No UART output from Trusted Firmware, UEFI

I have tried with the latest snapshot and by rebuilding the software stack from the source. But I cannot see any UART output from ARM Trusted Firmware and UEFI.

I can see UART from Linux on UART3 (even if I do not see the early Linux messages - probably because I do not have earlyprintk). Here are the first lines of the Linux kernel:

[ 3.209058] hisi_thermal f7030700.tsensor: THERMAL ALARM: T > 50^M [ 5.640555] of_dma_request_slave_channel: dma-names property of node '/smb/uart@f7113000' missing or empty^M Loading, please wait...^M Scanning for Btrfs filesystems^M fsck from util-linux 2.27.1^M rootfs: clean, 65522/96000 files, 356411/384000 blocks^M

I have two UART adapters connected on UART0 and UART3. They seem to both work.

Having a quick look at the source of ARM Trusted Firmware and UEFI. They both seem to use UART3.

cd arm-trusted-firmware grep -r -i uart plat/hikey/

plat/hikey/bl2_plat_setup.c: console_init(CONSOLE_BASE, PL011_UART_CLK_IN_HZ, PL011_BAUDRATE);
plat/hikey/hikey_def.h:#define PL011_UART0_BASE 0xF8015000
plat/hikey/hikey_def.h:#define PL011_UART3_BASE 0xF7113000
plat/hikey/hikey_def.h:#define PL011_UART_CLK_IN_HZ 19200000
plat/hikey/platform.mk:CONSOLE_BASE := PL011_UART3_BASE
plat/hikey/platform.mk:CRASH_CONSOLE_BASE := PL011_UART3_BASE
plat/hikey/bl31_plat_setup.c: console_init(CONSOLE_BASE, PL011_UART_CLK_IN_HZ, PL011_BAUDRATE);
plat/hikey/bl1_plat_setup.c: console_init(CONSOLE_BASE, PL011_UART_CLK_IN_HZ, PL011_BAUDRATE);

cd linaro-edk2 grep -r -i uart HisiPkg

HisiPkg/HiKeyPkg/HiKey.dsc: DEFINE SERIAL_BASE = 0xF7113000 # UART3
HisiPkg/HiKeyPkg/HiKey.dsc: gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
HisiPkg/HiKeyPkg/HiKey.dsc: gArmPlatformTokenSpaceGuid.PL011UartInteger|10
HisiPkg/HiKeyPkg/HiKey.dsc: gArmPlatformTokenSpaceGuid.PL011UartFractional|26
HisiPkg/HiKeyPkg/HiKey.dsc: gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(CE660500-824D-11E0-AC72-0002A5D5C51B)"
HisiPkg/HiKeyPkg/HiKey.dsc: gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()"

Hi @Olivier

We have decided to use UART3 on HiKey for serial console output since the release from last summer instead of initial UART0.
The reason is to make all different 96Boards to be able to use serial console from UART on the LS-connector.

There might not be much to see from ARM-TF and UEFI in release mode and after linux boots. Have you tried building in debug mode?

@ldts-atsuka: I know all the UART are expected to be on UART3. But it does not explain why I cannot see ARM Trusted Firmware and UEFI (and Grub?) on UART3…

@vchong: I forgot to say but I built ARM Trusted Firmware and UEFI in debug mode.

Just tested with http://builds.96boards.org/snapshots/hikey/linaro/uefi/latest/fip.bin and looks fine.


INFO:    BL1: 0xf9810000 - 0xf9818000 [size = 32768]                    
NOTICE:  Booting Trusted Firmware                                       
NOTICE:  BL1: v1.1(debug):7fb9b0e                                       
NOTICE:  BL1: Built : 16:11:08, Feb  6 2016
INFO:    BL1: RAM 0xf9810000 - 0xf9818000
NOTICE:  syspll frequency:1190461440Hz
NOTICE:  succeed to init lpddr3 rank0 dram phy
INFO:    lpddr3_freq_init, set ddrc 533mhz
INFO:    init ddr3 rank0
INFO:    ddr3 rank1 init pass
INFO:    lpddr3_freq_init, set ddrc 800mhz
INFO:    init ddr3 rank0
INFO:    ddr3 rank1 init pass
INFO:    Elpida DDR
INFO:    ddr test value:0xa5a55a5a
INFO:    Hisilicon HiKey platform is initialized
INFO:    Using FIP
INFO:    Loading file 'bl2.bin' at address 0xf9818000
INFO:    File 'bl2.bin' loaded: 0xf9818000 - 0xf981f100
NOTICE:  BL1: Booting BL2
INFO:    BL1: BL2 address = 0xf9818000
INFO:    BL1: BL2 spsr = 0x3c5
NOTICE:  acpu_dvfs_set_freq: set acpu freq success!NOTICE:  BL2: v1.1(release):7fb9b0e
NOTICE:  BL2: Built : 07:44:00, Feb  4 2016
NOTICE:  BL1: Booting BL3-1
INFO:    BL1: BL3-1 address = 0xf9858000
INFO:    BL1: BL3-1 spsr = 0x3cd
INFO:    BL1: BL3-1 params address = 0xf981f920
INFO:    BL1: BL3-1 plat params address = 0x0
NOTICE:  BL3-1: v1.1(release):7fb9b0e   
NOTICE:  BL3-1: Built : 07:44:00, Feb  4 20INF TEE-CORE:init_primary_helper:322: Initializing (29e6329 #1 Thu Feb  4 0)
INF TEE-CORE:init_teecore:81: teecore inits done
UEFI firmware (version PreAlpha built at 07:43:48 on Feb  4 2016)

Android Fastboot mode - version 0.4. Press any key to quit.
The default boot selection will start in  10 seconds
[1] fastboot
[2] boot from eMMC
[3] boot from SD card
[4] Shell
[5] Boot Manager
Start: 

Hi @Olivier

I missed your main portion that you were struggling for not able to see the console messages from UART3.

Does the @vchong comment work for you?

I have tried to flash the fip.bin you refered to but I still have the same issue.

Here is the way I processed:

  • turn off HiKey board
  • connect debug UART on HiKey to PC (used to monitor debug status)
  • make sure pin1-pin2 and pin3-pin4 on J15 are linked (recovery mode)
  • connect HiKey Micro-USB to PC with USB cable
  • turn on HiKey board
  • On the host machine:
sudo python hisi-idt.py --img1=l-loader.bin
cd /tmp
wget http://builds.96boards.org/snapshots/hikey/linaro/uefi/latest/fip.bin
sudo fastboot flash fastboot fip.bin

Here is the UART0 output:

usb reset intr
reset device done.
start enum.
enum done intr
Enum is starting.
usb reset intr
enum done intr
NULL package
NULL package
USB ENUM OK.
init ser device done....
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
uFileAddress=ss=f9800800
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
(...)
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
USB:: Err!! Unknown USB setup packet!
NULL package
Switch to aarch64 mode. CPU0 executes at 0xf9801000!

Then:

  • turn off HiKey board
  • remove the jumper of pin3-pin4 on J15
  • turn on HiKey board

Here is the UART0 output:


debug EMMC boot: print init OK
debug EMMC boot: send RST_N .
debug EMMC boot: start eMMC boot......
load fastboot1!
Switch to aarch64 mode. CPU0 executes at 0xf9801000!

The steps look right, and the log looks similar to mine, except that you have more USB:: Err!! Unknown USB setup packet! messages.

After sudo python hisi-idt.py --img1=l-loader.bin, do you not see anything on UART3? You should see BL1 boot logs. During sudo fastboot flash fastboot fip.bin, you should see printouts on UART3 as well as data is transferred to the board. Any error messages on the PC for both commands?

How are you connecting to UART3? Are you using the adapter from http://www.96boards.org/products/mezzanine/uarts/? Also just to be sure, you have the jumpers connected to UART1 (corresponding to UART3 on the hikey board) on the adapter as shown in the pictures?

Also try booting up the board with pin1-2 and pin5-6 connected (pin3-4 open) on J15 and see if you can get to fastboot mode on UEFI, i.e. something printed on UART3. If yes, maybe try to sudo fastboot flash fastboot fip.bin at this point from your PC, power off, remove pin5-6 jumper and power on to see if it makes a difference.

I am not using the mezzanine UART (ie: http://www.96boards.org/products/mezzanine/uarts/).
I am guessing my UART3 pins are connected properly as I can see output later on.

I forced all the firmware (ARM Trusted Firmware, UEFI) to be on UART0 (debug UART) and they print properly.
When ARM Trusted Firmware display on UART3, I can see its output when there are some PSCI SMC calls when I switched off Linux kernel. That means when the kernel reconfigures the UART, ARM Trusted Firmware can print.

I am now suspecting the pin multiplexing… UART3 is shared with GPIO5. I am suspecting only Linux kernel setup the multiplexer to use UART3 instead of GPIO5.

In dmesg:

[    0.773469] uart-pl011 f8015000.uart: ttyAMA0 at MMIO 0xf8015000 (irq = 68, base_baud = 0) is a PL011 rev2
[    0.773970] uart-pl011 f7111000.uart: could not find pctldev for node /smb/pinmux@f7010000/uart1_pmx_func, deferring probe
[    0.773985] amba f7111000.uart: Driver uart-pl011 requests probe deferral
[    0.774175] uart-pl011 f7112000.uart: could not find pctldev for node /smb/pinmux@f7010000/uart2_pmx_func, deferring probe
[    0.774184] amba f7112000.uart: Driver uart-pl011 requests probe deferral
[    0.774367] uart-pl011 f7113000.uart: could not find pctldev for node /smb/pinmux@f7010000/uart3_pmx_func, deferring probe
[    0.774377] amba f7113000.uart: Driver uart-pl011 requests probe deferral
[    0.774581] uart-pl011 f7114000.uart: could not find pctldev for node /smb/pinmux@f7010000/uart4_pmx_func, deferring probe
[    0.774591] amba f7114000.uart: Driver uart-pl011 requests probe deferral
(...)
[    2.370867] pinctrl-single f7010000.pinmux: 159 pins at pa ffffff80000bc000 size 636
[    2.371287] pinctrl-single f7010800.pinmux: 163 pins at pa ffffff80000be800 size 652
[    2.371458] pinctrl-single f8001800.pinmux: 30 pins at pa ffffff80000c0800 size 120
(...)
[    2.183025] i2c_designware f7100000.i2c: could not find pctldev for node /smb/pinmux@f7010000/i2c0_pmx_func, deferring probe
[    2.183036] platform f7100000.i2c: Driver i2c_designware requests probe deferral
[    2.183053] i2c_designware f7101000.i2c: could not find pctldev for node /smb/pinmux@f7010000/i2c1_pmx_func, deferring probe
[    2.183062] platform f7101000.i2c: Driver i2c_designware requests probe deferral
[    2.183079] i2c_designware f7102000.i2c: could not find pctldev for node /smb/pinmux@f7010000/i2c2_pmx_func, deferring probe
[    2.183089] platform f7102000.i2c: Driver i2c_designware requests probe deferral
(...)
[    3.298245] i2c /dev entries driver
[    3.319053] hisi_thermal f7030700.tsensor: THERMAL ALARM: T > 50

Unfortunatly the pin multiplexing documentation has been stripped from the public data sheet: https://github.com/96boards/documentation/raw/master/hikey/Hi6220V100_Multi-Mode_Application_Processor_Function_Description.pdf

I am using ARM Trusted Firmware https://github.com/96boards/arm-trusted-firmware.git branch hikey. The only code about pin multiplexing is related to SD card support.

I am now quite convince it is my issue (at least at the moment…).
I am using the ‘old’ hikey board. The one release at Linaro Connect last year.

The pinmux settings are configured in l-loader.bin, so there’s no need to configure them in ARM-TF and/or UEFI, and you should be able to see ARM-TF and UEFI outputs before Linux loads. If your l-loader.bin is from before 2015.06, please try/build a newer version.

I tried again with the latest version of hisi-idt.py and l-loader.bin and no change…

I can see still this output:

debug EMMC boot: print init OK
debug EMMC boot: send RST_N .
debug EMMC boot: start eMMC boot......
load fastboot1!

but no more firmware output on UART3 prior Linux booting and printing its first late messages.

Here is what I have done:


wget https://raw.githubusercontent.com/96boards/burn-boot/master/hisi-idt.py
wget https://builds.96boards.org/snapshots/hikey/linaro/uefi/latest/l-loader.bin
wget https://builds.96boards.org/snapshots/hikey/linaro/uefi/latest/fip.bin

sudo python hisi-idt.py --img1=l-loader.bin
sudo fastboot flash fastboot fip.bin

And I do not see the expected Grub output and Linux still fails to print its early message on UART3.