Name Date Size #Lines LOC

..02-Mar-2023-

SPI/H07-Mar-2021-359302

SPL/H07-Mar-2021-169139

chromium/H07-Mar-2021-9181

device-tree-bindings/H07-Mar-2021-10,7298,963

driver-model/H07-Mar-2021-3,4802,676

imx/H07-Mar-2021-1,9721,459

mvebu/H07-Mar-2021-11377

uImage.FIT/H07-Mar-2021-3,3382,744

usage/H10-Mar-2023-2419

I2C_Edge_ConditionsH A D07-Mar-20211.6 KiB4736

README.440-DDR-performanceH A D07-Mar-20213.8 KiB9181

README.AMCC-eval-boards-cleanupH A D07-Mar-20211 KiB3220

README.ARCH A D07-Mar-20211.3 KiB2819

README.ARM-memory-mapH A D07-Mar-2021782 1815

README.AX25H A D07-Mar-20211.2 KiB4738

README.Heterogeneous-SoCsH A D07-Mar-20213.6 KiB10676

README.JFFS2H A D07-Mar-20211.5 KiB4130

README.JFFS2_NANDH A D07-Mar-2021219 95

README.LEDH A D07-Mar-20212.4 KiB7854

README.LED_displayH A D07-Mar-2021891 2718

README.N1213H A D07-Mar-20211.4 KiB5648

README.NDS32H A D07-Mar-20211.6 KiB4235

README.NetConsoleH A D07-Mar-20213.7 KiB9873

README.OFTH A D07-Mar-2021847 2917

README.POSTH A D07-Mar-202125.4 KiB733548

README.SNTPH A D07-Mar-2021720 1814

README.SPLH A D07-Mar-20213.3 KiB9873

README.TPLH A D07-Mar-20211.5 KiB4633

README.VLANH A D07-Mar-2021551 1611

README.VSC3316-3308H A D07-Mar-20212.4 KiB4433

README.ae350H A D07-Mar-202110.3 KiB276234

README.ag101pH A D07-Mar-2021960 3726

README.android-fastbootH A D07-Mar-20215.8 KiB215150

README.android-fastboot-protocolH A D07-Mar-20215.8 KiB171111

README.arm-cachesH A D07-Mar-20212.2 KiB5444

README.arm-relocationH A D07-Mar-20215.8 KiB194139

README.arm64H A D07-Mar-20212.3 KiB5746

README.armada-securebootH A D07-Mar-202116.9 KiB374304

README.at91H A D07-Mar-20215.7 KiB175124

README.atmel_mciH A D07-Mar-20212.3 KiB7562

README.atmel_pmeccH A D07-Mar-20212.3 KiB5039

README.autobootH A D07-Mar-20215 KiB140110

README.avb2H A D07-Mar-20213.9 KiB11290

README.b4860qdsH A D07-Mar-202113.7 KiB367320

README.bcm7xxxH A D07-Mar-20213.6 KiB151130

README.bedbugH A D07-Mar-20212 KiB7957

README.bitbangMIIH A D07-Mar-20212.4 KiB5746

README.blackfinH A D07-Mar-20211.5 KiB4735

README.bloblistH A D07-Mar-20212.7 KiB8356

README.bootmenuH A D07-Mar-20213.9 KiB9975

README.bostonH A D07-Mar-20211.8 KiB5946

README.bus_vcxkH A D07-Mar-20211.8 KiB6845

README.cfiH A D07-Mar-20211.8 KiB6448

README.chromiumH A D07-Mar-20217.2 KiB240149

README.clangH A D07-Mar-20212.2 KiB5644

README.coccinelleH A D07-Mar-202115.5 KiB492339

README.commandsH A D07-Mar-20214.2 KiB13792

README.commands.itestH A D07-Mar-2021636 1713

README.commands.splH A D07-Mar-20211,014 3224

README.consoleH A D07-Mar-20213.1 KiB10172

README.davinciH A D07-Mar-20214.2 KiB160109

README.davinci.nand_splH A D07-Mar-20215 KiB142111

README.dfutftpH A D07-Mar-20213.5 KiB12183

README.displaying-bmpsH A D07-Mar-20211.2 KiB2823

README.distroH A D07-Mar-202116.1 KiB408301

README.dnsH A D07-Mar-20212 KiB6349

README.drivers.ethH A D07-Mar-20217.1 KiB216177

README.enetaddrH A D07-Mar-20214.8 KiB11993

README.esbc_validateH A D07-Mar-20211.7 KiB4137

README.ext4H A D07-Mar-20212.2 KiB8455

README.falconH A D07-Mar-20218.4 KiB231172

README.fdt-controlH A D07-Mar-20218.4 KiB231165

README.fdt-overlaysH A D07-Mar-20212.7 KiB11579

README.fec_mxcH A D07-Mar-20211.4 KiB4030

README.fsl-clkH A D07-Mar-2021127 64

README.fsl-ddrH A D07-Mar-202121.4 KiB440378

README.fsl-dpaaH A D07-Mar-2021494 119

README.fsl-esdhcH A D07-Mar-2021864 2320

README.fsl-hwconfigH A D07-Mar-20211.4 KiB4732

README.fsl-trustzone-componentsH A D07-Mar-20211.3 KiB2622

README.fsl_iimH A D07-Mar-20211.4 KiB4935

README.fuseH A D07-Mar-20212.7 KiB6849

README.generic-boardH A D07-Mar-20215.5 KiB136100

README.generic_usb_ohciH A D07-Mar-20211.6 KiB6439

README.gptH A D07-Mar-202111 KiB297235

README.hwconfigH A D07-Mar-20212 KiB5139

README.i2cH A D07-Mar-20212.6 KiB6147

README.iomuxH A D07-Mar-20213.6 KiB9069

README.iscsiH A D07-Mar-20217.4 KiB171134

README.kconfigH A D07-Mar-20216 KiB159116

README.kwbimageH A D07-Mar-20213.3 KiB10587

README.link-localH A D07-Mar-20212.3 KiB7661

README.logH A D07-Mar-20218.5 KiB283181

README.lynxkdiH A D07-Mar-20211.7 KiB5839

README.m54418twrH A D07-Mar-20218.7 KiB246216

README.m68kH A D07-Mar-20214.8 KiB151109

README.maltaH A D07-Mar-2021517 1710

README.marubun-pcmciaH A D07-Mar-20212 KiB6650

README.marvellH A D07-Mar-20211.6 KiB5436

README.mediatekH A D07-Mar-20216.1 KiB222138

README.memory-testH A D07-Mar-20214.9 KiB9982

README.menuH A D07-Mar-20212.9 KiB12599

README.mipsH A D07-Mar-20211.6 KiB5535

README.mpc74xxH A D07-Mar-2021839 2316

README.mpc83xx.ddreccH A D07-Mar-20214.5 KiB155110

README.mpc83xxadsH A D07-Mar-20212.2 KiB9863

README.mpc85xxH A D07-Mar-20215.9 KiB167133

README.mpc85xx-sd-spi-bootH A D07-Mar-20212.4 KiB7655

README.mpc85xx-spin-tableH A D07-Mar-20211.5 KiB2723

README.mpc85xxcdsH A D07-Mar-20216.1 KiB226167

README.multi-dtb-fitH A D07-Mar-20213.7 KiB6659

README.mxc_ocotpH A D07-Mar-20211.6 KiB5237

README.nandH A D07-Mar-202113.4 KiB346278

README.nand-boot-ppc440H A D07-Mar-20212 KiB6144

README.ne2000H A D07-Mar-20211.2 KiB3924

README.nios2H A D07-Mar-20213.1 KiB9668

README.nokia_rx51H A D07-Mar-20214.1 KiB10575

README.nvmeH A D07-Mar-20213.1 KiB8564

README.odroidH A D07-Mar-202111.6 KiB333283

README.omap-ulpi-viewportH A D07-Mar-2021899 2821

README.omap3H A D07-Mar-20214.4 KiB210138

README.pblimageH A D07-Mar-20213.1 KiB11294

README.plan9H A D07-Mar-2021785 1914

README.power-frameworkH A D07-Mar-20216.5 KiB167127

README.pxeH A D07-Mar-202110.1 KiB250193

README.qemu-armH A D07-Mar-20212.5 KiB6952

README.qemu-mipsH A D07-Mar-20216.5 KiB196151

README.qemu-riscvH A D07-Mar-20211.5 KiB4735

README.ramboot-ppc85xxH A D07-Mar-20214.2 KiB10385

README.rmobileH A D07-Mar-20213.8 KiB9870

README.rockchipH A D07-Mar-202112.6 KiB390269

README.rockusbH A D07-Mar-20211.6 KiB5741

README.s5pc1xxH A D07-Mar-20211.2 KiB7344

README.sataH A D07-Mar-20211.5 KiB6946

README.schedH A D07-Mar-20211.8 KiB5437

README.scrapyardH A D07-Mar-202131.8 KiB359356

README.semihostingH A D07-Mar-20211.7 KiB3931

README.serial_multiH A D07-Mar-20211.7 KiB5539

README.shH A D07-Mar-20212.8 KiB10585

README.sh7752evbH A D07-Mar-20211.3 KiB6844

README.sh7753evbH A D07-Mar-20211.3 KiB6844

README.sha1H A D07-Mar-20211.8 KiB5939

README.sifive-fu540H A D07-Mar-202115.6 KiB304284

README.silentH A D07-Mar-20211.3 KiB2922

README.socfpgaH A D07-Mar-20215.2 KiB150108

README.spearH A D07-Mar-20212.4 KiB7564

README.splashprepareH A D07-Mar-20211.6 KiB3226

README.srio-pcie-boot-corenetH A D07-Mar-20215.3 KiB11998

README.standaloneH A D07-Mar-20214.4 KiB12191

README.t1040-l2switchH A D07-Mar-20212.9 KiB6458

README.teeH A D07-Mar-20214 KiB11379

README.ti-secureH A D07-Mar-20219.8 KiB217172

README.traceH A D07-Mar-202110.1 KiB347245

README.u-boot_on_efiH A D07-Mar-20219.1 KiB253192

README.ubiH A D07-Mar-20216.5 KiB226176

README.ubisplH A D07-Mar-20214.1 KiB142111

README.ublimageH A D07-Mar-20214.4 KiB142106

README.uefiH A D07-Mar-202111.9 KiB349242

README.unaligned-memory-access.txtH A D07-Mar-20219.5 KiB241186

README.uniphierH A D07-Mar-202114 KiB463344

README.updateH A D07-Mar-20214.1 KiB10374

README.usbH A D07-Mar-20218.4 KiB232181

README.vf610H A D07-Mar-2021302 117

README.videoH A D07-Mar-20213.8 KiB9872

README.virtioH A D07-Mar-20218.9 KiB254202

README.vxworksH A D07-Mar-20214.5 KiB10380

README.watchdogH A D07-Mar-20211.2 KiB3426

README.x86H A D07-Mar-202146.9 KiB1,187901

README.xtensaH A D07-Mar-20214.3 KiB9875

README.zfsH A D07-Mar-2021903 3021

README.zynqH A D07-Mar-20212.4 KiB8464

bouncesH A D07-Mar-2021180 43

feature-removal-schedule.txtH A D07-Mar-20211.5 KiB4432

git-mailrcH A D07-Mar-20214.9 KiB127111

kwboot.1H A D07-Mar-20212.5 KiB8566

mkimage.1H A D07-Mar-20216.7 KiB234193

README.440-DDR-performance

1AMCC suggested to set the PMU bit to 0 for best performace on the
2PPC440 DDR controller. The 440er common DDR setup files (sdram.c &
3spd_sdram.c) are changed accordingly. So all 440er boards using
4these setup routines will automatically receive this performance
5increase.
6
7Please see below some benchmarks done by AMCC to demonstrate this
8performance changes:
9
10
11----------------------------------------
12SDRAM0_CFG0[PMU] = 1 (U-Boot default for Bamboo, Yosemite and Yellowstone)
13----------------------------------------
14Stream benchmark results
15-------------------------------------------------------------
16This system uses 8 bytes per DOUBLE PRECISION word.
17-------------------------------------------------------------
18Array size = 2000000, Offset = 0
19Total memory required = 45.8 MB.
20Each test is run 10 times, but only
21the *best* time for each is used.
22-------------------------------------------------------------
23Your clock granularity/precision appears to be 1 microseconds.
24Each test below will take on the order of 112345 microseconds.
25   (= 112345 clock ticks)
26Increase the size of the arrays if this shows that you are not getting
27at least 20 clock ticks per test.
28-------------------------------------------------------------
29WARNING -- The above is only a rough guideline.
30For best results, please be sure you know the precision of your system
31timer.
32-------------------------------------------------------------
33Function      Rate (MB/s)   RMS time     Min time     Max time
34Copy:         256.7683       0.1248       0.1246       0.1250
35Scale:        246.0157       0.1302       0.1301       0.1302
36Add:          255.0316       0.1883       0.1882       0.1885
37Triad:        253.1245       0.1897       0.1896       0.1899
38
39
40TTCP Benchmark Results
41ttcp-t: socket
42ttcp-t: connect
43ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5000  tcp  ->
44localhost
45ttcp-t: 16777216 bytes in 0.28 real seconds = 454.29 Mbit/sec +++
46ttcp-t: 2048 I/O calls, msec/call = 0.14, calls/sec = 7268.57
47ttcp-t: 0.0user 0.1sys 0:00real 60% 0i+0d 0maxrss 0+2pf 3+1506csw
48
49----------------------------------------
50SDRAM0_CFG0[PMU] = 0 (Suggested modification)
51Setting PMU = 0 provides a noticeable performance improvement *2% to
525% improvement in memory performance.
53*Improves the Mbit/sec for TTCP benchmark by almost 76%.
54----------------------------------------
55Stream benchmark results
56-------------------------------------------------------------
57This system uses 8 bytes per DOUBLE PRECISION word.
58-------------------------------------------------------------
59Array size = 2000000, Offset = 0
60Total memory required = 45.8 MB.
61Each test is run 10 times, but only
62the *best* time for each is used.
63-------------------------------------------------------------
64Your clock granularity/precision appears to be 1 microseconds.
65Each test below will take on the order of 120066 microseconds.
66   (= 120066 clock ticks)
67Increase the size of the arrays if this shows that you are not getting
68at least 20 clock ticks per test.
69-------------------------------------------------------------
70WARNING -- The above is only a rough guideline.
71For best results, please be sure you know the precision of your system
72timer.
73-------------------------------------------------------------
74Function      Rate (MB/s)   RMS time     Min time     Max time
75Copy:         262.5167       0.1221       0.1219       0.1223
76Scale:        258.4856       0.1238       0.1238       0.1240
77Add:          262.5404       0.1829       0.1828       0.1831
78Triad:        266.8594       0.1800       0.1799       0.1802
79
80TTCP Benchmark Results
81ttcp-t: socket
82ttcp-t: connect
83ttcp-t: buflen=8192, nbuf=2048, align=16384/0, port=5000  tcp  ->
84localhost
85ttcp-t: 16777216 bytes in 0.16 real seconds = 804.06 Mbit/sec +++
86ttcp-t: 2048 I/O calls, msec/call = 0.08, calls/sec = 12864.89
87ttcp-t: 0.0user 0.0sys 0:00real 46% 0i+0d 0maxrss 0+2pf 120+1csw
88
89
902006-07-28, Stefan Roese <sr@denx.de>
91

README.AMCC-eval-boards-cleanup

1---------------------------------------------------------------------
2Cleanup of AMCC eval boards (Walnut/Sycamore, Bubinga, Ebony, Ocotea)
3---------------------------------------------------------------------
4
5Changes to all AMCC eval boards:
6--------------------------------
7
8o Changed u-boot image size to 256 kBytes instead of 512 kBytes on most
9  boards.
10
11o Use 115200 baud as default console baudrate.
12
13o Added config option to use redundant environment in flash. This is also
14  the default setting. Option for environment in nvram is still available
15  for backward compatibility.
16
17o Merged board specific flash drivers to common flash driver:
18  board/amcc/common/flash.c
19
20
21Sycamore/Walnut (one port supporting both eval boards):
22-------------------------------------------------------
23
24o Cleanup to allow easier "cloning" for different (custom) boards:
25
26  o Moved EBC configuration from board specific asm-file "init.S"
27    using defines in board configuration file. No board specific
28    asm file needed anymore.
29
30
31August 01 2005, Stefan Roese <sr@denx.de>
32

README.ARC

1Synopsys' DesignWare(r) ARC(r) Processors are a family of 32-bit CPUs
2that SoC designers can optimize for a wide range of uses, from deeply embedded
3to high-performance host applications.
4
5More information on ARC cores avaialble here:
6http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/Pages/default.aspx
7
8Designers can differentiate their products by using patented configuration
9technology to tailor each ARC processor instance to meet specific performance,
10power and area requirements.
11
12The DesignWare ARC processors are also extendable, allowing designers to add
13their own custom instructions that dramatically increase performance.
14
15Synopsys' ARC processors have been used by over 170 customers worldwide who
16collectively ship more than 1 billion ARC-based chips annually.
17
18All DesignWare ARC processors utilize a 16-/32-bit ISA that provides excellent
19performance and code density for embedded and host SoC applications.
20
21The RISC microprocessors are synthesizable and can be implemented in any foundry
22or process, and are supported by a complete suite of development tools.
23
24The ARC GNU toolchain with support for all ARC Processors can be downloaded
25from here (available pre-built toolchains as well):
26
27https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases
28

README.ARM-memory-map

1Subject: Re: [PATCH][CFT] bring ARM memory layout in line with the documented behaviour
2From: "Anders Larsen" <alarsen@rea.de>
3Date: Thu, 18 Sep 2003 14:15:21 +0200
4To: Wolfgang Denk <wd@denx.de>
5
6...
7>I still see  references  to  _armboot_start,  _armboot_end_data,  and
8>_armboot_end - which role do these play now? Can we get rid of them?
9>
10>How are they (should they be) set in your memory map above?
11
12_armboot_start contains the value of CONFIG_SYS_TEXT_BASE (0xA07E0000); it seems
13CONFIG_SYS_TEXT_BASE and _armboot_start are both used for the same purpose in
14different parts of the (ARM) code.
15Furthermore, the startup code (cpu/<arm>/start.S) internally uses
16another variable (_TEXT_BASE) with the same content as _armboot_start.
17I agree that this mess should be cleaned up.
18

README.AX25

1AX25 is Andes CPU IP to adopt RISC-V architecture.
2
3Features
4========
5
6CPU Core
7 - 5-stage in-order execution pipeline
8 - Hardware Multiplier
9	 - radix-2/radix-4/radix-16/radix-256/fast
10 - Hardware Divider
11 - Optional branch prediction
12 - Machine mode and optional user mode
13 - Optional performance monitoring
14
15ISA
16 - RV64I base integer instructions
17 - RVC for 16-bit compressed instructions
18 - RVM for multiplication and division instructions
19
20Memory subsystem
21 - I & D local memory
22   - Size: 4KB to 16MB
23 - Memory subsyetem soft-error protection
24   - Protection scheme: parity-checking or error-checking-and-correction (ECC)
25   - Automatic hardware error correction
26
27Bus
28 - Interface Protocol
29   - Synchronous AHB (32-bit/64-bit data-width), or
30   - Synchronous AXI4 (64-bit data-width)
31
32Power management
33 - Wait for interrupt (WFI) mode
34
35Debug
36 - Configurable number of breakpoints: 2/4/8
37 - External Debug Module
38   - AHB slave port
39 - External JTAG debug transport module
40
41Platform Level Interrupt Controller (PLIC)
42 - AHB slave port
43 - Configurable number of interrupts: 1-1023
44 - Configurable number of interrupt priorities: 3/7/15/63/127/255
45 - Configurable number of targets:  1-16
46 - Preempted interrupt priority stack
47

README.Heterogeneous-SoCs

1DSP side awareness for Freescale heterogeneous multicore chips based on
2StarCore and Power Architecture
3===============================================================
4powerpc/mpc85xx code ve APIs and function to get the number,
5configuration and frequencies of all PowerPC cores and devices
6connected to them, but it didnt have the similar code ofr HEterogeneous
7SC3900/DSP cores and such devices like CPRI, MAPLE, MAPLE-ULB etc.
8
9Code for DSP side awareness provides such functionality for Freescale
10Heterogeneous SoCs which are chasis-2 compliant like B4860 and B4420
11
12As part of this feature, following changes have been made:
13==========================================================
14
151. Changed files:
16=================
17- arch/powerpc/cpu/mpc85xx/cpu.c
18
19Code added in this file to print the DSP cores and other device's(CPRI,
20MAPLE etc) frequencies
21
22- arch/powerpc/cpu/mpc85xx/speed.c
23
24Added Defines and code to extract the frequncy information for all
25required cores and devices from RCW and System frequency
26
27- arch/powerpc/cpu/mpc8xxx/cpu.c
28
29Added API to get the number of SC cores in running system and Their BIT
30MASK, similar to the code written for PowerPC
31
32- arch/powerpc/include/asm/config_mpc85xx.h
33
34Added top level CONFIG to identify presence of HETEROGENUOUS clusters
35in the system and CONFIGS for SC3900/DSP components
36
37- arch/powerpc/include/asm/processor.h
38- include/common.h
39
40Added newly added Functions Declaration
41
42- include/e500.h
43
44Global structure updated for dsp cores and other components
45
462. CONFIGs ADDED
47================
48
49CONFIG_HETROGENOUS_CLUSTERS	- Define for checking the presence of
50				  DSP/SC3900 core clusters
51
52CONFIG_SYS_FSL_NUM_CC_PLLS	- Define for number of PLLs
53
54Though there are only 4 PLLs in B4, but in sequence of PLLs from PLL1 -
55PLL5, PLL3 is Reserved(as mentioned in RM), so this define contains the
56value as 5 not 4, to iterate over all PLLs while coding
57
58CONFIG_SYS_MAPLE		- Define for MAPLE Baseband Accelerator
59CONFIG_SYS_CPRI			- Define for CPRI Interface
60CONFIG_PPC_CLUSTER_START	- Start index of ppc clusters
61CONFIG_DSP_CLUSTER_START	- Start index of dsp clusters
62
63Following are the defines for PLL's index that provide the Clocking to
64CPRI, ULB and ETVE components
65
66CONFIG_SYS_CPRI_CLK		- Define PLL index for CPRI clock
67CONFIG_SYS_ULB_CLK		- Define PLL index for ULB clock
68CONFIG_SYS_ETVPE_CLK		- Define PLL index for ETVPE clock
69
703. Changes in MPC85xx_SYS_INFO Global structure
71===============================================
72
73DSP cores and other device's components have been added in this structure.
74
75freq_processor_dsp[CONFIG_MAX_DSP_CPUS]	- Array to contain the DSP core's frequencies
76freq_cpri				- To store CPRI frequency
77freq_maple				- To store MAPLE frequency
78freq_maple_ulb				- To store MAPLE-ULB frequency
79freq_maple_etvpe			- To store MAPLE-eTVPE frequency
80
814. U-BOOT LOGS
82==============
834.1 B4860QDS board
84    Boot from NOR flash
85
86U-Boot 2014.07-00222-g70587a8-dirty (Aug 07 2014 - 13:15:47)
87
88CPU0:  B4860E, Version: 2.0, (0x86880020)
89Core:  e6500, Version: 2.0, (0x80400020) Clock Configuration:
90       CPU0:1600 MHz, CPU1:1600 MHz, CPU2:1600 MHz, CPU3:1600 MHz,
91       DSP CPU0:1200 MHz, DSP CPU1:1200 MHz, DSP CPU2:1200 MHz, DSP CPU3:1200 MHz,
92       DSP CPU4:1200 MHz, DSP CPU5:1200 MHz,
93       CCB:666.667 MHz,
94       DDR:933.333 MHz (1866.667 MT/s data rate) (Asynchronous), IFC:166.667 MHz
95       CPRI:600  MHz
96       MAPLE:600  MHz, MAPLE-ULB:800  MHz, MAPLE-eTVPE:1000 MHz
97       FMAN1: 666.667 MHz
98       QMAN:  333.333 MHz
99
100CPUn	 -  PowerPC core
101DSP CPUn -  SC3900 core
102
103Shaveta Leekha(shaveta@freescale.com)
104Created August 7, 2014
105===========================================
106

README.JFFS2

1JFFS2 options and usage.
2-----------------------
3
4JFFS2 in U-Boot is a read only implementation of the file system in
5Linux with the same name. To use JFFS2 define CONFIG_CMD_JFFS2.
6
7The module adds three new commands.
8fsload  - load binary file from a file system image
9fsinfo  - print information about file systems
10ls      - list files in a directory
11chpart  - change active partition
12
13If you do now need the commands, you can enable the filesystem separately
14with CONFIG_FS_JFFS2 and call the jffs2 functions yourself.
15
16If you boot from a partition which is mounted writable, and you
17update your boot environment by replacing single files on that
18partition, you should also define CONFIG_SYS_JFFS2_SORT_FRAGMENTS. Scanning
19the JFFS2 filesystem takes *much* longer with this feature, though.
20Sorting is done while inserting into the fragment list, which is
21more or less a bubble sort. That algorithm is known to be O(n^2),
22thus you should really consider if you can avoid it!
23
24
25There only one way for JFFS2 to find the disk. It uses the flash_info
26structure to find the start of a JFFS2 disk (called partition in the code)
27and you can change where the partition is with two defines.
28
29CONFIG_SYS_JFFS2_FIRST_BANK
30	defined the first flash bank to use
31
32CONFIG_SYS_JFFS2_FIRST_SECTOR
33	defines the first sector to use
34---
35
36TODO.
37
38	Remove the assumption that JFFS can dereference a pointer
39	into the disk. The current code do not work with memory holes
40	or hardware with a sliding window (PCMCIA).
41

README.JFFS2_NAND

1JFFS2 NAND support:
2
3To enable, use the following #define in the board configuration file:
4
5#define CONFIG_JFFS2_NAND
6
7Configuration of partitions is similar to how this is done in  U-Boot
8for  JFFS2  on top NOR flash.
9

README.LED

1Status LED
2========================================
3
4This README describes the status LED API.
5
6The API is defined by the include file include/status_led.h
7
8The first step is to enable CONFIG_LED_STATUS in menuconfig:
9> Device Drivers > LED Support.
10
11If the LED support is only for specific board, enable
12CONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig.
13
14Status LEDS 0 to 5 are enabled by the following configurations at menuconfig:
15CONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5
16
17The following should be configured for each of the enabled LEDs:
18CONFIG_STATUS_LED_BIT<n>
19CONFIG_STATUS_LED_STATE<n>
20CONFIG_STATUS_LED_FREQ<n>
21Where <n> is an integer 1 through 5 (empty for 0).
22
23CONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which LED
24is being acted on. As such, the value choose must be unique with with respect to
25the other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the
26reponsiblity of the __led_* function.
27
28CONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to one
29of these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON.
30
31CONFIG_STATUS_LED_FREQ determines the LED blink frequency.
32Values range from 2 to 10.
33
34Some other LED macros
35---------------------
36
37CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting.
38This must be a valid LED number (0-5).
39
40CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be
41a valid LED number (0-5). Other similar color LED's macros are
42CONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE.
43
44General LED functions
45---------------------
46The following functions should be defined:
47
48__led_init is called once to initialize the LED to CONFIG_STATUS_LED_STATE.
49One time start up code should be placed here.
50
51__led_set is called to change the state of the LED.
52
53__led_toggle is called to toggle the current state of the LED.
54
55Colour LED
56========================================
57
58Colour LED's are at present only used by ARM.
59
60The functions names explain their purpose.
61
62coloured_LED_init
63red_LED_on
64red_LED_off
65green_LED_on
66green_LED_off
67yellow_LED_on
68yellow_LED_off
69blue_LED_on
70blue_LED_off
71
72These are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define
73these functions in the board specific source.
74
75TBD : Describe older board dependent macros similar to what is done for
76
77TBD : Describe general support via asm/status_led.h
78

README.LED_display

1LED display internal API
2=======================================
3
4This README describes the LED display API.
5
6The API is defined by the include file include/led-display.h
7
8The first step in to define CONFIG_CMD_DISPLAY in the board config file.
9Then you need to provide the following functions to access LED display:
10
11void display_set(int cmd);
12
13This function should control the state of the LED display. Argument is
14an ORed combination of the following values:
15 DISPLAY_CLEAR	-- clear the display
16 DISPLAY_HOME	-- set the position to the beginning of display
17
18int display_putc(char c);
19
20This function should display it's parameter on the LED display in the
21current position. Returns the displayed character on success or -1 in
22case of failure.
23
24With this functions defined 'display' command will display it's
25arguments on the LED display (or clear the display if called without
26arguments).
27

README.N1213

1N1213 is a configurable hard/soft core of NDS32's N12 CPU family.
2
3Features
4========
5
6CPU Core
7 - 16-/32-bit mixable instruction format.
8 - 32 general-purpose 32-bit registers.
9 - 8-stage pipeline.
10 - Dynamic branch prediction.
11 - 32/64/128/256 BTB.
12 - Return address stack (RAS).
13 - Vector interrupts for internal/external.
14   interrupt controller with 6 hardware interrupt signals.
15 - 3 HW-level nested interruptions.
16 - User and super-user mode support.
17 - Memory-mapped I/O.
18 - Address space up to 4GB.
19
20Memory Management Unit
21 - TLB
22   - 4/8-entry fully associative iTLB/dTLB.
23   - 32/64/128-entry 4-way set-associati.ve main TLB.
24   - TLB locking support
25 - Optional hardware page table walker.
26 - Two groups of page size support.
27  - 4KB & 1MB.
28  - 8KB & 1MB.
29
30Memory Subsystem
31 - I & D cache.
32   - Virtually indexed and physically tagged.
33   - Cache size: 8KB/16KB/32KB/64KB.
34   - Cache line size: 16B/32B.
35   - Set associativity: 2-way, 4-way or direct-mapped.
36   - Cache locking support.
37 - I & D local memory (LM).
38   - Size: 4KB to 1MB.
39   - Bank numbers: 1 or 2.
40   - Optional 1D/2D DMA engine.
41   - Internal or external to CPU core.
42
43Bus Interface
44 - Synchronous/Asynchronous AHB bus: 0, 1 or 2 ports.
45 - Synchronous High speed memory port.
46   (HSMP): 0, 1 or 2 ports.
47
48Debug
49 - JTAG debug interface.
50 - Embedded debug module (EDM).
51 - Optional embedded program tracer interface.
52
53Miscellaneous
54 - Programmable data endian control.
55 - Performance monitoring mechanism.
56

README.NDS32

1NDS32 is a new high-performance 32-bit RISC microprocessor core.
2
3http://www.andestech.com/
4
5AndeStar ISA
6============
7AndeStar is a patent-pending 16-bit/32-bit mixed-length instruction set to
8achieve optimal system performance, code density, and power efficiency.
9
10It contains the following features:
11 - Intermixable 32-bit and 16-bit instruction sets without the need for
12   mode switch.
13 - 16-bit instructions as a frequently used subset of 32-bit instructions.
14 - RISC-style register-based instruction set.
15 - 32 32-bit General Purpose Registers (GPR).
16 - Upto 1024 User Special Registers (USR) for existing and extension
17   instructions.
18 - Rich load/store instructions for...
19   - Single memory access with base address update.
20   - Multiple aligned and unaligned memory accesses for memory copy and stack
21     operations.
22   - Data prefetch to improve data cache performance.
23   - Non-bus locking synchronization instructions.
24 - PC relative jump and PC read instructions for efficient position independent
25   code.
26 - Multiply-add and multiple-sub with 64-bit accumulator.
27 - Instruction for efficient power management.
28 - Bi-endian support.
29 - Three instruction extension space for application acceleration:
30   - Performance extension.
31   - Andes future extensions (for floating-point, multimedia, etc.)
32   - Customer extensions.
33
34AndesCore CPU
35=============
36Andes Technology has 4 families of CPU cores: N12, N10, N9, N8.
37
38For details about N12 CPU family, please check doc/README.N1213.
39
40The NDS32 ports of u-boot, the Linux kernel, the GNU toolchain and
41other associated software are actively supported by Andes Technology Corporation.
42

README.NetConsole

1
2In U-Boot, we implemented the networked console via the standard
3"devices" mechanism, which means that you can switch between the
4serial and network input/output devices by adjusting the 'stdin' and
5'stdout' environment variables. To switch to the networked console,
6set either of these variables to "nc". Input and output can be
7switched independently.
8
9CONFIG_NETCONSOLE_BUFFER_SIZE - Override the default buffer size
10
11We use an environment variable 'ncip' to set the IP address and the
12port of the destination. The format is <ip_addr>:<port>. If <port> is
13omitted, the value of 6666 is used. If the env var doesn't exist, the
14broadcast address and port 6666 are used. If it is set to an IP
15address of 0 (or 0.0.0.0) then no messages are sent to the network.
16The source / listening port can be configured separately by setting
17the 'ncinport' environment variable and the destination port can be
18configured by setting the 'ncoutport' environment variable.
19
20For example, if your server IP is 192.168.1.1, you could use:
21
22	=> setenv nc 'setenv stdout nc;setenv stdin nc'
23	=> setenv ncip 192.168.1.1
24	=> saveenv
25	=> run nc
26
27
28On the host side, please use this script to access the console:
29
30	tools/netconsole <ip> [port]
31
32The script uses netcat to talk to the board over UDP.  It requires you to
33specify the target IP address (or host name, assuming DNS is working). The
34script can be interrupted by pressing ^T (CTRL-T).
35
36Be aware that in some distributives (Fedora Core 5 at least)
37usage of nc has been changed and -l and -p options are considered
38as mutually exclusive. If nc complains about options provided,
39you can just remove the -p option from the script.
40
41It turns out that 'netcat' cannot be used to listen to broadcast
42packets. We developed our own tool 'ncb' (see tools directory) that
43listens to broadcast packets on a given port and dumps them to the
44standard output.  It will be built when compiling for a board which
45has CONFIG_NETCONSOLE defined.  If the netconsole script can find it
46in PATH or in the same directory, it will be used instead.
47
48For Linux, the network-based console needs special configuration.
49Minimally, the host IP address needs to be specified. This can be
50done either via the kernel command line, or by passing parameters
51while loading the netconsole.o module (when used in a loadable module
52configuration). Please refer to Documentation/networking/logging.txt
53file for the original Ingo Molnar's documentation on how to pass
54parameters to the loadable module.
55
56The format of the kernel command line parameter (for the static
57configuration) is as follows:
58
59  netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
60
61where
62
63  src-port	source for UDP packets
64		(defaults to 6665)
65  src-ip	source IP to use
66		(defaults to the interface's address)
67  dev		network interface
68		(defaults to eth0)
69  tgt-port	port for logging agent
70		(defaults to 6666)
71  tgt-ip	IP address for logging agent
72		(this is the required parameter)
73  tgt-macaddr	ethernet MAC address for logging agent
74		(defaults to broadcast)
75
76Examples:
77
78  netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc
79
80or
81
82  netconsole=@/,@192.168.3.1/
83
84Please note that for the Linux networked console to work, the
85ethernet interface has to be up by the time the netconsole driver is
86initialized. This means that in case of static kernel configuration,
87the respective Ethernet interface has to be brought up using the "IP
88Autoconfiguration" kernel feature, which is usually done by defaults
89in the ELDK-NFS-based environment.
90
91To browse the Linux network console output, use the 'netcat' tool invoked
92as follows:
93
94	nc -u -l -p 6666
95
96Note that unlike the U-Boot implementation the Linux netconsole is
97unidirectional, i. e. you have console output only in Linux.
98

README.OFT

1Open Firmware Flat Tree and usage.
2----------------------------------
3
4As part of the ongoing cleanup of the Linux PPC trees, the preferred
5way to pass bootloader and board setup information is the open
6firmware flat tree.
7
8Please take a look at the following email discussion for some
9background.
10
11  http://ozlabs.org/pipermail/linuxppc-dev/2005-August/019408.html
12  http://ozlabs.org/pipermail/linuxppc-dev/2005-August/019362.html
13
14The generated tree is part static and part dynamic.
15
16There is a static part which is compiled in with DTC and a dynamic
17part which is programmatically appended.
18
19You'll need a fairly recent DTC tool, which is available by git at
20
21  rsync://ozlabs.org/dtc/dtc.git
22
23The xxd binary dumper is needed too which I got from
24
25  ftp://ftp.uni-erlangen.de/pub/utilities/etc/xxd-1.10.tar.gz
26
27
28Pantelis Antoniou, 13 Oct 2005
29

README.POST

1Power-On-Self-Test support in U-Boot
2------------------------------------
3
4This project is to support Power-On-Self-Test (POST) in U-Boot.
5
61. High-level requirements
7
8The key requirements for this project are as follows:
9
101) The project shall develop a flexible framework for implementing
11   and running Power-On-Self-Test in U-Boot. This framework shall
12   possess the following features:
13
14   o) Extensibility
15
16      The framework shall allow adding/removing/replacing POST tests.
17      Also, standalone POST tests shall be supported.
18
19   o) Configurability
20
21      The framework shall allow run-time configuration of the lists
22      of tests running on normal/power-fail booting.
23
24   o) Controllability
25
26      The framework shall support manual running of the POST tests.
27
282) The results of tests shall be saved so that it will be possible to
29   retrieve them from Linux.
30
313) The following POST tests shall be developed for MPC823E-based
32   boards:
33
34   o) CPU test
35   o) Cache test
36   o) Memory test
37   o) Ethernet test
38   o) Serial channels test
39   o) Watchdog timer test
40   o) RTC test
41   o) I2C test
42   o) SPI test
43   o) USB test
44
454) The LWMON board shall be used for reference.
46
472. Design
48
49This section details the key points of the design for the project.
50The whole project can be divided into two independent tasks:
51enhancing U-Boot/Linux to provide a common framework for running POST
52tests and developing such tests for particular hardware.
53
542.1. Hardware-independent POST layer
55
56A new optional module will be added to U-Boot, which will run POST
57tests and collect their results at boot time. Also, U-Boot will
58support running POST tests manually at any time by executing a
59special command from the system console.
60
61The list of available POST tests will be configured at U-Boot build
62time. The POST layer will allow the developer to add any custom POST
63tests. All POST tests will be divided into the following groups:
64
65  1) Tests running on power-on booting only
66
67     This group will contain those tests that run only once on
68     power-on reset (e.g. watchdog test)
69
70  2) Tests running on normal booting only
71
72     This group will contain those tests that do not take much
73     time and can be run on the regular basis (e.g. CPU test)
74
75  3) Tests running in special "slow test mode" only
76
77     This group will contain POST tests that consume much time
78     and cannot be run regularly (e.g. strong memory test, I2C test)
79
80  4) Manually executed tests
81
82     This group will contain those tests that can be run manually.
83
84If necessary, some tests may belong to several groups simultaneously.
85For example, SDRAM test may run in both normal and "slow test" mode.
86In normal mode, SDRAM test may perform a fast superficial memory test
87only, while running in slow test mode it may perform a full memory
88check-up.
89
90Also, all tests will be discriminated by the moment they run at.
91Specifically, the following groups will be singled out:
92
93  1) Tests running before relocating to RAM
94
95     These tests will run immediately after initializing RAM
96     as to enable modifying it without taking care of its
97     contents. Basically, this group will contain memory tests
98     only.
99
100  2) Tests running after relocating to RAM
101
102     These tests will run immediately before entering the main
103     loop as to guarantee full hardware initialization.
104
105The POST layer will also distinguish a special group of tests that
106may cause system rebooting (e.g. watchdog test). For such tests, the
107layer will automatically detect rebooting and will notify the test
108about it.
109
1102.1.1. POST layer interfaces
111
112This section details the interfaces between the POST layer and the
113rest of U-Boot.
114
115The following flags will be defined:
116
117#define POST_POWERON		0x01	/* test runs on power-on booting */
118#define POST_NORMAL		0x02	/* test runs on normal booting */
119#define POST_SLOWTEST		0x04	/* test is slow, enabled by key press */
120#define POST_POWERTEST		0x08	/* test runs after watchdog reset */
121#define POST_ROM		0x100	/* test runs in ROM */
122#define POST_RAM		0x200	/* test runs in RAM */
123#define POST_MANUAL		0x400	/* test can be executed manually */
124#define POST_REBOOT		0x800	/* test may cause rebooting */
125#define POST_PREREL             0x1000  /* test runs before relocation */
126
127The POST layer will export the following interface routines:
128
129  o) int post_run(bd_t *bd, char *name, int flags);
130
131     This routine will run the test (or the group of tests) specified
132     by the name and flag arguments. More specifically, if the name
133     argument is not NULL, the test with this name will be performed,
134     otherwise all tests running in ROM/RAM (depending on the flag
135     argument) will be executed. This routine will be called at least
136     twice with name set to NULL, once from board_init_f() and once
137     from board_init_r(). The flags argument will also specify the
138     mode the test is executed in (power-on, normal, power-fail,
139     manual).
140
141  o) void post_reloc(ulong offset);
142
143     This routine will be called from board_init_r() and will
144     relocate the POST test table.
145
146  o) int post_info(char *name);
147
148     This routine will print the list of all POST tests that can be
149     executed manually if name is NULL, and the description of a
150     particular test if name is not NULL.
151
152  o) int post_log(char *format, ...);
153
154     This routine will be called from POST tests to log their
155     results. Basically, this routine will print the results to
156     stderr. The format of the arguments and the return value
157     will be identical to the printf() routine.
158
159Also, the following board-specific routines will be called from the
160U-Boot common code:
161
162  o) int post_hotkeys_pressed(gd_t *gd)
163
164     This routine will scan the keyboard to detect if a magic key
165     combination has been pressed, or otherwise detect if the
166     power-on long-running tests shall be executed or not ("normal"
167     versus "slow" test mode).
168
169The list of available POST tests be kept in the post_tests array
170filled at U-Boot build time. The format of entry in this array will
171be as follows:
172
173struct post_test {
174    char *name;
175    char *cmd;
176    char *desc;
177    int flags;
178    int (*test)(bd_t *bd, int flags);
179};
180
181  o) name
182
183     This field will contain a short name of the test, which will be
184     used in logs and on listing POST tests (e.g. CPU test).
185
186  o) cmd
187
188     This field will keep a name for identifying the test on manual
189     testing (e.g. cpu). For more information, refer to section
190     "Command line interface".
191
192  o) desc
193
194     This field will contain a detailed description of the test,
195     which will be printed on user request. For more information, see
196     section "Command line interface".
197
198  o) flags
199
200     This field will contain a combination of the bit flags described
201     above, which will specify the mode the test is running in
202     (power-on, normal, power-fail or manual mode), the moment it
203     should be run at (before or after relocating to RAM), whether it
204     can cause system rebooting or not.
205
206  o) test
207
208     This field will contain a pointer to the routine that will
209     perform the test, which will take 2 arguments. The first
210     argument will be a pointer to the board info structure, while
211     the second will be a combination of bit flags specifying the
212     mode the test is running in (POST_POWERON, POST_NORMAL,
213     POST_SLOWTEST, POST_MANUAL) and whether the last execution of
214     the test caused system rebooting (POST_REBOOT). The routine will
215     return 0 on successful execution of the test, and 1 if the test
216     failed.
217
218The lists of the POST tests that should be run at power-on/normal/
219power-fail booting will be kept in the environment. Namely, the
220following environment variables will be used: post_poweron,
221powet_normal, post_slowtest.
222
2232.1.2. Test results
224
225The results of tests will be collected by the POST layer. The POST
226log will have the following format:
227
228...
229--------------------------------------------
230START <name>
231<test-specific output>
232[PASSED|FAILED]
233--------------------------------------------
234...
235
236Basically, the results of tests will be printed to stderr. This
237feature may be enhanced in future to spool the log to a serial line,
238save it in non-volatile RAM (NVRAM), transfer it to a dedicated
239storage server and etc.
240
2412.1.3. Integration issues
242
243All POST-related code will be #ifdef'ed with the CONFIG_POST macro.
244This macro will be defined in the config_<board>.h file for those
245boards that need POST. The CONFIG_POST macro will contain the list of
246POST tests for the board. The macro will have the format of array
247composed of post_test structures:
248
249#define CONFIG_POST \
250	{
251		"On-board peripherals test", "board", \
252		"  This test performs full check-up of the " \
253		"on-board hardware.", \
254		POST_RAM | POST_SLOWTEST, \
255		&board_post_test \
256	}
257
258A new file, post.h, will be created in the include/ directory. This
259file will contain common POST declarations and will define a set of
260macros that will be reused for defining CONFIG_POST. As an example,
261the following macro may be defined:
262
263#define POST_CACHE \
264	{
265		"Cache test", "cache", \
266		"  This test verifies the CPU cache operation.", \
267		POST_RAM | POST_NORMAL, \
268		&cache_post_test \
269	}
270
271A new subdirectory will be created in the U-Boot root directory. It
272will contain the source code of the POST layer and most of POST
273tests. Each POST test in this directory will be placed into a
274separate file (it will be needed for building standalone tests). Some
275POST tests (mainly those for testing peripheral devices) will be
276located in the source files of the drivers for those devices. This
277way will be used only if the test subtantially uses the driver.
278
2792.1.4. Standalone tests
280
281The POST framework will allow to develop and run standalone tests. A
282user-space library will be developed to provide the POST interface
283functions to standalone tests.
284
2852.1.5. Command line interface
286
287A new command, diag, will be added to U-Boot. This command will be
288used for listing all available hardware tests, getting detailed
289descriptions of them and running these tests.
290
291More specifically, being run without any arguments, this command will
292print the list of all available hardware tests:
293
294=> diag
295Available hardware tests:
296  cache             - cache test
297  cpu               - CPU test
298  enet              - SCC/FCC ethernet test
299Use 'diag [<test1> [<test2>]] ... ' to get more info.
300Use 'diag run [<test1> [<test2>]] ... ' to run tests.
301=>
302
303If the first argument to the diag command is not 'run', detailed
304descriptions of the specified tests will be printed:
305
306=> diag cpu cache
307cpu - CPU test
308  This test verifies the arithmetic logic unit of CPU.
309cache - cache test
310  This test verifies the CPU cache operation.
311=>
312
313If the first argument to diag is 'run', the specified tests will be
314executed. If no tests are specified, all available tests will be
315executed.
316
317It will be prohibited to execute tests running in ROM manually. The
318'diag' command will not display such tests and/or run them.
319
3202.1.6. Power failure handling
321
322The Linux kernel will be modified to detect power failures and
323automatically reboot the system in such cases. It will be assumed
324that the power failure causes a system interrupt.
325
326To perform correct system shutdown, the kernel will register a
327handler of the power-fail IRQ on booting. Being called, the handler
328will run /sbin/reboot using the call_usermodehelper() routine.
329/sbin/reboot will automatically bring the system down in a secure
330way. This feature will be configured in/out from the kernel
331configuration file.
332
333The POST layer of U-Boot will check whether the system runs in
334power-fail mode. If it does, the system will be powered off after
335executing all hardware tests.
336
3372.1.7. Hazardous tests
338
339Some tests may cause system rebooting during their execution. For
340some tests, this will indicate a failure, while for the Watchdog
341test, this means successful operation of the timer.
342
343In order to support such tests, the following scheme will be
344implemented. All the tests that may cause system rebooting will have
345the POST_REBOOT bit flag set in the flag field of the correspondent
346post_test structure. Before starting tests marked with this bit flag,
347the POST layer will store an identification number of the test in a
348location in IMMR. On booting, the POST layer will check the value of
349this variable and if it is set will skip over the tests preceding the
350failed one. On second execution of the failed test, the POST_REBOOT
351bit flag will be set in the flag argument to the test routine. This
352will allow to detect system rebooting on the previous iteration. For
353example, the watchdog timer test may have the following
354declaration/body:
355
356...
357#define POST_WATCHDOG \
358	{
359		"Watchdog timer test", "watchdog", \
360		"  This test checks the watchdog timer.", \
361		POST_RAM | POST_POWERON | POST_REBOOT, \
362		&watchdog_post_test \
363	}
364...
365
366...
367int watchdog_post_test(bd_t *bd, int flags)
368{
369	unsigned long start_time;
370
371	if (flags & POST_REBOOT) {
372		/* Test passed */
373		return 0;
374	} else {
375		/* disable interrupts */
376		disable_interrupts();
377		/* 10-second delay */
378		...
379		/* if we've reached this, the watchdog timer does not work */
380		enable_interrupts();
381		return 1;
382	}
383}
384...
385
3862.2. Hardware-specific details
387
388This project will also develop a set of POST tests for MPC8xx- based
389systems. This section provides technical details of how it will be
390done.
391
3922.2.1. Generic PPC tests
393
394The following generic POST tests will be developed:
395
396  o) CPU test
397
398     This test will check the arithmetic logic unit (ALU) of CPU. The
399     test will take several milliseconds and will run on normal
400     booting.
401
402  o) Cache test
403
404     This test will verify the CPU cache (L1 cache). The test will
405     run on normal booting.
406
407  o) Memory test
408
409     This test will examine RAM and check it for errors. The test
410     will always run on booting. On normal booting, only a limited
411     amount of RAM will be checked. On power-fail booting a fool
412     memory check-up will be performed.
413
4142.2.1.1. CPU test
415
416This test will verify the following ALU instructions:
417
418  o) Condition register istructions
419
420     This group will contain: mtcrf, mfcr, mcrxr, crand, crandc,
421     cror, crorc, crxor, crnand, crnor, creqv, mcrf.
422
423     The mtcrf/mfcr instructions will be tested by loading different
424     values into the condition register (mtcrf), moving its value to
425     a general-purpose register (mfcr) and comparing this value with
426     the expected one. The mcrxr instruction will be tested by
427     loading a fixed value into the XER register (mtspr), moving XER
428     value to the condition register (mcrxr), moving it to a
429     general-purpose register (mfcr) and comparing the value of this
430     register with the expected one. The rest of instructions will be
431     tested by loading a fixed value into the condition register
432     (mtcrf), executing each instruction several times to modify all
433     4-bit condition fields, moving the value of the conditional
434     register to a general-purpose register (mfcr) and comparing it
435     with the expected one.
436
437  o) Integer compare instructions
438
439     This group will contain: cmp, cmpi, cmpl, cmpli.
440
441     To verify these instructions the test will run them with
442     different combinations of operands, read the condition register
443     value and compare it with the expected one. More specifically,
444     the test will contain a pre-built table containing the
445     description of each test case: the instruction, the values of
446     the operands, the condition field to save the result in and the
447     expected result.
448
449  o) Arithmetic instructions
450
451     This group will contain: add, addc, adde, addme, addze, subf,
452     subfc, subfe, subme, subze, mullw, mulhw, mulhwu, divw, divwu,
453     extsb, extsh.
454
455     The test will contain a pre-built table of instructions,
456     operands, expected results and expected states of the condition
457     register. For each table entry, the test will cyclically use
458     different sets of operand registers and result registers. For
459     example, for instructions that use 3 registers on the first
460     iteration r0/r1 will be used as operands and r2 for result. On
461     the second iteration, r1/r2 will be used as operands and r3 as
462     for result and so on. This will enable to verify all
463     general-purpose registers.
464
465  o) Logic instructions
466
467     This group will contain: and, andc, andi, andis, or, orc, ori,
468     oris, xor, xori, xoris, nand, nor, neg, eqv, cntlzw.
469
470     The test scheme will be identical to that from the previous
471     point.
472
473  o) Shift instructions
474
475     This group will contain: slw, srw, sraw, srawi, rlwinm, rlwnm,
476     rlwimi
477
478     The test scheme will be identical to that from the previous
479     point.
480
481  o) Branch instructions
482
483     This group will contain: b, bl, bc.
484
485     The first 2 instructions (b, bl) will be verified by jumping to
486     a fixed address and checking whether control was transferred to
487     that very point. For the bl instruction the value of the link
488     register will be checked as well (using mfspr). To verify the bc
489     instruction various combinations of the BI/BO fields, the CTR
490     and the condition register values will be checked. The list of
491     such combinations will be pre-built and linked in U-Boot at
492     build time.
493
494  o) Load/store instructions
495
496     This group will contain: lbz(x)(u), lhz(x)(u), lha(x)(u),
497     lwz(x)(u), stb(x)(u), sth(x)(u), stw(x)(u).
498
499     All operations will be performed on a 16-byte array. The array
500     will be 4-byte aligned. The base register will point to offset
501     8. The immediate offset (index register) will range in [-8 ...
502     +7]. The test cases will be composed so that they will not cause
503     alignment exceptions. The test will contain a pre-built table
504     describing all test cases. For store instructions, the table
505     entry will contain: the instruction opcode, the value of the
506     index register and the value of the source register. After
507     executing the instruction, the test will verify the contents of
508     the array and the value of the base register (it must change for
509     "store with update" instructions). For load instructions, the
510     table entry will contain: the instruction opcode, the array
511     contents, the value of the index register and the expected value
512     of the destination register. After executing the instruction,
513     the test will verify the value of the destination register and
514     the value of the base register (it must change for "load with
515     update" instructions).
516
517  o) Load/store multiple/string instructions
518
519
520The CPU test will run in RAM in order to allow run-time modification
521of the code to reduce the memory footprint.
522
5232.2.1.2 Special-Purpose Registers Tests
524
525TBD.
526
5272.2.1.3. Cache test
528
529To verify the data cache operation the following test scenarios will
530be used:
531
532  1) Basic test #1
533
534    - turn on the data cache
535    - switch the data cache to write-back or write-through mode
536    - invalidate the data cache
537    - write the negative pattern to a cached area
538    - read the area
539
540    The negative pattern must be read at the last step
541
542  2) Basic test #2
543
544    - turn on the data cache
545    - switch the data cache to write-back or write-through mode
546    - invalidate the data cache
547    - write the zero pattern to a cached area
548    - turn off the data cache
549    - write the negative pattern to the area
550    - turn on the data cache
551    - read the area
552
553    The negative pattern must be read at the last step
554
555  3) Write-through mode test
556
557    - turn on the data cache
558    - switch the data cache to write-through mode
559    - invalidate the data cache
560    - write the zero pattern to a cached area
561    - flush the data cache
562    - write the negative pattern to the area
563    - turn off the data cache
564    - read the area
565
566    The negative pattern must be read at the last step
567
568  4) Write-back mode test
569
570    - turn on the data cache
571    - switch the data cache to write-back mode
572    - invalidate the data cache
573    - write the negative pattern to a cached area
574    - flush the data cache
575    - write the zero pattern to the area
576    - invalidate the data cache
577    - read the area
578
579    The negative pattern must be read at the last step
580
581To verify the instruction cache operation the following test
582scenarios will be used:
583
584  1) Basic test #1
585
586    - turn on the instruction cache
587    - unlock the entire instruction cache
588    - invalidate the instruction cache
589    - lock a branch instruction in the instruction cache
590    - replace the branch instruction with "nop"
591    - jump to the branch instruction
592    - check that the branch instruction was executed
593
594  2) Basic test #2
595
596    - turn on the instruction cache
597    - unlock the entire instruction cache
598    - invalidate the instruction cache
599    - jump to a branch instruction
600    - check that the branch instruction was executed
601    - replace the branch instruction with "nop"
602    - invalidate the instruction cache
603    - jump to the branch instruction
604    - check that the "nop" instruction was executed
605
606The CPU test will run in RAM in order to allow run-time modification
607of the code.
608
6092.2.1.4. Memory test
610
611The memory test will verify RAM using sequential writes and reads
612to/from RAM. Specifically, there will be several test cases that will
613use different patterns to verify RAM. Each test case will first fill
614a region of RAM with one pattern and then read the region back and
615compare its contents with the pattern. The following patterns will be
616used:
617
618 1) zero pattern (0x00000000)
619 2) negative pattern (0xffffffff)
620 3) checkerboard pattern (0x55555555, 0xaaaaaaaa)
621 4) bit-flip pattern ((1 << (offset % 32)), ~(1 << (offset % 32)))
622 5) address pattern (offset, ~offset)
623
624Patterns #1, #2 will help to find unstable bits. Patterns #3, #4 will
625be used to detect adherent bits, i.e. bits whose state may randomly
626change if adjacent bits are modified. The last pattern will be used
627to detect far-located errors, i.e. situations when writing to one
628location modifies an area located far from it. Also, usage of the
629last pattern will help to detect memory controller misconfigurations
630when RAM represents a cyclically repeated portion of a smaller size.
631
632Being run in normal mode, the test will verify only small 4Kb regions
633of RAM around each 1Mb boundary. For example, for 64Mb RAM the
634following areas will be verified: 0x00000000-0x00000800,
6350x000ff800-0x00100800, 0x001ff800-0x00200800, ..., 0x03fff800-
6360x04000000. If the test is run in power-fail mode, it will verify the
637whole RAM.
638
639The memory test will run in ROM before relocating U-Boot to RAM in
640order to allow RAM modification without saving its contents.
641
6422.2.2. Common tests
643
644This section describes tests that are not based on any hardware
645peculiarities and use common U-Boot interfaces only. These tests do
646not need any modifications for porting them to another board/CPU.
647
6482.2.2.1. I2C test
649
650For verifying the I2C bus, a full I2C bus scanning will be performed
651using the i2c_probe() routine. If a board defines
652CONFIG_SYS_POST_I2C_ADDRS the I2C test will pass if all devices
653listed in CONFIG_SYS_POST_I2C_ADDRS are found, and no additional
654devices are detected.  If CONFIG_SYS_POST_I2C_ADDRS is not defined
655the test will pass if any I2C device is found.
656
657The CONFIG_SYS_POST_I2C_IGNORES define can be used to list I2C
658devices which may or may not be present when using
659CONFIG_SYS_POST_I2C_ADDRS.  The I2C POST test will pass regardless
660if the devices in CONFIG_SYS_POST_I2C_IGNORES are found or not.
661This is useful in cases when I2C devices are optional (eg on a
662daughtercard that may or may not be present) or not critical
663to board operation.
664
6652.2.2.2. Watchdog timer test
666
667To test the watchdog timer the scheme mentioned above (refer to
668section "Hazardous tests") will be used. Namely, this test will be
669marked with the POST_REBOOT bit flag. On the first iteration, the
670test routine will make a 10-second delay. If the system does not
671reboot during this delay, the watchdog timer is not operational and
672the test fails. If the system reboots, on the second iteration the
673POST_REBOOT bit will be set in the flag argument to the test routine.
674The test routine will check this bit and report a success if it is
675set.
676
6772.2.2.3. RTC test
678
679The RTC test will use the rtc_get()/rtc_set() routines. The following
680features will be verified:
681
682  o) Time uniformity
683
684     This will be verified by reading RTC in polling within a short
685     period of time (5-10 seconds).
686
687  o) Passing month boundaries
688
689     This will be checked by setting RTC to a second before a month
690     boundary and reading it after its passing the boundary. The test
691     will be performed for both leap- and nonleap-years.
692
6932.2.3. MPC8xx peripherals tests
694
695This project will develop a set of tests verifying the peripheral
696units of MPC8xx processors. Namely, the following controllers of the
697MPC8xx communication processor module (CPM) will be tested:
698
699  o) Serial Management Controllers (SMC)
700
701  o) Serial Communication Controllers (SCC)
702
7032.2.3.1. Ethernet tests (SCC)
704
705The internal (local) loopback mode will be used to test SCC. To do
706that the controllers will be configured accordingly and several
707packets will be transmitted. These tests may be enhanced in future to
708use external loopback for testing. That will need appropriate
709reconfiguration of the physical interface chip.
710
711The test routines for the SCC ethernet tests will be located in
712arch/powerpc/cpu/mpc8xx/scc.c.
713
7142.2.3.2. UART tests (SMC/SCC)
715
716To perform these tests the internal (local) loopback mode will be
717used. The SMC/SCC controllers will be configured to connect the
718transmitter output to the receiver input. After that, several bytes
719will be transmitted. These tests may be enhanced to make to perform
720"external" loopback test using a loopback cable. In this case, the
721test will be executed manually.
722
723The test routine for the SMC/SCC UART tests will be located in
724arch/powerpc/cpu/mpc8xx/serial.c.
725
7262.2.3.3. USB test
727
728TBD
729
7302.2.3.4. SPI test
731
732TBD
733

README.SNTP

1To use SNTP support, add define CONFIG_CMD_SNTP to the
2configuration file of the board.
3
4The "sntp" command gets network time from NTP time server and
5syncronize RTC of the board. This command needs the command line
6parameter of server's IP address or environment variable
7"ntpserverip". The network time is sent as UTC. So if you want to
8set local time to RTC, set the offset in second from UTC to the
9environment variable "time offset".
10
11If the DHCP server provides time server's IP or time offset, you
12don't need to set the above environment variables yourself.
13
14Current limitations of SNTP support:
151. The roundtrip time is ignored.
162. Only the 1st NTP server IP, in the option ntp-servers of DHCP, will
17   be used.
18

README.SPL

1Generic SPL framework
2=====================
3
4Overview
5--------
6
7To unify all existing implementations for a secondary program loader (SPL)
8and to allow simply adding of new implementations this generic SPL framework
9has been created. With this framework almost all source files for a board
10can be reused. No code duplication or symlinking is necessary anymore.
11
12
13How it works
14------------
15
16The object files for SPL are built separately and placed in the "spl" directory.
17The final binaries which are generated are u-boot-spl, u-boot-spl.bin and
18u-boot-spl.map.
19
20A config option named CONFIG_SPL_BUILD is enabled by Kconfig for SPL.
21Source files can therefore be compiled for SPL with different settings.
22
23For example:
24
25ifeq ($(CONFIG_SPL_BUILD),y)
26obj-y += board_spl.o
27else
28obj-y += board.o
29endif
30
31obj-$(CONFIG_SPL_BUILD) += foo.o
32
33#ifdef CONFIG_SPL_BUILD
34	foo();
35#endif
36
37
38The building of SPL images can be enabled by CONFIG_SPL option in Kconfig.
39
40Because SPL images normally have a different text base, one has to be
41configured by defining CONFIG_SPL_TEXT_BASE. The linker script has to be
42defined with CONFIG_SPL_LDSCRIPT.
43
44To support generic U-Boot libraries and drivers in the SPL binary one can
45optionally define CONFIG_SPL_XXX_SUPPORT. Currently following options
46are supported:
47
48CONFIG_SPL_LIBCOMMON_SUPPORT (common/libcommon.o)
49CONFIG_SPL_LIBDISK_SUPPORT (disk/libdisk.o)
50CONFIG_SPL_I2C_SUPPORT (drivers/i2c/libi2c.o)
51CONFIG_SPL_GPIO_SUPPORT (drivers/gpio/libgpio.o)
52CONFIG_SPL_MMC_SUPPORT (drivers/mmc/libmmc.o)
53CONFIG_SPL_SERIAL_SUPPORT (drivers/serial/libserial.o)
54CONFIG_SPL_SPI_FLASH_SUPPORT (drivers/mtd/spi/libspi_flash.o)
55CONFIG_SPL_SPI_SUPPORT (drivers/spi/libspi.o)
56CONFIG_SPL_FS_FAT (fs/fat/libfat.o)
57CONFIG_SPL_FS_EXT4
58CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o)
59CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o)
60CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/raw/libnand.o)
61CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc)
62CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o)
63CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
64CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/raw/nand_spl_load.o)
65CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o)
66CONFIG_SPL_RAM_DEVICE (common/spl/spl.c)
67CONFIG_SPL_WATCHDOG_SUPPORT (drivers/watchdog/libwatchdog.o)
68
69
70Debugging
71---------
72
73When building SPL with DEBUG set you may also need to set CONFIG_PANIC_HANG
74as in most cases do_reset is not defined within SPL.
75
76
77Estimating stack usage
78----------------------
79
80With gcc 4.6 (and later) and the use of GNU cflow it is possible to estimate
81stack usage at various points in run sequence of SPL.  The -fstack-usage option
82to gcc will produce '.su' files (such as arch/arm/cpu/armv7/syslib.su) that
83will give stack usage information and cflow can construct program flow.
84
85Must have gcc 4.6 or later, which supports -fstack-usage
86
871) Build normally
882) Perform the following shell command to generate a list of C files used in
89SPL:
90$ find spl -name '*.su' | sed -e 's:^spl/::' -e 's:[.]su$:.c:' > used-spl.list
913) Execute cflow:
92$ cflow --main=board_init_r `cat used-spl.list` 2>&1 | $PAGER
93
94cflow will spit out a number of warnings as it does not parse
95the config files and picks functions based on #ifdef.  Parsing the '.i'
96files instead introduces another set of headaches.  These warnings are
97not usually important to understanding the flow, however.
98

README.TPL

1Generic TPL framework
2=====================
3
4Overview
5--------
6
7TPL---Third Program Loader.
8
9Due to the SPL on some boards(powerpc mpc85xx) has a size limit and cannot
10be compatible with all the external device(e.g. DDR). So add a tertiary
11program loader (TPL) to enable a loader stub loaded by the code from the
12SPL. It loads the final uboot image into DDR, then jump to it to begin
13execution. Now, only the powerpc mpc85xx has this requirement and will
14implemente it.
15
16Keep consistent with SPL, with this framework almost all source files for a
17board can be reused. No code duplication or symlinking is necessary anymore.
18
19How it works
20------------
21
22There has been a directory $(srctree)/spl which contains only a Makefile. The
23Makefile is shared by SPL and TPL.
24
25The object files are built separately for SPL/TPL and placed in the
26directory spl/tpl. The final binaries which are generated are
27u-boot-{spl|tpl}, u-boot-{spl|tpl}.bin and u-boot-{spl|tpl}.map.
28
29During the TPL build a variable named CONFIG_TPL_BUILD is exported in the
30make environment and also appended to CPPFLAGS with -DCONFIG_TPL_BUILD.
31
32The SPL options are shared by SPL and TPL, the board config file should
33determine which SPL options to choose based on whether CONFIG_TPL_BUILD
34is set. Source files can be compiled for TPL with options choosed in the
35board config file.
36
37For example:
38
39spl/Makefile:
40LIBS-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/libcommon.o
41
42CONFIG_SPL_LIBCOMMON_SUPPORT is defined in board config file:
43#ifdef CONFIG_TPL_BUILD
44#define CONFIG_SPL_LIBCOMMON_SUPPORT
45#endif
46

README.VLAN

1U-Boot has networking support for VLANs (802.1q), and CDP (Cisco
2Discovery Protocol).
3
4You control the sending/receiving of VLAN tagged packets with the
5"vlan" environmental variable. When not present no tagging is
6performed.
7
8CDP is used mainly to discover your device VLAN(s) when connected to
9a Cisco switch.
10
11Note: In order to enable CDP support a small change is needed in the
12networking driver. You have to enable reception of the
1301:00:0c:cc:cc:cc MAC address which is a multicast address.
14
15Various defines control CDP; see the README section.
16

README.VSC3316-3308

1This file contains API information of the initialization code written for
2Vitesse cross-point devices, VSC3316 and VSC3308 for board B4860QDS
3
4Author: Shaveta Leekha <shaveta@freescale.com>
5
6About Device:
7=============
8VSC 3316/3308 is a low-power, low-cost asynchronous crosspoint switch capable of data rates upto 11.5Gbps.
9
10VSC3316 has 16 input and 16 output ports whereas VSC3308 has 8 input and 8 output ports. Programming of these devices are performed by two-wire or four-wire serial interface.
11
12Initialization:
13===============
14On reset, VSC devices are in low-power state with all inputs, outputs and connections in an off state.
15First thing required is to program it to interface with either two-wire or four-wire interface.
16In our case the interface is two-wire I2C serial interface. So the value in Interface mode register at address 79.h to be written is 0x02 for two-wire interface. Also for crosspoint connections to be activated, 01.h value need to be written in 75.h (core configuration register).
17
18API Overview:
19=============
20
21	vsc_if_enable(u8 vsc_addr):
22	--------------------------
23		This API programs VSC to interface with either two-wire or four-wire interface. In our case the interface is two-wire I2C serial interface. So the value in Interface mode register at address 79.h to be written is 0x02 for two-wire interface.
24	Parameters:
25		vsc_addr - Address of the VSC device on board.
26
27
28	vsc3316_config(u8 vsc_addr, int con_arr[][2], u8 num_con):
29	---------------------------------------------------------
30	This API configures the VSC3316 device for required connections. Connection through the VSC device requires the inputs and outputs to be properly configured.
31	Connection registers are on page 00. It Configures the selected input and output correctly and join them to make a connection. It also program Input state register, Global input ISE, Global input LOS, Global core control, Output mode register and core control registers etc.
32	vsc3308_config(u8 vsc_addr, int con_arr[][2], u8 num_con) does the essential configurations for VSC3308.
33
34	Parameters:
35		vsc_addr - Address of the VSC device on board.
36		con_arr - connection array
37		num_con - number of connections to be configured
38
39	vsc_wp_config(u8 vsc_addr):
40	--------------------------
41		For crosspoint connections to be activated, 01.h value need to be written in 75.h (core configuration register), which is done by this API.
42	Parameters:
43		vsc_addr - Address of the VSC device on board.
44

README.ae350

1Andes Technology SoC AE350
2===========================
3
4AE350 is the mainline SoC produced by Andes Technology using AX25 CPU core
5base on RISC-V architecture.
6
7AE350 has integrated both AHB and APB bus and many periphals for application
8and product development.
9
10AX25-AE350
11=========
12
13AX25-AE350 is the SoC with AE350 hardcore CPU.
14
15Configurations
16==============
17
18CONFIG_SKIP_LOWLEVEL_INIT:
19	If you want to boot this system from SPI ROM and bypass e-bios (the
20	other boot loader on ROM). You should undefine CONFIG_SKIP_LOWLEVEL_INIT
21	in "include/configs/ax25-ae350.h".
22
23Build and boot steps
24====================
25
26build:
271. Prepare the toolchains and make sure the $PATH to toolchains is correct.
282. Use `make ae350_rv[32|64]_defconfig` in u-boot root to build the image for 32 or 64 bit.
29
30Verification
31====================
32
33Target
34====================
351. startup
362. relocation
373. timer driver
384. uart driver
395. mac driver
406. mmc driver
417. spi driver
42
43Steps
44====================
451. Define CONFIG_SKIP_LOWLEVEL_INIT to build u-boot which is loaded via gdb from ram.
462. Undefine CONFIG_SKIP_LOWLEVEL_INIT to build u-boot which is booted from spi rom.
473. Ping a server by mac driver
484. Scan sd card and copy u-boot image which is booted from flash to ram by sd driver.
495. Burn this u-boot image to spi rom by spi driver
506. Re-boot u-boot from spi flash with power off and power on.
51
52Messages of U-Boot boot on AE350 board
53======================================
54U-Boot 2018.01-rc2-00033-g824f89a (Dec 21 2017 - 16:51:26 +0800)
55
56DRAM:  1 GiB
57MMC:   mmc@f0e00000: 0
58SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
59In:    serial@f0300000
60Out:   serial@f0300000
61Err:   serial@f0300000
62Net:
63Warning: mac@e0100000 (eth0) using random MAC address - be:dd:d7:e4:e8:10
64eth0: mac@e0100000
65
66RISC-V # version
67U-Boot 2018.01-rc2-00033-gb265b91-dirty (Dec 22 2017 - 13:54:21 +0800)
68
69riscv32-unknown-linux-gnu-gcc (GCC) 7.2.0
70GNU ld (GNU Binutils) 2.29
71
72RISC-V # setenv ipaddr 10.0.4.200 ;
73RISC-V # setenv serverip 10.0.4.97 ;
74RISC-V # ping 10.0.4.97 ;
75Using mac@e0100000 device
76host 10.0.4.97 is alive
77
78RISC-V # mmc rescan
79RISC-V # fatls mmc 0:1
80   318907   u-boot-ae350-64.bin
81     1252   hello_world_ae350_32.bin
82   328787   u-boot-ae350-32.bin
83
843 file(s), 0 dir(s)
85
86RISC-V # sf probe 0:0 50000000 0
87SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
88
89RISC-V # sf test 0x100000 0x1000
90SPI flash test:
910 erase: 36 ticks, 111 KiB/s 0.888 Mbps
921 check: 29 ticks, 137 KiB/s 1.096 Mbps
932 write: 40 ticks, 100 KiB/s 0.800 Mbps
943 read: 20 ticks, 200 KiB/s 1.600 Mbps
95Test passed
960 erase: 36 ticks, 111 KiB/s 0.888 Mbps
971 check: 29 ticks, 137 KiB/s 1.096 Mbps
982 write: 40 ticks, 100 KiB/s 0.800 Mbps
993 read: 20 ticks, 200 KiB/s 1.600 Mbps
100
101RISC-V # fatload mmc 0:1 0x600000 u-boot-ae350-32.bin
102reading u-boot-ae350-32.bin
103328787 bytes read in 324 ms (990.2 KiB/s)
104
105RISC-V # sf erase 0x0 0x51000
106SF: 331776 bytes @ 0x0 Erased: OK
107
108RISC-V # sf write 0x600000 0x0 0x50453
109device 0 offset 0x0, size 0x50453
110SF: 328787 bytes @ 0x0 Written: OK
111
112RISC-V # crc32 0x600000 0x50453
113crc32 for 00600000 ... 00650452 ==> 692dc44a
114
115RISC-V # crc32 0x80000000 0x50453
116crc32 for 80000000 ... 80050452 ==> 692dc44a
117RISC-V #
118
119*** power-off and power-on, this U-Boot is booted from spi flash 	***
120
121U-Boot 2018.01-rc2-00032-gf67dd47-dirty (Dec 21 2017 - 13:56:03 +0800)
122
123DRAM:  1 GiB
124MMC:   mmc@f0e00000: 0
125SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB
126In:    serial@f0300000
127Out:   serial@f0300000
128Err:   serial@f0300000
129Net:
130Warning: mac@e0100000 (eth0) using random MAC address - ee:4c:58:29:32:f5
131eth0: mac@e0100000
132RISC-V #
133
134
135Boot bbl and riscv-linux via U-Boot on QEMU
136===========================================
1371. Build riscv-linux
1382. Build bbl and riscv-linux with --with-payload
1393. Prepare ae350.dtb
1404. Creating OS-kernel images
141	./mkimage -A riscv -O linux -T kernel -C none -a 0x0000 -e 0x0000 -d bbl.bin bootmImage-bbl.bin
142	Image Name:
143	Created:      Tue Mar 13 10:06:42 2018
144	Image Type:   RISC-V Linux Kernel Image (uncompressed)
145	Data Size:    17901204 Bytes = 17481.64 KiB = 17.07 MiB
146	Load Address: 00000000
147	Entry Point:  00000000
148
1494. Copy bootmImage-bbl.bin and ae350.dtb to qemu sd card image
1505. Message of booting riscv-linux from bbl via u-boot on qemu
151
152U-Boot 2018.03-rc4-00031-g2631273 (Mar 13 2018 - 15:02:55 +0800)
153
154DRAM:  1 GiB
155main-loop: WARNING: I/O thread spun for 1000 iterations
156MMC:   mmc@f0e00000: 0
157Loading Environment from SPI Flash... *** Warning - spi_flash_probe_bus_cs() failed, using default environment
158
159Failed (-22)
160In:    serial@f0300000
161Out:   serial@f0300000
162Err:   serial@f0300000
163Net:
164Warning: mac@e0100000 (eth0) using random MAC address - 02:00:00:00:00:00
165eth0: mac@e0100000
166RISC-V # mmc rescan
167RISC-V # mmc part
168
169Partition Map for MMC device 0  --   Partition Type: DOS
170
171Part    Start Sector    Num Sectors     UUID            Type
172RISC-V # fatls mmc 0:0
173 17901268   bootmImage-bbl.bin
174     1954   ae2xx.dtb
175
1762 file(s), 0 dir(s)
177
178RISC-V # fatload mmc 0:0 0x00600000 bootmImage-bbl.bin
17917901268 bytes read in 4642 ms (3.7 MiB/s)
180RISC-V # fatload mmc 0:0 0x2000000 ae350.dtb
1811954 bytes read in 1 ms (1.9 MiB/s)
182RISC-V # setenv bootm_size 0x2000000
183RISC-V # setenv fdt_high 0x1f00000
184RISC-V # bootm 0x00600000 - 0x2000000
185## Booting kernel from Legacy Image at 00600000 ...
186   Image Name:
187   Image Type:   RISC-V Linux Kernel Image (uncompressed)
188   Data Size:    17901204 Bytes = 17.1 MiB
189   Load Address: 00000000
190   Entry Point:  00000000
191   Verifying Checksum ... OK
192## Flattened Device Tree blob at 02000000
193   Booting using the fdt blob at 0x2000000
194   Loading Kernel Image ... OK
195   Loading Device Tree to 0000000001efc000, end 0000000001eff7a1 ... OK
196[    0.000000] OF: fdt: Ignoring memory range 0x0 - 0x200000
197[    0.000000] Linux version 4.14.0-00046-gf3e439f-dirty (rick@atcsqa06) (gcc version 7.1.1 20170509 (GCC)) #1 Tue Jan 9 16:34:25 CST 2018
198[    0.000000] bootconsole [early0] enabled
199[    0.000000] Initial ramdisk at: 0xffffffe000016a98 (12267008 bytes)
200[    0.000000] Zone ranges:
201[    0.000000]   DMA      [mem 0x0000000000200000-0x000000007fffffff]
202[    0.000000]   Normal   empty
203[    0.000000] Movable zone start for each node
204[    0.000000] Early memory node ranges
205[    0.000000]   node   0: [mem 0x0000000000200000-0x000000007fffffff]
206[    0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000007fffffff]
207[    0.000000] elf_hwcap is 0x112d
208[    0.000000] random: fast init done
209[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 516615
210[    0.000000] Kernel command line: console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7
211[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
212[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
213[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
214[    0.000000] Sorting __ex_table...
215[    0.000000] Memory: 2047832K/2095104K available (1856K kernel code, 204K rwdata, 532K rodata, 12076K init, 756K bss, 47272K reserved, 0K cma-reserved)
216[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
217[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
218[    0.000000] riscv,cpu_intc,0: 64 local interrupts mapped
219[    0.000000] riscv,plic0,e4000000: mapped 31 interrupts to 1/2 handlers
220[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
221[    0.000000] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
222[    0.000000] pid_max: default: 32768 minimum: 301
223[    0.004000] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
224[    0.004000] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
225[    0.056000] devtmpfs: initialized
226[    0.060000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
227[    0.064000] futex hash table entries: 256 (order: 0, 6144 bytes)
228[    0.068000] NET: Registered protocol family 16
229[    0.080000] vgaarb: loaded
230[    0.084000] clocksource: Switched to clocksource riscv_clocksource
231[    0.088000] NET: Registered protocol family 2
232[    0.092000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
233[    0.096000] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
234[    0.096000] TCP: Hash tables configured (established 16384 bind 16384)
235[    0.100000] UDP hash table entries: 1024 (order: 3, 32768 bytes)
236[    0.100000] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
237[    0.104000] NET: Registered protocol family 1
238[    0.616000] Unpacking initramfs...
239[    1.220000] workingset: timestamp_bits=62 max_order=19 bucket_order=0
240[    1.244000] io scheduler noop registered
241[    1.244000] io scheduler cfq registered (default)
242[    1.244000] io scheduler mq-deadline registered
243[    1.248000] io scheduler kyber registered
244[    1.360000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
245[    1.368000] console [ttyS0] disabled
246[    1.372000] f0300000.serial: ttyS0 at MMIO 0xf0300020 (irq = 10, base_baud = 1228800) is a 16550A
247[    1.392000] console [ttyS0] enabled
248[    1.392000] ftmac100: Loading version 0.2 ...
249[    1.396000] ftmac100 e0100000.mac eth0: irq 8, mapped at ffffffd002005000
250[    1.400000] ftmac100 e0100000.mac eth0: generated random MAC address 6e:ac:c3:92:36:c0
251[    1.404000] IR NEC protocol handler initialized
252[    1.404000] IR RC5(x/sz) protocol handler initialized
253[    1.404000] IR RC6 protocol handler initialized
254[    1.404000] IR JVC protocol handler initialized
255[    1.408000] IR Sony protocol handler initialized
256[    1.408000] IR SANYO protocol handler initialized
257[    1.408000] IR Sharp protocol handler initialized
258[    1.408000] IR MCE Keyboard/mouse protocol handler initialized
259[    1.412000] IR XMP protocol handler initialized
260[    1.456000] ftsdc010 f0e00000.mmc: mmc0 - using hw SDIO IRQ
261[    1.464000] bootconsole [early0] uses init memory and must be disabled even before the real one is ready
262[    1.464000] bootconsole [early0] disabled
263[    1.508000] Freeing unused kernel memory: 12076K
264[    1.512000] This architecture does not have kernel memory protection.
265[    1.520000] mmc0: new SD card at address 4567
266[    1.524000] mmcblk0: mmc0:4567 QEMU! 20.0 MiB
267[    1.844000]  mmcblk0:
268Wed Dec  1 10:00:00 CST 2010
269/ #
270
271
272
273TODO
274==================================================
275Boot bbl and riscv-linux via U-Boot on AE350 board
276

README.ag101p

1Andes Technology SoC AG101P
2===========================
3
4AG101P is the mainline SoC produced by Andes Technology using N1213 CPU core
5with FPU and DDR contoller support.
6AG101P has integrated both AHB and APB bus and many periphals for application
7and product development.
8
9ADP-AG101P
10=========
11
12ADP-AG101P is the SoC with AG101 hardcore CPU.
13
14Configurations
15==============
16
17CONFIG_MEM_REMAP:
18	Doing memory remap is essential for preparing some non-OS or RTOS
19	applications.
20
21CONFIG_SKIP_LOWLEVEL_INIT:
22	If you want to boot this system from SPI ROM and bypass e-bios (the
23	other boot loader on ROM). You should undefine CONFIG_SKIP_LOWLEVEL_INIT
24	in "include/configs/adp-ag101p.h".
25
26Build and boot steps
27====================
28
29build:
301. Prepare the toolchains and make sure the $PATH to toolchains is correct.
312. Use `make adp-ag101p_defconfig` in u-boot root to build the image.
32
33Burn u-boot to SPI ROM:
34====================
35
36This section will be added later.
37

README.android-fastboot

1================
2Android Fastboot
3================
4
5Overview
6========
7
8The protocol that is used over USB and UDP is described in the
9``README.android-fastboot-protocol`` file in the same directory.
10
11The current implementation supports the following standard commands:
12
13- ``boot``
14- ``continue``
15- ``download``
16- ``erase`` (if enabled)
17- ``flash`` (if enabled)
18- ``getvar``
19- ``reboot``
20- ``reboot-bootloader``
21- ``set_active`` (only a stub implementation which always succeeds)
22
23The following OEM commands are supported (if enabled):
24
25- oem format - this executes ``gpt write mmc %x $partitions``
26
27Support for both eMMC and NAND devices is included.
28
29Client installation
30===================
31
32The counterpart to this is the fastboot client which can be found in
33Android's ``platform/system/core`` repository in the fastboot
34folder. It runs on Windows, Linux and OSX. The fastboot client is
35part of the Android SDK Platform-Tools and can be downloaded from:
36
37https://developer.android.com/studio/releases/platform-tools
38
39Board specific
40==============
41
42USB configuration
43-----------------
44
45The fastboot gadget relies on the USB download gadget, so the following
46options must be configured:
47
48::
49
50   CONFIG_USB_GADGET_DOWNLOAD
51   CONFIG_USB_GADGET_VENDOR_NUM
52   CONFIG_USB_GADGET_PRODUCT_NUM
53   CONFIG_USB_GADGET_MANUFACTURER
54
55NOTE: The ``CONFIG_USB_GADGET_VENDOR_NUM`` must be one of the numbers
56supported by the fastboot client. The list of vendor IDs supported can
57be found in the fastboot client source code.
58
59General configuration
60---------------------
61
62The fastboot protocol requires a large memory buffer for
63downloads. This buffer should be as large as possible for a
64platform. The location of the buffer and size are set with
65``CONFIG_FASTBOOT_BUF_ADDR`` and ``CONFIG_FASTBOOT_BUF_SIZE``. These
66may be overridden on the fastboot command line using ``-l`` and
67``-s``.
68
69Fastboot environment variables
70==============================
71
72Partition aliases
73-----------------
74
75Fastboot partition aliases can also be defined for devices where GPT
76limitations prevent user-friendly partition names such as "boot", "system"
77and "cache".  Or, where the actual partition name doesn't match a standard
78partition name used commonly with fastboot.
79
80The current implementation checks aliases when accessing partitions by
81name (flash_write and erase functions).  To define a partition alias
82add an environment variable similar to:
83
84``fastboot_partition_alias_<alias partition name>=<actual partition name>``
85
86for example:
87
88``fastboot_partition_alias_boot=LNX``
89
90Variable overrides
91------------------
92
93Variables retrived through ``getvar`` can be overridden by defining
94environment variables of the form ``fastboot.<variable>``. These are
95looked up first so can be used to override values which would
96otherwise be returned. Using this mechanism you can also return types
97for NAND filesystems, as the fully parameterised variable is looked
98up, e.g.
99
100``fastboot.partition-type:boot=jffs2``
101
102Boot command
103------------
104
105When executing the fastboot ``boot`` command, if ``fastboot_bootcmd`` is set then
106that will be executed in place of ``bootm <CONFIG_FASTBOOT_BUF_ADDR>``.
107
108Partition Names
109===============
110
111The Fastboot implementation in U-Boot allows to write images into disk
112partitions. Target partitions are referred on the host computer by
113their names.
114
115For GPT/EFI the respective partition name is used.
116
117For MBR the partitions are referred by generic names according to the
118following schema:
119
120  <device type><device index letter><partition index>
121
122Example: ``hda3``, ``sdb1``, ``usbda1``
123
124The device type is as follows:
125
126  * IDE, ATAPI and SATA disks: ``hd``
127  * SCSI disks: ``sd``
128  * USB media: ``usbd``
129  * MMC and SD cards: ``mmcsd``
130  * Disk on chip: ``docd``
131  * other: ``xx``
132
133The device index starts from ``a`` and refers to the interface (e.g. USB
134controller, SD/MMC controller) or disk index. The partition index starts
135from ``1`` and describes the partition number on the particular device.
136
137Writing Partition Table
138=======================
139
140Fastboot also allows to write the partition table to the media. This can be
141done by writing the respective partition table image to a special target
142"gpt" or "mbr". These names can be customized by defining the following
143configuration options:
144
145::
146
147   CONFIG_FASTBOOT_GPT_NAME
148   CONFIG_FASTBOOT_MBR_NAME
149
150In Action
151=========
152
153Enter into fastboot by executing the fastboot command in U-Boot for either USB:
154
155::
156
157   => fastboot usb 0
158
159or UDP:
160
161::
162
163   => fastboot udp
164   link up on port 0, speed 100, full duplex
165   Using ethernet@4a100000 device
166   Listening for fastboot command on 192.168.0.102
167
168On the client side you can fetch the bootloader version for instance:
169
170::
171
172   $ fastboot getvar bootloader-version
173   bootloader-version: U-Boot 2014.04-00005-gd24cabc
174   finished. total time: 0.000s
175
176or initiate a reboot:
177
178::
179
180   $ fastboot reboot
181
182and once the client comes back, the board should reset.
183
184You can also specify a kernel image to boot. You have to either specify
185the an image in Android format *or* pass a binary kernel and let the
186fastboot client wrap the Android suite around it. On OMAP for instance you
187take zImage kernel and pass it to the fastboot client:
188
189::
190
191   $ fastboot -b 0x80000000 -c "console=ttyO2 earlyprintk root=/dev/ram0 mem=128M" boot zImage
192   creating boot image...
193   creating boot image - 1847296 bytes
194   downloading 'boot.img'...
195   OKAY [  2.766s]
196   booting...
197   OKAY [ -0.000s]
198   finished. total time: 2.766s
199
200and on the U-Boot side you should see:
201
202::
203
204   Starting download of 1847296 bytes
205   ........................................................
206   downloading of 1847296 bytes finished
207   Booting kernel..
208   ## Booting Android Image at 0x81000000 ...
209   Kernel load addr 0x80008000 size 1801 KiB
210   Kernel command line: console=ttyO2 earlyprintk root=/dev/ram0 mem=128M
211      Loading Kernel Image ... OK
212   OK
213
214   Starting kernel ...
215

README.android-fastboot-protocol

1FastBoot  Version  0.4
2----------------------
3
4The fastboot protocol is a mechanism for communicating with bootloaders
5over USB.  It is designed to be very straightforward to implement, to
6allow it to be used across a wide range of devices and from hosts running
7Linux, Windows, or OSX.
8
9
10Basic Requirements
11------------------
12
13* Two bulk endpoints (in, out) are required
14* Max packet size must be 64 bytes for full-speed and 512 bytes for
15  high-speed USB
16* The protocol is entirely host-driven and synchronous (unlike the
17  multi-channel, bi-directional, asynchronous ADB protocol)
18
19
20Transport and Framing
21---------------------
22
231. Host sends a command, which is an ascii string in a single
24   packet no greater than 64 bytes.
25
262. Client response with a single packet no greater than 64 bytes.
27   The first four bytes of the response are "OKAY", "FAIL", "DATA",
28   or "INFO".  Additional bytes may contain an (ascii) informative
29   message.
30
31   a. INFO -> the remaining 60 bytes are an informative message
32      (providing progress or diagnostic messages).  They should
33      be displayed and then step #2 repeats
34
35   b. FAIL -> the requested command failed.  The remaining 60 bytes
36      of the response (if present) provide a textual failure message
37      to present to the user.  Stop.
38
39   c. OKAY -> the requested command completed successfully.  Go to #5
40
41   d. DATA -> the requested command is ready for the data phase.
42      A DATA response packet will be 12 bytes long, in the form of
43      DATA00000000 where the 8 digit hexidecimal number represents
44      the total data size to transfer.
45
463. Data phase.  Depending on the command, the host or client will
47   send the indicated amount of data.  Short packets are always
48   acceptable and zero-length packets are ignored.  This phase continues
49   until the client has sent or received the number of bytes indicated
50   in the "DATA" response above.
51
524. Client responds with a single packet no greater than 64 bytes.
53   The first four bytes of the response are "OKAY", "FAIL", or "INFO".
54   Similar to #2:
55
56   a. INFO -> display the remaining 60 bytes and return to #4
57
58   b. FAIL -> display the remaining 60 bytes (if present) as a failure
59      reason and consider the command failed.  Stop.
60
61   c. OKAY -> success.  Go to #5
62
635. Success.  Stop.
64
65
66Example Session
67---------------
68
69Host:    "getvar:version"        request version variable
70
71Client:  "OKAY0.4"               return version "0.4"
72
73Host:    "getvar:nonexistant"    request some undefined variable
74
75Client:  "OKAY"                  return value ""
76
77Host:    "download:00001234"     request to send 0x1234 bytes of data
78
79Client:  "DATA00001234"          ready to accept data
80
81Host:    < 0x1234 bytes >        send data
82
83Client:  "OKAY"                  success
84
85Host:    "flash:bootloader"      request to flash the data to the bootloader
86
87Client:  "INFOerasing flash"     indicate status / progress
88         "INFOwriting flash"
89         "OKAY"                  indicate success
90
91Host:    "powerdown"             send a command
92
93Client:  "FAILunknown command"   indicate failure
94
95
96Command Reference
97-----------------
98
99* Command parameters are indicated by printf-style escape sequences.
100
101* Commands are ascii strings and sent without the quotes (which are
102  for illustration only here) and without a trailing 0 byte.
103
104* Commands that begin with a lowercase letter are reserved for this
105  specification.  OEM-specific commands should not begin with a
106  lowercase letter, to prevent incompatibilities with future specs.
107
108 "getvar:%s"           Read a config/version variable from the bootloader.
109                       The variable contents will be returned after the
110                       OKAY response.
111
112 "download:%08x"       Write data to memory which will be later used
113                       by "boot", "ramdisk", "flash", etc.  The client
114                       will reply with "DATA%08x" if it has enough
115                       space in RAM or "FAIL" if not.  The size of
116                       the download is remembered.
117
118  "verify:%08x"        Send a digital signature to verify the downloaded
119                       data.  Required if the bootloader is "secure"
120                       otherwise "flash" and "boot" will be ignored.
121
122  "flash:%s"           Write the previously downloaded image to the
123                       named partition (if possible).
124
125  "erase:%s"           Erase the indicated partition (clear to 0xFFs)
126
127  "boot"               The previously downloaded data is a boot.img
128                       and should be booted according to the normal
129                       procedure for a boot.img
130
131  "continue"           Continue booting as normal (if possible)
132
133  "reboot"             Reboot the device.
134
135  "reboot-bootloader"  Reboot back into the bootloader.
136                       Useful for upgrade processes that require upgrading
137                       the bootloader and then upgrading other partitions
138                       using the new bootloader.
139
140  "powerdown"          Power off the device.
141
142
143
144Client Variables
145----------------
146
147The "getvar:%s" command is used to read client variables which
148represent various information about the device and the software
149on it.
150
151The various currently defined names are:
152
153  version             Version of FastBoot protocol supported.
154                      It should be "0.3" for this document.
155
156  version-bootloader  Version string for the Bootloader.
157
158  version-baseband    Version string of the Baseband Software
159
160  product             Name of the product
161
162  serialno            Product serial number
163
164  secure              If the value is "yes", this is a secure
165                      bootloader requiring a signature before
166                      it will install or boot images.
167
168Names starting with a lowercase character are reserved by this
169specification.  OEM-specific names should not start with lowercase
170characters.
171

README.arm-caches

1Disabling I-cache:
2- Set CONFIG_SYS_ICACHE_OFF
3
4Disabling D-cache:
5- Set CONFIG_SYS_DCACHE_OFF
6
7Enabling I-cache:
8- Make sure CONFIG_SYS_ICACHE_OFF is not set and call icache_enable().
9
10Enabling D-cache:
11- Make sure CONFIG_SYS_DCACHE_OFF is not set and call dcache_enable().
12
13Enabling Caches at System Startup:
14- Implement enable_caches() for your platform and enable the I-cache and
15  D-cache from this function. This function is called immediately
16  after relocation.
17
18Guidelines for Working with D-cache:
19
20Memory to Peripheral DMA:
21- Flush the buffer after the MPU writes the data and before the DMA is
22  initiated.
23
24Peripheral to Memory DMA:
25- Invalidate the buffer before starting the DMA. In case there are any dirty
26  lines from the DMA buffer in the cache, subsequent cache-line replacements
27  may corrupt the buffer in memory while the DMA is still going on. Cache-line
28  replacement can happen if the CPU tries to bring some other memory locations
29  into the cache while the DMA is going on.
30- Invalidate the buffer after the DMA is complete and before the MPU reads
31  it. This may be needed in addition to the invalidation before the DMA
32  mentioned above, because in some processors memory contents can spontaneously
33  come to the cache due to speculative memory access by the CPU. If this
34  happens with the DMA buffer while DMA is going on we have a coherency problem.
35
36Buffer Requirements:
37- Any buffer that is invalidated(that is, typically the peripheral to
38  memory DMA buffer) should be aligned to cache-line boundary both at
39  at the beginning and at the end of the buffer.
40- If the buffer is not cache-line aligned invalidation will be restricted
41  to the aligned part. That is, one cache-line at the respective boundary
42  may be left out while doing invalidation.
43- A suitable buffer can be alloced on the stack using the
44  ALLOC_CACHE_ALIGN_BUFFER macro.
45
46Cleanup Before Linux:
47- cleanup_before_linux() should flush the D-cache, invalidate I-cache, and
48  disable MMU and caches.
49- The following sequence is advisable while disabling d-cache:
50  1. dcache_disable() - flushes and disables d-cache
51  2. invalidate_dcache_all() - invalid any entry that came to the cache
52	in the short period after the cache was flushed but before the
53	cache got disabled.
54

README.arm-relocation

1To make relocation on arm working, the following changes are done:
2
3At arch level: add linker flag -pie
4
5	This causes the linker to generate fixup tables .rel.dyn and .dynsym,
6	which must be applied to the relocated image before transferring
7	control to it.
8
9	These fixups are described in the ARM ELF documentation as type 23
10	(program-base-relative) and 2 (symbol-relative)
11
12At cpu level: modify linker file and add a relocation and fixup loop
13
14	the linker file must be modified to include the .rel.dyn and .dynsym
15	tables in the binary image, and to provide symbols for the relocation
16	code to access these tables
17
18	The relocation and fixup loop must be executed after executing
19	board_init_f at initial location and before executing board_init_r
20	at final location.
21
22At board level:
23
24	dram_init(): bd pointer is now at this point not accessible, so only
25	detect the real dramsize, and store it in gd->ram_size. Bst detected
26	with get_ram_size().
27
28TODO:	move also dram initialization there on boards where it is possible.
29
30	Setup of the the bd_t dram bank info is done in the new function
31	dram_init_banksize() called after bd is accessible.
32
33At lib level:
34
35	Board.c code is adapted from ppc code
36
37* WARNING ** WARNING ** WARNING ** WARNING ** WARNING ** WARNING ** WARNING *
38
39Boards which are not fixed to support relocation will be REMOVED!
40
41-----------------------------------------------------------------------------
42
43For boards which boot from spl, it is possible to save one copy
44if CONFIG_SYS_TEXT_BASE == relocation address! This prevents that uboot code
45is copied again in relocate_code().
46
47example for the tx25 board booting from NAND Flash:
48
49a) cpu starts
50b) it copies the first page in nand to internal ram
51   (spl code)
52c) end executes this code
53d) this initialize CPU, RAM, ... and copy itself to RAM
54   (this bin must fit in one page, so board_init_f()
55    don;t fit in it ... )
56e) there it copy u-boot to CONFIG_SYS_NAND_U_BOOT_DST and
57   starts this image @ CONFIG_SYS_NAND_U_BOOT_START
58f) u-boot code steps through board_init_f() and calculates
59   the relocation address and copy itself to it
60
61If CONFIG_SYS_TEXT_BASE == relocation address, the copying of u-boot
62in f) could be saved.
63
64-----------------------------------------------------------------------------
65
66TODO
67
68- fill in bd_t infos (check)
69- adapt all boards
70
71- maybe adapt CONFIG_SYS_TEXT_BASE (this must be checked from board maintainers)
72  This *must* be done for boards, which boot from NOR flash
73
74  on other boards if CONFIG_SYS_TEXT_BASE = relocation baseaddr, this saves
75  one copying from u-boot code.
76
77- new function dram_init_banksize() is actual board specific. Maybe
78  we make a weak default function in arch/arm/lib/board.c ?
79
80-----------------------------------------------------------------------------
81
82Relocation with SPL (example for the tx25 booting from NAND Flash):
83
84- cpu copies the first page from NAND to 0xbb000000 (IMX_NFC_BASE)
85  and start with code execution on this address.
86
87- The First page contains u-boot code from drivers/mtd/nand/raw/mxc_nand_spl.c
88  which inits the dram, cpu registers, reloacte itself to CONFIG_SPL_TEXT_BASE	and loads
89  the "real" u-boot to CONFIG_SYS_NAND_U_BOOT_DST and starts execution
90  @CONFIG_SYS_NAND_U_BOOT_START
91
92- This u-boot does no RAM init, nor CPU register setup. Just look
93  where it has to copy and relocate itself to this address. If
94  relocate address = CONFIG_SYS_TEXT_BASE (not the same, as the
95  CONFIG_SPL_TEXT_BASE from the spl code), then there is no need
96  to copy, just go on with bss clear and jump to board_init_r.
97
98-----------------------------------------------------------------------------
99
100How ELF relocations 23 and 2 work.
101
102TBC
103
104-------------------------------------------------------------------------------------
105
106Debugging u-boot in RAM:
107(example on the qong board)
108
109-----------------
110
111a) start debugger
112
113arm-linux-gdb u-boot
114
115[hs@pollux u-boot]$ arm-linux-gdb u-boot
116GNU gdb Red Hat Linux (6.7-2rh)
117Copyright (C) 2007 Free Software Foundation, Inc.
118License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
119This is free software: you are free to change and redistribute it.
120There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
121and "show warranty" for details.
122This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux".
123The target architecture is set automatically (currently arm)
124..
125(gdb)
126
127-----------------
128
129b) connect to target
130
131target remote bdi10:2001
132
133(gdb) target remote bdi10:2001
134Remote debugging using bdi10:2001
1350x8ff17f10 in ?? ()
136(gdb)
137
138-----------------
139
140c) discard symbol-file
141
142(gdb) symbol-file
143Discard symbol table from `/home/hs/celf/u-boot/u-boot'? (y or n) y
144No symbol file now.
145(gdb)
146
147-----------------
148
149d) load new symbol table:
150
151(gdb) add-symbol-file u-boot 0x8ff08000
152add symbol table from file "u-boot" at
153	.text_addr = 0x8ff08000
154(y or n) y
155Reading symbols from /home/hs/celf/u-boot/u-boot...done.
156(gdb) c
157Continuing.
158^C
159Program received signal SIGSTOP, Stopped (signal).
1600x8ff17f18 in serial_getc () at serial_mxc.c:192
161192		while (__REG(UART_PHYS + UTS) & UTS_RXEMPTY);
162(gdb)
163
164add-symbol-file u-boot 0x8ff08000
165		       ^^^^^^^^^^
166		       get this address from u-boot bdinfo command
167		       or get it from gd->relocaddr in gdb
168
169 => bdinfo
170rch_number = XXXXXXXXXX
171boot_params = XXXXXXXXXX
172DRAM bank   = XXXXXXXXXX
173-> start    = XXXXXXXXXX
174-> size     = XXXXXXXXXX
175ethaddr     = XXXXXXXXXX
176ip_addr     = XXXXXXXXXX
177baudrate    = XXXXXXXXXX
178TLB addr    = XXXXXXXXXX
179relocaddr   = 0x8ff08000
180	      ^^^^^^^^^^
181reloc off   = XXXXXXXXXX
182irq_sp	    = XXXXXXXXXX
183sp start    = XXXXXXXXXX
184FB base     = XXXXXXXXXX
185
186or interrupt execution by any means and re-load the symbols at the location
187specified by gd->relocaddr -- this is only valid after board_init_f.
188
189(gdb) set $s = gd->relocaddr
190(gdb) symbol-file
191(gdb) add-symbol-file u-boot $s
192
193Now you can use gdb as usual :-)
194

README.arm64

1U-Boot for arm64
2
3Summary
4=======
5The initial arm64 U-Boot port was developed before hardware was available,
6so the first supported platforms were the Foundation and Fast Model for ARMv8.
7These days U-Boot runs on a variety of 64-bit capable ARM hardware, from
8embedded development boards to servers.
9
10Notes
11=====
12
131. U-Boot can run at any exception level it is entered in, it is
14   recommened to enter it in EL3 if U-Boot takes some responsibilities of a
15   classical firmware (like initial hardware setup, CPU errata workarounds
16   or SMP bringup). U-Boot can be entered in EL2 when its main purpose is
17   that of a boot loader. It can drop to lower exception levels before
18   entering the OS.
19
202. U-Boot for arm64 is compiled with AArch64-gcc. AArch64-gcc
21   use rela relocation format, a tool(tools/relocate-rela) by Scott Wood
22   is used to encode the initial addend of rela to u-boot.bin. After running,
23   the U-Boot will be relocated to destination again.
24
253. Earlier Linux kernel versions required the FDT to be placed at a
26   2 MB boundary and within the same 512 MB section as the kernel image,
27   resulting in fdt_high to be defined specially.
28   Since kernel version 4.2 Linux is more relaxed about the DT location, so it
29   can be placed anywhere in memory.
30   Please reference linux/Documentation/arm64/booting.txt for detail.
31
324. Spin-table is used to wake up secondary processors. One location
33   (or per processor location) is defined to hold the kernel entry point
34   for secondary processors. It must be ensured that the location is
35   accessible and zero immediately after secondary processor
36   enter slave_cpu branch execution in start.S. The location address
37   is encoded in cpu node of DTS. Linux kernel store the entry point
38   of secondary processors to it and send event to wakeup secondary
39   processors.
40   Please reference linux/Documentation/arm64/booting.txt for detail.
41
425. Generic board is supported.
43
446. CONFIG_ARM64 instead of CONFIG_ARMV8 is used to distinguish aarch64 and
45   aarch32 specific codes.
46
47
48Contributors
49============
50   Tom Rini            <trini@ti.com>
51   Scott Wood          <scottwood@freescale.com>
52   York Sun            <yorksun@freescale.com>
53   Simon Glass         <sjg@chromium.org>
54   Sharma Bhupesh      <bhupesh.sharma@freescale.com>
55   Rob Herring         <robherring2@gmail.com>
56   Sergey Temerkhanov  <s.temerkhanov@gmail.com>
57

README.armada-secureboot

1The trusted boot framework on Marvell Armada 38x
2================================================
3
4Contents:
5
61. Overview of the trusted boot
72. Terminology
83. Boot image layout
94. The secured header
105. The secured boot flow
116. Usage example
127. Work to be done
138. Bibliography
14
151. Overview of the trusted boot
16-------------------------------
17
18The Armada's trusted boot framework enables the SoC to cryptographically verify
19a specially prepared boot image. This can be used to establish a chain of trust
20from the boot firmware all the way to the OS.
21
22To achieve this, the Armada SoC requires a specially prepared boot image, which
23contains the relevant cryptographic data, as well as other information
24pertaining to the boot process. Furthermore, a eFuse structure (a
25one-time-writeable memory) need to be configured in the correct way.
26
27Roughly, the secure boot process works as follows:
28
29* Load the header block of the boot image, extract a special "root" public RSA
30  key from it, and verify its SHA-256 hash against a SHA-256 stored in a eFuse
31  field.
32* Load an array of code signing public RSA keys from the header block, and
33  verify its RSA signature (contained in the header block as well) using the
34  "root" RSA key.
35* Choose a code signing key, and use it to verify the header block (excluding
36  the key array).
37* Verify the binary image's signature (contained in the header block) using the
38  code signing key.
39* If all checks pass successfully, boot the image.
40
41The chain of trust is thus as follows:
42
43* The SHA-256 value in the eFuse field verifies the "root" public key.
44* The "root" public key verifies the code signing key array.
45* The selected code signing key verifies the header block and the binary image.
46
47In the special case of building a boot image containing U-Boot as the binary
48image, which employs this trusted boot framework, the following tasks need to
49be addressed:
50
511. Creation of the needed cryptographic key material.
522. Creation of a conforming boot image containing the U-Boot image as binary
53   image.
543. Burning the necessary eFuse values.
55
56(1) will be addressed later, (2) will be taken care of by U-Boot's build
57system (some user configuration is required, though), and for (3) the necessary
58data (essentially a series of U-Boot commands to be entered at the U-Boot
59command prompt) will be created by the build system as well.
60
61The documentation of the trusted boot mode is contained in part 1, chapter
627.2.5 in the functional specification [1], and in application note [2].
63
642. Terminology
65--------------
66
67	           CSK - Code Signing Key(s): An array of RSA key pairs, which
68                         are used to sign and verify the secured header and the
69                         boot loader image.
70	           KAK - Key Authentication Key: A RSA key pair, which is used
71                         to sign and verify the array of CSKs.
72	  Header block - The first part of the boot image, which contains the
73			 image's headers (also known as "headers block", "boot
74			 header", and "image header")
75                 eFuse - A one-time-writeable memory.
76               BootROM - The Armada's built-in boot firmware, which is
77                         responsible for verifying and starting secure images.
78	    Boot image - The complete image the SoC's boot firmware loads
79			 (contains the header block and the binary image)
80	   Main header - The header in the header block containing information
81			 and data pertaining to the boot process (used for both
82			 the regular and secured boot processes)
83	  Binary image - The binary code payload of the boot image; in this
84			 case the U-Boot's code (also known as "source image",
85			 or just "image")
86	Secured header - The specialized header in the header block that
87			 contains information and data pertaining to the
88			 trusted boot (also known as "security header")
89     Secured boot mode - A special boot mode of the Armada SoC in which secured
90                         images are verified (non-secure images won't boot);
91                         the mode is activated by setting a eFuse field.
92    Trusted debug mode - A special mode for the trusted boot that allows
93			 debugging of devices employing the trusted boot
94			 framework in a secure manner (untested in the current
95			 implementation).
96Trusted boot framework - The ARMADA SoC's implementation of a secure verified
97                         boot process.
98
993. Boot image layout
100--------------------
101
102+-- Boot image --------------------------------------------+
103|                                                          |
104| +-- Header block --------------------------------------+ |
105| | Main header                                          | |
106| +------------------------------------------------------+ |
107| | Secured header                                       | |
108| +------------------------------------------------------+ |
109| | BIN header(s)                                        | |
110| +------------------------------------------------------+ |
111| | REG header(s)                                        | |
112| +------------------------------------------------------+ |
113| | Padding                                              | |
114| +------------------------------------------------------+ |
115|                                                          |
116| +------------------------------------------------------+ |
117| | Binary image + checksum                              | |
118| +------------------------------------------------------+ |
119+----------------------------------------------------------+
120
1214. The secured header
122---------------------
123
124For the trusted boot framework, a additional header is added to the boot image.
125The following data are relevant for the secure boot:
126
127		   KAK: The KAK is contained in the secured header in the form
128		        of a RSA-2048 public key in DER format with a length of
129			524 bytes.
130Header block signature: The RSA signature of the header block (excluding the
131                        CSK array), created using the selected CSK.
132Binary image signature: The RSA signature of the binary image, created using
133                        the selected CSK.
134             CSK array: The array of the 16 CSKs as RSA-2048 public keys in DER
135	                format with a length of 8384 = 16 * 524 bytes.
136   CSK block signature: The RSA signature of the CSK array, created using the
137                        KAK.
138
139NOTE: The JTAG delay, Box ID, and Flash ID header fields do play a role in the
140trusted boot process to enable and configure secure debugging, but they were
141not tested in the current implementation of the trusted boot in U-Boot.
142
1435. The secured boot flow
144------------------------
145
146The steps in the boot flow that are relevant for the trusted boot framework
147proceed as follows:
148
1491) Check if trusted boot is enabled, and perform regular boot if it is not.
1502) Load the secured header, and verify its checksum.
1513) Select the lowest valid CSK from CSK0 to CSK15.
1524) Verify the SHA-256 hash of the KAK embedded in the secured header.
1535) Verify the RSA signature of the CSK block from the secured header with the
154   KAK.
1556) Verify the header block signature (which excludes the CSK block) from the
156   secured header with the selected CSK.
1577) Load the binary image to the main memory and verify its checksum.
1588) Verify the binary image's RSA signature from the secured header with the
159   selected CSK.
1609) Continue the boot process as in the case of the regular boot.
161
162NOTE: All RSA signatures are verified according to the PKCS #1 v2.1 standard
163described in [3].
164
165NOTE: The Box ID and Flash ID are checked after step 6, and the trusted debug
166mode may be entered there, but since this mode is untested in the current
167implementation, it is not described further.
168
1696. Usage example
170----------------
171
172### Create key material
173
174To employ the trusted boot framework, cryptographic key material needs to be
175created. In the current implementation, two keys are needed to build a valid
176secured boot image: The KAK private key and a CSK private key (both have to be
1772048 bit RSA keys in PEM format). Note that the usage of more than one CSK is
178currently not supported.
179
180NOTE: Since the public key can be generated from the private key, it is
181sufficient to store the private key for each key pair.
182
183OpenSSL can be used to generate the needed files kwb_kak.key and kwb_csk.key
184(the names of these files have to be configured, see the next section on
185kwbimage.cfg settings):
186
187openssl genrsa -out kwb_kak.key 2048
188openssl genrsa -out kwb_csk.key 2048
189
190The generated files have to be placed in the U-Boot root directory.
191
192Alternatively, instead of copying the files, symlinks to the private keys can
193be placed in the U-Boot root directory.
194
195WARNING: Knowledge of the KAK or CSK private key would enable an attacker to
196generate secured boot images containing arbitrary code. Hence, the private keys
197should be carefully guarded.
198
199### Create/Modifiy kwbimage.cfg
200
201The Kirkwook architecture in U-Boot employs a special board-specific
202configuration file (kwbimage.cfg), which controls various boot image settings
203that are interpreted by the BootROM, such as the boot medium. The support the
204trusted boot framework, several new options were added to faciliate
205configuration of the secured boot.
206
207The configuration file's layout has been retained, only the following new
208options were added:
209
210		KAK - The name of the KAK RSA private key file in the U-Boot
211                      root directory, without the trailing extension of ".key".
212		CSK - The name of the (active) CSK RSA private key file in the
213		      U-Boot root directory, without the trailing extension of
214		      ".key".
215	     BOX_ID - The BoxID to be used for trusted debugging (a integer
216	              value).
217	   FLASH_ID - The FlashID to be used for trusted debugging (a integer
218	              value).
219	 JTAG_DELAY - The JTAG delay to be used for trusted debugging (a
220	              integer value).
221          CSK_INDEX - The index of the active CSK (a integer value).
222SEC_SPECIALIZED_IMG - Flag to indicate whether to include the BoxID and FlashID
223		      in the image (that is, whether to use the trusted debug
224		      mode or not); no parameters.
225       SEC_BOOT_DEV - The boot device from which the trusted boot is allowed to
226		      proceed, identified via a numeric ID. The tested values
227		      are 0x34 = NOR flash, 0x31 = SDIO/MMC card; for
228		      additional ID values, consult the documentation in [1].
229      SEC_FUSE_DUMP - Dump the "fuse prog" commands necessary for writing the
230		      correct eFuse values to a text file in the U-Boot root
231		      directory. The parameter is the architecture for which to
232		      dump the commands (currently only "a38x" is supported).
233
234The parameter values may be hardcoded into the file, but it is also possible to
235employ a dynamic approach of creating a Autoconf-like kwbimage.cfg.in, then
236reading configuration values from Kconfig options or from the board config
237file, and generating the actual kwbimage.cfg from this template using Makefile
238mechanisms (see board/gdsys/a38x/Makefile as an example for this approach).
239
240### Set config options
241
242To enable the generation of trusted boot images, the corresponding support
243needs to be activated, and a index for the active CSK needs to be selected as
244well.
245
246Furthermore, eFuse writing support has to be activated in order to burn the
247eFuse structure's values (this option is just needed for programming the eFuse
248structure; production boot images may disable it).
249
250ARM architecture
251 -> [*] Build image for trusted boot
252    (0)   Index of active CSK
253 -> [*] Enable eFuse support
254    [ ]   Fake eFuse access (dry run)
255
256### Build and test boot image
257
258The creation of the boot image is done via the usual invocation of make (with a
259suitably set CROSS_COMPILE environment variable, of course). The resulting boot
260image u-boot-spl.kwb can then be tested, if so desired. The hdrparser from [5]
261can be used for this purpose. To build the tool, invoke make in the
262'tools/marvell/doimage_mv' directory of [5], which builds a stand-alone
263hdrparser executable. A test can be conducted by calling hdrparser with the
264produced boot image and the following (mandatory) parameters:
265
266./hdrparser -k 0 -t u-boot-spl.kwb
267
268Here we assume that the CSK index is 0 and the boot image file resides in the
269same directory (adapt accordingly if needed). The tool should report that all
270checksums are valid ("GOOD"), that all signature verifications succeed
271("PASSED"), and, finally, that the overall test was successful
272("T E S T   S U C C E E D E D" in the last line of output).
273
274### Burn eFuse structure
275
276+----------------------------------------------------------+
277| WARNING: Burning the eFuse structure is a irreversible   |
278| operation! Should wrong or corrupted values be used, the |
279| board won't boot anymore, and recovery is likely         |
280| impossible!                                              |
281+----------------------------------------------------------+
282
283After the build process has finished, and the SEC_FUSE_DUMP option was set in
284the kwbimage.cfg was set, a text file kwb_fuses_a38x.txt should be present in
285the U-Boot top-level directory. It contains all the necessary commands to set
286the eFuse structure to the values needed for the used KAK digest, as well as
287the CSK index, Flash ID and Box ID that were selected in kwbimage.cfg.
288
289Sequentially executing the commands in this file at the U-Boot command prompt
290will write these values to the eFuse structure.
291
292If the SEC_FUSE_DUMP option was not set, the commands needed to burn the fuses
293have to be crafted by hand. The needed fuse lines can be looked up in [1]; a
294rough overview of the process is:
295
296* Burn the KAK public key hash. The hash itself can be found in the file
297  pub_kak_hash.txt in the U-Boot top-level directory; be careful to account for
298  the endianness!
299* Burn the CSK selection, BoxID, and FlashID
300* Enable trusted boot by burning the corresponding fuse (WARNING: this must be
301  the last fuse line written!)
302* Lock the unused fuse lines
303
304The command to employ is the "fuse prog" command previously enabled by setting
305the corresponding configuration option.
306
307For the trusted boot, the fuse prog command has a special syntax, since the
308ARMADA SoC demands that whole fuse lines (64 bit values) have to be written as
309a whole. The fuse prog command itself allows lists of 32 bit words to be
310written at a time, but this is translated to a series of single 32 bit write
311operations to the fuse line, where the individual 32 bit words are identified
312by a "word" counter that is increased for each write.
313
314To work around this restriction, we interpret each line to have three "words"
315(0-2): The first and second words are the values to be written to the fuse
316line, and the third is a lock flag, which is supposed to lock the fuse line
317when set to 1. Writes to the first and second words are memoized between
318function calls, and the fuse line is only really written and locked (on writing
319the third word) if both words were previously set, so that "incomplete" writes
320are prevented. An exception to this is a single write to the third word (index
3212) without previously writing neither the first nor the second word, which
322locks the fuse line without setting any value; this is needed to lock the
323unused fuse lines.
324
325As an example, to write the value 0011223344556677 to fuse line 10, we would
326use the following command:
327
328fuse prog -y 10 0 00112233 44556677 1
329
330Here 10 is the fuse line number, 0 is the index of the first word to be
331written, 00112233 and 44556677 are the values to be written to the fuse line
332(first and second word) and the trailing 1 is the value for the third word
333responsible for locking the line.
334
335A "lock-only" command would look like this:
336
337fuse prog -y 11 2 1
338
339Here 11 is the fuse number, 2 is the index of the first word to be written
340(notice that we only write to word 2 here; the third word for fuse line
341locking), and the 1 is the value for the word we are writing to.
342
343WARNING: According to application note [4], the VHV pin of the SoC must be
344connected to a 1.8V source during eFuse programming, but *must* be disconnected
345for normal operation. The AN [4] describes a software-controlled circuit (based
346on a N-channel or P-channel FET and a free GPIO pin of the SoC) to achieve
347this, but a jumper-based circuit should suffice as well. Regardless of the
348chosen circuit, the issue needs to be addressed accordingly!
349
3507. Work to be done
351------------------
352
353* Add the ability to populate more than one CSK
354* Test secure debug
355* Test on Armada XP
356
3578. Bibliography
358---------------
359
360[1] ARMADA(R) 38x Family High-Performance Single/Dual CPU System on Chip
361    Functional Specification; MV-S109094-00, Rev. C; August 2, 2015,
362    Preliminary
363[2] AN-383: ARMADA(R) 38x Families Secure Boot Mode Support; MV-S302501-00
364    Rev.  A; March 11, 2015, Preliminary
365[3] Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography
366    Specifications Version 2.1; February 2003;
367    https://www.ietf.org/rfc/rfc3447.txt
368[4] AN-389: ARMADA(R) VHV Power; MV-S302545-00 Rev. B; January 28, 2016,
369    Released
370[5] Marvell Armada 38x U-Boot support; November 25, 2015;
371    https://github.com/MarvellEmbeddedProcessors/u-boot-marvell
372
3732017-01-05, Mario Six <mario.six@gdsys.cc>
374

README.at91

1Atmel AT91 Evaluation kits
2
3Index
4  - I. Board mapping & boot media
5  - II. NAND partition table
6  - III. watchdog support
7
8I. Board mapping & boot media
9------------------------------------------------------------------------------
10AT91SAM9260EK, AT91SAM9G20EK & AT91SAM9XEEK
11------------------------------------------------------------------------------
12
13Memory map
14	0x20000000 - 23FFFFFF	SDRAM (64 MB)
15	0xC0000000 - Cxxxxxxx	Atmel Dataflash card (J13)
16	0xD0000000 - D07FFFFF	Soldered Atmel Dataflash (AT45DB642)
17
18Environment variables
19
20	U-Boot environment variables can be stored at different places:
21		- Dataflash on SPI chip select 1 (default)
22		- Dataflash on SPI chip select 0 (dataflash card)
23		- Nand flash.
24
25	You can choose your storage location at config step (here for at91sam9260ek) :
26		make at91sam9260ek_nandflash_config	- use nand flash
27		make at91sam9260ek_dataflash_cs0_config	- use data flash (spi cs0)
28		make at91sam9260ek_dataflash_cs1_config	- use data flash (spi cs1)
29
30
31------------------------------------------------------------------------------
32AT91SAM9261EK, AT91SAM9G10EK
33------------------------------------------------------------------------------
34
35Memory map
36	0x20000000 - 23FFFFFF	SDRAM (64 MB)
37	0xC0000000 - C07FFFFF	Soldered Atmel Dataflash (AT45DB642)
38	0xD0000000 - Dxxxxxxx	Atmel Dataflash card (J22)
39
40Environment variables
41
42	U-Boot environment variables can be stored at different places:
43		- Dataflash on SPI chip select 0 (default)
44		- Dataflash on SPI chip select 3 (dataflash card)
45		- Nand flash.
46
47	You can choose your storage location at config step (here for at91sam9260ek) :
48		make at91sam9261ek_nandflash_config	- use nand flash
49		make at91sam9261ek_dataflash_cs0_config	- use data flash (spi cs0)
50		make at91sam9261ek_dataflash_cs3_config	- use data flash (spi cs3)
51
52
53------------------------------------------------------------------------------
54AT91SAM9263EK
55------------------------------------------------------------------------------
56
57Memory map
58	0x20000000 - 23FFFFFF	SDRAM (64 MB)
59	0xC0000000 - Cxxxxxxx	Atmel Dataflash card (J9)
60
61Environment variables
62
63	U-Boot environment variables can be stored at different places:
64		- Dataflash on SPI chip select 0 (dataflash card)
65		- Nand flash.
66		- Nor flash (not populate by default)
67
68	You can choose your storage location at config step (here for at91sam9260ek) :
69		make at91sam9263ek_nandflash_config	- use nand flash
70		make at91sam9263ek_dataflash_cs0_config	- use data flash (spi cs0)
71		make at91sam9263ek_norflash_config	- use nor flash
72
73	You can choose to boot directly from U-Boot at config step
74		make at91sam9263ek_norflash_boot_config	- boot from nor flash
75
76
77------------------------------------------------------------------------------
78AT91SAM9M10G45EK
79------------------------------------------------------------------------------
80
81Memory map
82	0x70000000 - 77FFFFFF	SDRAM (128 MB)
83
84Environment variables
85
86	U-Boot environment variables can be stored at different places:
87		- Nand flash.
88
89	You can choose your storage location at config step (here for at91sam9m10g45ek) :
90		make at91sam9m10g45ek_nandflash_config		- use nand flash
91
92
93------------------------------------------------------------------------------
94AT91SAM9RLEK
95------------------------------------------------------------------------------
96
97Memory map
98	0x20000000 - 23FFFFFF	SDRAM (64 MB)
99	0xC0000000 - C07FFFFF   Soldered Atmel Dataflash (AT45DB642)
100
101Environment variables
102
103	U-Boot environment variables can be stored at different places:
104		- Dataflash on SPI chip select 0
105		- Nand flash.
106
107	You can choose your storage location at config step (here for at91sam9rlek) :
108		make at91sam9rlek_nandflash_config	- use nand flash
109
110
111------------------------------------------------------------------------------
112AT91SAM9N12EK, AT91SAM9X5EK
113------------------------------------------------------------------------------
114
115Memory map
116	0x20000000 - 27FFFFFF	SDRAM (128 MB)
117
118Environment variables
119
120	U-Boot environment variables can be stored at different places:
121		- Nand flash.
122		- SD/MMC card
123		- Serialflash/Dataflash on SPI chip select 0
124
125	You can choose your storage location at config step (here for at91sam9x5ek) :
126		make at91sam9x5ek_dataflash_config	- use data flash
127		make at91sam9x5ek_mmc_config		- use sd/mmc card
128		make at91sam9x5ek_nandflash_config	- use nand flash
129		make at91sam9x5ek_spiflash_config	- use serial flash
130
131
132------------------------------------------------------------------------------
133SAMA5D3XEK
134------------------------------------------------------------------------------
135
136Memory map
137	0x20000000 - 3FFFFFFF	SDRAM (512 MB)
138
139Environment variables
140
141	U-Boot environment variables can be stored at different places:
142		- Nand flash.
143		- SD/MMC card
144		- Serialflash on SPI chip select 0
145
146	You can choose your storage location at config step (here for sama5d3xek) :
147		make sama5d3xek_mmc_config		- use SD/MMC card
148		make sama5d3xek_nandflash_config	- use nand flash
149		make sama5d3xek_serialflash_config	- use serial flash
150
151
152II. NAND partition table
153
154	All the board support boot from NAND flash will use the following NAND
155	partition table
156
157		0x00000000 - 0x0003FFFF	bootstrap	(256 KiB)
158		0x00040000 - 0x000BFFFF u-boot		(512 KiB)
159		0x000C0000 - 0x000FFFFF env		(256 KiB)
160		0x00100000 - 0x0013FFFF env_redundant	(256 KiB)
161		0x00140000 - 0x0017FFFF spare		(256 KiB)
162		0x00180000 - 0x001FFFFF dtb		(512 KiB)
163		0x00200000 - 0x007FFFFF kernel		(6 MiB)
164		0x00800000 - 0xxxxxxxxx rootfs		(All left)
165
166III. Watchdog support
167
168	For security reasons, the at91 watchdog is running at boot time and,
169	if deactivated, cannot be used anymore.
170	If you want to use the watchdog, you will need to keep it running in
171	your code (make sure not to disable it in AT91Bootstrap for instance).
172
173	In the U-Boot configuration, the AT91 watchdog support is enabled using
174	the CONFIG_WDT and CONFIG_WDT_AT91 options.
175

README.atmel_mci

1How to use SD/MMC cards with Atmel SoCs having MCI hardware
2-----------------------------------------------------------
32010-08-16 Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
4
5This is a new approach to use Atmel MCI hardware with the
6general MMC framework. Therefore it benefits from that
7framework's abilities to handle SDHC Cards and the ability
8to write blocks.
9
10- AT91SAM9XE512 (tested, will definitely work with XE128 and XE256)
11- AT91SAM9260 (not tested, but MCI is to AT91SAM9XE)
12- AT91SAM9G20 (not tested, should work)
13
14It should work with all other ATMEL devices that have MCI.
15
16The generic driver does NOT assign port pins to the MCI block
17nor does it start the MCI clock. This has to be handled in a
18board/SoC specific manner before the driver is initialized:
19
20example: this is added to at91sam9260_devices.c:
21
22#if defined(CONFIG_GENERIC_ATMEL_MCI)
23void at91_mci_hw_init(void)
24{
25	at91_set_a_periph(AT91_PIO_PORTA, 8, PUP);	/* MCCK */
26#if defined(CONFIG_ATMEL_MCI_PORTB)
27	at91_set_b_periph(AT91_PIO_PORTA, 1, PUP);	/* MCCDB */
28	at91_set_b_periph(AT91_PIO_PORTA, 0, PUP);	/* MCDB0 */
29	at91_set_b_periph(AT91_PIO_PORTA, 5, PUP);	/* MCDB1 */
30	at91_set_b_periph(AT91_PIO_PORTA, 4, PUP);	/* MCDB2 */
31	at91_set_b_periph(AT91_PIO_PORTA, 3, PUP);	/* MCDB3 */
32#else
33	at91_set_a_periph(AT91_PIO_PORTA, 7, PUP);	/* MCCDA */
34	at91_set_a_periph(AT91_PIO_PORTA, 6, PUP);	/* MCDA0 */
35	at91_set_a_periph(AT91_PIO_PORTA, 9, PUP);	/* MCDA1 */
36	at91_set_a_periph(AT91_PIO_PORTA, 10, PUP);	/* MCDA2 */
37	at91_set_a_periph(AT91_PIO_PORTA, 11, PUP);	/* MCDA3 */
38#endif
39}
40#endif
41
42the board specific file need added:
43...
44#ifdef CONFIG_GENERIC_ATMEL_MCI
45# include <mmc.h>
46#endif
47...
48#ifdef CONFIG_GENERIC_ATMEL_MCI
49/* this is a weak define that we are overriding */
50int board_mmc_init(bd_t *bd)
51{
52	/* Enable clock */
53	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_MCI);
54	at91_mci_hw_init();
55
56	/* This calls the atmel_mci_init in gen_atmel_mci.c */
57	return atmel_mci_init((void *)AT91_BASE_MCI);
58}
59
60/* this is a weak define that we are overriding */
61int board_mmc_getcd(struct mmc *mmc)
62{
63	return !at91_get_gpio_value(CONFIG_SYS_MMC_CD_PIN);
64}
65
66#endif
67
68and the board definition files needs:
69
70/* SD/MMC card */
71#define CONFIG_GENERIC_ATMEL_MCI	1
72#define CONFIG_ATMEL_MCI_PORTB		1	/* Atmel XE-EK uses port B */
73#define CONFIG_SYS_MMC_CD_PIN		AT91_PIN_PC9
74#define CONFIG_CMD_MMC			1
75

README.atmel_pmecc

1How to enable PMECC(Programmable Multibit ECC) for nand on Atmel SoCs
2-----------------------------------------------------------
32012-08-22 Josh Wu <josh.wu@atmel.com>
4
5The Programmable Multibit ECC (PMECC) controller is a programmable binary
6BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder. This controller
7can be used to support both SLC and MLC NAND Flash devices. It supports to
8generate ECC to correct 2, 4, 8, 12 or 24 bits of error per sector (512 or
91024 bytes) of data.
10
11Following Atmel AT91 products support PMECC.
12- AT91SAM9X25, X35, G25, G15, G35 (tested)
13- AT91SAM9N12 (not tested, Should work)
14
15As soon as your nand flash software ECC works, you can enable PMECC.
16
17To use PMECC in this driver, the user needs to set:
18	1. the PMECC correction error bits capability: CONFIG_PMECC_CAP.
19	   It can be 2, 4, 8, 12 or 24.
20	2. The PMECC sector size: CONFIG_PMECC_SECTOR_SIZE.
21	   It only can be 512 or 1024.
22
23Take 'configs/at91sam9x5ek_nandflash_defconfig' as an example, the board
24configuration file has the following entries:
25
26	CONFIG_PMECC_CAP=2
27	CONFIG_PMECC_SECTOR_SIZE=512
28	CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER=y
29
30How to enable PMECC header for direct programmable boot.bin
31-----------------------------------------------------------
322014-05-19 Andreas Bießmann <andreas@biessmann.org>
33
34The usual way to program SPL into NAND flash is to use the SAM-BA Atmel tool.
35This however is often not usable when doing field updates. To be able to
36program a SPL binary into NAND flash we need to add the PMECC header to the
37binary before. Chapter '12.4.4.1 NAND Flash Boot: NAND Flash Detection' in
38sama5d3 SoC spec (as of 03. April 2014) defines how this PMECC header has to
39look like. In order to do so we have a new image type added to mkimage to
40generate this PMECC header and integrated this into the build process of SPL.
41
42To enable the generation of atmel PMECC header for SPL one needs to define
43CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER. The required parameters are taken from
44board configuration and compiled into the host tools atmel_pmecc_params. This
45tool will be called in build process to parametrize mkimage for atmelimage
46type. The mkimage tool has intentionally _not_ compiled in those parameters.
47
48The mkimage image type atmelimage also set the 6'th interrupt vector to the
49correct value. This feature can also be used to setup a boot.bin for MMC boot.
50

README.autoboot

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2001
4 * Dave Ellis, SIXNET, dge@sixnetio.com
5 *
6 */
7
8Using autoboot configuration options
9====================================
10
11The basic autoboot configuration options are documented in the main
12U-Boot README. See it for details. They are:
13
14  bootdelay
15  bootcmd
16  CONFIG_BOOTDELAY
17  CONFIG_BOOTCOMMAND
18
19Some additional options that make autoboot safer in a production
20product are documented here.
21
22Why use them?
23-------------
24
25The basic autoboot feature allows a system to automatically boot to
26the real application (such as Linux) without a user having to enter
27any commands. If any key is pressed before the boot delay time
28expires, U-Boot stops the autoboot process, gives a U-Boot prompt
29and waits forever for a command. That's a good thing if you pressed a
30key because you wanted to get the prompt.
31
32It's not so good if the key press was a stray character on the
33console serial port, say because a user who knows nothing about
34U-Boot pressed a key before the system had time to boot. It's even
35worse on an embedded product that doesn't have a console during
36normal use. The modem plugged into that console port sends a
37character at the wrong time and the system hangs, with no clue as to
38why it isn't working.
39
40You might want the system to autoboot to recover after an external
41configuration program stops autoboot. If the configuration program
42dies or loses its connection (modems can disconnect at the worst
43time) U-Boot will patiently wait forever for it to finish.
44
45These additional configuration options can help provide a system that
46boots when it should, but still allows access to U-Boot.
47
48What they do
49------------
50
51  CONFIG_BOOT_RETRY_TIME
52  CONFIG_BOOT_RETRY_MIN
53
54  "bootretry" environment variable
55
56	These options determine what happens after autoboot is
57	stopped and U-Boot is waiting for commands.
58
59	CONFIG_BOOT_RETRY_TIME must be defined to enable the boot
60	retry feature. If the environment variable "bootretry" is
61	found then its value is used, otherwise the retry timeout is
62	CONFIG_BOOT_RETRY_TIME. CONFIG_BOOT_RETRY_MIN is optional and
63	defaults to CONFIG_BOOT_RETRY_TIME. All times are in seconds.
64
65	If the retry timeout is negative, the U-Boot command prompt
66	never times out. Otherwise it is forced to be at least
67	CONFIG_BOOT_RETRY_MIN seconds. If no valid U-Boot command is
68	entered before the specified time the boot delay sequence is
69	restarted. Each command that U-Boot executes restarts the
70	timeout.
71
72	If CONFIG_BOOT_RETRY_TIME < 0 the feature is there, but
73	doesn't do anything unless the environment variable
74	"bootretry" is >= 0.
75
76  CONFIG_AUTOBOOT_KEYED
77  CONFIG_AUTOBOOT_KEYED_CTRLC
78  CONFIG_AUTOBOOT_PROMPT
79  CONFIG_AUTOBOOT_DELAY_STR
80  CONFIG_AUTOBOOT_STOP_STR
81
82  "bootdelaykey"  environment variable
83  "bootstopkey"	  environment variable
84
85	These options give more control over stopping autoboot. When
86	they are used a specific character or string is required to
87	stop or delay autoboot.
88
89	Define CONFIG_AUTOBOOT_KEYED (no value required) to enable
90	this group of options.	CONFIG_AUTOBOOT_DELAY_STR,
91	CONFIG_AUTOBOOT_STOP_STR or both should be specified (or
92	specified by the corresponding environment variable),
93	otherwise there is no way to stop autoboot.
94
95	CONFIG_AUTOBOOT_PROMPT is displayed before the boot delay
96	selected by CONFIG_BOOTDELAY starts. If it is not defined
97	there is no output indicating that autoboot is in progress.
98
99	Note that CONFIG_AUTOBOOT_PROMPT is used as the (only)
100	argument to a printf() call, so it may contain '%' format
101	specifications, provided that it also includes, sepearated by
102	commas exactly like in a printf statement, the required
103	arguments. It is the responsibility of the user to select only
104	such arguments that are valid in the given context. A
105	reasonable prompt could be defined as
106
107		#define CONFIG_AUTOBOOT_PROMPT \
108			"autoboot in %d seconds\n",bootdelay
109
110	If CONFIG_AUTOBOOT_DELAY_STR or "bootdelaykey" is specified
111	and this string is received from console input before
112	autoboot starts booting, U-Boot gives a command prompt. The
113	U-Boot prompt will time out if CONFIG_BOOT_RETRY_TIME is
114	used, otherwise it never times out.
115
116	If CONFIG_AUTOBOOT_STOP_STR or "bootstopkey" is specified and
117	this string is received from console input before autoboot
118	starts booting, U-Boot gives a command prompt. The U-Boot
119	prompt never times out, even if CONFIG_BOOT_RETRY_TIME is
120	used.
121
122	The string recognition is not very sophisticated. If a
123	partial match is detected, the first non-matching character
124	is checked to see if starts a new match. There is no check
125	for a shorter partial match, so it's best if the first
126	character of a key string does not appear in the rest of the
127	string.
128
129	The CONFIG_AUTOBOOT_KEYED_CTRLC #define allows for the boot
130	sequence to be interrupted by ctrl-c, in addition to the
131	"bootdelaykey" and "bootstopkey". Setting this variable
132	provides an escape sequence from the limited "password"
133	strings.
134
135  CONFIG_RESET_TO_RETRY
136
137	(Only effective when CONFIG_BOOT_RETRY_TIME is also set)
138	After the countdown timed out, the board will be reset to restart
139	again.
140

README.avb2

1Android Verified Boot 2.0
2
3This file contains information about the current support of Android Verified
4Boot 2.0 in U-boot
5
61. OVERVIEW
7---------------------------------
8Verified Boot establishes a chain of trust from the bootloader to system images
9* Provides integrity checking for:
10  - Android Boot image: Linux kernel + ramdisk. RAW hashing of the whole
11    partition is done and the hash is compared with the one stored in
12    the VBMeta image
13  - system/vendor partitions: verifying root hash of dm-verity hashtrees.
14* Provides capabilities for rollback protection.
15
16Integrity of the bootloader (U-boot BLOB and environment) is out of scope.
17
18For additional details check:
19https://android.googlesource.com/platform/external/avb/+/master/README.md
20
211.1. AVB using OP-TEE (optional)
22---------------------------------
23If AVB is configured to use OP-TEE (see 4. below) rollback indexes and
24device lock state are stored in RPMB. The RPMB partition is managed by
25OP-TEE (https://www.op-tee.org/) which is a secure OS leveraging ARM
26TrustZone.
27
28
292. AVB 2.0 U-BOOT SHELL COMMANDS
30-----------------------------------
31Provides CLI interface to invoke AVB 2.0 verification + misc. commands for
32different testing purposes:
33
34avb init <dev> - initialize avb 2.0 for <dev>
35avb verify - run verification process using hash data from vbmeta structure
36avb read_rb <num> - read rollback index at location <num>
37avb write_rb <num> <rb> - write rollback index <rb> to <num>
38avb is_unlocked - returns unlock status of the device
39avb get_uuid <partname> - read and print uuid of partition <partname>
40avb read_part <partname> <offset> <num> <addr> - read <num> bytes from
41partition <partname> to buffer <addr>
42avb write_part <partname> <offset> <num> <addr> - write <num> bytes to
43<partname> by <offset> using data from <addr>
44
45
463. PARTITIONS TAMPERING (EXAMPLE)
47-----------------------------------
48Boot or system/vendor (dm-verity metadata section) is tampered:
49=> avb init 1
50=> avb verify
51avb_slot_verify.c:175: ERROR: boot: Hash of data does not match digest in
52descriptor.
53Slot verification result: ERROR_IO
54
55Vbmeta partition is tampered:
56=> avb init 1
57=> avb verify
58avb_vbmeta_image.c:206: ERROR: Hash does not match!
59avb_slot_verify.c:388: ERROR: vbmeta: Error verifying vbmeta image:
60HASH_MISMATCH
61Slot verification result: ERROR_IO
62
63
644. ENABLE ON YOUR BOARD
65-----------------------------------
66The following options must be enabled:
67CONFIG_LIBAVB=y
68CONFIG_AVB_VERIFY=y
69CONFIG_CMD_AVB=y
70
71In addtion optionally if storing rollback indexes in RPMB with help of
72OP-TEE:
73CONFIG_TEE=y
74CONFIG_OPTEE=y
75CONFIG_OPTEE_TA_AVB=y
76CONFIG_SUPPORT_EMMC_RPMB=y
77
78Then add `avb verify` invocation to your android boot sequence of commands,
79e.g.:
80
81=> avb_verify=avb init $mmcdev; avb verify;
82=> if run avb_verify; then                       \
83        echo AVB verification OK. Continue boot; \
84        set bootargs $bootargs $avb_bootargs;    \
85   else                                          \
86        echo AVB verification failed;            \
87        exit;                                    \
88   fi;                                           \
89
90=> emmc_android_boot=                                   \
91       echo Trying to boot Android from eMMC ...;       \
92       ...                                              \
93       run avb_verify;                                  \
94       mmc read ${fdtaddr} ${fdt_start} ${fdt_size};    \
95       mmc read ${loadaddr} ${boot_start} ${boot_size}; \
96       bootm $loadaddr $loadaddr $fdtaddr;              \
97
98
99To switch on automatic generation of vbmeta partition in AOSP build, add these
100lines to device configuration mk file:
101
102BOARD_AVB_ENABLE := true
103BOARD_AVB_ALGORITHM := SHA512_RSA4096
104BOARD_BOOTIMAGE_PARTITION_SIZE := <boot partition size>
105
106After flashing U-boot don't forget to update environment and write new
107partition table:
108=> env default -f -a
109=> setenv partitions $partitions_android
110=> env save
111=> gpt write mmc 1 $partitions_android
112

README.b4860qds

1Overview
2--------
3The B4860QDS is a Freescale reference board that hosts the B4860 SoC (and variants).
4
5B4860 Overview
6-------------
7The B4860 QorIQ Qonverge device is a Freescale high-end, multicore SoC based on
8StarCore and Power Architecture® cores. It targets the broadband wireless
9infrastructure and builds upon the proven success of the existing multicore
10DSPs and Power CPUs. It is designed to bolster the rapidly changing and
11expanding wireless markets, such as 3GLTE (FDD and TDD), LTE-Advanced, and UMTS.
12
13The B4860 is a highly-integrated StarCore and Power Architecture processor that
14contains:
15. Six fully-programmable StarCore SC3900 FVP subsystems, divided into three
16clusters-each core runs up to 1.2 GHz, with an architecture highly optimized for
17wireless base station applications
18. Four dual-thread e6500 Power Architecture processors organized in one cluster-each
19core runs up to 1.8 GHz
20. Two DDR3/3L controllers for high-speed, industry-standard memory interface each
21runs at up to 1866.67 MHz
22. MAPLE-B3 hardware acceleration-for forward error correction schemes including
23Turbo or Viterbi decoding, Turbo encoding and rate matching, MIMO MMSE
24equalization scheme, matrix operations, CRC insertion and check, DFT/iDFT and
25FFT/iFFT calculations, PUSCH/PDSCH acceleration, and UMTS chip rate
26acceleration
27. CoreNet fabric that fully supports coherency using MESI protocol between the
28  e6500 cores, SC3900 FVP cores, memories and external interfaces.
29  CoreNet fabric interconnect runs at 667 MHz and supports coherent and
30  non-coherent out of order transactions with prioritization and bandwidth
31  allocation amongst CoreNet endpoints.
32. Data Path Acceleration Architecture, which includes the following:
33. Frame Manager (FMan), which supports in-line packet parsing and general
34  classification to enable policing and QoS-based packet distribution
35. Queue Manager (QMan) and Buffer Manager (BMan), which allow offloading
36  of queue management, task management, load distribution, flow ordering, buffer
37  management, and allocation tasks from the cores
38. Security engine (SEC 5.3)-crypto-acceleration for protocols such as IPsec,
39  SSL, and 802.16
40. RapidIO manager (RMAN) - Support SRIO types 8, 9, 10, and 11 (inbound and
41  outbound). Supports types 5, 6 (outbound only)
42. Large internal cache memory with snooping and stashing capabilities for
43  bandwidth saving and high utilization of processor elements. The 9856-Kbyte
44  internal memory space includes the following:
45. 32 Kbyte L1 ICache per e6500/SC3900 core
46. 32 Kbyte L1 DCache per e6500/SC3900 core
47. 2048 Kbyte unified L2 cache for each SC3900 FVP cluster
48. 2048 Kbyte unified L2 cache for the e6500 cluster
49. Two 512 Kbyte shared L3 CoreNet platform caches (CPC)
50. Sixteen 10-GHz SerDes lanes serving:
51. Two Serial RapidIO interfaces.
52	- Each supports up to 4 lanes and a total of up to 8 lanes
53. Up to 8-lanes Common Public Radio Interface (CPRI) controller for glue-less
54  antenna connection
55. Two 10-Gbit Ethernet controllers (10GEC)
56. Six 1G/2.5-Gbit Ethernet controllers for network communications
57. PCI Express controller
58. Debug (Aurora)
59. Two OCeaN DMAs
60. Various system peripherals
61. 182 32-bit timers
62
63B4860QDS Overview
64------------------
65- DDRC1: Ten separate DDR3 parts of 16-bit to support 72-bit (ECC) at 1866MT/s, ECC, 4 GB
66  of memory in two ranks of 2 GB.
67- DDRC2: Five separate DDR3 parts of 16-bit to support 72-bit (ECC) at 1866MT/s, ECC, 2 GB
68  of memory. Single rank.
69- SerDes 1 multiplexing: Two Vitesse (transmit and receive path) cross-point 16x16 switch
70  VSC3316
71- SerDes 2 multiplexing: Two Vitesse (transmit and receive path) cross-point 8x8 switch VSC3308
72- USB 2.0 ULPI PHY USB3315 by SMSC supports USB port in host mode.
73  B4860 UART port is available over USB-to-UART translator USB2SER or over RS232 flat cable.
74- A Vitesse dual SGMII phy VSC8662 links the B4860 SGMII lines to 2xRJ-45 copper connectors
75  for Stand-alone mode and to the 1000Base-X over AMC MicroTCA connector ports 0 and 2 for
76  AMC mode.
77- The B4860 configuration may be loaded from nine bits coded reset configuration reset source. The
78  RCW source is set by appropriate DIP-switches:
79- 16-bit NOR Flash / PROMJet
80- QIXIS 8-bit NOR Flash Emulator
81- 8-bit NAND Flash
82- 24-bit SPI Flash
83- Long address I2C EEPROM
84- Available debug interfaces are:
85	- On-board eCWTAP controller with ETH and USB I/F
86	- JTAG/COP 16-pin header for any external TAP controller
87	- External JTAG source over AMC to support B2B configuration
88	- 70-pin Aurora debug connector
89- QIXIS (FPGA) logic:
90	- 2 KB internal memory space including
91- IDT840NT4 clock synthesizer provides B4860 essential clocks : SYSCLK, DDRCLK1,2 and
92  RTCCLK.
93- Two 8T49N222A SerDes ref clock devices support two SerDes port clock frequency - total four
94  refclk, including CPRI clock scheme.
95
96B4420 Personality
97--------------------
98
99B4420 Personality
100--------------------
101B4420 is a reduced personality of B4860 with less core/clusters(both SC3900 and e6500), less DDR
102controllers, less serdes lanes, less SGMII interfaces and reduced target frequencies.
103
104Key differences between B4860 and B4420
105----------------------------------------
106
107B4420 has:
1081. Less e6500 cores: 1 cluster with 2 e6500 cores
1092. Less SC3900 cores/clusters: 1 cluster with 2 SC3900 cores per cluster.
1103. Single DDRC
1114. 2X 4 lane serdes
1125. 3 SGMII interfaces
1136. no sRIO
1147. no 10G
115
116B4860QDS Default Settings
117-------------------------
118
119Switch Settings
120----------------
121
122SW1	OFF [0]	OFF [0]	OFF [0]	OFF [0]	OFF [0]	OFF [0]	OFF [0]	OFF [0]
123SW2	ON	ON	ON	ON	ON	ON	OFF	OFF
124SW3	OFF	OFF	OFF	ON	OFF	OFF	ON	OFF
125SW5	OFF	OFF	OFF	OFF	OFF	OFF	ON	ON
126
127Note: PCIe slots modes: All the PCIe devices work as Root Complex.
128Note: Boot location: NOR flash.
129
130SysClk/Core(e6500)/CCB/DDR/FMan/DDRCLK/StarCore/CPRI-Maple/eTVPE-Maple/ULB-Maple
13166MHz/1.6GHz/667MHz/1.6GHz data rate/667MHz/133MHz/1200MHz/500MHz/800MHz/667MHz
132
133a) NAND boot
134	SW1 [1.1] = 0
135	SW2 [1.1] = 1
136	SW3 [1:4] = 0001
137b) NOR boot
138	SW1 [1.1] = 1
139	SW2 [1.1] = 0
140	SW3 [1:4] = 1000.
141
142B4420QDS Default Settings
143-------------------------
144
145Switch Settings
146----------------
147SW1	OFF[0]	OFF [0]	OFF [0]	OFF [0]	OFF [0]	OFF [0]	OFF [0]	OFF [0]
148SW2	ON	OFF	ON	OFF	ON	ON	OFF	OFF
149SW3	OFF	OFF	OFF	ON	OFF	OFF	ON	OFF
150SW5	OFF	OFF	OFF	OFF	OFF	OFF	ON	ON
151
152Note: PCIe slots modes: All the PCIe devices work as Root Complex.
153Note: Boot location: NOR flash.
154
155SysClk/Core(e6500)/CCB/DDR/FMan/DDRCLK/StarCore/CPRI-Maple/eTVPE-Maple/ULB-Maple
15666MHz/1.6GHz/667MHz/1.6GHz data rate/667MHz/133MHz/1200MHz/500MHz/800MHz/667MHz
157
158a) NAND boot
159	SW1 [1.1] = 0
160	SW2 [1.1] = 1
161	SW3 [1:4] = 0001
162b) NOR boot
163	SW1 [1.1] = 1
164	SW2 [1.1] = 0
165	SW3 [1:4] = 1000.
166
167Memory map on B4860QDS
168----------------------
169The addresses in brackets are physical addresses.
170
171Start Address	End Address	Description	Size
1720xF_FFDF_1000 	0xF_FFFF_FFFF	Free		2 MB
1730xF_FFDF_0000 	0xF_FFDF_0FFF	IFC - FPGA 	4 KB
1740xF_FF81_0000 	0xF_FFDE_FFFF	Free		5 MB
1750xF_FF80_0000	0xF_FF80_FFFF	IFC NAND Flash	64 KB
1760xF_FF00_0000	0xF_FF7F_FFFF	Free		8 MB
1770xF_FE00_0000 	0xF_FEFF_FFFF	CCSRBAR		16 MB
1780xF_F801_0000 	0xF_FDFF_FFFF	Free		95 MB
1790xF_F800_0000	0xF_F800_FFFF	PCIe I/O Space 	64 KB
1800xF_F600_0000 	0xF_F7FF_FFFF	QMAN s/w portal	32 MB
1810xF_F400_0000 	0xF_F5FF_FFFF	BMAN s/w portal	32 MB
1820xF_F000_0000 	0xF_F3FF_FFFF	Free		64 MB
1830xF_E800_0000 	0xF_EFFF_FFFF	IFC  NOR Flash 	128 MB
1840xF_E000_0000	0xF_E7FF_FFFF	Promjet		128 MB
1850xF_A0C0_0000 	0xF_DFFF_FFFF	Free		1012 MB
1860xF_A000_0000 	0xF_A0BF_FFFF	MAPLE0/1/2	12 MB
1870xF_0040_0000 	0xF_9FFF_FFFF	Free		12 GB
1880xF_0000_0000 	0xF_01FF_FFFF	DCSR		32 MB
1890xC_4000_0000 	0xE_FFFF_FFFF	Free		11 GB
1900xC_3000_0000 	0xC_3FFF_FFFF	sRIO-2 I/O 	256 MB
1910xC_2000_0000 	0xC_2FFF_FFFF	sRIO-1 I/O  	256 MB
1920xC_0000_0000	0xC_1FFF_FFFF	PCIe Mem Space 	512 MB
1930x1_0000_0000 	0xB_FFFF_FFFF	Free		44 GB
1940x0_8000_0000 	0x0_FFFF_FFFF	DDRC1		2 GB
1950x0_0000_0000 	0x0_7FFF_FFFF	DDRC2	  	2 GB
196
197Memory map on B4420QDS
198----------------------
199The addresses in brackets are physical addresses.
200
201Start Address	End Address	Description	Size
2020xF_FFDF_1000 	0xF_FFFF_FFFF	Free		2 MB
2030xF_FFDF_0000 	0xF_FFDF_0FFF	IFC - FPGA 	4 KB
2040xF_FF81_0000 	0xF_FFDE_FFFF	Free		5 MB
2050xF_FF80_0000	0xF_FF80_FFFF	IFC NAND Flash	64 KB
2060xF_FF00_0000	0xF_FF7F_FFFF	Free		8 MB
2070xF_FE00_0000 	0xF_FEFF_FFFF	CCSRBAR		16 MB
2080xF_F801_0000 	0xF_FDFF_FFFF	Free		95 MB
2090xF_F800_0000	0xF_F800_FFFF	PCIe I/O Space 	64 KB
2100xF_F600_0000 	0xF_F7FF_FFFF	QMAN s/w portal	32 MB
2110xF_F400_0000 	0xF_F5FF_FFFF	BMAN s/w portal	32 MB
2120xF_F000_0000 	0xF_F3FF_FFFF	Free		64 MB
2130xF_E800_0000 	0xF_EFFF_FFFF	IFC  NOR Flash 	128 MB
2140xF_E000_0000	0xF_E7FF_FFFF	Promjet		128 MB
2150xF_A0C0_0000 	0xF_DFFF_FFFF	Free		1012 MB
2160xF_A000_0000 	0xF_A0BF_FFFF	MAPLE0/1/2	12 MB
2170xF_0040_0000 	0xF_9FFF_FFFF	Free		12 GB
2180xF_0000_0000 	0xF_01FF_FFFF	DCSR		32 MB
2190xC_4000_0000 	0xE_FFFF_FFFF	Free		11 GB
2200xC_3000_0000 	0xC_3FFF_FFFF	sRIO-2 I/O 	256 MB
2210xC_2000_0000 	0xC_2FFF_FFFF	sRIO-1 I/O  	256 MB
2220xC_0000_0000	0xC_1FFF_FFFF	PCIe Mem Space 	512 MB
2230x1_0000_0000 	0xB_FFFF_FFFF	Free		44 GB
2240x0_0000_0000 	0x0_FFFF_FFFF	DDRC1		4 GB
225
226
227NOR Flash memory Map on B4860 and B4420QDS
228------------------------------------------
229 Start		 End		Definition			Size
2300xEFF40000	0xEFFFFFFF	U-Boot (current bank)		768KB
2310xEFF20000	0xEFF3FFFF	U-Boot env (current bank)	128KB
2320xEFF00000	0xEFF1FFFF	FMAN Ucode (current bank)	128KB
2330xEF300000	0xEFEFFFFF	rootfs (alternate bank)		12MB
2340xEE800000	0xEE8FFFFF	device tree (alternate bank)	1MB
2350xEE020000	0xEE6FFFFF	Linux.uImage (alternate bank)	6MB+896KB
2360xEE000000	0xEE01FFFF	RCW (alternate bank)		128KB
2370xEDF40000	0xEDFFFFFF	U-Boot (alternate bank)		768KB
2380xEDF20000	0xEDF3FFFF	U-Boot env (alternate bank)	128KB
2390xEDF00000	0xEDF1FFFF	FMAN ucode (alternate bank)	128KB
2400xED300000	0xEDEFFFFF	rootfs (current bank)		12MB
2410xEC800000	0xEC8FFFFF	device tree (current bank)	1MB
2420xEC020000	0xEC6FFFFF	Linux.uImage (current bank)	6MB+896KB
2430xEC000000	0xEC01FFFF	RCW (current bank)		128KB
244
245Various Software configurations/environment variables/commands
246--------------------------------------------------------------
247The below commands apply to both B4860QDS and B4420QDS.
248
2491. U-Boot environment variable hwconfig
250   The default hwconfig is:
251	hwconfig=fsl_ddr:ctlr_intlv=null,bank_intlv=cs0_cs1;usb1:
252					dr_mode=host,phy_type=ulpi
253   Note: For USB gadget set "dr_mode=peripheral"
254
2552. FMAN Ucode versions
256   fsl_fman_ucode_B4860_106_3_6.bin
257
2583. Switching to alternate bank
259   Commands for switching to alternate bank.
260
261	1. To change from vbank0 to vbank2
262		=> qixis_reset altbank (it will boot using vbank2)
263
264	2.To change from vbank2 to vbank0
265		=> qixis reset (it will boot using vbank0)
266
2674. To change personality of board
268   For changing personality from B4860 to B4420
269	1)Boot from vbank0
270	2)Flash vbank2 with b4420 rcw and U-Boot
271	3)Give following commands to uboot prompt
272	   => mw.b ffdf0040 0x30;
273	   => mw.b ffdf0010 0x00;
274	   => mw.b ffdf0062 0x02;
275	   => mw.b ffdf0050 0x02;
276	   => mw.b ffdf0010 0x30;
277	   => reset
278
279   Note: Power off cycle will lead to default switch settings.
280   Note: 0xffdf0000 is the address of the QIXIS FPGA.
281
2825. Switching between NOR and NAND boot(RCW src changed from NOR <-> NAND)
283
284   To change from NOR to NAND boot give following command on uboot prompt
285	=> mw.b ffdf0040 0x30
286	=> mw.b ffdf0010 0x00
287	=> mw.b 0xffdf0050 0x08
288	=> mw.b 0xffdf0060 0x82
289	=> mw.b ffdf0061 0x00
290	=> mw.b ffdf0010 0x30
291	=> reset
292
293   To change from NAND to NOR boot give following command on uboot prompt:
294	=> mw.b ffdf0040 0x30
295	=> mw.b ffdf0010 0x00
296	=> mw.b 0xffdf0050 0x00(for vbank0) or (mw.b 0xffdf0050 0x02 for vbank2)
297	=> mw.b 0xffdf0060 0x12
298	=> mw.b ffdf0061 0x01
299	=> mw.b ffdf0010 0x30
300	=> reset
301
302   Note: Power off cycle will lead to default switch settings.
303   Note: 0xffdf0000 is the address of the QIXIS FPGA.
304
3056.  Ethernet interfaces for B4860QDS
306   Serdes protocosl tested:
307   0x2a, 0x8d (serdes1, serdes2) [DEFAULT]
308   0x2a, 0xb2 (serdes1, serdes2)
309
310   When using [DEFAULT] RCW, which including 2 * 1G SGMII on board and 2 * 1G
311   SGMII on SGMII riser card.
312   Under U-Boot these network interfaces are recognized as:
313   FM1@DTSEC3, FM1@DTSEC4, FM1@DTSEC5 and FM1@DTSEC6.
314
315   On Linux the interfaces are renamed as:
316	. eth2 -> fm1-gb2
317	. eth3 -> fm1-gb3
318	. eth4 -> fm1-gb4
319	. eth5 -> fm1-gb5
320
3217. RCW and Ethernet interfaces for B4420QDS
322   Serdes protocosl tested:
323   0x18, 0x9e (serdes1, serdes2)
324
325   Under U-Boot these network interfaces are recognized as:
326   FM1@DTSEC3, FM1@DTSEC4 and  e1000#0.
327
328   On Linux the interfaces are renamed as:
329	. eth2 -> fm1-gb2
330	. eth3 -> fm1-gb3
331
332NAND boot with 2 Stage boot loader
333----------------------------------
334PBL initialise the internal SRAM and copy SPL(160KB) in SRAM.
335SPL further initialise DDR using SPD and environment variables and copy
336U-Boot(768 KB) from flash to DDR.
337Finally SPL transer control to U-Boot for futher booting.
338
339SPL has following features:
340 - Executes within 256K
341 - No relocation required
342
343 Run time view of SPL framework during  boot :-
344 -----------------------------------------------
345 Area        | Address                         |
346-----------------------------------------------
347 Secure boot | 0xFFFC0000 (32KB)               |
348 headers     |                                 |
349 -----------------------------------------------
350 GD, BD      | 0xFFFC8000 (4KB)                |
351 -----------------------------------------------
352 ENV         | 0xFFFC9000 (8KB)                |
353 -----------------------------------------------
354 HEAP        | 0xFFFCB000 (30KB)               |
355 -----------------------------------------------
356 STACK       | 0xFFFD8000 (22KB)               |
357 -----------------------------------------------
358 U-Boot SPL  | 0xFFFD8000 (160KB)              |
359 -----------------------------------------------
360
361NAND Flash memory Map on B4860 and B4420QDS
362------------------------------------------
363 Start		 End		Definition			Size
3640x000000	0x0FFFFF	U-Boot                          1MB
3650x140000	0x15FFFF	U-Boot env                      128KB
3660x1A0000	0x1BFFFF	FMAN Ucode                      128KB
367

README.bcm7xxx

1Summary
2=======
3
4This document describes how to use U-Boot on the Broadcom 7445 SoC, as
5a third stage bootloader loaded by Broadcom's BOLT bootloader.
6
7BOLT loads U-Boot as a generic ELF binary.  Some U-Boot features such
8as networking are not yet available but other important features are,
9including:
10
11   - ext4 file system traversal
12
13   - support for loading FIT images
14
15   - advanced scripting
16
17   - support for FIT-provided DTBs instead of relying on the
18     BOLT-provided DTB
19
20A customized version of this port has been used in production.  The
21same approach may work on other BCM7xxx boards, with some
22configuration adjustments and memory layout experimentation.
23
24Build
25=====
26
27make bcm7445_defconfig
28make
29${CROSS_COMPILE}strip u-boot
30
31Run
32===
33
34Flash the u-boot binary into board storage, then invoke it from BOLT.
35For example:
36
37BOLT> boot -bsu -elf flash0.u-boot1
38
39This port assumes that I-cache and D-cache are already enabled when
40U-Boot is entered.
41
42Flattened Image Tree Support
43============================
44
45What follows is an example FIT image source file.  Build it with:
46
47mkimage -f image.its image.itb
48
49Booting the resulting image.itb was tested on BOLT v1.20, with the
50following kernels:
51
52https://github.com/Broadcom/stblinux-3.14
53https://github.com/Broadcom/stblinux-4.1
54https://github.com/Broadcom/stblinux-4.9
55
56and with a generic ARMv7 root file system.
57
58image.its:
59/dts-v1/;
60/ {
61	description = "BCM7445 FIT";
62	images {
63		kernel@1 {
64			description = "Linux kernel";
65			/*
66			 * This kernel image output format can be
67			 * generated with:
68			 *
69			 * make vmlinux
70			 * ${CROSS_COMPILE}objcopy -O binary -S vmlinux vmlinux.bin
71			 * gzip -9 vmlinux.bin
72			 *
73			 * For stblinux-3.14, the specific Broadcom
74			 * board type should be configured in the
75			 * kernel, for example CONFIG_BCM7445D0=y.
76			 */
77			data = /incbin/("<vmlinux.bin.gz>");
78			type = "kernel";
79			arch = "arm";
80			os = "linux";
81			compression = "gzip";
82			load = <0x8000>;
83			entry = <0x8000>;
84			hash@1 {
85				algo = "sha256";
86			};
87		};
88		ramdisk@1 {
89			description = "Initramfs root file system";
90			data = /incbin/("<initramfs.cpio.gz>");
91			type = "ramdisk";
92			arch = "arm";
93			os = "linux";
94			compression = "gzip";
95			/*
96			 * Set the environment variable initrd_high to
97			 * 0xffffffff, and set "load" and "entry" here
98			 * to 0x0 to keep initramfs in-place and to
99			 * accommodate stblinux bmem/CMA reservations.
100			 */
101			load = <0x0>;
102			entry = <0x0>;
103			hash@1 {
104				algo = "sha256";
105			};
106		};
107		fdt@1 {
108			description = "Device tree dumped from BOLT";
109			/*
110			 * This DTB should be similar to the
111			 * BOLT-generated device tree, after BOLT has
112			 * done its runtime modifications to it.  For
113			 * example, it can be dumped from within
114			 * U-Boot (at ${fdtcontroladdr}), after BOLT
115			 * has loaded U-Boot.  The result can be added
116			 * to the Linux source tree as a .dts file.
117			 *
118			 * To support modifications to the device tree
119			 * in-place in U-Boot, add to Linux's
120			 * arch/arm/boot/dts/Makefile:
121			 *
122			 * DTC_FLAGS ?= -p 4096
123			 *
124			 * This will leave some padding in the DTB and
125			 * thus reserve room for node additions.
126			 *
127			 * Also, set the environment variable fdt_high
128			 * to 0xffffffff to keep the DTB in-place and
129			 * to accommodate stblinux bmem/CMA
130			 * reservations.
131			 */
132			data = /incbin/("<bolt-<version>.dtb");
133			type = "flat_dt";
134			arch = "arm";
135			compression = "none";
136			hash@1 {
137				algo = "sha256";
138			};
139		};
140	};
141	configurations {
142		default = "conf@bcm7445";
143		conf@bcm7445 {
144			description = "BCM7445 configuration";
145			kernel = "kernel@1";
146			ramdisk = "ramdisk@1";
147			fdt = "fdt@1";
148		};
149	};
150};
151

README.bedbug

1BEDBUG Support for U-Boot
2--------------------------
3
4These changes implement the bedbug (emBEDded deBUGger) debugger in U-Boot.
5A specific implementation is made for the AMCC 405 processor but other flavors
6can be easily implemented.
7
8#####################
9### Modifications ###
10#####################
11
12./common/Makefile
13	Included cmd_bedbug.c and bedbug.c in the Makefile.
14
15./common/command.c
16	Added bedbug commands to command table.
17
18./common/board.c
19	Added call to initialize debugger on startup.
20
21./arch/powerpc/cpu/ppc4xx/Makefile
22	Added bedbug_405.c to the Makefile.
23
24./arch/powerpc/cpu/ppc4xx/start.S
25	Added code to handle the debug exception (0x2000) on the 405.
26	Also added code to handle critical exceptions since the debug
27	is treated as critical on the 405.
28
29./arch/powerpc/cpu/ppc4xx/traps.c
30	Added more detailed output for the program exception to tell
31	if it is an illegal instruction, privileged instruction or
32	a trap. Also added debug trap handler.
33
34./include/ppc_asm.tmpl
35	Added code to handle critical exceptions
36
37#################
38### New Stuff ###
39#################
40
41./include/bedbug/ppc.h
42./include/bedbug/regs.h
43./include/bedbug/bedbug.h
44./include/bedbug/elf.h		[obsoleted by new include/elf.h]
45./include/bedbug/tables.h
46./include/cmd_bedbug.h
47./common/cmd_bedbug.c
48./common/bedbug.c
49	Bedbug library includes code for assembling and disassembling
50	PowerPC instructions to/from memory as well as handling
51	hardware breakpoints and stepping through code.  These
52	routines are common to all PowerPC processors.
53
54./arch/powerpc/cpu/ppc4xx/bedbug_405.c
55	AMCC  PPC405 specific debugger routines.
56
57
58Bedbug support for the MPC860
59-----------------------------
60
61Changes:
62
63	common/cmd_bedbug.c
64		Added call to initialize 860 debugger.
65
66	arch/powerpc/cpu/mpc8xx/Makefile
67		Added new file "bedbug_860.c" to the makefile
68
69	arch/powerpc/cpu/mpc8xx/start.S
70		Added handler for InstructionBreakpoint (0xfd00)
71
72	arch/powerpc/cpu/mpc8xx/traps.c
73		Added new routine DebugException()
74
75New Files:
76
77	arch/powerpc/cpu/mpc8xx/bedbug_860.c
78		CPU-specific routines for 860 debug registers.
79

README.bitbangMII

1This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
2support an arbitrary number of mii buses. This feature is useful when your
3board uses different mii buses for different phys and all (or a part) of these
4buses are implemented via bit-banging mode.
5
6The driver requires that the following macros should be defined into the board
7configuration file:
8
9CONFIG_BITBANGMII	- Enable the miiphybb driver
10CONFIG_BITBANGMII_MULTI - Enable the multi bus support
11
12If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs
13to define at least the following macros:
14
15MII_INIT      - Generic code to enable the MII bus (optional)
16MDIO_DECLARE  - Declaration needed to access to the MDIO pin (optional)
17MDIO_ACTIVE   - Activate the MDIO pin as out pin
18MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
19MDIO_READ     - Read the MDIO pin
20MDIO(v)       - Write v on the MDIO pin
21MDC_DECLARE   - Declaration needed to access to the MDC pin (optional)
22MDC(v)	      - Write v on the MDC pin
23
24The previous macros make the driver compatible with the previous version
25(that didn't support the multi-bus).
26
27When the CONFIG_BITBANGMII_MULTI is also defined, the board code needs to fill
28the bb_miiphy_buses[] array with a record for each required bus and declare
29the bb_miiphy_buses_num variable with the number of mii buses.
30The record (struct bb_miiphy_bus) has the following fields/callbacks (see
31miiphy.h for details):
32
33char name[]	       - The symbolic name that must be equal to the MII bus
34			 registered name
35int (*init)()	       - Initialization function called at startup time (just
36			 before the Ethernet initialization)
37int (*mdio_active)()   - Activate the MDIO pin as output
38int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
39int (*set_mdio)()      - Write the MDIO pin
40int (*get_mdio)()      - Read the MDIO pin
41int (*set_mdc)()       - Write the MDC pin
42int (*delay)()	       - Delay function
43void *priv	       - Private data used by board specific code
44
45The board code will look like:
46
47struct bb_miiphy_bus bb_miiphy_buses[] = {
48 { .name = "miibus#1", .init = b1_init, .mdio_active = b1_mdio_active, ... },
49 { .name = "miibus#2", .init = b2_init, .mdio_active = b2_mdio_active, ... },
50 ...
51};
52int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
53			  sizeof(bb_miiphy_buses[0]);
54
552009 Industrie Dial Face S.p.A.
56     Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com>
57

README.blackfin

1Notes for the Blackfin architecture port of Das U-Boot
2
3 =========
4 ! ABOUT !
5 =========
6
7<marketing blurb>
8Blackfin Processors embody a new breed of 16/32-bit embedded processor, ideally
9suited for products where a convergence of capabilities are necessary -
10multi-format audio, video, voice and image processing; multi-mode baseband and
11packet processing; control processing; and real-time security.  The Blackfin's
12unique combination of software flexibility and scalability has gained it
13widespread adoption in convergent applications.
14</marketing blurb>
15
16The Blackfin processor is wholly developed by Analog Devices Inc.
17
18 ===========
19 ! SUPPORT !
20 ===========
21
22All open source code for the Blackfin processors are being handled via our
23collaborative website:
24http://blackfin.uclinux.org/
25
26In particular, bug reports, feature requests, help etc... for Das U-Boot are
27handled in the Das U-Boot sub project:
28http://blackfin.uclinux.org/gf/project/u-boot
29
30This website is backed both by an open source community as well as a dedicated
31team from Analog Devices Inc.
32
33 =============
34 ! TOOLCHAIN !
35 =============
36
37To compile the Blackfin aspects, you'll need the GNU toolchain configured for
38the Blackfin processor.  You can obtain such a cross-compiler here:
39http://blackfin.uclinux.org/gf/project/toolchain
40
41 =================
42 ! DOCUMENTATION !
43 =================
44
45For Blackfin specific documentation, you can visit our dedicated doc wiki:
46http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot
47

README.bloblist

1# SPDX-License-Identifier: GPL-2.0+
2
3Blob Lists - bloblist
4=====================
5
6Introduction
7------------
8
9A bloblist provides a way to store collections of binary information (blobs) in
10a central structure. Each record of information is assigned a tag so that its
11owner can find it and update it. Each record is generally described by a C
12structure defined by the code that owns it.
13
14
15Passing state through the boot process
16--------------------------------------
17
18The bloblist is created when the first U-Boot component runs (often SPL,
19sometimes TPL). It is passed through to each successive part of the boot and
20can be accessed as needed. This provides a way to transfer state from one part
21to the next. For example, TPL may determine that a watchdog reset occurred by
22reading an SoC register. Reading the register may reset the value, so that it
23cannot be read a second time. So TPL can store that in a bloblist record which
24can be passed through to SPL and U-Boot proper, which can print a message
25indicating that something went wrong and the watchdog fired.
26
27
28Blobs
29-----
30
31While each blob in the bloblist can be of any length, bloblists are designed to
32hold small amounts of data, typically a few KB at most. It is not possible to
33change the length of a blob once it has been written. Each blob is normally
34created from a C structure which can beused to access its fields.
35
36
37Blob tags
38---------
39
40Each blob has a tag which is a 32-bit number. This uniquely identifies the
41owner of the blob. Blob tags are listed in enum blob_tag_t and are named
42with a BLOBT_ prefix.
43
44
45Single structure
46----------------
47
48There is normally only one bloblist in U-Boot. Since a bloblist can store
49multiple blobs it does not seem useful to allow multiple bloblists. Of course
50there could be reasons for this, such as needing to spread the blobs around in
51different memory areas due to fragmented memory, but it is simpler to just have
52a single bloblist.
53
54
55API
56---
57
58Bloblist provides a fairly simple API which allows blobs to be created  and
59found. All access is via the blob's tag.
60
61
62Finishing the bloblist
63----------------------
64
65When a part of U-Boot is about to jump to the next part, it can 'finish' the
66bloblist in preparation for the next stage. This involves adding a checksum so
67that the next stage can make sure that the data arrived safely. While the
68bloblist is in use, changes can be made which will affect the checksum, so it
69is easier to calculate the checksum at the end after all changes are made.
70
71
72Future work
73-----------
74
75Bootstage has a mechanism to 'stash' its records for passing to the next part.
76This should move to using bloblist, to avoid having its own mechanism for
77passing information between U-Boot parts.
78
79
80Simon Glass
81sjg@chromium.org
8212-Aug-2018
83

README.bootmenu

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2011-2012 Pali Rohár <pali.rohar@gmail.com>
4 */
5
6ANSI terminal bootmenu command
7
8The "bootmenu" command uses U-Boot menu interfaces and provides
9a simple mechanism for creating menus with different boot items.
10The cursor keys "Up" and "Down" are used for navigation through
11the items. Current active menu item is highlighted and can be
12selected using the "Enter" key. The selection of the highlighted
13menu entry invokes an U-Boot command (or a list of commands)
14associated with this menu entry.
15
16The "bootmenu" command interprets ANSI escape sequencies, so
17an ANSI terminal is required for proper menu rendering and item
18selection.
19
20The assembling of the menu is done via a set of environment variables
21"bootmenu_<num>" and "bootmenu_delay", i.e.:
22
23  bootmenu_delay=<delay>
24  bootmenu_<num>="<title>=<commands>"
25
26  <delay> is the autoboot delay in seconds, after which the first
27  menu entry will be selected automatically
28
29  <num> is the boot menu entry number, starting from zero
30
31  <title> is the text of the menu entry shown on the console
32  or on the boot screen
33
34  <commands> are commands which will be executed when a menu
35  entry is selected
36
37  (title and commands are separated by first appearance of '='
38   character in the environment variable)
39
40First (optional) argument of the "bootmenu" command is a delay specifier
41and it overrides the delay value defined by "bootmenu_delay" environment
42variable. If the environment variable "bootmenu_delay" is not set or if
43the argument of the "bootmenu" command is not specified, the default delay
44will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on
45the console (or on the screen) and the command of the first menu entry will
46be called immediately. If delay is less then 0, bootmenu will be shown and
47autoboot will be disabled.
48
49Bootmenu always adds menu entry "U-Boot console" at the end of all menu
50entries specified by environment variables. When selecting this entry
51the bootmenu terminates and the usual U-Boot command prompt is presented
52to the user.
53
54Example environment:
55
56  setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000  # Set first menu entry
57  setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000  # Set second menu entry
58  setenv bootmenu_2 Reset board=reset                # Set third menu entry
59  setenv bootmenu_3 U-Boot boot order=boot           # Set fourth menu entry
60  bootmenu 20        # Run bootmenu with autoboot delay 20s
61
62
63The above example will be rendered as below
64(without decorating rectangle):
65
66┌──────────────────────────────────────────┐
67│                                          │
68│  *** U-Boot Boot Menu ***                │
69│                                          │
70│     Boot 1. kernel                       │
71│     Boot 2. kernel                       │
72│     Reset board                          │
73│     U-Boot boot order                    │
74│     U-Boot console                       │
75│                                          │
76│  Hit any key to stop autoboot: 20        │
77│  Press UP/DOWN to move, ENTER to select  │
78│                                          │
79└──────────────────────────────────────────┘
80
81Selected menu entry will be highlighted - it will have inverted
82background and text colors.
83
84To enable the "bootmenu" command add following definitions to the
85board config file:
86
87  #define CONFIG_CMD_BOOTMENU
88  #define CONFIG_MENU
89
90To run the bootmenu at startup add these additional definitions:
91
92  #define CONFIG_AUTOBOOT_KEYED
93  #define CONFIG_BOOTDELAY 30
94  #define CONFIG_MENU_SHOW
95
96When you intend to use the bootmenu on color frame buffer console,
97make sure to additionally define CONFIG_CFB_CONSOLE_ANSI in the
98board config file.
99

README.boston

1MIPS Boston Development Board
2
3---------
4  About
5---------
6
7The MIPS Boston development board is built around an FPGA & 3 PCIe controllers,
8one of which is connected to an Intel EG20T Platform Controller Hub which
9provides most connectivity to the board. It is used during the development &
10testing of both new CPUs and the software support for them. It is essentially
11the successor of the older MIPS Malta board.
12
13--------
14  QEMU
15--------
16
17U-Boot can be run on a currently out-of-tree branch of QEMU with support for
18the Boston board added. This QEMU code can currently be found in the "boston"
19branch of git://git.linux-mips.org/pub/scm/paul/qemu.git and used like so:
20
21  $ git clone git://git.linux-mips.org/pub/scm/paul/qemu.git -b boston
22  $ cd qemu
23  $ ./configure --target-list=mips64el-softmmu
24  $ make
25  $ ./mips64el-softmmu/qemu-system-mips64el -M boston -m 2G \
26      -bios u-boot.bin -serial stdio
27
28Please note that QEMU will default to emulating the I6400 CPU which implements
29the MIPS64r6 ISA, and at the time of writing doesn't implement any earlier CPUs
30with support for the CPS features the Boston board relies upon. You will
31therefore need to configure U-Boot to build for MIPSr6 in order to obtain a
32binary that will work in QEMU.
33
34-------------
35  Toolchain
36-------------
37
38If building for MIPSr6 then you will need a toolchain including GCC 5.x or
39newer, or the Codescape toolchain available for download from Imagination
40Technologies:
41
42  http://codescape-mips-sdk.imgtec.com/components/toolchain/2015.06-05/
43
44The "IMG GNU Linux Toolchain" is capable of building for all current MIPS ISAs,
45architecture revisions & both endiannesses.
46
47--------
48  TODO
49--------
50
51  - AHCI support
52  - CPU driver
53  - Exception handling (+UHI?)
54  - Flash support
55  - IOCU support
56  - L2 cache support
57  - More general LCD display driver
58  - Multi-arch-variant multi-endian fat binary
59

README.bus_vcxk

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2008-2009
4 * BuS Elektronik GmbH & Co. KG <www.bus-elektronik.de>
5 * Jens Scharsig <esw@bus-elektronik.de>
6 */
7
8U-Boot vcxk video controller driver
9======================================
10
11By defining CONFIG_VIDEO_VCXK this driver can be used with VC2K, VC4K and
12VC8K devices on following boards:
13
14board           | ARCH          | Vendor
15-----------------------------------------------------------------------
16EB+CPU5282-T1   | MCF5282       | BuS Elektronik GmbH & Co. KG
17EB+MCF-EVB123   | MCF5282       | BuS Elektronik GmbH & Co. KG
18EB+CPUx9K2      | AT91RM9200    | BuS Elektronik GmbH & Co. KG
19ZLSA            | AT91RM9200    | Ruf Telematik AG
20
21Driver configuration
22--------------------
23
24The driver needs some defines to describe the target hardware:
25
26CONFIG_SYS_VCXK_BASE
27
28	base address of VCxK hardware memory
29
30CONFIG_SYS_VCXK_DEFAULT_LINEALIGN
31
32	defines the physical alignment of a pixel row
33
34CONFIG_SYS_VCXK_DOUBLEBUFFERED
35
36	some boards that use vcxk prevent read from framebuffer memory.
37	define this option to enable double buffering (needs 16KiB RAM)
38
39CONFIG_SYS_VCXK_<xxxx>_PIN
40
41	defines the number of the I/O line PIN in the port
42	valid values for <xxxx> are:
43
44		ACKNOWLEDGE
45			describes the acknowledge line from vcxk hardware
46
47		ENABLE
48			describes the enable line to vcxk hardware
49
50		INVERT
51			describes the invert line to vcxk hardware
52
53		RESET
54			describes the reset line to vcxk hardware
55
56		REQUEST
57			describes the request line to vcxk hardware
58
59CONFIG_SYS_VCXK_<xxxx>_PORT
60
61	defines the I/O port which is connected with the line
62	for valid values for <xxxx> see CONFIG_SYS_VCXK_<xxxx>_PIN
63
64CONFIG_SYS_VCXK_<xxxx>_DDR
65
66	defines the register which configures the direction
67	for valid values for <xxxx> see CONFIG_SYS_VCXK_<xxxx>_PIN
68

README.cfi

1The common CFI driver provides this weak default implementation for
2flash_cmd_reset():
3
4static void __flash_cmd_reset(flash_info_t *info)
5{
6	/*
7	 * We do not yet know what kind of commandset to use, so we issue
8	 * the reset command in both Intel and AMD variants, in the hope
9	 * that AMD flash roms ignore the Intel command.
10	 */
11	flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
12	udelay(1);
13	flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
14}
15void flash_cmd_reset(flash_info_t *info)
16	__attribute__((weak,alias("__flash_cmd_reset")));
17
18Some flash chips seem to have trouble with this reset sequence.
19In this case, board-specific code can override this weak default
20version with a board-specific function.
21
22At the time of writing, there are two boards that define their own
23routine for this.
24
25First, the digsy_mtc board equipped with the M29W128GH from Numonyx
26needs this version to function properly:
27
28void flash_cmd_reset(flash_info_t *info)
29{
30	flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
31}
32
33In addition, the t3corp board defines the routine thusly:
34
35void flash_cmd_reset(flash_info_t *info)
36{
37	/*
38	 * FLASH at address CONFIG_SYS_FLASH_BASE is a Spansion chip and
39	 * needs the Spansion type reset commands. The other flash chip
40	 * is located behind a FPGA (Xilinx DS617) and needs the Intel type
41	 * reset command.
42	 */
43	if (info->start[0] == CONFIG_SYS_FLASH_BASE)
44		flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
45	else
46		flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
47}
48
49see also:
50http://www.mail-archive.com/u-boot@lists.denx.de/msg24368.html
51
52
53Config Option
54
55  CONFIG_SYS_MAX_FLASH_SECT: Number of sectors available on Flash device
56
57  CONFIG_SYS_FLASH_CFI_WIDTH: Data-width of the flash device
58
59  CONFIG_CMD_FLASH: Enables Flash command library
60
61  CONFIG_FLASH_CFI_DRIVER: Enables CFI Flash driver
62
63  CONFIG_FLASH_CFI_MTD: Enables MTD frame work for NOR Flash devices
64

README.chromium

1Running U-Boot from coreboot on Chromebooks
2===========================================
3
4U-Boot can be used as a secondary boot loader in a few situations such as from
5UEFI and coreboot (see README.x86). Recent Chromebooks use coreboot even on
6ARM platforms to start up the machine.
7
8This document aims to provide a guide to booting U-Boot on a Chromebook. It
9is only a starting point, and there are many guides on the interwebs. But
10placing this information in the U-Boot tree should make it easier to find for
11those who use U-Boot habitually.
12
13Most of these platforms are supported by U-Boot natively, but it is risky to
14replace the ROM unless you have a servo board and cable to restore it with.
15
16
17For all of these the standard U-Boot build instructions apply. For example on
18ARM:
19
20   sudo apt install gcc-arm-linux-gnueabi
21   mkdir b
22   make O=b/nyan_big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all
23
24You can obtain the vbutil_kernel utility here:
25
26   https://drive.google.com/open?id=0B7WYZbZ9zd-3dHlVVXo4VXE2T0U
27
28
29Snow (Samsung ARM Chromebook)
30-----------------------------
31
32See here:
33
34https://www.chromium.org/chromium-os/firmware-porting-guide/using-nv-u-boot-on-the-samsung-arm-chromebook
35
36
37Nyan-big
38--------
39
40Compiled based on information here:
41https://lists.denx.de/pipermail/u-boot/2015-March/209530.html
42https://git.collabora.com/cgit/user/tomeu/u-boot.git/commit/?h=nyan-big
43https://lists.denx.de/pipermail/u-boot/2017-May/289491.html
44https://github.com/chromeos-nvidia-androidtv/gnu-linux-on-acer-chromebook-13#copy-data-to-the-sd-card
45
461. Build U-Boot
47
48   mkdir b
49   make -j8 O=b/nyan-big CROSS_COMPILE=arm-linux-gnueabi- nyan-big_defconfig all
50
51
522. Select a .its file
53
54Select something from doc/chromium which matches your board, or create your
55own.
56
57Note that the device tree node is required, even though it is not actually
58used by U-Boot. This is because the Chromebook expects to pass it to the
59kernel, and crashes if it is not present.
60
61
623. Build and sign an image
63
64   ./b/nyan-big/tools/mkimage -f doc/chromium/nyan-big.its u-boot-chromium.fit
65   echo test >dummy.txt
66   vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \
67	--signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \
68	--version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \
69	--bootloader dummy.txt --pack u-boot.kpart
70
71
724. Prepare an SD card
73
74   DISK=/dev/sdc   # Replace with your actual SD card device
75   sudo cgpt create $DISK
76   sudo cgpt add -b 34 -s 32768 -P 1 -S 1 -t kernel $DISK
77   sudo cgpt add -b 32802 -s 2000000 -t rootfs $DISK
78   sudo gdisk $DISK   # Enter command 'w' to write a protective MBR to the disk
79
80
815. Write U-Boot to the SD card
82
83   sudo dd if=u-boot.kpart of=/dev/sdc1; sync
84
85
866. Start it up
87
88Reboot the device in dev mode. Make sure that you have USB booting enabled. To
89do this, login as root (via Ctrl-Alt-forward_arrow) and type
90'enable_dev_usb_boot'. You only need to do this once.
91
92Reboot the device with the SD card inserted. Press Clrl-U at the developer
93mode screen. It should show something like the following on the display:
94
95   U-Boot 2017.07-00637-g242eb42-dirty (May 22 2017 - 06:14:21 -0600)
96
97   Model: Acer Chromebook 13 CB5-311
98   Board: Google/NVIDIA Nyan-big, ID: 1
99
100   Net:   No ethernet found.
101   Hit any key to stop autoboot:  0
102   Tegra124 (Nyan-big) #
103
104
1057. Known problems
106
107On the serial console the word MMC is chopped at the start of the line:
108
109C:   sdhci@700b0000: 2, sdhci@700b0400: 1, sdhci@700b0600: 0
110
111This is likely due to some problem with change-over of the serial driver
112during relocation (or perhaps updating the clock setup in board_init()).
113
114
1159. Notes
116
117To check that you copied the u-boot.its file correctly, use these commands.
118You should see that the data at 0x100 in u-boot-chromium.fit is the first few
119bytes of U-Boot:
120
121   hd u-boot-chromium.fit |head -20
122   ...
123   00000100  b8 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |................|
124
125   hd b/nyan-big/u-boot.bin |head
126   00000000  b8 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |................|
127
128
129The 'data' property of the FIT is set up to start at offset 0x100 bytes into
130the file. The change to CONFIG_SYS_TEXT_BASE is also an offset of 0x100 bytes
131from the load address. If this changes, you either need to modify U-Boot to be
132fully relocatable, or expect it to hang.
133
134
135chromebook_jerry
136----------------
137
138The instruction are similar to those for Nyan with changes as noted below:
139
1401. Patch U-Boot
141
142Open include/configs/rk3288_common.h
143
144Change:
145
146#define CONFIG_SYS_TEXT_BASE		0x00100000
147
148to:
149
150#define CONFIG_SYS_TEXT_BASE		0x02000100
151
152
153
1542. Build U-Boot
155
156   mkdir b
157   make -j8 O=b/chromebook_jerry CROSS_COMPILE=arm-linux-gnueabi- \
158	chromebook_jerry_defconfig all
159
160
1613. See above
162
1634. Build and sign an image
164
165   ./b/chromebook_jerry/tools/mkimage -f doc/chromium/chromebook_jerry.its \
166	u-boot-chromium.fit
167   echo test >dummy.txt
168   vbutil_kernel --arch arm --keyblock doc/chromium/devkeys/kernel.keyblock \
169	--signprivate doc/chromium/devkeys/kernel_data_key.vbprivk \
170	--version 1 --config dummy.txt --vmlinuz u-boot-chromium.fit \
171	--bootloader dummy.txt --pack u-boot.kpart
172
173
1745. See above
175
1766. See above
177
1787. Start it up
179
180Reboot the device in dev mode. Make sure that you have USB booting enabled. To
181do this, login as root (via Ctrl-Alt-forward_arrow) and type
182'enable_dev_usb_boot'. You only need to do this once.
183
184Reboot the device with the SD card inserted. Press Clrl-U at the developer
185mode screen. It should show something like the following on the display:
186
187   U-Boot 2017.05-00649-g72acdbf-dirty (May 29 2017 - 14:57:05 -0600)
188
189   Model: Google Jerry
190   Net:   Net Initialization Skipped
191   No ethernet found.
192   Hit any key to stop autoboot:  0
193
194
1958. Known problems
196
197None as yet.
198
199
2009. Notes
201
202None as yet.
203
204
205Other notes
206===========
207
208flashrom
209--------
210
211   Used to make a backup of your firmware, or to replace it.
212
213   See: https://www.chromium.org/chromium-os/packages/cros-flashrom
214
215
216coreboot
217--------
218
219Coreboot itself is not designed to actually boot an OS. Instead, a program
220called Depthcharge is used. This originally came out of U-Boot and was then
221heavily hacked and modified such that is is almost unrecognisable. It does
222include a very small part of the U-Boot command-line interface but is not
223usable as a general-purpose boot loader.
224
225In addition, it has a very unusual design in that it does not do device init
226itself, but instead relies on coreboot. This is similar to (in U-Boot) having
227a SPI driver with an empty probe() method, relying on whatever was set up
228beforehand. It can be quite hard to figure out between these two code bases
229what settings are actually used. When chain-loading into U-Boot we must be
230careful to reinit anything that U-Boot expects. If not, some peripherals (or
231the whole machine) may not work. This makes the process of chainloading more
232complicated than it could be on some platforms.
233
234Finally, it supports only a subset of the U-Boot's FIT format. In particular
235it uses a fixed address to load the FIT and does not support load/exec
236addresses. This means that U-Boot must be able to boot from whatever
237address Depthcharge happens to use (it is the CONFIG_KERNEL_START setting
238in Depthcharge). In practice this means that the data in the kernel@1 FIT node
239(see above) must start at the same address as U-Boot's CONFIG_SYS_TEXT_BASE.
240

README.clang

1The biggest problem when trying to compile U-Boot with clang is that
2almost all archs rely on storing gd in a global register and clang user
3manual states: "clang does not support global register variables; this
4is unlikely to be implemented soon because it requires additional LLVM
5backend support."
6
7Since version 3.4 the ARM backend can be instructed to leave r9 alone.
8Global registers themselves are not supported so some inline assembly is
9used to get its value. This does lead to larger code then strictly
10necessary, but at least works.
11
12NOTE: target compilation only work for _some_ ARM boards at the moment.
13Also AArch64 is not supported currently due to a lack of private libgcc
14support.  Boards which reassign gd in c will also fail to compile, but there is
15in no strict reason to do so in the ARM world, since crt0.S takes care of this.
16These assignments can be avoided by changing the init calls but this is not in
17mainline yet.
18
19Debian (based)
20--------------
21Binary packages can be installed as usual, e.g.:
22sudo apt-get install clang
23
24Note that we still use binutils for some tools so we must continue to set
25CROSS_COMPILE. To compile U-Boot with clang on linux without IAS use e.g.:
26make HOSTCC=clang rpi_2_defconfig
27make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- \
28    CC="clang -target arm-linux-gnueabi" -j8
29
30It can also be used to compile sandbox:
31make HOSTCC=clang sandbox_defconfig
32make HOSTCC=clang CC=clang -j8
33
34FreeBSD 11 (Current):
35--------------------
36Since llvm 3.4 is currently in the base system, the integrated as is
37incapable of building U-Boot. Therefore gas from devel/arm-gnueabi-binutils
38is used instead. It needs a symlinks to be picked up correctly though:
39
40ln -s /usr/local/bin/arm-gnueabi-freebsd-as /usr/bin/arm-freebsd-eabi-as
41
42# The following commands compile U-Boot using the clang xdev toolchain.
43# NOTE: CROSS_COMPILE and target differ on purpose!
44export CROSS_COMPILE=arm-gnueabi-freebsd-
45gmake rpi_2_defconfig
46gmake CC="clang -target arm-freebsd-eabi --sysroot /usr/arm-freebsd" -j8
47
48Given that U-Boot will default to gcc, above commands can be
49simplified with a simple wrapper script, listed below.
50
51/usr/local/bin/arm-gnueabi-freebsd-gcc
52---
53#!/bin/sh
54
55exec clang -target arm-freebsd-eabi --sysroot /usr/arm-freebsd "$@"
56

README.coccinelle

1.. Copyright 2010 Nicolas Palix <npalix@diku.dk>
2.. Copyright 2010 Julia Lawall <julia@diku.dk>
3.. Copyright 2010 Gilles Muller <Gilles.Muller@lip6.fr>
4
5.. highlight:: none
6
7Coccinelle
8==========
9
10Coccinelle is a tool for pattern matching and text transformation that has
11many uses in kernel development, including the application of complex,
12tree-wide patches and detection of problematic programming patterns.
13
14Getting Coccinelle
15-------------------
16
17The semantic patches included in the kernel use features and options
18which are provided by Coccinelle version 1.0.0-rc11 and above.
19Using earlier versions will fail as the option names used by
20the Coccinelle files and coccicheck have been updated.
21
22Coccinelle is available through the package manager
23of many distributions, e.g. :
24
25 - Debian
26 - Fedora
27 - Ubuntu
28 - OpenSUSE
29 - Arch Linux
30 - NetBSD
31 - FreeBSD
32
33You can get the latest version released from the Coccinelle homepage at
34http://coccinelle.lip6.fr/
35
36Information and tips about Coccinelle are also provided on the wiki
37pages at http://cocci.ekstranet.diku.dk/wiki/doku.php
38
39Once you have it, run the following command::
40
41     	./configure
42        make
43
44as a regular user, and install it with::
45
46        sudo make install
47
48Supplemental documentation
49---------------------------
50
51For supplemental documentation refer to the wiki:
52
53https://bottest.wiki.kernel.org/coccicheck
54
55The wiki documentation always refers to the linux-next version of the script.
56
57Using Coccinelle on the Linux kernel
58------------------------------------
59
60A Coccinelle-specific target is defined in the top level
61Makefile. This target is named ``coccicheck`` and calls the ``coccicheck``
62front-end in the ``scripts`` directory.
63
64Four basic modes are defined: ``patch``, ``report``, ``context``, and
65``org``. The mode to use is specified by setting the MODE variable with
66``MODE=<mode>``.
67
68- ``patch`` proposes a fix, when possible.
69
70- ``report`` generates a list in the following format:
71  file:line:column-column: message
72
73- ``context`` highlights lines of interest and their context in a
74  diff-like style.Lines of interest are indicated with ``-``.
75
76- ``org`` generates a report in the Org mode format of Emacs.
77
78Note that not all semantic patches implement all modes. For easy use
79of Coccinelle, the default mode is "report".
80
81Two other modes provide some common combinations of these modes.
82
83- ``chain`` tries the previous modes in the order above until one succeeds.
84
85- ``rep+ctxt`` runs successively the report mode and the context mode.
86  It should be used with the C option (described later)
87  which checks the code on a file basis.
88
89Examples
90~~~~~~~~
91
92To make a report for every semantic patch, run the following command::
93
94		make coccicheck MODE=report
95
96To produce patches, run::
97
98		make coccicheck MODE=patch
99
100
101The coccicheck target applies every semantic patch available in the
102sub-directories of ``scripts/coccinelle`` to the entire Linux kernel.
103
104For each semantic patch, a commit message is proposed.  It gives a
105description of the problem being checked by the semantic patch, and
106includes a reference to Coccinelle.
107
108As any static code analyzer, Coccinelle produces false
109positives. Thus, reports must be carefully checked, and patches
110reviewed.
111
112To enable verbose messages set the V= variable, for example::
113
114   make coccicheck MODE=report V=1
115
116Coccinelle parallelization
117---------------------------
118
119By default, coccicheck tries to run as parallel as possible. To change
120the parallelism, set the J= variable. For example, to run across 4 CPUs::
121
122   make coccicheck MODE=report J=4
123
124As of Coccinelle 1.0.2 Coccinelle uses Ocaml parmap for parallelization,
125if support for this is detected you will benefit from parmap parallelization.
126
127When parmap is enabled coccicheck will enable dynamic load balancing by using
128``--chunksize 1`` argument, this ensures we keep feeding threads with work
129one by one, so that we avoid the situation where most work gets done by only
130a few threads. With dynamic load balancing, if a thread finishes early we keep
131feeding it more work.
132
133When parmap is enabled, if an error occurs in Coccinelle, this error
134value is propagated back, the return value of the ``make coccicheck``
135captures this return value.
136
137Using Coccinelle with a single semantic patch
138---------------------------------------------
139
140The optional make variable COCCI can be used to check a single
141semantic patch. In that case, the variable must be initialized with
142the name of the semantic patch to apply.
143
144For instance::
145
146	make coccicheck COCCI=<my_SP.cocci> MODE=patch
147
148or::
149
150	make coccicheck COCCI=<my_SP.cocci> MODE=report
151
152
153Controlling Which Files are Processed by Coccinelle
154---------------------------------------------------
155
156By default the entire kernel source tree is checked.
157
158To apply Coccinelle to a specific directory, ``M=`` can be used.
159For example, to check drivers/net/wireless/ one may write::
160
161    make coccicheck M=drivers/net/wireless/
162
163To apply Coccinelle on a file basis, instead of a directory basis, the
164following command may be used::
165
166    make C=1 CHECK="scripts/coccicheck"
167
168To check only newly edited code, use the value 2 for the C flag, i.e.::
169
170    make C=2 CHECK="scripts/coccicheck"
171
172In these modes, which works on a file basis, there is no information
173about semantic patches displayed, and no commit message proposed.
174
175This runs every semantic patch in scripts/coccinelle by default. The
176COCCI variable may additionally be used to only apply a single
177semantic patch as shown in the previous section.
178
179The "report" mode is the default. You can select another one with the
180MODE variable explained above.
181
182Debugging Coccinelle SmPL patches
183---------------------------------
184
185Using coccicheck is best as it provides in the spatch command line
186include options matching the options used when we compile the kernel.
187You can learn what these options are by using V=1, you could then
188manually run Coccinelle with debug options added.
189
190Alternatively you can debug running Coccinelle against SmPL patches
191by asking for stderr to be redirected to stderr, by default stderr
192is redirected to /dev/null, if you'd like to capture stderr you
193can specify the ``DEBUG_FILE="file.txt"`` option to coccicheck. For
194instance::
195
196    rm -f cocci.err
197    make coccicheck COCCI=scripts/coccinelle/free/kfree.cocci MODE=report DEBUG_FILE=cocci.err
198    cat cocci.err
199
200You can use SPFLAGS to add debugging flags, for instance you may want to
201add both --profile --show-trying to SPFLAGS when debugging. For instance
202you may want to use::
203
204    rm -f err.log
205    export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci
206    make coccicheck DEBUG_FILE="err.log" MODE=report SPFLAGS="--profile --show-trying" M=./drivers/mfd/arizona-irq.c
207
208err.log will now have the profiling information, while stdout will
209provide some progress information as Coccinelle moves forward with
210work.
211
212DEBUG_FILE support is only supported when using coccinelle >= 1.2.
213
214.cocciconfig support
215--------------------
216
217Coccinelle supports reading .cocciconfig for default Coccinelle options that
218should be used every time spatch is spawned, the order of precedence for
219variables for .cocciconfig is as follows:
220
221- Your current user's home directory is processed first
222- Your directory from which spatch is called is processed next
223- The directory provided with the --dir option is processed last, if used
224
225Since coccicheck runs through make, it naturally runs from the kernel
226proper dir, as such the second rule above would be implied for picking up a
227.cocciconfig when using ``make coccicheck``.
228
229``make coccicheck`` also supports using M= targets.If you do not supply
230any M= target, it is assumed you want to target the entire kernel.
231The kernel coccicheck script has::
232
233    if [ "$KBUILD_EXTMOD" = "" ] ; then
234        OPTIONS="--dir $srctree $COCCIINCLUDE"
235    else
236        OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE"
237    fi
238
239KBUILD_EXTMOD is set when an explicit target with M= is used. For both cases
240the spatch --dir argument is used, as such third rule applies when whether M=
241is used or not, and when M= is used the target directory can have its own
242.cocciconfig file. When M= is not passed as an argument to coccicheck the
243target directory is the same as the directory from where spatch was called.
244
245If not using the kernel's coccicheck target, keep the above precedence
246order logic of .cocciconfig reading. If using the kernel's coccicheck target,
247override any of the kernel's .coccicheck's settings using SPFLAGS.
248
249We help Coccinelle when used against Linux with a set of sensible defaults
250options for Linux with our own Linux .cocciconfig. This hints to coccinelle
251git can be used for ``git grep`` queries over coccigrep. A timeout of 200
252seconds should suffice for now.
253
254The options picked up by coccinelle when reading a .cocciconfig do not appear
255as arguments to spatch processes running on your system, to confirm what
256options will be used by Coccinelle run::
257
258      spatch --print-options-only
259
260You can override with your own preferred index option by using SPFLAGS. Take
261note that when there are conflicting options Coccinelle takes precedence for
262the last options passed. Using .cocciconfig is possible to use idutils, however
263given the order of precedence followed by Coccinelle, since the kernel now
264carries its own .cocciconfig, you will need to use SPFLAGS to use idutils if
265desired. See below section "Additional flags" for more details on how to use
266idutils.
267
268Additional flags
269----------------
270
271Additional flags can be passed to spatch through the SPFLAGS
272variable. This works as Coccinelle respects the last flags
273given to it when options are in conflict. ::
274
275    make SPFLAGS=--use-glimpse coccicheck
276
277Coccinelle supports idutils as well but requires coccinelle >= 1.0.6.
278When no ID file is specified coccinelle assumes your ID database file
279is in the file .id-utils.index on the top level of the kernel, coccinelle
280carries a script scripts/idutils_index.sh which creates the database with::
281
282    mkid -i C --output .id-utils.index
283
284If you have another database filename you can also just symlink with this
285name. ::
286
287    make SPFLAGS=--use-idutils coccicheck
288
289Alternatively you can specify the database filename explicitly, for
290instance::
291
292    make SPFLAGS="--use-idutils /full-path/to/ID" coccicheck
293
294See ``spatch --help`` to learn more about spatch options.
295
296Note that the ``--use-glimpse`` and ``--use-idutils`` options
297require external tools for indexing the code. None of them is
298thus active by default. However, by indexing the code with
299one of these tools, and according to the cocci file used,
300spatch could proceed the entire code base more quickly.
301
302SmPL patch specific options
303---------------------------
304
305SmPL patches can have their own requirements for options passed
306to Coccinelle. SmPL patch specific options can be provided by
307providing them at the top of the SmPL patch, for instance::
308
309	// Options: --no-includes --include-headers
310
311SmPL patch Coccinelle requirements
312----------------------------------
313
314As Coccinelle features get added some more advanced SmPL patches
315may require newer versions of Coccinelle. If an SmPL patch requires
316at least a version of Coccinelle, this can be specified as follows,
317as an example if requiring at least Coccinelle >= 1.0.5::
318
319	// Requires: 1.0.5
320
321Proposing new semantic patches
322-------------------------------
323
324New semantic patches can be proposed and submitted by kernel
325developers. For sake of clarity, they should be organized in the
326sub-directories of ``scripts/coccinelle/``.
327
328
329Detailed description of the ``report`` mode
330-------------------------------------------
331
332``report`` generates a list in the following format::
333
334  file:line:column-column: message
335
336Example
337~~~~~~~
338
339Running::
340
341	make coccicheck MODE=report COCCI=scripts/coccinelle/api/err_cast.cocci
342
343will execute the following part of the SmPL script::
344
345   <smpl>
346   @r depends on !context && !patch && (org || report)@
347   expression x;
348   position p;
349   @@
350
351     ERR_PTR@p(PTR_ERR(x))
352
353   @script:python depends on report@
354   p << r.p;
355   x << r.x;
356   @@
357
358   msg="ERR_CAST can be used with %s" % (x)
359   coccilib.report.print_report(p[0], msg)
360   </smpl>
361
362This SmPL excerpt generates entries on the standard output, as
363illustrated below::
364
365    /home/user/linux/crypto/ctr.c:188:9-16: ERR_CAST can be used with alg
366    /home/user/linux/crypto/authenc.c:619:9-16: ERR_CAST can be used with auth
367    /home/user/linux/crypto/xts.c:227:9-16: ERR_CAST can be used with alg
368
369
370Detailed description of the ``patch`` mode
371------------------------------------------
372
373When the ``patch`` mode is available, it proposes a fix for each problem
374identified.
375
376Example
377~~~~~~~
378
379Running::
380
381	make coccicheck MODE=patch COCCI=scripts/coccinelle/api/err_cast.cocci
382
383will execute the following part of the SmPL script::
384
385    <smpl>
386    @ depends on !context && patch && !org && !report @
387    expression x;
388    @@
389
390    - ERR_PTR(PTR_ERR(x))
391    + ERR_CAST(x)
392    </smpl>
393
394This SmPL excerpt generates patch hunks on the standard output, as
395illustrated below::
396
397    diff -u -p a/crypto/ctr.c b/crypto/ctr.c
398    --- a/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200
399    +++ b/crypto/ctr.c 2010-06-03 23:44:49.000000000 +0200
400    @@ -185,7 +185,7 @@ static struct crypto_instance *crypto_ct
401 	alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER,
402 				  CRYPTO_ALG_TYPE_MASK);
403 	if (IS_ERR(alg))
404    -		return ERR_PTR(PTR_ERR(alg));
405    +		return ERR_CAST(alg);
406
407 	/* Block size must be >= 4 bytes. */
408 	err = -EINVAL;
409
410Detailed description of the ``context`` mode
411--------------------------------------------
412
413``context`` highlights lines of interest and their context
414in a diff-like style.
415
416      **NOTE**: The diff-like output generated is NOT an applicable patch. The
417      intent of the ``context`` mode is to highlight the important lines
418      (annotated with minus, ``-``) and gives some surrounding context
419      lines around. This output can be used with the diff mode of
420      Emacs to review the code.
421
422Example
423~~~~~~~
424
425Running::
426
427	make coccicheck MODE=context COCCI=scripts/coccinelle/api/err_cast.cocci
428
429will execute the following part of the SmPL script::
430
431    <smpl>
432    @ depends on context && !patch && !org && !report@
433    expression x;
434    @@
435
436    * ERR_PTR(PTR_ERR(x))
437    </smpl>
438
439This SmPL excerpt generates diff hunks on the standard output, as
440illustrated below::
441
442    diff -u -p /home/user/linux/crypto/ctr.c /tmp/nothing
443    --- /home/user/linux/crypto/ctr.c	2010-05-26 10:49:38.000000000 +0200
444    +++ /tmp/nothing
445    @@ -185,7 +185,6 @@ static struct crypto_instance *crypto_ct
446 	alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER,
447 				  CRYPTO_ALG_TYPE_MASK);
448 	if (IS_ERR(alg))
449    -		return ERR_PTR(PTR_ERR(alg));
450
451 	/* Block size must be >= 4 bytes. */
452 	err = -EINVAL;
453
454Detailed description of the ``org`` mode
455----------------------------------------
456
457``org`` generates a report in the Org mode format of Emacs.
458
459Example
460~~~~~~~
461
462Running::
463
464	make coccicheck MODE=org COCCI=scripts/coccinelle/api/err_cast.cocci
465
466will execute the following part of the SmPL script::
467
468    <smpl>
469    @r depends on !context && !patch && (org || report)@
470    expression x;
471    position p;
472    @@
473
474      ERR_PTR@p(PTR_ERR(x))
475
476    @script:python depends on org@
477    p << r.p;
478    x << r.x;
479    @@
480
481    msg="ERR_CAST can be used with %s" % (x)
482    msg_safe=msg.replace("[","@(").replace("]",")")
483    coccilib.org.print_todo(p[0], msg_safe)
484    </smpl>
485
486This SmPL excerpt generates Org entries on the standard output, as
487illustrated below::
488
489    * TODO [[view:/home/user/linux/crypto/ctr.c::face=ovl-face1::linb=188::colb=9::cole=16][ERR_CAST can be used with alg]]
490    * TODO [[view:/home/user/linux/crypto/authenc.c::face=ovl-face1::linb=619::colb=9::cole=16][ERR_CAST can be used with auth]]
491    * TODO [[view:/home/user/linux/crypto/xts.c::face=ovl-face1::linb=227::colb=9::cole=16][ERR_CAST can be used with alg]]
492

README.commands

1Command definition
2------------------
3
4Commands are added to U-Boot by creating a new command structure.
5This is done by first including command.h, then using the U_BOOT_CMD() or the
6U_BOOT_CMD_COMPLETE macro to fill in a cmd_tbl_t struct.
7
8U_BOOT_CMD(name, maxargs, repeatable, command, "usage", "help")
9U_BOOT_CMD_COMPLETE(name, maxargs, repeatable, command, "usage, "help", comp)
10
11name:		The name of the command. THIS IS NOT a string.
12
13maxargs:	The maximum number of arguments this function takes including
14		the command itself.
15
16repeatable:	Either 0 or 1 to indicate if autorepeat is allowed.
17
18command:	Pointer to the command function. This is the function that is
19		called when the command is issued.
20
21usage:		Short description. This is a string.
22
23help:		Long description. This is a string. The long description is
24		only available if CONFIG_SYS_LONGHELP is defined.
25
26comp:		Pointer to the completion function. May be NULL.
27		This function is called if the user hits the TAB key while
28		entering the command arguments to complete the entry. Command
29		completion is only available if CONFIG_AUTO_COMPLETE is defined.
30
31Sub-command definition
32----------------------
33
34Likewise an array of cmd_tbl_t holding sub-commands can be created using either
35of the following macros:
36
37* U_BOOT_CMD_MKENT(name, maxargs, repeatable, command, "usage", "help")
38* U_BOOT_CMD_MKENTCOMPLETE(name, maxargs, repeatable, command, "usage, "help",
39  comp)
40
41This table has to be evaluated in the command function of the main command, e.g.
42
43    static cmd_tbl_t cmd_sub[] = {
44        U_BOOT_CMD_MKENT(foo, CONFIG_SYS_MAXARGS, 1, do_foo, "", ""),
45        U_BOOT_CMD_MKENT(bar, CONFIG_SYS_MAXARGS, 1, do_bar, "", ""),
46    };
47
48    static int do_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
49    {
50        cmd_tbl_t *cp;
51
52        if (argc < 2)
53                return CMD_RET_USAGE;
54
55        /* drop sub-command argument */
56        argc--;
57        argv++;
58
59        cp = find_cmd_tbl(argv[0], cmd_ut_sub, ARRAY_SIZE(cmd_sub));
60
61        if (cp)
62            return cp->cmd(cmdtp, flag, argc, argv);
63
64        return CMD_RET_USAGE;
65    }
66
67Command function
68----------------
69
70The command function pointer has to be of type
71int (*cmd)(struct cmd_tbl_s *cmdtp, int flag, int argc, const char *argv[]);
72
73cmdtp:		Table entry describing the command (see above).
74
75flag:		A bitmap which may contain the following bit:
76		CMD_FLAG_REPEAT - The last command is repeated.
77		CMD_FLAG_BOOTD  - The command is called by the bootd command.
78		CMD_FLAG_ENV    - The command is called by the run command.
79
80argc:		Number of arguments including the command.
81
82argv:		Arguments.
83
84Allowable return value are:
85
86CMD_SUCCESS	The command was successfully executed.
87
88CMD_FAILURE	The command failed.
89
90CMD_RET_USAGE	The command was called with invalid parameters. This value
91		leads to the display of the usage string.
92
93Completion function
94-------------------
95
96The completion function pointer has to be of type
97int (*complete)(int argc, char *const argv[], char last_char,
98		int maxv, char *cmdv[]);
99
100argc:		Number of arguments including the command.
101
102argv:		Arguments.
103
104last_char:	The last character in the command line buffer.
105
106maxv:		Maximum number of possible completions that may be returned by
107		the function.
108
109cmdv:		Used to return possible values for the last argument. The last
110		possible completion must be followed by NULL.
111
112The function returns the number of possible completions (without the terminating
113NULL value).
114
115Behind the scene
116----------------
117
118The structure created is named with a special prefix and placed by
119the linker in a special section using the linker lists mechanism
120(see include/linker_lists.h)
121
122This makes it possible for the final link to extract all commands
123compiled into any object code and construct a static array so the
124command array can be iterated over using the linker lists macros.
125
126The linker lists feature ensures that the linker does not discard
127these symbols when linking full U-Boot even though they are not
128referenced in the source code as such.
129
130If a new board is defined do not forget to define the command section
131by writing in u-boot.lds ($(srctree)/board/boardname/u-boot.lds) these
1323 lines:
133
134	.u_boot_list : {
135		KEEP(*(SORT(.u_boot_list*)));
136	}
137

README.commands.itest

1A slow day today so here is a revised itest command with provisional
2support for comparing strings as well :-))
3
4Now table driven to allow the operators
5-eq, -ne, -lt, -gt, -le, -ge, ==, !=, <>, <, >, <=, >=
6
7Uses the expected command modifier for integer compares of width 1, 2 or
84 bytes of .b, .w, .l and the new modifer of .s for a string compare.
9String comparison is over the length of the shorter, this hopefully
10avoids missing terminators when using an indirect pointer.
11
12eg.
13if itest.l *40000 == 12345678 then; ....
14if itest.w *40000 != 1234 then; ....
15if itest.b *40000 >= 12 then; ....
16if itest.s *40000 -eq hello then; ....
17

README.commands.spl

1The spl command is used to export a boot parameter image to RAM. Later
2it may implement more functions connected to the SPL.
3
4SUBCOMMAND EXPORT
5To execute the command everything has to be in place as if bootm should be
6used. (kernel image, initrd-image, fdt-image etc.)
7
8export has two subcommands:
9	atags: exports the ATAGS
10	fdt: exports the FDT
11
12Call is:
13spl export <fdt|atags> [kernel_addr] [initrd_addr] [fdt_addr if fdt]
14
15
16TYPICAL CALL
17
18on OMAP3:
19nandecc hw
20nand read 0x82000000 0x280000 0x400000 	/* Read kernel image from NAND*/
21spl export atags 			/* export ATAGS */
22nand erase 0x680000 0x20000		/* erase - one page */
23nand write 0x80000100 0x680000 0x20000	/* write the image - one page */
24
25call with FDT:
26nandecc hw
27nand read 0x82000000 0x280000 0x400000 	/* Read kernel image from NAND*/
28tftpboot 0x80000100 devkit8000.dtb /* Read fdt */
29spl export fdt 0x82000000 - 0x80000100	/* export FDT */
30nand erase 0x680000 0x20000		/* erase - one page */
31nand write <adress shown by spl export> 0x680000 0x20000
32

README.console

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2000
4 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
5 */
6
7U-Boot console handling
8========================
9
10HOW THE CONSOLE WORKS?
11----------------------
12
13At system startup U-Boot initializes a serial console. When U-Boot
14relocates itself to RAM, all console drivers are initialized (they
15will register all detected console devices to the system for further
16use).
17
18If not defined in the environment, the first input device is assigned
19to the 'stdin' file, the first output one to 'stdout' and 'stderr'.
20
21You can use the command "coninfo" to see all registered console
22devices and their flags. You can assign a standard file (stdin,
23stdout or stderr) to any device you see in that list simply by
24assigning its name to the corresponding environment variable. For
25example:
26
27    setenv stdin serial		<- To use the serial input
28    setenv stdout video		<- To use the video console
29
30Do a simple "saveenv" to save the console settings in the environment
31and get them working on the next startup, too.
32
33HOW CAN I USE STANDARD FILE INTO THE SOURCES?
34---------------------------------------------
35
36You can use the following functions to access the console:
37
38* STDOUT:
39    putc	(to put a char to stdout)
40    puts	(to put a string to stdout)
41    printf	(to format and put a string to stdout)
42
43* STDIN:
44    tstc	(to test for the presence of a char in stdin)
45    getc	(to get a char from stdin)
46
47* STDERR:
48    eputc	(to put a char to stderr)
49    eputs	(to put a string to stderr)
50    eprintf	(to format and put a string to stderr)
51
52* FILE (can be 'stdin', 'stdout', 'stderr'):
53    fputc	(like putc but redirected to a file)
54    fputs	(like puts but redirected to a file)
55    fprintf	(like printf but redirected to a file)
56    ftstc	(like tstc but redirected to a file)
57    fgetc	(like getc but redirected to a file)
58
59Remember that all FILE-related functions CANNOT be used before
60U-Boot relocation (done in 'board_init_r' in arch/*/lib/board.c).
61
62HOW CAN I USE STANDARD FILE INTO APPLICATIONS?
63----------------------------------------------
64
65Use the 'bd_mon_fnc' field of the bd_t structure passed to the
66application to do everything you want with the console.
67
68But REMEMBER that that will work only if you have not overwritten any
69U-Boot code while loading (or uncompressing) the image of your
70application.
71
72For example, you won't get the console stuff running in the Linux
73kernel because the kernel overwrites U-Boot before running. Only
74some parameters like the framebuffer descriptors are passed to the
75kernel in the high memory area to let the applications (the kernel)
76use the framebuffers initialized by U-Boot.
77
78SUPPORTED DRIVERS
79-----------------
80
81Working drivers:
82
83    serial	(architecture dependent serial stuff)
84    video	(mpc8xx video controller)
85
86Work in progress:
87
88    wl_kbd	(Wireless 4PPM keyboard)
89
90Waiting for volounteers:
91
92    lcd	(mpc8xx lcd controller; to )
93
94TESTED CONFIGURATIONS
95---------------------
96
97The driver has been tested with the following configurations (see
98CREDITS for other contact informations):
99
100- MPC823FADS with AD7176 on a PAL TV (YCbYCr)	- arsenio@tin.it
101

README.davinci

1Summary
2=======
3
4This README is about U-Boot support for TI's ARM 926EJS based family of SoCs.
5These SOCs are used for cameras, video security and surveillance, DVR's, etc.
6DaVinci SOC's comprise of DM644x, DM646x, DM35x and DM36x series of SOC's
7Additionally there are some SOCs meant for the audio market which though have
8an OMAP part number are very similar to the DaVinci series of SOC's
9Additionally, some family members contain a TI DSP and/or graphics
10co processors along with a host of other peripherals.
11
12Currently the following boards are supported:
13
14* TI DaVinci DM644x EVM
15
16* TI DaVinci DM646x EVM
17
18* TI DaVinci DM355 EVM
19
20* TI DaVinci DM365 EVM
21
22* TI DA830 EVM
23
24* TI DA850 EVM
25
26* DM355 based Leopard board
27
28* DM644x based schmoogie board
29
30* DM644x based sffsdr board
31
32* DM644x based sonata board
33
34Build
35=====
36
37* TI DaVinci DM644x EVM:
38
39make davinci_dvevm_config
40make
41
42* TI DaVinci DM646x EVM:
43
44make davinci_dm6467evm_config
45make
46
47* TI DaVinci DM355 EVM:
48
49make davinci_dm355evm_config
50make
51
52* TI DaVinci DM365 EVM:
53
54make davinci_dm365evm_config
55make
56
57* TI DA830 EVM:
58
59make da830evm_config
60make
61
62* TI DA850 EVM:
63
64make da850evm_config
65make
66
67* DM355 based Leopard board:
68
69make davinci_dm355leopard_config
70make
71
72* DM644x based schmoogie board:
73
74make davinci_schmoogie_config
75make
76
77* DM644x based sffsdr board:
78
79make davinci_sffsdr_config
80make
81
82* DM644x based sonata board:
83
84make davinci_sonata_config
85make
86
87Bootloaders
88===============
89
90The DaVinci SOC's use 2 bootloaders. The low level initialization
91is done by a UBL(user boot loader). The UBL is written to a NAND/NOR/SPI flash
92by a programmer. During initial bootup, the ROM Bootloader reads the UBL
93from a storage device and loads it into the IRAM. The UBL then loads the U-Boot
94into the RAM.
95The programmers and UBL are always released as part of any standard TI
96software release associated with an SOC.
97
98Alternative boot method (DA850 EVM only):
99For the DA850 EVM an SPL (secondary program loader, see doc/README.SPL)
100is provided to load U-Boot directly from SPI flash. In this case, the
101SPL does the low level initialization that is otherwise done by the SPL.
102To build U-Boot with this SPL, do
103make da850evm_config
104make u-boot.ais
105and program the resulting u-boot.ais file to the SPI flash of the DA850 EVM.
106
107Environment Variables
108=====================
109
110The DA850 EVM allows the user to specify the maximum cpu clock allowed by the
111silicon, in Hz, via an environment variable "maxcpuclk".
112
113The maximum clock rate allowed depends on the silicon populated on the EVM.
114Please make sure you understand the restrictions placed on this clock in the
115device specific datasheet before setting up this variable. This information is
116passed to the Linux kernel using the ATAG_REVISION atag.
117
118If "maxcpuclk" is not defined, the configuration CONFIG_DA850_EVM_MAX_CPU_CLK
119is used to obtain this information.
120
121Links
122=====
123
1241) TI DaVinci DM355 EVM:
125http://focus.ti.com/docs/prod/folders/print/tms320dm355.html
126http://www.spectrumdigital.com/product_info.php?cPath=103&products_id=203&osCsid=c499af6087317f11b3da19b4e8f1af32
127
1282) TI DaVinci DM365 EVM:
129http://focus.ti.com/docs/prod/folders/print/tms320dm365.html?247SEM=
130http://support.spectrumdigital.com/boards/evmdm365/revc/
131
1323) DaVinci DM355 based leopard board
133http://designsomething.org/leopardboard/default.aspx
134http://www.spectrumdigital.com/product_info.php?cPath=103&products_id=192&osCsid=67c20335668ffc57cb35727106eb24b1
135
1364) TI DaVinci DM6467 EVM:
137http://focus.ti.com/docs/prod/folders/print/tms320dm6467.html
138http://support.spectrumdigital.com/boards/evmdm6467/revf/
139
1405) TI DaVinci DM6446 EVM:
141http://focus.ti.com/docs/prod/folders/print/tms320dm6446.html
142http://www.spectrumdigital.com/product_info.php?cPath=103&products_id=222
143
1446) TI DA830 EVM
145http://focus.ti.com/apps/docs/gencontent.tsp?appId=1&contentId=52385
146http://www.spectrumdigital.com/product_info.php?cPath=37&products_id=214
147
1487) TI DA850 EVM
149http://focus.ti.com/docs/prod/folders/print/omap-l138.html
150http://www.logicpd.com/products/development-kits/zoom-omap-l138-evm-development-kit
151
152Davinci special defines
153=======================
154
155CONFIG_SYS_DV_NOR_BOOT_CFG:	AM18xx based boards, booting in NOR Boot mode
156				need a "NOR Boot Configuration Word" stored
157				in the NOR Flash. This define adds this.
158				More Info about this, see:
159				spraba5a.pdf chapter 3.1
160

README.davinci.nand_spl

1With this approach, we don't need the UBL any more on DaVinci boards.
2A "make boardname" will compile a u-boot.ubl, with UBL Header, which is
3needed for the RBL to find the "UBL", which actually is a  UBL-compatible
4header, nand spl code and u-boot code.
5
6
7As the RBL uses another read function as the "standard" u-boot,
8we need a command, which switches between this two read/write
9functions, so we can write the UBL header and the spl
10code in a format, which the RBL can read. This is realize
11(at the moment in board specific code) in the u-boot command
12nandrbl
13
14nandrbl without arguments returns actual mode (rbl or uboot).
15with nandrbl mode (mode = "rbl" or "uboot") you can switch
16between the two NAND read/write modes.
17
18
19To set up mkimage you need a config file for mkimage, example:
20board/ait/cam_enc_4xx/ublimage.cfg
21
22For information about the configuration please see:
23doc/README.ublimage
24
25Example for the cam_enc_4xx board:
26On the cam_enc_4xx board we have a NAND flash with blocksize = 0x20000 and
27pagesize = 0x800, so the u-boot.ubl image (which you get with:
28"make cam_enc_4xx") looks like this:
29
3000000000  00 ed ac a1 20 00 00 00  06 00 00 00 05 00 00 00  |.... ...........|
3100000010  00 00 00 00 20 00 00 00  ff ff ff ff ff ff ff ff  |.... ...........|
3200000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
33*
3400000800  14 00 00 ea 14 f0 9f e5  10 f0 9f e5 0c f0 9f e5  |................|
3500000810  08 f0 9f e5 04 f0 9f e5  00 f0 9f e5 04 f0 1f e5  |................|
3600000820  00 01 00 00 78 56 34 12  78 56 34 12 78 56 34 12  |....xV4.xV4.xV4.|
37[...]
38*
3900001fe0  00 00 00 00 00 00 00 00  ff ff ff ff ff ff ff ff  |................|
4000001ff0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
41*
4200003800  14 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |................|
4300003810  14 f0 9f e5 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |................|
4400003820  80 01 08 81 e0 01 08 81  40 02 08 81 a0 02 08 81  |........@.......|
45
46In the first "page" of the image, we have the UBL Header, needed for
47the RBL to find the spl code.
48
49The spl code starts in the second "page" of the image, with a size
50defined by:
51
52#define CONFIG_SYS_NROF_PAGES_NAND_SPL	6
53
54After the spl code, there comes the "real" u-boot code
55@ (6 + 1) * pagesize = 0x3800
56
57------------------------------------------------------------------------
58Setting up spl code:
59
60/*
61 * RBL searches from Block n (n = 1..24)
62 * so we can define, how many UBL Headers
63 * we write before the real spl code
64 */
65#define CONFIG_SYS_NROF_UBL_HEADER	5
66#define CONFIG_SYS_NROF_PAGES_NAND_SPL	6
67
68#define CONFIG_SYS_NAND_U_BOOT_OFFS	((CONFIG_SYS_NROF_UBL_HEADER * \
69					CONFIG_SYS_NAND_BLOCK_SIZE) + \
70					(CONFIG_SYS_NROF_PAGES_NAND_SPL) * \
71					CONFIG_SYS_NAND_PAGE_SIZE)
72------------------------------------------------------------------------
73
74Burning into NAND:
75
76step 1:
77The RBL searches from Block n ( n = 1..24) on page 0 for valid UBL
78Headers, so you have to burn the UBL header page from the u-boot.ubl
79image to the blocks, you want to have the UBL header.
80!! Don;t forget to switch to rbl nand read/write functions with
81   "nandrbl rbl"
82
83step 2:
84You need to setup in the ublimage.cfg, where the RBL can find the spl
85code, and how big it is.
86
87!! RBL always starts reading from page 0 !!
88
89For the AIT board, we have:
90PAGES		6
91START_BLOCK	5
92
93So we need to copy the spl code to block 5 page 0
94!! Don;t forget to switch to rbl nand read/write functions with
95   "nandrbl rbl"
96
97step 3:
98You need to copy the u-boot image to the block/page
99where the spl code reads it (CONFIG_SYS_NAND_U_BOOT_OFFS)
100!! Don;t forget to switch to rbl nand read/write functions with
101   "nandrbl uboot", which is default.
102
103On the cam_enc_4xx board it is:
104#define CONFIG_SYS_NAND_U_BOOT_OFFS	(0xc0000)
105
106-> this results in following NAND usage on the cam_enc_4xx board:
107
108addr
109
11020000		possible UBL Header
11140000		possible UBL Header
11260000		possible UBL Header
11380000		possilbe UBL Header
114a0000		spl code
115c0000		u-boot code
116
117The above steps are executeed through the following environment vars:
118(using 80000 as address for the UBL header)
119
120pagesz=800
121uboot=/tftpboot/cam_enc_4xx/u-boot.ubl
122load=tftp 80000000 ${uboot}
123writeheader nandrbl rbl;nand erase 80000 ${pagesz};nand write 80000000 80000 ${pagesz};nandrbl uboot
124writenand_spl nandrbl rbl;nand erase a0000 3000;nand write 80000800 a0000 3000;nandrbl uboot
125writeuboot nandrbl uboot;nand erase c0000 5d000;nand write 80003800 c0000 5d000
126update=run load writeheader writenand_spl writeuboot
127
128If you do a "run load update" u-boot, spl + ubl header
129are magically updated ;-)
130
131Note:
132- There seem to be a bug in the RBL code (at least on my HW),
133  In the UBL block, I can set the page to values != 0, so it
134  is possible to burn step 1 and step 2 in one step into the
135  flash, but the RBL ignores the page settings, so I have to
136  burn the UBL Header to a page 0 and the spl code to
137  a page 0 ... :-(
138- If we make the nand read/write functions in the RBL equal to
139  the functions in u-boot (as I have no RBL code, it is only
140  possible in u-boot), we could burn the complete image in
141  one step ... that would be nice ...
142

README.dfutftp

1# SPDX-License-Identifier: GPL-2.0+
2#
3#  Copyright (C) 2015
4#
5#  Lukasz Majewski <l.majewski@majess.pl>
6
7Device Firmware Upgrade (DFU) - extension to use TFTP
8=====================================================
9
10Why?
11----
12
13* Update TFTP (CONFIG_UPDATE_TFTP) only supports writing
14code to NAND memory via TFTP.
15* DFU supports writing data to the variety of mediums (NAND,
16eMMC, SD, partitions, RAM, etc) via USB.
17
18Combination of both solves their shortcomings!
19
20
21Overview
22--------
23
24This document briefly describes how to use DFU for
25upgrading firmware (e.g. kernel, u-boot, rootfs, etc.)
26via TFTP protocol.
27
28By using Ethernet (TFTP protocol to be precise) it is
29possible to overcome the major problem of USB based DFU -
30the relatively low transfer speed for large files.
31This was caused by DFU standard, which imposed utilization
32of only EP0 for transfer. By using Ethernet we can circumvent
33this shortcoming.
34
35Beagle Bone Black rev. C (BBB) powered by TI's am335x CPU has
36been used as a demo board.
37
38To utilize this feature, one needs to first enable support
39for USB based DFU (CONFIG_DFU_*) and DFU TFTP update
40(CONFIG_DFU_TFTP) described in ./doc/README.update.
41
42The "dfu" command has been extended to support transfer via TFTP - one
43needs to type for example "dfu tftp 0 mmc 0"
44
45This feature does not depend on "fitupd" command enabled.
46
47As of this writing (SHA1:8d77576371381ade83de475bb639949b44941e8c v2015.10-rc2)
48the update.c code is not enabled (CONFIG_UPDATE_TFTP) by any board in the
49contemporary u-boot tree.
50
51
52Environment variables
53---------------------
54
55The "dfu tftp" command can be used in the "preboot" environment variable
56(when it is enabled by defining CONFIG_PREBOOT).
57This is the preferable way of using this command in the early boot stage
58as opposed to legacy update_tftp() function invocation.
59
60
61Beagle Bone Black (BBB) setup
62-----------------------------
63
641. Setup tftp env variables:
65   *  select desired eth device - 'ethact' variable ["ethact=cpsw"]
66      (use "bdinfo" to check current setting)
67   *  setup "serverip" and "ipaddr" variables
68   *  set "loadaddr" as a fixed buffer where incoming data is placed
69      ["loadaddr=0x81000000"]
70
71#########
72# BONUS #
73#########
74It is possible to use USB interface to emulate ETH connection by setting
75"ethact=usb_ether". In this way one can have very fast DFU transfer via USB.
76
77For 33MiB test image the transfer rate was 1MiB/s for ETH over USB and 200KiB/s
78for pure DFU USB transfer.
79
802. Setup update_tftp variables:
81   *  set "updatefile" - the file name to be downloaded via TFTP (stored on
82      the HOST at e.g. /srv/tftp)
83
843. If required, to update firmware on boot, put the "dfu tftp 0 mmc 0" in the
85    "preboot" env variable. Otherwise use this command from u-boot prompt.
86
874. Inspect "dfu" specific variables:
88   * "dfu_alt_info" - information about available DFU entities
89   * "dfu_bufsiz"   - variable to set buffer size [in bytes] - when it is not
90		    possible to set large enough default buffer (8 MiB @ BBB)
91
92
93
94FIT image format for download
95-----------------------------
96
97To create FIT image for download one should follow the update tftp README file
98(./doc/README.update) with one notable difference:
99
100The original snippet of ./doc/uImage.FIT/update_uboot.its
101
102	images {
103		update@1 {
104			description = "U-Boot binary";
105
106should look like
107
108	images {
109		u-boot.bin@1 {
110			description = "U-Boot binary";
111
112where "u-boot.bin" is the DFU entity name to be stored.
113
114
115
116To do
117-----
118
119* Extend dfu-util command to support TFTP based transfers
120* Upload support (via TFTP)
121

README.displaying-bmps

1If you are experiencing hangups/data-aborts when trying to display a BMP image,
2the following might be relevant to your situation...
3
4Some architectures cannot handle unaligned memory accesses, and an attempt to
5perform one will lead to a data abort. On such architectures it is necessary to
6make sure all data is properly aligned, and in many situations simply choosing
7a 32 bit aligned address is enough to ensure proper alignment. This is not
8always the case when dealing with data that has an internal layout such as a
9BMP image:
10
11BMP images have a header that starts with 2 byte-size fields followed by mostly
1232 bit fields. The packed struct that represents this header can be seen below:
13
14typedef struct bmp_header {
15	/* Header */
16	char signature[2];
17	__u32	file_size;
18	__u32	reserved;
19	__u32	data_offset;
20	... etc
21} __attribute__ ((packed)) bmp_header_t;
22
23When placed in an aligned address such as 0x80a00000, char signature offsets
24the __u32 fields into unaligned addresses (in our example 0x80a00002,
250x80a00006, and so on...). When these fields are accessed by U-Boot, a 32 bit
26access is generated at a non-32-bit-aligned address, causing a data abort.
27The proper alignment for BMP images is therefore: 32-bit-aligned-address + 2.
28

README.distro

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2014 Red Hat Inc.
4 * Copyright (c) 2014-2015, NVIDIA CORPORATION.  All rights reserved.
5 * Copyright (C) 2015 K. Merker <merker@debian.org>
6 */
7
8Generic Distro Configuration Concept
9====================================
10
11Linux distributions are faced with supporting a variety of boot mechanisms,
12environments or bootloaders (PC BIOS, EFI, U-Boot, Barebox, ...). This makes
13life complicated. Worse, bootloaders such as U-Boot have a configurable set
14of features, and each board chooses to enable a different set of features.
15Hence, distros typically need to have board-specific knowledge in order to
16set up a bootable system.
17
18This document defines a common set of U-Boot features that are required for
19a distro to support the board in a generic fashion. Any board wishing to
20allow distros to install and boot in an out-of-the-box fashion should enable
21all these features. Linux distros can then create a single set of boot
22support/install logic that targets these features. This will allow distros
23to install on many boards without the need for board-specific logic.
24
25In fact, some of these features can be implemented by any bootloader, thus
26decoupling distro install/boot logic from any knowledge of the bootloader.
27
28This model assumes that boards will load boot configuration files from a
29regular storage mechanism (eMMC, SD card, USB Disk, SATA disk, etc.) with
30a standard partitioning scheme (MBR, GPT). Boards that cannot support this
31storage model are outside the scope of this document, and may still need
32board-specific installer/boot-configuration support in a distro.
33
34To some extent, this model assumes that a board has a separate boot flash
35that contains U-Boot, and that the user has somehow installed U-Boot to this
36flash before running the distro installer. Even on boards that do not conform
37to this aspect of the model, the extent of the board-specific support in the
38distro installer logic would be to install a board-specific U-Boot package to
39the boot partition during installation. This distro-supplied U-Boot can still
40implement the same features as on any other board, and hence the distro's boot
41configuration file generation logic can still be board-agnostic.
42
43Locating Bootable Disks
44-----------------------
45
46Typical desktop/server PCs search all (or a user-defined subset of) attached
47storage devices for a bootable partition, then load the bootloader or boot
48configuration files from there. A U-Boot board port that enables the features
49mentioned in this document will search for boot configuration files in the
50same way.
51
52Thus, distros do not need to manipulate any kind of bootloader-specific
53configuration data to indicate which storage device the system should boot
54from.
55
56Distros simply need to install the boot configuration files (see next
57section) in an ext2/3/4 or FAT partition, mark the partition bootable (via
58the MBR bootable flag, or GPT legacy_bios_bootable attribute), and U-Boot (or
59any other bootloader) will find those boot files and execute them. This is
60conceptually identical to creating a grub2 configuration file on a desktop
61PC.
62
63Note that in the absence of any partition that is explicitly marked bootable,
64U-Boot falls back to searching the first valid partition of a disk for boot
65configuration files. Other bootloaders are recommended to do the same, since
66I believe that partition table bootable flags aren't so commonly used outside
67the realm of x86 PCs.
68
69U-Boot can also search for boot configuration files from a TFTP server.
70
71Boot Configuration Files
72------------------------
73
74The standard format for boot configuration files is that of extlinux.conf, as
75handled by U-Boot's "syslinux" (disk) or "pxe boot" (network). This is roughly
76as specified at:
77
78http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/
79
80... with the exceptions that the BootLoaderSpec document:
81
82* Prescribes a separate configuration per boot menu option, whereas U-Boot
83  lumps all options into a single extlinux.conf file. Hence, U-Boot searches
84  for /extlinux/extlinux.conf then /boot/extlinux/extlinux.conf on disk, or
85  pxelinux.cfg/default over the network.
86
87* Does not document the fdtdir option, which automatically selects the DTB to
88  pass to the kernel.
89
90One example extlinux.conf generated by the Fedora installer is:
91
92------------------------------------------------------------
93# extlinux.conf generated by anaconda
94
95ui menu.c32
96
97menu autoboot Welcome to Fedora. Automatic boot in # second{,s}. Press a key for options.
98menu title Fedora Boot Options.
99menu hidden
100
101timeout 50
102#totaltimeout 9000
103
104default Fedora (3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae) 22 (Rawhide)
105
106label Fedora (3.17.0-0.rc4.git2.1.fc22.armv7hl) 22 (Rawhide)
107	kernel /boot/vmlinuz-3.17.0-0.rc4.git2.1.fc22.armv7hl
108	append ro root=UUID=8eac677f-8ea8-4270-8479-d5ddbb797450 console=ttyS0,115200n8 LANG=en_US.UTF-8 drm.debug=0xf
109	fdtdir /boot/dtb-3.17.0-0.rc4.git2.1.fc22.armv7hl
110	initrd /boot/initramfs-3.17.0-0.rc4.git2.1.fc22.armv7hl.img
111
112label Fedora (3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae) 22 (Rawhide)
113	kernel /boot/vmlinuz-3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae
114	append ro root=UUID=8eac677f-8ea8-4270-8479-d5ddbb797450 console=ttyS0,115200n8 LANG=en_US.UTF-8 drm.debug=0xf
115	fdtdir /boot/dtb-3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae
116	initrd /boot/initramfs-3.17.0-0.rc4.git2.1.fc22.armv7hl+lpae.img
117
118label Fedora-0-rescue-8f6ba7b039524e0eb957d2c9203f04bc (0-rescue-8f6ba7b039524e0eb957d2c9203f04bc)
119	kernel /boot/vmlinuz-0-rescue-8f6ba7b039524e0eb957d2c9203f04bc
120	initrd /boot/initramfs-0-rescue-8f6ba7b039524e0eb957d2c9203f04bc.img
121	append ro root=UUID=8eac677f-8ea8-4270-8479-d5ddbb797450 console=ttyS0,115200n8
122	fdtdir /boot/dtb-3.16.0-0.rc6.git1.1.fc22.armv7hl+lpae
123------------------------------------------------------------
124
125Another hand-crafted network boot configuration file is:
126
127------------------------------------------------------------
128TIMEOUT 100
129
130MENU TITLE TFTP boot options
131
132LABEL jetson-tk1-emmc
133        MENU LABEL ../zImage root on Jetson TK1 eMMC
134        LINUX ../zImage
135        FDTDIR ../
136        APPEND console=ttyS0,115200n8 console=tty1 loglevel=8 rootwait rw earlyprintk root=PARTUUID=80a5a8e9-c744-491a-93c1-4f4194fd690b
137
138LABEL venice2-emmc
139        MENU LABEL ../zImage root on Venice2 eMMC
140        LINUX ../zImage
141        FDTDIR ../
142        APPEND console=ttyS0,115200n8 console=tty1 loglevel=8 rootwait rw earlyprintk root=PARTUUID=5f71e06f-be08-48ed-b1ef-ee4800cc860f
143
144LABEL sdcard
145        MENU LABEL ../zImage, root on 2GB sdcard
146        LINUX ../zImage
147        FDTDIR ../
148        APPEND console=ttyS0,115200n8 console=tty1 loglevel=8 rootwait rw earlyprintk root=PARTUUID=b2f82cda-2535-4779-b467-094a210fbae7
149
150LABEL fedora-installer-fk
151        MENU LABEL Fedora installer w/ Fedora kernel
152        LINUX fedora-installer/vmlinuz
153        INITRD fedora-installer/initrd.img.orig
154        FDTDIR fedora-installer/dtb
155        APPEND loglevel=8 ip=dhcp inst.repo=http://10.0.0.2/mirrors/fedora/linux/development/rawhide/armhfp/os/ rd.shell cma=64M
156------------------------------------------------------------
157
158U-Boot Implementation
159=====================
160
161Enabling the distro options
162---------------------------
163
164In your board's defconfig, enable the DISTRO_DEFAULTS option by adding
165a line with "CONFIG_DISTRO_DEFAULTS=y". If you want to enable this
166from Kconfig itself, for e.g. all boards using a specific SoC then
167add a "imply DISTRO_DEFAULTS" to your SoC CONFIG option.
168
169In your board configuration file, include the following:
170
171------------------------------------------------------------
172#ifndef CONFIG_SPL_BUILD
173#include <config_distro_bootcmd.h>
174#endif
175------------------------------------------------------------
176
177The first of those headers primarily enables a core set of U-Boot features,
178such as support for MBR and GPT partitions, ext* and FAT filesystems, booting
179raw zImage and initrd (rather than FIT- or uImage-wrapped files), etc. Network
180boot support is also enabled here, which is useful in order to boot distro
181installers given that distros do not commonly distribute bootable install
182media for non-PC targets at present.
183
184Finally, a few options that are mostly relevant only when using U-Boot-
185specific boot.scr scripts are enabled. This enables distros to generate a
186U-Boot-specific boot.scr script rather than extlinux.conf as the boot
187configuration file. While doing so is fully supported, and
188CONFIG_DISTRO_DEFAULTS exposes enough parameterization to boot.scr to
189allow for board-agnostic boot.scr content, this document recommends that
190distros generate extlinux.conf rather than boot.scr. extlinux.conf is intended
191to work across multiple bootloaders, whereas boot.scr will only work with
192U-Boot. TODO: document the contract between U-Boot and boot.scr re: which
193environment variables a generic boot.scr may rely upon.
194
195The second of those headers sets up the default environment so that $bootcmd
196is defined in a way that searches attached disks for boot configuration files,
197and executes them if found.
198
199Required Environment Variables
200------------------------------
201
202The U-Boot "syslinux" and "pxe boot" commands require a number of environment
203variables be set. Default values for these variables are often hard-coded into
204CONFIG_EXTRA_ENV_SETTINGS in the board's U-Boot configuration file, so that
205the user doesn't have to configure them.
206
207fdt_addr:
208
209  Mandatory for any system that provides the DTB in HW (e.g. ROM) and wishes
210  to pass that DTB to Linux, rather than loading a DTB from the boot
211  filesystem. Prohibited for any other system.
212
213  If specified a DTB to boot the system must be available at the given
214  address.
215
216fdt_addr_r:
217
218  Mandatory. The location in RAM where the DTB will be loaded or copied to when
219  processing the fdtdir/devicetreedir or fdt/devicetree options in
220  extlinux.conf.
221
222  This is mandatory even when fdt_addr is provided, since extlinux.conf must
223  always be able to provide a DTB which overrides any copy provided by the HW.
224
225  A size of 1MB for the FDT/DTB seems reasonable.
226
227ramdisk_addr_r:
228
229  Mandatory. The location in RAM where the initial ramdisk will be loaded to
230  when processing the initrd option in extlinux.conf.
231
232  It is recommended that this location be highest in RAM out of fdt_addr_,
233  kernel_addr_r, and ramdisk_addr_r, so that the RAM disk can vary in size
234  and use any available RAM.
235
236kernel_addr_r:
237
238  Mandatory. The location in RAM where the kernel will be loaded to when
239  processing the kernel option in the extlinux.conf.
240
241  The kernel should be located within the first 128M of RAM in order for the
242  kernel CONFIG_AUTO_ZRELADDR option to work, which is likely enabled on any
243  distro kernel. Since the kernel will decompress itself to 0x8000 after the
244  start of RAM, kernel_addr_r should not overlap that area, or the kernel will
245  have to copy itself somewhere else first before decompression.
246
247  A size of 16MB for the kernel is likely adequate.
248
249pxefile_addr_r:
250
251  Mandatory. The location in RAM where extlinux.conf will be loaded to prior
252  to processing.
253
254  A size of 1MB for extlinux.conf is more than adequate.
255
256scriptaddr:
257
258  Mandatory, if the boot script is boot.scr rather than extlinux.conf. The
259  location in RAM where boot.scr will be loaded to prior to execution.
260
261  A size of 1MB for extlinux.conf is more than adequate.
262
263For suggestions on memory locations for ARM systems, you must follow the
264guidelines specified in Documentation/arm/Booting in the Linux kernel tree.
265
266For a commented example of setting these values, please see the definition of
267MEM_LAYOUT_ENV_SETTINGS in include/configs/tegra124-common.h.
268
269Boot Target Configuration
270-------------------------
271
272<config_distro_bootcmd.h> defines $bootcmd and many helper command variables
273that automatically search attached disks for boot configuration files and
274execute them. Boards must provide configure <config_distro_bootcmd.h> so that
275it supports the correct set of possible boot device types. To provide this
276configuration, simply define macro BOOT_TARGET_DEVICES prior to including
277<config_distro_bootcmd.h>. For example:
278
279------------------------------------------------------------
280#ifndef CONFIG_SPL_BUILD
281#define BOOT_TARGET_DEVICES(func) \
282        func(MMC, mmc, 1) \
283        func(MMC, mmc, 0) \
284        func(USB, usb, 0) \
285        func(PXE, pxe, na) \
286        func(DHCP, dhcp, na)
287#include <config_distro_bootcmd.h>
288#endif
289------------------------------------------------------------
290
291Each entry in the macro defines a single boot device (e.g. a specific eMMC
292device or SD card) or type of boot device (e.g. USB disk). The parameters to
293the func macro (passed in by the internal implementation of the header) are:
294
295- Upper-case disk type (MMC, SATA, SCSI, IDE, USB, DHCP, PXE, VIRTIO).
296- Lower-case disk type (same options as above).
297- ID of the specific disk (MMC only) or ignored for other types.
298
299User Configuration
300==================
301
302Once the user has installed U-Boot, it is expected that the environment will
303be reset to the default values in order to enable $bootcmd and friends, as set
304up by <config_distro_bootcmd.h>. After this, various environment variables may
305be altered to influence the boot process:
306
307boot_targets:
308
309  The list of boot locations searched.
310
311  Example: mmc0, mmc1, usb, pxe
312
313  Entries may be removed or re-ordered in this list to affect the boot order.
314
315boot_prefixes:
316
317  For disk-based booting, the list of directories within a partition that are
318  searched for boot configuration files (extlinux.conf, boot.scr).
319
320  Example: / /boot/
321
322  Entries may be removed or re-ordered in this list to affect the set of
323  directories which are searched.
324
325boot_scripts:
326
327  The name of U-Boot style boot.scr files that $bootcmd searches for.
328
329  Example: boot.scr.uimg boot.scr
330
331  (Typically we expect extlinux.conf to be used, but execution of boot.scr is
332  maintained for backwards-compatibility.)
333
334  Entries may be removed or re-ordered in this list to affect the set of
335  filenames which are supported.
336
337scan_dev_for_extlinux:
338
339  If you want to disable extlinux.conf on all disks, set the value to something
340  innocuous, e.g. setenv scan_dev_for_extlinux true.
341
342scan_dev_for_scripts:
343
344  If you want to disable boot.scr on all disks, set the value to something
345  innocuous, e.g. setenv scan_dev_for_scripts true.
346
347boot_net_usb_start:
348
349  If you want to prevent USB enumeration by distro boot commands which execute
350  network operations, set the value to something innocuous, e.g. setenv
351  boot_net_usb_start true. This would be useful if you know your Ethernet
352  device is not attached to USB, and you wish to increase boot speed by
353  avoiding unnecessary actions.
354
355boot_net_pci_enum:
356
357  If you want to prevent PCI enumeration by distro boot commands which execute
358  network operations, set the value to something innocuous, e.g. setenv
359  boot_net_pci_enum true. This would be useful if you know your Ethernet
360  device is not attached to PCI, and you wish to increase boot speed by
361  avoiding unnecessary actions.
362
363Interactively booting from a specific device at the u-boot prompt
364=================================================================
365
366For interactively booting from a user-selected device at the u-boot command
367prompt, the environment provides predefined bootcmd_<target> variables for
368every target defined in boot_targets, which can be run be the user.
369
370If the target is a storage device, the format of the target is always
371<device type><device number>, e.g. mmc0.  Specifying the device number is
372mandatory for storage devices, even if only support for a single instance
373of the storage device is actually implemented.
374
375For network targets (dhcp, pxe), only the device type gets specified;
376they do not have a device number.
377
378Examples:
379
380 - run bootcmd_usb0
381   boots from the first USB mass storage device
382
383 - run bootcmd_mmc1
384   boots from the second MMC device
385
386 - run bootcmd_pxe
387   boots by tftp using a pxelinux.cfg
388
389The list of possible targets consists of:
390
391- network targets
392  * dhcp
393  * pxe
394
395- storage targets (to which a device number must be appended)
396  * mmc
397  * sata
398  * scsi
399  * ide
400  * usb
401  * virtio
402
403Other *boot* variables than the ones defined above are only for internal use
404of the boot environment and are not guaranteed to exist or work in the same
405way in future u-boot versions.  In particular the <device type>_boot
406variables (e.g. mmc_boot, usb_boot) are a strictly internal implementation
407detail and must not be used as a public interface.
408

README.dns

1Domain Name System
2-------------------------------------------
3
4The Domain Name System (DNS) is a hierarchical naming system for computers,
5services, or any resource participating in the Internet. It associates various
6information with domain names assigned to each of the participants. Most
7importantly, it translates domain names meaningful to humans into the numerical
8(binary) identifiers associated with networking equipment for the purpose of
9locating and addressing these devices world-wide. An often used analogy to
10explain the Domain Name System is that it serves as the "phone book" for the
11Internet by translating human-friendly computer hostnames into IP addresses.
12For example, www.example.com translates to 208.77.188.166.
13
14For more information on DNS - http://en.wikipedia.org/wiki/Domain_Name_System
15
16U-Boot and DNS
17------------------------------------------
18
19CONFIG_CMD_DNS - controls if the 'dns' command is compiled in. If it is, it
20		 will send name lookups to the dns server (env var 'dnsip')
21		 Turning this option on will about abou 1k to U-Boot's size.
22
23		 Example:
24
25bfin> print dnsip
26dnsip=192.168.0.1
27
28bfin> dns www.google.com
2966.102.1.104
30
31		 By default, dns does nothing except print the IP number on
32		 the default console - which by itself, would be pretty
33		 useless. Adding a third argument to the dns command will
34		 use that as the environment variable to be set.
35
36		 Example:
37
38bfin> print googleip
39## Error: "googleip" not defined
40bfin> dns www.google.com googleip
4164.233.161.104
42bfin> print googleip
43googleip=64.233.161.104
44bfin> ping ${googleip}
45Using Blackfin EMAC device
46host 64.233.161.104 is alive
47
48		 In this way, you can lookup, and set many more meaningful
49		 things.
50
51bfin> sntp
52ntpserverip not set
53bfin> dns pool.ntp.org ntpserverip
5472.18.205.156
55bfin> sntp
56Date: 2009-07-18 Time:	4:06:57
57
58		 For some helpful things that can be related to DNS in U-Boot,
59		 look at the top level README for these config options:
60		    CONFIG_CMD_DHCP
61		    CONFIG_BOOTP_DNS
62		    CONFIG_BOOTP_DNS2
63

README.drivers.eth

1!!! WARNING !!!
2
3This guide describes to the old way of doing things. No new Ethernet drivers
4should be implemented this way. All new drivers should be written against the
5U-Boot core driver model. See doc/driver-model/README.txt
6
7-----------------------
8 Ethernet Driver Guide
9-----------------------
10
11The networking stack in Das U-Boot is designed for multiple network devices
12to be easily added and controlled at runtime.  This guide is meant for people
13who wish to review the net driver stack with an eye towards implementing your
14own ethernet device driver.  Here we will describe a new pseudo 'APE' driver.
15
16------------------
17 Driver Functions
18------------------
19
20All functions you will be implementing in this document have the return value
21meaning of 0 for success and non-zero for failure.
22
23 ----------
24  Register
25 ----------
26
27When U-Boot initializes, it will call the common function eth_initialize().
28This will in turn call the board-specific board_eth_init() (or if that fails,
29the cpu-specific cpu_eth_init()).  These board-specific functions can do random
30system handling, but ultimately they will call the driver-specific register
31function which in turn takes care of initializing that particular instance.
32
33Keep in mind that you should code the driver to avoid storing state in global
34data as someone might want to hook up two of the same devices to one board.
35Any such information that is specific to an interface should be stored in a
36private, driver-defined data structure and pointed to by eth->priv (see below).
37
38So the call graph at this stage would look something like:
39board_init()
40	eth_initialize()
41		board_eth_init() / cpu_eth_init()
42			driver_register()
43				initialize eth_device
44				eth_register()
45
46At this point in time, the only thing you need to worry about is the driver's
47register function.  The pseudo code would look something like:
48int ape_register(bd_t *bis, int iobase)
49{
50	struct ape_priv *priv;
51	struct eth_device *dev;
52	struct mii_dev *bus;
53
54	priv = malloc(sizeof(*priv));
55	if (priv == NULL)
56		return -ENOMEM;
57
58	dev = malloc(sizeof(*dev));
59	if (dev == NULL) {
60		free(priv);
61		return -ENOMEM;
62	}
63
64	/* setup whatever private state you need */
65
66	memset(dev, 0, sizeof(*dev));
67	sprintf(dev->name, "APE");
68
69	/*
70	 * if your device has dedicated hardware storage for the
71	 * MAC, read it and initialize dev->enetaddr with it
72	 */
73	ape_mac_read(dev->enetaddr);
74
75	dev->iobase = iobase;
76	dev->priv = priv;
77	dev->init = ape_init;
78	dev->halt = ape_halt;
79	dev->send = ape_send;
80	dev->recv = ape_recv;
81	dev->write_hwaddr = ape_write_hwaddr;
82
83	eth_register(dev);
84
85#ifdef CONFIG_PHYLIB
86	bus = mdio_alloc();
87	if (!bus) {
88		free(priv);
89		free(dev);
90		return -ENOMEM;
91	}
92
93	bus->read = ape_mii_read;
94	bus->write = ape_mii_write;
95	mdio_register(bus);
96#endif
97
98	return 1;
99}
100
101The exact arguments needed to initialize your device are up to you.  If you
102need to pass more/less arguments, that's fine.  You should also add the
103prototype for your new register function to include/netdev.h.
104
105The return value for this function should be as follows:
106< 0 - failure (hardware failure, not probe failure)
107>=0 - number of interfaces detected
108
109You might notice that many drivers seem to use xxx_initialize() rather than
110xxx_register().  This is the old naming convention and should be avoided as it
111causes confusion with the driver-specific init function.
112
113Other than locating the MAC address in dedicated hardware storage, you should
114not touch the hardware in anyway.  That step is handled in the driver-specific
115init function.  Remember that we are only registering the device here, we are
116not checking its state or doing random probing.
117
118 -----------
119  Callbacks
120 -----------
121
122Now that we've registered with the ethernet layer, we can start getting some
123real work done.  You will need five functions:
124	int ape_init(struct eth_device *dev, bd_t *bis);
125	int ape_send(struct eth_device *dev, volatile void *packet, int length);
126	int ape_recv(struct eth_device *dev);
127	int ape_halt(struct eth_device *dev);
128	int ape_write_hwaddr(struct eth_device *dev);
129
130The init function checks the hardware (probing/identifying) and gets it ready
131for send/recv operations.  You often do things here such as resetting the MAC
132and/or PHY, and waiting for the link to autonegotiate.  You should also take
133the opportunity to program the device's MAC address with the dev->enetaddr
134member.  This allows the rest of U-Boot to dynamically change the MAC address
135and have the new settings be respected.
136
137The send function does what you think -- transmit the specified packet whose
138size is specified by length (in bytes).  You should not return until the
139transmission is complete, and you should leave the state such that the send
140function can be called multiple times in a row.
141
142The recv function should process packets as long as the hardware has them
143readily available before returning.  i.e. you should drain the hardware fifo.
144For each packet you receive, you should call the net_process_received_packet() function on it
145along with the packet length.  The common code sets up packet buffers for you
146already in the .bss (net_rx_packets), so there should be no need to allocate your
147own.  This doesn't mean you must use the net_rx_packets array however; you're
148free to call the net_process_received_packet() function with any buffer you wish.  So the pseudo
149code here would look something like:
150int ape_recv(struct eth_device *dev)
151{
152	int length, i = 0;
153	...
154	while (packets_are_available()) {
155		...
156		length = ape_get_packet(&net_rx_packets[i]);
157		...
158		net_process_received_packet(&net_rx_packets[i], length);
159		...
160		if (++i >= PKTBUFSRX)
161			i = 0;
162		...
163	}
164	...
165	return 0;
166}
167
168The halt function should turn off / disable the hardware and place it back in
169its reset state.  It can be called at any time (before any call to the related
170init function), so make sure it can handle this sort of thing.
171
172The write_hwaddr function should program the MAC address stored in dev->enetaddr
173into the Ethernet controller.
174
175So the call graph at this stage would look something like:
176some net operation (ping / tftp / whatever...)
177	eth_init()
178		dev->init()
179	eth_send()
180		dev->send()
181	eth_rx()
182		dev->recv()
183	eth_halt()
184		dev->halt()
185
186--------------------------------
187 CONFIG_PHYLIB / CONFIG_CMD_MII
188--------------------------------
189
190If your device supports banging arbitrary values on the MII bus (pretty much
191every device does), you should add support for the mii command.  Doing so is
192fairly trivial and makes debugging mii issues a lot easier at runtime.
193
194After you have called eth_register() in your driver's register function, add
195a call to mdio_alloc() and mdio_register() like so:
196	bus = mdio_alloc();
197	if (!bus) {
198		free(priv);
199		free(dev);
200		return -ENOMEM;
201	}
202
203	bus->read = ape_mii_read;
204	bus->write = ape_mii_write;
205	mdio_register(bus);
206
207And then define the mii_read and mii_write functions if you haven't already.
208Their syntax is straightforward:
209	int mii_read(struct mii_dev *bus, int addr, int devad, int reg);
210	int mii_write(struct mii_dev *bus, int addr, int devad, int reg,
211		      u16 val);
212
213The read function should read the register 'reg' from the phy at address 'addr'
214and return the result to its caller.  The implementation for the write function
215should logically follow.
216

README.enetaddr

1---------------------------------
2 Ethernet Address (MAC) Handling
3---------------------------------
4
5There are a variety of places in U-Boot where the MAC address is used, parsed,
6and stored.  This document covers proper usage of each location and the moving
7of data between them.
8
9-----------
10 Locations
11-----------
12
13Here are the places where MAC addresses might be stored:
14
15 - board-specific location (eeprom, dedicated flash, ...)
16	Note: only used when mandatory due to hardware design etc...
17
18 - environment ("ethaddr", "eth1addr", ...)
19	Note: this is the preferred way to permanently store MAC addresses
20
21 - ethernet data (struct eth_device -> enetaddr)
22	Note: these are temporary copies of the MAC address which exist only
23	      after the respective init steps have run and only to make usage
24	      in other places easier (to avoid constant env lookup/parsing)
25
26 - struct bd_info and/or device tree
27	Note: these are temporary copies of the MAC address only for the
28	      purpose of passing this information to an OS kernel we are about
29	      to boot
30
31Correct flow of setting up the MAC address (summarized):
32
331. Read from hardware in initialize() function
342. Read from environment in net/eth.c after initialize()
353. The environment variable will be compared to the driver initialized
36   struct eth_device->enetaddr. If they differ, a warning is printed, and the
37   environment variable will be used unchanged.
38   If the environment variable is not set, it will be initialized from
39   eth_device->enetaddr, and a warning will be printed.
40   If both are invalid and CONFIG_NET_RANDOM_ETHADDR is defined, a random,
41   locally-assigned MAC is written to eth_device->enetaddr.
424. Program the address into hardware if the following conditions are met:
43	a) The relevant driver has a 'write_addr' function
44	b) The user hasn't set an 'ethmacskip' environment variable
45	c) The address is valid (unicast, not all-zeros)
46
47Previous behavior had the MAC address always being programmed into hardware
48in the device's init() function.
49
50-------
51 Usage
52-------
53
54If the hardware design mandates that the MAC address is stored in some special
55place (like EEPROM etc...), then the board specific init code (such as the
56board-specific misc_init_r() function) is responsible for locating the MAC
57address(es) and initializing the respective environment variable(s) from it.
58Note that this shall be done if, and only if, the environment does not already
59contain these environment variables, i.e. existing variable definitions must
60not be overwritten.
61
62During runtime, the ethernet layer will use the environment variables to sync
63the MAC addresses to the ethernet structures.  All ethernet driver code should
64then only use the enetaddr member of the eth_device structure.  This is done
65on every network command, so the ethernet copies will stay in sync.
66
67Any other code that wishes to access the MAC address should query the
68environment directly.  The helper functions documented below should make
69working with this storage much smoother.
70
71---------
72 Helpers
73---------
74
75To assist in the management of these layers, a few helper functions exist.  You
76should use these rather than attempt to do any kind of parsing/manipulation
77yourself as many common errors have arisen in the past.
78
79	* void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
80
81Convert a string representation of a MAC address to the binary version.
82char *addr = "00:11:22:33:44:55";
83uchar enetaddr[6];
84eth_parse_enetaddr(addr, enetaddr);
85/* enetaddr now equals { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 } */
86
87	* int eth_env_get_enetaddr(char *name, uchar *enetaddr);
88
89Look up an environment variable and convert the stored address.  If the address
90is valid, then the function returns 1.  Otherwise, the function returns 0.  In
91all cases, the enetaddr memory is initialized.  If the env var is not found,
92then it is set to all zeros.  The common function is_valid_ethaddr() is used
93to determine address validity.
94uchar enetaddr[6];
95if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
96	/* "ethaddr" is not set in the environment */
97	... try and setup "ethaddr" in the env ...
98}
99/* enetaddr is now set to the value stored in the ethaddr env var */
100
101	* int eth_env_set_enetaddr(char *name, const uchar *enetaddr);
102
103Store the MAC address into the named environment variable.  The return value is
104the same as the env_set() function.
105uchar enetaddr[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
106eth_env_set_enetaddr("ethaddr", enetaddr);
107/* the "ethaddr" env var should now be set to "00:11:22:33:44:55" */
108
109	* the %pM format modifier
110
111The %pM format modifier can be used with any standard printf function to format
112the binary 6 byte array representation of a MAC address.
113uchar enetaddr[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
114printf("The MAC is %pM\n", enetaddr);
115
116char buf[20];
117sprintf(buf, "%pM", enetaddr);
118/* the buf variable is now set to "00:11:22:33:44:55" */
119

README.esbc_validate

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2015
4 */
5
6esbc_validate command
7========================================
8
91. esbc_validate command is meant for validating header and
10    signature of images (Boot Script and ESBC uboot client).
11    SHA-256 and RSA operations are performed using SEC block in HW.
12    This command works on both PBL based and Non PBL based Freescale
13    platforms.
14   Command usage:
15    esbc_validate img_hdr_addr [pub_key_hash]
16    esbc_validate hdr_addr <hash_val>
17     Validates signature using RSA verification.
18     $hdr_addr Address of header of the image to be validated.
19     $hash_val -Optional. It provides Hash of public/srk key to be
20       used to verify signature.
21
222. ESBC uboot client can be linux. Additionally, rootfs and device
23    tree blob can also be signed.
243. In the event of header or signature failure in validation,
25    ITS and ITF bits determine further course of action.
264. In case of soft failure, appropriate error is dumped on console.
275. In case of hard failure, SoC is issued RESET REQUEST after
28    dumping error on the console.
296. KEY REVOCATION Feature:
30    QorIQ platforms like B4/T4 have support of srk key table and key
31    revocation in ISBC code in Silicon.
32    The srk key table allows the user to have a key table with multiple
33    keys and revoke any key in case of particular key gets compromised.
34    In case the ISBC code uses the key revocation and srk key table to
35    verify the u-boot code, the subsequent chain of trust should also
36    use the same.
376. ISBC KEY EXTENSION Feature:
38    This feature allows large number of keys to be used for esbc validation
39    of images. A set of public keys is being signed and validated by ISBC
40    which can be further used for esbc validation of images.
41

README.ext4

1U-Boot supports access of both ext2 and ext4 filesystems, either in read-only
2mode or in read-write mode.
3
4First, to enable support for both ext4 (and, automatically, ext2 as well),
5but without selecting the corresponding commands, enable one of the following:
6
7  CONFIG_FS_EXT4	(for read-only)
8  CONFIG_EXT4_WRITE	(for read-write)
9
10Next, to select the ext2-related commands:
11
12  * ext2ls
13  * ext2load
14
15or ext4-related commands:
16
17  * ext4size
18  * ext4ls
19  * ext4load
20
21use one or both of:
22
23  CONFIG_CMD_EXT2
24  CONFIG_CMD_EXT4
25
26Selecting either of the above automatically selects CONFIG_FS_EXT4 if it
27wasn't enabled already.
28
29In addition, to get the write access command "ext4write", enable:
30
31  CONFIG_CMD_EXT4_WRITE
32
33which automatically selects CONFIG_EXT4_WRITE if it wasn't defined
34already.
35
36Also relevant are the generic filesystem commands, selected by:
37
38  CONFIG_CMD_FS_GENERIC
39
40This does not automatically enable EXT4 support for you, you still need
41to do that yourself.
42
43Some sample commands to test ext4 support:
44
451. Check that the commands can be seen in the output of U-Boot help:
46
47	UBOOT #help
48	...
49	ext4load- load binary file from a Ext4 file system
50	ext4ls  - list files in a directory (default /)
51	ext4size - determine a file's size
52	ext4write- create a file in ext4 formatted partition
53	...
54
552. To list the files in an ext4-formatted partition, run:
56
57	ext4ls <interface> <dev[:part]> [directory]
58
59	For example:
60	UBOOT #ext4ls mmc 0:5 /usr/lib
61
623. To read and load a file from an ext4-formatted partition to RAM, run:
63
64	ext4load <interface> <dev[:part]> [addr] [filename] [bytes]
65
66	For example:
67	UBOOT #ext4load mmc 2:2 0x30007fc0 uImage
68
694. To write a file to an ext4-formatted partition.
70
71	a) First load a file to RAM at a particular address for example 0x30007fc0.
72	Now execute ext4write command:
73	ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes]
74
75	For example:
76	UBOOT #ext4write mmc 2:2 /boot/uImage 0x30007fc0 6183120
77	(here 6183120 is the size of the file to be written)
78	Note: Absolute path is required for the file to be written
79
80References :
81	-- ext4 implementation in Linux Kernel
82	-- Uboot existing ext2 load and ls implementation
83	-- Journaling block device JBD2 implementation in linux Kernel
84

README.falcon

1U-Boot Falcon Mode
2====================
3
4Introduction
5------------
6
7This document provides an overview of how to add support for Falcon Mode
8to a board.
9
10Falcon Mode is introduced to speed up the booting process, allowing
11to boot a Linux kernel (or whatever image) without a full blown U-Boot.
12
13Falcon Mode relies on the SPL framework. In fact, to make booting faster,
14U-Boot is split into two parts: the SPL (Secondary Program Loader) and U-Boot
15image. In most implementations, SPL is used to start U-Boot when booting from
16a mass storage, such as NAND or SD-Card. SPL has now support for other media,
17and can generally be seen as a way to start an image performing the minimum
18required initialization. SPL mainly initializes the RAM controller, and then
19copies U-Boot image into the memory.
20
21The Falcon Mode extends this way allowing to start the Linux kernel directly
22from SPL. A new command is added to U-Boot to prepare the parameters that SPL
23must pass to the kernel, using ATAGS or Device Tree.
24
25In normal mode, these parameters are generated each time before
26loading the kernel, passing to Linux the address in memory where
27the parameters can be read.
28With Falcon Mode, this snapshot can be saved into persistent storage and SPL is
29informed to load it before running the kernel.
30
31To boot the kernel, these steps under a Falcon-aware U-Boot are required:
32
331. Boot the board into U-Boot.
34After loading the desired legacy-format kernel image into memory (and DT as
35well, if used), use the "spl export" command to generate the kernel parameters
36area or the DT.  U-Boot runs as when it boots the kernel, but stops before
37passing the control to the kernel.
38
392. Save the prepared snapshot into persistent media.
40The address where to save it must be configured into board configuration
41file (CONFIG_CMD_SPL_NAND_OFS for NAND).
42
433. Boot the board into Falcon Mode. SPL will load the kernel and copy
44the parameters which are saved in the persistent area to the required address.
45If a valid uImage is not found at the defined location, U-Boot will be
46booted instead.
47
48It is required to implement a custom mechanism to select if SPL loads U-Boot
49or another image.
50
51The value of a GPIO is a simple way to operate the selection, as well as
52reading a character from the SPL console if CONFIG_SPL_CONSOLE is set.
53
54Falcon Mode is generally activated by setting CONFIG_SPL_OS_BOOT. This tells
55SPL that U-Boot is not the only available image that SPL is able to start.
56
57Configuration
58----------------------------
59CONFIG_CMD_SPL		Enable the "spl export" command.
60			The command "spl export" is then available in U-Boot
61			mode
62CONFIG_SYS_SPL_ARGS_ADDR	Address in RAM where the parameters must be
63				copied by SPL.
64				In most cases, it is <start_of_ram> + 0x100
65
66CONFIG_SYS_NAND_SPL_KERNEL_OFFS	Offset in NAND where the kernel is stored
67
68CONFIG_CMD_SPL_NAND_OFS	Offset in NAND where the parameters area was saved.
69
70CONFIG_CMD_SPL_WRITE_SIZE 	Size of the parameters area to be copied
71
72CONFIG_SPL_OS_BOOT	Activate Falcon Mode.
73
74Function that a board must implement
75------------------------------------
76
77void spl_board_prepare_for_linux(void) : optional
78	Called from SPL before starting the kernel
79
80spl_start_uboot() : required
81		Returns "0" if SPL should start the kernel, "1" if U-Boot
82		must be started.
83
84Environment variables
85---------------------
86
87A board may chose to look at the environment for decisions about falcon
88mode.  In this case the following variables may be supported:
89
90boot_os : 		Set to yes/Yes/true/True/1 to enable booting to OS,
91			any other value to fall back to U-Boot (including
92			unset)
93falcon_args_file :	Filename to load as the 'args' portion of falcon mode
94			rather than the hard-coded value.
95falcon_image_file :	Filename to load as the OS image portion of falcon
96			mode rather than the hard-coded value.
97
98Using spl command
99-----------------
100
101spl - SPL configuration
102
103Usage:
104
105spl export <img=atags|fdt> [kernel_addr] [initrd_addr] [fdt_addr ]
106
107img		: "atags" or "fdt"
108kernel_addr	: kernel is loaded as part of the boot process, but it is not started.
109		  This is the address where a kernel image is stored.
110initrd_addr	: Address of initial ramdisk
111		  can be set to "-" if fdt_addr without initrd_addr is used
112fdt_addr	: in case of fdt, the address of the device tree.
113
114The spl export command does not write to a storage media. The user is
115responsible to transfer the gathered information (assembled ATAGS list
116or prepared FDT) from temporary storage in RAM into persistant storage
117after each run of 'spl export'. Unfortunately the position of temporary
118storage can not be predicted nor provided at commandline, it depends
119highly on your system setup and your provided data (ATAGS or FDT).
120However at the end of an succesful 'spl export' run it will print the
121RAM address of temporary storage. The RAM address of FDT will also be
122set in the environment variable 'fdtargsaddr', the new length of the
123prepared FDT will be set in the environment variable 'fdtargslen'.
124These environment variables can be used in scripts for writing updated
125FDT to persistent storage.
126
127Now the user have to save the generated BLOB from that printed address
128to the pre-defined address in persistent storage
129(CONFIG_CMD_SPL_NAND_OFS in case of NAND).
130The following example shows how to prepare the data for Falcon Mode on
131twister board with ATAGS BLOB.
132
133The "spl export" command is prepared to work with ATAGS and FDT. However,
134using FDT is at the moment untested. The ppc port (see a3m071 example
135later) prepares the fdt blob with the fdt command instead.
136
137
138Usage on the twister board:
139--------------------------------
140
141Using mtd names with the following (default) configuration
142for mtdparts:
143
144device nand0 <omap2-nand.0>, # parts = 9
145 #: name		size		offset		mask_flags
146 0: MLO                 0x00080000      0x00000000      0
147 1: u-boot              0x00100000      0x00080000      0
148 2: env1                0x00040000      0x00180000      0
149 3: env2                0x00040000      0x001c0000      0
150 4: kernel              0x00600000      0x00200000      0
151 5: bootparms           0x00040000      0x00800000      0
152 6: splashimg           0x00200000      0x00840000      0
153 7: mini                0x02800000      0x00a40000      0
154 8: rootfs              0x1cdc0000      0x03240000      0
155
156
157twister => nand read 82000000 kernel
158
159NAND read: device 0 offset 0x200000, size 0x600000
160 6291456 bytes read: OK
161
162Now the kernel is in RAM at address 0x82000000
163
164twister => spl export atags 0x82000000
165## Booting kernel from Legacy Image at 82000000 ...
166   Image Name:   Linux-3.5.0-rc4-14089-gda0b7f4
167   Image Type:   ARM Linux Kernel Image (uncompressed)
168   Data Size:    3654808 Bytes = 3.5 MiB
169   Load Address: 80008000
170   Entry Point:  80008000
171   Verifying Checksum ... OK
172   Loading Kernel Image ... OK
173OK
174cmdline subcommand not supported
175bdt subcommand not supported
176Argument image is now in RAM at: 0x80000100
177
178The result can be checked at address 0x80000100:
179
180twister => md 0x80000100
18180000100: 00000005 54410001 00000000 00000000    ......AT........
18280000110: 00000000 00000067 54410009 746f6f72    ....g.....ATroot
18380000120: 65642f3d 666e2f76 77722073 73666e20    =/dev/nfs rw nfs
184
185The parameters generated with this step can be saved into NAND at the offset
1860x800000 (value for twister for CONFIG_CMD_SPL_NAND_OFS)
187
188nand erase.part bootparms
189nand write 0x80000100 bootparms 0x4000
190
191Now the parameters are stored into the NAND flash at the address
192CONFIG_CMD_SPL_NAND_OFS (=0x800000).
193
194Next time, the board can be started into Falcon Mode moving the
195setting the gpio (on twister gpio 55 is used) to kernel mode.
196
197The kernel is loaded directly by the SPL without passing through U-Boot.
198
199Example with FDT: a3m071 board
200-------------------------------
201
202To boot the Linux kernel from the SPL, the DT blob (fdt) needs to get
203prepard/patched first. U-Boot usually inserts some dynamic values into
204the DT binary (blob), e.g. autodetected memory size, MAC addresses,
205clocks speeds etc. To generate this patched DT blob, you can use
206the following command:
207
2081. Load fdt blob to SDRAM:
209=> tftp 1800000 a3m071/a3m071.dtb
210
2112. Set bootargs as desired for Linux booting (e.g. flash_mtd):
212=> run mtdargs addip2 addtty
213
2143. Use "fdt" commands to patch the DT blob:
215=> fdt addr 1800000
216=> fdt boardsetup
217=> fdt chosen
218
2194. Display patched DT blob (optional):
220=> fdt print
221
2225. Save fdt to NOR flash:
223=> erase fc060000 fc07ffff
224=> cp.b 1800000 fc060000 10000
225...
226
227
228Falcon Mode was presented at the RMLL 2012. Slides are available at:
229
230http://schedule2012.rmll.info/IMG/pdf/LSM2012_UbootFalconMode_Babic.pdf
231

README.fdt-control

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (c) 2011 The Chromium OS Authors.
4
5Device Tree Control in U-Boot
6=============================
7
8This feature provides for run-time configuration of U-Boot via a flat
9device tree (fdt). U-Boot configuration has traditionally been done
10using CONFIG options in the board config file. This feature aims to
11make it possible for a single U-Boot binary to support multiple boards,
12with the exact configuration of each board controlled by a flat device
13tree (fdt). This is the approach recently taken by the ARM Linux kernel
14and has been used by PowerPC for some time.
15
16The fdt is a convenient vehicle for implementing run-time configuration
17for three reasons. Firstly it is easy to use, being a simple text file.
18It is extensible since it consists of nodes and properties in a nice
19hierarchical format.
20
21Finally, there is already excellent infrastructure for the fdt: a
22compiler checks the text file and converts it to a compact binary
23format, and a library is already available in U-Boot (libfdt) for
24handling this format.
25
26The dts directory contains a Makefile for building the device tree blob
27and embedding it in your U-Boot image. This is useful since it allows
28U-Boot to configure itself according to what it finds there. If you have
29a number of similar boards with different peripherals, you can describe
30the features of each board in the device tree file, and have a single
31generic source base.
32
33To enable this feature, add CONFIG_OF_CONTROL to your board config file.
34
35
36What is a Flat Device Tree?
37---------------------------
38
39An fdt can be specified in source format as a text file. To read about
40the fdt syntax, take a look at the specification here:
41
42https://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf
43
44You also might find this section of the Linux kernel documentation
45useful: (access this in the Linux kernel source code)
46
47	Documentation/devicetree/booting-without-of.txt
48
49There is also a mailing list:
50
51	http://lists.ozlabs.org/listinfo/devicetree-discuss
52
53In case you are wondering, OF stands for Open Firmware.
54
55
56Tools
57-----
58
59To use this feature you will need to get the device tree compiler. This is
60provided by U-Boot automatically. If you have a system version of dtc
61(typically in the 'device-tree-compiler' package), it is currently not used.
62
63If you want to build your own dtc, it is kept here:
64
65	git://git.kernel.org/pub/scm/utils/dtc/dtc.git
66
67For example:
68
69	$ git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git
70	$ cd dtc
71	$ make
72	$ sudo make install
73
74Then run the compiler (your version will vary):
75
76	$ dtc -v
77	Version: DTC 1.2.0-g2cb4b51f
78	$ make tests
79	$ cd tests
80	$ ./run_tests.sh
81	********** TEST SUMMARY
82	*     Total testcases:	1371
83	*                PASS:	1371
84	*                FAIL:	0
85	*   Bad configuration:	0
86	* Strange test result:	0
87
88You will also find a useful fdtdump utility for decoding a binary file, as
89well as fdtget/fdtput for reading and writing properties in a binary file.
90
91
92Where do I get an fdt file for my board?
93----------------------------------------
94
95You may find that the Linux kernel has a suitable file. Look in the
96kernel source in arch/<arch>/boot/dts.
97
98If not you might find other boards with suitable files that you can
99modify to your needs. Look in the board directories for files with a
100.dts extension.
101
102Failing that, you could write one from scratch yourself!
103
104
105Configuration
106-------------
107
108Use:
109
110#define CONFIG_DEFAULT_DEVICE_TREE	"<name>"
111
112to set the filename of the device tree source. Then put your device tree
113file into
114
115	board/<vendor>/dts/<name>.dts
116
117This should include your CPU or SOC's device tree file, placed in
118arch/<arch>/dts, and then make any adjustments required.
119
120If CONFIG_OF_EMBED is defined, then it will be picked up and built into
121the U-Boot image (including u-boot.bin). This is suitable for debugging
122and development only and is not recommended for production devices.
123
124If CONFIG_OF_SEPARATE is defined, then it will be built and placed in
125a u-boot.dtb file alongside u-boot-nodtb.bin. A common approach is then to
126join the two:
127
128	cat u-boot-nodtb.bin u-boot.dtb >image.bin
129
130and then flash image.bin onto your board. Note that U-Boot creates
131u-boot-dtb.bin which does the above step for you also. Resulting
132u-boot.bin is a copy of u-boot-dtb.bin in this case. If you are using
133CONFIG_SPL_FRAMEWORK, then u-boot.img will be built to include the device
134tree binary.
135
136If CONFIG_OF_BOARD is defined, a board-specific routine will provide the
137device tree at runtime, for example if an earlier bootloader stage creates
138it and passes it to U-Boot.
139
140If CONFIG_OF_HOSTFILE is defined, then it will be read from a file on
141startup. This is only useful for sandbox. Use the -d flag to U-Boot to
142specify the file to read.
143
144You cannot use more than one of these options at the same time.
145
146To use a device tree file that you have compiled yourself, pass
147EXT_DTB=<filename> to 'make', as in:
148
149	make EXT_DTB=boot/am335x-boneblack-pubkey.dtb
150
151Then U-Boot will copy that file to u-boot.dtb, put it in the .img file
152if used, and u-boot-dtb.bin.
153
154If you wish to put the fdt at a different address in memory, you can
155define the "fdtcontroladdr" environment variable. This is the hex
156address of the fdt binary blob, and will override either of the options.
157Be aware that this environment variable is checked prior to relocation,
158when only the compiled-in environment is available. Therefore it is not
159possible to define this variable in the saved SPI/NAND flash
160environment, for example (it will be ignored). After relocation, this
161variable will be set to the address of the newly relocated fdt blob.
162It is read-only and cannot be changed. It can optionally be used to
163control the boot process of Linux with bootm/bootz commands.
164
165To use this, put something like this in your board header file:
166
167#define CONFIG_EXTRA_ENV_SETTINGS	"fdtcontroladdr=10000\0"
168
169Build:
170
171After board configuration is done, fdt supported u-boot can be build in two ways:
1721)  build the default dts which is defined from CONFIG_DEFAULT_DEVICE_TREE
173    $ make
1742)  build the user specified dts file
175    $ make DEVICE_TREE=<dts-file-name>
176
177
178Relocation, SPL and TPL
179-----------------------
180
181U-Boot can be divided into three phases: TPL, SPL and U-Boot proper.
182
183The full device tree is available to U-Boot proper, but normally only a subset
184(or none at all) is available to TPL and SPL. See 'Pre-Relocation Support' and
185'SPL Support' in doc/driver-model/README.txt for more details.
186
187
188Using several DTBs in the SPL (CONFIG_SPL_MULTI_DTB)
189----------------------------------------------------
190In some rare cases it is desirable to let SPL be able to select one DTB among
191many. This usually not very useful as the DTB for the SPL is small and usually
192fits several platforms. However the DTB sometimes include information that do
193work on several platforms (like IO tuning parameters).
194In this case it is possible to use CONFIG_SPL_MULTI_DTB. This option appends to
195the SPL a FIT image containing several DTBs listed in SPL_OF_LIST.
196board_fit_config_name_match() is called to select the right DTB.
197
198If board_fit_config_name_match() relies on DM (DM driver to access an EEPROM
199containing the board ID for example), it possible to start with a generic DTB
200and then switch over to the right DTB after the detection. For this purpose,
201the platform code must call fdtdec_resetup(). Based on the returned flag, the
202platform may have to re-initiliaze the DM subusystem using dm_uninit() and
203dm_init_and_scan().
204
205
206Limitations
207-----------
208
209U-Boot is designed to build with a single architecture type and CPU
210type. So for example it is not possible to build a single ARM binary
211which runs on your AT91 and OMAP boards, relying on an fdt to configure
212the various features. This is because you must select one of
213the CPU families within arch/arm/cpu/arm926ejs (omap or at91) at build
214time. Similarly you cannot build for multiple cpu types or
215architectures.
216
217That said the complexity reduction by using fdt to support variants of
218boards which use the same SOC / CPU can be substantial.
219
220It is important to understand that the fdt only selects options
221available in the platform / drivers. It cannot add new drivers (yet). So
222you must still have the CONFIG option to enable the driver. For example,
223you need to define CONFIG_SYS_NS16550 to bring in the NS16550 driver,
224but can use the fdt to specific the UART clock, peripheral address, etc.
225In very broad terms, the CONFIG options in general control *what* driver
226files are pulled in, and the fdt controls *how* those files work.
227
228--
229Simon Glass <sjg@chromium.org>
2301-Sep-11
231

README.fdt-overlays

1U-Boot FDT Overlay usage
2=============================================
3
4Overlays Syntax
5---------------
6
7Overlays require slightly different syntax compared to traditional overlays.
8Please refer to dt-object-internal.txt in the dtc sources for information
9regarding the internal format of overlays:
10https://git.kernel.org/pub/scm/utils/dtc/dtc.git/tree/Documentation/dt-object-internal.txt
11
12Building Overlays
13-----------------
14
15In a nutshell overlays provides a means to manipulate a symbol a previous dtb
16or overlay has defined. It requires both the base and all the overlays
17to be compiled with the -@ command line switch so that symbol information is
18included.
19
20Note support for -@ option can only be found in dtc version 1.4.4 or newer.
21Only version 4.14 or higher of the Linux kernel includes a built in version
22of dtc that meets this requirement.
23
24Building an overlay follows the same process as building a traditional dtb.
25
26For example:
27
28base.dts
29--------
30
31	/dts-v1/;
32	/ {
33		foo: foonode {
34			foo-property;
35		};
36	};
37
38	$ dtc -@ -I dts -O dtb -o base.dtb base.dts
39
40bar.dts
41-------
42
43	/dts-v1/;
44	/plugin/;
45	/ {
46		fragment@1 {
47			target = <&foo>;
48			__overlay__ {
49				overlay-1-property;
50				bar: barnode {
51					bar-property;
52				};
53			};
54		};
55	};
56
57	$ dtc -@ -I dts -O dtb -o bar.dtb bar.dts
58
59Ways to Utilize Overlays in U-boot
60----------------------------------
61
62There are two ways to apply overlays in U-boot.
631. Include and define overlays within a FIT image and have overlays
64   automatically applied.
65
662. Manually load and apply overlays
67
68The remainder of this document will discuss using overlays via the manual
69approach. For information on using overlays as part of a FIT image please see:
70doc/uImage.FIT/overlay-fdt-boot.txt
71
72Manually Loading and Applying Overlays
73--------------------------------------
74
751. Figure out where to place both the base device tree blob and the
76overlay. Make sure you have enough space to grow the base tree without
77overlapping anything.
78
79=> setenv fdtaddr 0x87f00000
80=> setenv fdtovaddr 0x87fc0000
81
822. Load the base blob and overlay blobs
83
84=> load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/base.dtb
85=> load ${devtype} ${bootpart} ${fdtovaddr} ${bootdir}/overlay.dtb
86
873. Set it as the working fdt tree.
88
89=> fdtaddr $fdtaddr
90
914. Grow it enough so it can 'fit' all the applied overlays
92
93=> fdt resize 8192
94
955. You are now ready to apply the overlay.
96
97=> fdt apply $fdtovaddr
98
996. Boot system like you would do with a traditional dtb.
100
101For bootm:
102
103=> bootm ${kerneladdr} - ${fdtaddr}
104
105For bootz:
106
107=> bootz ${kerneladdr} - ${fdtaddr}
108
109Please note that in case of an error, both the base and overlays are going
110to be invalidated, so keep copies to avoid reloading.
111
112Pantelis Antoniou
113pantelis.antoniou@konsulko.com
11411/7/2017
115

README.fec_mxc

1U-Boot config options used in fec_mxc.c
2
3CONFIG_FEC_MXC
4	Selects fec_mxc.c to be compiled into u-boot. Can read out the
5	ethaddr from the SoC eFuses (see below).
6
7CONFIG_MII
8	Must be defined if CONFIG_FEC_MXC is defined.
9
10CONFIG_FEC_XCV_TYPE
11	Defaults to MII100 for 100 Base-tx.
12	RGMII selects 1000 Base-tx reduced pin count interface.
13	RMII selects 100 Base-tx reduced pin count interface.
14
15CONFIG_FEC_MXC_SWAP_PACKET
16	Forced on iff MX28.
17	Swaps the bytes order of all words(4 byte units) in the packet.
18	This should not be specified by a board file. It is cpu specific.
19
20CONFIG_PHYLIB
21	fec_mxc supports PHYLIB and should be used for new boards.
22
23CONFIG_FEC_MXC_NO_ANEG
24	Relevant only if PHYLIB not used. Skips auto-negotiation restart.
25
26CONFIG_FEC_MXC_PHYADDR
27	Optional, selects the exact phy address that should be connected
28	and function fecmxc_initialize will try to initialize it.
29
30CONFIG_FEC_FIXED_SPEED
31	Optional, selects a fixed speed on the MAC interface without asking some
32	phy. This is usefull if there is a direct MAC <-> MAC connection, for
33	example if the CPU is connected directly via the RGMII interface to a
34	ethernet-switch.
35
36Reading the ethaddr from the SoC eFuses:
37if CONFIG_FEC_MXC is defined and the U-Boot environment does not contain the
38ethaddr variable, then its value gets read from the corresponding eFuses in
39the SoC. See the README files of the specific SoC for details.
40

README.fsl-clk

1Freescale system clock options
2
3	- CONFIG_SYS_FSL_CLK
4		Enable to call get_clocks() in board_init_f() for
5		non-PPC platforms.
6

README.fsl-ddr

1Table of interleaving 2-4 controllers
2=====================================
3  +--------------+-----------------------------------------------------------+
4  |Configuration |                    Memory Controller                      |
5  |              |       1              2              3             4       |
6  |--------------+--------------+--------------+-----------------------------+
7  | Two memory   | Not Intlv'ed | Not Intlv'ed |                             |
8  | complexes    +--------------+--------------+                             |
9  |              |      2-way Intlv'ed         |                             |
10  |--------------+--------------+--------------+--------------+              |
11  |              | Not Intlv'ed | Not Intlv'ed | Not Intlv'ed |              |
12  | Three memory +--------------+--------------+--------------+              |
13  | complexes    |         2-way Intlv'ed      | Not Intlv'ed |              |
14  |              +-----------------------------+--------------+              |
15  |              |                  3-way Intlv'ed            |              |
16  +--------------+--------------+--------------+--------------+--------------+
17  |              | Not Intlv'ed | Not Intlv'ed | Not Intlv'ed | Not Intlv'ed |
18  | Four memory  +--------------+--------------+--------------+--------------+
19  | complexes    |       2-way Intlv'ed        |       2-way Intlv'ed        |
20  |              +-----------------------------+-----------------------------+
21  |              |                      4-way Intlv'ed                       |
22  +--------------+-----------------------------------------------------------+
23
24
25Table of 2-way interleaving modes supported in cpu/8xxx/ddr/
26======================================================
27  +-------------+---------------------------------------------------------+
28  |		|		    Rank Interleaving			  |
29  |		+--------+-----------+-----------+------------+-----------+
30  |Memory	|	 |	     |		 |    2x2     |    4x1	  |
31  |Controller	|  None  | 2x1 lower | 2x1 upper | {CS0+CS1}, | {CS0+CS1+ |
32  |Interleaving |	 | {CS0+CS1} | {CS2+CS3} | {CS2+CS3}  |  CS2+CS3} |
33  +-------------+--------+-----------+-----------+------------+-----------+
34  |None		|  Yes	 | Yes	     | Yes	 | Yes	      | Yes	  |
35  +-------------+--------+-----------+-----------+------------+-----------+
36  |Cacheline	|  Yes	 | Yes	     | No	 | No, Only(*)| Yes	  |
37  |		|CS0 Only|	     |		 | {CS0+CS1}  |		  |
38  +-------------+--------+-----------+-----------+------------+-----------+
39  |Page		|  Yes	 | Yes	     | No	 | No, Only(*)| Yes	  |
40  |		|CS0 Only|	     |		 | {CS0+CS1}  |		  |
41  +-------------+--------+-----------+-----------+------------+-----------+
42  |Bank		|  Yes	 | Yes	     | No	 | No, Only(*)| Yes	  |
43  |		|CS0 Only|	     |		 | {CS0+CS1}  |		  |
44  +-------------+--------+-----------+-----------+------------+-----------+
45  |Superbank	|  No	 | Yes	     | No	 | No, Only(*)| Yes	  |
46  |		|	 |	     |		 | {CS0+CS1}  |		  |
47  +-------------+--------+-----------+-----------+------------+-----------+
48 (*) Although the hardware can be configured with memory controller
49 interleaving using "2x2" rank interleaving, it only interleaves {CS0+CS1}
50 from each controller. {CS2+CS3} on each controller are only rank
51 interleaved on that controller.
52
53 For memory controller interleaving, identical DIMMs are suggested. Software
54 doesn't check the size or organization of interleaved DIMMs.
55
56The ways to configure the ddr interleaving mode
57==============================================
581. In board header file(e.g.MPC8572DS.h), add default interleaving setting
59   under "CONFIG_EXTRA_ENV_SETTINGS", like:
60	#define CONFIG_EXTRA_ENV_SETTINGS				\
61	 "hwconfig=fsl_ddr:ctlr_intlv=bank"			\
62	 ......
63
642. Run U-Boot "setenv" command to configure the memory interleaving mode.
65   Either numerical or string value is accepted.
66
67  # disable memory controller interleaving
68  setenv hwconfig "fsl_ddr:ctlr_intlv=null"
69
70  # cacheline interleaving
71  setenv hwconfig "fsl_ddr:ctlr_intlv=cacheline"
72
73  # page interleaving
74  setenv hwconfig "fsl_ddr:ctlr_intlv=page"
75
76  # bank interleaving
77  setenv hwconfig "fsl_ddr:ctlr_intlv=bank"
78
79  # superbank
80  setenv hwconfig "fsl_ddr:ctlr_intlv=superbank"
81
82  # 1KB 3-way interleaving
83  setenv hwconfig "fsl_ddr:ctlr_intlv=3way_1KB"
84
85  # 4KB 3-way interleaving
86  setenv hwconfig "fsl_ddr:ctlr_intlv=3way_4KB"
87
88  # 8KB 3-way interleaving
89  setenv hwconfig "fsl_ddr:ctlr_intlv=3way_8KB"
90
91  # disable bank (chip-select) interleaving
92  setenv hwconfig "fsl_ddr:bank_intlv=null"
93
94  # bank(chip-select) interleaving cs0+cs1
95  setenv hwconfig "fsl_ddr:bank_intlv=cs0_cs1"
96
97  # bank(chip-select) interleaving cs2+cs3
98  setenv hwconfig "fsl_ddr:bank_intlv=cs2_cs3"
99
100  # bank(chip-select) interleaving (cs0+cs1) and (cs2+cs3)  (2x2)
101  setenv hwconfig "fsl_ddr:bank_intlv=cs0_cs1_and_cs2_cs3"
102
103  # bank(chip-select) interleaving (cs0+cs1+cs2+cs3) (4x1)
104  setenv hwconfig "fsl_ddr:bank_intlv=cs0_cs1_cs2_cs3"
105
106  # bank(chip-select) interleaving (auto)
107  setenv hwconfig "fsl_ddr:bank_intlv=auto"
108  This auto mode only select from cs0_cs1_cs2_cs3, cs0_cs1, null dependings
109  on DIMMs.
110
111Memory controller address hashing
112==================================
113If the DDR controller supports address hashing, it can be enabled by hwconfig.
114
115Syntax is:
116hwconfig=fsl_ddr:addr_hash=true
117
118Memory controller ECC on/off
119============================
120If ECC is enabled in board configuratoin file, i.e. #define CONFIG_DDR_ECC,
121ECC can be turned on/off by hwconfig.
122
123Syntax is
124hwconfig=fsl_ddr:ecc=off
125
126
127Memory address parity on/off
128============================
129address parity can be turned on/off by hwconfig.
130Syntax is:
131hwconfig=fsl_ddr:parity=on
132
133
134Memory testing options for mpc85xx
135==================================
1361. Memory test can be done once U-Boot prompt comes up using mtest, or
1372. Memory test can be done with Power-On-Self-Test function, activated at
138   compile time.
139
140   In order to enable the POST memory test, CONFIG_POST needs to be
141   defined in board configuraiton header file. By default, POST memory test
142   performs a fast test. A slow test can be enabled by changing the flag at
143   compiling time. To test memory bigger than 2GB, 36BIT support is needed.
144   Memory is tested within a 2GB window. TLBs are used to map the virtual 2GB
145   window to physical address so that all physical memory can be tested.
146
147Combination of hwconfig
148=======================
149Hwconfig can be combined with multiple parameters, for example, on a supported
150platform
151
152hwconfig=fsl_ddr:addr_hash=true,ctlr_intlv=cacheline,bank_intlv=cs0_cs1_cs2_cs3,ecc=on
153
154
155Table for dynamic ODT for DDR3
156==============================
157For single-slot system with quad-rank DIMM and dual-slot system, dynamic ODT may
158be needed, depending on the configuration. The numbers in the following tables are
159in Ohms.
160
161* denotes dynamic ODT
162
163Two slots system
164+-----------------------+----------+---------------+-----------------------------+-----------------------------+
165|     Configuration	|	   |DRAM controller|	       Slot 1		 |	      Slot 2	       |
166+-----------+-----------+----------+-------+-------+--------------+--------------+--------------+--------------+
167|	    |		|	   |	   |	   |	 Rank 1   |	Rank 2	 |   Rank 1	|    Rank 2    |
168+  Slot 1   |	Slot 2	|Write/Read| Write | Read  |-------+------+-------+------+-------+------+-------+------+
169|	    |		|	   |	   |	   | Write | Read | Write | Read | Write | Read | Write | Read |
170+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
171|	    |		|  Slot 1  |  off  | 75    | 120   | off  | off   | off  | off	 | off	| 30	| 30   |
172| Dual Rank | Dual Rank |----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
173|	    |		|  Slot 2  |  off  | 75    | off   | off  | 30	  | 30	 | 120	 | off	| off	| off  |
174+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
175|	    |		|  Slot 1  |  off  | 75    | 120   | off  | off   | off  | 20	 | 20	|	|      |
176| Dual Rank |Single Rank|----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
177|	    |		|  Slot 2  |  off  | 75    | off   | off  | 20	  | 20	 | 120	*| off	|	|      |
178+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
179|	    |		|  Slot 1  |  off  | 75    | 120  *| off  |	  |	 | off	 | off	| 20	| 20   |
180|Single Rank| Dual Rank |----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
181|	    |		|  Slot 2  |  off  | 75    | 20    | 20   |	  |	 | 120	 | off	| off	| off  |
182+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
183|	    |		|  Slot 1  |  off  | 75    | 120  *| off  |	  |	 | 30	 | 30	|	|      |
184|Single Rank|Single Rank|----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
185|	    |		|  Slot 2  |  off  | 75    | 30    | 30   |	  |	 | 120	*| off	|	|      |
186+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
187| Dual Rank |	Empty	|  Slot 1  |  off  | 75    | 40    | off  | off   | off  |	 |	|	|      |
188+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
189|   Empty   | Dual Rank |  Slot 2  |  off  | 75    |	   |	  |	  |	 | 40	 | off	| off	| off  |
190+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
191|Single Rank|	Empty	|  Slot 1  |  off  | 75    | 40    | off  |	  |	 |	 |	|	|      |
192+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
193|   Empty   |Single Rank|  Slot 2  |  off  | 75    |	   |	  |	  |	 | 40	 | off	|	|      |
194+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
195
196Single slot system
197+-------------+------------+---------------+-----------------------------+-----------------------------+
198|	      |		   |DRAM controller|	 Rank 1   |    Rank 2	 |    Rank 3	|    Rank 4    |
199|Configuration| Write/Read |-------+-------+-------+------+-------+------+-------+------+-------+------+
200|	      |		   | Write | Read  | Write | Read | Write | Read | Write | Read | Write | Read |
201+-------------+------------+-------+-------+-------+------+-------+------+-------+------+-------+------+
202|	      |   R1	   | off   | 75    | 120  *| off  | off   | off  | 20	 | 20	| off	| off  |
203|	      |------------+-------+-------+-------+------+-------+------+-------+------+-------+------+
204|	      |   R2	   | off   | 75    | off   | 20   | 120   | off  | 20	 | 20	| off	| off  |
205|  Quad Rank  |------------+-------+-------+-------+------+-------+------+-------+------+-------+------+
206|	      |   R3	   | off   | 75    | 20    | 20   | off   | off  | 120	*| off	| off	| off  |
207|	      |------------+-------+-------+-------+------+-------+------+-------+------+-------+------+
208|	      |   R4	   | off   | 75    | 20    | 20   | off   | off  | off	 | 20	| 120	| off  |
209+-------------+------------+-------+-------+-------+------+-------+------+-------+------+-------+------+
210|	      |   R1	   | off   | 75    | 40    | off  | off   | off  |
211|  Dual Rank  |------------+-------+-------+-------+------+-------+------+
212|	      |   R2	   | off   | 75    | 40    | off  | off   | off  |
213+-------------+------------+-------+-------+-------+------+-------+------+
214| Single Rank |   R1	   | off   | 75    | 40    | off  |
215+-------------+------------+-------+-------+-------+------+
216
217Reference http://www.xrosstalkmag.com/mag_issues/xrosstalk_oct08_final.pdf
218	  http://download.micron.com/pdf/technotes/ddr3/tn4108_ddr3_design_guide.pdf
219
220
221Table for ODT for DDR2
222======================
223Two slots system
224+-----------------------+----------+---------------+-----------------------------+-----------------------------+
225|     Configuration     |          |DRAM controller|           Slot 1            |            Slot 2           |
226+-----------+-----------+----------+-------+-------+--------------+--------------+--------------+--------------+
227|           |           |          |       |       |     Rank 1   |     Rank 2   |   Rank 1     |    Rank 2    |
228+  Slot 1   |   Slot 2  |Write/Read| Write | Read  |-------+------+-------+------+-------+------+-------+------+
229|           |           |          |       |       | Write | Read | Write | Read | Write | Read | Write | Read |
230+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
231|           |           |  Slot 1  |  off  | 150   | off   | off  | off   | off  | 75    | 75   | off   | off  |
232| Dual Rank | Dual Rank |----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
233|           |           |  Slot 2  |  off  | 150   | 75    | 75   | off   | off  | off   | off  | off   | off  |
234+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
235|           |           |  Slot 1  |  off  | 150   | off   | off  | off   | off  | 75    | 75   |       |      |
236| Dual Rank |Single Rank|----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
237|           |           |  Slot 2  |  off  | 150   | 75    | 75   | off   | off  | off   | off  |       |      |
238+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
239|           |           |  Slot 1  |  off  | 150   | off   | off  |       |      | 75    | 75   | off   | off  |
240|Single Rank| Dual Rank |----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
241|           |           |  Slot 2  |  off  | 150   | 75    | 75   |       |      | off   | off  | off   | off  |
242+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
243|           |           |  Slot 1  |  off  | 150   | off   | off  |       |      | 75    | 75   |       |      |
244|Single Rank|Single Rank|----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
245|           |           |  Slot 2  |  off  | 150   | 75    | 75   |       |      | off   | off  |       |      |
246+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
247| Dual Rank |   Empty   |  Slot 1  |  off  | 75    | 150   | off  | off   | off  |       |      |       |      |
248+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
249|   Empty   | Dual Rank |  Slot 2  |  off  | 75    |       |      |       |      | 150   | off  | off   | off  |
250+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
251|Single Rank|   Empty   |  Slot 1  |  off  | 75    | 150   | off  |       |      |       |      |       |      |
252+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
253|   Empty   |Single Rank|  Slot 2  |  off  | 75    |       |      |       |      | 150   | off  |       |      |
254+-----------+-----------+----------+-------+-------+-------+------+-------+------+-------+------+-------+------+
255
256Single slot system
257+-------------+------------+---------------+-----------------------------+
258|             |            |DRAM controller|     Rank 1   |    Rank 2    |
259|Configuration| Write/Read |-------+-------+-------+------+-------+------+
260|             |            | Write | Read  | Write | Read | Write | Read |
261+-------------+------------+-------+-------+-------+------+-------+------+
262|             |   R1       | off   | 75    | 150   | off  | off   | off  |
263|  Dual Rank  |------------+-------+-------+-------+------+-------+------+
264|             |   R2       | off   | 75    | 150   | off  | off   | off  |
265+-------------+------------+-------+-------+-------+------+-------+------+
266| Single Rank |   R1       | off   | 75    | 150   | off  |
267+-------------+------------+-------+-------+-------+------+
268
269Reference http://www.samsung.com/global/business/semiconductor/products/dram/downloads/applicationnote/ddr2_odt_control_200603.pdf
270
271
272Interactive DDR debugging
273===========================
274
275For DDR parameter tuning up and debugging, the interactive DDR debugger can
276be activated by setting the environment variable "ddr_interactive" to any
277value.  (The value of ddr_interactive may have a meaning in the future, but,
278for now, the presence of the variable will cause the debugger to run.)  Once
279activated, U-Boot will show the prompt "FSL DDR>" before enabling the DDR
280controller.  The available commands are printed by typing "help".
281
282Another way to enter the interactive DDR debugger without setting the
283environment variable is to send the 'd' character early during the boot
284process.  To save booting time, no additional delay is added, so the window
285to send the key press is very short -- basically, it is the time before the
286memory controller code starts to run.  For example, when rebooting from
287within U-Boot, the user must press 'd' IMMEDIATELY after hitting enter to
288initiate a 'reset' command.  In case of power on/reset, the user can hold
289down the 'd' key while applying power or hitting the board's reset button.
290
291The example flow of using interactive debugging is
292type command "compute" to calculate the parameters from the default
293type command "print" with arguments to show SPD, options, registers
294type command "edit" with arguments to change any if desired
295type command "copy" with arguments to copy controller/dimm settings
296type command "go" to continue calculation and enable DDR controller
297
298Additional commands to restart the debugging are:
299type command "reset" to reset the board
300type command "recompute" to reload SPD and start over
301
302Note, check "next_step" to show the flow. For example, after edit opts, the
303next_step is STEP_ASSIGN_ADDRESSES. After editing registers, the next_step is
304STEP_PROGRAM_REGS.  Upon issuing command "go", the debugger will program the
305DDR controller with the current setting without further calculation and then
306exit to resume the booting of the machine.
307
308The detail syntax for each commands are
309
310print [c<n>] [d<n>] [spd] [dimmparms] [commonparms] [opts] [addresses] [regs]
311	c<n>		- the controller number, eg. c0, c1
312	d<n>		- the DIMM number, eg. d0, d1
313	spd		- print SPD data
314	dimmparms	- DIMM parameters, calculated from SPD
315	commonparms	- lowest common parameters for all DIMMs
316	opts		- options
317	addresses	- address assignment (not implemented yet)
318	regs		- controller registers
319
320edit <c#> <d#> <spd|dimmparms|commonparms|opts|addresses|regs> <element> <value>
321	c<n>		- the controller number, eg. c0, c1
322	d<n>		- the DIMM number, eg. d0, d1
323	spd		- print SPD data
324	dimmparms	- DIMM parameters, calculated from SPD
325	commonparms	- lowest common parameters for all DIMMs
326	opts		- options
327	addresses	- address assignment (not implemented yet)
328	regs		- controller registers
329	<element>	- name of the modified element
330			  byte number if the object is SPD
331	<value>		- decimal or heximal (prefixed with 0x) numbers
332
333copy <src c#> <src d#> <spd|dimmparms|commonparms|opts|addresses|regs> <dst c#> <dst d#>
334	same as for "edit" command
335	DIMM numbers ignored for commonparms, opts, and regs
336
337reset
338	no arguement	- reset the board
339
340recompute
341	no argument	- reload SPD and start over
342
343compute
344	no argument	- recompute from current next_step
345
346next_step
347	no argument	- show current next_step
348
349help
350	no argument	- print a list of all commands
351
352go
353	no argument	- program memory controller(s) and continue with U-Boot
354
355Examples of debugging flow
356
357	FSL DDR>compute
358	Detected UDIMM UG51U6400N8SU-ACF
359	FSL DDR>print
360	print [c<n>] [d<n>] [spd] [dimmparms] [commonparms] [opts] [addresses] [regs]
361	FSL DDR>print dimmparms
362	DIMM parameters:  Controller=0 DIMM=0
363	DIMM organization parameters:
364	module part name = UG51U6400N8SU-ACF
365	rank_density = 2147483648 bytes (2048 megabytes)
366	capacity = 4294967296 bytes (4096 megabytes)
367	burst_lengths_bitmask = 0C
368	base_addresss = 0 (00000000 00000000)
369	n_ranks = 2
370	data_width = 64
371	primary_sdram_width = 64
372	ec_sdram_width = 0
373	registered_dimm = 0
374	n_row_addr = 15
375	n_col_addr = 10
376	edc_config = 0
377	n_banks_per_sdram_device = 8
378	tCKmin_X_ps = 1500
379	tCKmin_X_minus_1_ps = 0
380	tCKmin_X_minus_2_ps = 0
381	tCKmax_ps = 0
382	caslat_X = 960
383	tAA_ps = 13125
384	caslat_X_minus_1 = 0
385	caslat_X_minus_2 = 0
386	caslat_lowest_derated = 0
387	tRCD_ps = 13125
388	tRP_ps = 13125
389	tRAS_ps = 36000
390	tWR_ps = 15000
391	tWTR_ps = 7500
392	tRFC_ps = 160000
393	tRRD_ps = 6000
394	tRC_ps = 49125
395	refresh_rate_ps = 7800000
396	tIS_ps = 0
397	tIH_ps = 0
398	tDS_ps = 0
399	tDH_ps = 0
400	tRTP_ps = 7500
401	tDQSQ_max_ps = 0
402	tQHS_ps = 0
403	FSL DDR>edit c0 opts ECC_mode 0
404	FSL DDR>edit c0 regs cs0_bnds 0x000000FF
405	FSL DDR>go
406	2 GiB left unmapped
407	4 GiB (DDR3, 64-bit, CL=9, ECC off)
408	       DDR Chip-Select Interleaving Mode: CS0+CS1
409	Testing 0x00000000 - 0x7fffffff
410	Testing 0x80000000 - 0xffffffff
411	Remap DDR 2 GiB left unmapped
412
413	POST memory PASSED
414	Flash: 128 MiB
415	L2:    128 KB enabled
416	Corenet Platform Cache: 1024 KB enabled
417	SERDES: timeout resetting bank 3
418	SRIO1: disabled
419	SRIO2: disabled
420	MMC:  FSL_ESDHC: 0
421	EEPROM: Invalid ID (ff ff ff ff)
422	PCIe1: disabled
423	PCIe2: Root Complex, x1, regs @ 0xfe201000
424	  01:00.0     - 8086:10d3 - Network controller
425	PCIe2: Bus 00 - 01
426	PCIe3: disabled
427	In:    serial
428	Out:   serial
429	Err:   serial
430	Net:   Initializing Fman
431	Fman1: Uploading microcode version 101.8.0
432	e1000: 00:1b:21:81:d2:e0
433	FM1@DTSEC1, FM1@DTSEC2, FM1@DTSEC3, FM1@DTSEC4, FM1@DTSEC5, e1000#0 [PRIME]
434	Warning: e1000#0 MAC addresses don't match:
435	Address in SROM is         00:1b:21:81:d2:e0
436	Address in environment is  00:e0:0c:00:ea:05
437
438	Hit any key to stop autoboot:  0
439	=>
440

README.fsl-dpaa

1This file documents Freescale DPAA-specific options.
2
3FMan (Frame Manager)
4  - CONFIG_FSL_FM_10GEC_REGULAR_NOTATION
5	on SoCs T4240, T2080, LS1043A, etc, the notation between 10GEC and MAC as below:
6		10GEC1->MAC9, 10GEC2->MAC10, 10GEC3->MAC1, 10GEC4->MAC2
7	on SoCs T1024, etc, the notation between 10GEC and MAC as below:
8		10GEC1->MAC1, 10GEC2->MAC2
9	so we introduce CONFIG_FSL_FM_10GEC_REGULAR_NOTATION to identify the new SoCs on
10	which 10GEC enumeration is consistent with MAC enumeration.
11

README.fsl-esdhc

1Freescale esdhc-specific options
2
3	- CONFIG_FSL_ESDHC_ADAPTER_IDENT
4		Support Freescale adapter card type identification. This is implemented by
5		operating Qixis FPGA relevant registers. The STAT_PRES1 register has SDHC
6		Card ID[0:2] bits showing the type of card installed in the SDHC Adapter Slot.
7
8		SDHC Card ID[0:2]	Adapter Card Type
9		0b000			reserved
10		0b001			eMMC Card Rev4.5
11		0b010			SD/MMC Legacy Card
12		0b011			eMMC Card Rev4.4
13		0b100			reserved
14		0b101			MMC Card
15		0b110			SD Card Rev2.0/3.0
16		0b111			No card is present
17	- CONFIG_SYS_FSL_ESDHC_LE
18		ESDHC IP is in little-endian mode. Accessing ESDHC registers can be
19		determined by ESDHC IP's endian mode or processor's endian mode.
20	- CONFIG_SYS_FSL_ESDHC_BE
21		ESDHC IP is in big-endian mode. Accessing ESDHC registers can be determined
22		by ESDHC IP's endian mode or processor's endian mode.
23

README.fsl-hwconfig

1Freescale-specific 'hwconfig' options.
2
3This file documents Freescale-specific key:value pairs for the 'hwconfig'
4option.  See README.hwconfig for general information about 'hwconfig'.
5
6audclk
7	Specific to the P1022DS reference board.
8
9	This option specifies which of the two oscillator frequencies should be
10	routed to the Wolfson WM8776 codec.  The ngPIXIS can be programmed to
11	route either a 11.2896MHz or a 12.288MHz clock.  The default is
12	12.288MHz.  This option has two effects.  First, the MUX on the board
13	will be programmed accordingly.  Second, the clock-frequency property
14	in the codec node in the device tree will be updated to the correct
15	value.
16
17	'audclk:11'
18		Select the 11.2896MHz clock
19
20	'audclk:12'
21		Select the 12.288MHz clock
22
23usb
24	Specific to boards have USB controller
25
26	This option specifies the following for a USB controller:
27
28		- which controller mode to use
29		- which USB PHY to use
30
31	This is used by generic USB device-tree fixup function to update
32	modified values of phy type and controller mode.
33
34	Also used for configuring multiple USB controllers such that
35	'usbN' (where N is 1, 2, etc. refers to controller no.)
36
37	'phy_type'
38		Select USB phy type: 'utmi' OR 'ulpi'
39
40	'dr_mode'
41		Select USB controller mode: 'host', 'peripheral' OR 'otg'
42
43	Examples:
44		usb1:dr_mode=host;usb2:dr_mode=peripheral'
45
46		usb1:dr_mode=host,phy_type=utmi;usb2:dr_mode=host'
47

README.fsl-trustzone-components

1Freescale ARM64 SoCs like LS2080A have ARM TrustZone components like
2TZPC-BP147 (TrustZone Protection Controller) and TZASC-400 (TrustZone
3Address Space Controller).
4
5While most of the configuration related programming of these peripherals
6is left to a root-of-trust security software layer (running in EL3
7privilege mode), but still some configurations of these peripherals
8might be required while the bootloader is executing in EL3 privilege
9mode. The following sections define how to turn on these features for
10LS2080A like SoCs.
11
12TZPC-BP147 (TrustZone Protection Controller)
13============================================
14- Depends on CONFIG_FSL_TZPC_BP147 configuration flag.
15- Separates Secure World and Normal World on-chip RAM (OCRAM) spaces.
16- Provides a programming model to set access control policy via the TZPC
17  TZDECPROT Registers.
18
19TZASC-400 (TrustZone Address Space Controller)
20==============================================
21- Depends on CONFIG_FSL_TZASC_400 configuration flag.
22- Separates Secure World and Normal World external memory spaces for bus masters
23  such as processors and DMA-equipped peripherals.
24- Supports 8 fully programmable address regions, initially inactive at reset,
25  and one base region, always active, that covers the remaining address space.
26

README.fsl_iim

1Driver implementing the fuse API for Freescale's IC Identification Module (IIM)
2
3This IP can be found on the following SoCs:
4 - MPC512x,
5 - i.MX25,
6 - i.MX27,
7 - i.MX31,
8 - i.MX35,
9 - i.MX51,
10 - i.MX53.
11
12The section numbers in this file refer to the i.MX25 Reference Manual.
13
14A fuse word contains 8 fuse bit slots, as explained in 30.4.2.2.1.
15
16A bank contains 256 fuse word slots, as shown by the memory map in 30.3.1.
17
18Some fuse bit or word slots may not have the corresponding fuses actually
19implemented in the fusebox.
20
21See the README files of the SoCs using this driver in order to know the
22conventions used by U-Boot to store some specific data in the fuses, e.g. MAC
23addresses.
24
25Fuse operations:
26
27   Read
28      Read operations are implemented as read accesses to the shadow registers,
29      using "Word y of Bank x" from the register summary in 30.3.2. This is
30      explained in detail in 30.4.5.1.
31
32   Sense
33      Sense operations are implemented as explained in 30.4.5.2.
34
35   Program
36      Program operations are implemented as explained in 30.4.5.3. Following
37      this operation, the shadow registers are reloaded by the hardware (not
38      immediately, but this does not make any difference for a user reading
39      these registers).
40
41   Override
42      Override operations are implemented as write accesses to the shadow
43      registers, as explained in 30.4.5.4.
44
45Configuration:
46
47   CONFIG_FSL_IIM
48      Define this to enable the fsl_iim driver.
49

README.fuse

1Fuse API functions and commands
2
3The fuse API allows to control a fusebox and how it is used by the upper
4hardware layers.
5
6A fuse corresponds to a single non-volatile memory bit that can be programmed
7(i.e. blown, set to 1) only once. The programming operation is irreversible. A
8fuse that has not been programmed reads 0.
9
10Fuses can be used by SoCs to store various permanent configuration and data,
11e.g. boot configuration, security configuration, MAC addresses, etc.
12
13A fuse word is the smallest group of fuses that can be read at once from the
14fusebox control IP registers. This is limited to 32 bits with the current API.
15
16A fuse bank is the smallest group of fuse words having a common ID, as defined
17by each SoC.
18
19Upon startup, the fusebox control IP reads the fuse values and stores them to a
20volatile shadow cache.
21
22See the README files of the drivers implementing this API in order to know the
23SoC- and implementation-specific details.
24
25Functions / commands:
26
27   int fuse_read(u32 bank, u32 word, u32 *val);
28   fuse read <bank> <word> [<cnt>]
29      Read fuse words from the shadow cache.
30
31   int fuse_sense(u32 bank, u32 word, u32 *val);
32   fuse sense <bank> <word> [<cnt>]
33      Sense - i.e. read directly from the fusebox, skipping the shadow cache -
34      fuse words. This operation does not update the shadow cache.
35
36      This is useful to know the true value of fuses if an override has been
37      performed (see below).
38
39   int fuse_prog(u32 bank, u32 word, u32 val);
40   fuse prog [-y] <bank> <word> <hexval> [<hexval>...]
41      Program fuse words. This operation directly affects the fusebox and is
42      irreversible. The shadow cache is updated accordingly or not, depending on
43      each IP.
44
45      Only the bits to be programmed should be set in the input value (i.e. for
46      fuse bits that have already been programmed and hence should be left
47      unchanged by a further programming, it is preferable to clear the
48      corresponding bits in the input value in order not to perform a new
49      hardware programming operation on these fuse bits).
50
51   int fuse_override(u32 bank, u32 word, u32 val);
52   fuse override <bank> <word> <hexval> [<hexval>...]
53      Override fuse words in the shadow cache.
54
55      The fusebox is unaffected, so following this operation, the shadow cache
56      may differ from the fusebox values. Read or sense operations can then be
57      used to get the values from the shadow cache or from the fusebox.
58
59      This is useful to change the behaviors linked to some cached fuse values,
60      either because this is needed only temporarily, or because some of the
61      fuses have already been programmed or are locked (if the SoC allows to
62      override a locked fuse).
63
64Configuration:
65
66   CONFIG_CMD_FUSE
67      Define this to enable the fuse commands.
68

README.generic-board

1# SPDX-License-Identifier: GPL-2.0+
2#
3# (C) Copyright 2014 Google, Inc
4# Simon Glass <sjg@chromium.org>
5
6Background
7----------
8
9U-Boot traditionally had a board.c file for each architecture. This introduced
10quite a lot of duplication, with each architecture tending to do
11initialisation slightly differently. To address this, a new 'generic board
12init' feature was introduced in March 2013 (further motivation is
13provided in the cover letter below).
14
15All boards and architectures have moved to this as of mid 2016.
16
17
18What has changed?
19-----------------
20
21The main change is that the arch/<arch>/lib/board.c file is removed in
22favour of common/board_f.c (for pre-relocation init) and common/board_r.c
23(for post-relocation init).
24
25Related to this, the global_data and bd_t structures now have a core set of
26fields which are common to all architectures. Architecture-specific fields
27have been moved to separate structures.
28
29
30Further Background
31------------------
32
33The full text of the original generic board series is reproduced below.
34
35--8<-------------
36
37This series creates a generic board.c implementation which contains
38the essential functions of the major arch/xxx/lib/board.c files.
39
40What is the motivation for this change?
41
421. There is a lot of repeated code in the board.c files. Any change to
43things like setting up the baud rate requires a change in 10 separate
44places.
45
462. Since there are 10 separate files, adding a new feature which requires
47initialisation is painful since it must be independently added in 10
48places.
49
503. As time goes by the architectures naturally diverge since there is limited
51pressure to compare features or even CONFIG options against similar things
52in other board.c files.
53
544. New architectures must implement all the features all over again, and
55sometimes in subtle different ways. This places an unfair burden on getting
56a new architecture fully functional and running with U-Boot.
57
585. While it is a bit of a tricky change, I believe it is worthwhile and
59achievable. There is no requirement that all code be common, only that
60the code that is common should be located in common/board.c rather than
61arch/xxx/lib/board.c.
62
63All the functions of board_init_f() and board_init_r() are broken into
64separate function calls so that they can easily be included or excluded
65for a particular architecture. It also makes it easier to adopt Graeme's
66initcall proposal when it is ready.
67
68http://lists.denx.de/pipermail/u-boot/2012-January/114499.html
69
70This series removes the dependency on generic relocation. So relocation
71happens as one big chunk and is still completely arch-specific. See the
72relocation series for a proposed solution to this for ARM:
73
74http://lists.denx.de/pipermail/u-boot/2011-December/112928.html
75
76or Graeme's recent x86 series v2:
77
78http://lists.denx.de/pipermail/u-boot/2012-January/114467.html
79
80Instead of moving over a whole architecture, this series takes the approach
81of simply enabling generic board support for an architecture. It is then up
82to each board to opt in by defining CONFIG_SYS_GENERIC_BOARD in the board
83config file. If this is not done, then the code will be generated as
84before. This allows both sets of code to co-exist until we are comfortable
85with the generic approach, and enough boards run.
86
87ARM is a relatively large board.c file and one which I can test, therefore
88I think it is a good target for this series. On the other hand, x86 is
89relatively small and simple, but different enough that it introduces a
90few issues to be solved. So I have chosen both ARM and x86 for this series.
91After a suggestion from Wolfgang I have added PPC also. This is the
92largest and most feature-full board, so hopefully we have all bases
93covered in this RFC.
94
95A generic global_data structure is also required. This might upset a few
96people. Here is my basic reasoning: most fields are the same, all
97architectures include and need it, most global_data.h files already have
98#ifdefs to select fields for a particular SOC, so it is hard to
99see why architecures are different in this area. We can perhaps add a
100way to put architecture-specific fields into a separate header file, but
101for now I have judged that to be counter-productive.
102
103Similarly we need a generic bd_info structure, since generic code will
104be accessing it. I have done this in the same way as global_data and the
105same comments apply.
106
107There was dicussion on the list about passing gd_t around as a parameter
108to pre-relocation init functions. I think this makes sense, but it can
109be done as a separate change, and this series does not require it.
110
111While this series needs to stand on its own (as with the link script
112cleanup series and the generic relocation series) the goal is the
113unification of the board init code. So I hope we can address issues with
114this in mind, rather than focusing too narrowly on particular ARM, x86 or
115PPC issues.
116
117I have run-tested ARM on Tegra Seaboard only. To try it out, define
118CONFIG_SYS_GENERIC_BOARD in your board file and rebuild. Most likely on
119x86 and PPC at least it will hang, but if you are lucky it will print
120something first :-)
121
122I have run this though MAKEALL with CONFIG_SYS_GENERIC_BOARD on for all
123ARM, PPC and x86 boards. There are a few failures due to errors in
124the board config, which I have sent patches for. The main issue is
125just the difference between __bss_end and __bss_end__.
126
127Note: the first group of commits are required for this series to build,
128but could be separated out if required. I have included them here for
129convenience.
130
131------------->8--
132
133Simon Glass, sjg@chromium.org
134March 2014
135Updated after final removal, May 2016
136

README.generic_usb_ohci

1Notes on the the generic USB-OHCI driver
2========================================
3
4This driver (drivers/usb/usb_ohci.[ch]) is the result of the merge of
5various existing OHCI drivers that were basically identical beside
6cpu/board dependant initalization. This initalization has been moved
7into cpu/board directories and are called via the hooks below.
8
9Configuration options
10----------------------
11
12	CONFIG_USB_OHCI_NEW: enable the new OHCI driver
13
14	CONFIG_SYS_USB_OHCI_BOARD_INIT: call the board dependant hooks:
15
16		  - extern int board_usb_init(void);
17		  - extern int usb_board_stop(void);
18		  - extern int usb_cpu_init_fail(void);
19
20	CONFIG_SYS_USB_OHCI_CPU_INIT: call the cpu dependant hooks:
21
22		  - extern int usb_cpu_init(void);
23		  - extern int usb_cpu_stop(void);
24		  - extern int usb_cpu_init_fail(void);
25
26	CONFIG_SYS_USB_OHCI_REGS_BASE: defines the base address of the OHCI
27				registers
28
29	CONFIG_SYS_USB_OHCI_SLOT_NAME: slot name
30
31	CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS: maximal number of ports of the
32				     root hub.
33
34
35Endianness issues
36------------------
37
38The USB bus operates in little endian, but unfortunately there are
39OHCI controllers that operate in big endian such as ppc4xx. For these the
40config option
41
42	CONFIG_SYS_OHCI_BE_CONTROLLER
43
44needs to be defined.
45
46
47PCI Controllers
48----------------
49
50You'll need to define
51
52	CONFIG_PCI_OHCI
53
54If you have several USB PCI controllers, define
55
56	CONFIG_PCI_OHCI_DEVNO: number of the OHCI device in PCI list
57
58If undefined, the first instance found in PCI space will be used.
59
60PCI Controllers need to do byte swapping on register accesses, so they
61should to define:
62
63	CONFIG_SYS_OHCI_SWAP_REG_ACCESS
64

README.gpt

1# SPDX-License-Identifier: GPL-2.0+
2#
3#  Copyright (C) 2012 Samsung Electronics
4#
5#  Lukasz Majewski <l.majewski@samsung.com>
6
7Glossary:
8========
9- UUID -(Universally Unique Identifier)
10- GUID - (Globally Unique ID)
11- EFI - (Extensible Firmware Interface)
12- UEFI - (Unified EFI) - EFI evolution
13- GPT (GUID Partition Table) - it is the EFI standard part
14- partitions - lists of available partitions (defined at u-boot):
15  ./include/configs/{target}.h
16
17Introduction:
18=============
19This document describes the GPT partition table format and usage of
20the gpt command in u-boot.
21
22UUID introduction:
23====================
24
25GPT for marking disks/partitions is using the UUID. It is supposed to be a
26globally unique value. A UUID is a 16-byte (128-bit) number. The number of
27theoretically possible UUIDs is therefore about 3 x 10^38.
28More often UUID is displayed as 32 hexadecimal digits, in 5 groups,
29separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters
30(32 digits and 4 hyphens)
31
32For instance, GUID of Basic data partition: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
33and GUID of Linux filesystem data: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
34
35Historically there are 5 methods to generate this number. The oldest one is
36combining machine's MAC address and timer (epoch) value.
37
38Successive versions are using MD5 hash, random numbers and SHA-1 hash. All major
39OSes and programming languages are providing libraries to compute UUID (e.g.
40uuid command line tool).
41
42GPT brief explanation:
43======================
44
45	Layout:
46	-------
47
48	--------------------------------------------------
49	LBA 0          |Protective MBR                   |
50	----------------------------------------------------------
51	LBA 1          |Primary GPT Header               | Primary
52	-------------------------------------------------- GPT
53	LBA 2          |Entry 1|Entry 2| Entry 3| Entry 4|
54	--------------------------------------------------
55	LBA 3          |Entries 5 - 128                  |
56		       |                                 |
57		       |                                 |
58	----------------------------------------------------------
59	LBA 34         |Partition 1                      |
60		       |                                 |
61		       -----------------------------------
62		       |Partition 2                      |
63		       |                                 |
64		       -----------------------------------
65		       |Partition n                      |
66		       |                                 |
67	----------------------------------------------------------
68	LBA -34        |Entry 1|Entry 2| Entry 3| Entry 4| Backup
69	-------------------------------------------------- GPT
70	LBA -33        |Entries 5 - 128                  |
71		       |                                 |
72		       |                                 |
73	LBA -2         |                                 |
74	--------------------------------------------------
75	LBA -1         |Backup GPT Header                |
76	----------------------------------------------------------
77
78For a legacy reasons, GPT's LBA 0 sector has a MBR structure. It is called
79"protective MBR".
80Its first partition entry ID has 0xEE value, and disk software, which is not
81handling the GPT sees it as a storage device without free space.
82
83It is possible to define 128 linearly placed partition entries.
84
85"LBA -1" means the last addressable block (in the mmc subsystem:
86"dev_desc->lba - 1")
87
88Primary/Backup GPT header:
89----------------------------
90Offset  Size    Description
91
920       8 B     Signature ("EFI PART", 45 46 49 20 50 41 52 54)
938       4 B     Revision (For version 1.0, the value is 00 00 01 00)
9412      4 B     Header size (in bytes, usually 5C 00 00 00 meaning 92 bytes)
9516      4 B     CRC32 of header (0 to header size), with this field zeroed
96		during calculation
9720      4 B     Reserved (ZERO);
9824      8 B     Current LBA (location of this header copy)
9932      8 B     Backup LBA (location of the other header copy)
10040      8 B     First usable LBA for partitions (primary partition table last
101		LBA + 1)
10248      8 B     Last usable LBA (secondary partition table first LBA - 1)
10356      16 B    Disk GUID (also referred as UUID on UNIXes)
10472      8 B     Partition entries starting LBA (always 2 in primary copy)
10580      4 B     Number of partition entries
10684      4 B     Size of a partition entry (usually 128)
10788      4 B     CRC32 of partition array
10892      *       Reserved; must be ZERO (420 bytes for a 512-byte LBA)
109
110TOTAL: 512 B
111
112
113IMPORTANT:
114
115GPT headers and partition entries are protected by CRC32 (the POSIX CRC32).
116
117Primary GPT header and Backup GPT header have swapped values of "Current LBA"
118and "Backup LBA" and therefore different CRC32 check-sum.
119
120CRC32 for GPT headers (field "CRC of header") are calculated up till
121"Header size" (92), NOT 512 bytes.
122
123CRC32 for partition entries (field "CRC32 of partition array") is calculated for
124the whole array entry ( Number_of_partition_entries *
125sizeof(partition_entry_size (usually 128)))
126
127Observe, how Backup GPT is placed in the memory. It is NOT a mirror reflect
128of the Primary.
129
130	   Partition Entry Format:
131	   ----------------------
132	   Offset  Size    Description
133
134	   0       16 B    Partition type GUID (Big Endian)
135	   16      16 B    Unique partition GUID in (Big Endian)
136	   32      8  B    First LBA (Little Endian)
137	   40      8  B    Last LBA (inclusive)
138	   48      8  B    Attribute flags [+]
139	   56      72 B    Partition name (text)
140
141	   Attribute flags:
142	   Bit 0  - System partition
143	   Bit 1  - Hide from EFI
144	   Bit 2  - Legacy BIOS bootable
145	   Bit 48-63 - Defined and used by the individual partition type
146	   For Basic data partition :
147	   Bit 60 - Read-only
148	   Bit 62 - Hidden
149	   Bit 63 - Not mount
150
151Creating GPT partitions in U-Boot:
152==============
153
154To restore GUID partition table one needs to:
1551. Define partition layout in the environment.
156   Format of partitions layout:
157     "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
158	name=kernel,size=60MiB,uuid=...;"
159     or
160     "uuid_disk=${uuid_gpt_disk};name=${uboot_name},
161	size=${uboot_size},uuid=${uboot_uuid};"
162
163   The fields 'name' and 'size' are mandatory for every partition.
164   The field 'start' is optional.
165
166   If field 'size' of the last partition is 0, the partition is extended
167   up to the end of the device.
168
169   The fields 'uuid' and 'uuid_disk' are optional if CONFIG_RANDOM_UUID is
170   enabled. A random uuid will be used if omitted or they point to an empty/
171   non-existent environment variable. The environment variable will be set to
172   the generated UUID.  The 'gpt guid' command reads the current value of the
173   uuid_disk from the GPT.
174
175   The field 'bootable' is optional, it is used to mark the GPT partition
176   bootable (set attribute flags "Legacy BIOS bootable").
177     "name=u-boot,size=60MiB;name=boot,size=60Mib,bootable;name=rootfs,size=0"
178   It can be used to locate bootable disks with command
179   "part list <interface> <dev> -bootable <varname>",
180   please check out doc/README.distro for use.
181
1822. Define 'CONFIG_EFI_PARTITION' and 'CONFIG_CMD_GPT'
183
1843. From u-boot prompt type:
185   gpt write mmc 0 $partitions
186
187Checking (validating) GPT partitions in U-Boot:
188===============================================
189
190Procedure is the same as above. The only change is at point 3.
191
192At u-boot prompt one needs to write:
193   gpt verify mmc 0 [$partitions]
194
195where [$partitions] is an optional parameter.
196
197When it is not provided, only basic checks based on CRC32 calculation for GPT
198header and PTEs are performed.
199When provided, additionally partition data - name, size and starting
200offset (last two in LBA) - are compared with data defined in '$partitions'
201environment variable.
202
203After running this command, return code is set to 0 if no errors found in
204on non-volatile medium stored GPT.
205
206Following line can be used to assess if GPT verification has succeed:
207
208U-BOOT> gpt verify mmc 0 $partitions
209U-BOOT> if test $? = 0; then echo "GPT OK"; else echo "GPT ERR"; fi
210
211Renaming GPT partitions from U-Boot:
212====================================
213
214GPT partition names are a mechanism via which userspace and U-Boot can
215communicate about software updates and boot failure.  The 'gpt guid',
216'gpt read', 'gpt rename' and 'gpt swap' commands facilitate
217programmatic renaming of partitions from bootscripts by generating and
218modifying the partitions layout string.  Here is an illustration of
219employing 'swap' to exchange 'primary' and 'backup' partition names:
220
221U-BOOT> gpt swap mmc 0 primary backup
222
223Afterwards, all partitions previously named 'primary' will be named
224'backup', and vice-versa.  Alternatively, single partitions may be
225renamed.  In this example, mmc0's first partition will be renamed
226'primary':
227
228U-BOOT> gpt rename mmc 0 1 primary
229
230The GPT functionality may be tested with the 'sandbox' board by
231creating a disk image as described under 'Block Device Emulation' in
232board/sandbox/README.sandbox:
233
234=>host bind 0 ./disk.raw
235=> gpt read host 0
236[ . . . ]
237=> gpt swap host 0 name othername
238[ . . . ]
239
240Partition type GUID:
241====================
242
243For created partition, the used partition type GUID is
244PARTITION_BASIC_DATA_GUID (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7).
245
246If you define 'CONFIG_PARTITION_TYPE_GUID', a optionnal parameter 'type'
247can specify a other partition type guid:
248
249     "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
250	name=kernel,size=60MiB,uuid=...,
251	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"
252
253Some strings can be also used at the place of known GUID :
254	"system" = PARTITION_SYSTEM_GUID
255	           (C12A7328-F81F-11D2-BA4B-00A0C93EC93B)
256	"mbr"    = LEGACY_MBR_PARTITION_GUID
257	           (024DEE41-33E7-11D3-9D69-0008C781F39F)
258	"msft"   = PARTITION_MSFT_RESERVED_GUID
259	           (E3C9E316-0B5C-4DB8-817D-F92DF00215AE)
260	"data"   = PARTITION_BASIC_DATA_GUID
261	            (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7)
262	"linux"  = PARTITION_LINUX_FILE_SYSTEM_DATA_GUID
263	           (0FC63DAF-8483-4772-8E79-3D69D8477DE4)
264	"raid"   = PARTITION_LINUX_RAID_GUID
265	           (A19D880F-05FC-4D3B-A006-743F0F84911E)
266	"swap"   = PARTITION_LINUX_SWAP_GUID
267	           (0657FD6D-A4AB-43C4-84E5-0933C84B4F4F)
268	"lvm"    = PARTITION_LINUX_LVM_GUID
269	           (E6D6D379-F507-44C2-A23C-238F2A3DF928)
270
271    "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
272	name=kernel,size=60MiB,uuid=...,type=linux;"
273
274They are also used to display the type of partition in "part list" command.
275
276
277Useful info:
278============
279
280Two programs, namely: 'gdisk' and 'parted' are recommended to work with GPT
281recovery. Both are able to handle GUID partitions.
282Please, pay attention at -l switch for parted.
283
284"uuid" program is recommended to generate UUID string. Moreover it can decode
285(-d switch) passed in UUID string. It can be used to generate partitions UUID
286passed to u-boot environment variables.
287If optional CONFIG_RANDOM_UUID is defined then for any partition which environment
288uuid is unset, uuid is randomly generated and stored in correspond environment
289variable.
290
291note:
292Each string block of UUID generated by program "uuid" is in big endian and it is
293also stored in big endian in disk GPT.
294Partitions layout can be printed by typing "mmc part". Note that each partition
295GUID has different byte order than UUID generated before, this is because first
296three blocks of GUID string are in Little Endian.
297

README.hwconfig

1To enable this feature just define CONFIG_HWCONFIG in your board
2config file.
3
4This implements a simple hwconfig infrastructure: an
5interface for software knobs to control hardware.
6
7This a is very simple implementation, i.e. it is implemented
8via the `hwconfig' environment variable. Later we could write
9some "hwconfig <enable|disable|list>" commands, ncurses
10interface for Award BIOS-like interface, and frame-buffer
11interface for AMI GUI[1] BIOS-like interface with mouse
12support[2].
13
14Current implementation details/limitations:
15
161. Doesn't support options dependencies and mutual exclusion.
17   We can implement this by integrating apt-get[3] into Das
18   U-Boot. But I haven't bothered yet.
19
202. Since we don't implement a hwconfig command, i.e. we're working
21   with the environment directly, there is no way to tell that
22   toggling a particular option will need a reboot to take
23   effect. So, for now it's advised to always reboot the
24   target after modifying the hwconfig variable.
25
263. We support hwconfig options with arguments. For example,
27
28   set hwconfig "dr_usb:mode=peripheral,phy_type=ulpi"
29
30   This selects three hwconfig options:
31   1. dr_usb - enable Dual-Role USB controller;
32   2. dr_usb_mode:peripheral - USB in Function mode;
33   3. dr_usb_phy_type:ulpi - USB should work with ULPI PHYs.
34
35The purpose of this simple implementation is to refine the
36internal API and then we can continue improving the user
37experience by adding more mature interfaces, like a hwconfig
38command with bells and whistles. Or not adding, if we feel
39that the current interface fits people's needs.
40
41[1] http://en.wikipedia.org/wiki/American_Megatrends
42[2] Regarding ncurses and GUI with mouse support -- I'm just
43    kidding.
44[3] The comment regarding apt-get is also a joke, meaning that
45    dependency tracking could be non-trivial. For example, for
46    enabling HW feature X we may need to disable Y, and turn Z
47    into reduced mode (like RMII-only interface for ethernet,
48    no MII).
49
50    It's quite trivial to implement simple cases though.
51

README.i2c

1I2C Bus Arbitration
2===================
3
4While I2C supports multi-master buses this is difficult to get right.
5The implementation on the master side in software is quite complex.
6Clock-stretching and the arbitrary time that an I2C transaction can take
7make it difficult to share the bus fairly in the face of high traffic.
8When one or more masters can be reset independently part-way through a
9transaction it is hard to know the state of the bus.
10
11U-Boot provides a scheme based on two 'claim' GPIOs, one driven by the
12AP (Application Processor, meaning the main CPU) and one driven by the EC
13(Embedded Controller, a small CPU aimed at handling system tasks). With
14these they can communicate and reliably share the bus. This scheme has
15minimal overhead and involves very little code. The scheme can survive
16reboots by either side without difficulty.
17
18Since U-Boot runs on the AP, the terminology used is 'our' claim GPIO,
19meaning the AP's, and 'their' claim GPIO, meaning the EC's. This terminology
20is used by the device tree bindings in Linux also.
21
22The driver is implemented as an I2C mux, as it is in Linux. See
23i2c-arb-gpio-challenge for the implementation.
24
25GPIO lines are shared between the AP and EC to manage the bus. The AP and EC
26each have a 'bus claim' line, which is an output that the other can see.
27
28- AP_CLAIM: output from AP, signalling to the EC that the AP wants the bus
29- EC_CLAIM: output from EC, signalling to the AP that the EC wants the bus
30
31The basic algorithm is to assert your line when you want the bus, then make
32sure that the other side doesn't want it also. A detailed explanation is best
33done with an example.
34
35Let's say the AP wants to claim the bus. It:
36
371. Asserts AP_CLAIM
382. Waits a little bit for the other side to notice (slew time)
393. Checks EC_CLAIM. If this is not asserted, then the AP has the bus, and we
40   are done
414. Otherwise, wait for a few milliseconds (retry time) and see if EC_CLAIM is
42   released
435. If not, back off, release the claim and wait for a few more milliseconds
44  (retry time again)
456. Go back to 1 if things don't look wedged (wait time has expired)
467. Panic. The other side is hung with the CLAIM line set.
47
48The same algorithm applies on the EC.
49
50To release the bus, just de-assert the claim line.
51
52Typical delays are:
53- slew time 10 us
54- retry time 3 ms
55- wait time - 50ms
56
57In general the traffic is fairly light, and in particular the EC wants access
58to the bus quite rarely (maybe every 10s or 30s to check the battery). This
59scheme works very nicely with very low contention. There is only a 10 us
60wait for access to the bus assuming that the other side isn't using it.
61

README.iomux

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2008
4 * Gary Jennejohn, DENX Software Engineering GmbH <garyj@denx.de>
5 */
6
7U-Boot console multiplexing
8===========================
9
10HOW CONSOLE MULTIPLEXING WORKS
11------------------------------
12
13This functionality is controlled with CONFIG_CONSOLE_MUX in the board
14configuration file.
15
16Two new files, common/iomux.c and include/iomux.h, contain the heart
17(iomux_doenv()) of the environment setting implementation.
18
19iomux_doenv() is called in common/cmd_nvedit.c to handle setenv and in
20common/console.c in console_init_r() during bootup to initialize
21stdio_devices[].
22
23A user can use a comma-separated list of devices to set stdin, stdout
24and stderr.  For example: "setenv stdin serial,nc".  NOTE: No spaces
25are allowed around the comma(s)!
26
27The length of the list is limited by malloc(), since the array used
28is allocated and freed dynamically.
29
30It should be possible to specify any device which console_assign()
31finds acceptable, but the code has only been tested with serial and
32nc.
33
34iomux_doenv() prevents multiple use of the same device, e.g. "setenv
35stdin nc,nc,serial" will discard the second nc.  iomux_doenv() is
36not able to modify the environment, however, so that "pri stdin" still
37shows "nc,nc,serial".
38
39The major change in common/console.c was to modify fgetc() to call
40the iomux_tstc() routine in a for-loop.  iomux_tstc() in turn calls
41the tstc() routine for every registered device, but exits immediately
42when one of them returns true.  fgetc() then calls iomux_getc(),
43which calls the corresponding getc() routine.  fgetc() hangs in
44the for-loop until iomux_tstc() returns true and the input can be
45retrieved.
46
47Thus, a user can type into any device registered for stdin.  No effort
48has been made to demulitplex simultaneous input from multiple stdin
49devices.
50
51fputc() and fputs() have been modified to call iomux_putc() and
52iomux_puts() respectively, which call the corresponding output
53routines for every registered device.
54
55Thus, a user can see the ouput for any device registered for stdout
56or stderr on all devices registered for stdout or stderr.  As an
57example, if stdin=serial,nc and stdout=serial,nc then all output
58for serial, e.g. echos of input on serial, will appear on serial and nc.
59
60Just as with the old console code, this statement is still true:
61If not defined in the environment, the first input device is assigned
62to the 'stdin' file, the first output one to 'stdout' and 'stderr'.
63
64If CONFIG_SYS_CONSOLE_IS_IN_ENV is defined then multiple input/output
65devices can be set at boot time if defined in the environment.
66
67CAVEATS
68-------
69
70Note that common/iomux.c calls console_assign() for every registered
71device as it is discovered.  This means that the environment settings
72for application consoles will be set to the last device in the list.
73
74On a slow machine, such as MPC852T clocked at 66MHz, the overhead associated
75with calling tstc() and then getc() means that copy&paste will normally not
76work, even when stdin=stdout=stderr=serial.
77On a faster machine, such as a sequoia, cut&paste of longer (about 80
78characters) lines works fine when serial is the only device used.
79
80Using nc as a stdin device results in even more overhead because nc_tstc()
81is quite slow.  Even on a sequoia cut&paste does not work on the serial
82interface when nc is added to stdin, although there is no character loss using
83the ethernet interface for input. In this test case stdin=serial,nc and
84stdout=serial.
85
86In addition, the overhead associated with sending to two devices, when one of
87them is nc, also causes problems.  Even on a sequoia cut&paste does not work
88on the serial interface (stdin=serial) when nc is added to stdout (stdout=
89serial,nc).
90

README.iscsi

1# iSCSI booting with U-Boot and iPXE
2
3## Motivation
4
5U-Boot has only a reduced set of supported network protocols. The focus for
6network booting has been on UDP based protocols. A TCP stack and HTTP support
7are expected to be integrated in 2018 together with a wget command.
8
9For booting a diskless computer this leaves us with BOOTP or DHCP to get the
10address of a boot script. TFTP or NFS can be used to load the boot script, the
11operating system kernel and the initial file system (initrd).
12
13These protocols are insecure. The client cannot validate the authenticity
14of the contacted servers. And the server cannot verify the identity of the
15client.
16
17Furthermore the services providing the operating system loader or kernel are
18not the ones that the operating system typically will use. Especially in a SAN
19environment this makes updating the operating system a hassle. After installing
20a new kernel version the boot files have to be copied to the TFTP server
21directory.
22
23The HTTPS protocol provides certificate based validation of servers. Sensitive
24data like passwords can be securely transmitted.
25
26The iSCSI protocol is used for connecting storage attached networks. It
27provides mutual authentication using the CHAP protocol. It typically runs on
28a TCP transport.
29
30Thus a better solution than DHCP/TFTP/NFS boot would be to load a boot script
31via HTTPS and to download any other files needed for booting via iSCSI from the
32same target where the operating system is installed.
33
34An alternative to implementing these protocols in U-Boot is to use an existing
35software that can run on top of U-Boot. iPXE[1] is the "swiss army knife" of
36network booting. It supports both HTTPS and iSCSI. It has a scripting engine for
37fine grained control of the boot process and can provide a command shell.
38
39iPXE can be built as an EFI application (named snp.efi) which can be loaded and
40run by U-Boot.
41
42## Boot sequence
43
44U-Boot loads the EFI application iPXE snp.efi using the bootefi command. This
45application has network access via the simple network protocol offered by
46U-Boot.
47
48iPXE executes its internal script. This script may optionally chain load a
49secondary boot script via HTTPS or open a shell.
50
51For the further boot process iPXE connects to the iSCSI server. This includes
52the mutual authentication using the CHAP protocol. After the authentication iPXE
53has access to the iSCSI targets.
54
55For a selected iSCSI target iPXE sets up a handle with the block IO protocol. It
56uses the ConnectController boot service of U-Boot to request U-Boot to connect a
57file system driver. U-Boot reads from the iSCSI drive via the block IO protocol
58offered by iPXE. It creates the partition handles and installs the simple file
59protocol. Now iPXE can call the simple file protocol to load GRUB[2]. U-Boot
60uses the block IO protocol offered by iPXE to fulfill the request.
61
62Once GRUB is started it uses the same block IO protocol to load Linux. Via
63the EFI stub Linux is called as an EFI application::
64
65                  +--------+         +--------+
66                  |        | Runs    |        |
67                  | U-Boot |========>| iPXE   |
68                  | EFI    |         | snp.efi|
69    +--------+    |        | DHCP    |        |
70    |        |<===|********|<========|        |
71    | DHCP   |    |        | Get IP  |        |
72    | Server |    |        | Address |        |
73    |        |===>|********|========>|        |
74    +--------+    |        | Response|        |
75                  |        |         |        |
76                  |        |         |        |
77    +--------+    |        | HTTPS   |        |
78    |        |<===|********|<========|        |
79    | HTTPS  |    |        | Load    |        |
80    | Server |    |        | Script  |        |
81    |        |===>|********|========>|        |
82    +--------+    |        |         |        |
83                  |        |         |        |
84                  |        |         |        |
85    +--------+    |        | iSCSI   |        |
86    |        |<===|********|<========|        |
87    | iSCSI  |    |        | Auth    |        |
88    | Server |===>|********|========>|        |
89    |        |    |        |         |        |
90    |        |    |        | Loads   |        |
91    |        |<===|********|<========|        |       +--------+
92    |        |    |        | GRUB    |        | Runs  |        |
93    |        |===>|********|========>|        |======>| GRUB   |
94    |        |    |        |         |        |       |        |
95    |        |    |        |         |        |       |        |
96    |        |    |        |         |        | Loads |        |
97    |        |<===|********|<========|********|<======|        |      +--------+
98    |        |    |        |         |        | Linux |        | Runs |        |
99    |        |===>|********|========>|********|======>|        |=====>| Linux  |
100    |        |    |        |         |        |       |        |      |        |
101    +--------+    +--------+         +--------+       +--------+      |        |
102                                                                      |        |
103                                                                      |        |
104                                                                      | ~ ~ ~ ~|
105
106## Security
107
108The iSCSI protocol is not encrypted. The traffic could be secured using IPsec
109but neither U-Boot nor iPXE does support this. So we should at least separate
110the iSCSI traffic from all other network traffic. This can be achieved using a
111virtual local area network (VLAN).
112
113## Configuration
114
115### iPXE
116
117For running iPXE on arm64 the bin-arm64-efi/snp.efi build target is needed::
118
119    git clone http://git.ipxe.org/ipxe.git
120    cd ipxe/src
121    make bin-arm64-efi/snp.efi -j6 EMBED=myscript.ipxe
122
123The available commands for the boot script are documented at:
124
125http://ipxe.org/cmd
126
127Credentials are managed as environment variables. These are described here:
128
129http://ipxe.org/cfg
130
131iPXE by default will put the CPU to rest when waiting for input. U-Boot does
132not wake it up due to missing interrupt support. To avoid this behavior create
133file src/config/local/nap.h::
134
135    /* nap.h */
136    #undef NAP_EFIX86
137    #undef NAP_EFIARM
138    #define NAP_NULL
139
140The supported commands in iPXE are controlled by an include, too. Putting the
141following into src/config/local/general.h is sufficient for most use cases::
142
143    /* general.h */
144    #define NSLOOKUP_CMD            /* Name resolution command */
145    #define PING_CMD                /* Ping command */
146    #define NTP_CMD                 /* NTP commands */
147    #define VLAN_CMD                /* VLAN commands */
148    #define IMAGE_EFI               /* EFI image support */
149    #define DOWNLOAD_PROTO_HTTPS    /* Secure Hypertext Transfer Protocol */
150    #define DOWNLOAD_PROTO_FTP      /* File Transfer Protocol */
151    #define DOWNLOAD_PROTO_NFS      /* Network File System Protocol */
152    #define DOWNLOAD_PROTO_FILE     /* Local file system access */
153
154### Open-iSCSI
155
156When the root file system is on an iSCSI drive you should disable pings and set
157the replacement timer to a high value [3]:
158
159    node.conn[0].timeo.noop_out_interval = 0
160    node.conn[0].timeo.noop_out_timeout = 0
161    node.session.timeo.replacement_timeout = 86400
162
163## Links
164
165* [1](https://ipxe.org) https://ipxe.org - iPXE open source boot firmware
166* [2](https://www.gnu.org/software/grub/) https://www.gnu.org/software/grub/ -
167     GNU GRUB (Grand Unified Bootloader)
168* [3](https://github.com/open-iscsi/open-iscsi/blob/master/README)
169     https://github.com/open-iscsi/open-iscsi/blob/master/README -
170     Open-iSCSI README
171

README.kconfig

1Kconfig in U-Boot
2=================
3
4This document describes the configuration infrastructure of U-Boot.
5
6The conventional configuration was replaced by Kconfig at v2014.10-rc1 release.
7
8
9Language Specification
10----------------------
11
12Kconfig originates in Linux Kernel.
13See the file "Documentation/kbuild/kconfig*.txt" in your Linux Kernel
14source directory for a basic specification of Kconfig.
15
16
17Difference from Linux's Kconfig
18-------------------------------
19
20Here are some worth-mentioning configuration targets.
21
22- silentoldconfig
23
24  This target updates .config, include/generated/autoconf.h and
25  include/configs/* as in Linux.  In U-Boot, it also does the following
26  for the compatibility with the old configuration system:
27
28   * create a symbolic link "arch/${ARCH}/include/asm/arch" pointing to
29     the SoC/CPU specific header directory
30   * create include/config.h
31   * create include/autoconf.mk
32   * create spl/include/autoconf.mk (SPL and TPL only)
33   * create tpl/include/autoconf.mk (TPL only)
34
35   If we could completely switch to Kconfig in a long run
36   (i.e. remove all the include/configs/*.h), those additional processings
37   above would be removed.
38
39- defconfig
40
41  In U-Boot, "make defconfig" is a shorthand of "make sandbox_defconfig"
42
43- <board>_defconfig
44
45  Now it works as in Linux.
46  The prefixes such as "+S:" in *_defconfig are deprecated.
47  You can simply remove the prefixes.  Do not add them for new boards.
48
49- <board>_config
50
51  This does not exist in Linux's Kconfig.
52  "make <board>_config" works the same as "make <board>_defconfig".
53  Prior to Kconfig, in U-Boot, "make <board>_config" was used for the
54  configuration.  It is still supported for backward compatibility, so
55  we do not need to update the distro recipes.
56
57
58The other configuration targets work as in Linux Kernel.
59
60
61Migration steps to Kconfig
62--------------------------
63
64Prior to Kconfig, the C preprocessor based board configuration had been used
65in U-Boot.
66
67Although Kconfig was introduced and some configs have been moved to Kconfig,
68many of configs are still defined in C header files.  It will take a very
69long term to move all of them to Kconfig.  In the interim, the two different
70configuration infrastructures should coexist.
71The configuration files are generated by both Kconfig and the old preprocessor
72based configuration as follows:
73
74Configuration files for use in C sources
75  - include/generated/autoconf.h     (generated by Kconfig for Normal)
76  - include/configs/<board>.h        (exists for all boards)
77
78Configuration file for use in makefiles
79  - include/config/auto.conf         (generated by Kconfig)
80  - include/autoconf.mk              (generated by the old config for Normal)
81  - spl/include/autoconfig.mk        (generated by the old config for SPL)
82  - tpl/include/autoconfig.mk        (generated by the old config for TPL)
83
84When adding a new CONFIG macro, it is highly recommended to add it to Kconfig
85rather than to a header file.
86
87
88Conversion from boards.cfg to Kconfig
89-------------------------------------
90
91Prior to Kconfig, boards.cfg was a primary database that contained Arch, CPU,
92SoC, etc. of all the supported boards.  It was deleted when switching to
93Kconfig.  Each field of boards.cfg was converted as follows:
94
95 Status      ->  "S:" entry of MAINTAINERS
96 Arch        ->  CONFIG_SYS_ARCH defined by Kconfig
97 CPU         ->  CONFIG_SYS_CPU defined by Kconfig
98 SoC         ->  CONFIG_SYS_SOC defined by Kconfig
99 Vendor      ->  CONFIG_SYS_VENDOR defined by Kconfig
100 Board       ->  CONFIG_SYS_BOARD defined by Kconfig
101 Target      ->  File name of defconfig (configs/<target>_defconfig)
102 Options     ->  CONFIG_SYS_EXTRA_OPTIONS defined by Kconfig
103 Maintainers ->  "M:" entry of MAINTAINERS
104
105
106Tips to add/remove boards
107-------------------------
108
109When adding a new board, the following steps are generally needed:
110
111 [1] Add a header file include/configs/<target>.h
112 [2] Make sure to define necessary CONFIG_SYS_* in Kconfig:
113       Define CONFIG_SYS_CPU="cpu" to compile arch/<arch>/cpu/<cpu>
114       Define CONFIG_SYS_SOC="soc" to compile arch/<arch>/cpu/<cpu>/<soc>
115       Define CONFIG_SYS_VENDOR="vendor" to compile board/<vendor>/common/*
116         and board/<vendor>/<board>/*
117       Define CONFIG_SYS_BOARD="board" to compile board/<board>/*
118         (or board/<vendor>/<board>/* if CONFIG_SYS_VENDOR is defined)
119       Define CONFIG_SYS_CONFIG_NAME="target" to include
120         include/configs/<target>.h
121 [3] Add a new entry to the board select menu in Kconfig.
122     The board select menu is located in arch/<arch>/Kconfig or
123     arch/<arch>/*/Kconfig.
124 [4] Add a MAINTAINERS file
125     It is generally placed at board/<board>/MAINTAINERS or
126     board/<vendor>/<board>/MAINTAINERS
127 [5] Add configs/<target>_defconfig
128
129When removing an obsolete board, the following steps are generally needed:
130
131 [1] Remove configs/<target>_defconfig
132 [2] Remove include/configs/<target>.h if it is not used by any other boards
133 [3] Remove board/<vendor>/<board>/* or board/<board>/* if it is not used
134     by any other boards
135 [4] Update MAINTAINERS if necessary
136 [5] Remove the unused entry from the board select menu in Kconfig
137 [6] Add an entry to doc/README.scrapyard
138
139
140TODO
141----
142
143- The option field of boards.cfg, which was used for the pre-Kconfig
144  configuration, moved to CONFIG_SYS_EXTRA_OPTIONS verbatim now.
145  Board maintainers are expected to implement proper Kconfig options
146  and switch over to them.  Eventually CONFIG_SYS_EXTRA_OPTIONS will go away.
147  CONFIG_SYS_EXTRA_OPTIONS should not be used for new boards.
148
149- In the pre-Kconfig, a single board had multiple entries in the boards.cfg
150  file with differences in the option fields.  The corresponding defconfig
151  files were auto-generated when switching to Kconfig.  Now we have too many
152  defconfig files compared with the number of the supported boards.  It is
153  recommended to have only one defconfig per board and allow users to select
154  the config options.
155
156- Move the config macros in header files to Kconfig.  When we move at least
157  macros used in makefiles, we can drop include/autoconfig.mk, which makes
158  the build scripts much simpler.
159

README.kwbimage

1---------------------------------------------
2Kirkwood Boot Image generation using mkimage
3---------------------------------------------
4
5This document describes the U-Boot feature as it
6is implemented for the Kirkwood family of SoCs.
7
8The Kirkwood SoC's can boot directly from NAND FLASH,
9SPI FLASH, SATA etc. using its internal bootRom support.
10
11for more details refer section 24.2 of Kirkwood functional specifications.
12ref: www.marvell.com/products/embedded.../kirkwood/index.jsp
13
14Command syntax:
15--------------
16./tools/mkimage -l <kwboot_file>
17		to list the kwb image file details
18
19./tools/mkimage -n <board specific configuration file> \
20		-T kwbimage -a <start address> -e <execution address> \
21		-d <input_raw_binary> <output_kwboot_file>
22
23for ex.
24./tools/mkimage -n ./board/Marvell/openrd_base/kwbimage.cfg \
25		-T kwbimage -a 0x00600000 -e 0x00600000 \
26		-d u-boot.bin u-boot.kwb
27
28
29kwbimage support available with mkimage utility will generate kirkwood boot
30image that can be flashed on the board NAND/SPI flash.  The make target
31which uses mkimage to produce such an image is "u-boot.kwb".  For example:
32
33  export KBUILD_OUTPUT=/tmp/build
34  make distclean
35  make yourboard_config
36  make u-boot.kwb
37
38
39Board specific configuration file specifications:
40------------------------------------------------
411. This file must present in the $(BOARDDIR).  The default name is
42	kwbimage.cfg.  The name can be set as part of the full path
43	to the file using CONFIG_SYS_KWD_CONFIG (probably in
44	include/configs/<yourboard>.h).   The path should look like:
45	$(CONFIG_BOARDDIR)/<yourkwbimagename>.cfg
462. This file can have empty lines and lines starting with "#" as first
47	character to put comments
483. This file can have configuration command lines as mentioned below,
49	any other information in this file is treated as invalid.
50
51Configuration command line syntax:
52---------------------------------
531. Each command line is must have two strings, first one command or address
54	and second one data string
552. Following are the valid command strings and associated data strings:-
56	Command string		data string
57	--------------		-----------
58	BOOT_FROM		nand/spi/sata
59	NAND_ECC_MODE		default/rs/hamming/disabled
60	NAND_PAGE_SIZE		any uint16_t hex value
61	SATA_PIO_MODE		any uint32_t hex value
62	DDR_INIT_DELAY		any uint32_t hex value
63	DATA			regaddr and regdara hex value
64	you can have maximum 55 such register programming commands
65
663. All commands are optional to program
67
68Typical example of kwimage.cfg file:
69-----------------------------------
70
71# Boot Media configurations
72BOOT_FROM	nand
73NAND_ECC_MODE	default
74NAND_PAGE_SIZE	0x0800
75
76# Configure RGMII-0 interface pad voltage to 1.8V
77DATA 0xFFD100e0 0x1b1b1b9b
78# DRAM Configuration
79DATA 0xFFD01400 0x43000c30
80DATA 0xFFD01404 0x37543000
81DATA 0xFFD01408 0x22125451
82DATA 0xFFD0140C 0x00000a33
83DATA 0xFFD01410 0x000000cc
84DATA 0xFFD01414 0x00000000
85DATA 0xFFD01418 0x00000000
86DATA 0xFFD0141C 0x00000C52
87DATA 0xFFD01420 0x00000040
88DATA 0xFFD01424 0x0000F17F
89DATA 0xFFD01428 0x00085520
90DATA 0xFFD0147C 0x00008552
91DATA 0xFFD01504 0x0FFFFFF1
92DATA 0xFFD01508 0x10000000
93DATA 0xFFD0150C 0x0FFFFFF5
94DATA 0xFFD01514 0x00000000
95DATA 0xFFD0151C 0x00000000
96DATA 0xFFD01494 0x00030000
97DATA 0xFFD01498 0x00000000
98DATA 0xFFD0149C 0x0000E803
99DATA 0xFFD01480 0x00000001
100# End of Header extension
101DATA 0x0 0x0
102
103------------------------------------------------
104Author: Prafulla Wadaskar <prafulla@marvell.com>
105

README.link-local

1------------------------------------------
2 Link-local IP address auto-configuration
3------------------------------------------
4
5Negotiate with other link-local clients on the local network
6for an address that doesn't require explicit configuration.
7This is especially useful if a DHCP server cannot be guaranteed
8to exist in all environments that the device must operate.
9
10This is an implementation of RFC3927.
11
12----------
13 Commands
14----------
15
16When CONFIG_CMD_LINK_LOCAL is defined in the board config file,
17the "linklocal" command is available.  This running this will
18take approximately 5 seconds while the address is negotiated.
19
20------------------------
21 Environment interation
22------------------------
23
24The "llipaddr" variable is set with the most recently
25negotiated address and is preferred in future negotiations.
26
27The "ipaddr", "netmask", and "gatewayip" variables are set
28after successful negotiation to enable network access.
29
30-------------
31 Limitations
32-------------
33
34RFC3927 requires that addresses are continuously checked to
35avoid conflicts, however this can only happen when the net_loop
36is getting called.  It is possible for a conflict to go undetected
37until a command that accesses the network is executed.
38
39Using NetConsole is one way to ensure that net_loop is always
40processing packets and monitoring for conflicts.
41
42This is also not a concern if the feature is use to connect
43directly to another machine that may not be running a DHCP server.
44
45----------------
46 Example script
47----------------
48
49This script allows use of DHCP and/or Link-local controlled
50by env variables.  It depends on CONFIG_CMD_LINK_LOCAL, CONFIG_CMD_DHCP,
51and CONFIG_BOOTP_MAY_FAIL.
52If both fail or are disabled, static settings are used.
53
54#define CONFIG_EXTRA_ENV_SETTINGS \
55	"ipconfigcmd=if test \\\"$dhcpenabled\\\" -ne 0;"		\
56		"then "							\
57			"dhcpfail=0;dhcp || dhcpfail=1;"		\
58		"else "							\
59			"dhcpfail=-1;"					\
60		"fi;"							\
61		"if test \\\"$linklocalenabled\\\" -ne 0 -a "		\
62			"\\\"$dhcpfail\\\" -ne 0;"			\
63		"then "							\
64			"linklocal;"					\
65			"llfail=0;"					\
66		"else "							\
67			"llfail=-1;"					\
68		"fi;"							\
69		"if test \\\"$llfail\\\" -ne 0 -a "			\
70			"\\\"$dhcpfail\\\" -ne 0; "			\
71		"then "							\
72			"setenv ipaddr $sipaddr; "			\
73			"setenv netmask $snetmask; "			\
74			"setenv gatewayip $sgatewayip; "		\
75		"fi;\0"							\
76

README.log

1Logging in U-Boot
2=================
3
4Introduction
5------------
6
7U-Boot's internal operation involves many different steps and actions. From
8setting up the board to displaying a start-up screen to loading an Operating
9System, there are many component parts each with many actions.
10
11Most of the time this internal detail is not useful. Displaying it on the
12console would delay booting (U-Boot's primary purpose) and confuse users.
13
14But for digging into what is happening in a particular area, or for debugging
15a problem it is often useful to see what U-Boot is doing in more detail than
16is visible from the basic console output.
17
18U-Boot's logging feature aims to satisfy this goal for both users and
19developers.
20
21
22Logging levels
23--------------
24
25There are a number logging levels available, in increasing order of verbosity:
26
27   LOGL_EMERG	- Printed before U-Boot halts
28   LOGL_ALERT	- Indicates action must be taken immediate or U-Boot will crash
29   LOGL_CRIT	- Indicates a critical error that will cause boot failure
30   LOGL_ERR	- Indicates an error that may cause boot failure
31   LOGL_WARNING	- Warning about an unexpected condition
32   LOGL_NOTE	- Important information about progress
33   LOGL_INFO	- Information about normal boot progress
34   LOGL_DEBUG	- Debug information (useful for debugging a driver or subsystem)
35   LOGL_DEBUG_CONTENT	- Debug message showing full message content
36   LOGL_DEBUG_IO	- Debug message showing hardware I/O access
37
38
39Logging category
40----------------
41
42Logging can come from a wide variety of places within U-Boot. Each log message
43has a category which is intended to allow messages to be filtered according to
44their source.
45
46The following main categories are defined:
47
48   LOGC_NONE	- Unknown category (e.g. a debug() statement)
49   UCLASS_...	- Related to a particular uclass (e.g. UCLASS_USB)
50   LOGC_ARCH	- Related to architecture-specific code
51   LOGC_BOARD	- Related to board-specific code
52   LOGC_CORE	- Related to core driver-model support
53   LOGC_DT	- Related to device tree control
54   LOGC_EFI	- Related to EFI implementation
55
56
57Enabling logging
58----------------
59
60The following options are used to enable logging at compile time:
61
62   CONFIG_LOG		- Enables the logging system
63   CONFIG_MAX_LOG_LEVEL - Max log level to build (anything higher is compiled
64				out)
65   CONFIG_LOG_CONSOLE	- Enable writing log records to the console
66
67If CONFIG_LOG is not set, then no logging will be available.
68
69The above have SPL versions also, e.g. CONFIG_SPL_MAX_LOG_LEVEL.
70
71
72Temporary logging within a single file
73--------------------------------------
74
75Sometimes it is useful to turn on logging just in one file. You can use this:
76
77   #define LOG_DEBUG
78
79to enable building in of all logging statements in a single file. Put it at
80the top of the file, before any #includes.
81
82To actually get U-Boot to output this you need to also set the default logging
83level - e.g. set CONFIG_LOG_DEFAULT_LEVEL to 7 (LOGL_DEBUG) or more. Otherwise
84debug output is suppressed and will not be generated.
85
86
87Convenience functions
88---------------------
89
90A number of convenience functions are available to shorten the code needed
91for logging:
92
93	log_err(_fmt...)
94	log_warning(_fmt...)
95	log_notice(_fmt...)
96	log_info(_fmt...)
97	log_debug(_fmt...)
98	log_content(_fmt...)
99	log_io(_fmt...)
100
101With these the log level is implicit in the name. The category is set by
102LOG_CATEGORY, which you can only define once per file, above all #includes:
103
104	#define LOG_CATEGORY LOGC_ALLOC
105
106or
107
108	#define LOG_CATEGORY UCLASS_SPI
109
110Remember that all uclasses IDs are log categories too.
111
112
113Log commands
114------------
115
116The 'log' command provides access to several features:
117
118   level - access the default log level
119   format - access the console log format
120   rec - output a log record
121   test - run tests
122
123Type 'help log' for details.
124
125
126Using DEBUG
127-----------
128
129U-Boot has traditionally used a #define called DEBUG to enable debugging on a
130file-by-file basis. The debug() macro compiles to a printf() statement if
131DEBUG is enabled, and an empty statement if not.
132
133With logging enabled, debug() statements are interpreted as logging output
134with a level of LOGL_DEBUG and a category of LOGC_NONE.
135
136The logging facilities are intended to replace DEBUG, but if DEBUG is defined
137at the top of a file, then it takes precedence. This means that debug()
138statements will result in output to the console and this output will not be
139logged.
140
141
142Logging destinations
143--------------------
144
145If logging information goes nowhere then it serves no purpose. U-Boot provides
146several possible determinations for logging information, all of which can be
147enabled or disabled independently:
148
149   console - goes to stdout
150
151
152Log format
153----------
154
155You can control the log format using the 'log format' command. The basic
156format is:
157
158   LEVEL.category,file.c:123-func() message
159
160In the above, file.c:123 is the filename where the log record was generated and
161func() is the function name. By default ('log format default') only the
162function name and message are displayed on the console. You can control which
163fields are present, but not the field order.
164
165
166Filters
167-------
168
169Filters are attached to log drivers to control what those drivers emit. Only
170records that pass through the filter make it to the driver.
171
172Filters can be based on several criteria:
173
174   - maximum log level
175   - in a set of categories
176   - in a set of files
177
178If no filters are attached to a driver then a default filter is used, which
179limits output to records with a level less than CONFIG_LOG_MAX_LEVEL.
180
181
182Logging statements
183------------------
184
185The main logging function is:
186
187   log(category, level, format_string, ...)
188
189Also debug() and error() will generate log records  - these use LOG_CATEGORY
190as the category, so you should #define this right at the top of the source
191file to ensure the category is correct.
192
193You can also define CONFIG_LOG_ERROR_RETURN to enable the log_ret() macro. This
194can be used whenever your function returns an error value:
195
196   return log_ret(uclass_first_device(UCLASS_MMC, &dev));
197
198This will write a log record when an error code is detected (a value < 0). This
199can make it easier to trace errors that are generated deep in the call stack.
200
201
202Code size
203---------
204
205Code size impact depends largely on what is enabled. The following numbers are
206generated by 'buildman -S' for snow, which is a Thumb-2 board (all units in
207bytes):
208
209This series: adds bss +20.0 data +4.0 rodata +4.0 text +44.0
210CONFIG_LOG: bss -52.0 data +92.0 rodata -635.0 text +1048.0
211CONFIG_LOG_MAX_LEVEL=7: bss +188.0 data +4.0 rodata +49183.0 text +98124.0
212
213The last option turns every debug() statement into a logging call, which
214bloats the code hugely. The advantage is that it is then possible to enable
215all logging within U-Boot.
216
217
218To Do
219-----
220
221There are lots of useful additions that could be made. None of the below is
222implemented! If you do one, please add a test in test/py/tests/test_log.py
223
224Convenience functions to support setting the category:
225
226   log_arch(level, format_string, ...) - category LOGC_ARCH
227   log_board(level, format_string, ...) - category LOGC_BOARD
228   log_core(level, format_string, ...) - category LOGC_CORE
229   log_dt(level, format_string, ...) - category LOGC_DT
230
231More logging destinations:
232
233   device - goes to a device (e.g. serial)
234   buffer - recorded in a memory buffer
235
236Convert debug() statements in the code to log() statements
237
238Support making printf() emit log statements a L_INFO level
239
240Convert error() statements in the code to log() statements
241
242Figure out what to do with BUG(), BUG_ON() and warn_non_spl()
243
244Figure out what to do with assert()
245
246Add a way to browse log records
247
248Add a way to record log records for browsing using an external tool
249
250Add commands to add and remove filters
251
252Add commands to add and remove log devices
253
254Allow sharing of printf format strings in log records to reduce storage size
255for large numbers of log records
256
257Add a command-line option to sandbox to set the default logging level
258
259Convert core driver model code to use logging
260
261Convert uclasses to use logging with the correct category
262
263Consider making log() calls emit an automatic newline, perhaps with a logn()
264   function to avoid that
265
266Passing log records through to linux (e.g. via device tree /chosen)
267
268Provide a command to access the number of log records generated, and the
269number dropped due to them being generated before the log system was ready.
270
271Add a printf() format string pragma so that log statements are checked properly
272
273Enhance the log console driver to show level / category / file / line
274information
275
276Add a command to add new log records and delete existing records.
277
278Provide additional log() functions - e.g. logc() to specify the category
279
280--
281Simon Glass <sjg@chromium.org>
28215-Sep-17
283

README.lynxkdi

1			   LYNX KDI SUPPORT
2
3		    Last Update: July 20, 2003
4=======================================================================
5
6This file describes support for LynuxWorks KDI within U-Boot. Support
7is enabled by defining CONFIG_LYNXKDI.
8
9
10LYNXOS AND BLUECAT SUPPORTED
11============================
12Both LynxOS and BlueCat linux KDIs are supported. The implementation
13automatically detects which is being booted. When you use mkimage
14you should specify "lynxos" for both (see target-specific notes).
15
16
17SUPPORTED ARCHITECTURE/TARGETS
18==============================
19The following targets have been tested:
20
21-PowerPC  MPC8260ADS
22
23
24FILES TO LOOK AT
25================
26include/lynxkdi.h    -defines a simple struct passed to a kdi.
27common/lynxkdi.c     -implements the call to the kdi.
28common/cmd_bootm.c   -top-level command implementation ("bootm").
29
30
31====================================================================
32TARGET SPECIFIC NOTES
33====================================================================
34
35MPC8260ADS
36===========
37The default LynxOS and BlueCat implementations require some
38modifications to the config file.
39
40Edit include/configs/MPC8260ADS.h to use the following:
41
42#define CONFIG_SYS_IMMR	0xFA200000
43#define CONFIG_SYS_BCSR	0xFA100000
44#define CONFIG_SYS_BR1_PRELIM	0xFA101801
45
46When creating a LynxOS or BlueCat u-boot image using mkimage,
47you must specify the following:
48
49Both:    -A ppc -O lynxos -T kernel -C none
50LynxOS:  -a 0x00004000 -e 0x00004020
51BlueCat: -a 0x00500000 -e 0x00507000
52
53To pass the MAC address to BlueCat you should define the
54"fcc2_ether_addr" parameter in the "bootargs" environment
55variable. E.g.:
56
57==> setenv bootargs fcc2_ether_addr=00:11:22:33:44:55:66
58

README.m54418twr

1Freescale MCF54418TWR ColdFire Development Board
2================================================
3
4TsiChung Liew(Tsi-Chung.Liew@freescale.com)
5Created Mar 22, 2012
6===========================================
7
8
9Changed files:
10==============
11
12- board/freescale/m54418twr/m54418twr.c	Dram setup
13- board/freescale/m54418twr/Makefile	Makefile
14- board/freescale/m54418twr/config.mk	config make
15- board/freescale/m54418twr/u-boot.lds	Linker description
16- board/freescale/m54418twr/sbf_dram_init.S
17                                        DDR/SDRAM initialization
18
19- arch/m68k/cpu/mcf5445x/cpu.c		cpu specific code
20- arch/m68k/cpu/mcf5445x/cpu_init.c	Flexbus ChipSelect, Mux pins setup, icache and RTC extra regs
21- arch/m68k/cpu/mcf5445x/interrupts.c	cpu specific interrupt support
22- arch/m68k/cpu/mcf5445x/speed.c	system, pci, flexbus, and cpu clock
23- arch/m68k/cpu/mcf5445x/Makefile	Makefile
24- arch/m68k/cpu/mcf5445x/config.mk	config make
25- arch/m68k/cpu/mcf5445x/start.S	start up assembly code
26
27- doc/README.m54418twr			This readme file
28
29- drivers/net/mcffec.c			ColdFire common FEC driver
30- drivers/net/mcfmii.c			ColdFire common MII driver
31- drivers/serial/mcfuart.c		ColdFire common UART driver
32
33- arch/m68k/include/asm/bitops.h	Bit operation function export
34- arch/m68k/include/asm/byteorder.h	Byte order functions
35- arch/m68k/include/asm/fec.h		FEC structure and definition
36- arch/m68k/include/asm/global_data.h	Global data structure
37- arch/m68k/include/asm/immap.h		ColdFire specific header file and driver macros
38- arch/m68k/include/asm/immap_5441x.h	mcf5441x specific header file
39- arch/m68k/include/asm/io.h		io functions
40- arch/m68k/include/asm/m5441x.h	mcf5441x specific header file
41- arch/m68k/include/asm/posix_types.h	Posix
42- arch/m68k/include/asm/processor.h	header file
43- arch/m68k/include/asm/ptrace.h	Exception structure
44- arch/m68k/include/asm/rtc.h		Realtime clock header file
45- arch/m68k/include/asm/string.h	String function export
46- arch/m68k/include/asm/timer.h		Timer structure and definition
47- arch/m68k/include/asm/types.h		Data types definition
48- arch/m68k/include/asm/uart.h		Uart structure and definition
49- arch/m68k/include/asm/u-boot.h	u-boot structure
50
51- include/configs/M54418TWR.h		Board specific configuration file
52
53- arch/m68k/lib/board.c			board init function
54- arch/m68k/lib/cache.c
55- arch/m68k/lib/interrupts.c		Coldfire common interrupt functions
56- arch/m68k/lib/time.c			Timer functions (Dma timer and PIT)
57- arch/m68k/lib/traps.c			Exception init code
58
591 MCF5441x specific Options/Settings
60====================================
611.1 pre-loader is no longer suppoer in thie coldfire family
62
631.2 Configuration settings for M54418TWR Development Board
64CONFIG_MCF5441x			-- define for all MCF5441x CPUs
65CONFIG_M54418			-- define for all Freescale MCF54418 CPUs
66
67CONFIG_MCFUART			-- define to use common CF Uart driver
68CONFIG_SYS_UART_PORT		-- define UART port number, start with 0, 1 and 2
69CONFIG_BAUDRATE			-- define UART baudrate
70
71CONFIG_MCFFEC			-- define to use common CF FEC driver
72CONFIG_MII			-- enable to use MII driver
73CONFIG_SYS_DISCOVER_PHY		-- enable PHY discovery
74CONFIG_SYS_RX_ETH_BUFFER	-- Set FEC Receive buffer
75CONFIG_SYS_FAULT_ECHO_LINK_DOWN	--
76CONFIG_SYS_FEC0_PINMUX		-- Set FEC0 Pin configuration
77CONFIG_SYS_FEC1_PINMUX		-- Set FEC1 Pin configuration
78CONFIG_SYS_FEC0_MIIBASE		-- Set FEC0 MII base register
79CONFIG_SYS_FEC1_MIIBASE		-- Set FEC0 MII base register
80MCFFEC_TOUT_LOOP		-- set FEC timeout loop
81CONFIG_HAS_ETH1			-- define to enable second FEC in u-boot
82
83CONFIG_MCFTMR			-- define to use DMA timer
84
85CONFIG_SYS_IMMR			-- define for MBAR offset
86
87CONFIG_EXTRA_CLOCK		-- Enable extra clock such as vco, flexbus, pci, etc
88
89CONFIG_SYS_MBAR			-- define MBAR offset
90
91CONFIG_MONITOR_IS_IN_RAM 	-- Not support
92
93CONFIG_SYS_INIT_RAM_ADDR	-- defines the base address of the MCF54455 internal SRAM
94
95CONFIG_SYS_CSn_BASE		-- defines the Chip Select Base register
96CONFIG_SYS_CSn_MASK		-- defines the Chip Select Mask register
97CONFIG_SYS_CSn_CTRL		-- defines the Chip Select Control register
98
99CONFIG_SYS_SDRAM_BASE		-- defines the DRAM Base
100
1012. MEMORY MAP UNDER U-BOOT AND LINUX KERNEL
102===========================================
1032.1. System memory map:
104	MRAM:		0x00000000-0x0003FFFF (256KB)
105	DDR:		0x40000000-0x47FFFFFF (128MB)
106	SRAM:		0x80000000-0x8000FFFF (64KB)
107	IP:		0xE0000000-0xFFFFFFFF (512MB)
108
1093. COMPILATION
110==============
1113.1	To create U-Boot the gcc-4.x compiler set (ColdFire ELF version)
112from codesourcery.com was used. Download it from:
113http://www.codesourcery.com/gnu_toolchains/coldfire/download.html
114
1153.2 Compilation
116   export CROSS_COMPILE=cross-compile-prefix
117   cd u-boot
118   make distclean
119   make M54418TWR_config, or			- default to spi serial flash boot, 50Mhz input clock
120   make M54418TWR_nand_mii_config, or		- default to nand flash boot, mii mode, 25Mhz input clock
121   make M54418TWR_nand_rmii_config, or		- default to nand flash boot, rmii mode, 50Mhz input clock
122   make M54418TWR_nand_rmii_lowfreq_config, or	- default to nand flash boot, rmii mode, 50Mhz input clock
123   make M54418TWR_serial_mii_config, or		- default to spi serial flash boot, 25Mhz input clock
124   make M54418TWR_serial_rmii_config, or	- default to spi serial flash boot, 50Mhz input clock
125   make
126
1274. SCREEN DUMP
128==============
1294.1 M54418TWR Development board
130    Boot from NAND flash (NOTE: May not show exactly the same)
131
132U-Boot 2012.10-00209-g12ae1d8-dirty (Oct 18 2012 - 15:54:54)
133
134CPU:   Freescale MCF54418 (Mask:a3 Version:1)
135       CPU CLK 250 MHz BUS CLK 125 MHz FLB CLK 125 MHz
136       INP CLK 50 MHz VCO CLK 500 MHz
137Board: Freescale MCF54418 Tower System
138SPI:   ready
139DRAM:  128 MiB
140NAND:  256 MiB
141In:    serial
142Out:   serial
143Err:   serial
144Net:   FEC0, FEC1
145-> pri
146baudrate=115200
147bootargs=root=/dev/mtdblock2 rw rootfstype=jffs2 mtdparts=NAND:1M(u-boot)ro,7M(k
148ernel)ro,-(jffs2) console=ttyS0,115200
149bootdelay=2
150eth1addr=00:e0:0c:bc:e5:61
151ethact=FEC0
152ethaddr=00:e0:0c:bc:e5:60
153fileaddr=40010000
154filesize=27354
155gatewayip=192.168.1.1
156hostname=M54418TWR
157inpclk=50000000
158ipaddr=192.168.1.2
159load=tftp ${loadaddr} ${u-boot};
160loadaddr=0x40010000
161mem=129024k
162netdev=eth0
163netmask=255.255.255.0
164prog=nand device 0;nand erase 0 40000;nb_update ${loadaddr} ${filesize};save
165serverip=192.168.1.1
166stderr=serial
167stdin=serial
168stdout=serial
169u-boot=u-boot.bin
170upd=run load; run prog
171
172Environment size: 653/131068 bytes
173-> bdinfo
174memstart    = 0x40000000
175memsize     = 0x08000000
176flashstart  = 0x00000000
177flashsize   = 0x00000000
178flashoffset = 0x00000000
179sramstart   = 0x80000000
180sramsize    = 0x00010000
181mbar        = 0xFC000000
182cpufreq     =    250 MHz
183busfreq     =    125 MHz
184flbfreq     =    125 MHz
185inpfreq     =     50 MHz
186vcofreq     =    500 MHz
187ethaddr     = 00:e0:0c:bc:e5:60
188eth1addr    = 00:e0:0c:bc:e5:61
189ip_addr     = 192.168.1.2
190baudrate    = 115200 bps
191-> help
192?       - alias for 'help'
193base    - print or set address offset
194bdinfo  - print Board Info structure
195boot    - boot default, i.e., run 'bootcmd'
196bootd   - boot default, i.e., run 'bootcmd'
197bootelf - Boot from an ELF image in memory
198bootm   - boot application image from memory
199bootp   - boot image via network using BOOTP/TFTP protocol
200bootvx  - Boot vxWorks from an ELF image
201cmp     - memory compare
202coninfo - print console devices and information
203cp      - memory copy
204crc32   - checksum calculation
205dcache  - enable or disable data cache
206dhcp    - boot image via network using DHCP/TFTP protocol
207echo    - echo args to console
208editenv - edit environment variable
209env     - environment handling commands
210exit    - exit script
211false   - do nothing, unsuccessfully
212go      - start application at address 'addr'
213help    - print command description/usage
214icache  - enable or disable instruction cache
215iminfo  - print header information for application image
216imxtract- extract a part of a multi-image
217itest   - return true/false on integer compare
218loop    - infinite loop on address range
219md      - memory display
220mdio    - MDIO utility commands
221mii     - MII utility commands
222mm      - memory modify (auto-incrementing address)
223mtest   - simple RAM read/write test
224mw      - memory write (fill)
225nand    - NAND sub-system
226nb_update- Nand boot update  program
227nboot   - boot from NAND device
228nfs     - boot image via network using NFS protocol
229nm      - memory modify (constant address)
230ping    - send ICMP ECHO_REQUEST to network host
231printenv- print environment variables
232reginfo - print register information
233reset   - Perform RESET of the CPU
234run     - run commands in an environment variable
235saveenv - save environment variables to persistent storage
236setenv  - set environment variables
237sf      - SPI flash sub-system
238showvar - print local hushshell variables
239sleep   - delay execution for some time
240source  - run script from memory
241sspi    - SPI utility command
242test    - minimal test like /bin/sh
243tftpboot- boot image via network using TFTP protocol
244true    - do nothing, successfully
245version - print monitor, compiler and linker version
246

README.m68k

1
2U-Boot for Motorola (or Freescale/NXP) ColdFire processors
3
4===============================================================================
5History
6
7November 02, 2017	Angelo Dureghello <angelo@sysam.it>
8August   08, 2005	Jens Scharsig <esw@bus-elektronik.de>
9			MCF5282 implementation without preloader
10January  12, 2004	<josef.baumgartner@telex.de>
11===============================================================================
12
13
14This file contains status information for the port of U-Boot to the
15Motorola ColdFire series of CPUs.
16
17
181. Overview
19
20The ColdFire instruction set is "assembly source" compatible but an evolution
21of the original 68000 instruction set. Some not much used instructions has
22been removed. The instructions are only 16, 32, or 48 bits long, a
23simplification compared to the 68000 series.
24
25Bernhard Kuhn ported U-Boot 0.4.0 to the Motorola ColdFire architecture.
26The patches of Bernhard support the MCF5272 and MCF5282. A great disadvantage
27of these patches was that they needed a pre-bootloader to start U-Boot.
28Because of this, a new port was created which no longer needs a first stage
29booter.
30
31Thanks mainly to Freescale but also to several other contributors, U-Boot now
32supports nearly the entire range of ColdFire processors and their related
33development boards.
34
35
362. Supported CPU families
37
38Please "make menuconfig" with ARCH=m68k, or check arch/m68k/cpu to see the
39currently supported processor and families.
40
41
423. Supported boards
43
44U-Boot supports actually more than 40 ColdFire based boards.
45Board configuration can be done trough include/configs/<boardname>.h but the
46current recommended method is to use the new and more friendly approach as
47the "make menuconfig" way, very similar to the Linux way.
48
49To know details as memory map, build targets, default setup, etc, of a
50specific board please check:
51
52include/configs/<boardname>.h
53and/or
54configs/<boardname>_defconfig
55
56It is possible to build all ColdFire boards in a single command-line command,
57from u-boot root directory, as:
58
59./tools/buildman/buildman m68k
60
61
623.1. Build U-Boot for a specific board
63
64A bash script similar to the one below may be used:
65
66#!/bin/bash
67
68export CROSS_COMPILE=/opt/toolchains/m68k/gcc-4.9.0-nolibc/bin/m68k-linux-
69
70board=M5475DFE
71
72make distclean
73make ARCH=m68k ${board}_defconfig
74make ARCH=m68k KBUILD_VERBOSE=1
75
76
774. Adopted toolchains
78
79Please check:
80https://www.denx.de/wiki/U-Boot/ColdFireNotes
81
82
835. ColdFire specific configuration options/settings
84
85
865.1. Configuration to use a pre-loader
87
88If U-Boot should be loaded to RAM and started by a pre-loader
89CONFIG_MONITOR_IS_IN_RAM must be defined. If it is defined the
90initial vector table and basic processor initialization will not
91be compiled in. The start address of U-Boot must be adjusted in
92the boards config header file (CONFIG_SYS_MONITOR_BASE) and Makefile
93(CONFIG_SYS_TEXT_BASE) to the load address.
94
95
965.2 ColdFire CPU specific options/settings
97
98To specify a CPU model, some defines shoudl be used, i.e.:
99
100CONFIG_MCF52x2	-- defined for all MCF52x2 CPUs
101CONFIG_M5272	-- defined for all Motorola MCF5272 CPUs
102
103Other options, generally set inside include/configs/<boardname>.h, they may
104apply to one or more cpu for the ColdFire family:
105
106CONFIG_SYS_MBAR	-- defines the base address of the MCF5272 configuration
107		   registers
108CONFIG_SYS_ENET_BD_BASE
109		-- defines the base address of the FEC buffer descriptors
110CONFIG_SYS_SCR	-- defines the contents of the System Configuration Register
111CONFIG_SYS_SPR	-- defines the contents of the System Protection Register
112CONFIG_SYS_MFD	-- defines the PLL Multiplication Factor Divider
113		   (see table 9-4 of MCF user manual)
114CONFIG_SYS_RFD	-- defines the PLL Reduce Frequency Devider
115		   (see table 9-4 of MCF user manual)
116CONFIG_SYS_CSx_BASE
117		-- defines the base address of chip select x
118CONFIG_SYS_CSx_SIZE
119		-- defines the memory size (address range) of chip select x
120CONFIG_SYS_CSx_WIDTH
121		-- defines the bus with of chip select x
122CONFIG_SYS_CSx_MASK
123		-- defines the mask for the related chip select x
124CONFIG_SYS_CSx_RO
125		-- if set to 0 chip select x is read/write else chip select
126		   is read only
127CONFIG_SYS_CSx_WS
128		-- defines the number of wait states  of chip select x
129CONFIG_SYS_CACHE_ICACR
130CONFIG_SYS_CACHE_DCACR
131CONFIG_SYS_CACHE_ACRX
132		-- cache-related registers config
133CONFIG_SYS_SDRAM_BASE
134CONFIG_SYS_SDRAM_SIZE
135CONFIG_SYS_SDRAM_BASEX
136CONFIG_SYS_SDRAM_CFG1
137CONFIG_SYS_SDRAM_CFG2
138CONFIG_SYS_SDRAM_CTRL
139CONFIG_SYS_SDRAM_MODE
140CONFIG_SYS_SDRAM_EMOD
141		-- SDRAM config for SDRAM controller-specific registers, please
142		   see arch/m68k/cpu/<specific_cpu>/start.S files to see how
143		   these options are used.
144CONFIG_MCFUART
145		-- defines enabling of ColdFire UART driver
146CONFIG_SYS_UART_PORT
147		-- defines the UART port to be used (only a single UART can be
148		   actually enabled)
149CONFIG_SYS_SBFHDR_SIZE
150		-- size of the prepended SBF header, if any
151

README.malta

1MIPS Malta board
2
3How to flash using a MIPS Navigator Probe:
4
5  - Ensure that your Malta has jumper JP1 fitted. Without this jumper you will
6    be unable to flash your Malta using a Navigator Probe.
7
8  - Connect Navigator Console to your probe and Malta as usual.
9
10  - Within Navigator Console run the following commands:
11
12      source /path/to/u-boot/board/imgtec/malta/flash-malta-boot.tcl
13      reset
14      flash-boot /path/to/u-boot/u-boot.bin
15
16  - You should now be able to reboot your Malta to a U-Boot shell.
17

README.marubun-pcmcia

1
2U-Boot MARUBUN MR-SHPC-01 PCMCIA controller driver
3	Last update 21/11/2007 by Nobuhiro Iwamatsu
4
5========================================================================================
6
70. What's this?
8    This driver supports MARUBUN MR-SHPC-01.
9	url: http://www.marubun.co.jp/product/semicon/devices/qgc18e0000002n2z.html
10	(Sorry Japanese only.)
11
12    This chip is used with SuperH well, and adopted by the
13    reference board.
14	ex. * MS7750SE01
15		* MS7722SE01
16		* other
17
18    This chip doesn't support CardBus.
19
201. base source code
21    The code is based on sources from the Linux kernel
22	( arch/sh/kernel/cf-enabler.c ).
23
242. How to use
25    The options you have to specify in the config file are (with the
26    value for my board as an example):
27
28    * CONFIG_MARUBUN_PCCARD
29	If you want to use this device driver, should define CONFIG_MARUBUN_PCCARD.
30	ex.	#define CONFIG_MARUBUN_PCCARD
31
32    * CONFIG_PCMCIA_SLOT_A
33	Most devices have only one slot. You should define CONFIG_PCMCIA_SLOT_A .
34	ex.	#define CONFIG_PCMCIA_SLOT_A    1
35
36    * CONFIG_SYS_MARUBUN_MRSHPC
37	This is MR-SHPC-01 PCMCIA controller base address.
38	You should do the setting matched to your environment.
39	ex.  #define CONFIG_SYS_MARUBUN_MRSHPC 0xb03fffe0
40	     ( for MS7722SE01 environment )
41
42    * CONFIG_SYS_MARUBUN_MW1
43	This is MR-SHPC-01 memory window base address.
44	You should do the setting matched to your environment.
45	ex. #define CONFIG_SYS_MARUBUN_MW1 0xb0400000
46	     ( for MS7722SE01 environment )
47
48    * CONFIG_SYS_MARUBUN_MW1
49	This is MR-SHPC-01 attribute window base address.
50	You should do the setting matched to your environment.
51	ex. #define CONFIG_SYS_MARUBUN_MW2 0xb0500000
52	     ( for MS7722SE01 environment )
53
54    * CONFIG_SYS_MARUBUN_MW1
55	This is MR-SHPC-01 I/O window base address.
56	You should do the setting matched to your environment.
57	ex. #define CONFIG_SYS_MARUBUN_IO  0xb0600000
58	     ( for MS7722SE01 environment )
59
603. Other
61    * Check Compact Flash only.
62    * Maybe, NE2000 compatible NIC is sure to move.
63
64Copyright (c) 2007
65	Nobuhiro Iwamatsu <iwamatsu@nigaur.org>
66

README.marvell

1Marvell U-Boot Build Instructions
2=================================
3
4This document describes how to compile the U-Boot and how to change U-Boot configuration
5
6Build Procedure
7----------------
81. Install required packages:
9
10		# sudo apt-get install libssl-dev
11		# sudo apt-get install device-tree-compiler
12		# sudo apt-get install swig libpython-dev
13
142. Set the cross compiler:
15
16		# export CROSS_COMPILE=/path/to/toolchain/aarch64-marvell-linux-gnu-
17
183. Clean-up old residuals:
19
20		# make mrproper
21
224. Configure the U-Boot:
23
24		# make <defconfig_file>
25
26	- For the Armada-70x0/80x0 DB board use "mvebu_db_armada8k_defconfig"
27	- For the Armada-80x0 MacchiatoBin use "make mvebu_mcbin-88f8040_defconfig"
28	- For the Armada-3700 DB board use "make mvebu_db-88f3720_defconfig"
29	- For the Armada-3700 EsspressoBin use "make mvebu_espressobin-88f3720_defconfig"
30
315. Configure the device-tree and build the U-Boot image:
32
33	Compile u-boot and set the required device-tree using:
34
35		# make DEVICE_TREE=<name>
36
37	NOTE:
38	Compilation with "mvebu_db_armada8k_defconfig" requires explicitly exporting DEVICE_TREE
39	for the requested board.
40	By default, u-boot is compiled with armada-8040-db device-tree.
41        Using A80x0 device-tree on A70x0 might break the device.
42        In order to prevent this, the required device-tree MUST be set during compilation.
43        All device-tree files are located in ./arch/arm/dts/ folder.
44
45	NOTE:
46	The u-boot.bin should not be used as a stand-alone image.
47	The ARM Trusted Firmware (ATF) build process uses this image to generate the
48	flash image.
49
50Configuration update
51---------------------
52	To update the U-Boot configuration, please refer to doc/README.kconfig
53
54

README.mediatek

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2018 MediaTek Inc.
4# Ryder Lee <ryder.lee@kernel.org>
5
6
7This document describes how to compile the U-Boot and how to change U-Boot
8configuration about the MediaTek SoCs.
9
10
11Build Procedure
12===============
13	-Set the cross compiler:
14
15		# export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi-
16
17	-Clean-up old residuals:
18
19		# make mrproper
20
21	-Configure the U-Boot:
22
23		# make <defconfig_file>
24		# make
25
26		- For the MT7623n bananapi R2 board use "mt7623n_bpir2_defconfig"
27		- For the MT7629 reference board use "mt7629_rfb_defconfig"
28
29
30Boot sequence
31=============
32	-Bootrom -> MTK preloader -> U-Boot
33
34		- MT7623n
35
36	This version of U-Boot doesn't implement SPL. So, MTK preloader binary
37	is needed to boot up:
38
39	https://github.com/BPI-SINOVOIP/BPI-R2-bsp/tree/master/mt-pack/mtk/bpi-r2/bin
40
41
42	-Bootrom -> SPL -> U-Boot
43
44		- MT7629
45
46
47Configuration update
48====================
49	To update the U-Boot configuration, please refer to doc/README.kconfig
50
51
52MediaTek image header
53=====================
54Currently there are two image headers used for MediaTek chips:
55
56	- BootROM image header. This header is used by the first stage bootloader. It records
57	  the desired compatible boot device, integrity information and its load address.
58
59	  The on-chip BootROM will firstly verify integrity and compatibility of the bootloader.
60
61	  If verification passed, the BootROM will then load the bootloader into on-chip SRAM,
62	  and pass control to it.
63
64	  Note that this header is actually a combination of three independent headers:
65	  Device header, BRLYT header and GFH header.
66
67	  Used by U-Boot SPL of MT7629 and preloader of MT7623.
68
69
70	- MediaTek legacy image header. This header was originally used by the legacy image. It
71	  basically records the load address, image size and image name.
72
73	  After all low level initializations passed, the preloader will locate the LK image and
74	  load it into DRAM, and pass control to it.
75
76	  Now this header is used by U-Boot of MT7623.
77
78
79To generate these two headers with mkimage:
80
81	# mkimage -T mtk_image -a <load_addr> -n <option_string> -d <input_file> <image_file>
82
83	- mtk_image means using MediaTek's header generation method.
84
85
86	- load_addr is the load address of this image.
87	  For first stage bootloader like U-Boot SPL or preloader, it usually points to the
88	  on-chip SRAM.
89
90	  For second stage bootloader like U-Boot, it usually points to the DRAM.
91
92
93	- option_string contains options to generate the header.
94
95	  The option string is using the follow format:
96		key1=value1;key2=value2;...
97
98	  The following key names are valid:
99		lk: If lk=1, LK image header is used. Otherwise BootROM image header is used.
100
101		lkname: The name of the LK image header. The maximum length is 32.
102			The default value is "U-Boot".
103
104		media: Desired boot device. The valid values are:
105		nand : Parallel NAND
106		snand: Serial NAND
107		nor  : Serial NOR
108		emmc : eMMC
109		sdmmc: SD
110
111	   nandinfo: Desired NAND device type, a combination of page size, oob size and
112		     optional device capacity. Valid types are:
113		2k+64    : for Serial NAND, 2KiB page size + 64B oob size
114		2k+120   : for Serial NAND, 2KiB page size + 120B oob size
115		2k+128   : for Serial NAND, 2KiB page size + 128B oob size
116		4k+256   : for Serial NAND, 4KiB page size + 256B oob size
117		1g:2k+64 : for Parallel NAND, 2KiB page size + 64B oob size, total 1Gbit size
118		2g:2k+64 : for Parallel NAND, 2KiB page size + 64B oob size, total 2Gbit size
119		4g:2k+64 : for Parallel NAND, 2KiB page size + 64B oob size, total 4Gbit size
120		2g:2k+128: for Parallel NAND, 2KiB page size + 128B oob size, total 2Gbit size
121		4g:2k+128: for Parallel NAND, 2KiB page size + 128B oob size, total 4Gbit size
122
123
124MT7629 partitions on Serial NOR
125===============================
126
127	Start      End       Size       Description
128	00000000 - 0000ffff: 64KiB      U-Boot SPL
129	00010000 - 0005ffff: 320KiB     U-Boot
130	00060000 - 0006ffff: 64KiB      U-Boot env / MediaTek NVRAM
131	00070000 - 000affff: 256KiB     RF calibration data
132	000b0000 - xxxxxxxx: all left   Firmware image
133
134
135BPi-R2 (MT7623N) partitions on SD
136=================================
137	Please note that the last two partitions can vary from different Linux distributions
138	depending on the MBR partition table.
139
140	Start      End       Size       Description
141	00000000 - 000001ff: 512B       Device header (with MBR partition table)
142	00000200 - 000007ff: 1536B      BRLYT header
143	00000800 - 0004ffff: 318KiB     Preloader (with GFH header)
144	00050000 - 000fffff: 704KiB     U-Boot
145	00100000 - 063fffff: 99MiB      Reserved
146	06400000 - 163fffff: 256MiB     Partition 1 (FAT32)
147	16400000 - xxxxxxxx: all left   Partition 2 (ext4)
148
149
150Upgrading notice on Serial NOR
151==============================
152Example: MT7629
153
154	The command sf is used to operate the Serial NOR device:
155
156	- To probe current NOR flash:
157
158		# sf probe
159
160	- To erase a region:
161
162		# sf erase <offset> <len>
163
164	- To write data to an offset:
165
166		# sf write <data_addr> <offset> <len>
167
168	- To boot kernel:
169
170		# bootm 0x300b0000
171
172	The memory address range 0x30000000 - 0x3fffffff is mapped to the NOR flash.
173	The DRAM starts at 0x40000000.
174
175	Please note that the output binary u-boot-mtk.bin is a combination of SPL and U-Boot,
176	and it should be write to beginning of the flash.
177
178	Otherwise you should use standalone files:
179
180		spl/u-boot-spl-mtk.bin for SPL,
181		u-boot.img for U-Boot.
182
183
184Upgrading notice on SD / eMMC
185=============================
186Example: MT7623
187
188	Normally only Preloader and U-Boot can be upgraded within U-Boot, and other partitions
189	should be written in PC.
190
191	- To probe current SD card / eMMC:
192
193		# mmc dev 0 for eMMC
194		# mmc dev 1 for SD
195
196	- To erase a region:
197
198		# mmc erase <blk_offset> <blk_num>
199
200	- To write data to a block offset:
201
202		# mmc write <data_addr> <blk_offset> <blk_num>
203
204	- To load kernel image from partition 1:
205
206		# fatload mmc 0:1 <load_address> <path_to_kernel_uImage> for eMMC
207		# fatload mmc 1:1 <load_address> <path_to_kernel_uImage> for SD
208
209	- To boot kernel:
210
211		# bootm <load_address>
212
213	The DRAM starts at 0x80000000.
214
215	Please note that we use block offset and block count for SD card, not the byte offset.
216	The block size is always 512 bytes for SD card.
217
218
219Documentation
220=============
221	http://wiki.banana-pi.org/Banana_Pi_BPI-R2
222

README.memory-test

1The most frequent cause of problems when porting U-Boot to new
2hardware, or when using a sloppy port on some board, is memory errors.
3In most cases these are not caused by failing hardware, but by
4incorrect initialization of the memory controller.  So it appears to
5be a good idea to always test if the memory is working correctly,
6before looking for any other potential causes of any problems.
7
8U-Boot implements 3 different approaches to perform memory tests:
9
101. The get_ram_size() function (see "common/memsize.c").
11
12   This function is supposed to be used in each and every U-Boot port
13   determine the presence and actual size of each of the potential
14   memory banks on this piece of hardware.  The code is supposed to be
15   very fast, so running it for each reboot does not hurt.  It is a
16   little known and generally underrated fact that this code will also
17   catch 99% of hardware related (i. e. reliably reproducible) memory
18   errors.  It is strongly recommended to always use this function, in
19   each and every port of U-Boot.
20
212. The "mtest" command.
22
23   This is probably the best known memory test utility in U-Boot.
24   Unfortunately, it is also the most problematic, and the most
25   useless one.
26
27   There are a number of serious problems with this command:
28
29   - It is terribly slow.  Running "mtest" on the whole system RAM
30     takes a _long_ time before there is any significance in the fact
31     that no errors have been found so far.
32
33   - It is difficult to configure, and to use.  And any errors here
34     will reliably crash or hang your system.  "mtest" is dumb and has
35     no knowledge about memory ranges that may be in use for other
36     purposes, like exception code, U-Boot code and data, stack,
37     malloc arena, video buffer, log buffer, etc.  If you let it, it
38     will happily "test" all such areas, which of course will cause
39     some problems.
40
41   - It is not easy to configure and use, and a large number of
42     systems are seriously misconfigured.  The original idea was to
43     test basically the whole system RAM, with only exempting the
44     areas used by U-Boot itself - on most systems these are the areas
45     used for the exception vectors (usually at the very lower end of
46     system memory) and for U-Boot (code, data, etc. - see above;
47     these are usually at the very upper end of system memory).  But
48     experience has shown that a very large number of ports use
49     pretty much bogus settings of CONFIG_SYS_MEMTEST_START and
50     CONFIG_SYS_MEMTEST_END; this results in useless tests (because
51     the ranges is too small and/or badly located) or in critical
52     failures (system crashes).
53
54   Because of these issues, the "mtest" command is considered depre-
55   cated.  It should not be enabled in most normal ports of U-Boot,
56   especially not in production.  If you really need a memory test,
57   then see 1. and 3. above resp. below.
58
593. The most thorough memory test facility is available as part of the
60   POST (Power-On Self Test) sub-system, see "post/drivers/memory.c".
61
62   If you really need to perform memory tests (for example, because
63   it is mandatory part of your requirement specification), then
64   enable this test which is generic and should work on all archi-
65   tectures.
66
67WARNING:
68
69It should pointed out that _all_ these memory tests have one
70fundamental, unfixable design flaw:  they are based on the assumption
71that memory errors can be found by writing to and reading from memory.
72Unfortunately, this is only true for the relatively harmless, usually
73static errors like shorts between data or address lines, unconnected
74pins, etc.  All the really nasty errors which will first turn your
75hair gray, only to make you tear it out later, are dynamical errors,
76which usually happen not with simple read or write cycles on the bus,
77but when performing back-to-back data transfers in burst mode.  Such
78accesses usually happen only for certain DMA operations, or for heavy
79cache use (instruction fetching, cache flushing).  So far I am not
80aware of any freely available code that implements a generic, and
81efficient, memory test like that.  The best known test case to stress
82a system like that is to boot Linux with root file system mounted over
83NFS, and then build some larger software package natively (say,
84compile a Linux kernel on the system) - this will cause enough context
85switches, network traffic (and thus DMA transfers from the network
86controller), varying RAM use, etc. to trigger any weak spots in this
87area.
88
89Note: An attempt was made once to implement such a test to catch
90memory problems on a specific board.  The code is pretty much board
91specific (for example, it includes setting specific GPIO signals to
92provide triggers for an attached logic analyzer), but you can get an
93idea how it works: see "examples/standalone/test_burst*".
94
95Note 2: Ironically enough, the "test_burst" did not catch any RAM
96errors, not a single one ever.  The problems this code was supposed
97to catch did not happen when accessing the RAM, but when reading from
98NOR flash.
99

README.menu

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2010-2011 Calxeda, Inc.
4 */
5
6U-Boot provides a set of interfaces for creating and using simple, text
7based menus. Menus are displayed as lists of labeled entries on the
8console, and an entry can be selected by entering its label.
9
10To use the menu code, enable CONFIG_MENU, and include "menu.h" where
11the interfaces should be available.
12
13Menus are composed of items. Each item has a key used to identify it in
14the menu, and an opaque pointer to data controlled by the consumer.
15
16If you want to show a menu, instead starting the shell, define
17CONFIG_MENU_SHOW. You have to code the int menu_show(int bootdelay)
18function, which handle your menu. This function returns the remaining
19bootdelay.
20
21Interfaces
22----------
23#include "menu.h"
24
25/*
26 * Consumers of the menu interfaces will use a struct menu * as the
27 * handle for a menu. struct menu is only fully defined in menu.c,
28 * preventing consumers of the menu interfaces from accessing its
29 * contents directly.
30 */
31struct menu;
32
33/*
34 * NOTE: See comments in common/menu.c for more detailed documentation on
35 * these interfaces.
36 */
37
38/*
39 * menu_create() - Creates a menu handle with default settings
40 */
41struct menu *menu_create(char *title, int timeout, int prompt,
42				void (*item_data_print)(void *),
43				char *(*item_choice)(void *),
44				void *item_choice_data);
45
46/*
47 * menu_item_add() - Adds or replaces a menu item
48 */
49int menu_item_add(struct menu *m, char *item_key, void *item_data);
50
51/*
52 * menu_default_set() - Sets the default choice for the menu
53 */
54int menu_default_set(struct menu *m, char *item_key);
55
56/*
57 * menu_default_choice() - Set *choice to point to the default item's data
58 */
59int menu_default_choice(struct menu *m, void **choice);
60
61/*
62 * menu_get_choice() - Returns the user's selected menu entry, or the
63 * default if the menu is set to not prompt or the timeout expires.
64 */
65int menu_get_choice(struct menu *m, void **choice);
66
67/*
68 * menu_destroy() - frees the memory used by a menu and its items.
69 */
70int menu_destroy(struct menu *m);
71
72/*
73 * menu_display_statusline(struct menu *m);
74 * shows a statusline for every menu_display call.
75 */
76void menu_display_statusline(struct menu *m);
77
78Example Code
79------------
80This example creates a menu that always prompts, and allows the user
81to pick from a list of tools.  The item key and data are the same.
82
83#include "menu.h"
84
85char *tools[] = {
86	"Hammer",
87	"Screwdriver",
88	"Nail gun",
89	NULL
90};
91
92char *pick_a_tool(void)
93{
94	struct menu *m;
95	int i;
96	char *tool = NULL;
97
98	m = menu_create("Tools", 0, 1, NULL);
99
100	for(i = 0; tools[i]; i++) {
101		if (menu_item_add(m, tools[i], tools[i]) != 1) {
102			printf("failed to add item!");
103			menu_destroy(m);
104			return NULL;
105		}
106	}
107
108	if (menu_get_choice(m, (void **)&tool) != 1)
109		printf("Problem picking tool!\n");
110
111	menu_destroy(m);
112
113	return tool;
114}
115
116void caller(void)
117{
118	char *tool = pick_a_tool();
119
120	if (tool) {
121		printf("picked a tool: %s\n", tool);
122		use_tool(tool);
123	}
124}
125

README.mips

1
2Notes for the MIPS architecture port of U-Boot
3
4Toolchains
5----------
6
7  http://www.denx.de/wiki/DULG/ELDK
8  ELDK < DULG < DENX
9
10  http://www.emdebian.org/crosstools.html
11  Embedded Debian -- Cross-development toolchains
12
13  http://buildroot.uclibc.org/
14  Buildroot
15
16Known Issues
17------------
18
19  * Cache incoherency issue caused by do_bootelf_exec() at cmd_elf.c
20
21    Cache will be disabled before entering the loaded ELF image without
22    writing back and invalidating cache lines. This leads to cache
23    incoherency in most cases, unless the code gets loaded after U-Boot
24    re-initializes the cache. The more common uImage 'bootm' command does
25    not suffer this problem.
26
27    [workaround] To avoid this cache incoherency,
28    1) insert flush_cache(all) before calling dcache_disable(), or
29    2) fix dcache_disable() to do both flushing and disabling cache.
30
31  * Note that Linux users need to kill dcache_disable() in do_bootelf_exec()
32    or override do_bootelf_exec() not to disable I-/D-caches, because most
33    Linux/MIPS ports don't re-enable caches after entering kernel_entry.
34
35TODOs
36-----
37
38  * Probe CPU types, I-/D-cache and TLB size etc. automatically
39
40  * Secondary cache support missing
41
42  * Initialize TLB entries redardless of their use
43
44  * R2000/R3000 class parts are not supported
45
46  * Limited testing across different MIPS variants
47
48  * Due to cache initialization issues, the DRAM on board must be
49    initialized in board specific assembler language before the cache init
50    code is run -- that is, initialize the DRAM in lowlevel_init().
51
52  * centralize/share more CPU code of MIPS32, MIPS64 and XBurst
53
54  * support Qemu Malta
55

README.mpc74xx

1This file contains status information for the port of U-Boot to the
2Motorola mpc74xx series of CPUs.
3
4Author: Josh Huber <huber@mclx.com>
5	Mission Critical Linux, Inc.
6
7Currently the support for these CPUs is pretty minimal, but enough to
8get things going.  (much like the support for the Galileo Eval Board)
9
10There is a framework in place to enable the L2 cache, and to program
11the BATs.  Currently, there are still problems with the code which
12sets up the L2 cache, so it's not enabled. (IMHO, it shouldn't be
13anyway).  Additionally, there is support for enabling the MMU, which
14we also don't do.  The BATs are programmed just for the benefit of
15jumping into Linux in a sane configuration.
16
17Most of the code was based on other cpus supported by U-Boot.
18
19If you find any errors in the CPU setup code, please send us a note.
20
21Thanks,
22Josh
23

README.mpc83xx.ddrecc

1Overview
2========
3
4The overall usage pattern for ECC diagnostic commands is the following:
5
6  * (injecting errors is initially disabled)
7
8  * define inject mask (which tells the DDR controller what type of errors
9    we'll be injecting: single/multiple bit etc.)
10
11  * enable injecting errors - from now on the controller injects errors as
12    indicated in the inject mask
13
14IMPORTANT NOTICE: enabling injecting multiple-bit errors is potentially
15dangerous as such errors are NOT corrected by the controller. Therefore caution
16should be taken when enabling the injection of multiple-bit errors: it is only
17safe when used on a carefully selected memory area and used under control of
18the 'ecc testdw' 'ecc testword' command (see example 'Injecting Multiple-Bit
19Errors' below). In particular, when you simply set the multiple-bit errors in
20inject mask and enable injection, U-Boot is very likely to hang quickly as the
21errors will be injected when it accesses its code, data etc.
22
23
24Use cases for DDR 'ecc' command:
25================================
26
27Before executing particular tests reset target board or clear status registers:
28
29=> ecc captureclear
30=> ecc errdetectclr all
31=> ecc sbecnt 0
32
33
34Injecting Single-Bit Errors
35---------------------------
36
371. Set 1 bit in Data Path Error Inject Mask
38
39=> ecc injectdatahi 1
40
412. Run test over some memory region
42
43=> ecc testdw 200000 10
44
453. Check ECC status
46
47=> ecc status
48...
49Memory Data Path Error Injection Mask High/Low: 00000001 00000000
50...
51Memory Single-Bit Error Management (0..255):
52  Single-Bit Error Threshold: 255
53  Single Bit Error Counter: 16
54...
55Memory Error Detect:
56  Multiple Memory Errors: 0
57  Multiple-Bit Error: 0
58  Single-Bit Error: 0
59...
60
6116 errors were generated, Single-Bit Error flag was not set as Single Bit Error
62Counter did not reach  Single-Bit Error Threshold.
63
644. Make sure used memory region got re-initialized with 0x0123456789abcdef
65
66=> md 200000
6700200000: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
6800200010: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
6900200020: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
7000200030: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
7100200040: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
7200200050: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
7300200060: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
7400200070: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
7500200080: deadbeef deadbeef deadbeef deadbeef    ................
7600200090: deadbeef deadbeef deadbeef deadbeef    ................
77
78Injecting Multiple-Bit Errors
79-----------------------------
80
811. Set more than 1 bit in Data Path Error Inject Mask
82
83=> ecc injectdatahi 1
84=> ecc injectdatalo 1
85
862. Run test over some memory region
87
88=> ecc testword 200000 1
89
903. Check ECC status
91
92=> ecc status
93...
94Memory Data Path Error Injection Mask High/Low: 00000001 00000001
95...
96Memory Error Detect:
97  Multiple Memory Errors: 0
98  Multiple-Bit Error: 1
99  Single-Bit Error: 0
100...
101
102The Multiple Memory Errors flags not set and Multiple-Bit Error flags are set.
103
1044. Make sure used memory region got re-initialized with 0x0123456789abcdef
105
106=> md 200000
10700200000: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
10800200010: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
10900200020: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
11000200030: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
11100200040: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
11200200050: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
11300200060: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
11400200070: 01234567 89abcdef 01234567 89abcdef    .#Eg.....#Eg....
11500200080: deadbeef deadbeef deadbeef deadbeef    ................
11600200090: deadbeef deadbeef deadbeef deadbeef    ................
117
118
119Test Single-Bit Error Counter and Threshold
120-------------------------------------------
121
1221. Set 1 bit in Data Path Error Inject Mask
123
124=> ecc injectdatahi 1
125
1262. Enable error injection
127
128=> ecc inject en
129
1303. Let u-boot run for a with Single-Bit error injection enabled
131
1324. Disable error injection
133
134=> ecc inject dis
135
1364. Check status
137
138=> ecc status
139
140...
141Memory Single-Bit Error Management (0..255):
142  Single-Bit Error Threshold: 255
143  Single Bit Error Counter: 199
144
145Memory Error Detect:
146  Multiple Memory Errors: 1
147  Multiple-Bit Error: 0
148  Single-Bit Error: 1
149...
150
151Observe that Single-Bit Error is 'on' which means that Single-Bit Error Counter
152reached Single-Bit Error Threshold. Multiple Memory Errors bit is also 'on', that
153is Counter reached Threshold more than one time (it wraps back after reaching
154Threshold).
155

README.mpc83xxads

1Freescale MPC83xx ADS Boards
2-----------------------------------------
3
40. Toolchain / Building
5
6    $ PATH=$PATH:/usr/powerpc/bin
7    $ CROSS_COMPILE=powerpc-linux-
8    $ export PATH CROSS_COMPILE
9
10    $ powerpc-linux-gcc -v
11    Reading specs from /usr/powerpc/lib/gcc/powerpc-linux/3.4.3/specs
12    Configured with: ../configure --prefix=/usr/powerpc
13    --exec-prefix=/usr/powerpc --target=powerpc-linux --enable-shared
14    --disable-nls --disable-multilib --enable-languages=c,c++,ada,f77,objc
15    Thread model: posix
16    gcc version 3.4.3 (Debian)
17
18    $ powerpc-linux-as -v
19    GNU assembler version 2.15 (powerpc-linux) using BFD version 2.15
20
21
22    $ make MPC8349ADS_config
23    Configuring for MPC8349ADS board...
24
25    $ make
26
27
281. Board Switches and Jumpers
29
30
312. Memory Map
32
332.1. The memory map should look pretty much like this:
34
35     0x0000_0000     0x7fff_ffff     DDR		     2G
36     0x8000_0000     0x9fff_ffff     PCI MEM		     512M
37     0xc000_0000     0xdfff_ffff     Rapid IO		     512M
38     0xe000_0000     0xe00f_ffff     CCSR		     1M
39     0xe200_0000     0xe2ff_ffff     PCI IO		     16M
40     0xf000_0000     0xf7ff_ffff     SDRAM		     128M
41     0xf800_0000     0xf80f_ffff     BCSR		     1M
42     0xfe00_0000     0xffff_ffff     FLASH (boot bank)	     16M
43
44
453. Definitions
46
473.1 Explanation of NEW definitions in:
48
49	include/configs/MPC8349ADS.h
50
51    CONFIG_MPC83xx	    MPC83xx family
52    CONFIG_MPC8349	    MPC8349 specific
53    CONFIG_TSEC_ENET	    Use on-chip 10/100/1000 ethernet
54
55
564. Compilation
57
58    Assuming you're using BASH shell:
59
60	export CROSS_COMPILE=your-cross-compile-prefix
61	cd u-boot
62	make distclean
63	make MPC8349ADS_config
64	make
65
665. Downloading and Flashing Images
67
685.0 Download over serial line using Kermit:
69
70	loadb
71	[Drop to kermit:
72	    ^\c
73	    send <u-boot-bin-image>
74	    c
75	]
76
77
78    Or via tftp:
79
80	tftp 10000 u-boot.bin
81
825.1 Reflash U-Boot Image using U-Boot
83
84    tftp 10000 u-boot.bin
85    protect off fe000000 fe09ffff
86    erase fe000000 fe09ffff
87
88    cp.b 10000 fe000000 xxxx
89or
90    cp.b 10000 fe000000 a0000
91
92You might have to supply the correct byte count for 'xxxx' from
93the TFTP.  Maybe a0000 will work too, that corresponds to the
94erased sectors.
95
96
976. Notes
98

README.mpc85xx

1External Debug Support
2----------------------
3
4Freescale's e500v1 and e500v2 cores (used in mpc85xx chips) have some
5restrictions on external debugging (JTAG).  In particular, for the debugger to
6be able to receive control after a single step or breakpoint:
7	- MSR[DE] must be set
8	- A valid opcode must be fetchable, through the MMU, from the debug
9	  exception vector (IVPR + IVOR15).
10
11To maximize the time during which this requirement is met, U-Boot sets MSR[DE]
12immediately on entry and keeps it set. It also uses a temporary TLB to keep a
13mapping to a valid opcode at the debug exception vector, even if we normally
14don't support exception vectors being used that early, and that's not the area
15where U-Boot currently executes from.
16
17Note that there may still be some small windows where debugging will not work,
18such as in between updating IVPR and IVOR15.
19
20Config Switches:
21----------------
22
23Please refer README section "MPC85xx External Debug Support"
24
25Major Config Switches during various boot Modes
26----------------------------------------------
27
28NOR boot
29		!defined(CONFIG_SYS_RAMBOOT) && !defined(CONFIG_SPL)
30NOR boot Secure
31		!defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SECURE_BOOT)
32RAMBOOT(SD, SPI & NAND boot)
33		 defined(CONFIG_SYS_RAMBOOT)
34RAMBOOT Secure (SD, SPI & NAND)
35		 defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SECURE_BOOT)
36NAND SPL BOOT
37		 defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_NAND_SPL)
38
39
40TLB Entries during u-boot execution
41-----------------------------------
42
43Note: Sequence number is in order of execution
44
45A) defined(CONFIG_SYS_RAMBOOT) i.e. SD, SPI, NAND RAMBOOT & NAND_SPL boot
46
47   1) TLB entry to overcome e500 v1/v2 debug restriction
48       Location	  : Label "_start_e500"
49       TLB Entry  : CONFIG_SYS_PPC_E500_DEBUG_TLB
50       EPN -->RPN : CONFIG_SYS_MONITOR_BASE --> CONFIG_SYS_MONITOR_BASE
51       Properties : 256K, AS0, I, IPROT
52
53   2) TLB entry for working in AS1
54       Location	  : Label "create_init_ram_area"
55       TLB Entry  : 15
56       EPN -->RPN : CONFIG_SYS_MONITOR_BASE --> CONFIG_SYS_MONITOR_BASE
57       Properties : 1M, AS1, I, G, IPROT
58
59   3) TLB entry for the stack during AS1
60       Location	  : Lable "create_init_ram_area"
61       TLB Entry  : 14
62       EPN -->RPN : CONFIG_SYS_INIT_RAM_ADDR --> CONFIG_SYS_INIT_RAM_ADDR
63       Properties : 16K, AS1, IPROT
64
65   4) TLB entry for CCSRBAR during AS1 execution
66       Location	  : cpu_init_early_f
67       TLB Entry  : 13
68       EPN -->RPN : CONFIG_SYS_CCSRBAR --> CONFIG_SYS_CCSRBAR
69       Properties : 1M, AS1, I, G
70
71   5) Invalidate unproctected TLB Entries
72       Location	  : cpu_init_early_f
73       Invalidated: 13
74
75   6) Create TLB entries as per boards/freescale/<board>/tlb.c
76       Location	  : cpu_init_early_f --> init_tlbs()
77       Properties : ..., AS0, ...
78      Please note It can overwrites previous TLB Entries.
79
80   7) Disable TLB Entries of AS1
81       Location	  : cpu_init_f --> disable_tlb()
82       Disable	  : 15, 14
83
84   8) Update Flash's TLB entry
85       Location	  : Board_init_r
86       TLB entry  : Search from TLB entries
87       EPN -->RPN : CONFIG_SYS_FLASH_BASE --> CONFIG_SYS_FLASH_BASE_PHYS
88       Properties : Board specific size, AS0, I, G, IPROT
89
90
91B) !defined(CONFIG_SYS_RAMBOOT) i.e. NOR boot
92
93   1) TLB entry to overcome e500 v1/v2 debug restriction
94       Location	  : Label "_start_e500"
95       TLB Entry  : CONFIG_SYS_PPC_E500_DEBUG_TLB
96#if defined(CONFIG_SECURE_BOOT)
97       EPN -->RPN : CONFIG_SYS_MONITOR_BASE --> CONFIG_SYS_PBI_FLASH_WINDOW
98       Properties : 1M, AS1, I, G, IPROT
99#else
100       EPN -->RPN : CONFIG_SYS_MONITOR_BASE & 0xffc00000 --> 0xffc00000
101       Properties : 4M, AS0, I, G, IPROT
102#endif
103
104   2) TLB entry for working in AS1
105       Location	  : Label "create_init_ram_area"
106       TLB Entry  : 15
107#if defined(CONFIG_SECURE_BOOT)
108       EPN -->RPN : CONFIG_SYS_MONITOR_BASE --> CONFIG_SYS_PBI_FLASH_WINDOW
109       Properties : 1M, AS1, I, G, IPROT
110#else
111       EPN -->RPN : CONFIG_SYS_MONITOR_BASE & 0xffc00000 --> 0xffc00000
112       Properties : 4M, AS1, I, G, IPROT
113#endif
114
115   3) TLB entry for the stack during AS1
116       Location	  : Lable "create_init_ram_area"
117       TLB Entry  : 14
118       EPN -->RPN : CONFIG_SYS_INIT_RAM_ADDR --> CONFIG_SYS_INIT_RAM_ADDR
119       Properties : 16K, AS1, IPROT
120
121   4) TLB entry for CCSRBAR during AS1 execution
122       Location	  : cpu_init_early_f
123       TLB Entry  : 13
124       EPN -->RPN : CONFIG_SYS_CCSRBAR --> CONFIG_SYS_CCSRBAR
125       Properties : 1M, AS1, I, G
126
127   5) TLB entry for Errata workaround CONFIG_SYS_FSL_ERRATUM_IFC_A003399
128       Location	  : cpu_init_early_f
129       TLB Entry  : 9
130       EPN -->RPN : SRAM_BASE_ADDR --> SRAM_BASE_ADDR
131       Properties : 1M, AS1, I
132
133   6) CONFIG_SYS_FSL_ERRATUM_IFC_A003399 Adjust flash's phys addr
134       Location	  : cpu_init_early_f --> setup_ifc
135       TLB Entry  : Get Flash TLB
136       EPN -->RPN : Adjusted flash_phys --> Adjusted flash_phys
137       Properties : 4M, AS1, I, G, IPROT
138
139   7) CONFIG_SYS_FSL_ERRATUM_IFC_A003399: E500 v1,v2 debug restriction
140       Location	  : cpu_init_early_f --> setup_ifc
141       TLB Entry  : CONFIG_SYS_PPC_E500_DEBUG_TLB
142       EPN -->RPN : Adjusted flash_phys --> Adjusted flash_phys
143       Properties : 4M, AS0, I, G, IPROT
144
145   8) Invalidate unproctected TLB Entries
146       Location	  : cpu_init_early_f
147       Invalidated: 13, 9
148
149   9) Create TLB entries as per boards/freescale/<board>/tlb.c
150       Location	  : cpu_init_early_f --> init_tlbs()
151       Properties : ..., AS0, ...
152      Note: It can overwrites previous TLB Entries
153
154   10) Disable TLB Entries of AS1
155       Location	  : cpu_init_f --> disable_tlb()
156       Disable	  : 15, 14
157
158   11) Create DDR's TLB entriy
159       Location	  : Board_init_f -> dram_init
160       TLB entry  : Search free TLB entry
161
162   12) Update Flash's TLB entry
163       Location	  : Board_init_r
164       TLB entry  : Search from TLB entries
165       EPN -->RPN : CONFIG_SYS_FLASH_BASE --> CONFIG_SYS_FLASH_BASE_PHYS
166       Properties : Board specific size, AS0, I, G, IPROT
167

README.mpc85xx-sd-spi-boot

1----------------------------------------
2Booting from On-Chip ROM (eSDHC or eSPI)
3----------------------------------------
4
5boot_format is a tool to write SD bootable images to a filesystem and build
6SD/SPI images to a binary file for writing later.
7
8When booting from an SD card/MMC, boot_format puts the configuration file and
9the RAM-based U-Boot image on the card.
10When booting from an EEPROM, boot_format generates a binary image that is used
11to boot from this EEPROM.
12
13Where to get boot_format:
14========================
15
16you can browse it online at:
17http://git.freescale.com/git/cgit.cgi/ppc/sdk/boot-format.git/
18
19Building
20========
21
22Run the following to build this project
23
24	$ make
25
26Execution
27=========
28
29boot_format runs under a regular Linux machine and requires a super user mode
30to run. Execute boot_format as follows.
31
32For building SD images by writing directly to a file system on SD media:
33
34	$ boot_format $config u-boot.bin -sd $device
35
36Where $config is the included config.dat file for your platform and $device
37is the target block device for the SD media on your computer.
38
39For build binary images directly a local file:
40
41	$ boot_format $config u-boot.bin -spi $file
42
43Where $file is the target file. Also keep in mind the u-boot.bin file needs
44to be the u-boot built for your particular platform and target media.
45
46Example: To generate a u-boot.bin for a P1022DS booting from SD, run the
47following in the u-boot repository:
48
49	$ make P1022DS_SDCARD
50
51Configuration Files
52===================
53
54Below are the configuration files to be used with a particular platform. Keep
55in mind that some of these config files are tied to the platforms DDR speed.
56Please see the SoC reference manual for more documentation.
57
58P1022DS		config_sram_p1022ds.dat
59P2020DS		config_sram_p2020ds.dat
60P1020RDB	config_ddr2_1g_p1020rdb_533M.dat
61P1020RDB	config_ddr2_1g_p1020rdb_667M.dat
62P2020RDB	config_ddr2_1g_p2020rdb_800M.dat
63P2020RDB	config_ddr2_1g_p2020rdb_667M.dat
64P2020RDB	config_ddr3_1gb_64bit_p2020rdb_pc.dat
65P1020RDB	config_ddr3_1gb_p1_p2_rdb_pc_800M.dat
66P1011RDB	config_ddr3_1gb_p1_p2_rdb_pc_800M.dat
67P1010RDB	config_ddr3_1gb_p1010rdb_800M.dat
68P1021RDB	config_ddr3_1gb_p1_p2_rdb_pc_800M.dat
69P1022DS		config_ddr3_2gb_p1022ds.dat
70P1024RDB	config_ddr3_1gb_p1_p2_rdb_pc_667M.dat
71P1025RDB	config_ddr3_1gb_p1_p2_rdb_pc_667M.dat
72P1016RDB	config_ddr3_1gb_p1_p2_rdb_pc_667M.dat
73P1020UTM	config_ddr3_1gb_p1_p2_rdb_pc_800M.dat
74P1020MBG	config_ddr3_1gb_p1_p2_rdb_pc_800M.dat
75MPC8536DS	config_ddr2_512m_mpc8536ds_667M.dat
76

README.mpc85xx-spin-table

1Spin table in cache
2=====================================
3As specified by ePAPR v1.1, the spin table needs to be in cached memory. After
4DDR is initialized and U-Boot relocates itself into DDR, the spin table is
5accessible for core 0. It is part of release.S, within 4KB range after
6__secondary_start_page. For other cores to use the spin table, the booting
7process is described below:
8
9Core 0 sets up the reset page on the top 4K of memory (or 4GB if total memory
10is more than 4GB), and creates a TLB to map it to 0xffff_f000, regardless of
11the physical address of this page, with WIMGE=0b01010. Core 0 also enables boot
12page translation for secondary cores to use this page of memory. Then 4KB
13memory is copied from __secondary_start_page to the boot page, after flusing
14cache because this page is mapped as normal DDR. Before copying the reset page,
15core 0 puts the physical address of the spin table (which is in release.S and
16relocated to the top of mapped memory) into a variable __spin_table_addr so
17that secondary cores can see it.
18
19When secondary cores boot up from 0xffff_f000 page, they only have one default
20TLB. While booting, they set up another TLB in AS=1 space and jump into
21the new space. The new TLB covers the physical address of the spin table page,
22with WIMGE =0b00100. Now secondary cores can keep polling the spin table
23without stress DDR bus because both the code and the spin table is in cache.
24
25For the above to work, DDR has to set the 'M' bit of WIMGE, in order to keep
26cache coherence.
27

README.mpc85xxcds

1Motorola MPC85xxCDS boards
2--------------------------
3
4The CDS family of boards consists of a PCI backplane called the
5"Arcadia", a PCI-form-factor carrier card that plugs into a PCI slot,
6and a CPU daughter card that bolts onto the daughter card.
7
8Much of the content of the README.mpc85xxads for the 85xx ADS boards
9applies to the 85xx CDS boards as well.	 In particular the toolchain,
10the switch nomenclature, and the basis for the memory map.  There are
11some differences, though.
12
13
14Building U-Boot
15---------------
16
17The Binutils in current ELDK toolchain will not support MPC85xx
18chip.  You need to use binutils-2.14.tar.bz2 (or newer) from
19    http://ftp.gnu.org/gnu/binutils.
20
21The 85xx CDS code base is known to compile using:
22    gcc (GCC) 3.2.2 20030217 (Yellow Dog Linux 3.0 3.2.2-2a)
23
24
25Memory Map
26----------
27
28The memory map for U-Boot and linux has been extended w.r.t. the ADS
29platform to allow for utilization of all 85xx CDS devices.  The memory
30map is setup for linux to operate properly.  The linux source when
31configured for MPC85xx CDS has been updated to reflect the new memory
32map.
33
34The mapping is:
35
36   0x0000_0000	   0x7fff_ffff	   DDR			   2G
37   0x8000_0000	   0x9fff_ffff	   PCI1 MEM		   512M
38   0xa000_0000	   0xbfff_ffff	   PCI2 MEM		   512M
39   0xe000_0000	   0xe00f_ffff	   CCSR			   1M
40   0xe200_0000	   0xe2ff_ffff	   PCI1 IO		   16M
41   0xe300_0000	   0xe3ff_ffff	   PCI2 IO		   16M
42   0xf000_0000	   0xf7ff_ffff	   SDRAM		   128M
43   0xf800_0000	   0xf80f_ffff	   NVRAM/CADMUS (*)	   1M
44   0xff00_0000	   0xff7f_ffff	   FLASH (2nd bank)	   8M
45   0xff80_0000	   0xffff_ffff	   FLASH (boot bank)	   8M
46
47   (*) The system control registers (CADMUS) start at offset 0xfdb0_4000
48   within the NVRAM/CADMUS region of memory.
49
50
51Using Flash
52-----------
53
54The CDS board  has two flash banks, each 8MB in size (2^23 = 0x00800000).
55There is a switch which allows the boot-bank to be selected.  The switch
56settings for updating flash are given below.
57
58The U-Boot commands for copying the boot-bank into the secondary bank are
59as follows:
60
61     erase ff780000 ff7fffff
62     cp.b fff80000 ff780000 80000
63
64
65U-Boot/kermit commands for downloading an image, then copying
66it into the secondary bank:
67
68     loadb
69     [Drop to kermit:
70	^\c
71	send <u-boot-bin-image>
72	c
73     ]
74
75     erase ff780000 ff7fffff
76     cp.b $loadaddr ff780000 80000
77
78
79U-Boot commands for downloading an image via tftp and flashing
80it into the second bank:
81
82     tftp 10000 <u-boot.bin.image>
83     erase ff780000 ff7fffff
84     cp.b 10000 ff780000 80000
85
86
87After copying the image into the second bank of flash, be sure to toggle
88SW2[2] on the carrier card before resetting the board in order to set the
89secondary bank as the boot-bank.
90
91
92Carrier Board Switches
93----------------------
94
95As a reminder, you should read the README.mpc85xxads too.
96
97Most switches on the carrier board should not be changed.  The only
98user-settable switches on the carrier board are used to configure
99the flash banks and determining the PCI slot.
100
101The first two bits of SW2 control how flash is used on the board:
102
103      12345678
104      --------
105  SW2=00XXXXXX	   FLASH:  Boot bank 1, bank 2 available.
106      01XXXXXX	   FLASH:  Boot bank 2, bank 1 available (swapped).
107      10XXXXXX	   FLASH:  Boot promjet, bank 1 available
108      11XXXXXX	   FLASH:  Boot promjet, bank 2 available
109
110The boot bank is always mapped to FF80_0000 and listed first by
111the "flinfo" command.  The secondary bank is always FF00_0000.
112
113When using PCI, linux needs to know to which slot the CDS carrier is
114connected..  By convention, the user-specific bits of SW2 are used to
115convey this information:
116
117      12345678
118      --------
119  SW2=xxxxxx00	   PCI SLOT INFORM: The CDS carrier is in slot0 of the Arcadia
120      xxxxxx01	   PCI SLOT INFORM: The CDS carrier is in slot1 of the Arcadia
121      xxxxxx10	   PCI SLOT INFORM: The CDS carrier is in slot2 of the Arcadia
122      xxxxxx11	   PCI SLOT INFORM: The CDS carrier is in slot3 of the Arcadia
123
124These are cleverly, er, clearly silkscreened as Slot 1 through 4,
125respectively, on the Arcadia near the support posts.
126
127
128The default setting of all switches on the carrier board is:
129
130      12345678
131      --------
132  SW1=01101100
133  SW2=0x1111yy	   x=Flash bank, yy=PCI slot
134  SW3=11101111
135  SW4=10001000
136
137
1388555/41 CPU Card Switches
139-------------------------
140
141Most switches on the CPU Card should not be changed.  However, the
142frequency can be changed by setting SW3:
143
144      12345678
145      --------
146  SW3=XX00XXXX == CORE:CCB 2:1
147      XX01XXXX == CORE:CCB 5:2
148      XX10XXXX == CORE:CCB 3:1
149      XX11XXXX == CORE:CCB 7:2
150      XXXX1000 == CCB:SYSCLK 8:1
151      XXXX1010 == CCB:SYSCLK 10:1
152
153A safe default setting for all switches on the CPU board is:
154
155      12345678
156      --------
157  SW1=10001111
158  SW2=01000111
159  SW3=00001000
160  SW4=11111110
161
162
1638548 CPU Card Switches
164----------------------
165And, just to be confusing, in this set of switches:
166
167    ON  = 1
168    OFF = 0
169
170Default
171  SW1=11111101
172  SW2=10011111
173  SW3=11001000    (8X) (2:1)
174  SW4=11110011
175
176  SW3=X000XXXX  == CORE:CCB    4:1
177      X001XXXX  == CORE:CCB    9:2
178      X010XXXX  == CORE:CCB    1:1
179      X011XXXX  == CORE:CCB    3:2
180      X100XXXX  == CORE:CCB    2:1
181      X101XXXX  == CORE:CCB    5:2
182      X110XXXX  == CORE:CCB    3:1
183      X111XXXX  == CORE:CCB    7:2
184      XXXX0000  == CCB:SYSCLK 16:1
185      XXXX0001  == RESERVED
186      XXXX0010  == CCB:SYSCLK  2:1
187      XXXX0011  == CCB:SYSCLK  3:1
188      XXXX0100  == CCB:SYSCLK  4:1
189      XXXX0101  == CCB:SYSCLK  5:1
190      XXXX0110  == CCB:SYSCLK  6:1
191      XXXX0111  == RESERVED
192      XXXX1000  == CCB:SYSCLK  8:1
193      XXXX1001  == CCB:SYSCLK  9:1
194      XXXX1010  == CCB:SYSCLK 10:1
195      XXXX1011  == RESERVED
196      XXXX1100  == CCB:SYSCLK 12:1
197      XXXX1101  == CCB:SYSCLK 20:1
198      XXXX1110  == RESERVED
199      XXXX1111  == RESERVED
200
201
202eDINK Info
203----------
204
205One bank of flash may contain an eDINK image.
206
207Memory Map:
208
209   CCSRBAR @ 0xe0000000
210   Flash Bank 1 @ 0xfe000000
211   Flash Bank 2 @ 0xff000000
212   Ram @ 0
213
214Commands for downloading a U-Boot image to memory from edink:
215
216   env -c
217   time -s 4/8/2004 4:30p
218   dl -k -b -o 100000
219   [Drop to kermit:
220	^\c
221	transmit /binary <u-boot-bin-image>
222	c
223   ]
224
225   fu -l 100000 fe780000 80000
226

README.multi-dtb-fit

1MULTI DTB FIT and SPL_MULTI_DTB_FIT
2
3The purpose of this feature is to enable U-Boot or the SPL to select its DTB
4from a FIT appended at the end of the binary.
5It comes in two flavors: U-Boot (CONFIG_MULTI_DTB_FIT) and SPL
6(CONFIG_SPL_MULTI_DTB_FIT).
7
8U-Boot flavor:
9Usually the DTB is selected by the SPL and passed down to U-Boot. But some
10platforms don't use the SPL. In this case MULTI_DTB_FIT can used to provide
11U-Boot with a choice of DTBs.
12The relevant DTBs are packed into a FIT (list provided by CONFIG__OF_LIST). The
13FIT is automatically generated at the end of the compilation and appended to
14u-boot.bin so that U-Boot can locate it and select the correct DTB from inside
15the FIT.
16The selection is done using board_fit_config_name_match() (same as what the SPL
17uses to select the DTB for U-Boot). The selection happens during fdtdec_setup()
18which is called during before relocation by board_init_f().
19
20SPL flavor:
21the SPL uses only a small subset of the DTB and it usually depends more
22on the SOC than on the board. So it's usually fine to include a DTB in the
23SPL that doesn't exactly match the board. There are howerver some cases
24where it's not possible. In the later case, in order to support multiple
25boards (or board revisions) with the same SPL binary, SPL_MULTI_DTB_FIT
26can be used.
27The relevant DTBs are packed into a FIT. This FIT is automatically generated
28at the end of the compilation, compressed and appended to u-boot-spl.bin, so
29that SPL can locate it and select the correct DTB from inside the FIT.
30CONFIG_SPL__OF_LIST is used to list the relevant DTBs.
31The compression stage is optional but reduces the impact on the size of the
32SPL. LZO and GZIP compressions are supported. By default, the area where the
33FIT is uncompressed is dynamicaly allocated but this behaviour can be changed
34for platforms that don't provide a HEAP big enough to contain the uncompressed
35FIT.
36The SPL uses board_fit_config_name_match() to find the correct DTB within the
37FIT (same as what the SPL uses to select the DTB for U-Boot).
38Uncompression and selection stages happen in fdtdec_setup() which is called
39during the early initialization stage of the SPL (spl_early_init() or
40spl_init())
41
42Impacts and performances (SPL flavor):
43The impact of this option is relatively small. Here are some numbers measured
44for a TI DRA72 platform:
45
46                            +----------+------------+-----------+------------+
47                            |  size    | size delta | SPL boot  | boot time  |
48                            |  (bytes) | (bytes)    | time (s)  | delta (s)  |
49+---------------------------+----------+------------+-----------+------------+
50| 1 DTB                     |          |            |           |            |
51+---------------------------+----------+------------+-----------+------------+
52| reference                 |   125305 |          0 |     1.389 |          0 |
53| LZO (dynamic allocation)  |   125391 |         86 |     1.381 |     -0.008 |
54+---------------------------+----------+------------+-----------+------------+
55| 4 DTBs (DRA7, DRA71,      |          |            |           |            |
56| DRA72, DRA72 revC)        |          |            |           |            |
57+---------------------------+----------+------------+-----------+------------+
58| LZO (dynamic allocation)  |   125991 |        686 |      1.39 |      0.001 |
59| LZO (user defined area)   |   125927 |        622 |     1.403 |      0.014 |
60| GZIP (user defined area)  |   133880 |       8575 |     1.421 |      0.032 |
61| No compression (in place) |   137472 |      12167 |     1.412 |      0.023 |
62+---------------------------+----------+------------+-----------+------------+
63
64Note: SPL boot time is the time elapsed between the 'reset' command is entered
65and the time when the first U-Boot (not SPL) version string is displayed.
66

README.mxc_ocotp

1Driver implementing the fuse API for Freescale's On-Chip OTP Controller (OCOTP)
2on MXC
3
4This IP can be found on the following SoCs:
5 - Vybrid VF610,
6 - i.MX6.
7
8Note that this IP is different from albeit similar to the IPs of the same name
9that can be found on the following SoCs:
10 - i.MX23,
11 - i.MX28,
12 - i.MX50.
13
14The section numbers in this file refer to the i.MX6 Reference Manual.
15
16A fuse word contains 32 fuse bit slots, as explained in 46.2.1.
17
18A bank contains 8 fuse word slots, as explained in 46.2.1 and shown by the
19memory map in 46.4.
20
21Some fuse bit or word slots may not have the corresponding fuses actually
22implemented in the fusebox.
23
24See the README files of the SoCs using this driver in order to know the
25conventions used by U-Boot to store some specific data in the fuses, e.g. MAC
26addresses.
27
28Fuse operations:
29
30   Read
31      Read operations are implemented as read accesses to the shadow registers,
32      using "Bankx Wordy" from the memory map in 46.4. This is explained in
33      detail by the first two paragraphs in 46.2.1.2.
34
35   Sense
36      Sense operations are implemented as the direct fusebox read explained by
37      the steps in 46.2.1.2.
38
39   Program
40      Program operations are implemented as explained by the steps in 46.2.1.3.
41      Following this operation, the shadow registers are not reloaded by the
42      hardware.
43
44   Override
45      Override operations are implemented as write accesses to the shadow
46      registers, as explained by the first paragraph in 46.2.1.3.
47
48Configuration:
49
50   CONFIG_MXC_OCOTP
51      Define this to enable the mxc_ocotp driver.
52

README.nand

1# SPDX-License-Identifier: GPL-2.0+
2NAND FLASH commands and notes
3
4See NOTE below!!!
5
6# (C) Copyright 2003
7# Dave Ellis, SIXNET, dge@sixnetio.com
8#
9
10Commands:
11
12   nand bad
13      Print a list of all of the bad blocks in the current device.
14
15   nand device
16      Print information about the current NAND device.
17
18   nand device num
19      Make device `num' the current device and print information about it.
20
21   nand erase off|partition size
22   nand erase clean [off|partition size]
23      Erase `size' bytes starting at offset `off'. Alternatively partition
24      name can be specified, in this case size will be eventually limited
25      to not exceed partition size (this behaviour applies also to read
26      and write commands). Only complete erase blocks can be erased.
27
28      If `erase' is specified without an offset or size, the entire flash
29      is erased. If `erase' is specified with partition but without an
30      size, the entire partition is erased.
31
32      If `clean' is specified, a JFFS2-style clean marker is written to
33      each block after it is erased.
34
35      This command will not erase blocks that are marked bad. There is
36      a debug option in cmd_nand.c to allow bad blocks to be erased.
37      Please read the warning there before using it, as blocks marked
38      bad by the manufacturer must _NEVER_ be erased.
39
40   nand info
41      Print information about all of the NAND devices found.
42
43   nand read addr ofs|partition size
44      Read `size' bytes from `ofs' in NAND flash to `addr'.  Blocks that
45      are marked bad are skipped.  If a page cannot be read because an
46      uncorrectable data error is found, the command stops with an error.
47
48   nand read.oob addr ofs|partition size
49      Read `size' bytes from the out-of-band data area corresponding to
50      `ofs' in NAND flash to `addr'. This is limited to the 16 bytes of
51      data for one 512-byte page or 2 256-byte pages. There is no check
52      for bad blocks or ECC errors.
53
54   nand write addr ofs|partition size
55      Write `size' bytes from `addr' to `ofs' in NAND flash.  Blocks that
56      are marked bad are skipped.  If a page cannot be read because an
57      uncorrectable data error is found, the command stops with an error.
58
59      As JFFS2 skips blocks similarly, this allows writing a JFFS2 image,
60      as long as the image is short enough to fit even after skipping the
61      bad blocks.  Compact images, such as those produced by mkfs.jffs2
62      should work well, but loading an image copied from another flash is
63      going to be trouble if there are any bad blocks.
64
65   nand write.trimffs addr ofs|partition size
66      Enabled by the CONFIG_CMD_NAND_TRIMFFS macro. This command will write to
67      the NAND flash in a manner identical to the 'nand write' command
68      described above -- with the additional check that all pages at the end
69      of eraseblocks which contain only 0xff data will not be written to the
70      NAND flash. This behaviour is required when flashing UBI images
71      containing UBIFS volumes as per the UBI FAQ[1].
72
73      [1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo
74
75   nand write.oob addr ofs|partition size
76      Write `size' bytes from `addr' to the out-of-band data area
77      corresponding to `ofs' in NAND flash. This is limited to the 16 bytes
78      of data for one 512-byte page or 2 256-byte pages. There is no check
79      for bad blocks.
80
81   nand read.raw addr ofs|partition [count]
82   nand write.raw addr ofs|partition [count]
83      Read or write one or more pages at "ofs" in NAND flash, from or to
84      "addr" in memory.  This is a raw access, so ECC is avoided and the
85      OOB area is transferred as well.  If count is absent, it is assumed
86      to be one page.  As with .yaffs2 accesses, the data is formatted as
87      a packed sequence of "data, oob, data, oob, ..." -- no alignment of
88      individual pages is maintained.
89
90Configuration Options:
91
92   CONFIG_SYS_NAND_U_BOOT_OFFS
93	NAND Offset from where SPL will read u-boot image. This is the starting
94	address of u-boot MTD partition in NAND.
95
96   CONFIG_CMD_NAND
97      Enables NAND support and commands.
98
99   CONFIG_CMD_NAND_TORTURE
100      Enables the torture command (see description of this command below).
101
102   CONFIG_SYS_MAX_NAND_DEVICE
103      The maximum number of NAND devices you want to support.
104
105   CONFIG_SYS_NAND_MAX_ECCPOS
106      If specified, overrides the maximum number of ECC bytes
107      supported.  Useful for reducing image size, especially with SPL.
108      This must be at least 48 if nand_base.c is used.
109
110   CONFIG_SYS_NAND_MAX_OOBFREE
111      If specified, overrides the maximum number of free OOB regions
112      supported.  Useful for reducing image size, especially with SPL.
113      This must be at least 2 if nand_base.c is used.
114
115   CONFIG_SYS_NAND_MAX_CHIPS
116      The maximum number of NAND chips per device to be supported.
117
118   CONFIG_SYS_NAND_SELF_INIT
119      Traditionally, glue code in drivers/mtd/nand/raw/nand.c has driven
120      the initialization process -- it provides the mtd and nand
121      structs, calls a board init function for a specific device,
122      calls nand_scan(), and registers with mtd.
123
124      This arrangement does not provide drivers with the flexibility to
125      run code between nand_scan_ident() and nand_scan_tail(), or other
126      deviations from the "normal" flow.
127
128      If a board defines CONFIG_SYS_NAND_SELF_INIT, drivers/mtd/nand/raw/nand.c
129      will make one call to board_nand_init(), with no arguments.  That
130      function is responsible for calling a driver init function for
131      each NAND device on the board, that performs all initialization
132      tasks except setting mtd->name, and registering with the rest of
133      U-Boot.  Those last tasks are accomplished by calling  nand_register()
134      on the new mtd device.
135
136      Example of new init to be added to the end of an existing driver
137      init:
138
139	/* chip is struct nand_chip, and is now provided by the driver. */
140	mtd = nand_to_mtd(&chip);
141
142	/*
143	 * Fill in appropriate values if this driver uses these fields,
144	 * or uses the standard read_byte/write_buf/etc. functions from
145	 * nand_base.c that use these fields.
146	 */
147	chip.IO_ADDR_R = ...;
148	chip.IO_ADDR_W = ...;
149
150	if (nand_scan_ident(mtd, CONFIG_SYS_MAX_NAND_CHIPS, NULL))
151		error out
152
153	/*
154	 * Insert here any code you wish to run after the chip has been
155	 * identified, but before any other I/O is done.
156	 */
157
158	if (nand_scan_tail(mtd))
159		error out
160
161	/*
162	 * devnum is the device number to be used in nand commands
163	 * and in mtd->name.  Must be less than CONFIG_SYS_MAX_NAND_DEVICE.
164	 */
165	if (nand_register(devnum, mtd))
166		error out
167
168      In addition to providing more flexibility to the driver, it reduces
169      the difference between a U-Boot driver and its Linux counterpart.
170      nand_init() is now reduced to calling board_nand_init() once, and
171      printing a size summary.  This should also make it easier to
172      transition to delayed NAND initialization.
173
174      Please convert your driver even if you don't need the extra
175      flexibility, so that one day we can eliminate the old mechanism.
176
177
178   CONFIG_SYS_NAND_ONFI_DETECTION
179	Enables detection of ONFI compliant devices during probe.
180	And fetching device parameters flashed on device, by parsing
181	ONFI parameter page.
182
183Platform specific options
184=========================
185   CONFIG_NAND_OMAP_GPMC
186	Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
187	GPMC controller is used for parallel NAND flash devices, and can
188	do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
189	and BCH16 ECC algorithms.
190
191   CONFIG_NAND_OMAP_ELM
192	Enables omap_elm.c driver for OMAPx and AMxxxx platforms.
193	ELM controller is used for ECC error detection (not ECC calculation)
194	of BCH4, BCH8 and BCH16 ECC algorithms.
195	Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
196	thus such SoC platforms need to depend on software library for ECC error
197	detection. However ECC calculation on such plaforms would still be
198	done by GPMC controller.
199
200   CONFIG_SPL_NAND_AM33XX_BCH
201	Enables SPL-NAND driver (am335x_spl_bch.c) which supports ELM based
202        hardware ECC correction. This is useful for platforms which have ELM
203	hardware engine and use NAND boot mode.
204	Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
205	so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
206        SPL-NAND driver with software ECC correction support.
207
208   CONFIG_NAND_OMAP_ECCSCHEME
209	On OMAP platforms, this CONFIG specifies NAND ECC scheme.
210	It can take following values:
211	OMAP_ECC_HAM1_CODE_SW
212		1-bit Hamming code using software lib.
213		(for legacy devices only)
214	OMAP_ECC_HAM1_CODE_HW
215		1-bit Hamming code using GPMC hardware.
216		(for legacy devices only)
217	OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
218		4-bit BCH code (unsupported)
219	OMAP_ECC_BCH4_CODE_HW
220		4-bit BCH code (unsupported)
221	OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
222		8-bit BCH code with
223		- ecc calculation using GPMC hardware engine,
224		- error detection using software library.
225		- requires CONFIG_BCH to enable software BCH library
226		(For legacy device which do not have ELM h/w engine)
227	OMAP_ECC_BCH8_CODE_HW
228		8-bit BCH code with
229		- ecc calculation using GPMC hardware engine,
230		- error detection using ELM hardware engine.
231	OMAP_ECC_BCH16_CODE_HW
232		16-bit BCH code with
233		- ecc calculation using GPMC hardware engine,
234		- error detection using ELM hardware engine.
235
236	How to select ECC scheme on OMAP and AMxx platforms ?
237	-----------------------------------------------------
238	Though higher ECC schemes have more capability to detect and correct
239	bit-flips, but still selection of ECC scheme is dependent on following
240	- hardware engines present in SoC.
241		Some legacy OMAP SoC do not have ELM h/w engine thus such
242		SoC cannot support BCHx_HW ECC schemes.
243	- size of OOB/Spare region
244		With higher ECC schemes, more OOB/Spare area is required to
245		store ECC. So choice of ECC scheme is limited by NAND oobsize.
246
247	In general following expression can help:
248		NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
249	where
250		NAND_OOBSIZE	= number of bytes available in
251				OOB/spare area per NAND page.
252		NAND_PAGESIZE	= bytes in main-area of NAND page.
253		ECC_BYTES	= number of ECC bytes generated to
254				protect 512 bytes of data, which is:
255				3 for HAM1_xx ecc schemes
256				7 for BCH4_xx ecc schemes
257				14 for BCH8_xx ecc schemes
258				26 for BCH16_xx ecc schemes
259
260		example to check for BCH16 on 2K page NAND
261		NAND_PAGESIZE = 2048
262		NAND_OOBSIZE = 64
263		2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
264		Thus BCH16 cannot be supported on 2K page NAND.
265
266		However, for 4K pagesize NAND
267		NAND_PAGESIZE = 4096
268		NAND_OOBSIZE = 224
269		ECC_BYTES = 26
270		2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
271		Thus BCH16 can be supported on 4K page NAND.
272
273
274    CONFIG_NAND_OMAP_GPMC_PREFETCH
275	On OMAP platforms that use the GPMC controller
276	(CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
277	uses the prefetch mode to speed up read operations.
278
279NOTE:
280=====
281
282The Disk On Chip driver is currently broken and has been for some time.
283There is a driver in drivers/mtd/nand/raw, taken from Linux, that works with
284the current NAND system but has not yet been adapted to the u-boot
285environment.
286
287Additional improvements to the NAND subsystem by Guido Classen, 10-10-2006
288
289JFFS2 related commands:
290
291  implement "nand erase clean" and old "nand erase"
292  using both the new code which is able to skip bad blocks
293  "nand erase clean" additionally writes JFFS2-cleanmarkers in the oob.
294
295Miscellaneous and testing commands:
296  "markbad [offset]"
297  create an artificial bad block (for testing bad block handling)
298
299  "scrub [offset length]"
300  like "erase" but don't skip bad block. Instead erase them.
301  DANGEROUS!!! Factory set bad blocks will be lost. Use only
302  to remove artificial bad blocks created with the "markbad" command.
303
304  "torture offset [size]"
305  Torture block to determine if it is still reliable.
306  Enabled by the CONFIG_CMD_NAND_TORTURE configuration option.
307  This command returns 0 if the block is still reliable, else 1.
308  If the block is detected as unreliable, it is up to the user to decide to
309  mark this block as bad.
310  The analyzed block is put through 3 erase / write cycles (or less if the block
311  is detected as unreliable earlier).
312  This command can be used in scripts, e.g. together with the markbad command to
313  automate retries and handling of possibly newly detected bad blocks if the
314  nand write command fails.
315  It can also be used manually by users having seen some NAND errors in logs to
316  search the root cause of these errors.
317  The underlying nand_torture() function is also useful for code willing to
318  automate actions following a nand->write() error. This would e.g. be required
319  in order to program or update safely firmware to NAND, especially for the UBI
320  part of such firmware.
321  Optionally, a second parameter size can be given to test multiple blocks with
322  one call. If size is not a multiple of the NAND's erase size, then the block
323  that contains offset + size will be tested in full. If used with size, this
324  command returns 0 if all tested blocks have been found reliable, else 1.
325
326
327NAND locking command (for chips with active LOCKPRE pin)
328
329  "nand lock"
330  set NAND chip to lock state (all pages locked)
331
332  "nand lock tight"
333  set NAND chip to lock tight state (software can't change locking anymore)
334
335  "nand lock status"
336  displays current locking status of all pages
337
338  "nand unlock [offset] [size]"
339  unlock consecutive area (can be called multiple times for different areas)
340
341  "nand unlock.allexcept [offset] [size]"
342  unlock all except specified consecutive area
343
344I have tested the code with board containing 128MiB NAND large page chips
345and 32MiB small page chips.
346

README.nand-boot-ppc440

1-----------------------------
2NAND boot on PPC440 platforms
3-----------------------------
4
5This document describes the U-Boot NAND boot feature as it
6is implemented for the AMCC Sequoia (PPC440EPx) board.
7
8The PPC440EP(x)/GR(x) cpu's can boot directly from NAND FLASH,
9completely without NOR FLASH. This can be done by using the NAND
10boot feature of the 440 NAND flash controller (NDFC).
11
12Here a short description of the different boot stages:
13
14a) IPL (Initial Program Loader, integrated inside CPU)
15------------------------------------------------------
16Will load first 4k from NAND (SPL) into cache and execute it from there.
17
18b) SPL (Secondary Program Loader)
19---------------------------------
20Will load special U-Boot version (NUB) from NAND and execute it. This SPL
21has to fit into 4kByte. It sets up the CPU and configures the SDRAM
22controller and the NAND controller so that the special U-Boot image can be
23loaded from NAND to SDRAM.
24This special image is build in the directory "nand_spl".
25
26c) NUB (NAND U-Boot)
27--------------------
28This NAND U-Boot (NUB) is a special U-Boot version which can be started
29from RAM. Therefore it mustn't (re-)configure the SDRAM controller.
30
31On 440EPx the SPL is copied to internal SRAM before the NAND controller
32is set up. While still running from cache, I experienced problems accessing
33the NAND controller.
34
35
36Example: Build and install NAND boot image for Sequoia (440EPx):
37
38a) Configure for sequoia with NAND boot support:
39# make sequoia_nand_config
40
41b) Build image(s)
42# make
43
44This will generate the SPL image in the "nand_spl" directory:
45nand_spl/u-boot-spl.bin
46Also another image is created spanning a whole NAND block (16kBytes):
47nand_spl/u-boot-spl-16k.bin
48The main NAND U-Boot image is generated in the toplevel directory:
49u-boot.bin
50A combined image of u-boot-spl-16k.bin and u-boot.bin is also created:
51u-boot-nand.bin
52
53This image should be programmed at offset 0 in the NAND flash:
54
55# tftp 100000 /tftpboot/sequoia/u-boot-nand.bin
56# nand erase 0 60000
57# nand write 100000 0 60000
58
59
60September 07 2006, Stefan Roese <sr@denx.de>
61

README.ne2000

1This driver supports NE2000 compatible cards (those based on DP8390,
2DP83902 and similar). It can be used with PCMCIA/CF cards provided
3that the CCR is correctly initialized.
4
5The code is based on sources from the Linux kernel (pcnet_cs.c,
68390.h) and eCOS(if_dp83902a.c, if_dp83902a.h). Both of these 2
7wonderful world are GPL, so this is, of course, GPL.
8
9I developed and tested this driver on a custom PXA255 based system and
10with a billionton CF network card connected to the PCMCIA interface of
11the micro (have a look at README.PXA_CF for the support of this port).
12
13The options you have to specify in the config file are (with the
14value for my board as an example):
15
16#define CONFIG_DRIVER_NE2000
17
18- Enables the driver
19
20#define CONFIG_DRIVER_NE2000_BASE (0x20000000+0x300)
21
22- Address where the board is mapped
23
24#define CONFIG_DRIVER_NE2000_CCR (0x28000000+0x3f8)
25
26- Address of the CCR (card configuration register). It could be found
27by enabling DEBUG in cmd_pcmcia.c. If this is not defined nothing is
28done as far as PCMCIA support is concerned.
29
30#define CONFIG_DRIVER_NE2000_VAL (0x20)
31
32- The value to be written in the CCR. It selects among different I/O
33spaces that could be used by the card.
34
35
36Enjoy!
37
38Christian Pellegrin <chri@ascensit.com>
39

README.nios2

1Nios II is a 32-bit embedded-processor architecture designed
2specifically for the Altera family of FPGAs.
3
4Please refer to the link for more information on Nios II,
5https://www.altera.com/products/processors/overview.html
6
7Please refer to the link for Linux port and toolchains,
8http://rocketboards.org/foswiki/view/Documentation/NiosIILinuxUserManual
9
10The Nios II port of u-boot is controlled by device tree. Please check
11out doc/README.fdt-control.
12
13To add a new board/configuration (eg, mysystem) to u-boot, you will need
14three files.
15
161. The device tree source which describes the hardware, dts file.
17    arch/nios2/dts/mysystem.dts
18
192. Default configuration of Kconfig, defconfig file.
20    configs/mysystem_defconfig
21
223. The legacy board header file.
23    include/configs/mysystem.h
24
25The device tree source must be generated from your qsys/sopc design
26using the sopc2dts tool. Then modified to fit your configuration. Please
27find the sopc2dts download and usage at the wiki,
28http://www.alterawiki.com/wiki/Sopc2dts
29
30$ java -jar sopc2dts.jar --force-altr -i mysystem.sopcinfo -o mysystem.dts
31
32You will need to add additional properties to the dts. Please find an
33example at, arch/nios2/dts/10m50_devboard.dts.
34
351. Add "stdout-path=..." property with your serial path to the chosen
36node, like this,
37	chosen {
38		stdout-path = &uart_0;
39	};
40
412. If you use SPI/EPCS or I2C, you will need to add aliases to number
42the sequence of these devices, like this,
43	aliases {
44		spi0 = &epcs_controller;
45	};
46
47Next, you will need a default config file. You may start with
4810m50_defconfig, modify the options and save it.
49
50$ make 10m50_defconfig
51$ make menuconfig
52$ make savedefconfig
53$ cp defconfig configs/mysystem_defconfig
54
55You will need to change the names of board header file and device tree,
56and select the drivers with menuconfig.
57
58Nios II architecture  --->
59  (mysystem) Board header file
60Device Tree Control  --->
61  (mysystem) Default Device Tree for DT control
62
63There is a selection of "Provider of DTB for DT control" in the Device
64Tree Control menu.
65
66( ) Separate DTB for DT control, will cat the dtb to end of u-boot
67binary, output u-boot-dtb.bin. This should be used for production.
68If you use boot copier, like EPCS boot copier, make sure the copier
69copies all the u-boot-dtb.bin, not just u-boot.bin.
70
71( ) Embedded DTB for DT control, will include the dtb inside the u-boot
72binary. This is handy for development, eg, using gdb or nios2-download.
73
74The last thing, legacy board header file describes those config options
75not covered in Kconfig yet. You may copy it from 10m50_devboard.h.
76
77$ cp include/configs/10m50_devboard.h include/configs/mysystem.h
78
79Please change the SDRAM base and size to match your board. The base
80should be cached virtual address, for Nios II with MMU it is 0xCxxx_xxxx
81to 0xDxxx_xxxx.
82
83#define CONFIG_SYS_SDRAM_BASE		0xc8000000
84#define CONFIG_SYS_SDRAM_SIZE		0x08000000
85
86You will need to change the environment variables location and setting,
87too. You may change other configs to fit your board.
88
89After all these changes, you may build and test.
90
91$ export CROSS_COMPILE=nios2-elf-  (or nios2-linux-gnu-)
92$ make mysystem_defconfig
93$ make
94
95Enjoy!
96

README.nokia_rx51

1Board: Nokia RX-51 aka N900
2
3This board definition results in a u-boot.bin which can be chainloaded
4from NOLO in qemu or on a real N900. It does very little hardware config
5because NOLO has already configured the board. Only needed is enabling
6internal eMMC memory via twl4030 regulator which is not enabled by NOLO.
7
8NOLO is expecting a kernel image and will treat any image it finds in
9onenand as such. This u-boot is intended to be flashed to the N900 like
10a kernel. In order to transparently boot the original kernel, it will be
11appended to u-boot.bin at 0x40000. NOLO will load the entire image into
12(random) memory and execute u-boot, which saves hw revision, boot reason
13and boot mode ATAGs set by NOLO. Then the bootscripts will attempt to load
14uImage or boot.scr from a fat, ext2/ext3 or ext4 filesystem in external
15SD card or internal eMMC memory. If this fails or keyboard is closed then
16the appended kernel image will be booted using some generated and some
17stored ATAGs (see boot order).
18
19There is support for hardware watchdog. Hardware watchdog is started by
20NOLO so u-boot must kick watchdog to prevent reboot device (but not very
21often, max every 2 seconds). There is also support for framebuffer display
22output with ANSI espace codes and the N900 HW keyboard input. USB tty works
23but is disabled because it prevents the current Maemo kernel from booting.
24
25When U-Boot is starting it enable IBE bit in Auxiliary Control Register,
26which is needed for Thumb-2 ISA support. It is workaround for errata 430973.
27
28Default boot order:
29
30 * 0. if keyboard is closed boot automatically attached kernel image
31 * 1. try boot from external SD card
32 * 2. try boot from internal eMMC memory
33 * 3. try boot from attached kernel image
34
35Boot from SD or eMMC in this order:
36
37 * 1.
38   * 1.1 find boot.scr on first fat partition
39   * 1.2 find uImage on first fat parition
40   * 1.3 same order for 2. - 4. fat partition
41 * 2. same as 1. but for ext2/3 partition
42 * 3. same as 1. but for ext4 partition
43
44
45Available additional commands/variables:
46
47 * run sercon - Use serial port for control
48 * run usbcon - Use usbtty for control
49 * run vgacon - Use framebuffer and HW keyboard for control (default)
50
51 * run sdboot - Boot from external SD card (see boot order)
52 * run emmcboot - Boot from internal eMMC memory (see boot order)
53 * run attachboot - Boot attached kernel image (attached to U-Boot binary)
54
55 * run scriptload - Load boot script ${mmcscriptfile}
56 * run scriptboot - Run loaded boot script
57 * run kernload - Load kernel image ${mmckernfile}
58 * run initrdload - Load initrd image ${mmcinitrdfile}
59 * run kernboot - Boot loaded kernel image
60 * run kerninitrdboot - Boot loaded kernel image with loaded initrd image
61
62 * run trymmcscriptboot - Try to load and boot script ${mmcscriptfile}
63 * run trymmckernboot - Try to load and boot kernel image ${mmckernfile}
64 * run trymmckerninitrdboot - Try to load and boot kernel image ${mmckernfile}
65			      with initrd image ${mmcinitrdfile}
66
67Additional variables for loading files from mmc:
68
69 * mmc ${mmcnum} (0 - external, 1 - internal)
70 * partition number ${mmcpart} (1 - 4)
71 * parition type ${mmctype} (fat, ext2)
72
73Additional varuables for booting kernel:
74
75 * setup_omap_atag - Add OMAP table into atags structure (needs maemo kernel)
76 * setup_console_atag - Enable serial console in OMAP table
77 * setup_boot_reason_atag - Change boot reason in OMAP table
78 * setup_boot_mode_atag - Change boot mode in OMAP table
79
80USB TTY:
81
82 Maemo kernel 2.6.28 will crash if u-boot enable usb tty. So USB TTY is disabled.
83 For enabling USB TTY just add this line to file include/configs/nokia_rx51.h
84
85 #define CONFIG_USB_TTY
86
87
88ONENAND support:
89
90 ONENAND support is disabled because not working yet and cause linux kernel to
91 crash or no access to mtd. For enabling ONENAND support add this line at begin
92 of file include/configs/nokia_rx51.h
93
94 #define ONENAND_SUPPORT
95
96
97UBIFS support:
98
99 UBIFS support is disabled, because U-Boot image is too big and cannot be
100 flashed with attached zImage to RX-51 kernel nand area. For enabling UBIFS
101 support first enable ONENAND support and then add this line at begin of file
102 include/configs/nokia_rx51.h
103
104 #define UBIFS_SUPPORT
105

README.nvme

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2017 NXP Semiconductors
4# Copyright (C) 2017 Bin Meng <bmeng.cn@gmail.com>
5
6What is NVMe
7============
8
9NVM Express (NVMe) is a register level interface that allows host software to
10communicate with a non-volatile memory subsystem. This interface is optimized
11for enterprise and client solid state drives, typically attached to the PCI
12express interface. It is a scalable host controller interface designed to
13address the needs of enterprise and client systems that utilize PCI express
14based solid state drives (SSD). The interface provides optimized command
15submission and completion paths. It includes support for parallel operation by
16supporting up to 64K I/O queues with up to 64K commands per I/O queue.
17
18The device is comprised of some number of controllers, where each controller
19is comprised of some number of namespaces, where each namespace is comprised
20of some number of logical blocks. A namespace is a quantity of non-volatile
21memory that is formatted into logical blocks. An NVMe namespace is equivalent
22to a SCSI LUN. Each namespace is operated as an independent "device".
23
24How it works
25------------
26There is an NVMe uclass driver (driver name "nvme"), an NVMe host controller
27driver (driver name "nvme") and an NVMe namespace block driver (driver name
28"nvme-blk"). The host controller driver is supposed to probe the hardware and
29do necessary initialization to put the controller into a ready state at which
30it is able to scan all available namespaces attached to it. Scanning namespace
31is triggered by the NVMe uclass driver and the actual work is done in the NVMe
32namespace block driver.
33
34Status
35------
36It only support basic block read/write functions in the NVMe driver.
37
38Config options
39--------------
40CONFIG_NVME	Enable NVMe device support
41CONFIG_CMD_NVME	Enable basic NVMe commands
42
43Usage in U-Boot
44---------------
45To use an NVMe hard disk from U-Boot shell, a 'nvme scan' command needs to
46be executed for all NVMe hard disks attached to the NVMe controller to be
47identified.
48
49To list all of the NVMe hard disks, try:
50
51  => nvme info
52  Device 0: Vendor: 0x8086 Rev: 8DV10131 Prod: CVFT535600LS400BGN
53	    Type: Hard Disk
54	    Capacity: 381554.0 MB = 372.6 GB (781422768 x 512)
55
56and print out detailed information for controller and namespaces via:
57
58  => nvme detail
59
60Raw block read/write to can be done via the 'nvme read/write' commands:
61
62  => nvme read a0000000 0 11000
63
64  => tftp 80000000 /tftpboot/kernel.itb
65  => nvme write 80000000 0 11000
66
67Of course, file system command can be used on the NVMe hard disk as well:
68
69  => fatls nvme 0:1
70	32376967   kernel.itb
71	22929408   100m
72
73	2 file(s), 0 dir(s)
74
75  => fatload nvme 0:1 a0000000 /kernel.itb
76  => bootm a0000000
77
78Testing NVMe with QEMU x86
79--------------------------
80QEMU supports NVMe emulation and we can test NVMe driver with QEMU x86 running
81U-Boot. Please see README.x86 for how to build u-boot.rom image for QEMU x86.
82
83Example command line to call QEMU x86 below with emulated NVMe device:
84$ ./qemu-system-i386 -drive file=nvme.img,if=none,id=drv0 -device nvme,drive=drv0,serial=QEMUNVME0001 -bios u-boot.rom
85

README.odroid

1 U-Boot for Odroid X2/U3/XU3/XU4/HC1
2========================
3
41. Summary
5==========
6This is a quick instruction for setup Odroid boards.
7Board config: odroid_config for X2/U3
8Board config: odroid-xu3_config for XU3/XU4/HC1
9
102. Supported devices
11====================
12This U-BOOT config can be used on three boards:
13- Odroid U3
14- Odroid X2
15with CPU Exynos 4412 rev 2.0 and 2GB of RAM
16- Odroid XU3
17- Odroid XU4
18- Odroid HC1
19with CPU Exynos5422 and 2GB of RAM
20
213. Boot sequence
22================
23iROM->BL1->(BL2 + TrustZone)->U-BOOT
24
25This version of U-BOOT doesn't implement SPL. So, BL1, BL2, and TrustZone
26binaries are needed to boot up.
27
28<< X2/U3 >>
29It can be found in "boot.tar.gz" from here:
30http://dev.odroid.com/projects/4412boot/wiki/FrontPage?action=download&value=boot.tar.gz
31or here:
32http://odroid.in/guides/ubuntu-lfs/boot.tar.gz
33
34<< XU3/XU4 >>
35It can be downloaded from:
36https://github.com/hardkernel/u-boot/tree/odroidxu3-v2012.07/sd_fuse/hardkernel_1mb_uboot
37
38
394. Boot media layout
40====================
41The table below shows SD/eMMC cards layout for U-Boot.
42The block offset is starting from 0 and the block size is 512B.
43 -------------------------------------
44|  Binary   | Block offset| part type |
45|   name    | SD   | eMMC |(eMMC only)|
46 -------------------------------------
47| Bl1       | 1    | 0    |  1 (boot) |
48| Bl2       | 31   | 30   |  1 (boot) |
49| U-Boot    | 63   | 62   |  1 (boot) |
50| Tzsw      | 2111 | 2110 |  1 (boot) |
51| Uboot Env | 2560 | 2560 |  0 (user) |
52 -------------------------------------
53
545. Prepare the SD boot card - with SD card reader
55=================================================
56To prepare bootable media you need boot binaries provided by hardkernel.
57From the downloaded files, You can find:
58- bl1.bin
59- tzsw.bin
60- bl2.bin
61- sd_fusing.sh
62- u-boot.bin
63(The file names can be slightly different, but you can distinguish what they are
64without problem)
65
66This is all you need to boot this board. But if you want to use your custom
67U-Boot then you need to change u-boot.bin with your own U-Boot binary*
68and run the script "sd_fusing.sh" - this script is valid only for SD card.
69
70*note:
71The proper binary file of current U-Boot is u-boot-dtb.bin.
72
73quick steps for Linux:
74- Download all files from the link at point 3 and extract it if needed.
75- put any SD card into the SD reader
76- check the device with "dmesg"
77- run ./sd_fusing.sh /dev/sdX - where X is SD card device (but not a partition)
78Check if Hardkernel U-Boot is booting, and next do the same with your U-Boot.
79
806. Prepare the eMMC boot card
81   with a eMMC card reader (boot from eMMC card slot)
82=====================================================
83To boot the device from the eMMC slot you should use a special card reader
84which supports eMMC partition switch. All of the boot binaries are stored
85on the eMMC boot partition which is normally hidden.
86
87The "sd_fusing.sh" script can be used after updating offsets of binaries
88according to the table from point 4. Be sure that you are working on the right
89eMMC partition - its size is usually very small, about 1-4 MiB.
90
917. Prepare the eMMC boot card
92   with a SD card reader (boot from SD card slot)
93=================================================
94If you have an eMMC->microSD adapter you can prepare the card as in point 5.
95But then the device can boot only from the SD card slot.
96
978. Prepare the boot media using Hardkernel U-Boot
98=================================================
99You can update the U-Boot to the custom one if you have a working bootloader
100delivered with the board on the eMMC/SD card. Then follow the steps:
101- install the android fastboot tool
102- connect a micro usb cable to the board
103- on the U-Boot prompt, run command: fastboot (as a root)
104- on the host, run command: "fastboot flash bootloader u-boot-dtb.bin"
105- the custom U-Boot should start after the board resets.
106
1079. Partition layout
108====================
109Default U-Boot environment is setup for fixed partition layout.
110
111Partition table: MSDOS. Disk layout and files as listed in the table below.
112 ----- ------ ------ ------ -------- ---------------------------------
113| Num | Name |  FS  | Size | Offset |         Reguired files          |
114|     |      | Type |  MiB |  MiB   |                                 |
115 ----- ------ ------ ------ -------- ---------------------------------
116|  1  | BOOT | fat  |  100 |   2    |  kernel, fdt**                  |
117|  2  | ROOT | ext4 |   -  |        |  any Linux system               |
118 ----- ------ ------ ------ -------- ---------------------------------
119
120**note:
121Supported fdt files are:
122- exynos4412-odroidx2.dtb
123- exynos4412-odroidu3.dtb
124- exynos5422-odroidxu3.dtb
125- exynos5422-odroidxu3-lite.dtb
126- exynos5422-odroidxu4.dtb
127- exynos5422-odroidhc1.dtb
128
129Supported kernel files are:
130- Image.itb
131- zImage
132- uImage
133
134The default environmental variable "dfu_alt_info" is set* for above layout.
135Each partition size is just an example, dfu_alt_info tries init two partitions.
136The size of each is not important.
137
138*note:
139$dfu_alt_info is set on a boot time and it is concatenated using two variables:
140- $dfu_alt_boot(set dynamically)
141- $dfu_alt_system(from current env).
142
143To add any changes to dfu_alt_info - please modify $dfu_alt_system only.
144Changes are visible after board reset.
145
14610. The environment and booting the kernel
147==========================================
148There are three macros defined in config for various boot options:
149Two for both, kernel with device tree support and also without it:
150- boot_uimg - load uImage
151- boot_zimg - load zImage
152If proper fdt file exists then it will be automatically loaded,
153so for old kernel types, please remove fdt file from boot partition.
154
155The third boot option for multi image support (more info: doc/uImage.FIT/)
156- boot_fit - for binary file: "Image.itb"
157
158Default boot command: "autoboot"
159And the boot sequence is:
160- boot_fit - if "Image.itb" exists
161- boot_zimg - if "zImage" exists
162- boot_uimg - if "uImage" exists
163
16411. USB host support
165====================
166NOTE: This section is only for Odroid X2/U3.
167
168The ethernet can be accessed after starting the USB subsystem in U-Boot.
169The adapter does not come with a preconfigured MAC address, and hence it needs
170to be set before starting USB.
171setenv usbethaddr 02:DE:AD:BE:EF:FF
172
173Note that in this example a locally managed MAC address is chosen. Care should
174be taken to make these MAC addresses unique within the same subnet.
175
176Start the USB subsystem:
177Odroid # setenv usbethaddr 02:DE:AD:BE:EF:FF
178Odroid # usb start
179(Re)start USB...
180USB0:   USB EHCI 1.00
181scanning bus 0 for devices... 4 USB Device(s) found
182       scanning usb for storage devices... 1 Storage Device(s) found
183       scanning usb for ethernet devices... 1 Ethernet Device(s) found
184Odroid #
185
186Automatic IP assignment:
187------------------------
188If the ethernet is connected to a DHCP server (router maybe with DHCP enabled),
189then the below will automatically assign an ip address through DHCP.
190setenv autoload no
191dhcp
192
193Odroid # setenv autoload no
194Odroid # dhcp
195Waiting for Ethernet connection... done.
196BOOTP broadcast 1
197DHCP client bound to address 192.168.1.10 (524 ms)
198Odroid #
199
200Note that this automatically sets the many IP address related variables in
201U-Boot that is obtained from the DHCP server.
202
203Odroid # printenv ipaddr netmask gatewayip dnsip
204ipaddr=192.168.1.10
205netmask=255.255.255.0
206gatewayip=192.168.1.1
207dnsip=192.168.1.1
208
209Ping example:
210The ping command can be used a test to check connectivity. In this example,
211192.168.1.27 is a pingable server in the network.
212Odroid # ping 192.168.1.27
213Waiting for Ethernet connection... done.
214Using sms0 device
215host 192.168.1.27 is alive
216Odroid #
217
218Static IP assignment:
219---------------------
220In the case where there are no DHCP servers in the network, or you want to
221set the IP address statically, it can be done by:
222Odroid # setenv ipaddr 192.168.1.10
223Odroid # ping 192.168.1.27
224Waiting for Ethernet connection... done.
225Using sms0 device
226host 192.168.1.27 is alive
227
228TFTP booting:
229-------------
230Say there exists a tftp server in the network with address 192.168.1.27 and
231it serves a kernel image (zImage.3.17) and a DTB blob (exynos4412-odroidu3.dtb)
232that needs to be loaded and booted. It can be accomplished as below:
233(Assumes that you have setenv usbethaddr, and have not set autoload to no)
234
235Odroid # setenv serverip 192.168.1.27
236Odroid # tftpboot 0x40080000 zImage.3.17
237Waiting for Ethernet connection... done.
238Using sms0 device
239TFTP from server 192.168.1.27; our IP address is 192.168.1.10
240Filename 'zImage.3.17'.
241Load address: 0x40080000
242Loading: #################################################################
243	 #################################################################
244	 #################################################################
245	 #######################
246	 52.7 KiB/s
247done
248Bytes transferred = 3194200 (30bd58 hex)
249Odroid # tftpboot 0x42000000 exynos4412-odroidu3.dtb
250Waiting for Ethernet connection... done.
251Using sms0 device
252TFTP from server 192.168.1.27; our IP address is 192.168.1.10
253Filename 'exynos4412-odroidu3.dtb'.
254Load address: 0x42000000
255Loading: ####
256	 40 KiB/s
257done
258Bytes transferred = 46935 (b757 hex)
259Odroid # printenv bootargs
260bootargs=Please use defined boot
261Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/mmcblk0p2 rootwait
262Odroid # bootz 40080000 - 42000000
263Kernel image @ 0x40080000 [ 0x000000 - 0x30bd58 ]
264## Flattened Device Tree blob at 42000000
265   Booting using the fdt blob at 0x42000000
266   Loading Device Tree to 4fff1000, end 4ffff756 ... OK
267
268Starting kernel ...
269
270[    0.000000] Booting Linux on physical CPU 0xa00
271... etc ...
272
273In the above example you can substitute 'dhcp' for 'tftpboot' as well.
274
275USB Storage booting:
276--------------------
277Similarly we can use the USB storage to load the kernel image/initrd/fdt etc
278and boot. For this example, there is a USB drive plugged in. It has a FAT
2791st partition and an EXT 2nd partition. Using the generic FS (ls/load) makes
280it even easier to work with FAT/EXT file systems.
281For this example the second EXT partition is used for booting and as rootfs.
282The boot files - kernel and the dtb are present in the /boot directory of the
283second partition.
284
285Odroid # usb start
286(Re)start USB...
287USB0:   USB EHCI 1.00
288scanning bus 0 for devices... 4 USB Device(s) found
289       scanning usb for storage devices... 1 Storage Device(s) found
290       scanning usb for ethernet devices...
291Error: sms0 address not set.		<----- Note the error as usbethaddr
292Warning: failed to set MAC address	<----- is not set.
2931 Ethernet Device(s) found
294Odroid # usb part 0
295
296Partition Map for USB device 0  --   Partition Type: DOS
297
298Part	Start Sector	Num Sectors	UUID		Type
299  1	3072      	263168    	000c4046-01	06
300  2	266240    	13457408  	000c4046-02	83
301
302Odroid # ls usb 0:2 /boot
303<DIR>       4096 .
304<DIR>       4096 ..
305             353 boot.scr
306             281 boot.txt
307          101420 config-3.8.13.23
308         2127254 initrd.img-3.8.13.23
309         2194825 uInitrd
310         2194825 uInitrd-3.8.13.23
311         2453112 zImage
312          101448 config-3.8.13.26
313         2127670 uInitrd-3.8.13.26
314         2127606 initrd.img-3.8.13.26
315         3194200 zImage.3.17                    <--- Kernel
316           46935 exynos4412-odroidu3.dtb        <--- DTB
317Odroid # load usb 0:2 40080000 /boot/zImage.3.17
3183194200 bytes read in 471 ms (6.5 MiB/s)
319Odroid # load usb 0:2 42000000 /boot/exynos4412-odroidu3.dtb
32046935 bytes read in 233 ms (196.3 KiB/s)
321Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/sda2 rootwait
322Odroid # bootz 40080000 - 42000000
323Kernel image @ 0x40080000 [ 0x000000 - 0x30bd58 ]
324## Flattened Device Tree blob at 42000000
325   Booting using the fdt blob at 0x42000000
326   Loading Device Tree to 4fff1000, end 4ffff756 ... OK
327
328Starting kernel ...
329
330[    0.000000] Booting Linux on physical CPU 0xa00
331
332Please refer to README.usb for additional information.
333

README.omap-ulpi-viewport

1Reference code ""drivers/usb/ulpi/omap-ulpi-viewport.c"
2
3Contains the ulpi read write api's to perform
4any ulpi phy port access on omap platform.
5
6On omap ehci reg map contains INSNREG05_ULPI
7register which offers the ulpi phy access so
8any ulpi phy commands should be passsed using this
9register.
10
11omap-ulpi-viewport.c is a low level function
12implementation of "drivers/usb/ulpi/ulpi.c"
13
14To enable and use omap-ulpi-viewport.c
15we require CONFIG_USB_ULPI_VIEWPORT_OMAP and
16CONFIG_USB_ULPI be enabled in config file.
17
18Any ulpi ops request can be done with ulpi.c
19and soc specific binding and usage is done with
20omap-ulpi-viewport implementation.
21
22Ex: scenario:
23omap-ehci driver code requests for ulpi phy reset if
24ehci is used in phy mode, which will call ulpi phy reset
25the ulpi phy reset does ulpi_read/write from viewport
26implementation which will do ulpi reset using the
27INSNREG05_ULPI register.
28

README.omap3

1
2Summary
3=======
4
5This README is about U-Boot support for TI's ARM Cortex-A8 based OMAP3 [1]
6family of SoCs. TI's OMAP3 SoC family contains an ARM Cortex-A8. Additionally,
7some family members contain a TMS320C64x+ DSP and/or an Imagination SGX 2D/3D
8graphics processor and various other standard peripherals.
9
10Currently the following boards are supported:
11
12* OMAP3530 BeagleBoard [2]
13
14* Gumstix Overo [3]
15
16* TI EVM [4]
17
18* OpenPandora Ltd. Pandora [5]
19
20* TI/Logic PD Zoom MDK [6]
21
22* TI/Logic PD Zoom 2 [7]
23
24* CompuLab Ltd. CM-T35 [8]
25
26Build
27=====
28
29* BeagleBoard:
30
31make omap3_beagle_config
32make
33
34* Gumstix Overo:
35
36make omap3_overo_config
37make
38
39* TI EVM:
40
41make omap3_evm_config
42make
43
44* Pandora:
45
46make omap3_pandora_config
47make
48
49* Zoom MDK:
50
51make omap3_zoom1_config
52make
53
54* Zoom 2:
55
56make omap3_zoom2_config
57make
58
59* CM-T35:
60
61make cm_t35_config
62make
63
64
65Custom commands
66===============
67
68To make U-Boot for OMAP3 support NAND device SW or HW ECC calculation, U-Boot
69for OMAP3 supports custom user command
70
71nandecc hw/sw
72
73To be compatible with NAND drivers using SW ECC (e.g. kernel code)
74
75nandecc sw
76
77enables SW ECC calculation. HW ECC enabled with
78
79nandecc hw
80
81is typically used to write 2nd stage bootloader (known as 'x-loader') which is
82executed by OMAP3's boot rom and therefore has to be written with HW ECC.
83
84For all other commands see
85
86help
87
88Interfaces
89==========
90
91gpio
92----
93
94To set a bit :
95
96	if (!gpio_request(N, "")) {
97		gpio_direction_output(N, 0);
98		gpio_set_value(N, 1);
99	}
100
101To clear a bit :
102
103	if (!gpio_request(N, "")) {
104		gpio_direction_output(N, 0);
105		gpio_set_value(N, 0);
106	}
107
108To read a bit :
109
110	if (!gpio_request(N, "")) {
111		gpio_direction_input(N);
112		val = gpio_get_value(N);
113		gpio_free(N);
114	}
115	if (val)
116		printf("GPIO N is set\n");
117	else
118		printf("GPIO N is clear\n");
119
120dma
121---
122void omap3_dma_init(void)
123	Init the DMA module
124int omap3_dma_get_conf_chan(uint32_t chan, struct dma4_chan *config);
125	Read config of the channel
126int omap3_dma_conf_chan(uint32_t chan, struct dma4_chan *config);
127	Write config to the channel
128int omap3_dma_conf_transfer(uint32_t chan, uint32_t *src, uint32_t *dst,
129		uint32_t sze)
130	Config source, destination and size of a transfer
131int omap3_dma_wait_for_transfer(uint32_t chan)
132	Wait for a transfer to end - this hast to be called before a channel
133	or the data the channel transferd are used.
134int omap3_dma_get_revision(uint32_t *minor, uint32_t *major)
135	Read silicon Revision of the DMA module
136
137NAND
138====
139
140There are some OMAP3 devices out there with NAND attached. Due to the fact that
141OMAP3 ROM code can only handle 1-bit hamming ECC for accessing first page
142(place where SPL lives) we require this setup for u-boot at least when reading
143the second progam within SPL.  A lot of newer NAND chips however require more
144than 1-bit ECC for the pages, some can live with 1-bit for the first page. To
145handle this we can switch to another ECC algorithm after reading the payload
146within SPL.
147
148BCH8
149----
150
151To enable hardware assisted BCH8 (8-bit BCH [Bose, Chaudhuri, Hocquenghem]) on
152OMAP3 devices we can use the BCH library in lib/bch.c. To do so add CONFIG_BCH
153and set CONFIG_NAND_OMAP_ECCSCHEME=5 (refer README.nand) for selecting BCH8_SW.
154The NAND OOB layout is the same as in linux kernel, if the linux kernel BCH8
155implementation for OMAP3 works for you so the u-boot version should also.
156When you require the SPL to read with BCH8 there are two more configs to
157change:
158
159 * CONFIG_SYS_NAND_ECCPOS (must be the same as .eccpos in
160   GPMC_NAND_HW_BCH8_ECC_LAYOUT defined in
161   arch/arm/include/asm/arch-omap3/omap_gpmc.h)
162 * CONFIG_SYS_NAND_ECCSIZE must be 512
163 * CONFIG_SYS_NAND_ECCBYTES must be 13 for this BCH8 setup
164
165Acknowledgements
166================
167
168OMAP3 U-Boot is based on U-Boot tar ball [9] for BeagleBoard and EVM done by
169several TI employees.
170
171Links
172=====
173
174[1] OMAP3:
175
176http://www.ti.com/omap3 (high volume) and
177http://www.ti.com/omap35x (broad market)
178
179[2] OMAP3530 BeagleBoard:
180
181http://beagleboard.org/
182
183[3] Gumstix Overo:
184
185http://www.gumstix.net/Overo/
186
187[4] TI EVM:
188
189http://focus.ti.com/docs/toolsw/folders/print/tmdxevm3503.html
190
191[5] OpenPandora Ltd. Pandora:
192
193http://openpandora.org/
194
195[6] TI/Logic PD Zoom MDK:
196
197http://www.logicpd.com/products/devkit/ti/zoom_mobile_development_kit
198
199[7] TI/Logic PD Zoom 2
200
201http://www.logicpd.com/sites/default/files/1012659A_Zoom_OMAP34x-II_MDP_Brief.pdf
202
203[8] CompuLab Ltd. CM-T35:
204
205http://www.compulab.co.il/t3530/html/t3530-cm-datasheet.htm
206
207[9] TI OMAP3 U-Boot:
208
209http://beagleboard.googlecode.com/files/u-boot_beagle_revb.tar.gz
210

README.pblimage

1------------------------------------------------------------------
2Freescale PBL(pre-boot loader) Boot Image generation using mkimage
3------------------------------------------------------------------
4
5The CoreNet SoC's can boot directly from eSPI FLASH, SD/MMC and
6NAND, etc. These SoCs use PBL to load RCW and/or pre-initialization
7instructions. For more details refer section 5 Pre-boot loader
8specifications of reference manual P3041RM/P4080RM/P5020RM at link:
9http://www.freescale.com/webapp/search/Serp.jsp?Reference+Manuals
10
11Building PBL Boot Image and boot steps
12--------------------------------------
13
141. Building PBL Boot Image.
15   The default Image is u-boot.pbl.
16
17   For eSPI boot(available on P2041/P3041/P4080/P5020/P5040/T4240):
18	To build the eSPI boot image:
19	make <board_name>_SPIFLASH
20
21   For SD boot(available on P2041/P3041/P4080/P5020/P5040/T4240):
22	To build the SD boot image:
23	make <board_name>_SDCARD
24
25   For Nand boot(available on P2041/P3041/P5020/P5040):
26	To build the NAND boot image:
27	make <board_name>_NAND
28
29
302. pblimage support available with mkimage utility will generate Freescale PBL
31boot image that can be flashed on the board eSPI flash, SD/MMC and NAND.
32Following steps describe it in detail.
33
34	1). Boot from eSPI flash
35	Write u-boot.pbl to eSPI flash from offset 0x0.
36	for ex in u-boot:
37	=>tftp 100000 u-boot.pbl
38	=>sf probe 0
39	=>sf erase 0 100000
40	=>sf write 100000 0 $filesize
41	Change SW1[1:5] = off off on off on.
42
43	2). Boot from SD/MMC
44	Write u-boot.pbl to SD/MMC from offset 0x1000.
45	for ex in u-boot:
46	=>tftp 100000 u-boot.pbl
47	=>mmcinfo
48	=>mmc write 100000 8 441
49	Change SW1[1:5] = off off on on off.
50
51	3). Boot from Nand
52	Write u-boot.pbl to Nand from offset 0x0.
53	for ex in u-boot:
54	=>tftp 100000 u-boot.pbl
55	=>nand info
56	=>nand erase 0 100000
57	=>nand write 100000 0 $filesize
58	Change SW1[1:5] = off on off off on
59	Change SW7[1:4] = on off off on
60
61Board specific configuration file specifications:
62------------------------------------------------
631. Configuration files rcw.cfg and pbi.cfg must present in the
64board/freescale/corenet_ds/, rcw.cfg is for RCW, pbi.cfg is for
65PBI instructions. File name must not be changed since they are used
66in Makefile.
672. These files can have empty lines and lines starting with "#" as first
68character to put comments
69
70Typical example of rcw.cfg file:
71-----------------------------------
72
73#PBL preamble and RCW header
74aa55aa55 010e0100
75#64 bytes RCW data
764c580000 00000000 18185218 0000cccc
7740464000 3c3c2000 58000000 61000000
7800000000 00000000 00000000 008b6000
7900000000 00000000 00000000 00000000
80
81Typical example of pbi.cfg file:
82-----------------------------------
83
84#PBI commands
85#Initialize CPC1
8609010000 00200400
8709138000 00000000
88091380c0 00000100
8909010100 00000000
9009010104 fff0000b
9109010f00 08000000
9209010000 80000000
93#Configure LAW for CPC1
9409000d00 00000000
9509000d04 fff00000
9609000d08 81000013
9709000010 00000000
9809000014 ff000000
9909000018 81000000
100#Initialize eSPI controller
10109110000 80000403
10209110020 2d170008
10309110024 00100008
10409110028 00100008
1050911002c 00100008
106#Flush PBL data
10709138000 00000000
108091380c0 00000000
109
110------------------------------------------------
111Author: Shaohui Xie<Shaohui.Xie@freescale.com>
112

README.plan9

1Plan 9 from Bell Labs kernel images require additional setup to pass
2configuration information to the kernel.  An environment variable named
3confaddr must be defined with the same value as CONFADDR (see mem.h).
4Use of this facility is optional, but should be preferable to manual
5configuration.
6
7When booting an image, arguments supplied to the bootm command will be
8copied to CONFADDR.  If no arguments are specified, the contents of the
9bootargs environment variable will be copied.
10
11If no command line arguments or bootargs are defined, CONFADDR is left
12uninitialized to permit manual configuration.  For example, PC-style
13configuration could be simulated by issuing a fatload in bootcmd:
14
15  # setenv bootcmd fatload mmc 0 $confaddr plan9.ini; ...; bootm
16
17Steven Stallion
18June 2013
19

README.power-framework

1#
2# (C) Copyright 2014 Samsung Electronics
3# Lukasz Majewski <l.majewski@samsung.com>
4#
5# SPDX-License-Identifier:      GPL-2.0+
6#
7
8Introduction
9------------
10
11This document describes the second version of the u-boot's PMIC (Power
12Management IC) framework. As a reference boards please consider Samsungs' Trats
13and Trats2.
14
15Background
16----------
17
18Boards supported by u-boot are getting increasingly complex. Developers and
19designers strive to cut down power consumption. Hence several different types of
20devices are now available on the board - namely power managers (PMIC), fuel
21gauges (FG), micro USB interface controllers (MUIC), batteries, multi-function
22devices (MFD).
23
24Explanation of key design decisions
25-----------------------------------
26
27One package can integrate PMIC and MUIC with different addresses on the I2C bus.
28The same device - e.g. MAX8997 uses two different I2C busses and addresses.
29
30Power devices use not only I2C for communication, but SPI as well. Additionally
31different ICs use different endianess. For this reason struct pmic holds
32information about I2C/SPI transmission, which is used with generic
33pmic_req_write() function.
34
35The "flat" hierarchy for power devices works well when each device performs only
36one operation - e.g. PMIC enables LDO.
37
38The problem emerges when we have a device (battery) which conceptually shall be
39the master and uses methods exported by other devices. We need to control MUIC
40to start charging the battery, use PMIC to reduce board's overall power
41consumption (by disabling not needed LDOs, BUCKs) and get current state of
42energy on the battery from FG.
43Up till now u-boot doesn't support device model, so a simple one had to be
44added.
45
46The directory hierarchy has following structure:
47./include/power/<device_name>_<device_function>.h
48e.g. ./include/power/max8997_pmic.h
49
50./drivers/power/pmic/power_{core files}.c
51e.g. ./drivers/power/pmic/power_core.c
52
53./drivers/power/pmic/<device_function>/<device_function>_<device_name>.c
54e.g. ./drivers/power/pmic/pmic_max8997.c
55e.g. ./drivers/power/battery/trats/bat_trats.c
56e.g. ./drivers/power/fuel_gauge/fg_max17042.c
57
58The framework classifies devices by their function - separate directories should
59be maintained for different classes of devices.
60
61Current design
62--------------
63
64Everything is a power device described by struct pmic. Even battery is
65considered as a valid power device. This helps for better management of those
66devices.
67
68- Block diagram of the hierarchy:
69			-----------------
70		--------| BAT           |------------
71		|       |               |           |
72		|       -----------------           |
73		|               |                   |
74	       \|/             \|/                 \|/
75	-----------     -----------------       ---------
76	|FG       |     |MUIC           |       |CHRG   |
77	|         |     |               |       |       |
78	-----------     -----------------       ---------
79
80
811. When hierarchy is not needed (no complex battery charge):
82
83Definition of the struct pmic is only required with proper name and parameters
84for communication. This is enough to use the "pmic" command in the u-boot
85prompt to change values of device's register (enable/disable LDO, BUCK).
86
87The PG, MUIC and CHRG above are regarded to be in the same level in the
88hierarchy.
89
902. Complex battery charging.
91
92To charge a battery, information from several "abstract" power devices is
93needed (defined at ./include/power/pmic.h):
94- FG device (struct power_fg):
95	     -- *fg_battery_check - check if battery is not above its limits
96	     -- *fg_battery_update - update the pmic framework with current
97				     battery state(voltage and current capacity)
98
99- Charger device (struct power_chrq):
100	     -- *chrg_type - type/capacity of the charger (including information
101			     about USB cable disconnection)
102	     -- *chrg_bat_present - detection if battery to be charged is
103				    present
104	     -- *chrg_state - status of the charger - if it is enabled or
105			      disabled
106
107- Battery device (struct power_battery):
108	     -- *battery_init - assign proper callbacks to be used by top
109				hierarchy battery device
110	     -- *battery_charge - called from "pmic" command, responsible
111				  for performing the charging
112
113Now two batteries are supported; trats and trats2 [*]. Those differ in the way
114how they handle the exact charging. Trats uses polling (MAX8997) and trats2
115relies on the PMIC/MUIC HW completely (MAX77693).
116
117__Example for trats (this can be very different for other board):__
118	     -- *fg_battery_check       -> FG device (fg_max17042.c)
119	     -- *fg_battery_update      -> FG device (fg_max17042.c)
120	     -- *chrg_type              -> MUIC device (muic_max8997.c)
121	     -- *chrg_bat_present       -> PMIC device (pmic_max8997.c)
122	     -- *chrg_state             -> PMIC device (pmic_max8997.c)
123	     -- *battery_init           -> BAT device (bat_trats.c)
124	     -- *battery_charge         -> BAT device (bat_trats.c)
125
126Also the struct pmic holds method (*low_power_mode) for reducing board's
127power consumption when one calls "pmic BAT_TRATS bat charge" command.
128
129How to add a new power device
130-----------------------------
131
1321. Simple device should be added with creation of file
133<pmic_function>_<pmic_name>.c, <pmic_name>_<pmic_function>.h  according to the
134proposed and described above scheme.
135
136Then "pmic" command supports reading/writing/dump of device's internal
137registers.
138
1392. Charging battery with hierarchy
140Define devices as listed at 1.
141
142Define battery file (bat_<board>.c). Please also note that one might need a
143corresponding battery model description for FG.
144
145For points 1 and 2 use a generic function power_init_board() to initialise the
146power framework on your board.
147
148For reference, please look into the trats/trats2 boards.
149
150TO DO list (for PMICv3) - up till v2014.04
151------------------------------------------
152
1531. Description of the devices related to power via device tree is not available.
154This is the main problem when a developer tries to build a multi-boot u-boot
155binary. The best would be to parse the DTS from Linux kernel.
156
1572. To support many instances of the same IC, like two MAX8997, one needs to
158copy the corresponding pmic_max8997.c file with changed name to "MAX8997_PMICX",
159where X is the device number. This problem will be addressed when extended
160pmic_core.c will support storing available devices in a list.
161
1623. Definition of batteries [*] (for trats/trats2) should be excluded from the
163code responsible for charging them and since it in fact describes the charging
164profile it should be put to a separate file.
165
1664. Adjust the framework to work with the device model.
167

README.pxe

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2010-2011 Calxeda, Inc.
4 */
5
6The 'pxe' commands provide a near subset of the functionality provided by
7the PXELINUX boot loader. This allows U-Boot based systems to be controlled
8remotely using the same PXE based techniques that many non U-Boot based servers
9use.
10
11Commands
12========
13
14pxe get
15-------
16     syntax: pxe get
17
18     follows PXELINUX's rules for retrieving configuration files from a tftp
19     server, and supports a subset of PXELINUX's config file syntax.
20
21     Environment
22     -----------
23     'pxe get' requires two environment variables to be set:
24
25     pxefile_addr_r - should be set to a location in RAM large enough to hold
26     pxe files while they're being processed. Up to 16 config files may be
27     held in memory at once. The exact number and size of the files varies with
28     how the system is being used. A typical config file is a few hundred bytes
29     long.
30
31     bootfile,serverip - these two are typically set in the DHCP response
32     handler, and correspond to fields in the DHCP response.
33
34     'pxe get' optionally supports these two environment variables being set:
35
36     ethaddr - this is the standard MAC address for the ethernet adapter in use.
37     'pxe get' uses it to look for a configuration file specific to a system's
38     MAC address.
39
40     pxeuuid - this is a UUID in standard form using lower case hexadecimal
41     digits, for example, 550e8400-e29b-41d4-a716-446655440000. 'pxe get' uses
42     it to look for a configuration file based on the system's UUID.
43
44     File Paths
45     ----------
46     'pxe get' repeatedly tries to download config files until it either
47     successfully downloads one or runs out of paths to try. The order and
48     contents of paths it tries mirrors exactly that of PXELINUX - you can
49     read in more detail about it at:
50
51     http://syslinux.zytor.com/wiki/index.php/Doc/pxelinux
52
53pxe boot
54--------
55     syntax: pxe boot [pxefile_addr_r]
56
57     Interprets a pxe file stored in memory.
58
59     pxefile_addr_r is an optional argument giving the location of the pxe file.
60     The file must be terminated with a NUL byte.
61
62     Environment
63     -----------
64     There are some environment variables that may need to be set, depending
65     on conditions.
66
67     pxefile_addr_r - if the optional argument pxefile_addr_r is not supplied,
68     an environment variable named pxefile_addr_r must be supplied. This is
69     typically the same value as is used for the 'pxe get' command.
70
71     bootfile - typically set in the DHCP response handler based on the
72     same field in the DHCP respone, this path is used to generate the base
73     directory that all other paths to files retrieved by 'pxe boot' will use.
74     If no bootfile is specified, paths used in pxe files will be used as is.
75
76     serverip - typically set in the DHCP response handler, this is the IP
77     address of the tftp server from which other files will be retrieved.
78
79     kernel_addr_r, initrd_addr_r - locations in RAM at which 'pxe boot' will
80     store the kernel(or FIT image) and initrd it retrieves from tftp. These
81     locations will be passed to the bootm command to boot the kernel. These
82     environment variables are required to be set.
83
84     fdt_addr_r - location in RAM at which 'pxe boot' will store the fdt blob it
85     retrieves from tftp. The retrieval is possible if 'fdt' label is defined in
86     pxe file and 'fdt_addr_r' is set. If retrieval is possible, 'fdt_addr_r'
87     will be passed to bootm command to boot the kernel.
88
89     fdt_addr - the location of a fdt blob. 'fdt_addr' will be passed to bootm
90     command if it is set and 'fdt_addr_r' is not passed to bootm command.
91
92pxe file format
93===============
94The pxe file format is nearly a subset of the PXELINUX file format; see
95http://syslinux.zytor.com/wiki/index.php/PXELINUX. It's composed of one line
96commands - global commands, and commands specific to labels. Lines begining
97with # are treated as comments. White space between and at the beginning of
98lines is ignored.
99
100The size of pxe files and the number of labels is only limited by the amount
101of RAM available to U-Boot. Memory for labels is dynamically allocated as
102they're parsed, and memory for pxe files is statically allocated, and its
103location is given by the pxefile_addr_r environment variable. The pxe code is
104not aware of the size of the pxefile memory and will outgrow it if pxe files
105are too large.
106
107Supported global commands
108-------------------------
109Unrecognized commands are ignored.
110
111default <label>	    - the label named here is treated as the default and is
112		      the first label 'pxe boot' attempts to boot.
113
114menu title <string> - sets a title for the menu of labels being displayed.
115
116menu include <path> - use tftp to retrieve the pxe file at <path>, which
117		      is then immediately parsed as if the start of its
118		      contents were the next line in the current file. nesting
119		      of include up to 16 files deep is supported.
120
121prompt <flag>	    - if 1, always prompt the user to enter a label to boot
122		      from. if 0, only prompt the user if timeout expires.
123
124timeout <num>	    - wait for user input for <num>/10 seconds before
125		      auto-booting a node.
126
127label <name>	    - begin a label definition. labels continue until
128		      a command not recognized as a label command is seen,
129		      or EOF is reached.
130
131Supported label commands
132------------------------
133labels end when a command not recognized as a label command is reached, or EOF.
134
135menu default	    - set this label as the default label to boot; this is
136		      the same behavior as the global default command but
137		      specified in a different way
138
139kernel <path>	    - if this label is chosen, use tftp to retrieve the kernel
140		      (or FIT image) at <path>. it will be stored at the address
141		      indicated in the kernel_addr_r environment variable, and
142		      that address will be passed to bootm to boot this kernel.
143		      For FIT image, The configuration specification can be
144		      appended to the file name, with the format:
145		        <path>#<conf>[#<extra-conf[#...]]
146		      It will passed to bootm with that address.
147		      (see: doc/uImage.FIT/command_syntax_extensions.txt)
148		      It useful for overlay selection in pxe file
149		      (see: doc/uImage.FIT/overlay-fdt-boot.txt)
150
151append <string>	    - use <string> as the kernel command line when booting this
152		      label.
153
154initrd <path>	    - if this label is chosen, use tftp to retrieve the initrd
155		      at <path>. it will be stored at the address indicated in
156		      the initrd_addr_r environment variable, and that address
157		      will be passed to bootm.
158
159fdt <path>	    - if this label is chosen, use tftp to retrieve the fdt blob
160		      at <path>. it will be stored at the address indicated in
161		      the fdt_addr_r environment variable, and that address will
162		      be passed to bootm.
163
164fdtdir <path>	    - if this label is chosen, use tftp to retrieve a fdt blob
165		      relative to <path>. If the fdtfile environment variable
166		      is set, <path>/<fdtfile> is retrieved. Otherwise, the
167		      filename is generated from the soc and board environment
168		      variables, i.e. <path>/<soc>-<board>.dtb is retrieved.
169		      If the fdt command is specified, fdtdir is ignored.
170
171localboot <flag>    - Run the command defined by "localcmd" in the environment.
172		      <flag> is ignored and is only here to match the syntax of
173		      PXELINUX config files.
174
175Example
176-------
177Here's a couple of example files to show how this works.
178
179------------/tftpboot/pxelinux.cfg/menus/base.menu-----------
180menu title Linux selections
181
182# This is the default label
183label install
184	menu label Default Install Image
185	kernel kernels/install.bin
186	append console=ttyAMA0,38400 debug earlyprintk
187	initrd initrds/uzInitrdDebInstall
188
189# Just another label
190label linux-2.6.38
191	kernel kernels/linux-2.6.38.bin
192	append root=/dev/sdb1
193
194# The locally installed kernel
195label local
196	menu label Locally installed kernel
197	append root=/dev/sdb1
198	localboot 1
199-------------------------------------------------------------
200
201------------/tftpboot/pxelinux.cfg/default-------------------
202menu include pxelinux.cfg/menus/base.menu
203timeout 500
204
205default linux-2.6.38
206-------------------------------------------------------------
207
208When a pxe client retrieves and boots the default pxe file,
209'pxe boot' will wait for user input for 5 seconds before booting
210the linux-2.6.38 label, which will cause /tftpboot/kernels/linux-2.6.38.bin
211to be downloaded, and boot with the command line "root=/dev/sdb1"
212
213Differences with PXELINUX
214=========================
215The biggest difference between U-Boot's pxe and PXELINUX is that since
216U-Boot's pxe support is written entirely in C, it can run on any platform
217with network support in U-Boot. Here are some other differences between
218PXELINUX and U-Boot's pxe support.
219
220- U-Boot's pxe does not support the PXELINUX DHCP option codes specified
221  in RFC 5071, but could be extended to do so.
222
223- when U-Boot's pxe fails to boot, it will return control to U-Boot,
224  allowing another command to run, other U-Boot command, instead of resetting
225  the machine like PXELINUX.
226
227- U-Boot's pxe doesn't rely on or provide an UNDI/PXE stack in memory, it
228  only uses U-Boot.
229
230- U-Boot's pxe doesn't provide the full menu implementation that PXELINUX
231  does, only a simple text based menu using the commands described in
232  this README.	With PXELINUX, it's possible to have a graphical boot
233  menu, submenus, passwords, etc. U-Boot's pxe could be extended to support
234  a more robust menuing system like that of PXELINUX's.
235
236- U-Boot's pxe expects U-Boot uimg's as kernels.  Anything that would work
237  with the 'bootm' command in U-Boot could work with the 'pxe boot' command.
238
239- U-Boot's pxe only recognizes a single file on the initrd command line.  It
240  could be extended to support multiple.
241
242- in U-Boot's pxe, the localboot command doesn't necessarily cause a local
243  disk boot - it will do whatever is defined in the 'localcmd' env
244  variable. And since it doesn't support a full UNDI/PXE stack, the
245  type field is ignored.
246
247- the interactive prompt in U-Boot's pxe only allows you to choose a label
248  from the menu.  If you want to boot something not listed, you can ctrl+c
249  out of 'pxe boot' and use existing U-Boot commands to accomplish it.
250

README.qemu-arm

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2017, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
4
5U-Boot on QEMU's 'virt' machine on ARM & AArch64
6================================================
7
8QEMU for ARM supports a special 'virt' machine designed for emulation and
9virtualization purposes. This document describes how to run U-Boot under it.
10Both 32-bit ARM and AArch64 are supported.
11
12The 'virt' platform provides the following as the basic functionality:
13
14    - A freely configurable amount of CPU cores
15    - U-Boot loaded and executing in the emulated flash at address 0x0
16    - A generated device tree blob placed at the start of RAM
17    - A freely configurable amount of RAM, described by the DTB
18    - A PL011 serial port, discoverable via the DTB
19    - An ARMv7/ARMv8 architected timer
20    - PSCI for rebooting the system
21    - A generic ECAM-based PCI host controller, discoverable via the DTB
22
23Additionally, a number of optional peripherals can be added to the PCI bus.
24
25Building U-Boot
26---------------
27Set the CROSS_COMPILE environment variable as usual, and run:
28
29- For ARM:
30    make qemu_arm_defconfig
31    make
32
33- For AArch64:
34    make qemu_arm64_defconfig
35    make
36
37Running U-Boot
38--------------
39The minimal QEMU command line to get U-Boot up and running is:
40
41- For ARM:
42    qemu-system-arm -machine virt -bios u-boot.bin
43
44- For AArch64:
45    qemu-system-aarch64 -machine virt -cpu cortex-a57 -bios u-boot.bin
46
47Note that for some odd reason qemu-system-aarch64 needs to be explicitly
48told to use a 64-bit CPU or it will boot in 32-bit mode.
49
50Additional persistent U-boot environment support can be added as follows:
51- Create envstore.img using qemu-img:
52    qemu-img create -f raw envstore.img 64M
53- Add a pflash drive parameter to the command line:
54    -drive if=pflash,format=raw,index=1,file=envstore.img
55
56Additional peripherals that have been tested to work in both U-Boot and Linux
57can be enabled with the following command line parameters:
58
59- To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.:
60    -drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0
61- To add an Intel E1000 network adapter, pass e.g.:
62    -netdev user,id=net0 -device e1000,netdev=net0
63- To add an EHCI-compliant USB host controller, pass e.g.:
64    -device usb-ehci,id=ehci
65- To add a NVMe disk, pass e.g.:
66    -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo
67
68These have been tested in QEMU 2.9.0 but should work in at least 2.5.0 as well.
69

README.qemu-mips

1By Vlad Lungu vlad.lungu@windriver.com 2007-Oct-01
2----------------------------------------
3Qemu is a full system emulator. See
4
5http://www.nongnu.org/qemu/
6
7Limitations & comments
8----------------------
9Supports the "-M mips" configuration of qemu: serial,NE2000,IDE.
10Supports little and big endian as well as 32 bit and 64 bit.
11Derived from au1x00 with a lot of things cut out.
12
13Supports emulated flash (patch Jean-Christophe PLAGNIOL-VILLARD) with
14recent qemu versions. When using emulated flash, launch with
15-pflash <filename> and erase mips_bios.bin.
16
17
18Notes for the Qemu MIPS port
19----------------------------
20
21I) Example usage:
22
23Using u-boot.bin as ROM (replaces Qemu monitor):
24
2532 bit, big endian:
26# make qemu_mips
27# qemu-system-mips -M mips -bios u-boot.bin -nographic
28
2932 bit, little endian:
30# make qemu_mipsel
31# qemu-system-mipsel -M mips -bios u-boot.bin -nographic
32
3364 bit, big endian:
34# make qemu_mips64
35# qemu-system-mips64 -cpu MIPS64R2-generic -M mips -bios u-boot.bin -nographic
36
3764 bit, little endian:
38# make qemu_mips64el
39# qemu-system-mips64el -cpu MIPS64R2-generic -M mips -bios u-boot.bin -nographic
40
41or using u-boot.bin from emulated flash:
42
43if you use a qemu version after commit 4224
44
45create image:
46# dd of=flash bs=1k count=4k if=/dev/zero
47# dd of=flash bs=1k conv=notrunc if=u-boot.bin
48start it (see above):
49# qemu-system-mips[64][el] [-cpu MIPS64R2-generic] -M mips -pflash flash -nographic
50
512) Download kernel + initrd
52
53On ftp://ftp.denx.de/pub/contrib/Jean-Christophe_Plagniol-Villard/qemu_mips/
54you can downland
55
56#config to build the kernel
57qemu_mips_defconfig
58#patch to fix mips interrupt init on 2.6.24.y kernel
59qemu_mips_kernel.patch
60initrd.gz
61vmlinux
62vmlinux.bin
63System.map
64
654) Generate uImage
66
67# tools/mkimage -A mips -O linux -T kernel -C gzip -a 0x80010000 -e 0x80245650 -n "Linux 2.6.24.y" -d vmlinux.bin.gz uImage
68
695) Copy uImage to Flash
70# dd if=uImage bs=1k conv=notrunc seek=224 of=flash
71
726) Generate Ide Disk
73
74# dd of=ide bs=1k cout=100k if=/dev/zero
75
76# sfdisk -C 261 -d ide
77# partition table of ide
78unit: sectors
79
80     ide1 : start=       63, size=    32067, Id=83
81     ide2 : start=    32130, size=    32130, Id=83
82     ide3 : start=    64260, size=  4128705, Id=83
83     ide4 : start=        0, size=        0, Id= 0
84
857) Copy to ide
86
87# dd if=uImage bs=512 conv=notrunc seek=63 of=ide
88
898) Generate ext2 on part 2 on Copy uImage and initrd.gz
90
91# Attached as loop device ide offset = 32130 * 512
92# losetup -o 16450560 -f ide
93# Format as ext2 ( arg2 : nb blocks)
94# mke2fs /dev/loop0 16065
95# losetup -d /dev/loop0
96# Mount and copy uImage and initrd.gz to it
97# mount -o loop,offset=16450560 -t ext2 ide /mnt
98# mkdir /mnt/boot
99# cp {initrd.gz,uImage} /mnt/boot/
100# Umount it
101# umount /mnt
102
1039) Set Environment
104
105setenv rd_start 0x80800000
106setenv rd_size 2663940
107setenv kernel BFC38000
108setenv oad_addr 80500000
109setenv load_addr2 80F00000
110setenv kernel_flash BFC38000
111setenv load_addr_hello 80200000
112setenv bootargs 'root=/dev/ram0 init=/bin/sh'
113setenv load_rd_ext2 'ide res; ext2load ide 0:2 ${rd_start} /boot/initrd.gz'
114setenv load_rd_tftp 'tftp ${rd_start} /initrd.gz'
115setenv load_kernel_hda 'ide res; diskboot ${load_addr} 0:2'
116setenv load_kernel_ext2 'ide res; ext2load ide 0:2 ${load_addr} /boot/uImage'
117setenv load_kernel_tftp 'tftp ${load_addr} /qemu_mips/uImage'
118setenv boot_ext2_ext2 'run load_rd_ext2; run load_kernel_ext2; run addmisc; bootm ${load_addr}'
119setenv boot_ext2_flash 'run load_rd_ext2; run addmisc; bootm ${kernel_flash}'
120setenv boot_ext2_hda 'run load_rd_ext2; run load_kernel_hda; run addmisc; bootm ${load_addr}'
121setenv boot_ext2_tftp 'run load_rd_ext2; run load_kernel_tftp; run addmisc; bootm ${load_addr}'
122setenv boot_tftp_hda 'run load_rd_tftp; run load_kernel_hda; run addmisc; bootm ${load_addr}'
123setenv boot_tftp_ext2 'run load_rd_tftp; run load_kernel_ext2; run addmisc; bootm ${load_addr}'
124setenv boot_tftp_flash 'run load_rd_tftp; run addmisc; bootm ${kernel_flash}'
125setenv boot_tftp_tftp 'run load_rd_tftp; run load_kernel_tftp; run addmisc; bootm ${load_addr}'
126setenv load_hello_tftp 'tftp ${load_addr_hello} /examples/hello_world.bin'
127setenv go_tftp 'run load_hello_tftp; go ${load_addr_hello}'
128setenv addmisc 'setenv bootargs ${bootargs} console=ttyS0,${baudrate} rd_start=${rd_start} rd_size=${rd_size} ethaddr=${ethaddr}'
129setenv bootcmd 'run boot_tftp_flash'
130
13110) Now you can boot from flash, ide, ide+ext2 and tfp
132
133# qemu-system-mips -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide
134
135II) How to debug U-Boot
136
137In order to debug U-Boot you need to start qemu with gdb server support (-s)
138and waiting the connection to start the CPU (-S)
139
140# qemu-system-mips -S -s -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide
141
142in an other console you start gdb
143
1441) Debugging of U-Boot Before Relocation
145
146Before relocation, the addresses in the ELF file can be used without any problems
147by connecting to the gdb server localhost:1234
148
149# mipsel-unknown-linux-gnu-gdb u-boot
150GNU gdb 6.6
151Copyright (C) 2006 Free Software Foundation, Inc.
152GDB is free software, covered by the GNU General Public License, and you are
153welcome to change it and/or distribute copies of it under certain conditions.
154Type "show copying" to see the conditions.
155There is absolutely no warranty for GDB.  Type "show warranty" for details.
156This GDB was configured as "--host=i486-linux-gnu --target=mipsel-unknown-linux-gnu"...
157(gdb)  target remote localhost:1234
158Remote debugging using localhost:1234
159_start () at start.S:64
16064		RVECENT(reset,0)	/* U-Boot entry point */
161Current language:  auto; currently asm
162(gdb)  b board.c:289
163Breakpoint 1 at 0xbfc00cc8: file board.c, line 289.
164(gdb) c
165Continuing.
166
167Breakpoint 1, board_init_f (bootflag=<value optimized out>) at board.c:290
168290		relocate_code (addr_sp, id, addr);
169Current language:  auto; currently c
170(gdb) p/x addr
171$1 = 0x87fa0000
172
1732) Debugging of U-Boot After Relocation
174
175For debugging U-Boot after relocation we need to know the address to which
176U-Boot relocates itself to 0x87fa0000 by default.
177And replace the symbol table to this offset.
178
179(gdb) symbol-file
180Discard symbol table from `/private/u-boot-arm/u-boot'? (y or n) y
181Error in re-setting breakpoint 1:
182No symbol table is loaded.  Use the "file" command.
183No symbol file now.
184(gdb) add-symbol-file u-boot 0x87fa0000
185add symbol table from file "u-boot" at
186	.text_addr = 0x87fa0000
187(y or n) y
188Reading symbols from /private/u-boot-arm/u-boot...done.
189Breakpoint 1 at 0x87fa0cc8: file board.c, line 289.
190(gdb) c
191Continuing.
192
193Program received signal SIGINT, Interrupt.
1940xffffffff87fa0de4 in udelay (usec=<value optimized out>) at time.c:78
19578		while ((tmo - read_c0_count()) < 0x7fffffff)
196

README.qemu-riscv

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
4
5U-Boot on QEMU's 'virt' machine on RISC-V
6=========================================
7
8QEMU for RISC-V supports a special 'virt' machine designed for emulation and
9virtualization purposes. This document describes how to run U-Boot under it.
10Both 32-bit 64-bit targets are supported.
11
12The QEMU virt machine models a generic RISC-V virtual machine with support for
13the VirtIO standard networking and block storage devices. It has CLINT, PLIC,
1416550A UART devices in addition to VirtIO and it also uses device-tree to pass
15configuration information to guest software. It implements RISC-V privileged
16architecture spec v1.10.
17
18Building U-Boot
19---------------
20Set the CROSS_COMPILE environment variable as usual, and run:
21
22- For 32-bit RISC-V:
23    make qemu-riscv32_defconfig
24    make
25
26- For 64-bit RISC-V:
27    make qemu-riscv64_defconfig
28    make
29
30Running U-Boot
31--------------
32The minimal QEMU command line to get U-Boot up and running is:
33
34- For 32-bit RISC-V:
35    qemu-system-riscv32 -nographic -machine virt -kernel u-boot
36
37- For 64-bit RISC-V:
38    qemu-system-riscv64 -nographic -machine virt -kernel u-boot
39
40The commands above create targets with 128MiB memory by default.
41A freely configurable amount of RAM can be created via the '-m'
42parameter. For example, '-m 2G' creates 2GiB memory for the target,
43and the memory node in the embedded DTB created by QEMU reflects
44the new setting.
45
46These have been tested in QEMU 3.0.0.
47

README.ramboot-ppc85xx

1			RAMBOOT for MPC85xx Platforms
2			==============================
3
4RAMBOOT literally means boot from DDR. But since DDR is volatile memory some
5pre-mechanism is required to load the DDR with the bootloader binary.
6- In case of SD and SPI boot this is done by BootROM code inside the chip
7  itself.
8- In case of NAND boot FCM supports loading initial 4K code from NAND flash
9  which can initialize the DDR and get the complete bootloader copied to DDR.
10
11In addition to the above there could be some more methods to initialize the DDR
12and load it manually.
13Two of them are described below.There is also an explanation as to where these
14methods could be handy.
151. Load the RAM based bootloader onto DDR via JTAG/BDI interface. And then
16   execute the bootloader from DDR.
17   This may be handy in the following cases:
18     - In very early stage of platform bringup where other boot options are not
19       functional because of various reasons.
20     - In case the support to program the flashes on the board is not available.
21
222. Load the RAM based bootloader onto DDR using already existing bootloader on
23   the board.And then execute the bootloader from DDR.
24   Some usecases where this may be used:
25      - While developing some new feature of u-boot, for example USB driver or
26	SPI driver.
27	Suppose the board already has a working bootloader on it. And you would
28	prefer to keep it intact, at the same time want to test your bootloader.
29	In this case you can get your test bootloader binary into DDR via tftp
30	for example. Then execute the test bootloader.
31     - Suppose a platform already has a propreitery bootloader which does not
32       support for example AMP boot. In this case also RAM boot loader can be
33       utilized.
34
35   So basically when the original bootloader is required to be kept intact
36   RAM based bootloader can offer an updated bootloader on the system.
37
38Both the above Bootloaders are slight variants of SDcard or SPI Flash
39bootloader or for that matter even NAND bootloader.
40All of them define CONFIG_SYS_RAMBOOT.
41The main difference among all of them is the way the pre-environment is getting
42configured and who is doing that.
43- In case of SD card and SPI flash bootloader this is done by On Chip BootROM inside the Si itself.
44- In case of NAND boot SPL/TPL code does it with some support from Si itself.
45- In case of the pure RAM based bootloaders we have to do it by JTAG manually or already existing bootloader.
46
47How to use them:
481. Using JTAG
49   Boot up in core hold off mode or stop the core after reset using JTAG
50   interface.
51   Preconfigure DDR/L2SRAM through JTAG interface.
52	- setup DDR controller registers.
53	- setup DDR LAWs
54	- setup DDR TLB
55   Load the RAM based boot loader to the proper location in DDR/L2SRAM.
56   set up IAR (Instruction counter properly)
57   Enable the core to execute.
58
592. Using already existing bootloader.
60   get the rambased boot loader binary into DDR/L2SRAM via tftp.
61   execute the RAM based bootloader.
62      => tftp 11000000 u-boot-ram.bin
63      => go 1107f000
64
65Please note that L2SRAM can also be used instead of DDR if the SOC has
66sufficient size of L2SRAM.
67
68Necessary Code changes Required:
69=====================================
70Please note that below mentioned changes are for 85xx platforms.
71They have been tested on P1020/P2020/P1010 RDB.
72
73The main difference between the above two methods from technical perspective is
74that in 1st case SOC is just out of reset so it is in default configuration.
75(CCSRBAR is at 0xff700000).
76In the 2nd case bootloader has already re-located CCSRBAR to 0xffe00000
77
781. File name-> boards.cfg
79   There can be added specific Make options for RAMBoot. We can keep different
80   options for the two cases mentioned above.
81   for example
82   P1020RDB_JTAG_RAMBOOT and P1020RDB_GO_RAMBOOT.
83
842. platform config file
85   for example include/configs/P1_P2_RDB.h
86
87   #ifdef CONFIG_RAMBOOT
88   #define CONFIG_SDCARD
89   #endif
90
91   This will finally use the CONFIG_SYS_RAMBOOT.
92
933. Change CONFIG_SYS_CCSRBAR_DEFAULT in menuconfig accordingly.
94   In the section of the particular SOC, for example P1020, pseudo code
95
96   #if defined(CONFIG_GO)
97   #define CONFIG_SYS_CCSRBAR_DEFAULT	0xffe00000
98   #else
99   #define CONFIG_SYS_CCSRBAR_DEFAULT	0xff700000
100   #endif
101
102For JTAG  RAMBOOT this is not required because CCSRBAR is at ff700000.
103

README.rmobile

1Summary
2=======
3
4This README is about U-Boot support for Renesas's ARM Cortex-A9 based RMOBILE[1]
5and Cortex-A9/A53/A57 based R-Car[2] family of SoCs. Renesas's RMOBILE/R-Car SoC
6family contains an ARM Cortex-A9/A53/A57.
7
8Currently the following boards are supported:
9
10| SoC           | Board                                  | defconfig
11|===============+========================================+===================
12| R8A73A0       | KMC KZM-A9-GT [3]                      | kzm9g_config
13| R8A7734       | Atmark-Techno Armadillo-800-EVA [4]    | armadillo-800eva_config
14|===============+========================================+===================
15| R8A7790  H2   | Renesas Electronics Lager              | lager_defconfig
16|               | Renesas Electronics Stout              | stout_defconfig
17|---------------+----------------------------------------+-------------------
18| R8A7791  M2-W | Renesas Electronics Koelsch            | koelsch_defconfig
19|               | Renesas Electronics Porter             | porter_defconfig
20|---------------+----------------------------------------+-------------------
21| R8A7792  V2H  | Renesas Electronics Blanche            | blanche_defconfig
22|---------------+----------------------------------------+-------------------
23| R8A7793  M2-N | Renesas Electronics Gose               | gose_defconfig
24|---------------+----------------------------------------+-------------------
25| R8A7794  E2   | Renesas Electronics Alt                | alt_defconfig
26|               | Renesas Electronics Silk               | silk_defconfig
27|===============+========================================+===================
28| R8A7795  H3   | Renesas Electronics Salvator-XS ES2.0+ | r8a7795_salvator-x_defconfig
29| R8A7795  H3   | Renesas Electronics ULCB ES2.0+        | r8a7795_ulcb
30|---------------+----------------------------------------+-------------------
31| R8A7796  M3-W | Renesas Electronics Salvator-X         | r8a7796_salvator-x_defconfig
32| R8A7796  M3-W | Renesas Electronics ULCB               | r8a7796_ulcb
33|---------------+----------------------------------------+-------------------
34| R8A77965 M3-N | Renesas Electronics Salvator-XS        | r8a77965_salvator-x_defconfig
35|---------------+----------------------------------------+-------------------
36| R8A77970 V3M  | Renesas Electronics Eagle              | r8a77970_eagle_defconfig
37|---------------+----------------------------------------+-------------------
38| R8A77995 D3   | Renesas Electronics Draak              | r8a77995_draak_defconfig
39'===============+========================================+===================
40
41Toolchain
42=========
43
44Either ARMv7 toolchain for 32bit Cortex-A9 systems or ARMv8 (aarch64)
45toolchain for 64bit Cortex-A53/A57 systems. Currently we compile the
4632bit systems with -march=armv5 to allow more compilers to work. (For
47U-Boot code this has no performance impact.)
48
49Currently, ELDK[5], Linaro[6], CodeSourcery[7] and Emdebian[8] supports
50ARMv7. Modern distributions also contain ARMv7 and ARMv8 crosstoolchains
51in their package feeds.
52
53Build
54=====
55
56Locate defconfig in the table above. Then apply standard build procedure:
57
58  make <board>_defconfig
59  make
60
61  Note: Armadillo-800-EVA's U-Boot supports booting from SDcard only.
62        Please see "B.2 Appendix B Boot Specifications" in hardware manual.
63
64Links
65=====
66
67[1] Renesas RMOBILE:
68
69http://am.renesas.com/products/soc/assp/mobile/r_mobile/index.jsp
70
71[2] Renesas R-Car:
72
73http://am.renesas.com/products/soc/assp/automotive/index.jsp
74
75[3] KZM-A9-GT
76
77http://www.kmckk.co.jp/kzma9-gt/index.html
78
79[4] Armadillo-800-EVA
80
81http://armadillo.atmark-techno.com/armadillo-800-EVA
82
83[5] ELDK
84
85http://www.denx.de/wiki/view/ELDK-5/WebHome#Section_1.6.
86
87[6] Linaro
88
89http://www.linaro.org/downloads/
90
91[7] CodeSourcey
92
93http://www.mentor.com/embedded-software/codesourcery
94
95[8] Emdebian
96
97http://www.emdebian.org/crosstools.html
98

README.rockchip

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2015 Google. Inc
4# Written by Simon Glass <sjg@chromium.org>
5
6U-Boot on Rockchip
7==================
8
9A wide range of Rockchip SoCs are supported in mainline U-Boot
10
11
12Prerequisites
13=============
14
15You will need:
16
17   - Firefly RK3288 board or something else with a supported RockChip SoC
18   - Power connection to 5V using the supplied micro-USB power cable
19   - Separate USB serial cable attached to your computer and the Firefly
20        (connect to the micro-USB connector below the logo)
21   - rkflashtool [3]
22   - openssl (sudo apt-get install openssl)
23   - Serial UART connection [4]
24   - Suitable ARM cross compiler, e.g.:
25        sudo apt-get install gcc-4.7-arm-linux-gnueabi
26
27
28Building
29========
30
31At present 12 RK3288 boards are supported:
32
33   - EVB RK3288 - use evb-rk3288 configuration
34   - Fennec RK3288 - use fennec-rk3288 configuration
35   - Firefly RK3288 - use firefly-rk3288 configuration
36   - Hisense Chromebook - use chromebook_jerry configuration
37   - Asus C100P Chromebook - use chromebook_minnie configuration
38   - Asus Chromebit - use chromebook_mickey configuration
39   - MiQi RK3288 - use miqi-rk3288 configuration
40   - phyCORE-RK3288 RDK - use phycore-rk3288 configuration
41   - PopMetal RK3288 - use popmetal-rk3288 configuration
42   - Radxa Rock 2 - use rock2 configuration
43   - Tinker RK3288 - use tinker-rk3288 configuration
44   - Vyasa RK3288 - use vyasa-rk3288 configuration
45
46Two RK3036 boards are supported:
47
48   - EVB RK3036 - use evb-rk3036 configuration
49   - Kylin - use kylin_rk3036 configuration
50
51One RK3328 board is supported:
52
53   - EVB RK3328
54
55Size RK3399 boards are supported (aarch64):
56
57   - EBV RK3399 - use evb_rk3399 configuration
58   - Firefly RK3399 - use the firefly_rk3399 configuration
59   - Puma - use puma_rk3399 configuration
60   - Ficus - use ficus-rk3399 configuration
61   - Rock960 (Vamrs) - use rock960-rk3399 configuration
62   - Bob - use chromebook_bob configuration
63
64Four RK3368 boards are supported:
65
66   - Sheep - use sheep-rk3368 configuration
67   - Lion - use lion-rk3368 configuration
68   - Geekbox - use geekbox configuration
69   - EVB PX5 - use evb-px5  configuration
70
71One RK3128 board is supported:
72
73   - EVB RK3128 - use evb-rk3128 configuration
74
75One RK3229 board is supported:
76
77   - EVB RK3229 - use evb-rk3229 configuration
78
79Two RV1108 boards are supported:
80
81   - EVB RV1108 - use evb-rv1108 configuration
82   - Elgin R1 - use elgin-rv1108 configuration
83
84One RV3188 baord is supported:
85
86   - Raxda Rock - use rock configuration
87
88
89For example:
90
91   CROSS_COMPILE=arm-linux-gnueabi- make O=firefly firefly-rk3288_defconfig all
92
93(or you can use another cross compiler if you prefer)
94
95
96Writing to the board with USB
97=============================
98
99For USB to work you must get your board into ROM boot mode, either by erasing
100your MMC or (perhaps) holding the recovery button when you boot the board.
101To erase your MMC, you can boot into Linux and type (as root)
102
103   dd if=/dev/zero of=/dev/mmcblk0 bs=1M
104
105Connect your board's OTG port to your computer.
106
107To create a suitable image and write it to the board:
108
109   ./firefly-rk3288/tools/mkimage -n rk3288 -T rkimage -d \
110	./firefly-rk3288/spl/u-boot-spl-dtb.bin out && \
111   cat out | openssl rc4 -K 7c4e0304550509072d2c7b38170d1711 | rkflashtool l
112
113If all goes well you should something like:
114
115   U-Boot SPL 2015.07-rc1-00383-ge345740-dirty (Jun 03 2015 - 10:06:49)
116   Card did not respond to voltage select!
117   spl: mmc init failed with error: -17
118   ### ERROR ### Please RESET the board ###
119
120You will need to reset the board before each time you try. Yes, that's all
121it does so far. If support for the Rockchip USB protocol or DFU were added
122in SPL then we could in principle load U-Boot and boot to a prompt from USB
123as several other platforms do. However it does not seem to be possible to
124use the existing boot ROM code from SPL.
125
126
127Booting from an SD card
128=======================
129
130To write an image that boots from an SD card (assumed to be /dev/sdc):
131
132   ./firefly-rk3288/tools/mkimage -n rk3288 -T rksd -d \
133	firefly-rk3288/spl/u-boot-spl-dtb.bin out && \
134   sudo dd if=out of=/dev/sdc seek=64 && \
135   sudo dd if=firefly-rk3288/u-boot-dtb.img of=/dev/sdc seek=16384
136
137This puts the Rockchip header and SPL image first and then places the U-Boot
138image at block 16384 (i.e. 8MB from the start of the SD card). This
139corresponds with this setting in U-Boot:
140
141   #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	0x4000
142
143Put this SD (or micro-SD) card into your board and reset it. You should see
144something like:
145
146   U-Boot 2016.01-rc2-00309-ge5bad3b-dirty (Jan 02 2016 - 23:41:59 -0700)
147
148   Model: Radxa Rock 2 Square
149   DRAM:  2 GiB
150   MMC:   dwmmc@ff0f0000: 0, dwmmc@ff0c0000: 1
151   *** Warning - bad CRC, using default environment
152
153   In:    serial
154   Out:   vop@ff940000.vidconsole
155   Err:   serial
156   Net:   Net Initialization Skipped
157   No ethernet found.
158   Hit any key to stop autoboot:  0
159   =>
160
161The rockchip bootrom can load and boot an initial spl, then continue to
162load a second-stage bootloader (ie. U-Boot) as soon as the control is returned
163to the bootrom. Both the RK3288 and the RK3036 use this special boot sequence.
164The configuration option enabling this is:
165
166	CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
167
168You can create the image via the following operations:
169
170   ./firefly-rk3288/tools/mkimage -n rk3288 -T rksd -d \
171	firefly-rk3288/spl/u-boot-spl-dtb.bin out && \
172   cat firefly-rk3288/u-boot-dtb.bin >> out && \
173   sudo dd if=out of=/dev/sdc seek=64
174
175If you have an HDMI cable attached you should see a video console.
176
177For evb_rk3036 board:
178	./evb-rk3036/tools/mkimage -n rk3036 -T rksd  -d evb-rk3036/spl/u-boot-spl.bin out && \
179	cat evb-rk3036/u-boot-dtb.bin >> out && \
180	sudo dd if=out of=/dev/sdc seek=64
181
182Note: rk3036 SDMMC and debug uart use the same iomux, so if you boot from SD, the
183      debug uart must be disabled
184
185
186Booting from an SD card on RK3288 with TPL
187==========================================
188
189Since the size of SPL can't be exceeded 0x8000 bytes in RK3288, it is not possible add
190new SPL features like Falcon mode or etc.
191
192So introduce TPL so-that adding new features to SPL is possible because now TPL should
193run minimal with code like DDR, clock etc and rest of new features in SPL.
194
195As of now TPL is added on Vyasa-RK3288 board.
196
197To write an image that boots from an SD card (assumed to be /dev/mmcblk0):
198
199   ./tools/mkimage -n rk3288 -T rksd -d ./tpl/u-boot-tpl.bin out &&
200    cat ./spl/u-boot-spl-dtb.bin >> out &&
201    sudo dd if=out of=/dev/mmcblk0 seek=64 &&
202    sudo dd if=u-boot-dtb.img of=/dev/mmcblk0 seek=16384
203
204Booting from an SD card on RK3188
205=================================
206
207For rk3188 boards the general storage onto the card stays the same as
208described above, but the image creation needs a bit more care.
209
210The bootrom of rk3188 expects to find a small 1kb loader which returns
211control to the bootrom, after which it will load the real loader, which
212can then be up to 29kb in size and does the regular ddr init.  This is
213handled by a single image (built as the SPL stage) that tests whether
214it is handled for the first or second time via code executed from the
215boot0-hook.
216
217Additionally the rk3188 requires everything the bootrom loads to be
218rc4-encrypted. Except for the very first stage the bootrom always reads
219and decodes 2kb pages, so files should be sized accordingly.
220
221# copy tpl, pad to 1020 bytes and append spl
222tools/mkimage -n rk3188 -T rksd -d spl/u-boot-spl.bin out
223
224# truncate, encode and append u-boot.bin
225truncate -s %2048 u-boot.bin
226cat u-boot.bin | split -b 512 --filter='openssl rc4 -K 7C4E0304550509072D2C7B38170D1711' >> out
227
228
229Using fastboot on rk3288
230========================
231- Write GPT partition layout to mmc device which fastboot want to use it to
232store the image
233
234        => gpt write mmc 1 $partitions
235
236- Invoke fastboot command to prepare
237
238        => fastboot 1
239
240- Start fastboot request on PC
241
242        fastboot -i 0x2207 flash loader evb-rk3288/spl/u-boot-spl-dtb.bin
243
244You should see something like:
245
246        => fastboot 1
247        WARNING: unknown variable: partition-type:loader
248        Starting download of 357796 bytes
249        ..
250        downloading of 357796 bytes finished
251        Flashing Raw Image
252        ........ wrote 357888 bytes to 'loader'
253
254Booting from SPI
255================
256
257To write an image that boots from SPI flash (e.g. for the Haier Chromebook or
258Bob):
259
260   ./chromebook_jerry/tools/mkimage -n rk3288 -T rkspi \
261	-d chromebook_jerry/spl/u-boot-spl-dtb.bin spl.bin && \
262   dd if=spl.bin of=spl-out.bin bs=128K conv=sync && \
263   cat spl-out.bin chromebook_jerry/u-boot-dtb.img >out.bin && \
264   dd if=out.bin of=out.bin.pad bs=4M conv=sync
265
266This converts the SPL image to the required SPI format by adding the Rockchip
267header and skipping every second 2KB block. Then the U-Boot image is written at
268offset 128KB and the whole image is padded to 4MB which is the SPI flash size.
269The position of U-Boot is controlled with this setting in U-Boot:
270
271   #define CONFIG_SYS_SPI_U_BOOT_OFFS	(128 << 10)
272
273If you have a Dediprog em100pro connected then you can write the image with:
274
275      sudo em100 -s -c GD25LQ32 -d out.bin.pad -r
276
277When booting you should see something like:
278
279   U-Boot SPL 2015.07-rc2-00215-g9a58220-dirty (Jun 23 2015 - 12:11:32)
280
281
282   U-Boot 2015.07-rc2-00215-g9a58220-dirty (Jun 23 2015 - 12:11:32 -0600)
283
284   Model: Google Jerry
285   DRAM:  2 GiB
286   MMC:
287   Using default environment
288
289   In:    serial@ff690000
290   Out:   serial@ff690000
291   Err:   serial@ff690000
292   =>
293
294Future work
295===========
296
297Immediate priorities are:
298
299- USB host
300- USB device
301- Run CPU at full speed (code exists but we only see ~60 DMIPS maximum)
302- NAND flash
303- Boot U-Boot proper over USB OTG (at present only SPL works)
304
305
306Development Notes
307=================
308
309There are plenty of patches in the links below to help with this work.
310
311[1] https://github.com/rkchrome/uboot.git
312[2] https://github.com/linux-rockchip/u-boot-rockchip.git branch u-boot-rk3288
313[3] https://github.com/linux-rockchip/rkflashtool.git
314[4] http://wiki.t-firefly.com/index.php/Firefly-RK3288/Serial_debug/en
315
316rkimage
317-------
318
319rkimage.c produces an SPL image suitable for sending directly to the boot ROM
320over USB OTG. This is a very simple format - just the string RK32 (as 4 bytes)
321followed by u-boot-spl-dtb.bin.
322
323The boot ROM loads image to 0xff704000 which is in the internal SRAM. The SRAM
324starts at 0xff700000 and extends to 0xff718000 where we put the stack.
325
326rksd
327----
328
329rksd.c produces an image consisting of 32KB of empty space, a header and
330u-boot-spl-dtb.bin. The header is defined by 'struct header0_info' although
331most of the fields are unused by U-Boot. We just need to specify the
332signature, a flag and the block offset and size of the SPL image.
333
334The header occupies a single block but we pad it out to 4 blocks. The header
335is encoding using RC4 with the key 7c4e0304550509072d2c7b38170d1711. The SPL
336image can be encoded too but we don't do that.
337
338The maximum size of u-boot-spl-dtb.bin which the boot ROM will read is 32KB,
339or 0x40 blocks. This is a severe and annoying limitation. There may be a way
340around this limitation, since there is plenty of SRAM, but at present the
341board refuses to boot if this limit is exceeded.
342
343The image produced is padded up to a block boundary (512 bytes). It should be
344written to the start of an SD card using dd.
345
346Since this image is set to load U-Boot from the SD card at block offset,
347CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, dd should be used to write
348u-boot-dtb.img to the SD card at that offset. See above for instructions.
349
350rkspi
351-----
352
353rkspi.c produces an image consisting of a header and u-boot-spl-dtb.bin. The
354resulting image is then spread out so that only the first 2KB of each 4KB
355sector is used. The header is the same as with rksd and the maximum size is
356also 32KB (before spreading). The image should be written to the start of
357SPI flash.
358
359See above for instructions on how to write a SPI image.
360
361rkmux.py
362--------
363
364You can use this script to create #defines for SoC register access. See the
365script for usage.
366
367
368Device tree and driver model
369----------------------------
370
371Where possible driver model is used to provide a structure to the
372functionality. Device tree is used for configuration. However these have an
373overhead and in SPL with a 32KB size limit some shortcuts have been taken.
374In general all Rockchip drivers should use these features, with SPL-specific
375modifications where required.
376
377GPT partition layout
378----------------------------
379
380Rockchip use a unified GPT partition layout  in open source support.
381With this GPT partition layout, uboot can be compatilbe with other components,
382like miniloader, trusted-os, arm-trust-firmware.
383
384There are some documents about partitions in the links below.
385http://rockchip.wikidot.com/partitions
386
387--
388Simon Glass <sjg@chromium.org>
38924 June 2015
390

README.rockusb

1Rockusb (Rockchip USB protocol)
2=====================================================
3
4Overview
5--------
6
7Rockusb protocol is widely used by Rockchip SoC based devices. It can
8read/write info, image to/from devices. This document briefly describes how to
9use Rockusb for upgrading firmware (e.g. kernel, u-boot, rootfs, etc.).
10
11Tools
12--------
13There are many tools can support Rockusb protocol. rkdeveloptool
14(https://github.com/rockchip-linux/rkdeveloptool) is open source,
15It is maintained by Rockchip. People don't want to build from source
16can download from here
17(https://github.com/rockchip-linux/rkbin/blob/master/tools/rkdeveloptool)
18
19Usage
20--------
21The Usage of Rockusb command is:
22
23rockusb <USB_controller> <devtype> <dev[:part]>
24
25e.g. rockusb 0 mmc 0
26
27On your U-Boot console, type this command to enter rockusb mode.
28On your host PC. use lsusb command. you should see a usb device
29using 0x2207 as its USB verdor id.
30
31for more detail about the rkdeveloptool. please read the usage.
32
33rkdeveloptool -h
34
35use rkdeveloptool wl command to write lba. BeginSec is the lba on device
36you want to write.
37
38sudo rkdeveloptool wl  <BeginSec> <File>
39
40to flash U-Boot image use below command. U-Boot binary is made by mkimage.
41see doc/README.rockchip for more detail about how to get U-Boot binary.
42
43sudo rkdeveloptool wl  64 <U-Boot binary>
44
45Current set of rkdeveloptool commands supported:
46- rci: Read Chip Info
47- rfi: Read Flash Id
48- rd : Reset Device
49- td : Test Device Ready
50- rl : Read blocks using LBA
51- wl : Write blocks using LBA
52- wlx: Write partition
53
54To do
55-----
56* Fully support Rockusb protocol
57

README.s5pc1xx

1
2Summary
3=======
4
5This README is about U-Boot support for SAMSUNG's ARM Cortex-A8 based S5PC1xx
6family of SoCs (S5PC100 [1] and S5PC110).
7
8Currently the following board is supported:
9
10* SMDKC100 [2]
11
12Toolchain
13=========
14
15While ARM Cortex-A8 support ARM v7 instruction set (-march=armv7a) we compile
16with -march=armv5 to allow more compilers to work. For U-Boot code this has
17no performance impact.
18
19Build
20=====
21
22* SMDKC100
23
24make smdkc100_config
25make
26
27
28Interfaces
29==========
30
31cpu
32
33To check SoC:
34
35	if (cpu_is_s5pc100())
36		printf("cpu is s5pc100\n");
37
38	or
39
40	if (cpu_is_s5pc110())
41		printf("cpu is s5pc110\n");
42
43gpio
44
45	struct s5pc100_gpio *gpio = (struct s5pc100_gpio*)S5PC100_GPIO_BASE;
46
47	/* GPA[0] pin set to irq */
48	gpio_cfg_pin(&gpio->gpio_a, 0, GPIO_IRQ);
49
50	/* GPA[0] pin set to input */
51	gpio_direction_input(&gpio->gpio_a, 0);
52
53	/* GPA[0] pin set to output/high */
54	gpio_direction_output(&gpio->gpio_a, 0, 1);
55
56	/* GPA[0] value set to low */
57	gpio_set_value(&gpio->gpio_a, 0, 0);
58
59	/* get GPA[0] value */
60	value = gpio_get_value(&gpio->gpio_a, 0);
61
62Links
63=====
64
65[1] S5PC100:
66
67http://www.samsung.com/global/business/semiconductor/productInfo.do?
68fmly_id=229&partnum=S5PC100
69
70[2] SMDKC100:
71
72http://meritech.co.kr/eng/products/product_view.php?num=28
73

README.sata

11. SATA usage in U-Boot
2
3	There are two ways to operate the hard disk
4
5	* Read/write raw blocks from/to SATA hard disk
6	* ext2load to read a file from ext2 file system
7
81.0 How to read the SATA hard disk's information?
9
10	=> sata info
11
12SATA device 0: Model: ST3320620AS Firm: 3.AAD Ser#:		4QF01ZTN
13	    Type: Hard Disk
14	    Supports 48-bit addressing
15	    Capacity: 305245.3 MB = 298.0 GB (625142448 x 512)
16
171.1 How to raw write the kernel, file system, dtb to a SATA hard disk?
18
19	Notes: Hard disk sectors are normally 512 bytes, so
20		0x1000 sectors = 2 MBytes
21
22	write kernel
23	=> tftp 40000 /tftpboot/uImage.837x
24	=> sata write 40000 0 2000
25
26	write ramdisk
27	=> tftp 40000 /tftpboot/ramdisk.837x
28	=> sata write 40000 2000 8000
29
30	write dtb
31	=> tftp 40000 /tftpboot/mpc837xemds.dtb
32	=> sata write 40000 a000 1000
33
341.2 How to raw read the kernel, file system, dtb from a SATA hard disk?
35
36	load kernel
37	=> sata read 200000 0 2000
38
39	load ramdisk
40	=> sata read 1000000 2000 8000
41
42	load dtb
43	=> sata read 2000000 a000 1000
44
45	boot
46	=> bootm 200000 1000000 2000000
47
481.3 How to load an image from an ext2 file system in U-Boot?
49
50	U-Boot doesn't support writing to an ext2 file system, so the
51	files must be written by other means (e.g. linux).
52
53	=> ext2ls sata 0:1 /
54	<DIR>	    4096 .
55	<DIR>	    4096 ..
56	<DIR>	   16384 lost+found
57		 1352023 uImage.837x
58		 3646377 ramdisk.837x
59		   12288 mpc837xemds.dtb
60		      12 hello.txt
61
62	=> ext2load sata 0:1 200000 /uImage.837x
63
64	=> ext2load sata 0:1 1000000 /ramdisk.837x
65
66	=> ext2load sata 0:1 2000000 /mpc837xemds.dtb
67
68	=> bootm 200000 1000000 2000000
69

README.sched

1Notes on the scheduler in sched.c:
2~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
4  'sched.c' provides an very simplistic multi-threading scheduler.
5   See the example, function 'sched(...)', in the same file for its
6   API usage.
7
8   Until an exhaustive testing can be done, the implementation cannot
9   qualify as that of production quality. It works with the example
10   in 'sched.c', it may or may not work in other cases.
11
12
13Limitations:
14~~~~~~~~~~~~
15
16  - There are NO primitives for thread synchronization (locking,
17    notify etc).
18
19  - Only the GPRs and FPRs context is saved during a thread context
20    switch. Other registers on the PowerPC processor (60x, 7xx, 7xxx
21    etc) are NOT saved.
22
23  - The scheduler is NOT transparent to the user. The user
24    applications must invoke thread_yield() to allow other threads to
25    scheduler.
26
27  - There are NO priorities, and the scheduling policy is round-robin
28    based.
29
30  - There are NO capabilities to collect thread CPU usage, scheduler
31    stats, thread status etc.
32
33  - The semantics are somewhat based on those of pthreads, but NOT
34    the same.
35
36  - Only seven threads are allowed. These can be easily increased by
37    changing "#define MAX_THREADS" depending on the available memory.
38
39  - The stack size of each thread is 8KBytes. This can be easily
40    increased depending on the requirement and the available memory,
41    by increasing "#define STK_SIZE".
42
43  - Only one master/parent thread is allowed, and it cannot be
44    stopped or deleted. Any given thread is NOT allowed to stop or
45    delete itself.
46
47  - There NOT enough safety checks as are probably in the other
48    threads implementations.
49
50  - There is no parent-child relationship between threads. Only one
51    thread may thread_join, preferably the master/parent thread.
52
53(C) 2003 Arun Dharankar <ADharankar@ATTBI.Com>
54

README.scrapyard

1Over time, support for more and more boards gets added to U-Boot -
2while other board support code dies a silent death caused by
3negligence in combination with ordinary bitrot.  Sometimes this goes
4by unnoticed, but often build errors will result.  If nobody cares any
5more to resolve such problems, then the code is really dead and will
6be removed from the U-Boot source tree.  The remainders rest in peace
7in the imperishable depths of the git history.  This document tries to
8maintain a list of such former fellows, so archaeologists can check
9easily if there is something they might want to dig for...
10The list should be sorted in reverse chronological order.
11
12
13Board            Arch        CPU            Commit      Removed     Last known maintainer/contact
14=================================================================================================
15ocotea           powerpc     ppc4xx         29155e73    2015-10-27  Stefan Roese <sr@denx.de>
16taishan          powerpc     ppc4xx         bb5553c6    2015-10-27  Stefan Roese <sr@denx.de>
17ebony            powerpc     ppc4xx         9d9e2f5d    2015-10-27  Stefan Roese <sr@denx.de>
18taihu            powerpc     ppc4xx         123b6cd7    2015-10-27  John Otken <jotken@softadvances.com>
19lcd4_lwmon5      powerpc     ppc4xx         b6b5e394    2015-10-02  Stefan Roese <sr@denx.de>
20da830evm         arm         arm926ejs      d7e8b2b9    2015-09-12  Nick Thompson <nick.thompson@gefanuc.com>
21wireless_space   arm         arm926ejs      b352182a    2015-09-12  Albert ARIBAUD <albert.u.boot@aribaud.net>
22stxgp3           powerpc     mpc85xx        2ec69b88    2015-09-02  Dan Malek <dan@embeddedalley.com>
23stxssa           powerpc     mpc85xx        2ec69b88    2015-09-02  Dan Malek <dan@embeddedalley.com>
24cmi_mpc5xx       powerpc     mpc5xx         972f5320    2015-09-02
25zeus             powerpc     ppc4xx         eb5d1dc7    2015-09-02  Stefan Roese <sr@denx.de>
26sbc405           powerpc     ppc4xx         0e030593    2015-09-02
27pcs440ep         powerpc     ppc4xx         242836a8    2015-09-02  Stefan Roese <sr@denx.de>
28p3p440           powerpc     ppc4xx         c6999e5f    2015-09-02  Stefan Roese <sr@denx.de>
29csb272/csb472    powerpc     ppc4xx         54a3f260    2015-09-02  Tolunay Orkun <torkun@nextio.com>
30alpr             powerpc     ppc4xx         0d2fc811    2015-09-02  Stefan Roese <sr@denx.de>
31balloon3         arm         pxa            679d4456    2015-08-30  Marek Vasut <marex@denx.de>
32cpu9260_128M     arm         arm926ejs      af7f884b    2015-08-30  Eric Benard <eric@eukrea.com>
33cpu9260          arm         arm926ejs      af7f884b    2015-08-30  Eric Benard <eric@eukrea.com>
34cpu9260_nand_128M arm        arm926ejs      af7f884b    2015-08-30  Eric Benard <eric@eukrea.com>
35cpu9260_nand     arm         arm926ejs      af7f884b    2015-08-30  Eric Benard <eric@eukrea.com>
36cpu9G20_128M     arm         arm926ejs      af7f884b    2015-08-30  Eric Benard <eric@eukrea.com>
37cpu9G20          arm         arm926ejs      af7f884b    2015-08-30  Eric Benard <eric@eukrea.com>
38cpuat91          arm         arm920t        af7f884b    2015-08-30  Eric Benard <eric@eukrea.com>
39cpuat91_ram      arm         arm920t        af7f884b    2015-08-30  Eric Benard <eric@eukrea.com>
40davinci_dm355evm arm         arm926ejs      6761946f    2015-08-30
41davinci_dm355leopard arm     arm926ejs      6761946f    2015-08-30
42davinci_dm365evm arm         arm926ejs      6761946f    2015-08-30
43davinci_dm6467evm arm        arm926ejs      6761946f    2015-08-30
44davinci_dm6467Tevm arm       arm926ejs      6761946f    2015-08-30
45davinci_dvevm    arm         arm926ejs      6761946f    2015-08-30
46davinci_schmoogie arm        arm926ejs      6761946f    2015-08-30
47davinci_sffsdr   arm         arm926ejs      6761946f    2015-08-30
48davinci_sonata   arm         arm926ejs      6761946f    2015-08-30
49dig297           arm         armv7          5ff33d04    2015-08-30  Luca Ceresoli <luca.ceresoli@comelit.it>
50ea20             arm         arm926ejs      6761946f    2015-08-30
51eb_cpux9k2       arm         arm920t        5522f12b    2015-08-30  Jens Scharsig <esw@bus-elektronik.de>
52eb_cpux9k2_ram   arm         arm920t        5522f12b    2015-08-30  Jens Scharsig <esw@bus-elektronik.de>
53enbw_cmc         arm         arm926ejs      a6f7f787    2015-08-30  Heiko Schocher <hs@denx.de>
54ima3-mx53        arm         armv7          3eb8f58d    2015-08-30
55imx27lite        arm         arm926ejs      bc0840bc    2015-08-30  Wolfgang Denk <wd@denx.de>
56imx31_litekit    arm         arm1136        36d14178    2015-08-30
57jornada          arm         sa1100         df0b116d    2015-08-30  Kristoffer Ericson <kristoffer.ericson@gmail.com>
58lp8x4x           arm         pxa            9f840b8d    2015-08-30  Sergey Yanovich <ynvich@gmail.com>
59magnesium        arm         arm926ejs      bc0840bc    2015-08-30  Heiko Schocher <hs@denx.de>
60mv88f6281gtw_ge  arm         arm926ejs      7cd768cf    2015-08-30  Prafulla Wadaskar <prafulla@marvell.com>
61mx51_efikamx     arm         armv7          b6073fd2    2015-08-30
62mx51_efikasb     arm         armv7          b6073fd2    2015-08-30
63nhk8815          arm         arm926ejs      0abdd9d0    2015-08-30  Nomadik Linux Team <STN_WMM_nomadik_linux@list.st.com>
64nhk8815_onenand  arm         arm926ejs      0abdd9d0    2015-08-30  Nomadik Linux Team <STN_WMM_nomadik_linux@list.st.com>
65omap3_mvblx      arm         armv7          8dc372f9    2015-08-30  Michael Jones <michael.jones@matrix-vision.de>
66omap3_sdp3430    arm         armv7          93b25c08    2015-08-30  Nishanth Menon <nm@ti.com>
67otc570           arm         arm926ejs      819216dd    2015-08-30  Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
68otc570_dataflash arm         arm926ejs      819216dd    2015-08-30  Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
69palmld           arm         pxa            35782e9c    2015-08-30  Marek Vasut <marex@denx.de>
70palmtc           arm         pxa            8896325d    2015-08-30  Marek Vasut <marex@denx.de>
71palmtreo680      arm         pxa            ad4f54ea    2015-08-30  Mike Dunn <mikedunn@newsguy.com>
72polaris          arm         pxa            f6eac00a    2015-08-30  Stefano Babic <sbabic@denx.de>
73portuxg20        arm         arm926ejs      79d19734    2015-08-30  Markus Hubig <mhubig@imko.de>
74pxa255_idp       arm         pxa            49d8899b    2015-08-30  Marek Vasut <marex@denx.de>
75qong             arm         arm1136        daf77086    2015-08-30  Wolfgang Denk <wd@denx.de>
76rd6281a          arm         arm926ejs      47b87d2e    2015-08-30  Prafulla Wadaskar <prafulla@marvell.com>
77scb9328          arm         arm920t        7650beb7    2015-08-30  Torsten Koschorrek <koschorrek@synertronixx.de>
78snowball         arm         armv7          7495e41b    2015-08-30  Mathieu Poirier <mathieu.poirier@linaro.org>
79stamp9g20        arm         arm926ejs      79d19734    2015-08-30  Markus Hubig <mhubig@imko.de>
80tk71             arm         arm926ejs      f73db66d    2015-08-30
81trizepsiv        arm         pxa            f6eac00a    2015-08-30  Stefano Babic <sbabic@denx.de>
82tt01             arm         arm1136        0c81f37d    2015-08-30  Helmut Raiger <helmut.raiger@hale.at>
83tx25             arm         arm926ejs      b9599dd8    2015-08-30  John Rigby <jcrigby@gmail.com>
84u8500_href       arm         armv7          7495e41b    2015-08-30
85versatileab      arm         arm926ejs      b928e658    2015-08-30
86versatilepb      arm         arm926ejs      b928e658    2015-08-30
87versatileqemu    arm         arm926ejs      b928e658    2015-08-30
88vision2          arm         armv7          bee2b99d    2015-08-30  Stefano Babic <sbabic@denx.de>
89vl_ma2sc         arm         arm926ejs      6e830dfc    2015-08-30  Jens Scharsig <esw@bus-elektronik.de>
90vl_ma2sc_ram     arm         arm926ejs      6e830dfc    2015-08-30  Jens Scharsig <esw@bus-elektronik.de>
91vpac270_nor_128  arm         pxa            452ef830    2015-08-30  Marek Vasut <marex@denx.de>
92vpac270_nor_256  arm         pxa            452ef830    2015-08-30  Marek Vasut <marex@denx.de>
93vpac270_ond_256  arm         pxa            452ef830    2015-08-30  Marek Vasut <marex@denx.de>
94xaeniax          arm         pxa            1c87dd76    2015-08-30
95zipitz2          arm         pxa            49d8899b    2015-08-30  Cliff Brake <cliff.brake@gmail.com>
96cam_enc_4xx      arm         arm926ejs      8d775763    2015-08-20  Heiko Schocher <hs@denx.de>
97afeb9260         arm         arm926ejs      f6b42c14    2015-05-13  Sergey Lapin <slapin@ossfans.org>
98tny_a9260        arm         arm926ejs      f6b42c14    2015-05-13  Albin Tonnerre <albin.tonnerre@free-electrons.com>
99sbc35_a9g20      arm         arm926ejs      f6b42c14    2015-05-13  Albin Tonnerre <albin.tonnerre@free-electrons.com>
100sc3              powerpc     ppc4xx         27e72156    2015-05-10  Heiko Schocher <hs@denx.de>
101T4240EMU         powerpc     mpc85xx        7fc63cca    2015-05-05  York Sun <yorksun@freescale.com>
102korat            powerpc     ppc4xx         5043045d    2015-03-17  Larry Johnson <lrj@acm.org>
103W7OLMC           powerpc     ppc4xx         6beecd5d    2015-03-17  Erik Theisen <etheisen@mindspring.com>
104W7OLMG           powerpc     ppc4xx         6beecd5d    2015-03-17  Erik Theisen <etheisen@mindspring.com>
105JSE              powerpc     ppc4xx         2da8137b    2015-03-17  Stephen Williams <steve@icarus.com>
106hawkboard        arm         arm926ejs      cb957cda    2015-02-24  Syed Mohammed Khasim <sm.khasim@gmail.com>:Sughosh Ganu <urwithsughosh@gmail.com>
107tnetv107x        arm         arm1176        50b82c4b    2015-02-24  Chan-Taek Park <c-park@ti.com>
108a320evb          arm         arm920t        29fc6f24    2015-02-24  Po-Yu Chuang <ratbert@faraday-tech.com>
109cm4008           arm         arm920t        a2f39e83    2015-02-24  Greg Ungerer <greg.ungerer@opengear.com>
110cm41xx           arm         arm920t        a2f39e83    2015-02-24
111dkb              arm         arm926ejs      346cfba4    2015-02-24  Lei Wen <leiwen@marvell.com>
112jadecpu          arm         arm926ejs      41fbbbbc    2015-02-24  Matthias Weisser <weisserm@arcor.de>
113CATcenter        powerpc     ppc4xx         5344cc1a    2015-01-23
114PPChameleonEVB   powerpc     ppc4xx         5344cc1a    2015-01-23  Andrea "llandre" Marson <andrea.marson@dave-tech.it>
115P2020DS          powerpc     mpc85xx        168dcc6c    2015-01-23
116P2020COME        powerpc     mpc85xx        89123536    2015-01-23  Ira W. Snyder <iws@ovro.caltech.edu>
117P2020RDB         powerpc     mpc85xx        743d4815    2015-01-23  Poonam Aggrwal <poonam.aggrwal@freescale.com>
118P2010RDB         powerpc     mpc85xx        743d4815    2015-01-23
119P1020RDB         powerpc     mpc85xx        743d4815    2015-01-23
120P1011RDB         powerpc     mpc85xx        743d4815    2015-01-23
121MPC8360EMDS      powerpc     mpc83xx        8d1e3cb1    2015-01-23  Dave Liu <daveliu@freescale.com>
122MPC8360ERDK      powerpc     mpc83xx        8d1e3cb1    2015-01-23  Anton Vorontsov <avorontsov@ru.mvista.com>
123P3G4             powerpc     74xx_7xx       d928664f    2015-01-16  Wolfgang Denk <wd@denx.de>
124ZUMA             powerpc     74xx_7xx       d928664f    2015-01-16  Nye Liu <nyet@zumanetworks.com>
125ppmc7xx          powerpc     74xx_7xx       d928664f    2015-01-16
126ELPPC            powerpc     74xx_7xx       d928664f    2015-01-16
127mpc7448hpc2      powerpc     74xx_7xx       d928664f    2015-01-16  Roy Zang <tie-fei.zang@freescale.com>
128CPCI405          ppc4xx      405gp          5f1459dc    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
129CPCI405DT        ppc4xx      405gpr         5f1459dc    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
130CPCI405AB        ppc4xx      405gpr         5f1459dc    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
131G2000            ppc4xx      405ep          5f8f6294    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
132WUH405           ppc4xx      405ep          fc88a5bf    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
133VOH405           ppc4xx      405ep          807db88b    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
134PMC405           ppc4xx      405gp          d5263304    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
135PCI405           ppc4xx      405gp          dbe7bb0d    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
136OCRTC            ppc4xx      405gpr         cc6e715f    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
137HUB405           ppc4xx      405ep          e434d5d7    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
138HH405            ppc4xx      405ep          843125da    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
139DU440            ppc4xx      440epx         7ac9d47a    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
140DU405            ppc4xx      405gpr         bc114076    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
141DP405            ppc4xx      405ep          9a4018e0    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
142CPCIISER4        ppc4xx      405gp          37057260    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
143CMS700           ppc4xx      405ep          2404124c    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
144ASH405           ppc4xx      405ep          b5e7c84f    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
145AR405            ppc4xx      405gpr         61b57c4a    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
146APC405           ppc4xx      405gpr         2b8a04e5    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
147TASREG           m68k        mcf52x2        cbdc662a    2015-01-13  Matthias Fuchs <matthias.fuchs@esd.eu>
148A3000            powerpc     mpc824x        d622ac39    2015-01-05
149CPC45            powerpc     mpc824x        d622ac39    2015-01-05  Josef Wagner <Wagner@Microsys.de>
150CU824            powerpc     mpc824x        d622ac39    2015-01-05  Wolfgang Denk <wd@denx.de>
151eXalion          powerpc     mpc824x        d622ac39    2015-01-05  Torsten Demke <torsten.demke@fci.com>
152MVBLUE           powerpc     mpc824x        d622ac39    2015-01-05
153MUSENKI          powerpc     mpc824x        d622ac39    2015-01-05  Jim Thompson <jim@musenki.com>
154Sandpoint8240    powerpc     mpc824x        d622ac39    2015-01-05  Wolfgang Denk <wd@denx.de>
155Sandpoint8245    powerpc     mpc824x        d622ac39    2015-01-05  Jim Thompson <jim@musenki.com>
156utx8245          powerpc     mpc824x        d622ac39    2015-01-05  Greg Allen <gallen@arlut.utexas.edu>
157atc              powerpc     mpc8260        9067b300    2015-01-05  Wolfgang Denk <wd@denx.de>
158CPU86            powerpc     mpc8260        f7e1af86    2015-01-05  Wolfgang Denk <wd@denx.de>
159CPU87            powerpc     mpc8260        f7e1af86    2015-01-05
160ep82xxm          powerpc     mpc8260        e2b19629    2015-01-05
161gw8260           powerpc     mpc8260        8eecbaf3    2015-01-05  Oliver Brown <obrown@adventnetworks.com>
162IPHASE4539       powerpc     mpc8260        87882f57    2015-01-05  Wolfgang Grandegger <wg@denx.de>
163muas3001         powerpc     mpc8260        d2fd1d66    2015-01-05  Heiko Schocher <hs@denx.de>
164PM825            powerpc     mpc8260        dc0b2fb4    2015-01-05  Wolfgang Denk <wd@denx.de>
165PM826            powerpc     mpc8260        dc0b2fb4    2015-01-05  Wolfgang Denk <wd@denx.de>
166PM828            powerpc     mpc8260        dc0b2fb4    2015-01-05
167MPC8266ADS       powerpc     mpc8260        b3a2bbe1    2015-01-05  Rune Torgersen <runet@innovsys.com>
168VoVPN-GW         powerpc     mpc8260        cc90905f    2015-01-05
169ep8260           powerpc     mpc8260        4ad015ba    2015-01-05  Frank Panno <fpanno@delphintech.com>
170ppmc8260         powerpc     mpc8260        793116d2    2015-01-05  Brad Kemp <Brad.Kemp@seranoa.com>
171sacsng           powerpc     mpc8260        b35c0ad6    2015-01-05  Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com>
172cogent_mpc8260   powerpc     mpc8260        d19f6a60    2015-01-05  Murray Jensen <Murray.Jensen@csiro.au>
173cogent_8xx       powerpc     mpc8xx         d19f6a60    2015-01-05  Murray Jensen <Murray.Jensen@csiro.au>
174ESTEEM192E       powerpc     mpc8xx         af0e3514    2015-01-05  Conn Clark <clark@esteem.com>
175IP860            powerpc     mpc8xx         5ec71100    2015-01-05  Wolfgang Denk <wd@denx.de>
176IVML24           powerpc     mpc8xx         ca620cd1    2015-01-05  Wolfgang Denk <wd@denx.de>
177IVMS8            powerpc     mpc8xx         ca620cd1    2015-01-05  Wolfgang Denk <wd@denx.de>
178lwmon            powerpc     mpc8xx         acc2372d    2015-01-05  Wolfgang Denk <wd@denx.de>
179NETVIA           powerpc     mpc8xx         f017cd7f    2015-01-05  Pantelis Antoniou <panto@intracom.gr>
180R360MPI          powerpc     mpc8xx         79cbecb8    2015-01-05  Wolfgang Denk <wd@denx.de>
181RRvision         powerpc     mpc8xx         8737fc75    2015-01-05  Wolfgang Denk <wd@denx.de>
182SPD823TS         powerpc     mpc8xx         72ba368f    2015-01-05  Wolfgang Denk <wd@denx.de>
183KUP4K            powerpc     mpc8xx         4317d070    2015-01-05  Klaus Heydeck <heydeck@kieback-peter.de>
184KUP4X            powerpc     mpc8xx         4317d070    2015-01-05  Klaus Heydeck <heydeck@kieback-peter.de>
185ELPT860          powerpc     mpc8xx         3c5b20f1    2015-01-05  The LEOX team <team@leox.org>
186uc100            powerpc     mpc8xx         ceaf499b    2015-01-05  Stefan Roese <sr@denx.de>
187FPS850L          powerpc     mpc8xx         5d2a5ef7    2015-01-05  Wolfgang Denk <wd@denx.de>
188FPS860L          powerpc     mpc8xx         5d2a5ef7    2015-01-05  Wolfgang Denk <wd@denx.de>
189NSCU             powerpc     mpc8xx         5d2a5ef7    2015-01-05
190SM850            powerpc     mpc8xx         5d2a5ef7    2015-01-05  Wolfgang Denk <wd@denx.de>
191TK885D           powerpc     mpc8xx         5d2a5ef7    2015-01-05
192virtlab2         powerpc     mpc8xx         5d2a5ef7    2015-01-05  Wolfgang Denk <wd@denx.de>
193hermes           powerpc     mpc8xx         36da51e     2014-12-08  Wolfgang Denk <wd@denx.de>
194TOP860		 powerpc     mpc860	    d58a945	2014-10-28  Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
195TOP9000		 arm	     at91sam9xeXXX  d58a945	2014-10-28  Reinhard Meyer <reinhard.meyer@emk-elektronik.de>
196TQM8272          powerpc     mpc8260        f06f9a1     2014-10-27  Wolfgang Denk <wd@denx.de>
197TQM8260          powerpc     mpc8260        ccc1950     2014-10-27  Wolfgang Denk <wd@denx.de>
198IDS8247          powerpc     mpc8260        6afb357     2014-10-27  Heiko Schocher <hs@denx.de>
199HWW1U1A          powerpc     mpc85xx        4109cb0     2014-10-27  Kyle Moffett <Kyle.D.Moffett@boeing.com>
200hymod            powerpc     mpc8260        5038d7f     2014-10-27  Murray Jensen <Murray.Jensen@csiro.au>
201MHPC             powerpc     mpc8xx         1655f9f     2014-10-27  Frank Gottschling <fgottschling@eltec.de>
202ICU862           powerpc     mpc8xx         4af5f0f     2014-10-27  Wolfgang Denk <wd@denx.de>
203CPCI750		 powerpc     74xx_7xx	    03b0040	2014-10-27  Reinhard Arlt <reinhard.arlt@esd-electronics.com>
204DB64360		 powerpc     74xx_7xx	    03b0040	2014-10-27
205DB64460		 powerpc     74xx_7xx	    03b0040	2014-10-27
206p3m750		 powerpc     74xx_7xx	    03b0040	2014-10-27  Stefan Roese <sr@denx.de>
207p3m7448		 powerpc     74xx_7xx	    03b0040	2014-10-27  Stefan Roese <sr@denx.de>
208MERGERBOX        powerpc     mpc83xx        e7a5656	2014-10-10  Andre Schwarz <andre.schwarz@matrix-vision.de>
209MVBLM7           powerpc     mpc83xx        e7a5656	2014-10-10  Andre Schwarz <andre.schwarz@matrix-vision.de>
210bluestone        powerpc     ppc4xx         9ed3246	2014-10-10  Tirumala Marri <tmarri@apm.com>
211CRAYL1           powerpc     ppc4xx         1521cdc	2014-10-10  David Updegraff <dave@cray.com>
212KAREF            powerpc     ppc4xx         dc9617e	2014-10-10  Travis Sawyer <travis.sawyer@sandburst.com>
213METROBOX         powerpc     ppc4xx         dc9617e	2014-10-10  Travis Sawyer <travis.sawyer@sandburst.com>
214PK1C20           nios2       -              70fbc461    2014-08-24  Scott McNutt <smcnutt@psyent.com>
215PCI5441          nios2       -              70fbc461    2014-08-24  Scott McNutt <smcnutt@psyent.com>
216flagadm          powerpc     mpc8xx         aec6f8c5    2014-08-22  Kári Davíðsson <kd@flaga.is>
217gen860t          powerpc     mpc8xx         6bde1ec1    2014-08-22  Keith Outwater <Keith_Outwater@mvis.com>
218sixnet           powerpc     mpc8xx         4723ce49    2014-08-22  Dave Ellis <DGE@sixnetio.com>
219svm_sc8xx        powerpc     mpc8xx         d1a4aafd    2014-08-22  John Zhan <zhanz@sinovee.com>
220stxxtc           powerpc     mpc8xx         0ace4d9d    2014-08-22  Dan Malek <dan@embeddedalley.com>
221omap5912osk      arm         arm926ejs      62d636aa    2014-08-22  Rishi Bhattacharya <rishi@ti.com>
222p1023rds         powerpc     mpc85xx        d0bc5140    2014-07-22  Roy Zang <tie-fei.zang@freescale.com>
223spc1920          powerpc     mpc8xx         98ad54be    2014-07-07
224v37              powerpc     mpc8xx         b8c1438a    2014-07-07
225fads             powerpc     mpc8xx         03f9d7d1    2014-07-07
226netphone         powerpc     mpc8xx         c51c1c9a    2014-07-07
227netta2           powerpc     mpc8xx         c51c1c9a    2014-07-07
228netta            powerpc     mpc8xx         c51c1c9a    2014-07-07
229rbc823           powerpc     mpc8xx         c750b9c0    2014-07-07
230quantum          powerpc     mpc8xx         0657e46e    2014-07-07
231RPXlite_dw       powerpc     mpc8xx         0657e46e    2014-07-07
232qs850            powerpc     mpc8xx         dab0f762    2014-07-07
233qs860t           powerpc     mpc8xx         dab0f762    2014-07-07
234simpc8313        powerpc     mpc83xx        7445207f    2014-06-05  Ron Madrid <info@sheldoninst.com>
235hidden_dragon    powerpc     mpc824x        3fe1a854    2014-05-30  Yusdi Santoso <yusdi_santoso@adaptec.com>
236debris           powerpc     mpc824x        7edb1f7b    2014-05-30  Sangmoon Kim <dogoil@etinsys.com>
237kvme080          powerpc     mpc824x        2868f862    2014-05-30  Sangmoon Kim <dogoil@etinsys.com>
238ep8248           powerpc     mpc8260        49ad566d    2014-05-30  Yuli Barcohen <yuli@arabellasw.com>
239ispan            powerpc     mpc8260        80bae39a    2014-05-30  Yuli Barcohen <yuli@arabellasw.com>
240rattler          powerpc     mpc8260        d0664db4    2014-05-30  Yuli Barcohen <yuli@arabellasw.com>
241zpc1900          powerpc     mpc8260        6f80bb48    2014-05-30  Yuli Barcohen <yuli@arabellasw.com>
242mpc8260ads       powerpc     mpc8260        facb6725    2014-05-30  Yuli Barcohen <yuli@arabellasw.com>
243adder            powerpc     mpc8xx         373a9788    2014-05-30  Yuli Barcohen <yuli@arabellasw.com>
244quad100hd        powerpc     ppc405ep       3569571d    2014-05-30  Gary Jennejohn <gljennjohn@googlemail.com>
245incaip           mips        mips32         538cf92c    2014-04-20  Wolfgang Denk <wd@denx.de>
246lubbock          arm         pxa            36bf57b     2014-04-18  Kyle Harris <kharris@nexus-tech.net>
247EVB64260	 powerpc     mpc824x        bb3aef9	2014-04-18
248MOUSSE           powerpc     mpc824x        03f2ecc     2014-04-18
249rsdproto         powerpc     mpc8260        8b043e6     2014-04-18
250RPXsuper         powerpc     mpc8260        0ebf5f5     2014-04-18
251RPXClassic       powerpc     mpc8xx         4fb3925     2014-04-18
252RPXlite          powerpc     mpc8xx         4fb3925     2014-04-18
253FADS		 powerpc     mpc8xx	    aa6e1e4	2014-04-18
254genietv          powerpc     mpc8xx         b8a49bd     2014-04-18
255mbx8xx           powerpc     mpc8xx         d6b11fd     2014-04-18
256nx823            powerpc     mpc8xx         a146e8b     2014-04-18
257idmr             m68k        mcf52x2        ba650e9b    2014-01-28
258M5271EVB         m68k        mcf52x2        ba650e9b    2014-01-28
259dvl_host         arm         ixp            e317de6b    2014-01-28  Michael Schwingen <michael@schwingen.org>
260actux4           arm         ixp            6ff7aafa    2014-01-28  Michael Schwingen <michael@schwingen.org>
261actux3           arm         ixp            38da33f3    2014-01-28  Michael Schwingen <michael@schwingen.org>
262actux2           arm         ixp            13e0ee7f    2014-01-28  Michael Schwingen <michael@schwingen.org>
263actux1           arm         ixp            373ee048    2014-01-28  Michael Schwingen <michael@schwingen.org>
264mx1ads           arm         arm920t        e570aca9    2014-01-13
265mini2440         arm         arm920t        af5b9b1f    2014-01-13  Gabriel Huau <contact@huau-gabriel.fr>
266omap730p2        arm         arm926ejs      79c5c08d    2013-11-11
267pn62             powerpc     mpc824x        649acfe1    2013-11-11  Wolfgang Grandegger <wg@grandegger.com>
268pdnb3            arm         ixp            304db0b     2013-09-24  Stefan Roese <sr@denx.de>
269scpu             arm         ixp            304db0b     2013-09-24  Stefan Roese <sr@denx.de>
270omap1510inn      arm         arm925t        0610a16     2013-09-23  Kshitij Gupta <kshitij@ti.com>
271CANBT            powerpc     405CR          fb8f4fd     2013-08-07  Matthias Fuchs <matthias.fuchs@esd.eu>
272omap2420h4       arm         omap24xx       7f5eef9     2013-06-04  Richard Woodruff <r-woodruff2@ti.com>
273Alaska8220       powerpc     mpc8220        d6ed322     2013-05-11
274Yukon8220        powerpc     mpc8220        d6ed322     2013-05-11
275sorcery          powerpc     mpc8220        d6ed322     2013-05-11
276smdk6400         arm         arm1176        52587f1     2013-04-12  Zhong Hongbo <bocui107@gmail.com>
277ns9750dev        arm         arm926ejs      4cfc611     2013-02-28  Markus Pietrek <mpietrek@fsforth.de>
278eNET             x86         x86            7e8c53d     2013-02-14  Graeme Russ <graeme.russ@gmail.com>
279PCIPPC2          powerpc     MPC740/MPC750  7c9e89b     2013-02-07  Wolfgang Denk <wd@denx.de>
280PCIPPC6          powerpc     MPC740/MPC750  7c9e89b     2013-02-07  Wolfgang Denk <wd@denx.de>
281AMX860           powerpc     mpc860         1b0757e     2012-10-28  Wolfgang Denk <wd@denx.de>
282c2mon            powerpc     mpc855         1b0757e     2012-10-28  Wolfgang Denk <wd@denx.de>
283EP88x            powerpc     mpc885         1b0757e     2012-10-28
284ETX094           powerpc     mpc850         1b0757e     2012-10-28  Wolfgang Denk <wd@denx.de>
285IAD210           powerpc     mpc860         1b0757e     2012-10-28  -
286LANTEC           powerpc     mpc850         1b0757e     2012-10-28  Wolfgang Denk <wd@denx.de>
287SCM              powerpc     mpc8260        1b0757e     2012-10-28  Wolfgang Grandegger <wg@denx.de>
288SX1              arm         arm925t        53c4154     2012-10-26
289TQM85xx          powerpc     MPC85xx        d923a5d     2012-10-04  Stefan Roese <sr@denx.de>
290ADCIOP           powerpc     ppc4xx         99bcad1     2012-09-19  Matthias Fuchs <matthias.fuchs@esd-electronics.com>
291DASA_SIM         powerpc     ppc4xx         99bcad1     2012-09-19  Matthias Fuchs <matthias.fuchs@esd-electronics.com>
292apollon          arm         omap24xx       535c74f     2012-09-18  Kyungmin Park <kyungmin.park@samsung.com>
293tb0229           mips        mips32         3f3110d     2011-12-12
294OXC              powerpc     MPC8240        309a292     2011-12-07
295BAB7xx           powerpc     MPC740/MPC750  c53043b     2011-12-07  Frank Gottschling <fgottschling@eltec.de>
296xm250            arm         pxa            c477d72     2011-11-25
297pleb2            arm         pxa            d299173     2011-11-25
298cradle           arm         pxa            00c4aca     2011-11-25  Kyle Harris <kharris@nexus-tech.net>
299cerf250          arm         pxa            f13eba6     2011-11-25  Prakash Kumar <prakash@embedx.com>
300mpq101           powerpc     mpc85xx        e877fab     2011-10-23  Alex Dubov <oakad@yahoo.com>
301ixdpg425         arm         ixp            0ca8eb7     2011-09-22  Stefan Roese <sr@denx.de>
302ixdp425          arm         ixp            0ca8eb7     2011-09-22  Kyle Harris <kharris@nexus-tech.net>
303zylonite         arm         pxa            b66521a     2011-09-05
304shannon          arm         sa1100         5df092d     2011-09-05  Rolf Offermanns <rof@sysgo.de>
305modnet50         arm         arm720t        9c62815     2011-09-05  Thomas Elste <info@elste.org>
306lpc2292sodimm    arm         arm720t        d1a067a     2011-09-05
307lart             arm         sa1100         3d57573     2011-09-05  Alex Züpke <azu@sysgo.de>
308impa7            arm         arm720t        c1f8750     2011-09-05  Marius Gröger <mag@sysgo.de>
309gcplus           arm         sa1100         2c650e2     2011-09-05  George G. Davis <gdavis@mvista.com>
310evb4510          arm         arm720t        26e670e     2011-09-05  Curt Brune <curt@cucy.com>
311ep7312           arm         arm720t        c8f63b4     2011-09-05  Marius Gröger <mag@sysgo.de>
312dnp1110          arm         sa1100         fc5e5ce     2011-09-05  Alex Züpke <azu@sysgo.de>
313SMN42            arm         arm720t        6aac646     2011-09-05
314at91rm9200dk     arm         arm920t        1c85752     2011-07-17
315m501sk           arm         arm920t        b1a2bd4     2011-07-17
316kb9202           arm         arm920t        5bd3814     2011-07-17
317csb637           arm         arm920t        d14af08     2011-07-17
318cmc_pu2          arm         arm920t        37a9b4d     2011-07-17
319at91cap9adk      arm         arm926ejs      b550834     2011-07-17  Stelian Pop <stelian@popies.net>
320voiceblue        arm         arm925t        1b793a4     2011-07-17
321smdk2400         arm         arm920t        ad218a8     2011-07-17  Gary Jennejohn <garyj@denx.de>
322sbc2410x         arm         arm920t        1f7f0ed     2011-07-17
323netstar          arm         arm925t        6ea2405     2011-07-17
324mx1fs2           arm         arm920t        6962419     2011-07-17
325lpd7a404         arm         lh7a40x        957731e     2011-07-17
326edb9301          arm         arm920t        716f7ad     2011-07-17
327edb9302          arm         arm920t        716f7ad     2011-07-17
328edb9302a         arm         arm920t        716f7ad     2011-07-17
329edb9307          arm         arm920t        716f7ad     2011-07-17
330edb9307a         arm         arm920t        716f7ad     2011-07-17
331edb9312          arm         arm920t        716f7ad     2011-07-17
332edb9315          arm         arm920t        716f7ad     2011-07-17
333edb9315a         arm         arm920t        716f7ad     2011-07-17
334B2               arm         s3c44b0        5dcf536     2011-07-16  Andrea Scian <andrea.scian@dave-tech.it>
335armadillo        arm         arm720t        be28857     2011-07-16  Rowel Atienza <rowel@diwalabs.com>
336assabet          arm         sa1100         c91e90d     2011-07-16  George G. Davis <gdavis@mvista.com>
337trab             arm         S3C2400        566e5cf     2011-05-01  Gary Jennejohn <garyj@denx.de>
338mp2usb           ARM         AT91RM2900     ee986e2     2011-01-25  Eric Bénard <eric@eukrea.com>
339barco            powerpc     MPC8245        afaa27b     2010-11-23  Marc Leeman <marc.leeman@barco.com>
340ERIC             powerpc     405GP          d9ba451     2010-11-21  Swen Anderson <sand@peppercon.de>
341VoVPN-GW_100MHz  powerpc     MPC8260        26fe3d2     2010-10-24  Juergen Selent <j.selent@elmeg.de>
342xsengine         ARM         PXA2xx         4262a7c     2010-10-20
343wepep250         ARM         PXA2xx         7369478     2010-10-20  Peter Figuli <peposh@etc.sk>
344delta            ARM         PXA2xx         75e2035     2010-10-20
345NC650            powerpc     MPC852         333d86d     2010-10-19  Wolfgang Denk <wd@denx.de>
346CP850            powerpc     MPC852         333d86d     2010-10-19  Wolfgang Denk <wd@denx.de>
347logodl           ARM         PXA2xx         059e778     2010-10-18  August Hoeraendl <august.hoerandl@gmx.at>
348CCM              powerpc     MPC860         dff07e1     2010-10-06  Wolfgang Grandegger <wg@denx.de>
349PCU_E            powerpc     MPC860T        544d97e     2010-10-06  Wolfgang Denk <wd@denx.de>
350HMI10            powerpc     MPC823         77efe35     2010-09-19  Wolfgang Denk <wd@denx.de>
351GTH              powerpc     MPC860         0fe247b     2010-07-17  Thomas Lange <thomas@corelatus.se>
352AmigaOneG3SE     powerpc     74xx_7xx       953b7e6     2010-06-23
353suzaku           microblaze  -              4f18060     2009-10-03  Yasushi Shoji <yashi@atmark-techno.com>
354XUPV2P           microblaze  -              8fab49e     2008-12-10  Michal Simek <monstr@monstr.eu>
355MVS1             powerpc     MPC823         306620b     2008-08-26  Andre Schwarz <andre.schwarz@matrix-vision.de>
356adsvix           ARM         PXA27x         7610db1     2008-07-30  Adrian Filipi <adrian.filipi@eurotech.com>
357R5200            ColdFire    -              48ead7a     2008-03-31  Zachary P. Landau <zachary.landau@labxtechnologies.com>
358CPCI440          powerpc     440GP          b568fd2     2007-12-27  Matthias Fuchs <matthias.fuchs@esd-electronics.com>
359

README.semihosting

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2014 Broadcom Corporation.
4 */
5
6Semihosting is ARM's way of having a real or virtual target communicate
7with a host or host debugger for basic operations such as file I/O,
8console I/O, etc. Please see
9http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/Bgbjjgij.html for more information.
10
11For developing on armv8 virtual fastmodel platforms, semihosting is a
12valuable tool since it allows access to image/configuration files before
13eMMC or other NV media are available.
14
15There are two main ARM virtual Fixed Virtual Platform (FVP) models,
16Versatile Express (VE) FVP and BASE FVP (See
17http://www.arm.com/products/tools/models/fast-models/foundation-model.php)
18The initial vexpress64 u-boot board created here runs on the VE virtual
19platform using the license-free Foundation_v8 simulator. Fortunately,
20the Foundation_v8 simulator also supports the BASE_FVP model which
21companies can purchase licenses for and contain much more functionality.
22So we can, in u-boot, run either model by either using the VE FVP (default),
23or turning on CONFIG_BASE_FVP for the more full featured model.
24
25Rather than create a new armv8 board similar to armltd/vexpress64, add
26semihosting calls to the existing one, enabled with CONFIG_SEMIHOSTING
27and CONFIG_BASE_FVP both set. Also reuse the existing board config file
28vexpress_aemv8a.h but differentiate the two models by the presence or
29absence of CONFIG_BASE_FVP. This change is tested and works on both the
30Foundation and Base fastmodel simulators.
31
32The semihosting code adds a command:
33
34  smhload <image> <address> [env var]
35
36That will load an image from the host filesystem into RAM at the specified
37address and optionally store the load end address in the specified
38environment variable.
39

README.serial_multi

1The support for multiple serial interfaces as implemented is mainly
2intended to allow for modem dial-in / dial-out while still being able
3to use a serial console on a (different) serial port.
4
5MPC8XX Specific
6===============
7At the moment, the ports must be split on a SMC and a SCC port  on  a
88xx processor; other configurations are not (yet) supported.
9
10Support for hardware handshake has not been implemented yet (but is
11in the works).
12
13*) The default console depends on the keys pressed:
14	- SMC if keys not pressed (modem not enabled)
15	- SCC if keys pressed (modem enabled)
16
17*) The console can be switched to SCC by any of the following commands:
18
19	setenv stdout serial_scc
20	setenv stdin serial_scc
21	setenv stderr serial_scc
22
23*) The console can be switched to SMC by any of the following commands:
24
25	setenv stdout serial_smc
26	setenv stdin serial_smc
27	setenv stderr serial_smc
28
29*) If a file descriptor is set to "serial" then the current serial device
30will be used which, in turn, can be switched by above commands.
31
32*) The baudrate is the same for all serial devices. But it can be switched
33just after switching the console:
34
35	setenv sout serial_scc; setenv baudrate 38400
36
37After that press 'enter' at the SCC console. Note that baudrates <38400
38are not allowed on LWMON with watchdog enabled (see CONFIG_SYS_BAUDRATE_TABLE in
39include/configs/lwmon.h).
40
41
42PPC4XX Specific
43===============
44*) The default console is UART0
45
46*) The console can be switched to UART1 by any of the following commands:
47	setenv stdout serial1
48	setenv stderr serial1
49	setenv stdin serial1
50
51*) The console can be switched to UART0 by any of the following commands:
52	setenv stdout serial0
53	setenv stderr serial0
54	setenv stdin serial0
55

README.sh

1
2U-Boot for Renesas SuperH
3	Last update 01/18/2008 by Nobuhiro Iwamatsu
4
5================================================================================
60. What's this?
7	This file contains status information for the port of U-Boot to the
8	Renesas SuperH series of CPUs.
9
10================================================================================
111. Overview
12	SuperH has an original boot loader. However, source code is dirty, and
13	maintenance is not done.
14	To improve sharing and the maintenance of the code, Nobuhiro Iwamatsu
15	started the porting to u-boot in 2007.
16
17================================================================================
182. Supported CPUs
19
20	2.1. Renesas SH7750/SH7750R
21		This CPU has the SH4 core.
22
23	2.2. Renesas SH7722
24		This CPU has the SH4AL-DSP core.
25
26	2.3. Renesas SH7720
27		This CPU has the SH3 core.
28
29	2.4. Renesas SH7710/SH7712
30		This CPU has the SH3-DSP core and Ethernet controller.
31
32	2.5. Renesas SH7780
33		This CPU has the SH4A core.
34
35================================================================================
363. Supported Boards
37
38	3.1. Hitachi UL MS7750SE01/MS7750RSE01
39		Board specific code is in board/ms7750se
40		To use this board, type "make ms7750se_config".
41		Support devices are :
42			- SCIF
43			- SDRAM
44			- NOR Flash
45			- Marubun PCMCIA
46
47	3.2. Hitachi UL MS7722SE01
48		Board specific code is in board/ms7722se
49		To use this board, type "make ms7722se_config".
50		Support devices are :
51			- SCIF
52			- SDRAM
53			- NOR Flash
54			- Marubun PCMCIA
55			- SMC91x ethernet
56
57	3.2. Hitachi UL MS7720ERP01
58		Board specific code is in board/ms7720se
59		To use this board, type "make ms7720se_config".
60		Support devices are :
61			- SCIF
62			- SDRAM
63			- NOR Flash
64			- Marubun PCMCIA
65
66	3.3. Renesas R7780MP
67		Board specific code is in board/r7780mp
68		To use this board, type "make r7780mp_config".
69		Support devices are :
70			- SCIF
71			- DDR-SDRAM
72			- NOR Flash
73			- Compact Flash
74			- ASIX ethernet
75			- SH7780 PCI bridge
76			- RTL8110 ethernet
77
78	** README **
79		In SuperH, S-record and binary of made u-boot work on the memory.
80		When u-boot is written in the flash, it is necessary to change the
81		address by using 'objcopy'.
82		ex) shX-linux-objcopy -Ibinary -Osrec u-boot.bin u-boot.flash.srec
83
84================================================================================
854. Compiler
86	You can use the following of u-boot to compile.
87		- SuperH Linux Open site
88			http://www.superh-linux.org/
89		- KPIT GNU tools
90			http://www.kpitgnutools.com/
91
92================================================================================
935. Future
94	I plan to support the following CPUs and boards.
95		5.1. CPUs
96			- SH7751R(SH4)
97			- SH7785(SH4)
98
99		5.2. Boards
100			- Many boards ;-)
101
102================================================================================
103Copyright (c) 2007,2008
104    Nobuhiro Iwamatsu <iwamatsu@nigaur.org>
105

README.sh7752evb

1========================================
2Renesas R0P7752C00000RZ board
3========================================
4
5This board specification:
6=========================
7
8The R0P7752C00000RZ(board config name:sh7752evb) has the following device:
9
10 - SH7752 (SH-4A)
11 - DDR3-SDRAM 512MB
12 - SPI ROM 8MB
13 - Gigabit Ethernet controllers
14 - eMMC 4GB
15
16
17Configuration for This board:
18=============================
19
20You can select the configuration as follows:
21
22 - make sh7752evb_config
23
24
25This board specific command:
26============================
27
28This board has the following its specific command:
29
30 - write_mac
31
32
331. write_mac
34
35You can write MAC address to SPI ROM.
36
37 Usage 1) Write MAC address
38
39   write_mac [GETHERC ch0] [GETHERC ch1]
40
41	For example)
42	 => write_mac 74:90:50:00:33:9e 74:90:50:00:33:9f
43		*) We have to input the command as a single line
44		   (without carriage return)
45		*) We have to reset after input the command.
46
47 Usage 2) Show current data
48
49   write_mac
50
51	For example)
52		=> write_mac
53		GETHERC ch0 = 74:90:50:00:33:9e
54		GETHERC ch1 = 74:90:50:00:33:9f
55
56
57Update SPI ROM:
58============================
59
601. Copy u-boot image to RAM area.
612. Probe SPI device.
62   => sf probe 0
63   SF: Detected MX25L6405D with page size 64KiB, total 8 MiB
643. Erase SPI ROM.
65   => sf erase 0 80000
664. Write u-boot image to SPI ROM.
67   => sf write 0x48000000 0 80000
68

README.sh7753evb

1========================================
2Renesas SH7753 EVB board
3========================================
4
5This board specification:
6=========================
7
8The SH7753 EVB (board config name:sh7753evb) has the following device:
9
10 - SH7753 (SH-4A)
11 - DDR3-SDRAM 512MB
12 - SPI ROM 8MB
13 - Gigabit Ethernet controllers
14 - eMMC 4GB
15
16
17Configuration for This board:
18=============================
19
20You can select the configuration as follows:
21
22 - make sh7753evb_config
23
24
25This board specific command:
26============================
27
28This board has the following its specific command:
29
30 - write_mac
31
32
331. write_mac
34
35You can write MAC address to SPI ROM.
36
37 Usage 1) Write MAC address
38
39   write_mac [GETHERC ch0] [GETHERC ch1]
40
41	For example)
42	 => write_mac 74:90:50:00:33:9e 74:90:50:00:33:9f
43		*) We have to input the command as a single line
44		   (without carriage return)
45		*) We have to reset after input the command.
46
47 Usage 2) Show current data
48
49   write_mac
50
51	For example)
52		=> write_mac
53		GETHERC ch0 = 74:90:50:00:33:9e
54		GETHERC ch1 = 74:90:50:00:33:9f
55
56
57Update SPI ROM:
58============================
59
601. Copy u-boot image to RAM area.
612. Probe SPI device.
62   => sf probe 0
63   SF: Detected MX25L6405D with page size 64KiB, total 8 MiB
643. Erase SPI ROM.
65   => sf erase 0 80000
664. Write u-boot image to SPI ROM.
67   => sf write 0x48000000 0 80000
68

README.sha1

1SHA1 usage:
2-----------
3
4In the U-Boot Image for the pcs440ep board is a SHA1 checksum integrated.
5This SHA1 sum is used, to check, if the U-Boot Image in Flash is not
6corrupted.
7
8The following command is available:
9
10=> help sha1
11sha1 address len [addr]  calculate the SHA1 sum [save at addr]
12     -p calculate the SHA1 sum from the U-Boot image in flash and print
13     -c check the U-Boot image in flash
14
15"sha1 -p"
16	calculates and prints the SHA1 sum, from the Image stored in Flash
17
18"sha1 -c"
19	check, if the SHA1 sum from the Image stored in Flash is correct
20
21
22It is possible to calculate a SHA1 checksum from a memoryrange with:
23
24"sha1 address len"
25
26If you want to store a new Image in Flash for the pcs440ep board,
27which has no SHA1 sum, you can do the following:
28
29a) cp the new Image on a position in RAM (here 0x300000)
30   (for this example we use the Image from Flash, stored at 0xfffa0000 and
31    0x60000 Bytes long)
32
33"cp.b fffa0000 300000 60000"
34
35b) Initialize the SHA1 sum in the Image with 0x00
36   The SHA1 sum is stored in Flash at:
37			   CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN + SHA1_SUM_POS
38   for the pcs440ep Flash:	 0xfffa0000 +	      0x60000 +        -0x20
39			    = 0xffffffe0
40   for the example in RAM:	   0x300000 +	      0x60000 +        -0x20
41			    = 0x35ffe0
42
43   note: a SHA1 checksum is 20 bytes long.
44
45"mw.b 35ffe0 0 14"
46
47c) now calculate the SHA1 sum from the memoryrange and write
48   the calculated checksum at the right place:
49
50"sha1 300000 60000 35ffe0"
51
52Now you have a U-Boot-Image for the pcs440ep board with the correct SHA1 sum.
53
54If you do a "buildman -k pcs440ep" or a "make all" to get the U-Boot image,
55which will be found in ../current/ipam390/ - the correct SHA1 sum will be
56automagically included in the U-Boot image.
57
58Heiko Schocher, 11 Jul 2007
59

README.sifive-fu540

1FU540-C000 RISC-V SoC
2=====================
3The FU540-C000 is the world’s first 4+1 64-bit RISC‑V SoC from SiFive.
4
5The HiFive Unleashed development platform is based on FU540-C000 and capable
6of running Linux.
7
8Mainline support
9================
10The support for following drivers are already enabled:
111. SiFive UART Driver.
122. SiFive PRCI Driver for clock.
133. Cadence MACB ethernet driver for networking support.
14
15TODO:
161. SPI driver is still missing. So MMC card can't be used in U-Boot as of now.
172. U-Boot expects the serial console device entry to be present under /chosen
18   DT node. Example:
19   chosen {
20        stdout-path = "/soc/serial@10010000:115200";
21   };
22
23   Without a serial console U-Boot will panic.
24
25Building
26========
271. Add the RISC-V toolchain to your PATH.
282. Setup ARCH & cross compilation enviornment variable.
29   a. export ARCH=riscv
30   b. export CROSS_COMPILE=<riscv64 toolchain prefix>
313. make sifive_fu540_defconfig
324. make
33
34Flashing
35========
36The current U-Boot port is supported in S-mode only and loaded from DRAM.
37
38A prior stage (M-mode) firmware/bootloader (e.g OpenSBI or BBL) is required to
39load the u-boot.bin into memory and provide runtime services. The u-boot.bin
40can be given as a payload to the prior stage (M-mode) firmware/bootloader.
41
42The description of steps required to build the firmware is beyond the scope of
43this document. Please refer OpenSBI or BBL documenation.
44(Note: OpenSBI git repo is at https://github.com/riscv/opensbi.git)
45(Note: BBL git repo is at https://github.com/riscv/riscv-pk.git)
46
47Once the prior stage firmware/bootloader binary is generated, it should be
48copied to the first partition of the sdcard.
49
50sudo dd if=<prior_stage_firmware_binary> of=/dev/disk2s1 bs=1024
51
52Booting
53=======
54Once you plugin the sdcard and power up, you should see the U-Boot prompt.
55
56Sample boot log from HiFive Unleashed board
57===========================================
58U-Boot 2019.01-00019-gc7953536-dirty (Jan 22 2019 - 11:05:40 -0800)
59
60CPU:   rv64imafdc
61Model: sifive,hifive-unleashed-a00
62DRAM:  8 GiB
63In:    serial@10010000
64Out:   serial@10010000
65Err:   serial@10010000
66Net:
67Warning: ethernet@10090000 (eth0) using random MAC address - b6:75:4d:48:50:94
68eth0: ethernet@10090000
69Hit any key to stop autoboot:  0
70=> version
71U-Boot 2019.01-00019-gc7953536-dirty (Jan 22 2019 - 11:05:40 -0800)
72
73riscv64-linux-gcc.br_real (Buildroot 2018.11-rc2-00003-ga0787e9) 8.2.0
74GNU ld (GNU Binutils) 2.31.1
75=>
76===============================================================================
77
78Now you can configure your networking, tftp server and use tftp boot method to
79load uImage.
80
81==========================================================================
82=> setenv ethaddr 70:B3:D5:92:F0:C2
83=> setenv ipaddr 10.196.157.189
84=> setenv serverip 10.11.143.218
85=> setenv gatewayip 10.196.156.1
86=> setenv netmask 255.255.252.0
87=> bdinfo
88boot_params = 0x0000000000000000
89DRAM bank   = 0x0000000000000000
90-> start    = 0x0000000080000000
91-> size     = 0x0000000200000000
92relocaddr   = 0x00000000fff90000
93reloc off   = 0x000000007fd90000
94ethaddr     = 70:B3:D5:92:F0:C2
95IP addr     = 10.196.157.189
96baudrate    = 115200 bps
97=> tftpboot uImage
98ethernet@10090000: PHY present at 0
99ethernet@10090000: Starting autonegotiation...
100ethernet@10090000: Autonegotiation complete
101ethernet@10090000: link up, 1000Mbps full-duplex (lpa: 0x3800)
102Using ethernet@10090000 device
103TFTP from server 10.11.143.218; our IP address is 10.196.157.189; sending through gateway 10.196.156.1
104Filename 'uImage'.
105Load address: 0x80200000
106Loading: #################################################################
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         2.5 MiB/s
152done
153Bytes transferred = 14939132 (e3f3fc hex)
154=> bootm 0x80200000 - 0x82200000
155## Booting kernel from Legacy Image at 80200000 ...
156   Image Name:   Linux
157   Image Type:   RISC-V Linux Kernel Image (uncompressed)
158   Data Size:    14939068 Bytes = 14.2 MiB
159   Load Address: 80200000
160   Entry Point:  80200000
161   Verifying Checksum ... OK
162## Flattened Device Tree blob at 82200000
163   Booting using the fdt blob at 0x82200000
164   Loading Kernel Image ... OK
165   Using Device Tree in place at 0000000082200000, end 0000000082205c69
166
167Starting kernel ...
168
169[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
170[    0.000000] Linux version 5.0.0-rc1-00020-g4b51f736 (atish@jedi-01) (gcc version 7.2.0 (GCC)) #262 SMP Mon Jan 21 17:39:27 PST 2019
171[    0.000000] initrd not found or empty - disabling initrd
172[    0.000000] Zone ranges:
173[    0.000000]   DMA32    [mem 0x0000000080200000-0x00000000ffffffff]
174[    0.000000]   Normal   [mem 0x0000000100000000-0x000027ffffffffff]
175[    0.000000] Movable zone start for each node
176[    0.000000] Early memory node ranges
177[    0.000000]   node   0: [mem 0x0000000080200000-0x000000027fffffff]
178[    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000027fffffff]
179[    0.000000] software IO TLB: mapped [mem 0xfbfff000-0xfffff000] (64MB)
180[    0.000000] CPU with hartid=0 has a non-okay status of "masked"
181[    0.000000] CPU with hartid=0 has a non-okay status of "masked"
182[    0.000000] elf_hwcap is 0x112d
183[    0.000000] percpu: Embedded 15 pages/cpu @(____ptrval____) s29720 r0 d31720 u61440
184[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2067975
185[    0.000000] Kernel command line: earlyprintk
186[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
187[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
188[    0.000000] Sorting __ex_table...
189[    0.000000] Memory: 8178760K/8386560K available (3309K kernel code, 248K rwdata, 872K rodata, 9381K init, 763K bss, 207800K reserved, 0K cma-reserved)
190[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
191[    0.000000] rcu: Hierarchical RCU implementation.
192[    0.000000] rcu:     RCU event tracing is enabled.
193[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
194[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
195[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
196[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
197[    0.000000] plic: mapped 53 interrupts to 4 (out of 9) handlers.
198[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
199[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns
200[    0.000008] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns
201[    0.000221] Console: colour dummy device 80x25
202[    0.000902] printk: console [tty0] enabled
203[    0.000963] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=10000)
204[    0.001034] pid_max: default: 32768 minimum: 301
205[    0.001541] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes)
206[    0.001912] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes)
207[    0.003542] rcu: Hierarchical SRCU implementation.
208[    0.004347] smp: Bringing up secondary CPUs ...
209[    1.040259] CPU1: failed to come online
210[    2.080483] CPU2: failed to come online
211[    3.120699] CPU3: failed to come online
212[    3.120765] smp: Brought up 1 node, 1 CPU
213[    3.121923] devtmpfs: initialized
214[    3.124649] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
215[    3.124727] futex hash table entries: 1024 (order: 4, 65536 bytes)
216[    3.125346] random: get_random_u32 called from bucket_table_alloc+0x72/0x172 with crng_init=0
217[    3.125578] NET: Registered protocol family 16
218[    3.126400] sifive-u54-prci 10000000.prci: Registered U54 core clocks
219[    3.126649] sifive-gemgxl-mgmt 100a0000.cadence-gemgxl-mgmt: Registered clock switch 'cadence-gemgxl-mgmt'
220[    3.135572] vgaarb: loaded
221[    3.135858] SCSI subsystem initialized
222[    3.136193] usbcore: registered new interface driver usbfs
223[    3.136266] usbcore: registered new interface driver hub
224[    3.136348] usbcore: registered new device driver usb
225[    3.136446] pps_core: LinuxPPS API ver. 1 registered
226[    3.136484] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
227[    3.136575] PTP clock support registered
228[    3.137256] clocksource: Switched to clocksource riscv_clocksource
229[    3.142711] NET: Registered protocol family 2
230[    3.143322] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes)
231[    3.143634] TCP established hash table entries: 65536 (order: 7, 524288 bytes)
232[    3.145799] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
233[    3.149121] TCP: Hash tables configured (established 65536 bind 65536)
234[    3.149591] UDP hash table entries: 4096 (order: 5, 131072 bytes)
235[    3.150094] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes)
236[    3.150781] NET: Registered protocol family 1
237[    3.230693] workingset: timestamp_bits=62 max_order=21 bucket_order=0
238[    3.241224] io scheduler mq-deadline registered
239[    3.241269] io scheduler kyber registered
240[    3.242143] sifive_gpio 10060000.gpio: SiFive GPIO chip registered 16 GPIOs
241[    3.242357] pwm-sifivem 10020000.pwm: Unable to find controller clock
242[    3.242439] pwm-sifivem 10021000.pwm: Unable to find controller clock
243[    3.243228] xilinx-pcie 2000000000.pci: PCIe Link is DOWN
244[    3.243289] xilinx-pcie 2000000000.pci: host bridge /soc/pci@2000000000 ranges:
245[    3.243360] xilinx-pcie 2000000000.pci:   No bus range found for /soc/pci@2000000000, using [bus 00-ff]
246[    3.243447] xilinx-pcie 2000000000.pci:   MEM 0x40000000..0x5fffffff -> 0x40000000
247[    3.243591] xilinx-pcie 2000000000.pci: PCI host bridge to bus 0000:00
248[    3.243636] pci_bus 0000:00: root bus resource [bus 00-ff]
249[    3.243676] pci_bus 0000:00: root bus resource [mem 0x40000000-0x5fffffff]
250[    3.276547] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
251[    3.277689] 10010000.serial: ttySIF0 at MMIO 0x10010000 (irq = 39, base_baud = 0) is a SiFive UART v0
252[    3.786963] printk: console [ttySIF0] enabled
253[    3.791504] 10011000.serial: ttySIF1 at MMIO 0x10011000 (irq = 40, base_baud = 0) is a SiFive UART v0
254[    3.801251] sifive_spi 10040000.spi: mapped; irq=41, cs=1
255[    3.806362] m25p80 spi0.0: unrecognized JEDEC id bytes: 9d, 70, 19
256[    3.812084] m25p80: probe of spi0.0 failed with error -2
257[    3.817453] sifive_spi 10041000.spi: mapped; irq=42, cs=4
258[    3.823027] sifive_spi 10050000.spi: mapped; irq=43, cs=1
259[    3.828604] libphy: Fixed MDIO Bus: probed
260[    3.832623] macb: GEM doesn't support hardware ptp.
261[    3.837196] libphy: MACB_mii_bus: probed
262[    4.041156] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: attached PHY driver [Microsemi VSC8541 SyncE] (mii_bus:phy_addr=10090000.ethernet-ffffffff:00, irq=POLL)
263[    4.055779] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at 0x10090000 irq 12 (70:b3:d5:92:f0:c2)
264[    4.065780] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
265[    4.072033] ehci-pci: EHCI PCI platform driver
266[    4.076521] usbcore: registered new interface driver usb-storage
267[    4.082843] softdog: initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0)
268[    4.127465] mmc_spi spi2.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
269[    4.133645] usbcore: registered new interface driver usbhid
270[    4.138980] usbhid: USB HID core driver
271[    4.143017] NET: Registered protocol family 17
272[    4.147885] pwm-sifivem 10020000.pwm: SiFive PWM chip registered 4 PWMs
273[    4.153945] pwm-sifivem 10021000.pwm: SiFive PWM chip registered 4 PWMs
274[    4.186407] Freeing unused kernel memory: 9380K
275[    4.190224] This architecture does not have kernel memory protection.
276[    4.196609] Run /init as init process
277Starting logging: OK
278Starting mdev...
279[    4.303785] mmc0: host does not support reading read-only switch, assuming write-enable
280[    4.311109] mmc0: new SDHC card on SPI
281[    4.317103] mmcblk0: mmc0:0000 SS08G 7.40 GiB
282[    4.386471]  mmcblk0: p1 p2
283sort: /sys/devices/platform/Fixed: No such file or directory
284modprobe: can't change directory to '/lib/modules': No such file or directory
285Initializing random[    4.759075] random: dd: uninitialized urandom read (512 bytes read)
286 number generator... done.
287Starting network...
288udhcpc (v1.24.2) started
289Sending discover...
290Sending discover...
291[    7.927510] macb 10090000.ethernet eth0: link up (1000/Full)
292Sending discover...
293Sending select for 10.196.157.190...
294Lease of 10.196.157.190 obtained, lease time 499743
295deleting routers
296adding dns 10.86.1.1
297adding dns 10.86.2.1
298/etc/init.d/S50dropbear
299Starting dropbear sshd: [   12.772393] random: dropbear: uninitialized urandom read (32 bytes read)
300OK
301
302Welcome to Buildroot
303buildroot login:
304

README.silent

1The config option CONFIG_SILENT_CONSOLE can be used to quiet messages
2on the console.  If the option has been enabled, the output can be
3silenced by setting the environment variable "silent".
4
5- CONFIG_SILENT_CONSOLE_UPDATE_ON_SET
6	When the "silent" variable is changed with env set, the change
7	will take effect immediately.
8
9- CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC
10	Some environments are not available until relocation (e.g. NAND)
11	so this will make the value in the flash env take effect at
12	relocation.
13
14The following actions are taken if "silent" is set at boot time:
15
16 - Until the console devices have been initialized, output has to be
17   suppressed by testing for the flag "GD_FLG_SILENT" in "gd->flags".
18
19 - When the console devices have been initialized, "stdout" and
20   "stderr" are set to "nulldev", so subsequent messages are
21   suppressed automatically. Make sure to enable "nulldev" by
22   #defining CONFIG_SYS_DEVICE_NULLDEV in your board config file.
23
24 - When booting a linux kernel, the "bootargs" are fixed up so that
25   the argument "console=" will be in the command line, no matter how
26   it was set in "bootargs" before. If you don't want the linux command
27   line to be affected, define CONFIG_SILENT_U_BOOT_ONLY in your board
28   config file as well, and this part of the feature will be disabled.
29

README.socfpga

1----------------------------------------
2SOCFPGA Documentation for U-Boot and SPL
3----------------------------------------
4
5This README is about U-Boot and SPL support for Altera's ARM Cortex-A9MPCore
6based SOCFPGA. To know more about the hardware itself, please refer to
7www.altera.com.
8
9
10socfpga_dw_mmc
11--------------
12
13Here are macro and detailed configuration required to enable DesignWare SDMMC
14controller support within SOCFPGA
15
16#define CONFIG_SYS_MMC_MAX_BLK_COUNT	256
17-> Using smaller max blk cnt to avoid flooding the limited stack in OCRAM
18
19--------------------------------------------------
20Generating the handoff header files for U-Boot SPL
21--------------------------------------------------
22
23This text is assuming quartus 16.1, but newer versions will probably work just fine too;
24verified with DE1_SOC_Linux_FB demo project (https://github.com/VCTLabs/DE1_SOC_Linux_FB).
25Updated/working projects should build using either process below.
26
27Note: it *should* work from Quartus 14.0.200 onwards, however, the current vendor demo
28projects must have the IP cores updated as shown below.
29
30Rebuilding your Quartus project
31-------------------------------
32
33Choose one of the follwing methods, either command line or GUI.
34
35Using the comaand line
36~~~~~~~~~~~~~~~~~~~~~~
37
38First run the embedded command shell, using your path to the Quartus install:
39
40  $ /path/to/intelFPGA/16.1/embedded/embedded_command_shell.sh
41
42Then (if necessary) update the IP cores in the project, generate HDL code, and
43build the project:
44
45  $ cd path/to/project/dir
46  $ qsys-generate soc_system.qsys --upgrade-ip-cores
47  $ qsys-generate soc_system.qsys --synthesis=[VERILOG|VHDL]
48  $ quartus_sh --flow compile <project name>
49
50Convert the resulting .sof file (SRAM object file) to .rbf file (Raw bit file):
51
52  $ quartus_cpf -c <project_name>.sof soc_system.rbf
53
54
55Generate BSP handoff files
56~~~~~~~~~~~~~~~~~~~~~~~~~~
57
58You can run the bsp editor GUI below, or run the following command from the
59project directory:
60
61  $ /path/to/bsb/tools/bsp-create-settings --type spl --bsp-dir build \
62      --preloader-settings-dir hps_isw_handoff/soc_system_hps_0/ \
63      --settings build/settings.bsp
64
65You should use the bsp "build" directory above (ie, where the settings.bsp file is)
66in the following u-boot command to update the board headers.  Once these headers
67are updated for a given project build, u-boot should be configured for the
68project board (eg, de0-nano-sockit) and then build the normal spl build.
69
70Now you can skip the GUI section.
71
72
73Using the Qsys GUI
74~~~~~~~~~~~~~~~~~~
75
761. Navigate to your project directory
772. Run Quartus II
783. Open Project (Ctrl+J), select <project_name>.qpf
794. Run QSys [Tools->QSys]
80  4.1 In the Open dialog, select '<project_name>.qsys'
81  4.2 In the Open System dialog, wait until completion and press 'Close'
82  4.3 In the Qsys window, click on 'Generate HDL...' in bottom right corner
83     4.3.1 In the 'Generation' window, click 'Generate'
84     4.3.2 In the 'Generate' dialog, wait until completion and click 'Close'
85  4.4 In the QSys window, click 'Finish'
86     4.4.1 In the 'Quartus II' pop up window, click 'OK'
875. Back in Quartus II main window, do the following
88  5.1 Use Processing -> Start -> Start Analysis & Synthesis (Ctrl+K)
89  5.2 Use Processing -> Start Compilation (Ctrl+L)
90
91    ... this may take some time, have patience ...
92
936. Start the embedded command shell as shown in the previous section
94  6.1 Change directory to 'software/spl_bsp'
95  6.2 Prepare BSP by launching the BSP editor from ECS
96       => bsp-editor
97  6.3 In BSP editor
98      6.3.1 Use File -> Open
99      6.3.2 Select 'settings.bsp' file
100      6.3.3 Click Generate
101      6.3.4 Click Exit
102
103
104Post handoff generation
105~~~~~~~~~~~~~~~~~~~~~~~
106
107Now that the handoff files are generated, U-Boot can be used to process
108the handoff files generated by the bsp-editor. For this, please use the
109following script from the u-boot source tree:
110
111  $ ./arch/arm/mach-socfpga/qts-filter.sh \
112        <soc_type> \
113        <input_qts_dir> \
114        <input_bsp_dir> \
115        <output_dir>
116
117Process QTS-generated files into U-Boot compatible ones.
118
119    soc_type      - Type of SoC, either 'cyclone5' or 'arria5'.
120    input_qts_dir - Directory with compiled Quartus project
121                    and containing the Quartus project file (QPF).
122    input_bsp_dir - Directory with generated bsp containing
123                    the settings.bsp file.
124    output_dir    - Directory to store the U-Boot compatible
125                    headers.
126
127This will generate (or update) the following 4 files:
128
129  iocsr_config.h
130  pinmux_config.h
131  pll_config.h
132  sdram_config.h
133
134These files should be copied into "qts" directory in the board directory
135(see output argument of qts-filter.sh command above).
136
137Here is an example for the DE-0 Nano SoC after the above rebuild process:
138
139  $ ll board/terasic/de0-nano-soc/qts/
140  total 36
141  -rw-r--r-- 1 sarnold sarnold 8826 Mar 21 18:11 iocsr_config.h
142  -rw-r--r-- 1 sarnold sarnold 4398 Mar 21 18:11 pinmux_config.h
143  -rw-r--r-- 1 sarnold sarnold 3190 Mar 21 18:11 pll_config.h
144  -rw-r--r-- 1 sarnold sarnold 9022 Mar 21 18:11 sdram_config.h
145
146Note: file sizes will differ slightly depending on the selected board.
147
148Now your board is ready for full mainline support including U-Boot SPL.
149The Preloader will not be needed any more.
150

README.spear

1
2SPEAr (Structured Processor Enhanced Architecture).
3
4SPEAr600 is also known as SPEArPlus and SPEAr300 is also known as SPEArBasic
5
6The SPEAr SoC family embeds a customizable logic that can be programmed
7one-time by a customer at silicon mask level (i.e. not at runtime!).
8
9U-Boot supports four SoCs: SPEAr600, SPEAr3xx
10
11All 4 SoCs (SPEAr3xx and SPEAr600) share common peripherals. SPEAr300 and
12SPEAr600 do not have EMI.
13
141. ARM926ejs core based (sp600 has two cores, the 2nd handled only in Linux)
152. FastEthernet (sp600 has Gbit version, but same controller - GMAC)
163. USB Host
174. USB Device
185. NAND controller (FSMC)
196. Serial NOR ctrl
207. I2C
218. SPI
229. CLCD
2310. others ..
24
25Everything is supported in Linux.
26u-boot is currently not supporting all peripeharls (just a few as listed below).
271. USB Device
282. NAND controller (FSMC)
293. Serial Memory Interface
304. EMI (Parallel NOR interface)
314. I2C
325. UART
33
34Build options
35	make spear320_config
36		spear320 build with environment variables placed at default
37		location i.e. Serial NOR device
38	make spear320_pnor_config
39		This option generates a uboot image that supports emi controller
40		for CFI compliant parallel NOR flash. Environment variables are
41		placed in Parallel NOR device
42	make spear320_nand_config
43		spear320 build with environment variables placed in NAND device
44	make spear320_usbtty_config
45		spear320 build with usbtty terminal as default and environment
46		placed at default location
47	make spear320_usbtty_pnor_config
48		spear320 build with usbtty terminal as default and environment
49		placed in pnor device
50	make spear320_usbtty_nand_config
51		Build with usbtty terminal as default and environment placed in
52		NAND device
53	make spear300_config
54	make spear300_nand_config
55	make spear300_usbtty_config
56	make spear300_usbtty_nand_config
57	make spear310_config
58	make spear310_pnor_config
59	make spear310_nand_config
60	make spear310_usbtty_config
61	make spear310_usbtty_pnor_config
62	make spear310_usbtty_nand_config
63	make spear600_config
64	make spear600_nand_config
65	make spear600_usbtty_config
66	make spear600_usbtty_nand_config
67
68Mac id storage and retrieval in spear platforms
69
70Please read doc/README.enetaddr for the implementation guidelines for mac id
71usage. Basically, environment has precedence over board specific storage. The
72ethaddr beeing used for the network interface is always taken only from
73environment variables. Although, we can check the mac id programmed in i2c
74memory by using chip_config command
75

README.splashprepare

1---------------------------------------------------------------------
2Splash Screen
3---------------------------------------------------------------------
4The splash_screen_prepare() function is a weak function defined in
5common/splash.c. It is called as part of the splash screen display
6sequence. It gives the board an opportunity to prepare the splash
7image data before it is processed and sent to the frame buffer by
8U-Boot. Define your own version to use this feature.
9
10CONFIG_SPLASH_SOURCE
11
12Use the splash_source.c library. This library provides facilities to declare
13board specific splash image locations, routines for loading splash image from
14supported locations, and a way of controlling the selected splash location
15using the "splashsource" environment variable.
16
17splashsource works as follows:
18- If splashsource is set to a supported location name as defined by board code,
19  use that splash location.
20- If splashsource is undefined, use the first splash location as default.
21- If splashsource is set to an unsupported value, do not load a splash screen.
22
23A splash source location can describe either storage with raw data, a storage
24formatted with a file system or a FIT image. In case of a filesystem, the splash
25screen data is loaded as a file. The name of the splash screen file can be
26controlled with the environment variable "splashfile".
27
28To enable loading the splash image from a FIT image, CONFIG_FIT must be
29enabled. Struct splash_location field 'name' should match the splash image
30name within the FIT and the FIT should start at the 'offset' field address in
31the specified storage.
32

README.srio-pcie-boot-corenet

1---------------------------------------
2SRIO and PCIE Boot on Corenet Platforms
3---------------------------------------
4
5For some PowerPC processors with SRIO or PCIE interface, boot location can be
6configured to SRIO or PCIE by RCW. The processor booting from SRIO or PCIE can
7do without flash for u-boot image, ucode and ENV. All the images can be fetched
8from another processor's memory space by SRIO or PCIE link connected between
9them.
10
11This document describes the processes based on an example implemented on P4080DS
12platforms and a RCW example with boot from SRIO or PCIE configuration.
13
14Environment of the SRIO or PCIE boot:
15	a) Master and slave can be SOCs in one board or SOCs in separate boards.
16	b) They are connected with SRIO or PCIE links, whether 1x, 2x or 4x, and
17	   directly or through switch system.
18	c) Only Master has NorFlash for booting, and all the Master's and Slave's
19	   U-Boot images, UCodes will be stored in this flash.
20	d) Slave has its own EEPROM for RCW and PBI.
21	e) Slave's RCW should configure the SerDes for SRIO or PCIE boot port, set
22	   the boot location to SRIO or PCIE, and holdoff all the cores.
23
24	-----------       -----------             -----------
25	|         |       |         |             |         |
26	|         |       |         |             |         |
27	| NorFlash|<----->| Master  |SRIO or PCIE |  Slave  |<---->[EEPROM]
28	|         |       |         |<===========>|         |
29	|         |       |         |             |         |
30	-----------       -----------             -----------
31
32The example based on P4080DS platform:
33	Two P4080DS platforms can be used to implement the boot from SRIO or PCIE.
34	Their SRIO or PCIE ports 1 will be connected directly and will be used for
35	the boot from SRIO or PCIE.
36
37	1. Slave's RCW example for boot from SRIO port 1 and all cores in holdoff.
38		00000000: aa55 aa55 010e 0100 0c58 0000 0000 0000
39		00000010: 1818 1818 0000 8888 7440 4000 0000 2000
40		00000020: f440 0000 0100 0000 0000 0000 0000 0000
41		00000030: 0000 0000 0083 0000 0000 0000 0000 0000
42		00000040: 0000 0000 0000 0000 0813 8040 063c 778f
43
44	2. Slave's RCW example for boot from PCIE port 1 and all cores in holdoff.
45		00000000: aa55 aa55 010e 0100 0c58 0000 0000 0000
46		00000010: 1818 1818 0000 8888 1440 4000 0000 2000
47		00000020: f040 0000 0100 0000 0020 0000 0000 0000
48		00000030: 0000 0000 0083 0000 0000 0000 0000 0000
49		00000040: 0000 0000 0000 0000 0813 8040 547e ffc9
50
51	3. Sequence in Step by Step.
52		a) Update RCW for slave with boot from SRIO or PCIE port 1 configuration.
53		b) Program slave's U-Boot image, UCode, and ENV parameters into master's
54		   NorFlash.
55		c) Set environment variable "bootmaster" to "SRIO1" or "PCIE1" and save
56		   environment for master.
57					setenv bootmaster SRIO1
58				or
59					setenv bootmaster PCIE1
60					saveenv
61		d) Restart up master and it will boot up normally from its NorFlash.
62		   Then, it will finish necessary configurations for slave's boot from
63		   SRIO or PCIE port 1.
64		e) Master will set inbound SRIO or PCIE windows covered slave's U-Boot
65		   image stored in master's NorFlash.
66		f) Master will set an inbound SRIO or PCIE window covered slave's UCode
67		   and ENV stored in master's NorFlash.
68		g) Master will set outbound SRIO or PCIE  windows in order to configure
69		   slave's registers for the core's releasing.
70		h) Since all cores of slave in holdoff, slave should be powered on before
71		   all the above master's steps, and wait to be released by master. In the
72		   startup phase of the slave from SRIO or PCIE, it will finish some
73		   necessary configurations.
74		i) Slave will set a specific TLB entry for the boot process.
75		j) Slave will set a LAW entry with the TargetID SRIO or PCIE port 1 for
76		   the boot.
77		k) Slave will set a specific TLB entry in order to fetch UCode and ENV
78		   from master.
79		l) Slave will set a LAW entry with the TargetID SRIO or PCIE port 1 for
80		   UCode and ENV.
81
82How to use this feature:
83	To use this feature, you need to focus those points.
84
85	1. Slave's RCW with SRIO or PCIE boot configurations, and all cores in holdoff
86	   configurations.
87	   Please refer to the examples given above.
88
89	2. U-Boot image's compilation.
90	   For master, U-Boot image should be generated normally.
91
92	   For example, master U-Boot image used on P4080DS should be compiled with
93
94				make P4080DS_config.
95
96	   For slave, U-Boot image should be generated specifically by
97
98				make xxxx_SRIO_PCIE_BOOT_config.
99
100	   For example, slave U-Boot image used on P4080DS should be compiled with
101
102				make P4080DS_SRIO_PCIE_BOOT_config.
103
104	3. Necessary modifications based on a specific environment.
105	   For a specific environment, the addresses of the slave's U-Boot image,
106	   UCode, ENV stored in master's NorFlash, and any other configurations
107	   can be modified in the file:
108				include/configs/corenet_ds.h.
109
110	4. Set and save the environment variable "bootmaster" with "SRIO1", "SRIO2"
111	   or "PCIE1", "PCIE2", "PCIE3" for master, and then restart it in order to
112	   perform the role as a master for boot from SRIO or PCIE.
113
114NOTE: When the Slave's ENV parameters are stored in Master's NorFlash,
115      it can fetch them through PCIE or SRIO interface. But the ENV
116      parameters can not be modified by "saveenv" or other commands under
117      the Slave's u-boot environment, because the Slave can not erase,
118      write Master's NorFlash by PCIE or SRIO link.
119

README.standalone

1Design Notes on Exporting U-Boot Functions to Standalone Applications:
2======================================================================
3
41. The functions are exported by U-Boot via a jump table. The jump
5   table is allocated and initialized in the jumptable_init() routine
6   (common/exports.c). Other routines may also modify the jump table,
7   however. The jump table can be accessed as the 'jt' field of the
8   'global_data' structure. The struct members for the jump table are
9   defined in the <include/exports.h> header. E.g., to substitute the
10   malloc() and free() functions that will be available to standalone
11   applications, one should do the following:
12
13	DECLARE_GLOBAL_DATA_PTR;
14
15	gd->jt->malloc	= my_malloc;
16	gd->jt->free = my_free;
17
18   Note that the pointers to the functions are real function pointers
19   so the compiler can perform type checks on these assignments.
20
212. The pointer to the jump table is passed to the application in a
22   machine-dependent way. PowerPC, ARM, MIPS, Blackfin and Nios II
23   architectures use a dedicated register to hold the pointer to the
24   'global_data' structure: r2 on PowerPC, r9 on ARM, k0 on MIPS,
25   P3 on Blackfin and gp on Nios II. The x86 architecture does not
26   use such a register; instead, the pointer to the 'global_data'
27   structure is passed as 'argv[-1]' pointer.
28
29   The application can access the 'global_data' structure in the same
30   way as U-Boot does:
31
32	DECLARE_GLOBAL_DATA_PTR;
33
34	printf("U-Boot relocation offset: %x\n", gd->reloc_off);
35
363. The application should call the app_startup() function before any
37   call to the exported functions. Also, implementor of the
38   application may want to check the version of the ABI provided by
39   U-Boot. To facilitate this, a get_version() function is exported
40   that returns the ABI version of the running U-Boot. I.e., a
41   typical application startup may look like this:
42
43	int my_app (int argc, char * const argv[])
44	{
45		app_startup (argv);
46		if (get_version () != XF_VERSION)
47			return 1;
48	}
49
504. The default load and start addresses of the applications are as
51   follows:
52
53			Load address	Start address
54	x86		0x00040000	0x00040000
55	PowerPC		0x00040000	0x00040004
56	ARM		0x0c100000	0x0c100000
57	MIPS		0x80200000	0x80200000
58	Blackfin	0x00001000	0x00001000
59	NDS32		0x00300000	0x00300000
60	Nios II		0x02000000	0x02000000
61	RISC-V		0x00600000	0x00600000
62
63   For example, the "hello world" application may be loaded and
64   executed on a PowerPC board with the following commands:
65
66   => tftp 0x40000 hello_world.bin
67   => go 0x40004
68
695. To export some additional function long foobar(int i,char c), the following steps
70   should be undertaken:
71
72   - Append the following line at the end of the include/_exports.h
73     file:
74
75	EXPORT_FUNC(foobar, long, foobar, int, char)
76
77	Parameters to EXPORT_FUNC:
78	 - the first parameter is the function that is exported (default implementation)
79	 - the second parameter is the return value type
80	 - the third  parameter is the name of the member in struct jt_funcs
81	   this is also the name that the standalone application will used.
82	   the rest of the parameters are the function arguments
83
84   - Add the prototype for this function to the include/exports.h
85     file:
86
87	long foobar(int i, char c);
88
89	Initialization with the default implementation is done in jumptable_init()
90
91	You can override the default implementation using:
92
93	gd->jt->foobar = another_foobar;
94
95	The signature of another_foobar must then match the declaration of foobar.
96
97   - Increase the XF_VERSION value by one in the include/exports.h
98     file
99
100   - If you want to export a function which depends on a CONFIG_XXX
101	use 2 lines like this:
102	#ifdef CONFIG_FOOBAR
103		EXPORT_FUNC(foobar, long, foobar, int, char)
104	#else
105		EXPORT_FUNC(dummy, void, foobar, void)
106	#endif
107
108
1096. The code for exporting the U-Boot functions to applications is
110   mostly machine-independent. The only places written in assembly
111   language are stub functions that perform the jump through the jump
112   table. That said, to port this code to a new architecture, the
113   only thing to be provided is the code in the examples/stubs.c
114   file. If this architecture, however, uses some uncommon method of
115   passing the 'global_data' pointer (like x86 does), one should add
116   the respective code to the app_startup() function in that file.
117
118   Note that these functions may only use call-clobbered registers;
119   those registers that are used to pass the function's arguments,
120   the stack contents and the return address should be left intact.
121

README.t1040-l2switch

1This file contains information for VSC9953, a Vitesse L2 Switch IP
2which is integrated in the T1040/T1020 Freescale SoCs.
3
4About Device:
5=============
6VSC9953 is an 8-port Gigabit Ethernet switch supports the following features:
7	-	8192 MAC addresses
8	-	Static Address provisioning
9	-	Dynamic learning of MAC addresses and aging
10	-	4096 VLANs
11	-	Independent and shared VLAN learning (IVL, SVL)
12	-	Policing with storm control and MC/BC protection
13	-	IPv4 and IPv6 multicast
14	-	Jumbo frames (9.6 KB)
15	-	Access Control List
16	-	VLAN editing, translation and remarking
17	-	RMON counters per port
18
19Switch interfaces:
20	-	8 Gigabit switch ports (ports 0 to 7) are external and are connected to external PHYs
21	-	2 switch ports (ports 8 and 9) of 2.5 G are connected (fixed links)
22		to FMan ports (FM1@DTSEC1 and FM1@DTSEC2)
23
24Commands Overview:
25=============
26Commands supported
27	- enable/disable a port or show its configuration (speed, duplexity, status, etc.)
28	- port statistics
29	- MAC learning
30	- add/remove FDB entries
31	- Port-based VLAN
32	- Private/Shared VLAN learning
33	- VLAN ingress filtering
34	- Port LAG
35
36Commands syntax
37ethsw [port <port_no>] { enable | disable | show } - enable/disable a port; show a port's configuration
38ethsw [port <port_no>] statistics { [help] | [clear] } - show an l2 switch port's statistics
39ethsw [port <port_no>] learning { [help] | show | auto | disable } - enable/disable/show learning configuration on a port
40ethsw [port <port_no>] [vlan <vid>] fdb { [help] | show | flush | { add | del } <mac> } - add/delete a mac entry in FDB; use show to see FDB entries;
41											  if [vlan <vid>] is missing, VID 1 will be used
42ethsw [port <port_no>] pvid { [help] | show | <pvid> } - set/show PVID (ingress and egress VLAN tagging) for a port
43ethsw [port <port_no>] vlan { [help] | show | add <vid> | del <vid> } - add a VLAN to a port (VLAN members)
44ethsw [port <port_no>] untagged { [help] | show | all | none | pvid } - set egress tagging mode for a port
45ethsw [port <port_no>] egress tag { [help] | show | pvid | classified } - configure VID source for egress tag.
46									  Tag's VID could be the frame's classified VID or the PVID of the port
47ethsw vlan fdb { [help] | show | shared | private } - make VLAN learning shared or private
48ethsw [port <port_no>] ingress filtering { [help] | show | enable | disable } - enable/disable VLAN ingress filtering on port
49ethsw [port <port_no>] aggr { [help] | show | <lag_group_no> } - get/set LAG group for a port
50
51=> ethsw show
52    Port   Status     Link    Speed   Duplex
53       0  enabled     down       10     half
54       1  enabled     down       10     half
55       2  enabled     down       10     half
56       3  enabled       up     1000     full
57       4 disabled     down        -     half
58       5 disabled     down        -     half
59       6 disabled     down        -     half
60       7 disabled     down        -     half
61       8  enabled       up     2500     full
62       9  enabled       up     2500     full
63=>
64

README.tee

1=============
2TEE uclass
3=============
4
5This document describes the TEE uclass in U-Boot
6
7A TEE (Trusted Execution Environment) is a trusted OS running in some
8secure environment, for example, TrustZone on ARM CPUs, or a separate
9secure co-processor etc. A TEE driver handles the details needed to
10communicate with the TEE.
11
12This uclass deals with:
13
14- Registration of TEE drivers
15
16- Managing shared memory between U-Boot and the TEE
17
18- Providing a generic API to the TEE
19
20The TEE interface
21=================
22
23include/tee.h defines the generic interface to a TEE.
24
25A client finds the TEE device via tee_find_device(). Other important functions
26when interfacing with a TEE are:
27
28- tee_shm_alloc(), tee_shm_register() and tee_shm_free() to manage shared
29  memory objects often needed when communicating with the TEE.
30
31- tee_get_version() lets the client know which the capabilities of the TEE
32  device.
33
34- tee_open_session() opens a session to a Trusted Application
35
36- tee_invoke_func() invokes a function in a Trusted Application
37
38- tee_close_session() closes a session to a Trusted Application
39
40Much of the communication between clients and the TEE is opaque to the
41driver. The main job for the driver is to receive requests from the
42clients, forward them to the TEE and send back the results.
43
44OP-TEE driver
45=============
46
47The OP-TEE driver handles OP-TEE [1] based TEEs. Currently it is only the ARM
48TrustZone based OP-TEE solution that is supported.
49
50Lowest level of communication with OP-TEE builds on ARM SMC Calling
51Convention (SMCCC) [2], which is the foundation for OP-TEE's SMC interface
52[3] used internally by the driver. Stacked on top of that is OP-TEE Message
53Protocol [4].
54
55OP-TEE SMC interface provides the basic functions required by SMCCC and some
56additional functions specific for OP-TEE. The most interesting functions are:
57
58- OPTEE_SMC_FUNCID_CALLS_UID (part of SMCCC) returns the version information
59  which is then returned by TEE_IOC_VERSION
60
61- OPTEE_SMC_CALL_GET_OS_UUID returns the particular OP-TEE implementation, used
62  to tell, for instance, a TrustZone OP-TEE apart from an OP-TEE running on a
63  separate secure co-processor.
64
65- OPTEE_SMC_CALL_WITH_ARG drives the OP-TEE message protocol
66
67- OPTEE_SMC_GET_SHM_CONFIG lets the driver and OP-TEE agree on which memory
68  range to used for shared memory between Linux and OP-TEE.
69
70The GlobalPlatform TEE Client API [5] is implemented on top of the generic
71TEE API.
72
73Picture of the relationship between the different components in the
74OP-TEE architecture:
75
76                   U-Boot                  Secure world
77                   ~~~~~~                  ~~~~~~~~~~~~
78                 +------------+           +-------------+
79                 | Client     |           | Trusted     |
80                 |            |           | Application |
81                 +------------+           +-------------+
82                       /\                       /\
83                       ||                       ||
84                       \/                       \/
85                 +------------+           +-------------+
86                 | TEE        |           | TEE Internal|
87                 | uclass     |           | API         |
88                 +------------+           +-------------+
89                 | OP-TEE     |           | OP-TEE      |
90                 | driver     |           | Trusted OS  |
91                 +------------+-----------+-------------+
92                 |             OP-TEE MSG               |
93                 |      SMCCC (OPTEE_SMC_CALL_*)        |
94                 +--------------------------------------+
95
96RPC (Remote Procedure Call) are requests from secure world to the driver.
97An RPC is identified by a special range of SMCCC return values from
98OPTEE_SMC_CALL_WITH_ARG.
99
100References
101==========
102
103[1] https://github.com/OP-TEE/optee_os
104
105[2] http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
106
107[3] drivers/tee/optee/optee_smc.h
108
109[4] drivers/tee/optee/optee_msg.h
110
111[5] http://www.globalplatform.org/specificationsdevice.asp look for
112    "TEE Client API Specification v1.0" and click download.
113

README.ti-secure

1README on how boot images are created for secure TI devices
2
3CONFIG_TI_SECURE_DEVICE:
4Secure TI devices require a boot image that is authenticated by ROM
5code to function. Without this, even JTAG remains locked and the
6device is essentially useless. In order to create a valid boot image for
7a secure device from TI, the initial public software image must be signed
8and combined with various headers, certificates, and other binary images.
9
10Information on the details on the complete boot image format can be obtained
11from Texas Instruments. The tools used to generate boot images for secure
12devices are part of a secure development package (SECDEV) that can be
13downloaded from:
14
15	http://www.ti.com/mysecuresoftware (login required)
16
17The secure development package is access controlled due to NDA and export
18control restrictions. Access must be requested and granted by TI before the
19package is viewable and downloadable. Contact TI, either online or by way
20of a local TI representative, to request access.
21
22Booting of U-Boot SPL
23=====================
24
25	When CONFIG_TI_SECURE_DEVICE is set, the U-Boot SPL build process
26	requires the presence and use of these tools in order to create a
27	viable boot image. The build process will look for the environment
28	variable TI_SECURE_DEV_PKG, which should be the path of the installed
29	SECDEV package. If the TI_SECURE_DEV_PKG variable is not defined or
30	if it is defined but doesn't point to a valid SECDEV package, a
31	warning is issued during the build to indicate that a final secure
32	bootable image was not created.
33
34	Within the SECDEV package exists an image creation script:
35
36	${TI_SECURE_DEV_PKG}/scripts/create-boot-image.sh
37
38	This is called as part of the SPL/u-boot build process. As the secure
39	boot image formats and requirements differ between secure SOC from TI,
40	the purpose of this script is to abstract these details as much as
41	possible.
42
43	The script is basically the only required interface to the TI SECDEV
44	package for creating a bootable SPL image for secure TI devices.
45
46	Invoking the script for AM33xx Secure Devices
47	=============================================
48
49	create-boot-image.sh \
50		<IMAGE_FLAG> <INPUT_FILE> <OUTPUT_FILE> <SPL_LOAD_ADDR>
51
52	<IMAGE_FLAG> is a value that specifies the type of the image to
53	generate OR the action the image generation tool will take. Valid
54	values are:
55		SPI_X-LOADER - Generates an image for SPI flash (byte swapped)
56		X-LOADER - Generates an image for non-XIP flash
57		MLO - Generates an image for SD/MMC/eMMC media
58		2ND - Generates an image for USB, UART and Ethernet
59		XIP_X-LOADER - Generates a single stage u-boot for NOR/QSPI XiP
60
61	<INPUT_FILE> is the full path and filename of the public world boot
62	loaderbinary file (depending on the boot media, this is usually
63	either u-boot-spl.bin or u-boot.bin).
64
65	<OUTPUT_FILE> is the full path and filename of the final secure
66	image. The output binary images should be used in place of the standard
67	non-secure binary images (see the platform-specific user's guides and
68	releases notes for how the non-secure images are typically used)
69	u-boot-spl_HS_SPI_X-LOADER - byte swapped boot image for SPI flash
70	u-boot-spl_HS_X-LOADER - boot image for NAND or SD/MMC/eMMC rawmode
71	u-boot-spl_HS_MLO - boot image for SD/MMC/eMMC media
72	u-boot-spl_HS_2ND - boot image for USB, UART and Ethernet
73	u-boot_HS_XIP_X-LOADER - boot image for NOR or QSPI Xip flash
74
75	<SPL_LOAD_ADDR> is the address at which SOC ROM should load the
76	<INPUT_FILE>
77
78	Invoking the script for AM43xx Secure Devices
79	=============================================
80
81	create-boot-image.sh \
82		<IMAGE_FLAG> <INPUT_FILE> <OUTPUT_FILE> <SPL_LOAD_ADDR>
83
84	<IMAGE_FLAG> is a value that specifies the type of the image to
85	generate OR the action the image generation tool will take. Valid
86	values are:
87		SPI_X-LOADER - Generates an image for SPI flash (byte
88			swapped)
89		XIP_X-LOADER - Generates a single stage u-boot for
90			NOR/QSPI XiP
91		ISSW - Generates an image for all other boot modes
92
93	<INPUT_FILE> is the full path and filename of the public world boot
94	loaderbinary file (depending on the boot media, this is usually
95	either u-boot-spl.bin or u-boot.bin).
96
97	<OUTPUT_FILE> is the full path and filename of the final secure
98	image. The output binary images should be used in place of the standard
99	non-secure binary images (see the platform-specific user's guides and
100	releases notes for how the non-secure images are typically used)
101	u-boot-spl_HS_SPI_X-LOADER - byte swapped boot image for SPI flash
102	u-boot_HS_XIP_X-LOADER - boot image for NOR or QSPI flash
103	u-boot-spl_HS_ISSW - boot image for all other boot media
104
105	<SPL_LOAD_ADDR> is the address at which SOC ROM should load the
106	<INPUT_FILE>
107
108	Invoking the script for DRA7xx/AM57xx Secure Devices
109	====================================================
110
111	create-boot-image.sh \
112		<IMAGE_TYPE> <INPUT_FILE> <OUTPUT_FILE> <SPL_LOAD_ADDR>
113
114	<IMAGE_TYPE> is a value that specifies the type of the image to
115	generate OR the action the image generation tool will take. Valid
116	values are:
117		X-LOADER - Generates an image for NOR or QSPI boot modes
118		MLO - Generates an image for SD/MMC/eMMC boot modes
119		ULO - Generates an image for USB/UART peripheral boot modes
120
121	<INPUT_FILE> is the full path and filename of the public world boot
122	loader binary file (for this platform, this is always u-boot-spl.bin).
123
124	<OUTPUT_FILE> is the full path and filename of the final secure image.
125	The output binary images should be used in place of the standard
126	non-secure binary images (see the platform-specific user's guides
127	and releases notes for how the non-secure images are typically used)
128	u-boot-spl_HS_MLO - boot image for SD/MMC/eMMC. This image is
129		copied to a file named MLO, which is the name that
130		the device ROM bootloader requires for loading from
131		the FAT partition of an SD card (same as on
132		non-secure devices)
133	u-boot-spl_HS_ULO - boot image for USB/UART peripheral boot modes
134	u-boot-spl_HS_X-LOADER - boot image for all other flash memories
135		including QSPI and NOR flash
136
137	<SPL_LOAD_ADDR> is the address at which SOC ROM should load the
138	<INPUT_FILE>
139
140	Invoking the script for Keystone2 Secure Devices
141	=============================================
142
143	create-boot-image.sh \
144		<UNUSED> <INPUT_FILE> <OUTPUT_FILE> <UNUSED>
145
146	<UNUSED> is currently ignored and reserved for future use.
147
148	<INPUT_FILE> is the full path and filename of the public world boot
149	loader binary file (only u-boot.bin is currently supported on
150	Keystone2 devices, u-boot-spl.bin is not currently supported).
151
152	<OUTPUT_FILE> is the full path and filename of the final secure image.
153	The output binary images should be used in place of the standard
154	non-secure binary images (see the platform-specific user's guides
155	and releases notes for how the non-secure images are typically used)
156	u-boot_HS_MLO - signed and encrypted boot image that can be used to
157		boot from all media. Secure boot from SPI NOR flash is not
158		currently supported.
159
160Booting of Primary U-Boot (u-boot.img)
161======================================
162
163	The SPL image is responsible for loading the next stage boot loader,
164	which is the main u-boot image. For secure TI devices, the SPL will
165	be authenticated, as described above, as part of the particular
166	device's ROM boot process. In order to continue the secure boot
167	process, the authenticated SPL must authenticate the main u-boot
168	image that it loads.
169
170	The configurations for secure TI platforms are written to make the boot
171	process use the FIT image format for the u-boot.img (CONFIG_SPL_FRAMEWORK
172	and CONFIG_SPL_LOAD_FIT). With these configurations the binary
173	components that the SPL loads include a specific DTB image and u-boot
174	image. These DTB image may be one of many available to the boot
175	process. In order to secure these components so that they can be
176	authenticated by the SPL as they are loaded from the FIT image,	the
177	build procedure for secure TI devices will secure these images before
178	they are integrated into the FIT image. When those images are extracted
179	from the FIT image at boot time, they are post-processed to verify that
180	they are still secure. The outlined security-related SPL post-processing
181	is enabled through the CONFIG_SPL_FIT_IMAGE_POST_PROCESS option which
182	must be enabled for the secure boot scheme to work. In order to allow
183	verifying proper operation of the secure boot chain in case of successful
184	authentication messages like "Authentication passed: CERT_U-BOOT-NOD" are
185	output by the SPL to the console for each blob that got extracted from the
186	FIT image. Note that the last part of this log message is the (truncated)
187	name of the signing certificate embedded into the blob that got processed.
188
189	The exact details of the how the images are secured is handled by the
190	SECDEV package. Within the SECDEV package exists a script to process
191	an input binary image:
192
193	${TI_SECURE_DEV_PKG}/scripts/secure-binary-image.sh
194
195	This is called as part of the u-boot build process. As the secure
196	image formats and requirements can differ between the various secure
197	SOCs from TI, this script in the SECDEV package abstracts these
198	details. This script is essentially the only required interface to the
199	TI SECDEV package for creating a u-boot.img image for secure TI
200	devices.
201
202	The SPL/u-boot code contains calls to dedicated secure ROM functions
203	to perform the validation on the secured images. The details of the
204	interface to those functions is shown in the code. The summary
205	is that they are accessed by invoking an ARM secure monitor call to
206	the device's secure ROM (fixed read-only-memory that is secure and
207	only accessible when the ARM core is operating in the secure mode).
208
209	Invoking the secure-binary-image script for Secure Devices
210	==========================================================
211
212	secure-binary-image.sh <INPUT_FILE> <OUTPUT_FILE>
213
214	<INPUT_FILE> is the full path and filename of the input binary image
215
216	<OUTPUT_FILE> is the full path and filename of the output secure image.
217

README.trace

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (c) 2013 The Chromium OS Authors.
4
5Tracing in U-Boot
6=================
7
8U-Boot supports a simple tracing feature which allows a record of excecution
9to be collected and sent to a host machine for analysis. At present the
10main use for this is to profile boot time.
11
12
13Overview
14--------
15
16The trace feature uses GCC's instrument-functions feature to trace all
17function entry/exit points. These are then recorded in a memory buffer.
18The memory buffer can be saved to the host over a network link using
19tftpput or by writing to an attached memory device such as MMC.
20
21On the host, the file is first converted with a tool called 'proftool',
22which extracts useful information from it. The resulting trace output
23resembles that emitted by Linux's ftrace feature, so can be visually
24displayed by pytimechart.
25
26
27Quick-start using Sandbox
28-------------------------
29
30Sandbox is a build of U-Boot that can run under Linux so it is a convenient
31way of trying out tracing before you use it on your actual board. To do
32this, follow these steps:
33
34Add the following to include/configs/sandbox.h (if not already there)
35
36#define CONFIG_TRACE
37#define CONFIG_CMD_TRACE
38#define CONFIG_TRACE_BUFFER_SIZE		(16 << 20)
39#define CONFIG_TRACE_EARLY_SIZE		(8 << 20)
40#define CONFIG_TRACE_EARLY
41#define CONFIG_TRACE_EARLY_ADDR		0x00100000
42
43Build sandbox U-Boot with tracing enabled:
44
45$ make FTRACE=1 O=sandbox sandbox_config
46$ make FTRACE=1 O=sandbox
47
48Run sandbox, wait for a bit of trace information to appear, and then capture
49a trace:
50
51$ ./sandbox/u-boot
52
53
54U-Boot 2013.04-rc2-00100-ga72fcef (Apr 17 2013 - 19:25:24)
55
56DRAM:  128 MiB
57trace: enabled
58Using default environment
59
60In:    serial
61Out:   serial
62Err:   serial
63=>trace stats
64	671,406 function sites
65	 69,712 function calls
66	      0 untracked function calls
67	 73,373 traced function calls
68	     16 maximum observed call depth
69	     15 call depth limit
70	 66,491 calls not traced due to depth
71=>trace stats
72	671,406 function sites
73      1,279,450 function calls
74	      0 untracked function calls
75	950,490 traced function calls (333217 dropped due to overflow)
76	     16 maximum observed call depth
77	     15 call depth limit
78      1,275,767 calls not traced due to depth
79=>trace calls 0 e00000
80Call list dumped to 00000000, size 0xae0a40
81=>print
82baudrate=115200
83profbase=0
84profoffset=ae0a40
85profsize=e00000
86stderr=serial
87stdin=serial
88stdout=serial
89
90Environment size: 117/8188 bytes
91=>host save host 0 trace 0 ${profoffset}
9211405888 bytes written in 10 ms (1.1 GiB/s)
93=>reset
94
95
96Then run proftool to convert the trace information to ftrace format.
97
98$ ./sandbox/tools/proftool -m sandbox/System.map -p trace dump-ftrace >trace.txt
99
100Finally run pytimechart to display it:
101
102$ pytimechart trace.txt
103
104Using this tool you can zoom and pan across the trace, with the function
105calls on the left and little marks representing the start and end of each
106function.
107
108
109CONFIG Options
110--------------
111
112- CONFIG_TRACE
113		Enables the trace feature in U-Boot.
114
115- CONFIG_CMD_TRACE
116		Enables the trace command.
117
118- CONFIG_TRACE_BUFFER_SIZE
119		Size of trace buffer to allocate for U-Boot. This buffer is
120		used after relocation, as a place to put function tracing
121		information. The address of the buffer is determined by
122		the relocation code.
123
124- CONFIG_TRACE_EARLY
125		Define this to start tracing early, before relocation.
126
127- CONFIG_TRACE_EARLY_SIZE
128		Size of 'early' trace buffer. Before U-Boot has relocated
129		it doesn't have a proper trace buffer. On many boards
130		you can define an area of memory to use for the trace
131		buffer until the 'real' trace buffer is available after
132		relocation. The contents of this buffer are then copied to
133		the real buffer.
134
135- CONFIG_TRACE_EARLY_ADDR
136		Address of early trace buffer
137
138
139Building U-Boot with Tracing Enabled
140------------------------------------
141
142Pass 'FTRACE=1' to the U-Boot Makefile to actually instrument the code.
143This is kept as a separate option so that it is easy to enable/disable
144instrumenting from the command line instead of having to change board
145config files.
146
147
148Collecting Trace Data
149---------------------
150
151When you run U-Boot on your board it will collect trace data up to the
152limit of the trace buffer size you have specified. Once that is exhausted
153no more data will be collected.
154
155Collecting trace data has an affect on execution time/performance. You
156will notice this particularly with trvial functions - the overhead of
157recording their execution may even exceed their normal execution time.
158In practice this doesn't matter much so long as you are aware of the
159effect. Once you have done your optimisations, turn off tracing before
160doing end-to-end timing.
161
162The best time to start tracing is right at the beginning of U-Boot. The
163best time to stop tracing is right at the end. In practice it is hard
164to achieve these ideals.
165
166This implementation enables tracing early in board_init_f(). This means
167that it captures most of the board init process, missing only the
168early architecture-specific init. However, it also misses the entire
169SPL stage if there is one.
170
171U-Boot typically ends with a 'bootm' command which loads and runs an
172OS. There is useful trace data in the execution of that bootm
173command. Therefore this implementation provides a way to collect trace
174data after bootm has finished processing, but just before it jumps to
175the OS. In practical terms, U-Boot runs the 'fakegocmd' environment
176variable at this point. This variable should have a short script which
177collects the trace data and writes it somewhere.
178
179Trace data collection relies on a microsecond timer, accesed through
180timer_get_us(). So the first think you should do is make sure that
181this produces sensible results for your board. Suitable sources for
182this timer include high resolution timers, PWMs or profile timers if
183available. Most modern SOCs have a suitable timer for this. Make sure
184that you mark this timer (and anything it calls) with
185__attribute__((no_instrument_function)) so that the trace library can
186use it without causing an infinite loop.
187
188
189Commands
190--------
191
192The trace command has variable sub-commands:
193
194- stats
195		Display tracing statistics
196
197- pause
198		Pause tracing
199
200- resume
201		Resume tracing
202
203- funclist [<addr> <size>]
204		Dump a list of functions into the buffer
205
206- calls  [<addr> <size>]
207		Dump function call trace into buffer
208
209If the address and size are not given, these are obtained from environment
210variables (see below). In any case the environment variables are updated
211after the command runs.
212
213
214Environment Variables
215---------------------
216
217The following are used:
218
219- profbase
220		Base address of trace output buffer
221
222- profoffset
223		Offset of first unwritten byte in trace output buffer
224
225- profsize
226		Size of trace output buffer
227
228All of these are set by the 'trace calls' command.
229
230These variables keep track of the amount of data written to the trace
231output buffer by the 'trace' command. The trace commands which write data
232to the output buffer can use these to specify the buffer to write to, and
233update profoffset each time. This allows successive commands to append data
234to the same buffer, for example:
235
236	trace funclist 10000 e00000
237	trace calls
238
239(the latter command appends more data to the buffer).
240
241
242- fakegocmd
243		Specifies commands to run just before booting the OS. This
244		is a useful time to write the trace data to the host for
245		processing.
246
247
248Writing Out Trace Data
249----------------------
250
251Once the trace data is in an output buffer in memory there are various ways
252to transmit it to the host. Notably you can use tftput to send the data
253over a network link:
254
255fakegocmd=trace pause; usb start; set autoload n; bootp;
256	trace calls 10000000 1000000;
257	tftpput ${profbase} ${profoffset} 192.168.1.4:/tftpboot/calls
258
259This starts up USB (to talk to an attached USB Ethernet dongle), writes
260a trace log to address 10000000 and sends it to a host machine using
261TFTP. After this, U-Boot will boot the OS normally, albeit a little
262later.
263
264
265Converting Trace Output Data
266----------------------------
267
268The trace output data is kept in a binary format which is not documented
269here. To convert it into something useful, you can use proftool.
270
271This tool must be given the U-Boot map file and the trace data received
272from running that U-Boot. It produces a text output file.
273
274Options
275	-m <map_file>
276		Specify U-Boot map file
277
278	-p <trace_file>
279		Specifiy profile/trace file
280
281Commands:
282
283- dump-ftrace
284	Write a text dump of the file in Linux ftrace format to stdout
285
286
287Viewing the Trace Data
288----------------------
289
290You can use pytimechart for this (sudo apt-get pytimechart might work on
291your Debian-style machine, and use your favourite search engine to obtain
292documentation). It expects the file to have a .txt extension. The program
293has terse user interface but is very convenient for viewing U-Boot
294profile information.
295
296
297Workflow Suggestions
298--------------------
299
300The following suggestions may be helpful if you are trying to reduce boot
301time:
302
3031. Enable CONFIG_BOOTSTAGE and CONFIG_BOOTSTAGE_REPORT. This should get
304you are helpful overall snapshot of the boot time.
305
3062. Build U-Boot with tracing and run it. Note the difference in boot time
307(it is common for tracing to add 10% to the time)
308
3093. Collect the trace information as descibed above. Use this to find where
310all the time is being spent.
311
3124. Take a look at that code and see if you can optimise it. Perhaps it is
313possible to speed up the initialisation of a device, or remove an unused
314feature.
315
3165. Rebuild, run and collect again. Compare your results.
317
3186. Keep going until you run out of steam, or your boot is fast enough.
319
320
321Configuring Trace
322-----------------
323
324There are a few parameters in the code that you may want to consider.
325There is a function call depth limit (set to 15 by default). When the
326stack depth goes above this then no tracing information is recorded.
327The maximum depth reached is recorded and displayed by the 'trace stats'
328command.
329
330
331Future Work
332-----------
333
334Tracing could be a little tidier in some areas, for example providing
335run-time configuration options for trace.
336
337Some other features that might be useful:
338
339- Trace filter to select which functions are recorded
340- Sample-based profiling using a timer interrupt
341- Better control over trace depth
342- Compression of trace information
343
344
345Simon Glass <sjg@chromium.org>
346April 2013
347

README.u-boot_on_efi

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2015 Google, Inc
4
5U-Boot on EFI
6=============
7This document provides information about U-Boot running on top of EFI, either
8as an application or just as a means of getting U-Boot onto a new platform.
9
10
11=========== Table of Contents ===========
12
13Motivation
14Status
15Build Instructions
16Trying it out
17Inner workings
18EFI Application
19EFI Payload
20Tables
21Interrupts
2232/64-bit
23Future work
24Where is the code?
25
26
27Motivation
28----------
29Running U-Boot on EFI is useful in several situations:
30
31- You have EFI running on a board but U-Boot does not natively support it
32fully yet. You can boot into U-Boot from EFI and use that until U-Boot is
33fully ported
34
35- You need to use an EFI implementation (e.g. UEFI) because your vendor
36requires it in order to provide support
37
38- You plan to use coreboot to boot into U-Boot but coreboot support does
39not currently exist for your platform. In the meantime you can use U-Boot
40on EFI and then move to U-Boot on coreboot when ready
41
42- You use EFI but want to experiment with a simpler alternative like U-Boot
43
44
45Status
46------
47Only x86 is supported at present. If you are using EFI on another architecture
48you may want to reconsider. However, much of the code is generic so could be
49ported.
50
51U-Boot supports running as an EFI application for 32-bit EFI only. This is
52not very useful since only a serial port is provided. You can look around at
53memory and type 'help' but that is about it.
54
55More usefully, U-Boot supports building itself as a payload for either 32-bit
56or 64-bit EFI. U-Boot is packaged up and loaded in its entirety by EFI. Once
57started, U-Boot changes to 32-bit mode (currently) and takes over the
58machine. You can use devices, boot a kernel, etc.
59
60
61Build Instructions
62------------------
63First choose a board that has EFI support and obtain an EFI implementation
64for that board. It will be either 32-bit or 64-bit. Alternatively, you can
65opt for using QEMU [1] and the OVMF [2], as detailed below.
66
67To build U-Boot as an EFI application (32-bit EFI required), enable CONFIG_EFI
68and CONFIG_EFI_APP. The efi-x86_app config (efi-x86_app_defconfig) is set up
69for this. Just build U-Boot as normal, e.g.
70
71   make efi-x86_app_defconfig
72   make
73
74To build U-Boot as an EFI payload (32-bit or 64-bit EFI can be used), enable
75CONFIG_EFI, CONFIG_EFI_STUB, and select either CONFIG_EFI_STUB_32BIT or
76CONFIG_EFI_STUB_64BIT. The efi-x86_payload configs (efi-x86_payload32_defconfig
77and efi-x86_payload32_defconfig) are set up for this. Then build U-Boot as
78normal, e.g.
79
80   make efi-x86_payload32_defconfig (or efi-x86_payload64_defconfig)
81   make
82
83You will end up with one of these files depending on what you build for:
84
85   u-boot-app.efi      - U-Boot EFI application
86   u-boot-payload.efi  - U-Boot EFI payload application
87
88
89Trying it out
90-------------
91QEMU is an emulator and it can emulate an x86 machine. Please make sure your
92QEMU version is 2.3.0 or above to test this. You can run the payload with
93something like this:
94
95   mkdir /tmp/efi
96   cp /path/to/u-boot*.efi /tmp/efi
97   qemu-system-x86_64 -bios bios.bin -hda fat:/tmp/efi/
98
99Add -nographic if you want to use the terminal for output. Once it starts
100type 'fs0:u-boot-payload.efi' to run the payload or 'fs0:u-boot-app.efi' to
101run the application. 'bios.bin' is the EFI 'BIOS'. Check [2] to obtain a
102prebuilt EFI BIOS for QEMU or you can build one from source as well.
103
104To try it on real hardware, put u-boot-app.efi on a suitable boot medium,
105such as a USB stick. Then you can type something like this to start it:
106
107   fs0:u-boot-payload.efi
108
109(or fs0:u-boot-app.efi for the application)
110
111This will start the payload, copy U-Boot into RAM and start U-Boot. Note
112that EFI does not support booting a 64-bit application from a 32-bit
113EFI (or vice versa). Also it will often fail to print an error message if
114you get this wrong.
115
116
117Inner workings
118==============
119Here follow a few implementation notes for those who want to fiddle with
120this and perhaps contribute patches.
121
122The application and payload approaches sound similar but are in fact
123implemented completely differently.
124
125EFI Application
126---------------
127For the application the whole of U-Boot is built as a shared library. The
128efi_main() function is in lib/efi/efi_app.c. It sets up some basic EFI
129functions with efi_init(), sets up U-Boot global_data, allocates memory for
130U-Boot's malloc(), etc. and enters the normal init sequence (board_init_f()
131and board_init_r()).
132
133Since U-Boot limits its memory access to the allocated regions very little
134special code is needed. The CONFIG_EFI_APP option controls a few things
135that need to change so 'git grep CONFIG_EFI_APP' may be instructive.
136The CONFIG_EFI option controls more general EFI adjustments.
137
138The only available driver is the serial driver. This calls back into EFI
139'boot services' to send and receive characters. Although it is implemented
140as a serial driver the console device is not necessarilly serial. If you
141boot EFI with video output then the 'serial' device will operate on your
142target devices's display instead and the device's USB keyboard will also
143work if connected. If you have both serial and video output, then both
144consoles will be active. Even though U-Boot does the same thing normally,
145These are features of EFI, not U-Boot.
146
147Very little code is involved in implementing the EFI application feature.
148U-Boot is highly portable. Most of the difficulty is in modifying the
149Makefile settings to pass the right build flags. In particular there is very
150little x86-specific code involved - you can find most of it in
151arch/x86/cpu. Porting to ARM (which can also use EFI if you are brave
152enough) should be straightforward.
153
154Use the 'reset' command to get back to EFI.
155
156EFI Payload
157-----------
158The payload approach is a different kettle of fish. It works by building
159U-Boot exactly as normal for your target board, then adding the entire
160image (including device tree) into a small EFI stub application responsible
161for booting it. The stub application is built as a normal EFI application
162except that it has a lot of data attached to it.
163
164The stub application is implemented in lib/efi/efi_stub.c. The efi_main()
165function is called by EFI. It is responsible for copying U-Boot from its
166original location into memory, disabling EFI boot services and starting
167U-Boot. U-Boot then starts as normal, relocates, starts all drivers, etc.
168
169The stub application is architecture-dependent. At present it has some
170x86-specific code and a comment at the top of efi_stub.c describes this.
171
172While the stub application does allocate some memory from EFI this is not
173used by U-Boot (the payload). In fact when U-Boot starts it has all of the
174memory available to it and can operate as it pleases (but see the next
175section).
176
177Tables
178------
179The payload can pass information to U-Boot in the form of EFI tables. At
180present this feature is used to pass the EFI memory map, an inordinately
181large list of memory regions. You can use the 'efi mem all' command to
182display this list. U-Boot uses the list to work out where to relocate
183itself.
184
185Although U-Boot can use any memory it likes, EFI marks some memory as used
186by 'run-time services', code that hangs around while U-Boot is running and
187is even present when Linux is running. This is common on x86 and provides
188a way for Linux to call back into the firmware to control things like CPU
189fan speed. U-Boot uses only 'conventional' memory, in EFI terminology. It
190will relocate itself to the top of the largest block of memory it can find
191below 4GB.
192
193Interrupts
194----------
195U-Boot drivers typically don't use interrupts. Since EFI enables interrupts
196it is possible that an interrupt will fire that U-Boot cannot handle. This
197seems to cause problems. For this reason the U-Boot payload runs with
198interrupts disabled at present.
199
20032/64-bit
201---------
202While the EFI application can in principle be built as either 32- or 64-bit,
203only 32-bit is currently supported. This means that the application can only
204be used with 32-bit EFI.
205
206The payload stub can be build as either 32- or 64-bits. Only a small amount
207of code is built this way (see the extra- line in lib/efi/Makefile).
208Everything else is built as a normal U-Boot, so is always 32-bit on x86 at
209present.
210
211Future work
212-----------
213This work could be extended in a number of ways:
214
215- Add ARM support
216
217- Add 64-bit application support
218
219- Figure out how to solve the interrupt problem
220
221- Add more drivers to the application side (e.g. video, block devices, USB,
222environment access). This would mostly be an academic exercise as a strong
223use case is not readily apparent, but it might be fun.
224
225- Avoid turning off boot services in the stub. Instead allow U-Boot to make
226use of boot services in case it wants to. It is unclear what it might want
227though.
228
229Where is the code?
230------------------
231lib/efi
232	payload stub, application, support code. Mostly arch-neutral
233
234arch/x86/cpu/efi
235	x86 support code for running as an EFI application and payload
236
237board/efi/efi-x86_app/efi.c
238	x86 board code for running as an EFI application
239
240board/efi/efi-x86_payload
241	generic x86 EFI payload board support code
242
243common/cmd_efi.c
244	the 'efi' command
245
246--
247Ben Stoltz, Simon Glass
248Google, Inc
249July 2015
250
251[1] http://www.qemu.org
252[2] http://www.tianocore.org/ovmf/
253

README.ubi

1-------------------
2UBI usage in U-Boot
3-------------------
4
5UBI support in U-Boot is broken down into five separate commands.
6The first is the ubi command, which has six subcommands:
7
8=> help ubi
9ubi - ubi commands
10
11Usage:
12ubi part [part] [offset]
13 - Show or set current partition (with optional VID header offset)
14ubi info [l[ayout]] - Display volume and ubi layout information
15ubi create[vol] volume [size] [type] - create volume name with size
16ubi write[vol] address volume size - Write volume from address with size
17ubi write.part address volume size [fullsize]
18 - Write part of a volume from address
19ubi read[vol] address volume [size] - Read volume to address with size
20ubi remove[vol] volume - Remove volume
21[Legends]
22 volume: character name
23 size: specified in bytes
24 type: s[tatic] or d[ynamic] (default=dynamic)
25
26
27The first command that is needed to be issues is "ubi part" to connect
28one mtd partition to the UBI subsystem. This command will either create
29a new UBI device on the requested MTD partition. Or it will attach a
30previously created UBI device. The other UBI commands will only work
31when such a UBI device is attached (via "ubi part"). Here an example:
32
33=> mtdparts
34
35device nor0 <1fc000000.nor_flash>, # parts = 6
36 #: name                size            offset          mask_flags
37 0: kernel              0x00200000      0x00000000      0
38 1: dtb                 0x00040000      0x00200000      0
39 2: root                0x00200000      0x00240000      0
40 3: user                0x01ac0000      0x00440000      0
41 4: env                 0x00080000      0x01f00000      0
42 5: u-boot              0x00080000      0x01f80000      0
43
44active partition: nor0,0 - (kernel) 0x00200000 @ 0x00000000
45
46defaults:
47mtdids  : nor0=1fc000000.nor_flash
48mtdparts: mtdparts=1fc000000.nor_flash:2m(kernel),256k(dtb),2m(root),27392k(user),512k(env),512k(u-boot)
49
50=> ubi part root
51Creating 1 MTD partitions on "nor0":
520x000000240000-0x000000440000 : "mtd=2"
53UBI: attaching mtd1 to ubi0
54UBI: physical eraseblock size:   262144 bytes (256 KiB)
55UBI: logical eraseblock size:    262016 bytes
56UBI: smallest flash I/O unit:    1
57UBI: VID header offset:          64 (aligned 64)
58UBI: data offset:                128
59UBI: attached mtd1 to ubi0
60UBI: MTD device name:            "mtd=2"
61UBI: MTD device size:            2 MiB
62UBI: number of good PEBs:        8
63UBI: number of bad PEBs:         0
64UBI: max. allowed volumes:       128
65UBI: wear-leveling threshold:    4096
66UBI: number of internal volumes: 1
67UBI: number of user volumes:     1
68UBI: available PEBs:             0
69UBI: total number of reserved PEBs: 8
70UBI: number of PEBs reserved for bad PEB handling: 0
71UBI: max/mean erase counter: 2/1
72
73
74Now that the UBI device is attached, this device can be modified
75using the following commands:
76
77ubi info	Display volume and ubi layout information
78ubi createvol	Create UBI volume on UBI device
79ubi removevol	Remove UBI volume from UBI device
80ubi read	Read data from UBI volume to memory
81ubi write	Write data from memory to UBI volume
82ubi write.part	Write data from memory to UBI volume, in parts
83
84
85Here a few examples on the usage:
86
87=> ubi create testvol
88Creating dynamic volume testvol of size 1048064
89
90=> ubi info l
91UBI: volume information dump:
92UBI: vol_id          0
93UBI: reserved_pebs   4
94UBI: alignment       1
95UBI: data_pad        0
96UBI: vol_type        3
97UBI: name_len        7
98UBI: usable_leb_size 262016
99UBI: used_ebs        4
100UBI: used_bytes      1048064
101UBI: last_eb_bytes   262016
102UBI: corrupted       0
103UBI: upd_marker      0
104UBI: name            testvol
105
106UBI: volume information dump:
107UBI: vol_id          2147479551
108UBI: reserved_pebs   2
109UBI: alignment       1
110UBI: data_pad        0
111UBI: vol_type        3
112UBI: name_len        13
113UBI: usable_leb_size 262016
114UBI: used_ebs        2
115UBI: used_bytes      524032
116UBI: last_eb_bytes   2
117UBI: corrupted       0
118UBI: upd_marker      0
119UBI: name            layout volume
120
121=> ubi info
122UBI: MTD device name:            "mtd=2"
123UBI: MTD device size:            2 MiB
124UBI: physical eraseblock size:   262144 bytes (256 KiB)
125UBI: logical eraseblock size:    262016 bytes
126UBI: number of good PEBs:        8
127UBI: number of bad PEBs:         0
128UBI: smallest flash I/O unit:    1
129UBI: VID header offset:          64 (aligned 64)
130UBI: data offset:                128
131UBI: max. allowed volumes:       128
132UBI: wear-leveling threshold:    4096
133UBI: number of internal volumes: 1
134UBI: number of user volumes:     1
135UBI: available PEBs:             0
136UBI: total number of reserved PEBs: 8
137UBI: number of PEBs reserved for bad PEB handling: 0
138UBI: max/mean erase counter: 4/1
139
140=> ubi write 800000 testvol 80000
141Volume "testvol" found at volume id 0
142
143=> ubi read 900000 testvol 80000
144Volume testvol found at volume id 0
145read 524288 bytes from volume 0 to 900000(buf address)
146
147=> cmp.b 800000 900000 80000
148Total of 524288 bytes were the same
149
150
151Next, the ubifsmount command allows you to access filesystems on the
152UBI partition which has been attached with the ubi part command:
153
154=> help ubifsmount
155ubifsmount - mount UBIFS volume
156
157Usage:
158ubifsmount <volume-name>
159    - mount 'volume-name' volume
160
161For example:
162
163=> ubifsmount ubi0:recovery
164UBIFS: mounted UBI device 0, volume 0, name "recovery"
165UBIFS: mounted read-only
166UBIFS: file system size:   46473216 bytes (45384 KiB, 44 MiB, 366 LEBs)
167UBIFS: journal size:       6348800 bytes (6200 KiB, 6 MiB, 50 LEBs)
168UBIFS: media format:       w4/r0 (latest is w4/r0)
169UBIFS: default compressor: LZO
170UBIFS: reserved for root:  0 bytes (0 KiB)
171
172Note that unlike Linux, U-Boot can only have one active UBI partition
173at a time, which can be referred to as ubi0, and must be supplied along
174with the name of the filesystem you are mounting.
175
176
177Once a UBI filesystem has been mounted, the ubifsls command allows you
178to list the contents of a directory in the filesystem:
179
180
181=> help ubifsls
182ubifsls - list files in a directory
183
184Usage:
185ubifsls [directory]
186    - list files in a 'directory' (default '/')
187
188For example:
189
190=> ubifsls
191	    17442  Thu Jan 01 02:57:38 1970  imx28-evk.dtb
192	  2998146  Thu Jan 01 02:57:43 1970  zImage
193
194
195And the ubifsload command allows you to load a file from a UBI
196filesystem:
197
198
199=> help ubifsload
200ubifsload - load file from an UBIFS filesystem
201
202Usage:
203ubifsload <addr> <filename> [bytes]
204    - load file 'filename' to address 'addr'
205
206For example:
207
208=> ubifsload ${loadaddr} zImage
209Loading file 'zImage' to addr 0x42000000 with size 2998146 (0x002dbf82)...
210Done
211
212
213Finally, you can unmount the UBI filesystem with the ubifsumount
214command:
215
216=> help ubifsumount
217ubifsumount - unmount UBIFS volume
218
219Usage:
220ubifsumount     - unmount current volume
221
222For example:
223
224=> ubifsumount
225Unmounting UBIFS volume recovery!
226

README.ubispl

1Lightweight UBI and UBI fastmap support
2
3# Copyright (C) Thomas Gleixner <tglx@linutronix.de>
4#
5# SPDX-License-Identifier: GPL 2.0+ BSD-3-Clause
6
7Scans the UBI information and loads the requested static volumes into
8memory.
9
10Configuration Options:
11
12   CONFIG_SPL_UBI
13     Enables the SPL UBI support
14
15   CONFIG_SPL_UBI_MAX_VOL_LEBS
16     The maximum number of logical eraseblocks which a static volume
17     to load can contain. Used for sizing the scan data structure
18
19   CONFIG_SPL_UBI_MAX_PEB_SIZE
20     The maximum physical erase block size. Either a compile time
21     constant or runtime detection. Used for sizing the scan data
22     structure
23
24   CONFIG_SPL_UBI_MAX_PEBS
25     The maximum physical erase block count. Either a compile time
26     constant or runtime detection. Used for sizing the scan data
27     structure
28
29   CONFIG_SPL_UBI_VOL_IDS
30     The maximum volume ids which can be loaded. Used for sizing the
31     scan data structure.
32
33Usage notes:
34
35In the board config file define for example:
36
37#define CONFIG_SPL_UBI
38#define CONFIG_SPL_UBI_MAX_VOL_LEBS	256
39#define CONFIG_SPL_UBI_MAX_PEB_SIZE	(256*1024)
40#define CONFIG_SPL_UBI_MAX_PEBS		4096
41#define CONFIG_SPL_UBI_VOL_IDS		8
42
43The size requirement is roughly as follows:
44
45    2k for the basic data structure
46  + CONFIG_SPL_UBI_VOL_IDS * CONFIG_SPL_UBI_MAX_VOL_LEBS * 8
47  + CONFIG_SPL_UBI_MAX_PEBS * 64
48  + CONFIG_SPL_UBI_MAX_PEB_SIZE * UBI_FM_MAX_BLOCKS
49
50The last one is big, but I really don't care in that stage. Real world
51implementations only use the first couple of blocks, but the code
52handles up to UBI_FM_MAX_BLOCKS.
53
54Given the above configuration example the requirement is about 5M
55which is usually not a problem to reserve in the RAM along with the
56other areas like the kernel/dts load address.
57
58So something like this will do the trick:
59
60#define SPL_FINFO_ADDR			0x80800000
61#define SPL_DTB_LOAD_ADDR		0x81800000
62#define SPL_KERNEL_LOAD_ADDR		0x82000000
63
64In the board file, implement the following:
65
66static struct ubispl_load myvolumes[] = {
67	{
68		.vol_id		= 0,	/* kernel volume */
69		.load_addr	= (void *)SPL_KERNEL_LOAD_ADDR,
70	},
71	{
72		.vol_id		= 1,	/* DT blob */
73		.load_addr	= (void *)SPL_DTB_LOAD_ADDR,
74	}
75};
76
77int spl_start_uboot(void)
78{
79	struct ubispl_info info;
80
81	info.ubi = (struct ubi_scan_info *) SPL_FINFO_ADDR;
82	info.fastmap = 1;
83	info.read = nand_spl_read_flash;
84
85#if COMPILE_TIME_DEFINED
86	/*
87	 * MY_NAND_NR_SPL_PEBS is the number of physical erase blocks
88	 * in the FLASH which are reserved for the SPL. Think about
89	 * mtd partitions:
90	 *
91	 * part_spl { .start = 0, .end = 4 }
92	 * part_ubi { .start = 4, .end = NR_PEBS }
93	 */
94	info.peb_offset = MY_NAND_NR_SPL_PEBS;
95	info.peb_size = CONFIG_SYS_NAND_BLOCK_SIZE;
96	info.vid_offset = MY_NAND_UBI_VID_OFFS;
97	info.leb_start = MY_NAND_UBI_DATA_OFFS;
98	info.peb_count = MY_NAND_UBI_NUM_PEBS;
99#else
100	get_flash_info(&flash_info);
101	info.peb_offset = MY_NAND_NR_SPL_PEBS;
102	info.peb_size = flash_info.peb_size;
103
104	/*
105	 * The VID and Data offset depend on the capability of the
106	 * FLASH chip to do subpage writes.
107	 *
108	 * If the flash chip supports subpage writes, then the VID
109	 * header starts at the second subpage. So for 2k pages size
110	 * with 4 subpages the VID offset is 512. The DATA offset is 2k.
111	 *
112	 * If the flash chip does not support subpage writes then the
113	 * VID offset is FLASH_PAGE_SIZE and the DATA offset
114	 * 2 * FLASH_PAGE_SIZE
115	 */
116	info.vid_offset = flash_info.vid_offset;
117	info.leb_start = flash_info.data_offset;
118
119	/*
120	 * The flash reports the total number of erase blocks, so
121	 * we need to subtract the number of blocks which are reserved
122	 * for the SPL itself and not managed by UBI.
123	 */
124	info.peb_count = flash_info.peb_count - MY_NAND_NR_SPL_PEBS;
125#endif
126
127	ret = ubispl_load_volumes(&info, myvolumes, ARRAY_SIZE(myvolumes);
128
129	....
130
131}
132
133Note: you can load any payload that way. You can even load u-boot from
134UBI, so the only non UBI managed FLASH area is the one which is
135reserved for the SPL itself and read from the SoC ROM.
136
137And you can do fallback scenarios:
138
139    if (ubispl_load_volumes(&info, volumes0, ARRAY_SIZE(volumes0)))
140        if (ubispl_load_volumes(&info, volumes1, ARRAY_SIZE(volumes1)))
141	    ubispl_load_volumes(&info, vol_uboot, ARRAY_SIZE(vol_uboot));
142

README.ublimage

1---------------------------------------------
2UBL image Boot Image generation using mkimage
3---------------------------------------------
4
5This document describes how to set up an U-Boot image that can be directly
6booted by a DaVinci processor via NAND boot mode, using an UBL header,
7but without need for UBL.
8
9For more details see section 11.2 "ARM ROM Boot Modes" of
10http://focus.ti.com/lit/ug/sprufg5a/sprufg5a.pdf
11
12Command syntax:
13--------------
14./tools/mkimage -l <u-boot_file>
15		to list the UBL image file details
16
17./tools/mkimage -T ublimage \
18		-n <board specific configuration file> \
19		-d <u-boot binary>  <output image file>
20
21For example, for the davinci dm365evm board:
22./tools/mkimage -n ./board/davinci/dm365evm/ublimage.cfg \
23		-T ublimage \
24		-d u-boot-nand.bin u-boot.ubl
25
26You can generate the image directly when you compile u-boot with:
27
28$ make u-boot.ubl
29
30The output image can be flashed into the NAND.
31
32Please check the DaVinci documentation for further details.
33
34Board specific configuration file specifications:
35-------------------------------------------------
361. This file must present in the $(BOARDDIR) and the name should be
37	ublimage.cfg (since this is used in Makefile).
382. This file can have empty lines and lines starting with "#" as first
39	character to put comments.
403. This file can have configuration command lines as mentioned below,
41	any other information in this file is treated as invalid.
42
43Configuration command line syntax:
44---------------------------------
451. Each command line must have two strings, first one command or address
46	and second one data string
472. Following are the valid command strings and associated data strings:-
48	Command string		data string
49	--------------		-----------
50	MODE			UBL special mode, on of:
51				safe
52				Example:
53				MODE	safe
54
55	ENTRY			Entry point address for the user
56				bootloader (absolute address) = TEXT_BASE
57				nand_spl loader.
58				Example:
59				ENTRY	0x00000020
60
61	PAGES			Number of pages (size of user bootloader
62				in number of pages)
63				Example:
64				PAGES	27
65
66	START_BLOCK		Block number where user bootloader is present
67				Example:
68				START_BLOCK	5
69
70	START_PAGE		Page number where user bootloader is present
71				(for RBL always 0)
72				Example:
73				START_PAGE	0
74
75------------------------------------------------
76
77Structure of the u-boot.ubl binary:
78
79compile steps:
80
811) nand_spl code compile, with pad_to = (TEXT_BASE +
82   (CONFIG_SYS_NROF_PAGES_NAND_SPL * pagesize))
83   Example: cam_enc_4xx pad_to = 0x20 + (6 * 0x800) = 0x3020 = 12320
84   -> u-boot-spl-16k.bin
85
86   !! TEXT_BASE = 0x20, as the RBL starts at 0x20
87
882) compile u-boot.bin ("normal" u-boot)
89   -> u-boot.bin
90
913) create u-boot-nand.bin = u-boot-spl-16k.bin + u-boot.bin
92
934) create u-boot.ubl, size = 1 page size NAND
94   create UBL header and paste it before u-boot.bin
95
96This steps are done automagically if you do a "make all"
97
98-> You get an u-boot.ubl binary, which you can flash
99   into your NAND.
100
101Structure of this binary (Example for the cam_enc_4xx board with a NAND
102page size = 0x800):
103
104offset :    0x00000 | 0x800	  | 0x3800
105content:    UBL     | nand_spl	  | u-boot code
106	    Header  | code	  |
107
108The NAND layout looks for example like this:
109
110(Example for the cam_enc_4xx board with a NAND page size = 0x800, block
111size = 0x20000 and CONFIG_SYS_NROF_UBL_HEADER 5):
112
113offset :    0x80000 | 0xa0000	  | 0xa3000
114content:    UBL     | nand_spl	  | u-boot code
115	    Header  | code	  |
116	    ^	      ^
117	    ^	      0xa0000 = CONFIG_SYS_NROF_UBL_HEADER * 0x20000
118	    ^
119	    0x80000 = Block 4 * 0x20000
120
121If the cpu starts in NAND boot mode, it checks the UBL descriptor
122starting with block 1 (page 0).  When a valid UBL signature is found,
123the corresponding block number (from 1 to 24) is written to the last 32
124bits of ARM internal memory (0x7ffc-0x8000).  This feature is provided
125as a basic debug mechanism.  If not found, it continues with block 2
126... last possible block is 24
127
128If a valid UBL descriptor is found, the UBL descriptor is read and
129processed.  The descriptor gives the information required for loading
130and control transfer to the nand_spl code.  The nand_spl code is then
131read and processed.
132
133Once the user-specified start-up conditions are set, the RBL copies the
134nand_spl into ARM internal RAM, starting at address 0x0000: 0020.
135							    ^^^^
136
137The nand_spl code itself now does necessary intializations, and at least,
138copies the u-boot code from NAND into RAM, and jumps to it ...
139
140------------------------------------------------
141Author: Heiko Schocher <hs@denx.de>
142

README.uefi

1<!--
2SPDX-License-Identifier: GPL-2.0+
3
4Copyright (c) 2018 Heinrich Schuchardt
5-->
6
7# UEFI on U-Boot
8
9The Unified Extensible Firmware Interface Specification (UEFI) [1] has become
10the default for booting on AArch64 and x86 systems. It provides a stable API for
11the interaction of drivers and applications with the firmware. The API comprises
12access to block storage, network, and console to name a few. The Linux kernel
13and boot loaders like GRUB or the FreeBSD loader can be executed.
14
15## Development target
16
17The implementation of UEFI in U-Boot strives to reach the minimum requirements
18described in "Server Base Boot Requirements System Software on ARM Platforms -
19Version 1.1" [4].
20
21A full blown UEFI implementation would contradict the U-Boot design principle
22"keep it small".
23
24## Building for UEFI
25
26The UEFI standard supports only little-endian systems. The UEFI support can be
27activated for ARM and x86 by specifying
28
29    CONFIG_CMD_BOOTEFI=y
30    CONFIG_EFI_LOADER=y
31
32in the .config file.
33
34Support for attaching virtual block devices, e.g. iSCSI drives connected by the
35loaded UEFI application [3], requires
36
37    CONFIG_BLK=y
38    CONFIG_PARTITIONS=y
39
40### Executing a UEFI binary
41
42The bootefi command is used to start UEFI applications or to install UEFI
43drivers. It takes two parameters
44
45    bootefi <image address> [fdt address]
46
47* image address - the memory address of the UEFI binary
48* fdt address - the memory address of the flattened device tree
49
50Below you find the output of an example session starting GRUB.
51
52    => load mmc 0:2 ${fdt_addr_r} boot/dtb
53    29830 bytes read in 14 ms (2 MiB/s)
54    => load mmc 0:1 ${kernel_addr_r} efi/debian/grubaa64.efi
55    reading efi/debian/grubaa64.efi
56    120832 bytes read in 7 ms (16.5 MiB/s)
57    => bootefi ${kernel_addr_r} ${fdt_addr_r}
58
59The environment variable 'bootargs' is passed as load options in the UEFI system
60table. The Linux kernel EFI stub uses the load options as command line
61arguments.
62
63### Executing the boot manager
64
65The UEFI specification foresees to define boot entries and boot sequence via UEFI
66variables. Booting according to these variables is possible via
67
68    bootefi bootmgr [fdt address]
69
70As of U-Boot v2018.03 UEFI variables are not persisted and cannot be set at
71runtime.
72
73### Executing the built in hello world application
74
75A hello world UEFI application can be built with
76
77    CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y
78
79It can be embedded into the U-Boot binary with
80
81    CONFIG_CMD_BOOTEFI_HELLO=y
82
83The bootefi command is used to start the embedded hello world application.
84
85    bootefi hello [fdt address]
86
87Below you find the output of an example session.
88
89    => bootefi hello ${fdtcontroladdr}
90    ## Starting EFI application at 01000000 ...
91    WARNING: using memory device/image path, this may confuse some payloads!
92    Hello, world!
93    Running on UEFI 2.7
94    Have SMBIOS table
95    Have device tree
96    Load options: root=/dev/sdb3 init=/sbin/init rootwait ro
97    ## Application terminated, r = 0
98
99The environment variable fdtcontroladdr points to U-Boot's internal device tree
100(if available).
101
102### Executing the built-in self-test
103
104An UEFI self-test suite can be embedded in U-Boot by building with
105
106    CONFIG_CMD_BOOTEFI_SELFTEST=y
107
108For testing the UEFI implementation the bootefi command can be used to start the
109self-test.
110
111    bootefi selftest [fdt address]
112
113The environment variable 'efi_selftest' can be used to select a single test. If
114it is not provided all tests are executed except those marked as 'on request'.
115If the environment variable is set to 'list' a list of all tests is shown.
116
117Below you can find the output of an example session.
118
119    => setenv efi_selftest simple network protocol
120    => bootefi selftest
121    Testing EFI API implementation
122    Selected test: 'simple network protocol'
123    Setting up 'simple network protocol'
124    Setting up 'simple network protocol' succeeded
125    Executing 'simple network protocol'
126    DHCP Discover
127    DHCP reply received from 192.168.76.2 (52:55:c0:a8:4c:02)
128      as broadcast message.
129    Executing 'simple network protocol' succeeded
130    Tearing down 'simple network protocol'
131    Tearing down 'simple network protocol' succeeded
132    Boot services terminated
133    Summary: 0 failures
134    Preparing for reset. Press any key.
135
136## The UEFI life cycle
137
138After the U-Boot platform has been initialized the UEFI API provides two kinds
139of services
140
141* boot services and
142* runtime services.
143
144The API can be extended by loading UEFI drivers which come in two variants
145
146* boot drivers and
147* runtime drivers.
148
149UEFI drivers are installed with U-Boot's bootefi command. With the same command
150UEFI applications can be executed.
151
152Loaded images of UEFI drivers stay in memory after returning to U-Boot while
153loaded images of applications are removed from memory.
154
155An UEFI application (e.g. an operating system) that wants to take full control
156of the system calls ExitBootServices. After a UEFI application calls
157ExitBootServices
158
159* boot services are not available anymore
160* timer events are stopped
161* the memory used by U-Boot except for runtime services is released
162* the memory used by boot time drivers is released
163
164So this is a point of no return. Afterwards the UEFI application can only return
165to U-Boot by rebooting.
166
167## The UEFI object model
168
169UEFI offers a flexible and expandable object model. The objects in the UEFI API
170are devices, drivers, and loaded images. These objects are referenced by
171handles.
172
173The interfaces implemented by the objects are referred to as protocols. These
174are identified by GUIDs. They can be installed and uninstalled by calling the
175appropriate boot services.
176
177Handles are created by the InstallProtocolInterface or the
178InstallMultipleProtocolinterfaces service if NULL is passed as handle.
179
180Handles are deleted when the last protocol has been removed with the
181UninstallProtocolInterface or the UninstallMultipleProtocolInterfaces service.
182
183Devices offer the EFI_DEVICE_PATH_PROTOCOL. A device path is the concatenation
184of device nodes. By their device paths all devices of a system are arranged in a
185tree.
186
187Drivers offer the EFI_DRIVER_BINDING_PROTOCOL. This protocol is used to connect
188a driver to devices (which are referenced as controllers in this context).
189
190Loaded images offer the EFI_LOADED_IMAGE_PROTOCOL. This protocol provides meta
191information about the image and a pointer to the unload callback function.
192
193## The UEFI events
194
195In the UEFI terminology an event is a data object referencing a notification
196function which is queued for calling when the event is signaled. The following
197types of events exist:
198
199* periodic and single shot timer events
200* exit boot services events, triggered by calling the ExitBootServices() service
201* virtual address change events
202* memory map change events
203* read to boot events
204* reset system events
205* system table events
206* events that are only triggered programmatically
207
208Events can be created with the CreateEvent service and deleted with CloseEvent
209service.
210
211Events can be assigned to an event group. If any of the events in a group is
212signaled, all other events in the group are also set to the signaled state.
213
214## The UEFI driver model
215
216A driver is specific for a single protocol installed on a device. To install a
217driver on a device the ConnectController service is called. In this context
218controller refers to the device for which the driver is installed.
219
220The relevant drivers are identified using the EFI_DRIVER_BINDING_PROTOCOL. This
221protocol has has three functions:
222
223* supported - determines if the driver is compatible with the device
224* start - installs the driver by opening the relevant protocol with
225  attribute EFI_OPEN_PROTOCOL_BY_DRIVER
226* stop - uninstalls the driver
227
228The driver may create child controllers (child devices). E.g. a driver for block
229IO devices will create the device handles for the partitions. The child
230controllers  will open the supported protocol with the attribute
231EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
232
233A driver can be detached from a device using the DisconnectController service.
234
235## U-Boot devices mapped as UEFI devices
236
237Some of the U-Boot devices are mapped as UEFI devices
238
239* block IO devices
240* console
241* graphical output
242* network adapter
243
244As of U-Boot 2018.03 the logic for doing this is hard coded.
245
246The development target is to integrate the setup of these UEFI devices with the
247U-Boot driver model. So when a U-Boot device is discovered a handle should be
248created and the device path protocol and the relevant IO protocol should be
249installed. The UEFI driver then would be attached by calling ConnectController.
250When a U-Boot device is removed DisconnectController should be called.
251
252## UEFI devices mapped as U-Boot devices
253
254UEFI drivers binaries and applications may create new (virtual) devices, install
255a protocol and call the ConnectController service. Now the matching UEFI driver
256is determined by iterating over the implementations of the
257EFI_DRIVER_BINDING_PROTOCOL.
258
259It is the task of the UEFI driver to create a corresponding U-Boot device and to
260proxy calls for this U-Boot device to the controller.
261
262In U-Boot 2018.03 this has only been implemented for block IO devices.
263
264### UEFI uclass
265
266An UEFI uclass driver (lib/efi_driver/efi_uclass.c) has been created that
267takes care of initializing the UEFI drivers and providing the
268EFI_DRIVER_BINDING_PROTOCOL implementation for the UEFI drivers.
269
270A linker created list is used to keep track of the UEFI drivers. To create an
271entry in the list the UEFI driver uses the U_BOOT_DRIVER macro specifying
272UCLASS_EFI as the ID of its uclass, e.g.
273
274    /* Identify as UEFI driver */
275    U_BOOT_DRIVER(efi_block) = {
276    	.name  = "EFI block driver",
277    	.id    = UCLASS_EFI,
278    	.ops   = &driver_ops,
279    };
280
281The available operations are defined via the structure struct efi_driver_ops.
282
283    struct efi_driver_ops {
284        const efi_guid_t *protocol;
285        const efi_guid_t *child_protocol;
286        int (*bind)(efi_handle_t handle, void *interface);
287    };
288
289When the supported() function of the EFI_DRIVER_BINDING_PROTOCOL is called the
290uclass checks if the protocol GUID matches the protocol GUID of the UEFI driver.
291In the start() function the bind() function of the UEFI driver is called after
292checking the GUID.
293The stop() function of the EFI_DRIVER_BINDING_PROTOCOL disconnects the child
294controllers created by the UEFI driver and the UEFI driver. (In U-Boot v2013.03
295this is not yet completely implemented.)
296
297### UEFI block IO driver
298
299The UEFI block IO driver supports devices exposing the EFI_BLOCK_IO_PROTOCOL.
300
301When connected it creates a new U-Boot block IO device with interface type
302IF_TYPE_EFI, adds child controllers mapping the partitions, and installs the
303EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on these. This can be used together with the
304software iPXE to boot from iSCSI network drives [3].
305
306This driver is only available if U-Boot is configured with
307
308    CONFIG_BLK=y
309    CONFIG_PARTITIONS=y
310
311## TODOs as of U-Boot 2019.04
312
313* unimplemented or incompletely implemented boot services
314  * Exit - call unload function, unload applications only
315  * ProtocolRegisterNotify
316  * UnloadImage
317
318* unimplemented or incompletely implemented runtime services
319  * SetVariable() ignores attribute EFI_VARIABLE_APPEND_WRITE
320  * QueryVariableInfo is not implemented
321
322* unimplemented events
323  * EVT_RUNTIME
324  * EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
325
326* data model
327  * manage configuration tables in a linked list
328
329* UEFI drivers
330  * support DisconnectController for UEFI block devices.
331
332* support for CONFIG_EFI_LOADER in the sandbox (CONFIG_SANDBOX=y)
333
334* UEFI variables
335  * persistence
336  * runtime support
337
338* incompletely implemented protocols
339  * support version 0x00020000 of the EFI file protocol
340
341## Links
342
343* [1](http://uefi.org/specifications)
344  http://uefi.org/specifications - UEFI specifications
345* [2](./driver-model/README.txt) doc/driver-model/README.txt - Driver model
346* [3](./README.iscsi) doc/README.iscsi - iSCSI booting with U-Boot and iPXE
347* [4](https://developer.arm.com/docs/den0044/latest/server-base-boot-requirements-system-software-on-arm-platforms-version-11)
348  Server Base Boot Requirements System Software on ARM Platforms - Version 1.1
349

README.unaligned-memory-access.txt

1Editors note: This document is _heavily_ cribbed from the Linux Kernel, with
2really only the section about "Alignment vs. Networking" removed.
3
4UNALIGNED MEMORY ACCESSES
5=========================
6
7Linux runs on a wide variety of architectures which have varying behaviour
8when it comes to memory access. This document presents some details about
9unaligned accesses, why you need to write code that doesn't cause them,
10and how to write such code!
11
12
13The definition of an unaligned access
14=====================================
15
16Unaligned memory accesses occur when you try to read N bytes of data starting
17from an address that is not evenly divisible by N (i.e. addr % N != 0).
18For example, reading 4 bytes of data from address 0x10004 is fine, but
19reading 4 bytes of data from address 0x10005 would be an unaligned memory
20access.
21
22The above may seem a little vague, as memory access can happen in different
23ways. The context here is at the machine code level: certain instructions read
24or write a number of bytes to or from memory (e.g. movb, movw, movl in x86
25assembly). As will become clear, it is relatively easy to spot C statements
26which will compile to multiple-byte memory access instructions, namely when
27dealing with types such as u16, u32 and u64.
28
29
30Natural alignment
31=================
32
33The rule mentioned above forms what we refer to as natural alignment:
34When accessing N bytes of memory, the base memory address must be evenly
35divisible by N, i.e. addr % N == 0.
36
37When writing code, assume the target architecture has natural alignment
38requirements.
39
40In reality, only a few architectures require natural alignment on all sizes
41of memory access. However, we must consider ALL supported architectures;
42writing code that satisfies natural alignment requirements is the easiest way
43to achieve full portability.
44
45
46Why unaligned access is bad
47===========================
48
49The effects of performing an unaligned memory access vary from architecture
50to architecture. It would be easy to write a whole document on the differences
51here; a summary of the common scenarios is presented below:
52
53 - Some architectures are able to perform unaligned memory accesses
54   transparently, but there is usually a significant performance cost.
55 - Some architectures raise processor exceptions when unaligned accesses
56   happen. The exception handler is able to correct the unaligned access,
57   at significant cost to performance.
58 - Some architectures raise processor exceptions when unaligned accesses
59   happen, but the exceptions do not contain enough information for the
60   unaligned access to be corrected.
61 - Some architectures are not capable of unaligned memory access, but will
62   silently perform a different memory access to the one that was requested,
63   resulting in a subtle code bug that is hard to detect!
64
65It should be obvious from the above that if your code causes unaligned
66memory accesses to happen, your code will not work correctly on certain
67platforms and will cause performance problems on others.
68
69
70Code that does not cause unaligned access
71=========================================
72
73At first, the concepts above may seem a little hard to relate to actual
74coding practice. After all, you don't have a great deal of control over
75memory addresses of certain variables, etc.
76
77Fortunately things are not too complex, as in most cases, the compiler
78ensures that things will work for you. For example, take the following
79structure:
80
81	struct foo {
82		u16 field1;
83		u32 field2;
84		u8 field3;
85	};
86
87Let us assume that an instance of the above structure resides in memory
88starting at address 0x10000. With a basic level of understanding, it would
89not be unreasonable to expect that accessing field2 would cause an unaligned
90access. You'd be expecting field2 to be located at offset 2 bytes into the
91structure, i.e. address 0x10002, but that address is not evenly divisible
92by 4 (remember, we're reading a 4 byte value here).
93
94Fortunately, the compiler understands the alignment constraints, so in the
95above case it would insert 2 bytes of padding in between field1 and field2.
96Therefore, for standard structure types you can always rely on the compiler
97to pad structures so that accesses to fields are suitably aligned (assuming
98you do not cast the field to a type of different length).
99
100Similarly, you can also rely on the compiler to align variables and function
101parameters to a naturally aligned scheme, based on the size of the type of
102the variable.
103
104At this point, it should be clear that accessing a single byte (u8 or char)
105will never cause an unaligned access, because all memory addresses are evenly
106divisible by one.
107
108On a related topic, with the above considerations in mind you may observe
109that you could reorder the fields in the structure in order to place fields
110where padding would otherwise be inserted, and hence reduce the overall
111resident memory size of structure instances. The optimal layout of the
112above example is:
113
114	struct foo {
115		u32 field2;
116		u16 field1;
117		u8 field3;
118	};
119
120For a natural alignment scheme, the compiler would only have to add a single
121byte of padding at the end of the structure. This padding is added in order
122to satisfy alignment constraints for arrays of these structures.
123
124Another point worth mentioning is the use of __attribute__((packed)) on a
125structure type. This GCC-specific attribute tells the compiler never to
126insert any padding within structures, useful when you want to use a C struct
127to represent some data that comes in a fixed arrangement 'off the wire'.
128
129You might be inclined to believe that usage of this attribute can easily
130lead to unaligned accesses when accessing fields that do not satisfy
131architectural alignment requirements. However, again, the compiler is aware
132of the alignment constraints and will generate extra instructions to perform
133the memory access in a way that does not cause unaligned access. Of course,
134the extra instructions obviously cause a loss in performance compared to the
135non-packed case, so the packed attribute should only be used when avoiding
136structure padding is of importance.
137
138
139Code that causes unaligned access
140=================================
141
142With the above in mind, let's move onto a real life example of a function
143that can cause an unaligned memory access. The following function taken
144from the Linux Kernel's include/linux/etherdevice.h is an optimized routine
145to compare two ethernet MAC addresses for equality.
146
147bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
148{
149#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
150	u32 fold = ((*(const u32 *)addr1) ^ (*(const u32 *)addr2)) |
151		   ((*(const u16 *)(addr1 + 4)) ^ (*(const u16 *)(addr2 + 4)));
152
153	return fold == 0;
154#else
155	const u16 *a = (const u16 *)addr1;
156	const u16 *b = (const u16 *)addr2;
157	return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0;
158#endif
159}
160
161In the above function, when the hardware has efficient unaligned access
162capability, there is no issue with this code.  But when the hardware isn't
163able to access memory on arbitrary boundaries, the reference to a[0] causes
1642 bytes (16 bits) to be read from memory starting at address addr1.
165
166Think about what would happen if addr1 was an odd address such as 0x10003.
167(Hint: it'd be an unaligned access.)
168
169Despite the potential unaligned access problems with the above function, it
170is included in the kernel anyway but is understood to only work normally on
17116-bit-aligned addresses. It is up to the caller to ensure this alignment or
172not use this function at all. This alignment-unsafe function is still useful
173as it is a decent optimization for the cases when you can ensure alignment,
174which is true almost all of the time in ethernet networking context.
175
176
177Here is another example of some code that could cause unaligned accesses:
178	void myfunc(u8 *data, u32 value)
179	{
180		[...]
181		*((u32 *) data) = cpu_to_le32(value);
182		[...]
183	}
184
185This code will cause unaligned accesses every time the data parameter points
186to an address that is not evenly divisible by 4.
187
188In summary, the 2 main scenarios where you may run into unaligned access
189problems involve:
190 1. Casting variables to types of different lengths
191 2. Pointer arithmetic followed by access to at least 2 bytes of data
192
193
194Avoiding unaligned accesses
195===========================
196
197The easiest way to avoid unaligned access is to use the get_unaligned() and
198put_unaligned() macros provided by the <asm/unaligned.h> header file.
199
200Going back to an earlier example of code that potentially causes unaligned
201access:
202
203	void myfunc(u8 *data, u32 value)
204	{
205		[...]
206		*((u32 *) data) = cpu_to_le32(value);
207		[...]
208	}
209
210To avoid the unaligned memory access, you would rewrite it as follows:
211
212	void myfunc(u8 *data, u32 value)
213	{
214		[...]
215		value = cpu_to_le32(value);
216		put_unaligned(value, (u32 *) data);
217		[...]
218	}
219
220The get_unaligned() macro works similarly. Assuming 'data' is a pointer to
221memory and you wish to avoid unaligned access, its usage is as follows:
222
223	u32 value = get_unaligned((u32 *) data);
224
225These macros work for memory accesses of any length (not just 32 bits as
226in the examples above). Be aware that when compared to standard access of
227aligned memory, using these macros to access unaligned memory can be costly in
228terms of performance.
229
230If use of such macros is not convenient, another option is to use memcpy(),
231where the source or destination (or both) are of type u8* or unsigned char*.
232Due to the byte-wise nature of this operation, unaligned accesses are avoided.
233
234--
235In the Linux Kernel,
236Authors: Daniel Drake <dsd@gentoo.org>,
237         Johannes Berg <johannes@sipsolutions.net>
238With help from: Alan Cox, Avuton Olrich, Heikki Orsila, Jan Engelhardt,
239Kyle McMartin, Kyle Moffett, Randy Dunlap, Robert Hancock, Uli Kunitz,
240Vadim Lobanov
241

README.uniphier

1U-Boot for UniPhier SoC family
2==============================
3
4
5Recommended toolchains
6----------------------
7
8The UniPhier platform is well tested with Linaro toolchains.
9You can download pre-built toolchains from:
10
11    http://www.linaro.org/downloads/
12
13
14Compile the source
15------------------
16
17The source can be configured and built with the following commands:
18
19    $ make <defconfig>
20    $ make CROSS_COMPILE=<toolchain-prefix> DEVICE_TREE=<device-tree>
21
22The recommended <toolchain-prefix> is `arm-linux-gnueabihf-` for 32bit SoCs,
23`aarch64-linux-gnu-` for 64bit SoCs, but you may wish to change it to use your
24favorite compiler.
25
26The following tables show <defconfig> and <device-tree> for each board.
27
2832bit SoC boards:
29
30 Board         | <defconfig>                 | <device-tree>
31---------------|-----------------------------|------------------------------
32LD4 reference  | uniphier_ld4_sld8_defconfig | uniphier-ld4-ref (default)
33sld8 reference | uniphier_ld4_sld8_defconfig | uniphier-sld8-def
34Pro4 reference | uniphier_v7_defconfig       | uniphier-pro4-ref
35Pro4 Ace       | uniphier_v7_defconfig       | uniphier-pro4-ace
36Pro4 Sanji     | uniphier_v7_defconfig       | uniphier-pro4-sanji
37Pro5 4KBOX     | uniphier_v7_defconfig       | uniphier-pro5-4kbox
38PXs2 Gentil    | uniphier_v7_defconfig       | uniphier-pxs2-gentil
39PXs2 Vodka     | uniphier_v7_defconfig       | uniphier-pxs2-vodka (default)
40LD6b reference | uniphier_v7_defconfig       | uniphier-ld6b-ref
41
4264bit SoC boards:
43
44 Board         | <defconfig>           | <device-tree>
45---------------|-----------------------|----------------------------
46LD11 reference | uniphier_v8_defconfig | uniphier-ld11-ref
47LD11 Global    | uniphier_v8_defconfig | uniphier-ld11-global
48LD20 reference | uniphier_v8_defconfig | uniphier-ld20-ref (default)
49LD20 Global    | uniphier_v8_defconfig | uniphier-ld20-global
50PXs3 reference | uniphier_v8_defconfig | uniphier-pxs3-ref
51
52For example, to compile the source for PXs2 Vodka board, run the following:
53
54    $ make uniphier_v7_defconfig
55    $ make CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=uniphier-pxs2-vodka
56
57The device tree marked as (default) can be omitted.  `uniphier-pxs2-vodka` is
58the default device tree for the configuration `uniphier_v7_defconfig`, so the
59following gives the same result.
60
61    $ make uniphier_v7_defconfig
62    $ make CROSS_COMPILE=arm-linux-gnueabihf-
63
64
65Booting 32bit SoC boards
66------------------------
67
68The build command will generate the following:
69- u-boot.bin
70- spl/u-boot.bin
71
72U-Boot can boot UniPhier 32bit SoC boards by itself.  Flash the generated images
73to the storage device (NAND or eMMC) on your board.
74
75 - spl/u-boot-spl.bin at the offset address 0x00000000
76 - u-boot.bin         at the offset address 0x00020000
77
78The `u-boot-with-spl.bin` is the concatenation of the two (with appropriate
79padding), so you can also do:
80
81 - u-boot-with-spl.bin at the offset address 0x00000000
82
83If a TFTP server is available, the images can be easily updated.
84Just copy the u-boot-spl.bin and u-boot.bin to the TFTP public directory,
85and run the following command at the U-Boot command line:
86
87To update the images in NAND:
88
89    => run nandupdate
90
91To update the images in eMMC:
92
93    => run emmcupdate
94
95
96Booting 64bit SoC boards
97------------------------
98
99The build command will generate the following:
100- u-boot.bin
101
102However, U-Boot is not the first stage loader for UniPhier 64bit SoC boards.
103U-Boot serves as a non-secure boot loader loaded by [ARM Trusted Firmware],
104so you need to provide the `u-boot.bin` to the build command of ARM Trusted
105Firmware.
106
107[ARM Trusted Firmware]: https://github.com/ARM-software/arm-trusted-firmware
108
109
110Verified Boot
111-------------
112
113U-Boot supports an image verification method called "Verified Boot".
114This is a brief tutorial to utilize this feature for the UniPhier platform.
115You will find details documents in the doc/uImage.FIT directory.
116
117Here, we take LD20 reference board for example, but it should work for any
118other boards including 32 bit SoCs.
119
1201. Generate key to sign with
121
122  $ mkdir keys
123  $ openssl genpkey -algorithm RSA -out keys/dev.key \
124    -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537
125  $ openssl req -batch -new -x509 -key keys/dev.key -out keys/dev.crt
126
127Two files "dev.key" and "dev.crt" will be created.  The base name is arbitrary,
128but need to match to the "key-name-hint" property described below.
129
1302. Describe FIT source
131
132You need to write an FIT (Flattened Image Tree) source file to describe the
133structure of the image container.
134
135The following is an example for a simple usecase:
136
137---------------------------------------->8----------------------------------------
138/dts-v1/;
139
140/ {
141	description = "Kernel, DTB and Ramdisk for UniPhier LD20 Reference Board";
142	#address-cells = <1>;
143
144	images {
145		kernel {
146			description = "linux";
147			data = /incbin/("PATH/TO/YOUR/LINUX/DIR/arch/arm64/boot/Image.gz");
148			type = "kernel";
149			arch = "arm64";
150			os = "linux";
151			compression = "gzip";
152			load = <0x82080000>;
153			entry = <0x82080000>;
154			hash-1 {
155				algo = "sha256";
156			};
157		};
158
159		fdt-1 {
160			description = "fdt";
161			data = /incbin/("PATH/TO/YOUR/LINUX/DIR/arch/arm64/boot/dts/socionext/uniphier-ld20-ref.dtb");
162			type = "flat_dt";
163			arch = "arm64";
164			compression = "none";
165			hash-1 {
166				algo = "sha256";
167			};
168		};
169
170		ramdisk {
171			description = "ramdisk";
172			data = /incbin/("PATH/TO/YOUR/ROOTFS/DIR/rootfs.cpio");
173			type = "ramdisk";
174			arch = "arm64";
175			os = "linux";
176			compression = "none";
177			hash-1 {
178				algo = "sha256";
179			};
180		};
181	};
182
183	configurations {
184		default = "config-1";
185
186		config-1 {
187			description = "Configuration0";
188			kernel = "kernel";
189			fdt = "fdt-1";
190			ramdisk = "ramdisk";
191			signature-1 {
192				algo = "sha256,rsa2048";
193				key-name-hint = "dev";
194				sign-images = "kernel", "fdt", "ramdisk";
195			};
196		};
197	};
198};
199---------------------------------------->8----------------------------------------
200
201You need to change the three '/incbin/' lines, depending on the location of
202your kernel image, device tree blob, and init ramdisk.  The "load" and "entry"
203properties also need to be adjusted if you want to change the physical placement
204of the kernel.
205
206The "key-name-hint" must specify the key name you have created in the step 1.
207
208The FIT file name is arbitrary.  Let's say you saved it into "fit.its".
209
2103. Compile U-Boot with FIT and signature enabled
211
212To use the Verified Boot, you need to enable the following two options:
213  CONFIG_FIT
214  CONFIG_FIT_SIGNATURE
215
216They are disabled by default for UniPhier defconfig files.  So, you need to
217tweak the configuration from "make menuconfig" or friends.
218
219  $ make uniphier_v8_defconfig
220  $ make menuconfig
221      [ enable CONFIG_FIT and CONFIG_FIT_SIGNATURE ]
222  $ make CROSS_COMPILE=aarch64-linux-gnu-
223
2244. Build the image tree blob
225
226After building U-Boot, you will see tools/mkimage.  With this tool, you can
227create an image tree blob as follows:
228
229  $ tools/mkimage -f fit.its -k keys -K dts/dt.dtb -r -F fitImage
230
231The -k option must specify the key directory you have created in step 1.
232
233A file "fitImage" will be created.  This includes kernel, DTB, Init-ramdisk,
234hash data for each of the three, and signature data.
235
236The public key needed for the run-time verification is stored in "dts/dt.dtb".
237
2385. Compile U-Boot again
239
240Since the "dt.dtb" has been updated in step 4, you need to re-compile the
241U-Boot.
242
243  $ make CROSS_COMPILE=aarch64-linux-gnu-
244
245The re-compiled "u-boot.bin" is appended with DTB that contains the public key.
246
2476. Flash the image
248
249Flash the "fitImage" to a storage device (NAND, eMMC, or whatever) on your
250board.
251
252Please note the "u-boot.bin" must be signed, and verified by someone when it is
253loaded.  For ARMv8 SoCs, the "someone" is generally ARM Trusted Firmware BL2.
254ARM Trusted Firmware supports an image authentication mechanism called Trusted
255Board Boot (TBB).  The verification process must be chained from the moment of
256the system reset.  If the Chain of Trust has a breakage somewhere, the verified
257boot process is entirely pointless.
258
2597. Boot verified kernel
260
261Load the fitImage to memory and run the following from the U-Boot command line.
262
263  > bootm <addr>
264
265Here, <addr> is the base address of the fitImage.
266
267If it is successful, you will see messages like follows:
268
269---------------------------------------->8----------------------------------------
270## Loading kernel from FIT Image at 84100000 ...
271   Using 'config-1' configuration
272   Verifying Hash Integrity ... sha256,rsa2048:dev+ OK
273   Trying 'kernel' kernel subimage
274     Description:  linux
275     Created:      2017-10-20  14:32:29 UTC
276     Type:         Kernel Image
277     Compression:  gzip compressed
278     Data Start:   0x841000c8
279     Data Size:    6957818 Bytes = 6.6 MiB
280     Architecture: AArch64
281     OS:           Linux
282     Load Address: 0x82080000
283     Entry Point:  0x82080000
284     Hash algo:    sha256
285     Hash value:   82a37b7f11ae55f4e07aa25bf77e4067cb9dc1014d52d6cd4d588f92eee3aaad
286   Verifying Hash Integrity ... sha256+ OK
287## Loading ramdisk from FIT Image at 84100000 ...
288   Using 'config-1' configuration
289   Trying 'ramdisk' ramdisk subimage
290     Description:  ramdisk
291     Created:      2017-10-20  14:32:29 UTC
292     Type:         RAMDisk Image
293     Compression:  uncompressed
294     Data Start:   0x847a5cc0
295     Data Size:    5264365 Bytes = 5 MiB
296     Architecture: AArch64
297     OS:           Linux
298     Load Address: unavailable
299     Entry Point:  unavailable
300     Hash algo:    sha256
301     Hash value:   44980a2874154a2e31ed59222c9f8ea968867637f35c81e4107a984de7014deb
302   Verifying Hash Integrity ... sha256+ OK
303## Loading fdt from FIT Image at 84100000 ...
304   Using 'config-1' configuration
305   Trying 'fdt-1' fdt subimage
306     Description:  fdt
307     Created:      2017-10-20  14:32:29 UTC
308     Type:         Flat Device Tree
309     Compression:  uncompressed
310     Data Start:   0x847a2cb0
311     Data Size:    12111 Bytes = 11.8 KiB
312     Architecture: AArch64
313     Hash algo:    sha256
314     Hash value:   c517099db537f6d325e6be46b25c871a41331ad5af0283883fd29d40bfc14e1d
315   Verifying Hash Integrity ... sha256+ OK
316   Booting using the fdt blob at 0x847a2cb0
317   Uncompressing Kernel Image ... OK
318   reserving fdt memory region: addr=80000000 size=2000000
319   Loading Device Tree to 000000009fffa000, end 000000009fffff4e ... OK
320
321Starting kernel ...
322---------------------------------------->8----------------------------------------
323
324Please pay attention to the lines that start with "Verifying Hash Integrity".
325
326"Verifying Hash Integrity ... sha256,rsa2048:dev+ OK" means the signature check
327passed.
328
329"Verifying Hash Integrity ... sha256+ OK" (3 times) means the hash check passed
330for kernel, DTB, and Init ramdisk.
331
332If they are not displayed, the Verified Boot is not working.
333
334
335Deployment for Distro Boot
336--------------------------
337
338UniPhier SoC family boot the kernel in a generic manner as described in
339doc/README.distro .
340
341To boot the kernel, you need to deploy necesssary components to a file
342system on one of your block devices (eMMC, NAND, USB drive, etc.).
343
344The components depend on the kernel image format.
345
346[1] Bare images
347
348  - kernel
349  - init ramdisk
350  - device tree blob
351  - boot configuration file (extlinux.conf)
352
353Here is an exmple of the configuration file.
354
355-------------------->8--------------------
356menu title UniPhier Boot Options.
357
358timeout 50
359default UniPhier
360
361label UniPhier
362      kernel ../Image
363      initrd ../rootfs.cpio.gz
364      fdtdir ..
365-------------------->8--------------------
366
367Then, write 'Image', 'rootfs.cpio.gz', 'uniphier-ld20-ref.dtb' (DTB depends on
368your board), and 'extlinux/extlinux.conf' to the file system.
369
370[2] FIT
371
372  - FIT blob
373  - boot configuration file (extlinux.conf)
374
375-------------------->8--------------------
376menu title UniPhier Boot Options.
377
378timeout 50
379default UniPhier
380
381label UniPhier
382      kernel ../fitImage
383-------------------->8--------------------
384
385Since the init ramdisk and DTB are contained in the FIT blob,
386you do not need to describe them in the configuration file.
387Write 'fitImage' and 'extlinux/extlinux.conf' to the file system.
388
389
390UniPhier specific commands
391--------------------------
392
393 - pinmon (enabled by CONFIG_CMD_PINMON)
394     shows the boot mode pins that has been latched at the power-on reset
395
396 - ddrphy (enabled by CONFIG_CMD_DDRPHY_DUMP)
397     shows the DDR PHY parameters set by the PHY training
398
399 - ddrmphy (enabled by CONFIG_CMD_DDRMPHY_DUMP)
400     shows the DDR Multi PHY parameters set by the PHY training
401
402
403Supported devices
404-----------------
405
406 - UART (on-chip)
407 - NAND
408 - SD/eMMC
409 - USB 2.0 (EHCI)
410 - USB 3.0 (xHCI)
411 - GPIO
412 - LAN (on-board SMSC9118)
413 - I2C
414 - EEPROM (connected to the on-board I2C bus)
415 - Support card (SRAM, NOR flash, some peripherals)
416
417
418Micro Support Card
419------------------
420
421The recommended bit switch settings are as follows:
422
423 SW2    OFF(1)/ON(0)   Description
424 ------------------------------------------
425 bit 1   <----         BKSZ[0]
426 bit 2   ---->         BKSZ[1]
427 bit 3   <----         SoC Bus Width 16/32
428 bit 4   <----         SERIAL_SEL[0]
429 bit 5   ---->         SERIAL_SEL[1]
430 bit 6   ---->         BOOTSWAP_EN
431 bit 7   <----         CS1/CS5
432 bit 8   <----         SOC_SERIAL_DISABLE
433
434 SW8    OFF(1)/ON(0)   Description
435 ------------------------------------------
436 bit 1    <----        CS1_SPLIT
437 bit 2    <----        CASE9_ON
438 bit 3    <----        CASE10_ON
439 bit 4  Don't Care     Reserve
440 bit 5  Don't Care     Reserve
441 bit 6  Don't Care     Reserve
442 bit 7    ---->        BURST_EN
443 bit 8    ---->        FLASHBUS32_16
444
445The BKSZ[1:0] specifies the address range of memory slot and peripherals
446as follows:
447
448 BKSZ    Description              RAM slot            Peripherals
449 --------------------------------------------------------------------
450 0b00   15MB RAM / 1MB Peri    00000000-00efffff    00f00000-00ffffff
451 0b01   31MB RAM / 1MB Peri    00000000-01efffff    01f00000-01ffffff
452 0b10   64MB RAM / 1MB Peri    00000000-03efffff    03f00000-03ffffff
453 0b11  127MB RAM / 1MB Peri    00000000-07efffff    07f00000-07ffffff
454
455Set BSKZ[1:0] to 0b01 for U-Boot.
456This mode is the most handy because EA[24] is always supported by the save pin
457mode of the system bus.  On the other hand, EA[25] is not supported for some
458newer SoCs.  Even if it is, EA[25] is not connected on most of the boards.
459
460--
461Masahiro Yamada <yamada.masahiro@socionext.com>
462Oct. 2017
463

README.update

1Automatic software update from a TFTP server
2============================================
3
4Overview
5--------
6
7This feature allows to automatically store software updates present on a TFTP
8server in NOR Flash. In more detail: a TFTP transfer of a file given in
9environment variable 'updatefile' from server 'serverip' is attempted during
10boot. The update file should be a FIT file, and can contain one or more
11updates. Each update in the update file has an address in NOR Flash where it
12should be placed, updates are also protected with a SHA-1 checksum. If the
13TFTP transfer is successful, the hash of each update is verified, and if the
14verification is positive, the update is stored in Flash.
15
16The auto-update feature is enabled by the CONFIG_UPDATE_TFTP macro:
17
18#define CONFIG_UPDATE_TFTP		1
19
20
21Note that when enabling auto-update, Flash support must be turned on.  Also,
22one must enable FIT and LIBFDT support:
23
24#define CONFIG_FIT		1
25#define CONFIG_OF_LIBFDT	1
26
27The auto-update feature uses the following configuration knobs:
28
29- CONFIG_UPDATE_LOAD_ADDR
30
31  Normally, TFTP transfer of the update file is done to the address specified
32  in environment variable 'loadaddr'. If this variable is not present, the
33  transfer is made to the address given in CONFIG_UPDATE_LOAD_ADDR (0x100000
34  by default).
35
36- CONFIG_UPDATE_TFTP_CNT_MAX
37  CONFIG_UPDATE_TFTP_MSEC_MAX
38
39  These knobs control the timeouts during initial connection to the TFTP
40  server. Since a transfer is attempted during each boot, it is undesirable to
41  have a long delay when a TFTP server is not present.
42  CONFIG_UPDATE_TFTP_MSEC_MAX specifies the number of milliseconds to wait for
43  the server to respond to initial connection, and CONFIG_UPDATE_TFTP_CNT_MAX
44  gives the number of such connection retries. CONFIG_UPDATE_TFTP_CNT_MAX must
45  be non-negative and is 0 by default, CONFIG_UPDATE_TFTP_MSEC_MAX must be
46  positive and is 100 by default.
47
48Since the update file is in FIT format, it is created from an *.its file using
49the mkimage tool. dtc tool with support for binary includes, e.g. in version
501.2.0 or later, must also be available on the system where the update file is
51to be prepared. Refer to the doc/uImage.FIT/ directory for more details on FIT
52images.
53
54This mechanism can be also triggered by the command "fitupd".
55If an optional, non-zero address is provided as argument, the TFTP transfer
56is skipped and the image at this address is used.
57The fitupd command is enabled by CONFIG_CMD_FITUPD.
58
59
60Example .its files
61------------------
62
63- doc/uImage.FIT/update_uboot.its
64
65  A simple example that can be used to create an update file for automatically
66  replacing U-Boot image on a system.
67
68  Assuming that an U-Boot image u-boot.bin is present in the current working
69  directory, and that the address given in the 'load' property in the
70  'update_uboot.its' file is where the U-Boot is stored in Flash, the
71  following command will create the actual update file 'update_uboot.itb':
72
73  mkimage -f update_uboot.its update_uboot.itb
74
75  Place 'update_uboot.itb' on a TFTP server, for example as
76  '/tftpboot/update_uboot.itb', and set the 'updatefile' variable
77  appropriately, for example in the U-Boot prompt:
78
79  setenv updatefile /tftpboot/update_uboot.itb
80  saveenv
81
82  Now, when the system boots up and the update TFTP server specified in the
83  'serverip' environment variable is accessible, the new U-Boot image will be
84  automatically stored in Flash.
85
86  NOTE: do make sure that the 'u-boot.bin' image used to create the update
87  file is a good, working image. Also make sure that the address in Flash
88  where the update will be placed is correct. Making mistake here and
89  attempting the auto-update can render the system unusable.
90
91- doc/uImage.FIT/update3.its
92
93  An example containing three updates. It can be used to update Linux kernel,
94  ramdisk and FDT blob stored in Flash. The procedure for preparing the update
95  file is similar to the example above.
96
97TFTP update via DFU
98-------------------
99
100- It is now possible to update firmware (bootloader, kernel, rootfs, etc.) via
101  TFTP by using DFU (Device Firmware Upgrade). More information can be found in
102  ./doc/README.dfutftp documentation entry.
103

README.usb

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2001
4 * Denis Peter, MPL AG Switzerland
5 */
6
7USB Support
8===========
9
10The USB support is implemented on the base of the UHCI Host
11controller.
12
13Currently supported are USB Hubs, USB Keyboards, USB Floppys, USB
14flash sticks and USB network adaptors.
15Tested with a TEAC Floppy TEAC FD-05PUB and Chicony KU-8933 Keyboard.
16
17How it works:
18-------------
19
20The USB (at least the USB UHCI) needs a frame list (4k), transfer
21descripor and queue headers which are all located in the main memory.
22The UHCI allocates every milisecond the PCI bus and reads the current
23frame pointer. This may cause to crash the OS during boot. So the USB
24_MUST_ be stopped during OS boot. This is the reason, why the USB is
25NOT automatically started during start-up. If someone needs the USB
26he has to start it and should therefore be aware that he had to stop
27it before booting the OS.
28
29For USB keyboards this can be done by a script which is automatically
30started after the U-Boot is up and running. To boot an OS with a an
31USB keyboard another script is necessary, which first disables the
32USB and then executes the boot command. If the boot command fails,
33the script can reenable the USB kbd.
34
35Common USB Commands:
36- usb start:
37- usb reset:	    (re)starts the USB. All USB devices will be
38		    initialized and a device tree is build for them.
39- usb tree:	    shows all USB devices in a tree like display
40- usb info [dev]:   shows all USB infos of the device dev, or of all
41		    the devices
42- usb stop [f]:	    stops the USB. If f==1 the USB will also stop if
43		    an USB keyboard is assigned as stdin. The stdin
44		    is then switched to serial input.
45Storage USB Commands:
46- usb scan:	    scans the USB for storage devices.The USB must be
47		    running for this command (usb start)
48- usb device [dev]: show or set current USB storage device
49- usb part [dev]:   print partition table of one or all USB storage
50		    devices
51- usb read addr blk# cnt:
52		    read `cnt' blocks starting at block `blk#'to
53		    memory address `addr'
54- usbboot addr dev:part:
55		    boot from USB device
56
57Config Switches:
58----------------
59CONFIG_CMD_USB	    enables basic USB support and the usb command
60CONFIG_USB_UHCI	    defines the lowlevel part.A lowlevel part must be defined
61		    if using CONFIG_CMD_USB
62CONFIG_USB_KEYBOARD enables the USB Keyboard
63CONFIG_USB_STORAGE  enables the USB storage devices
64CONFIG_USB_HOST_ETHER	enables USB ethernet adapter support
65
66
67USB Host Networking
68===================
69
70If you have a supported USB Ethernet adapter you can use it in U-Boot
71to obtain an IP address and load a kernel from a network server.
72
73Note: USB Host Networking is not the same as making your board act as a USB
74client. In that case your board is pretending to be an Ethernet adapter
75and will appear as a network interface to an attached computer. In that
76case the connection is via a USB cable with the computer acting as the host.
77
78With USB Host Networking, your board is the USB host. It controls the
79Ethernet adapter to which it is directly connected and the connection to
80the outside world is your adapter's Ethernet cable. Your board becomes an
81independent network device, able to connect and perform network operations
82independently of your computer.
83
84
85Device support
86--------------
87
88Currently supported devices are listed in the drivers according to
89their vendor and product IDs. You can check your device by connecting it
90to a Linux machine and typing 'lsusb'. The drivers are in
91drivers/usb/eth.
92
93For example this lsusb output line shows a device with Vendor ID 0x0x95
94and product ID 0x7720:
95
96Bus 002 Device 010: ID 0b95:7720 ASIX Electronics Corp. AX88772
97
98If you look at drivers/usb/eth/asix.c you will see this line within the
99supported device list, so we know this adapter is supported.
100
101	{ 0x0b95, 0x7720 },	/* Trendnet TU2-ET100 V3.0R */
102
103If your adapter is not listed there is a still a chance that it will
104work. Try looking up the manufacturer of the chip inside your adapter.
105or take the adapter apart and look for chip markings. Then add a line
106for your vendor/product ID into the table of the appropriate driver,
107build U-Boot and see if it works. If not then there might be differences
108between the chip in your adapter and the driver. You could try to get a
109datasheet for your device and add support for it to U-Boot. This is not
110particularly difficult - you only need to provide support for four basic
111functions: init, halt, send and recv.
112
113
114Enabling USB Host Networking
115----------------------------
116
117The normal U-Boot commands are used with USB networking, but you must
118start USB first. For example:
119
120usb start
121setenv bootfile /tftpboot/uImage
122bootp
123
124
125To enable USB Host Ethernet in U-Boot, your platform must of course
126support USB with CONFIG_CMD_USB enabled and working. You will need to
127add some config settings to your board config:
128
129CONFIG_CMD_USB=y		/* the 'usb' interactive command */
130CONFIG_USB_HOST_ETHER=y		/* Enable USB Ethernet adapters */
131
132and one or more of the following for individual adapter hardware:
133
134CONFIG_USB_ETHER_ASIX=y
135CONFIG_USB_ETHER_ASIX88179=y
136CONFIG_USB_ETHER_LAN75XX=y
137CONFIG_USB_ETHER_LAN78XX=y
138CONFIG_USB_ETHER_MCS7830=y
139CONFIG_USB_ETHER_RTL8152=y
140CONFIG_USB_ETHER_SMSC95XX=y
141
142As with built-in networking, you will also want to enable some network
143commands, for example:
144
145CONFIG_CMD_NET=y
146CONFIG_CMD_PING=y
147CONFIG_CMD_DHCP=y
148
149and some bootp options, which tell your board to obtain its subnet,
150gateway IP, host name and boot path from the bootp/dhcp server. These
151settings should start you off:
152
153#define CONFIG_BOOTP_SUBNETMASK
154#define CONFIG_BOOTP_GATEWAY
155#define CONFIG_BOOTP_HOSTNAME
156#define CONFIG_BOOTP_BOOTPATH
157
158You can also set the default IP address of your board and the server
159as well as the default file to load when a 'bootp' command is issued.
160However note that encoding these individual network settings into a
161common exectuable is discouraged, as it leads to potential conflicts,
162and all the parameters can either get stored in the board's external
163environment, or get obtained from the bootp server if not set.
164
165#define CONFIG_IPADDR		10.0.0.2  (replace with your value)
166#define CONFIG_SERVERIP		10.0.0.1  (replace with your value)
167#define CONFIG_BOOTFILE		"uImage"
168
169
170The 'usb start' command should identify the adapter something like this:
171
172CrOS> usb start
173(Re)start USB...
174USB EHCI 1.00
175scanning bus for devices... 3 USB Device(s) found
176       scanning bus for storage devices... 0 Storage Device(s) found
177       scanning bus for ethernet devices... 1 Ethernet Device(s) found
178CrOS> print ethact
179ethact=asx0
180
181You can see that it found an ethernet device and we can print out the
182device name (asx0 in this case).
183
184Then 'bootp' or 'dhcp' should use it to obtain an IP address from DHCP,
185perhaps something like this:
186
187CrOS> bootp
188Waiting for Ethernet connection... done.
189BOOTP broadcast 1
190BOOTP broadcast 2
191DHCP client bound to address 172.22.73.81
192Using asx0 device
193TFTP from server 172.22.72.144; our IP address is 172.22.73.81
194Filename '/tftpboot/uImage-sjg-seaboard-261347'.
195Load address: 0x40c000
196Loading: #################################################################
197	 #################################################################
198	 #################################################################
199	 ################################################
200done
201Bytes transferred = 3557464 (364858 hex)
202CrOS>
203
204
205Another way of doing this is to issue a tftp command, which will cause the
206bootp to happen automatically.
207
208
209MAC Addresses
210-------------
211
212Most Ethernet dongles have a built-in MAC address which is unique in the
213world. This is important so that devices on the network can be
214distinguised from each other. MAC address conflicts are evil and
215generally result in strange and eratic behaviour.
216
217Some boards have USB Ethernet chips on-board, and these sometimes do not
218have an assigned MAC address. In this case it is up to you to assign
219one which is unique. You should obtain a valid MAC address from a range
220assigned to you before you ship the product.
221
222Built-in Ethernet adapters support setting the MAC address by means of
223an ethaddr environment variable for each interface (ethaddr, eth1addr,
224eth2addr). There is similar support on the USB network side, using the
225names usbethaddr, usbeth1addr, etc. They are kept separate since we
226don't want a USB device taking the MAC address of a built-in device or
227vice versa.
228
229So if your USB Ethernet chip doesn't have a MAC address available then
230you must set usbethaddr to a suitable MAC address. At the time of
231writing this functionality is only supported by the SMSC driver.
232

README.vf610

1U-Boot for Freescale Vybrid VF610
2
3This file contains information for the port of U-Boot to the Freescale Vybrid
4VF610 SoC.
5
61. CONVENTIONS FOR FUSE ASSIGNMENTS
7-----------------------------------
8
91.1 MAC Address: It is stored in fuse bank 4, with the 16 msbs in word 2 and the
10    32 lsbs in word 3.
11

README.video

1SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2000
4 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
5 */
6
7"video-mode" environment variable
8=================================
9
10The 'video-mode' environment variable can be used to enable and configure
11some video drivers.  The format matches the video= command-line option used
12for Linux:
13
14	video-mode=<driver>:<xres>x<yres>-<depth>@<freq><,option=string>
15
16	<driver>	The video driver name, ignored by U-Boot
17	<xres>		The X resolution (in pixels) to use.
18	<yres>		The Y resolution (in pixels) to use.
19	<depth>		The color depth (in bits) to use.
20	<freq>		The frequency (in Hz) to use.
21	<options>	A comma-separated list of device-specific options
22
23
24U-Boot MPC8xx video controller driver
25=====================================
26
27The driver has been tested with the following configurations:
28
29- MPC823FADS with AD7176 on a PAL TV (YCbYCr)	- arsenio@tin.it
30
31Example: video-mode=fslfb:1280x1024-32@60,monitor=dvi
32
33
34U-Boot sunxi video controller driver
35====================================
36
37U-Boot supports hdmi and lcd output on Allwinner sunxi SoCs, lcd output
38requires the CONFIG_VIDEO_LCD_MODE Kconfig value to be set.
39
40The sunxi U-Boot driver supports the following video-mode options:
41
42- monitor=[none|dvi|hdmi|lcd|vga|composite-*] - Select the video output to use
43 none:     Disable video output.
44 dvi/hdmi: Selects output over the hdmi connector with dvi resp. hdmi output
45           format, if edid is used the format is automatically selected.
46 lcd:      Selects video output to a LCD screen.
47 vga:      Selects video output over the VGA connector.
48 composite-pal/composite-ntsc/composite-pal-m/composite-pal-nc:
49           Selects composite video output, note the specified resolution is
50           ignored with composite video output.
51 Defaults to monitor=dvi.
52
53- hpd=[0|1] - Enable use of the hdmi HotPlug Detect feature
54 0: Disabled. Configure dvi/hdmi output even if no cable is detected
55 1: Enabled.  Fallback to the lcd / vga / none in that order (if available)
56 Defaults to hpd=1.
57
58- hpd_delay=<int> - How long to wait for the hdmi HPD signal in milliseconds
59 When the monitor and the board power up at the same time, it may take some
60 time for the monitor to assert the HPD signal. This configures how long to
61 wait for the HPD signal before assuming no cable is connected.
62 Defaults to hpd_delay=500.
63
64- edid=[0|1] - Enable use of DDC + EDID to get monitor info
65 0: Disabled.
66 1: Enabled. If valid EDID info was read from the monitor the EDID info will
67    overrides the xres, yres and refresh from the video-mode env. variable.
68 Defaults to edid=1.
69
70- overscan_x/overscan_y=<int> - Set x/y overscan value
71 This configures a black border on the left and right resp. top and bottom
72 to deal with overscanning displays. Defaults to overscan_x=32 and
73 overscan_y=20 for composite monitors, 0 for other monitors.
74
75For example to always use the hdmi connector, even if no cable is inserted,
76using edid info when available and otherwise initalizing it at 1024x768@60Hz,
77use: "setenv video-mode sunxi:1024x768-24@60,monitor=dvi,hpd=0,edid=1".
78
79
80TrueType fonts
81--------------
82
83U-Boot supports the use of antialiased TrueType fonts on some platforms. This
84has been tested in x86, ARMv7 and sandbox.
85
86To enable this, select CONFIG_CONSOLE_TRUETYPE. You can choose between several
87fonts, with CONSOLE_TRUETYPE_NIMBUS being the default.
88
89TrueType support requires floating point at present. On ARMv7 platforms you
90need to disable use of the private libgcc. You can do this by disabling
91CONFIG_USE_PRIVATE_LIBGCC. See chromebook_jerry for an example. Note that this
92increases U-Boot's size by about 70KB at present.
93
94On ARM you should also make sure your toolchain supports hardfp. This is
95normally given in the name of your toolchain, e.g. arm-linux-gnueabihf (hf
96means hardware floating point). You can also run gcc with -v to see if it has
97this option.
98

README.virtio

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
4
5VirtIO Support
6==============
7
8This document describes the information about U-Boot support for VirtIO [1]
9devices, including supported boards, build instructions, driver details etc.
10
11What's VirtIO?
12--------------
13VirtIO is a virtualization standard for network and disk device drivers where
14just the guest's device driver "knows" it is running in a virtual environment,
15and cooperates with the hypervisor. This enables guests to get high performance
16network and disk operations, and gives most of the performance benefits of
17paravirtualization. In the U-Boot case, the guest is U-Boot itself, while the
18virtual environment are normally QEMU [2] targets like ARM, RISC-V and x86.
19
20Status
21------
22VirtIO can use various different buses, aka transports as described in the
23spec. While VirtIO devices are commonly implemented as PCI devices on x86,
24embedded devices models like ARM/RISC-V, which does not normally come with
25PCI support might use simple memory mapped device (MMIO) instead of the PCI
26device. The memory mapped virtio device behaviour is based on the PCI device
27specification. Therefore most operations including device initialization,
28queues configuration and buffer transfers are nearly identical. Both MMIO
29and PCI transport options are supported in U-Boot.
30
31The VirtIO spec defines a lots of VirtIO device types, however at present only
32network and block device, the most two commonly used devices, are supported.
33
34The following QEMU targets are supported.
35
36  - qemu_arm_defconfig
37  - qemu_arm64_defconfig
38  - qemu-riscv32_defconfig
39  - qemu-riscv64_defconfig
40  - qemu-x86_defconfig
41  - qemu-x86_64_defconfig
42
43Note ARM and RISC-V targets are configured with VirtIO MMIO transport driver,
44and on x86 it's the PCI transport driver.
45
46Build Instructions
47------------------
48Building U-Boot for pre-configured QEMU targets is no different from others.
49For example, we can do the following with the CROSS_COMPILE environment
50variable being properly set to a working toolchain for ARM:
51
52  $ make qemu_arm_defconfig
53  $ make
54
55You can even create a QEMU ARM target with VirtIO devices showing up on both
56MMIO and PCI buses. In this case, you can enable the PCI transport driver
57from 'make menuconfig':
58
59Device Drivers  --->
60	...
61	VirtIO Drivers  --->
62		...
63		[*] PCI driver for virtio devices
64
65Other drivers are at the same location and can be tuned to suit the needs.
66
67Requirements
68------------
69It is required that QEMU v2.5.0+ should be used to test U-Boot VirtIO support
70on QEMU ARM and x86, and v2.12.0+ on QEMU RISC-V.
71
72Testing
73-------
74The following QEMU command line is used to get U-Boot up and running with
75VirtIO net and block devices on ARM.
76
77  $ qemu-system-arm -nographic -machine virt -bios u-boot.bin \
78    -netdev tap,ifname=tap0,id=net0 \
79    -device virtio-net-device,netdev=net0 \
80    -drive if=none,file=test.img,format=raw,id=hd0 \
81    -device virtio-blk-device,drive=hd0
82
83On x86, command is slightly different to create PCI VirtIO devices.
84
85  $ qemu-system-i386 -nographic -bios u-boot.rom \
86    -netdev tap,ifname=tap0,id=net0 \
87    -device virtio-net-pci,netdev=net0 \
88    -drive if=none,file=test.img,format=raw,id=hd0 \
89    -device virtio-blk-pci,drive=hd0
90
91Additional net and block devices can be created by appending more '-device'
92parameters. It is also possible to specify both MMIO and PCI VirtIO devices.
93For example, the following commnad creates 3 VirtIO devices, with 1 on MMIO
94and 2 on PCI bus.
95
96  $ qemu-system-arm -nographic -machine virt -bios u-boot.bin \
97    -netdev tap,ifname=tap0,id=net0 \
98    -device virtio-net-pci,netdev=net0 \
99    -drive if=none,file=test0.img,format=raw,id=hd0 \
100    -device virtio-blk-device,drive=hd0 \
101    -drive if=none,file=test1.img,format=raw,id=hd1 \
102    -device virtio-blk-pci,drive=hd1
103
104By default QEMU creates VirtIO legacy devices by default. To create non-legacy
105(aka modern) devices, pass additional device property/value pairs like below:
106
107  $ qemu-system-i386 -nographic -bios u-boot.rom \
108    -netdev tap,ifname=tap0,id=net0 \
109    -device virtio-net-pci,netdev=net0,disable-legacy=true,disable-modern=false \
110    -drive if=none,file=test.img,format=raw,id=hd0 \
111    -device virtio-blk-pci,drive=hd0,disable-legacy=true,disable-modern=false
112
113A 'virtio' command is provided in U-Boot shell.
114
115  => virtio
116  virtio - virtio block devices sub-system
117
118  Usage:
119  virtio scan - initialize virtio bus
120  virtio info - show all available virtio block devices
121  virtio device [dev] - show or set current virtio block device
122  virtio part [dev] - print partition table of one or all virtio block devices
123  virtio read addr blk# cnt - read `cnt' blocks starting at block
124       `blk#' to memory address `addr'
125  virtio write addr blk# cnt - write `cnt' blocks starting at block
126       `blk#' from memory address `addr'
127
128To probe all the VirtIO devices, type:
129
130  => virtio scan
131
132Then we can show the connected block device details by:
133
134  => virtio info
135  Device 0: QEMU VirtIO Block Device
136              Type: Hard Disk
137              Capacity: 4096.0 MB = 4.0 GB (8388608 x 512)
138
139And list the directories and files on the disk by:
140
141  => ls virtio 0 /
142  <DIR>       4096 .
143  <DIR>       4096 ..
144  <DIR>      16384 lost+found
145  <DIR>       4096 dev
146  <DIR>       4096 proc
147  <DIR>       4096 sys
148  <DIR>       4096 var
149  <DIR>       4096 etc
150  <DIR>       4096 usr
151  <SYM>          7 bin
152  <SYM>          8 sbin
153  <SYM>          7 lib
154  <SYM>          9 lib64
155  <DIR>       4096 run
156  <DIR>       4096 boot
157  <DIR>       4096 home
158  <DIR>       4096 media
159  <DIR>       4096 mnt
160  <DIR>       4096 opt
161  <DIR>       4096 root
162  <DIR>       4096 srv
163  <DIR>       4096 tmp
164                 0 .autorelabel
165
166Driver Internals
167----------------
168There are 3 level of drivers in the VirtIO driver family.
169
170	+---------------------------------------+
171	|	 virtio device drivers		|
172	|    +-------------+ +------------+	|
173	|    | virtio-net  | | virtio-blk |	|
174	|    +-------------+ +------------+	|
175	+---------------------------------------+
176	+---------------------------------------+
177	|	virtio transport drivers	|
178	|    +-------------+ +------------+	|
179	|    | virtio-mmio | | virtio-pci |	|
180	|    +-------------+ +------------+	|
181	+---------------------------------------+
182		+----------------------+
183		| virtio uclass driver |
184		+----------------------+
185
186The root one is the virtio uclass driver (virtio-uclass.c), which does lots of
187common stuff for the transport drivers (virtio_mmio.c, virtio_pci.c). The real
188virtio device is discovered in the transport driver's probe() method, and its
189device ID is saved in the virtio uclass's private data of the transport device.
190Then in the virtio uclass's post_probe() method, the real virtio device driver
191(virtio_net.c, virtio_blk.c) is bound if there is a match on the device ID.
192
193The child_post_bind(), child_pre_probe() and child_post_probe() methods of the
194virtio uclass driver help bring the virtio device driver online. They do things
195like acknowledging device, feature negotiation, etc, which are really common
196for all virtio devices.
197
198The transport drivers provide a set of ops (struct dm_virtio_ops) for the real
199virtio device driver to call. These ops APIs's parameter is designed to remind
200the caller to pass the correct 'struct udevice' id of the virtio device, eg:
201
202int virtio_get_status(struct udevice *vdev, u8 *status)
203
204So the parameter 'vdev' indicates the device should be the real virtio device.
205But we also have an API like:
206
207struct virtqueue *vring_create_virtqueue(unsigned int index, unsigned int num,
208					 unsigned int vring_align,
209					 struct udevice *udev)
210
211Here the parameter 'udev' indicates the device should be the transport device.
212Similar naming is applied in other functions that are even not APIs, eg:
213
214static int virtio_uclass_post_probe(struct udevice *udev)
215static int virtio_uclass_child_pre_probe(struct udevice *vdev)
216
217So it's easy to tell which device these functions are operating on.
218
219Development Flow
220----------------
221At present only VirtIO network card (device ID 1) and block device (device
222ID 2) are supported. If you want to develop new driver for new devices,
223please follow the guideline below.
224
2251. add new device ID in virtio.h
226#define VIRTIO_ID_XXX		X
227
2282. update VIRTIO_ID_MAX_NUM to be the largest device ID plus 1
229
2303. add new driver name string in virtio.h
231#define VIRTIO_XXX_DRV_NAME	"virtio-xxx"
232
2334. create a new driver with name set to the name string above
234U_BOOT_DRIVER(virtio_xxx) = {
235	.name = VIRTIO_XXX_DRV_NAME,
236	...
237	.remove = virtio_reset,
238	.flags = DM_FLAG_ACTIVE_DMA,
239}
240
241Note the driver needs to provide the remove method and normally this can be
242hooked to virtio_reset(). The driver flags should contain DM_FLAG_ACTIVE_DMA
243for the remove method to be called before jumping to OS.
244
2455. provide bind() method in the driver, where virtio_driver_features_init()
246   should be called for driver to negotiate feature support with the device.
247
2486. do funny stuff with the driver
249
250References
251----------
252[1] http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.pdf
253[2] https://www.qemu.org
254

README.vxworks

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2013, Miao Yan <miao.yan@windriver.com>
4# Copyright (C) 2015-2018, Bin Meng <bmeng.cn@gmail.com>
5
6VxWorks Support
7===============
8
9This document describes the information about U-Boot loading VxWorks kernel.
10
11Status
12------
13U-Boot supports loading VxWorks kernels via 'bootvx' and 'bootm' commands.
14For booting old kernels (6.9.x) on PowerPC and ARM, and all kernel versions
15on other architectures, 'bootvx' shall be used. For booting VxWorks 7 kernels
16on PowerPC and ARM, 'bootm' shall be used.
17
18With CONFIG_EFI_LOADER option, it's possible to chain load a VxWorks x86 kernel
19via the UEFI boot loader application for VxWorks loaded by 'bootefi' command.
20
21VxWorks 7 on PowerPC and ARM
22---------------------------
23From VxWorks 7, VxWorks starts adopting device tree as its hardware description
24mechanism (for PowerPC and ARM), thus requiring boot interface changes.
25This section will describe the new interface.
26
27For PowerPC, the calling convention of the new VxWorks entry point conforms to
28the ePAPR standard, which is shown below (see ePAPR for more details):
29
30    void (*kernel_entry)(fdt_addr, 0, 0, EPAPR_MAGIC, boot_IMA, 0, 0)
31
32For ARM, the calling convention is shown below:
33
34    void (*kernel_entry)(void *fdt_addr)
35
36When booting a VxWorks 7 kernel (uImage format), the parameters passed to bootm
37is like below:
38
39    bootm <kernel image address> - <device tree address>
40
41VxWorks bootline
42----------------
43When using 'bootvx', the kernel bootline must be prepared by U-Boot at a
44board-specific address before loading VxWorks. U-Boot supplies its address
45via "bootaddr" environment variable. To check where the bootline should be
46for a specific board, go to the VxWorks BSP for that board, and look for a
47parameter called BOOT_LINE_ADRS. Assign its value to "bootaddr". A typical
48value for "bootaddr" on an x86 board is 0x101200.
49
50If a "bootargs" variable is defined, its content will be copied to the memory
51location pointed by "bootaddr" as the kernel bootline. If "bootargs" is not
52there, command 'bootvx' can construct a valid bootline using the following
53environments variables: bootdev, bootfile, ipaddr, netmask, serverip,
54gatewayip, hostname, othbootargs.
55
56When using 'bootm', just define "bootargs" in the environment and U-Boot will
57handle bootline fix up for the kernel dtb automatically.
58
59When using 'bootefi' to chain load an x86 kernel, the UEFI boot loader
60application for VxWorks takes care of the kernel bootline preparation.
61
62Serial console
63--------------
64It's very common that VxWorks BSPs configure a different baud rate for the
65serial console from what is being used by U-Boot. For example, VxWorks tends
66to use 9600 as the default baud rate on all x86 BSPs while U-Boot uses 115200.
67Please configure both U-Boot and VxWorks to use the same baud rate, or it may
68look like VxWorks hangs somewhere as nothing outputs on the serial console.
69
70x86-specific information
71------------------------
72Before direct loading an x86 kernel via 'bootvx', one additional environment
73variable need to be provided. This is "vx_phys_mem_base", which represent the
74physical memory base address of VxWorks.
75
76Check VxWorks kernel configuration to look for LOCAL_MEM_LOCAL_ADRS. For
77VxWorks 7, this is normally a virtual address and you need find out its
78corresponding physical address and assign its value to "vx_phys_mem_base".
79
80For boards on which ACPI is not supported by U-Boot yet, VxWorks kernel must
81be configured to use MP table and virtual wire interrupt mode. This requires
82INCLUDE_MPTABLE_BOOT_OP and INCLUDE_VIRTUAL_WIRE_MODE to be included in a
83VxWorks kernel configuration.
84
85Both 32-bit x86 and 64-bit x64 kernels can be loaded.
86
87There are two types of graphics console drivers in VxWorks. One is the 80x25
88VGA text mode driver. The other one is the EFI console bitmapped graphics mode
89driver. To make these drivers function, U-Boot needs to load and run the VGA
90BIOS of the graphics card first.
91
92    - If the kernel is configured with 80x25 VGA text mode driver,
93      CONFIG_FRAMEBUFFER_SET_VESA_MODE must be unset in U-Boot.
94    - If the kernel is configured with bitmapped graphics mode driver,
95      CONFIG_FRAMEBUFFER_SET_VESA_MODE need remain set but care must be taken
96      at which VESA mode is to be set. The supported pixel format is 32-bit
97      RGBA, hence the available VESA mode can only be one of the following:
98        * FRAMEBUFFER_VESA_MODE_10F
99        * FRAMEBUFFER_VESA_MODE_112
100        * FRAMEBUFFER_VESA_MODE_115
101        * FRAMEBUFFER_VESA_MODE_118
102        * FRAMEBUFFER_VESA_MODE_11B
103

README.watchdog

1Watchdog driver general info
2
3CONFIG_HW_WATCHDOG
4	This enables hw_watchdog_reset to be called during various loops,
5	including waiting for a character on a serial port. But it
6	does not also call hw_watchdog_init. Boards which want this
7	enabled must call this function in their board file. This split
8	is useful because some rom's enable the watchdog when downloading
9	new code, so it must be serviced, but the board would rather it
10	was off. And, it cannot always be turned off once on.
11
12CONFIG_WATCHDOG_TIMEOUT_MSECS
13	Can be used to change the timeout for i.mx31/35/5x/6x.
14	If not given, will default to maximum timeout. This would
15	be 128000 msec for i.mx31/35/5x/6x.
16
17CONFIG_WDT_AT91
18	Available for AT91SAM9 to service the watchdog.
19
20CONFIG_FTWDT010_WATCHDOG
21	Available for FTWDT010 to service the watchdog.
22
23CONFIG_FTWDT010_HW_TIMEOUT
24	Can be used to change the timeout for FTWDT010.
25
26CONFIG_IMX_WATCHDOG
27	Available for i.mx31/35/5x/6x to service the watchdog. This is not
28	automatically set because some boards (vision2) still need to define
29	their own hw_watchdog_reset routine.
30	TODO: vision2 is removed now, so perhaps this can be changed.
31
32CONFIG_XILINX_TB_WATCHDOG
33	Available for Xilinx Axi platforms to service timebase watchdog timer.
34

README.x86

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Copyright (C) 2014, Simon Glass <sjg@chromium.org>
4# Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
5
6U-Boot on x86
7=============
8
9This document describes the information about U-Boot running on x86 targets,
10including supported boards, build instructions, todo list, etc.
11
12Status
13------
14U-Boot supports running as a coreboot [1] payload on x86. So far only Link
15(Chromebook Pixel) and QEMU [2] x86 targets have been tested, but it should
16work with minimal adjustments on other x86 boards since coreboot deals with
17most of the low-level details.
18
19U-Boot is a main bootloader on Intel Edison board.
20
21U-Boot also supports booting directly from x86 reset vector, without coreboot.
22In this case, known as bare mode, from the fact that it runs on the
23'bare metal', U-Boot acts like a BIOS replacement. The following platforms
24are supported:
25
26   - Bayley Bay CRB
27   - Cherry Hill CRB
28   - Congatec QEVAL 2.0 & conga-QA3/E3845
29   - Cougar Canyon 2 CRB
30   - Crown Bay CRB
31   - Galileo
32   - Link (Chromebook Pixel)
33   - Minnowboard MAX
34   - Samus (Chromebook Pixel 2015)
35   - QEMU x86 (32-bit & 64-bit)
36
37As for loading an OS, U-Boot supports directly booting a 32-bit or 64-bit
38Linux kernel as part of a FIT image. It also supports a compressed zImage.
39U-Boot supports loading an x86 VxWorks kernel. Please check README.vxworks
40for more details.
41
42Build Instructions for U-Boot as coreboot payload
43-------------------------------------------------
44Building U-Boot as a coreboot payload is just like building U-Boot for targets
45on other architectures, like below:
46
47$ make coreboot_defconfig
48$ make all
49
50Build Instructions for U-Boot as main bootloader
51------------------------------------------------
52
53Intel Edison instructions:
54
55Simple you can build U-Boot and obtain u-boot.bin
56
57$ make edison_defconfig
58$ make all
59
60Build Instructions for U-Boot as BIOS replacement (bare mode)
61-------------------------------------------------------------
62Building a ROM version of U-Boot (hereafter referred to as u-boot.rom) is a
63little bit tricky, as generally it requires several binary blobs which are not
64shipped in the U-Boot source tree. Due to this reason, the u-boot.rom build is
65not turned on by default in the U-Boot source tree. Firstly, you need turn it
66on by enabling the ROM build either via an environment variable
67
68    $ export BUILD_ROM=y
69
70or via configuration
71
72    CONFIG_BUILD_ROM=y
73
74Both tell the Makefile to build u-boot.rom as a target.
75
76---
77
78Chromebook Link specific instructions for bare mode:
79
80First, you need the following binary blobs:
81
82* descriptor.bin - Intel flash descriptor
83* me.bin - Intel Management Engine
84* mrc.bin - Memory Reference Code, which sets up SDRAM
85* video ROM - sets up the display
86
87You can get these binary blobs by:
88
89$ git clone http://review.coreboot.org/p/blobs.git
90$ cd blobs
91
92Find the following files:
93
94* ./mainboard/google/link/descriptor.bin
95* ./mainboard/google/link/me.bin
96* ./northbridge/intel/sandybridge/systemagent-r6.bin
97
98The 3rd one should be renamed to mrc.bin.
99As for the video ROM, you can get it here [3] and rename it to vga.bin.
100Make sure all these binary blobs are put in the board directory.
101
102Now you can build U-Boot and obtain u-boot.rom:
103
104$ make chromebook_link_defconfig
105$ make all
106
107---
108
109Chromebook Samus (2015 Pixel) instructions for bare mode:
110
111First, you need the following binary blobs:
112
113* descriptor.bin - Intel flash descriptor
114* me.bin - Intel Management Engine
115* mrc.bin - Memory Reference Code, which sets up SDRAM
116* refcode.elf - Additional Reference code
117* vga.bin - video ROM, which sets up the display
118
119If you have a samus you can obtain them from your flash, for example, in
120developer mode on the Chromebook (use Ctrl-Alt-F2 to obtain a terminal and
121log in as 'root'):
122
123   cd /tmp
124   flashrom -w samus.bin
125   scp samus.bin username@ip_address:/path/to/somewhere
126
127If not see the coreboot tree [4] where you can use:
128
129   bash crosfirmware.sh samus
130
131to get the image. There is also an 'extract_blobs.sh' scripts that you can use
132on the 'coreboot-Google_Samus.*' file to short-circuit some of the below.
133
134Then 'ifdtool -x samus.bin' on your development machine will produce:
135
136   flashregion_0_flashdescriptor.bin
137   flashregion_1_bios.bin
138   flashregion_2_intel_me.bin
139
140Rename flashregion_0_flashdescriptor.bin to descriptor.bin
141Rename flashregion_2_intel_me.bin to me.bin
142You can ignore flashregion_1_bios.bin - it is not used.
143
144To get the rest, use 'cbfstool samus.bin print':
145
146samus.bin: 8192 kB, bootblocksize 2864, romsize 8388608, offset 0x700000
147alignment: 64 bytes, architecture: x86
148
149Name                           Offset     Type         Size
150cmos_layout.bin                0x700000   cmos_layout  1164
151pci8086,0406.rom               0x7004c0   optionrom    65536
152spd.bin                        0x710500   (unknown)    4096
153cpu_microcode_blob.bin         0x711540   microcode    70720
154fallback/romstage              0x722a00   stage        54210
155fallback/ramstage              0x72fe00   stage        96382
156config                         0x7476c0   raw          6075
157fallback/vboot                 0x748ec0   stage        15980
158fallback/refcode               0x74cd80   stage        75578
159fallback/payload               0x75f500   payload      62878
160u-boot.dtb                     0x76eb00   (unknown)    5318
161(empty)                        0x770000   null         196504
162mrc.bin                        0x79ffc0   (unknown)    222876
163(empty)                        0x7d66c0   null         167320
164
165You can extract what you need:
166
167   cbfstool samus.bin extract -n pci8086,0406.rom -f vga.bin
168   cbfstool samus.bin extract -n fallback/refcode -f refcode.rmod
169   cbfstool samus.bin extract -n mrc.bin -f mrc.bin
170   cbfstool samus.bin extract -n fallback/refcode -f refcode.bin -U
171
172Note that the -U flag is only supported by the latest cbfstool. It unpacks
173and decompresses the stage to produce a coreboot rmodule. This is a simple
174representation of an ELF file. You need the patch "Support decoding a stage
175with compression".
176
177Put all 5 files into board/google/chromebook_samus.
178
179Now you can build U-Boot and obtain u-boot.rom:
180
181$ make chromebook_link_defconfig
182$ make all
183
184If you are using em100, then this command will flash write -Boot:
185
186   em100 -s -d filename.rom -c W25Q64CV -r
187
188---
189
190Intel Crown Bay specific instructions for bare mode:
191
192U-Boot support of Intel Crown Bay board [4] relies on a binary blob called
193Firmware Support Package [5] to perform all the necessary initialization steps
194as documented in the BIOS Writer Guide, including initialization of the CPU,
195memory controller, chipset and certain bus interfaces.
196
197Download the Intel FSP for Atom E6xx series and Platform Controller Hub EG20T,
198install it on your host and locate the FSP binary blob. Note this platform
199also requires a Chipset Micro Code (CMC) state machine binary to be present in
200the SPI flash where u-boot.rom resides, and this CMC binary blob can be found
201in this FSP package too.
202
203* ./FSP/QUEENSBAY_FSP_GOLD_001_20-DECEMBER-2013.fd
204* ./Microcode/C0_22211.BIN
205
206Rename the first one to fsp.bin and second one to cmc.bin and put them in the
207board directory.
208
209Note the FSP release version 001 has a bug which could cause random endless
210loop during the FspInit call. This bug was published by Intel although Intel
211did not describe any details. We need manually apply the patch to the FSP
212binary using any hex editor (eg: bvi). Go to the offset 0x1fcd8 of the FSP
213binary, change the following five bytes values from orginally E8 42 FF FF FF
214to B8 00 80 0B 00.
215
216As for the video ROM, you need manually extract it from the Intel provided
217BIOS for Crown Bay here [6], using the AMI MMTool [7]. Check PCI option ROM
218ID 8086:4108, extract and save it as vga.bin in the board directory.
219
220Now you can build U-Boot and obtain u-boot.rom
221
222$ make crownbay_defconfig
223$ make all
224
225---
226
227Intel Cougar Canyon 2 specific instructions for bare mode:
228
229This uses Intel FSP for 3rd generation Intel Core and Intel Celeron processors
230with mobile Intel HM76 and QM77 chipsets platform. Download it from Intel FSP
231website and put the .fd file (CHIEFRIVER_FSP_GOLD_001_09-OCTOBER-2013.fd at the
232time of writing) in the board directory and rename it to fsp.bin.
233
234Now build U-Boot and obtain u-boot.rom
235
236$ make cougarcanyon2_defconfig
237$ make all
238
239The board has two 8MB SPI flashes mounted, which are called SPI-0 and SPI-1 in
240the board manual. The SPI-0 flash should have flash descriptor plus ME firmware
241and SPI-1 flash is used to store U-Boot. For convenience, the complete 8MB SPI-0
242flash image is included in the FSP package (named Rom00_8M_MB_PPT.bin). Program
243this image to the SPI-0 flash according to the board manual just once and we are
244all set. For programming U-Boot we just need to program SPI-1 flash. Since the
245default u-boot.rom image for this board is set to 2MB, it should be programmed
246to the last 2MB of the 8MB chip, address range [600000, 7FFFFF].
247
248---
249
250Intel Bay Trail based board instructions for bare mode:
251
252This uses as FSP as with Crown Bay, except it is for the Atom E3800 series.
253Two boards that use this configuration are Bayley Bay and Minnowboard MAX.
254Download this and get the .fd file (BAYTRAIL_FSP_GOLD_003_16-SEP-2014.fd at
255the time of writing). Put it in the corresponding board directory and rename
256it to fsp.bin.
257
258Obtain the VGA RAM (Vga.dat at the time of writing) and put it into the same
259board directory as vga.bin.
260
261You still need two more binary blobs. For Bayley Bay, they can be extracted
262from the sample SPI image provided in the FSP (SPI.bin at the time of writing).
263
264   $ ./tools/ifdtool -x BayleyBay/SPI.bin
265   $ cp flashregion_0_flashdescriptor.bin board/intel/bayleybay/descriptor.bin
266   $ cp flashregion_2_intel_me.bin board/intel/bayleybay/me.bin
267
268For Minnowboard MAX, we can reuse the same ME firmware above, but for flash
269descriptor, we need get that somewhere else, as the one above does not seem to
270work, probably because it is not designed for the Minnowboard MAX. Now download
271the original firmware image for this board from:
272
273http://firmware.intel.com/sites/default/files/2014-WW42.4-MinnowBoardMax.73-64-bit.bin_Release.zip
274
275Unzip it:
276
277   $ unzip 2014-WW42.4-MinnowBoardMax.73-64-bit.bin_Release.zip
278
279Use ifdtool in the U-Boot tools directory to extract the images from that
280file, for example:
281
282   $ ./tools/ifdtool -x MNW2MAX1.X64.0073.R02.1409160934.bin
283
284This will provide the descriptor file - copy this into the correct place:
285
286   $ cp flashregion_0_flashdescriptor.bin board/intel/minnowmax/descriptor.bin
287
288Now you can build U-Boot and obtain u-boot.rom
289Note: below are examples/information for Minnowboard MAX.
290
291$ make minnowmax_defconfig
292$ make all
293
294Checksums are as follows (but note that newer versions will invalidate this):
295
296$ md5sum -b board/intel/minnowmax/*.bin
297ffda9a3b94df5b74323afb328d51e6b4  board/intel/minnowmax/descriptor.bin
29869f65b9a580246291d20d08cbef9d7c5  board/intel/minnowmax/fsp.bin
299894a97d371544ec21de9c3e8e1716c4b  board/intel/minnowmax/me.bin
300a2588537da387da592a27219d56e9962  board/intel/minnowmax/vga.bin
301
302The ROM image is broken up into these parts:
303
304Offset   Description         Controlling config
305------------------------------------------------------------
306000000   descriptor.bin      Hard-coded to 0 in ifdtool
307001000   me.bin              Set by the descriptor
308500000   <spare>
3096ef000   Environment         CONFIG_ENV_OFFSET
3106f0000   MRC cache           CONFIG_ENABLE_MRC_CACHE
311700000   u-boot-dtb.bin      CONFIG_SYS_TEXT_BASE
3127b0000   vga.bin             CONFIG_VGA_BIOS_ADDR
3137c0000   fsp.bin             CONFIG_FSP_ADDR
3147f8000   <spare>             (depends on size of fsp.bin)
3157ff800   U-Boot 16-bit boot  CONFIG_SYS_X86_START16
316
317Overall ROM image size is controlled by CONFIG_ROM_SIZE.
318
319Note that the debug version of the FSP is bigger in size. If this version
320is used, CONFIG_FSP_ADDR needs to be configured to 0xfffb0000 instead of
321the default value 0xfffc0000.
322
323---
324
325Intel Cherry Hill specific instructions for bare mode:
326
327This uses Intel FSP for Braswell platform. Download it from Intel FSP website,
328put the .fd file to the board directory and rename it to fsp.bin.
329
330Extract descriptor.bin and me.bin from the original BIOS on the board using
331ifdtool and put them to the board directory as well.
332
333Note the FSP package for Braswell does not ship a traditional legacy VGA BIOS
334image for the integrated graphics device. Instead a new binary called Video
335BIOS Table (VBT) is shipped. Put it to the board directory and rename it to
336vbt.bin if you want graphics support in U-Boot.
337
338Now you can build U-Boot and obtain u-boot.rom
339
340$ make cherryhill_defconfig
341$ make all
342
343An important note for programming u-boot.rom to the on-board SPI flash is that
344you need make sure the SPI flash's 'quad enable' bit in its status register
345matches the settings in the descriptor.bin, otherwise the board won't boot.
346
347For the on-board SPI flash MX25U6435F, this can be done by writing 0x40 to the
348status register by DediProg in: Config > Modify Status Register > Write Status
349Register(s) > Register1 Value(Hex). This is is a one-time change. Once set, it
350persists in SPI flash part regardless of the u-boot.rom image burned.
351
352---
353
354Intel Galileo instructions for bare mode:
355
356Only one binary blob is needed for Remote Management Unit (RMU) within Intel
357Quark SoC. Not like FSP, U-Boot does not call into the binary. The binary is
358needed by the Quark SoC itself.
359
360You can get the binary blob from Quark Board Support Package from Intel website:
361
362* ./QuarkSocPkg/QuarkNorthCluster/Binary/QuarkMicrocode/RMU.bin
363
364Rename the file and put it to the board directory by:
365
366   $ cp RMU.bin board/intel/galileo/rmu.bin
367
368Now you can build U-Boot and obtain u-boot.rom
369
370$ make galileo_defconfig
371$ make all
372
373---
374
375QEMU x86 target instructions for bare mode:
376
377To build u-boot.rom for QEMU x86 targets, just simply run
378
379$ make qemu-x86_defconfig (for 32-bit)
380or
381$ make qemu-x86_64_defconfig (for 64-bit)
382$ make all
383
384Note this default configuration will build a U-Boot for the QEMU x86 i440FX
385board. To build a U-Boot against QEMU x86 Q35 board, you can change the build
386configuration during the 'make menuconfig' process like below:
387
388Device Tree Control  --->
389	...
390	(qemu-x86_q35) Default Device Tree for DT control
391
392Test with coreboot
393------------------
394For testing U-Boot as the coreboot payload, there are things that need be paid
395attention to. coreboot supports loading an ELF executable and a 32-bit plain
396binary, as well as other supported payloads. With the default configuration,
397U-Boot is set up to use a separate Device Tree Blob (dtb). As of today, the
398generated u-boot-dtb.bin needs to be packaged by the cbfstool utility (a tool
399provided by coreboot) manually as coreboot's 'make menuconfig' does not provide
400this capability yet. The command is as follows:
401
402# in the coreboot root directory
403$ ./build/util/cbfstool/cbfstool build/coreboot.rom add-flat-binary \
404  -f u-boot-dtb.bin -n fallback/payload -c lzma -l 0x1110000 -e 0x1110000
405
406Make sure 0x1110000 matches CONFIG_SYS_TEXT_BASE, which is the symbol address
407of _x86boot_start (in arch/x86/cpu/start.S).
408
409If you want to use ELF as the coreboot payload, change U-Boot configuration to
410use CONFIG_OF_EMBED instead of CONFIG_OF_SEPARATE.
411
412To enable video you must enable these options in coreboot:
413
414   - Set framebuffer graphics resolution (1280x1024 32k-color (1:5:5))
415   - Keep VESA framebuffer
416
417At present it seems that for Minnowboard Max, coreboot does not pass through
418the video information correctly (it always says the resolution is 0x0). This
419works correctly for link though.
420
421Test with QEMU for bare mode
422----------------------------
423QEMU is a fancy emulator that can enable us to test U-Boot without access to
424a real x86 board. Please make sure your QEMU version is 2.3.0 or above test
425U-Boot. To launch QEMU with u-boot.rom, call QEMU as follows:
426
427$ qemu-system-i386 -nographic -bios path/to/u-boot.rom
428
429This will instantiate an emulated x86 board with i440FX and PIIX chipset. QEMU
430also supports emulating an x86 board with Q35 and ICH9 based chipset, which is
431also supported by U-Boot. To instantiate such a machine, call QEMU with:
432
433$ qemu-system-i386 -nographic -bios path/to/u-boot.rom -M q35
434
435Note by default QEMU instantiated boards only have 128 MiB system memory. But
436it is enough to have U-Boot boot and function correctly. You can increase the
437system memory by pass '-m' parameter to QEMU if you want more memory:
438
439$ qemu-system-i386 -nographic -bios path/to/u-boot.rom -m 1024
440
441This creates a board with 1 GiB system memory. Currently U-Boot for QEMU only
442supports 3 GiB maximum system memory and reserves the last 1 GiB address space
443for PCI device memory-mapped I/O and other stuff, so the maximum value of '-m'
444would be 3072.
445
446QEMU emulates a graphic card which U-Boot supports. Removing '-nographic' will
447show QEMU's VGA console window. Note this will disable QEMU's serial output.
448If you want to check both consoles, use '-serial stdio'.
449
450Multicore is also supported by QEMU via '-smp n' where n is the number of cores
451to instantiate. Note, the maximum supported CPU number in QEMU is 255.
452
453The fw_cfg interface in QEMU also provides information about kernel data,
454initrd, command-line arguments and more. U-Boot supports directly accessing
455these informtion from fw_cfg interface, which saves the time of loading them
456from hard disk or network again, through emulated devices. To use it , simply
457providing them in QEMU command line:
458
459$ qemu-system-i386 -nographic -bios path/to/u-boot.rom -m 1024 -kernel /path/to/bzImage
460    -append 'root=/dev/ram console=ttyS0' -initrd /path/to/initrd -smp 8
461
462Note: -initrd and -smp are both optional
463
464Then start QEMU, in U-Boot command line use the following U-Boot command to
465setup kernel:
466
467 => qfw
468qfw - QEMU firmware interface
469
470Usage:
471qfw <command>
472    - list                             : print firmware(s) currently loaded
473    - cpus                             : print online cpu number
474    - load <kernel addr> <initrd addr> : load kernel and initrd (if any) and setup for zboot
475
476=> qfw load
477loading kernel to address 01000000 size 5d9d30 initrd 04000000 size 1b1ab50
478
479Here the kernel (bzImage) is loaded to 01000000 and initrd is to 04000000. Then,
480'zboot' can be used to boot the kernel:
481
482=> zboot 01000000 - 04000000 1b1ab50
483
484To run 64-bit U-Boot, qemu-system-x86_64 should be used instead, e.g.:
485$ qemu-system-x86_64 -nographic -bios path/to/u-boot.rom
486
487A specific CPU can be specified via the '-cpu' parameter but please make
488sure the specified CPU supports 64-bit like '-cpu core2duo'. Conversely
489'-cpu pentium' won't work for obvious reasons that the processor only
490supports 32-bit.
491
492Note 64-bit support is very preliminary at this point. Lots of features
493are missing in the 64-bit world. One notable feature is the VGA console
494support which is currently missing, so that you must specify '-nographic'
495to get 64-bit U-Boot up and running.
496
497Updating U-Boot on Edison
498-------------------------
499By default Intel Edison boards are shipped with preinstalled heavily
500patched U-Boot v2014.04. Though it supports DFU which we may be able to
501use.
502
5031. Prepare u-boot.bin as described in chapter above. You still need one
504more step (if and only if you have original U-Boot), i.e. run the
505following command:
506
507$ truncate -s %4096 u-boot.bin
508
5092. Run your board and interrupt booting to U-Boot console. In the console
510call:
511
512 => run do_force_flash_os
513
5143. Wait for few seconds, it will prepare environment variable and runs
515DFU. Run DFU command from the host system:
516
517$ dfu-util -v -d 8087:0a99 --alt u-boot0 -D u-boot.bin
518
5194. Return to U-Boot console and following hint. i.e. push Ctrl+C, and
520reset the board:
521
522 => reset
523
524CPU Microcode
525-------------
526Modern CPUs usually require a special bit stream called microcode [8] to be
527loaded on the processor after power up in order to function properly. U-Boot
528has already integrated these as hex dumps in the source tree.
529
530SMP Support
531-----------
532On a multicore system, U-Boot is executed on the bootstrap processor (BSP).
533Additional application processors (AP) can be brought up by U-Boot. In order to
534have an SMP kernel to discover all of the available processors, U-Boot needs to
535prepare configuration tables which contain the multi-CPUs information before
536loading the OS kernel. Currently U-Boot supports generating two types of tables
537for SMP, called Simple Firmware Interface (SFI) [9] and Multi-Processor (MP)
538[10] tables. The writing of these two tables are controlled by two Kconfig
539options GENERATE_SFI_TABLE and GENERATE_MP_TABLE.
540
541Driver Model
542------------
543x86 has been converted to use driver model for serial, GPIO, SPI, SPI flash,
544keyboard, real-time clock, USB. Video is in progress.
545
546Device Tree
547-----------
548x86 uses device tree to configure the board thus requires CONFIG_OF_CONTROL to
549be turned on. Not every device on the board is configured via device tree, but
550more and more devices will be added as time goes by. Check out the directory
551arch/x86/dts/ for these device tree source files.
552
553Useful Commands
554---------------
555In keeping with the U-Boot philosophy of providing functions to check and
556adjust internal settings, there are several x86-specific commands that may be
557useful:
558
559fsp  - Display information about Intel Firmware Support Package (FSP).
560	 This is only available on platforms which use FSP, mostly Atom.
561iod  - Display I/O memory
562iow  - Write I/O memory
563mtrr - List and set the Memory Type Range Registers (MTRR). These are used to
564	 tell the CPU whether memory is cacheable and if so the cache write
565	 mode to use. U-Boot sets up some reasonable values but you can
566	 adjust then with this command.
567
568Booting Ubuntu
569--------------
570As an example of how to set up your boot flow with U-Boot, here are
571instructions for starting Ubuntu from U-Boot. These instructions have been
572tested on Minnowboard MAX with a SATA drive but are equally applicable on
573other platforms and other media. There are really only four steps and it's a
574very simple script, but a more detailed explanation is provided here for
575completeness.
576
577Note: It is possible to set up U-Boot to boot automatically using syslinux.
578It could also use the grub.cfg file (/efi/ubuntu/grub.cfg) to obtain the
579GUID. If you figure these out, please post patches to this README.
580
581Firstly, you will need Ubuntu installed on an available disk. It should be
582possible to make U-Boot start a USB start-up disk but for now let's assume
583that you used another boot loader to install Ubuntu.
584
585Use the U-Boot command line to find the UUID of the partition you want to
586boot. For example our disk is SCSI device 0:
587
588=> part list scsi 0
589
590Partition Map for SCSI device 0  --   Partition Type: EFI
591
592   Part	Start LBA	End LBA		Name
593	Attributes
594	Type GUID
595	Partition GUID
596   1	0x00000800	0x001007ff	""
597	attrs:	0x0000000000000000
598	type:	c12a7328-f81f-11d2-ba4b-00a0c93ec93b
599	guid:	9d02e8e4-4d59-408f-a9b0-fd497bc9291c
600   2	0x00100800	0x037d8fff	""
601	attrs:	0x0000000000000000
602	type:	0fc63daf-8483-4772-8e79-3d69d8477de4
603	guid:	965c59ee-1822-4326-90d2-b02446050059
604   3	0x037d9000	0x03ba27ff	""
605	attrs:	0x0000000000000000
606	type:	0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
607	guid:	2c4282bd-1e82-4bcf-a5ff-51dedbf39f17
608   =>
609
610This shows that your SCSI disk has three partitions. The really long hex
611strings are called Globally Unique Identifiers (GUIDs). You can look up the
612'type' ones here [11]. On this disk the first partition is for EFI and is in
613VFAT format (DOS/Windows):
614
615   => fatls scsi 0:1
616               efi/
617
618   0 file(s), 1 dir(s)
619
620
621Partition 2 is 'Linux filesystem data' so that will be our root disk. It is
622in ext2 format:
623
624   => ext2ls scsi 0:2
625   <DIR>       4096 .
626   <DIR>       4096 ..
627   <DIR>      16384 lost+found
628   <DIR>       4096 boot
629   <DIR>      12288 etc
630   <DIR>       4096 media
631   <DIR>       4096 bin
632   <DIR>       4096 dev
633   <DIR>       4096 home
634   <DIR>       4096 lib
635   <DIR>       4096 lib64
636   <DIR>       4096 mnt
637   <DIR>       4096 opt
638   <DIR>       4096 proc
639   <DIR>       4096 root
640   <DIR>       4096 run
641   <DIR>      12288 sbin
642   <DIR>       4096 srv
643   <DIR>       4096 sys
644   <DIR>       4096 tmp
645   <DIR>       4096 usr
646   <DIR>       4096 var
647   <SYM>         33 initrd.img
648   <SYM>         30 vmlinuz
649   <DIR>       4096 cdrom
650   <SYM>         33 initrd.img.old
651   =>
652
653and if you look in the /boot directory you will see the kernel:
654
655   => ext2ls scsi 0:2 /boot
656   <DIR>       4096 .
657   <DIR>       4096 ..
658   <DIR>       4096 efi
659   <DIR>       4096 grub
660            3381262 System.map-3.13.0-32-generic
661            1162712 abi-3.13.0-32-generic
662             165611 config-3.13.0-32-generic
663             176500 memtest86+.bin
664             178176 memtest86+.elf
665             178680 memtest86+_multiboot.bin
666            5798112 vmlinuz-3.13.0-32-generic
667             165762 config-3.13.0-58-generic
668            1165129 abi-3.13.0-58-generic
669            5823136 vmlinuz-3.13.0-58-generic
670           19215259 initrd.img-3.13.0-58-generic
671            3391763 System.map-3.13.0-58-generic
672            5825048 vmlinuz-3.13.0-58-generic.efi.signed
673           28304443 initrd.img-3.13.0-32-generic
674   =>
675
676The 'vmlinuz' files contain a packaged Linux kernel. The format is a kind of
677self-extracting compressed file mixed with some 'setup' configuration data.
678Despite its size (uncompressed it is >10MB) this only includes a basic set of
679device drivers, enough to boot on most hardware types.
680
681The 'initrd' files contain a RAM disk. This is something that can be loaded
682into RAM and will appear to Linux like a disk. Ubuntu uses this to hold lots
683of drivers for whatever hardware you might have. It is loaded before the
684real root disk is accessed.
685
686The numbers after the end of each file are the version. Here it is Linux
687version 3.13. You can find the source code for this in the Linux tree with
688the tag v3.13. The '.0' allows for additional Linux releases to fix problems,
689but normally this is not needed. The '-58' is used by Ubuntu. Each time they
690release a new kernel they increment this number. New Ubuntu versions might
691include kernel patches to fix reported bugs. Stable kernels can exist for
692some years so this number can get quite high.
693
694The '.efi.signed' kernel is signed for EFI's secure boot. U-Boot has its own
695secure boot mechanism - see [12] [13] and cannot read .efi files at present.
696
697To boot Ubuntu from U-Boot the steps are as follows:
698
6991. Set up the boot arguments. Use the GUID for the partition you want to
700boot:
701
702   => setenv bootargs root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro
703
704Here root= tells Linux the location of its root disk. The disk is specified
705by its GUID, using '/dev/disk/by-partuuid/', a Linux path to a 'directory'
706containing all the GUIDs Linux has found. When it starts up, there will be a
707file in that directory with this name in it. It is also possible to use a
708device name here, see later.
709
7102. Load the kernel. Since it is an ext2/4 filesystem we can do:
711
712   => ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic
713
714The address 30000000 is arbitrary, but there seem to be problems with using
715small addresses (sometimes Linux cannot find the ramdisk). This is 48MB into
716the start of RAM (which is at 0 on x86).
717
7183. Load the ramdisk (to 64MB):
719
720   => ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic
721
7224. Start up the kernel. We need to know the size of the ramdisk, but can use
723a variable for that. U-Boot sets 'filesize' to the size of the last file it
724loaded.
725
726   => zboot 03000000 0 04000000 ${filesize}
727
728Type 'help zboot' if you want to see what the arguments are. U-Boot on x86 is
729quite verbose when it boots a kernel. You should see these messages from
730U-Boot:
731
732   Valid Boot Flag
733   Setup Size = 0x00004400
734   Magic signature found
735   Using boot protocol version 2.0c
736   Linux kernel version 3.13.0-58-generic (buildd@allspice) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015
737   Building boot_params at 0x00090000
738   Loading bzImage at address 100000 (5805728 bytes)
739   Magic signature found
740   Initial RAM disk at linear address 0x04000000, size 19215259 bytes
741   Kernel command line: "root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro"
742
743   Starting kernel ...
744
745U-Boot prints out some bootstage timing. This is more useful if you put the
746above commands into a script since then it will be faster.
747
748   Timer summary in microseconds:
749          Mark    Elapsed  Stage
750             0          0  reset
751       241,535    241,535  board_init_r
752     2,421,611  2,180,076  id=64
753     2,421,790        179  id=65
754     2,428,215      6,425  main_loop
755    48,860,584 46,432,369  start_kernel
756
757   Accumulated time:
758                  240,329  ahci
759                1,422,704  vesa display
760
761Now the kernel actually starts: (if you want to examine kernel boot up message
762on the serial console, append "console=ttyS0,115200" to the kernel command line)
763
764   [    0.000000] Initializing cgroup subsys cpuset
765   [    0.000000] Initializing cgroup subsys cpu
766   [    0.000000] Initializing cgroup subsys cpuacct
767   [    0.000000] Linux version 3.13.0-58-generic (buildd@allspice) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 (Ubuntu 3.13.0-58.97-generic 3.13.11-ckt22)
768   [    0.000000] Command line: root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro console=ttyS0,115200
769
770It continues for a long time. Along the way you will see it pick up your
771ramdisk:
772
773   [    0.000000] RAMDISK: [mem 0x04000000-0x05253fff]
774...
775   [    0.788540] Trying to unpack rootfs image as initramfs...
776   [    1.540111] Freeing initrd memory: 18768K (ffff880004000000 - ffff880005254000)
777...
778
779Later it actually starts using it:
780
781   Begin: Running /scripts/local-premount ... done.
782
783You should also see your boot disk turn up:
784
785   [    4.357243] scsi 1:0:0:0: Direct-Access     ATA      ADATA SP310      5.2  PQ: 0 ANSI: 5
786   [    4.366860] sd 1:0:0:0: [sda] 62533296 512-byte logical blocks: (32.0 GB/29.8 GiB)
787   [    4.375677] sd 1:0:0:0: Attached scsi generic sg0 type 0
788   [    4.381859] sd 1:0:0:0: [sda] Write Protect is off
789   [    4.387452] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
790   [    4.399535]  sda: sda1 sda2 sda3
791
792Linux has found the three partitions (sda1-3). Mercifully it doesn't print out
793the GUIDs. In step 1 above we could have used:
794
795   setenv bootargs root=/dev/sda2 ro
796
797instead of the GUID. However if you add another drive to your board the
798numbering may change whereas the GUIDs will not. So if your boot partition
799becomes sdb2, it will still boot. For embedded systems where you just want to
800boot the first disk, you have that option.
801
802The last thing you will see on the console is mention of plymouth (which
803displays the Ubuntu start-up screen) and a lot of 'Starting' messages:
804
805 * Starting Mount filesystems on boot                                    [ OK ]
806
807After a pause you should see a login screen on your display and you are done.
808
809If you want to put this in a script you can use something like this:
810
811   setenv bootargs root=UUID=b2aaf743-0418-4d90-94cc-3e6108d7d968 ro
812   setenv boot zboot 03000000 0 04000000 \${filesize}
813   setenv bootcmd "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; run boot"
814   saveenv
815
816The \ is to tell the shell not to evaluate ${filesize} as part of the setenv
817command.
818
819You can also bake this behaviour into your build by hard-coding the
820environment variables if you add this to minnowmax.h:
821
822#undef CONFIG_BOOTCOMMAND
823#define CONFIG_BOOTCOMMAND	\
824	"ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; " \
825	"ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; " \
826	"run boot"
827
828#undef CONFIG_EXTRA_ENV_SETTINGS
829#define CONFIG_EXTRA_ENV_SETTINGS "boot=zboot 03000000 0 04000000 ${filesize}"
830
831and change CONFIG_BOOTARGS value in configs/minnowmax_defconfig to:
832
833CONFIG_BOOTARGS="root=/dev/sda2 ro"
834
835Test with SeaBIOS
836-----------------
837SeaBIOS [14] is an open source implementation of a 16-bit x86 BIOS. It can run
838in an emulator or natively on x86 hardware with the use of U-Boot. With its
839help, we can boot some OSes that require 16-bit BIOS services like Windows/DOS.
840
841As U-Boot, we have to manually create a table where SeaBIOS gets various system
842information (eg: E820) from. The table unfortunately has to follow the coreboot
843table format as SeaBIOS currently supports booting as a coreboot payload.
844
845To support loading SeaBIOS, U-Boot should be built with CONFIG_SEABIOS on.
846Booting SeaBIOS is done via U-Boot's bootelf command, like below:
847
848   => tftp bios.bin.elf;bootelf
849   Using e1000#0 device
850   TFTP from server 10.10.0.100; our IP address is 10.10.0.108
851   ...
852   Bytes transferred = 122124 (1dd0c hex)
853   ## Starting application at 0x000ff06e ...
854   SeaBIOS (version rel-1.9.0)
855   ...
856
857bios.bin.elf is the SeaBIOS image built from SeaBIOS source tree.
858Make sure it is built as follows:
859
860   $ make menuconfig
861
862Inside the "General Features" menu, select "Build for coreboot" as the
863"Build Target". Inside the "Debugging" menu, turn on "Serial port debugging"
864so that we can see something as soon as SeaBIOS boots. Leave other options
865as in their default state. Then,
866
867   $ make
868   ...
869   Total size: 121888  Fixed: 66496  Free: 9184 (used 93.0% of 128KiB rom)
870   Creating out/bios.bin.elf
871
872Currently this is tested on QEMU x86 target with U-Boot chain-loading SeaBIOS
873to install/boot a Windows XP OS (below for example command to install Windows).
874
875   # Create a 10G disk.img as the virtual hard disk
876   $ qemu-img create -f qcow2 disk.img 10G
877
878   # Install a Windows XP OS from an ISO image 'winxp.iso'
879   $ qemu-system-i386 -serial stdio -bios u-boot.rom -hda disk.img -cdrom winxp.iso -smp 2 -m 512
880
881   # Boot a Windows XP OS installed on the virutal hard disk
882   $ qemu-system-i386 -serial stdio -bios u-boot.rom -hda disk.img -smp 2 -m 512
883
884This is also tested on Intel Crown Bay board with a PCIe graphics card, booting
885SeaBIOS then chain-loading a GRUB on a USB drive, then Linux kernel finally.
886
887If you are using Intel Integrated Graphics Device (IGD) as the primary display
888device on your board, SeaBIOS needs to be patched manually to get its VGA ROM
889loaded and run by SeaBIOS. SeaBIOS locates VGA ROM via the PCI expansion ROM
890register, but IGD device does not have its VGA ROM mapped by this register.
891Its VGA ROM is packaged as part of u-boot.rom at a configurable flash address
892which is unknown to SeaBIOS. An example patch is needed for SeaBIOS below:
893
894diff --git a/src/optionroms.c b/src/optionroms.c
895index 65f7fe0..c7b6f5e 100644
896--- a/src/optionroms.c
897+++ b/src/optionroms.c
898@@ -324,6 +324,8 @@ init_pcirom(struct pci_device *pci, int isvga, u64 *sources)
899         rom = deploy_romfile(file);
900     else if (RunPCIroms > 1 || (RunPCIroms == 1 && isvga))
901         rom = map_pcirom(pci);
902+    if (pci->bdf == pci_to_bdf(0, 2, 0))
903+        rom = (struct rom_header *)0xfff90000;
904     if (! rom)
905         // No ROM present.
906         return;
907
908Note: the patch above expects IGD device is at PCI b.d.f 0.2.0 and its VGA ROM
909is at 0xfff90000 which corresponds to CONFIG_VGA_BIOS_ADDR on Minnowboard MAX.
910Change these two accordingly if this is not the case on your board.
911
912Development Flow
913----------------
914These notes are for those who want to port U-Boot to a new x86 platform.
915
916Since x86 CPUs boot from SPI flash, a SPI flash emulator is a good investment.
917The Dediprog em100 can be used on Linux. The em100 tool is available here:
918
919   http://review.coreboot.org/p/em100.git
920
921On Minnowboard Max the following command line can be used:
922
923   sudo em100 -s -p LOW -d u-boot.rom -c W25Q64DW -r
924
925A suitable clip for connecting over the SPI flash chip is here:
926
927   http://www.dediprog.com/pd/programmer-accessories/EM-TC-8
928
929This allows you to override the SPI flash contents for development purposes.
930Typically you can write to the em100 in around 1200ms, considerably faster
931than programming the real flash device each time. The only important
932limitation of the em100 is that it only supports SPI bus speeds up to 20MHz.
933This means that images must be set to boot with that speed. This is an
934Intel-specific feature - e.g. tools/ifttool has an option to set the SPI
935speed in the SPI descriptor region.
936
937If your chip/board uses an Intel Firmware Support Package (FSP) it is fairly
938easy to fit it in. You can follow the Minnowboard Max implementation, for
939example. Hopefully you will just need to create new files similar to those
940in arch/x86/cpu/baytrail which provide Bay Trail support.
941
942If you are not using an FSP you have more freedom and more responsibility.
943The ivybridge support works this way, although it still uses a ROM for
944graphics and still has binary blobs containing Intel code. You should aim to
945support all important peripherals on your platform including video and storage.
946Use the device tree for configuration where possible.
947
948For the microcode you can create a suitable device tree file using the
949microcode tool:
950
951  ./tools/microcode-tool -d microcode.dat -m <model> create
952
953or if you only have header files and not the full Intel microcode.dat database:
954
955  ./tools/microcode-tool -H BAY_TRAIL_FSP_KIT/Microcode/M0130673322.h \
956	-H BAY_TRAIL_FSP_KIT/Microcode/M0130679901.h \
957	-m all create
958
959These are written to arch/x86/dts/microcode/ by default.
960
961Note that it is possible to just add the micrcode for your CPU if you know its
962model. U-Boot prints this information when it starts
963
964   CPU: x86_64, vendor Intel, device 30673h
965
966so here we can use the M0130673322 file.
967
968If you platform can display POST codes on two little 7-segment displays on
969the board, then you can use post_code() calls from C or assembler to monitor
970boot progress. This can be good for debugging.
971
972If not, you can try to get serial working as early as possible. The early
973debug serial port may be useful here. See setup_internal_uart() for an example.
974
975During the U-Boot porting, one of the important steps is to write correct PIRQ
976routing information in the board device tree. Without it, device drivers in the
977Linux kernel won't function correctly due to interrupt is not working. Please
978refer to U-Boot doc [15] for the device tree bindings of Intel interrupt router.
979Here we have more details on the intel,pirq-routing property below.
980
981	intel,pirq-routing = <
982		PCI_BDF(0, 2, 0) INTA PIRQA
983		...
984	>;
985
986As you see each entry has 3 cells. For the first one, we need describe all pci
987devices mounted on the board. For SoC devices, normally there is a chapter on
988the chipset datasheet which lists all the available PCI devices. For example on
989Bay Trail, this is chapter 4.3 (PCI configuration space). For the second one, we
990can get the interrupt pin either from datasheet or hardware via U-Boot shell.
991The reliable source is the hardware as sometimes chipset datasheet is not 100%
992up-to-date. Type 'pci header' plus the device's pci bus/device/function number
993from U-Boot shell below.
994
995  => pci header 0.1e.1
996    vendor ID =			0x8086
997    device ID =			0x0f08
998    ...
999    interrupt line =		0x09
1000    interrupt pin =		0x04
1001    ...
1002
1003It shows this PCI device is using INTD pin as it reports 4 in the interrupt pin
1004register. Repeat this until you get interrupt pins for all the devices. The last
1005cell is the PIRQ line which a particular interrupt pin is mapped to. On Intel
1006chipset, the power-up default mapping is INTA/B/C/D maps to PIRQA/B/C/D. This
1007can be changed by registers in LPC bridge. So far Intel FSP does not touch those
1008registers so we can write down the PIRQ according to the default mapping rule.
1009
1010Once we get the PIRQ routing information in the device tree, the interrupt
1011allocation and assignment will be done by U-Boot automatically. Now you can
1012enable CONFIG_GENERATE_PIRQ_TABLE for testing Linux kernel using i8259 PIC and
1013CONFIG_GENERATE_MP_TABLE for testing Linux kernel using local APIC and I/O APIC.
1014
1015This script might be useful. If you feed it the output of 'pci long' from
1016U-Boot then it will generate a device tree fragment with the interrupt
1017configuration for each device (note it needs gawk 4.0.0):
1018
1019   $ cat console_output |awk '/PCI/ {device=$4} /interrupt line/ {line=$4} \
1020	/interrupt pin/ {pin = $4; if (pin != "0x00" && pin != "0xff") \
1021	{patsplit(device, bdf, "[0-9a-f]+"); \
1022	printf "PCI_BDF(%d, %d, %d) INT%c PIRQ%c\n", strtonum("0x" bdf[1]), \
1023	strtonum("0x" bdf[2]), bdf[3], strtonum(pin) + 64, 64 + strtonum(pin)}}'
1024
1025Example output:
1026   PCI_BDF(0, 2, 0) INTA PIRQA
1027   PCI_BDF(0, 3, 0) INTA PIRQA
1028...
1029
1030Porting Hints
1031-------------
1032
1033Quark-specific considerations:
1034
1035To port U-Boot to other boards based on the Intel Quark SoC, a few things need
1036to be taken care of. The first important part is the Memory Reference Code (MRC)
1037parameters. Quark MRC supports memory-down configuration only. All these MRC
1038parameters are supplied via the board device tree. To get started, first copy
1039the MRC section of arch/x86/dts/galileo.dts to your board's device tree, then
1040change these values by consulting board manuals or your hardware vendor.
1041Available MRC parameter values are listed in include/dt-bindings/mrc/quark.h.
1042The other tricky part is with PCIe. Quark SoC integrates two PCIe root ports,
1043but by default they are held in reset after power on. In U-Boot, PCIe
1044initialization is properly handled as per Quark's firmware writer guide.
1045In your board support codes, you need provide two routines to aid PCIe
1046initialization, which are board_assert_perst() and board_deassert_perst().
1047The two routines need implement a board-specific mechanism to assert/deassert
1048PCIe PERST# pin. Care must be taken that in those routines that any APIs that
1049may trigger PCI enumeration process are strictly forbidden, as any access to
1050PCIe root port's configuration registers will cause system hang while it is
1051held in reset. For more details, check how they are implemented by the Intel
1052Galileo board support codes in board/intel/galileo/galileo.c.
1053
1054coreboot:
1055
1056See scripts/coreboot.sed which can assist with porting coreboot code into
1057U-Boot drivers. It will not resolve all build errors, but will perform common
1058transformations. Remember to add attribution to coreboot for new files added
1059to U-Boot. This should go at the top of each file and list the coreboot
1060filename where the code originated.
1061
1062Debugging ACPI issues with Windows:
1063
1064Windows might cache system information and only detect ACPI changes if you
1065modify the ACPI table versions. So tweak them liberally when debugging ACPI
1066issues with Windows.
1067
1068ACPI Support Status
1069-------------------
1070Advanced Configuration and Power Interface (ACPI) [16] aims to establish
1071industry-standard interfaces enabling OS-directed configuration, power
1072management, and thermal management of mobile, desktop, and server platforms.
1073
1074Linux can boot without ACPI with "acpi=off" command line parameter, but
1075with ACPI the kernel gains the capabilities to handle power management.
1076For Windows, ACPI is a must-have firmware feature since Windows Vista.
1077CONFIG_GENERATE_ACPI_TABLE is the config option to turn on ACPI support in
1078U-Boot. This requires Intel ACPI compiler to be installed on your host to
1079compile ACPI DSDT table written in ASL format to AML format. You can get
1080the compiler via "apt-get install iasl" if you are on Ubuntu or download
1081the source from [17] to compile one by yourself.
1082
1083Current ACPI support in U-Boot is basically complete. More optional features
1084can be added in the future. The status as of today is:
1085
1086 * Support generating RSDT, XSDT, FACS, FADT, MADT, MCFG tables.
1087 * Support one static DSDT table only, compiled by Intel ACPI compiler.
1088 * Support S0/S3/S4/S5, reboot and shutdown from OS.
1089 * Support booting a pre-installed Ubuntu distribution via 'zboot' command.
1090 * Support installing and booting Ubuntu 14.04 (or above) from U-Boot with
1091   the help of SeaBIOS using legacy interface (non-UEFI mode).
1092 * Support installing and booting Windows 8.1/10 from U-Boot with the help
1093   of SeaBIOS using legacy interface (non-UEFI mode).
1094 * Support ACPI interrupts with SCI only.
1095
1096Features that are optional:
1097 * Dynamic AML bytecodes insertion at run-time. We may need this to support
1098   SSDT table generation and DSDT fix up.
1099 * SMI support. Since U-Boot is a modern bootloader, we don't want to bring
1100   those legacy stuff into U-Boot. ACPI spec allows a system that does not
1101   support SMI (a legacy-free system).
1102
1103ACPI was initially enabled on BayTrail based boards. Testing was done by booting
1104a pre-installed Ubuntu 14.04 from a SATA drive. Installing Ubuntu 14.04 and
1105Windows 8.1/10 to a SATA drive and booting from there is also tested. Most
1106devices seem to work correctly and the board can respond a reboot/shutdown
1107command from the OS.
1108
1109For other platform boards, ACPI support status can be checked by examining their
1110board defconfig files to see if CONFIG_GENERATE_ACPI_TABLE is set to y.
1111
1112The S3 sleeping state is a low wake latency sleeping state defined by ACPI
1113spec where all system context is lost except system memory. To test S3 resume
1114with a Linux kernel, simply run "echo mem > /sys/power/state" and kernel will
1115put the board to S3 state where the power is off. So when the power button is
1116pressed again, U-Boot runs as it does in cold boot and detects the sleeping
1117state via ACPI register to see if it is S3, if yes it means we are waking up.
1118U-Boot is responsible for restoring the machine state as it is before sleep.
1119When everything is done, U-Boot finds out the wakeup vector provided by OSes
1120and jump there. To determine whether ACPI S3 resume is supported, check to
1121see if CONFIG_HAVE_ACPI_RESUME is set for that specific board.
1122
1123Note for testing S3 resume with Windows, correct graphics driver must be
1124installed for your platform, otherwise you won't find "Sleep" option in
1125the "Power" submenu from the Windows start menu.
1126
1127EFI Support
1128-----------
1129U-Boot supports booting as a 32-bit or 64-bit EFI payload, e.g. with UEFI.
1130This is enabled with CONFIG_EFI_STUB to boot from both 32-bit and 64-bit
1131UEFI BIOS. U-Boot can also run as an EFI application, with CONFIG_EFI_APP.
1132The CONFIG_EFI_LOADER option, where U-Boot provides an EFI environment to
1133the kernel (i.e. replaces UEFI completely but provides the same EFI run-time
1134services) is supported too. For example, we can even use 'bootefi' command
1135to load a 'u-boot-payload.efi', see below test logs on QEMU.
1136
1137  => load ide 0 3000000 u-boot-payload.efi
1138  489787 bytes read in 138 ms (3.4 MiB/s)
1139  => bootefi 3000000
1140  Scanning disk ide.blk#0...
1141  Found 2 disks
1142  WARNING: booting without device tree
1143  ## Starting EFI application at 03000000 ...
1144  U-Boot EFI Payload
1145
1146
1147  U-Boot 2018.07-rc2 (Jun 23 2018 - 17:12:58 +0800)
1148
1149  CPU: x86_64, vendor AMD, device 663h
1150  DRAM:  2 GiB
1151  MMC:
1152  Video: 1024x768x32
1153  Model: EFI x86 Payload
1154  Net:   e1000: 52:54:00:12:34:56
1155
1156  Warning: e1000#0 using MAC address from ROM
1157  eth0: e1000#0
1158  No controllers found
1159  Hit any key to stop autoboot:  0
1160
1161See README.u-boot_on_efi and README.uefi for details of EFI support in U-Boot.
1162
1163TODO List
1164---------
1165- Audio
1166- Chrome OS verified boot
1167
1168References
1169----------
1170[1] http://www.coreboot.org
1171[2] http://www.qemu.org
1172[3] http://www.coreboot.org/~stepan/pci8086,0166.rom
1173[4] http://www.intel.com/content/www/us/en/embedded/design-tools/evaluation-platforms/atom-e660-eg20t-development-kit.html
1174[5] http://www.intel.com/fsp
1175[6] http://www.intel.com/content/www/us/en/secure/intelligent-systems/privileged/e6xx-35-b1-cmc22211.html
1176[7] http://www.ami.com/products/bios-uefi-tools-and-utilities/bios-uefi-utilities/
1177[8] http://en.wikipedia.org/wiki/Microcode
1178[9] http://simplefirmware.org
1179[10] http://www.intel.com/design/archives/processors/pro/docs/242016.htm
1180[11] https://en.wikipedia.org/wiki/GUID_Partition_Table
1181[12] http://events.linuxfoundation.org/sites/events/files/slides/chromeos_and_diy_vboot_0.pdf
1182[13] http://events.linuxfoundation.org/sites/events/files/slides/elce-2014.pdf
1183[14] http://www.seabios.org/SeaBIOS
1184[15] doc/device-tree-bindings/misc/intel,irq-router.txt
1185[16] http://www.acpi.info
1186[17] https://www.acpica.org/downloads
1187

README.xtensa

1U-Boot for the Xtensa Architecture
2==================================
3
4Xtensa Architecture and Diamond Cores
5-------------------------------------
6
7Xtensa is a configurable processor architecture from Tensilica, Inc.
8Diamond Cores are pre-configured instances available for license and
9SoC cores in the same manner as ARM, MIPS, etc.
10
11Xtensa licensees create their own Xtensa cores with selected features
12and custom instructions, registers and co-processors. The custom core
13is configured with Tensilica tools and built with Tensilica's Xtensa
14Processor Generator.
15
16There are an effectively infinite number of CPUs in the Xtensa
17architecture family. It is, however, not feasible to support individual
18Xtensa CPUs in U-Boot. Therefore, there is only a single 'xtensa' CPU
19in the cpu tree of U-Boot.
20
21In the same manner as the Linux port to Xtensa, U-Boot adapts to an
22individual Xtensa core configuration using a set of macros provided with
23the particular core. This is part of what is known as the hardware
24abstraction layer (HAL). For the purpose of U-Boot, the HAL consists only
25of a few header files. These provide CPP macros that customize sources,
26Makefiles, and the linker script.
27
28
29Adding support for an additional processor configuration
30--------------------------------------------------------
31
32The header files for one particular processor configuration are inside
33a variant-specific directory located in the arch/xtensa/include/asm
34directory. The name of that directory starts with 'arch-' followed by
35the name for the processor configuration, for example, arch-dc233c for
36the Diamond DC233 processor.
37
38    core.h	Definitions for the core itself.
39
40The following files are part of the overlay but not used by U-Boot.
41
42    tie.h	Co-processors and custom extensions defined
43		in the Tensilica Instruction Extension (TIE)
44		language.
45    tie-asm.h	Assembly macros to access custom-defined registers
46		and states.
47
48
49Global Data Pointer, Exported Function Stubs, and the ABI
50---------------------------------------------------------
51
52To support standalone applications launched with the "go" command,
53U-Boot provides a jump table of entrypoints to exported functions
54(grep for EXPORT_FUNC). The implementation for Xtensa depends on
55which ABI (or function calling convention) is used.
56
57Windowed ABI presents unique difficulties with the approach based on
58keeping global data pointer in dedicated register. Because the register
59window rotates during a call, there is no register that is constantly
60available for the gd pointer. Therefore, on xtensa gd is a simple
61global variable. Another difficulty arises from the requirement to have
62an 'entry' at the beginning of a function, which rotates the register
63file and reserves a stack frame. This is an integral part of the
64windowed ABI implemented in hardware. It makes using a jump table to an
65arbitrary (separately compiled) function a bit tricky. Use of a simple
66wrapper is also very tedious due to the need to move all possible
67register arguments and adjust the stack to handle arguments that cannot
68be passed in registers. The most efficient approach is to have the jump
69table perform the 'entry' so as to pretend it's the start of the real
70function. This requires decoding the target function's 'entry'
71instruction to determine the stack frame size, and adjusting the stack
72pointer accordingly, then jumping into the target function just after
73the 'entry'. Decoding depends on the processor's endianness so uses the
74HAL. The implementation (12 instructions) is in examples/stubs.c.
75
76
77Access to Invalid Memory Addresses
78----------------------------------
79
80U-Boot does not check if memory addresses given as arguments to commands
81such as "md" are valid. There are two possible types of invalid
82addresses: an area of physical address space may not be mapped to RAM
83or peripherals, or in the presence of MMU an area of virtual address
84space may not be mapped to physical addresses.
85
86Accessing first type of invalid addresses may result in hardware lockup,
87reading of meaningless data, written data being ignored or an exception,
88depending on the CPU wiring to the system. Accessing second type of
89invalid addresses always ends with an exception.
90
91U-Boot for Xtensa provides a special memory exception handler that
92reports such access attempts and resets the board.
93
94
95------------------------------------------------------------------------------
96Chris Zankel
97Ross Morley
98

README.zfs

1This patch series adds support for ZFS listing and load to u-boot.
2
3To Enable zfs ls and load commands, modify the board specific config file with
4#define CONFIG_CMD_ZFS
5
6Steps to test:
7
81. After applying the patch, zfs specific commands can be seen
9   in the boot loader prompt using
10	UBOOT #help
11
12	zfsload- load binary file from a ZFS file system
13	zfsls  - list files in a directory (default /)
14
152. To list the files in zfs pool, device or partition, execute
16	zfsls <interface> <dev[:part]> [POOL/@/dir/file]
17	For example:
18	UBOOT #zfsls mmc 0:5 /rpool/@/usr/bin/
19
203. To read and load a file from an ZFS formatted partition to RAM, execute
21	zfsload <interface> <dev[:part]> [addr] [filename] [bytes]
22	For example:
23	UBOOT #zfsload mmc 2:2 0x30007fc0 /rpool/@/boot/uImage
24
25References :
26	-- ZFS GRUB sources from Solaris GRUB-0.97
27	-- GRUB Bazaar repository
28
29Jorgen Lundman <lundman at lundman.net> 2012.
30

README.zynq

1# SPDX-License-Identifier: GPL-2.0+
2#
3# Xilinx ZYNQ U-Boot
4#
5# (C) Copyright 2013 Xilinx, Inc.
6
71. About this
8
9This document describes the information about Xilinx Zynq U-Boot -
10like supported boards, ML status and TODO list.
11
122. Zynq boards
13
14Xilinx Zynq-7000 All Programmable SoCs enable extensive system level
15differentiation, integration, and flexibility through hardware, software,
16and I/O programmability.
17
18* zc702 (single qspi, gem0, mmc) [1]
19* zc706 (dual parallel qspi, gem0, mmc) [2]
20* zed (single qspi, gem0, mmc) [3]
21* microzed (single qspi, gem0, mmc) [4]
22* zc770
23  - zc770-xm010 (single qspi, gem0, mmc)
24  - zc770-xm011 (8 or 16 bit nand)
25  - zc770-xm012 (nor)
26  - zc770-xm013 (dual parallel qspi, gem1)
27
283. Building
29
30 ex. configure and build for zc702 board
31   $ make zynq_zc702_config
32   $ make
33
344. Bootmode
35
36Zynq has a facility to read the bootmode from the slcr bootmode register
37once user is setting through jumpers on the board - see page no:1546 on [5]
38
39All possible bootmode values are defined in Table 6-2:Boot_Mode MIO Pins
40on [5].
41
42board_late_init() will read the bootmode values using slcr bootmode register
43at runtime and assign the modeboot variable to specific bootmode string which
44is intern used in autoboot.
45
46SLCR bootmode register Bit[3:0] values
47#define ZYNQ_BM_NOR		0x02
48#define ZYNQ_BM_SD		0x05
49#define ZYNQ_BM_JTAG		0x0
50
51"modeboot" variable can assign any of "norboot", "sdboot" or "jtagboot"
52bootmode strings at runtime.
53
545. Mainline status
55
56- Added basic board configurations support.
57- Added zynq u-boot bsp code - arch/arm/cpu/armv7/zynq
58- Added zynq boards named - zc70x, zed, microzed, zc770_xm010/xm011/xm012/xm013
59- Added zynq drivers:
60  serial - drivers/serial/serial_zynq.c
61  net - drivers/net/zynq_gem.c
62  mmc - drivers/mmc/zynq_sdhci.c
63  spi - drivers/spi/zynq_spi.c
64  qspi - drivers/spi/zynq_qspi.c
65  i2c - drivers/i2c/zynq_i2c.c
66  nand - drivers/mtd/nand/raw/zynq_nand.c
67- Done proper cleanups on board configurations
68- Added basic FDT support for zynq boards
69- d-cache support for zynq_gem.c
70
716. TODO
72
73- Add FDT support on individual drivers
74
75[1] http://www.xilinx.com/products/boards-and-kits/EK-Z7-ZC702-G.htm
76[2] http://www.xilinx.com/products/boards-and-kits/EK-Z7-ZC706-G.htm
77[3] http://zedboard.org/product/zedboard
78[4] http://zedboard.org/product/microzed
79[5] http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf
80
81--
82Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
83Sun Dec 15 14:52:41 IST 2013
84