Lines Matching refs:sc

123 	struct saf1761_otg_softc *sc = device_get_softc(dev);
135 sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_DATA_BUS_WIDTH;
138 sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_DATA_BUS_WIDTH;
144 sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_ANA_DIGI_OC;
150 sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_DACK_POL;
156 sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_DREQ_POL;
162 sc->sc_interrupt_cfg |= SOTG_INTERRUPT_CFG_INTPOL;
163 sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_INTR_POL;
169 sc->sc_interrupt_cfg |= SOTG_INTERRUPT_CFG_INTLVL;
170 sc->sc_hw_mode |= SOTG_HW_MODE_CTRL_INTR_LEVEL;
174 sc->sc_bus.parent = dev;
175 sc->sc_bus.devices = sc->sc_devices;
176 sc->sc_bus.devices_max = SOTG_MAX_DEVICES;
177 sc->sc_bus.dma_bits = 32;
180 if (usb_bus_mem_alloc_all(&sc->sc_bus,
185 sc->sc_io_res =
188 if (sc->sc_io_res == NULL)
191 sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
192 sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
193 sc->sc_io_size = rman_get_size(sc->sc_io_res);
197 sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
199 if (sc->sc_irq_res == NULL) {
202 sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
204 if (sc->sc_irq_res == NULL)
208 sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
209 if (sc->sc_bus.bdev == NULL)
212 device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
214 err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_TTY | INTR_MPSAFE,
215 &saf1761_otg_filter_interrupt, &saf1761_otg_interrupt, sc, &sc->sc_intr_hdl);
217 sc->sc_intr_hdl = NULL;
220 err = saf1761_otg_init(sc);
225 err = device_probe_and_attach(sc->sc_bus.bdev);
240 struct saf1761_otg_softc *sc = device_get_softc(dev);
246 if (sc->sc_irq_res && sc->sc_intr_hdl) {
250 saf1761_otg_uninit(sc);
252 err = bus_teardown_intr(dev, sc->sc_irq_res,
253 sc->sc_intr_hdl);
254 sc->sc_intr_hdl = NULL;
256 if (sc->sc_irq_res) {
258 sc->sc_irq_res);
259 sc->sc_irq_res = NULL;
261 if (sc->sc_io_res) {
263 sc->sc_io_res);
264 sc->sc_io_res = NULL;
266 usb_bus_mem_free_all(&sc->sc_bus, NULL);