- 硬件设置:
1.1 网口0的phyaddr为0;网口1的phyaddr为1。
1.2 网口模式为双RMII。使用芯片双lan8720.
- 现象说明:
l 只能找到一个网口,只有phy_id = "0:00"的网口能找到并好用。
l 只要设成phy_id= "0:01"或其它值都不行,如果phy_id设成非0,则找不网口。
l 能找到网口时phymask 始终为0xfffffffe。
l 内核版本为3.2。(4.0 dts的也试过现象一样)
- 配置
3.1 board-am335xevm.c
/* Module pin mux for rmii1 */
static struct pinmux_config rmii1_pin_mux[] = {
{"mii1_crs.rmii1_crs_dv", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"mii1_rxerr.mii1_rxerr", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"mii1_txen.mii1_txen", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},
{"mii1_txd1.mii1_txd1", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},
{"mii1_txd0.mii1_txd0", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},
{"mii1_rxd1.mii1_rxd1", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"mii1_rxd0.mii1_rxd0", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"rmii1_refclk.rmii1_refclk", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},
{"mdio_data.mdio_data", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
{"mdio_clk.mdio_clk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT_PULLUP},
{NULL, 0},
};
/* Module pin mux for rmii2 */
static struct pinmux_config rmii2_pin_mux[] = {
{"gpmc_wait0.rmii2_crs_dv", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLDOWN},
{"gpmc_wpn.rmii2_rxerr", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLDOWN},
{"gpmc_a0.rmii2_txen", OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT},
{"gpmc_a4.rmii2_txd1", OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT},
{"gpmc_a5.rmii2_txd0", OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT},
{"gpmc_a10.rmii2_rxd1", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLDOWN},
{"gpmc_a11.rmii2_rxd0", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLDOWN},
{"mii1_col.rmii2_refclk", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"mdio_data.mdio_data", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
{"mdio_clk.mdio_clk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT_PULLUP},
{NULL, 0},
};
3.2 devicdes.c
static struct cpsw_slave_data am33xx_cpsw_slaves[] = {
{
.slave_reg_ofs = 0x208,
.sliver_reg_ofs = 0xd80,
.phy_id = "0:00",
.dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_0,
},
{
.slave_reg_ofs = 0x308,
.sliver_reg_ofs = 0xdc0,
.phy_id = "0:01",
.dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_1,
},
};
4. 内核设置:
4.1 [*] Networking support —>
<*> 802.1Q VLAN Support
[*] GVRP (GARP VLAN Registration Protocol) support
4.2 Device Drivers —>
[*] Network device support —>
[*] Ethernet driver support —>
[*] Texas Instruments (TI) devices
< > TI DaVinci EMAC Support
-*- TI DaVinci MDIO Support
-*- TI DaVinci CPDMA Support
<*> TI CPSW Switch Support
[*] TI CPSW Switch as Dual EMAC
Jian Zhou:
首先问下,你在U-boot下有没有单独调通过这两个网口。
zheng lian:
回复 Jian Zhou:
没有在Uboot下调试过。
Jian Zhou:
回复 zheng lian:
建议你先在SDK06的U-boot中根据PHY的id分别调试下,这样首先确认不是硬件的问题。