Commit Graph

74 Commits

Author SHA1 Message Date
Daniel Golle
537b423d9f
uboot-mediatek: update to U-Boot 2022.10
Remove patches adding support for MT7621 which have been merged upsteam.
Patches for MT7981 and MT7986 have been merged too, but not in time to
be included in the 2022.10 release, so we have to keep carrying them
until the 2023.01 release.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-10-18 20:08:35 +01:00
Chukun Pan
bb212092df
uboot-mediatek: fixes defconfig typo for UniFi 6 LR
CONFIG_CMD_MTDPART does not exist, fix it.

Fixes: e9ad412 ("uboot-mediatek: add build for Ubiquiti Networks UniFi 6 LR")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2022-10-11 14:34:11 +02:00
Chukun Pan
b3c81c9f21
uboot-mediatek: fixes defconfig typo for Linksys E8450
CONFIG_CMD_MTDPART does not exist, fix it.

Fixes: ed50004 ("uboot-mediatek: add support for Linksys E8450")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2022-10-11 14:34:07 +02:00
Petr Štetiar
a575788b8f uboot-mediatek: fix extraneous right parens
Fixes following warning:

 Makefile:310: extraneous text after 'ifeq' directive

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-09-13 09:14:09 +02: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
0ea329fec4 uboot-mediatek: replace patches with updated versions
Weijie Gao has submitted an updated version of the patchset adding
support for MT7986 and MT7981 to U-Boot. Use that v2 patchset.

Changes of v2:
- Add cpu driver for print_cpuinfo()
- Fix NULL pointer dereference in mtk_image
  (was already fixed in OpenWrt)
- Fix coding style
- Minor changes

https://patchwork.ozlabs.org/project/uboot/list/?series=316148

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-31 14:02:45 +01:00
Daniel Golle
c2bc1bd99a uboot-mediatek: add support for Bananapi BPi-R3
The Bananapi BPi-R3 board can boot from eMMC, SD card, SPI-NAND and
SPI-NOR, depending on the position of switches controlling the BOOTSEL
bootstrap pins as we as hard-wired chip-select lines. The position of the
chip-select switch SW6 decides whether either SD card or eMMC can be
accessed, SW5 selects either SPI-NAND or SPI-NOR.

Generate U-Boot for all 4 boot options. The SD card version allows
installation to SPI-NAND and SPI-NOR (eMMC cannot be accessed
simultanously with the SD card), the SPI-NAND version allows installation
to eMMC.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-30 13:36:28 +01:00
Daniel Golle
0a18456ffc uboot-mediatek: no compression means IH_COMP_NONE
Treat missing compression node in FIT image as IH_COMP_NONE.
This is implicentely already happening in most places, but for now
was still triggering an annoying warning about initramfs compression
being obsolete despite compression note being absent.
Fix this.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-28 20:33:15 +01:00
Daniel Golle
20eee0d6cb uboot-mediatek: mt7986: add generic reset button support
Allow resetting environment to default values when defined button
exists in device tree.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-28 20:33:15 +01:00
Daniel Golle
85581cc89a uboot-mediatek: mt7986: support PSTORE/ramoops
Assign reserved memory for PSTORE/ramoops for the MT7986 SoC.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-28 20:33:15 +01:00
Daniel Golle
d3a337a592 uboot-mediatek: additions from MTK SDK
* updated SNAND/SNFI driver brings support for MT7981
 * add support for MediaTek NAND Memory bad Block Management (NMBM)
   (not used for any boards atm, but could be useful in future)
 * wire up NMBM support for MT7622, MT7629, MT7981 and MT7986
 * replace some local patches with updated version from SDK
 * bring some legacy precompiler symbols which haven't been converted
   into Kconfig symbols in U-Boot 2022.07, remove when bumbping to
   U-Boot 2022.10:
   100-28-include-configs-mt7986-h-from-SDK.patch

Source: https://github.com/mtk-openwrt/u-boot
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-28 20:33:15 +01:00
Daniel Golle
c09eb08dad uboot-mediatek: add support for MT798x platforms
Import pending patches to support the upcoming Filogic platforms.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-28 20:33:15 +01:00
Daniel Golle
a4933cdd12 uboot-mediatek: add support for compressed BL3/FIP image
MediaTek's ARM Trusted Firmware v2.7+ allows the images inside a FIP
structure to be compressed. Make use of that for boards with NOR flash.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-28 20:33:15 +01:00
Daniel Golle
d118cbdfec uboot-mediatek: fix factory reset on UBI
Truncating a UBI volume using `ubi write 0x0 volname 0x0` results in
segfault on newer U-Boot. Write 1MB of 0s instead.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-28 20:33:15 +01:00
Daniel Golle
0bc8889e7b uboot-mediatek: fix Ubiquiti UniFi 6 LR U-Boot mod
Image names as well as the calculation of the padded image size did
not work as intended. Fix that.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-28 16:11:09 +01:00
Daniel Golle
87e09b692b uboot-mediatek: backport pinctrl fix to avoid error message
Import a3ba6adb70 arm: dts: mt7622: remove default pinctrl of uart0
and apply also to locally added boards.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-11 17:11:48 +02:00
Daniel Golle
7f5e70a534 uboot-mediatek: mt7621: use silent stage1 by default
Use faster and silent MT7621 stage1 blob by default unless
CONFIG_DEBUG is selected.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-11 17:11:36 +02:00
Daniel Golle
603aaceb42 uboot-mediatek: reorder patches
Rename/reorder patches to avoid duplicate usage of 300-* prefix.
No functional changes.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-07-30 19:03:54 +02:00
Daniel Golle
e0e74d8a2c uboot-mediatek: unbreak build with binman
swig has been installed on the buildbots a while a ago and
Petr Štetiar got a fix for the pylibfdt error. Use that and re-enable
the builds for mt7620 and mt7621.
Refresh patches while at it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-07-13 11:38:57 +01:00
Daniel Golle
7659ee1e27 uboot-mediatek: add support for UBI EOF marker
Let U-Boot handle free space in UBI partitions by recognizing the EOF
marker OpenWrt is using as well for that purpose.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-07-13 11:38:57 +01:00
Daniel Golle
a7a3a04a2c
uboot-mediatek: mark mt7620 build as @BROKEN
Turns out also mt7620 build has a more hidden dependency on binman.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-07-12 21:31:38 +01:00
Daniel Golle
e760f065c6
uboot-mediatek: mark MT7621 variants as @BROKEN
Building U-Boot for the MT7621 SoC requires binman, a Python-based
host tool to generate images. For now, binman cannot work inside the
OpenWrt build system because it requires swig, so mark the MT7621
boards as borken to fix the ramips/mt7621 build until someone with
knowledge about Python and swig fixes the underlaying issue.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-07-12 19:58:13 +01:00
Daniel Golle
2f7fb57c12
uboot-ramips: add support for MT7621, merge into uboot-mediatek
* Merge uboot-ramips into uboot-mediatek.
* Port support for the RAVPower RP WD009 to U-Boot 2022.07.
* Add support for MT7621 and add builds for the reference boards.
* Add builds for MT7620 and MT7628 reference boards.

This should help to make development of U-Boot-level board support for
all MediaTek targets much easier.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-07-11 21:27:24 +01:00
Daniel Golle
fa75a3a935
uboot-mediatek: update to 2022.07 release
Add patch to fix host-build of the mkimage tool without
CONFIG_TOOLS_LIBCRYPTO.
Update and refresh all patches.

Tested on BananaPi R64 (MT7622) successfully booting from SD card,
eMMC and SPI-NAND.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-07-11 17:13:22 +01:00
Daniel Golle
2caa03ec86
uboot-mediatek: update UniFi 6 LR board name
Select matching U-Boot for both v1 and v2 variants.

Fixes: 15a02471bb ("mediatek: new target mt7622-ubnt-unifi-6-lr-v1")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-06-16 19:56:12 +01:00
Daniel Golle
079828fa54
uboot-mediatek: replace patch with accepted commit
Replace pending patch with version accepted upstream.
Other than in the first suggested version, the new property is now
called 'u-boot,bootconf' instead of 'bootconf'.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-04-20 15:22:45 +01:00
Daniel Golle
810b48e793
uboot-mediatek: remove '0x' prefix from pstore node
Remove '0x' prefix from pstore node in dts, just like it was done
for the device tree used by Linux on MT7622.
This change is done in preparation to update U-Boot to 2022.04.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-04-19 17:07:38 +01:00
Daniel Golle
dfc3ea6810
uboot-mediatek: add patch to allow accessing bootconf from Linux
Store selected boot configuration in '/chosen' node in device tree, so
it can be accessed by Linux (and used for fine-tuning the FIT partition
parser).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-03-21 23:48:04 +00:00
Daniel Golle
145d896e0e
uboot-mediatek: update to version 2022.01
Tested on BananaPi R2 (SD, eMMC), BananaPi R64 (SD, eMMC, SPI-NAND) and
UniElec U7623-02 (eMMC).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-01-23 20:20:53 +00:00
Daniel Golle
213b406ae3
uboot-mediatek: update build for the U7623-02 board
Brings bootmenu and production/recovery dual-boot scheme like on
the BPi-R2, BPi-R64, E8450 and UniFi 6 LR.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-01-23 19:48:42 +00:00
Andre Heider
f262d2aae1 u-boot.mk: fix pkg-config usage
Using Host/Exports doesn't work as intended, explicitly add the
required vars so that u-boot finds the required libraries when building
its tools.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2021-10-24 18:00:49 +02:00
Daniel Golle
b6da10f2d1
uboot-mediatek: update to 2021.10
U-Boot 2021.10 has been released.
Rebase mediatek patches on top of new release and remove some patches
which have been merged upstream.

Tested on Bananapi BPi-R2 (mt7623), Bananapi BPi-R64 (mt7622) and
Linksys E8450 (mt7622).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-10-04 20:46:30 +01:00
Daniel Golle
454e411a77 uboot-mediatek: fix and make use of LEDs on BPi-R2
Fix BPi-R2 GPIO LEDs to indicate boot into production or recovery
firmware in DTS and define them in default environment.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-09-30 22:49:55 +01:00
Daniel Golle
7ca173d51a
uboot-mediatek: pass console=tty1 for BPi-R2
BananaPi BPi-R2 comes with HDMI and MIPI-DSI. Use dislpay facility in
Linux by add "console=tty1" boot argument.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-08-21 04:35:52 +01:00
Daniel Golle
025c0bcd60 uboot-mediatek: fix board name of Bananapi BPi-R2
As the board name was changed to be identical to the device tree
compatible string (just like for other boards), also reflect that
change for U-Boot.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-20 17:01:02 +01:00
Daniel Golle
ec3bd5e197 uboot-mediatek: rework support for the BPi-R2
* use built-in default environment instead of file in bootfs
 * get rid of bootfs alltogether and use uImage.FIT
 * auto-detect boot device like original script did
 * add support for factory button

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-20 04:11:05 +01:00
Daniel Golle
349e2b7e65
uboot-mediatek: several fixes for MT7622
* ! Behavior change !

   Old behavior: If the Reset button is held down during power-on
   do factory reset and try booting recovery from TFTP forever.
   If valid recovery is received via TFTP, write it to flash and boot.

   New behavior: If the Reset button is held down during power-on
   do factory reset, then try TFTP *once*, then try booting on-flash
   recovery, then keep trying via TFTP forever until a valid image is
   received.
   Only if there is no bootable recovery stored on flash, store the
   downloaded recovery. Then boot it.

 * Set loadaddr to 0x48000000 in order to allow booting images larger
   than ~47MB (reported by Oskari Lemmelä). Setting loadaddr to
   0x48000000 gives us 384MB on devices with 512MB RAM, which should be
   more than enough as a maximum size for uImage.FIT to be loaded.

 * Widely unify device-specific default environment in preparation to
   auto-generate it from parameters.

 * backport upstream commit fixing MBR/DOS partitioning

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-11 23:39:18 +01:00
Daniel Golle
cc201759b6
uboot-mediaktek: add support for PSTORE and check it on boot
Add support for pstore/ramoops now that DRAM content is preserved
over reboot on MT7622. On each boot, check pstore and boot to recovery
image in case there are records stored in it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-08 23:35:38 +01:00
Daniel Golle
af3a1adee0
uboot-mediatek: unifi-6-lr: fix erase of production parition
mtd erase needs to be aligned with erase blocks. Use padded image size
for erasing the production volume.
As the environment grew above the current size of 0x1000 bytes by
introducing the new padding function, increase the env size to 0x4000.
While at it, clean up reset button function to work to more reliable on
that board.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-07 22:50:15 +01:00
Daniel Golle
fbcfa895a8
uboot-mediatek: bpi-r64: add TFTP update options to eMMC bootmenu
Just like on SPI-NAND, also allow updating the bootloader comfortably
on eMMC installations.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-01 22:55:22 +01:00
Chen Minqiang
43dad22025
uboot-mediatek: unifi6lr: mtd erase before write to flash
Erase firmware ereas before writing to recovery or production partition
when updating them via the bootloader menu.

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-28 20:54:43 +01:00
Daniel Golle
d0adc4865c
uboot-mediatek: minor fixes for bpi-r64 spi-nand default env
* check image checksums before writing to flash
 * only bootmenu_0...9 are working, remove bootmenu_a entry

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-11 22:48:36 +01:00
Daniel Golle
987562bad2
uboot-mediatek: add spi-nand build for bananapi bpi-r64
Some of bpi-r64 boards have serial NAND attached to SPI bus.
Build U-Boot for booting from SPI-NAND.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
2021-04-11 20:19:34 +01:00
Oskari Lemmela
d05051774e mediatek: bpi-r64: use separate partition for emmc bootloader
eMMC booloader is stored to separate partition.
FIP size is increased to 2MB.

Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
2021-04-11 14:55:35 +01:00
Daniel Golle
e9ad412049
uboot-mediatek: add build for Ubiquiti Networks UniFi 6 LR
Add U-Boot build for the Ubiquiti Networks UniFi 6 LR access point.
This allows updating the bootchain to modern ARM Trusted Firmware 2.4
and U-Boot 2021.04 while keeping as much of the existing flash layout
as possible (u-boot-env, factory and eeprom partitions are retained),
gaining robust recovery vs. production dual-boot mechanism.
Add info for the Winbond W25Q512JV SPI NOR flash used in the device
and wait for GPIOs to settle after reset before checking for reset
button.
I2C connected LED controller is not supported yet.
Writing large amounts of data to SPI flash currently doesn't work due
to watchdog timeout causing reset before data write completes.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-09 16:04:46 +01:00
Daniel Golle
0268f76bbb
uboot-mediatek: bpi-r64: erase eMMC environment on installation
Erase U-Boot environment partition on eMMC on installation to make sure
chages are applied.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-09 16:04:20 +01:00
Daniel Golle
5e7d6d5ba4
uboot-mediatek: update to v2021.04
Remove patches merged upstream and refresh the remaining ones.
Runtime tested on
 * Bananapi BPi-R64 (eMMC and SD Card)
 * Linksys E8450 (SPI-NAND)
 * Ubiquiti UniFi 6 LR (SPI-NOR)

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-05 18:57:51 +01:00
Daniel Golle
1db4681617 uboot-mediatek: bpi-r64: no longer force recovery on first-boot
Now that sdcard.gz image contains everything needed to boot straight
into production image, no longer force booting into recovery image on
first boot by removing the logic which implemented that.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-04 10:51:25 +01:00
Daniel Golle
5ea7fabdb3
uboot-mediatek: adapt root= cmdline arg for bpi-r64
Adapt to FIT partition parser changes.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-31 22:54:17 +01:00
Daniel Golle
81edc842f6
uboot-mediatek: don't rely in 'lzma' cmdline
Use 'xz --format=lzma' instead.
Fixes build for mt7629.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-18 04:19:48 +00:00