Hirschmann Hellcreek DSA driver
Subsystems (5)
Kurt Kanzenbach
maintainerv4 cover Hirschmann Hellcreek DSA driver
Hi,
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/[email protected]/
* https://lkml.kernel.org/netdev/[email protected]/
* https://lkml.kernel.org/netdev/[email protected]/
* https://lkml.kernel.org/netdev/[email protected]/
Due to the changes with the compatible strings and platform data patch 2 and 7 should be re-reviewed.
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
Kamil Alkhouri (2):
net: dsa: hellcreek: Add PTP clock support
net: dsa: hellcreek: Add support for hardware timestamping
Kurt Kanzenbach (5):
net: dsa: Add tag handling for Hirschmann Hellcreek switches
net: dsa: Add DSA driver for Hirschmann Hellcreek switches
net: dsa: hellcreek: Add PTP status LEDs
dt-bindings: Add vendor prefix for Hirschmann
dt-bindings: net: dsa: Add documentation for Hellcreek switches
.../bindings/net/dsa/hellcreek.yaml | 127 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + drivers/net/dsa/Kconfig | 2 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/hirschmann/Kconfig | 9 + drivers/net/dsa/hirschmann/Makefile | 5 + drivers/net/dsa/hirschmann/hellcreek.c | 1262 +++++++++++++++++ drivers/net/dsa/hirschmann/hellcreek.h | 282 ++++ .../net/dsa/hirschmann/hellcreek_hwtstamp.c | 479 +++++++ .../net/dsa/hirschmann/hellcreek_hwtstamp.h | 58 + drivers/net/dsa/hirschmann/hellcreek_ptp.c | 452 ++++++ drivers/net/dsa/hirschmann/hellcreek_ptp.h | 76 + .../platform_data/hirschmann-hellcreek.h | 22 + include/net/dsa.h | 2 + net/dsa/Kconfig | 6 + net/dsa/Makefile | 1 + net/dsa/tag_hellcreek.c | 101 ++ 17 files changed, 2887 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.yaml create mode 100644 drivers/net/dsa/hirschmann/Kconfig create mode 100644 drivers/net/dsa/hirschmann/Makefile create mode 100644 drivers/net/dsa/hirschmann/hellcreek.c create mode 100644 drivers/net/dsa/hirschmann/hellcreek.h create mode 100644 drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c create mode 100644 drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h create mode 100644 drivers/net/dsa/hirschmann/hellcreek_ptp.c create mode 100644 drivers/net/dsa/hirschmann/hellcreek_ptp.h create mode 100644 include/linux/platform_data/hirschmann-hellcreek.h create mode 100644 net/dsa/tag_hellcreek.c
Signature · 1 line
2.20.1
Kurt Kanzenbach
maintainerPATCH v4 1/7 net: dsa: Add tag handling for Hirschmann Hellcreek switches
The Hirschmann Hellcreek TSN switches have a special tagging protocol for frames exchanged between the CPU port and the master interface. The format is a one byte trailer indicating the destination or origin port.
It's quite similar to the Micrel KSZ tagging. That's why the implementation is based on that code.
--- include/net/dsa.h | 2 + net/dsa/Kconfig | 6 +++ net/dsa/Makefile | 1 + net/dsa/tag_hellcreek.c | 101 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 net/dsa/tag_hellcreek.c
include/net/dsa.h +2 -0
@@ -45,6 +45,7 @@ struct phylink_link_state;#define DSA_TAG_PROTO_OCELOT_VALUE 15#define DSA_TAG_PROTO_AR9331_VALUE 16#define DSA_TAG_PROTO_RTL4_A_VALUE 17 +#define DSA_TAG_PROTO_HELLCREEK_VALUE 18enum dsa_tag_protocol {DSA_TAG_PROTO_NONE =DSA_TAG_PROTO_NONE_VALUE ,
@@ -65,6 +66,7 @@ enum dsa_tag_protocol {DSA_TAG_PROTO_OCELOT =DSA_TAG_PROTO_OCELOT_VALUE ,DSA_TAG_PROTO_AR9331 =DSA_TAG_PROTO_AR9331_VALUE ,DSA_TAG_PROTO_RTL4_A =DSA_TAG_PROTO_RTL4_A_VALUE , + DSA_TAG_PROTO_HELLCREEK = DSA_TAG_PROTO_HELLCREEK_VALUE, };struct packet_type ;
net/dsa/Kconfig +6 -0
@@ -56,6 +56,12 @@ config NET_DSA_TAG_BRCM_PREPEND Broadcom switches which places the tag before the Ethernet header (prepended). +config NET_DSA_TAG_HELLCREEK + tristate "Tag driver for Hirschmann Hellcreek TSN switches" + help + Say Y or M if you want to enable support for tagging frames + for the Hirschmann Hellcreek TSN switches. + config NET_DSA_TAG_GSWIP tristate "Tag driver for Lantiq / Intel GSWIP switches" help
net/dsa/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_NET_DSA_TAG_BRCM_COMMON) += tag_brcm.o obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o obj-$(CONFIG_NET_DSA_TAG_GSWIP) += tag_gswip.o +obj-$(CONFIG_NET_DSA_TAG_HELLCREEK) += tag_hellcreek.o obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o obj-$(CONFIG_NET_DSA_TAG_RTL4_A) += tag_rtl4_a.o obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
net/dsa/tag_hellcreek.c new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
2.20.1
Kurt Kanzenbach
maintainerPATCH v4 2/7 net: dsa: Add DSA driver for Hirschmann Hellcreek switches
In reply to Kurt KanzenbachAdd a basic DSA driver for Hirschmann Hellcreek switches. Those switches are implementing features needed for Time Sensitive Networking (TSN) such as support for the Time Precision Protocol and various shapers like the Time Aware Shaper.
This driver includes basic support for networking:
* VLAN handling
* FDB handling
* Port statistics
* STP
* Phylink
--- drivers/net/dsa/Kconfig | 2 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/hirschmann/Kconfig | 8 + drivers/net/dsa/hirschmann/Makefile | 2 + drivers/net/dsa/hirschmann/hellcreek.c | 1176 +++++++++++++++++ drivers/net/dsa/hirschmann/hellcreek.h | 245 ++++ .../platform_data/hirschmann-hellcreek.h | 22 + 7 files changed, 1456 insertions(+) create mode 100644 drivers/net/dsa/hirschmann/Kconfig create mode 100644 drivers/net/dsa/hirschmann/Makefile create mode 100644 drivers/net/dsa/hirschmann/hellcreek.c create mode 100644 drivers/net/dsa/hirschmann/hellcreek.h create mode 100644 include/linux/platform_data/hirschmann-hellcreek.h
drivers/net/dsa/Kconfig +2 -0
@@ -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
drivers/net/dsa/Makefile +1 -0
@@ -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/
drivers/net/dsa/hirschmann/Kconfig new file +8 -0
@@ -0,0 +1,8 @@ +# 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 + select NET_DSA_TAG_HELLCREEK + help + This driver adds support for Hirschmann Hellcreek TSN switches.
drivers/net/dsa/hirschmann/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK) += hellcreek.o
drivers/net/dsa/hirschmann/hellcreek.c new file +1176 -0
1,176 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek.h new file +245 -0
245 lines not on this page · raw message
include/linux/platform_data/hirschmann-hellcreek.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: (GPL-2.0 or MIT) */ +/* +* Hirschmann Hellcreek TSN switch platform data. +* +* Copyright (C) 2020 Linutronix GmbH +* Author Kurt Kanzenbach <[email protected]> +*/ + +#ifndef _HIRSCHMANN_HELLCREEK_H_ +#define _HIRSCHMANN_HELLCREEK_H_ + +#include <linux/types.h> + +struct hellcreek_platform_data { +int num_ports; +int is_100_mbits; +int qbv_support; +int qbv_on_cpu; +u16 module_id; +}; + +#endif /* _HIRSCHMANN_HELLCREEK_H_ */
Signature · 1 line
2.20.1
Vladimir Oltean
maintainerRe: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
Hi Kurt,
Quoted 263 lines · Kurt Kanzenbach
Add a basic DSA driver for Hirschmann Hellcreek switches. Those switches are implementing features needed for Time Sensitive Networking (TSN) such as support for the Time Precision Protocol and various shapers like the Time Aware Shaper.
This driver includes basic support for networking:
* VLAN handling
* FDB handling
* Port statistics
* STP
* PhylinkSigned-off-by Kurt Kanzenbach <[email protected]>--- drivers/net/dsa/Kconfig | 2 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/hirschmann/Kconfig | 8 + drivers/net/dsa/hirschmann/Makefile | 2 + drivers/net/dsa/hirschmann/hellcreek.c | 1176 +++++++++++++++++ drivers/net/dsa/hirschmann/hellcreek.h | 245 ++++ .../platform_data/hirschmann-hellcreek.h | 22 + 7 files changed, 1456 insertions(+) create mode 100644 drivers/net/dsa/hirschmann/Kconfig create mode 100644 drivers/net/dsa/hirschmann/Makefile create mode 100644 drivers/net/dsa/hirschmann/hellcreek.c create mode 100644 drivers/net/dsa/hirschmann/hellcreek.h create mode 100644 include/linux/platform_data/hirschmann-hellcreek.hdrivers/net/dsa/hirschmann/hellcreek.h new file +229
-0@@ -0,0 +1,245 @@ +/* SPDX-License-Identifier: (GPL-2.0 or MIT) */ +/* +* DSA driver for: +* Hirschmann Hellcreek TSN switch. +* +* Copyright (C) 2019,2020 Linutronix GmbH +* Author Kurt Kanzenbach <[email protected]> +*/ + +#ifndef _HELLCREEK_H_ +#define _HELLCREEK_H_ + +#include <linux/bitops.h> +#include <linux/kernel.h> +#include <linux/device.h> +#include <linux/ptp_clock_kernel.h> +#include <linux/timecounter.h> +#include <linux/mutex.h> +#include <linux/platform_data/hirschmann-hellcreek.h> +#include <net/dsa.h> + +/* Ports: + * - 0: CPU + * - 1: Tunnel + * - 2: TSN front port 1 + * - 3: TSN front port 2 + * - ... + */ +#define CPU_PORT 0 +#define TUNNEL_PORT 1 + +#define HELLCREEK_VLAN_NO_MEMBER 0x0 +#define HELLCREEK_VLAN_UNTAGGED_MEMBER 0x1 +#define HELLCREEK_VLAN_TAGGED_MEMBER 0x3 +#define HELLCREEK_NUM_EGRESS_QUEUES 8 + +/* Register definitions */ +#define HR_MODID_C (0 * 2) +#define HR_REL_L_C (1 * 2) +#define HR_REL_H_C (2 * 2) +#define HR_BLD_L_C (3 * 2) +#define HR_BLD_H_C (4 * 2) +#define HR_CTRL_C (5 * 2) +#define HR_CTRL_C_READY BIT(14) +#define HR_CTRL_C_TRANSITION BIT(13) +#define HR_CTRL_C_ENABLE BIT(0) + +#define HR_PSEL (0xa6 * 2) +#define HR_PSEL_PTWSEL_SHIFT 4 +#define HR_PSEL_PTWSEL_MASK GENMASK(5, 4) +#define HR_PSEL_PRTCWSEL_SHIFT 0 +#define HR_PSEL_PRTCWSEL_MASK GENMASK(2, 0) + +#define HR_PTCFG (0xa7 * 2) +#define HR_PTCFG_MLIMIT_EN BIT(13) +#define HR_PTCFG_UMC_FLT BIT(10) +#define HR_PTCFG_UUC_FLT BIT(9) +#define HR_PTCFG_UNTRUST BIT(8) +#define HR_PTCFG_TAG_REQUIRED BIT(7) +#define HR_PTCFG_PPRIO_SHIFT 4 +#define HR_PTCFG_PPRIO_MASK GENMASK(6, 4) +#define HR_PTCFG_INGRESSFLT BIT(3) +#define HR_PTCFG_BLOCKED BIT(2) +#define HR_PTCFG_LEARNING_EN BIT(1) +#define HR_PTCFG_ADMIN_EN BIT(0) + +#define HR_PRTCCFG (0xa8 * 2) +#define HR_PRTCCFG_PCP_TC_MAP_SHIFT 0 +#define HR_PRTCCFG_PCP_TC_MAP_MASK GENMASK(2, 0) + +#define HR_CSEL (0x8d * 2) +#define HR_CSEL_SHIFT 0 +#define HR_CSEL_MASK GENMASK(7, 0) +#define HR_CRDL (0x8e * 2) +#define HR_CRDH (0x8f * 2) + +#define HR_SWTRC_CFG (0x90 * 2) +#define HR_SWTRC0 (0x91 * 2) +#define HR_SWTRC1 (0x92 * 2) +#define HR_PFREE (0x93 * 2) +#define HR_MFREE (0x94 * 2) + +#define HR_FDBAGE (0x97 * 2) +#define HR_FDBMAX (0x98 * 2) +#define HR_FDBRDL (0x99 * 2) +#define HR_FDBRDM (0x9a * 2) +#define HR_FDBRDH (0x9b * 2) + +#define HR_FDBMDRD (0x9c * 2) +#define HR_FDBMDRD_PORTMASK_SHIFT 0 +#define HR_FDBMDRD_PORTMASK_MASK GENMASK(3, 0) +#define HR_FDBMDRD_AGE_SHIFT 4 +#define HR_FDBMDRD_AGE_MASK GENMASK(7, 4) +#define HR_FDBMDRD_OBT BIT(8) +#define HR_FDBMDRD_PASS_BLOCKED BIT(9) +#define HR_FDBMDRD_STATIC BIT(11) +#define HR_FDBMDRD_REPRIO_TC_SHIFT 12 +#define HR_FDBMDRD_REPRIO_TC_MASK GENMASK(14, 12) +#define HR_FDBMDRD_REPRIO_EN BIT(15) + +#define HR_FDBWDL (0x9d * 2) +#define HR_FDBWDM (0x9e * 2) +#define HR_FDBWDH (0x9f * 2) +#define HR_FDBWRM0 (0xa0 * 2) +#define HR_FDBWRM0_PORTMASK_SHIFT 0 +#define HR_FDBWRM0_PORTMASK_MASK GENMASK(3, 0) +#define HR_FDBWRM0_OBT BIT(8) +#define HR_FDBWRM0_PASS_BLOCKED BIT(9) +#define HR_FDBWRM0_REPRIO_TC_SHIFT 12 +#define HR_FDBWRM0_REPRIO_TC_MASK GENMASK(14, 12) +#define HR_FDBWRM0_REPRIO_EN BIT(15) +#define HR_FDBWRM1 (0xa1 * 2) + +#define HR_FDBWRCMD (0xa2 * 2) +#define HR_FDBWRCMD_FDBDEL BIT(9) + +#define HR_SWCFG (0xa3 * 2) +#define HR_SWCFG_GM_STATEMD BIT(15) +#define HR_SWCFG_LAS_MODE_SHIFT 12 +#define HR_SWCFG_LAS_MODE_MASK GENMASK(13, 12) +#define HR_SWCFG_LAS_OFF (0x00) +#define HR_SWCFG_LAS_ON (0x01) +#define HR_SWCFG_LAS_STATIC (0x10) +#define HR_SWCFG_CT_EN BIT(11) +#define HR_SWCFG_LAN_UNAWARE BIT(10) +#define HR_SWCFG_ALWAYS_OBT BIT(9) +#define HR_SWCFG_FDBAGE_EN BIT(5) +#define HR_SWCFG_FDBLRN_EN BIT(4) + +#define HR_SWSTAT (0xa4 * 2) +#define HR_SWSTAT_FAIL BIT(4) +#define HR_SWSTAT_BUSY BIT(0) + +#define HR_SWCMD (0xa5 * 2) +#define HW_SWCMD_FLUSH BIT(0) + +#define HR_VIDCFG (0xaa * 2) +#define HR_VIDCFG_VID_SHIFT 0 +#define HR_VIDCFG_VID_MASK GENMASK(11, 0) +#define HR_VIDCFG_PVID BIT(12) + +#define HR_VIDMBRCFG (0xab * 2) +#define HR_VIDMBRCFG_P0MBR_SHIFT 0 +#define HR_VIDMBRCFG_P0MBR_MASK GENMASK(1, 0) +#define HR_VIDMBRCFG_P1MBR_SHIFT 2 +#define HR_VIDMBRCFG_P1MBR_MASK GENMASK(3, 2) +#define HR_VIDMBRCFG_P2MBR_SHIFT 4 +#define HR_VIDMBRCFG_P2MBR_MASK GENMASK(5, 4) +#define HR_VIDMBRCFG_P3MBR_SHIFT 6 +#define HR_VIDMBRCFG_P3MBR_MASK GENMASK(7, 6) + +#define HR_FEABITS0 (0xac * 2) +#define HR_FEABITS0_FDBBINS_SHIFT 4 +#define HR_FEABITS0_FDBBINS_MASK GENMASK(7, 4) +#define HR_FEABITS0_PCNT_SHIFT 8 +#define HR_FEABITS0_PCNT_MASK GENMASK(11, 8) +#define HR_FEABITS0_MCNT_SHIFT 12 +#define HR_FEABITS0_MCNT_MASK GENMASK(15, 12) + +#define TR_QTRACK (0xb1 * 2) +#define TR_TGDVER (0xb3 * 2) +#define TR_TGDVER_REV_MIN_MASK GENMASK(7, 0) +#define TR_TGDVER_REV_MIN_SHIFT 0 +#define TR_TGDVER_REV_MAJ_MASK GENMASK(15, 8) +#define TR_TGDVER_REV_MAJ_SHIFT 8 +#define TR_TGDSEL (0xb4 * 2) +#define TR_TGDSEL_TDGSEL_MASK GENMASK(1, 0) +#define TR_TGDSEL_TDGSEL_SHIFT 0 +#define TR_TGDCTRL (0xb5 * 2) +#define TR_TGDCTRL_GATE_EN BIT(0) +#define TR_TGDCTRL_CYC_SNAP BIT(4) +#define TR_TGDCTRL_SNAP_EST BIT(5) +#define TR_TGDCTRL_ADMINGATESTATES_MASK GENMASK(15, 8) +#define TR_TGDCTRL_ADMINGATESTATES_SHIFT 8 +#define TR_TGDSTAT0 (0xb6 * 2) +#define TR_TGDSTAT1 (0xb7 * 2) +#define TR_ESTWRL (0xb8 * 2) +#define TR_ESTWRH (0xb9 * 2) +#define TR_ESTCMD (0xba * 2) +#define TR_ESTCMD_ESTSEC_MASK GENMASK(2, 0) +#define TR_ESTCMD_ESTSEC_SHIFT 0 +#define TR_ESTCMD_ESTARM BIT(4) +#define TR_ESTCMD_ESTSWCFG BIT(5) +#define TR_EETWRL (0xbb * 2) +#define TR_EETWRH (0xbc * 2) +#define TR_EETCMD (0xbd * 2) +#define TR_EETCMD_EETSEC_MASK GEMASK(2, 0) +#define TR_EETCMD_EETSEC_SHIFT 0 +#define TR_EETCMD_EETARM BIT(4) +#define TR_CTWRL (0xbe * 2) +#define TR_CTWRH (0xbf * 2) +#define TR_LCNSL (0xc1 * 2) +#define TR_LCNSH (0xc2 * 2) +#define TR_LCS (0xc3 * 2) +#define TR_GCLDAT (0xc4 * 2) +#define TR_GCLDAT_GCLWRGATES_MASK GENMASK(7, 0) +#define TR_GCLDAT_GCLWRGATES_SHIFT 0 +#define TR_GCLDAT_GCLWRLAST BIT(8) +#define TR_GCLDAT_GCLOVRI BIT(9) +#define TR_GCLTIL (0xc5 * 2) +#define TR_GCLTIH (0xc6 * 2) +#define TR_GCLCMD (0xc7 * 2) +#define TR_GCLCMD_GCLWRADR_MASK GENMASK(7, 0) +#define TR_GCLCMD_GCLWRADR_SHIFT 0 +#define TR_GCLCMD_INIT_GATE_STATES_MASK GENMASK(15, 8) +#define TR_GCLCMD_INIT_GATE_STATES_SHIFT 8 + +struct hellcreek_counter { + u8 offset; + const char *name; +}; + +struct hellcreek; + +struct hellcreek_port { + struct hellcreek *hellcreek; + int port; + u16 ptcfg; /* ptcfg shadow */ + u64 *counter_values; +}; + +struct hellcreek_fdb_entry { + size_t idx; + unsigned char mac[6]; + u8 portmask; + u8 age; + u8 is_obt; + u8 pass_blocked; + u8 is_static;
drivers/net/dsa/hirschmann/hellcreek.h line 239
Quoted 10 lines
drivers/net/dsa/hirschmann/hellcreek.h new file +10
-0+u8 reprio_tc; +u8 reprio_en; +}; + +struct hellcreek { +const struct hellcreek_platform_data *pdata; +struct device *dev; +struct dsa_switch *ds; +struct hellcreek_port *ports; +struct mutex reg_lock;/* Switch IP register lock */
Pardon me asking, but I went back through the previous review comments and I didn't see this being asked.
What is the register lock protecting against, exactly?
Quoted 9 lines
drivers/net/dsa/hirschmann/hellcreek.h new file +6
-0+void __iomem *base; +u8 *vidmbrcfg;/* vidmbrcfg shadow */ + size_t fdb_entries; +}; + +#endif /* _HELLCREEK_H_ */ Signature · 1 line
2.20.1
Thanks,
-Vladimir
Kurt Kanzenbach
maintainerRe: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
Hi Vladimir,
Quoted 3 lines · Vladimir Oltean
Hi Kurt,
On Tue, Sep 01, 2020 at 02:50:09PM +0200, Kurt Kanzenbach wrote:
[snip]
Quoted 9 lines
drivers/net/dsa/hirschmann/hellcreek.h line 239
Quoted 6 lines
drivers/net/dsa/hirschmann/hellcreek.h new file +6
-0+struct hellcreek { +const struct hellcreek_platform_data *pdata; +struct device *dev; +struct dsa_switch *ds; +struct hellcreek_port *ports; +struct mutex reg_lock;/* Switch IP register lock */ Pardon me asking, but I went back through the previous review comments and I didn't see this being asked.
It was asked multiple times, why there was a spinlock without interrupts being registered (see e.g. [1], [2]). I've used the spinlock variant, because the previously used hrtimers act like interrupts. As there are no timers anymore, there's no need for spinlocks and mutexes can be used.
Florian Fainelli also asked if the reg lock can be removed completely. See below.
Quoted 2 lines
What is the register lock protecting against, exactly?
A lot of the register operations work by:
* Select port, priority, vlan or counter
* Configure it
These sequences have to be atomic. That's what I wanted to ensure.
Thanks,
Kurt
[1] - https://lkml.kernel.org/netdev/[email protected]/
[2] - https://lkml.kernel.org/netdev/20200624130318.GD7247@localhost/
Vladimir Oltean
maintainerRe: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
Quoted 17 lines · Kurt Kanzenbach
Hi Vladimir,
Quoted 3 lines · Vladimir Oltean
Hi Kurt,
On Tue, Sep 01, 2020 at 02:50:09PM +0200, Kurt Kanzenbach wrote:
[snip]
Quoted 9 lines
drivers/net/dsa/hirschmann/hellcreek.h line 239
Quoted 6 lines
drivers/net/dsa/hirschmann/hellcreek.h new file +6
-0+struct hellcreek { +const struct hellcreek_platform_data *pdata; +struct device *dev; +struct dsa_switch *ds; +struct hellcreek_port *ports; +struct mutex reg_lock;/* Switch IP register lock */ Pardon me asking, but I went back through the previous review comments and I didn't see this being asked.
Quoted 6 lines
It was asked multiple times, why there was a spinlock without interrupts being registered (see e.g. [1], [2]). I've used the spinlock variant, because the previously used hrtimers act like interrupts. As there are no timers anymore, there's no need for spinlocks and mutexes can be used.
That, yes, I remember, but not why the reg_lock exists in the first place.
Quoted 3 lines
Florian Fainelli also asked if the reg lock can be removed completely. See below.
Missed your answer on that.
Quoted 10 lines
Quoted 2 lines
What is the register lock protecting against, exactly?
A lot of the register operations work by:
* Select port, priority, vlan or counter
* Configure itThese sequences have to be atomic. That's what I wanted to ensure.
So, let me rephrase. Is there any code path that is broken, even if only theoretically, if you remove the reg_lock?
Quoted 5 lines
Thanks,
Kurt[1] - https://lkml.kernel.org/netdev/[email protected]/
[2] - https://lkml.kernel.org/netdev/20200624130318.GD7247@localhost/
Thanks,
-Vladimir
Andrew Lunn
maintainerRe: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
What is the register lock protecting against, exactly?
A lot of the register operations work by:
Quoted 8 lines
Quoted 5 lines
* Select port, priority, vlan or counter
* Configure itThese sequences have to be atomic. That's what I wanted to ensure.
So, let me rephrase. Is there any code path that is broken, even if only theoretically, if you remove the
reg_lock?
Maybe, at the moment, RTNL is keeping things atomic. But that is because there is no HWMON, or MDIO bus. Those sort of operations don't take the RTNL, and so would be an issue. I've also never audited the network stack to check RTNL really is held at all the network stack entry points to a DSA driver. It would be an interesting excesses to scatter some ASSERT_RTNL() in a DSA driver and see what happens.
Andrew
Re: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
Quoted 6 lines · Andrew Lunn
Maybe, at the moment, RTNL is keeping things atomic. But that is because there is no HWMON, or MDIO bus. Those sort of operations don't take the RTNL, and so would be an issue. I've also never audited the network stack to check RTNL really is held at all the network stack entry points to a DSA driver. It would be an interesting excesses to scatter some
ASSERT_RTNL()in a DSA driver and see what happens.
Device drivers really aught to protect their state and their devices' state from concurrent access.
Thanks,
Richard
David Miller
maintainerRe: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
From: Richard Cochran <[email protected]>
Date: Tue, 1 Sep 2020 09:36:10 -0700
Quoted 10 lines · Andrew Lunn
Quoted 6 lines
Maybe, at the moment, RTNL is keeping things atomic. But that is because there is no HWMON, or MDIO bus. Those sort of operations don't take the RTNL, and so would be an issue. I've also never audited the network stack to check RTNL really is held at all the network stack entry points to a DSA driver. It would be an interesting excesses to scatter some
ASSERT_RTNL()in a DSA driver and see what happens.Device drivers really aught to protect their state and their devices' state from concurrent access.
Completely agreed.
Kurt Kanzenbach
maintainerRe: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
Quoted 11 lines · David Miller
From: Richard Cochran <[email protected]>
Date: Tue, 1 Sep 2020 09:36:10 -0700Quoted 8 lines · Andrew Lunn
Quoted 6 lines
Maybe, at the moment, RTNL is keeping things atomic. But that is because there is no HWMON, or MDIO bus. Those sort of operations don't take the RTNL, and so would be an issue. I've also never audited the network stack to check RTNL really is held at all the network stack entry points to a DSA driver. It would be an interesting excesses to scatter some
ASSERT_RTNL()in a DSA driver and see what happens.
Quoted 4 lines
Quoted 2 lines
Device drivers really aught to protect their state and their devices' state from concurrent access.
Completely agreed.
OK. So I'll keep the locking as is.
Since I have to have to prepare another version due to the compiler warnings, I'll wait a bit for more comments and send the next version after.
Thanks,
Kurt
kernel test robot
build botRe: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches
In reply to Kurt KanzenbachThank you for the patch! Perhaps something to improve:
Hi Kurt,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on net-next/master net/master linus/master v5.9-rc3 next-20200828] [cannot apply to sparc-next/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Kurt-Kanzenbach/Hirschmann-Hellcreek-DSA-driver/20200901-205620 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/net/dsa/hirschmann/hellcreek.c:1147:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
1147 | const static struct hellcreek_platform_data de1soc_r1_pdata = {
| ^~~~~# https://github.com/0day-ci/linux/commit/a0634aaa91ab02823fa311b9cf33e3872207bb60
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kurt-Kanzenbach/Hirschmann-Hellcreek-DSA-driver/20200901-205620 git checkout a0634aaa91ab02823fa311b9cf33e3872207bb60
vim +/static +1147 drivers/net/dsa/hirschmann/hellcreek.c
1146
> 1147 const static struct hellcreek_platform_data de1soc_r1_pdata = { 1148 .num_ports = 4,
1149 .is_100_mbits = 1,
1150 .qbv_support = 1,
1151 .qbv_on_cpu = 1,
1152 .module_id = 0x4c30,
1153 };
1154
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Kurt Kanzenbach
maintainerPATCH v4 3/7 net: dsa: hellcreek: Add PTP clock support
In reply to Kurt KanzenbachFrom: Kamil Alkhouri <[email protected]>
The switch has internal PTP hardware clocks. Add support for it. There are three clocks:
* Synchronized
* Syntonized
* Free running
Currently the synchronized clock is exported to user space which is a good default for the beginning. The free running clock might be exported later e.g. for implementing 802.1AS-2011/2020 Time Aware Bridges (TAB). The switch also supports cross time stamping for that purpose.
The implementation adds support setting/getting the time as well as offset and frequency adjustments. However, the clock only holds a partial timeofday timestamp. This is why we track the seconds completely in software (see overflow work and last_ts).
Furthermore, add the PTP multicast addresses into the FDB to forward that packages only to the CPU port where they are processed by a PTP program.
--- drivers/net/dsa/hirschmann/Kconfig | 1 + drivers/net/dsa/hirschmann/Makefile | 4 +- drivers/net/dsa/hirschmann/hellcreek.c | 71 ++++++ drivers/net/dsa/hirschmann/hellcreek.h | 8 + drivers/net/dsa/hirschmann/hellcreek_ptp.c | 283 +++++++++++++++++++++ drivers/net/dsa/hirschmann/hellcreek_ptp.h | 69 +++++ 6 files changed, 435 insertions(+), 1 deletion(-) create mode 100644 drivers/net/dsa/hirschmann/hellcreek_ptp.c create mode 100644 drivers/net/dsa/hirschmann/hellcreek_ptp.h
drivers/net/dsa/hirschmann/Kconfig +1 -0
@@ -3,6 +3,7 @@ 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.
drivers/net/dsa/hirschmann/Makefile +3 -1
@@ -1,2 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK) += hellcreek.o +obj-$(CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK) += hellcreek_sw.o +hellcreek_sw-objs := hellcreek.o +hellcreek_sw-objs += hellcreek_ptp.o
drivers/net/dsa/hirschmann/hellcreek.c +71 -0
116 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek.h +8 -0
@@ -16,6 +16,7 @@#include <linux/ptp_clock_kernel.h> #include <linux/timecounter.h> #include <linux/mutex.h> +#include <linux/workqueue.h> #include <linux/platform_data/hirschmann-hellcreek.h> #include <net/dsa.h>
@@ -235,10 +236,17 @@ struct hellcreek {const struct hellcreek_platform_data *pdata;struct device *dev;struct dsa_switch *ds; +struct ptp_clock *ptp_clock; +struct ptp_clock_info ptp_clock_info;struct hellcreek_port *ports; +struct delayed_work overflow_work;struct mutex reg_lock;/* Switch IP register lock */ +struct mutex ptp_lock;/* PTP IP register lock */ void __iomem *base; +void __iomem *ptp_base;u8 *vidmbrcfg;/* vidmbrcfg shadow */ +u64 seconds;/* PTP seconds */ +u64 last_ts;/* Used for overflow detection */ size_t fdb_entries; };
drivers/net/dsa/hirschmann/hellcreek_ptp.c new file +283 -0
283 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek_ptp.h new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
2.20.1
Kurt Kanzenbach
maintainerPATCH v4 4/7 net: dsa: hellcreek: Add support for hardware timestamping
In reply to Kurt KanzenbachFrom: Kamil Alkhouri <[email protected]>
The switch has the ability to take hardware generated time stamps per port for PTPv2 event messages in Rx and Tx direction. That is useful for achieving needed time synchronization precision for TSN devices/switches. So add support for it.
There are two directions:
* RX
The switch has a single register per port to capture a timestamp. That mechanism is not used due to correlation problems. If the software processing is too slow and a PTPv2 event message is received before the previous one has been processed, false timestamps will be captured. Therefore, the switch can do "inline" timestamping which means it can insert the nanoseconds part of the timestamp directly into the PTPv2 event message. The reserved field (4 bytes) is leveraged for that. This might not be in accordance with (older) PTP standards, but is the only way to get reliable results.
* TX
In Tx direction there is no correlation problem, because the software and the driver has to ensure that only one event message is "on the fly". However, the switch provides also a mechanism to check whether a timestamp is lost. That can only happen when a timestamp is read and at this point another message is timestamped. So, that lost bit is checked just in case to indicate to the user that the driver or the software is somewhat buggy.
--- drivers/net/dsa/hirschmann/Makefile | 1 + drivers/net/dsa/hirschmann/hellcreek.c | 15 + drivers/net/dsa/hirschmann/hellcreek.h | 25 + .../net/dsa/hirschmann/hellcreek_hwtstamp.c | 479 ++++++++++++++++++ .../net/dsa/hirschmann/hellcreek_hwtstamp.h | 58 +++ drivers/net/dsa/hirschmann/hellcreek_ptp.c | 48 +- drivers/net/dsa/hirschmann/hellcreek_ptp.h | 4 + 7 files changed, 616 insertions(+), 14 deletions(-) create mode 100644 drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c create mode 100644 drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h
drivers/net/dsa/hirschmann/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK) += hellcreek_sw.o hellcreek_sw-objs := hellcreek.o hellcreek_sw-objs += hellcreek_ptp.o +hellcreek_sw-objs += hellcreek_hwtstamp.o
drivers/net/dsa/hirschmann/hellcreek.c +15 -0
@@ -25,6 +25,7 @@#include "hellcreek.h" #include "hellcreek_ptp.h" +#include "hellcreek_hwtstamp.h" static const struct hellcreek_counter hellcreek_counter[] = { {0x00 ,"RxFiltered" , },
@@ -1087,6 +1088,11 @@ static const struct dsa_switch_ops hellcreek_ds_ops = { .port_bridge_leave = hellcreek_port_bridge_leave, .port_stp_state_set = hellcreek_port_stp_state_set, .phylink_validate = hellcreek_phylink_validate, + .port_hwtstamp_set = hellcreek_port_hwtstamp_set, + .port_hwtstamp_get = hellcreek_port_hwtstamp_get, + .port_txtstamp = hellcreek_port_txtstamp, + .port_rxtstamp = hellcreek_port_rxtstamp, + .get_ts_info = hellcreek_get_ts_info, };static int hellcreek_probe (struct platform_device *pdev)
@@ -1194,10 +1200,18 @@ static int hellcreek_probe(struct platform_device *pdev) goto err_ptp_setup; } + ret =hellcreek_hwtstamp_setup (hellcreek); +if (ret) { +dev_err (dev,"Failed to setup hardware timestamping!\n" ); + goto err_tstamp_setup; + } +platform_set_drvdata (pdev, hellcreek);return 0 ; +err_tstamp_setup: +hellcreek_ptp_free (hellcreek); err_ptp_setup:dsa_unregister_switch (hellcreek->ds);
@@ -1208,6 +1222,7 @@ static int hellcreek_remove(struct platform_device *pdev) {struct hellcreek *hellcreek =platform_get_drvdata (pdev); +hellcreek_hwtstamp_free (hellcreek);hellcreek_ptp_free (hellcreek);dsa_unregister_switch (hellcreek->ds);platform_set_drvdata (pdev,NULL );
drivers/net/dsa/hirschmann/hellcreek.h +25 -0
@@ -213,11 +213,36 @@ struct hellcreek_counter {struct hellcreek ; +/* State flags for hellcreek_port_hwtstamp::state */ +enum { +HELLCREEK_HWTSTAMP_ENABLED , +HELLCREEK_HWTSTAMP_TX_IN_PROGRESS , +}; + +/* A structure to hold hardware timestamping information per port */ +struct hellcreek_port_hwtstamp { +/* Timestamping state */ +unsigned long state; + +/* Resources for receive timestamping */ +struct sk_buff_head rx_queue;/* For synchronization messages */ + +/* Resources for transmit timestamping */ +unsigned long tx_tstamp_start; +struct sk_buff *tx_skb; + +/* Current timestamp configuration */ +struct hwtstamp_config tstamp_config; +}; +struct hellcreek_port {struct hellcreek *hellcreek;int port;u16 ptcfg;/* ptcfg shadow */ u64 *counter_values; + +/* Per-port timestamping resources */ +struct hellcreek_port_hwtstamp port_hwtstamp; };struct hellcreek_fdb_entry {
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c new file +479 -0
479 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.h new file +58 -0
58 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek_ptp.c +34 -14
71 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek_ptp.h +4 -0
@@ -59,6 +59,10 @@int hellcreek_ptp_setup (struct hellcreek *hellcreek);void hellcreek_ptp_free (struct hellcreek *hellcreek); +u16 hellcreek_ptp_read (struct hellcreek *hellcreek,unsigned int offset); +void hellcreek_ptp_write (struct hellcreek *hellcreek,u16 data, +unsigned int offset); +u64 hellcreek_ptp_gettime_seconds (struct hellcreek *hellcreek,u64 ns);#define ptp_to_hellcreek (ptp) \ container_of(ptp, struct hellcreek, ptp_clock_info)
Signature · 1 line
2.20.1
Kurt Kanzenbach
maintainerPATCH v4 5/7 net: dsa: hellcreek: Add PTP status LEDs
In reply to Kurt KanzenbachThe switch has two controllable I/Os which are usually connected to LEDs. This is useful to immediately visually see the PTP status.
These provide two signals:
* is_gm
This LED can be activated if the current device is the grand master in that PTP domain.
* sync_good
This LED can be activated if the current device is in sync with the network time.
Expose these via the LED framework to be controlled via user space e.g. linuxptp.
--- drivers/net/dsa/hirschmann/hellcreek.h | 4 + drivers/net/dsa/hirschmann/hellcreek_ptp.c | 149 +++++++++++++++++++++ drivers/net/dsa/hirschmann/hellcreek_ptp.h | 3 + 3 files changed, 156 insertions(+)
drivers/net/dsa/hirschmann/hellcreek.h +4 -0
@@ -17,6 +17,7 @@#include <linux/timecounter.h> #include <linux/mutex.h> #include <linux/workqueue.h> +#include <linux/leds.h> #include <linux/platform_data/hirschmann-hellcreek.h> #include <net/dsa.h>
@@ -265,6 +266,8 @@ struct hellcreek {struct ptp_clock_info ptp_clock_info;struct hellcreek_port *ports;struct delayed_work overflow_work; +struct led_classdev led_is_gm; +struct led_classdev led_sync_good;struct mutex reg_lock;/* Switch IP register lock */ struct mutex ptp_lock;/* PTP IP register lock */ void __iomem *base;
@@ -272,6 +275,7 @@ struct hellcreek {u8 *vidmbrcfg;/* vidmbrcfg shadow */ u64 seconds;/* PTP seconds */ u64 last_ts;/* Used for overflow detection */ +u16 status_out;/* ptp.status_out shadow */ size_t fdb_entries; };
drivers/net/dsa/hirschmann/hellcreek_ptp.c +149 -0
170 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek_ptp.h +3 -0
@@ -70,4 +70,7 @@ u64 hellcreek_ptp_gettime_seconds(struct hellcreek *hellcreek, u64 ns);#define dw_overflow_to_hellcreek (dw) \ container_of(dw, struct hellcreek, overflow_work) +#define led_to_hellcreek (ldev, led) \ + container_of(ldev, struct hellcreek, led) +#endif /* _HELLCREEK_PTP_H_ */
Signature · 1 line
2.20.1
Re: [PATCH v4 5/7] net: dsa: hellcreek: Add PTP status LEDs
Quoted 12 lines · Kurt Kanzenbach
The switch has two controllable I/Os which are usually connected to LEDs. This is useful to immediately visually see the PTP status.
These provide two signals:
*
is_gmThis LED can be activated if the current device is the grand master in that PTP domain.
*
sync_good
Quoted 8 lines
This LED can be activated if the current device is in sync with the network time.
Expose these via the LED framework to be controlled via user space e.g. linuxptp.
Signed-off-by Kurt Kanzenbach <[email protected]>Reviewed-by Andrew Lunn <[email protected]>
There appears to be quite some boilerplate code to deal with the default trigger, default LED label that could presumably live in the LED subsystem, nonetheless:
Signature · 1 line
Florian
Kurt Kanzenbach
maintainerPATCH v4 6/7 dt-bindings: Add vendor prefix for Hirschmann
In reply to Kurt KanzenbachHirschmann is building devices for automation and networking. Add them to the vendor prefixes.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -433,6 +433,8 @@ patternProperties: description: HiDeep Inc. "^himax,.*": description: Himax Technologies, Inc. + "^hirschmann,.*": + description: Hirschmann Automation and Control GmbH "^hisilicon,.*": description: Hisilicon Limited. "^hit,.*":
Signature · 1 line
2.20.1
Kurt Kanzenbach
maintainerPATCH v4 7/7 dt-bindings: net: dsa: Add documentation for Hellcreek switches
In reply to Kurt KanzenbachAdd basic documentation and example.
--- .../bindings/net/dsa/hellcreek.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.yaml
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +127 -0
@@ -0,0 +1,127 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/dsa/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 <[email protected]> + - Florian Fainelli <[email protected]> + - Vivien Didelot <[email protected]> + - Kurt Kanzenbach <[email protected]> + +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"; + }; + }; + };
Signature · 1 line
2.20.1
Re: [PATCH v4 7/7] dt-bindings: net: dsa: Add documentation for Hellcreek switches
Quoted 8 lines · Kurt Kanzenbach
Add basic documentation and example.
Signed-off-by Kurt Kanzenbach <[email protected]>--- .../bindings/net/dsa/hellcreek.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.yaml
Re: [PATCH v4 7/7] dt-bindings: net: dsa: Add documentation for Hellcreek switches
In reply to Kurt KanzenbachQuoted 3 lines · Kurt Kanzenbach
Add basic documentation and example.
Signed-off-by Kurt Kanzenbach <[email protected]>
Signature · 1 line
Florian