am3358 uboot mii2 ping不通

请教个问题:

使用AM3358的mii2 连接KSZ8041PHY,在uboot下ping不通?

请教一下在uboot中是否可以使用mii2进行网络通信,需要进行如何设置?

使用的uboot版本为2018.07如图:

uboot中的pinmux的配置为:

static struct module_pin_mux rmii2_pin_mux[] = {
{OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
{OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
{OFFSET(gpmc_csn3), MODE(2) | RXACTIVE}, /* MII2_CRS *//* gpmc_csn3.rmmii2_crs_dv */
{OFFSET(gpmc_wpn), MODE(3) | RXACTIVE}, /* MII2_RXERR *//* gpmc_wpn.rmmii2_rxer */
{OFFSET(gpmc_a0), MODE(3)}, /* MII2_TXEN */ /* gpmc_a0.rmmii2_txen */
{OFFSET(gpmc_a4), MODE(3)}, /* MII1_TXD1 */ /* gpmc_a4.rmmii2_txd1 */
{OFFSET(gpmc_a5), MODE(3)}, /* MII1_TXD0 */ /* gpmc_a5.rmmii2_txd0 */
{OFFSET(gpmc_a10), MODE(3) | RXACTIVE}, /* MII1_RXD1 *//* gpmc_a10.rmmii2_rxd1 */
{OFFSET(gpmc_a11), MODE(3) | RXACTIVE}, /* MII1_RXD0 *//* gpmc_a11.rmmii2_rxd0 */
{OFFSET(mii1_col), MODE(1) | RXACTIVE}, /* RMII1_REFCLK *//* gpmc_a11.rmmii2_REFCLK */
{-1},
};

dts中的配置为:

/*net*/
cpsw_default: cpsw_default {
pinctrl-single,pins = <
AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gpmc_a0.rmmii2_txen */
AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gpmc_a5.rmmii2_txd0 */
AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* gpmc_a4.rmmii2_txd1 */
AM33XX_IOPAD(0x874, PIN_INPUT_PULLDOWN | MUX_MODE3) /* gpmc_wpn.rmmii2_rxer */
AM33XX_IOPAD(0x888, PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_csn3.rmmii2_crs_dv */
AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE3) /* gpmc_a11.rmmii2_rxd0 */
AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE3) /* gpmc_a11.rmmii2_rxd1 */
AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE1) /* gpmc_a11.rmmii2_REFCLK */

>;
};

davinci_mdio_default: davinci_mdio_default {
pinctrl-single,pins = <
/* MDIO */
AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
>;
};

gpio_mdio_default: gpio_mdio_default {
pinctrl-single,pins = <
/* MDIO via GPIO*/
AM33XX_IOPAD(0x948, PIN_INPUT | MUX_MODE7) /* mdio_data.mdio_data GPIO0_0*/
AM33XX_IOPAD(0x94c, PIN_OUTPUT| MUX_MODE7) /* mdio_clk.mdio_clk GPIO0_1 */
>;
};

&mac {
pinctrl-names = "default";
pinctrl-0 = <&cpsw_default>;
slaves = <1>; /* use only one emac if */
status = "okay";

mdio0: gpio {
compatible = "mdio-gpio";
pinctrl-names = "default";
pinctrl-0 = <&gpio_mdio_default>;

#address-cells = <1>;
#size-cells = <0>;
gpios = <&gpio0 1 GPIO_ACTIVE_HIGH /* MDIO-CLK */
&gpio0 0 GPIO_ACTIVE_HIGH>; /* MDIO-DATA */

phy0: ethernet-phy@1 {
reg = <0>;
};
};
};

&davinci_mdio {
pinctrl-names = "default";
pinctrl-0 = <&davinci_mdio_default>;
status = "disabled";
};&cpsw_emac1 { 

phy_id = <&mdio0>,<2>;
phy-mode = "rmii";
};

&phy_sel {
rmii-clock-ext;
};

am335x-evmsk.dts.txt

6 个回复

  • 状元 208367 points

    请问能link吗?uboot的log信息是什么?

  • 回复 Shine:

    能linkup。

    P:lib/initcall.c,L:25, F:initcall_run_list, i:37...
    initcall: 8080f0f9 (relocated to bff480f9)
    Net: F:net/eth-uclass.c, L:402, F:eth_initialize, start:
    F:common/miiphyutil.c, L:66, F:miiphy_init, start:
    F:drivers/net/phy/phy.c, L:474, F:phy_init, PHY USE Start:
    F:drivers/net/phy/phy.c, L:512, F:phy_init, PHY USE CONFIG_PHY_MICREL_KSZ8XXX:
    P:drivers/core/uclass.c,L:214, F:uclass_find_first_device, ...
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:drivers/core/uclass.c, L:219, F:uclass_find_first_device ret:0
    F:drivers/core/uclass.c, L:228, F:uclass_find_first_device
    F:drivers/core/uclass.c, L:569, F:uclass_first_device_check ret:0
    P:drivers/core/device.c,L:322, F:device_probe, ...
    F:drivers/core/device.c, L:354, F:device_probe
    P:drivers/core/device.c,L:322, F:device_probe, ...
    F:drivers/core/device.c, L:382, F:device_probe
    uclass_find_device_by_seq: 0 -1
    uclass_find_device_by_seq: 0 0
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    - -1 -1 'ethernet@4a100000'
    - not found
    F:drivers/net/cpsw.c, L:1360, F:cpsw_eth_ofdata_to_platdata
    OF: ** translation for device ethernet@4a100000 **
    OF: bus is default (na=1, ns=1) on ocp
    OF: translating address: 0000104a
    OF: parent bus is default (na=1, ns=1) on
    OF: no ranges, 1:1 translation
    OF: parent translation for: 00000000
    OF: with offset: 1242562560
    OF: one level translation: 0000104a
    OF: reached root node
    fdtdec_get_int: cpdma_channels: 0x8 (8)
    fdtdec_get_int: slaves: 0x1 (1)
    fdtdec_get_int: ale_entries: 0x400 (1024)
    fdtdec_get_int: bd_ram_size: 0x2000 (8192)
    fdtdec_get_int: mac_control: 0x20 (32)
    gpio_get_list_count: Node 'ethernet@4a100000', property 'mode-gpios', GPIO count failed: -2
    fdtdec_get_int: active_slave: 0x0 (0)
    F:drivers/net/cpsw.c, L:1419, F:cpsw_eth_ofdata_to_platdata active_slave:0
    fdtdec_get_addr_size_auto_noparent: fdtdec_get_addr_size_auto_parent: na=1, ns=1, fdtdec_get_addr_size_fixed: reg: addr=4a101000
    fdtdec_lookup_phandle: phy-handle
    fdtdec_get_int_array: phy_id
    get_prop_check_min_len: phy_id
    F:lib/fdtdec.c, L:676, F:fdtdec_get_int_array,prop_name:phy_id, array[0]:58
    F:lib/fdtdec.c, L:676, F:fdtdec_get_int_array,prop_name:phy_id, array[1]:2
    fdtdec_get_addr_size_auto_noparent: fdtdec_get_addr_size_auto_parent: na=1, ns=1, fdtdec_get_addr_size_fixed: reg: addr=44e10650
    F:drivers/net/cpsw.c, L:1487, F:cpsw_eth_ofdata_to_platdata
    fdtdec_lookup_phandle: syscon
    OF: ** translation for device scm_conf@0 **
    OF: bus is default (na=1, ns=1) on scm@210000
    OF: translating address: 00000000
    OF: parent bus is default (na=1, ns=1) on l4_wkup@44c00000
    OF: walking ranges...
    OF: default map, cp=0, s=8192, da=0
    OF: parent translation for: 00002100
    OF: with offset: 0
    OF: one level translation: 00002100
    OF: parent bus is default (na=1, ns=1) on ocp
    OF: walking ranges...
    OF: default map, cp=0, s=2621440, da=2162688
    OF: parent translation for: 0000c044
    OF: with offset: 2162688
    OF: one level translation: 0000e144
    OF: parent bus is default (na=1, ns=1) on
    OF: no ranges, 1:1 translation
    OF: parent translation for: 00000000
    OF: with offset: 1155596288
    OF: one level translation: 0000e144
    OF: reached root node
    F:drivers/net/cpsw.c, L:1066, F:_cpsw_register, 0
    F:drivers/net/cpsw.c, L:1005, F:cpsw_slave_setup slave_num:0
    F:drivers/net/cpsw.c, L:1020, F:cpsw_phy_init. phy_addr:2
    ethernet@4a100000 connected to Micrel KSZ804
    F:drivers/net/phy/phy.c, L:393, F:genphy_config
    F:net/eth-uclass.c, L:420, F:eth_initialize
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    eth0: ethernet@4a100000

    => mii info
    MII_PHYSID2 @ 0x0 = 0x1513
    PHY_PHYIDR[1,2] @ 0x0 = 0x00221513
    PHY 0x00: OUI = 0x0885, Model = 0x11, Rev = 0x03, 10baseT, HDX
    PHY ID register 2 read failed
    MII_PHYSID2 @ 0x2 = 0x1513
    PHY_PHYIDR[1,2] @ 0x2 = 0x00221513
    PHY 0x02: OUI = 0x0885, Model = 0x11, Rev = 0x03, 10baseT, HDX
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    PHY ID register 2 read failed
    => setenv ipaddr 172.30.131.108
    Initial value for argc=3
    Final value for argc=3
    => ping 172.30.131.73
    F:net/net.c, L:412, F:net_loop protocol:5
    --- net_loop Entry
    --- net_loop UDP handler set (00000000)
    --- net_loop ARP handler set (00000000)
    --- net_loop timeout handler cancelled
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    P:drivers/core/uclass.c,L:214, F:uclass_find_first_device, ...
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:drivers/core/uclass.c, L:219, F:uclass_find_first_device ret:0
    F:drivers/core/uclass.c, L:228, F:uclass_find_first_device
    P:drivers/core/uclass.c,L:408, F:uclass_get_device_tail, ...
    P:drivers/core/device.c,L:322, F:device_probe, ...
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:net/net.c, L:359, F:net_init_loop net_ethaddr:0x a8.10.87.b4.3f.5f
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:drivers/net/cpsw.c, L:783, F:cpdma_process start
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    P:drivers/core/uclass.c,L:214, F:uclass_find_first_device, ...
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:drivers/core/uclass.c, L:219, F:uclass_find_first_device ret:0
    F:drivers/core/uclass.c, L:228, F:uclass_find_first_device
    P:drivers/core/uclass.c,L:408, F:uclass_get_device_tail, ...
    P:drivers/core/device.c,L:322, F:device_probe, ...
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    Initial value for argc=3
    Final value for argc=3
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    Trying ethernet@4a100000
    F:drivers/net/cpsw.c, L:823, F:_cpsw_init
    F:drivers/net/cpsw.c, L:669, F:cpsw_update_link
    F:drivers/net/cpsw.c, L:623, F:cpsw_slave_update_link
    F:drivers/net/phy/phy.c, L:226, F:genphy_update_link
    F:drivers/net/phy/phy.c, L:234, F:genphy_update_link. mii_reg: 0x786d
    link up on port 0, speed 100, full duplex
    F:drivers/net/cpsw.c, L:867, F:_cpsw_init
    F:drivers/net/cpsw.c, L:734, F:cpdma_submit
    F:drivers/net/cpsw.c, L:734, F:cpdma_submit
    F:drivers/net/cpsw.c, L:734, F:cpdma_submit
    F:drivers/net/cpsw.c, L:734, F:cpdma_submit
    --- NetState set to 0
    --- net_loop Init
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:net/net.c, L:359, F:net_init_loop net_ethaddr:0x a8.10.87.b4.3f.5f
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    Using ethernet@4a100000 device
    --- net_loop timeout handler set (bff891e1)
    sending ARP for 172.30.131.73
    ARP broadcast 1
    F:net/eth-uclass.c, L:337, F:eth_send, start:
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:drivers/net/cpsw.c, L:1174, F:cpsw_eth_send
    F:drivers/net/cpsw.c, L:966, F:_cpsw_send
    F:drivers/net/cpsw.c, L:783, F:cpdma_process start
    F:drivers/net/cpsw.c, L:734, F:cpdma_submit
    F:net/eth-uclass.c, L:363, F:eth_rx, start:
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:drivers/net/cpsw.c, L:1184, F:cpsw_eth_recv
    F:drivers/net/cpsw.c, L:986, F:_cpsw_recv
    F:drivers/net/cpsw.c, L:783, F:cpdma_process start
    F:drivers/net/cpsw.c, L:790, F:cpdma_process status:-536869390
    F:drivers/net/cpsw.c, L:794, F:cpdma_process start
    F:net/eth-uclass.c, L:377, F:eth_rx eth_get_ops:-16
    eth_rx: recv() returned error -16


    --- net_loop UDP handler set (00000000)
    --- net_loop ARP handler set (00000000)
    --- net_loop timeout handler cancelled
    F:net/eth-uclass.c, L:68, F:eth_get_dev, start:
    F:drivers/core/uclass.c, L:36, F:uclass_find name:usb_dev_generic
    F:drivers/core/uclass.c, L:36, F:uclass_find name:eth
    F:drivers/core/uclass.c, L:151, F:uclass_get
    F:drivers/core/uclass.c, L:156, F:uclass_get
    F:drivers/net/cpsw.c, L:783, F:cpdma_process start
    F:drivers/net/cpsw.c, L:790, F:cpdma_process status:-805306308
    F:drivers/net/cpsw.c, L:783, F:cpdma_process start

    Abort
    --- net_loop Abort!
    --- NetState set to 0
    ping failed; host 172.30.131.73 is not alive
    Command failed, result=1
    => mdio list
    ethernet@4a100000:
    2 - Micrel KSZ804 <--> ethernet@4a100000

  • 状元 208367 points

    回复 user6317248:

    您能用wireshark看一下是否有收到U-Boot 'ping' 发出来的APR requset?

    TI 诚邀您参加全新设计的产品页面测试,参加测试即可享有 TI 购物 9 折优惠码,点击加入 EP产品页面测试报名,名额有限。感谢您的参与!

  • 回复 Shine:

    wireshark收不到uboot发出的arp requset.

  • 回复 user6317248:

    ping时,使用示波器抓取am3358至PHY(KSZ8041)之间的发送信号,抓取不到任何数据波形。
    主机ping时,示波器能够抓取到am3358至PHY(KSZ8041)之间的接收信号。
  • 状元 208367 points

    回复 user6317248:

    请问您是不是MMI1和MMI2都用了?连MMI1的PHY0能工作是吗?
    另外,您可以用示波器量一下TXC信号看是否是2.5MHz或者25MHz?
    请参考git.ti.com/.../board.c
    使用'mii dump 2 0' 和 'mii dump 2 1'命令把PHY2 register导出来看看器件的基本状态。
    下面是关于在u-boot里启动network的培训资料,可以参考一下。training.ti.com/.../ETH_System_SW_on_AMClass_Devices.pdf