Hirschmann Hellcreek DSA driver
Subsystems (5)
Kurt Kanzenbach
maintainerv2 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, hardware timestamping and TAPRIO offloading.
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]/
This series depends on:
* https://lkml.kernel.org/netdev/[email protected]/
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)
I didn't change the bridge/tagging setup, as I didn't find a better way to do it.
Kamil Alkhouri (2):
net: dsa: hellcreek: Add PTP clock support
net: dsa: hellcreek: Add support for hardware timestamping
Kurt Kanzenbach (6):
net: dsa: Add tag handling for Hirschmann Hellcreek switches
net: dsa: Add DSA driver for Hirschmann Hellcreek switches
net: dsa: hellcreek: Add TAPRIO offloading support
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 | 126 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + drivers/net/dsa/Kconfig | 2 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/hirschmann/Kconfig | 10 + drivers/net/dsa/hirschmann/Makefile | 5 + drivers/net/dsa/hirschmann/hellcreek.c | 1551 +++++++++++++++++ drivers/net/dsa/hirschmann/hellcreek.h | 301 ++++ .../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 + include/net/dsa.h | 2 + net/dsa/Kconfig | 6 + net/dsa/Makefile | 1 + net/dsa/tag_hellcreek.c | 101 ++ 16 files changed, 3173 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 net/dsa/tag_hellcreek.c
Signature · 1 line
2.20.1
Kurt Kanzenbach
maintainerPATCH v2 1/8 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 v2 2/8 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 | 1170 ++++++++++++++++++++++++ drivers/net/dsa/hirschmann/hellcreek.h | 244 +++++ 6 files changed, 1427 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
drivers/net/dsa/Kconfig +2 -0
@@ -58,6 +58,8 @@ source "drivers/net/dsa/qca/Kconfig" source "drivers/net/dsa/sja1105/Kconfig" +source "drivers/net/dsa/hirschmann/Kconfig" + config NET_DSA_QCA8K tristate "Qualcomm Atheros QCA8K Ethernet switch family support" depends on NET_DSA
drivers/net/dsa/Makefile +1 -0
@@ -23,3 +23,4 @@ obj-y += mv88e6xxx/ obj-y += ocelot/ obj-y += qca/ obj-y += sja1105/ +obj-y += hirschmann/
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 +1170 -0
1,170 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek.h new file +244 -0
244 lines not on this page · raw message
Signature · 1 line
2.20.1
Kurt Kanzenbach
maintainerPATCH v2 3/8 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 | 72 ++++++ drivers/net/dsa/hirschmann/hellcreek.h | 7 + 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 +72 -0
117 lines not on this page · raw message
drivers/net/dsa/hirschmann/hellcreek.h +7 -0
@@ -234,10 +234,17 @@ struct hellcreek_fdb_entry {struct hellcreek {struct device *dev;struct dsa_switch *ds; +struct ptp_clock *ptp_clock; +struct ptp_clock_info ptp_clock_info;struct hellcreek_port ports[4 ]; +struct delayed_work overflow_work;spinlock_t reg_lock;/* Switch IP register lock */ +spinlock_t 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 v2 4/8 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/Kconfig | 1 + 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 + 8 files changed, 617 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/Kconfig +1 -0
@@ -5,5 +5,6 @@ config NET_DSA_HIRSCHMANN_HELLCREEK depends on NET_DSA depends on PTP_1588_CLOCK select NET_DSA_TAG_HELLCREEK + select NET_PTP_CLASSIFY help This driver adds support for Hirschmann Hellcreek TSN switches.
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
@@ -26,6 +26,7 @@#include "hellcreek.h" #include "hellcreek_ptp.h" +#include "hellcreek_hwtstamp.h" static const struct hellcreek_counter hellcreek_counter[] = { {0x00 ,"RxFiltered" , },
@@ -1099,6 +1100,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)
@@ -1198,10 +1204,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);
@@ -1212,6 +1226,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
@@ -212,11 +212,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
kernel test robot
build botRe: [PATCH v2 4/8] net: dsa: hellcreek: Add support for hardware timestamping
Thank you for the patch! Yet something to improve:
Hi Kurt,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on next-20200723]
[cannot apply to robh/for-next sparc-next/master net/master linus/master v5.8-rc6] [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/20200723-161930 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 7fc3b978a8971305d456b32d3f2ac13191f5a0d7 config: ia64-allmodconfig (attached as .config) compiler: ia64-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=ia64
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c: In function 'hellcreek_should_tstamp':
>> drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:165:8: error: implicit declaration of function 'ptp_parse_header'; did you mean 'dev_parse_header'? [-Werror=implicit-function-declaration]
165 | hdr = ptp_parse_header(skb, type);
| ^~~~~~~~~~~~~~~~
| dev_parse_header
>> drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:165:6: warning: assignment to 'struct ptp_header *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
165 | hdr = ptp_parse_header(skb, type);
| ^
In file included from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/ia64/include/uapi/asm/byteorder.h:5,
from include/asm-generic/bitops/le.h:6,
from arch/ia64/include/asm/bitops.h:448,
from include/linux/bitops.h:29,
from include/linux/kernel.h:12,
from include/linux/skbuff.h:13,
from include/linux/ip.h:16,
from include/linux/ptp_classify.h:13,
from drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:12:
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c: In function 'hellcreek_get_reserved_field':
>> drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:177:24: error: dereferencing pointer to incomplete type 'const struct ptp_header'
177 | return be32_to_cpu(hdr->reserved2);
| ^~
include/uapi/linux/swab.h:118:32: note: in definition of macro '__swab32'
118 | (__builtin_constant_p((__u32)(x)) ? \
| ^
include/linux/byteorder/generic.h:95:21: note: in expansion of macro '__be32_to_cpu'
95 | #define be32_to_cpu __be32_to_cpu
| ^~~~~~~~~~~~~
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:177:9: note: in expansion of macro 'be32_to_cpu'
177 | return be32_to_cpu(hdr->reserved2);
| ^~~~~~~~~~~
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c: In function 'hellcreek_clear_reserved_field':
>> drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:182:5: error: dereferencing pointer to incomplete type 'struct ptp_header'
182 | hdr->reserved2 = 0;
| ^~
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c: In function 'hellcreek_get_rxts':
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:325:8: warning: assignment to 'struct ptp_header *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
325 | hdr = ptp_parse_header(skb, type);
| ^
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c: In function 'hellcreek_get_reserved_field':
>> drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:178:1: warning: control reaches end of non-void function [-Wreturn-type]
178 | }
| ^cc1: some warnings being treated as errors
vim +165 drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c
153
154 /* Returns a pointer to the PTP header if the caller should time stamp, or NULL
155 * if the caller should not.
156 */
157 static struct ptp_header *hellcreek_should_tstamp(struct hellcreek *hellcreek,
158 int port, struct sk_buff *skb,
159 unsigned int type)
160 {
161 struct hellcreek_port_hwtstamp *ps =
162 &hellcreek->ports[port].port_hwtstamp;
163 struct ptp_header *hdr;
164
> 165 hdr = ptp_parse_header(skb, type);
166 if (!hdr)
167 return NULL;
168
169 if (!test_bit(HELLCREEK_HWTSTAMP_ENABLED, &ps->state))
170 return NULL;
171
172 return hdr;
173 }
174
175 static u64 hellcreek_get_reserved_field(const struct ptp_header *hdr)
176 {
> 177 return be32_to_cpu(hdr->reserved2);
> 178 }
179
180 static void hellcreek_clear_reserved_field(struct ptp_header *hdr)
181 {
> 182 hdr->reserved2 = 0; 183 }
184
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Kurt Kanzenbach
maintainerPATCH v2 5/8 net: dsa: hellcreek: Add TAPRIO offloading support
In reply to Kurt KanzenbachThe switch has support for the 802.1Qbv Time Aware Shaper (TAS). Traffic schedules may be configured individually on each front port. Each port has eight egress queues. The traffic is mapped to a traffic class respectively via the PCP field of a VLAN tagged frame.
The TAPRIO Qdisc already implements that. Therefore, this interface can simply be reused. Add .port_setup_tc() accordingly.
The activation of a schedule on a port is split into two parts:
* Programming the necessary gate control list (GCL)
* Setup hrtimer for starting the schedule
The hardware supports starting a schedule up to eight seconds in the future. The TAPRIO interface provides an absolute base time. Therefore, hrtimers are leveraged.
--- drivers/net/dsa/hirschmann/hellcreek.c | 294 +++++++++++++++++++++++++ drivers/net/dsa/hirschmann/hellcreek.h | 21 ++ 2 files changed, 315 insertions(+)
drivers/net/dsa/hirschmann/hellcreek.c +294 -0
@@ -22,7 +22,9 @@#include <linux/spinlock.h> #include <linux/delay.h> #include <linux/ktime.h> +#include <linux/time.h> #include <net/dsa.h> +#include <net/pkt_sched.h> #include "hellcreek.h" #include "hellcreek_ptp.h"
@@ -153,6 +155,15 @@ static void hellcreek_select_vlan(struct hellcreek *hellcreek, int vid,hellcreek_write (hellcreek, val,HR_VIDCFG ); } +static void hellcreek_select_tgd (struct hellcreek *hellcreek,int port) +{ +u16 val =0 ; + + val |= port <<TR_TGDSEL_TDGSEL_SHIFT ; + +hellcreek_write (hellcreek, val,TR_TGDSEL ); +} +static int hellcreek_wait_until_ready (struct hellcreek *hellcreek) {u16 val;
@@ -958,6 +969,24 @@ static void __hellcreek_setup_tc_identity_mapping(struct hellcreek *hellcreek) } } +static void hellcreek_setup_tc_mapping (struct hellcreek *hellcreek, +struct net_device *netdev) +{ +int i, j; + +/* Setup mapping between traffic classes and port queues. */ +for (i =0 ; i <netdev_get_num_tc (netdev); ++i) { +for (j =0 ; j < netdev->tc_to_txq[i].count; ++j) { +const int queue = j + netdev->tc_to_txq[i].offset; + +hellcreek_select_prio (hellcreek, i); +hellcreek_write (hellcreek, + queue <<HR_PRTCCFG_PCP_TC_MAP_SHIFT , +HR_PRTCCFG ); + } + } +} +static void hellcreek_setup_tc_identity_mapping (struct hellcreek *hellcreek) {unsigned long flags;
@@ -1081,6 +1110,267 @@ static void hellcreek_phylink_validate(struct dsa_switch *ds, int port, __ETHTOOL_LINK_MODE_MASK_NBITS); } +static void hellcreek_setup_gcl (struct hellcreek *hellcreek,int port, +const struct hellcreek_schedule *schedule) +{ +size_t i; + +for (i =1 ; i <= schedule->num_entries; ++i) { +const struct hellcreek_gcl_entry *cur, *initial, *next; +u16 data; +u8 gates; + + cur = &schedule->entries[i -1 ]; + initial = &schedule->entries[0 ]; + next = &schedule->entries[i]; + +if (i == schedule->num_entries) + gates = initial->gate_states ^ + cur->gate_states; +else + gates = next->gate_states ^ + cur->gate_states; + + data = gates; +if (cur->overrun_ignore) + data |=TR_GCLDAT_GCLOVRI ; + +if (i == schedule->num_entries) + data |=TR_GCLDAT_GCLWRLAST ; + +/* Gates states */ +hellcreek_write (hellcreek, data,TR_GCLDAT ); + +/* Time intervall */ +hellcreek_write (hellcreek, + cur->interval &0x0000ffff , +TR_GCLTIL ); +hellcreek_write (hellcreek, + (cur->interval &0xffff0000 ) >>16 , +TR_GCLTIH ); + +/* Commit entry */ + data = ((i -1 ) <<TR_GCLCMD_GCLWRADR_SHIFT ) | + (initial->gate_states << +TR_GCLCMD_INIT_GATE_STATES_SHIFT ); +hellcreek_write (hellcreek, data,TR_GCLCMD ); + } +} + +static void hellcreek_set_cycle_time (struct hellcreek *hellcreek, +const struct hellcreek_schedule *schedule) +{ +u32 cycle_time = schedule->cycle_time; + +hellcreek_write (hellcreek, cycle_time &0x0000ffff ,TR_CTWRL ); +hellcreek_write (hellcreek, (cycle_time &0xffff0000 ) >>16 ,TR_CTWRH ); +} + +static void hellcreek_start_schedule (struct hellcreek *hellcreek, +ktime_t start_time) +{ +struct timespec64 ts =ktime_to_timespec64 (start_time); + +/* Start can be only 8 seconds in the future */ + ts.tv_sec %=8 ; + +/* Start schedule at this point of time */ +hellcreek_write (hellcreek, ts.tv_nsec &0x0000ffff ,TR_ESTWRL ); +hellcreek_write (hellcreek, (ts.tv_nsec &0xffff0000 ) >>16 ,TR_ESTWRH ); + +/* Arm timer, set seconds and switch schedule */ +hellcreek_write (hellcreek,TR_ESTCMD_ESTARM |TR_ESTCMD_ESTSWCFG | + ((ts.tv_sec &TR_ESTCMD_ESTSEC_MASK ) << +TR_ESTCMD_ESTSEC_SHIFT ),TR_ESTCMD ); +} + +static struct hellcreek_schedule *hellcreek_taprio_to_schedule ( +const struct tc_taprio_qopt_offload *taprio) +{ +struct hellcreek_schedule *schedule; +size_t i; + +/* Allocate some memory first */ + schedule =kzalloc (sizeof (*schedule),GFP_KERNEL ); +if (!schedule) +return ERR_PTR (-ENOMEM ); + schedule->entries =kcalloc (taprio->num_entries, +sizeof (*schedule->entries), +GFP_KERNEL ); +if (!schedule->entries) { +kfree (schedule); +return ERR_PTR (-ENOMEM ); + } + +/* Construct hellcreek schedule */ + schedule->num_entries = taprio->num_entries; + schedule->base_time = taprio->base_time; + +for (i =0 ; i < taprio->num_entries; ++i) { +const struct tc_taprio_sched_entry *t = &taprio->entries[i]; +struct hellcreek_gcl_entry *k = &schedule->entries[i]; + + k->interval = t->interval; + k->gate_states = t->gate_mask; + k->overrun_ignore =0 ; + +/* Update complete cycle time */ + schedule->cycle_time += t->interval; + } + +return schedule; +} + +static enum hrtimer_restart hellcreek_set_schedule (struct hrtimer *timer) +{ +struct hellcreek_port *hellcreek_port = +hrtimer_to_hellcreek_port (timer); +struct hellcreek *hellcreek = hellcreek_port->hellcreek; +struct hellcreek_schedule *schedule; +unsigned long flags; + +spin_lock_irqsave (&hellcreek->reg_lock, flags); + +/* First select port */ +hellcreek_select_tgd (hellcreek, hellcreek_port->port); + +/* Set admin base time and switch schedule */ +hellcreek_start_schedule (hellcreek, + hellcreek_port->current_schedule->base_time); + + schedule = hellcreek_port->current_schedule; + hellcreek_port->current_schedule =NULL ; + +spin_unlock_irqrestore (&hellcreek->reg_lock, flags); + +dev_dbg (hellcreek->dev,"ARMed EST timer for port %d\n" , + hellcreek_port->port); + +/* Free resources */ +kfree (schedule->entries); +kfree (schedule); + +return HRTIMER_NORESTART ; +} + +static int hellcreek_port_set_schedule (struct dsa_switch *ds,int port, +const struct tc_taprio_qopt_offload *taprio) +{ +struct net_device *netdev =dsa_to_port (ds, port)->slave; +struct hellcreek *hellcreek = ds->priv; +struct hellcreek_port *hellcreek_port; +struct hellcreek_schedule *schedule; +unsigned long flags; +ktime_t start; +u16 ctrl; + + hellcreek_port = &hellcreek->ports[port]; + +/* Convert taprio data to hellcreek schedule */ + schedule =hellcreek_taprio_to_schedule (taprio); +if (IS_ERR (schedule)) +return PTR_ERR (schedule); + +dev_dbg (hellcreek->dev,"Configure traffic schedule on port %d\n" , + port); + +/* Cancel an in flight timer */ +hrtimer_cancel (&hellcreek_port->cycle_start_timer); + +spin_lock_irqsave (&hellcreek->reg_lock, flags); + +if (hellcreek_port->current_schedule) { +kfree (hellcreek_port->current_schedule->entries); +kfree (hellcreek_port->current_schedule); + } + + hellcreek_port->current_schedule = schedule; + +/* First select port */ +hellcreek_select_tgd (hellcreek, port); + +/* Setup traffic class <-> queue mapping */ +hellcreek_setup_tc_mapping (hellcreek, netdev); + +/* Enable gating and set the admin state to forward everything in the +* mean time +*/ + ctrl = (0xff <<TR_TGDCTRL_ADMINGATESTATES_SHIFT ) |TR_TGDCTRL_GATE_EN ; +hellcreek_write (hellcreek, ctrl,TR_TGDCTRL ); + +/* Cancel pending schedule */ +hellcreek_write (hellcreek,0x00 ,TR_ESTCMD ); + +/* Setup a new schedule */ +hellcreek_setup_gcl (hellcreek, port, schedule); + +/* Configure cycle time */ +hellcreek_set_cycle_time (hellcreek, schedule); + +/* Setup timer for schedule switch: The IP core only allows to set a +* cycle start timer 8 seconds in the future. This is why we setup the +* hritmer to base_time - 5 seconds. Then, we have enough time to +* activate IP core's EST timer. +*/ + start =ktime_sub_ns (schedule->base_time, (u64 )5 *NSEC_PER_SEC ); +hrtimer_start_range_ns (&hellcreek_port->cycle_start_timer, start, +NSEC_PER_SEC ,HRTIMER_MODE_ABS ); + +spin_unlock_irqrestore (&hellcreek->reg_lock, flags); + +return 0 ; +} + +static int hellcreek_port_del_schedule (struct dsa_switch *ds,int port) +{ +struct hellcreek *hellcreek = ds->priv; +struct hellcreek_port *hellcreek_port; +unsigned long flags; + + hellcreek_port = &hellcreek->ports[port]; + +dev_dbg (hellcreek->dev,"Remove traffic schedule on port %d\n" , port); + +/* First cancel timer */ +hrtimer_cancel (&hellcreek_port->cycle_start_timer); + +spin_lock_irqsave (&hellcreek->reg_lock, flags); + +if (hellcreek_port->current_schedule) { +kfree (hellcreek_port->current_schedule->entries); +kfree (hellcreek_port->current_schedule); + hellcreek_port->current_schedule =NULL ; + } + +/* Then select port */ +hellcreek_select_tgd (hellcreek, port); + +/* Revert tc mapping */ +__hellcreek_setup_tc_identity_mapping (hellcreek); + +/* Disable gating and return to regular switching flow */ +hellcreek_write (hellcreek,0xff <<TR_TGDCTRL_ADMINGATESTATES_SHIFT , +TR_TGDCTRL ); + +spin_unlock_irqrestore (&hellcreek->reg_lock, flags); + +return 0 ; +} + +static int hellcreek_port_setup_tc (struct dsa_switch *ds,int port, +enum tc_setup_type type,void *type_data) +{ +const struct tc_taprio_qopt_offload *taprio = type_data; + +if (type !=TC_SETUP_QDISC_TAPRIO ) +return -EOPNOTSUPP ; + +if (taprio->enable) +return hellcreek_port_set_schedule (ds, port, taprio); + +return hellcreek_port_del_schedule (ds, port); +} +static const struct dsa_switch_ops hellcreek_ds_ops = { .get_tag_protocol = hellcreek_get_tag_protocol, .setup = hellcreek_setup,
@@ -1104,6 +1394,7 @@ static const struct dsa_switch_ops hellcreek_ds_ops = { .port_hwtstamp_get = hellcreek_port_hwtstamp_get, .port_txtstamp = hellcreek_port_txtstamp, .port_rxtstamp = hellcreek_port_rxtstamp, + .port_setup_tc = hellcreek_port_setup_tc, .get_ts_info = hellcreek_get_ts_info, };
@@ -1135,6 +1426,9 @@ static int hellcreek_probe(struct platform_device *pdev)if (!port->counter_values)return -ENOMEM ; +hrtimer_init (&port->cycle_start_timer,CLOCK_TAI , +HRTIMER_MODE_ABS ); + port->cycle_start_timer.function = hellcreek_set_schedule; port->hellcreek = hellcreek; port->port = i; }
drivers/net/dsa/hirschmann/hellcreek.h +21 -0
@@ -16,6 +16,7 @@#include <linux/ptp_clock_kernel.h> #include <linux/timecounter.h> #include <linux/spinlock.h> +#include <linux/hrtimer.h> #include <net/dsa.h> /* Ports:
@@ -210,6 +211,20 @@ struct hellcreek_counter {const char *name; }; +struct hellcreek_gcl_entry { +u32 interval; +u8 gate_states; +bool overrun_ignore; +}; + +struct hellcreek_schedule { +struct hellcreek_gcl_entry *entries; +size_t num_entries; +ktime_t base_time; +u32 cycle_time; +int port; +}; +struct hellcreek ;/* State flags for hellcreek_port_hwtstamp::state */
@@ -236,6 +251,8 @@ struct hellcreek_port_hwtstamp {struct hellcreek_port {struct hellcreek *hellcreek; +struct hellcreek_schedule *current_schedule; +struct hrtimer cycle_start_timer;int port;u16 ptcfg;/* ptcfg shadow */ u64 *counter_values;
@@ -273,4 +290,8 @@ struct hellcreek { size_t fdb_entries; }; +#define hrtimer_to_hellcreek_port (timer) \ + container_of(timer, struct hellcreek_port, \ + cycle_start_timer) +#endif /* _HELLCREEK_H_ */
Signature · 1 line
2.20.1
Kurt Kanzenbach
maintainerPATCH v2 6/8 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/spinlock.h> #include <linux/hrtimer.h> +#include <linux/leds.h> #include <net/dsa.h> /* Ports:
@@ -280,6 +281,8 @@ struct hellcreek {struct ptp_clock_info ptp_clock_info;struct hellcreek_port ports[4 ];struct delayed_work overflow_work; +struct led_classdev led_is_gm; +struct led_classdev led_sync_good;spinlock_t reg_lock;/* Switch IP register lock */ spinlock_t ptp_lock;/* PTP IP register lock */ void __iomem *base;
@@ -287,6 +290,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
Kurt Kanzenbach
maintainerPATCH v2 7/8 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
@@ -429,6 +429,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 v2 8/8 dt-bindings: net: dsa: Add documentation for Hellcreek switches
In reply to Kurt KanzenbachAdd basic documentation and example.
--- .../bindings/net/dsa/hellcreek.yaml | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.yaml
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +126 -0
@@ -0,0 +1,126 @@ +# 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: + oneOf: + - const: hirschmann,hellcreek + + reg: + description: + The physical base address and size of TSN and PTP memory base + minItems: 2 + maxItems: 2 + + reg-names: + description: + Names of the physical base addresses + minItems: 2 + maxItems: 2 + items: + enum: ["reg", "ptp"] + + leds: + type: object + properties: + '#address-cells': + const: 1 + '#size-cells': + const: 0 + + patternProperties: + "^led@[0-9]+$": + type: object + description: Hellcreek leds + + properties: + reg: + items: + - enum: [0, 1] + description: Led number + + label: true + + default-state: true + + required: + - reg + + additionalProperties: false + +required: + - compatible + - reg + - reg-names + - ports + - leds + +examples: + - | + switch0: switch@ff240000 { + compatible = "hirschmann,hellcreek"; + status = "okay"; + reg = <0xff240000 0x1000>, + <0xff250000 0x1000>; + reg-names = "reg", "ptp"; + dsa,member = <0 0>; + + 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
Rob Herring
maintainerRe: [PATCH v2 8/8] dt-bindings: net: dsa: Add documentation for Hellcreek switches
Quoted 30 lines · Kurt Kanzenbach
Add basic documentation and example.
Signed-off-by Kurt Kanzenbach <[email protected]>--- .../bindings/net/dsa/hellcreek.yaml | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.yamlDocumentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +16
-0@@ -0,0 +1,126 @@ +# 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]>
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml line 26
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +10
-0+ +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: + oneOf: + - const: hirschmann,hellcreek
Don't need 'oneOf' for 1 entry.
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml line 36
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +10
-0+ + reg: + description: + The physical base address and size of TSN and PTP memory base + minItems: 2 + maxItems: 2 + + reg-names: + description: + Names of the physical base addresses
No need for generic descriptions. That's all 'reg-names'...
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml line 40
Quoted 4 lines
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +4
-0+ minItems: 2 + maxItems: 2 + items: + enum: ["reg", "ptp"]
Why not 'tsn' as above instead of reg? In any case, the correct form is:
items:
- const: reg
- const: ptp
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml line 53
Quoted 13 lines
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +13
-0+ + leds: + type: object + properties: + '#address-cells': + const: 1 + '#size-cells': + const: 0 + + patternProperties: + "^led@[0-9]+$": + type: object + description: Hellcreek leds
This should reference leds/common.yaml
Quoted 11 lines
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +11
-0+ + properties: + reg: + items: + - enum: [0, 1] + description: Led number + + label: true + + default-state: true +
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml line 74
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +10
-0+ required: + - reg + + additionalProperties: false + +required: + - compatible + - reg + - reg-names + - ports
Use the preferred 'ethernet-ports'.
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml line 75
Quoted 1 line
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +1
-0+ - leds
Add:
unevaluatedProperties: false
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml line 81
Quoted 6 lines
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +6
-0+ +examples: + - | + switch0: switch@ff240000 { + compatible = "hirschmann,hellcreek"; + status = "okay";
Don't show status in examples.
Quoted 48 lines
Documentation/devicetree/bindings/net/dsa/hellcreek.yaml new file +45
-0+ reg = <0xff240000 0x1000>, + <0xff250000 0x1000>; + reg-names = "reg", "ptp"; + dsa,member = <0 0>; + + 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
Jakub Kicinski
maintainerQuoted 31 lines · On Thu, 23 Jul 2020 10:17:06 +0200 Kurt Kanzenbach wrote:
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 supportThat 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, hardware timestamping and TAPRIO offloading.
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]/This series depends on:
* https://lkml.kernel.org/netdev/[email protected]/
Changes since v1:
Quoted 8 lines
* Code simplifications (Florian Fainelli, Vladimir Oltean)
* Fix issues withhellcreek.yamlbindings (Florian Fainelli)
* Clear reserved field in ptp v2 event messages (Richard Cochran)
* Make use of generic ptp parsing function (Richard Cochran, Vladimir Oltean)
* FixKconfig(Florian Fainelli)
* Add tags (Florian Fainelli, Rob Herring, Richard Cochran)I didn't change the bridge/tagging setup, as I didn't find a better way to do it.
Appears not to build:
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c: In function ‘hellcreek_get_reserved_field’:drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c:177:24: error: invalid use of undefined type ‘const struct ptp_header’
177 | return be32_to_cpu(hdr->reserved2);
| ^~
Kurt Kanzenbach
maintainerQuoted 2 lines · Jakub Kicinski
Appears not to build:
Yeah, i know. This patch series depends on two other ones:
* https://lkml.kernel.org/netdev/[email protected]/
* https://lkml.kernel.org/netdev/[email protected]/
One of them has been merged, the other is being discussed. That series includes the 'ptp_header' and the corresponding functions. So, for compile testing you'll have to apply that series as well.
Thanks,
Kurt
David Miller
maintainerFrom: Kurt Kanzenbach <[email protected]>
Date: Fri, 24 Jul 2020 08:04:10 +0200
Quoted 12 lines · Jakub Kicinski
Quoted 2 lines
Appears not to build:
Yeah, i know. This patch series depends on two other ones:
* https://lkml.kernel.org/netdev/[email protected]/
* https://lkml.kernel.org/netdev/[email protected]/One of them has been merged, the other is being discussed. That series includes the '
ptp_header' and the corresponding functions. So, for compile testing you'll have to apply that series as well.
Please never submit patches for serious review when the dependencies haven't landed in the target tree yet.
That makes so much wasted work for us and other reviewers.
Thank you.
Kurt Kanzenbach
maintainerQuoted 7 lines · David Miller
Please never submit patches for serious review when the dependencies haven't landed in the target tree yet.
That makes so much wasted work for us and other reviewers.
Thank you.
OK, noted. Sorry for that.
Thanks,
Kurt