u-boot-brain/board/phytec/pcm058
Niel Fourie 26a6ed1b2e arm: imx6q: pcm058: Convert pcm058 to use DM with DTs
Convert pcm058 support to use device trees and the driver model.
Add rudimentary boot scripts to the environment, expand README.

Signed-off-by: Niel Fourie <lusus@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
2020-07-14 11:46:04 +02:00
..
Kconfig mx6: Add Phytec PCM058 i.MX6 Quad 2016-07-12 17:58:48 +02:00
MAINTAINERS arm: imx6q: pcm058: change MAINTAINER 2020-07-14 11:46:04 +02:00
Makefile SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pcm058.c arm: imx6q: pcm058: Convert pcm058 to use DM with DTs 2020-07-14 11:46:04 +02:00
README arm: imx6q: pcm058: Convert pcm058 to use DM with DTs 2020-07-14 11:46:04 +02:00

Board information
-----------------

The SBC produced by Phytec has a SOM based on a i.MX6Q.
The SOM is sold in two versions, with eMMC or with NAND. Support
here is for the SOM with NAND.
The evaluation board "phyBoard-Mira" is thought to be used
together with the SOM.

More information on the board can be found on manufacturer's
website:

http://www.phytec.de/produkt/single-board-computer/phyboard-mira/
http://www.phytec.de/fileadmin/user_upload/images/content/1.Products/SOMs/phyCORE-i.MX6/L-808e_1.pdf

Building U-Boot
-------------------------------

$ make pcm058_defconfig
$ make

This generates the artifacts SPL and u-boot.img.
The SOM can boot from NAND or from SD-Card, having the SPI-NOR
as second option.
The dip switch "DIP-1" on the board let choose between
NAND and SD.

DIP-1 set to off:	Boot first from NAND, then try SPI
DIP-1 set to on:	Boot first from SD, then try SPI

The bootloader was tested with DIP-1 set to on. If a SD-card
is present, then the RBL tries to load SPL from the SD Card, if not,
RBL loads from SPI-NOR. The SPL tries then to load from the same
device where SPL was loaded (SD or SPI). Booting from NAND is
not supported.

Flashing U-Boot onto an SD card
-------------------------------

After a successful build, the generated SPL and U-boot binaries can be copied
to an SD card. Adjust the SD card device as necessary:

$ sudo dd if=u-boot-with-spl.imx of=/dev/mmcblk0 bs=1k seek=1

This is equivalent to separately copying the SPL and U-boot using:

$ sudo dd if=SPL of=/dev/mmcblk0 bs=1k seek=1
$ sudo dd if=u-boot-dtb.img of=/dev/mmcblk0 bs=1k seek=197

The default bootscripts expect a kernel fit-image file named "fitImage" in the
first partition and Linux ext4 rootfs in the second partition.

Flashing U-boot to the SPI Flash, for booting Linux from NAND
-------------------------------------------------------------

The SD card created above can also be used to install the SPL and U-boot into
the SPI flash. Boot U-boot from the SD card as above, and stop at the autoboot.

Then, clear the SPI flash:

=> sf probe
=> sf erase 0x0 0x1000000

Load the SPL from raw MMC into memory and copy to the SPI. The SPL is maximum
392*512-byte blocks in size therefore 0x188 blocks, totaling 0x31000 bytes:

=> mmc read ${loadaddr} 0x2 0x188
=> sf write ${loadaddr} 0x400 0x31000

Load the U-boot binary into memory and copy to the SPI. U-boot should fit into
640KiB, so 0x500 512-byte blocks, totalling 0xA0000 bytes:

=> mmc read ${loadaddr} 0x18a 0x500
=> sf write ${loadaddr} 0x40000 0xA0000

The default NAND bootscripts expect a single MTD partition named "rootfs",
which in turn contains the UBI volumes "fit" (which contains the kernel fit-
image) and "root" (which contains a ubifs root filesystem).

The "bootm_size" variable in the environment
--------------------------------------------

By default, U-boot relocates the device tree towards the upper end of the RAM,
which kernels using CONFIG_HIGHMEM=y may not be able to access during early
boot. With the bootm_size variable set to 0x30000000, U-boot relocates the
device tree to below this address instead.