2018-11-13 13:51:46

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH 0/3] 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(-)

--
2.19.1



2018-11-13 13:51:54

by Bartosz Golaszewski

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

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: [email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
arch/arm/mach-davinci/da850.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 4528bbf0c861..e7b78df2bfef 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -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)
--
2.19.1


2018-11-13 13:53:14

by Bartosz Golaszewski

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

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: [email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/gpio/gpio-davinci.c | 2 +-
include/linux/platform_data/gpio-davinci.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 5c1564fcc24e..bdb29e51b417 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -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;
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
index f92a47e18034..a93841bfb9f7 100644
--- a/include/linux/platform_data/gpio-davinci.h
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -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;
};
--
2.19.1


2018-11-13 13:53:25

by Bartosz Golaszewski

[permalink] [raw]
Subject: [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: [email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
arch/arm/mach-davinci/devices-da8xx.c | 42 ++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 1fd3619f6a09..8c4ae9866e3c 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -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 = {
--
2.19.1


2018-11-16 21:52:14

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 0/3] ARM: davinci: fix ethernet support on da850-evm

On Tue, Nov 13, 2018 at 2:51 PM Bartosz Golaszewski <[email protected]> wrote:

> 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

2018-11-19 09:14:14

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH 0/3] ARM: davinci: fix ethernet support on da850-evm

pt., 16 lis 2018 o 22:51 Linus Walleij <[email protected]> napisał(a):
>
> On Tue, Nov 13, 2018 at 2:51 PM Bartosz Golaszewski <[email protected]> wrote:
>
> > 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.
>

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

> 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

2018-11-19 13:21:37

by Linus Walleij

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

On Tue, Nov 13, 2018 at 2:51 PM Bartosz Golaszewski <[email protected]> wrote:

> 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: [email protected]
> Signed-off-by: Bartosz Golaszewski <[email protected]>

Acked-by: Linus Walleij <[email protected]>

I guess this will be merged throug ARM SoC?

Yours,
Linus Walleij

2018-11-19 14:21:44

by Bartosz Golaszewski

[permalink] [raw]
Subject: 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):
>
> On Tue, Nov 13, 2018 at 2:51 PM Bartosz Golaszewski <[email protected]> wrote:
>
> > 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: [email protected]
> > Signed-off-by: Bartosz Golaszewski <[email protected]>
>
> Acked-by: Linus Walleij <[email protected]>
>
> I guess this will be merged throug ARM SoC?
>

Yes, if Sekhar's fine with that.

Bart

2018-11-19 20:55:11

by Sekhar Nori

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

On 13/11/18 7:20 PM, Bartosz Golaszewski wrote:
> 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: [email protected]
> Signed-off-by: Bartosz Golaszewski <[email protected]>

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.

Signed-off-by: Keerthy <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>


Can we revert the offending commit instead?

Thanks,
Sekhar

2018-11-19 21:09:25

by Sekhar Nori

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

Hi Bartosz,


On 13/11/18 7:20 PM, Bartosz Golaszewski wrote:
> 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: [email protected]
> Signed-off-by: Bartosz Golaszewski <[email protected]>


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

2018-11-20 06:58:08

by Keerthy

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



On 11/20/2018 2:22 AM, Sekhar Nori wrote:
> On 13/11/18 7:20 PM, Bartosz Golaszewski wrote:
>> 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: [email protected]
>> Signed-off-by: Bartosz Golaszewski <[email protected]>
>
> 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

>
>
> 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.
>
> Signed-off-by: Keerthy <[email protected]>
> Reviewed-by: Grygorii Strashko <[email protected]>
> Signed-off-by: Linus Walleij <[email protected]>
>
>
> Can we revert the offending commit instead?
>
> Thanks,
> Sekhar
>

2018-11-20 12:34:13

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 0/3] ARM: davinci: fix ethernet support on da850-evm

On Mon, Nov 19, 2018 at 10:11 AM Bartosz Golaszewski <[email protected]> wrote:
> pt., 16 lis 2018 o 22:51 Linus Walleij <[email protected]> napisał(a):

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

2018-11-20 23:09:37

by Sekhar Nori

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

On 20/11/18 12:08 PM, J, KEERTHY wrote:
>
>
> On 11/20/2018 2:22 AM, Sekhar Nori wrote:
>> On 13/11/18 7:20 PM, Bartosz Golaszewski wrote:
>>> 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: [email protected]
>>> Signed-off-by: Bartosz Golaszewski <[email protected]>
>>
>> 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.

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

2018-11-21 09:53:22

by Bartosz Golaszewski

[permalink] [raw]
Subject: 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):
>
> On 20/11/18 12:08 PM, J, KEERTHY wrote:
> >
> >
> > On 11/20/2018 2:22 AM, Sekhar Nori wrote:
> >> On 13/11/18 7:20 PM, Bartosz Golaszewski wrote:
> >>> 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: [email protected]
> >>> Signed-off-by: Bartosz Golaszewski <[email protected]>
> >>
> >> 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.
>
> 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

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

Bart