mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-11 13:15:47 +00:00
310 lines
12 KiB
Diff
310 lines
12 KiB
Diff
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
||
|
To: Christian Marangi <ansuelsmth@gmail.com>,
|
||
|
Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
|
||
|
Krzysztof Kozlowski <krzk+dt@kernel.org>,
|
||
|
Conor Dooley <conor+dt@kernel.org>,
|
||
|
Andrew Lunn <andrew+netdev@lunn.ch>,
|
||
|
"David S. Miller" <davem@davemloft.net>,
|
||
|
Eric Dumazet <edumazet@google.com>,
|
||
|
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
|
||
|
Vladimir Oltean <olteanv@gmail.com>,
|
||
|
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
|
||
|
Heiner Kallweit <hkallweit1@gmail.com>,
|
||
|
Russell King <linux@armlinux.org.uk>,
|
||
|
Matthias Brugger <matthias.bgg@gmail.com>,
|
||
|
AngeloGioacchino Del Regno
|
||
|
<angelogioacchino.delregno@collabora.com>,
|
||
|
linux-arm-kernel@lists.infradead.org,
|
||
|
linux-mediatek@lists.infradead.org, netdev@vger.kernel.org,
|
||
|
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||
|
upstream@airoha.com
|
||
|
Subject: [net-next PATCH v11 0/9] net: dsa: Add Airoha AN8855 support
|
||
|
Date: Mon, 9 Dec 2024 14:44:17 +0100 [thread overview]
|
||
|
Message-ID: <20241209134459.27110-1-ansuelsmth@gmail.com> (raw)
|
||
|
|
||
|
This small series add the initial support for the Airoha AN8855 Switch.
|
||
|
|
||
|
It's a 5 port Gigabit Switch with SGMII/HSGMII upstream port.
|
||
|
|
||
|
This is starting to get in the wild and there are already some router
|
||
|
having this switch chip.
|
||
|
|
||
|
It's conceptually similar to mediatek switch but register and bits
|
||
|
are different. And there is that massive Hell that is the PCS
|
||
|
configuration.
|
||
|
Saddly for that part we have absolutely NO documentation currently.
|
||
|
|
||
|
There is this special thing where PHY needs to be calibrated with values
|
||
|
from the switch efuse. (the thing have a whole cpu timer and MCU)
|
||
|
|
||
|
Changes v11:
|
||
|
- Address reviews from Christophe (spell mistake + dev_err_probe)
|
||
|
- Fix kconfig dependency for MFD driver (depends on MDIO_DEVICE instead of MDIO)
|
||
|
(indirectly fix link error for mdio APIs)
|
||
|
- Fix copy-paste error for MFD driver of_table
|
||
|
- Fix compilation error for PHY (move NVMEM to .config)
|
||
|
- Drop unneeded NVMEM node from MDIO example schema (from Andrew)
|
||
|
- Adapt MFD example schema to MDIO reg property restrictions
|
||
|
Changes v10:
|
||
|
- Entire rework to MFD + split to MDIO, EFUSE, SWITCH separate drivers
|
||
|
- Drop EEE OPs (while Russell finish RFC for EEE changes)
|
||
|
- Use new pcs_inpand OPs
|
||
|
- Drop AN restart function and move to pcs_config
|
||
|
- Enable assisted_learning and disable CPU learn (preparation for fdb_isolation)
|
||
|
- Move EFUSE read in Internal PHY driver to .config to handle EPROBE_DEFER
|
||
|
(needed now that NVMEM driver is register externally instead of internally to switch
|
||
|
node)
|
||
|
Changes v9:
|
||
|
- Error out on using 5G speed as currently not supported
|
||
|
- Add missing MAC_2500FD in phylink mac_capabilities
|
||
|
- Add comment and improve if condition for an8855_phylink_mac_config
|
||
|
Changes v8:
|
||
|
- Add port Fast Age support
|
||
|
- Add support for Port Isolation
|
||
|
- Use correct register for Learning Disable
|
||
|
- Add support for Ageing Time OP
|
||
|
- Set default PVID to 0 by default
|
||
|
- Add mdb OPs
|
||
|
- Add port change MTU
|
||
|
- Fix support for Upper VLAN
|
||
|
Changes v7:
|
||
|
- Fix devm_dsa_register_switch wrong export symbol
|
||
|
Changes v6:
|
||
|
- Drop standard MIB and handle with ethtool OPs (as requested by Jakub)
|
||
|
- Cosmetic: use bool instead of 0 or 1
|
||
|
Changes v5:
|
||
|
- Add devm_dsa_register_switch() patch
|
||
|
- Add Reviewed-by tag for DT patch
|
||
|
Changes v4:
|
||
|
- Set regmap readable_table static (mute compilation warning)
|
||
|
- Add support for port_bridge flags (LEARNING, FLOOD)
|
||
|
- Reset fdb struct in fdb_dump
|
||
|
- Drop support_asym_pause in port_enable
|
||
|
- Add define for get_phy_flags
|
||
|
- Fix bug for port not inititially part of a bridge
|
||
|
(in an8855_setup the port matrix was always cleared but
|
||
|
the CPU port was never initially added)
|
||
|
- Disable learning and flood for user port by default
|
||
|
- Set CPU port to flood and learning by default
|
||
|
- Correctly AND force duplex and flow control in an8855_phylink_mac_link_up
|
||
|
- Drop RGMII from pcs_config
|
||
|
- Check ret in "Disable AN if not in autoneg"
|
||
|
- Use devm_mutex_init
|
||
|
- Fix typo for AN8855_PORT_CHECK_MODE
|
||
|
- Better define AN8855_STP_LISTENING = AN8855_STP_BLOCKING
|
||
|
- Fix typo in AN8855_PHY_EN_DOWN_SHIFT
|
||
|
- Use paged helper for PHY
|
||
|
- Skip calibration in config_init if priv not defined
|
||
|
Changes v3:
|
||
|
- Out of RFC
|
||
|
- Switch PHY code to select_page API
|
||
|
- Better describe masks and bits in PHY driver for ADC register
|
||
|
- Drop raw values and use define for mii read/write
|
||
|
- Switch to absolute PHY address
|
||
|
- Replace raw values with mask and bits for pcs_config
|
||
|
- Fix typo for ext-surge property name
|
||
|
- Drop support for relocating Switch base PHY address on the bus
|
||
|
Changes v2:
|
||
|
- Drop mutex guard patch
|
||
|
- Drop guard usage in DSA driver
|
||
|
- Use __mdiobus_write/read
|
||
|
- Check return condition and return errors for mii read/write
|
||
|
- Fix wrong logic for EEE
|
||
|
- Fix link_down (don't force link down with autoneg)
|
||
|
- Fix forcing speed on sgmii autoneg
|
||
|
- Better document link speed for sgmii reg
|
||
|
- Use standard define for sgmii reg
|
||
|
- Imlement nvmem support to expose switch EFUSE
|
||
|
- Rework PHY calibration with the use of NVMEM producer/consumer
|
||
|
- Update DT with new NVMEM property
|
||
|
- Move aneg validation for 2500-basex in pcs_config
|
||
|
- Move r50Ohm table and function to PHY driver
|
||
|
|
||
|
Christian Marangi (9):
|
||
|
dt-bindings: nvmem: Document support for Airoha AN8855 Switch EFUSE
|
||
|
dt-bindings: net: Document support for Airoha AN8855 Switch Virtual
|
||
|
MDIO
|
||
|
dt-bindings: net: dsa: Document support for Airoha AN8855 DSA Switch
|
||
|
dt-bindings: mfd: Document support for Airoha AN8855 Switch SoC
|
||
|
mfd: an8855: Add support for Airoha AN8855 Switch MFD
|
||
|
net: mdio: Add Airoha AN8855 Switch MDIO Passtrough
|
||
|
nvmem: an8855: Add support for Airoha AN8855 Switch EFUSE
|
||
|
net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver
|
||
|
net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY
|
||
|
|
||
|
.../bindings/mfd/airoha,an8855-mfd.yaml | 178 ++
|
||
|
.../bindings/net/airoha,an8855-mdio.yaml | 56 +
|
||
|
.../net/dsa/airoha,an8855-switch.yaml | 105 +
|
||
|
.../bindings/nvmem/airoha,an8855-efuse.yaml | 123 +
|
||
|
MAINTAINERS | 17 +
|
||
|
drivers/mfd/Kconfig | 10 +
|
||
|
drivers/mfd/Makefile | 1 +
|
||
|
drivers/mfd/airoha-an8855.c | 278 ++
|
||
|
drivers/net/dsa/Kconfig | 9 +
|
||
|
drivers/net/dsa/Makefile | 1 +
|
||
|
drivers/net/dsa/an8855.c | 2310 +++++++++++++++++
|
||
|
drivers/net/dsa/an8855.h | 783 ++++++
|
||
|
drivers/net/mdio/Kconfig | 9 +
|
||
|
drivers/net/mdio/Makefile | 1 +
|
||
|
drivers/net/mdio/mdio-an8855.c | 113 +
|
||
|
drivers/net/phy/Kconfig | 5 +
|
||
|
drivers/net/phy/Makefile | 1 +
|
||
|
drivers/net/phy/air_an8855.c | 267 ++
|
||
|
drivers/nvmem/Kconfig | 11 +
|
||
|
drivers/nvmem/Makefile | 2 +
|
||
|
drivers/nvmem/an8855-efuse.c | 63 +
|
||
|
include/linux/mfd/airoha-an8855-mfd.h | 41 +
|
||
|
22 files changed, 4384 insertions(+)
|
||
|
create mode 100644 Documentation/devicetree/bindings/mfd/airoha,an8855-mfd.yaml
|
||
|
create mode 100644 Documentation/devicetree/bindings/net/airoha,an8855-mdio.yaml
|
||
|
create mode 100644 Documentation/devicetree/bindings/net/dsa/airoha,an8855-switch.yaml
|
||
|
create mode 100644 Documentation/devicetree/bindings/nvmem/airoha,an8855-efuse.yaml
|
||
|
create mode 100644 drivers/mfd/airoha-an8855.c
|
||
|
create mode 100644 drivers/net/dsa/an8855.c
|
||
|
create mode 100644 drivers/net/dsa/an8855.h
|
||
|
create mode 100644 drivers/net/mdio/mdio-an8855.c
|
||
|
create mode 100644 drivers/net/phy/air_an8855.c
|
||
|
create mode 100644 drivers/nvmem/an8855-efuse.c
|
||
|
create mode 100644 include/linux/mfd/airoha-an8855-mfd.h
|
||
|
|
||
|
--- a/drivers/mfd/Kconfig
|
||
|
+++ b/drivers/mfd/Kconfig
|
||
|
@@ -41,6 +41,16 @@ config MFD_ALTERA_SYSMGR
|
||
|
using regmap_mmio accesses for ARM32 parts and SMC calls to
|
||
|
EL3 for ARM64 parts.
|
||
|
|
||
|
+config MFD_AIROHA_AN8855
|
||
|
+ tristate "Airoha AN8855 Switch MFD"
|
||
|
+ select MFD_CORE
|
||
|
+ select MDIO_DEVICE
|
||
|
+ depends on NETDEVICES && OF
|
||
|
+ help
|
||
|
+ Support for the Airoha AN8855 Switch MFD. This is a SoC Switch
|
||
|
+ that provides various peripherals. Currently it provides a
|
||
|
+ DSA switch and a NVMEM provider.
|
||
|
+
|
||
|
config MFD_ACT8945A
|
||
|
tristate "Active-semi ACT8945A"
|
||
|
select MFD_CORE
|
||
|
--- a/drivers/mfd/Makefile
|
||
|
+++ b/drivers/mfd/Makefile
|
||
|
@@ -7,6 +7,7 @@
|
||
|
obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o
|
||
|
obj-$(CONFIG_MFD_88PM800) += 88pm800.o 88pm80x.o
|
||
|
obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o
|
||
|
+obj-$(CONFIG_MFD_AIROHA_AN8855) += airoha-an8855.o
|
||
|
obj-$(CONFIG_MFD_ACT8945A) += act8945a.o
|
||
|
obj-$(CONFIG_MFD_SM501) += sm501.o
|
||
|
obj-$(CONFIG_ARCH_BCM2835) += bcm2835-pm.o
|
||
|
--- a/drivers/net/dsa/Kconfig
|
||
|
+++ b/drivers/net/dsa/Kconfig
|
||
|
@@ -24,6 +24,15 @@ config NET_DSA_LOOP
|
||
|
This enables support for a fake mock-up switch chip which
|
||
|
exercises the DSA APIs.
|
||
|
|
||
|
+config NET_DSA_AN8855
|
||
|
+ tristate "Airoha AN8855 Ethernet switch support"
|
||
|
+ depends on MFD_AIROHA_AN8855
|
||
|
+ depends on NET_DSA
|
||
|
+ select NET_DSA_TAG_MTK
|
||
|
+ help
|
||
|
+ This enables support for the Airoha AN8855 Ethernet switch
|
||
|
+ chip.
|
||
|
+
|
||
|
source "drivers/net/dsa/hirschmann/Kconfig"
|
||
|
|
||
|
config NET_DSA_LANTIQ_GSWIP
|
||
|
--- a/drivers/net/dsa/Makefile
|
||
|
+++ b/drivers/net/dsa/Makefile
|
||
|
@@ -5,6 +5,7 @@ obj-$(CONFIG_NET_DSA_LOOP) += dsa_loop.o
|
||
|
ifdef CONFIG_NET_DSA_LOOP
|
||
|
obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o
|
||
|
endif
|
||
|
+obj-$(CONFIG_NET_DSA_AN8855) += an8855.o
|
||
|
obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o
|
||
|
obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o
|
||
|
obj-$(CONFIG_NET_DSA_MT7530_MDIO) += mt7530-mdio.o
|
||
|
--- a/drivers/net/mdio/Kconfig
|
||
|
+++ b/drivers/net/mdio/Kconfig
|
||
|
@@ -61,6 +61,15 @@ config MDIO_XGENE
|
||
|
This module provides a driver for the MDIO busses found in the
|
||
|
APM X-Gene SoC's.
|
||
|
|
||
|
+config MDIO_AN8855
|
||
|
+ tristate "Airoha AN8855 Switch MDIO bus controller"
|
||
|
+ depends on MFD_AIROHA_AN8855
|
||
|
+ depends on OF_MDIO
|
||
|
+ help
|
||
|
+ This module provides a driver for the Airoha AN8855 Switch
|
||
|
+ that requires a MDIO passtrough as switch address is shared
|
||
|
+ with the internal PHYs and requires additional page handling.
|
||
|
+
|
||
|
config MDIO_ASPEED
|
||
|
tristate "ASPEED MDIO bus controller"
|
||
|
depends on ARCH_ASPEED || COMPILE_TEST
|
||
|
--- a/drivers/net/mdio/Makefile
|
||
|
+++ b/drivers/net/mdio/Makefile
|
||
|
@@ -5,6 +5,7 @@ obj-$(CONFIG_ACPI_MDIO) += acpi_mdio.o
|
||
|
obj-$(CONFIG_FWNODE_MDIO) += fwnode_mdio.o
|
||
|
obj-$(CONFIG_OF_MDIO) += of_mdio.o
|
||
|
|
||
|
+obj-$(CONFIG_MDIO_AN8855) += mdio-an8855.o
|
||
|
obj-$(CONFIG_MDIO_ASPEED) += mdio-aspeed.o
|
||
|
obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o
|
||
|
obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o
|
||
|
--- a/drivers/net/phy/Kconfig
|
||
|
+++ b/drivers/net/phy/Kconfig
|
||
|
@@ -147,6 +147,11 @@ config AIROHA_EN8801SC_PHY
|
||
|
help
|
||
|
Currently supports the Airoha EN8801SC PHY.
|
||
|
|
||
|
+config AIR_AN8855_PHY
|
||
|
+ tristate "Airoha AN8855 Internal Gigabit PHY"
|
||
|
+ help
|
||
|
+ Currently supports the internal Airoha AN8855 Switch PHY.
|
||
|
+
|
||
|
config AIR_EN8811H_PHY
|
||
|
tristate "Airoha EN8811H 2.5 Gigabit PHY"
|
||
|
help
|
||
|
--- a/drivers/net/phy/Makefile
|
||
|
+++ b/drivers/net/phy/Makefile
|
||
|
@@ -50,6 +50,7 @@ obj-y += $(sfp-obj-y) $(sfp-obj-m)
|
||
|
obj-$(CONFIG_ADIN_PHY) += adin.o
|
||
|
obj-$(CONFIG_ADIN1100_PHY) += adin1100.o
|
||
|
obj-$(CONFIG_AIROHA_EN8801SC_PHY) += en8801sc.o
|
||
|
+obj-$(CONFIG_AIR_AN8855_PHY) += air_an8855.o
|
||
|
obj-$(CONFIG_AIR_EN8811H_PHY) += air_en8811h.o
|
||
|
obj-$(CONFIG_AMD_PHY) += amd.o
|
||
|
obj-$(CONFIG_AQUANTIA_PHY) += aquantia/
|
||
|
--- a/drivers/nvmem/Kconfig
|
||
|
+++ b/drivers/nvmem/Kconfig
|
||
|
@@ -29,6 +29,17 @@ source "drivers/nvmem/layouts/Kconfig"
|
||
|
|
||
|
# Devices
|
||
|
|
||
|
+config NVMEM_AN8855_EFUSE
|
||
|
+ tristate "Airoha AN8855 eFuse support"
|
||
|
+ depends on MFD_AIROHA_AN8855 || COMPILE_TEST
|
||
|
+ help
|
||
|
+ Say y here to enable support for reading eFuses on Airoha AN8855
|
||
|
+ Switch. These are e.g. used to store factory programmed
|
||
|
+ calibration data required for the PHY.
|
||
|
+
|
||
|
+ This driver can also be built as a module. If so, the module will
|
||
|
+ be called nvmem-an8855-efuse.
|
||
|
+
|
||
|
config NVMEM_APPLE_EFUSES
|
||
|
tristate "Apple eFuse support"
|
||
|
depends on ARCH_APPLE || COMPILE_TEST
|
||
|
--- a/drivers/nvmem/Makefile
|
||
|
+++ b/drivers/nvmem/Makefile
|
||
|
@@ -10,6 +10,8 @@ nvmem_layouts-y := layouts.o
|
||
|
obj-y += layouts/
|
||
|
|
||
|
# Devices
|
||
|
+obj-$(CONFIG_NVMEM_AN8855_EFUSE) += nvmem-an8855-efuse.o
|
||
|
+nvmem-an8855-efuse-y := an8855-efuse.o
|
||
|
obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o
|
||
|
nvmem-apple-efuses-y := apple-efuses.o
|
||
|
obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o
|