diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2016-04-05 02:27:01 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2016-04-05 02:27:01 +0000 |
commit | 3744256f5c62876e0d891a75413cec933c562a5c (patch) | |
tree | cf9276a1c43e15cb0e6f4f8b27b92e4b6ed026c6 /sys/powerpc/mpc85xx | |
parent | e8575f5bc72f2ecb0f1a130b43281aa484da57e5 (diff) | |
download | FreeBSD-src-3744256f5c62876e0d891a75413cec933c562a5c.zip FreeBSD-src-3744256f5c62876e0d891a75413cec933c562a5c.tar.gz |
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.
Diffstat (limited to 'sys/powerpc/mpc85xx')
-rw-r--r-- | sys/powerpc/mpc85xx/i2c.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/powerpc/mpc85xx/i2c.c b/sys/powerpc/mpc85xx/i2c.c index e02a08b..89c91a2 100644 --- a/sys/powerpc/mpc85xx/i2c.c +++ b/sys/powerpc/mpc85xx/i2c.c @@ -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)); +} |