* [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot @ 2018-12-13 13:58 Peter Ujfalusi 2018-12-13 15:17 ` Tony Lindgren ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Peter Ujfalusi @ 2018-12-13 13:58 UTC (permalink / raw) To: tony, linux; +Cc: devicetree, linux-omap, linux-arm-kernel, bcousson The ethernet works in kernel only if we use some binary u-boot from the past which have support for KS8851. The u-boot sources are not available for this mysterious u-boot image people tends to hold on... Mainline u-bott does not have ethernet support for sdp4430 and if we use that the ethernet is not working. After some debugging I have managed to get the ethernet working with mainline u-boot while not breaking the networking with the case when we boot with the mysterious binary u-boot. Basically we were missing bunch of pinmux settings and the 'magic' gpio_138 handling in kernel. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> --- arch/arm/boot/dts/omap4-sdp.dts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts index 9dc7ec7655cb..c88817bdcc56 100644 --- a/arch/arm/boot/dts/omap4-sdp.dts +++ b/arch/arm/boot/dts/omap4-sdp.dts @@ -26,6 +26,9 @@ }; vdd_eth: fixedregulator-vdd-eth { + pinctrl-names = "default"; + pinctrl-0 = <&enet_enable_gpio>; + compatible = "regulator-fixed"; regulator-name = "VDD_ETH"; regulator-min-microvolt = <3300000>; @@ -352,6 +355,29 @@ OMAP4_IOPAD(0x152, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat3.sdmmc5_dat3 */ >; }; + + /* gpio_48 for ENET_ENABLE */ + enet_enable_gpio: pinmux_enet_enable_gpio { + pinctrl-single,pins = < + OMAP4_IOPAD(0x070, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gpmc_a24.gpio_48 */ + >; + }; + + ks8851_pins: pinmux_ks8851_pins { + pinctrl-single,pins = < + /* ENET_INT */ + OMAP4_IOPAD(0x054, PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_ad10.gpio_34 */ + /* + * Misterious pin which makes the ethernet working + * The legacy board file requested this pin on boot + * (ETH_KS8851_QUART) and set it to high, similarly to + * the ENET_ENABLE pin. + * We could use gpio-hog to keep it high, but let's use + * it as a reset GPIO for ks8851. + */ + OMAP4_IOPAD(0x13a, PIN_OUTPUT_PULLUP | MUX_MODE3) /* mcspi1_cs1.gpio_138 */ + >; + }; }; &i2c1 { @@ -452,12 +478,16 @@ pinctrl-0 = <&mcspi1_pins>; eth@0 { + pinctrl-names = "default"; + pinctrl-0 = <&ks8851_pins>; + compatible = "ks8851"; spi-max-frequency = <24000000>; reg = <0>; interrupt-parent = <&gpio2>; interrupts = <2 IRQ_TYPE_LEVEL_LOW>; /* gpio line 34 */ vdd-supply = <&vdd_eth>; + reset-gpios = <&gpio5 10 GPIO_ACTIVE_HIGH>; }; }; -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot 2018-12-13 13:58 [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot Peter Ujfalusi @ 2018-12-13 15:17 ` Tony Lindgren 2018-12-14 13:06 ` Peter Ujfalusi 2018-12-13 15:50 ` Russell King - ARM Linux 2019-01-24 16:17 ` Tony Lindgren 2 siblings, 1 reply; 8+ messages in thread From: Tony Lindgren @ 2018-12-13 15:17 UTC (permalink / raw) To: Peter Ujfalusi Cc: Nishanth Menon, devicetree, linux, bcousson, linux-omap, linux-arm-kernel * Peter Ujfalusi <peter.ujfalusi@ti.com> [181213 13:57]: > After some debugging I have managed to get the ethernet working with > mainline u-boot while not breaking the networking with the case when we > boot with the mysterious binary u-boot. I'm pretty sure this is the most recent version of WIP u-boot SPI support from Nishanth: https://github.com/nmenon/u-boot/tree/v2014.04-mod/sdp4430-ethernet From what I recall, that did not work for Blaze though for enabling Ethernet for tftp booting but worked on 4430-sdp. Maybe because of the same issues as these kernel patches though. Regards, Tony _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot 2018-12-13 15:17 ` Tony Lindgren @ 2018-12-14 13:06 ` Peter Ujfalusi 0 siblings, 0 replies; 8+ messages in thread From: Peter Ujfalusi @ 2018-12-14 13:06 UTC (permalink / raw) To: Tony Lindgren Cc: Nishanth Menon, devicetree, linux, bcousson, linux-omap, linux-arm-kernel On 13/12/2018 17.17, Tony Lindgren wrote: > * Peter Ujfalusi <peter.ujfalusi@ti.com> [181213 13:57]: >> After some debugging I have managed to get the ethernet working with >> mainline u-boot while not breaking the networking with the case when we >> boot with the mysterious binary u-boot. > > I'm pretty sure this is the most recent version of > WIP u-boot SPI support from Nishanth: > > https://github.com/nmenon/u-boot/tree/v2014.04-mod/sdp4430-ethernet Cool, thanks! It fails to compile so far with any of the toolchains I have tried so far :( > From what I recall, that did not work for Blaze though > for enabling Ethernet for tftp booting but worked on > 4430-sdp. Maybe because of the same issues as these > kernel patches though. My Blaze is the 'big phone w/ two display' and not the tablet. Afaik it is a shrink down version of sdp. And the u-boot code still leaves open the questions regarding to pinmix and gpio_138. - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot 2018-12-13 13:58 [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot Peter Ujfalusi 2018-12-13 15:17 ` Tony Lindgren @ 2018-12-13 15:50 ` Russell King - ARM Linux 2018-12-14 13:08 ` Peter Ujfalusi 2019-01-24 16:17 ` Tony Lindgren 2 siblings, 1 reply; 8+ messages in thread From: Russell King - ARM Linux @ 2018-12-13 15:50 UTC (permalink / raw) To: Peter Ujfalusi; +Cc: tony, devicetree, linux-omap, linux-arm-kernel, bcousson On Thu, Dec 13, 2018 at 03:58:45PM +0200, Peter Ujfalusi wrote: > The ethernet works in kernel only if we use some binary u-boot from the > past which have support for KS8851. > > The u-boot sources are not available for this mysterious u-boot image > people tends to hold on... Mainline u-bott does not have ethernet support > for sdp4430 and if we use that the ethernet is not working. > > After some debugging I have managed to get the ethernet working with > mainline u-boot while not breaking the networking with the case when we > boot with the mysterious binary u-boot. > > Basically we were missing bunch of pinmux settings and the 'magic' > gpio_138 handling in kernel. > > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Hi Peter, Digging up where my u-boot came from, I found: https://plus.google.com/103895730806848715870/posts/cCq2CxDogW9 Unfortunately, gitorious no longer exists, but I do still have a clone of that tree locally, containing: 9f384308319e OMAP4SDP: Add Micrel KS8851 net chip support ae631b095a87 NET: Add driver for Micrel KS8851 78e43f2a8987 ARMV7: OMAP: Add spi driver for OMAP3/OMAP4 e576c6a9cbc9 omap4_common: config: remove I2C for SPL mode 19d5934c4b3b ARM: OMAP4: Move TEXT_BASE down to non-HS limit plus some of my own modifications to fix the problems stated in that post. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot 2018-12-13 15:50 ` Russell King - ARM Linux @ 2018-12-14 13:08 ` Peter Ujfalusi 2018-12-14 13:16 ` Russell King - ARM Linux 0 siblings, 1 reply; 8+ messages in thread From: Peter Ujfalusi @ 2018-12-14 13:08 UTC (permalink / raw) To: Russell King - ARM Linux Cc: tony, devicetree, linux-omap, linux-arm-kernel, bcousson On 13/12/2018 17.50, Russell King - ARM Linux wrote: > On Thu, Dec 13, 2018 at 03:58:45PM +0200, Peter Ujfalusi wrote: >> The ethernet works in kernel only if we use some binary u-boot from the >> past which have support for KS8851. >> >> The u-boot sources are not available for this mysterious u-boot image >> people tends to hold on... Mainline u-bott does not have ethernet support >> for sdp4430 and if we use that the ethernet is not working. >> >> After some debugging I have managed to get the ethernet working with >> mainline u-boot while not breaking the networking with the case when we >> boot with the mysterious binary u-boot. >> >> Basically we were missing bunch of pinmux settings and the 'magic' >> gpio_138 handling in kernel. >> >> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> > > Hi Peter, > > Digging up where my u-boot came from, I found: > > https://plus.google.com/103895730806848715870/posts/cCq2CxDogW9 > > Unfortunately, gitorious no longer exists, but I do still have a clone > of that tree locally, containing: > > 9f384308319e OMAP4SDP: Add Micrel KS8851 net chip support > ae631b095a87 NET: Add driver for Micrel KS8851 > 78e43f2a8987 ARMV7: OMAP: Add spi driver for OMAP3/OMAP4 > e576c6a9cbc9 omap4_common: config: remove I2C for SPL mode > 19d5934c4b3b ARM: OMAP4: Move TEXT_BASE down to non-HS limit > > plus some of my own modifications to fix the problems stated in that > post. I certainly have the version of u-boot which can do only one tftp load (or dhcp request). - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot 2018-12-14 13:08 ` Peter Ujfalusi @ 2018-12-14 13:16 ` Russell King - ARM Linux 2018-12-18 10:28 ` Peter Ujfalusi 0 siblings, 1 reply; 8+ messages in thread From: Russell King - ARM Linux @ 2018-12-14 13:16 UTC (permalink / raw) To: Peter Ujfalusi; +Cc: tony, devicetree, linux-omap, linux-arm-kernel, bcousson On Fri, Dec 14, 2018 at 03:08:09PM +0200, Peter Ujfalusi wrote: > I certainly have the version of u-boot which can do only one tftp load > (or dhcp request). That'll be because of the buggy KS8851 driver. This is the patch I have on top of my 2014 version of Nishanth's tree. diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c index 6467dde7ebf6..f888f43ad937 100644 --- a/drivers/net/ks8851.c +++ b/drivers/net/ks8851.c @@ -27,6 +27,27 @@ #include "ks8851.h" #define KS8851_SNL 1 +#undef DEBUG + +static void dump_mem(const char *str, const void *base, unsigned orig, unsigned len) +{ +#ifdef DEBUG + const unsigned char *p = base; + unsigned i, j; + + printf("%s:", str); + + for (j = 0; j < len; j += 32) { + printf("\n%04x:", j); + for (i = j; i < j + 32 && i < len; i++) + printf("%s%s%02x", + (i == j + 16) ? " " : "", + i == orig ? "|" : " ", + p[i]); + } + printf("\n"); +#endif +} /* * GET_KS8851SNL_RWWORD_CMD @@ -324,6 +345,7 @@ void KS8851SNL_READ_BUFFER(void *pHardware, pdw++; *puReadLen = (u16)((*pdw) >> 16); *ppOut = pIn + 8; +dump_mem("RX", pMove, spiBurstLen + 8, spiBurstLen + 8); } if (spiBurstFlag != SPI_READ_BURST_ALL) { @@ -626,6 +648,7 @@ static int ks8851_eth_recv(struct eth_device *dev) printf("frame count = %d\n", rxFrameCount); #endif + pHardware->m_uCurFrameIndex = 0; pHardware->m_uFramesRemained = rxFrameCount; if (rxFrameCount == 0) @@ -697,7 +720,7 @@ static int ks8851_eth_send(struct eth_device *dev, uiPacketLength = length; GET_DATA_ALIGNMENT(length, &uiPacketLength); HW_WRITE_START(pHardware); - +dump_mem("TX", packet, length, uiPacketLength); #ifdef KS8851_SNL KS8851SNL_DATA_WRITE((u8 *)packet, length, uiPacketLength, &fReturn); #else @@ -722,12 +745,19 @@ static int ks8851_eth_send(struct eth_device *dev, return 1; } +static int ks8851_eth_init2(struct eth_device *dev, bd_t *bd) +{ + return 0; +} + static int ks8851_eth_init(struct eth_device *dev, bd_t *bd) { u16 txCntl, rxCntl, w, intMask; PHARDWARE pHardware = &gHardware; + dev->init = ks8851_eth_init2; + pHardware->m_uCurFrameIndex = 0; pHardware->m_uFramesRemained = 0; pHardware->m_uCurRecvFrams = MAX_RECV_FRAMES; diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index 0d9c16ea9f04..ae94dd852f3d 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -21,6 +21,9 @@ #include <configs/omap4_common.h> +#undef CONFIG_SYS_PROMPT +#define CONFIG_SYS_PROMPT "OMAP44XX SDP # " + #ifndef CONFIG_SPL_BUILD /* Battery Charger */ #define CONFIG_CMD_BAT 1 -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot 2018-12-14 13:16 ` Russell King - ARM Linux @ 2018-12-18 10:28 ` Peter Ujfalusi 0 siblings, 0 replies; 8+ messages in thread From: Peter Ujfalusi @ 2018-12-18 10:28 UTC (permalink / raw) To: Russell King - ARM Linux Cc: tony, devicetree, linux-omap, linux-arm-kernel, bcousson On 14/12/2018 15.16, Russell King - ARM Linux wrote: > On Fri, Dec 14, 2018 at 03:08:09PM +0200, Peter Ujfalusi wrote: >> I certainly have the version of u-boot which can do only one tftp load >> (or dhcp request). > > That'll be because of the buggy KS8851 driver. This is the patch I > have on top of my 2014 version of Nishanth's tree. Thanks! Can you test the patch to see if it is not breaking things? I believe the patch is correct as we clearly missing pinmux configuration from the DT for pins. > > diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c > index 6467dde7ebf6..f888f43ad937 100644 > --- a/drivers/net/ks8851.c > +++ b/drivers/net/ks8851.c > @@ -27,6 +27,27 @@ > > #include "ks8851.h" > #define KS8851_SNL 1 > +#undef DEBUG > + > +static void dump_mem(const char *str, const void *base, unsigned orig, unsigned len) > +{ > +#ifdef DEBUG > + const unsigned char *p = base; > + unsigned i, j; > + > + printf("%s:", str); > + > + for (j = 0; j < len; j += 32) { > + printf("\n%04x:", j); > + for (i = j; i < j + 32 && i < len; i++) > + printf("%s%s%02x", > + (i == j + 16) ? " " : "", > + i == orig ? "|" : " ", > + p[i]); > + } > + printf("\n"); > +#endif > +} > > /* > * GET_KS8851SNL_RWWORD_CMD > @@ -324,6 +345,7 @@ void KS8851SNL_READ_BUFFER(void *pHardware, > pdw++; > *puReadLen = (u16)((*pdw) >> 16); > *ppOut = pIn + 8; > +dump_mem("RX", pMove, spiBurstLen + 8, spiBurstLen + 8); > } > > if (spiBurstFlag != SPI_READ_BURST_ALL) { > @@ -626,6 +648,7 @@ static int ks8851_eth_recv(struct eth_device *dev) > printf("frame count = %d\n", rxFrameCount); > #endif > > + pHardware->m_uCurFrameIndex = 0; > pHardware->m_uFramesRemained = rxFrameCount; > > if (rxFrameCount == 0) > @@ -697,7 +720,7 @@ static int ks8851_eth_send(struct eth_device *dev, > uiPacketLength = length; > GET_DATA_ALIGNMENT(length, &uiPacketLength); > HW_WRITE_START(pHardware); > - > +dump_mem("TX", packet, length, uiPacketLength); > #ifdef KS8851_SNL > KS8851SNL_DATA_WRITE((u8 *)packet, length, uiPacketLength, &fReturn); > #else > @@ -722,12 +745,19 @@ static int ks8851_eth_send(struct eth_device *dev, > return 1; > } > > +static int ks8851_eth_init2(struct eth_device *dev, bd_t *bd) > +{ > + return 0; > +} > + > static int ks8851_eth_init(struct eth_device *dev, bd_t *bd) > { > > u16 txCntl, rxCntl, w, intMask; > PHARDWARE pHardware = &gHardware; > > + dev->init = ks8851_eth_init2; > + > pHardware->m_uCurFrameIndex = 0; > pHardware->m_uFramesRemained = 0; > pHardware->m_uCurRecvFrams = MAX_RECV_FRAMES; > diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h > index 0d9c16ea9f04..ae94dd852f3d 100644 > --- a/include/configs/omap4_sdp4430.h > +++ b/include/configs/omap4_sdp4430.h > @@ -21,6 +21,9 @@ > > #include <configs/omap4_common.h> > > +#undef CONFIG_SYS_PROMPT > +#define CONFIG_SYS_PROMPT "OMAP44XX SDP # " > + > #ifndef CONFIG_SPL_BUILD > /* Battery Charger */ > #define CONFIG_CMD_BAT 1 > > - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot 2018-12-13 13:58 [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot Peter Ujfalusi 2018-12-13 15:17 ` Tony Lindgren 2018-12-13 15:50 ` Russell King - ARM Linux @ 2019-01-24 16:17 ` Tony Lindgren 2 siblings, 0 replies; 8+ messages in thread From: Tony Lindgren @ 2019-01-24 16:17 UTC (permalink / raw) To: Peter Ujfalusi; +Cc: linux-arm-kernel, devicetree, linux-omap, linux, bcousson * Peter Ujfalusi <peter.ujfalusi@ti.com> [181213 05:57]: > The ethernet works in kernel only if we use some binary u-boot from the > past which have support for KS8851. > > The u-boot sources are not available for this mysterious u-boot image > people tends to hold on... Mainline u-bott does not have ethernet support > for sdp4430 and if we use that the ethernet is not working. > > After some debugging I have managed to get the ethernet working with > mainline u-boot while not breaking the networking with the case when we > boot with the mysterious binary u-boot. > > Basically we were missing bunch of pinmux settings and the 'magic' > gpio_138 handling in kernel. Applying into omap-for-v5.1/dt thanks. Tony _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-01-24 16:17 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-12-13 13:58 [PATCH] ARM: dts: omap4-sdp: Make ethernet working even if booted with latest u-boot Peter Ujfalusi 2018-12-13 15:17 ` Tony Lindgren 2018-12-14 13:06 ` Peter Ujfalusi 2018-12-13 15:50 ` Russell King - ARM Linux 2018-12-14 13:08 ` Peter Ujfalusi 2018-12-14 13:16 ` Russell King - ARM Linux 2018-12-18 10:28 ` Peter Ujfalusi 2019-01-24 16:17 ` Tony Lindgren
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).