Lines Matching +full:iproc +full:- +full:mdio

1 /*-
99 MALLOC_DEFINE(M_BRCM_IPROC_MDIO, "Broadcom IPROC MDIO",
100 "Broadcom IPROC MDIO dynamic memory");
127 /* MDIO interface */
144 {"brcm,mdio-mux-iproc", true},
156 bus_id = bus_dir ? child : (child - EXT_BUS_START_ADDR); in brcm_iproc_switch()
161 bus_write_4(sc->reg_base, MDIO_PARAM_OFFSET, param); in brcm_iproc_switch()
173 val = bus_read_4(sc->reg_base, MDIO_STAT_OFFSET); in iproc_mdio_wait_for_idle()
177 pause("BRCM MDIO SLEEP", 1000 / hz); in iproc_mdio_wait_for_idle()
178 } while (timeout--); in iproc_mdio_wait_for_idle()
183 /* start_miim_ops- Program and start MDIO transaction over mdio bus.
202 bus_write_4(sc->reg_base, MDIO_CTRL_OFFSET, 0); in brcm_iproc_mdio_op()
203 bus_read_4(sc->reg_base, MDIO_STAT_OFFSET); in brcm_iproc_mdio_op()
208 param = bus_read_4(sc->reg_base, MDIO_PARAM_OFFSET); in brcm_iproc_mdio_op()
214 bus_write_4(sc->reg_base, MDIO_PARAM_OFFSET, param); in brcm_iproc_mdio_op()
216 bus_write_4(sc->reg_base, MDIO_ADDR_OFFSET, reg); in brcm_iproc_mdio_op()
218 bus_write_4(sc->reg_base, MDIO_CTRL_OFFSET, op); in brcm_iproc_mdio_op()
225 ret = bus_read_4(sc->reg_base, MDIO_READ_OFFSET) & MDIO_READ_DATA_MASK; in brcm_iproc_mdio_op()
236 /* Disable external mdio master access */ in brcm_iproc_config()
237 val = bus_read_4(sc->reg_base, MDIO_SCAN_CTRL_OFFSET); in brcm_iproc_config()
239 bus_write_4(sc->reg_base, MDIO_SCAN_CTRL_OFFSET, val); in brcm_iproc_config()
241 if (sc->clock_rate) { in brcm_iproc_config()
242 /* use rate adjust regs to derrive the mdio's operating in brcm_iproc_config()
245 divisor = sc->clock_rate / MDIO_OPERATING_FREQUENCY; in brcm_iproc_config()
249 bus_write_4(sc->reg_base, MDIO_RATE_ADJ_EXT_OFFSET, val); in brcm_iproc_config()
250 bus_write_4(sc->reg_base, MDIO_RATE_ADJ_INT_OFFSET, val); in brcm_iproc_config()
292 if (!ofw_bus_search_compatible(dev, mdio_compat_data)->ocd_data) in brcm_iproc_mdio_probe()
295 device_set_desc(dev, "Broadcom MDIO MUX driver"); in brcm_iproc_mdio_probe()
309 sc->dev = dev; in brcm_iproc_mdio_attach()
313 sc->reg_base = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in brcm_iproc_mdio_attach()
315 if (sc->reg_base == NULL) { in brcm_iproc_mdio_attach()
320 /* Configure MDIO controlled */ in brcm_iproc_mdio_attach()
322 device_printf(dev, "Unable to initialize IPROC MDIO\n"); in brcm_iproc_mdio_attach()
333 if (ofw_bus_gen_setup_devinfo(&di->di_dinfo, node) != 0) { in brcm_iproc_mdio_attach()
339 resource_list_init(&di->di_rl); in brcm_iproc_mdio_attach()
340 ofw_bus_reg_to_rl(dev, node, sc->sbus.acells, sc->sbus.scells, in brcm_iproc_mdio_attach()
341 &di->di_rl); in brcm_iproc_mdio_attach()
342 ofw_bus_intr_to_rl(dev, node, &di->di_rl, NULL); in brcm_iproc_mdio_attach()
348 resource_list_free(&di->di_rl); in brcm_iproc_mdio_attach()
349 ofw_bus_gen_destroy_devinfo(&di->di_dinfo); in brcm_iproc_mdio_attach()
379 return (&di->di_dinfo); in brcm_iproc_mdio_get_devinfo()
389 if (sc->reg_base != NULL) { in brcm_iproc_mdio_detach()
391 sc->reg_base); in brcm_iproc_mdio_detach()