Message ID | 9196291.TTCd8TUnMq@tool |
---|---|
State | Superseded |
Delegated to: | Jonas Gorski |
Headers | show |
Hi, On 12 December 2015 at 14:10, dani <dgcbueu@gmail.com> wrote: > Currently ephy-reset, which uses a GPIO for enabling external ethernet phys, is broken. > This patch fix the problem. > > This problem causes in boards with external phys with a reset pin connected to gpio, are > initialized without lan interfaces. > > The line > ephy_reset.table[0].chip_label = gpio_chip_labels[hw_gpio / 32]; > always returns bcm63xx-gpio.1. As a result of this, reset pins connected to gpios <32 > will return messages "gpio X out of range", and ethernet fails to initialize. > > The array *gpio_chip_labels[] should be initialized with different names for each element, > otherwise sprintf will copy the label of the gpio chip for both elements at the same time. > And the name of both elements of the array will be the same. > > Using a different name on the second array element solves the problem. > Signed-off-by: Daniel Gonzalez <dgcbueu@gmail.com> I added a slightly different approach in r48303, can you verify it works for you? Jonas
Thanks Jonas. Tested and working OK. It would be nice if the patch is also backported to Chaos Calmer revision. Regards. 2016-01-18 14:16 GMT+01:00 Jonas Gorski <jogo@openwrt.org>: > Hi, > > On 12 December 2015 at 14:10, dani <dgcbueu@gmail.com> wrote: > > Currently ephy-reset, which uses a GPIO for enabling external ethernet > phys, is broken. > > This patch fix the problem. > > > > This problem causes in boards with external phys with a reset pin > connected to gpio, are > > initialized without lan interfaces. > > > > The line > > ephy_reset.table[0].chip_label = gpio_chip_labels[hw_gpio / 32]; > > always returns bcm63xx-gpio.1. As a result of this, reset pins connected > to gpios <32 > > will return messages "gpio X out of range", and ethernet fails to > initialize. > > > > The array *gpio_chip_labels[] should be initialized with different names > for each element, > > otherwise sprintf will copy the label of the gpio chip for both elements > at the same time. > > And the name of both elements of the array will be the same. > > > > Using a different name on the second array element solves the problem. > > Signed-off-by: Daniel Gonzalez <dgcbueu@gmail.com> > > I added a slightly different approach in r48303, can you verify it > works for you? > > > Jonas >
diff --git a/target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch index 0cbb4f5..28ff40b 100644 --- a/target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch +++ b/target/linux/brcm63xx/patches-4.1/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch @@ -61,7 +61,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> +/* for registering lookups; make them large enough to hold OF names */ +static char *gpio_chip_labels[] = { + "xxxxxxxx.gpio-controller", -+ "xxxxxxxx.gpio-controller", ++ "yyyyyyyy.gpio-controller", +}; + static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio) diff --git a/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch index bd5f5e8..e4224a6 100644 --- a/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch +++ b/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch @@ -61,7 +61,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> +/* for registering lookups; make them large enough to hold OF names */ +static char *gpio_chip_labels[] = { + "xxxxxxxx.gpio-controller", -+ "xxxxxxxx.gpio-controller", ++ "yyyyyyyy.gpio-controller", +}; + static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
Currently ephy-reset, which uses a GPIO for enabling external ethernet phys, is broken. This patch fix the problem. This problem causes in boards with external phys with a reset pin connected to gpio, are initialized without lan interfaces. The line ephy_reset.table[0].chip_label = gpio_chip_labels[hw_gpio / 32]; always returns bcm63xx-gpio.1. As a result of this, reset pins connected to gpios <32 will return messages "gpio X out of range", and ethernet fails to initialize. The array *gpio_chip_labels[] should be initialized with different names for each element, otherwise sprintf will copy the label of the gpio chip for both elements at the same time. And the name of both elements of the array will be the same. Using a different name on the second array element solves the problem. Signed-off-by: Daniel Gonzalez <dgcbueu@gmail.com>