generic: backport initial LEDs hw control support
[openwrt/openwrt.git] / target / linux / ipq40xx / patches-5.15 / 705-net-dsa-add-Qualcomm-IPQ4019-built-in-switch-support.patch
1 From b5f71652b85a85ea53162e9e2b760b84fd0d254f Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robert.marko@sartura.hr>
3 Date: Mon, 1 Nov 2021 18:10:28 +0100
4 Subject: [PATCH] net: dsa: add Qualcomm IPQ4019 built-in switch support
5
6 Qualcomm IPQ40xx SoC-s have a variant of QCA8337N switch built-in.
7
8 It shares most of the stuff with its external counterpart, however it is
9 modified for the SoC.
10 Namely, it doesn't have second CPU port (Port 6), so it has 6 ports
11 instead of 7.
12 It also has no built-in PHY-s but rather requires external PSGMII based
13 companion PHY-s (QCA8072 and QCA8075) for which it first needs to carry
14 out calibration before using them.
15 PSGMII has a SoC built-in PHY that is used to connect to the PHY-s which
16 unfortunately requires some magic values as the datasheet doesnt document
17 the bits that are being set or the register at all.
18
19 Since its built-in it is MMIO like other peripherals and doesn't have its
20 own MDIO bus but depends on the SoC provided one.
21
22 CPU connection is at Port 0 and it uses some kind of a internal connection
23 and no traditional RGMII/SGMII.
24 It also doesn't use in-band tagging like other qca8k switches so a shinfo
25 based tagger is used.
26
27 Signed-off-by: Robert Marko <robert.marko@sartura.hr>
28 ---
29 drivers/net/dsa/qca/Kconfig | 9 +++++++++
30 drivers/net/dsa/qca/Makefile | 1 +
31 2 files changed, 10 insertions(+)
32
33 --- a/drivers/net/dsa/qca/Kconfig
34 +++ b/drivers/net/dsa/qca/Kconfig
35 @@ -23,3 +23,13 @@ config NET_DSA_QCA8K_LEDS_SUPPORT
36 help
37 This enabled support for LEDs present on the Qualcomm Atheros
38 QCA8K Ethernet switch chips.
39 +
40 +config NET_DSA_QCA8K_IPQ4019
41 + tristate "Qualcomm Atheros IPQ4019 built-in Ethernet switch support"
42 + depends on HAS_IOMEM && NET_DSA
43 + select NET_DSA_TAG_IPQ4019
44 + select REGMAP
45 + help
46 + This enables support for the Qualcomm Atheros IPQ4019 SoC built-in
47 + Ethernet switch.
48 +
49 --- a/drivers/net/dsa/qca/Makefile
50 +++ b/drivers/net/dsa/qca/Makefile
51 @@ -1,5 +1,6 @@
52 # SPDX-License-Identifier: GPL-2.0-only
53 obj-$(CONFIG_NET_DSA_AR9331) += ar9331.o
54 +obj-$(CONFIG_NET_DSA_QCA8K_IPQ4019) += qca8k-ipq4019.o
55 obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
56 qca8k-y += qca8k-common.o qca8k-8xxx.o
57 ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT