Skip to contentSkip to conversation

ARM: davinci: fix ethernet support on da850-evm

PATCH In review Bartosz Golaszewski 5 participants 14 messages Nov 13, 2018 – Nov 21, 2018

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

cover ARM: davinci: fix ethernet support on da850-evm

From: Bartosz Golaszewski <[email protected]>

Ethernet doesn't work on da850-evm in legacy boot mode since v4.19. This series addresses two problems I've found. I guess with this kind of intrusive changes in the GPIO driver, other boards may be broken at the moment too.

Bartosz Golaszewski (3):
ARM: davinci: define gpio interrupts as separate resources
gpio: davinci: restore a way to manually specify the GPIO base
ARM: davinci: fix da850-evm boot in legacy mode

 arch/arm/mach-davinci/da850.c              |  4 ++-
 arch/arm/mach-davinci/devices-da8xx.c      | 42 +++++++++++++++++++++-
 drivers/gpio/gpio-davinci.c                |  2 +-
 include/linux/platform_data/gpio-davinci.h |  2 ++
 4 files changed, 47 insertions(+), 3 deletions(-)
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/3 ARM: davinci: 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 in devices-da8xx.c 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 | 42 ++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/devices-da8xx.c +41 -1
index 1fd3619f6a09..8c4ae9866e3c 100644
@@ -701,9 +701,49 @@ static struct resource da8xx_gpio_resources[] = {
 	},
 	{ /* interrupt */
 		.start	= IRQ_DA8XX_GPIO0,
-		.end	= IRQ_DA8XX_GPIO8,
+		.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,
+	}
 };
 
 static struct platform_device da8xx_gpio_device = {
Signature · 1 line
2.19.1
Reviewed-by Grygorii Strashko on v1 1/3
#2 lore raw

Re: [PATCH 1/3] ARM: davinci: define gpio interrupts as separate resources

Quoted 9 lines · 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 in devices-da8xx.c instead of having a single continuous interrupt range.

Quoted 3 lines
Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering")
Cc stable at vger.kernel.org

There are a number of other boards that need such fixing too. And the commit in question does not do a good job of explaining why it was needed in the first place. The description just repeats what can be inferred by reading the patch.

gpio: davinci: Do not assume continuous IRQ numbering

Currently the driver assumes that the interrupts are continuous and does platform_get_irq only once and assumes the rest are continuous, instead call platform_get_irq for all the interrupts and store them in an array for later use.

Can we revert the offending commit instead?

Thanks,
Sekhar

maintainer
#3 lore raw

Re: [PATCH 1/3] ARM: davinci: define gpio interrupts as separate resources

Quoted 10 lines · Sekhar Nori
Quoted 9 lines · 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 in devices-da8xx.c instead of having a single continuous interrupt range.

Quoted 8 lines
Quoted 3 lines
Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ numbering")
Cc stable at vger.kernel.org

There are a number of other boards that need such fixing too. And the commit in question does not do a good job of explaining why it was needed in the first place. The description just repeats what can be inferred by reading the patch.

Cc Lokesh

Sekhar,

DT explicitly mentions every IRQ number. The patch in discussion explicitly calls platform_get_irq for all the interrupts which to me is the right thing to do as: platform_get_irq--> of_irq_get-->irq_create_of_mapping--> sequence is to be done for every IRQ.

k3-am654 definitely will need explicit calls to platform_get_irq as it will be involving interrupt router and interrupt numbers need not be continuous.

So i do not think reverting the patch is the right idea.

Regards,
Keerthy

Quoted 19 lines

gpio: davinci: Do not assume continuous IRQ numbering

Currently the driver assumes that the interrupts are continuous and does platform_get_irq only once and assumes the rest are continuous, instead call platform_get_irq for all the interrupts and store them in an array for later use.

Can we revert the offending commit instead?

Thanks,
Sekhar

#4 lore raw

Re: [PATCH 1/3] ARM: davinci: define gpio interrupts as separate resources

Quoted 32 lines · KEERTHY
Quoted 15 lines · Sekhar Nori
Quoted 9 lines · 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 in devices-da8xx.c instead of having a single continuous interrupt range.

Quoted 4 lines
Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ

numbering")

Cc stable at vger.kernel.org
Quoted 4 lines

There are a number of other boards that need such fixing too. And the commit in question does not do a good job of explaining why it was needed in the first place. The description? just repeats what can be inferred by reading the patch.

Cc Lokesh

Sekhar,

DT explicitly mentions every IRQ number. The patch in discussion explicitly calls platform_get_irq for all the interrupts which to me is the right thing to do as: platform_get_irq--> of_irq_get-->irq_create_of_mapping--> sequence is to be done for every IRQ.

Quoted 5 lines

k3-am654 definitely will need explicit calls to platform_get_irq as it will be involving interrupt router and interrupt numbers need not be continuous.

So i do not think reverting the patch is the right idea.

Well, all of this description of patch motivation should have been in the patch description to begin with.

Bartosz, can you please extend this patch to fix this problem for other DaVinci SoCs too? I am on the road this week, but will do my best to queue these fixes at the earliest .

Thanks,
Sekhar

#5 lore raw

Re: [PATCH 1/3] ARM: davinci: define gpio interrupts as separate resources

?r., 21 lis 2018 o 00:07 Sekhar Nori <[email protected]> napisa?(a):

Quoted 43 lines · KEERTHY
Quoted 32 lines · Sekhar Nori
Quoted 15 lines · Bartosz Golaszewski
Quoted 9 lines

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 in devices-da8xx.c instead of having a single continuous interrupt range.

Quoted 4 lines
Fixes eb3744a2dd01 ("gpio: davinci: Do not assume continuous IRQ

numbering")

Cc stable at vger.kernel.org
Quoted 4 lines

There are a number of other boards that need such fixing too. And the commit in question does not do a good job of explaining why it was needed in the first place. The description just repeats what can be inferred by reading the patch.

Cc Lokesh

Sekhar,

DT explicitly mentions every IRQ number. The patch in discussion explicitly calls platform_get_irq for all the interrupts which to me is the right thing to do as: platform_get_irq--> of_irq_get-->irq_create_of_mapping--> sequence is to be done for every IRQ.

Quoted 5 lines

k3-am654 definitely will need explicit calls to platform_get_irq as it will be involving interrupt router and interrupt numbers need not be continuous.

So i do not think reverting the patch is the right idea.

Well, all of this description of patch motivation should have been in the patch description to begin with.

Quoted 6 lines

Bartosz, can you please extend this patch to fix this problem for other DaVinci SoCs too? I am on the road this week, but will do my best to queue these fixes at the earliest .

Thanks,
Sekhar

Ok, to make it easier for you, I'll resend all the patches addressing the GPIO issue.

Bart

#6 lore raw

PATCH 2/3 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
Acked-by on v1 2/3
#7 lore raw

Re: [PATCH 2/3] gpio: davinci: restore a way to manually specify the GPIO base

Quoted 11 lines · 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.

Quoted 7 lines

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

I guess this will be merged throug ARM SoC?

Yours,
Linus Walleij

#8 lore raw

Re: [PATCH 2/3] gpio: davinci: restore a way to manually specify the GPIO base

pon., 19 lis 2018 o 14:19 Linus Walleij <[email protected]> napisa?(a):

Quoted 18 lines · Bartosz Golaszewski
Quoted 16 lines

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.

Quoted 8 lines
Quoted 3 lines
Fixes 587f7a694f01 ("gpio: davinci: Use dev name for label and automatic base selection")
Cc stable at vger.kernel.org

I guess this will be merged throug ARM SoC?

Yes, if Sekhar's fine with that.

Bart

#9 lore raw

PATCH 3/3 ARM: davinci: fix da850-evm boot in legacy mode

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
#10 lore raw

Re: [PATCH 3/3] ARM: davinci: fix da850-evm boot in legacy mode

Hi Bartosz,

Quoted 9 lines · 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.

Quoted 8 lines
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(-)

Similar changes are needed for other 5 DaVinci SoCs too. Can you do those in this patch itself?

Thanks,
Sekhar

#11 lore raw
In reply to Bartosz Golaszewski
Quoted 11 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Ethernet doesn't work on da850-evm in legacy boot mode since v4.19. This series addresses two problems I've found. I guess with this kind of intrusive changes in the GPIO driver, other boards may be broken at the moment too.

Bartosz Golaszewski (3):
ARM: davinci: define gpio interrupts as separate resources
gpio: davinci: restore a way to manually specify the GPIO base
ARM: davinci: fix da850-evm boot in legacy mode

I have some patches starting to move DaVinci over to using only descriptor tables, but that's not somthing we can pull off overnight so I guess we have to go for this solution.

Can we have ACKs from the DaVinci maintainers so I can merge all three patches through the GPIO tree fixes? Else I'm fine with merging through ARM SoC.

Yours,
Linus Walleij

#12 lore raw

pt., 16 lis 2018 o 22:51 Linus Walleij <[email protected]> napisa?(a):

Quoted 10 lines · Bartosz Golaszewski
Quoted 8 lines

From: Bartosz Golaszewski <[email protected]>

Ethernet doesn't work on da850-evm in legacy boot mode since v4.19. This series addresses two problems I've found. I guess with this kind of intrusive changes in the GPIO driver, other boards may be broken at the moment too.

Quoted 9 lines
Quoted 4 lines

Bartosz Golaszewski (3):
ARM: davinci: define gpio interrupts as separate resources
gpio: davinci: restore a way to manually specify the GPIO base
ARM: davinci: fix da850-evm boot in legacy mode

I have some patches starting to move DaVinci over to using only descriptor tables, but that's not somthing we can pull off overnight so I guess we have to go for this solution.

Nice, would you mind sharing the development branch? I'm interested in it as well and may be doing some work on that early 2019 so let's sync to avoid duplicating the effort.

Bart

Quoted 6 lines

Can we have ACKs from the DaVinci maintainers so I can merge all three patches through the GPIO tree fixes? Else I'm fine with merging through ARM SoC.

Yours,
Linus Walleij

#13 lore raw
Quoted 10 lines · Bartosz Golaszewski

pt., 16 lis 2018 o 22:51 Linus Walleij <[email protected]> napisa?(a):

Quoted 4 lines

I have some patches starting to move DaVinci over to using only descriptor tables, but that's not somthing we can pull off overnight so I guess we have to go for this solution.

Nice, would you mind sharing the development branch? I'm interested in it as well and may be doing some work on that early 2019 so let's sync to avoid duplicating the effort.

Just a stab:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?h=gpio-descriptors-leds&id=b4db69c2a066a87c990a6757720284df88f11f57

It will also require this patch (as I realized after talking to the PXA people):
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?h=gpio-descriptors-mmc-cd-wp&id=1911a4fe1ed8805080d8c7e0adc298f740531c3b

I guess I should queue the naming patch in some immutable branch or something so it can be pulled in all over the place.

Yours,
Linus Walleij