bug in ARM/LPC32XX eth init code / probably OF related

From: Martin Devera
Date: Sun Jul 05 2015 - 07:56:30 EST


Hi,

I compiled vanilla 4.1.1 for LPC3240 MPU without loadable module support.
I created own dts and board .c source:

static void __init lpc3250_machine_init(void)
{
__raw_writel(0x1600 ,LPC32XX_GPIO_P_MUX_SET); // SSP0
__raw_writel(1<<6 , io_p2v(0x40028004)); // ETH unreset

lpc32xx_serial_init();
of_platform_populate(NULL, of_default_bus_match_table,
lpc32xx_auxdata_lookup, NULL);
}

All seems to be ok, only ETH doesn't work. I found the problem -
Micrel PHY driver is inited later than lpc_eth driver and it doesn't bind
to the eth.
I solved it by ugly hack - set status="disabled" for eth in dts and adding:

static struct of_device_id __initdata of_ids[] = {
{ .compatible = "nxp,lpc-eth" },{}
};
static void __init devik_late_init(void) // errorchecking omited
{
struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "nxp,lpc-eth");
struct property *p = of_find_property(np,"status",NULL);
of_remove_property(np,p);
of_node_clear_flag(np, OF_POPULATED);
of_platform_bus_probe(np,of_ids,NULL);
}

Other solutiuon is to make it module a load later (we prefer no modules here),
or editing lpc_eth.c to register in device_initcall_sync.

Is there some better solution for the bug ?

devik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/