BPI-R64 current u-boot support

Currently it looks like that:

U-Boot 2020.01-rc1-03158-g10bf57eb9a-dirty (Nov 03 2019 - 01:09:42 +0200)

CPU:   MediaTek MT7622 E1
DRAM:  1 GiB
WDT:   Started with servicing (60s timeout)
MMC:   [email protected]: 0, [email protected]: 1
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Net:   mt7622_ethsys_probe:711
eth0: [email protected]
Hit any key to stop autoboot:  0 
U-Boot MT7622>

Code is here Updated to latest @2019-11-02T22:00:00Z


  • Serial - :white_check_mark:
  • Timer - :white_check_mark:
  • SD - :white_check_mark:
  • eMMC - :white_check_mark:
  • Ethernet - :x:
  • Switch - not started
  • PCI-E - :x: needs v2 driver update
  • SATA - :white_check_mark: But not committed yet :exclamation::exclamation::exclamation::exclamation:
  • USB - :x: can found only root hub
  • CLocks - :eight_spoked_asterisk:, somehow works :slight_smile:
  • pinctl - :eight_spoked_asterisk:, somehow works :slight_smile:
  • Watchdog - :white_check_mark:
  • Reset - :white_check_mark:
1 Like

@moore can you please look, which clock assigned to GPT on MT7622? Not value, but ID and parent plz. Also, looks like, stated in doc 13MHz a bit wrong. At least board do about 12 sec on sleep 10.

armv8 timer not used yet.

thank you for your great work so far.

do you also create a u-boot-mtk-file? because this is needed to write to sd-card

for tftp/go u-boot.bin is enough

have not yet get it compiled with crosscompiler

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
make mt7622_bpir64_efi_defconfig
make menuconfig

CC      lib/asm-offsets.s
cc1: error: unknown value 'generic-armv7-a' for -mtune

or do you still compile for 32-bit armhf? there it works and creates u-boot-mtk.bin

edit: have successfully loaded it via tftp:

U-Boot 2019.10-00714-gc451ad3950 (Oct 22 2019 - 15:40:12 +0200)

CPU:   MediaTek MT7622 E1
DRAM:  1 GiB
WDT:   Started with servicing (60s timeout)
MMC:   [email protected]: 0, [email protected]: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
U-Boot MT7622> 

nice work, waiting for network :wink:

if anyone wants to try it (without flashing sdcard):

BPI-IoT> setenv ipaddr
BPI-IoT> setenv serverip
BPI-IoT> setenv ufile u-boot-r64-2019-10.bin
BPI-IoT> setenv uaddr 0x41E00000
BPI-IoT> setenv umtkaddr 0x41dffe00
BPI-IoT> tftp ${umtkaddr} ${ufile}
BPI-IoT> go $uaddr

@ray mmc seems to be swapped (0=sd-card) or is it because emmc does not work

yup, 32bit :slight_smile:

It should be 12.5Mhz, thanks.

1 Like


Should I bind it to dummy clock?

Or parent and Id known and you can give it to me?

@moore can you help with network-support? and see question of ray before :slight_smile:

eMMC/SD works fine. Environment loaded.

Code updated.

SATA works too, but small organizational issue should be resolved.

1 Like

Emmc seems to work only if pre-initialized (e.g. by previous loaded uboot or by booting from emmc). if booting directly from sd it does not work.

If anybody has an idea…

Now, we’re also developing mt7622 upstream uboot, and will share our patches with you in these two days.

  • Ethernet: todo

  • PCIe/USB: ongoing

    We’ll use mt7629 as target platform first because it has uboot usptream already with similar IP.


have you emmc-access ready? Is it also working if booting from sdcard?

Can you share this patch (maybe pinctrl/timer)?

@moore can you please give us difference on things preloader initialized to boot form eMMC and from SD.

Because we have it worked when first uboot started from eMMC and not worked when from SD.

Boot src      eMMC status     SD status
eMMC             works            works
SD                 no             works

So for case it boot from SD something (clk, pinctrl, power, etc) did not initialized, so eMMC won’t work. But we can’t catch yet, what is it.


@frank-w did you try to boot linux from SD (both uboot and linux from SD) and check if eMMC accessible?

have not get managed it…copied kernel+dtb (which i load from my older uboot) to root of sd-card and did this:

U-Boot MT7622> setenv bootargs console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait                                                                             
U-Boot MT7622> ls mmc 1:1                                                                                                                                       
        0   sd.txt                                                                                                                                              
  8841288   uImage_5.4                                                                                                                                          
    23721   bpi-r64-5.4.dtb                                                                                                                                     
3 file(s), 1 dir(s)                                                                                                                                             
U-Boot MT7622> setenv kaddr 0x44000000                                                                                                                          
U-Boot MT7622> setenv dtaddr 0x47000000                                                                                                                         
U-Boot MT7622> fatload mmc 1:1 $kaddr uImage_5.4                                                                                                                
8841288 bytes read in 785 ms (10.7 MiB/s)                                                                                                                       
U-Boot MT7622> fatload mmc 1:1 $dtaddr bpi-r64-5.4.dtb                                                                                                          
23721 bytes read in 8 ms (2.8 MiB/s)
U-Boot MT7622> bootm $kaddr - $dtaddr                                                                                                                           
## Booting kernel from Legacy Image at 44000000 ...                                                                                                             
   Image Name:   Linux Kernel 5.4.0-rc1-r64                                                                                                                     
   Image Type:   ARM Linux Kernel Image (uncompressed)                                                                                                          
   Data Size:    8841224 Bytes = 8.4 MiB                                                                                                                        
   Load Address: 40080000                                                                                                                                       
   Entry Point:  40080000                                                                                                                                       
   Verifying Checksum ... OK                                                                                                                                    
## Flattened Device Tree blob at 47000000                                                                                                                       
   Booting using the fdt blob at 0x47000000                                                                                                                     
   Loading Kernel Image                                                                                                                                         
   Loading Device Tree to 7bff7000, end 7bfffca8 ... OK                                                                                                         
Starting kernel ...

then it hangs till a board-reset occours

did same steps with my old uboot (where i have additional env-vars set) and i see kernel booting…with this running i see emmc-partitions and can access them

[email protected]:~# hd /dev/mmcblk0boot0 | head -1                                                                                                                  
00000000  45 4d 4d 43 5f 42 4f 4f  54 00 00 00 01 00 00 00  |EMMC_BOOT.......|                                                                                  
[email protected]:~#

I asked: if you boot board to uboot from SD, then load kernel from SD, do running linux has access to eMMC?

If i use old uboot:yes…see the hd on boot0 output. New uboot hangs on kernel load

Ok, thanks.

Which tree used to build that kernel?

It should be 5.4-r64-rc (as it was on rc1)…why is this important?

I can send you the binaries if needed

for the not loading kernel (which was loaded from sd-card correctly) i guess it is a problem with loading ATF (missing offset/config-option)…if i load kernel with old uboot i see this:

Starting kernel ...

[ATF][     8.776223]save kernel info
[ATF][     8.779425]Kernel_EL2
[ATF][     8.782181]Kernel is 64Bit
[ATF][     8.785369]pc=0x40080000, r0=0x6bff7000, r1=0x0
INFO:    BL3-1: Preparing for EL3 exit to normal world, Kernel
INFO:    BL3-1: Next image address = 0x40080000
INFO:    BL3-1: Next image spsr = 0x3c9
[ATF][     8.803636]el3_exit
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]

Uboot 2019.07 version on github:

1 Like