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>
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>
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>
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>
Increase readability by replacing more numbers and bit operations
with macros in order to give them distinct, expressive names.
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Link: https://github.com/openwrt/openwrt/pull/21786
Signed-off-by: Robert Marko <robimarko@gmail.com>
So far the function prefix rtl83xx_ is used for functions which are
exclusive to RTL8390_FAMILY_ID but also for ones shared between
RTL8390_FAMILY_ID/RTL9300_FAMILY_ID/RTL9310_FAMILY_ID.
For a more fitting, precise use of rtl83xx_ rename the ones in dsa.c
which are also used by RTL9300_FAMILY_ID and RTL9310_FAMILY_ID
to rtldsa_.
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Link: https://github.com/openwrt/openwrt/pull/21786
Signed-off-by: Robert Marko <robimarko@gmail.com>
For the IPv4 unknown multicast flood portmask the first byte should be
for the higher port numbers and the following byte for the lower port
numbers, just like for the L2 unknown multicast flood portmask or the
IPv6 unknown multicast flood portmasks, too. Not the other way around.
Fix the debug output here by adjusting the offsets accordingly.
Fixes: 27029277f9 ("realtek: add switch driver support for the RTL93XX based switches")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Link: https://github.com/openwrt/openwrt/pull/21786
Signed-off-by: Robert Marko <robimarko@gmail.com>
Avoid to reconfigure a SerDes when it has been configured for a mode
before. This usually applies to switches which drive multiple ports on a
single SerDes. For those, the phylink subsystem triggers PCS
configuration everytime although it's a single SerDes. For example, on
switches with XSGMII-connected RTL8218D the particular SerDes is
configured eight times but only a single run is needed.
Add a proper check to pcs_config which checks the mode stored in the
SerDes instance against the requested mode. Other 'settings' should be
executed though, e.g. setting autoneg. While at it, drop the check if
there is a 'setup_serdes' implementation. It's just a driver-internal
interface and all variants implement this now.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21763
Signed-off-by: Robert Marko <robimarko@gmail.com>
All variant-specific setup_serdes functions currently make equal use of
the mapping from the interface mode to the hardware mode. To reduce
redundancy, move this mapping to the generic pcs_config, from where the
setup_serdes implementations are called.
This includes slightly changing the setup_serdes signature and some
debug messages.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21763
Signed-off-by: Robert Marko <robimarko@gmail.com>
The linux kernel printk has a MAC address specifier `%pM` that can be
used to pretty-print MAC addresses. We should use this specifier when
printing MAC addresses for humans since that ensure the appearance that
people are used to.
Fixes#21796
Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21812
Signed-off-by: Robert Marko <robimarko@gmail.com>
"features" describes the currently active device options and
"hw_features" describes all possible ones. So hw_features must
be a superset of features. Fix that.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
Remove all old structures and defines that are no longer needed.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
Provide a new transmit function. It is cleaner and closer to
upstream than what we have now. The basic features are:
- Avoid memory moving and keep data in the SKBs
- Only protect really critcal parts by a lock as transmit
queues will be only called once by the kernel
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
The operating system has enough features to control the transmit
queues. There is no need to provide a hard coded distribution
function. Especially differentiating between a round robin for
RTL83xx and high/low priority for RTL93xx makes no sense. All
devices have the same low/high priority queues.
Simply present two "generic" queues to the kernel.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
The ethernet driver will get a new transmit function. As a first
step add the required structures and initialize them.
To get an idea: In the future the transmit buffer will hold only
the needed packet header information. The real data is kept in the
SKBs. So only pointers will be changed and memory moving can be
avoided. The SoC will transfer packet data directly from the SKBs.
Additionally a new transmit lock will be established that is
separated from the current driver lock. This is only needed
to guard the "kick-the-engine" command. So contention of the old
global lock can be reduced.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
Ethernet transmit handling processes data synchronously via a
packet buffer. As soon as it kicks the SoC to send the packet
no more post processing is needed. Especially there is no need
for transmit completion interrupts. Disable them to reduce the
CPU load.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
The u-boot-env partition on the Zyxel P-2812HNU-F1 is 128 KiB but
the actual environment data is only 8 KiB (0x2000 bytes). Without
the env-size property, the u-boot,env nvmem layout driver assumes
env-size equals the full partition size and computes an incorrect
CRC32 over the entire 128 KiB, causing all nvmem cell reads to fail
silently.
Add env-size = <0x2000> so the CRC32 is computed over the correct
8 KiB region, allowing nvmem-cells (such as ethaddr) to be read
properly by the kernel.
Signed-off-by: Burak Aydos <byhexadecimal@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21780
Signed-off-by: Robert Marko <robimarko@gmail.com>
Drop legacy sw_xxx() macros for rtl838x devices. While we are here
reorganize the access and aovid 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/21741
Signed-off-by: Robert Marko <robimarko@gmail.com>
As a first step convert the central run command over to regmap.
Additional info: The command masks where changed because
sw_xxx() dont care about the to be set or to be cleared bits
(aka mask). In regmap the mask must always be a superset of the
to be set bits.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21741
Signed-off-by: Robert Marko <robimarko@gmail.com>
To make use of regmap in the command function adapt its signature
so it has access to the control structure via the bus.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21741
Signed-off-by: Robert Marko <robimarko@gmail.com>
For regmap conversion the read/write functions need access to the
control structure (aka bus->priv). Add the bus to the parameters list.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21741
Signed-off-by: Robert Marko <robimarko@gmail.com>
To convert the existing sw_xxx() commands the bus needs a regmap.
This is derived from the parent mfd node like in all other Realtek
drivers.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21741
Signed-off-by: Robert Marko <robimarko@gmail.com>
Port 21 definition was missed during addition of LGS328C.
Add it to the dts.
Fixes: 853d73f ("realtek: add support for Linksys LGS328C")
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21793
Signed-off-by: Robert Marko <robimarko@gmail.com>
The firmware update file can get big, so instead of extracting
the whole file into the tmp folder potentially running out of space
and make the upgrade fail, stream from tar xvf -O directly to the
mtd write command.
Refactor the checking of partitions and the actual upgrade into
two steps when we are at it.
Link: https://github.com/openwrt/openwrt/pull/21782
Signed-off-by: Linus Walleij <linusw@kernel.org>
Part of the phy patch process breaks functionality on non-Realtek
platforms. Only apply this on Realtek SoCs to fix functionality
everywhere else.
Signed-off-by: Andrew LaMarche <andrewjlamarche@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21777
Signed-off-by: Robert Marko <robimarko@gmail.com>
In the original userspace implementation, the WAN and DSL interfaces
used the same MAC. Mirror that here.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21081
Signed-off-by: Robert Marko <robimarko@gmail.com>
This adds the pending upstream patches for platform PWM support for qualcommbe
Signed-off-by: Kenneth Kasilag <kenneth@kasilag.me>
Link: https://github.com/openwrt/openwrt/pull/21727
Signed-off-by: Robert Marko <robimarko@gmail.com>
Make sure seq is copied to ramfs during sysupgrade.
Signed-off-by: Milan Krstic <milan.krstic@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21760
Signed-off-by: Robert Marko <robimarko@gmail.com>
Make sure seq is copied to ramfs during sysupgrade.
Signed-off-by: Milan Krstic <milan.krstic@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21760
Signed-off-by: Robert Marko <robimarko@gmail.com>
We don't want kmod-gpio-button-hotplug, we want the more
normal kmod-input-gpio-keys.
Link: https://github.com/openwrt/openwrt/pull/21750
Signed-off-by: Linus Walleij <linusw@kernel.org>
The redboot partition parser gets upset if a partition
doesn't end on an even erase block and marks the partition
read-only.
Fix this by always padding the three firmware items to
128kb.
It is no longer required for the filesystem to be padded
to 6144kb, so we pad this to just 128kb like the kernel
images.
Link: https://github.com/openwrt/openwrt/pull/21750
Signed-off-by: Linus Walleij <linusw@kernel.org>
The Storlink reference designs sometimes fail upgrade because
not the entire partition is used, so the size isn't equal to
the actual flash space available for the partition.
Fix this by calculating the actual partition sizes by measuring
across the partition offsets instead.
Link: https://github.com/openwrt/openwrt/pull/21750
Signed-off-by: Linus Walleij <linusw@kernel.org>
The MT7531 has an incorrect interrupt number described in the DTS.
This commit also adds PHY interrupts. They work the same as on
the MT7988.
Tested on Gemtek W1700k.
Suggested-by: Benjamin Larsson <benjamin.larsson@genexis.eu>
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://github.com/openwrt/openwrt/pull/21016
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>