Skip to contentSkip to conversation

ARM: davinci: fix GPIO breakage after v4.19

PATCH Applied Bartosz Golaszewski 2 participants 14 messages Nov 21, 2018 – Nov 27, 2018

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

cover ARM: davinci: fix GPIO breakage after v4.19

From: Bartosz Golaszewski <[email protected]>

This is the entire set of changes needed to fix the broken GPIO support for DaVinci boards in legacy mode after certain changes made to the GPIO driver in 4.19, namely: commits 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") and eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering").

Bartosz Golaszewski (12):
ARM: davinci: da8xx: define gpio interrupts as separate resources
ARM: davinci: dm365: define gpio interrupts as separate resources
ARM: davinci: dm646x: define gpio interrupts as separate resources
ARM: davinci: dm355: define gpio interrupts as separate resources
ARM: davinci: dm644x: define gpio interrupts as separate resources
gpio: davinci: restore a way to manually specify the GPIO base
ARM: davinci: da850: set the GPIO base to 0
ARM: davinci: dm365: set the GPIO base to 0
ARM: davinci: dm646x: set the GPIO base to 0
ARM: davinci: dm355: set the GPIO base to 0
ARM: davinci: da830: set the GPIO base to 0
ARM: davinci: dm644x: set the GPIO base to 0

 arch/arm/mach-davinci/da830.c              |  4 ++-
 arch/arm/mach-davinci/da850.c              |  4 ++-
 arch/arm/mach-davinci/devices-da8xx.c      | 40 ++++++++++++++++++++++
 arch/arm/mach-davinci/dm355.c              | 32 +++++++++++++++++
 arch/arm/mach-davinci/dm365.c              | 37 ++++++++++++++++++++
 arch/arm/mach-davinci/dm644x.c             | 22 ++++++++++++
 arch/arm/mach-davinci/dm646x.c             | 12 +++++++
 drivers/gpio/gpio-davinci.c                |  2 +-
 include/linux/platform_data/gpio-davinci.h |  2 ++
 9 files changed, 152 insertions(+), 3 deletions(-)
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/12 ARM: davinci: da8xx: define gpio interrupts as separate resources

From: Bartosz Golaszewski <[email protected]>

Since commit eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering") the davinci GPIO driver fails to probe if we boot in legacy mode from any of the board files. Since the driver now expects every interrupt to be defined as a separate resource, split the definition of IRQ resources instead of having a single continuous interrupt range.

Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/devices-da8xx.c | 40 +++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
arch/arm/mach-davinci/devices-da8xx.c +40 -0
index 1fd3619f6a09..cf78da5ab054 100644
@@ -701,6 +701,46 @@ static struct resource da8xx_gpio_resources[] = {
 	},
 	{ /* interrupt */
 		.start	= IRQ_DA8XX_GPIO0,
+		.end	= IRQ_DA8XX_GPIO0,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DA8XX_GPIO1,
+		.end	= IRQ_DA8XX_GPIO1,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DA8XX_GPIO2,
+		.end	= IRQ_DA8XX_GPIO2,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DA8XX_GPIO3,
+		.end	= IRQ_DA8XX_GPIO3,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DA8XX_GPIO4,
+		.end	= IRQ_DA8XX_GPIO4,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DA8XX_GPIO5,
+		.end	= IRQ_DA8XX_GPIO5,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DA8XX_GPIO6,
+		.end	= IRQ_DA8XX_GPIO6,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DA8XX_GPIO7,
+		.end	= IRQ_DA8XX_GPIO7,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DA8XX_GPIO8,
 		.end	= IRQ_DA8XX_GPIO8,
 		.flags	= IORESOURCE_IRQ,
 	},
Signature · 1 line
2.19.1
#2 lore raw

PATCH 2/12 ARM: davinci: dm365: define gpio interrupts as separate resources

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Since commit eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering") the davinci GPIO driver fails to probe if we boot in legacy mode from any of the board files. Since the driver now expects every interrupt to be defined as a separate resource, split the definition of IRQ resources instead of having a single continuous interrupt range.

Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/dm365.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm/mach-davinci/dm365.c +35 -0
index abcf2a5ed89b..42665914166a 100644
@@ -267,6 +267,41 @@ static struct resource dm365_gpio_resources[] = {
 	},
 	{	/* interrupt */
 		.start	= IRQ_DM365_GPIO0,
+		.end	= IRQ_DM365_GPIO0,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM365_GPIO1,
+		.end	= IRQ_DM365_GPIO1,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM365_GPIO2,
+		.end	= IRQ_DM365_GPIO2,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM365_GPIO3,
+		.end	= IRQ_DM365_GPIO3,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM365_GPIO4,
+		.end	= IRQ_DM365_GPIO4,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM365_GPIO5,
+		.end	= IRQ_DM365_GPIO5,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM365_GPIO6,
+		.end	= IRQ_DM365_GPIO6,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM365_GPIO7,
 		.end	= IRQ_DM365_GPIO7,
 		.flags	= IORESOURCE_IRQ,
 	},
Signature · 1 line
2.19.1
#3 lore raw

PATCH 3/12 ARM: davinci: dm646x: define gpio interrupts as separate resources

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Since commit eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering") the davinci GPIO driver fails to probe if we boot in legacy mode from any of the board files. Since the driver now expects every interrupt to be defined as a separate resource, split the definition of IRQ resources instead of having a single continuous interrupt range.

Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/dm646x.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/mach-davinci/dm646x.c +10 -0
index 6bd2ed069d0d..d9b93e2806d2 100644
@@ -442,6 +442,16 @@ static struct resource dm646x_gpio_resources[] = {
 	},
 	{	/* interrupt */
 		.start	= IRQ_DM646X_GPIOBNK0,
+		.end	= IRQ_DM646X_GPIOBNK0,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM646X_GPIOBNK1,
+		.end	= IRQ_DM646X_GPIOBNK1,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM646X_GPIOBNK2,
 		.end	= IRQ_DM646X_GPIOBNK2,
 		.flags	= IORESOURCE_IRQ,
 	},
Signature · 1 line
2.19.1
#4 lore raw

PATCH 4/12 ARM: davinci: dm355: define gpio interrupts as separate resources

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Since commit eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering") the davinci GPIO driver fails to probe if we boot in legacy mode from any of the board files. Since the driver now expects every interrupt to be defined as a separate resource, split the definition of IRQ resources instead of having a single continuous interrupt range.

Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/dm355.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/mach-davinci/dm355.c +30 -0
index 9f7d38d12c88..2b0f5d97ab7c 100644
@@ -548,6 +548,36 @@ static struct resource dm355_gpio_resources[] = {
 	},
 	{	/* interrupt */
 		.start	= IRQ_DM355_GPIOBNK0,
+		.end	= IRQ_DM355_GPIOBNK0,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM355_GPIOBNK1,
+		.end	= IRQ_DM355_GPIOBNK1,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM355_GPIOBNK2,
+		.end	= IRQ_DM355_GPIOBNK2,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM355_GPIOBNK3,
+		.end	= IRQ_DM355_GPIOBNK3,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM355_GPIOBNK4,
+		.end	= IRQ_DM355_GPIOBNK4,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM355_GPIOBNK5,
+		.end	= IRQ_DM355_GPIOBNK5,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_DM355_GPIOBNK6,
 		.end	= IRQ_DM355_GPIOBNK6,
 		.flags	= IORESOURCE_IRQ,
 	},
Signature · 1 line
2.19.1
#5 lore raw

PATCH 5/12 ARM: davinci: dm644x: define gpio interrupts as separate resources

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Since commit eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering") the davinci GPIO driver fails to probe if we boot in legacy mode from any of the board files. Since the driver now expects every interrupt to be defined as a separate resource, split the definition of IRQ resources instead of having a single continuous interrupt range.

Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/dm644x.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/mach-davinci/dm644x.c +20 -0
index 0720da7809a6..de1ec6dc01e9 100644
@@ -492,6 +492,26 @@ static struct resource dm644_gpio_resources[] = {
 	},
 	{	/* interrupt */
 		.start	= IRQ_GPIOBNK0,
+		.end	= IRQ_GPIOBNK0,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_GPIOBNK1,
+		.end	= IRQ_GPIOBNK1,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_GPIOBNK2,
+		.end	= IRQ_GPIOBNK2,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_GPIOBNK3,
+		.end	= IRQ_GPIOBNK3,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= IRQ_GPIOBNK4,
 		.end	= IRQ_GPIOBNK4,
 		.flags	= IORESOURCE_IRQ,
 	},
Signature · 1 line
2.19.1
#6 lore raw

PATCH 6/12 gpio: davinci: restore a way to manually specify the GPIO base

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Commit 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") broke the network support in legacy boot mode for da850-evm since we can no longer request the MDIO clock GPIO.

Other boards may be broken too, which I haven't tested.

The problem is in the fact that most board files still use the legacy GPIO API where lines are requested by numbers rather than descriptors.

While this should be fixed eventually, in order to unbreak the board for now - provide a way to manually specify the GPIO base in platform data.

Fixes 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection")
Cc stable at vger.kernel.org
---
 drivers/gpio/gpio-davinci.c                | 2 +-
 include/linux/platform_data/gpio-davinci.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-davinci.c +1 -1
index 5c1564fcc24e..bdb29e51b417 100644
@@ -258,7 +258,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
 	chips->chip.set = davinci_gpio_set;
 
 	chips->chip.ngpio = ngpio;
-	chips->chip.base = -1;
+	chips->chip.base = pdata->no_auto_base ? pdata->base : -1;
 
 #ifdef CONFIG_OF_GPIO
 	chips->chip.of_gpio_n_cells = 2;
include/linux/platform_data/gpio-davinci.h +2 -0
index f92a47e18034..a93841bfb9f7 100644
@@ -17,6 +17,8 @@
 #define __DAVINCI_GPIO_PLATFORM_H
 
 struct davinci_gpio_platform_data {
+	bool	no_auto_base;
+	u32	base;
 	u32	ngpio;
 	u32	gpio_unbanked;
 };
Signature · 1 line
2.19.1
#7 lore raw

PATCH 7/12 ARM: davinci: da850: set the GPIO base to 0

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Commit 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") broke the network support in legacy boot mode for da850-evm since we can no longer request the MDIO clock GPIO.

We now have the option to specify the GPIO base manually for davinci, so add the relevant fields to platform data.

Fixes 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/da850.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/da850.c +3 -1
index 4528bbf0c861..e7b78df2bfef 100644
@@ -719,7 +719,9 @@ int __init da850_register_vpif_capture(struct vpif_capture_config
 }
 
 static struct davinci_gpio_platform_data da850_gpio_platform_data = {
-	.ngpio = 144,
+	.no_auto_base	= true,
+	.base		= 0,
+	.ngpio		= 144,
 };
 
 int __init da850_register_gpio(void)
Signature · 1 line
2.19.1
#8 lore raw

PATCH 8/12 ARM: davinci: dm365: set the GPIO base to 0

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Commit 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") broke the GPIO support on DaVinci boards in legacy mode by allowing gpiolib to set the GPIO base automatically.

DaVinci board files use the legacy GPIO API with hard-coded GPIO line numbers. Use the new fields in struct davinci_gpio_platform_data to manually set the GPIO base to 0.

Fixes 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/dm365.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/dm365.c +2 -0
index 42665914166a..01fb2b0c82de 100644
@@ -308,6 +308,8 @@ static struct resource dm365_gpio_resources[] = {
 };
 
 static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
+	.no_auto_base	= true,
+	.base		= 0,
 	.ngpio		= 104,
 	.gpio_unbanked	= 8,
 };
Signature · 1 line
2.19.1
#9 lore raw

PATCH 9/12 ARM: davinci: dm646x: set the GPIO base to 0

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Commit 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") broke the GPIO support on DaVinci boards in legacy mode by allowing gpiolib to set the GPIO base automatically.

DaVinci board files use the legacy GPIO API with hard-coded GPIO line numbers. Use the new fields in struct davinci_gpio_platform_data to manually set the GPIO base to 0.

Fixes 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/dm646x.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/dm646x.c +2 -0
index d9b93e2806d2..7dc54b2a610f 100644
@@ -458,6 +458,8 @@ static struct resource dm646x_gpio_resources[] = {
 };
 
 static struct davinci_gpio_platform_data dm646x_gpio_platform_data = {
+	.no_auto_base	= true,
+	.base		= 0,
 	.ngpio		= 43,
 };
 
Signature · 1 line
2.19.1
#10 lore raw

PATCH 10/12 ARM: davinci: dm355: set the GPIO base to 0

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Commit 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") broke the GPIO support on DaVinci boards in legacy mode by allowing gpiolib to set the GPIO base automatically.

DaVinci board files use the legacy GPIO API with hard-coded GPIO line numbers. Use the new fields in struct davinci_gpio_platform_data to manually set the GPIO base to 0.

Fixes 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/dm355.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/dm355.c +2 -0
index 2b0f5d97ab7c..4c6e0bef4509 100644
@@ -584,6 +584,8 @@ static struct resource dm355_gpio_resources[] = {
 };
 
 static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
+	.no_auto_base	= true,
+	.base		= 0,
 	.ngpio		= 104,
 };
 
Signature · 1 line
2.19.1
#11 lore raw

PATCH 11/12 ARM: davinci: da830: set the GPIO base to 0

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Commit 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") broke the GPIO support on DaVinci boards in legacy mode by allowing gpiolib to set the GPIO base automatically.

DaVinci board files use the legacy GPIO API with hard-coded GPIO line numbers. Use the new fields in struct davinci_gpio_platform_data to manually set the GPIO base to 0.

Fixes 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/da830.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/da830.c +3 -1
index 0bc5bd2665df..2cc9fe4c3a91 100644
@@ -759,7 +759,9 @@ static struct davinci_id da830_ids[] = {
 };
 
 static struct davinci_gpio_platform_data da830_gpio_platform_data = {
-	.ngpio = 128,
+	.no_auto_base	= true,
+	.base		= 0,
+	.ngpio		= 128,
 };
 
 int __init da830_register_gpio(void)
Signature · 1 line
2.19.1
#12 lore raw

PATCH 12/12 ARM: davinci: dm644x: set the GPIO base to 0

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Commit 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") broke the GPIO support on DaVinci boards in legacy mode by allowing gpiolib to set the GPIO base automatically.

DaVinci board files use the legacy GPIO API with hard-coded GPIO line numbers. Use the new fields in struct davinci_gpio_platform_data to manually set the GPIO base to 0.

Fixes 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection")
Cc stable at vger.kernel.org
---
 arch/arm/mach-davinci/dm644x.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/dm644x.c +2 -0
index de1ec6dc01e9..38f92b7d413e 100644
@@ -518,6 +518,8 @@ static struct resource dm644_gpio_resources[] = {
 };
 
 static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
+	.no_auto_base	= true,
+	.base		= 0,
 	.ngpio		= 71,
 };
 
Signature · 1 line
2.19.1
Applied
#13 lore raw
In reply to Bartosz Golaszewski

Hi Bartosz,

Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This is the entire set of changes needed to fix the broken GPIO support for DaVinci boards in legacy mode after certain changes made to the GPIO driver in 4.19, namely: commits 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection") and eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering").

I applied this series and sent a pull request to ARM SoC too.

Thanks,
Sekhar