Commit 77a31246 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'lan966x-driver'



Horatiu Vultur says:

====================
net: lan966x: Add lan966x switch driver

This patch series add support for Microchip lan966x driver

The lan966x switch is a multi-port Gigabit AVB/TSN Ethernet Switch with
two integrated 10/100/1000Base-T PHYs. In addition to the integrated PHYs,
it supports up to 2RGMII/RMII, up to 3BASE-X/SERDES/2.5GBASE-X and up to
2 Quad-SGMII/Quad-USGMII interfaces.

Initially it adds support only for the ports to behave as simple
NIC cards. In the future patches it would be extended with other
functionality like Switchdev, PTP, Frame DMA, VCAP, etc.

v4->v5:
- more fixes to the reset of the switch, require all resources before
  activating the hardware
- fix to lan966x-switch binding
- implement get/set_pauseparam in ethtool_ops
- stop calling lan966x_port_link_down when calling lan966x_port_pcs_set and
  call it in lan966x_phylink_mac_link_down

v3->v4:
- add timeouts when injecting/extracting frames, in case the HW breaks
- simplify the creation of the IFH
- fix the order of operations in lan966x_cleanup_ports
- fixes to phylink based on Russel review

v2->v3:
- fix compiling issues for x86
- fix resource management in first patch

v1->v2:
- add new patch for MAINTAINERS
- add functions lan966x_mac_cpu_learn/forget
- fix build issues with second patch
- fix the reset of the switch, return error if there is no reset controller
- start to use phylink_mii_c22_pcs_decode_state and
  phylink_mii_c22_pcs_encode_advertisement to remove duplicate code
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 35aefaad 813f38bf
Loading
Loading
Loading
Loading
+158 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/microchip,lan966x-switch.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Microchip Lan966x Ethernet switch controller

maintainers:
  - Horatiu Vultur <horatiu.vultur@microchip.com>

description: |
  The lan966x switch is a multi-port Gigabit AVB/TSN Ethernet Switch with
  two integrated 10/100/1000Base-T PHYs. In addition to the integrated PHYs,
  it supports up to 2RGMII/RMII, up to 3BASE-X/SERDES/2.5GBASE-X and up to
  2 Quad-SGMII/Quad-USGMII interfaces.

properties:
  $nodename:
    pattern: "^switch@[0-9a-f]+$"

  compatible:
    const: microchip,lan966x-switch

  reg:
    items:
      - description: cpu target
      - description: general control block target

  reg-names:
    items:
      - const: cpu
      - const: gcb

  interrupts:
    minItems: 1
    items:
      - description: register based extraction
      - description: frame dma based extraction

  interrupt-names:
    minItems: 1
    items:
      - const: xtr
      - const: fdma

  resets:
    items:
      - description: Reset controller used for switch core reset (soft reset)
      - description: Reset controller used for releasing the phy from reset

  reset-names:
    items:
      - const: switch
      - const: phy

  ethernet-ports:
    type: object
    patternProperties:
      "^port@[0-9a-f]+$":
        type: object

        allOf:
          - $ref: "http://devicetree.org/schemas/net/ethernet-controller.yaml#"

        properties:
          '#address-cells':
            const: 1
          '#size-cells':
            const: 0

          reg:
            description:
              Switch port number

          phys:
            description:
              Phandle of a Ethernet SerDes PHY

          phy-mode:
            description:
              This specifies the interface used by the Ethernet SerDes towards
              the PHY or SFP.
            enum:
              - gmii
              - sgmii
              - qsgmii
              - 1000base-x
              - 2500base-x

          phy-handle:
            description:
              Phandle of a Ethernet PHY.

          sfp:
            description:
              Phandle of an SFP.

          managed: true

        required:
          - reg
          - phys
          - phy-mode

        oneOf:
          - required:
              - phy-handle
          - required:
              - sfp
              - managed

required:
  - compatible
  - reg
  - reg-names
  - interrupts
  - interrupt-names
  - resets
  - reset-names
  - ethernet-ports

additionalProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    switch: switch@e0000000 {
      compatible = "microchip,lan966x-switch";
      reg =  <0xe0000000 0x0100000>,
             <0xe2000000 0x0800000>;
      reg-names = "cpu", "gcb";
      interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
      interrupt-names = "xtr";
      resets = <&switch_reset 0>, <&phy_reset 0>;
      reset-names = "switch", "phy";
      ethernet-ports {
        #address-cells = <1>;
        #size-cells = <0>;

        port0: port@0 {
          reg = <0>;
          phy-handle = <&phy0>;
          phys = <&serdes 0 0>;
          phy-mode = "gmii";
        };

        port1: port@1 {
          reg = <1>;
          sfp = <&sfp_eth1>;
          managed = "in-band-status";
          phys = <&serdes 2 4>;
          phy-mode = "sgmii";
        };
      };
    };

...
+7 −0
Original line number Diff line number Diff line
@@ -12524,6 +12524,13 @@ L: netdev@vger.kernel.org
S:	Maintained
F:	drivers/net/ethernet/microchip/lan743x_*
MICROCHIP LAN966X ETHERNET DRIVER
M:	Horatiu Vultur <horatiu.vultur@microchip.com>
M:	UNGLinuxDriver@microchip.com
L:	netdev@vger.kernel.org
S:	Maintained
F:	drivers/net/ethernet/microchip/lan966x/*
MICROCHIP LCDFB DRIVER
M:	Nicolas Ferre <nicolas.ferre@microchip.com>
L:	linux-fbdev@vger.kernel.org
+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ config LAN743X
	  To compile this driver as a module, choose M here. The module will be
	  called lan743x.

source "drivers/net/ethernet/microchip/lan966x/Kconfig"
source "drivers/net/ethernet/microchip/sparx5/Kconfig"

endif # NET_VENDOR_MICROCHIP
+1 −0
Original line number Diff line number Diff line
@@ -9,4 +9,5 @@ obj-$(CONFIG_LAN743X) += lan743x.o

lan743x-objs := lan743x_main.o lan743x_ethtool.o lan743x_ptp.o

obj-$(CONFIG_LAN966X_SWITCH) += lan966x/
obj-$(CONFIG_SPARX5_SWITCH) += sparx5/
+7 −0
Original line number Diff line number Diff line
config LAN966X_SWITCH
	tristate "Lan966x switch driver"
	depends on HAS_IOMEM
	depends on OF
	select PHYLINK
	help
	  This driver supports the Lan966x network switch device.
Loading