Possible bug in s5p_sdhci.c
The use of SDHCI_CTRL2_SELBASECLK_SHIFT in s5p_sdhci_set_control_reg() seems wrong, because a shifting offset is being used as a mask, not to generate a mask.
It's unclear what the original intent was. Below is my suggested fix.
What think ye?
Matt
drivers/mmc/s5p_sdhci.c +1 -1
@@ -30,7 +30,7 @@ static void s5p_sdhci_set_control_reg(struct sdhci_host *host)sdhci_writel (host,SDHCI_CTRL4_DRIVE_MASK (0x3 ),SDHCI_CONTROL4 ); val =sdhci_readl (host,SDHCI_CONTROL2 ); - val &=SDHCI_CTRL2_SELBASECLK_SHIFT ; + val &=SDHCI_CTRL2_SELBASECLK_MASK (3 ); val |=SDHCI_CTRL2_ENSTAASYNCCLR | SDHCI_CTRL2_ENCMDCNFMSK |
Hi Matt,
Quoted 19 lines · Matt Reimer
The use of
SDHCI_CTRL2_SELBASECLK_SHIFTins5p_sdhci_set_control_reg()seems wrong, because a shifting offset is being used as a mask, not to generate a mask.It's unclear what the original intent was. Below is my suggested fix.
What think ye?
Matt
drivers/mmc/s5p_sdhci.c +0
-0
drivers/mmc/s5p_sdhci.c static void s5p_sdhci_set_control_reg(struct sdhci_host *host) · line 36
Quoted 8 lines
drivers/mmc/s5p_sdhci.c +1
-1@@ -30,7 +30,7 @@ static void s5p_sdhci_set_control_reg(struct sdhci_host *host)sdhci_writel (host,SDHCI_CTRL4_DRIVE_MASK (0x3 ),SDHCI_CONTROL4 ); val =sdhci_readl (host,SDHCI_CONTROL2 ); - val &=SDHCI_CTRL2_SELBASECLK_SHIFT ; + val &=SDHCI_CTRL2_SELBASECLK_MASK (3 ); val |=SDHCI_CTRL2_ENSTAASYNCCLR | SDHCI_CTRL2_ENCMDCNFMSK |
At first glance it seems you?re right. Please prepare a proper patch. CCing Jaehoon?
Regards
? Pantelis
PATCH 1/1 mmc: s5p: properly mask SELBASECLK
Properly mask SELBASECLK by using an actual mask rather than the number of bits to shift in order to create the mask.
--- drivers/mmc/s5p_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/s5p_sdhci.c +1 -1
@@ -30,7 +30,7 @@ static void s5p_sdhci_set_control_reg(struct sdhci_host *host)sdhci_writel (host,SDHCI_CTRL4_DRIVE_MASK (0x3 ),SDHCI_CONTROL4 ); val =sdhci_readl (host,SDHCI_CONTROL2 ); - val &=SDHCI_CTRL2_SELBASECLK_SHIFT ; + val &=SDHCI_CTRL2_SELBASECLK_MASK (3 ); val |=SDHCI_CTRL2_ENSTAASYNCCLR | SDHCI_CTRL2_ENCMDCNFMSK |
Signature · 1 line
1.7.9.5
PATCH 1/1 mmc: s5p: properly mask SELBASECLK
Hi, Matt.
You're right, it's wrong masking.
Best Regards,
Jaehoon Chung
Quoted 22 lines · Matt Reimer
Properly mask SELBASECLK by using an actual mask rather than the number of bits to shift in order to create the mask.
Signed-off-by Matt Reimer <[email protected]>--- drivers/mmc/s5p_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/s5p_sdhci.c +1
-1@@ -30,7 +30,7 @@ static void s5p_sdhci_set_control_reg(struct sdhci_host *host)sdhci_writel (host,SDHCI_CTRL4_DRIVE_MASK (0x3 ),SDHCI_CONTROL4 ); val =sdhci_readl (host,SDHCI_CONTROL2 ); - val &=SDHCI_CTRL2_SELBASECLK_SHIFT ; + val &=SDHCI_CTRL2_SELBASECLK_MASK (3 ); val |=SDHCI_CTRL2_ENSTAASYNCCLR | SDHCI_CTRL2_ENCMDCNFMSK |
PATCH 1/1 mmc: s5p: properly mask SELBASECLK
In reply to Matt ReimerQuoted 21 lines · Matt Reimer
Properly mask SELBASECLK by using an actual mask rather than the number of bits to shift in order to create the mask.
Signed-off-by Matt Reimer <[email protected]>--- drivers/mmc/s5p_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/s5p_sdhci.c +1
-1@@ -30,7 +30,7 @@ static void s5p_sdhci_set_control_reg(struct sdhci_host *host)sdhci_writel (host,SDHCI_CTRL4_DRIVE_MASK (0x3 ),SDHCI_CONTROL4 ); val =sdhci_readl (host,SDHCI_CONTROL2 ); - val &=SDHCI_CTRL2_SELBASECLK_SHIFT ; + val &=SDHCI_CTRL2_SELBASECLK_MASK (3 ); val |= SDHCI_CTRL2_ENSTAASYNCCLR |
Quoted 5 lines
SDHCI_CTRL2_ENCMDCNFMSK|
--
1.7.9.5
ping
Pantelis Antoniou
AppliedPATCH 1/1 mmc: s5p: properly mask SELBASECLK
In reply to Matt ReimerHi Matt,
Quoted 26 lines · Matt Reimer
Properly mask SELBASECLK by using an actual mask rather than the number of bits to shift in order to create the mask.
Signed-off-by Matt Reimer <[email protected]>---
drivers/mmc/s5p_sdhci.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/s5p_sdhci.c +1
-1@@ -30,7 +30,7 @@ static void s5p_sdhci_set_control_reg(struct sdhci_host *host)sdhci_writel (host,SDHCI_CTRL4_DRIVE_MASK (0x3 ),SDHCI_CONTROL4 ); val =sdhci_readl (host,SDHCI_CONTROL2 ); - val &=SDHCI_CTRL2_SELBASECLK_SHIFT ; + val &=SDHCI_CTRL2_SELBASECLK_MASK (3 ); val |=SDHCI_CTRL2_ENSTAASYNCCLR | SDHCI_CTRL2_ENCMDCNFMSK |Signature · 1 line
1.7.9.5
Thanks, applied.
? Pantelis