diff mbox series

[v3,2/2] ARM: s3c24xx: Correct SD card write protect detection on Mini2440

Message ID 20180907215446.15160-2-sed@free.fr (mailing list archive)
State Accepted
Headers show
Series [v3,1/2] ARM: s3c24xx: formatting cleanup in mach-mini2440.c | expand

Commit Message

Cedric Roux Sept. 7, 2018, 9:54 p.m. UTC
The mini2440 computer uses "active high" to signal that the "write protect"
of the inserted MMC is set. The current code uses the opposite, leading to
a wrong detection of write protection. The solution is simply to use
".wprotect_invert = 1" in the description of the MMC.

Signed-off-by: Cedric Roux <sed@free.fr>
---
 arch/arm/mach-s3c24xx/mach-mini2440.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Krzysztof Kozlowski Sept. 10, 2018, 10:23 a.m. UTC | #1
On Fri, 7 Sep 2018 at 23:53, Cedric Roux <sed@free.fr> wrote:
>
> The mini2440 computer uses "active high" to signal that the "write protect"
> of the inserted MMC is set. The current code uses the opposite, leading to
> a wrong detection of write protection. The solution is simply to use
> ".wprotect_invert = 1" in the description of the MMC.
>
> Signed-off-by: Cedric Roux <sed@free.fr>
> ---
>  arch/arm/mach-s3c24xx/mach-mini2440.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
> index 4a0bf6abba8c..bfce7971d741 100644
> --- a/arch/arm/mach-s3c24xx/mach-mini2440.c
> +++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
> @@ -234,10 +234,11 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
>  /* MMC/SD  */
>
>  static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
> -       .gpio_detect   = S3C2410_GPG(8),
> -       .gpio_wprotect = S3C2410_GPH(8),
> -       .set_power     = NULL,
> -       .ocr_avail     = MMC_VDD_32_33|MMC_VDD_33_34,
> +       .gpio_detect     = S3C2410_GPG(8),
> +       .gpio_wprotect   = S3C2410_GPH(8),
> +       .wprotect_invert = 1,
> +       .set_power       = NULL,
> +       .ocr_avail       = MMC_VDD_32_33|MMC_VDD_33_34,

This looks unexpected... after patch 1 there should be only one change
- one new line added. What happened here?

Best regards,
Krzysztof
Cedric Roux Sept. 10, 2018, 4:55 p.m. UTC | #2
On 09/10/2018 12:23 PM, Krzysztof Kozlowski wrote:
>>  static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
>> -       .gpio_detect   = S3C2410_GPG(8),
>> -       .gpio_wprotect = S3C2410_GPH(8),
>> -       .set_power     = NULL,
>> -       .ocr_avail     = MMC_VDD_32_33|MMC_VDD_33_34,
>> +       .gpio_detect     = S3C2410_GPG(8),
>> +       .gpio_wprotect   = S3C2410_GPH(8),
>> +       .wprotect_invert = 1,
>> +       .set_power       = NULL,
>> +       .ocr_avail       = MMC_VDD_32_33|MMC_VDD_33_34,
> 
> This looks unexpected... after patch 1 there should be only one change
> - one new line added. What happened here?

This is to align all the '='.

These were spaces before the '=' so I also used spaces.
Should I put TABs instead? I looked in the coding style
and didn't find anything about this specific thing
(maybe I read too fast though).

And if this ends up unaligned because 'wprotect_invert'
requires a second TAB for the others, should I do a separate
commit?

Thanks.

Regards,
Cédric.
Krzysztof Kozlowski Sept. 10, 2018, 4:57 p.m. UTC | #3
On Mon, Sep 10, 2018 at 06:55:09PM +0200, Cedric Roux wrote:
> On 09/10/2018 12:23 PM, Krzysztof Kozlowski wrote:
> >>  static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
> >> -       .gpio_detect   = S3C2410_GPG(8),
> >> -       .gpio_wprotect = S3C2410_GPH(8),
> >> -       .set_power     = NULL,
> >> -       .ocr_avail     = MMC_VDD_32_33|MMC_VDD_33_34,
> >> +       .gpio_detect     = S3C2410_GPG(8),
> >> +       .gpio_wprotect   = S3C2410_GPH(8),
> >> +       .wprotect_invert = 1,
> >> +       .set_power       = NULL,
> >> +       .ocr_avail       = MMC_VDD_32_33|MMC_VDD_33_34,
> > 
> > This looks unexpected... after patch 1 there should be only one change
> > - one new line added. What happened here?
> 
> This is to align all the '='.
> 
> These were spaces before the '=' so I also used spaces.
> Should I put TABs instead? I looked in the coding style
> and didn't find anything about this specific thing
> (maybe I read too fast though).
> 
> And if this ends up unaligned because 'wprotect_invert'
> requires a second TAB for the others, should I do a separate
> commit?

Ah, I understand. It's okay, thanks!


Best regards,
Krzysztof
Krzysztof Kozlowski Sept. 10, 2018, 5:22 p.m. UTC | #4
On Fri, Sep 07, 2018 at 11:54:46PM +0200, Cedric Roux wrote:
> The mini2440 computer uses "active high" to signal that the "write protect"
> of the inserted MMC is set. The current code uses the opposite, leading to
> a wrong detection of write protection. The solution is simply to use
> ".wprotect_invert = 1" in the description of the MMC.
> 
> Signed-off-by: Cedric Roux <sed@free.fr>
> ---
>  arch/arm/mach-s3c24xx/mach-mini2440.c | 9 +++++----

Thanks, applied.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 4a0bf6abba8c..bfce7971d741 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -234,10 +234,11 @@  static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
 /* MMC/SD  */
 
 static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
-	.gpio_detect   = S3C2410_GPG(8),
-	.gpio_wprotect = S3C2410_GPH(8),
-	.set_power     = NULL,
-	.ocr_avail     = MMC_VDD_32_33|MMC_VDD_33_34,
+	.gpio_detect     = S3C2410_GPG(8),
+	.gpio_wprotect   = S3C2410_GPH(8),
+	.wprotect_invert = 1,
+	.set_power       = NULL,
+	.ocr_avail       = MMC_VDD_32_33|MMC_VDD_33_34,
 };
 
 /* NAND Flash on MINI2440 board */