prepare ocelot for external interface control
Subsystems (4)
v5 cover prepare ocelot for external interface control
This patch set is derived from an attempt to include external control for a VSC751[1234] chip via SPI. That patch set has grown large and is getting unwieldy for reviewers and the developers... me.
I'm breaking out the changes from that patch set. Some are trivial
net: dsa: ocelot: remove unnecessary pci_bar variables
net: dsa: ocelot: felix: Remove requirement for PCS in felix devices
some are required for SPI
net: dsa: ocelot: felix: add interface for custom regmaps
and some are just to expose code to be shared
net: mscc: ocelot: split register definitions to a separate file
The entirety of this patch set should have essentially no impact on the system performance.
v1 -> v2
* Removed the per-device-per-port quirks for Felix. Might be completely unnecessary.
* Fixed the renaming issue for vec7514_regs. It includes the Reported-by kernel test robot by way of git b4... If that isn't the right thing to do in this instance, let me know :-)
v2 -> v3
* Fix an include. Thanks Jakub Kicinski!
v3 -> v4
* Add reviewed by tags
v4 -> v5
* Remove patch 5/5, which added unused symbols
Colin Foster (4):
net: dsa: ocelot: remove unnecessary pci_bar variables
net: dsa: ocelot: felix: Remove requirement for PCS in felix devices
net: dsa: ocelot: felix: add interface for custom regmaps
net: mscc: ocelot: split register definitions to a separate file
drivers/net/dsa/ocelot/felix.c | 6 +- drivers/net/dsa/ocelot/felix.h | 4 +- drivers/net/dsa/ocelot/felix_vsc9959.c | 11 +- drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + drivers/net/ethernet/mscc/Makefile | 3 +- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 520 +------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 523 +++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 27 ++ 8 files changed, 574 insertions(+), 521 deletions(-) create mode 100644 drivers/net/ethernet/mscc/vsc7514_regs.c create mode 100644 include/soc/mscc/vsc7514_regs.h
Signature · 1 line
2.25.1
PATCH v5 1/4 net: dsa: ocelot: remove unnecessary pci_bar variables
The pci_bar variables for the switch and imdio don't make sense for the generic felix driver. Moving them to felix_vsc9959 to limit scope and simplify the felix_info struct.
--- drivers/net/dsa/ocelot/felix.h | 2 -- drivers/net/dsa/ocelot/felix_vsc9959.c | 10 ++++------ 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/net/dsa/ocelot/felix.h +0 -2
@@ -25,8 +25,6 @@ struct felix_info {u16 vcap_pol_max;u16 vcap_pol_base2;u16 vcap_pol_max2; -int switch_pci_bar; -int imdio_pci_bar;const struct ptp_clock_info *ptp_caps;/* Some Ocelot switches are integrated into the SoC without the
drivers/net/dsa/ocelot/felix_vsc9959.c +4 -6
@@ -21,6 +21,8 @@#define VSC9959_TAS_GCL_ENTRY_MAX 63#define VSC9959_VCAP_POLICER_BASE 63#define VSC9959_VCAP_POLICER_MAX 383 +#define VSC9959_SWITCH_PCI_BAR 4 +#define VSC9959_IMDIO_PCI_BAR 0static const u32 vsc9959_ana_regmap[] = {REG (ANA_ADVLEARN ,0x0089a0 ),
@@ -2230,8 +2232,6 @@ static const struct felix_info felix_info_vsc9959 = { .num_mact_rows = 2048, .num_ports = 6, .num_tx_queues = OCELOT_NUM_TC, - .switch_pci_bar = 4, - .imdio_pci_bar = 0, .quirk_no_xtr_irq = true, .ptp_caps = &vsc9959_ptp_caps, .mdio_bus_alloc = vsc9959_mdio_bus_alloc,
@@ -2290,10 +2290,8 @@ static int felix_pci_probe(struct pci_dev *pdev, ocelot->dev = &pdev->dev; ocelot->num_flooding_pgids =OCELOT_NUM_TC ; felix->info = &felix_info_vsc9959; - felix->switch_base =pci_resource_start (pdev, - felix->info->switch_pci_bar); - felix->imdio_base =pci_resource_start (pdev, - felix->info->imdio_pci_bar); + felix->switch_base =pci_resource_start (pdev,VSC9959_SWITCH_PCI_BAR ); + felix->imdio_base =pci_resource_start (pdev,VSC9959_IMDIO_PCI_BAR );pci_set_master (pdev);
Signature · 1 line
2.25.1
PATCH v5 2/4 net: dsa: ocelot: felix: Remove requirement for PCS in felix devices
In reply to Colin FosterExisting felix devices all have an initialized pcs array. Future devices might not, so running a NULL check on the array before dereferencing it will allow those future drivers to not crash at this point
--- drivers/net/dsa/ocelot/felix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/ocelot/felix.c +1 -1
@@ -828,7 +828,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port,struct felix *felix =ocelot_to_felix (ocelot);struct dsa_port *dp =dsa_to_port (ds, port); -if (felix->pcs[port]) +if (felix->pcs && felix->pcs[port])phylink_set_pcs (dp->pl, &felix->pcs[port]->pcs); }
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 2/4] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices
Quoted 6 lines · Colin Foster
Existing felix devices all have an initialized pcs array. Future devices might not, so running a NULL check on the array before dereferencing it will allow those future drivers to not crash at this point
Signed-off-by Colin Foster <[email protected]>Reviewed-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
PATCH v5 3/4 net: dsa: ocelot: felix: add interface for custom regmaps
In reply to Colin FosterAdd an interface so that non-mmio regmaps can be used
--- drivers/net/dsa/ocelot/felix.c | 4 ++-- drivers/net/dsa/ocelot/felix.h | 2 ++ drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/dsa/ocelot/felix.c +2 -2
@@ -1028,7 +1028,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) res.start += felix->switch_base; res.end += felix->switch_base; - target =ocelot_regmap_init (ocelot, &res); + target = felix->info->init_regmap (ocelot, &res);if (IS_ERR (target)) {dev_err (ocelot->dev,"Failed to map device memory space\n" );
@@ -1065,7 +1065,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) res.start += felix->switch_base; res.end += felix->switch_base; - target =ocelot_regmap_init (ocelot, &res); + target = felix->info->init_regmap (ocelot, &res);if (IS_ERR (target)) { dev_err(ocelot->dev, "Failed to map memory space for port %d\n",
drivers/net/dsa/ocelot/felix.h +2 -0
@@ -50,6 +50,8 @@ struct felix_info { enum tc_setup_type type, void *type_data);void (*port_sched_speed_set)(struct ocelot *ocelot,int port,u32 speed); +struct regmap *(*init_regmap)(struct ocelot *ocelot, +struct resource *res); };extern const struct dsa_switch_ops felix_switch_ops;
drivers/net/dsa/ocelot/felix_vsc9959.c +1 -0
@@ -2240,6 +2240,7 @@ static const struct felix_info felix_info_vsc9959 = { .prevalidate_phy_mode = vsc9959_prevalidate_phy_mode, .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, + .init_regmap = ocelot_regmap_init, };static irqreturn_t felix_irq_handler (int irq,void *data)
drivers/net/dsa/ocelot/seville_vsc9953.c +1 -0
@@ -1104,6 +1104,7 @@ static const struct felix_info seville_info_vsc9953 = { .mdio_bus_free = vsc9953_mdio_bus_free, .phylink_validate = vsc9953_phylink_validate, .prevalidate_phy_mode = vsc9953_prevalidate_phy_mode, + .init_regmap = ocelot_regmap_init, };static int seville_probe (struct platform_device *pdev)
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 3/4] net: dsa: ocelot: felix: add interface for custom regmaps
Quoted 4 lines · Colin Foster
Add an interface so that non-mmio regmaps can be used
Signed-off-by Colin Foster <[email protected]>Reviewed-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
PATCH v5 4/4 net: mscc: ocelot: split register definitions to a separate file
In reply to Colin FosterMove these to a separate file will allow them to be shared to other drivers.
--- drivers/net/ethernet/mscc/Makefile | 3 +- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 520 +------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 523 +++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 27 ++ 4 files changed, 563 insertions(+), 510 deletions(-) create mode 100644 drivers/net/ethernet/mscc/vsc7514_regs.c create mode 100644 include/soc/mscc/vsc7514_regs.h
drivers/net/ethernet/mscc/Makefile +2 -1
@@ -7,7 +7,8 @@ mscc_ocelot_switch_lib-y := \ ocelot_vcap.o \ ocelot_flower.o \ ocelot_ptp.o \ - ocelot_devlink.o + ocelot_devlink.o \ + vsc7514_regs.o mscc_ocelot_switch_lib-$(CONFIG_BRIDGE_MRP) += ocelot_mrp.o obj-$(CONFIG_MSCC_OCELOT_SWITCH) += mscc_ocelot.o mscc_ocelot-y := \
drivers/net/ethernet/mscc/ocelot_vsc7514.c +11 -509
538 lines not on this page · raw message
drivers/net/ethernet/mscc/vsc7514_regs.c new file +523 -0
523 lines not on this page · raw message
include/soc/mscc/vsc7514_regs.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ +/* +* Microsemi Ocelot Switch driver +* +* Copyright (c) 2021 Innovative Advantage Inc. +*/ + +#ifndef VSC7514_REGS_H +#define VSC7514_REGS_H + +extern const u32 vsc7514_ana_regmap[]; +extern const u32 vsc7514_qs_regmap[]; +extern const u32 vsc7514_qsys_regmap[]; +extern const u32 vsc7514_rew_regmap[]; +extern const u32 vsc7514_sys_regmap[]; +extern const u32 vsc7514_vcap_regmap[]; +extern const u32 vsc7514_ptp_regmap[]; +extern const u32 vsc7514_dev_gmii_regmap[]; + +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[]; +extern const struct vcap_field vsc7514_vcap_is1_actions[]; +extern const struct vcap_field vsc7514_vcap_is2_keys[]; +extern const struct vcap_field vsc7514_vcap_is2_actions[]; + +#endif
Signature · 1 line
2.25.1
Re: [PATCH v5 net-next 4/4] net: mscc: ocelot: split register definitions to a separate file
Quoted 5 lines · Colin Foster
Move these to a separate file will allow them to be shared to other drivers.
Signed-off-by Colin Foster <[email protected]>Reviewed-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
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 Tue, 7 Dec 2021 09:00:26 -0800 you wrote:
This patch set is derived from an attempt to include external control for a VSC751[1234] chip via SPI. That patch set has grown large and is getting unwieldy for reviewers and the developers... me.
I'm breaking out the changes from that patch set. Some are trivial
net: dsa: ocelot: remove unnecessarypci_barvariables
net: dsa: ocelot: felix: Remove requirement for PCS in felix devices[...]
Here is the summary with links:
- [v5,net-next,1/4] net: dsa: ocelot: remove unnecessary pci_bar variables
https://git.kernel.org/netdev/net-next/c/c99104840a95 - [v5,net-next,2/4] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices https://git.kernel.org/netdev/net-next/c/49af6a7620c5 - [v5,net-next,3/4] net: dsa: ocelot: felix: add interface for custom regmaps https://git.kernel.org/netdev/net-next/c/242bd0c10bbd - [v5,net-next,4/4] net: mscc: ocelot: split register definitions to a separate file https://git.kernel.org/netdev/net-next/c/32ecd22ba60b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html