xref: /freebsd/sys/dev/mii/mii_fdt.c (revision d6b692835e52d85441dfdd20a01c12e17cb50914)
17f153db8SIan Lepore /*-
27f153db8SIan Lepore  * Copyright (c) 2017 Ian Lepore <ian@freebsd.org>
37f153db8SIan Lepore  * All rights reserved.
47f153db8SIan Lepore  *
57f153db8SIan Lepore  * Development sponsored by Microsemi, Inc.
67f153db8SIan Lepore  *
77f153db8SIan Lepore  * Redistribution and use in source and binary forms, with or without
87f153db8SIan Lepore  * modification, are permitted provided that the following conditions
97f153db8SIan Lepore  * are met:
107f153db8SIan Lepore  * 1. Redistributions of source code must retain the above copyright
117f153db8SIan Lepore  *    notice, this list of conditions and the following disclaimer.
127f153db8SIan Lepore  * 2. Redistributions in binary form must reproduce the above copyright
137f153db8SIan Lepore  *    notice, this list of conditions and the following disclaimer in the
147f153db8SIan Lepore  *    documentation and/or other materials provided with the distribution.
157f153db8SIan Lepore  *
167f153db8SIan Lepore  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
177f153db8SIan Lepore  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
187f153db8SIan Lepore  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
197f153db8SIan Lepore  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
207f153db8SIan Lepore  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
217f153db8SIan Lepore  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
227f153db8SIan Lepore  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
237f153db8SIan Lepore  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
247f153db8SIan Lepore  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
257f153db8SIan Lepore  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
267f153db8SIan Lepore  * SUCH DAMAGE.
277f153db8SIan Lepore  */
287f153db8SIan Lepore 
297f153db8SIan Lepore #include <sys/cdefs.h>
307f153db8SIan Lepore /*
317f153db8SIan Lepore  * Utility functions for PHY drivers on systems configured using FDT data.
327f153db8SIan Lepore  */
337f153db8SIan Lepore 
347f153db8SIan Lepore #include <sys/param.h>
357f153db8SIan Lepore #include <sys/systm.h>
367f153db8SIan Lepore #include <sys/socket.h>
377f153db8SIan Lepore #include <sys/bus.h>
387f153db8SIan Lepore #include <sys/malloc.h>
397f153db8SIan Lepore 
407f153db8SIan Lepore #include <net/if.h>
417f153db8SIan Lepore #include <net/if_media.h>
427f153db8SIan Lepore 
437f153db8SIan Lepore #include <dev/ofw/openfirm.h>
447f153db8SIan Lepore #include <dev/ofw/ofw_bus.h>
457f153db8SIan Lepore #include <dev/ofw/ofw_bus_subr.h>
467f153db8SIan Lepore 
477f153db8SIan Lepore #include <dev/mii/mii.h>
487f153db8SIan Lepore #include <dev/mii/miivar.h>
497f153db8SIan Lepore #include <dev/mii/mii_fdt.h>
507f153db8SIan Lepore 
517f153db8SIan Lepore /*
527f153db8SIan Lepore  * Table to translate MII_CONTYPE_xxxx constants to/from devicetree strings.
537f153db8SIan Lepore  * We explicitly associate the enum values with the strings in a table to avoid
547f153db8SIan Lepore  * relying on this list being sorted in the same order as the enum in miivar.h,
557f153db8SIan Lepore  * and to avoid problems if the enum gains new types that aren't in the FDT
567f153db8SIan Lepore  * data.  However, the "unknown" entry must be first because it is referenced
577f153db8SIan Lepore  * using subscript 0 in mii_fdt_contype_to_name().
587f153db8SIan Lepore  */
597f153db8SIan Lepore static struct contype_names {
607f153db8SIan Lepore 	mii_contype_t type;
617f153db8SIan Lepore 	const char   *name;
627f153db8SIan Lepore } fdt_contype_names[] = {
637f153db8SIan Lepore 	{MII_CONTYPE_UNKNOWN,		"unknown"},
647f153db8SIan Lepore 	{MII_CONTYPE_MII,		"mii"},
657f153db8SIan Lepore 	{MII_CONTYPE_GMII,		"gmii"},
667f153db8SIan Lepore 	{MII_CONTYPE_SGMII,		"sgmii"},
677f153db8SIan Lepore 	{MII_CONTYPE_QSGMII,		"qsgmii"},
687f153db8SIan Lepore 	{MII_CONTYPE_TBI,		"tbi"},
697f153db8SIan Lepore 	{MII_CONTYPE_REVMII,		"rev-mii"},
707f153db8SIan Lepore 	{MII_CONTYPE_RMII,		"rmii"},
717f153db8SIan Lepore 	{MII_CONTYPE_RGMII,		"rgmii"},
727f153db8SIan Lepore 	{MII_CONTYPE_RGMII_ID,		"rgmii-id"},
737f153db8SIan Lepore 	{MII_CONTYPE_RGMII_RXID,	"rgmii-rxid"},
747f153db8SIan Lepore 	{MII_CONTYPE_RGMII_TXID,	"rgmii-txid"},
757f153db8SIan Lepore 	{MII_CONTYPE_RTBI,		"rtbi"},
767f153db8SIan Lepore 	{MII_CONTYPE_SMII,		"smii"},
777f153db8SIan Lepore 	{MII_CONTYPE_XGMII,		"xgmii"},
787f153db8SIan Lepore 	{MII_CONTYPE_TRGMII,		"trgmii"},
797f153db8SIan Lepore 	{MII_CONTYPE_2000BX,		"2000base-x"},
807f153db8SIan Lepore 	{MII_CONTYPE_2500BX,		"2500base-x"},
817f153db8SIan Lepore 	{MII_CONTYPE_RXAUI,		"rxaui"},
827f153db8SIan Lepore };
837f153db8SIan Lepore 
847f153db8SIan Lepore static phandle_t
mii_fdt_get_phynode(phandle_t macnode)857f153db8SIan Lepore mii_fdt_get_phynode(phandle_t macnode)
867f153db8SIan Lepore {
877f153db8SIan Lepore 	static const char *props[] = {
887f153db8SIan Lepore 	    "phy-handle", "phy", "phy-device"
897f153db8SIan Lepore 	};
907f153db8SIan Lepore 	pcell_t xref;
917f153db8SIan Lepore 	u_int i;
927f153db8SIan Lepore 
937f153db8SIan Lepore 	for (i = 0; i < nitems(props); ++i) {
947f153db8SIan Lepore 		if (OF_getencprop(macnode, props[i], &xref, sizeof(xref)) > 0)
957f153db8SIan Lepore 			return (OF_node_from_xref(xref));
967f153db8SIan Lepore 	}
977f153db8SIan Lepore 	return (-1);
987f153db8SIan Lepore }
997f153db8SIan Lepore 
1004b843e7fSKornel Duleba static phandle_t
mii_fdt_lookup_phy(phandle_t node,int addr)1014b843e7fSKornel Duleba mii_fdt_lookup_phy(phandle_t node, int addr)
1024b843e7fSKornel Duleba {
1034b843e7fSKornel Duleba 	phandle_t ports, phynode, child;
1044b843e7fSKornel Duleba 	int reg;
1054b843e7fSKornel Duleba 
1064b843e7fSKornel Duleba 	/* First try to see if we have a direct xref pointing to a PHY. */
1074b843e7fSKornel Duleba 	phynode = mii_fdt_get_phynode(node);
1084b843e7fSKornel Duleba 	if (phynode != -1)
1094b843e7fSKornel Duleba 		return (phynode);
1104b843e7fSKornel Duleba 
1114b843e7fSKornel Duleba 	/*
1124b843e7fSKornel Duleba 	 * Now handle the "switch" case.
1134b843e7fSKornel Duleba 	 * Search "ports" subnode for nodes that describe a switch port
1144b843e7fSKornel Duleba 	 * including a PHY xref.
1154b843e7fSKornel Duleba 	 * Since we have multiple candidates select one based on PHY address.
1164b843e7fSKornel Duleba 	 */
1174b843e7fSKornel Duleba 	ports = ofw_bus_find_child(node, "ports");
1184b843e7fSKornel Duleba 	if (ports <= 0)
119*d6b69283SMark Johnston 		ports = ofw_bus_find_child(node, "ethernet-ports");
120*d6b69283SMark Johnston 	if (ports <= 0)
1214b843e7fSKornel Duleba 		return (-1);
1224b843e7fSKornel Duleba 
1234b843e7fSKornel Duleba 	for (child = OF_child(ports); child != 0; child = OF_peer(child)) {
1244b843e7fSKornel Duleba 		if (ofw_bus_node_status_okay(child) == 0)
1254b843e7fSKornel Duleba 			continue;
1264b843e7fSKornel Duleba 
1274b843e7fSKornel Duleba 		phynode = mii_fdt_get_phynode(child);
1284b843e7fSKornel Duleba 		if (phynode <= 0)
1294b843e7fSKornel Duleba 			continue;
1304b843e7fSKornel Duleba 
1314b843e7fSKornel Duleba 		if (OF_getencprop(phynode, "reg", &reg, sizeof(reg)) <= 0)
1324b843e7fSKornel Duleba 			continue;
1334b843e7fSKornel Duleba 
1344b843e7fSKornel Duleba 		if (reg == addr)
1354b843e7fSKornel Duleba 			return (phynode);
1364b843e7fSKornel Duleba 	}
1374b843e7fSKornel Duleba 	return (-1);
1384b843e7fSKornel Duleba }
1394b843e7fSKornel Duleba 
1407f153db8SIan Lepore mii_contype_t
mii_fdt_contype_from_name(const char * name)1417f153db8SIan Lepore mii_fdt_contype_from_name(const char *name)
1427f153db8SIan Lepore {
1437f153db8SIan Lepore 	u_int i;
1447f153db8SIan Lepore 
1457f153db8SIan Lepore 	for (i = 0; i < nitems(fdt_contype_names); ++i) {
1467f153db8SIan Lepore 		if (strcmp(name, fdt_contype_names[i].name) == 0)
1477f153db8SIan Lepore 			return (fdt_contype_names[i].type);
1487f153db8SIan Lepore 	}
1497f153db8SIan Lepore 	return (MII_CONTYPE_UNKNOWN);
1507f153db8SIan Lepore }
1517f153db8SIan Lepore 
1527f153db8SIan Lepore const char *
mii_fdt_contype_to_name(mii_contype_t contype)1537f153db8SIan Lepore mii_fdt_contype_to_name(mii_contype_t contype)
1547f153db8SIan Lepore {
1557f153db8SIan Lepore 	u_int i;
1567f153db8SIan Lepore 
1577f153db8SIan Lepore 	for (i = 0; i < nitems(fdt_contype_names); ++i) {
1587f153db8SIan Lepore 		if (contype == fdt_contype_names[i].type)
1597f153db8SIan Lepore 			return (fdt_contype_names[i].name);
1607f153db8SIan Lepore 	}
1617f153db8SIan Lepore 	return (fdt_contype_names[0].name);
1627f153db8SIan Lepore }
1637f153db8SIan Lepore 
1647f153db8SIan Lepore mii_contype_t
mii_fdt_get_contype(phandle_t macnode)1657f153db8SIan Lepore mii_fdt_get_contype(phandle_t macnode)
1667f153db8SIan Lepore {
1677f153db8SIan Lepore 	char val[32];
1687f153db8SIan Lepore 
1697f153db8SIan Lepore 	if (OF_getprop(macnode, "phy-mode", val, sizeof(val)) <= 0 &&
1707f153db8SIan Lepore 	    OF_getprop(macnode, "phy-connection-type", val, sizeof(val)) <= 0) {
1717f153db8SIan Lepore                 return (MII_CONTYPE_UNKNOWN);
1727f153db8SIan Lepore 	}
1737f153db8SIan Lepore 	return (mii_fdt_contype_from_name(val));
1747f153db8SIan Lepore }
1757f153db8SIan Lepore 
1767f153db8SIan Lepore void
mii_fdt_free_config(struct mii_fdt_phy_config * cfg)1777f153db8SIan Lepore mii_fdt_free_config(struct mii_fdt_phy_config *cfg)
1787f153db8SIan Lepore {
1797f153db8SIan Lepore 
1807f153db8SIan Lepore 	free(cfg, M_OFWPROP);
1817f153db8SIan Lepore }
1827f153db8SIan Lepore 
1837f153db8SIan Lepore mii_fdt_phy_config_t *
mii_fdt_get_config(device_t phydev)1847f153db8SIan Lepore mii_fdt_get_config(device_t phydev)
1857f153db8SIan Lepore {
1864b843e7fSKornel Duleba 	struct mii_attach_args *ma;
1877f153db8SIan Lepore 	mii_fdt_phy_config_t *cfg;
1887f153db8SIan Lepore 	device_t miibus, macdev;
1897f153db8SIan Lepore 	pcell_t val;
1907f153db8SIan Lepore 
1914b843e7fSKornel Duleba 	ma = device_get_ivars(phydev);
1927f153db8SIan Lepore 	miibus = device_get_parent(phydev);
1937f153db8SIan Lepore 	macdev = device_get_parent(miibus);
1947f153db8SIan Lepore 
1957f153db8SIan Lepore 	cfg = malloc(sizeof(*cfg), M_OFWPROP, M_ZERO | M_WAITOK);
1967f153db8SIan Lepore 
1977f153db8SIan Lepore 	/*
1987f153db8SIan Lepore 	 * If we can't find our parent MAC's node, there's nothing more we can
1997f153db8SIan Lepore 	 * fill in; cfg is already full of zero/default values, return it.
2007f153db8SIan Lepore 	 */
2017f153db8SIan Lepore 	if ((cfg->macnode = ofw_bus_get_node(macdev)) == -1)
2027f153db8SIan Lepore 		return (cfg);
2037f153db8SIan Lepore 
2047f153db8SIan Lepore 	cfg->con_type = mii_fdt_get_contype(cfg->macnode);
2057f153db8SIan Lepore 
2067f153db8SIan Lepore 	/*
2077f153db8SIan Lepore 	 * If we can't find our own PHY node, there's nothing more we can fill
2087f153db8SIan Lepore 	 * in, just return what we've got.
2097f153db8SIan Lepore 	 */
2104b843e7fSKornel Duleba 	cfg->phynode = mii_fdt_lookup_phy(cfg->macnode, ma->mii_phyno);
2114b843e7fSKornel Duleba 	if (cfg->phynode == -1)
2127f153db8SIan Lepore 		return (cfg);
2137f153db8SIan Lepore 
2147f153db8SIan Lepore 	if (OF_getencprop(cfg->phynode, "max-speed", &val, sizeof(val)) > 0)
2157f153db8SIan Lepore 		cfg->max_speed = val;
2167f153db8SIan Lepore 
2177f153db8SIan Lepore 	if (ofw_bus_node_is_compatible(cfg->phynode,
2187f153db8SIan Lepore 	    "ethernet-phy-ieee802.3-c45"))
2197f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_COMPAT_CLAUSE45;
2207f153db8SIan Lepore 
2217f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "broken-turn-around"))
2227f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_BROKEN_TURNAROUND;
2237f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "enet-phy-lane-swap"))
2247f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_LANE_SWAP;
2257f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "enet-phy-lane-no-swap"))
2267f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_NO_LANE_SWAP;
2277f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "eee-broken-100tx"))
2287f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_EEE_BROKEN_100TX;
2297f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "eee-broken-1000t"))
2307f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_EEE_BROKEN_1000T;
2317f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "eee-broken-10gt"))
2327f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_EEE_BROKEN_10GT;
2337f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "eee-broken-1000kx"))
2347f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_EEE_BROKEN_1000KX;
2357f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "eee-broken-10gkx4"))
2367f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_EEE_BROKEN_10GKX4;
2377f153db8SIan Lepore 	if (OF_hasprop(cfg->phynode, "eee-broken-10gkr"))
2387f153db8SIan Lepore 		cfg->flags |= MIIF_FDT_EEE_BROKEN_10GKR;
2397f153db8SIan Lepore 
2407f153db8SIan Lepore 	return (cfg);
2417f153db8SIan Lepore }
2429174eab4SKornel Duleba 
2439174eab4SKornel Duleba static int
miibus_fdt_probe(device_t dev)2449174eab4SKornel Duleba miibus_fdt_probe(device_t dev)
2459174eab4SKornel Duleba {
2469174eab4SKornel Duleba 	device_t parent;
2479174eab4SKornel Duleba 
2489174eab4SKornel Duleba 	parent = device_get_parent(dev);
2499174eab4SKornel Duleba 	if (ofw_bus_get_node(parent) == -1)
2509174eab4SKornel Duleba 		return (ENXIO);
2519174eab4SKornel Duleba 
2529174eab4SKornel Duleba 	device_set_desc(dev, "OFW MII bus");
2539174eab4SKornel Duleba 	return (BUS_PROBE_DEFAULT);
2549174eab4SKornel Duleba }
2559174eab4SKornel Duleba 
2569174eab4SKornel Duleba static int
miibus_fdt_attach(device_t dev)2579174eab4SKornel Duleba miibus_fdt_attach(device_t dev)
2589174eab4SKornel Duleba {
2599174eab4SKornel Duleba 	struct mii_attach_args *ma;
2609174eab4SKornel Duleba 	int i, error, nchildren;
2619174eab4SKornel Duleba 	device_t parent, *children;
2629174eab4SKornel Duleba 	phandle_t phy_node;
2639174eab4SKornel Duleba 
2649174eab4SKornel Duleba 	parent = device_get_parent(dev);
2659174eab4SKornel Duleba 
2669174eab4SKornel Duleba 	error = device_get_children(dev, &children, &nchildren);
2679174eab4SKornel Duleba 	if (error != 0 || nchildren == 0)
2689174eab4SKornel Duleba 		return (ENXIO);
2699174eab4SKornel Duleba 
2709174eab4SKornel Duleba 	for (i = 0; i < nchildren; i++) {
2719174eab4SKornel Duleba 		ma = device_get_ivars(children[i]);
2729174eab4SKornel Duleba 		bzero(&ma->obd, sizeof(ma->obd));
2739174eab4SKornel Duleba 		phy_node = mii_fdt_lookup_phy(ofw_bus_get_node(parent),
2749174eab4SKornel Duleba 		    ma->mii_phyno);
2759174eab4SKornel Duleba 		if (phy_node == -1) {
2769174eab4SKornel Duleba 			device_printf(dev,
2779174eab4SKornel Duleba 			    "Warning: failed to find OFW node for PHY%d\n",
2789174eab4SKornel Duleba 			    ma->mii_phyno);
2799174eab4SKornel Duleba 			continue;
2809174eab4SKornel Duleba 		}
2819174eab4SKornel Duleba 		error = ofw_bus_gen_setup_devinfo(&ma->obd, phy_node);
2829174eab4SKornel Duleba 		if (error != 0) {
2839174eab4SKornel Duleba 			device_printf(dev,
2849174eab4SKornel Duleba 			    "Warning: failed to setup OFW devinfo for PHY%d\n",
2859174eab4SKornel Duleba 			    ma->mii_phyno);
2869174eab4SKornel Duleba 			continue;
2879174eab4SKornel Duleba 		}
2889174eab4SKornel Duleba 		/*
2899174eab4SKornel Duleba 		 * Setup interrupt resources.
2909174eab4SKornel Duleba 		 * Only a handful of PHYs support those,
2919174eab4SKornel Duleba 		 * so it's fine if we fail here.
2929174eab4SKornel Duleba 		 */
2939174eab4SKornel Duleba 		resource_list_init(&ma->rl);
2949174eab4SKornel Duleba 		(void)ofw_bus_intr_to_rl(children[i], phy_node, &ma->rl, NULL);
2959174eab4SKornel Duleba 	}
2969174eab4SKornel Duleba 
2979174eab4SKornel Duleba 	free(children, M_TEMP);
2989174eab4SKornel Duleba 	return (miibus_attach(dev));
2999174eab4SKornel Duleba }
3009174eab4SKornel Duleba 
3019174eab4SKornel Duleba static struct resource_list *
miibus_fdt_get_resource_list(device_t bus,device_t child)3029174eab4SKornel Duleba miibus_fdt_get_resource_list(device_t bus, device_t child)
3039174eab4SKornel Duleba {
3049174eab4SKornel Duleba 	struct mii_attach_args *ma;
3059174eab4SKornel Duleba 
3069174eab4SKornel Duleba 	ma = device_get_ivars(child);
3079174eab4SKornel Duleba 
3089174eab4SKornel Duleba 	if (ma->obd.obd_node == 0)
3099174eab4SKornel Duleba 		return (NULL);
3109174eab4SKornel Duleba 
3119174eab4SKornel Duleba 	return (&ma->rl);
3129174eab4SKornel Duleba }
3139174eab4SKornel Duleba 
3149174eab4SKornel Duleba static const struct ofw_bus_devinfo*
miibus_fdt_get_devinfo(device_t bus,device_t child)3159174eab4SKornel Duleba miibus_fdt_get_devinfo(device_t bus, device_t child)
3169174eab4SKornel Duleba {
3179174eab4SKornel Duleba 	struct mii_attach_args *ma;
3189174eab4SKornel Duleba 
3199174eab4SKornel Duleba 	ma = device_get_ivars(child);
3209174eab4SKornel Duleba 
3219174eab4SKornel Duleba 	if (ma->obd.obd_node == 0)
3229174eab4SKornel Duleba 		return (NULL);
3239174eab4SKornel Duleba 
3249174eab4SKornel Duleba 	return (&ma->obd);
3259174eab4SKornel Duleba }
3269174eab4SKornel Duleba 
3279174eab4SKornel Duleba static device_method_t miibus_fdt_methods[] = {
3289174eab4SKornel Duleba 	DEVMETHOD(device_probe,		miibus_fdt_probe),
3299174eab4SKornel Duleba 	DEVMETHOD(device_attach,	miibus_fdt_attach),
3309174eab4SKornel Duleba 
3319174eab4SKornel Duleba 	/* ofw_bus interface */
3329174eab4SKornel Duleba 	DEVMETHOD(ofw_bus_get_devinfo,	miibus_fdt_get_devinfo),
3339174eab4SKornel Duleba 	DEVMETHOD(ofw_bus_get_compat,	ofw_bus_gen_get_compat),
3349174eab4SKornel Duleba 	DEVMETHOD(ofw_bus_get_model,	ofw_bus_gen_get_model),
3359174eab4SKornel Duleba 	DEVMETHOD(ofw_bus_get_name,	ofw_bus_gen_get_name),
3369174eab4SKornel Duleba 	DEVMETHOD(ofw_bus_get_node,	ofw_bus_gen_get_node),
3379174eab4SKornel Duleba 	DEVMETHOD(ofw_bus_get_type,	ofw_bus_gen_get_type),
3389174eab4SKornel Duleba 
3399174eab4SKornel Duleba 	DEVMETHOD(bus_setup_intr,		bus_generic_setup_intr),
3409174eab4SKornel Duleba 	DEVMETHOD(bus_teardown_intr,		bus_generic_teardown_intr),
3419174eab4SKornel Duleba 	DEVMETHOD(bus_release_resource,		bus_generic_release_resource),
3429174eab4SKornel Duleba 	DEVMETHOD(bus_activate_resource,	bus_generic_activate_resource),
3439174eab4SKornel Duleba 	DEVMETHOD(bus_deactivate_resource,	bus_generic_deactivate_resource),
3449174eab4SKornel Duleba 	DEVMETHOD(bus_adjust_resource,		bus_generic_adjust_resource),
3459174eab4SKornel Duleba 	DEVMETHOD(bus_alloc_resource,		bus_generic_rl_alloc_resource),
3469174eab4SKornel Duleba 	DEVMETHOD(bus_get_resource,		bus_generic_rl_get_resource),
3479174eab4SKornel Duleba 	DEVMETHOD(bus_set_resource,		bus_generic_rl_set_resource),
3489174eab4SKornel Duleba 	DEVMETHOD(bus_get_resource_list,	miibus_fdt_get_resource_list),
3499174eab4SKornel Duleba 
3509174eab4SKornel Duleba 	DEVMETHOD_END
3519174eab4SKornel Duleba };
3529174eab4SKornel Duleba 
3539174eab4SKornel Duleba DEFINE_CLASS_1(miibus, miibus_fdt_driver, miibus_fdt_methods,
3549174eab4SKornel Duleba     sizeof(struct mii_data), miibus_driver);
355