Skip to content
  • Alexander Pockes's avatar
    cgtqmx6eval: add falcon mode implementation · 16278856
    Alexander Pockes authored and Michael Schanz's avatar Michael Schanz committed
    Based on the results of Alexander Schuller's Bachelor Thesis (i.mx6 quickboot)
    
    Overview
    --------
    A standard u-boot build consists of two image files: uboot.img and SPL.
    The bootrom is loading the SPL image which performs some basic/initial
    configuraion tasks. Afterwards, SPL loads the uboot.img which loads device-tree
    and kernel image files.
    Falcon mode means, enabling SPL to load/execute the kernel image directly.
    This accelerates boot time but requires special u-boot configuration as well as
    special (u)SD-card/EMMC setup.
    
    congatec's falcon mode implementation enables SPL to...
    -> load the kernel image directly from an arbitrary MMC device (uSD, SD, EMMC)
    -> select the boot target (uboot.img/kernel) dependent on GPIO-level or
       environment-settings
    -> load uboot.img stored at arbitrary MMC device by definition of
       <CONFIG_CGT_FALCON_MODE> and undefining <CONFIG_CGT_FALCON_MODE_OS_BOOT>.
       Please note, the environment has to be stored at SPI-flash.
    
    Notes
    -----
    -> MMC device must be specified by definition of <CONFIG_CGT_FALCON_MODE_USD>,
       <CONFIG_CGT_FALCON_MODE_SD> or <CONFIG_CGT_FALCON_MODE_EMMC>
    -> Boot target selection via GPIO...
        - is enabled by definition of <CONFIG_CGT_FALCON_MODE_IMG_SEL_GPIO>
        - is customizable via <BOOT_MODE_BTN>
    -> Boot target selection via environment variable...
        - is enabled by definition of <CONFIG_CGT_FALCON_MODE_IMG_SEL_ENV>
        - can be combined with selection via GPIO
    
    Standard behaviour
    ------------------
    Preconditions:
        -> Proper MMC setup
            - argument file stored at sector 0x800
            - kernel image (uImage) stored at sector 0x1000
            - ext3 root filesystem starting at sector 0x8000 (32768)
        -> Falcon mode enabled <SPL> and <uboot.img> are stored at SPI-flash
    
    a) Boot target selection via GPIO ENABLED:
        SPL tries to load kernel/uboot.img image from MMC device, if there is no
        boot image found, SPL loads uboot.img from SPI-flash.
        Press <BOOT_MODE_BTN> in order to force execution of uboot.img.
    
    b) Boot target selection via environment ENABLED:
        (I) <boot_os> is NOT set to <1>
            SPL tries to load uboot.img from MMC, if there is no uboot.img
            found, SPL loads uboot.img from SPI-flash.
            In order to load the kernel directly, the environtment variable
            <boot_os> must be set to <1>
        (II) <boot_os> is set to <1>
            SPL tries to load kernel image from MMC, if there is no kernel image
            found, SPL loads uboot.img from SPI-flash.
    
    c) Both boot target selections are ENABLED:
        (I) <boot_os> is NOT set to <1>
            SPL tries to load uboot.img from MMC, if there is no uboot.img found,
            SPL loads uboot.img from SPI-flash.
        (II) <boot_os> is set to <1>
            SPL tries to load kernelimage from MMC, if there is no boot
            image found, SPL loads uboot.img from SPI-flash.
            Press <BOOT_MODE_BTN> in order to force execution of uboot.img.
    
    d) Both boot target selections are DISABLED:
        SPL tries to load kernel/uboot.img image from MMC device, if there is no
        boot image found, SPL loads uboot.img from SPI-flash.
    
    Important changes at cgtqmx6eval specific code:
    -----------------------------------------------
    - boot order changed: MMC (1), SPI (2) by overloading board_boot_order()
    - SPL: selection of image type to boot (uboot.img/kernel) via GPIO or/and
      environment variable <boot_os> by overloading spl_start_uboot()
    
    Minor changes at common/imx6-related u-boot code required:
    ----------------------------------------------------------
    - arch/arm/imx-common/spl.c: introducing spl_boot_mode_mmc()
        spl_boot_mode() queries OTP register in order to determine the (boot)
        device, the kernel has to be loaded. The underlying assumption is, that
        SPL and u-boot.img/kernel image are always located at the same device.
        Because of the limited size of the SPI-flash (4 MB), the kernel image
        can't be stored at SPI-flash in most cases. spl_boot_mode_mmc()
        determines the boot device - device, where uboot.img/kernel image is
        stored - by evaluating the variable boot_device, refering to the
        specified boot priority list (spl_boot_list[]).
    - include/spl.h: spl_boot_mode_mmc() prototype added
    - common/spl/spl_mmc.c:
        calling spl_boot_mode_mmc() instead of spl_boot_mode() dependent on
        <CONFIG_CGT_FALCON_MODE>
    16278856