Commit Graph

549 Commits

Author SHA1 Message Date
Markus Stockhausen
4fd4274f68 realtek: 6.6: copy patch 304-spi-update-dependency-for-spi-realtek-rtl
Copy the patch file to 6.6

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:55 +02:00
Markus Stockhausen
2abd2b54bc ealtek: 6.6: refresh patch 303-gpio-update-dependencies-for-gpio-realtek-otto
No content changes. Only take over the new patch locations.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:55 +02:00
Markus Stockhausen
8bbe9e9fc5 realtek: 6.6: copy patch 303-gpio-update-dependencies-for-gpio-realtek-otto
Copy the patch file to 6.6

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:55 +02:00
Markus Stockhausen
13391465ba realtek: 6.6: refresh patch 302-clocksource-add-otto-driver
No content changes. Only take over the new patch locations.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:55 +02:00
Markus Stockhausen
955d6b41f1 realtek: 6.6: copy patch 302-clocksource-add-otto-driver
Copy the patch file to 6.6

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:55 +02:00
Markus Stockhausen
82732d2ebe realtek: 6.6: refresh patch 301-gpio-add-rtl8231-driver
No content changes. Only take over the new patch locations.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:55 +02:00
Markus Stockhausen
badf1c960a realtek: 6.6: copy patch 301-gpio-add-rtl8231-driver
Copy the patch file to 6.6

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:54 +02:00
Markus Stockhausen
d81d0d503d realtek: 6.6: refresh patch 300-mips-add-rtl838x-platform
No content changes. Only take over the new patch locations.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:54 +02:00
Markus Stockhausen
416006a6d1 realtek: 6.6: copy patch 300-mips-add-rtl838x-platform
Copy the patch file to 6.6

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:54 +02:00
Markus Stockhausen
91eaa76909 realtek: 6.6: fix rtl931x kernel config
The CONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US is missing. Avoid
complaints and add it with its default 125.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:54 +02:00
Markus Stockhausen
325d79f0f9 realtek: 6.6: copy files and config from 5.15
Copy files and config from 5.15 kernel version. Because of the big version jump
leave out the patches for now so we can treat them individually later on.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 19:58:54 +02:00
Markus Stockhausen
0f7131baf3 realtek: rework hardware-assisted indirect mdio access
With commit b53202a8c3 ("realtek: switch to use generic MDIO accessor functions")
the phy access logic was enhanced. A quite big kernel patch was introduced that
allowed to make use of hardware-assisted page access like we have in the realtek
target. Basically it works the following way

- The enhanced bus intercepts page write accesses
- Currently selected pages are stored in internal vars.
- Finally only all-in-one-consistent bus/register accesses are issued
- It intercepted page changes and ensured that only a complete bus call

For the details see https://github.com/openwrt/openwrt/pull/16172

Switching over to newer kernels this patch is really hard to maintain. Its heavy
modifcations exist only in the realtek target. So it does not matter if we keep
it as an kernel modification or directly include it in our driver. To make it the
future brighter we drop this patch and take over its logic. Thus the kernel will
stay totally modification-free. What do we do?

1. Up to now the bus->priv structure directly pointed to ethernet->priv. Create an
explicit private structure rtl838x_bus_priv that not only holds the ethernet->priv
pointer but also space for some bus status tracking vars as well.

2. Wherever we use a reference to ethernet->priv directly replace that by an
additional indirection over the new rtl838x_bus_priv structure.

3. Up to now the phy flag PHY_HAS_REALTEK_PAGES identified that we can use the
alternative paged access from the patch. As this will be no longer available
remove it and provide read_page/write_page functions for each possible PHY.
These functions will be pretty standard as for other Realtek PHYs.

4. The existing mdio bus read/write function rely on the classic MII_ADDR_C45
flag - one interface for two access types. This mixup will be removed on the way
to kernel 6.6. In the future there will be two pairs of access functions. One for
classic access one for c45 style access. Rewrite our functions into 3 parts:

- a classic read/write function: ready for kernel 6.6
- a new c45 read/write function: ready for kernel 6.6
- a legacy read/write wrapper: for current 5.15 for the time being

When we switch to 6.6 we only need to remove the legacy wrappers and link the
new functions. Life can be so easy.

5. The classic read/write functions will incorporate the interception logic that
was originally in the patch.

6. The package convenience functions that were embedded in the patch get lost as
well. Rewrite them inside our phy driver.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
[Minor checkpatch.pl cleanups]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2024-09-14 19:58:21 +02:00
Markus Stockhausen
0b078f2ecf realtek: normalize dts directory
There is no need to keep a version specific dts directory.
Rename the folder to its standard location.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2024-09-14 16:56:37 +02:00
Goetz Goerisch
3774f3272e treewide: rename ZyXEL to Zyxel
The company Zyxel rebranded some years ago.
Currently the casing is according to the old branding even
for newer devices which already use the new branding.

This commit aligns the casing of Zyxel everywhere.

Signed-off-by: Goetz Goerisch <ggoerisch@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/15652
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-08-25 15:08:25 +02:00
Kevin Jilissen
5a5c52085a realtek: Trap LLDP packets to the CPU
We should setup the registers for trapping LLDP packets to the CPU.
Currently, these packets are forwarded to all ports which is not desired
behaviour.

Signed-off-by: Kevin Jilissen <info@kevinjilissen.nl>
2024-05-10 16:03:51 +02:00
Kevin Jilissen
81ab9ef2d1 realtek: Change LLTP register to LLDP
These registers control the handling of Link Layer Discovery Protocol
(LLDP) packets. This seems to be a typo in the naming.

Signed-off-by: Kevin Jilissen <info@kevinjilissen.nl>
2024-05-10 16:03:51 +02:00
Stijn Tintel
a9781a04a1 realtek: add RTL821X_CHIP_ID
According to the Realtek SDK code, the RTL8214FC, RTL8218B and RTL8218FB
all have the same chip ID 0x6276. Let's add a constant for it, as we're
using it in more than one location.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2024-05-07 12:27:33 +03:00
Stijn Tintel
1626b06683 realtek/rtl839x: respect phy-is-integrated property
Respect the phy-is-integrated property on ethernet-phy nodes.

There are RTL8393M switches where the PHYs at address 48 and 49 are
provided by an external RTL8214FC. Hardcoding them to use the internal
SerDes makes it impossible to use the ports connected to such an
external PHY. Respect the phy-is-integrated property on ethernet-phy
nodes as a first step to support such ports.

The potential impact for this should be limited to RTL8393 based
switches, and looking at the commit messages and device tree files of
the supported switches based on this SoC, the SFP and/or combo ports are
either not working (D-Link DGS-1210-52, Netgear GS750E, TP-Link
SG2452P/T1600G-52PS), use PHYs at a different address (Panasonic
SwitchM48EG PN28480K), or already have the phy-is-integrated property
set on the PHYs at address 48 and 49.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Daniel Golle <daniel@makrotopia.org>
2024-05-07 12:27:30 +03:00
Hauke Mehrtens
9693ed6a9e kernel: bump 5.15 to 5.15.155
Manual adapted the following patches:
   generic/hack-5.15/221-module_exports.patch
   octeontx/patches-5.15/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-04-16 23:11:25 +02:00
Stijn Tintel
291efaf765 realtek: fix filter_port_list_reverse calls
The function introduced in commit 7cbfe5654d is named
filter_port_list_reverse, not filter_port_list_reversed.

Fixes the following error on hpe,1920-8g-poe-65w and
hpe,1920-8g-poe-180w.

  /bin/board_detect: /etc/board.d/02_network: line 84: filter_port_list_reversed: not found

Fixes: 7cbfe5654d ("realtek: move port filtering out of uci_set_poe()")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Sander Vanheule <sander@svanheule.net>
2024-04-13 13:22:11 +03:00
Mirko Vogt
0688cf5aeb realtek: add support for switch Zyxel GS1900-24EP
This device is very similar to the GS1900-24E switch (added in b515ad1),
except that the first 12 of 24 ethernet ports are capable of PoE and the
physical jacks are in the right order - unlike for the GS1900-24E, where
even and uneven ports are flipped (up <-> down on panel).

Zyxel version code for this device (-24EP) is: ABTO

Signed-off-by: Mirko Vogt <mirko-openwrt@nanl.de>
2024-04-08 21:31:55 +02:00
Goetz Goerisch
71ccb35017 realtek: add Zyxel GS1900-8 v2
The Zyxel GS1900-8 v2 or Rev.B1 is a newer variant of the GS1900-8, but
otherwise similar to the other GS1900 switches.

Differences
------------
* Front Button labeled RESTORE
* NO Power Switch on rear
* Serial Header next to the barrel power connector
* Part Number ends 0102F

Signed-off-by: Goetz Goerisch <ggoerisch@gmail.com>
2024-03-25 21:28:44 +01:00
Richard Kunze
92c21b2e18 realtek: support common GPIOs on D-Link DGS-1210-16
D-Link DGS-1210-16 hangs when rebooting and has no support for the reset
button.

Fix both by enabling the same GPIOs for reboot and the reset button as
already used for D-Link DGS-1210-20 and D-Link DGS-1210-28.

Signed-off-by: Richard Kunze <kunze@tivano.de>
2024-03-23 18:36:51 +01:00
Bjørn Mork
6da308f4de realtek: fix Netgear GS110TPP OEM install
Recent OEM firmware versions test the version number embedded in the uimage
"name" header field. The exact restricton is unknown, but "7.0.8.4" seems
to be the lowest number accepted on a GS110TPPv1 which already has that
version or higher.

A "9.9.9.9" version is accepted as valid by the GS110TPPv1 OEM firmware,
and considered both unique enough to identify an OpenWrt image and
moderately future proof against OEM version bumps.

This change is also boot tested on a GS108Tv3 with

 "BOOT Loader Version 1.0.0.2 (2018-08-31 17:05:26 UTC)"

to verify that it doesn't break boot on older hardware.

Link: https://forum.openwrt.org/t/72510/58
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2024-02-18 09:56:45 +01:00
Sander Vanheule
6f83a708c8 base-files: move uci_set_poe() to uci-defaults.sh
PoE devices in the realtek target have the possibility to add PSE info
to the board description via 02_network. Make this available for all
targets, by moving the uci_set_poe() function to the globally available
uci-default.sh script.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2024-02-12 20:46:51 +01:00
Sander Vanheule
7cbfe5654d realtek: move port filtering out of uci_set_poe()
uci_set_poe() now performs two duties: filtering the list of device
ports to exclude non-PoE ports, and generating the PoE related device
config.

Extract the port filtering to an external function, which is made a bit
more readable by the use of 'sort -V [-r] | uniq -u' to filter duplicate
entries out of a (reverse) version sorted list.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2024-02-12 20:46:51 +01:00
Tobias Schramm
356a0b86eb realtek: add support for chassis fan on ZyXEL XGS1250-12
The ZyXEL XGS1250-12 has a chassis fan. The fan is positioned perfectly to
provide additional cooling to the Aquantia NBase-T phys. Testing has shown
that the phys can reach temperatures upwards of 72 degrees Celsius quite
easily at about 20 degrees Celsius ambient.
Support the chassis fan to give the phys a bit of extra cooling.

Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
2024-02-12 20:09:24 +01:00
Christian Marangi
db9f26cfcb
realtek: convert to new LED color/function format where possible
Initial conversion to new LED color/function format
and drop label format where possible. The same label
is composed at runtime.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-02-07 14:48:44 +01:00
Christian Marangi
f038c0c18f
realtek: drop redundant label with new LED color/function format
Drop redundant label with new LED color/function format declared.
This was needed previously when the new format wasn't supported by
leds.sh functions script. Now that is supported this property
can be removed in favor of the new format.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-02-07 14:48:44 +01:00
Tobias Schramm
af9bf9a949 realtek: enable in-band configuration of SFP port on ZyXEL XGS1250-12
The rtl93xx SoC supports both 1000Base-X and 10GBase-CR on its SerDes
interfaces. Enable dynamic switching between mac-signaled modes to
support 1000Base-X and 10GBase-CR on the SFP port.

Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
2024-02-05 20:44:46 +01:00
Tobias Schramm
9daf4dff6b realtek: 5.15: rtl93xx: add 1000Base-X and 10GBase-CR support on SerDes
This patch adds support for 1000Base-X and 10GBase-CR directly on the
SerDes lanes of rtl93xx SoCs.
This fixes SFP/SFP+ support on devices like the XSG1250-12.

Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
2024-02-05 20:44:46 +01:00
Tobias Schramm
9fe2412e62 realtek: 5.15: rtl930x: introduce SerDes mode macros
Previously SerDes modes were specified ad-hoc in hex. Introduce and use
macros for SerDes modes.

Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
2024-02-05 20:44:46 +01:00
Tobias Schramm
2f8a881895 realtek: 5.15: rtl93xx: fix switch/case indentation
Small stylistic fixup, one switch case statement was incorrectly indented.

Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
2024-02-05 20:44:46 +01:00
Tobias Schramm
9b066384f9 realtek: 5.15: rtl93xx: remove unused SerDes mode selection
rtl93xx_phylink_mac_config used to determine sds_mode without ever using
it. Drop that code.

Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
2024-02-05 20:44:46 +01:00
Tobias Schramm
0ac785caf3 realtek: 5.15: rtl930x: fix SerDes phy register write
The indirect SerDes phy register write function was missing the actual
write call. Add it.

Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
2024-02-05 20:44:46 +01:00
Stijn Segers
557db5106c realtek: fix zyxel-vers usage for XGS1250-12
Commit daefc646e6 ("realtek: fix ZyXEL initramfs image generation")
fixed a shell expansion issue with zyxel-vers usage. Commit 045baca10b
("realtek: deduplicate GS1900 recipes") took care of this for the
rtl838x and rtl839x subtargets, but the single device officially
supported in rtl930x - the XGS1250-12 - was overlooked. This commit
updates the XGS1250-12 build recipe as well.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
2024-02-04 13:31:35 +01:00
Christian Marangi
1b3259eb5c generic: 5.15: backport upstream Aquantia PHY firmware loader patches
Backport merged upstream patch that adds support for firmware loader
from NVMEM or attached filesystem for Aquantia PHYs.

Refresh all kernel patches affected by this change.

Also update the path for aquantia .ko that got moved to dedicated
directory upstream.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
[rmilecki: port to 5.15]
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2024-01-26 17:52:24 +01:00
Christian Marangi
0f09fd60fb
realtek: 5.15: refresh HSGMII patch due to recent PHY backport
Refresh HSGMII patch due to recent PHY backport that cause
compilation warning for case not handled in phy_interface_num_ports.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-01-26 15:50:43 +01:00
Rafał Miłecki
2df8a0ccb0 kernel: 5.15: backport v6.1 PHY changes required for Aquantia
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2024-01-26 11:48:50 +01:00
Michel Thill
135e107620 realtek: d-link dgs-1210-10p improve sfp support
The current dts file of dgs-1210-10p doesn't support link states
for the sfp ports (they are always up).
This patch tries to give better support for this and was run tested
on dgs-1210-10p.

It was heavily inspired from Paul Fertser, RaylynnKnight
and the author of dgs-1210-10mp-f.dts

https://forum.openwrt.org/t/dlink-dgs-1210-10p-with-glc-t-co-sfp/170928

Signed-off-by: Michel Thill <jmthill@gmail.com>
2024-01-23 10:57:06 +01:00
Peter Körner
5798e12e4a
rtl838x: debugfs use constants from mach-rtl83xx.h
The register constants were duplicated in net/dsa/rtl83xx/debugfs.c and asm
mach-rtl838x/mach-rtl83xx.h. This commit removes this duplication.

Signed-off-by: Peter Körner <git@mazdermind.de>
2024-01-15 18:09:22 +01:00
Peter Körner
668a049171
rtl838x: fix RTL838X_LED_SW_CTRL definition
According to https://svanheule.net/realtek/maple/register/led_sw_ctrl and also
drivers/net/dsa/rtl83xx/debugfs.c LED_SW_CTRL on the RTL838X should be 0xa00c
not 0x0128. Please note, that is is 0x0128 on the RTL8390/cypress SOC family.

Signed-off-by: Peter Körner <git@mazdermind.de>
2024-01-15 18:09:22 +01:00
Peter Körner
b49a0feb20
rtl931x: reformat broken indentation
the given code-format did not correctly express the condition and made the code
harder to read then necessary.

Signed-off-by: Peter Körner <git@mazdermind.de>
2024-01-15 18:09:19 +01:00
Jacob Potter
735efbfb7c realtek: rtl838x: add Netgear GS110TUP v1 support
The GS110TUP v1 is a managed switch similar to the GS110TPP v1, but with
port 10 as SFP instead of RJ-45 and a total budget of 240 watts. Ports
1-4 support 60-watt 802.3bt PoE and ports 5-8 support 30-watt 802.3at.

The flash layout of the two switches are identical, and the U-Boot
configurations are the same except for having a different magic number,
so installation can be done via the same U-Boot method.

The following command will be needed to enable the port LEDs as per
https://forum.openwrt.org/t/72510/51 :
    fw_setenv bootcmd "rtk network on; boota"

Additionally, port 9 (1000base-T from a separate QSGMII PHY) does not
function without this. Port 10 was not tested as no SFP module was
available.

Signed-off-by: Jacob Potter <jacob@j4cbo.com>
[rebase on merged flash layout]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2024-01-13 16:45:05 +01:00
Sander Vanheule
92e0baba42 realtek: rtl838x: join Netgear GSxxx flash layouts
Flash layouts for GS108Tv3, GS110TPPv1, GS308Tv1 and GS310TPv1 are
almost identical, except for the uimage header magic.

Move the flash layout to the common dtsi, and only place the magic value
in the device dts files.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2024-01-13 16:45:05 +01:00
Harshal Gohel
e691e2b302 rtl83xx: dsa: reset PVID to 1 instead of 0
Before, PVID is reset for all ports and goes out of bounds. Also, PVID
is later changed by dsa configuration by `ip link` and `bridge vlan`
commands, this does not change the CPU port PVID and CPU PVID stays 0.
It does not allow sending packets from OpenWrt to any connected devices
unless default configuration is changed

This change iterates up to and including cpu_port and sets default PVID
to 1. For lan* ports PVID can be configured with `ip link` and `bridge
vlan` commands

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
2024-01-09 21:20:37 +01:00
Harshal Gohel
da495c477d rtl93xx: dsa: Fix 802.1QinQ for trunk ports
Fix incorrect register value being set for VLAN_PORT_FWD

Before, the 0b1111 would be set for the register which means outgoing
packets would receive an extra tag, corresponding to the PVID of the
port.

On untagged ports, this meant outgoing packets with a single tag.

On tagged ports, this meant outgoing QinQ packets, where the inner tag
was either the PVID of the untagged ingress port, or the already
assigned original (single) tag.

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
2024-01-09 21:19:41 +01:00
Harshal Gohel
fe01435b69 rtl83xx: dsa: Clear duplex bit correctly
Without this, luci shows 10M full duplex when there is no link. So
explicitly set half duplex and unknown speed.

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
2024-01-09 21:19:21 +01:00
Harshal Gohel
2cfb1ecf10 rtl930x: Rework per port LED configuration
Use led_setX to determine number of LEDs per port. Introduce macros to
calculate register value and shift for particular LED in a particular
set.

Problem with previous implementation is that it uses is10G status to
determine leds per port. However with usxgmii, driver sets 10g, 5g and
2.5g so even though there are only 2 leds per port it selects 4 leds per
port

This implementation relies on configured led_set node.

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
2024-01-09 21:18:50 +01:00
Harshal Gohel
a376508216 rtl83xx: dsa: Do nothing when vid 0
Following other dsa drivers, vid 0 is no-op

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
2024-01-09 21:18:46 +01:00