Help Needed: No UART Output in Mainline U-Boot on MT7620A (ZBT WE826-T2)

2024-02-01 Thread Richard Thanki
Dear U-Boot Community,

I am working on porting mainline U-Boot to a standard MT7620A wireless router, 
specifically the ZBT WE826-T2 (https://openwrt.org/toh/zbtlink/we-826). After 
building and flashing the mainline U-Boot, I'm encountering an issue where 
there is no output over UART.

So far, I've tried the default configurations for both MT7620 RFB and 
MT7620-MT7530 RFB targets, with the latter being more of an experimental test 
as my board lacks a gigabit switch. I’m flashing the standard `u-boot.bin` 
image. I’ve tried disabling the 'skip low-level configuration' in 'make 
menuconfig,’ but the issue persists. Despite these efforts, the router's 
behaviour remains unchanged, showing the same LED behaviour (one of the led’s 
infrequently but regularly flashing) whether the new U-Boot is flashed or the 
flash chip is entirely erased.

In comparing the Device Trees (DTs) for OpenWrt:
- 
https://github.com/openwrt/openwrt/blob/master/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi
- 
https://github.com/openwrt/openwrt/blob/master/target/linux/ramips/dts/mt7620a.dtsi

with those in U-Boot 
- 
https://github.com/u-boot/u-boot/blob/master/arch/mips/dts/mediatek%2Cmt7620-rfb.dts
- https://github.com/u-boot/u-boot/blob/master/arch/mips/dts/mt7620.dtsi

both look similar to all important characteristics. I noticed both use the 
uartlite for serial.

I’m using Ubuntu 20.04 to compile using OpenWrt’s pre-built toolchain.

Any insights or guidance on this matter would be greatly appreciated, 
especially if someone has experience with UART issues on MT7620A-based hardware 
in mainline U-Boot. Resolving this could pave the way for easier ports to 
similar devices.

Thank you in advance for your support.

Rich

Bootargs received by a uImage but not by a FIT

2021-12-06 Thread Richard Thanki
Hi all, I’m reaching out on this list as my problem spans U-Boot and Openwrt. 
In essence the very same kernel (5.4 and 5.10 - built using latest Openwrt), 
packaged in a FIT, is not receiving bootlogs from latest U-Boot and it’s also 
not being informed of the presence of the location and existence of an external 
initramfs. I suspect the issue is with my packaging, or Openwrt, but I wondered 
if there were any subtleties of how bootargs might be being passed differently 
between both types of image container? Why might this happen from a U-Boot 
perspective?

Rich

PS. The details of my issue are set out below in my post to the OpenWrt forum.

I'm seeing a very odd difference between a single build, deployed on an ath79 
device in two different ways. In short, when deployed as an OpenWrt built 
sysupgrade-squashfs the kernel picks up the command line arguments provided by 
the bootloader. However, when packaged as a FIT image the kernel does not pick 
up the bootargs. I think this is why my FIT packed kernel image cannot find the 
packaged external initramfs.

My device is a very standard ath79 qca9531 board from ZBT - works great on 
mainline OpenWrt + mainline U-Boot with minimal DTS. I've tried adding my 
target to both ath79-generic and ath79-tiny targets and the results are the 
same. It's also the same with kernel 5.4 and 5.10. In each case I'm using 
mainline U-Boot (which with a few changes works well on QCA9531!). 

## Steps I've taken

The main patches I've made to OpenWrt are all configuration:

enabling lzma for the external initramfs:
```
diff --git a/target/linux/ath79/config-5.4 b/target/linux/ath79/config-5.4
index 60f57692e2..8d521e4193 100644
--- a/target/linux/ath79/config-5.4
+++ b/target/linux/ath79/config-5.4
@@ -52,6 +52,7 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_CPU_SUPPORTS_MSA=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CSRC_R4K=y
+CONFIG_DECOMPRESS_LZMA=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y
 CONFIG_DTC=y
@@ -211,6 +212,7 @@ CONFIG_PHYLIB=y
 # CONFIG_PHY_ATH79_USB is not set
 CONFIG_PINCTRL=y
 CONFIG_RATIONAL=y
+CONFIG_RD_LZMA=y
 CONFIG_REGMAP=y
 CONFIG_REGMAP_MMIO=y
 CONFIG_RESET_ATH79=y
-- 
2.24.3 (Apple Git-128)
```

enabling mips kernel to extend the dtb bootargs with those from the bootloader:
```
diff --git a/target/linux/ath79/config-5.4 b/target/linux/ath79/config-5.4
index 8d521e4193..4898190a02 100644
--- a/target/linux/ath79/config-5.4
+++ b/target/linux/ath79/config-5.4
@@ -158,9 +158,9 @@ CONFIG_MIPS_ASID_BITS=8
 CONFIG_MIPS_ASID_SHIFT=0
 CONFIG_MIPS_CLOCK_VSYSCALL=y
 # CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set
-# CONFIG_MIPS_CMDLINE_DTB_EXTEND is not set
+CONFIG_MIPS_CMDLINE_DTB_EXTEND=y
 # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set
-CONFIG_MIPS_CMDLINE_FROM_DTB=y
+# CONFIG_MIPS_CMDLINE_FROM_DTB is not set
 # CONFIG_MIPS_ELF_APPENDED_DTB is not set
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_MIPS_NO_APPENDED_DTB is not set
-- 
2.24.3 (Apple Git-128)
```

I've even tried backporting this patch 
http://lkml.iu.edu/hypermail/linux/kernel/2003.2/01736.html to 5.4 and made no 
difference: the squashfs image picked up the args no problem (even when 
launched from $loadaddr/0x810) and the FIT packaging which doesn't

Here's my u-boot environment:

```
Environment size: 342/8187 bytes
baudrate=115200
bootargs=foo=bar
bootcmd=sf probe;mtdparts default;bootm 0x9f05
bootcount=1
bootdelay=3
bootlimit=3
fdtcontroladdr=87f6caa0
ipaddr=192.168.0.234
loadaddr=0x8100
serverip=192.168.0.6
stderr=uart@1802
stdin=uart@1802
stdout=uart@1802
```

Here's the bootlog from the squashfs image which picks up the bootargs (ignore 
the error at the end, image was running from memory):

```
getbox # bootm 0x8100
## Booting kernel from Legacy Image at 8100 ...
   Image Name:   MIPS OpenWrt Linux-5.4.158
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:1538183 Bytes = 1.5 MiB
   Load Address: 8006
   Entry Point:  8006
   Verifying Checksum ... OK
   Uncompressing Kernel Image
[0.00] Linux version 5.4.158 (vscode@d0b09531f99b) (gcc version 8.4.0 
(OpenWrt GCC 8.4.0 r0+16397-266890bb12)) #0 Fri Dec 3 10:13:01 2021
[0.00] printk: bootconsole [early0] enabled
[0.00] CPU0 revision is: 00019374 (MIPS 24Kc)
[0.00] MIPS: machine is Jangala Get Box (Tiny)
[0.00] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
[0.00] Initrd not found or empty - disabling initrd
[0.00] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[0.00] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 
bytes
[0.00] Zone ranges:
[0.00]   Normal   [mem 0x-0x07ff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x07ff]
[0.00] Initmem setup node 0 [mem 0x-0x07ff]
[0.00] Built 1 

Re: Porting U-Boot to a QCA9531 board?

2020-11-18 Thread Richard Thanki
Hi Heinrich

> On 18 Nov 2020, at 17:27, Heinrich Schuchardt  > wrote:
> 
> 
> The driver will not be compiled because your config does not select
> CONFIG_AG7XXX.

So clear when you point it out. I’ll modify this, and retest, thank you.

> 
>> - With OpenWrt 18.06 (Kernel 4.4 - ar71xx mach target) and 19.07 (kernel 
>> 4.14 -
>> ath79 dts target) the boot process doesn't complete and stalls at [link]. 
>> With
>> OpenWrt Master (5.4) the boot process completes but the system displays the
>> following issues: -- Within OpenWrt the watchdog timer (usually on GPIO 2)
>> does not respond to writes on sysfs and therefore the device reboots every 4
>> minutes -- The second USB hub on the board is not detected by OpenWrt during
>> boot and therefore some devices do not come up on the operating system such 
>> as
>> the modem.
> 
> These seem to be questions about Linux configuration, not U-Boot.

Sorry, I think we phrased this badly. We only get these issues when using 
mainline U-Boot 
and not a) the manufacturer default bootloader or b) the Pepe2K mod - both of 
which work 
perfectly with our test images. In each case we’re using the same OpenWrt OS 
images 
we’ve built ourselves between the tests with these different botloaders.

I guess the deeper understanding we’re trying to get to is the proper 
relationship between 
bootloader and Linux:

- Why would the very same OpenWrt image be able to find and use the USB hub or 
make 
use of GPIO 2 using these other two U-Boot variants but not mainline? 
- Does this point to us not performing important set-up steps in U-Boot or does 
our problem
 lie in our OpenWrt setup? (If the latter, why do these other U-Boots work 
properly?)
- Are we stumbling into a common beginners’ problem?

Thanks again

Rich


> 
> Cc: Daniel Schwierzeck  > (maintainer:MIPS)
> 
> Best regards
> 
> Heinrich
> 
>> 
>> My working config file is here[1], my device tree is here[2], the board file
>> here[3]  and my defconfig can be found here[4].
>> 
>> Am I running into an obvious oversight? What are the next steps I need to 
>> take
>> to get my port working?
>> 
>> Thanks,
>> wambui karuga
>> [1] https://github.com/wambu-i/u-boot/blob/getbox/include/configs/get-box.h
>> [2] 
>> https://github.com/wambu-i/u-boot/blob/getbox/arch/mips/dts/jangala,get-box.dts
>> [3] 
>> https://github.com/wambu-i/u-boot/blob/getbox/board/jangala/get-box/get-box.c
>> [4] https://github.com/wambu-i/u-boot/blob/getbox/configs/get-box_defconfig



Re: Porting U-Boot to a QCA9531 board?

2020-11-18 Thread Richard Thanki
Hi Heinrich

> On 18 Nov 2020, at 17:27, Heinrich Schuchardt  wrote:
> 
> 
> The driver will not be compiled because your config does not select
> CONFIG_AG7XXX.

So clear when you point it out. I’ll modify this, and retest, thank you.

> 
>> - With OpenWrt 18.06 (Kernel 4.4 - ar71xx mach target) and 19.07 (kernel 
>> 4.14 -
>>  ath79 dts target) the boot process doesn't complete and stalls at [link]. 
>> With
>>  OpenWrt Master (5.4) the boot process completes but the system displays the
>>  following issues: -- Within OpenWrt the watchdog timer (usually on GPIO 2)
>>  does not respond to writes on sysfs and therefore the device reboots every 4
>>  minutes -- The second USB hub on the board is not detected by OpenWrt during
>>  boot and therefore some devices do not come up on the operating system such 
>> as
>>  the modem.
> 
> These seem to be questions about Linux configuration, not U-Boot.

Sorry, I think we phrased this badly. We only get these issues when using 
mainline U-Boot 
and not a) the manufacturer default bootloader or b) the Pepe2K mod - both of 
which work 
perfectly with our test images. In each case we’re using the same OpenWrt OS 
images 
we’ve built ourselves between the tests with these different botloaders.

I guess the deeper understanding we’re trying to get to is the proper 
relationship between 
bootloader and Linux:

- Why would the very same OpenWrt image be able to find and use the USB hub or 
make 
use of GPIO 2 using these other two U-Boot variants but not mainline? 
- Does this point to us not performing important set-up steps in U-Boot or does 
our problem
  lie in our OpenWrt setup? (If the latter, why do these other U-Boots work 
properly?)
- Are we stumbling into a common beginners’ problem?

All the best

Rich


> 
> Cc: Daniel Schwierzeck  (maintainer:MIPS)
> 
> Best regards
> 
> Heinrich
> 
>> 
>> My working config file is here[1], my device tree is here[2], the board file
>> here[3]  and my defconfig can be found here[4].
>> 
>> Am I running into an obvious oversight? What are the next steps I need to 
>> take
>> to get my port working?
>> 
>> Thanks,
>> wambui karuga
>> [1] https://github.com/wambu-i/u-boot/blob/getbox/include/configs/get-box.h
>> [2] 
>> https://github.com/wambu-i/u-boot/blob/getbox/arch/mips/dts/jangala,get-box.dts
>> [3] 
>> https://github.com/wambu-i/u-boot/blob/getbox/board/jangala/get-box/get-box.c
>> [4] https://github.com/wambu-i/u-boot/blob/getbox/configs/get-box_defconfig
>> 
>