Lines Matching +full:bus +full:- +full:id
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright © 2021-2022 Dmitry Salychev
31 * The DPAA2 Management Complex (MC) Bus Driver (FDT-based).
35 * hardware objects used in network-oriented packet processing applications.
40 #include <sys/bus.h>
46 #include <machine/bus.h>
73 compatible = "fsl,qoriq-mc-dpmac";
76 pcs-handle = <0x15>;
77 phy-connection-type = "10gbase-r";
78 managed = "in-band-status";
82 compatible = "fsl,qoriq-mc-dpmac";
84 phy-handle = <0x18>;
85 phy-connection-type = "qsgmii";
86 managed = "in-band-status";
87 pcs-handle = <0x19>;
99 if (!ofw_bus_node_is_compatible(node, "fsl,qoriq-mc-dpmac")) { in dpaa2_mac_dev_probe()
100 device_printf(dev, "'%s' not fsl,qoriq-mc-dpmac compatible\n", in dpaa2_mac_dev_probe()
107 if (s == -1) { in dpaa2_mac_dev_probe()
127 s = device_get_property(dev, "reg", &sc->reg, sizeof(sc->reg), in dpaa2_mac_fdt_attach()
129 if (s == -1) { in dpaa2_mac_fdt_attach()
134 s = device_get_property(dev, "managed", sc->managed, in dpaa2_mac_fdt_attach()
135 sizeof(sc->managed), DEVICE_PROP_ANY); in dpaa2_mac_fdt_attach()
136 s = device_get_property(dev, "phy-connection-type", sc->phy_conn_type, in dpaa2_mac_fdt_attach()
137 sizeof(sc->phy_conn_type), DEVICE_PROP_ANY); in dpaa2_mac_fdt_attach()
138 s = device_get_property(dev, "pcs-handle", &sc->pcs_handle, in dpaa2_mac_fdt_attach()
139 sizeof(sc->pcs_handle), DEVICE_PROP_HANDLE); in dpaa2_mac_fdt_attach()
141 /* 'sfp' and 'phy-handle' are optional but we need one or the other. */ in dpaa2_mac_fdt_attach()
142 s = device_get_property(dev, "sfp", &sc->sfp, sizeof(sc->sfp), in dpaa2_mac_fdt_attach()
144 s = device_get_property(dev, "phy-handle", &sc->phy_handle, in dpaa2_mac_fdt_attach()
145 sizeof(sc->phy_handle), DEVICE_PROP_HANDLE); in dpaa2_mac_fdt_attach()
148 device_printf(dev, "node %#x '%s': reg %#x sfp %#x pcs-handle " in dpaa2_mac_fdt_attach()
149 "%#x phy-handle %#x managed '%s' phy-conn-type '%s'\n", in dpaa2_mac_fdt_attach()
151 sc->reg, sc->sfp, sc->pcs_handle, sc->phy_handle, in dpaa2_mac_fdt_attach()
152 sc->managed, sc->phy_conn_type); in dpaa2_mac_fdt_attach()
158 dpaa2_mac_fdt_match_id(device_t dev, uint32_t id) in dpaa2_mac_fdt_match_id() argument
166 if (sc->reg == id) in dpaa2_mac_fdt_match_id()
181 if (sc->phy_handle == 0 && sc->sfp == 0) in dpaa2_mac_fdt_get_phy_dev()
185 if (sc->sfp != 0) { in dpaa2_mac_fdt_get_phy_dev()
188 xdev = OF_device_from_xref(OF_xref_from_node(sc->sfp)); in dpaa2_mac_fdt_get_phy_dev()
193 return (OF_device_from_xref(OF_xref_from_node(sc->phy_handle))); in dpaa2_mac_fdt_get_phy_dev()
220 if (!ofw_bus_is_compatible(dev, "fsl,qoriq-mc")) in dpaa2_mc_fdt_probe()
228 dpaa2_mc_fdt_probe_child(device_t bus, phandle_t child) in dpaa2_mc_fdt_probe_child() argument
233 childdev = ofw_bus_find_child_device_by_phandle(bus, child); in dpaa2_mc_fdt_probe_child()
237 childdev = simplebus_add_device(bus, child, 0, "dpaa2_mac_fdt", -1, in dpaa2_mc_fdt_probe_child()
253 sc->acpi_based = false; in dpaa2_mc_fdt_attach()
254 sc->ofw_node = ofw_bus_get_node(dev); in dpaa2_mc_fdt_attach()
265 /* fsl-mc -> dpamcs */ in dpaa2_mc_fdt_attach()
266 node = OF_child(sc->ofw_node); in dpaa2_mc_fdt_attach()
270 child = ofw_bus_find_compatible(node, "fsl,qoriq-mc-dpmac"); in dpaa2_mc_fdt_attach()
272 if (!ofw_bus_node_is_compatible(child, "fsl,qoriq-mc-dpmac")) in dpaa2_mc_fdt_attach()
287 dpaa2_mc_fdt_find_dpaa2_mac_dev(device_t dev, uint32_t id) in dpaa2_mc_fdt_find_dpaa2_mac_dev() argument
308 if (dpaa2_mac_fdt_match_id(mdev, id)) in dpaa2_mc_fdt_find_dpaa2_mac_dev()
316 dpaa2_mc_fdt_get_phy_dev(device_t dev, device_t *phy_dev, uint32_t id) in dpaa2_mc_fdt_get_phy_dev() argument
320 mdev = dpaa2_mc_fdt_find_dpaa2_mac_dev(dev, id); in dpaa2_mc_fdt_get_phy_dev()
322 device_printf(dev, "%s: error finding dpmac device with id=%u\n", in dpaa2_mc_fdt_get_phy_dev()
323 __func__, id); in dpaa2_mc_fdt_get_phy_dev()
330 "(id=%u)\n", __func__, device_get_nameunit(mdev), id); in dpaa2_mc_fdt_get_phy_dev()
339 id, mdev, device_get_nameunit(mdev), in dpaa2_mc_fdt_get_phy_dev()
346 dpaa2_mc_simplebus_get_devinfo(device_t bus, device_t child) in dpaa2_mc_simplebus_get_devinfo() argument
349 return (OFW_BUS_GET_DEVINFO(device_get_parent(bus), child)); in dpaa2_mc_simplebus_get_devinfo()
358 /* Bus interface */
368 /* Pseudo-PCIB interface */
374 /* DPAA2 MC bus interface */