* [U-Boot] Possible bug in sdhci.c
@ 2015-02-19 18:33 Matt Reimer
2015-02-23 17:57 ` Pantelis Antoniou
0 siblings, 1 reply; 6+ messages in thread
From: Matt Reimer @ 2015-02-19 18:33 UTC (permalink / raw)
To: u-boot
In sdhci_init() a writel() is used on a byte-sized register, which would clobber the adjacent registers. Below is my suggested fix. If it looks correct, I can submit a proper patch.
Matt
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 82d7984..1f8917b 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)
if (host->quirks & SDHCI_QUIRK_NO_CD) {
unsigned int status;
- sdhci_writel(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
+ sdhci_writeb(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
SDHCI_HOST_CONTROL);
status = sdhci_readl(host, SDHCI_PRESENT_STATE);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] Possible bug in sdhci.c
2015-02-19 18:33 [U-Boot] Possible bug in sdhci.c Matt Reimer
@ 2015-02-23 17:57 ` Pantelis Antoniou
2015-02-23 21:56 ` [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers Matt Reimer
0 siblings, 1 reply; 6+ messages in thread
From: Pantelis Antoniou @ 2015-02-23 17:57 UTC (permalink / raw)
To: u-boot
Hi Matt,
> On Feb 19, 2015, at 20:33 , Matt Reimer <mreimer@sdgsystems.com> wrote:
>
> In sdhci_init() a writel() is used on a byte-sized register, which would clobber the adjacent registers. Below is my suggested fix. If it looks correct, I can submit a proper patch.
>
> Matt
>
>
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 82d7984..1f8917b 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)
> if (host->quirks & SDHCI_QUIRK_NO_CD) {
> unsigned int status;
>
> - sdhci_writel(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
> + sdhci_writeb(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
> SDHCI_HOST_CONTROL);
>
> status = sdhci_readl(host, SDHCI_PRESENT_STATE);
>
Correct again. Please send a proper patch.
Regards
? Pantelis
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers
2015-02-23 17:57 ` Pantelis Antoniou
@ 2015-02-23 21:56 ` Matt Reimer
2015-03-02 18:31 ` Matt Reimer
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Matt Reimer @ 2015-02-23 21:56 UTC (permalink / raw)
To: u-boot
SDHCI_HOST_CONTROL is a byte-sized register, so don't write to it
as if it were a long, as that would result in clobbering the three
registers following.
Signed-off-by: Matt Reimer <mreimer@sdgsystems.com>
---
drivers/mmc/sdhci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 82d7984..1f8917b 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)
if (host->quirks & SDHCI_QUIRK_NO_CD) {
unsigned int status;
- sdhci_writel(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
+ sdhci_writeb(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
SDHCI_HOST_CONTROL);
status = sdhci_readl(host, SDHCI_PRESENT_STATE);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers
2015-02-23 21:56 ` [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers Matt Reimer
@ 2015-03-02 18:31 ` Matt Reimer
2015-03-02 18:31 ` Pantelis Antoniou
2015-03-18 7:53 ` Pantelis Antoniou
2 siblings, 0 replies; 6+ messages in thread
From: Matt Reimer @ 2015-03-02 18:31 UTC (permalink / raw)
To: u-boot
On Mon, Feb 23, 2015 at 2:56 PM, Matt Reimer <mreimer@sdgsystems.com> wrote:
> SDHCI_HOST_CONTROL is a byte-sized register, so don't write to it
> as if it were a long, as that would result in clobbering the three
> registers following.
>
> Signed-off-by: Matt Reimer <mreimer@sdgsystems.com>
> ---
> drivers/mmc/sdhci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 82d7984..1f8917b 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)
> if (host->quirks & SDHCI_QUIRK_NO_CD) {
> unsigned int status;
>
> - sdhci_writel(host, SDHCI_CTRL_CD_TEST_INS |
> SDHCI_CTRL_CD_TEST,
> + sdhci_writeb(host, SDHCI_CTRL_CD_TEST_INS |
> SDHCI_CTRL_CD_TEST,
> SDHCI_HOST_CONTROL);
>
> status = sdhci_readl(host, SDHCI_PRESENT_STATE);
> --
> 1.7.9.5
>
>
ping
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers
2015-02-23 21:56 ` [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers Matt Reimer
2015-03-02 18:31 ` Matt Reimer
@ 2015-03-02 18:31 ` Pantelis Antoniou
2015-03-18 7:53 ` Pantelis Antoniou
2 siblings, 0 replies; 6+ messages in thread
From: Pantelis Antoniou @ 2015-03-02 18:31 UTC (permalink / raw)
To: u-boot
Hi Matt,
> On Feb 23, 2015, at 23:56 , Matt Reimer <mreimer@sdgsystems.com> wrote:
>
> SDHCI_HOST_CONTROL is a byte-sized register, so don't write to it
> as if it were a long, as that would result in clobbering the three
> registers following.
>
> Signed-off-by: Matt Reimer <mreimer@sdgsystems.com>
> ---
> drivers/mmc/sdhci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 82d7984..1f8917b 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)
> if (host->quirks & SDHCI_QUIRK_NO_CD) {
> unsigned int status;
>
> - sdhci_writel(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
> + sdhci_writeb(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
> SDHCI_HOST_CONTROL);
>
> status = sdhci_readl(host, SDHCI_PRESENT_STATE);
> --
> 1.7.9.5
>
The patch is obviously correct and I?ll pick it up for my next pull-req.
Relax :)
Regards
? Pantelis
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers
2015-02-23 21:56 ` [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers Matt Reimer
2015-03-02 18:31 ` Matt Reimer
2015-03-02 18:31 ` Pantelis Antoniou
@ 2015-03-18 7:53 ` Pantelis Antoniou
2 siblings, 0 replies; 6+ messages in thread
From: Pantelis Antoniou @ 2015-03-18 7:53 UTC (permalink / raw)
To: u-boot
Hi Matt,
> On Feb 23, 2015, at 23:56 , Matt Reimer <mreimer@sdgsystems.com> wrote:
>
> SDHCI_HOST_CONTROL is a byte-sized register, so don't write to it
> as if it were a long, as that would result in clobbering the three
> registers following.
>
> Signed-off-by: Matt Reimer <mreimer@sdgsystems.com>
> ---
> drivers/mmc/sdhci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 82d7984..1f8917b 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -412,7 +412,7 @@ static int sdhci_init(struct mmc *mmc)
> if (host->quirks & SDHCI_QUIRK_NO_CD) {
> unsigned int status;
>
> - sdhci_writel(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
> + sdhci_writeb(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
> SDHCI_HOST_CONTROL);
>
> status = sdhci_readl(host, SDHCI_PRESENT_STATE);
> --
> 1.7.9.5
>
Thanks, applied.
? Pantelis
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-18 7:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-19 18:33 [U-Boot] Possible bug in sdhci.c Matt Reimer
2015-02-23 17:57 ` Pantelis Antoniou
2015-02-23 21:56 ` [U-Boot] [PATCH] mmc: sdhci: don't clobber adjacent registers Matt Reimer
2015-03-02 18:31 ` Matt Reimer
2015-03-02 18:31 ` Pantelis Antoniou
2015-03-18 7:53 ` Pantelis Antoniou
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.