Lines Matching refs:dev
31 __FBSDID("$FreeBSD: releng/11.0/sys/dev/pcf/pcf_isa.c 298955 2016-05-03 03:41:25Z pfg $");
55 #include <dev/iicbus/iiconf.h>
56 #include <dev/pcf/pcfvar.h>
101 pcf_isa_probe(device_t dev)
107 if (isa_get_logicalid(dev))
111 bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count);
119 device_set_desc(dev, "PCF8584 I2C bus controller");
125 pcf_isa_attach(device_t dev)
130 sc = DEVTOSOFTC(dev);
131 mtx_init(&sc->pcf_lock, device_get_nameunit(dev), "pcf", MTX_DEF);
134 sc->res_ioport = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
137 device_printf(dev, "cannot reserve I/O port range\n");
141 sc->pcf_flags = device_get_flags(dev);
144 sc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->rid_irq,
147 device_printf(dev, "can't reserve irq, polled mode.\n");
153 pcf_rst_card(dev, IIC_FASTEST, PCF_DEFAULT_ADDR, NULL);
156 rv = bus_setup_intr(dev, sc->res_irq,
160 device_printf(dev, "could not setup IRQ\n");
165 if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL)
166 device_printf(dev, "could not allocate iicbus instance\n");
169 bus_generic_attach(dev);
175 bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq,
179 bus_release_resource(dev, SYS_RES_IOPORT, sc->rid_ioport,
187 pcf_isa_detach(device_t dev)
192 sc = DEVTOSOFTC(dev);
194 if ((rv = bus_generic_detach(dev)) != 0)
197 if ((rv = device_delete_child(dev, sc->iicbus)) != 0)
201 bus_teardown_intr(dev, sc->res_irq, sc->intr_cookie);
202 bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
205 bus_release_resource(dev, SYS_RES_IOPORT, sc->rid_ioport, sc->res_ioport);