Enabling two ethernet ports in u-boot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enabling two ethernet ports in u-boot

5,580 Views
corono
Contributor II

Hi

I've built my own board based on the iMX7dsabre eval board. One of the differences: Both ethernet ports are on their own MDIO-line. Both ports work in Li-nux, but in u-boot (2018-03_4), only one works. I guess the problem is the config-header I took (and adjusted) from the sabre board:

#define CONFIG_FEC_ENET_DEV                          0

#define CONFIG_PHY_BROADCOM
/* ENET1 */
#if (CONFIG_FEC_ENET_DEV == 0)
#define IMX_FEC_BASE                                          ENET_IPS_BASE_ADDR
#define CONFIG_FEC_MXC_PHYADDR                0x0
#define CONFIG_ETHPRIME                                   "eth0"
#define CONFIG_FEC_MXC_MDIO_BASE            ENET_IPS_BASE_ADDR
/* ENET2 */
#elif (CONFIG_FEC_ENET_DEV == 1)
#define IMX_FEC_BASE                                          ENET2_IPS_BASE_ADDR
#define CONFIG_FEC_MXC_PHYADDR                0x1
#define CONFIG_ETHPRIME                                   "eth1"
#define CONFIG_FEC_MXC_MDIO_BASE          ENET2_IPS_BASE_ADDR
#endif

#endif

If I define CONFIG_FEC_ENET_DEV  as 0, only port eth0 works in u-boot, if I define CONFIG_FEC_ENET_DEV  as 1, only port eth1 works. So the settings should be correct. The problem is, that CONFIG_FEC_MXC_PHYADDR is a parameter from u-boot and can only be defined for one port.

If I scan the devices in u-boot with mdio list for ONFIG_FEC_ENET_DEV 0:

=> mdio list
FEC0:
0 - Generic PHY <--> ethernet@30be0000
FEC1:
0 - Generic PHY <--> ethernet@30bf0000

For ONFIG_FEC_ENET_DEV 1:

=> mdio list
FEC0:
1 - Generic PHY <--> ethernet@30be0000
FEC1:
1 - Generic PHY <--> ethernet@30bf0000

Both ports get the address that is defined in the header file. How can I change the header file to enable both ports at the same time? (Something like CONFIG_FEC2_MXC_PHYADDR)

Thanks.

Sebastian

Labels (1)
Tags (1)
0 Kudos
Reply
5 Replies

5,219 Views
corono
Contributor II

H Igor

Thanks for your answer. But I'm not sure if it helps.

My problem is in u-boot. In linux, both ports work. Deleting the ethaddr variable does not help. Also in u-boot, both ports work, but not at the same time, depending on the hardcoded CONFIG_FEC_ENET_DEV flag.  And when I have a look in the board header file of the linked imx6ull eval board, it looks quite similar to the one from the imx7dsabre:

#ifdef CONFIG_CMD_NET
#define CONFIG_CMD_MII
#define CONFIG_FEC_MXC
#define CONFIG_MII
#define CONFIG_FEC_ENET_DEV             1

#if (CONFIG_FEC_ENET_DEV == 0)
#define IMX_FEC_BASE                               ENET_BASE_ADDR
#define CONFIG_FEC_MXC_PHYADDR    0x2
#define CONFIG_FEC_XCV_TYPE             RMII
#ifdef CONFIG_DM_ETH
#define CONFIG_ETHPRIME                      "eth0"
#else
#define CONFIG_ETHPRIME "FEC0"
#endif
#elif (CONFIG_FEC_ENET_DEV == 1)
#define IMX_FEC_BASE                               ENET2_BASE_ADDR
#define CONFIG_FEC_MXC_PHYADDR    0x1
#define CONFIG_FEC_XCV_TYPE             RMII
#ifdef CONFIG_DM_ETH
#define CONFIG_ETHPRIME                      "eth1"
#else
#define CONFIG_ETHPRIME                      "FEC1"
#endif
#endif
#define CONFIG_FEC_MXC_MDIO_BASE ENET2_BASE_ADDR
#endif

With CONFIG_FEC_ENET_DEV, port 0 or 1 is selected. So there is the same problem as in the imx7dsabre.

Sebastian

0 Kudos
Reply

5,219 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos
Reply

5,219 Views
corono
Contributor II

Hi Igor

Thanks for the links. I already found them, but it does not help. The GIT-Repository of the BELK-Board is password protected, I don't have access. And I know how to switch between the two ports in u-boot, but only one works because of the wrong configuration (see the previous posts).

The sabre board uses the "fec_mxc" u-boot driver. I don't see a way to use this driver with two ports, the address is hardcoded:

#ifdef CONFIG_FEC_MXC_PHYADDR
int fecmxc_initialize(bd_t *bd)
{
    return fecmxc_initialize_multi(bd, -1, CONFIG_FEC_MXC_PHYADDR,
            IMX_FEC_BASE);
}
#endif

Or:

#ifdef CONFIG_FEC_MXC_MDIO_BASE
    /*
     * The i.MX28 has two ethernet interfaces, but they are not equal.
     * Only the first one can access the MDIO bus.
     */
    base_mii = CONFIG_FEC_MXC_MDIO_BASE;
#else

There are these defines (CONFIG_FEC_MXC_PHYADDR, CONFIG_FEC_MXC_MDIO_BASE) in the driver. They are different for both ports on my board, but can't be set independently.

Best Regards

Sebastian

0 Kudos
Reply

5,219 Views
igorpadykov
NXP Employee
NXP Employee

Hi Sebastian

suggested solution for i.mx6ul has the similar  #defines.

Best regards
igor

0 Kudos
Reply

5,219 Views
igorpadykov
NXP Employee
NXP Employee

Hi Sebastian

one can look on similar solution for i.mx6ul :

https://community.nxp.com/thread/500763 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply