diff options
author | loos <loos@FreeBSD.org> | 2017-06-20 18:25:27 +0000 |
---|---|---|
committer | Luiz Souza <luiz@netgate.com> | 2017-07-17 15:03:27 -0500 |
commit | fad7209b05ecfd3fce73f53f7e2a92671436fd90 (patch) | |
tree | 8fda59d0089146c567822508cac0f22ee62303e7 | |
parent | 7a12f7622fdbe16d13ee6265004b7d4012055f26 (diff) | |
download | FreeBSD-src-fad7209b05ecfd3fce73f53f7e2a92671436fd90.zip FreeBSD-src-fad7209b05ecfd3fce73f53f7e2a92671436fd90.tar.gz |
Make ofw_iicbus attach to twsi I2C controllers.
Add the ofw_bus_get_node() callback in mv_twsi, it is mandatory for the
ofw_iicbus usage.
Sponsored by: Rubicon Communications, LLC (Netgate)
(cherry picked from commit 63d5603d622c5bb69f74644f066faa68709e87fb)
-rw-r--r-- | sys/dev/iicbus/ofw_iicbus.c | 2 | ||||
-rw-r--r-- | sys/dev/iicbus/twsi/mv_twsi.c | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/sys/dev/iicbus/ofw_iicbus.c b/sys/dev/iicbus/ofw_iicbus.c index 0820bbf..bff23ec 100644 --- a/sys/dev/iicbus/ofw_iicbus.c +++ b/sys/dev/iicbus/ofw_iicbus.c @@ -84,6 +84,8 @@ EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass, 0, 0, BUS_PASS_BUS); EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass, 0, 0, BUS_PASS_BUS); +EARLY_DRIVER_MODULE(ofw_iicbus, twsi, ofw_iicbus_driver, ofwiicbus_devclass, + 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_iicbus, 1); MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1); diff --git a/sys/dev/iicbus/twsi/mv_twsi.c b/sys/dev/iicbus/twsi/mv_twsi.c index 998a197..997263e 100644 --- a/sys/dev/iicbus/twsi/mv_twsi.c +++ b/sys/dev/iicbus/twsi/mv_twsi.c @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +static phandle_t mv_twsi_get_node(device_t, device_t); static int mv_twsi_probe(device_t); static int mv_twsi_attach(device_t); @@ -105,7 +106,10 @@ static device_method_t mv_twsi_methods[] = { DEVMETHOD(device_probe, mv_twsi_probe), DEVMETHOD(device_attach, mv_twsi_attach), - { 0, 0 } + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, mv_twsi_get_node), + + DEVMETHOD_END }; DEFINE_CLASS_1(twsi, mv_twsi_driver, mv_twsi_methods, @@ -117,6 +121,14 @@ DRIVER_MODULE(twsi, simplebus, mv_twsi_driver, mv_twsi_devclass, 0, 0); DRIVER_MODULE(iicbus, twsi, iicbus_driver, iicbus_devclass, 0, 0); MODULE_DEPEND(twsi, iicbus, 1, 1, 1); +static phandle_t +mv_twsi_get_node(device_t bus, device_t dev) +{ + + /* Used by ofw_iicbus. */ + return (ofw_bus_get_node(bus)); +} + static int mv_twsi_probe(device_t dev) { |