Commit Graph

621 Commits

Author SHA1 Message Date
John Audia
a34255b795 kernel: bump 5.15 to 5.15.75
Removed upstreamed:
   bcm27xx/patches-5.15/950-0446-drm-vc4-Fix-timings-for-VEC-modes.patch[1]

Manually rebased:
   patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch
   bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch
   bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch
   bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch

All other patches automatically rebased

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.75&id=2810061452f9b748b096ad023d318690ca519aa3

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-10-30 17:54:59 +01:00
Chukun Pan
641e4f2f04 mediatek: add Xiaomi Redmi Router AX6000 support
Hardware specification:
  SoC: MediaTek MT7986A 4x A53
  Flash: ESMT F50L1G41LB 128 MB
  RAM: K4A4G165WF-BCWE 512 MB
  Ethernet: 4x 10/100/1000 Mbps
  WiFi1: MT7976GN 2.4GHz ax 4x4
  WiFi2: MT7976AN 5GHz ax 4x4
  Button: Mesh, Reset

Flash instructions:
  1. Gain ssh and serial port access, see the link below:
     https://openwrt.org/toh/xiaomi/redmi_ax6000#installation
  2. Use ssh or serial port to log in to the router, and
     execute the following command:
     nvram set boot_wait=on
     nvram set flag_boot_rootfs=0
     nvram set flag_boot_success=1
     nvram set flag_last_success=1
     nvram set flag_try_sys1_failed=8
     nvram set flag_try_sys2_failed=8
     nvram commit
  3. Set a static ip on the ethernet interface of your computer
     (e.g. default: ip 192.168.31.100, gateway 192.168.31.1)
  4. Download the initramfs image, rename it to initramfs.bin,
     and host it with the tftp server.
  5. Interrupt U-Boot and run these commands:
     setenv mtdparts nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),112640k(ubi)
     saveenv
     tftpboot initramfs.bin
     bootm
  6. After openwrt boots up, use scp or luci web
     to upload sysupgrade.bin to upgrade.

Revert to stock firmware:
  Restore mtdparts back to default, then use the
  vendor's recovery tool (Windows only).

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2022-10-30 14:30:22 +00:00
Aleksander Jan Bajkowski
9226f1e419
kernel: disable CONFIG_CPU_LITTLE_ENDIAN in generic config
Endianness depends on CPU architecture. CONFIG_CPU_(BIG/LITTLE)_ENDIAN should
be enabled on target or subtarget based on SoC architecture.

Fixes warning:
$ make kernel_oldconfig CONFIG_TARGET=subtarget
...
.config:1008:warning: override: CPU_LITTLE_ENDIAN changes choice state
....

Summary:
- ARC - only the CONFIG_CPU_BIG_ENDIAN symbol is defined for this architeture.
  If it is disabled then the processor operates in LITTLE_ENDIAN mode (default),
- ARM32 - CONFIG_CPU_LITTLE_ENDIAN symbol available since kernel 5.19. This
  option should be enabled after OpenWRT moves to kernel 6.x. After refreshing
  the kernel, the symbol disappears,
- ARM64 - enabled CONFIG_CPU_LITTLE_ENDIAN,
- MIPS - enabled relevant symbols,
- POWERPC -  enabled CONFIG_CPU_BIG_ENDIAN,
- UML - Symbols are not defined for this architecture,
- X86 - always little endian. Symbols are not defined for this architecture.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
2022-10-21 13:47:01 +02:00
Daniel Golle
c15e7e2910
mediatek: filogic: consolidate adc '32k' clock
Add dependency to '32k' ADC clock so it is always enabled for thermal
and raw access to ADC values. This allows to remove the patch for the
ADC driver and reduce the patch adding thermal support for MT7986 to
only add the new efuse layout and temperature decoding for V3.

Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-20 20:37:50 +01:00
John Audia
b1cc4eac1b
mt7622: switch default CPU governor to ondemand
The most common CPU governor in the OpenWRT project is currently ondemand (see
below).  Switch mt7622 over to it as well.

Audit the code by running the following and then analyzing the results:
find -name 'config-5.*' -print0 | xargs -0 grep 'CONFIG_CPU_FREQ_DEFAULT_GOV.*=y'

ondemand: 16
performance: 5
schedutil: 5
userspace: 2

Build system: x86_64
Build-tested: ramips/mt7621

Signed-off-by: John Audia <graysky@archlinux.us>
2022-10-20 00:44:53 +02:00
Daniel Golle
f2ae4e2f8c
mediatek: clean up platform kernel modules
Remove kmod-sdhci-mtk as the mtk-sd driver is built-in anyway for the
relevant subtargets in order to support mounting rootfs from eMMC or
SD card.

Add kmod-iio-mt6577-auxadc to support reading the raw values from the
auxadc unit used as in-SoC thermal sensor. This driver was previously
built-in, but as thermal itself works well without it there is no use
for it in every day use of a device. Build the module to still allow
access to the raw values for those who need it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-19 23:20:48 +01:00
Daniel Golle
d640cbac0e
mediatek: mt7622: don't rely on existing image for sysupgrade
Don't reply on mapped rootfs partition but rather just take what ever
has been set to the kernel cmdline root= parameter as a hint to decide
which media to install sysupgrade to on the BananaPi BPi-R64.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-19 20:05:17 +01:00
Daniel Golle
a97991fbeb
mediatek: mt7622: kernel config fixes
* remove orphaned Kconfig symbol now that CONFIG_IIO is no longer
   selected after commit ef8b935c95 ("mediatek: clean up mt7622 kernel config")

 * select UBI fast-map feature to decrease boot time and keep the
   number of spare blocks required in sync with U-Boot's expectations
   (we got fast-map enabled in U-Boot)

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-19 20:05:12 +01:00
Daniel Golle
dca5bf6d53
mediatek: update pending and rename merged patch
Add patch headers and description for pending patch.
Add version tag to patch already merged upstream.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-19 20:05:01 +01:00
Daniel Golle
de94587e70
mediatek: filogic: don't rely on image preset in flash or sysupgrade
Instead of trying to figure out the actual root device, just use the
kernel 'root' cmdline parameter as a hint to decide which device to
flash to.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-18 20:08:47 +01:00
Daniel Golle
51ee5fb274
mediatek: filogic: use UBI fast map to speed up boot
Use UBI fast map feature to avoid scanning the whole flash on each
boot which takes several seconds.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-18 20:08:30 +01:00
Daniel Golle
b00640bd06
mediatek: don't break auxadc without 32k clk
Make the newly added 32k clock optional for the auxadc driver also used
on pre-filogic platforms.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-18 20:08:25 +01:00
Bruno Umuarama
85ae64bb27
mediatek: mt7623: fix thermal zone
Raising the temperatures for passive and active trips. @VA1DER
proposed at issue 9396 to remove passive trip. This commit relates to
his suggestion.

Without this patch. the CPU will be throttled all the way down to 98MHz
if the temperature rises even a degree above the trip point, and it was
further discovered that if the internal temperature of the device is
above the first trip point temperature when it boots then it will start
in a throttled state and even
$ echo disabled > /sys/class/thermal/thermal_zone0/mode
will have no effect.

The patch increases the passive trip point and active cooling map. The
throttling temperature will then be at 77°C and 82°C, which is still a
low enough temperature for ARM devices to not be in the real danger
zone, and gives some operational headroom.

Signed-off-by: Bruno Umuarama <anonimou_eu@hotmail.com>
2022-10-14 14:44:37 +02:00
Felix Fietkau
ef8b935c95 mediatek: clean up mt7622 kernel config
Remove a few unused options to reduce kernel size

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-10-14 13:16:16 +02:00
Felix Fietkau
9995dd2543 kernel: remove target specific CONFIG_IKCONFIG lines
Use generic configuration for this feature

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-10-14 13:15:47 +02:00
Felix Fietkau
34054e4c06 mediatek: fill wlan device entries in board.json on mt7622
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-10-14 13:13:49 +02:00
Daniel Golle
88eae0f036
mediatek: filogic: set correct PWM clock and clean thermal zone
* set correct clocks for PWM to work.
 * MT7986 PWM does have the 26MHz-clock-select, set that in patch
 * drop useless 'passive' trip point in thermal zone
 * extend pwm-fan to have 3 active operating points
 * set reasonable trip points in thermal zone
 * invert pwm-fan operating points and set shorter period to allow
   less noisy operation of the PWM fan of the BPi-R3.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-09 16:41:16 +01:00
Daniel Golle
f38276c9be mediatek: filogic: enable thermal, I2C and PWM of the BPi-R3
Setup thermal zone, select pins and enabled drivers for I2C (on 26-pin
GPIO bank) and PWM (1x fan and 1x GPIO bank).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-07 16:45:10 +01:00
Daniel Golle
5d921aa72f mediatek: filogic: add support for hw i2c, pwm and thermal
Add support for hardware I2C and PWM units found in the Filogic SoCs
as well as the CPU thermal support.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-07 16:45:10 +01:00
Daniel Golle
0419f7dead mediatek: add support t-phy settings from efuse on MT7986
Import patches from mtk-openwrt-feeds (MTK SDK) to support reading
t-phy settings affecting PCIe as well as USB2 and USB3 from efuse.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-30 13:29:58 +01:00
Daniel Golle
b18b5a7ca3 mediatek: filogic: add efuse layout to mt7986a.dtsi
efuse is used to store board-specific settings of some of the in-SoC
peripherals. Add it to device tree, so it gets probed on boot and can
be accessed by other drivers.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-30 13:29:58 +01:00
Daniel Golle
243a2184f2 mediatek: add patch allowing 1-byte wide access to efuse
Allow byte-wise access to mtk-efuse as some drivers require that.
Patch imported from mtk-openwrt-feeds (MTK SDK).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-30 13:29:58 +01:00
Felix Fietkau
4363faef8a kernel: move ubnt ledbar driver to a separate package
Simplifies the tree by removing a non-upstream kernel patch and related kconfig
symbols

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-30 11:28:51 +02:00
Hauke Mehrtens
f08f7e88c9 kernel: Move some IOMMU options to generic
This adds some missing IOMMU related options for x86/64 and moves some
of them to generic for all targets.

On x86 IOMMU_DEFAULT_DMA_LAZY is used by default, on all other platforms
IOMMU_DEFAULT_DMA_STRICT is the default. we just follow the default
kernel configuration here.

Fixes: 8fea4a102c ("x86/64: enable IOMMU support")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2022-09-24 13:49:47 +02:00
Daniel Golle
c93c5365c0
kernel: pick patches for MediaTek Ethernet from linux-next
Pick patches with several fixes and improvements, preparation for
upcoming WED (TX) [1] as well as basic XDP support [2] with MediaTek's
Filogic SoCs to the mtk_eth_soc driver.

Also pick follow-up patch fixing Ethernet on MT7621 [3].

Tested on Bananapi BPi-R3 (MT7986), Bananapi BPi-R64 (MT7622),
Bananapi BPi-R2 (MT7623), MikroTik RouterBoard M11G (MT7621).

[1]: https://patchwork.kernel.org/project/netdevbpf/list/?series=662108&state=*
[2]: https://patchwork.kernel.org/project/netdevbpf/list/?series=675368&state=*
     (the first part of the series adding wed nodes to mt7986a.dtsi was
      applied to the copy of mt7986a.dtsi in our tree)
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=5e69163d3b9931098922b3fc2f8e786af8c1f37e

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-22 23:55:02 +01:00
Stijn Tintel
117f41ee95 mediatek: fix Unifi 6LR network config
When the v1 and v2 variants of the U6LR were introduced, the board
network config was not adapted to the new device names. Due to this, the
wrong network config is applied during initial boot. The resulting
config has lan, wan and a switch, while this device only has a single
ethernet interface without a switch.

Fix this by using a wildcard that matches all the variants.

Fixes: 15a02471bb ("mediatek: new target mt7622-ubnt-unifi-6-lr-v1")
Fixes: 5c8d3893a7 ("mediatek: new target ubnt_unifi-6-lr-v1-ubootmod")
Fixes: 31d86a1a11 ("mediatek: add Ubiquiti UniFi 6 LR v2 targets")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Daniel Golle <daniel@makrotopia.org>
2022-09-20 22:07:59 +03:00
John Audia
fe209fa47d kernel: bump 5.15 to 5.15.68
All patches automatically rebased

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-09-17 14:16:37 +02:00
Daniel Golle
8010d3da03 mediatek: build USB XHCI support as module
Instead of always including the XHCI driver in the kernel on all
MediaTek boards, selectively include the kernel module only on boards
which actually make use of USB functionality.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-14 20:26:58 +01:00
Daniel Golle
a46e91e8a1 mediatek: unset CONFIG_CMDLINE_OVERRIDE for all targets but mt7629
The newly introduced config symbol CONFIG_CMDLINE_OVERRIDE is only set
for mt7629 for now which breaks automated build on all other mediatek
subtargets. Make sure the symbol is configured as 'is not set' for all
remaining subtargets.

Fixes: c27279dc26 ("mediatek: add support for ipTIME A6004MX Add basic support for ipTIME A6004MX.")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-12 14:10:26 +01:00
Yoonji Park
c27279dc26 mediatek: add support for ipTIME A6004MX Add basic support for ipTIME A6004MX.
Hardware:
SoC: MediaTek MT7629 Cortex-A7 (ARMv7 1.25GHz, Dual-Core)
RAM: DDR3 128MB
Flash: Macronix MX35LF1GE4AB (SPI-NAND 128MB)
WiFi: MediaTek MT7761N (2.4GHz) / MediaTek MT7762N (5GHz) - no driver
Ethernet: SoC (WAN) / MediaTek MT7531 (LAN x4)
UART: [GND, RX, TX, 3.3V] (115200)

Installation:
- Flash recovery image with TFTP recovery

Revert to stock firmware:
- Flash stock firmware with TFTP recovery

TFTP Recovery method:
1. Unplug the router
2. Hold the reset button and plug in
3. Release when the power LED stops flashing and go off
4. Set your computer IP address manually to 192.168.0.x / 255.255.255.0
5. Flash image with TFTP client to 192.168.0.1

Signed-off-by: Yoonji Park <koreapyj@dcmys.kr>
2022-09-12 01:43:49 +01:00
Shiji Yang
60384d8a74 mediatek: disable unsupported background radar detection
MT7915 requires an additional antenna for background radar scanning.
Disable this feature in the following devices that do not have a
separate DFS antenna:
  linksys,e8450
  ruijie,rg-ew3200gx-pro
  xiaomi,redmi-router-ax6s

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2022-09-12 00:14:02 +01:00
Daniel Golle
0b5cf952cf mediatek: fix ledbar of UniFi 6 LR when running custom U-Boot
The RGB LED of the UniFi 6 LR v1 doesn't work when using the Openwrt-
built U-Boot. This is because the vendor loader resets the ledbar
controller while our U-Boot doesn't care.
Add reset-gpio so the ledbar driver in Linux will always reset the
ledbar controller.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-11 20:26:42 +01:00
Sven Wegener
53fc987b25 generic: move ledbar driver from mediatek target
This moves the ledbar driver to generic, to be also used by the ramips target.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:42 +01:00
Sven Wegener
76198e8f09 mediatek: add led count
The LEDs connected to the MCU are so-called smart LEDs and their signal is
daisy-chained. Because of this, the MCU needs to be told how many LEDs are
connected. It also means the LEDs could be individually controlled, if the MCU
has a command for this.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:42 +01:00
Sven Wegener
013a956f08 mediatek: add initialization after reset
During GPIO initialization the pin state flips and triggers a reset of
the ledbar MCU. It needs to be moved through an initialization sequence
before working correctly.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:42 +01:00
Sven Wegener
84e4bbf5f0 mediatek: add support for reset gpio
Some versions of the ledbar MCU have a reset pin. It needs to be
correctly initialized or we might keep the MCU in reset state.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:42 +01:00
Sven Wegener
7c852e7df5 mediatek: support reading more than one byte of response
There are commands that return more than one byte of response.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:41 +01:00
Sven Wegener
e9a22ce253 mediatek: cast literal value to char
Or the comparison against a signed char is always true, because the
literal 0xaa is treated as an unsigned int, to which the signed char is
casted during comparison. 0xaa is above the positive values of a signed
char and negative signed char values result in values larger than 0xaa
when casted to unsigned int.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:41 +01:00
Sven Wegener
c4f9f9b44c mediatek: correctly log i2c response
The read response is in the i2c_response variable. Also use %hhx format,
because we're dealing with a single char.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:41 +01:00
Sven Wegener
a188356484 mediatek: remove gpiod_direction_output()
It's already set to output with GPIOD_OUT_LOW.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:41 +01:00
Sven Wegener
56c2d15587 mediatek: do not use gpiod_set_raw_value()
The polarity of the signal is set in the device dts.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:41 +01:00
Daniel Golle
f7dbdcfa54 mediatek: filogic: use WPS button instead of RST on BPi-R3
The GPIO used for the RST button is also used for PCIe-CLKREQ signal.
Hence it cannot be used as button signal if PCIe is also used.
Wire up WPS button to serve as KEY_RESTART in Linux and "reset" button
in U-Boot.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-10 19:20:26 +01:00
Daniel Golle
a34cd4f66a mediatek: bananapi-r3: remove kmod-btmtkuart from default packages
The package kmod-btmtkuart is specific for MT7622 and isn't available
for MT7986 (which doesn't have this built-in Bluetooth like MT7622).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-10 03:23:20 +01:00
Daniel Golle
f97fbd8a9a mediatek: rename some patches
To ease maintainance rename patches to contain the kernel version they
have first been part of.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-09 21:08:37 +01:00
Chukun Pan
c91dd139d6 mediatek: 5.15: add missing patch suffix
The 213 patch is missing filename suffix. Fix it.

Fixes: dabcaac ("mediatek: add mt7986 soc support to the target")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2022-09-09 21:08:37 +01:00
Chukun Pan
a9233175e8 mediatek: mt7986a/b-rfb: fix 02_network setup
According to the device tree, the lan ports are
lan0 to lan3, and the wan port is eth1.

Fixes: cffc77a ("mediatek: add filogic subtarget")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2022-09-09 21:08:37 +01:00
Daniel Golle
007c8809c1 mediatek: fix typo in bpi-r64 image recipe
Janusz Dziedzic reported a typo introduced by a recent commit. Fix it.

Fixes: 50c892d67b ("mediatek: bpi-r64: make initramfs/recovery optional")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-08 19:30:56 +01:00
Daniel Golle
50c892d67b mediatek: bpi-r64: make initramfs/recovery optional
Only include recovery image in SD card image generated for the
BananaPi BPi-R64 if building with CONFIG_TARGET_ROOTFS_INITRAMFS
This allows to build images larger than 32 MB (the limit for
initramfs/recovery image) by deselecting initramfs.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-08 02:51:11 +01:00
Daniel Golle
1a6f6a1e8c mediatek: bpi-r3: make initramfs/recovery optional
Only include recovery image in SD card image generated for the
BananaPi BPi-R3 if building with CONFIG_TARGET_ROOTFS_INITRAMFS.
This allows to build images larger than 32 MB (the limit for
initramfs/recovery image) by deselecting initramfs.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-08 02:51:11 +01:00
Daniel Golle
3df72f6928 mediatek: remove redundant patch
The patch 921-mt7986-add-mmc-support.patch introduced by commit
dabcaac443 ("mediatek: add mt7986 soc support to the target") has never
been applied in a way that it would have any effect as it actually
created a file target/linux/generic/patches-5.15/... in the kernel tree
and was probably a patch intended to be applied to openwrt.git instead
of being put into kernel patches folder as a file.

As an upstream commit from vanilla Linux also adding support for MT7986
to the mtk-sd driver has already been included we can remove that old
patch.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-07 04:27:41 +01:00