Lines Matching refs:dev
31 __FBSDID("$FreeBSD: releng/11.0/sys/dev/pcf/pcf_ebus.c 233018 2012-03-15 22:53:39Z nwhitehorn $");
75 #include <dev/ofw/ofw_bus.h>
76 #include <dev/ofw/openfirm.h>
83 #include <dev/iicbus/iiconf.h>
84 #include <dev/pcf/pcfvar.h>
119 pcf_ebus_probe(device_t dev)
128 if (strcmp("i2c", ofw_bus_get_name(dev)) == 0) {
129 compat = ofw_bus_get_compat(dev);
131 device_set_desc(dev, "PCF8584 I2C bus controller");
139 pcf_ebus_attach(device_t dev)
146 sc = DEVTOSOFTC(dev);
147 mtx_init(&sc->pcf_lock, device_get_nameunit(dev), "pcf", MTX_DEF);
150 if ((node = ofw_bus_get_node(dev)) == -1) {
151 device_printf(dev, "cannot get OFW node\n");
156 sc->res_ioport = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
159 device_printf(dev, "cannot reserve I/O port range\n");
163 sc->pcf_flags = device_get_flags(dev);
169 sc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
172 device_printf(dev, "can't reserve irq, polled mode.\n");
185 device_printf(dev, "cannot get own address\n");
189 device_printf(dev, "PCF8584 address: 0x%08llx\n", (unsigned
193 pcf_rst_card(dev, IIC_FASTEST, own_addr, NULL);
196 rv = bus_setup_intr(dev, sc->res_irq,
200 device_printf(dev, "could not setup IRQ\n");
205 if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL)
206 device_printf(dev, "could not allocate iicbus instance\n");
209 bus_generic_attach(dev);
215 bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq,
219 bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ioport,
227 pcf_ebus_detach(device_t dev)
232 sc = DEVTOSOFTC(dev);
234 if ((rv = bus_generic_detach(dev)) != 0)
237 if ((rv = device_delete_child(dev, sc->iicbus)) != 0)
241 bus_teardown_intr(dev, sc->res_irq,
243 bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq,
247 bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ioport,