Commit Graph

25 Commits

Author SHA1 Message Date
Daniel Golle
ada3b2190a mediatek: update driver for MT7988 built-in 2.5G Ethernet PHY
Sync driver for built-in 2.5G Ethernet PHY with MediaTek SDK.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:30:08 +00:00
Daniel Golle
1192554d56 uboot-envtools: filogic: add support for BananaPi R4
Add environment settings for the BananaPi BPI-R4 router board which
can boot from (and store its bootloader environment on) micro SD card,
SPI-NAND and eMMC.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:30:08 +00:00
Daniel Golle
f16dc4b42f mediatek: add support for BananaPi BPI-R4 board
Hardware
--------
SOC:    MediaTek MT7988A (4x Cortex-A73)
RAM:    4 GiB DDR4
Flash:  128 MiB Winbond SPI-NAND
MMC:    8 GiB eMMC *or* microSD (cannot be used both)
ETH:    4x 1GE (1x WAN, 3x LAN)
        2x SFP+ (10G, 5G, 2.5G, 1G)
USB:    on-board USB 3.2 4-port hub
        1x USB 3.2 port (type A connector)
        1x M.2 for 4G/5G modem
        2x mPCIe for additional modems
WiFi:   optional MediaTek MT7996 Wi-Fi 7 module
        (using 2x PCIe gen3 x2 on the mPCIe slots and 12V power)

Installation
------------
1. Decompress and write the sdcard image to a micro SD card and use that
to boot the R4 (both dip switches in upper position).

2. Use the bootloader menu accessible via the serial console to install
to SPI-NAND.

3. Switch to boot from SPI-NAND and install to eMMC.

Known issues
------------
 - The RST button is hard-wired to the SoC reset and can't be read
   from software. This can be changed by modifying the board (ie.
   moving a 0-ohm resistor). However, in order to maintain compatibility
   with the board as it comes from factory the button isn't used by
   OpenWrt and the WPS button is used as factory/reset button instead.

 - various small things still need to be fixed in DT

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:30:08 +00:00
Daniel Golle
bbd49326c5 mediatek: dts: mt7988: add uart1 and uart2
Add device tree nodes for uart1 and uart2 of the MT7988 SoC.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:06:37 +00:00
Daniel Golle
430a96ed0d mediatek: pinctrl-mt7988: add additional uart1_2_lite group
Add UART pinctrl group for using only pins 80 and 81 for uart1.
This is needed on the BPi-R4 as RTS/CTS signals are used for other
on-board functions.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:06:37 +00:00
Daniel Golle
42cf04dd05 mediatek: pinctrl-mt7988: add pinconf map
Add pull-up/pull-down configuration for pins of MT7988.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:06:36 +00:00
Daniel Golle
4cb6bd9a6d mediatek: switch to pending XFI 10G Ethernet drivers
Replace previous patch adding paths and SerDes modes with patch series
pending upstream adding dedicated drivers for XFI T-PHY and USXGMII PCS,
extends LynxI PCS to be a standalone platform driver and as a consequence
makes much less changes to the actual Ethernet driver mtk_eth_soc.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:06:36 +00:00
Daniel Golle
c36de2e73a mediatek: backport a hell of thermal commits
Backport almost 50 commits from upstream Linux to improve thermal
drivers for MediaTek SoCs and add new LVTS driver for MT7988.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:06:36 +00:00
Daniel Golle
d4b4bc98bb mediatek: replace mt7988 clk files with accepted patches
Replace clock drivers for MT7988 with backported upstream commits.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:06:36 +00:00
Rafał Miłecki
efaa26a548 mediatek: filogic: fixup mt7988a DTS coding style
Use coding style as described as preferred in upstream DTS Coding Style.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2024-02-13 12:07:47 +01:00
Rafał Miłecki
518aaa7ce2 mediatek: filogic: reorder mt7988a DTS properties
Use order described as preferred in DTS Coding Style. Mostly just move
"compatible", "reg", "ranges" and "status" properties.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2024-02-13 12:07:42 +01:00
Rafał Miłecki
061a70d33c mediatek: filogic: reorder nodes in mt7988a.dtsi
Use order described as preferred in DTS Coding Style:
1. Sort bus nodes by unit address
2. Use alpha-numerical order for the rest

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2023-12-29 12:41:48 +01:00
Rani Hod
aaeb379023 mediatek: fiilogic: device tree switch@1f fix
Quite a few `fiilogic` devices use the `mt7531` switch.
Some of them have a DT node that looks like:
```
switch: switch@0 {
	compatible = "mediatek,mt7531";
	reg = <31>;
...
};
```
This commit changes the DT node name to `switch@1f`.

Signed-off-by: Rani Hod <rani.hod@gmail.com>
2023-11-22 19:42:23 +02:00
Łukasz M
5a603c7a31 mediatek: mt7981: improve fan behaviour
This doubles the number of cooling-levels.
In addition the fan is turned on with a low speed at lower temperatures
and with a higher speed at higher temperatures.
This also attempts to reduce the likelihood of constant start-stop actions.

The change only affects the GL.iNet MT3000 and has been tested with it.

Signed-off-by: Łukasz M <lukasz1992m@gmail.com>
2023-11-03 23:06:07 +01:00
Daniel Golle
ce7209bd21 mediatek: add build for MT7981 RFB
Add build for the MTK3943 reference board for MT7981B+MT7976C.

**Hardware specification:**

 - SoC: MediaTek MT7981B 2x A53
 - Flash: various options
 - RAM: 256MB DDR3
 - Ethernet: 4 x 10/100/1000 Mbps via MT7531AE switch
        EITHER 1 x 10/100/1000 Mbps built-in PHY
            OR 1 x 10/100/1000/2500 Mbps MaxLinear GPY211C
 - Switch: MediaTek MT7531AE
 - WiFi: MediaTek MT7976C
 - Button: RST, WPS

**Flash instructions for SPIM-NAND:**
 - write *mt7981-rfb-spim-nand-preloader.bin to 'BL2' partition
 - write *mt7981-rfb-spim-nand-bl31-uboot.fip to 'FIP' partition
 - erase 'ubi' partition
 - reset board
 - create ubootenv and ubootenv2 UBI volumes in U-Boot
 - edit environment and set bootcmd, e.g.
   setenv bootconf 'config-1#mt7981-rfb-spim-nand#mt7981-rfb-mxl-2p5g-phy-eth1'
   setenv bootcmd 'ubi read $loadaddr fit; bootm $loadaddr#$bootconf'
 - load initramfs image via TFTP:
   setenv serverip 192.168.1.254
   setenv ipaddr 192.168.1.1
   setenv bootfile openwrt-mediatek-filogic-mediatek_mt7981-rfb-initramfs.itb
   saveenv ; saveenv
   tftpboot
   bootm $loadaddr#$bootconf
 - Now use sysupgrade to write OpenWrt firmware to flash.

SNFI-NAND, SPIM-NOR and eMMC all work very similar, a bootable SD card image
is also being generated. However, as the board I've been provided only comes
with SPIM-NAND all other boot media are untested.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-09-21 10:15:08 +01:00
Chen Minqiang
36746893ac mediatek: fix the name of buswidth to bus-width
Fix the issue of dts buswidth cannot be applied properly with spi driver.
Fix the name of buswidth to bus-width in dts in order to fit the format
in linux spi kernel[1] so that spi-tx-bus-width & spi-rx-bus-width can be
parsed properly.

[1] Documentation/devicetree/bindings/spi/spi-controller.yaml

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2023-09-05 15:40:43 +08:00
Daniel Golle
035a88ae55 mediatek: generate bootloader artifacts for mt7988_rfb
Switch to OpenWrt uImage.FIT bootmethod and include various bootloader
artifacts with the generated binaries.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-08-28 16:35:22 +01:00
Daniel Golle
3ef8760e87 mediatek: improve mt7981.dtsi
* re-factor WED components to boot fine also on limited loaders
 * add LEDs of integrated GE PHY

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-08-28 13:55:38 +01:00
Daniel Golle
0454691960 mediatek: filogic: mt7988: mark RTC clock as critical
A dependency of the MT7988 MMC host controller on the SoC's RTC clock
being running has been discovered. Mark RTC clock as critical to fix
MMC host on MT7988.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-08-13 15:01:36 +01:00
Daniel Golle
64b99802a6 mediatek: filogic: update MT7988 device tree
* move ethernet to mt7988a.dtsi
 * move switch definition to mt7988a.dtsi
 * add PHY LEDs

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-08-03 15:47:51 +01:00
Daniel Golle
36d0aa9c2d mediatek: filogic: sync pinctrl-mt7988 with MediaTek SDK
Update pinctrl driver for the MT7988 with driver from mtk-openwrt-feeds.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-08-03 15:47:51 +01:00
Daniel Golle
f321a49fd5 mediatek: dts: mt7988a: remove boottrap hack
The PHY driver now uses regmap created from pio syscon, we no longer
need the boottrap device.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-07-08 17:36:19 +01:00
Daniel Golle
1f1e0b1144 mediatek: dts: mt7988a: wire-up mediatek,pio for PHY LEDs
The PHY driver needs to read a register containing the values of the
bootstrap pins (which happen to be the PHY LEDs) to determine the LED
polarities. Allow regmap access to first pinctrl bank by adding the
'syscon' compatible, and reference the pinctrl in the MDIO bus where
the PHY driver will look for it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-07-08 16:36:49 +01:00
Daniel Golle
659f4a13dd mediatek: adapt files and patches for Linux 6.1
With Linux 6.1 many of our downstream patches and out-of-tree files
can be removed or at least replaced by backported upstream commits.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
[fix CMDLINE_OVERRIDE for arm64]
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2023-07-07 14:01:39 +02:00
Daniel Golle
d85438f454 mediatek: copy patches and files for Linux 6.1
First step only copies patches-5.15 and files-5.15 to
patches-6.1 and files-6.1 respectively.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-07-07 14:01:39 +02:00