Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

The goal of the document is to illustrate how to build SP7021 Linux image for booting from SPI-NOR flash on SP7021 boards. SP7021 build (make) system supports two types of root file-system for SPI-NOR flash. One is initramfs file-system and other is jffs2 file-system. If you choose initramfs file-system, build system merges root file-system into Linux kernel. The whole kernel (kernel + root file-system) is loaded into and operates in DRAM directly. The advantage of initramfs file-system is that accessing speed is very fast. But since it is stored in DRAM, all changes disappear when power off. If you choose jffs2 file-system, root file-system is compressed and is stored in rootfs partition of SPI-NOR flash. The drawback of jffs2 file-system is that accessing speed is slow. But all changes are kept in SPI-NOR flash when power off.

To build image of SPI-NOR flash, first, you need to get source files of SP7021 from git server of SP7021. Second, you need to run make to build all images of SP7021. After make processes complete successfully, it will create two binary files named spi_all.bin and ISPBOOOT.BIN. Third, you need to either use flash programmer to write the spi_all.bin to SPI-NOR flash or copy ISPBOOOT.BIN to an USB drive to in-system program SPI-NOR flash. Finally, set DIP-SW to “boot from SPI-NOR flash”. You are now ready to turn on SP7021 power to boot Linux from SPI-NOR flash. For details, please follow the following steps.

1. Download source files

Source files of SP7021 can be downloaded from GitHub or Yocto server of SP7021. Refer to https://github.com/sunplus-plus1/SP7021 or 2. HOW TO GET SOURCE FILE AND PACKAGE. Refer to report of ll command for the contents of top folder of source of SP7021:

wellslu@scdiu3:~/q628/nor$ ll
total 52
drwxr-xr-x 12 wellslu sp 4096 Oct 15 12:01 ./
drwxr-xr-x 19 wellslu sp 4096 Oct 15 11:53 ../
drwxr-xr-x  8 wellslu sp 4096 Apr 27 18:51 boot/
drwxr-xr-x  4 wellslu sp 4096 Aug 25 12:05 build/
drwxr-xr-x  7 wellslu sp 4096 Jul 27 12:23 crossgcc/
drwxr-xr-x  6 wellslu sp 4096 Apr 27 18:51 eCos/
drwxr-xr-x  9 wellslu sp 4096 Jun  5 09:30 freertos/
drwxr-xr-x  8 wellslu sp 4096 Aug 11 16:40 ipack/
drwxr-xr-x  7 wellslu sp 4096 Apr 27 18:51 linux/
-r--r--r--  1 wellslu sp   23 Apr 27 18:51 Makefile
drwxr-xr-x  4 wellslu sp 4096 Apr 27 18:51 nonos/
drwxr-xr-x  7 wellslu sp 4096 Apr 27 18:51 .repo/
drwxr-xr-x  3 wellslu sp 4096 Jun 29 09:44 yocto/

2. Configure environment

Run make config command on top folder. After configuration menu pops up, first, choose a board you want to build image for. For example, press 1 to choose “SP7021 Ev Board”. Second, press 1 to choose to use C chip (quad core CA7). Finally, press 3 (jffs2) or 4 (initramfs) to choose to boot from SPI-NOR flash and then enter to start to configure building environment. Refer to screenshot below,

make config starts to build compiler environment. It may take a few minutes. Please wait for make config completing the processes.

3. Modify device-tree source file

This step is for jffs2 (3) root file-system. Please skip this step if you are using initramfs (4) root file-system.

Modify device-tree node sp_spinor0 in device-tree source file linux/kernel/arch/arm/boot/dts/sp7021-ev.dts to setup operating frequency SPI-NOR flash and pins as shown below:

&sp_spinor0 {
	spi-max-frequency = <50000000>;
	spi-chip-selection = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&spi_flash2_mux &spi_fla4b2_mux>;
}

where operating frequency of SPI-NOR flash is 50 MHz and SPI-NOR flash is installed in pin-group: spi_flash2_mux and spi_fla4b2_mux. Set them base on your real hardware installation.

4. Remove SECT_4K flag of SPI-NOR flash

This step is for jffs2 (3) root file-system. Please skip this step if you are using initramfs (4) root file-system.

Some SPI-NOR flashes support 4 kB sector-erase, but mkfs.jffs2 -e option does not support 4 kB size of erase. Please remove SECT_4K flag in C file “driver/mtd/spi-nor/spi-nor.c” if your NOR flash support 4 KB sector-erase . Refer to screenshot of diff report, SECT_4K flag of Winbond w25q128 flashes are removed.

5. Build SPI-NOR image

Run make all command to start to create all images of SP7021. It may take several minutes to complete. At almost final stage of building processes, make will ask you to select the use of iBoot,

Please press x and enter to continue the processes. After make all completes, you will see screenshot like:

Two binary files spi_all.bin and ISPBOOOT.BIN are built and copied to folder out. You Refer to screenshot of output of ll out command:

Binary file spi_all.bin is a pure image of SPI-NOR flash. You can use a flash programmer to write the image into an SPI-NOR flash. Refer to step 6 for detail.

Binary file ISPBOOOT.BIN consists of boot-loader (x-boot), u-boot and image of SPI-NOR flash. You can copy it to an USB drive to in-system program SPI-NOR image to SPI-NOR flash on SP7021 boards. Refer to step 7 for detail.

6. Write your SPI-NOR flash using flash programmer

Put your SPI-NOR flash chip into socket of a flash programmer. Be careful about the pin 1 position of the chip. It should be at the same corner of pin 1 of socket. Refer to picture below, an SPI-NOR flash is placed at socket of a GZUT USB flash programmer.

Run flash programmer application, for example, run GZUT_OnePro in Windows. After application window pops up, then load binary file, spi_all.bin. Press “Auto” to start to write processes automatically (including erase, write and verify). Refer to screenshot below, a Winbond 128 Mibit (16 MiB) flash chip (W25Q128) has been programmed and verified successfully.

Remove the SPI-NOR flash chip from socket. Plug the written SPI-NOR flash into socket of SPI-NOR flash of SP7021 boards.

Note that the size of spi_all.bin is about 12 MiB. So, size of SPI-NOR flash chip should be 16 MiB (or 128 Mibit) or greater.

7. In-system program SPI-NOR flash

First, copy the file ISPBOOOT.BIN to root directory of an USB flash drive. Note that the USB flash drive should be formatted to DOS/Windows FAT32 file-system. SP7021 can only load files from an USB flash drive which is formatted to FAT32 file-system. Also note that FAT32 file-system should be in the first or the sole partition of the USB flash drive.

Second, set DIP-SW (boot-select switch) to “boot from USB”. For example, if you are using SP7021 Ev Board, please set DIP-SW to OFF-OFF-OFF-OFF-ON-OFF (1-1-1-1-0-1) for booting from USB flash drive. Refer to picture below, DIP-SW is set to OFF-OFF-OFF-OFF-ON-OFF.

Refer to Selection of boot devices of SP7021 for details of boot selection of SP7021.

Third, plug your USB flash drive which contains ISPBOOOT.BIN into either USB socket of SP7021 board.

Finally, turn on power of SP7021 board. After power on, SP7021 starts to ”boot from USB” drive. It first loads boot-loader (x-boot) from ISPBOOOT.BIN in USB flash drive. Boot-loader loads u-boot. u-boot then runs built-in scripts which writes image to SPI-NOR flash and verify it. The processes takes 1 ~ 2 minutes. Please wait for the processes completing. At the end of processes, you will see screen like:

“ISP all: Done” means in-system program processes are done successfully.

Note that in-system-program (ISP) of SP7021 does not support USB hub. The USB flash drive for ISP should be plugged into USB socket of SP7021 board directly.

If you are using Banana Pi BPI-F2P boards, please plug you USB flash drive to the micro USB socket for ISP. It is the only USB socket that is connected to SP7021 directly.

8. Set DIP-SW to “boot from SPI-NOR flash”

Set DIP-SW (boot-select switch) to “boot from SPI-NOR flash”. For example, if you are using SP7021 Ev Board, please set DIP-SW to OFF-OFF-ON-OFF-ON-OFF (1-1-0-1-0-1) for booting from SPI-NOR flash. Refer to picture below, DIP-SW is set to OFF-OFF-ON-OFF-ON-OFF.

Now, you are ready to boot SP7021 Linux from SPI-NOR flash. Turn on power of SP7021 board to boot system.

Appendix A. Layout of partitions of SPI-NOR flash

Refer to layout of partitions of a 16 MiB SPI-NOR flash. There are 6 partitions in SPI-NOR flash. The figures in parenthesis of each partition is the size of the partition. Note that root file-system of Linux is built into kernel.

Appendix B. Log of Booting from SPI-NOR (jffs2) flash (from U-Boot to Linux)

U-Boot 2019.04-gead4713-dirty (Nov 25 2020 - 10:38:24 +0800)

CONFIG_SYS_CACHELINE_SIZE: 64
Model: SP7021/CA7/Ev
DRAM:  512 MiB
clk@osc0        :   27000000 Hz
clk@0           :   13500000 Hz
clk@A_pll0      : 2000000000 Hz
plla            :  135475200 Hz
plle            :   50000000 Hz
plle_2p5        :    2500000 Hz
plle_25         :   25000000 Hz
plle_112p5      :  112500000 Hz
pllf            :  202500000 Hz
plltv           :  148500000 Hz
plltv_a         :  148500000 Hz
pllsys          :  202500000 Hz
SPI:   Manufacturer id = 0x00, Device id = 0x4018
MMC:
In:    serial
Out:   serial
Err:   serial

Reason(s) of reset: REG(116, 22): 0x0002

After cleaning  REG(116, 22): 0x0000

arch/arm/mach-pentagram/cpu.c, arch_misc_init: TBD.
Net:
Warning: l2sw@0x9c108000 using MAC address from ROM
eth0: l2sw@0x9c108000
Hit any key to stop autoboot:  0
[scr] bootcmd started
9e809408: 00000011                               ....
[scr] romter boot
   Image Name:   uboot
   Image Type:   ARM Linux Sunplus Quick Boot Image (uncompressed)
   Data Size:    49088 Bytes = 47.9 KiB
   Load Address: 00010040
   Entry Point:  00010040
   Verifying Checksum ... OK
[u-boot] nonos_B address 0x00010000  nonos_size= 49088
SF: Detected W25Q128BV with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x200000, size 0x3c68e8
SF: 3959016 bytes @ 0x200000 Read: OK
## Booting kernel from Legacy Image at 00307fc0 ...
   Image Name:   Linux-5.4.35-g301db42
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3958880 Bytes = 3.8 MiB
   Load Address: 00308000
   Entry Point:  00308000
   Verifying Checksum ... OK

 ******OTP Secure Boot is OFF, return success******
## Flattened Device Tree blob at 1f902f38
   Booting using the fdt blob at 0x1f902f38
   XIP Kernel Image ... OK
   Loading Device Tree to 1f8f9000, end 1f900f70 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.35-g301db42 (wellslu@scdiu3) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)) #18 SMP PREEMPT Wed Nov 25 10:38:58 CST 2020
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: SP7021/CA7/Ev
[    0.000000] printk: bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] sp_map_io
[    0.000000] P_REG: [9c000000-9dffffff] -> [f8000000-f9ffffff]
[    0.000000] C_REG: [9ec00000-9effffff] -> [fa000000-fa3fffff]
[    0.000000] percpu: Embedded 15 pages/cpu s30348 r8192 d22900 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129540
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk root=/dev/mtdblock6 rw rootfstype=jffs2 user_debug=255 rootwait mtdparts=9c000b00.spinor:64k@0(iboot)ro,64k(xboot)ro,128k(dtb),768k(uboot),1m(nonos),0x3d0000(kernel),-(rootfs)
[    0.000000] printk: log_buf_len individual max cpu contribution: 4096 bytes
[    0.000000] printk: log_buf_len total cpu_extra contributions: 12288 bytes
[    0.000000] printk: log_buf_len min size: 16384 bytes
[    0.000000] printk: log_buf_len: 32768 bytes
[    0.000000] printk: early log buf free: 14580(88%)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 508128K/522240K available (4096K kernel code, 817K rwdata, 2040K rodata, 1024K init, 222K bss, 14112K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 205
[    0.000000] random: get_random_bytes called from start_kernel+0x1c3/0x308 with crng_init=0
[    0.000000] @@@ Sunplus clock init
[    0.000000] plla                135475200
[    0.000000] plle                50000000
[    0.000000] plle_2p5            2500000
[    0.000000] plle_25             25000000
[    0.000000] plle_112p5          112500000
[    0.000000] pllf                202500000
[    0.000000] plltv               148500000
[    0.000000] pllsys              202500000
[    0.000000] arch_timer: cp15 timer(s) running at 27.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x63a1e71a3, max_idle_ns: 440795203123 ns
[    0.000009] sched_clock: 56 bits at 27MHz, resolution 37ns, wraps every 4398046511093ns
[    0.008133] Switching to timer-based delay loop, resolution 37ns
[    0.014952] Console: colour dummy device 80x30
[    0.019495] Calibrating delay loop (skipped), value calculated using timer frequency.. 54.00 BogoMIPS (lpj=270000)
[    0.030022] pid_max: default: 32768 minimum: 301
[    0.034980] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.042420] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.051252] CPU: Testing write buffer coherency: ok
[    0.056861] CPU0: update cpu_capacity 1024
[    0.061014] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.126983] Setting up static identity map for 0x400000 - 0x400054
[    0.133408] rcu: Hierarchical SRCU implementation.
[    0.178391] smp: Bringing up secondary CPUs ...
[    0.238840] CPU1: update cpu_capacity 1024
[    0.238849] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.318786] CPU2: update cpu_capacity 1024
[    0.318795] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.398870] CPU3: update cpu_capacity 1024
[    0.398878] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.398993] smp: Brought up 1 node, 4 CPUs
[    0.432828] SMP: Total of 4 processors activated (216.00 BogoMIPS).
[    0.439193] CPU: All CPU(s) started in SVC mode.
[    0.444645] devtmpfs: initialized
[    0.454283] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.463044] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.473073] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.480509] pinctrl core: initialized pinctrl subsystem
[    0.486627] NET: Registered protocol family 16
[    0.491857] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.500635] sp_init
[    0.502767] av1_stc: 0x0004e117
[    0.505949] P-chip: sys = 202MHz, cpio_ctrl = (16bit, DDR)
[    0.511551] C-chip: core = 931MHz, sys = 465MHz, pllio = 1998MHz, cpio_bus = 399MHz
[    0.519316] apply partial clken to save power
[    0.524166] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.532286] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.538249] 1: ext0-mask=0xf
[    0.541172] 2: ext1-mask=0xe
[    0.561135] sppctl pctl: funcs: 156 unq_grps: 140
[    0.566190] SP7021 PinCtl by Sunplus/Tibbo Tech.(C) 2020
[    0.600099] SCSI subsystem initialized
[    0.609950] usbcore: registered new interface driver usbfs
[    0.615590] usbcore: registered new interface driver hub
[    0.621144] usbcore: registered new device driver usb
[    0.626492] videodev: Linux video capture interface: v2.00
[    0.632999] sunplus,sp7021-ocotp 9c00af00.otp: by Sunplus (C) 2020
[    0.641060] clocksource: Switched to clocksource arch_sys_counter
[    0.660875] register sunplus_usb_phy0_driver
[    0.665778] uphy0_irq:36
[    0.674833] register sunplus_usb_phy1_driver
[    0.679359] uphy1_irq:37
[    0.688364] register sunplus_usb_otg0_driver
[    0.693463] register sunplus_usb_otg1_driver
[    0.711908] HDMITX installed
[    0.714907] HDMI plug in
[    0.716109] NET: Registered protocol family 2
[    0.722814] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.731329] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.739228] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.746538] TCP: Hash tables configured (established 4096 bind 4096)
[    0.753188] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.759877] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.767285] NET: Registered protocol family 1
[    0.791501] RPC: Registered named UNIX socket transport module.
[    0.797506] RPC: Registered udp transport module.
[    0.802332] RPC: Registered tcp transport module.
[    0.807099] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.814694] hw perfevents: no interrupt-affinity property for /arm-pmu, guessing.
[    0.822767] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available
[    0.832922] Initialise system trusted keyrings
[    0.837721] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.845783] NFS: Registering the id_resolver key type
[    0.850939] Key type id_resolver registered
[    0.855208] Key type id_legacy registered
[    0.859330] jffs2: version 2.2. (NAND) c 2001-2006 Red Hat, Inc.
[    0.865844] Key type asymmetric registered
[    0.870002] Asymmetric key parser 'x509' registered
[    0.875075] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.882597] io scheduler mq-deadline registered
[    0.887188] io scheduler kyber registered
[    0.894393] K_TTYS: sp_uart0's Rx is in PIO mode.
[    0.899172] K_TTYS: sp_uart0's Tx is in PIO mode.
[    0.904037] 9c000900.serial: ttyS0 at MMIO 0x9c000900 (irq = 53, base_baud = 1687500) is a sp_uart0
[    0.913288] printk: console [ttyS0] enabled
[    0.913288] printk: console [ttyS0] enabled
[    0.921738] printk: bootconsole [earlycon0] disabled
[    0.921738] printk: bootconsole [earlycon0] disabled
[    0.947462] loop: module loaded
[    0.950450] sp-spi-nor 9c000b00.spinor: w25q128 (16384 Kbytes)
[    0.950595] 7 cmdlinepart partitions found on MTD device 9c000b00.spinor
[    0.951959] Creating 7 MTD partitions on "9c000b00.spinor":
[    0.957480] 0x000000000000-0x000000010000 : "iboot"
[    0.972503] 0x000000010000-0x000000020000 : "xboot"
[    0.982390] 0x000000020000-0x000000040000 : "dtb"
[    0.992365] 0x000000040000-0x000000100000 : "uboot"
[    1.002367] 0x000000100000-0x000000200000 : "nonos"
[    1.012379] 0x000000200000-0x0000005d0000 : "kernel"
[    1.022330] 0x0000005d0000-0x000001000000 : "rootfs"
[    1.042968] libphy: Fixed MDIO Bus: probed
[    1.043050] CAN device driver interface
[    1.043735] [L2SW] L2 switch mode = 0
[    1.044023] [L2SW] HW Addr = 00:22:60:00:88:30
[    1.048605] [L2SW] Registered net device "eth0" successfully.
[    1.053903] libphy: sunplus_mii_bus: probed
[    1.059034] net eth0: could not add device link to 9c108000.l2sw-mii:01 err -17
[    1.066438] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.071498] ehci-platform: EHCI generic platform driver
[    1.076960] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.082845] ohci-platform: OHCI generic platform driver
[    1.088177] register ehci0_hcd_sunplus_driver
[    1.092631] ehci0-sunplus 9c102100.usb: Generic Platform EHCI Controller
[    1.099021] ehci0-sunplus 9c102100.usb: new USB bus registered, assigned bus number 1
[    1.107045] ehci0-sunplus 9c102100.usb: irq 14, io mem 0x9c102100
[    1.141059] ehci0-sunplus 9c102100.usb: USB 2.0 started, EHCI 1.10
[    1.142325] hub 1-0:1.0: USB hub found
[    1.142434] hub 1-0:1.0: 1 port detected
[    1.144398] register ehci1_hcd_sunplus_driver
[    1.148311] ehci1-sunplus 9c103100.usb: Generic Platform EHCI Controller
[    1.154797] ehci1-sunplus 9c103100.usb: new USB bus registered, assigned bus number 2
[    1.162741] ehci1-sunplus 9c103100.usb: irq 17, io mem 0x9c103100
[    1.191036] ehci1-sunplus 9c103100.usb: USB 2.0 started, EHCI 1.10
[    1.192106] hub 2-0:1.0: USB hub found
[    1.192215] hub 2-0:1.0: 1 port detected
[    1.194323] register ohci0_hcd_sunplus_driver
[    1.198236] ohci_id:1,irq:15
[    1.200900] ohci0-sunplus 9c102080.usb: Generic Platform OHCI Controller
[    1.207636] ohci0-sunplus 9c102080.usb: new USB bus registered, assigned bus number 3
[    1.215553] ohci0-sunplus 9c102080.usb: irq 15, io mem 0x9c102080
[    1.293933] hub 3-0:1.0: USB hub found
[    1.294040] hub 3-0:1.0: 1 port detected
[    1.294778] register ohci1_hcd_sunplus_driver
[    1.295112] ohci_id:2,irq:18
[    1.297629] ohci1-sunplus 9c103080.usb: Generic Platform OHCI Controller
[    1.304494] ohci1-sunplus 9c103080.usb: new USB bus registered, assigned bus number 4
[    1.312316] ohci1-sunplus 9c103080.usb: irq 18, io mem 0x9c103080
[    1.383877] hub 4-0:1.0: USB hub found
[    1.383984] hub 4-0:1.0: 1 port detected
[    1.384875] usbcore: registered new interface driver usb-storage
[    1.386560] register sunplus_driver_udc
[    1.386560]
[    1.392856] >>> sp_udc_alloc_request...
[    1.392856]
[    1.396903] <<< sp_udc_alloc_request...
[    1.396903]
[    1.402496] zero gadget: Gadget Zero, version: Cinco de Mayo 2008
[    1.408258] zero gadget: zero ready
[    1.412523] mousedev: PS/2 mouse device common for all mice
[    1.418656] sp7021-rtc 9c003a00.serial: registered as rtc0
[    1.422771] [RTC] Info: sp7021-rtc loaded
[    1.427222] [DISP][_display_probe:2845] disp probe ...
[    1.432039] [DISP]irq num:4
[    1.435887] [DISP][_display_probe:3014] disp probe done
[    1.440356] usbcore: registered new interface driver uvcvideo
[    1.445741] USB Video Class driver (1.1.1)
[    1.450770] hidraw: raw HID events driver (C) Jiri Kosina
[    1.455642] usbcore: registered new interface driver usbhid
[    1.460688] usbhid: USB HID core driver
[    1.464523] exFAT: Version 1.3.0
[    1.468458] NET: Registered protocol family 10
[    1.473719] Segment Routing with IPv6
[    1.475870] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.483136] NET: Registered protocol family 17
[    1.486104] can: controller area network core (rev 20170425 abi 9)
[    1.492699] NET: Registered protocol family 29
[    1.496663] can: raw protocol (rev 20170425)
[    1.500905] can: broadcast manager protocol (rev 20170425 t)
[    1.506567] can: netlink gateway (rev 20190810) max_hops=1
[    1.512227] NET: Registered protocol family 37
[    1.516474] Key type dns_resolver registered
[    1.520717] Key type ceph registered
[    1.541076] libceph: loaded (mon/osd proto 15/24)
[    1.541443] Registering SWP/SWPB emulation handler
[    1.541915] Loading compiled-in X.509 certificates
[    1.564569] sp7021-fb soc@B:fb_device: [_sp7021_fb_create_device:289] mem VA 0xe08cf000(PA 0x1e000000), Palette VA 0x0(PA 0x40000000), UI Res 720x480, size 2768896 + 0
[    1.568717] sp7021-rtc 9c003a00.serial: setting system clock to 1970-01-01T00:00:04 UTC (4)
[    1.628250] random: fast init done
[    2.370840] VFS: Mounted root (jffs2 filesystem) on device 31:6.
[    2.371659] devtmpfs: mounted
[    2.373728] Freeing unused kernel memory: 1024K
[    2.373961] Run /sbin/init as init process
/etc/init.d/rcS starts...
Mounting other filesystems ...
rc.extra [bg]
End of /etc/init.d/rcS
0x00005DDC
0x00000008

extra done
login[641]: root login on 'console'
~ #
~ # df -hT
Filesystem           Type            Size      Used Available Use% Mounted on
/dev/root            jffs2          10.2M      6.0M      4.2M  59% /
devtmpfs             devtmpfs      248.1M         0    248.1M   0% /dev
tmpfs                tmpfs         248.6M         0    248.6M   0% /dev/shm
tmpfs                tmpfs         248.6M         0    248.6M   0% /tmp
~ #

Appendix C. Log of Booting from SPI-NOR (initramfs) flash (from U-Boot to Linux)

U-Boot 2019.04-g034e481-dirty (Nov 19 2020 - 17:35:00 +0800)

CONFIG_SYS_CACHELINE_SIZE: 64
Model: SP7021/CA7/Ev
DRAM:  512 MiB
clk@osc0        :   27000000 Hz
clk@0           :   13500000 Hz
clk@A_pll0      : 2000000000 Hz
plla            :  135475200 Hz
plle            :   50000000 Hz
plle_2p5        :    2500000 Hz
plle_25         :   25000000 Hz
plle_112p5      :  112500000 Hz
pllf            :  202500000 Hz
plltv           :  148500000 Hz
plltv_a         :  148500000 Hz
pllsys          :  202500000 Hz
SPI:   Manufacturer id = 0x00, Device id = 0x4018
In:    serial
Out:   serial
Err:   serial

Reason(s) of reset: REG(116, 22): 0x0002

After cleaning  REG(116, 22): 0x0000

arch/arm/mach-pentagram/cpu.c, arch_misc_init: TBD.
Net:
Warning: l2sw@0x9c108000 using MAC address from ROM
eth0: l2sw@0x9c108000
Hit any key to stop autoboot:  0
[scr] bootcmd started
9e809408: 00000011                               ....
[scr] romter boot
   Image Name:   uboot
   Image Type:   ARM Linux Sunplus Quick Boot Image (uncompressed)
   Data Size:    49088 Bytes = 47.9 KiB
   Load Address: 00010040
   Entry Point:  00010040
   Verifying Checksum ... OK
[u-boot] nonos_B address 0x00010000  nonos_size= 49088
## Booting kernel from Legacy Image at 00307fc0 ...
   Image Name:   Linux-5.4.35-g49bbe95
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8662952 Bytes = 8.3 MiB
   Load Address: 00308000
   Entry Point:  00308000
   Verifying Checksum ... OK

 ******OTP Secure Boot is OFF, return success******
## Flattened Device Tree blob at 1f906f38
   Booting using the fdt blob at 0x1f906f38
   XIP Kernel Image ... OK
   Loading Device Tree to 1f8fd000, end 1f904f70 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.35-g49bbe95 (wellslu@scdiu3) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)) #5 SMP PREEMPT Thu Nov 19 17:35:41 CST 2020
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: SP7021/CA7/Ev
[    0.000000] printk: bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] sp_map_io
[    0.000000] P_REG: [9c000000-9dffffff] -> [f8000000-f9ffffff]
[    0.000000] C_REG: [9ec00000-9effffff] -> [fa000000-fa3fffff]
[    0.000000] On node 0 totalpages: 130560
[    0.000000]   Normal zone: 1020 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 130560 pages, LIFO batch:31
[    0.000000] percpu: Embedded 15 pages/cpu s30348 r8192 d22900 u61440
[    0.000000] pcpu-alloc: s30348 r8192 d22900 u61440 alloc=15*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129540
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/ram rw loglevel=8 user_debug=255 earlyprintk
[    0.000000] printk: log_buf_len individual max cpu contribution: 4096 bytes
[    0.000000] printk: log_buf_len total cpu_extra contributions: 12288 bytes
[    0.000000] printk: log_buf_len min size: 16384 bytes
[    0.000000] printk: log_buf_len: 32768 bytes
[    0.000000] printk: early log buf free: 14716(89%)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 499952K/522240K available (3072K kernel code, 807K rwdata, 1900K rodata, 10240K init, 219K bss, 22288K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 205
[    0.000000] random: get_random_bytes called from start_kernel+0x1c3/0x344 with crng_init=0
[    0.000000] @@@ Sunplus clock init
[    0.000000] plla                135475200
[    0.000000] plle                50000000
[    0.000000] plle_2p5            2500000
[    0.000000] plle_25             25000000
[    0.000000] plle_112p5          112500000
[    0.000000] pllf                202500000
[    0.000000] plltv               148500000
[    0.000000] pllsys              202500000
[    0.000000] arch_timer: cp15 timer(s) running at 27.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x63a1e71a3, max_idle_ns: 440795203123 ns
[    0.000009] sched_clock: 56 bits at 27MHz, resolution 37ns, wraps every 4398046511093ns
[    0.008125] Switching to timer-based delay loop, resolution 37ns
[    0.014938] Console: colour dummy device 80x30
[    0.019487] Calibrating delay loop (skipped), value calculated using timer frequency.. 54.00 BogoMIPS (lpj=270000)
[    0.030005] pid_max: default: 32768 minimum: 301
[    0.034969] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.042409] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.051264] CPU: Testing write buffer coherency: ok
[    0.056876] CPU0: update cpu_capacity 1024
[    0.061027] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.126996] Setting up static identity map for 0x400000 - 0x400054
[    0.133415] rcu: Hierarchical SRCU implementation.
[    0.178396] smp: Bringing up secondary CPUs ...
[    0.238839] CPU1: update cpu_capacity 1024
[    0.238849] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.318795] CPU2: update cpu_capacity 1024
[    0.318805] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.398879] CPU3: update cpu_capacity 1024
[    0.398886] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.398998] smp: Brought up 1 node, 4 CPUs
[    0.432814] SMP: Total of 4 processors activated (216.00 BogoMIPS).
[    0.439179] CPU: All CPU(s) started in SVC mode.
[    0.444595] devtmpfs: initialized
[    0.453926] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.462708] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.472730] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.480162] pinctrl core: initialized pinctrl subsystem
[    0.486237] NET: Registered protocol family 16
[    0.491420] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.499746] sp_init
[    0.501878] av1_stc: 0x0006aed5
[    0.505059] P-chip: sys = 202MHz, cpio_ctrl = (16bit, DDR)
[    0.510649] C-chip: core = 931MHz, sys = 465MHz, pllio = 1998MHz, cpio_bus = 399MHz
[    0.518405] apply partial clken to save power
[    0.523239] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.531356] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.537314] 1: ext0-mask=0xf
[    0.540235] 2: ext1-mask=0xe
[    0.560008] sppctl pctl: funcs: 156 unq_grps: 140
[    0.565061] SP7021 PinCtl by Sunplus/Tibbo Tech.(C) 2020
[    0.596834] SCSI subsystem initialized
[    0.606557] usbcore: registered new interface driver usbfs
[    0.612228] usbcore: registered new interface driver hub
[    0.617844] usbcore: registered new device driver usb
[    0.623173] videodev: Linux video capture interface: v2.00
[    0.629695] sunplus,sp7021-ocotp 9c00af00.otp: by Sunplus (C) 2020
[    0.637707] clocksource: Switched to clocksource arch_sys_counter
[    0.656899] register sunplus_usb_phy0_driver
[    0.661674] uphy0_irq:36
[    0.670711] register sunplus_usb_phy1_driver
[    0.675225] uphy1_irq:37
[    0.684053] register sunplus_usb_otg0_driver
[    0.688565] #@#OTG: @@@ otg reg -1676663808 112 irq 11 10000
[    0.694471] #@#OTG: Init is B device
[    0.698488] register sunplus_usb_otg1_driver
[    0.703019] #@#OTG: @@@ otg reg -1676659712 112 irq 10 10000
[    0.727696] #@#OTG: Init is B device
[    0.732043] HDMITX installed
[    0.735014] HDMI plug in
[    0.738728] NET: Registered protocol family 2
[    0.744001] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.752522] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.760447] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.767755] TCP: Hash tables configured (established 4096 bind 4096)
[    0.774410] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.781123] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.788553] NET: Registered protocol family 1
[    0.808154] RPC: Registered named UNIX socket transport module.
[    0.814157] RPC: Registered udp transport module.
[    0.818977] RPC: Registered tcp transport module.
[    0.823740] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.914771] hw perfevents: no interrupt-affinity property for /arm-pmu, guessing.
[    0.923026] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available
[    0.933384] Initialise system trusted keyrings
[    0.938389] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.946009] NFS: Registering the id_resolver key type
[    0.951180] Key type id_resolver registered
[    0.955416] Key type id_legacy registered
[    0.959897] Key type asymmetric registered
[    0.964052] Asymmetric key parser 'x509' registered
[    0.969100] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.976605] io scheduler mq-deadline registered
[    0.981206] io scheduler kyber registered
[    0.988509] K_TTYS: sp_uart0's Rx is in PIO mode.
[    0.993284] K_TTYS: sp_uart0's Tx is in PIO mode.
[    0.998086] 9c000900.serial: ttyS0 at MMIO 0x9c000900 (irq = 53, base_baud = 1687500) is a sp_uart0
[    1.007331] printk: console [ttyS0] enabled
[    1.007331] printk: console [ttyS0] enabled
[    1.015747] printk: bootconsole [earlycon0] disabled
[    1.015747] printk: bootconsole [earlycon0] disabled
[    1.041862] loop: module loaded
[    1.043913] libphy: Fixed MDIO Bus: probed
[    1.043997] CAN device driver interface
[    1.044572] [L2SW] L2 switch mode = 0
[    1.045585] [L2SW] HW Addr = 00:22:60:00:88:30
[    1.050668] [L2SW] Registered net device "eth0" successfully.
[    1.055716] libphy: sunplus_mii_bus: probed
[    1.157916] net eth0: could not add device link to 9c108000.l2sw-mii:01 err -17
[    1.159540] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.160609] ehci-platform: EHCI generic platform driver
[    1.166130] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.172004] ohci-platform: OHCI generic platform driver
[    1.177319] register ehci0_hcd_sunplus_driver
[    1.181754] ehci_id:1,irq:14
[    1.184363] ehci0-sunplus 9c102100.usb: Generic Platform EHCI Controller
[    1.191037] ehci0-sunplus 9c102100.usb: new USB bus registered, assigned bus number 1
[    1.199062] ehci0-sunplus 9c102100.usb: irq 14, io mem 0x9c102100
[    1.227691] ehci0-sunplus 9c102100.usb: USB 2.0 started, EHCI 1.10
[    1.228985] hub 1-0:1.0: USB hub found
[    1.229104] hub 1-0:1.0: 1 port detected
[    1.230818] hcd_irq:14,14
[    1.233127] register ehci1_hcd_sunplus_driver
[    1.237499] ehci_id:2,irq:17
[    1.240176] ehci1-sunplus 9c103100.usb: Generic Platform EHCI Controller
[    1.246804] ehci1-sunplus 9c103100.usb: new USB bus registered, assigned bus number 2
[    1.254832] ehci1-sunplus 9c103100.usb: irq 17, io mem 0x9c103100
[    1.287683] ehci1-sunplus 9c103100.usb: USB 2.0 started, EHCI 1.10
[    1.288738] hub 2-0:1.0: USB hub found
[    1.288849] hub 2-0:1.0: 1 port detected
[    1.290763] hcd_irq:17,17
[    1.293113] register ohci0_hcd_sunplus_driver
[    1.297474] ohci_id:1,irq:15
[    1.300170] ohci0-sunplus 9c102080.usb: Generic Platform OHCI Controller
[    1.306797] ohci0-sunplus 9c102080.usb: new USB bus registered, assigned bus number 3
[    1.314833] ohci0-sunplus 9c102080.usb: irq 15, io mem 0x9c102080
[    1.390625] hub 3-0:1.0: USB hub found
[    1.390736] hub 3-0:1.0: 1 port detected
[    1.391462] register ohci1_hcd_sunplus_driver
[    1.391770] ohci_id:2,irq:18
[    1.394320] ohci1-sunplus 9c103080.usb: Generic Platform OHCI Controller
[    1.401188] ohci1-sunplus 9c103080.usb: new USB bus registered, assigned bus number 4
[    1.408976] ohci1-sunplus 9c103080.usb: irq 18, io mem 0x9c103080
[    1.480573] hub 4-0:1.0: USB hub found
[    1.480688] hub 4-0:1.0: 1 port detected
[    1.481578] usbcore: registered new interface driver usb-storage
[    1.483223] register sunplus_driver_udc
[    1.483223]
[    1.489491] >>> sp_udc_alloc_request...
[    1.489491]
[    1.493600] <<< sp_udc_alloc_request...
[    1.493600]
[    1.499195] zero gadget: Gadget Zero, version: Cinco de Mayo 2008
[    1.504952] zero gadget: zero ready
[    1.509179] mousedev: PS/2 mouse device common for all mice
[    1.515280] sp7021-rtc 9c003a00.serial: registered as rtc0
[    1.519451] [RTC] Info: sp7021-rtc loaded
[    1.523938] [DISP][_display_probe:2845] disp probe ...
[    1.528679] [DISP]irq num:4
[    1.532626] [DISP][_display_probe:3014] disp probe done
[    1.537078] usbcore: registered new interface driver uvcvideo
[    1.542427] USB Video Class driver (1.1.1)
[    1.547058] hidraw: raw HID events driver (C) Jiri Kosina
[    1.552158] usbcore: registered new interface driver usbhid
[    1.557382] usbhid: USB HID core driver
[    1.561219] exFAT: Version 1.3.0
[    1.565133] NET: Registered protocol family 10
[    1.570398] Segment Routing with IPv6
[    1.572568] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.579535] NET: Registered protocol family 17
[    1.582798] can: controller area network core (rev 20170425 abi 9)
[    1.589337] NET: Registered protocol family 29
[    1.593358] can: raw protocol (rev 20170425)
[    1.597600] can: broadcast manager protocol (rev 20170425 t)
[    1.603255] can: netlink gateway (rev 20190810) max_hops=1
[    1.608909] NET: Registered protocol family 37
[    1.613173] Key type dns_resolver registered
[    1.617406] Key type ceph registered
[    1.637730] libceph: loaded (mon/osd proto 15/24)
[    1.638046] Registering SWP/SWPB emulation handler
[    1.638520] Loading compiled-in X.509 certificates
[    1.660643] sp7021-fb soc@B:fb_device: [_sp7021_fb_create_device:289] mem VA 0xe0879000(PA 0x1d800000), Palette VA 0x0(PA 0x40000000), UI Res 720x480, size 2768896 + 0
[    1.664750] sp7021-rtc 9c003a00.serial: setting system clock to 1970-01-01T03:45:11 UTC (13511)
[    1.701862] Freeing unused kernel memory: 10240K
[    1.725891] random: fast init done
[    1.747848] Run /init as init process
/etc/init.d/rcS starts...
Mounting other filesystems ...
rc.extra [bg]
End of /etc/init.d/rcS
0x0000A293
0x00000008
extra done

login[595]: root login on 'console'
~ #
~ # df -hT
Filesystem           Type            Size      Used Available Use% Mounted on
tmpfs                tmpfs         249.1M         0    249.1M   0% /dev/shm
tmpfs                tmpfs         249.1M         0    249.1M   0% /tmp
~ #
  • No labels