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.
*** Notes on V4
The patch set is growing long. My apologies. There isn't much that can
reasonably be broken out. Perhaps these could be standalone:
net: dsa: felix: add functionality when not all ports are supported
dt-bindings: mfd: ocelot: remove spi-max-frequency from required
properties
And I'm not certain if these two patches should be combined, as they are
co-dependent:
dt-bindings: mfd: ocelot: add ethernet-switch hardware support
dt-bindings: net: dsa: ocelot: add ocelot-ext documentation
The only warning I know about is about the reg array being too long:
/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.example.dtb: soc@0: ethernet-switch@0:reg: [[1895890944, 65536], [1896022016, 65536], [1896349696, 256], [1896742912, 65536], [1897791488, 256], [1897857024, 256], [1897922560, 256], [1897988096, 256], [1898053632, 256], [1898119168, 256], [1898184704, 256], [1898250240, 256], [1898315776, 256], [1898381312, 256], [1898446848, 256], [1904214016, 524288], [1904738304, 65536], [1896087552, 65536], [1896153088, 65536], [1896218624, 65536]] is too long
Also I know there is still ongoing discussion regarding what the documentation
should reflect. I hope I'm not getting ahead of myself by submitting this
RFC at this time.
***
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 (17):
net: mscc: ocelot: expose ocelot wm functions
net: mscc: ocelot: expose regfield definition to be used by other
drivers
net: mscc: ocelot: expose stats layout 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: populate mac_capabilities for all ports
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
mfd: ocelot: add shared resource names for switch functionality
dt-bindings: mfd: ocelot: remove spi-max-frequency from required
properties
dt-bindings: mfd: ocelot: add ethernet-switch hardware support
dt-bindings: net: dsa: ocelot: add ocelot-ext documentation
net: dsa: ocelot: add external ocelot switch control
mfd: ocelot: add external ocelot switch control
.../devicetree/bindings/mfd/mscc,ocelot.yaml | 9 +-
.../bindings/net/dsa/mscc,ocelot.yaml | 112 ++++++++++
MAINTAINERS | 1 +
drivers/mfd/ocelot-core.c | 68 +++++-
drivers/net/dsa/ocelot/Kconfig | 19 ++
drivers/net/dsa/ocelot/Makefile | 5 +
drivers/net/dsa/ocelot/felix.c | 28 ++-
drivers/net/dsa/ocelot/felix.h | 2 +
drivers/net/dsa/ocelot/felix_vsc9959.c | 1 +
drivers/net/dsa/ocelot/ocelot_ext.c | 178 ++++++++++++++++
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 | 196 +-----------------
drivers/net/ethernet/mscc/vsc7514_regs.c | 122 +++++++++++
include/linux/mfd/ocelot.h | 9 +
include/soc/mscc/ocelot.h | 6 +
include/soc/mscc/vsc7514_regs.h | 8 +
18 files changed, 640 insertions(+), 204 deletions(-)
create mode 100644 drivers/net/dsa/ocelot/ocelot_ext.c
--
2.25.1
The *_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.
Signed-off-by: Colin Foster <[email protected]>
---
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(-)
diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c
index 1816d52c65c5..013e83173062 100644
--- a/drivers/mfd/ocelot-core.c
+++ b/drivers/mfd/ocelot-core.c
@@ -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
--
2.25.1
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.
Add support for MFD configurations by performing this request from the
parent device.
Signed-off-by: Colin Foster <[email protected]>
---
v4
* New patch
---
drivers/net/dsa/ocelot/felix.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 1d938675bd3a..fb0a0f7e42ac 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1325,6 +1325,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;
--
2.25.1
On Sat, Oct 08, 2022 at 11:51:35AM -0700, Colin Foster wrote:
> The only warning I know about is about the reg array being too long:
> /Documentation/devicetree/bindings/net/dsa/mscc,ocelot.example.dtb: soc@0: ethernet-switch@0:reg: [[1895890944, 65536], [1896022016, 65536], [1896349696, 256], [1896742912, 65536], [1897791488, 256], [1897857024, 256], [1897922560, 256], [1897988096, 256], [1898053632, 256], [1898119168, 256], [1898184704, 256], [1898250240, 256], [1898315776, 256], [1898381312, 256], [1898446848, 256], [1904214016, 524288], [1904738304, 65536], [1896087552, 65536], [1896153088, 65536], [1896218624, 65536]] is too long
>
> Also I know there is still ongoing discussion regarding what the documentation
> should reflect. I hope I'm not getting ahead of myself by submitting this
> RFC at this time.
This is because 'reg' is longer than the schema was told it would be.
net/dsa/mscc,ocelot.yaml defines 'reg' with maxItems: 1, whereas
net/mscc,vsc7514-switch.yaml lists out all targets.
At this stage I wonder whether it wouldn't be better for you to patch up
net/mscc,vsc7514-switch.yaml with support for your compatible string and
reference dsa.yaml, rather than net/dsa/mscc,ocelot.yaml which should
perhaps be rebranded to make it clear it only applies to NXP
integrations of Microchip switches.
I also expressed something along these lines yesterday
https://lore.kernel.org/netdev/20221007231009.qgcirfezgib5vu6y@skbuf/
and I'd wait for a little bit more, to give Krzysztof a chance to
respond and share his thoughts.
On Sat, 08 Oct 2022, Colin Foster wrote:
> The *_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.
>
> Signed-off-by: Colin Foster <[email protected]>
> ---
>
> 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(-)
I'm guessing some of the other patches depend on this?
How should it be handled?
For my own reference (apply this as-is to your sign-off block):
Acked-for-MFD-by: Lee Jones <[email protected]>
--
Lee Jones [李琼斯]