[Qemu-devel] [PATCH v3] sdhci: add i.MX SD Stable Clock bit

Hans-Erik Floryd posted 1 patch 7 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1534507843-4251-1-git-send-email-hans-erik.floryd@rt-labs.com
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test docker-quick@centos7 passed
hw/sd/sdhci-internal.h | 2 ++
hw/sd/sdhci.c          | 8 ++++++++
2 files changed, 10 insertions(+)
[Qemu-devel] [PATCH v3] sdhci: add i.MX SD Stable Clock bit
Posted by Hans-Erik Floryd 7 years, 2 months ago
Add the ESDHC PRSSTAT_SDSTB bit, using the value of SDHC_CLOCK_INT_STABLE.
Freescale recommends checking this bit when changing clock frequency.

Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
---
 hw/sd/sdhci-internal.h | 2 ++
 hw/sd/sdhci.c          | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/hw/sd/sdhci-internal.h b/hw/sd/sdhci-internal.h
index 756ef3f..19665fd 100644
--- a/hw/sd/sdhci-internal.h
+++ b/hw/sd/sdhci-internal.h
@@ -302,4 +302,6 @@ extern const VMStateDescription sdhci_vmstate;
 #define ESDHC_CTRL_4BITBUS              (0x1 << 1)
 #define ESDHC_CTRL_8BITBUS              (0x2 << 1)
 
+#define ESDHC_PRNSTS_SDSTB              (1 << 3)
+
 #endif
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 8f58c31..5201f3c 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1651,6 +1651,14 @@ static uint64_t usdhc_read(void *opaque, hwaddr offset, unsigned size)
 
         break;
 
+    case SDHC_PRNSTS:
+       /* Add SDSTB (SD Clock Stable) bit to PRNSTS */
+       ret = sdhci_read(opaque, offset, size) & ~ESDHC_PRNSTS_SDSTB;
+       if (s->clkcon & SDHC_CLOCK_INT_STABLE) {
+            ret |= ESDHC_PRNSTS_SDSTB;
+       }
+       break;
+
     case ESDHC_DLL_CTRL:
     case ESDHC_TUNE_CTRL_STATUS:
     case ESDHC_UNDOCUMENTED_REG27:
-- 
2.7.4


Re: [Qemu-devel] [PATCH v3] sdhci: add i.MX SD Stable Clock bit
Posted by Peter Maydell 7 years, 2 months ago
On 17 August 2018 at 13:10, Hans-Erik Floryd
<hans-erik.floryd@rt-labs.com> wrote:
> Add the ESDHC PRSSTAT_SDSTB bit, using the value of SDHC_CLOCK_INT_STABLE.
> Freescale recommends checking this bit when changing clock frequency.
>
> Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
> ---
>  hw/sd/sdhci-internal.h | 2 ++
>  hw/sd/sdhci.c          | 8 ++++++++
>  2 files changed, 10 insertions(+)

Applied to target-arm.next, thanks.

(Your indentation was off-by-one -- we use 4-space indent -- but I fixed that.)

-- PMM

Re: [Qemu-devel] [PATCH v3] sdhci: add i.MX SD Stable Clock bit
Posted by Hans-Erik Floryd 7 years, 2 months ago
Den fre 17 aug 2018 19:51Peter Maydell <peter.maydell@linaro.org> skrev

> (Your indentation was off-by-one -- we use 4-space indent -- but I fixed
> that.)

-- PMM
>

Thanks! I think i fixed that in a new patch so please ignore v3.

/Hans-Erik Floryd

>
Re: [Qemu-devel] [PATCH v3] sdhci: add i.MX SD Stable Clock bit
Posted by Peter Maydell 7 years, 2 months ago
On 17 August 2018 at 18:56, Hans-Erik Floryd
<hans-erik.floryd@rt-labs.com> wrote:
>
>
> Den fre 17 aug 2018 19:51Peter Maydell <peter.maydell@linaro.org> skrev
>>
>> (Your indentation was off-by-one -- we use 4-space indent -- but I fixed
>> that.)
>>
>> -- PMM
>
>
> Thanks! I think i fixed that in a new patch so please ignore v3.

You don't need to resend, I've already taken this version with a fixup.

-- PMM