Skip to contentSkip to conversation

ARM: davinci: GPIO look-up fixes for legacy boot

PATCH New Sekhar Nori 3 participants 14 messages Apr 24, 2018 – May 16, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ARM: davinci: GPIO look-up fixes for legacy boot

Hi,

I noticed that several GPIO lookup issues creeped up due to changes done in recent past. Here are fixes for these issues.

Tested on DM644x, DM355, DA830 and DA850 EVMs.

Sekhar Nori (4):
ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD
ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD
ARM: davinci: fix GPIO lookup for I2C
ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup

 arch/arm/mach-davinci/board-da830-evm.c     |  9 +++++++--
 arch/arm/mach-davinci/board-da850-evm.c     |  9 +++++++--
 arch/arm/mach-davinci/board-dm355-evm.c     |  6 +++---
 arch/arm/mach-davinci/board-dm644x-evm.c    |  6 +++---
 arch/arm/mach-davinci/board-omapl138-hawk.c | 10 +++++++---
 5 files changed, 27 insertions(+), 13 deletions(-)
Signature · 1 line
2.16.2
#1 lore raw

PATCH 1/4 ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that mmc can correctly lookup the wp and cp gpios. Also fix the GPIO numbers as they are not offsets within a bank.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Fixes b5e1438cf98a ("ARM: davinci: da830-evm: use gpio descriptor for mmc pins")
---
 arch/arm/mach-davinci/board-da830-evm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +7 -2
index 004f9c8de032..d1e8ce7b4bd2 100644
@@ -205,12 +205,17 @@ static const short da830_evm_mmc_sd_pins[] = {
 	-1
 };
 
+#define DA830_MMCSD_WP_PIN		GPIO_TO_PIN(2, 1)
+#define DA830_MMCSD_CD_PIN		GPIO_TO_PIN(2, 2)
+
 static struct gpiod_lookup_table mmc_gpios_table = {
 	.dev_id = "da830-mmc.0",
 	.table = {
 		/* gpio chip 1 contains gpio range 32-63 */
-		GPIO_LOOKUP("davinci_gpio.1", 2, "cd", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("davinci_gpio.1", 1, "wp", GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_CD_PIN, "cd",
+			    GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_WP_PIN, "wp",
+			    GPIO_ACTIVE_LOW),
 	},
 };
 
Signature · 1 line
2.16.2
#2 lore raw

PATCH 1/4 ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD

Quoted 29 lines · Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that mmc can correctly lookup the wp and cp gpios. Also fix the GPIO numbers as they are not offsets within a bank.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Fixes b5e1438cf98a ("ARM: davinci: da830-evm: use gpio descriptor for mmc pins")
---
  arch/arm/mach-davinci/board-da830-evm.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +3 -0
index 004f9c8de032..d1e8ce7b4bd2 100644
@@ -205,12 +205,17 @@ static const short da830_evm_mmc_sd_pins[] = {
  	-1
  };
 
+#define DA830_MMCSD_WP_PIN		GPIO_TO_PIN(2, 1)
+#define DA830_MMCSD_CD_PIN		GPIO_TO_PIN(2, 2)
+
  static struct gpiod_lookup_table mmc_gpios_table = {
  	.dev_id = "da830-mmc.0",
  	.table = {

arch/arm/mach-davinci/board-da830-evm.c static const short da830_evm_mmc_sd_pins[] = { · line 221

Quoted 10 lines
arch/arm/mach-davinci/board-da830-evm.c +4 -2
  		/* gpio chip 1 contains gpio range 32-63 */
-		GPIO_LOOKUP("davinci_gpio.1", 2, "cd", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("davinci_gpio.1", 1, "wp", GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_CD_PIN, "cd",
+			    GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_WP_PIN, "wp",
+			    GPIO_ACTIVE_LOW),
  	},
  };
 
#3 lore raw

PATCH 2/4 ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD

In reply to Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that mmc can correctly lookup the wp and cp gpios. Also fix the GPIO numbers as they are not offsets within a bank.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Fixes bdf0e8364fd3 ("ARM: davinci: da850-evm: use gpio descriptor for mmc pins")
---
 arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +7 -2
index 3063478bcc36..158ed9a1483f 100644
@@ -763,12 +763,17 @@ static const short da850_evm_mcasp_pins[] __initconst = {
 	-1
 };
 
+#define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
+#define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
+
 static struct gpiod_lookup_table mmc_gpios_table = {
 	.dev_id = "da830-mmc.0",
 	.table = {
 		/* gpio chip 2 contains gpio range 64-95 */
-		GPIO_LOOKUP("davinci_gpio.2", 0, "cd", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("davinci_gpio.2", 1, "wp", GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd",
+			    GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp",
+			    GPIO_ACTIVE_LOW),
 	},
 };
 
Signature · 1 line
2.16.2
#4 lore raw

PATCH 2/4 ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD

Quoted 28 lines · Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that mmc can correctly lookup the wp and cp gpios. Also fix the GPIO numbers as they are not offsets within a bank.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Fixes bdf0e8364fd3 ("ARM: davinci: da850-evm: use gpio descriptor for mmc pins")
---
  arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +3 -0
index 3063478bcc36..158ed9a1483f 100644
@@ -763,12 +763,17 @@ static const short da850_evm_mcasp_pins[] __initconst = {
  	-1
  };
 
+#define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
+#define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
+
  static struct gpiod_lookup_table mmc_gpios_table = {
  	.dev_id = "da830-mmc.0",
  	.table = {

arch/arm/mach-davinci/board-da850-evm.c static const short da850_evm_mcasp_pins[] __initconst = { · line 779

Quoted 10 lines
arch/arm/mach-davinci/board-da850-evm.c +4 -2
  		/* gpio chip 2 contains gpio range 64-95 */
-		GPIO_LOOKUP("davinci_gpio.2", 0, "cd", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("davinci_gpio.2", 1, "wp", GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd",
+			    GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp",
+			    GPIO_ACTIVE_LOW),
  	},
  };
 
#5 lore raw

PATCH 2/4 ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD

Quoted 30 lines · David Lechner
Quoted 29 lines · Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that mmc can correctly lookup the wp and cp gpios. Also fix the GPIO numbers as they are not offsets within a bank.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Fixes bdf0e8364fd3 ("ARM: davinci: da850-evm: use gpio descriptor for mmc

pins")

---
  arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +2 -0
index 3063478bcc36..158ed9a1483f 100644
@@ -763,12 +763,17 @@ static const short da850_evm_mcasp_pins[]
 __initconst = {
        -1
  };
  +#define DA850_MMCSD_CD_PIN           GPIO_TO_PIN(4, 0)
+#define DA850_MMCSD_WP_PIN             GPIO_TO_PIN(4, 1)
+
  static struct gpiod_lookup_table mmc_gpios_table = {
        .dev_id = "da830-mmc.0",
Quoted 8 lines

arch/arm/mach-davinci/board-da850-evm.c static const short da850_evm_mcasp_pins[] __initconst = { · line 776

Quoted 8 lines
arch/arm/mach-davinci/board-da850-evm.c +4 -2
        .table = {
                /* gpio chip 2 contains gpio range 64-95 */
-               GPIO_LOOKUP("davinci_gpio.2", 0, "cd", GPIO_ACTIVE_LOW),
-               GPIO_LOOKUP("davinci_gpio.2", 1, "wp", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd",
+                           GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp",
+                           GPIO_ACTIVE_LOW),

I don't think the WP polarity is working correctly. If I boot the board 'rw' enabled but WP disabled on the SD card, the system crashes. If I enable WP, the board boots correctly.

Comparing this to the device tree version that I did, and double checking the behavior for my sanity, I believe WP needs to be GPIO_ACTIVE_HIGH

adam

Quoted 7 lines

arch/arm/mach-davinci/board-da850-evm.c static const short da850_evm_mcasp_pins[] · line 778

Quoted 3 lines
arch/arm/mach-davinci/board-da850-evm.c +0 -0
        },
  };
#6 lore raw

PATCH 2/4 ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD

Quoted 44 lines · Adam Ford
Quoted 30 lines · David Lechner
Quoted 29 lines · Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that mmc can correctly lookup the wp and cp gpios. Also fix the GPIO numbers as they are not offsets within a bank.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Fixes bdf0e8364fd3 ("ARM: davinci: da850-evm: use gpio descriptor for mmc

pins")

---
  arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +2 -0
index 3063478bcc36..158ed9a1483f 100644
@@ -763,12 +763,17 @@ static const short da850_evm_mcasp_pins[]
 __initconst = {
        -1
  };
  +#define DA850_MMCSD_CD_PIN           GPIO_TO_PIN(4, 0)
+#define DA850_MMCSD_WP_PIN             GPIO_TO_PIN(4, 1)
+
  static struct gpiod_lookup_table mmc_gpios_table = {
        .dev_id = "da830-mmc.0",
Quoted 8 lines

arch/arm/mach-davinci/board-da850-evm.c static const short da850_evm_mcasp_pins[] __initconst = { · line 776

Quoted 8 lines
arch/arm/mach-davinci/board-da850-evm.c +4 -2
        .table = {
                /* gpio chip 2 contains gpio range 64-95 */
-               GPIO_LOOKUP("davinci_gpio.2", 0, "cd", GPIO_ACTIVE_LOW),
-               GPIO_LOOKUP("davinci_gpio.2", 1, "wp", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd",
+                           GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp",
+                           GPIO_ACTIVE_LOW),

I don't think the WP polarity is working correctly. If I boot the board 'rw' enabled but WP disabled on the SD card, the system crashes. If I enable WP, the board boots correctly.

Quoted 3 lines

Comparing this to the device tree version that I did, and double checking the behavior for my sanity, I believe WP needs to be GPIO_ACTIVE_HIGH

You are right, I see the issue on my board too. Although this patch did not touch the polarity, we could have fixed it here.

Anyway, do you want to send a patch for that? Or I can do it too. A similar fix is needed for DA830 EVM too.

Thanks,
Sekhar

#7 lore raw

PATCH 2/4 ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD

Quoted 49 lines · Sekhar Nori
Quoted 44 lines · Adam Ford
Quoted 30 lines · David Lechner
Quoted 29 lines · Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that mmc can correctly lookup the wp and cp gpios. Also fix the GPIO numbers as they are not offsets within a bank.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Fixes bdf0e8364fd3 ("ARM: davinci: da850-evm: use gpio descriptor for mmc

pins")

---
  arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +2 -0
index 3063478bcc36..158ed9a1483f 100644
@@ -763,12 +763,17 @@ static const short da850_evm_mcasp_pins[]
 __initconst = {
        -1
  };
  +#define DA850_MMCSD_CD_PIN           GPIO_TO_PIN(4, 0)
+#define DA850_MMCSD_WP_PIN             GPIO_TO_PIN(4, 1)
+
  static struct gpiod_lookup_table mmc_gpios_table = {
        .dev_id = "da830-mmc.0",
Quoted 8 lines

arch/arm/mach-davinci/board-da850-evm.c static const short da850_evm_mcasp_pins[] __initconst = { · line 776

Quoted 8 lines
arch/arm/mach-davinci/board-da850-evm.c +4 -2
        .table = {
                /* gpio chip 2 contains gpio range 64-95 */
-               GPIO_LOOKUP("davinci_gpio.2", 0, "cd", GPIO_ACTIVE_LOW),
-               GPIO_LOOKUP("davinci_gpio.2", 1, "wp", GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd",
+                           GPIO_ACTIVE_LOW),
+               GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp",
+                           GPIO_ACTIVE_LOW),

I don't think the WP polarity is working correctly. If I boot the board 'rw' enabled but WP disabled on the SD card, the system crashes. If I enable WP, the board boots correctly.

Quoted 3 lines

Comparing this to the device tree version that I did, and double checking the behavior for my sanity, I believe WP needs to be GPIO_ACTIVE_HIGH

Quoted 5 lines

You are right, I see the issue on my board too. Although this patch did not touch the polarity, we could have fixed it here.

Anyway, do you want to send a patch for that? Or I can do it too. A similar fix is needed for DA830 EVM too.

I don't have a DA830, so if I do a patch, it will be limited to the DA850-evm. I can submit a patch later this afternoon, but if you have time and want to do both at the same time, go head.

adam

Quoted 3 lines

Thanks,
Sekhar

#8 lore raw

PATCH 3/4 ARM: davinci: fix GPIO lookup for I2C

In reply to Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that I2C can correctly lookup the recovery gpios.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Also, the I2C device uses an id of 1 on DM644x and DM355.

Fixes e53537653791 ("i2c/ARM: davinci: Deep refactoring of I2C recovery")
---
 arch/arm/mach-davinci/board-dm355-evm.c  | 6 +++---
 arch/arm/mach-davinci/board-dm644x-evm.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-davinci/board-dm355-evm.c +3 -3
index cb30637d9eaf..14557f893798 100644
@@ -110,11 +110,11 @@ static struct platform_device davinci_nand_device = {
 };
 
 static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
-	.dev_id = "i2c_davinci",
+	.dev_id = "i2c_davinci.1",
 	.table = {
-		GPIO_LOOKUP("davinci_gpio", 15, "sda",
+		GPIO_LOOKUP("davinci_gpio.0", 15, "sda",
 			    GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
-		GPIO_LOOKUP("davinci_gpio", 14, "scl",
+		GPIO_LOOKUP("davinci_gpio.0", 14, "scl",
 			    GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
 	},
 };
arch/arm/mach-davinci/board-dm644x-evm.c +3 -3
index 5bf024784738..5b0b95e04cac 100644
@@ -597,11 +597,11 @@ static struct i2c_board_info __initdata i2c_info[] =  {
 };
 
 static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
-	.dev_id = "i2c_davinci",
+	.dev_id = "i2c_davinci.1",
 	.table = {
-		GPIO_LOOKUP("davinci_gpio", 44, "sda",
+		GPIO_LOOKUP("davinci_gpio.0", 44, "sda",
 			    GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
-		GPIO_LOOKUP("davinci_gpio", 43, "scl",
+		GPIO_LOOKUP("davinci_gpio.0", 43, "scl",
 			    GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
 	},
 };
Signature · 1 line
2.16.2
#9 lore raw

PATCH 3/4 ARM: davinci: fix GPIO lookup for I2C

Quoted 44 lines · Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that I2C can correctly lookup the recovery gpios.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Also, the I2C device uses an id of 1 on DM644x and DM355.

Fixes e53537653791 ("i2c/ARM: davinci: Deep refactoring of I2C recovery")
---
  arch/arm/mach-davinci/board-dm355-evm.c  | 6 +++---
  arch/arm/mach-davinci/board-dm644x-evm.c | 6 +++---
  2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-davinci/board-dm355-evm.c +3 -3
index cb30637d9eaf..14557f893798 100644
@@ -110,11 +110,11 @@ static struct platform_device davinci_nand_device = {
  };
 
  static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
-	.dev_id = "i2c_davinci",
+	.dev_id = "i2c_davinci.1",
  	.table = {
-		GPIO_LOOKUP("davinci_gpio", 15, "sda",
+		GPIO_LOOKUP("davinci_gpio.0", 15, "sda",
  			    GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
-		GPIO_LOOKUP("davinci_gpio", 14, "scl",
+		GPIO_LOOKUP("davinci_gpio.0", 14, "scl",
  			    GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
  	},
  };
arch/arm/mach-davinci/board-dm644x-evm.c +0 -1
index 5bf024784738..5b0b95e04cac 100644
@@ -597,11 +597,11 @@ static struct i2c_board_info __initdata i2c_info[] =  {
  };
 
  static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
-	.dev_id = "i2c_davinci",

arch/arm/mach-davinci/board-dm644x-evm.c static struct i2c_board_info __initdata i2c_info[] = { · line 607

Quoted 10 lines
arch/arm/mach-davinci/board-dm644x-evm.c +3 -2
+	.dev_id = "i2c_davinci.1",
  	.table = {
-		GPIO_LOOKUP("davinci_gpio", 44, "sda",
+		GPIO_LOOKUP("davinci_gpio.0", 44, "sda",
  			    GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
-		GPIO_LOOKUP("davinci_gpio", 43, "scl",
+		GPIO_LOOKUP("davinci_gpio.0", 43, "scl",
  			    GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
  	},
  };

Why not use the GPIO_TO_PIN() macro like the previous patches?

#10 lore raw

PATCH 3/4 ARM: davinci: fix GPIO lookup for I2C

Quoted 52 lines · David Lechner
Quoted 51 lines · Sekhar Nori

The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that I2C can correctly lookup the recovery gpios.

Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.

Also, the I2C device uses an id of 1 on DM644x and DM355.

Fixes e53537653791 ("i2c/ARM: davinci: Deep refactoring of I2C

recovery")

---
? arch/arm/mach-davinci/board-dm355-evm.c? | 6 +++--- ? arch/arm/mach-davinci/board-dm644x-evm.c | 6 +++--- ? 2 files changed, 6 insertions(+), 6 deletions(-)

arch/arm/mach-davinci/board-dm355-evm.c +3 -3
index cb30637d9eaf..14557f893798 100644
@@ -110,11 +110,11 @@ static struct platform_device
 davinci_nand_device = {
 ? };
 ? ? static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
-??? .dev_id = "i2c_davinci",
+??? .dev_id = "i2c_davinci.1",
 ????? .table = {
-??????? GPIO_LOOKUP("davinci_gpio", 15, "sda",
+??????? GPIO_LOOKUP("davinci_gpio.0", 15, "sda",
 ????????????????? GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
-??????? GPIO_LOOKUP("davinci_gpio", 14, "scl",
+??????? GPIO_LOOKUP("davinci_gpio.0", 14, "scl",
 ????????????????? GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
 ????? },
 ? };
arch/arm/mach-davinci/board-dm644x-evm.c +2 -2
index 5bf024784738..5b0b95e04cac 100644
@@ -597,11 +597,11 @@ static struct i2c_board_info __initdata
 i2c_info[] =? {
 ? };
 ? ? static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
-??? .dev_id = "i2c_davinci",
+??? .dev_id = "i2c_davinci.1",
 ????? .table = {
-??????? GPIO_LOOKUP("davinci_gpio", 44, "sda",
+??????? GPIO_LOOKUP("davinci_gpio.0", 44, "sda",
 ????????????????? GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
Quoted 8 lines

arch/arm/mach-davinci/board-dm644x-evm.c static struct i2c_board_info __initdata · line 607

Quoted 6 lines
arch/arm/mach-davinci/board-dm644x-evm.c +1 -1
-??????? GPIO_LOOKUP("davinci_gpio", 43, "scl",
+??????? GPIO_LOOKUP("davinci_gpio.0", 43, "scl",
 ????????????????? GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
 ????? },
 ? };

Why not use the GPIO_TO_PIN() macro like the previous patches?

I was just following the existing style. But, yes, I can fix that up.

Thanks,,
Sekhar

#11 lore raw

PATCH 4/4 ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup

In reply to Sekhar Nori

commit c4dc56be7e26 ("ARM: davinci: fix the GPIO lookup for omapl138-hawk") fixed the GPIO chip name for look-up of MMC/SD CD and WP pins, but forgot to change the GPIO numbers passed.

The GPIO numbers are not offsets from within a 32 GPIO bank. Fix the GPIO numbers as well as remove the misleading comment.

Fixes c4dc56be7e26 ("ARM: davinci: fix the GPIO lookup for omapl138-hawk")
---
 arch/arm/mach-davinci/board-omapl138-hawk.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +7 -3
index 0d32042b728f..be8b892a6ea7 100644
@@ -123,12 +123,16 @@ static const short hawk_mmcsd0_pins[] = {
 	-1
 };
 
+#define DA850_HAWK_MMCSD_CD_PIN		GPIO_TO_PIN(3, 12)
+#define DA850_HAWK_MMCSD_WP_PIN		GPIO_TO_PIN(3, 13)
+
 static struct gpiod_lookup_table mmc_gpios_table = {
 	.dev_id = "da830-mmc.0",
 	.table = {
-		/* CD: gpio3_12: gpio60: chip 1 contains gpio range 32-63*/
-		GPIO_LOOKUP("davinci_gpio.0", 28, "cd", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("davinci_gpio.0", 29, "wp", GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_CD_PIN, "cd",
+			    GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_WP_PIN, "wp",
+			    GPIO_ACTIVE_LOW),
 	},
 };
 
Signature · 1 line
2.16.2
#12 lore raw

PATCH 4/4 ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup

Quoted 28 lines · Sekhar Nori

commit c4dc56be7e26 ("ARM: davinci: fix the GPIO lookup for omapl138-hawk") fixed the GPIO chip name for look-up of MMC/SD CD and WP pins, but forgot to change the GPIO numbers passed.

The GPIO numbers are not offsets from within a 32 GPIO bank. Fix the GPIO numbers as well as remove the misleading comment.

Fixes c4dc56be7e26 ("ARM: davinci: fix the GPIO lookup for omapl138-hawk")
---
  arch/arm/mach-davinci/board-omapl138-hawk.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +3 -0
index 0d32042b728f..be8b892a6ea7 100644
@@ -123,12 +123,16 @@ static const short hawk_mmcsd0_pins[] = {
  	-1
  };
 
+#define DA850_HAWK_MMCSD_CD_PIN		GPIO_TO_PIN(3, 12)
+#define DA850_HAWK_MMCSD_WP_PIN		GPIO_TO_PIN(3, 13)
+
  static struct gpiod_lookup_table mmc_gpios_table = {
  	.dev_id = "da830-mmc.0",
  	.table = {

arch/arm/mach-davinci/board-omapl138-hawk.c static const short hawk_mmcsd0_pins[] = { · line 138

Quoted 10 lines
arch/arm/mach-davinci/board-omapl138-hawk.c +4 -3
-		/* CD: gpio3_12: gpio60: chip 1 contains gpio range 32-63*/
-		GPIO_LOOKUP("davinci_gpio.0", 28, "cd", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("davinci_gpio.0", 29, "wp", GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_CD_PIN, "cd",
+			    GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_WP_PIN, "wp",
+			    GPIO_ACTIVE_LOW),
  	},
  };
 
#13 lore raw

cover ARM: davinci: GPIO look-up fixes for legacy boot

In reply to Sekhar Nori
Quoted 7 lines · Sekhar Nori

Hi,

I noticed that several GPIO lookup issues creeped up due to changes done in recent past. Here are fixes for these issues.

Tested on DM644x, DM355, DA830 and DA850 EVMs.

Patches except 3/4 applied.

Thanks,
Sekhar