summaryrefslogtreecommitdiff
path: root/board/hisilicon/hikey/README
blob: 4c2021f5097ab797b1024649f59d9477f2f0b2aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
Introduction
============

HiKey is the first certified 96Boards Consumer Edition board. The board/SoC has: -
* HiSilicon Kirin 6220 eight-core ARM Cortex-A53 64-bit SoC running at 1.2GHz.
* ARM Mali 450-MP4 GPU
* 1GB 800MHz LPDDR3 DRAM
* 4GB eMMC Flash Storage
* microSD
* 802.11a/b/g/n WiFi, Bluetooth

The HiKey schematic can be found here: -
https://github.com/96boards/documentation/blob/master/hikey/96Boards-Hikey-Rev-A1.pdf

A SoC datasheet can be found here: -
https://github.com/96boards/documentation/blob/master/hikey/
Hi6220V100_Multi-Mode_Application_Processor_Function_Description.pdf

Currently the u-boot port supports: -
* USB
* eMMC
* SD card
* GPIO

The HiKey U-Boot port has been tested with l-loader, booting ATF, which then boots
U-Boot as the bl33.bin executable.

Compile from source
===================

First get all the sources

  > mkdir -p ~/hikey/src ~/hikey/bin
  > cd ~/hikey/src
  > git clone https://github.com/96boards/edk2.git
  > git clone https://github.com/96boards/arm-trusted-firmware.git
  > git clone https://github.com/96boards/l-loader.git
  > git clone https://github.com/96boards/burn-boot.git

Get the BL30 mcuimage.bin binary. It is shipped as part of the UEFI source.
The latest version can be obtained from the edk2 repo.

  > cp edk2/HisiPkg/HiKeyPkg/NonFree/mcuimage.bin ~/hikey/bin/

Get nvme.img binary (check this link is still the latest)
  > wget -P ~/hikey/bin https://builds.96boards.org/releases/reference-platform/debian/hikey/16.03/bootloader/nvme.img

Compile U-Boot
==============

  > cd ~/hikey/src/u-boot
  > make CROSS_COMPILE=aarch64-linux-gnu- hikey_config
  > make CROSS_COMPILE=aarch64-linux-gnu-
  > cp u-boot.bin ~/hikey/bin

Compile ARM Trusted Firmware (ATF)
==================================

  > cd ~/hikey/src/arm-trusted-firmware
  > make CROSS_COMPILE=aarch64-linux-gnu- all fip \
    BL30=~/hikey/bin/mcuimage.bin \
    BL33=~/hikey/bin/u-boot.bin DEBUG=1 PLAT=hikey

Copy resulting binaries
  > cp build/hikey/debug/bl1.bin ~/hikey/bin
  > cp build/hikey/debug/fip.bin ~/hikey/bin

Compile l-loader
===============
  > cd ~/hikey/src/l-loader
  > make BL1=~/hikey/bin/bl1.bin all
  > cp *.img ~/hikey/bin
  > cp l-loader.bin ~/hikey/bin

These instructions are adapted from
https://github.com/96boards/documentation/wiki/HiKeyUEFI

FLASHING
========

1. Connect the second jumper on J15 BOOT SEL, to go into recovery mode and flash l-loader.bin with
the hisi-idt.py utility.

The command below assumes HiKey enumerated as the first USB serial port
  > sudo ~/hikey/src/burn-boot/hisi-idt.py -d /dev/ttyUSB0 --img1=~/hikey/bin/l-loader.bin

2. Once LED 0 comes on solid, HiKey board should be detected as a fastboot device by plugging a USB A to mini B
   cable from your PC to the USB OTG port of HiKey (on some boards I've found this to be unreliable).

  > sudo fastboot devices

0123456789ABCDEF	fastboot

3. Flash the images

  > sudo fastboot flash ptable ~/hikey/bin/ptable.img
  > sudo fastboot flash fastboot ~/hikey/bin/fip.bin
  > sudo fastboot flash nvme ~/hikey/bin/nvme.img

4. Disconnect second jumper on J15 BOOT SEL, and reset the board and you will now (hopefully)
   have ATF, booting u-boot from eMMC. On 'new' boards I've had to do the
   flashing twice in the past to avoid an ATF error.

   Note: To get USB host working, also disconnect the USB OTG cable used for flashing. Otherwise you
   will get 'dwc_otg_core_host_init: Timeout!' errors.

See working boot trace below (by default trace is now output to UART3 not UART0 on latest
ATF, U-Boot and Kernel sources): -

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

Switch to aarch64 mode. CPU0 executes at 0xf9801000!

INFO:    BL1: 0xf9810000 - 0xf9817000 [size = 28672]
NOTICE:  Booting Trusted Firmware
NOTICE:  BL1: v1.1(debug):e8b7174
NOTICE:  BL1: Built : 19:16:44, Sep  8 2015
INFO:    BL1: RAM 0xf9810000 - 0xf9817000
NOTICE:  syspll frequency:1190494208Hz
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 - 0xf9821100
NOTICE:  BL1: Booting BL2
INFO:    BL1: BL2 address = 0xf9818000
INFO:    BL1: BL2 spsr = 0x3c5
INFO:    [BDID] [fff91c18] midr: 0x410fd033
INFO:    [BDID] [fff91c1c] board type: 0
INFO:    [BDID] [fff91c20] board id: 0x2b
INFO:    init_acpu_dvfs: pmic version 17
INFO:    init_acpu_dvfs: ACPU_CHIP_MAX_FREQ=0x186a00.
INFO:    acpu_dvfs_volt_init: success!
INFO:    acpu_dvfs_set_freq: support freq num is 5
INFO:    acpu_dvfs_set_freq: start prof is 0x4
INFO:    acpu_dvfs_set_freq: magic is 0x5a5ac5c5
INFO:    acpu_dvfs_set_freq: voltage:
INFO:      - 0: 0x49
INFO:      - 1: 0x49
INFO:      - 2: 0x50
INFO:      - 3: 0x60
INFO:      - 4: 0x78
NOTICE:  acpu_dvfs_set_freq: set acpu freq success!NOTICE:  BL2: v1.1(debug):e8b7174
NOTICE:  BL2: Built : 19:16:46, Sep  8 2015
INFO:    BL2: Loading BL3-0
INFO:    Using FIP
INFO:    Loading file 'bl30.bin' at address 0x1000000
INFO:    Skip reserving memory: 0x1000000 - 0x1023270
INFO:    File 'bl30.bin' loaded: 0x1000000 - 0x1023270
INFO:    bl2_plat_handle_bl30: [1000000] 3a334d43 34313032 2f38302f 30203133
INFO:    bl2_plat_handle_bl30: [10000c8] 0 0 b 0
INFO:    bl2_plat_handle_bl30: [1000190] 17 0 0 0
INFO:    bl2_plat_handle_bl30: [1023260] 0 0 0 0
INFO:    hisi_mcu_load_image: mcu sections 0:
INFO:    hisi_mcu_load_image:  src  = 0x1000200
INFO:    hisi_mcu_load_image:  dst  = 0xf6000000
INFO:    hisi_mcu_load_image:  size = 512
INFO:    hisi_mcu_load_image:  [SRC 0x1000200] 0x7600 0x201 0x1eae1 0x1ea71
INFO:    hisi_mcu_load_image:  [DST 0xf6000000] 0x7600 0x201 0x1eae1 0x1ea71
INFO:    hisi_mcu_load_image: mcu sections 1:
INFO:    hisi_mcu_load_image:  src  = 0x1000400
INFO:    hisi_mcu_load_image:  dst  = 0xf6000200
INFO:    hisi_mcu_load_image:  size = 27828
INFO:    hisi_mcu_load_image:  [SRC 0x1000400] 0xbf00bf00 0x4815b672 0x48154780 0x60014915
INFO:    hisi_mcu_load_image:  [DST 0xf6000200] 0xbf00bf00 0x4815b672 0x48154780 0x60014915
INFO:    hisi_mcu_load_image: mcu sections 2:
INFO:    hisi_mcu_load_image:  src  = 0x10070b4
INFO:    hisi_mcu_load_image:  dst  = 0xf6007200
INFO:    hisi_mcu_load_image:  size = 1024
INFO:    hisi_mcu_load_image:  [SRC 0x10070b4] 0x55 0x0 0x0 0x0
INFO:    hisi_mcu_load_image:  [DST 0xf6007200] 0x55 0x0 0x0 0x0
INFO:    hisi_mcu_load_image: mcu sections 3:
INFO:    hisi_mcu_load_image:  src  = 0x10074b4
INFO:    hisi_mcu_load_image:  dst  = 0xfff8e000
INFO:    hisi_mcu_load_image:  size = 12704
INFO:    hisi_mcu_load_image:  [SRC 0x10074b4] 0x55 0x0 0x0 0x0
INFO:    hisi_mcu_load_image:  [DST 0xfff8e000] 0x55 0x0 0x0 0x0
INFO:    hisi_mcu_load_image: mcu sections 4:
INFO:    hisi_mcu_load_image:  src  = 0x100a654
INFO:    hisi_mcu_load_image:  dst  = 0x5e00000
INFO:    hisi_mcu_load_image:  size = 82912
INFO:    hisi_mcu_load_image:  [SRC 0x100a654] 0x4ff0e92d 0x2cc5f645 0x2600b0ab 0x2c7cf6c0
INFO:    hisi_mcu_load_image:  [DST 0x5e00000] 0x4ff0e92d 0x2cc5f645 0x2600b0ab 0x2c7cf6c0
INFO:    hisi_mcu_load_image: mcu sections 5:
INFO:    hisi_mcu_load_image:  src  = 0x101ea34
INFO:    hisi_mcu_load_image:  dst  = 0x5e143e0
INFO:    hisi_mcu_load_image:  size = 12816
INFO:    hisi_mcu_load_image:  [SRC 0x101ea34] 0x33323130 0x37363534 0x42413938 0x46454443
INFO:    hisi_mcu_load_image:  [DST 0x5e143e0] 0x33323130 0x37363534 0x42413938 0x46454443
INFO:    hisi_mcu_load_image: mcu sections 6:
INFO:    hisi_mcu_load_image:  src  = 0x1021c44
INFO:    hisi_mcu_load_image:  dst  = 0x5e1c1d0
INFO:    hisi_mcu_load_image:  size = 3060
INFO:    hisi_mcu_load_image:  [SRC 0x1021c44] 0x0 0x0 0x0 0x0
INFO:    hisi_mcu_load_image:  [DST 0x5e1c1d0] 0x0 0x0 0x0 0x0
INFO:    hisi_mcu_load_image: mcu sections 7:
INFO:    hisi_mcu_load_image:  src  = 0x1022838
INFO:    hisi_mcu_load_image:  dst  = 0x5e1cdc4
INFO:    hisi_mcu_load_image:  size = 2616
INFO:    hisi_mcu_load_image:  [SRC 0x1022838] 0xf80000a0 0x0 0xf80000ac 0x0
INFO:    hisi_mcu_load_image:  [DST 0x5e1cdc4] 0xf80000a0 0x0 0xf80000ac 0x0
INFO:    hisi_mcu_start_run: AO_SC_SYS_CTRL2=0
INFO:    bl2_plat_handle_bl30: mcu pc is 42933301
INFO:    bl2_plat_handle_bl30: AO_SC_PERIPH_CLKSTAT4	is 39018f09
INFO:    BL2: TrustZone: protecting 16777216 bytes of memory at 0x3f000000
INFO:    BL2: Loading BL3-1
INFO:    Using FIP
INFO:    Loading file 'bl31.bin' at address 0xf9858000
INFO:    File 'bl31.bin' loaded: 0xf9858000 - 0xf9861010
INFO:    BL2: Loading BL3-2
INFO:    Using FIP
WARNING: Failed to access image 'bl32.bin' (-1)
WARNING: Failed to load BL3-2 (-1)
INFO:    BL2: Loading BL3-3
INFO:    Using FIP
INFO:    Loading file 'bl33.bin' at address 0x35000000
INFO:    File 'bl33.bin' loaded: 0x35000000 - 0x3504c468
NOTICE:  BL1: Booting BL3-1
INFO:    BL1: BL3-1 address = 0xf9858000
INFO:    BL1: BL3-1 spsr = 0x3cd
INFO:    BL1: BL3-1 params address = 0xf9821920
INFO:    BL1: BL3-1 plat params address = 0x0
NOTICE:  BL3-1: v1.1(debug):e8b7174
NOTICE:  BL3-1: Built : 19:16:49, Sep  8 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x35000000
INFO:    BL3-1: Next image spsr = 0x3c9

U-Boot 2015.10-rc2 (Sep 08 2015 - 20:29:33 +0100)hikey

DRAM:  1008 MiB
HI6553 PMIC init
MMC:   config_sd_carddetect: SD card not present
HiKey DWMMC: 0, HiKey DWMMC: 1
Card did not respond to voltage select!
** Bad device mmc 1 **
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0
starting USB...
USB0:   Core Release: 3.00a
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found