summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorjhibbits <jhibbits@FreeBSD.org>2016-04-05 02:27:01 +0000
committerjhibbits <jhibbits@FreeBSD.org>2016-04-05 02:27:01 +0000
commit3744256f5c62876e0d891a75413cec933c562a5c (patch)
treecf9276a1c43e15cb0e6f4f8b27b92e4b6ed026c6 /sys/powerpc
parente8575f5bc72f2ecb0f1a130b43281aa484da57e5 (diff)
downloadFreeBSD-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')
-rw-r--r--sys/powerpc/mpc85xx/i2c.c12
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));
+}
OpenPOWER on IntegriCloud