Add a new SerDes operation for restarting in-band negotiation including
an implemenation for RTL93xx, and call it from .pcs_an_restart.
This is a prerequisite for configuration of the in-band advertisement,
as changing it requires triggering a restart of auto-negotiation.
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Link: https://github.com/openwrt/openwrt/pull/21869
Signed-off-by: Robert Marko <robimarko@gmail.com>
Commit 78bf3a5f44 ("realtek: dsa: Fix rate control initialization") enabled
code setting up the "storm control" feature. This casued a speed regression
on rtl838x, reducing the effective max speed per port from line rate to around
500 Mbits/s.
Storm control is a policy feature with a number of input parameters depending
on use case and environment. It is not possible to define a meaningful static
policy in the driver. The problem isn't just the arbitrary limits in the
current code. Such features require userspace interfaces.
Drop this code for now. It wasn't missed while it was disabled.
Cc: Sven Eckelmann <se@simonwunderlich.de>
Fixes: 78bf3a5f44 ("realtek: dsa: Fix rate control initialization")
Link: https://github.com/openwrt/openwrt/issues/21692
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Link: https://github.com/openwrt/openwrt/pull/21877
Signed-off-by: Robert Marko <robimarko@gmail.com>
Replace the following pending patches which have now been merged in
kernel v6.20:
- arm64: dts: qcom: ipq5018: Remove tsens v1 fallback compatible
- clk: qcom: gcc-ipq5018: flag sleep clock as critical
- arm64: dts: qcom: ipq5018: Correct USB DWC3 wrapper interrupts
Signed-off-by: George Moussalem <george.moussalem@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/21883
Signed-off-by: Robert Marko <robimarko@gmail.com>
Update PWM patch set to v20 which resolves some bugs related to the
duty cycle / frequency calculation; and add missing config symbol
CONFIG_PWM.
Fixes: #21727
Signed-off-by: Kenneth Kasilag <kenneth@kasilag.me>
Link: https://github.com/openwrt/openwrt/pull/21889
Signed-off-by: Robert Marko <robimarko@gmail.com>
Uninitialized memory led to bogus, huge timestamps being set on files
downloaded with the wget backend. This caused odd issues like 'ls -l'
crashing busybox when attempting to list the .apk file afterwards.
Link: 42f159e67b
Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
Link: https://github.com/openwrt/openwrt/pull/21874
Signed-off-by: Robert Marko <robimarko@gmail.com>
DSA tagging currently works with a tuned trailer tagging. That means:
- realtek target uses tag_trailer for tagging
- there is a patch for the trailer tagger to write the target port not
as a bitfield but as an integer
Make the tagging independent from upstream and hacky patches by providing
a new downstream driver. This can be aligned easier for future development.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21815
Signed-off-by: Robert Marko <robimarko@gmail.com>
The SoC specific configuration structure is currently manually
assigned depending on the family_id. This will be removed in
the future. Make use of device_get_match_data() instead.
While we are here rename the structure prefix.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21866
Signed-off-by: Robert Marko <robimarko@gmail.com>
Bit 15 of the rtl838x SMI_GLB_CTRL register is set early during mdio reset
and never cleared. There is no need to set it again.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Link: https://github.com/openwrt/openwrt/pull/21868
Signed-off-by: Robert Marko <robimarko@gmail.com>
Commit 17f12695d0 ("realtek: mdio: rtl838x: activate combo PHY media detection")
dropped setting bit 15 of the SMI_GLB_CTRL register without any explanation. This
broke the Netgear GS108Tv3, causing phy patching to fail:
Firmware loaded. Size 1184, magic: 83808380
Realtek RTL8218B (internal) 1b000000.switchcore:mdio-controller-mii:08: patch
Realtek RTL8218B (internal) 1b000000.switchcore:mdio-controller-mii:08: package not ready for patch.
Realtek RTL8218B (internal) 1b000000.switchcore:mdio-controller-mii:0f: probe with driver Realtek RTL8218B (internal) failed with error -5
None of the internal phys was able to detect a link after this error.
Some rtl8380 devices, like the Zyxel GS1900-10HP A1, were not affected by the bug
because their boot loader always sets bit 15. The bug could also be worked around
on affected devices by running "rtk network on" before booting OpenWrt, setting
bit 15 as a side effect.
Cc: Markus Stockhausen <markus.stockhausen@gmx.de>
Cc: Robert Marko <robimarko@gmail.com>
Fixes: 17f12695d0 ("realtek: mdio: rtl838x: activate combo PHY media detection")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Link: https://github.com/openwrt/openwrt/pull/21868
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit increases the SPI bus frequency from 20 to 52 MHz. Reduces boot
time by 2s. Below is a performance comparison.
spi-max-frequency = <20000000>
> time dd if=/dev/mtd4 of=/dev/null bs=10M count=1
> 1+0 records in
> 1+0 records out
> real 0m 1.86s
> user 0m 0.00s
> sys 0m 0.28s
spi-max-frequency = <52000000>
> time dd if=/dev/mtd4 of=/dev/null bs=10M count=1
> 1+0 records in
> 1+0 records out
> real 0m 1.04s
> user 0m 0.00s
> sys 0m 0.27s
Signed-off-by: st7105 <st7105@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21802
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The internal RTL8218B gets detected cleanly. No need for
additional checks of the bus address or the SoC type.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21857
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Add everything that's needed to have a standalone setup of the XSGMII
mode without having to rely on previous U-boot setup. This includes
patch sequences for the SerDes and extensions of symbol error reset and
reading.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21762
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The XSGMII mode is special in several regards. The inband
autonegotiation for this mode is called 'XSG N-way'. It is controlled
using different bits and location, and using XSG operations.
Add support for this by enhancing the set_autoneg implementation shared
by RTL930x and RTL931x. This can stay shared since it works the same for
both variants.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21762
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Instead of having all kinds of SerDes-related operations in the global
pcs config structure, there's now a SerDes ops structure which is
intended to cover and separate this.
Move the set_autoneg hook to the SerDes ops to adhere to this desired
separation. Calling the operation is further encapsulated with a small
convenience helper.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21762
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Though most Macronix Flash support the lock feature, the generic lock
implementation is not fully compatible with the Macronix series Flash.
Enabling the lock feature globally is unsafe. These hack patches are
used to unlock the Flash of ubnt devices on the ath79 target. Rework
these patches and move it to the ath79 target to prevent the potential
risk.
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/21754
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This header is deprecated and typically platform_device.h should be
used.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21164
[Adapted the lantiq patches a bit]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It's not the proper one. No of_platform_ APIs are being used.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21164
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This introduces support for the SkyHigh S35ML-3 series SPI NAND flash
devices by importing two key patches:
- 430-v6.14-mtd-spinand-Introduce-a-way-to-avoid-raw-access.patch
- 431-v6.14-mtd-spinand-Add-support-for-SkyHigh-S35ML-3-family.patch
Additionally, refresh all existing patches.
Co-authored-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Signed-off-by: Rongzeng Cai <cairongzeng@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/21808
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This is patch is identical in form and purpose as the IB-4220-B
patch. We switch over to a single "firmware" partition.
All reference design-based machines are now converted and we can
drop the legacy set-up code.
It turns out that the reference design also uses the flash layout
with a 3072KB kernel so augment the sysupgrade to do the right
thing also here.
Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
This is patch is identical in form and purpose as the IB-4220-B
patch. We switch over to a single "firmware" partition.
Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
To optimize the flash usage and to make firmware upgrades
simpler, catenate the three firmware partitions "Kern",
"Ramdisk" and "Application" into one, and use all of this
for the combined MTD-splitted kernel+rootfs.
This works fine as long as the kernel is placed in the
beginning of this firmware partition and we leave the
RedBoot partition as is, so the boot loader still can load
the kernel from the first two RedBoot partitions.
Using the RedBoot partitions "as is" can be considered
harmful, because when you flash to a RedBoot partition the
file size is used for downsizing of the partition and make
firmware upgrades fail if they are larger than the RedBoot
partition size after flashing, despite there is actually
flash there. So overriding with fixed partitions is just
generally a good idea.
Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
The problem is the following: we have three fixed partitions
in a RedBoot partition for kernel, initrd and rootfs. On the
surface this looks good.
But we have little flash and want to use it efficiently. We want
to use the OpenWrt "firmware" partition scheme where the kernel,
initramfs and sqashfs+jffs2 rootfs is appended, leaving maximum
space for a writeable rootfs.
To do this we will override the existing RedBoot partition table
with one that merges the three separate partitions into one
"firmware" partition.
RedBoot is still booting the system. It still needs to read the
first two parts "as if" these were the kernel and initrd. This
works fine, because the kernel still comes first.
We already have hacks in place to merge the two kernel and initrd
into one binary image and execute it. This is done by prepending
a "prolog" to the kernel that does the necessary copying in
memory and then jumps to execute the kernel.
Since this "prolog" copying routine is just 92 bytes but has 512
bytes allocated, we can trivially create a firmware format that
can be used for splitting the image into kernel and rootfs
using a tagging scheme that can be done directly by scripting
so we don't need any special binary programs.
This splitter implements that idea.
This will be used on the Gemini platform and was tested on the
Raidsonic IB-4220-B.
Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
follow-up to 148207730a
Schoolboy error on the peer_psk value.
Also fix an issue when joining peer IPv4 and IPv6 AllowedIPs
(${peer_a_ips/ /, } replaces only the first space, while
${peer_a_ips// /, } replaces all the spaces).
Closes: https://github.com/openwrt/openwrt/issues/21847
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21851
Signed-off-by: Robert Marko <robimarko@gmail.com>
Do not derive the number of hardware receive rings from the SoC
family. Instead add the information to the configuration
structure. Make use of it during ethernet driver probing.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21706
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit fixes non-working USB port:
---
[ 5.294036] xhci-mtk 11200000.usb: error -EPERM: Failed to get supply 'vbus'
[ 5.301163] xhci-mtk 11200000.usb: error -EPERM: Failed to get regulators
[ 5.307938] xhci-mtk 11200000.usb: probe with driver xhci-mtk failed with error -1
---
While testing the USB power on/off functionality during the previous
commit, I didn't sufficiently test the actual operation of the USB
devices.
Fixes: ff5e66a920 ("mediatek: add support for Routerich BE7200")
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21795
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
For packets trapped to the CPU for a special reason (not normal
forward), the RTL931x tag decoding always print a log message with level
INFO. This is not needed and just spams the log, e.g. when LLDP packets
are running through the network, each of them causes a log message.
Make that a debug message instead of an info message. We can keep it,
just change when it's printed.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21844
Signed-off-by: Robert Marko <robimarko@gmail.com>
Add a status method to both hostapd and wpa_supplicant ubus objects
that lists all configured interfaces with their wiphy, MAC address,
and running/pending state. For MLO interfaces, links are grouped
under a single entry with per-link status.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Remove the unneeded sw_xxx() macros.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21824
Signed-off-by: Robert Marko <robimarko@gmail.com>
Make use of regmap in the RTL93xx reset functions.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21824
Signed-off-by: Robert Marko <robimarko@gmail.com>
Make use of regmap in RTL83xx reset functions.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21824
Signed-off-by: Robert Marko <robimarko@gmail.com>
Some straight forward conversion ...
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21824
Signed-off-by: Robert Marko <robimarko@gmail.com>
Drop legacy sw_xxx() macros for RTL931x devices. While we are here
reorganize the access and avoid masked access where possible. So the
code is easier to read.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21824
Signed-off-by: Robert Marko <robimarko@gmail.com>
Drop legacy sw_xxx() macros for RTL930x devices. While we are here
reorganize the access and avoid masked access where possible. So the
code is easier to read.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21824
Signed-off-by: Robert Marko <robimarko@gmail.com>
Drop legacy sw_xxx() macros for RTL839x devices. While we are here
reorganize the access and avoid masked access where possible. So the
code is easier to read.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21824
Signed-off-by: Robert Marko <robimarko@gmail.com>
- preserve (active) interface (at reload)
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21784
Signed-off-by: Robert Marko <robimarko@gmail.com>
- no longer write any temporary file for peer gen
- use wg syncconf to update active interfaces (not setconf)
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21784
Signed-off-by: Robert Marko <robimarko@gmail.com>
- no longer write any temporary file for key gen
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21784
Signed-off-by: Robert Marko <robimarko@gmail.com>
Proto handler now also detects changes to
- addresses
Tighten also assign address portion
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21784
Signed-off-by: Robert Marko <robimarko@gmail.com>
Commit 168d5af added the possibility to configure netifd logging level.
The option is read from /etc/config/network and validated.
Supposedly the validation sets 2 as default.
But in case of a syntax error in /etc/config/network, the validation
result can be empty. Then the always passed option to netifd is
just '-l' instead of '-l 2'. That crashes netifd and prevents network
from launching.
Add a fallback value to the variable, so that there will always be
a proper value after the '-l' option.
Improves: 168d5af "netifd: add loglevel config option (fixes#18001)"
Fixes: #21816
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Link: https://github.com/openwrt/openwrt/pull/21819
Signed-off-by: Robert Marko <robimarko@gmail.com>
The D-Link DIR-1360 A1 is an AC1300 router based on the MT7621AT SoC.
Specifications :-
* SoC: MediaTek MT7621AT
* RAM: 256 MB DDR3
* Flash: 128 MB SPI NAND (Winbond W29N01HV)
* WiFi: MT7615D (2.4 GHz + 5 GHz DBDC)
* Ethernet: 5x 10/100/1000 Mbps (1x WAN, 4x LAN)
* USB: 1x USB 3.0
* Buttons: Reset, WPS
* LEDs: Power (White/Orange), Internet (White/Orange), USB, 2.4G/5G WLAN
MAC addresses are retrieved from the 'factory' partition via NVMEM.
LAN: 0xe000 (gmac0)
WAN: 0xe006 (gmac1)
WLAN: 0xe00c (pcie0)
Flash Instruction :-
1-Set a static IP on your PC (e.g., 192.168.0.10, Gateway 192.168.0.1).
2- Power off the router and connect your PC to a LAN port.
3- Hold the Reset button and power on the router; continue holding for 5 seconds.
4- Access the Recovery UI at http://192.168.0.1 in your browser.
5- Upload the OpenWrt factory.bin image and wait for the reboot.
With these definitions in place, the DIR-1360 A1 boots reliably, exposes all hardware features correctly, and can be flashed via both the OEM recovery interface and standard OpenWrt upgrade paths.
Signed-off-by: Aryaman Srivastava <aryamansrivastava895@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21616
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Bc-bocun Chen of MediaTek has discovered a memory leak in the error path
in our downstream patch for mtk_eth_soc which adds support for the 10G
PCS and PHY paths of the MT7988 SoC.
Fix this by freeing the at this point already allocated netdev resources
before returning the error.
Fixes: 4cb6bd9a6d ("mediatek: switch to pending XFI 10G Ethernet drivers")
Reported-by: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>