[PATCH] gianfar: prevent resource conflict
Renaud Barbier
renaud.barbier at ge.com
Tue Jun 4 13:01:29 EDT 2013
Hello Sacha,
I applied your patch and try it on our mpc8544 based board
with a few modification.
This board uses eTSEC1. This means all 3 regions have the same
base address.
I just did the following update to your patch.
It only maps the eTSEC registers and mdio bus registers.
static int fsl_phy_init(void)
{
add_generic_device("gfar-phy", 0, NULL, MDIO_BASE_ADDR, 0x1000,
IORESOURCE_MEM, NULL);
return 0;
}
coredevice_initcall(fsl_phy_init);
int fsl_eth_init(int num, struct gfar_info_struct *gf)
{
printf("FSL_ETH_INIT: num = %d, 0x%x\n", num - 1,
GFAR_BASE_ADDR + (num - 1) * 0x1000);
add_generic_device("gfar", num - 1, NULL,
GFAR_BASE_ADDR + (num - 1) * 0x1000, 0x1000,
IORESOURCE_MEM, gf);
return 0;
}
I added a few debug messages in request_region and got:
barebox 2013.05.0-00706-g87df6ec-dirty #13 Tue Jun 4 17:17:34 BST 2013
Board: DA923RC
dev_request_mem_region:got resource
request_region:name = gfar-phy0, parent = 1ffa6494
request_region ok: 0xe0024000:0xe0024fff
gfar_phy_probe:phy->regs= e0024000, 0
gfar_phy_probe: id = 0
mdio_bus: miibus0: probed
...
FSL_ETH_INIT: num = 0, 0xe0024000
dev_request_mem_region:got resource
request_region:name = gfar0, parent = 1ffa6494
request_region: 0xe0024000:0xe0024fff conflicts with 0xe0024000:0xe0024fff
gfar_probe:priv->regs 00000000, 0
gfar_halt:regs = 00000000
Even though, two devices have been added, both have the same parent
iomem and the same region is compared. A conflict is then detected.
When gfar_probe requests its Ethernet register region, NULL is returned.
More information about the barebox
mailing list