Commit 6a8ab436 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'add-support-for-the-the-vsc7512-internal-copper-phys'

Colin Foster says:

====================
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.
====================

Link: https://lore.kernel.org/r/20230127193559.1001051-1-colin.foster@in-advantage.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 3c1dc221 8dccdd27
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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
+90 −23
Original line number Diff line number Diff line
@@ -18,13 +18,52 @@ description: |
  packets using CPU. Additionally, PTP is supported as well as FDMA for faster
  packet extraction/injection.

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,vsc7514-switch
          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:
    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";
          };
        };
      };

...
+1 −0
Original line number Diff line number Diff line
@@ -15155,6 +15155,7 @@ M: Colin Foster <colin.foster@in-advantage.com>
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
+64 −4
Original line number Diff line number Diff line
@@ -34,16 +34,49 @@

#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_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,
	},
};

+20 −0
Original line number Diff line number Diff line
@@ -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
Loading