All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot
@ 2018-04-24 14:35 Sekhar Nori
  2018-04-24 14:35 ` [PATCH 1/4] ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD Sekhar Nori
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Sekhar Nori @ 2018-04-24 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

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(-)

-- 
2.16.2

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/4] ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD
  2018-04-24 14:35 [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori
@ 2018-04-24 14:35 ` Sekhar Nori
  2018-04-27  1:39   ` David Lechner
  2018-04-24 14:35 ` [PATCH 2/4] ARM: davinci: board-da850-evm: " Sekhar Nori
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Sekhar Nori @ 2018-04-24 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

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")
Reported-by: David Lechner <david@lechnology.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 arch/arm/mach-davinci/board-da830-evm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 004f9c8de032..d1e8ce7b4bd2 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -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),
 	},
 };
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD
  2018-04-24 14:35 [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori
  2018-04-24 14:35 ` [PATCH 1/4] ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD Sekhar Nori
@ 2018-04-24 14:35 ` Sekhar Nori
  2018-04-27  1:40   ` David Lechner
  2018-04-24 14:35 ` [PATCH 3/4] ARM: davinci: fix GPIO lookup for I2C Sekhar Nori
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Sekhar Nori @ 2018-04-24 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

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")
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 3063478bcc36..158ed9a1483f 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -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),
 	},
 };
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/4] ARM: davinci: fix GPIO lookup for I2C
  2018-04-24 14:35 [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori
  2018-04-24 14:35 ` [PATCH 1/4] ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD Sekhar Nori
  2018-04-24 14:35 ` [PATCH 2/4] ARM: davinci: board-da850-evm: " Sekhar Nori
@ 2018-04-24 14:35 ` Sekhar Nori
  2018-04-27  1:43   ` David Lechner
  2018-04-24 14:35 ` [PATCH 4/4] ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup Sekhar Nori
  2018-05-01 12:16 ` [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori
  4 siblings, 1 reply; 14+ messages in thread
From: Sekhar Nori @ 2018-04-24 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

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")
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 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(-)

diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index cb30637d9eaf..14557f893798 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -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),
 	},
 };
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 5bf024784738..5b0b95e04cac 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -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),
 	},
 };
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup
  2018-04-24 14:35 [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori
                   ` (2 preceding siblings ...)
  2018-04-24 14:35 ` [PATCH 3/4] ARM: davinci: fix GPIO lookup for I2C Sekhar Nori
@ 2018-04-24 14:35 ` Sekhar Nori
  2018-04-27  1:58   ` David Lechner
  2018-05-01 12:16 ` [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori
  4 siblings, 1 reply; 14+ messages in thread
From: Sekhar Nori @ 2018-04-24 14:35 UTC (permalink / raw)
  To: linux-arm-kernel

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")
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 arch/arm/mach-davinci/board-omapl138-hawk.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index 0d32042b728f..be8b892a6ea7 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -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),
 	},
 };
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 1/4] ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD
  2018-04-24 14:35 ` [PATCH 1/4] ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD Sekhar Nori
@ 2018-04-27  1:39   ` David Lechner
  0 siblings, 0 replies; 14+ messages in thread
From: David Lechner @ 2018-04-27  1:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 04/24/2018 09:35 AM, Sekhar Nori wrote:
> 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")
> Reported-by: David Lechner <david@lechnology.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
>   arch/arm/mach-davinci/board-da830-evm.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index 004f9c8de032..d1e8ce7b4bd2 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -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),
>   	},
>   };
>   
> 

Reviewed-by: David Lechner <david@lechnology.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD
  2018-04-24 14:35 ` [PATCH 2/4] ARM: davinci: board-da850-evm: " Sekhar Nori
@ 2018-04-27  1:40   ` David Lechner
  2018-05-15 22:53     ` Adam Ford
  0 siblings, 1 reply; 14+ messages in thread
From: David Lechner @ 2018-04-27  1:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 04/24/2018 09:35 AM, Sekhar Nori wrote:
> 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")
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
>   arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 3063478bcc36..158ed9a1483f 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -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),
>   	},
>   };
>   
> 

Reviewed-by: David Lechner <david@lechnology.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/4] ARM: davinci: fix GPIO lookup for I2C
  2018-04-24 14:35 ` [PATCH 3/4] ARM: davinci: fix GPIO lookup for I2C Sekhar Nori
@ 2018-04-27  1:43   ` David Lechner
  2018-05-01 11:36     ` Sekhar Nori
  0 siblings, 1 reply; 14+ messages in thread
From: David Lechner @ 2018-04-27  1:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 04/24/2018 09:35 AM, Sekhar Nori wrote:
> 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")
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
>   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(-)
> 
> diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
> index cb30637d9eaf..14557f893798 100644
> --- a/arch/arm/mach-davinci/board-dm355-evm.c
> +++ b/arch/arm/mach-davinci/board-dm355-evm.c
> @@ -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),
>   	},
>   };
> diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
> index 5bf024784738..5b0b95e04cac 100644
> --- a/arch/arm/mach-davinci/board-dm644x-evm.c
> +++ b/arch/arm/mach-davinci/board-dm644x-evm.c
> @@ -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),
>   	},
>   };
> 

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/4] ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup
  2018-04-24 14:35 ` [PATCH 4/4] ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup Sekhar Nori
@ 2018-04-27  1:58   ` David Lechner
  0 siblings, 0 replies; 14+ messages in thread
From: David Lechner @ 2018-04-27  1:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 04/24/2018 09:35 AM, Sekhar Nori wrote:
> 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")
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
>   arch/arm/mach-davinci/board-omapl138-hawk.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
> index 0d32042b728f..be8b892a6ea7 100644
> --- a/arch/arm/mach-davinci/board-omapl138-hawk.c
> +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
> @@ -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),
>   	},
>   };
>   
> 

Reviewed-by: David Lechner <david@lechnology.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/4] ARM: davinci: fix GPIO lookup for I2C
  2018-04-27  1:43   ` David Lechner
@ 2018-05-01 11:36     ` Sekhar Nori
  0 siblings, 0 replies; 14+ messages in thread
From: Sekhar Nori @ 2018-05-01 11:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 27 April 2018 07:13 AM, David Lechner wrote:
> On 04/24/2018 09:35 AM, Sekhar Nori wrote:
>> 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")
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>> ---
>> ? 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(-)
>>
>> diff --git a/arch/arm/mach-davinci/board-dm355-evm.c
>> b/arch/arm/mach-davinci/board-dm355-evm.c
>> index cb30637d9eaf..14557f893798 100644
>> --- a/arch/arm/mach-davinci/board-dm355-evm.c
>> +++ b/arch/arm/mach-davinci/board-dm355-evm.c
>> @@ -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),
>> ????? },
>> ? };
>> diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c
>> b/arch/arm/mach-davinci/board-dm644x-evm.c
>> index 5bf024784738..5b0b95e04cac 100644
>> --- a/arch/arm/mach-davinci/board-dm644x-evm.c
>> +++ b/arch/arm/mach-davinci/board-dm644x-evm.c
>> @@ -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),
>> ????? },
>> ? };
>>
> 
> 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot
  2018-04-24 14:35 [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori
                   ` (3 preceding siblings ...)
  2018-04-24 14:35 ` [PATCH 4/4] ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup Sekhar Nori
@ 2018-05-01 12:16 ` Sekhar Nori
  4 siblings, 0 replies; 14+ messages in thread
From: Sekhar Nori @ 2018-05-01 12:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 24 April 2018 08:05 PM, Sekhar Nori wrote:
> 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD
  2018-04-27  1:40   ` David Lechner
@ 2018-05-15 22:53     ` Adam Ford
  2018-05-16 10:14       ` Sekhar Nori
  0 siblings, 1 reply; 14+ messages in thread
From: Adam Ford @ 2018-05-15 22:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 26, 2018 at 8:40 PM, David Lechner <david@lechnology.com> wrote:
> On 04/24/2018 09:35 AM, Sekhar Nori wrote:
>>
>> 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")
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>> ---
>>   arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-davinci/board-da850-evm.c
>> b/arch/arm/mach-davinci/board-da850-evm.c
>> index 3063478bcc36..158ed9a1483f 100644
>> --- a/arch/arm/mach-davinci/board-da850-evm.c
>> +++ b/arch/arm/mach-davinci/board-da850-evm.c
>> @@ -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),

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

>>         },
>>   };
>>
>
>
> Reviewed-by: David Lechner <david@lechnology.com>
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD
  2018-05-15 22:53     ` Adam Ford
@ 2018-05-16 10:14       ` Sekhar Nori
  2018-05-16 13:34         ` Adam Ford
  0 siblings, 1 reply; 14+ messages in thread
From: Sekhar Nori @ 2018-05-16 10:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 16 May 2018 04:23 AM, Adam Ford wrote:
> On Thu, Apr 26, 2018 at 8:40 PM, David Lechner <david@lechnology.com> wrote:
>> On 04/24/2018 09:35 AM, Sekhar Nori wrote:
>>>
>>> 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")
>>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>>> ---
>>>   arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
>>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-davinci/board-da850-evm.c
>>> b/arch/arm/mach-davinci/board-da850-evm.c
>>> index 3063478bcc36..158ed9a1483f 100644
>>> --- a/arch/arm/mach-davinci/board-da850-evm.c
>>> +++ b/arch/arm/mach-davinci/board-da850-evm.c
>>> @@ -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),
> 
> 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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/4] ARM: davinci: board-da850-evm: fix GPIO lookup for MMC/SD
  2018-05-16 10:14       ` Sekhar Nori
@ 2018-05-16 13:34         ` Adam Ford
  0 siblings, 0 replies; 14+ messages in thread
From: Adam Ford @ 2018-05-16 13:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 16, 2018 at 5:14 AM, Sekhar Nori <nsekhar@ti.com> wrote:
> On Wednesday 16 May 2018 04:23 AM, Adam Ford wrote:
>> On Thu, Apr 26, 2018 at 8:40 PM, David Lechner <david@lechnology.com> wrote:
>>> On 04/24/2018 09:35 AM, Sekhar Nori wrote:
>>>>
>>>> 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")
>>>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>>>> ---
>>>>   arch/arm/mach-davinci/board-da850-evm.c | 9 +++++++--
>>>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/arch/arm/mach-davinci/board-da850-evm.c
>>>> b/arch/arm/mach-davinci/board-da850-evm.c
>>>> index 3063478bcc36..158ed9a1483f 100644
>>>> --- a/arch/arm/mach-davinci/board-da850-evm.c
>>>> +++ b/arch/arm/mach-davinci/board-da850-evm.c
>>>> @@ -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),
>>
>> 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
>
> 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
>
> Thanks,
> Sekhar

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-05-16 13:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 14:35 [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori
2018-04-24 14:35 ` [PATCH 1/4] ARM: davinci: board-da830-evm: fix GPIO lookup for MMC/SD Sekhar Nori
2018-04-27  1:39   ` David Lechner
2018-04-24 14:35 ` [PATCH 2/4] ARM: davinci: board-da850-evm: " Sekhar Nori
2018-04-27  1:40   ` David Lechner
2018-05-15 22:53     ` Adam Ford
2018-05-16 10:14       ` Sekhar Nori
2018-05-16 13:34         ` Adam Ford
2018-04-24 14:35 ` [PATCH 3/4] ARM: davinci: fix GPIO lookup for I2C Sekhar Nori
2018-04-27  1:43   ` David Lechner
2018-05-01 11:36     ` Sekhar Nori
2018-04-24 14:35 ` [PATCH 4/4] ARM: davinci: board-omapl138-hawk: fix GPIO numbers for MMC/SD lookup Sekhar Nori
2018-04-27  1:58   ` David Lechner
2018-05-01 12:16 ` [PATCH 0/4] ARM: davinci: GPIO look-up fixes for legacy boot Sekhar Nori

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.