svn commit: r304336 - head/sys/dev/usb/net
Pyun YongHyeon
yongari at FreeBSD.org
Thu Aug 18 07:11:33 UTC 2016
Author: yongari
Date: Thu Aug 18 07:11:31 2016
New Revision: 304336
URL: https://svnweb.freebsd.org/changeset/base/304336
Log:
When device is detached make sure to stop the controller and make
it return zero-length USB packet.
Modified:
head/sys/dev/usb/net/if_axge.c
Modified: head/sys/dev/usb/net/if_axge.c
==============================================================================
--- head/sys/dev/usb/net/if_axge.c Thu Aug 18 06:46:14 2016 (r304335)
+++ head/sys/dev/usb/net/if_axge.c Thu Aug 18 07:11:31 2016 (r304336)
@@ -580,9 +580,27 @@ axge_detach(device_t dev)
{
struct axge_softc *sc;
struct usb_ether *ue;
+ uint16_t val;
sc = device_get_softc(dev);
ue = &sc->sc_ue;
+ if (device_is_attached(dev)) {
+ AXGE_LOCK(sc);
+ /*
+ * XXX
+ * ether_ifdetach(9) should be called first.
+ */
+ axge_stop(ue);
+ /* Force bulk-in to return a zero-length USB packet. */
+ val = axge_read_cmd_2(sc, AXGE_ACCESS_MAC, 2, AXGE_EPPRCR);
+ val |= EPPRCR_BZ | EPPRCR_IPRL;
+ axge_write_cmd_2(sc, AXGE_ACCESS_MAC, 2, AXGE_EPPRCR, val);
+ /* Change clock. */
+ axge_write_cmd_1(sc, AXGE_ACCESS_MAC, AXGE_CLK_SELECT, 0);
+ /* Disable MAC. */
+ axge_write_cmd_2(sc, AXGE_ACCESS_MAC, 2, AXGE_RCR, 0);
+ AXGE_UNLOCK(sc);
+ }
usbd_transfer_unsetup(sc->sc_xfer, AXGE_N_TRANSFER);
uether_ifdetach(ue);
mtx_destroy(&sc->sc_mtx);
More information about the svn-src-head
mailing list