Commit 67438feb authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'hirschmann-hellcreek-dsa-driver'

Kurt Kanzenbach says:

====================
Hirschmann Hellcreek DSA driver

this series adds a DSA driver for the Hirschmann Hellcreek TSN switch
IP. Characteristics of that IP:

 * Full duplex Ethernet interface at 100/1000 Mbps on three ports
 * IEEE 802.1Q-compliant Ethernet Switch
 * IEEE 802.1Qbv Time-Aware scheduling support
 * IEEE 1588 and IEEE 802.1AS support

That IP is used e.g. in

 https://www.arrow.com/en/campaigns/arrow-kairos

Due to the hardware setup the switch driver is implemented using DSA. A special
tagging protocol is leveraged. Furthermore, this driver supports PTP and
hardware timestamping.

This work is part of the AccessTSN project: https://www.accesstsn.com/

The previous versions can be found here:

 * https://lkml.kernel.org/netdev/20200618064029.32168-1-kurt@linutronix.de/
 * https://lkml.kernel.org/netdev/20200710113611.3398-1-kurt@linutronix.de/
 * https://lkml.kernel.org/netdev/20200723081714.16005-1-kurt@linutronix.de/
 * https://lkml.kernel.org/netdev/20200820081118.10105-1-kurt@linutronix.de/
 * https://lkml.kernel.org/netdev/20200901125014.17801-1-kurt@linutronix.de/
 * https://lkml.kernel.org/netdev/20200904062739.3540-1-kurt@linutronix.de/
 * https://lkml.kernel.org/netdev/20201004112911.25085-1-kurt@linutronix.de/
 * https://lkml.kernel.org/netdev/20201028074221.29326-1-kurt@linutronix.de/

Changes since v7:

 * Simplify tagging code (rebase to net-next)
 * Pass info instead of ptr (Florian Fainelli)
 * Fix yamllint warnings (Rob Herring)

Changes since v6:

 * Add .tail_tag = true (Vladimir Oltean)
 * Fix vlan_filtering=0 bridges (Vladimir Oltean)
 * Enforce restrictions (Vladimir Oltean)
 * Sort stuff alphabetically (Vladimir Oltean)
 * Rename hellcreek.yaml to hirschmann,hellcreek.yaml
 * Typo fixes

Changes since v5:

 * Implement configure_vlan_while_not_filtering behavior (Vladimir Oltean)
 * Minor cleanups

Changes since v4:

 * Fix W=1 compiler warnings (kernel test robot)
 * Add tags

Changes since v3:

 * Drop TAPRIO support (David Miller)
   => Switch to mutexes due to the lack of hrtimers
 * Use more specific compatible strings and add platform data (Andrew Lunn)
 * Fix Kconfig ordering (Andrew Lunn)

Changes since v2:

 * Make it compile by getting all requirements merged first (Jakub Kicinski, David Miller)
 * Use "tsn" for TSN register set (Rob Herring)
 * Fix DT binding issues (Rob Herring)

Changes since v1:

 * Code simplifications (Florian Fainelli, Vladimir Oltean)
 * Fix issues with hellcreek.yaml bindings (Florian Fainelli)
 * Clear reserved field in ptp v2 event messages (Richard Cochran)
 * Make use of generic ptp parsing function (Richard Cochran, Vladimir Oltean)
 * Fix Kconfig (Florian Fainelli)
 * Add tags (Florian Fainelli, Rob Herring, Richard Cochran)

Changes since RFC ordered by reviewers:

 * Andrew Lunn
   * Use dev_dbg for debug messages
   * Get rid of __ function names where possible
   * Use reverse xmas tree variable ordering
   * Remove redundant/useless checks
   * Improve comments e.g. for PTP
   * Fix Kconfig ordering
   * Make LED handling more generic and provide info via DT
   * Setup advertisement of PHYs according to hardware
   * Drop debugfs patch
 * Jakub Kicinski
   * Fix compiler warnings
 * Florian Fainelli
   * Switch to YAML DT bindings
 * Richard Cochran
   * Fix typo
   * Add missing NULL checks
====================

Link: https://lore.kernel.org/r/20201103071101.3222-1-kurt@linutronix.de


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 94f44f28 d5d29d52
Loading
Loading
Loading
Loading
+127 −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/dsa/hirschmann,hellcreek.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Hirschmann Hellcreek TSN Switch Device Tree Bindings

allOf:
  - $ref: dsa.yaml#

maintainers:
  - Andrew Lunn <andrew@lunn.ch>
  - Florian Fainelli <f.fainelli@gmail.com>
  - Vivien Didelot <vivien.didelot@gmail.com>
  - Kurt Kanzenbach <kurt@linutronix.de>

description:
  The Hellcreek TSN Switch IP is a 802.1Q Ethernet compliant switch. It supports
  the Precision Time Protocol, Hardware Timestamping as well the Time Aware
  Shaper.

properties:
  compatible:
    items:
      - const: hirschmann,hellcreek-de1soc-r1

  reg:
    description:
      The physical base address and size of TSN and PTP memory base
    minItems: 2
    maxItems: 2

  reg-names:
    items:
      - const: tsn
      - const: ptp

  leds:
    type: object
    properties:
      '#address-cells':
        const: 1
      '#size-cells':
        const: 0

    patternProperties:
      "^led@[01]$":
        type: object
        description: Hellcreek leds
        $ref: ../../leds/common.yaml#

        properties:
          reg:
            items:
              - enum: [0, 1]
            description: Led number

          label: true

          default-state: true

        required:
          - reg

        additionalProperties: false

    additionalProperties: false

required:
  - compatible
  - reg
  - reg-names
  - ethernet-ports
  - leds

unevaluatedProperties: false

examples:
  - |
        switch0: switch@ff240000 {
            compatible = "hirschmann,hellcreek-de1soc-r1";
            reg = <0xff240000 0x1000>,
                  <0xff250000 0x1000>;
            reg-names = "tsn", "ptp";
            dsa,member = <0 0>;

            ethernet-ports {
                #address-cells = <1>;
                #size-cells = <0>;

                port@0 {
                    reg = <0>;
                    label = "cpu";
                    ethernet = <&gmac0>;
                };

                port@2 {
                    reg = <2>;
                    label = "lan0";
                    phy-handle = <&phy1>;
                };

                port@3 {
                    reg = <3>;
                    label = "lan1";
                    phy-handle = <&phy2>;
                };
            };

            leds {
                #address-cells = <1>;
                #size-cells = <0>;

                led@0 {
                    reg = <0>;
                    label = "sync_good";
                    default-state = "on";
                };

                led@1 {
                    reg = <1>;
                    label = "is_gm";
                    default-state = "off";
                };
            };
        };
+2 −0
Original line number Diff line number Diff line
@@ -441,6 +441,8 @@ patternProperties:
    description: HiDeep Inc.
  "^himax,.*":
    description: Himax Technologies, Inc.
  "^hirschmann,.*":
    description: Hirschmann Automation and Control GmbH
  "^hisilicon,.*":
    description: Hisilicon Limited.
  "^hit,.*":
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ config NET_DSA_LOOP
	  This enables support for a fake mock-up switch chip which
	  exercises the DSA APIs.

source "drivers/net/dsa/hirschmann/Kconfig"

config NET_DSA_LANTIQ_GSWIP
	tristate "Lantiq / Intel GSWIP"
	depends on HAS_IOMEM && NET_DSA
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX) += vitesse-vsc73xx-core.o
obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM) += vitesse-vsc73xx-platform.o
obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_SPI) += vitesse-vsc73xx-spi.o
obj-y				+= b53/
obj-y				+= hirschmann/
obj-y				+= microchip/
obj-y				+= mv88e6xxx/
obj-y				+= ocelot/
+9 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
config NET_DSA_HIRSCHMANN_HELLCREEK
	tristate "Hirschmann Hellcreek TSN Switch support"
	depends on HAS_IOMEM
	depends on NET_DSA
	depends on PTP_1588_CLOCK
	select NET_DSA_TAG_HELLCREEK
	help
	  This driver adds support for Hirschmann Hellcreek TSN switches.
Loading