This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MACCONTROL register in AM3358 not being updated by CPSW driver

Other Parts Discussed in Thread: AM3358

We're having some trouble bringing up the Ethernet on our board. We have an AM3358 and Marvell 88E1512 PHY.

After bringing up the eth0 interface in Linux, I queried the MACCONTROL register to see what the contents were, but the value I obtain is always zero.

In drivers/net/ethernet/ti/cpsw.c, I modified the bottom of the _cpsw_adjust_link() function to print the value that (I think) is supposed to be written to the MACCONTROL register. That value is non-zero, however the address it's being written to is not the address of the MACCONTROL register! According to the TRM, it should be at 0x4a100d04, but the address is actually 0xe08fcd84. According to the TRM memory map, this address is in a reserved area.

Why am I not able to see the value of the MACCONTROL register? Is the MACCONTROL register actually being set properly?

Here is the bottom of the modified _cpsw_adjust_link() function:

	if (mac_control != slave->mac_control) {
		phy_print_status(phy);
		__raw_writel(mac_control, &slave->sliver->mac_control);
		printk("phy_debug: Just wrote 0x%08x to MACCONTROL register at address 0x%08x.\n", mac_control, (unsigned int)&(slave->sliver->mac_control));
	}

And here is the code I'm using to obtain the value of the MACCONTROL register (this code is actually in the driver I'm writing for the PHY):

void phy_debug_dump_reg(u32 addr, char* name)
{
	void* map;

	if (request_mem_region(addr, 4, "phy_debug") != NULL)
	{
		map = ioremap(addr, 4);

		if (map != NULL)
		{
			printk("phy_debug: %s (0x%08x): 0x%08x\n", name, addr, ioread32(map));
			iounmap(map);
		}
		else
		{
			printk("phy_debug: ioremap() failed for %s (0x%08x).\n", name, addr);
		}

		release_mem_region(addr, 4);
	}
	else printk("phy_debug: request_mem_region() failed for %s (0x%08x).\n", name, addr);
}

// Elsewhere:
phy_debug_dump_reg(0x4a100d04, "MACCONTROL");