Lines Matching +full:force +full:- +full:external +full:- +full:phy

3 /*-
4 * SPDX-License-Identifier: BSD-3-Clause
17 * 3. Neither the name of the author nor the names of any co-contributors
36 * DM9601(DAVICOM USB to Ethernet MAC Controller with Integrated 10/100 PHY)
38 * http://ptm2.cc.utu.fi/ftp/network/cards/DM9601/From_NET/DM9601-DS-P01-930914.pdf
44 * External PHYs
175 /* Corega USB-TXC */
239 udav_csr_read(sc, UDAV_PAR, ue->ue_eaddr, ETHER_ADDR_LEN); in udav_attach_post()
247 if (uaa->usb_mode != USB_MODE_HOST) in udav_probe()
249 if (uaa->info.bConfigIndex != UDAV_CONFIG_INDEX) in udav_probe()
251 if (uaa->info.bIfaceIndex != UDAV_IFACE_INDEX) in udav_probe()
262 struct usb_ether *ue = &sc->sc_ue; in udav_attach()
266 sc->sc_flags = USB_GET_DRIVER_INFO(uaa); in udav_attach()
270 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); in udav_attach()
273 error = usbd_transfer_setup(uaa->device, &iface_index, in udav_attach()
274 sc->sc_xfer, udav_config, UDAV_N_TRANSFER, sc, &sc->sc_mtx); in udav_attach()
281 * The JP1082 has an unusable PHY and provides no link information. in udav_attach()
283 if (sc->sc_flags & UDAV_FLAG_NO_PHY) { in udav_attach()
284 ue->ue_methods = &udav_ue_methods_nophy; in udav_attach()
285 sc->sc_flags |= UDAV_FLAG_LINK; in udav_attach()
287 ue->ue_methods = &udav_ue_methods; in udav_attach()
290 ue->ue_sc = sc; in udav_attach()
291 ue->ue_dev = dev; in udav_attach()
292 ue->ue_udev = uaa->device; in udav_attach()
293 ue->ue_mtx = &sc->sc_mtx; in udav_attach()
312 struct usb_ether *ue = &sc->sc_ue; in udav_detach()
314 usbd_transfer_unsetup(sc->sc_xfer, UDAV_N_TRANSFER); in udav_detach()
316 mtx_destroy(&sc->sc_mtx); in udav_detach()
336 return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
353 return (uether_do_request(&sc->sc_ue, &req, buf, 1000));
368 return (uether_do_request(&sc->sc_ue, &req, NULL, 1000));
385 return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); in udav_csr_read()
402 return (uether_do_request(&sc->sc_ue, &req, buf, 1000)); in udav_csr_write()
428 return (uether_do_request(&sc->sc_ue, &req, NULL, 1000)); in udav_csr_write1()
434 struct udav_softc *sc = ue->ue_sc; in udav_init()
435 if_t ifp = uether_getifp(&sc->sc_ue); in udav_init()
461 /* clear POWER_DOWN state of internal PHY */ in udav_init()
465 usbd_xfer_set_stall(sc->sc_xfer[UDAV_BULK_DT_WR]); in udav_init()
476 /* Select PHY */ in udav_reset()
479 * XXX: force select internal phy. in udav_reset()
480 * external phy routines are not tested. in udav_reset()
484 if (sc->sc_flags & UDAV_EXT_PHY) in udav_reset()
495 if (uether_pause(&sc->sc_ue, hz / 100)) in udav_reset()
499 uether_pause(&sc->sc_ue, hz / 100); in udav_reset()
517 struct udav_softc *sc = ue->ue_sc; in udav_setmulti()
518 if_t ifp = uether_getifp(&sc->sc_ue); in udav_setmulti()
546 struct udav_softc *sc = ue->ue_sc; in udav_setpromisc()
547 if_t ifp = uether_getifp(&sc->sc_ue); in udav_setpromisc()
565 struct udav_softc *sc = ue->ue_sc; in udav_start()
570 usbd_transfer_start(sc->sc_xfer[UDAV_INTR_DT_RD]); in udav_start()
571 usbd_transfer_start(sc->sc_xfer[UDAV_BULK_DT_RD]); in udav_start()
572 usbd_transfer_start(sc->sc_xfer[UDAV_BULK_DT_WR]); in udav_start()
579 if_t ifp = uether_getifp(&sc->sc_ue); in udav_bulk_write_callback()
594 if ((sc->sc_flags & UDAV_FLAG_LINK) == 0) { in udav_bulk_write_callback()
604 if (m->m_pkthdr.len > MCLBYTES) in udav_bulk_write_callback()
605 m->m_pkthdr.len = MCLBYTES; in udav_bulk_write_callback()
606 if (m->m_pkthdr.len < UDAV_MIN_FRAME_LEN) { in udav_bulk_write_callback()
607 extra_len = UDAV_MIN_FRAME_LEN - m->m_pkthdr.len; in udav_bulk_write_callback()
612 temp_len = (m->m_pkthdr.len + extra_len); in udav_bulk_write_callback()
625 usbd_m_copy_in(pc, 2, m, 0, m->m_pkthdr.len); in udav_bulk_write_callback()
628 usbd_frame_zero(pc, temp_len - extra_len, extra_len); in udav_bulk_write_callback()
660 struct usb_ether *ue = &sc->sc_ue; in udav_bulk_read_callback()
678 actlen -= sizeof(stat); in udav_bulk_read_callback()
680 len -= ETHER_CRC_LEN; in udav_bulk_read_callback()
736 struct udav_softc *sc = ue->ue_sc; in udav_stop()
737 if_t ifp = uether_getifp(&sc->sc_ue); in udav_stop()
742 if (!(sc->sc_flags & UDAV_FLAG_NO_PHY)) in udav_stop()
743 sc->sc_flags &= ~UDAV_FLAG_LINK; in udav_stop()
748 usbd_transfer_stop(sc->sc_xfer[UDAV_BULK_DT_WR]); in udav_stop()
749 usbd_transfer_stop(sc->sc_xfer[UDAV_BULK_DT_RD]); in udav_stop()
750 usbd_transfer_stop(sc->sc_xfer[UDAV_INTR_DT_RD]); in udav_stop()
765 sc->sc_flags &= ~UDAV_FLAG_LINK; in udav_ifmedia_upd()
766 LIST_FOREACH(miisc, &mii->mii_phys, mii_list) in udav_ifmedia_upd()
780 ifmr->ifm_active = mii->mii_media_active; in udav_ifmedia_status()
781 ifmr->ifm_status = mii->mii_media_status; in udav_ifmedia_status()
788 struct udav_softc *sc = ue->ue_sc; in udav_tick()
794 if ((sc->sc_flags & UDAV_FLAG_LINK) == 0 in udav_tick()
795 && mii->mii_media_status & IFM_ACTIVE && in udav_tick()
796 IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { in udav_tick()
797 sc->sc_flags |= UDAV_FLAG_LINK; in udav_tick()
803 udav_miibus_readreg(device_t dev, int phy, int reg) in udav_miibus_readreg() argument
810 /* XXX: one PHY only for the internal PHY */ in udav_miibus_readreg()
811 if (phy != 0) in udav_miibus_readreg()
814 locked = mtx_owned(&sc->sc_mtx); in udav_miibus_readreg()
818 /* select internal PHY and set PHY register address */ in udav_miibus_readreg()
822 /* select PHY operation and start read command */ in udav_miibus_readreg()
835 DPRINTFN(11, "phy=%d reg=0x%04x => 0x%04x\n", in udav_miibus_readreg()
836 phy, reg, data16); in udav_miibus_readreg()
844 udav_miibus_writereg(device_t dev, int phy, int reg, int data) in udav_miibus_writereg() argument
850 /* XXX: one PHY only for the internal PHY */ in udav_miibus_writereg()
851 if (phy != 0) in udav_miibus_writereg()
854 locked = mtx_owned(&sc->sc_mtx); in udav_miibus_writereg()
858 /* select internal PHY and set PHY register address */ in udav_miibus_writereg()
867 /* select PHY operation and start write command */ in udav_miibus_writereg()