[U-Boot] [PATCH 1/2] mx6sabresd: Add Falcon mode support

Allow i.MX6Q Sabre SD to load the kernel and dtb via SPL in Falcon mode.
Based on the Falcon mode code for MX6 Gateworks Ventana board.
Signed-off-by: Diego Dorta diego.dorta@nxp.com --- board/freescale/mx6sabresd/mx6sabresd.c | 12 ++++++++++++ include/configs/mx6sabresd.h | 12 ++++++++++++ 2 files changed, 24 insertions(+)
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index e58c03c..2b6d7be 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -57,6 +57,8 @@ DECLARE_GLOBAL_DATA_PTR;
#define DISP0_PWR_EN IMX_GPIO_NR(1, 21)
+#define KEY_VOL_UP IMX_GPIO_NR(1, 4) + int dram_init(void) { gd->ram_size = imx_ddr_size(); @@ -682,6 +684,16 @@ int checkboard(void) #include <spl.h> #include <libfdt.h>
+#ifdef CONFIG_SPL_OS_BOOT +int spl_start_uboot(void) +{ + gpio_direction_input(KEY_VOL_UP); + + /* Only enter in Falcon mode if KEY_VOL_UP is pressed */ + return gpio_get_value(KEY_VOL_UP); +} +#endif + static void ccgr_init(void) { struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h index 5c2734d..6a7a0d3 100644 --- a/include/configs/mx6sabresd.h +++ b/include/configs/mx6sabresd.h @@ -11,6 +11,7 @@
#ifdef CONFIG_SPL #include "imx6_spl.h" +#undef CONFIG_SPL_EXT_SUPPORT #endif
#define CONFIG_MACH_TYPE 3980 @@ -22,6 +23,17 @@
#include "mx6sabre_common.h"
+/* Falcon Mode */ +#define CONFIG_CMD_SPL +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000 +#define CONFIG_CMD_SPL_WRITE_SIZE (128 * SZ_1K) + +/* Falcon Mode - MMC support: args@1MB kernel@2MB */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) +#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ + #define CONFIG_SYS_FSL_USDHC_NUM 3 #if defined(CONFIG_ENV_IS_IN_MMC) #define CONFIG_SYS_MMC_ENV_DEV 1 /* SDHC3 */

Add a README to explain the steps for booting mx6sabresd in different ways: 1. Booting via Normal U-Boot (u-boot.imx) 2. Booting via SPL (SPL and u-boot.img) 3. Booting via Falcon mode (SPL launches the kernel directly)
Signed-off-by: Diego Dorta diego.dorta@nxp.com --- board/freescale/mx6sabresd/README | 103 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 board/freescale/mx6sabresd/README
diff --git a/board/freescale/mx6sabresd/README b/board/freescale/mx6sabresd/README new file mode 100644 index 0000000..5814b9d --- /dev/null +++ b/board/freescale/mx6sabresd/README @@ -0,0 +1,103 @@ +How to use and build U-Boot on mx6sabresd: +---------------------------------- + +Currently there are three methods for booting mx6sabresd boards: + +1. Booting via Normal U-Boot (u-boot.imx) + +2. Booting via SPL (SPL and u-boot.img) + +3. Booting via Falcon mode (SPL launches the kernel directly) + + +1. Booting via Normal U-Boot +---------------------------- + +$ make mx6qsabresd_defconfig (If you want to build for mx6qsabresd) + +or + +$ make mx6dlsabresd_defconfig (If you want to build for mx6dlsabresd) + +$ make + +This will generate the image called u-boot.imx. + +- Flash the u-boot.imx binary into the SD card: + +$ sudo dd if=u-boot.imx of=/dev/sdb bs=1K seek=1 && sync + + +2. Booting via SPL +------------------ + +Other method for building U-Boot on mx6qsabresd and mx6qpsabresd is +through SPL. In order to do so: + +$ make mx6sabresd_spl_defconfig +$ make + +This will generate the SPL image called SPL and the u-boot.img. + +- Flash the SPL image into the SD card: + +$ sudo dd if=SPL of=/dev/sdb bs=1K seek=1 && sync + +- Flash the u-boot.img image into the SD card: + +$ sudo dd if=u-boot.img of=/dev/sdbbs=1K seek=69 && sync + + +3. Booting via Falcon mode +-------------------------- + +$ make mx6sabresd_spl_defconfig +$ make + +This will generate the SPL image called SPL and the u-boot.img. + +- Flash the SPL image into the SD card: + +$ sudo dd if=SPL of=/dev/sdb bs=1K seek=1 oflag=sync status=none && sync + +- Flash the u-boot.img image into the SD card: + +$ sudo dd if=u-boot.img of=/dev/sdbbs=1K seek=69 oflag=sync status=none && sync + +Create a partition for root file system and extract it there: + +$ sudo tar xvf rootfs.tar.gz -C /media/root + +The SD card must have enough space for raw "args" and "kernel". +To configure Falcon mode for the first time, on U-Boot do the following commands: + +- Setup the IP server: + +# setenv serverip <server_ip_address> + +- Download dtb file: + +# dhcp ${fdt_addr} imx6q-sabresd.dtb + +- Download kernel image: + +# dhcp ${loadaddr} uImage + +- Write kernel at 2MB offset: + +# mmc write ${loadaddr} 0x1000 0x4000 + +- Setup kernel bootargs: + +# setenv bootargs "console=ttymxc0,115200 root=/dev/mmcblk1p1 rootfstype=ext4 rootwait quiet rw" + +- Prepare args: + +# spl export fdt ${loadaddr} - ${fdt_addr} + +- Write args 1MB data (0x800 sectors) to 1MB offset (0x800 sectors) + +# mmc write 18000000 0x800 0x800 + +- Press KEY_VOL_UP key, power up the board and then SPL binary will +launch the kernel directly.

On Tue, Oct 11, 2016 at 11:09 AM, Diego Dorta diego.dorta@nxp.com wrote:
Add a README to explain the steps for booting mx6sabresd in different ways: 1. Booting via Normal U-Boot (u-boot.imx) 2. Booting via SPL (SPL and u-boot.img) 3. Booting via Falcon mode (SPL launches the kernel directly)
Signed-off-by: Diego Dorta diego.dorta@nxp.com
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com

On Tue, Oct 11, 2016 at 11:09 AM, Diego Dorta diego.dorta@nxp.com wrote:
Add a README to explain the steps for booting mx6sabresd in different ways: 1. Booting via Normal U-Boot (u-boot.imx) 2. Booting via SPL (SPL and u-boot.img) 3. Booting via Falcon mode (SPL launches the kernel directly)
Signed-off-by: Diego Dorta diego.dorta@nxp.com
It is not clear if the SPL supports the QDL automatically or not. Also the Falcon mode uses network boot, why not documenting how to use it from uSD?

On Tue, Oct 11, 2016 at 3:15 PM, Otavio Salvador otavio.salvador@ossystems.com.br wrote:
On Tue, Oct 11, 2016 at 11:09 AM, Diego Dorta diego.dorta@nxp.com wrote:
Add a README to explain the steps for booting mx6sabresd in different ways: 1. Booting via Normal U-Boot (u-boot.imx) 2. Booting via SPL (SPL and u-boot.img) 3. Booting via Falcon mode (SPL launches the kernel directly)
Signed-off-by: Diego Dorta diego.dorta@nxp.com
It is not clear if the SPL supports the QDL automatically or not. Also
The README mentions that only mx6qsabresd and mx6qpsabresd are supported.
the Falcon mode uses network boot, why not documenting how to use it from uSD?
Network U-Boot?
The README shows how to retrieve the SPL and u-boot.img via DHCP.
There are many others possibilities such as retrieving them from SATA, USB stick, SPI NOR, etc.
Retrieving from DHCP is just an example.

On Tue, Oct 11, 2016 at 11:09 AM, Diego Dorta diego.dorta@nxp.com wrote:
Allow i.MX6Q Sabre SD to load the kernel and dtb via SPL in Falcon mode.
Based on the Falcon mode code for MX6 Gateworks Ventana board.
Signed-off-by: Diego Dorta diego.dorta@nxp.com
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com

Hi Stefano,
On Tue, Oct 11, 2016 at 12:05 PM, Fabio Estevam festevam@gmail.com wrote:
On Tue, Oct 11, 2016 at 11:09 AM, Diego Dorta diego.dorta@nxp.com wrote:
Allow i.MX6Q Sabre SD to load the kernel and dtb via SPL in Falcon mode.
Based on the Falcon mode code for MX6 Gateworks Ventana board.
Signed-off-by: Diego Dorta diego.dorta@nxp.com
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com
Does this series look good for you? Could it be applied?
Thanks

On 24/10/2016 17:26, Fabio Estevam wrote:
Hi Stefano,
On Tue, Oct 11, 2016 at 12:05 PM, Fabio Estevam festevam@gmail.com wrote:
On Tue, Oct 11, 2016 at 11:09 AM, Diego Dorta diego.dorta@nxp.com wrote:
Allow i.MX6Q Sabre SD to load the kernel and dtb via SPL in Falcon mode.
Based on the Falcon mode code for MX6 Gateworks Ventana board.
Signed-off-by: Diego Dorta diego.dorta@nxp.com
Reviewed-by: Fabio Estevam fabio.estevam@nxp.com
Does this series look good for you? Could it be applied?
It was already applied, but I have just pushed to the server today.
Regards, Stefano

On Mon, Oct 24, 2016 at 2:00 PM, Stefano Babic sbabic@denx.de wrote:
It was already applied, but I have just pushed to the server today.
Excellent, I can see the patches there now. Thanks!

On Tue, Oct 11, 2016 at 11:09 AM, Diego Dorta diego.dorta@nxp.com wrote:
Allow i.MX6Q Sabre SD to load the kernel and dtb via SPL in Falcon mode.
Based on the Falcon mode code for MX6 Gateworks Ventana board.
Signed-off-by: Diego Dorta diego.dorta@nxp.com
board/freescale/mx6sabresd/mx6sabresd.c | 12 ++++++++++++ include/configs/mx6sabresd.h | 12 ++++++++++++ 2 files changed, 24 insertions(+)
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index e58c03c..2b6d7be 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -57,6 +57,8 @@ DECLARE_GLOBAL_DATA_PTR;
#define DISP0_PWR_EN IMX_GPIO_NR(1, 21)
+#define KEY_VOL_UP IMX_GPIO_NR(1, 4)
int dram_init(void) { gd->ram_size = imx_ddr_size(); @@ -682,6 +684,16 @@ int checkboard(void) #include <spl.h> #include <libfdt.h>
+#ifdef CONFIG_SPL_OS_BOOT +int spl_start_uboot(void) +{
gpio_direction_input(KEY_VOL_UP);
/* Only enter in Falcon mode if KEY_VOL_UP is pressed */
return gpio_get_value(KEY_VOL_UP);
I would prefer if it booted on falcon by default and vol-up could make it load the U-Boot.img as a recovery option.
+} +#endif
static void ccgr_init(void) { struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h index 5c2734d..6a7a0d3 100644 --- a/include/configs/mx6sabresd.h +++ b/include/configs/mx6sabresd.h @@ -11,6 +11,7 @@
#ifdef CONFIG_SPL #include "imx6_spl.h" +#undef CONFIG_SPL_EXT_SUPPORT #endif
#define CONFIG_MACH_TYPE 3980 @@ -22,6 +23,17 @@
#include "mx6sabre_common.h"
+/* Falcon Mode */ +#define CONFIG_CMD_SPL +#define CONFIG_SPL_OS_BOOT +#define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000 +#define CONFIG_CMD_SPL_WRITE_SIZE (128 * SZ_1K)
+/* Falcon Mode - MMC support: args@1MB kernel@2MB */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) +#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */
#define CONFIG_SYS_FSL_USDHC_NUM 3 #if defined(CONFIG_ENV_IS_IN_MMC)
#define CONFIG_SYS_MMC_ENV_DEV 1 /* SDHC3 */
2.7.4
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hi Otavio,
On Tue, Oct 11, 2016 at 3:16 PM, Otavio Salvador otavio.salvador@ossystems.com.br wrote:
I would prefer if it booted on falcon by default and vol-up could make it load the U-Boot.img as a recovery option.
In this case we would break existing SPL users of mx6sabresd.
All of a sudden SPL will no longer boot, which is not a good user experience.
Please keep in mind that mx6sabresd is a development board, not a final product, where Falcon mode would make more sense to be enabled by default.

Hi Otavio,
On 11/10/2016 20:16, Otavio Salvador wrote:
On Tue, Oct 11, 2016 at 11:09 AM, Diego Dorta diego.dorta@nxp.com wrote:
Allow i.MX6Q Sabre SD to load the kernel and dtb via SPL in Falcon mode.
Based on the Falcon mode code for MX6 Gateworks Ventana board.
Signed-off-by: Diego Dorta diego.dorta@nxp.com
board/freescale/mx6sabresd/mx6sabresd.c | 12 ++++++++++++ include/configs/mx6sabresd.h | 12 ++++++++++++ 2 files changed, 24 insertions(+)
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index e58c03c..2b6d7be 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -57,6 +57,8 @@ DECLARE_GLOBAL_DATA_PTR;
#define DISP0_PWR_EN IMX_GPIO_NR(1, 21)
+#define KEY_VOL_UP IMX_GPIO_NR(1, 4)
int dram_init(void) { gd->ram_size = imx_ddr_size(); @@ -682,6 +684,16 @@ int checkboard(void) #include <spl.h> #include <libfdt.h>
+#ifdef CONFIG_SPL_OS_BOOT +int spl_start_uboot(void) +{
gpio_direction_input(KEY_VOL_UP);
/* Only enter in Falcon mode if KEY_VOL_UP is pressed */
return gpio_get_value(KEY_VOL_UP);
I would prefer if it booted on falcon by default and vol-up could make it load the U-Boot.img as a recovery option.
For customer boards or final products, I absolutely agree with you. In case of an evaluation board as this one, I tend to support Fabio's concerns, and let the board to start as default U-Boot. Newbie can start to check the board and when they become confident they have still the possibility to switch to optimization like Falcon mode.
Best regards, Stefano
participants (4)
-
Diego Dorta
-
Fabio Estevam
-
Otavio Salvador
-
Stefano Babic