Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jun 2017 18:25:27 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320159 - in head/sys/dev/iicbus: . twsi
Message-ID:  <201706201825.v5KIPRng071486@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Tue Jun 20 18:25:27 2017
New Revision: 320159
URL: https://svnweb.freebsd.org/changeset/base/320159

Log:
  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)

Modified:
  head/sys/dev/iicbus/ofw_iicbus.c
  head/sys/dev/iicbus/twsi/mv_twsi.c

Modified: head/sys/dev/iicbus/ofw_iicbus.c
==============================================================================
--- head/sys/dev/iicbus/ofw_iicbus.c	Tue Jun 20 18:14:56 2017	(r320158)
+++ head/sys/dev/iicbus/ofw_iicbus.c	Tue Jun 20 18:25:27 2017	(r320159)
@@ -84,6 +84,8 @@ EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driv
     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);
 

Modified: head/sys/dev/iicbus/twsi/mv_twsi.c
==============================================================================
--- head/sys/dev/iicbus/twsi/mv_twsi.c	Tue Jun 20 18:14:56 2017	(r320158)
+++ head/sys/dev/iicbus/twsi/mv_twsi.c	Tue Jun 20 18:25:27 2017	(r320159)
@@ -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,
@@ -116,6 +120,14 @@ static devclass_t mv_twsi_devclass;
 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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706201825.v5KIPRng071486>