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
已解决! 转到解答。
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);
}
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);
}