* [U-Boot] [PATCH] ARM64: zynqmp: Add support for standard distro boot commands
@ 2016-06-01 13:08 Michal Simek
2016-06-01 14:12 ` Alexander Graf
0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2016-06-01 13:08 UTC (permalink / raw)
To: u-boot
Nand and QSPI are not defined now but this will be extended.
Based on selected bootmode boot_targets are rewritten.
Patch also contains detection if variables are saved. If yes don't
rewrite boot_targets variable.
Also move variable setup to the end of file because SCSI needs to be
defined before others macros are using it.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Patch depends on
"env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"
---
board/xilinx/zynqmp/zynqmp.c | 20 +++++++++-----
include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
2 files changed, 57 insertions(+), 22 deletions(-)
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 4623cd49e9c7..46c332215b6b 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -215,6 +215,11 @@ int board_late_init(void)
u32 reg = 0;
u8 bootmode;
+ if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
+ debug("Saved variables - Skipping\n");
+ return 0;
+ }
+
reg = readl(&crlapb_base->boot_mode);
bootmode = reg & BOOT_MODES_MASK;
@@ -222,31 +227,32 @@ int board_late_init(void)
switch (bootmode) {
case JTAG_MODE:
puts("JTAG_MODE\n");
- setenv("modeboot", "jtagboot");
+ setenv("boot_targets", "pxe dhcp");
break;
case QSPI_MODE_24BIT:
case QSPI_MODE_32BIT:
- setenv("modeboot", "qspiboot");
+ setenv("boot_targets", "qspi0");
puts("QSPI_MODE\n");
break;
case EMMC_MODE:
puts("EMMC_MODE\n");
- setenv("modeboot", "sdboot");
+ setenv("boot_targets", "mmc0");
break;
case SD_MODE:
puts("SD_MODE\n");
- setenv("modeboot", "sdboot");
+ setenv("boot_targets", "mmc0");
break;
case SD_MODE1:
puts("SD_MODE1\n");
#if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
- setenv("sdbootdev", "1");
+ setenv("boot_targets", "mmc1");
+#else
+ setenv("boot_targets", "mmc0");
#endif
- setenv("modeboot", "sdboot");
break;
case NAND_MODE:
puts("NAND_MODE\n");
- setenv("modeboot", "nandboot");
+ setenv("boot_targets", "nand0");
break;
default:
printf("Invalid Boot Mode:0x%x\n", bootmode);
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index 795d58646e15..3fba87ac194e 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -147,21 +147,6 @@
# define DFU_ALT_INFO
#endif
-/* Initial environment variables */
-#ifndef CONFIG_EXTRA_ENV_SETTINGS
-#define CONFIG_EXTRA_ENV_SETTINGS \
- "kernel_addr=0x80000\0" \
- "fdt_addr=0x7000000\0" \
- "fdt_high=0x10000000\0" \
- CONFIG_KERNEL_FDT_OFST_SIZE \
- "sdbootdev=0\0"\
- "sdboot=mmc dev $sdbootdev && mmcinfo && load mmc $sdbootdev:$partid $fdt_addr system.dtb && " \
- "load mmc $sdbootdev:$partid $kernel_addr Image && " \
- "booti $kernel_addr - $fdt_addr\0" \
- DFU_ALT_INFO
-#endif
-
-#define CONFIG_BOOTCOMMAND "run $modeboot"
#define CONFIG_BOOTDELAY 3
#define CONFIG_BOARD_LATE_INIT
@@ -231,6 +216,50 @@
#define CONFIG_BOARD_EARLY_INIT_R
#define CONFIG_CLOCKS
+#define ENV_MEM_LAYOUT_SETTINGS \
+ "fdt_high=10000000\0" \
+ "initrd_high=10000000\0" \
+ "fdt_addr_r=0x40000000\0" \
+ "pxefile_addr_r=0x10000000\0" \
+ "kernel_addr_r=0x18000000\0" \
+ "scriptaddr=0x02000000\0" \
+ "ramdisk_addr_r=0x02100000\0" \
+
+#if defined(CONFIG_ZYNQ_SDHCI)
+# define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
+#else
+# define BOOT_TARGET_DEVICES_MMC(func)
+#endif
+
+#if defined(CONFIG_SATA_CEVA)
+# define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
+#else
+# define BOOT_TARGET_DEVICES_SCSI(func)
+#endif
+
+#if defined(CONFIG_ZYNQMP_USB)
+# define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
+#else
+# define BOOT_TARGET_DEVICES_USB(func)
+#endif
+
+#define BOOT_TARGET_DEVICES(func) \
+ BOOT_TARGET_DEVICES_MMC(func) \
+ BOOT_TARGET_DEVICES_USB(func) \
+ BOOT_TARGET_DEVICES_SCSI(func) \
+ func(PXE, pxe, na) \
+ func(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
+
+/* Initial environment variables */
+#ifndef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ ENV_MEM_LAYOUT_SETTINGS \
+ BOOTENV \
+ DFU_ALT_INFO
+#endif
+
#define CONFIG_SPL_TEXT_BASE 0xfffc0000
#define CONFIG_SPL_MAX_SIZE 0x20000
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] ARM64: zynqmp: Add support for standard distro boot commands
2016-06-01 13:08 [U-Boot] [PATCH] ARM64: zynqmp: Add support for standard distro boot commands Michal Simek
@ 2016-06-01 14:12 ` Alexander Graf
2016-06-01 14:20 ` Michal Simek
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2016-06-01 14:12 UTC (permalink / raw)
To: u-boot
On 01.06.16 15:08, Michal Simek wrote:
> Nand and QSPI are not defined now but this will be extended.
> Based on selected bootmode boot_targets are rewritten.
> Patch also contains detection if variables are saved. If yes don't
> rewrite boot_targets variable.
>
> Also move variable setup to the end of file because SCSI needs to be
> defined before others macros are using it.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> Patch depends on
> "env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"
>
> ---
> board/xilinx/zynqmp/zynqmp.c | 20 +++++++++-----
> include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
> 2 files changed, 57 insertions(+), 22 deletions(-)
>
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 4623cd49e9c7..46c332215b6b 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -215,6 +215,11 @@ int board_late_init(void)
> u32 reg = 0;
> u8 bootmode;
>
> + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
> + debug("Saved variables - Skipping\n");
> + return 0;
> + }
> +
> reg = readl(&crlapb_base->boot_mode);
> bootmode = reg & BOOT_MODES_MASK;
>
> @@ -222,31 +227,32 @@ int board_late_init(void)
> switch (bootmode) {
> case JTAG_MODE:
> puts("JTAG_MODE\n");
> - setenv("modeboot", "jtagboot");
> + setenv("boot_targets", "pxe dhcp");
Is there a particular reason you're overwriting the boot_targets rather
than prepending them?
If I plug in an SD card with U-Boot on it, but my OS is on a SATA
attached disk (which is how I currently use the ZynqMP), this would set
the boot_targets to SD rather than "SD first, default list later".
If we instead do something like
boot_targets = "pxe dhcp " + getenv(boot_targets);
we would maintain a workable fallback path. Yes, we might check a target
device twice, but since we know that it fails I don't think it's too
much of a problem.
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] ARM64: zynqmp: Add support for standard distro boot commands
2016-06-01 14:12 ` Alexander Graf
@ 2016-06-01 14:20 ` Michal Simek
2016-06-01 14:23 ` Alexander Graf
0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2016-06-01 14:20 UTC (permalink / raw)
To: u-boot
On 1.6.2016 16:12, Alexander Graf wrote:
>
>
> On 01.06.16 15:08, Michal Simek wrote:
>> Nand and QSPI are not defined now but this will be extended.
>> Based on selected bootmode boot_targets are rewritten.
>> Patch also contains detection if variables are saved. If yes don't
>> rewrite boot_targets variable.
>>
>> Also move variable setup to the end of file because SCSI needs to be
>> defined before others macros are using it.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> Patch depends on
>> "env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"
>>
>> ---
>> board/xilinx/zynqmp/zynqmp.c | 20 +++++++++-----
>> include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
>> 2 files changed, 57 insertions(+), 22 deletions(-)
>>
>> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
>> index 4623cd49e9c7..46c332215b6b 100644
>> --- a/board/xilinx/zynqmp/zynqmp.c
>> +++ b/board/xilinx/zynqmp/zynqmp.c
>> @@ -215,6 +215,11 @@ int board_late_init(void)
>> u32 reg = 0;
>> u8 bootmode;
>>
>> + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
>> + debug("Saved variables - Skipping\n");
>> + return 0;
>> + }
>> +
>> reg = readl(&crlapb_base->boot_mode);
>> bootmode = reg & BOOT_MODES_MASK;
>>
>> @@ -222,31 +227,32 @@ int board_late_init(void)
>> switch (bootmode) {
>> case JTAG_MODE:
>> puts("JTAG_MODE\n");
>> - setenv("modeboot", "jtagboot");
>> + setenv("boot_targets", "pxe dhcp");
>
> Is there a particular reason you're overwriting the boot_targets rather
> than prepending them?
>
> If I plug in an SD card with U-Boot on it, but my OS is on a SATA
> attached disk (which is how I currently use the ZynqMP), this would set
> the boot_targets to SD rather than "SD first, default list later".
>
> If we instead do something like
>
> boot_targets = "pxe dhcp " + getenv(boot_targets);
>
> we would maintain a workable fallback path. Yes, we might check a target
> device twice, but since we know that it fails I don't think it's too
> much of a problem.
No problem to do it but maybe in mmc0 case we should also remove mmc0
from boot_targets which is already there.
Thanks,
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] ARM64: zynqmp: Add support for standard distro boot commands
2016-06-01 14:20 ` Michal Simek
@ 2016-06-01 14:23 ` Alexander Graf
2016-06-02 8:23 ` Michal Simek
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2016-06-01 14:23 UTC (permalink / raw)
To: u-boot
On 01.06.16 16:20, Michal Simek wrote:
> On 1.6.2016 16:12, Alexander Graf wrote:
>>
>>
>> On 01.06.16 15:08, Michal Simek wrote:
>>> Nand and QSPI are not defined now but this will be extended.
>>> Based on selected bootmode boot_targets are rewritten.
>>> Patch also contains detection if variables are saved. If yes don't
>>> rewrite boot_targets variable.
>>>
>>> Also move variable setup to the end of file because SCSI needs to be
>>> defined before others macros are using it.
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>> Patch depends on
>>> "env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"
>>>
>>> ---
>>> board/xilinx/zynqmp/zynqmp.c | 20 +++++++++-----
>>> include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
>>> 2 files changed, 57 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
>>> index 4623cd49e9c7..46c332215b6b 100644
>>> --- a/board/xilinx/zynqmp/zynqmp.c
>>> +++ b/board/xilinx/zynqmp/zynqmp.c
>>> @@ -215,6 +215,11 @@ int board_late_init(void)
>>> u32 reg = 0;
>>> u8 bootmode;
>>>
>>> + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
>>> + debug("Saved variables - Skipping\n");
>>> + return 0;
>>> + }
>>> +
>>> reg = readl(&crlapb_base->boot_mode);
>>> bootmode = reg & BOOT_MODES_MASK;
>>>
>>> @@ -222,31 +227,32 @@ int board_late_init(void)
>>> switch (bootmode) {
>>> case JTAG_MODE:
>>> puts("JTAG_MODE\n");
>>> - setenv("modeboot", "jtagboot");
>>> + setenv("boot_targets", "pxe dhcp");
>>
>> Is there a particular reason you're overwriting the boot_targets rather
>> than prepending them?
>>
>> If I plug in an SD card with U-Boot on it, but my OS is on a SATA
>> attached disk (which is how I currently use the ZynqMP), this would set
>> the boot_targets to SD rather than "SD first, default list later".
>>
>> If we instead do something like
>>
>> boot_targets = "pxe dhcp " + getenv(boot_targets);
>>
>> we would maintain a workable fallback path. Yes, we might check a target
>> device twice, but since we know that it fails I don't think it's too
>> much of a problem.
>
> No problem to do it but maybe in mmc0 case we should also remove mmc0
> from boot_targets which is already there.
If you want to write the code for that, sure :).
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] ARM64: zynqmp: Add support for standard distro boot commands
2016-06-01 14:23 ` Alexander Graf
@ 2016-06-02 8:23 ` Michal Simek
0 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2016-06-02 8:23 UTC (permalink / raw)
To: u-boot
On 1.6.2016 16:23, Alexander Graf wrote:
>
>
> On 01.06.16 16:20, Michal Simek wrote:
>> On 1.6.2016 16:12, Alexander Graf wrote:
>>>
>>>
>>> On 01.06.16 15:08, Michal Simek wrote:
>>>> Nand and QSPI are not defined now but this will be extended.
>>>> Based on selected bootmode boot_targets are rewritten.
>>>> Patch also contains detection if variables are saved. If yes don't
>>>> rewrite boot_targets variable.
>>>>
>>>> Also move variable setup to the end of file because SCSI needs to be
>>>> defined before others macros are using it.
>>>>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>>> Patch depends on
>>>> "env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"
>>>>
>>>> ---
>>>> board/xilinx/zynqmp/zynqmp.c | 20 +++++++++-----
>>>> include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
>>>> 2 files changed, 57 insertions(+), 22 deletions(-)
>>>>
>>>> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
>>>> index 4623cd49e9c7..46c332215b6b 100644
>>>> --- a/board/xilinx/zynqmp/zynqmp.c
>>>> +++ b/board/xilinx/zynqmp/zynqmp.c
>>>> @@ -215,6 +215,11 @@ int board_late_init(void)
>>>> u32 reg = 0;
>>>> u8 bootmode;
>>>>
>>>> + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
>>>> + debug("Saved variables - Skipping\n");
>>>> + return 0;
>>>> + }
>>>> +
>>>> reg = readl(&crlapb_base->boot_mode);
>>>> bootmode = reg & BOOT_MODES_MASK;
>>>>
>>>> @@ -222,31 +227,32 @@ int board_late_init(void)
>>>> switch (bootmode) {
>>>> case JTAG_MODE:
>>>> puts("JTAG_MODE\n");
>>>> - setenv("modeboot", "jtagboot");
>>>> + setenv("boot_targets", "pxe dhcp");
>>>
>>> Is there a particular reason you're overwriting the boot_targets rather
>>> than prepending them?
>>>
>>> If I plug in an SD card with U-Boot on it, but my OS is on a SATA
>>> attached disk (which is how I currently use the ZynqMP), this would set
>>> the boot_targets to SD rather than "SD first, default list later".
>>>
>>> If we instead do something like
>>>
>>> boot_targets = "pxe dhcp " + getenv(boot_targets);
>>>
>>> we would maintain a workable fallback path. Yes, we might check a target
>>> device twice, but since we know that it fails I don't think it's too
>>> much of a problem.
>>
>> No problem to do it but maybe in mmc0 case we should also remove mmc0
>> from boot_targets which is already there.
>
> If you want to write the code for that, sure :).
Let's just use simple version first and then we can tune this.
There is checking if boot fails that's why it is not big deal just
showing down boot process.
Thanks,
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-02 8:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-01 13:08 [U-Boot] [PATCH] ARM64: zynqmp: Add support for standard distro boot commands Michal Simek
2016-06-01 14:12 ` Alexander Graf
2016-06-01 14:20 ` Michal Simek
2016-06-01 14:23 ` Alexander Graf
2016-06-02 8:23 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox