打印
[i.MX]

mx6d uboot-2015-04-r0 rmii lan8720

[复制链接]
3008|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ispsubb|  楼主 | 2016-5-12 15:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
目前在调试uboot  mx6d rmii lan8720a 。
平台: mx6d , uboot-2015-04-r0
硬件: rmii + lan8720 (硬件应该是OK的, linux3.14.52 上面OK,另外也是在L3.0.35上面有验证的)

先说一下目前我已经做得一些改动,RGMII 相关均屏蔽。

mx6sabresd.c 中
1,pin 脚配置 OK
static iomux_v3_cfg_t const enet_pads[] = {
        MX6_PAD_ENET_MDIO__ENET_MDIO                | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET_MDC__ENET_MDC                | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET_CRS_DV__ENET_RX_EN            | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET_RX_ER__ENET_RX_ER                   | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET_TX_EN__ENET_TX_EN                   | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET_RXD0__ENET_RX_DATA0            | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET_RXD1__ENET_RX_DATA1            | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET_TXD0__ENET_TX_DATA0            | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET_TXD1__ENET_TX_DATA1            | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_GPIO_16__ENET_REF_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_EIM_D21__GPIO3_IO21 | MUX_PAD_CTRL(NO_PAD_CTRL),
};

2,PIN脚配置调用 及PHY reset
static void setup_iomux_enet(void)
{
        imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
        // Reset lan8720 PHY
        gpio_direction_output(IMX_GPIO_NR(3, 21) , 1);
        udelay(150);
        gpio_set_value(IMX_GPIO_NR(3, 21), 0);       
        udelay(200);
        gpio_set_value(IMX_GPIO_NR(3, 21), 1);
        udelay(100);
}


3,时钟 ,并且在board_init 中调用
static int setup_fec(void)
{
    struct iomuxc_base_regs *iomuxc_regs =
                (struct iomuxc_base_regs *)IOMUXC_BASE_ADDR;
    int ret;
    /* set gpr1[21] to select anatop clock */
    clrsetbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK, 1
<< 21);
        ret = enable_fec_anatop_clock(0, ENET_50MHZ);
        if (ret)
                return ret;
    return 0;
}

mx6sabre-common.h 中

4,RMII 相关配置

#define CONFIG_CMD_PING
#define CONFIG_CMD_DHCP
#define CONFIG_CMD_MII
#define CONFIG_CMD_NET
#define CONFIG_FEC_MXC
#define CONFIG_MII
#define IMX_FEC_BASE            ENET_BASE_ADDR
#define CONFIG_FEC_XCV_TYPE        RMII
#define CONFIG_ETHPRIME                 "FEC"
#define CONFIG_FEC_MXC_PHYADDR        0

#define CONFIG_PHYLIB
#define CONFIG_PHY_SMSC


5,目前现象

a , clk 时钟已经出来了,OK

b, log 如下:  (ip 已经是在同一网段)

U-Boot 2015.04-imx_v2015.04_3.14.52_1.1.0_ga+g6cf684a (May 10 2016 - 16:42:24)

CPU:   Freescale i.MX6D rev1.2 at 792 MHz
CPU:   Temperature 36 C
Reset cause: POR
Board: MX6-SabreSD
I2C:   ready
DRAM:  1 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
No panel detected: default to Hannstar-XGA
Display: Hannstar-XGA (1024x768)
In:    serial
Out:   serial
Err:   serial
switch to partitions #0, OK
mmc2(part 0) is current device
Net:   FEC [PRIME]
Normal Boot
Hit any key to stop autoboot:  0
=>
=>
=> ping 192.168.0.1
Using FEC device
error frame: 0x4ef46dc0 0x00000804
error frame: 0x4ef47400 0x00000804
error frame: 0x4ef47a40 0x00000804
error frame: 0x4f24ba40 0x00000884
error frame: 0x4f24c080 0x00000804

ARP Retry count exceeded; starting again
error frame: 0x4ef46dc0 0x00000804
error frame: 0x4ef47400 0x00000804
error frame: 0x4ef47a40 0x00000804
error frame: 0x4f24ba40 0x00000804
error frame: 0x4f24c080 0x00000884

ARP Retry count exceeded; starting again

相关帖子

沙发
ispsubb|  楼主 | 2016-5-13 09:06 | 只看该作者
没有人回复吗? @FSL_TICS_Rita
其他的一些操作
1, mii bus , we can use  mii command in uboot. the phy address of the hardware design is 0 .
and software configure is "#define CONFIG_FEC_MXC_PHYADDR        0"
=> mii info
PHY 0x00: OUI = 0x01F0, Model = 0x0F, Rev = 0x01, 100baseT, FDX

=> mii devices
MII devices: 'FEC'
Current device: 'FEC'

2, I have configure the SION for the clock .
mx6q_pins.h

MX6_PAD_DECL(GPIO_16__ENET_REF_CLK,        0x0618, 0x0248, 2 | IOMUX_CONFIG_SION, 0x083C, 1, 0)
and then ,I can measure 50MHz clk at GPIO_16 PIN

3 I define the DEBUG in mx6sabre_common.h  . The log is :
=> ping 192.168.0.1
eth_halt: wait for stop regs
eth_halt: done
Trying FEC
fec_mii_setspeed: mii_speed 0000001a
fec_open: fec_open(dev)
fec_mdio_read: phy: 00 reg:01 val:0x782d
fec_mdio_read: phy: 00 reg:01 val:0x782d
fec_mdio_read: phy: 00 reg:04 val:0x1e1
fec_mdio_read: phy: 00 reg:05 val:0x4de1
fec_open:Speed=100
Using FEC device
fec_send: status 0xc00 index 0 ret 0
fec_recv: ievent 0xe000000
fec_recv: status 0x804
error frame: 0x4ef3ddc0 0x00000804
fec_recv: stop
fec_recv: ievent 0x0
fec_recv: status 0x8000
fec_recv: stop
fec_recv: ievent 0x0
fec_recv: status 0x8000
fec_recv: stop
fec_recv: ievent 0x0
fec_recv: status 0x8000
fec_recv: stop
fec_recv: ievent 0x0
fec_recv: status 0x8000
fec_recv: stop
fec_recv: ievent 0x0
fec_recv: status 0x8000
fec_recv: stop
fec_recv: ievent 0x0
fec_recv: status 0x8000

使用特权

评论回复
板凳
mini1986| | 2016-11-10 16:05 | 只看该作者
看看返回的状态是什么意思,之前在am335x上调过lan8710......

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3

主题

10

帖子

1

粉丝