diff options
| author | Adrian Fiergolski <adrian.fiergolski@fastree3d.com> | 2019-11-15 15:46:20 +0100 |
|---|---|---|
| committer | Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> | 2020-08-11 23:47:26 -0700 |
| commit | 310471e7b6e342343f2d0e3a5eee4737fd60a27b (patch) | |
| tree | 5679d323bb41078c94519faf111b0bf6e258506b | |
| parent | 61a5129a4d7143e28e5ead74c7c9e51b75baafdd (diff) | |
| download | meta-xilinx-310471e7b6e342343f2d0e3a5eee4737fd60a27b.tar.gz | |
ZynqMP+: Use a proper SD device in U-Boot scripts (uEnv, scr).
It fixes the u-boot scripts in case a ZynqMP+ SoC comes with two SDHCI controllers.
It requires a proper enumeration in the U-Boot Device tree, i.e.
mmc0 = &sdhci0;
mmc1 = &sdhci1;
not
mmc0 = &sdhci1;
mmc1 = &sdhci0;
The second enumeration being a workaround (always boot from mmc0),
is not required anymore as u-boot for ZynqMP+ defines 'sdbootdev'
environment variable. Moreover, the proper enumeration allows to
select proper block device (mmcblk0p2 vs mmcblk1p2) passed as 'root'
parameter to kernel.
Signed-off-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
| -rw-r--r-- | meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp | 3 | ||||
| -rw-r--r-- | meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-uenv.bb | 19 |
2 files changed, 16 insertions, 6 deletions
diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp index 9d4c6b9e..ebf00875 100644 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | setenv bootargs $bootargs root=/dev/mmcblk0p2 rw rootwait earlycon clk_ignore_unused | 1 | setenv bootargs $bootargs root=/dev/mmcblk${sdbootdev}p2 rw rootwait earlycon clk_ignore_unused |
| 2 | fatload mmc $sdbootdev @@DEVICETREE_ADDRESS@@ @@DEVICE_TREE_NAME@@ | ||
| 2 | fatload mmc $sdbootdev:$partid @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@ | 3 | fatload mmc $sdbootdev:$partid @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@ |
| 3 | @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ | 4 | @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ |
diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-uenv.bb b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-uenv.bb index 952077d1..6e4c3c0b 100644 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-uenv.bb +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-uenv.bb | |||
| @@ -37,6 +37,12 @@ def uboot_boot_cmd(d): | |||
| 37 | return "booti" | 37 | return "booti" |
| 38 | raise bb.parse.SkipRecipe("Unsupport kernel image type") | 38 | raise bb.parse.SkipRecipe("Unsupport kernel image type") |
| 39 | 39 | ||
| 40 | def get_sdbootdev(d): | ||
| 41 | if d.getVar("SOC_FAMILY") in ["zynqmp"]: | ||
| 42 | return "${sdbootdev}" | ||
| 43 | else: | ||
| 44 | return "0" | ||
| 45 | |||
| 40 | def uenv_populate(d): | 46 | def uenv_populate(d): |
| 41 | # populate the environment values | 47 | # populate the environment values |
| 42 | env = {} | 48 | env = {} |
| @@ -51,10 +57,13 @@ def uenv_populate(d): | |||
| 51 | 57 | ||
| 52 | env["bootargs"] = d.getVar("KERNEL_BOOTARGS") | 58 | env["bootargs"] = d.getVar("KERNEL_BOOTARGS") |
| 53 | 59 | ||
| 54 | env["loadkernel"] = "fatload mmc 0 ${kernel_load_address} ${kernel_image}" | 60 | env["loadkernel"] = "fatload mmc " + get_sdbootdev(d) + " ${kernel_load_address} ${kernel_image}" |
| 55 | env["loaddtb"] = "fatload mmc 0 ${devicetree_load_address} ${devicetree_image}" | 61 | env["loaddtb"] = "fatload mmc " + get_sdbootdev(d) + " ${devicetree_load_address} ${devicetree_image}" |
| 56 | env["bootkernel"] = "run loadkernel && run loaddtb && " + uboot_boot_cmd(d) + " ${kernel_load_address} - ${devicetree_load_address}" | 62 | env["bootkernel"] = "run loadkernel && run loaddtb && " + uboot_boot_cmd(d) + " ${kernel_load_address} - ${devicetree_load_address}" |
| 57 | 63 | ||
| 64 | if d.getVar("SOC_FAMILY") in ["zynqmp"]: | ||
| 65 | env["bootkernel"] = "setenv bootargs " + d.getVar("KERNEL_BOOTARGS") + " ; " + env["bootkernel"] | ||
| 66 | |||
| 58 | # default uenvcmd does not load bitstream | 67 | # default uenvcmd does not load bitstream |
| 59 | env["uenvcmd"] = "run bootkernel" | 68 | env["uenvcmd"] = "run bootkernel" |
| 60 | 69 | ||
| @@ -67,14 +76,14 @@ def uenv_populate(d): | |||
| 67 | env["bitstream_type"] = "loadb" if bitstreamtype else "load" | 76 | env["bitstream_type"] = "loadb" if bitstreamtype else "load" |
| 68 | 77 | ||
| 69 | # load bitstream first with loadfpa | 78 | # load bitstream first with loadfpa |
| 70 | env["loadfpga"] = "fatload mmc 0 ${bitstream_load_address} ${bitstream_image} && fpga ${bitstream_type} 0 ${bitstream_load_address} ${filesize}" | 79 | env["loadfpga"] = "fatload mmc " + get_sdbootdev(d) + " ${bitstream_load_address} ${bitstream_image} && fpga ${bitstream_type} 0 ${bitstream_load_address} ${filesize}" |
| 71 | env["uenvcmd"] = "run loadfpga && run bootkernel" | 80 | env["uenvcmd"] = "run loadfpga && run bootkernel" |
| 72 | 81 | ||
| 73 | return env | 82 | return env |
| 74 | 83 | ||
| 75 | # bootargs, default to booting with the rootfs device being partition 2 of the first mmc device | 84 | # bootargs, default to booting with the rootfs device being partition 2 |
| 76 | KERNEL_BOOTARGS_zynq = "earlyprintk console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait" | 85 | KERNEL_BOOTARGS_zynq = "earlyprintk console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait" |
| 77 | KERNEL_BOOTARGS_zynqmp = "earlycon clk_ignore_unused root=/dev/mmcblk0p2 rw rootwait" | 86 | KERNEL_BOOTARGS_zynqmp = "earlycon clk_ignore_unused root=/dev/mmcblk${sdbootdev}p2 rw rootwait" |
| 78 | 87 | ||
| 79 | KERNEL_LOAD_ADDRESS_zynq = "0x2080000" | 88 | KERNEL_LOAD_ADDRESS_zynq = "0x2080000" |
| 80 | KERNEL_LOAD_ADDRESS_zynqmp = "0x80000" | 89 | KERNEL_LOAD_ADDRESS_zynqmp = "0x80000" |
