| 2747 | } |
| 2748 | |
| 2749 | static int |
| 2750 | argemdio_attach(device_t dev) |
| 2751 | { |
| 2752 | struct arge_softc *sc; |
| 2753 | int error = 0; |
| 2754 | #ifdef ARGE_DEBUG |
| 2755 | struct sysctl_ctx_list *ctx; |
| 2756 | struct sysctl_oid *tree; |
| 2757 | #endif |
| 2758 | sc = device_get_softc(dev); |
| 2759 | sc->arge_dev = dev; |
| 2760 | sc->arge_mac_unit = device_get_unit(dev); |
| 2761 | sc->arge_rid = 0; |
| 2762 | sc->arge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, |
| 2763 | &sc->arge_rid, RF_ACTIVE | RF_SHAREABLE); |
| 2764 | if (sc->arge_res == NULL) { |
| 2765 | device_printf(dev, "couldn't map memory\n"); |
| 2766 | error = ENXIO; |
| 2767 | goto fail; |
| 2768 | } |
| 2769 | |
| 2770 | #ifdef ARGE_DEBUG |
| 2771 | ctx = device_get_sysctl_ctx(dev); |
| 2772 | tree = device_get_sysctl_tree(dev); |
| 2773 | SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, |
| 2774 | "debug", CTLFLAG_RW, &sc->arge_debug, 0, |
| 2775 | "argemdio interface debugging flags"); |
| 2776 | #endif |
| 2777 | |
| 2778 | /* Reset MAC - required for AR71xx MDIO to successfully occur */ |
| 2779 | arge_reset_mac(sc); |
| 2780 | /* Reset MII bus */ |
| 2781 | arge_reset_miibus(sc); |
| 2782 | |
| 2783 | bus_generic_probe(dev); |
| 2784 | bus_enumerate_hinted_children(dev); |
| 2785 | error = bus_generic_attach(dev); |
| 2786 | fail: |
| 2787 | return (error); |
| 2788 | } |
| 2789 | |
| 2790 | static int |
| 2791 | argemdio_detach(device_t dev) |
nothing calls this directly
no test coverage detected