各位大神好,我们的板使用AM3352,网络芯片使用DP83848J,双网卡,u-boot驱动使用通用的CPSW,在驱动注册的时候,mdio寄存器的mdio-control第30bit写入1失败。具体代码如下:
static void cpsw_mdio_init(char *name, u32 mdio_base, u32 div)
{
struct mii_dev *bus = mdio_alloc();
mdio_regs = (struct cpsw_mdio_regs *)mdio_base;
/* set enable and clock divider */
__raw_writel(div | CONTROL_ENABLE, &mdio_regs->control);
/*
* wait for scan logic to settle:
* the scan time consists of (a) a large fixed component, and (b) a
* small component that varies with the mii bus frequency. These
* were estimated using measurements at 1.1 and 2.2 MHz on tnetv107x
* silicon. Since the effect of (b) was found to be largely
* negligible, we keep things simple here.
*/
udelay(1000);
bus->read = cpsw_mdio_read;
bus->write = cpsw_mdio_write;
sprintf(bus->name, name);
mdio_register(bus);
}
u-boot启动时,就停在红色代码的地方。mdio寄存器的地址为0x4a101000,control的地址为0x4a101004,使用CCS6.1连仿真器,查看0x4a101000寄存器为写保护,但是根据TRM,control的第30bit是R/W的,红色代码部分就是将0x400000FF写入control,即第30bit和0~7bit写入1,但是就是写入不成功。
另外:CPU和网络芯片使用MII接口,已设置gmii_sel寄存器为GMII模式。