From: Vagrant Cascadian <vagrant@aikidev.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] mx6cuboxi: PHY/FEC detection
Date: Fri, 01 May 2015 17:07:38 -0700 [thread overview]
Message-ID: <87iocbu9it.fsf@aikidev.net> (raw)
In-Reply-To: <CAOMZO5DqcgEPCPhqLT8r2fwDdvg1KsOeFOg2hbF3TA-Bi-Z2Dw@mail.gmail.com>
On 2015-05-01, Fabio Estevam wrote:
> On Fri, May 1, 2015 at 5:20 PM, Fabio Estevam <festevam@gmail.com> wrote:
>
>> Looking at Solid-run's tree they have the following commit that may be
>> related to this PHY issue:
>
> I applied Rabeeh's patch on top of this v2 series and generated the
> two attached patches.
>
> Could you please give them a try and let us know if it fixes the
> Ethernet PHY detect issue?
After some brief testing with these two patches, it seems to be
working. After trying various methods (cold boot, reset from u-boot
prompt several consecutive times, reboot from linux several times), it
seems to consistantly detect the PHY.
Thanks for looking into it!
live well,
vagrant
> From c0078a4fe907f8c579924f89ee5ac48e40d84736 Mon Sep 17 00:00:00 2001
> From: Fabio Estevam <fabio.estevam@freescale.com>
> Date: Fri, 1 May 2015 18:09:30 -0300
> Subject: [PATCH 1/2] fec: Allow passing a phy mask in fecmxc_initialize_multi()
>
> Instead of only accepting a fixed PHY address, allow passing a range of PHY
> addresses through a mask address.
>
> Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> board/denx/m28evk/m28evk.c | 4 ++--
> board/freescale/mx28evk/mx28evk.c | 4 ++--
> board/schulercontrol/sc_sps_1/sc_sps_1.c | 4 ++--
> drivers/net/fec_mxc.c | 10 +++++-----
> include/netdev.h | 2 +-
> 5 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c
> index 33d38cf..7b4f67d 100644
> --- a/board/denx/m28evk/m28evk.c
> +++ b/board/denx/m28evk/m28evk.c
> @@ -131,13 +131,13 @@ int board_eth_init(bd_t *bis)
> udelay(10000);
> #endif
>
> - ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
> + ret = fecmxc_initialize_multi(bis, 0, 1 << 0, MXS_ENET0_BASE);
> if (ret) {
> printf("FEC MXS: Unable to init FEC0\n");
> return ret;
> }
>
> - ret = fecmxc_initialize_multi(bis, 1, 3, MXS_ENET1_BASE);
> + ret = fecmxc_initialize_multi(bis, 1, 1 << 3, MXS_ENET1_BASE);
> if (ret) {
> printf("FEC MXS: Unable to init FEC1\n");
> return ret;
> diff --git a/board/freescale/mx28evk/mx28evk.c b/board/freescale/mx28evk/mx28evk.c
> index 5005fe2..4cf9332 100644
> --- a/board/freescale/mx28evk/mx28evk.c
> +++ b/board/freescale/mx28evk/mx28evk.c
> @@ -118,13 +118,13 @@ int board_eth_init(bd_t *bis)
> udelay(200);
> gpio_set_value(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 1);
>
> - ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
> + ret = fecmxc_initialize_multi(bis, 0, 1 << 0, MXS_ENET0_BASE);
> if (ret) {
> puts("FEC MXS: Unable to init FEC0\n");
> return ret;
> }
>
> - ret = fecmxc_initialize_multi(bis, 1, 3, MXS_ENET1_BASE);
> + ret = fecmxc_initialize_multi(bis, 1, 1 << 3, MXS_ENET1_BASE);
> if (ret) {
> puts("FEC MXS: Unable to init FEC1\n");
> return ret;
> diff --git a/board/schulercontrol/sc_sps_1/sc_sps_1.c b/board/schulercontrol/sc_sps_1/sc_sps_1.c
> index 7f0b591..fdaa383 100644
> --- a/board/schulercontrol/sc_sps_1/sc_sps_1.c
> +++ b/board/schulercontrol/sc_sps_1/sc_sps_1.c
> @@ -79,13 +79,13 @@ int board_eth_init(bd_t *bis)
> CLKCTRL_ENET_TIME_SEL_MASK,
> CLKCTRL_ENET_TIME_SEL_RMII_CLK | CLKCTRL_ENET_CLK_OUT_EN);
>
> - ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
> + ret = fecmxc_initialize_multi(bis, 0, 1 << 0, MXS_ENET0_BASE);
> if (ret) {
> printf("FEC MXS: Unable to init FEC0\n");
> return ret;
> }
>
> - ret = fecmxc_initialize_multi(bis, 1, 1, MXS_ENET1_BASE);
> + ret = fecmxc_initialize_multi(bis, 1, 1 << 1, MXS_ENET1_BASE);
> if (ret) {
> printf("FEC MXS: Unable to init FEC1\n");
> return ret;
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index b572470..9817df2 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -1077,7 +1077,7 @@ struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)
> return bus;
> }
>
> -int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
> +int fecmxc_initialize_multi(bd_t *bd, int dev_id, uint32_t phy_mask, uint32_t addr)
> {
> uint32_t base_mii;
> struct mii_dev *bus = NULL;
> @@ -1095,19 +1095,19 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
> #else
> base_mii = addr;
> #endif
> - debug("eth_init: fec_probe(bd, %i, %i) @ %08x\n", dev_id, phy_id, addr);
> + debug("eth_init: fec_probe(bd, %i, %i) @ %08x\n", dev_id, phy_mask, addr);
> bus = fec_get_miibus(base_mii, dev_id);
> if (!bus)
> return -ENOMEM;
> #ifdef CONFIG_PHYLIB
> - phydev = phy_find_by_mask(bus, 1 << phy_id, PHY_INTERFACE_MODE_RGMII);
> + phydev = phy_find_by_mask(bus, phy_mask, PHY_INTERFACE_MODE_RGMII);
> if (!phydev) {
> free(bus);
> return -ENOMEM;
> }
> ret = fec_probe(bd, dev_id, addr, bus, phydev);
> #else
> - ret = fec_probe(bd, dev_id, addr, bus, phy_id);
> + ret = fec_probe(bd, dev_id, addr, bus, phy_mask);
> #endif
> if (ret) {
> #ifdef CONFIG_PHYLIB
> @@ -1121,7 +1121,7 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
> #ifdef CONFIG_FEC_MXC_PHYADDR
> int fecmxc_initialize(bd_t *bd)
> {
> - return fecmxc_initialize_multi(bd, -1, CONFIG_FEC_MXC_PHYADDR,
> + return fecmxc_initialize_multi(bd, -1, 1 << CONFIG_FEC_MXC_PHYADDR,
> IMX_FEC_BASE);
> }
> #endif
> diff --git a/include/netdev.h b/include/netdev.h
> index d96e1da..15c513d 100644
> --- a/include/netdev.h
> +++ b/include/netdev.h
> @@ -49,7 +49,7 @@ int eth_3com_initialize (bd_t * bis);
> int ethoc_initialize(u8 dev_num, int base_addr);
> int fec_initialize (bd_t *bis);
> int fecmxc_initialize(bd_t *bis);
> -int fecmxc_initialize_multi(bd_t *bis, int dev_id, int phy_id, uint32_t addr);
> +int fecmxc_initialize_multi(bd_t *bis, int dev_id, uint32_t phy_mask, uint32_t addr);
> int ftgmac100_initialize(bd_t *bits);
> int ftmac100_initialize(bd_t *bits);
> int ftmac110_initialize(bd_t *bits);
> --
> 1.9.1
>
> From cc3a6625a4ddab8943c8d66f5dd0aac651e7c5e5 Mon Sep 17 00:00:00 2001
> From: Fabio Estevam <fabio.estevam@freescale.com>
> Date: Fri, 1 May 2015 18:16:13 -0300
> Subject: [PATCH 2/2] mx6cuboxi: Fix Ethernet PHY undetected problem
>
> mx6cuboxi sometimes fails to recognize the Ethernet PHY:
>
> Net: Phy 0 not found
>
> The explanation comes from a patch from Rabeeh:
>
> "Initialize the phy in address 0x0 or 0x4 (0x11 phy mask).
> The LED_ACT pin on the carrier-one boards had a pull down that
> forces the phy address to 0x0; where on CuBox-i and the production
> HummingBoard that pin is connected directly to LED that depending
> on the pull down strength of the LED it might be sampled as '0' or '1' thus
> the phy address might appear as either address 0x0 or 0x4."
>
> Reported-by: Vagrant Cascadian <vagrant@aikidev.net>
> Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> board/solidrun/mx6cuboxi/mx6cuboxi.c | 16 ++++++++++++++++
> include/configs/mx6cuboxi.h | 1 -
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> index 9aa0259..d1ba2dd 100644
> --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> @@ -133,6 +133,8 @@ static iomux_v3_cfg_t const enet_pads[] = {
> IOMUX_PADS(PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)),
> IOMUX_PADS(PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)),
> IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL_PD)),
> + IOMUX_PADS(PAD_ENET_RXD0__GPIO1_IO27 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD)),
> + IOMUX_PADS(PAD_ENET_RXD1__GPIO1_IO26 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD)),
> };
>
> static void setup_iomux_enet(void)
> @@ -144,6 +146,20 @@ static void setup_iomux_enet(void)
> gpio_set_value(ETH_PHY_RESET, 1);
> }
>
> +int fecmxc_initialize(bd_t *bd)
> +{
> + /*
> + * Initialize the phy in address 0x0 or 0x4 (0x11 phy mask).
> + * The LED_ACT pin on the carrier-one boards had a pull down that
> + * forces the phy address to 0x0; where on CuBox-i and the production
> + * HummingBoard that pin is connected directly to LED that depending
> + * on the pull down strength of the LED it might be sampled
> + * as '0' or '1' thus the phy address might appear as either address
> + * 0x0 or 0x4.
> + */
> + return fecmxc_initialize_multi(bd, -1, 0x11, IMX_FEC_BASE);
> +}
> +
> int board_phy_config(struct phy_device *phydev)
> {
> if (phydev->drv->config)
> diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
> index 4e07f59..3759b3f 100644
> --- a/include/configs/mx6cuboxi.h
> +++ b/include/configs/mx6cuboxi.h
> @@ -57,7 +57,6 @@
> #define CONFIG_MII
> #define IMX_FEC_BASE ENET_BASE_ADDR
> #define CONFIG_FEC_XCV_TYPE RGMII
> -#define CONFIG_FEC_MXC_PHYADDR 0
> #define CONFIG_PHYLIB
> #define CONFIG_PHY_ATHEROS
>
> --
> 1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150501/1d9d4b3d/attachment.sig>
next prev parent reply other threads:[~2015-05-02 0:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 1:28 [U-Boot] [PATCH v2 1/4] mx6cuboxi: Add HDMI output support Fabio Estevam
2015-04-30 1:28 ` [U-Boot] [PATCH v2 2/4] mx6cuboxi: Add USB host support Fabio Estevam
2015-04-30 21:26 ` Vagrant Cascadian
2015-04-30 21:40 ` Fabio Estevam
2015-04-30 22:20 ` Vagrant Cascadian
2015-04-30 23:50 ` Vagrant Cascadian
2015-05-01 2:14 ` Fabio Estevam
2015-05-01 5:50 ` Vagrant Cascadian
2015-05-01 7:33 ` Stefano Babic
2015-05-01 15:06 ` Fabio Estevam
2015-05-01 16:20 ` Vagrant Cascadian
2015-05-01 17:10 ` Fabio Estevam
2015-05-01 20:20 ` Fabio Estevam
2015-05-01 21:37 ` Fabio Estevam
2015-05-02 0:07 ` Vagrant Cascadian [this message]
2015-05-02 8:54 ` [U-Boot] mx6cuboxi: PHY/FEC detection Stefano Babic
2015-05-02 14:12 ` Fabio Estevam
2015-05-04 3:24 ` Fabio Estevam
2015-05-04 6:19 ` Stefano Babic
2015-04-30 22:21 ` [U-Boot] [PATCH v2 2/4] mx6cuboxi: Add USB host support Vagrant Cascadian
2015-05-02 9:15 ` Stefano Babic
2015-04-30 1:28 ` [U-Boot] [PATCH v2 3/4] mx6cuboxi: Allow HDMI and USB keyboard to be stdout/stdin Fabio Estevam
2015-04-30 21:27 ` Vagrant Cascadian
2015-05-02 9:16 ` Stefano Babic
2015-04-30 1:28 ` [U-Boot] [PATCH v2 4/4] logos: Add Solidrun's logo Fabio Estevam
2015-05-02 9:19 ` Stefano Babic
2015-04-30 21:28 ` [U-Boot] [PATCH v2 1/4] mx6cuboxi: Add HDMI output support Vagrant Cascadian
2015-05-02 9:15 ` Stefano Babic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iocbu9it.fsf@aikidev.net \
--to=vagrant@aikidev.net \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox