Lines Matching +full:ocelot +full:- +full:miim
1 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
9 #include <soc/mscc/ocelot.h>
10 #include <linux/mdio/mdio-mscc-miim.h>
13 #include <linux/pcs-lynx.h>
14 #include <linux/dsa/ocelot.h>
600 /* Layer-3 Information */
606 /* Layer-4 Information */
785 static int vsc9953_gcb_soft_rst_status(struct ocelot *ocelot) in vsc9953_gcb_soft_rst_status() argument
789 ocelot_field_read(ocelot, GCB_SOFT_RST_SWC_RST, &val); in vsc9953_gcb_soft_rst_status()
794 static int vsc9953_sys_ram_init_status(struct ocelot *ocelot) in vsc9953_sys_ram_init_status() argument
798 ocelot_field_read(ocelot, SYS_RESET_CFG_MEM_INIT, &val); in vsc9953_sys_ram_init_status()
808 static int vsc9953_reset(struct ocelot *ocelot) in vsc9953_reset() argument
812 /* soft-reset the switch core */ in vsc9953_reset()
813 ocelot_field_write(ocelot, GCB_SOFT_RST_SWC_RST, 1); in vsc9953_reset()
815 err = readx_poll_timeout(vsc9953_gcb_soft_rst_status, ocelot, val, !val, in vsc9953_reset()
818 dev_err(ocelot->dev, "timeout: switch core reset\n"); in vsc9953_reset()
823 ocelot_field_write(ocelot, SYS_RESET_CFG_MEM_ENA, 1); in vsc9953_reset()
824 ocelot_field_write(ocelot, SYS_RESET_CFG_MEM_INIT, 1); in vsc9953_reset()
826 err = readx_poll_timeout(vsc9953_sys_ram_init_status, ocelot, val, !val, in vsc9953_reset()
830 dev_err(ocelot->dev, "timeout: switch sram init\n"); in vsc9953_reset()
835 ocelot_field_write(ocelot, SYS_RESET_CFG_CORE_ENA, 1); in vsc9953_reset()
842 * Bit 8-0: Value to be multiplied with unit
879 static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot) in vsc9953_mdio_bus_alloc() argument
881 struct felix *felix = ocelot_to_felix(ocelot); in vsc9953_mdio_bus_alloc()
882 struct device *dev = ocelot->dev; in vsc9953_mdio_bus_alloc()
887 felix->pcs = devm_kcalloc(dev, felix->info->num_ports, in vsc9953_mdio_bus_alloc()
890 if (!felix->pcs) { in vsc9953_mdio_bus_alloc()
892 return -ENOMEM; in vsc9953_mdio_bus_alloc()
896 ocelot->targets[GCB], in vsc9953_mdio_bus_alloc()
897 ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK], in vsc9953_mdio_bus_alloc()
911 felix->imdio = bus; in vsc9953_mdio_bus_alloc()
913 for (port = 0; port < felix->info->num_ports; port++) { in vsc9953_mdio_bus_alloc()
914 struct ocelot_port *ocelot_port = ocelot->ports[port]; in vsc9953_mdio_bus_alloc()
918 if (dsa_is_unused_port(felix->ds, port)) in vsc9953_mdio_bus_alloc()
921 if (ocelot_port->phy_mode == PHY_INTERFACE_MODE_INTERNAL) in vsc9953_mdio_bus_alloc()
924 phylink_pcs = lynx_pcs_create_mdiodev(felix->imdio, addr); in vsc9953_mdio_bus_alloc()
928 felix->pcs[port] = phylink_pcs; in vsc9953_mdio_bus_alloc()
936 static void vsc9953_mdio_bus_free(struct ocelot *ocelot) in vsc9953_mdio_bus_free() argument
938 struct felix *felix = ocelot_to_felix(ocelot); in vsc9953_mdio_bus_free()
941 for (port = 0; port < ocelot->num_phys_ports; port++) { in vsc9953_mdio_bus_free()
942 struct phylink_pcs *phylink_pcs = felix->pcs[port]; in vsc9953_mdio_bus_free()
973 struct device *dev = &pdev->dev; in seville_probe()
979 return -EINVAL; in seville_probe()
982 return felix_register_switch(dev, res->start, 1, false, false, in seville_probe()
994 dsa_unregister_switch(felix->ds); in seville_remove()
1004 dsa_switch_shutdown(felix->ds); in seville_shutdown()
1010 { .compatible = "mscc,vsc9953-switch" },