add support for the the vsc7512 internal copper phys
Subsystems (7)
Colin Foster
maintainerv5 cover add support for the the vsc7512 internal copper phys
This patch series is a continuation to add support for the VSC7512:
https://patchwork.kernel.org/project/netdevbpf/list/?series=674168&state=*
That series added the framework and initial functionality for the VSC7512 chip. Several of these patches grew during the initial development of the framework, which is why v1 will include changelogs. It was during v9 of that original MFD patch set that these were dropped.
With that out of the way, the VSC7512 is mainly a subset of the VSC7514 chip. The 7512 lacks an internal MIPS processor, but otherwise many of the register definitions are identical. That is why several of these patches are simply to expose common resources from drivers/net/ethernet/mscc/*.
This patch only adds support for the first four ports (swp0-swp3). The remaining ports require more significant changes to the felix driver, and will be handled in the future.
***
Note on V5: This driver triggers a bug in phy_device.c. A fix has been sent to 'net': https://lkml.org/lkml/2023/1/27/1105
***
v5
* Documentation overhauled to use /schemas/net/mscc,vsc7514-switch.yaml instead of /schemas/net/dsa/mscc,ocelot.yaml
* Two patches were applied elsewhere, so have been dropped:
"net: dsa: felix: populate mac_capabilities for all ports" and "dt-bindings: mfd: ocelot: remove spi-max-frequency from required
properties"
* stats_layout changes are no longer necessary, so the patch "net: mscc: ocelot: expose stats layout definition to be used by other drivers" has been dropped
* Common naming macros has been dropped:
"mfd: ocelot: add shared resource names for switch functionality". This changed patches 12-13 slightly.
* Patch 12 had some small changes due to the rebase - more info there
v4
* Update documentation to include all ports / modes (patch 15)
* Fix dt_bindings_check warnings (patch 13, 14, 15)
* Utilize new "resource_names" reference (patch 9, 12, 16)
* Drop unnecessary #undef REG patch in pinctl: ocelot
* Utilize standard MFD resource addition (patch 17)
* Utilize shared vsc7514_regmap (new patch 6)
* Allow forward-compatibility on fully-defined device trees (patch 10,14)
v3
* Fix allmodconfig build (patch 8)
* Change documentation wording (patch 12)
* Import module namespace (patch 13)
* Fix array initializer (patch 13)
v2
* Utilize common ocelot_reset routine (new patch 5, modified patch 13)
* Change init_regmap() routine to be string-based (new patch 8)
* Split patches where necessary (patches 9 and 14)
* Add documentation (patch 12) and MAINTAINERS (patch 13)
* Upgrade to PATCH status
v1 (from RFC v8 suggested above):
* Utilize the MFD framework for creating regmaps, as well as dev_get_regmap() (patches 7 and 8 of this series)
Colin Foster (13):
net: mscc: ocelot: expose ocelot wm functions
net: mscc: ocelot: expose regfield definition to be used by other
drivers
net: mscc: ocelot: expose vcap_props structure
net: mscc: ocelot: expose ocelot_reset routine
net: mscc: ocelot: expose vsc7514_regmap definition
net: dsa: felix: add configurable device quirks
net: dsa: felix: add support for MFD configurations
net: dsa: felix: add functionality when not all ports are supported
mfd: ocelot: prepend resource size macros to be 32-bit
dt-bindings: net: mscc,vsc7514-switch: add dsa binding for the vsc7512
dt-bindings: mfd: ocelot: add ethernet-switch hardware support
net: dsa: ocelot: add external ocelot switch control
mfd: ocelot: add external ocelot switch control
.../devicetree/bindings/mfd/mscc,ocelot.yaml | 9 + .../bindings/net/mscc,vsc7514-switch.yaml | 113 ++++++++--- MAINTAINERS | 1 + drivers/mfd/ocelot-core.c | 68 ++++++- drivers/net/dsa/ocelot/Kconfig | 20 ++ drivers/net/dsa/ocelot/Makefile | 2 + drivers/net/dsa/ocelot/felix.c | 25 ++- drivers/net/dsa/ocelot/felix.h | 2 + drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/ocelot_ext.c | 163 +++++++++++++++ drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + drivers/net/ethernet/mscc/ocelot.c | 48 ++++- drivers/net/ethernet/mscc/ocelot_devlink.c | 31 +++ drivers/net/ethernet/mscc/ocelot_vsc7514.c | 190 +----------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 117 +++++++++++ include/soc/mscc/ocelot.h | 6 + include/soc/mscc/vsc7514_regs.h | 6 + 17 files changed, 582 insertions(+), 221 deletions(-) create mode 100644 drivers/net/dsa/ocelot/ocelot_ext.c
Signature · 1 line
2.25.1
Colin Foster
maintainerPATCH v5 1/13 net: mscc: ocelot: expose ocelot wm functions
Expose ocelot_wm functions so they can be shared with other drivers.
---
v1 - v5:
* No changes since previous RFC
--- drivers/net/ethernet/mscc/ocelot_devlink.c | 31 ++++++++++++++++++++++ drivers/net/ethernet/mscc/ocelot_vsc7514.c | 28 ------------------- include/soc/mscc/ocelot.h | 5 ++++ 3 files changed, 36 insertions(+), 28 deletions(-)
drivers/net/ethernet/mscc/ocelot_devlink.c +31 -0
@@ -487,6 +487,37 @@ static void ocelot_watermark_init(struct ocelot *ocelot)ocelot_setup_sharing_watermarks (ocelot); } +/* Watermark encode +* Bit 8: Unit; 0:1, 1:16 +* Bit 7-0: Value to be multiplied with unit +*/ +u16 ocelot_wm_enc (u16 value) +{ +WARN_ON (value >=16 *BIT (8 )); + +if (value >=BIT (8 )) +return BIT (8 ) | (value /16 ); + +return value; +} +EXPORT_SYMBOL (ocelot_wm_enc); + +u16 ocelot_wm_dec (u16 wm) +{ +if (wm &BIT (8 )) +return (wm &GENMASK (7 ,0 )) *16 ; + +return wm; +} +EXPORT_SYMBOL (ocelot_wm_dec); + +void ocelot_wm_stat (u32 val,u32 *inuse,u32 *maxuse) +{ + *inuse = (val &GENMASK (23 ,12 )) >>12 ; + *maxuse = val &GENMASK (11 ,0 ); +} +EXPORT_SYMBOL (ocelot_wm_stat); +/* Pool size and type are fixed up at runtime. Keeping this structure to * look up the cell size multipliers. */
drivers/net/ethernet/mscc/ocelot_vsc7514.c +0 -28
@@ -229,34 +229,6 @@ static int ocelot_reset(struct ocelot *ocelot)return regmap_field_write (ocelot->regfields[SYS_RESET_CFG_CORE_ENA ],1 ); } -/* Watermark encode -* Bit 8: Unit; 0:1, 1:16 -* Bit 7-0: Value to be multiplied with unit -*/ -static u16 ocelot_wm_enc (u16 value) -{ -WARN_ON (value >=16 *BIT (8 )); - -if (value >=BIT (8 )) -return BIT (8 ) | (value /16 ); - -return value; -} - -static u16 ocelot_wm_dec (u16 wm) -{ -if (wm &BIT (8 )) -return (wm &GENMASK (7 ,0 )) *16 ; - -return wm; -} - -static void ocelot_wm_stat (u32 val,u32 *inuse,u32 *maxuse) -{ - *inuse = (val &GENMASK (23 ,12 )) >>12 ; - *maxuse = val &GENMASK (11 ,0 ); -} -static const struct ocelot_ops ocelot_ops = { .reset = ocelot_reset, .wm_enc = ocelot_wm_enc,
include/soc/mscc/ocelot.h +5 -0
@@ -978,6 +978,11 @@ void ocelot_port_assign_dsa_8021q_cpu(struct ocelot *ocelot, int port, int cpu);void ocelot_port_unassign_dsa_8021q_cpu (struct ocelot *ocelot,int port);u32 ocelot_port_assigned_dsa_8021q_cpu_mask (struct ocelot *ocelot,int port); +/* Watermark interface */ +u16 ocelot_wm_enc (u16 value); +u16 ocelot_wm_dec (u16 wm); +void ocelot_wm_stat (u32 val,u32 *inuse,u32 *maxuse); +/* DSA callbacks */ void ocelot_get_strings (struct ocelot *ocelot,int port,u32 sset,u8 *data);void ocelot_get_ethtool_stats (struct ocelot *ocelot,int port,u64 *data);
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 01/13] net: mscc: ocelot: expose ocelot wm functions
Quoted 4 lines · Colin Foster
Expose
ocelot_wmfunctions so they can be shared with other drivers.Signed-off-by Colin Foster <[email protected]>Reviewed-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 2/13 net: mscc: ocelot: expose regfield definition to be used by other drivers
In reply to Colin FosterThe ocelot_regfields struct is common between several different chips, some of which can only be controlled externally. Export this structure so it doesn't have to be duplicated in these other drivers.
Rename the structure as well, to follow the conventions of other shared resources.
---
v3-v5
* No changes
v2
* Add Reviewed tag
v1 from previous RFC:
* Remove GCB_SOFT_RST_SWC_RST entry from the regfields struct - it isn't used.
* Export the vsc7514_regfields symbol so it can be used as a module.
--- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 60 +--------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 59 +++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 2 + 3 files changed, 62 insertions(+), 59 deletions(-)
drivers/net/ethernet/mscc/ocelot_vsc7514.c +1 -59
@@ -42,64 +42,6 @@ static const u32 *ocelot_regmap[TARGET_MAX] = { [DEV_GMII] = vsc7514_dev_gmii_regmap, }; -static const struct reg_field ocelot_regfields[REGFIELD_MAX ] = { - [ANA_ADVLEARN_VLAN_CHK ] =REG_FIELD (ANA_ADVLEARN ,11 ,11 ), - [ANA_ADVLEARN_LEARN_MIRROR ] =REG_FIELD (ANA_ADVLEARN ,0 ,10 ), - [ANA_ANEVENTS_MSTI_DROP ] =REG_FIELD (ANA_ANEVENTS ,27 ,27 ), - [ANA_ANEVENTS_ACLKILL ] =REG_FIELD (ANA_ANEVENTS ,26 ,26 ), - [ANA_ANEVENTS_ACLUSED ] =REG_FIELD (ANA_ANEVENTS ,25 ,25 ), - [ANA_ANEVENTS_AUTOAGE ] =REG_FIELD (ANA_ANEVENTS ,24 ,24 ), - [ANA_ANEVENTS_VS2TTL1 ] =REG_FIELD (ANA_ANEVENTS ,23 ,23 ), - [ANA_ANEVENTS_STORM_DROP ] =REG_FIELD (ANA_ANEVENTS ,22 ,22 ), - [ANA_ANEVENTS_LEARN_DROP ] =REG_FIELD (ANA_ANEVENTS ,21 ,21 ), - [ANA_ANEVENTS_AGED_ENTRY ] =REG_FIELD (ANA_ANEVENTS ,20 ,20 ), - [ANA_ANEVENTS_CPU_LEARN_FAILED ] =REG_FIELD (ANA_ANEVENTS ,19 ,19 ), - [ANA_ANEVENTS_AUTO_LEARN_FAILED ] =REG_FIELD (ANA_ANEVENTS ,18 ,18 ), - [ANA_ANEVENTS_LEARN_REMOVE ] =REG_FIELD (ANA_ANEVENTS ,17 ,17 ), - [ANA_ANEVENTS_AUTO_LEARNED ] =REG_FIELD (ANA_ANEVENTS ,16 ,16 ), - [ANA_ANEVENTS_AUTO_MOVED ] =REG_FIELD (ANA_ANEVENTS ,15 ,15 ), - [ANA_ANEVENTS_DROPPED ] =REG_FIELD (ANA_ANEVENTS ,14 ,14 ), - [ANA_ANEVENTS_CLASSIFIED_DROP ] =REG_FIELD (ANA_ANEVENTS ,13 ,13 ), - [ANA_ANEVENTS_CLASSIFIED_COPY ] =REG_FIELD (ANA_ANEVENTS ,12 ,12 ), - [ANA_ANEVENTS_VLAN_DISCARD ] =REG_FIELD (ANA_ANEVENTS ,11 ,11 ), - [ANA_ANEVENTS_FWD_DISCARD ] =REG_FIELD (ANA_ANEVENTS ,10 ,10 ), - [ANA_ANEVENTS_MULTICAST_FLOOD ] =REG_FIELD (ANA_ANEVENTS ,9 ,9 ), - [ANA_ANEVENTS_UNICAST_FLOOD ] =REG_FIELD (ANA_ANEVENTS ,8 ,8 ), - [ANA_ANEVENTS_DEST_KNOWN ] =REG_FIELD (ANA_ANEVENTS ,7 ,7 ), - [ANA_ANEVENTS_BUCKET3_MATCH ] =REG_FIELD (ANA_ANEVENTS ,6 ,6 ), - [ANA_ANEVENTS_BUCKET2_MATCH ] =REG_FIELD (ANA_ANEVENTS ,5 ,5 ), - [ANA_ANEVENTS_BUCKET1_MATCH ] =REG_FIELD (ANA_ANEVENTS ,4 ,4 ), - [ANA_ANEVENTS_BUCKET0_MATCH ] =REG_FIELD (ANA_ANEVENTS ,3 ,3 ), - [ANA_ANEVENTS_CPU_OPERATION ] =REG_FIELD (ANA_ANEVENTS ,2 ,2 ), - [ANA_ANEVENTS_DMAC_LOOKUP ] =REG_FIELD (ANA_ANEVENTS ,1 ,1 ), - [ANA_ANEVENTS_SMAC_LOOKUP ] =REG_FIELD (ANA_ANEVENTS ,0 ,0 ), - [ANA_TABLES_MACACCESS_B_DOM ] =REG_FIELD (ANA_TABLES_MACACCESS ,18 ,18 ), - [ANA_TABLES_MACTINDX_BUCKET ] =REG_FIELD (ANA_TABLES_MACTINDX ,10 ,11 ), - [ANA_TABLES_MACTINDX_M_INDEX ] =REG_FIELD (ANA_TABLES_MACTINDX ,0 ,9 ), - [QSYS_TIMED_FRAME_ENTRY_TFRM_VLD ] =REG_FIELD (QSYS_TIMED_FRAME_ENTRY ,20 ,20 ), - [QSYS_TIMED_FRAME_ENTRY_TFRM_FP ] =REG_FIELD (QSYS_TIMED_FRAME_ENTRY ,8 ,19 ), - [QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO ] =REG_FIELD (QSYS_TIMED_FRAME_ENTRY ,4 ,7 ), - [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL ] =REG_FIELD (QSYS_TIMED_FRAME_ENTRY ,1 ,3 ), - [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T ] =REG_FIELD (QSYS_TIMED_FRAME_ENTRY ,0 ,0 ), - [SYS_RESET_CFG_CORE_ENA ] =REG_FIELD (SYS_RESET_CFG ,2 ,2 ), - [SYS_RESET_CFG_MEM_ENA ] =REG_FIELD (SYS_RESET_CFG ,1 ,1 ), - [SYS_RESET_CFG_MEM_INIT ] =REG_FIELD (SYS_RESET_CFG ,0 ,0 ), -/* Replicated per number of ports (12), register size 4 per port */ - [QSYS_SWITCH_PORT_MODE_PORT_ENA ] =REG_FIELD_ID (QSYS_SWITCH_PORT_MODE ,14 ,14 ,12 ,4 ), - [QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG ] =REG_FIELD_ID (QSYS_SWITCH_PORT_MODE ,11 ,13 ,12 ,4 ), - [QSYS_SWITCH_PORT_MODE_YEL_RSRVD ] =REG_FIELD_ID (QSYS_SWITCH_PORT_MODE ,10 ,10 ,12 ,4 ), - [QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE ] =REG_FIELD_ID (QSYS_SWITCH_PORT_MODE ,9 ,9 ,12 ,4 ), - [QSYS_SWITCH_PORT_MODE_TX_PFC_ENA ] =REG_FIELD_ID (QSYS_SWITCH_PORT_MODE ,1 ,8 ,12 ,4 ), - [QSYS_SWITCH_PORT_MODE_TX_PFC_MODE ] =REG_FIELD_ID (QSYS_SWITCH_PORT_MODE ,0 ,0 ,12 ,4 ), - [SYS_PORT_MODE_DATA_WO_TS ] =REG_FIELD_ID (SYS_PORT_MODE ,5 ,6 ,12 ,4 ), - [SYS_PORT_MODE_INCL_INJ_HDR ] =REG_FIELD_ID (SYS_PORT_MODE ,3 ,4 ,12 ,4 ), - [SYS_PORT_MODE_INCL_XTR_HDR ] =REG_FIELD_ID (SYS_PORT_MODE ,1 ,2 ,12 ,4 ), - [SYS_PORT_MODE_INCL_HDR_ERR ] =REG_FIELD_ID (SYS_PORT_MODE ,0 ,0 ,12 ,4 ), - [SYS_PAUSE_CFG_PAUSE_START ] =REG_FIELD_ID (SYS_PAUSE_CFG ,10 ,18 ,12 ,4 ), - [SYS_PAUSE_CFG_PAUSE_STOP ] =REG_FIELD_ID (SYS_PAUSE_CFG ,1 ,9 ,12 ,4 ), - [SYS_PAUSE_CFG_PAUSE_ENA ] =REG_FIELD_ID (SYS_PAUSE_CFG ,0 ,1 ,12 ,4 ), -}; -static void ocelot_pll5_init (struct ocelot *ocelot) {/* Configure PLL5. This will need a proper CCF driver
@@ -137,7 +79,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) ocelot->num_mact_rows =1024 ; ocelot->ops = ops; - ret =ocelot_regfields_init (ocelot, ocelot_regfields); + ret =ocelot_regfields_init (ocelot, vsc7514_regfields);if (ret)return ret;
drivers/net/ethernet/mscc/vsc7514_regs.c +59 -0
65 lines not on this page · raw message
include/soc/mscc/vsc7514_regs.h +2 -0
@@ -10,6 +10,8 @@#include <soc/mscc/ocelot_vcap.h> +extern const struct reg_field vsc7514_regfields[REGFIELD_MAX ]; +extern const u32 vsc7514_ana_regmap[];extern const u32 vsc7514_qs_regmap[];extern const u32 vsc7514_qsys_regmap[];
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 02/13] net: mscc: ocelot: expose regfield definition to be used by other drivers
Quoted 9 lines · Colin Foster
The
ocelot_regfieldsstruct is common between several different chips, some of which can only be controlled externally. Export this structure so it doesn't have to be duplicated in these other drivers.Rename the structure as well, to follow the conventions of other shared resources.
Signed-off-by Colin Foster <[email protected]>Reviewed-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 3/13 net: mscc: ocelot: expose vcap_props structure
In reply to Colin FosterThe vcap_props structure is common to other devices, specifically the VSC7512 chip that can only be controlled externally. Export this structure so it doesn't need to be recreated.
---
v1 - v5 from previous RFC:
* No changes
--- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 43 --------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 44 ++++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 2 + 3 files changed, 46 insertions(+), 43 deletions(-)
drivers/net/ethernet/mscc/ocelot_vsc7514.c +0 -43
@@ -180,49 +180,6 @@ static const struct ocelot_ops ocelot_ops = { .netdev_to_port = ocelot_netdev_to_port, }; -static struct vcap_props vsc7514_vcap_props[] = { - [VCAP_ES0 ] = { - .action_type_width =0 , - .action_table = { - [ES0_ACTION_TYPE_NORMAL ] = { - .width =73 ,/* HIT_STICKY not included */ - .count =1 , - }, - }, - .target =S0 , - .keys = vsc7514_vcap_es0_keys, - .actions = vsc7514_vcap_es0_actions, - }, - [VCAP_IS1 ] = { - .action_type_width =0 , - .action_table = { - [IS1_ACTION_TYPE_NORMAL ] = { - .width =78 ,/* HIT_STICKY not included */ - .count =4 , - }, - }, - .target =S1 , - .keys = vsc7514_vcap_is1_keys, - .actions = vsc7514_vcap_is1_actions, - }, - [VCAP_IS2 ] = { - .action_type_width =1 , - .action_table = { - [IS2_ACTION_TYPE_NORMAL ] = { - .width =49 , - .count =2 - }, - [IS2_ACTION_TYPE_SMAC_SIP ] = { - .width =6 , - .count =4 - }, - }, - .target =S2 , - .keys = vsc7514_vcap_is2_keys, - .actions = vsc7514_vcap_is2_actions, - }, -}; -static struct ptp_clock_info ocelot_ptp_clock_info = { .owner =THIS_MODULE , .name ="ocelot ptp" ,
drivers/net/ethernet/mscc/vsc7514_regs.c +44 -0
47 lines not on this page · raw message
include/soc/mscc/vsc7514_regs.h +2 -0
@@ -10,6 +10,8 @@#include <soc/mscc/ocelot_vcap.h> +extern struct vcap_props vsc7514_vcap_props[]; +extern const struct reg_field vsc7514_regfields[REGFIELD_MAX ];extern const u32 vsc7514_ana_regmap[];
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 03/13] net: mscc: ocelot: expose vcap_props structure
Quoted 5 lines · Colin Foster
The
vcap_propsstructure is common to other devices, specifically the VSC7512 chip that can only be controlled externally. Export this structure so it doesn't need to be recreated.Signed-off-by Colin Foster <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 4/13 net: mscc: ocelot: expose ocelot_reset routine
In reply to Colin FosterResetting the switch core is the same whether it is done internally or externally. Move this routine to the ocelot library so it can be used by other drivers.
---
v3-v5
* No changes
v2
* New patch
--- drivers/net/ethernet/mscc/ocelot.c | 48 +++++++++++++++++++++- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 44 +------------------- include/soc/mscc/ocelot.h | 1 + 3 files changed, 48 insertions(+), 45 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +46 -2
@@ -6,12 +6,16 @@*/ #include <linux/dsa/ocelot.h> #include <linux/if_bridge.h> +#include <linux/iopoll.h> #include <soc/mscc/ocelot_vcap.h> #include "ocelot.h" #include "ocelot_vcap.h" -#define TABLE_UPDATE_SLEEP_US 10 -#define TABLE_UPDATE_TIMEOUT_US 100000 +#define TABLE_UPDATE_SLEEP_US 10 +#define TABLE_UPDATE_TIMEOUT_US 100000 +#define MEM_INIT_SLEEP_US 1000 +#define MEM_INIT_TIMEOUT_US 100000 +#define OCELOT_RSV_VLAN_RANGE_START 4000struct ocelot_mact_entry {
@@ -2713,6 +2717,46 @@ static void ocelot_detect_features(struct ocelot *ocelot) ocelot->num_frame_refs =QSYS_MMGT_EQ_CTRL_FP_FREE_CNT (eq_ctrl); } +static int ocelot_mem_init_status (struct ocelot *ocelot) +{ +unsigned int val; +int err; + + err =regmap_field_read (ocelot->regfields[SYS_RESET_CFG_MEM_INIT ], + &val); + +return err ?: val; +} + +int ocelot_reset (struct ocelot *ocelot) +{ +int err; +u32 val; + + err =regmap_field_write (ocelot->regfields[SYS_RESET_CFG_MEM_INIT ],1 ); +if (err) +return err; + + err =regmap_field_write (ocelot->regfields[SYS_RESET_CFG_MEM_ENA ],1 ); +if (err) +return err; + +/* MEM_INIT is a self-clearing bit. Wait for it to be cleared (should be +* 100us) before enabling the switch core. +*/ + err =readx_poll_timeout (ocelot_mem_init_status, ocelot, val, !val, +MEM_INIT_SLEEP_US ,MEM_INIT_TIMEOUT_US ); +if (err) +return err; + + err =regmap_field_write (ocelot->regfields[SYS_RESET_CFG_MEM_ENA ],1 ); +if (err) +return err; + +return regmap_field_write (ocelot->regfields[SYS_RESET_CFG_CORE_ENA ],1 ); +} +EXPORT_SYMBOL (ocelot_reset); +int ocelot_init (struct ocelot *ocelot) {int i, ret;
drivers/net/ethernet/mscc/ocelot_vsc7514.c +1 -43
68 lines not on this page · raw message
include/soc/mscc/ocelot.h +1 -0
@@ -967,6 +967,7 @@ void ocelot_ptp_rx_timestamp(struct ocelot *ocelot, struct sk_buff *skb,int ocelot_regfields_init (struct ocelot *ocelot,const struct reg_field *const regfields);struct regmap *ocelot_regmap_init (struct ocelot *ocelot,struct resource *res); +int ocelot_reset (struct ocelot *ocelot);int ocelot_init (struct ocelot *ocelot);void ocelot_deinit (struct ocelot *ocelot);void ocelot_init_port (struct ocelot *ocelot,int port);
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 04/13] net: mscc: ocelot: expose ocelot_reset routine
Quoted 5 lines · Colin Foster
Resetting the switch core is the same whether it is done internally or externally. Move this routine to the ocelot library so it can be used by other drivers.
Signed-off-by Colin Foster <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 5/13 net: mscc: ocelot: expose vsc7514_regmap definition
In reply to Colin FosterThe VSC7514 target regmap is identical for ones shared with similar hardware, specifically the VSC7512. Share this resource, and change the name to match the pattern of other exported resources.
---
v5
* No change
v4
* New patch
--- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 15 +-------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 14 ++++++++++++++ include/soc/mscc/vsc7514_regs.h | 2 ++ 3 files changed, 17 insertions(+), 14 deletions(-)
drivers/net/ethernet/mscc/ocelot_vsc7514.c +1 -14
@@ -26,19 +26,6 @@#define VSC7514_VCAP_POLICER_BASE 128#define VSC7514_VCAP_POLICER_MAX 191 -static const u32 *ocelot_regmap[TARGET_MAX ] = { - [ANA ] = vsc7514_ana_regmap, - [QS ] = vsc7514_qs_regmap, - [QSYS ] = vsc7514_qsys_regmap, - [REW ] = vsc7514_rew_regmap, - [SYS ] = vsc7514_sys_regmap, - [S0 ] = vsc7514_vcap_regmap, - [S1 ] = vsc7514_vcap_regmap, - [S2 ] = vsc7514_vcap_regmap, - [PTP ] = vsc7514_ptp_regmap, - [DEV_GMII ] = vsc7514_dev_gmii_regmap, -}; -static void ocelot_pll5_init (struct ocelot *ocelot) {/* Configure PLL5. This will need a proper CCF driver
@@ -72,7 +59,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) {int ret; - ocelot->map = ocelot_regmap; + ocelot->map = vsc7514_regmap; ocelot->num_mact_rows =1024 ; ocelot->ops = ops;
drivers/net/ethernet/mscc/vsc7514_regs.c +14 -0
@@ -429,6 +429,20 @@ const u32 vsc7514_dev_gmii_regmap[] = { };EXPORT_SYMBOL (vsc7514_dev_gmii_regmap); +const u32 *vsc7514_regmap[TARGET_MAX ] = { + [ANA ] = vsc7514_ana_regmap, + [QS ] = vsc7514_qs_regmap, + [QSYS ] = vsc7514_qsys_regmap, + [REW ] = vsc7514_rew_regmap, + [SYS ] = vsc7514_sys_regmap, + [S0 ] = vsc7514_vcap_regmap, + [S1 ] = vsc7514_vcap_regmap, + [S2 ] = vsc7514_vcap_regmap, + [PTP ] = vsc7514_ptp_regmap, + [DEV_GMII ] = vsc7514_dev_gmii_regmap, +}; +EXPORT_SYMBOL (vsc7514_regmap); +const struct vcap_field vsc7514_vcap_es0_keys[] = { [VCAP_ES0_EGR_PORT ] = {0 ,4 }, [VCAP_ES0_IGR_PORT ] = {4 ,4 },
include/soc/mscc/vsc7514_regs.h +2 -0
@@ -23,6 +23,8 @@ extern const u32 vsc7514_vcap_regmap[];extern const u32 vsc7514_ptp_regmap[];extern const u32 vsc7514_dev_gmii_regmap[]; +extern const u32 *vsc7514_regmap[TARGET_MAX ]; +extern const struct vcap_field vsc7514_vcap_es0_keys[];extern const struct vcap_field vsc7514_vcap_es0_actions[];extern const struct vcap_field vsc7514_vcap_is1_keys[];
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 05/13] net: mscc: ocelot: expose vsc7514_regmap definition
Quoted 5 lines · Colin Foster
The VSC7514 target regmap is identical for ones shared with similar hardware, specifically the VSC7512. Share this resource, and change the name to match the pattern of other exported resources.
Signed-off-by Colin Foster <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 6/13 net: dsa: felix: add configurable device quirks
In reply to Colin FosterThe define FELIX_MAC_QUIRKS was used directly in the felix.c shared driver. Other devices (VSC7512 for example) don't require the same quirks, so they need to be configured on a per-device basis.
---
v2-v5
* No changes
v1 from previous RFC:
* No changes
--- drivers/net/dsa/ocelot/felix.c | 7 +++++-- drivers/net/dsa/ocelot/felix.h | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/dsa/ocelot/felix.c +5 -2
@@ -1075,9 +1075,12 @@ static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, phy_interface_t interface) {struct ocelot *ocelot = ds->priv; +struct felix *felix; + + felix =ocelot_to_felix (ocelot);ocelot_phylink_mac_link_down (ocelot, port, link_an_mode, interface, -FELIX_MAC_QUIRKS ); + felix->info->quirks); } static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port,
@@ -1092,7 +1095,7 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port,ocelot_phylink_mac_link_up (ocelot, port, phydev, link_an_mode, interface, speed, duplex, tx_pause, rx_pause, -FELIX_MAC_QUIRKS ); + felix->info->quirks);if (felix->info->port_sched_speed_set) felix->info->port_sched_speed_set (ocelot, port, speed);
drivers/net/dsa/ocelot/felix.h +1 -0
@@ -36,6 +36,7 @@ struct felix_info {u16 vcap_pol_base2;u16 vcap_pol_max2;const struct ptp_clock_info *ptp_caps; +unsigned long quirks;/* Some Ocelot switches are integrated into the SoC without the * extraction IRQ line connected to the ARM GIC. By enabling this
drivers/net/dsa/ocelot/felix_vsc9959.c +1 -0
@@ -2593,6 +2593,7 @@ static const struct felix_info felix_info_vsc9959 = { .num_mact_rows = 2048, .num_ports = VSC9959_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC, + .quirks = FELIX_MAC_QUIRKS, .quirk_no_xtr_irq = true, .ptp_caps = &vsc9959_ptp_caps, .mdio_bus_alloc = vsc9959_mdio_bus_alloc,
drivers/net/dsa/ocelot/seville_vsc9953.c +1 -0
@@ -971,6 +971,7 @@ static const struct felix_info seville_info_vsc9953 = { .vcap_pol_max = VSC9953_VCAP_POLICER_MAX, .vcap_pol_base2 = VSC9953_VCAP_POLICER_BASE2, .vcap_pol_max2 = VSC9953_VCAP_POLICER_MAX2, + .quirks = FELIX_MAC_QUIRKS, .num_mact_rows = 2048, .num_ports = VSC9953_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC,
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 06/13] net: dsa: felix: add configurable device quirks
Quoted 6 lines · Colin Foster
The define
FELIX_MAC_QUIRKSwas used directly in thefelix.cshared driver. Other devices (VSC7512 for example) don't require the same quirks, so they need to be configured on a per-device basis.Signed-off-by Colin Foster <[email protected]>Reviewed-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 7/13 net: dsa: felix: add support for MFD configurations
In reply to Colin FosterThe architecture around the VSC7512 differs from existing felix drivers. In order to add support for all the chip's features (pinctrl, MDIO, gpio) the device had to be laid out as a multi-function device (MFD).
One difference between an MFD and a standard platform device is that the regmaps are allocated to the parent device before the child devices are probed. As such, there is no need for felix to initialize new regmaps in these configurations, they can simply be requested from the parent device.
Add support for MFD configurations by performing this request from the parent device.
---
v5
* No changes
v4
* New patch
--- drivers/net/dsa/ocelot/felix.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/dsa/ocelot/felix.c +7 -0
@@ -1315,6 +1315,13 @@ static struct regmap *felix_request_regmap_by_name(struct felix *felix,struct resource res;int i; +/* In an MFD configuration, regmaps are registered directly to the +* parent device before the child devices are probed, so there is no +* need to initialize a new one. +*/ +if (!felix->info->resources) +return dev_get_regmap (ocelot->dev->parent, resource_name); +for (i =0 ; i < felix->info->num_resources; i++) {if (strcmp (resource_name, felix->info->resources[i].name))continue ;
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 07/13] net: dsa: felix: add support for MFD configurations
Quoted 9 lines · Colin Foster
The architecture around the VSC7512 differs from existing felix drivers. In order to add support for all the chip's features (pinctrl, MDIO, gpio) the device had to be laid out as a multi-function device (MFD).
One difference between an MFD and a standard platform device is that the regmaps are allocated to the parent device before the child devices are probed. As such, there is no need for felix to initialize new regmaps in these configurations, they can simply be requested from the parent device.
Quoted 4 lines
Add support for MFD configurations by performing this request from the parent device.
Signed-off-by Colin Foster <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 8/13 net: dsa: felix: add functionality when not all ports are supported
In reply to Colin FosterWhen the Felix driver would probe the ports and verify functionality, it would fail if it hit single port mode that wasn't supported by the driver.
The initial case for the VSC7512 driver will have physical ports that exist, but aren't supported by the driver implementation. Add the OCELOT_PORT_MODE_NONE macro to handle this scenario, and allow the Felix driver to continue with all the ports that are currently functional.
---
v5
* No changes
v4
* New patch
--- drivers/net/dsa/ocelot/felix.c | 11 ++++++++--- drivers/net/dsa/ocelot/felix.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/dsa/ocelot/felix.c +8 -3
@@ -1273,10 +1273,15 @@ static int felix_parse_ports_node(struct felix *felix, err =felix_validate_phy_mode (felix, port, phy_mode);if (err <0 ) { -dev_err (dev,"Unsupported PHY mode %s on port %d\n" , -phy_modes (phy_mode), port); +dev_info (dev,"Unsupported PHY mode %s on port %d\n" , +phy_modes (phy_mode), port);of_node_put (child); -return err; + +/* Leave port_phy_modes[port] = 0, which is also +* PHY_INTERFACE_MODE_NA. This will perform a +* best-effort to bring up as many ports as possible. +*/ +continue ; } port_phy_modes[port] = phy_mode;
drivers/net/dsa/ocelot/felix.h +1 -0
@@ -7,6 +7,7 @@#define ocelot_to_felix (o) container_of((o), struct felix, ocelot)#define FELIX_MAC_QUIRKS OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION +#define OCELOT_PORT_MODE_NONE 0#define OCELOT_PORT_MODE_INTERNAL BIT(0)#define OCELOT_PORT_MODE_SGMII BIT(1)#define OCELOT_PORT_MODE_QSGMII BIT(2)
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 08/13] net: dsa: felix: add functionality when not all ports are supported
Quoted 9 lines · Colin Foster
When the Felix driver would probe the ports and verify functionality, it would fail if it hit single port mode that wasn't supported by the driver.
The initial case for the VSC7512 driver will have physical ports that exist, but aren't supported by the driver implementation. Add the
OCELOT_PORT_MODE_NONEmacro to handle this scenario, and allow the Felix driver to continue with all the ports that are currently functional.Signed-off-by Colin Foster <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 9/13 mfd: ocelot: prepend resource size macros to be 32-bit
In reply to Colin FosterThe *_RES_SIZE macros are initally <= 0x100. Future resource sizes will be upwards of 0x200000 in size.
To keep things clean, fully align the RES_SIZE macros to 32-bit to do nothing more than make the code more consistent.
---
v5
* Add Lee's Acked-for-MFD tag
v3-v4
* No change
v2
* New patch - broken out from a different one
--- drivers/mfd/ocelot-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/ocelot-core.c +4 -4
@@ -34,16 +34,16 @@#define VSC7512_MIIM0_RES_START 0x7107009c#define VSC7512_MIIM1_RES_START 0x710700c0 -#define VSC7512_MIIM_RES_SIZE 0x024 +#define VSC7512_MIIM_RES_SIZE 0x00000024#define VSC7512_PHY_RES_START 0x710700f0 -#define VSC7512_PHY_RES_SIZE 0x004 +#define VSC7512_PHY_RES_SIZE 0x00000004#define VSC7512_GPIO_RES_START 0x71070034 -#define VSC7512_GPIO_RES_SIZE 0x06c +#define VSC7512_GPIO_RES_SIZE 0x0000006c#define VSC7512_SIO_CTRL_RES_START 0x710700f8 -#define VSC7512_SIO_CTRL_RES_SIZE 0x100 +#define VSC7512_SIO_CTRL_RES_SIZE 0x00000100#define VSC7512_GCB_RST_SLEEP_US 100#define VSC7512_GCB_RST_TIMEOUT_US 100000
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 09/13] mfd: ocelot: prepend resource size macros to be 32-bit
Quoted 8 lines · Colin Foster
The
*_RES_SIZEmacros are initally <=0x100. Future resource sizes will be upwards of0x200000in size.To keep things clean, fully align the
RES_SIZEmacros to 32-bit to do nothing more than make the code more consistent.Signed-off-by Colin Foster <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 10/13 dt-bindings: net: mscc,vsc7514-switch: add dsa binding for the vsc7512
In reply to Colin FosterThe VSC7511, VSC7512, VSC7513 and VSC7514 all have the ability to be controlled either internally by a memory-mapped CPU, or externally via interfaces like SPI and PCIe. The internal CPU of the VSC7511 and 7512 don't have the resources to run Linux, so must be controlled via these external interfaces in a DSA configuration.
Add mscc,vsc7512-switch compatible string to indicate that the chips are being controlled externally in a DSA configuration.
---
v5
* New patch after a documentation overhaul series
--- .../bindings/net/mscc,vsc7514-switch.yaml | 113 ++++++++++++++---- 1 file changed, 90 insertions(+), 23 deletions(-)
Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml +90 -23
@@ -18,13 +18,52 @@ description: | packets using CPU. Additionally, PTP is supported as well as FDMA for faster packet extraction/injection. -$ref: ethernet-switch.yaml# +allOf: + - if: + properties: + compatible: + const: mscc,vsc7514-switch + then: + $ref: ethernet-switch.yaml# + required: + - interrupts + - interrupt-names + properties: + reg: + minItems: 21 + reg-names: + minItems: 21 + ethernet-ports: + patternProperties: + "^port@[0-9a-f]+$": + $ref: ethernet-switch-port.yaml# + unevaluatedProperties: false + + - if: + properties: + compatible: + const: mscc,vsc7512-switch + then: + $ref: /schemas/net/dsa/dsa.yaml# + properties: + reg: + maxItems: 20 + reg-names: + maxItems: 20 + ethernet-ports: + patternProperties: + "^port@[0-9a-f]+$": + $ref: /schemas/net/dsa/dsa-port.yaml# + unevaluatedProperties: false properties: compatible: - const: mscc,vsc7514-switch + enum: + - mscc,vsc7512-switch + - mscc,vsc7514-switch reg: + minItems: 20 items: - description: system target - description: rewriter target
@@ -49,6 +88,7 @@ properties: - description: fdma target reg-names: + minItems: 20 items: - const: sys - const: rew
@@ -86,35 +126,16 @@ properties: - const: xtr - const: fdma - ethernet-ports: - type: object - - properties: - '#address-cells': - const: 1 - '#size-cells': - const: 0 - - additionalProperties: false - - patternProperties: - "^port@[0-9a-f]+$": - - $ref: ethernet-switch-port.yaml# - - unevaluatedProperties: false - required: - compatible - reg - reg-names - - interrupts - - interrupt-names - ethernet-ports -additionalProperties: false +unevaluatedProperties: false examples: + # VSC7514 (Switchdev) - | switch@1010000 { compatible = "mscc,vsc7514-switch";
@@ -162,5 +183,51 @@ examples: }; }; }; + # VSC7512 (DSA) + - | + ethernet-switch@1{ + compatible = "mscc,vsc7512-switch"; + reg = <0x71010000 0x10000>, + <0x71030000 0x10000>, + <0x71080000 0x100>, + <0x710e0000 0x10000>, + <0x711e0000 0x100>, + <0x711f0000 0x100>, + <0x71200000 0x100>, + <0x71210000 0x100>, + <0x71220000 0x100>, + <0x71230000 0x100>, + <0x71240000 0x100>, + <0x71250000 0x100>, + <0x71260000 0x100>, + <0x71270000 0x100>, + <0x71280000 0x100>, + <0x71800000 0x80000>, + <0x71880000 0x10000>, + <0x71040000 0x10000>, + <0x71050000 0x10000>, + <0x71060000 0x10000>; + reg-names = "sys", "rew", "qs", "ptp", "port0", "port1", + "port2", "port3", "port4", "port5", "port6", + "port7", "port8", "port9", "port10", "qsys", + "ana", "s0", "s1", "s2"; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + ethernet = <&mac_sw>; + phy-handle = <&phy0>; + phy-mode = "internal"; + }; + port@1 { + reg = <1>; + phy-handle = <&phy1>; + phy-mode = "internal"; + }; + }; + }; ...
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 10/13] dt-bindings: net: mscc,vsc7514-switch: add dsa binding for the vsc7512
Quoted 10 lines · Colin Foster
The VSC7511, VSC7512, VSC7513 and VSC7514 all have the ability to be controlled either internally by a memory-mapped CPU, or externally via interfaces like SPI and PCIe. The internal CPU of the VSC7511 and 7512 don't have the resources to run Linux, so must be controlled via these external interfaces in a DSA configuration.
Add mscc,vsc7512-switch compatible string to indicate that the chips are being controlled externally in a DSA configuration.
Signed-off-by Colin Foster <[email protected]>
Quoted 9 lines
---
v5
* New patch after a documentation overhaul series--- .../bindings/net/mscc,vsc7514-switch.yaml | 113 ++++++++++++++---- 1 file changed, 90 insertions(+), 23 deletions(-)
Colin Foster
maintainerPATCH v5 11/13 dt-bindings: mfd: ocelot: add ethernet-switch hardware support
In reply to Colin FosterThe main purpose of the Ocelot chips are the Ethernet switching functionalities. Document the support for these features.
---
v5
* Update ref to mscc,vsc7514-switch.yaml instead of mscc.ocelot.yaml
* Add unevaluatedProperties: false
v4
* New patch
--- Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml +9 -0
@@ -57,6 +57,15 @@ patternProperties: enum: - mscc,ocelot-miim + "^ethernet-switch@[0-9a-f]+$": + type: object + $ref: /schemas/net/mscc,vsc7514-switch.yaml + unevaluatedProperties: false + properties: + compatible: + enum: + - mscc,vsc7512-switch + required: - compatible - reg
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 11/13] dt-bindings: mfd: ocelot: add ethernet-switch hardware support
Quoted 11 lines · Colin Foster
The main purpose of the Ocelot chips are the Ethernet switching functionalities. Document the support for these features.
Signed-off-by Colin Foster <[email protected]>---
v5
* Update ref to mscc,vsc7514-switch.yaml instead ofmscc.ocelot.yaml
* Add unevaluatedProperties: false
Quoted 7 lines
v4
* New patch--- Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
Colin Foster
maintainerPATCH v5 12/13 net: dsa: ocelot: add external ocelot switch control
In reply to Colin FosterAdd control of an external VSC7512 chip.
Currently the four copper phy ports are fully functional. Communication to external phys is also functional, but the SGMII / QSGMII interfaces are currently non-functional.
---
v5
* Rebase to use NET_DSA_MSCC_FELIX_DSA_LIB
* Remove ocelot_ext_phylink_validate as part of the rebase
* Remove stats_layout reference as part of the rebase
* Remove OCELOT_RES_NAME_* macros
v4
* Add forward-compatibility for device trees that have ports 4-7 defined by saying they are OCELOT_PORT_MODE_NONE
* Utilize new "resource_names" instead of "*_io_res". Many thanks to Vladimir for making this possible.
- Also remove ocelot_ext_regmap_init() function
* Remove dev_set_drvdata(dev, NULL) from remove() to match other drivers
v3
* Remove additional entry in vsc7512_port_modes array
* Add MFD_OCELOT namespace import, which is needed for vsc7512_*_io_res
v2
* Add MAINTAINERS update
* Remove phrase "by way of the ocelot-mfd interface" from the commit message
* Move MFD resource addition to a separate patch
* Update Kconfig help
* Remove "ocelot_ext_reset()" - it is now shared with ocelot_lib
* Remove unnecessary includes
* Remove "_EXT" from OCELOT_EXT_PORT_MODE_SERDES
* Remove _ext from the compatible string
* Remove no-longer-necessary GCB register definitions
v1 from previous RFC:
* Remove unnecessary byteorder and kconfig header includes.
* Create OCELOT_EXT_PORT_MODE_SERDES macro to match vsc9959.
* Utilize readx_poll_timeout for SYS_RESET_CFG_MEM_INIT.
* *_io_res struct arrays have been moved to the MFD files.
* Changes to utilize phylink_generic_validate() have been squashed.
* dev_err_probe() is used in the probe function.
* Make ocelot_ext_switch_of_match static.
* Relocate ocelot_ext_ops structure to be next to vsc7512_info, to match what was done in other felix drivers.
* Utilize dev_get_regmap() instead of the obsolete ocelot_init_regmap_from_resource() routine.
--- MAINTAINERS | 1 + drivers/net/dsa/ocelot/Kconfig | 20 ++++ drivers/net/dsa/ocelot/Makefile | 2 + drivers/net/dsa/ocelot/ocelot_ext.c | 163 ++++++++++++++++++++++++++++ 4 files changed, 186 insertions(+) create mode 100644 drivers/net/dsa/ocelot/ocelot_ext.c
MAINTAINERS +1 -0
@@ -15157,6 +15157,7 @@ M: Colin Foster <[email protected]> S: Supported F: Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml F: drivers/mfd/ocelot* +F: drivers/net/dsa/ocelot/ocelot_ext.c F: include/linux/mfd/ocelot.h OCXL (Open Coherent Accelerator Processor Interface OpenCAPI) DRIVER
drivers/net/dsa/ocelot/Kconfig +20 -0
@@ -8,6 +8,26 @@ config NET_DSA_MSCC_FELIX_DSA_LIB Its name comes from the first hardware chip to make use of it (VSC9959), code named Felix. +config NET_DSA_MSCC_OCELOT_EXT + tristate "Ocelot External Ethernet switch support" + depends on NET_DSA && SPI + depends on NET_VENDOR_MICROSEMI + select MDIO_MSCC_MIIM + select MFD_OCELOT_CORE + select MSCC_OCELOT_SWITCH_LIB + select NET_DSA_MSCC_FELIX_DSA_LIB + select NET_DSA_TAG_OCELOT_8021Q + select NET_DSA_TAG_OCELOT + help + This driver supports the VSC7511, VSC7512, VSC7513 and VSC7514 chips + when controlled through SPI. + + The Ocelot switch family is a set of multi-port networking chips. All + of these chips have the ability to be controlled externally through + SPI or PCIe interfaces. + + Say "Y" here to enable external control to these chips. + config NET_DSA_MSCC_FELIX tristate "Ocelot / Felix Ethernet switch support" depends on NET_DSA && PCI
drivers/net/dsa/ocelot/Makefile +2 -0
@@ -1,8 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_NET_DSA_MSCC_FELIX_DSA_LIB) += mscc_felix_dsa_lib.o obj-$(CONFIG_NET_DSA_MSCC_FELIX) += mscc_felix.o +obj-$(CONFIG_NET_DSA_MSCC_OCELOT_EXT) += mscc_ocelot_ext.o obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) += mscc_seville.o mscc_felix_dsa_lib-objs := felix.o mscc_felix-objs := felix_vsc9959.o +mscc_ocelot_ext-objs := ocelot_ext.o mscc_seville-objs := seville_vsc9953.o
drivers/net/dsa/ocelot/ocelot_ext.c new file +163 -0
163 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 12/13] net: dsa: ocelot: add external ocelot switch control
Quoted 7 lines · Colin Foster
Add control of an external VSC7512 chip.
Currently the four copper phy ports are fully functional. Communication to external phys is also functional, but the SGMII / QSGMII interfaces are currently non-functional.
Signed-off-by Colin Foster <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerPATCH v5 13/13 mfd: ocelot: add external ocelot switch control
In reply to Colin FosterUtilize the existing ocelot MFD interface to add switch functionality to the Microsemi VSC7512 chip.
---
v5
* Add Acked-for-MFD Lee tag
* Remove OCELOT_REG_NAME_ macros
v4
* Integrate a different patch, so now this one
- Adds the resources during this patch. Previouisly this was done in a separate patch
- Utilize the standard {,num_}resources initializer
v3
* No change
v2
* New patch, broken out from a previous one
--- drivers/mfd/ocelot-core.c | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
drivers/mfd/ocelot-core.c +60 -0
@@ -45,6 +45,39 @@#define VSC7512_SIO_CTRL_RES_START 0x710700f8#define VSC7512_SIO_CTRL_RES_SIZE 0x00000100 +#define VSC7512_ANA_RES_START 0x71880000 +#define VSC7512_ANA_RES_SIZE 0x00010000 + +#define VSC7512_QS_RES_START 0x71080000 +#define VSC7512_QS_RES_SIZE 0x00000100 + +#define VSC7512_QSYS_RES_START 0x71800000 +#define VSC7512_QSYS_RES_SIZE 0x00200000 + +#define VSC7512_REW_RES_START 0x71030000 +#define VSC7512_REW_RES_SIZE 0x00010000 + +#define VSC7512_SYS_RES_START 0x71010000 +#define VSC7512_SYS_RES_SIZE 0x00010000 + +#define VSC7512_S0_RES_START 0x71040000 +#define VSC7512_S1_RES_START 0x71050000 +#define VSC7512_S2_RES_START 0x71060000 +#define VCAP_RES_SIZE 0x00000400 + +#define VSC7512_PORT_0_RES_START 0x711e0000 +#define VSC7512_PORT_1_RES_START 0x711f0000 +#define VSC7512_PORT_2_RES_START 0x71200000 +#define VSC7512_PORT_3_RES_START 0x71210000 +#define VSC7512_PORT_4_RES_START 0x71220000 +#define VSC7512_PORT_5_RES_START 0x71230000 +#define VSC7512_PORT_6_RES_START 0x71240000 +#define VSC7512_PORT_7_RES_START 0x71250000 +#define VSC7512_PORT_8_RES_START 0x71260000 +#define VSC7512_PORT_9_RES_START 0x71270000 +#define VSC7512_PORT_10_RES_START 0x71280000 +#define VSC7512_PORT_RES_SIZE 0x00010000 +#define VSC7512_GCB_RST_SLEEP_US 100#define VSC7512_GCB_RST_TIMEOUT_US 100000
@@ -96,6 +129,28 @@ static const struct resource vsc7512_sgpio_resources[] = { DEFINE_RES_REG_NAMED(VSC7512_SIO_CTRL_RES_START, VSC7512_SIO_CTRL_RES_SIZE, "gcb_sio"), }; +static const struct resource vsc7512_switch_resources[] = { +DEFINE_RES_REG_NAMED (VSC7512_ANA_RES_START ,VSC7512_ANA_RES_SIZE ,"ana" ), +DEFINE_RES_REG_NAMED (VSC7512_QS_RES_START ,VSC7512_QS_RES_SIZE ,"qs" ), +DEFINE_RES_REG_NAMED (VSC7512_QSYS_RES_START ,VSC7512_QSYS_RES_SIZE ,"qsys" ), +DEFINE_RES_REG_NAMED (VSC7512_REW_RES_START ,VSC7512_REW_RES_SIZE ,"rew" ), +DEFINE_RES_REG_NAMED (VSC7512_SYS_RES_START ,VSC7512_SYS_RES_SIZE ,"sys" ), +DEFINE_RES_REG_NAMED (VSC7512_S0_RES_START ,VCAP_RES_SIZE ,"s0" ), +DEFINE_RES_REG_NAMED (VSC7512_S1_RES_START ,VCAP_RES_SIZE ,"s1" ), +DEFINE_RES_REG_NAMED (VSC7512_S2_RES_START ,VCAP_RES_SIZE ,"s2" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_0_RES_START ,VSC7512_PORT_RES_SIZE ,"port0" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_1_RES_START ,VSC7512_PORT_RES_SIZE ,"port1" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_2_RES_START ,VSC7512_PORT_RES_SIZE ,"port2" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_3_RES_START ,VSC7512_PORT_RES_SIZE ,"port3" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_4_RES_START ,VSC7512_PORT_RES_SIZE ,"port4" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_5_RES_START ,VSC7512_PORT_RES_SIZE ,"port5" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_6_RES_START ,VSC7512_PORT_RES_SIZE ,"port6" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_7_RES_START ,VSC7512_PORT_RES_SIZE ,"port7" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_8_RES_START ,VSC7512_PORT_RES_SIZE ,"port8" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_9_RES_START ,VSC7512_PORT_RES_SIZE ,"port9" ), +DEFINE_RES_REG_NAMED (VSC7512_PORT_10_RES_START ,VSC7512_PORT_RES_SIZE ,"port10" ) +}; +static const struct mfd_cell vsc7512_devs[] = { { .name ="ocelot-pinctrl" ,
@@ -121,6 +176,11 @@ static const struct mfd_cell vsc7512_devs[] = { .use_of_reg = true, .num_resources = ARRAY_SIZE(vsc7512_miim1_resources), .resources = vsc7512_miim1_resources, + }, { + .name = "ocelot-switch", + .of_compatible = "mscc,vsc7512-switch", + .num_resources = ARRAY_SIZE(vsc7512_switch_resources), + .resources = vsc7512_switch_resources, }, };
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 13/13] mfd: ocelot: add external ocelot switch control
Quoted 5 lines · Colin Foster
Utilize the existing ocelot MFD interface to add switch functionality to the Microsemi VSC7512 chip.
Signed-off-by Colin Foster <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>
Signature · 1 line
Florian
Colin Foster
maintainerRe: [PATCH v5 net-next 13/13] mfd: ocelot: add external ocelot switch control
Quoted 12 lines · Florian Fainelli
Quoted 5 lines · Colin Foster
Utilize the existing ocelot MFD interface to add switch functionality to the Microsemi VSC7512 chip.
Signed-off-by Colin Foster <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Signature · 1 line
Florian
Thanks for all the reviews today Florian!
Quoted 14 lines · Colin Foster
This patch series is a continuation to add support for the VSC7512:
https://patchwork.kernel.org/project/netdevbpf/list/?series=674168&state=*That series added the framework and initial functionality for the VSC7512 chip. Several of these patches grew during the initial development of the framework, which is why v1 will include changelogs. It was during v9 of that original MFD patch set that these were dropped.
With that out of the way, the VSC7512 is mainly a subset of the VSC7514 chip. The 7512 lacks an internal MIPS processor, but otherwise many of the register definitions are identical. That is why several of these patches are simply to expose common resources from
drivers/net/ethernet/mscc/*.
Quoted 3 lines
This patch only adds support for the first four ports (swp0-swp3). The remaining ports require more significant changes to the felix driver, and will be handled in the future.
For the whole series:
A minor nitpick after this is merged: please clean up and unexport stuff from include/soc/mscc/vsc7514_regs.h which was added with your previous approaches and then we steered mid-way.
Congratulations!
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Fri, 27 Jan 2023 11:35:46 -0800 you wrote:
This patch series is a continuation to add support for the VSC7512:
https://patchwork.kernel.org/project/netdevbpf/list/?series=674168&state=*That series added the framework and initial functionality for the VSC7512 chip. Several of these patches grew during the initial development of the framework, which is why v1 will include changelogs. It was during v9 of that original MFD patch set that these were dropped.
[...]
Here is the summary with links:
- [v5,net-next,01/13] net: mscc: ocelot: expose ocelot wm functions
https://git.kernel.org/netdev/net-next/c/c6a9321b0811 - [v5,net-next,02/13] net: mscc: ocelot: expose regfield definition to be used by other drivers https://git.kernel.org/netdev/net-next/c/728d8019f1a3 - [v5,net-next,03/13] net: mscc: ocelot: expose vcap_props structure https://git.kernel.org/netdev/net-next/c/beb9a74e0bf7 - [v5,net-next,04/13] net: mscc: ocelot: expose ocelot_reset routine https://git.kernel.org/netdev/net-next/c/b67f5502136f - [v5,net-next,05/13] net: mscc: ocelot: expose vsc7514_regmap definition https://git.kernel.org/netdev/net-next/c/2efaca411c96 - [v5,net-next,06/13] net: dsa: felix: add configurable device quirks https://git.kernel.org/netdev/net-next/c/1dc6a2a02320 - [v5,net-next,07/13] net: dsa: felix: add support for MFD configurations https://git.kernel.org/netdev/net-next/c/dc454fa4b764 - [v5,net-next,08/13] net: dsa: felix: add functionality when not all ports are supported https://git.kernel.org/netdev/net-next/c/de879a016a94 - [v5,net-next,09/13] mfd: ocelot: prepend resource size macros to be 32-bit https://git.kernel.org/netdev/net-next/c/fde0b6ced8ed - [v5,net-next,10/13] dt-bindings: net: mscc,vsc7514-switch: add dsa binding for the vsc7512 https://git.kernel.org/netdev/net-next/c/dd43f5e7684c - [v5,net-next,11/13] dt-bindings: mfd: ocelot: add ethernet-switch hardware support https://git.kernel.org/netdev/net-next/c/11fc80cbb225 - [v5,net-next,12/13] net: dsa: ocelot: add external ocelot switch control https://git.kernel.org/netdev/net-next/c/3d7316ac81ac - [v5,net-next,13/13] mfd: ocelot: add external ocelot switch control https://git.kernel.org/netdev/net-next/c/8dccdd277e0b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 4 lines · On Tue, 31 Jan 2023, [email protected] wrote:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Please don't do that. The commits do not have proper Acked-by tags.
The plan is to merge these via MFD and send out a pull-request to an immutable branch. However, if you're prepared to convert all of the:
to
... and send out a pull request to a succinct (only these patches) and immutable branch then that is also an acceptable solution.
Please let me know what works best for you.
Thanks.
Quoted 44 lines
Quoted 9 lines
This patch series is a continuation to add support for the VSC7512:
https://patchwork.kernel.org/project/netdevbpf/list/?series=674168&state=*That series added the framework and initial functionality for the VSC7512 chip. Several of these patches grew during the initial development of the framework, which is why v1 will include changelogs. It was during v9 of that original MFD patch set that these were dropped.
[...]
Here is the summary with links:
- [v5,net-next,01/13] net: mscc: ocelot: expose ocelot wm functionshttps://git.kernel.org/netdev/net-next/c/c6a9321b0811 - [v5,net-next,02/13] net: mscc: ocelot: expose regfield definition to be used by other drivers https://git.kernel.org/netdev/net-next/c/728d8019f1a3 - [v5,net-next,03/13] net: mscc: ocelot: expose vcap_props structure https://git.kernel.org/netdev/net-next/c/beb9a74e0bf7 - [v5,net-next,04/13] net: mscc: ocelot: expose ocelot_reset routine https://git.kernel.org/netdev/net-next/c/b67f5502136f - [v5,net-next,05/13] net: mscc: ocelot: expose vsc7514_regmap definition https://git.kernel.org/netdev/net-next/c/2efaca411c96 - [v5,net-next,06/13] net: dsa: felix: add configurable device quirks https://git.kernel.org/netdev/net-next/c/1dc6a2a02320 - [v5,net-next,07/13] net: dsa: felix: add support for MFD configurations https://git.kernel.org/netdev/net-next/c/dc454fa4b764 - [v5,net-next,08/13] net: dsa: felix: add functionality when not all ports are supported https://git.kernel.org/netdev/net-next/c/de879a016a94 - [v5,net-next,09/13] mfd: ocelot: prepend resource size macros to be 32-bit https://git.kernel.org/netdev/net-next/c/fde0b6ced8ed - [v5,net-next,10/13] dt-bindings: net: mscc,vsc7514-switch: add dsa binding for the vsc7512 https://git.kernel.org/netdev/net-next/c/dd43f5e7684c - [v5,net-next,11/13] dt-bindings: mfd: ocelot: add ethernet-switch hardware support https://git.kernel.org/netdev/net-next/c/11fc80cbb225 - [v5,net-next,12/13] net: dsa: ocelot: add external ocelot switch control https://git.kernel.org/netdev/net-next/c/3d7316ac81ac - [v5,net-next,13/13] mfd: ocelot: add external ocelot switch control https://git.kernel.org/netdev/net-next/c/8dccdd277e0bYou are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Signature · 1 line
Lee Jones [李琼斯]
Jakub Kicinski
maintainerQuoted 10 lines · On Tue, 31 Jan 2023 09:06:22 +0000 Lee Jones wrote:
Please don't do that. The commits do not have proper Acked-by tags.
The plan is to merge these via MFD and send out a pull-request to an immutable branch. However, if you're prepared to convert all of the:
Acked-for-MFD-by Lee Jones <[email protected]>to
Acked-by Lee Jones <[email protected]>
Sorry, I must have been blind yesterday because I definitely double checked this doesn't touch mfd code. And it does :/
The patches should not be sent for net-next if they are not supposed to be applied directly. Or at the very least says something about merging in the cover letter!
Quoted 4 lines
... and send out a pull request to a succinct (only these patches) and immutable branch then that is also an acceptable solution.
Please let me know what works best for you.
Sorry for messing up again. Stable branch would obviously had been best. Do we have to take action now, or can we just wait for the trees to converge during the merge window?
Colin Foster
maintainerQuoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 31 Jan 2023 09:06:22 +0000 Lee Jones wrote:
Please don't do that. The commits do not have proper Acked-by tags.
The plan is to merge these via MFD and send out a pull-request to an immutable branch. However, if you're prepared to convert all of the:
Acked-for-MFD-by Lee Jones <[email protected]>to
Quoted 8 lines
Quoted 1 line
Acked-by Lee Jones <[email protected]>Sorry, I must have been blind yesterday because I definitely double checked this doesn't touch mfd code. And it does :/
The patches should not be sent for net-next if they are not supposed to be applied directly. Or at the very least says something about merging in the cover letter!
My apologies. I wasn't sure how these cross-tree syncs would be done (and I recognize Lee even asked during a previous submission.) I'll be more verbose in cover letters moving forward, should I ever be submitting against multiple trees like this.
Lee Jones
maintainerQuoted 19 lines · Jakub Kicinski
Quoted 10 lines · On Tue, 31 Jan 2023 09:06:22 +0000 Lee Jones wrote:
Please don't do that. The commits do not have proper Acked-by tags.
The plan is to merge these via MFD and send out a pull-request to an immutable branch. However, if you're prepared to convert all of the:
Acked-for-MFD-by Lee Jones <[email protected]>to
Acked-by Lee Jones <[email protected]>Sorry, I must have been blind yesterday because I definitely double checked this doesn't touch mfd code. And it does :/
The patches should not be sent for net-next if they are not supposed to be applied directly. Or at the very least says something about merging in the cover letter!
Quoted 8 lines
Quoted 4 lines
... and send out a pull request to a succinct (only these patches) and immutable branch then that is also an acceptable solution.
Please let me know what works best for you.
Sorry for messing up again. Stable branch would obviously had been best. Do we have to take action now, or can we just wait for the trees to converge during the merge window?
Russell explained to me (off-list) that the net-next branch is immutable and the only way to fix this would be to revert the whole set.
Let's not go to that much trouble this time.
It does mean that I cannot take any more commits on the affected files, but that shouldn't be a big deal seeing how far into the release cycle we are.
No real harm done.
Signature · 1 line
Lee Jones [李琼斯]