Hi experts!
I am using SJA1105Q board with RGMII connection like this
and I used the sja1105 configuration tool with sja1105QS.py to generate the code for static configuration.
and I found the connection between the two phys is OK but the MCU to SJA1105 (MCU --> port3 or port4 phy) isnot OK.
My code about configuration for sja1105 is here.
rc = sja1105_check_device_id(priv);// check sja1105 device id
if (rc < 0) {
printk("================lyl======== cannot find device id\n");
dev_err(dev, "Device ID check failed: %d\n", rc);
return rc;
}
// write static config code to sja1105.
int sizecfg = sizeof(configBurst0_0);
for(i = 0; i < sizecfg; i += 256)
{
// write every single 64 4-bytes(32bits).
rc = sja1105_xfer_buf(priv, SPI_WRITE, 0x20000 + i/4,
&configBurst0_0[i], (((sizecfg - i) > 256) ? 256 : (sizecfg - i)));
printk("================lyl======== sja1105_xfer_buf addr=0x%x, rc=%d, i=%d, sizecfg=%d\n", (0x20000 + i/4), rc, i, sizecfg);
}
//config clock source for RGMII port0 to port4
u8 value2[] = {0x0B,0x00,0x08,0x00};//RGMII_TX_CLK_x to be written is 0x0B000800.
rc = sja1105_xfer_buf(priv, SPI_WRITE, 0x10001C, value2, 4);
rc = sja1105_xfer_buf(priv, SPI_WRITE, 0x100016, value2, 4);
rc = sja1105_xfer_buf(priv, SPI_WRITE, 0x100022, value2, 4);
rc = sja1105_xfer_buf(priv, SPI_WRITE, 0x100028, value2, 4);
rc = sja1105_xfer_buf(priv, SPI_WRITE, 0x10002e, value2, 4);
I sent ethernet packet through MCU and I got err counter register.
for example, ==lyl== 0x1400 rc=0,result=[0x1,0x2,0x3,0x4] means reading register 0x1400 is 0x01020304.
Could anyone tell me what is wrong with the configuration?
PS: MCU to SJA1105 connection is SJA1105 port 0 (MAC to MAC)
My MCU is TDA4VM(TI).