aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files-5.15/drivers
Commit message (Collapse)AuthorAgeFilesLines
* realtek: return correct error value for phy opsPascal Ernster2023-01-051-2/+2
| | | | | | | | | | | | | | | | | | | | | A behavioural change was introduced with commit 758c88b96963 ("realtek: Whitespace and codestyle cleanup") causing rtl838x_read_phy() and rtl838x_write_phy() to unconditionally return -ETIMEDOUT. As a result, probing the device during boot fails: Error setting up netdev, freeing it again. rtl838x-eth: probe of 1b00a300.ethernet failed with error -5 Fix the bootloop caused by this regression with kernel 5.15 on rtl838x devices, by properly returning 0 on success. Tested on a Netgear GS108T v3, a Netgear GS310TP v1, a Zyxel GS1900-8HP v1 and an HPE 1920-8G. Fixes: 758c88b969639d0e6b684669d2e54dd1be3102f4 ("realtek: Whitespace and codestyle cleanup") Tested-by: Stijn Segers <foss@volatilesystems.org> Tested-by: Jan Hoffmann <jan@3e8.eu> Signed-off-by: Pascal Ernster <git@hardfalcon.net>
* realtek: Fix reset register accessBirger Koblitz2022-12-281-1/+1
| | | | | | | | | | | The reset register on RTL93xx not merely have bits to execute a reset of a hardware component, but also configuration bits for reset procedures. Keep them during executing a reset. Signed-off-by: Birger Koblitz <git@birger-koblitz.de> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl> [backport to 5.10 kernel] Signed-off-by: Sander Vanheule <sander@svanheule.net>
* realtek: Reduce variable scopesOlliver Schinagl2022-12-2712-443/+335
| | | | | | | | | | | | | | Linus prefers to have loop initializers nice and tightly scoped. In OpenWRT this has been possible since 41a1a652fbd4 ("kernel: backport gnu11 upgrade"). This patch cleans up variable scope while trying to do the above for 'simple for loops'. This cleans up and simplifies some functions and code, and pulls in variables to a smaller scope. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
* realtek: Replace C++ style commentsOlliver Schinagl2022-12-2718-956/+958
| | | | | | | The only exception to C++ style comments are SPDX license identifier markers at the start of C files (even headers have C style markers). Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
* realtek: Whitespace and codestyle cleanupOlliver Schinagl2022-12-2722-805/+760
| | | | | | | | Fix some ugly whitepsaces and codestyle issues around the realtek sources. While this is by no means perfect, it catches what it caught. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
* realtek: add cond_resched to loops accessing the FDB tableJan Hoffmann2022-12-272-0/+6
| | | | | | | | | A full loop accessing all FDB entries can take several milliseconds (on RTL839x about 20 ms), so give other kernel tasks a chance to run. This is especially important for rtl83xx_port_fdb_dump which is itself called in a loop for all ports by the kernel. Signed-off-by: Jan Hoffmann <jan@3e8.eu>
* realtek: restructure rtl_table_read/writeJan Hoffmann2022-12-272-14/+31
| | | | | | | | | | | | | | | | These two functions are identical apart from writing different values to the read/write bit. Create a new function rtl_table_exec to reduce code duplication. Also replace the unbounded busy-waiting loop. The new implementation may sleep, but as the hardware typically responds before the first poll, any callers doing many table accesses still need to make sure not to block other kernel tasks themselves. So far, polling timeout errors are only handled by logging an error, but a return value is added to allow proper handling in the future. Signed-off-by: Jan Hoffmann <jan@3e8.eu>
* realtek: simplify log messages in rtl83xx_mdio_probeJan Hoffmann2022-12-271-7/+1
| | | | | | | | | | This function currently prints three messages for every switch port at KERN_INFO level. This takes a considerable amount of time during bootup and can even trigger an external watchdog. Replace these log messages by a single one at KERN_DEBUG level. Signed-off-by: Jan Hoffmann <jan@3e8.eu>
* realtek: don't set L2LEARNING flag in rtl83xx TX headerJan Hoffmann2022-12-271-2/+2
| | | | | | | | | | | | | | | | | | | As learning for the CPU port is now disabled globally, the bit in the TX header doesn't have any effect anymore. Remove it to make the header consistent with the global configuration. Originally, this change was intended to be applied before commit eb456aedfe24 ("realtek: use assisted learning on CPU port"), which is why the commit message incorrectly mentions that the TX header already disables learning. The reason for disabling learning on the CPU port in the first place is that it doesn't work correctly when packets are trapped to the CPU and then forwarded by the CPU to other ports. In that case, the switch would incorrectly learn the CPU port as source. An example that triggered this issue are Multicast Listener Reports and IGMP membership reports. Signed-off-by: Jan Hoffmann <jan@3e8.eu>
* realtek: enable needs_standalone_vlan_filtering on DSA driver in 5.15INAGAKI Hiroshi2022-12-151-0/+1
| | | | | | | To configure VLAN 0, enable needs_standalone_vlan_filtering option of dsa_switch struct. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
* realtek: update dsa.c of DSA driver for 5.15INAGAKI Hiroshi2022-12-151-101/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - rtl83xx_vlan_filtering() "struct switchdev_trans *trans" parameter was removed[1] and "struct netlink_ext_ack *extack" was added[2]. [1]: https://www.spinics.net/lists/netdev/msg712250.html [2]: https://www.spinics.net/lists/netdev/msg722496.html - rtl83xx_vlan_add/del() vlan->vid_begin and vlan->vid_end were removed and vlan->vid was added[3]. [3]: https://www.spinics.net/lists/netdev/msg712248.html - rtl83xx_vlan_prepare() "port_vlan_prepare" member was removed from "dsa_switch_ops" struct in dsa.h[4] and vlan_prepare function should be called from vlan_add function. Also, change return type of vlan_add function to int. [4]: https://www.spinics.net/lists/netdev/msg712252.html - rtl83xx_port_mdb_add() "port_mdb_prepare" member in "dsa_switch_ops" struct was removed and preparation need to be done in the function of "port_mdb_add" member instead. And also, int type need to be returned on "port_mdb_add" member[5]. [5]: https://www.spinics.net/lists/netdev/msg712251.html - rtl83xx_port_pre_bridge_flags(), rtl83xx_port_bridge_flags() The current "port_pre_bridge_flags" member and "port_bridge_flags" member in "dsa_switch_ops" in dsa.h has flags of "struct switchdev_brport_flags" type instead[6], so adjust to it. And, the changed features are passed by flags.mask[7] in rtl83xx_port_bridge_flags(), so check it before calling function to enable/disable fieature. [6]: https://lore.kernel.org/lkml/20210212151600.3357121-7-olteanv@gmail.com/ [7]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e18f4c18ab5b0dd47caaf8377c2e36d66f632a8c Suggested-by: Markus Stockhausen <markus.stockhausen@gmx.de> Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> [shorten final return statement of rtl83xx_port_mdb_add()] Signed-off-by: Sander Vanheule <sander@svanheule.net>
* realtek: copy dts/files/patches/configs for 5.15INAGAKI Hiroshi2022-12-1528-0/+24942
Copy dts/files/patches/configs from 5.10 to 5.15. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> [refresh with updated DGS-1210 dts files] Signed-off-by: Sander Vanheule <sander@svanheule.net>