Let ofw_iicbus work its magic on OPAL i2c buses.

ofw_iicbus already has attachments on iichb.  Rather than adding an explicit
attachment onto opal_i2c, simply change the exposed name of the OPAL i2c bus
to 'iichb'.
This commit is contained in:
Justin Hibbits 2018-07-07 01:58:40 +00:00
parent 2ef6727edd
commit fedd55f14b

View File

@ -90,6 +90,7 @@ static int opal_i2c_callback(device_t, int, caddr_t);
static int opal_i2c_probe(device_t);
static int opal_i2c_transfer(device_t, struct iic_msg *, uint32_t);
static int i2c_opal_send_request(uint32_t, struct opal_i2c_request *);
static phandle_t opal_i2c_get_node(device_t bus, device_t dev);
static device_method_t opal_i2c_methods[] = {
/* Device interface */
@ -99,6 +100,7 @@ static device_method_t opal_i2c_methods[] = {
/* iicbus interface */
DEVMETHOD(iicbus_callback, opal_i2c_callback),
DEVMETHOD(iicbus_transfer, opal_i2c_transfer),
DEVMETHOD(ofw_bus_get_node, opal_i2c_get_node),
DEVMETHOD_END
};
@ -111,7 +113,7 @@ static device_method_t opal_i2c_methods[] = {
static devclass_t opal_i2c_devclass;
static driver_t opal_i2c_driver = {
"i2c",
"iichb",
opal_i2c_methods,
sizeof(struct opal_i2c_softc),
};
@ -246,6 +248,14 @@ opal_i2c_callback(device_t dev, int index, caddr_t data)
return (error);
}
static phandle_t
opal_i2c_get_node(device_t bus, device_t dev)
{
/* Share controller node with iibus device. */
return (ofw_bus_get_node(bus));
}
DRIVER_MODULE(opal_i2c, opal_i2cm, opal_i2c_driver, opal_i2c_devclass, NULL,
NULL);
DRIVER_MODULE(iicbus, opal_i2c, iicbus_driver, iicbus_devclass, NULL, NULL);