mii commands do not work in u-boot

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

mii commands do not work in u-boot

跳至解决方案
6,308 次查看
VincentChou1z
Contributor III

Hi!

I tried to use mii commands to access PHY information in u-boot.  Unfortunately I could only see a FEC0 from "mii device" and no output from other mii commands like "mii info", "mii read" and "mii dump".  Could anyone share his/her experience to make these commands work in u-boot environment?  We need to test some PHY information in order to customize our FEC interface. 

Vincent

标签 (1)
1 解答
2,749 次查看
Sasamy
Contributor IV

Hi Vincent,

just add two lines, mii commands do not work because these functions are called without initializing

 

drivers/net/mxc_fec.c:

static int mxc_fec_mii_read(char *devname, unsigned char addr,
                unsigned char reg, unsigned short *value)
{
    struct eth_device *dev = eth_get_dev_by_name(devname);
    struct fec_info_s *info;
    volatile fec_t *fecp;

    if (!dev)
        return -1;

    info = dev->priv;
    fecp = (fec_t *) (info->iobase);

    fec_reset(dev);
    mxc_fec_mii_init(fecp);    

    return __fec_mii_read(fecp, addr, reg, value);
}

static int mxc_fec_mii_write(char *devname, unsigned char addr,
                 unsigned char reg, unsigned short value)
{
    struct eth_device *dev = eth_get_dev_by_name(devname);
    struct fec_info_s *info;
    volatile fec_t *fecp;

    if (!dev)
        return -1;

    info = dev->priv;
    fecp = (fec_t *) (info->iobase);

    fec_reset(dev);
    mxc_fec_mii_init(fecp);    

    return __fec_mii_write(fecp, addr, reg, value);
}

在原帖中查看解决方案

2 回复数
2,750 次查看
Sasamy
Contributor IV

Hi Vincent,

just add two lines, mii commands do not work because these functions are called without initializing

 

drivers/net/mxc_fec.c:

static int mxc_fec_mii_read(char *devname, unsigned char addr,
                unsigned char reg, unsigned short *value)
{
    struct eth_device *dev = eth_get_dev_by_name(devname);
    struct fec_info_s *info;
    volatile fec_t *fecp;

    if (!dev)
        return -1;

    info = dev->priv;
    fecp = (fec_t *) (info->iobase);

    fec_reset(dev);
    mxc_fec_mii_init(fecp);    

    return __fec_mii_read(fecp, addr, reg, value);
}

static int mxc_fec_mii_write(char *devname, unsigned char addr,
                 unsigned char reg, unsigned short value)
{
    struct eth_device *dev = eth_get_dev_by_name(devname);
    struct fec_info_s *info;
    volatile fec_t *fecp;

    if (!dev)
        return -1;

    info = dev->priv;
    fecp = (fec_t *) (info->iobase);

    fec_reset(dev);
    mxc_fec_mii_init(fecp);    

    return __fec_mii_write(fecp, addr, reg, value);
}

2,749 次查看
MaxChou
Contributor III

Dear  Sir.

have any MII command patch for u-boot 2014.4 ?

Thanks

0 项奖励
回复