ARM: davinci: fix GPIO breakage after v4.19
Subsystems (6)
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
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.
--- arch/arm/mach-davinci/devices-da8xx.c | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
arch/arm/mach-davinci/devices-da8xx.c +40 -0
@@ -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
PATCH 2/12 ARM: davinci: dm365: define gpio interrupts as separate resources
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/dm365.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
arch/arm/mach-davinci/dm365.c +35 -0
@@ -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
PATCH 3/12 ARM: davinci: dm646x: define gpio interrupts as separate resources
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/dm646x.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-davinci/dm646x.c +10 -0
@@ -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
PATCH 4/12 ARM: davinci: dm355: define gpio interrupts as separate resources
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/dm355.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/arm/mach-davinci/dm355.c +30 -0
@@ -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
PATCH 5/12 ARM: davinci: dm644x: define gpio interrupts as separate resources
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/dm644x.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/arm/mach-davinci/dm644x.c +20 -0
@@ -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
PATCH 6/12 gpio: davinci: restore a way to manually specify the GPIO base
In reply to Bartosz GolaszewskiFrom: 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.
--- 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
@@ -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
@@ -17,6 +17,8 @@#define __DAVINCI_GPIO_PLATFORM_Hstruct davinci_gpio_platform_data { +bool no_auto_base; +u32 base;u32 ngpio;u32 gpio_unbanked; };
Signature · 1 line
2.19.1
PATCH 7/12 ARM: davinci: da850: set the GPIO base to 0
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/da850.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/da850.c +3 -1
@@ -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
PATCH 8/12 ARM: davinci: dm365: set the GPIO base to 0
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/dm365.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/dm365.c +2 -0
@@ -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
PATCH 9/12 ARM: davinci: dm646x: set the GPIO base to 0
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/dm646x.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/dm646x.c +2 -0
@@ -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
PATCH 10/12 ARM: davinci: dm355: set the GPIO base to 0
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/dm355.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/dm355.c +2 -0
@@ -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
PATCH 11/12 ARM: davinci: da830: set the GPIO base to 0
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/da830.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/da830.c +3 -1
@@ -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
PATCH 12/12 ARM: davinci: dm644x: set the GPIO base to 0
In reply to Bartosz GolaszewskiFrom: 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.
--- arch/arm/mach-davinci/dm644x.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/dm644x.c +2 -0
@@ -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
Sekhar Nori
AppliedHi 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") andeb3744a2dd01("gpio: davinci: Do not assume continuous IRQ numbering").
I applied this series and sent a pull request to ARM SoC too.
Thanks,
Sekhar