Make i2c device child auto-probe work for MPC85xx and QorIQ SoCs.
OFW i2c probing requires a new method ofw_bus_get_node(), and the bus device is assumed iichb. With these changes, i2c devices attached in fdt are probed and attached automagically.
This commit is contained in:
parent
281a5e676b
commit
2db664d7b5
@ -97,6 +97,7 @@ static int i2c_stop(device_t dev);
|
||||
static int i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr);
|
||||
static int i2c_read(device_t dev, char *buf, int len, int *read, int last, int delay);
|
||||
static int i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout);
|
||||
static phandle_t i2c_get_node(device_t bus, device_t dev);
|
||||
|
||||
static device_method_t i2c_methods[] = {
|
||||
DEVMETHOD(device_probe, i2c_probe),
|
||||
@ -110,12 +111,13 @@ static device_method_t i2c_methods[] = {
|
||||
DEVMETHOD(iicbus_read, i2c_read),
|
||||
DEVMETHOD(iicbus_write, i2c_write),
|
||||
DEVMETHOD(iicbus_transfer, iicbus_transfer_gen),
|
||||
DEVMETHOD(ofw_bus_get_node, i2c_get_node),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t i2c_driver = {
|
||||
"i2c",
|
||||
"iichb",
|
||||
i2c_methods,
|
||||
sizeof(struct i2c_softc),
|
||||
};
|
||||
@ -425,3 +427,11 @@ i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout)
|
||||
|
||||
return (IIC_NOERR);
|
||||
}
|
||||
|
||||
static phandle_t
|
||||
i2c_get_node(device_t bus, device_t dev)
|
||||
{
|
||||
|
||||
/* Share controller node with iibus device. */
|
||||
return (ofw_bus_get_node(bus));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user