net: mscc: refactor mscc_miim
PATCH RESEND 1/1 net: mscc: refactor mscc_miim
Because all MSCC SoC use the same MDIO bus, put the implementation in one common file(mscc_miim) and make all the other MSCC network drivers to use these functions.
--- drivers/net/mscc_eswitch/Makefile | 10 +-- drivers/net/mscc_eswitch/jr2_switch.c | 119 ++---------------------------- drivers/net/mscc_eswitch/luton_switch.c | 101 +------------------------ drivers/net/mscc_eswitch/mscc_miim.c | 28 +++++++ drivers/net/mscc_eswitch/mscc_miim.h | 14 +++- drivers/net/mscc_eswitch/ocelot_switch.c | 104 +------------------------- drivers/net/mscc_eswitch/serval_switch.c | 101 +------------------------ drivers/net/mscc_eswitch/servalt_switch.c | 102 +------------------------ 8 files changed, 63 insertions(+), 516 deletions(-)
drivers/net/mscc_eswitch/Makefile +5 -5
@@ -1,6 +1,6 @@ -obj-$(CONFIG_MSCC_OCELOT_SWITCH) += ocelot_switch.o mscc_xfer.o mscc_mac_table.o -obj-$(CONFIG_MSCC_LUTON_SWITCH) += luton_switch.o mscc_xfer.o mscc_mac_table.o -obj-$(CONFIG_MSCC_JR2_SWITCH) += jr2_switch.o mscc_xfer.o -obj-$(CONFIG_MSCC_SERVALT_SWITCH) += servalt_switch.o mscc_xfer.o -obj-$(CONFIG_MSCC_SERVAL_SWITCH) += serval_switch.o mscc_xfer.o mscc_mac_table.o +obj-$(CONFIG_MSCC_OCELOT_SWITCH) += ocelot_switch.o mscc_xfer.o mscc_mac_table.o mscc_miim.o +obj-$(CONFIG_MSCC_LUTON_SWITCH) += luton_switch.o mscc_xfer.o mscc_mac_table.o mscc_miim.o +obj-$(CONFIG_MSCC_JR2_SWITCH) += jr2_switch.o mscc_xfer.o mscc_miim.o +obj-$(CONFIG_MSCC_SERVALT_SWITCH) += servalt_switch.o mscc_xfer.o mscc_miim.o +obj-$(CONFIG_MSCC_SERVAL_SWITCH) += serval_switch.o mscc_xfer.o mscc_mac_table.o mscc_miim.o
drivers/net/mscc_eswitch/jr2_switch.c +5 -114
151 lines not on this page · raw message
drivers/net/mscc_eswitch/luton_switch.c +3 -98
125 lines not on this page · raw message
drivers/net/mscc_eswitch/mscc_miim.c +28 -0
@@ -72,3 +72,31 @@ int mscc_miim_write(struct mii_dev *bus, int addr, int devad, int reg, out:return ret; } + +struct mii_dev *mscc_mdiobus_init (struct mscc_miim_dev *miim,int *miim_count, +phys_addr_t miim_base, +unsigned long miim_size) +{ +struct mii_dev *bus; + + bus =mdio_alloc (); + +if (!bus) +return NULL ; + + *miim_count +=1 ; +sprintf (bus->name,"miim-bus%d" , *miim_count); + + miim[*miim_count].regs =ioremap (miim_base, miim_size); + miim[*miim_count].miim_base = miim_base; + miim[*miim_count].miim_size = miim_size; + bus->priv = &miim[*miim_count]; + bus->read = mscc_miim_read; + bus->write = mscc_miim_write; + +if (mdio_register (bus)) +return NULL ; + + miim[*miim_count].bus = bus; +return bus; +}
drivers/net/mscc_eswitch/mscc_miim.h +13 -1
@@ -3,10 +3,22 @@* Copyright (c) 2018 Microsemi Corporation */ +#ifndef _MSCC_MIIM_H_ +#define _MSCC_MIIM_H_ +struct mscc_miim_dev {void __iomem *regs; -void __iomem *phy_regs; +phys_addr_t miim_base; +unsigned long miim_size; +struct mii_dev *bus; };int mscc_miim_read (struct mii_dev *bus,int addr,int devad,int reg);int mscc_miim_write (struct mii_dev *bus,int addr,int devad,int reg,u16 val); + +struct mii_dev *mscc_mdiobus_init (struct mscc_miim_dev *miim,int *miim_count, +phys_addr_t miim_base, +unsigned long miim_size); + + +#endif /* _MSCC_MIIM_H_ */
drivers/net/mscc_eswitch/ocelot_switch.c +3 -101
134 lines not on this page · raw message
drivers/net/mscc_eswitch/serval_switch.c +3 -98
125 lines not on this page · raw message
drivers/net/mscc_eswitch/servalt_switch.c +3 -99
126 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH RESEND 1/1 net: mscc: refactor mscc_miim
Am 09.06.19 um 15:27 schrieb Horatiu Vultur:
Quoted 5 lines
Because all MSCC SoC use the same MDIO bus, put the implementation in one common
file(mscc_miim)and make all the other MSCC network drivers to use these functions.Signed-off-by Horatiu Vultur <[email protected]>
Quoted 11 lines
--- drivers/net/mscc_eswitch/Makefile | 10 +-- drivers/net/mscc_eswitch/jr2_switch.c | 119 ++---------------------------- drivers/net/mscc_eswitch/luton_switch.c | 101 +------------------------ drivers/net/mscc_eswitch/mscc_miim.c | 28 +++++++ drivers/net/mscc_eswitch/mscc_miim.h | 14 +++- drivers/net/mscc_eswitch/ocelot_switch.c | 104 +------------------------- drivers/net/mscc_eswitch/serval_switch.c | 101 +------------------------ drivers/net/mscc_eswitch/servalt_switch.c | 102 +------------------------ 8 files changed, 63 insertions(+), 516 deletions(-)
Signature · 1 line
- Daniel
PATCH RESEND 1/1 net: mscc: refactor mscc_miim
In reply to Horatiu VulturQuoted 6 lines · Horatiu Vultur
Because all MSCC SoC use the same MDIO bus, put the implementation in one common
file(mscc_miim)and make all the other MSCC network drivers to use these functions.Signed-off-by Horatiu Vultur <[email protected]>
Hi Horatiu,
https://patchwork.ozlabs.org/patch/1112638/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git
Thanks!
-Joe