svn commit: r297572 - head/sys/powerpc/mpc85xx
Justin Hibbits
jhibbits at FreeBSD.org
Tue Apr 5 02:27:03 UTC 2016
Author: jhibbits
Date: Tue Apr 5 02:27:01 2016
New Revision: 297572
URL: https://svnweb.freebsd.org/changeset/base/297572
Log:
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.
Modified:
head/sys/powerpc/mpc85xx/i2c.c
Modified: head/sys/powerpc/mpc85xx/i2c.c
==============================================================================
--- head/sys/powerpc/mpc85xx/i2c.c Tue Apr 5 01:12:56 2016 (r297571)
+++ head/sys/powerpc/mpc85xx/i2c.c Tue Apr 5 02:27:01 2016 (r297572)
@@ -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,
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));
+}
More information about the svn-src-head
mailing list