Lines Matching +full:usb +full:- +full:attach
1 /*-
2 * SPDX-License-Identifier: BSD-4-Clause
18 * 4. Neither the name of the author nor the names of any co-contributors
37 * CATC USB-EL1210A USB to ethernet driver. Used in the CATC Netmate
46 * The CATC USB-EL1210A provides USB ethernet support at 10Mbps. The
47 * RX filter uses a 512-bit multicast hash table, single perfect entry
77 #include <dev/usb/usb.h>
78 #include <dev/usb/usbdi.h>
79 #include <dev/usb/usbdi_util.h>
83 #include <dev/usb/usb_debug.h>
84 #include <dev/usb/usb_process.h>
86 #include <dev/usb/net/usb_ethernet.h>
87 #include <dev/usb/net/if_cuereg.h>
132 "USB cue");
175 MODULE_DEPEND(cue, usb, 1, 1, 1);
208 if (uether_do_request(&sc->sc_ue, &req, &val, 1000)) { in cue_csr_read_1()
226 (void)uether_do_request(&sc->sc_ue, &req, &val, 1000); in cue_csr_read_2()
241 return (uether_do_request(&sc->sc_ue, &req, NULL, 1000)); in cue_csr_write_1()
258 return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); in cue_mem()
272 return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); in cue_getmac()
285 return (crc & ((1 << CUE_BITS) - 1)); in cue_mchash()
302 /* write multicast hash-bits */ in cue_setpromisc()
362 if (uether_do_request(&sc->sc_ue, &req, NULL, 1000)) { in cue_reset()
369 uether_pause(&sc->sc_ue, hz / 100); in cue_reset()
377 cue_getmac(sc, ue->ue_eaddr); in cue_attach_post()
385 if (uaa->usb_mode != USB_MODE_HOST) in cue_probe()
387 if (uaa->info.bConfigIndex != CUE_CONFIG_IDX) in cue_probe()
389 if (uaa->info.bIfaceIndex != CUE_IFACE_IDX) in cue_probe()
396 * Attach the interface. Allocate softc structures, do ifmedia
397 * setup and ethernet/BPF attach.
404 struct usb_ether *ue = &sc->sc_ue; in cue_attach()
409 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); in cue_attach()
412 error = usbd_transfer_setup(uaa->device, &iface_index, in cue_attach()
413 sc->sc_xfer, cue_config, CUE_N_TRANSFER, sc, &sc->sc_mtx); in cue_attach()
415 device_printf(dev, "allocating USB transfers failed\n"); in cue_attach()
419 ue->ue_sc = sc; in cue_attach()
420 ue->ue_dev = dev; in cue_attach()
421 ue->ue_udev = uaa->device; in cue_attach()
422 ue->ue_mtx = &sc->sc_mtx; in cue_attach()
423 ue->ue_methods = &cue_ue_methods; in cue_attach()
427 device_printf(dev, "could not attach interface\n"); in cue_attach()
441 struct usb_ether *ue = &sc->sc_ue; in cue_detach()
443 usbd_transfer_unsetup(sc->sc_xfer, CUE_N_TRANSFER); in cue_detach()
445 mtx_destroy(&sc->sc_mtx); in cue_detach()
454 struct usb_ether *ue = &sc->sc_ue; in cue_bulk_read_callback()
472 actlen -= 2; in cue_bulk_read_callback()
502 if_t ifp = uether_getifp(&sc->sc_ue); in cue_bulk_write_callback()
519 if (m->m_pkthdr.len > MCLBYTES) in cue_bulk_write_callback()
520 m->m_pkthdr.len = MCLBYTES; in cue_bulk_write_callback()
521 usbd_xfer_set_frame_len(xfer, 0, (m->m_pkthdr.len + 2)); in cue_bulk_write_callback()
525 buf[0] = (uint8_t)(m->m_pkthdr.len); in cue_bulk_write_callback()
526 buf[1] = (uint8_t)(m->m_pkthdr.len >> 8); in cue_bulk_write_callback()
530 usbd_m_copy_in(pc, 2, m, 0, m->m_pkthdr.len); in cue_bulk_write_callback()
581 * start the USB transfers, if not already started: in cue_start()
583 usbd_transfer_start(sc->sc_xfer[CUE_BULK_DT_RD]); in cue_start()
584 usbd_transfer_start(sc->sc_xfer[CUE_BULK_DT_WR]); in cue_start()
605 cue_csr_write_1(sc, CUE_PAR0 - i, if_getlladdr(ifp)[i]); in cue_init()
627 usbd_xfer_set_stall(sc->sc_xfer[CUE_BULK_DT_WR]); in cue_init()
650 usbd_transfer_stop(sc->sc_xfer[CUE_BULK_DT_WR]); in cue_stop()
651 usbd_transfer_stop(sc->sc_xfer[CUE_BULK_DT_RD]); in cue_stop()