mii commands do not work in u-boot

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

mii commands do not work in u-boot

Jump to solution
6,309 Views
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

Labels (1)
1 Solution
2,750 Views
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);
}

View solution in original post

2 Replies
2,751 Views
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,750 Views
MaxChou
Contributor III

Dear  Sir.

have any MII command patch for u-boot 2014.4 ?

Thanks

0 Kudos
Reply