This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5718: Memory booting device descriptor

Part Number: AM5718

Tool/software: Linux

According to section 33.3.8.4 Image Execution of the AM5718 TRM (SPRUHZ7F), at offset 0x04 in the Booting Parameter Structure, there's a pointer to something called "Memory booting device descriptor".  I was unable to find a description of that descriptor.  The U-boot code that handles that descriptor is save_omap_boot_params() found in arch/arm/mach-omap2/boot-common.c.  The reference is

boot_params = omap_boot_params->boot_device_descriptor;

The code then adds an offset to get to another address to which is added yet another offset to access the boot mode.

Does anyone know where that structure is documented?

P.S.  That same code can potentially invoke the function omap_sys_boot_device().  For my situation, that function isn't called which is a good thing since I believe that function has a serious bug.  The implementation of that function is found in arch/arm/mach-omap2/omap5.  That function claims to be accessing the register that contains the latched SYS_BOOT pins.  The invocation is:

sys_boot = readl((u32 *) (*ctrl)->control_status) & ((1 << 4) - 1);

According to arch/arm/mach-omap2/omap5/prcm-regs.c, control_status resolves to 0x4A002134 which Table 18-32. CTRL_CORE_STATUS of the TRM shows to be a completely different register.  The bits that function is reading are marked "RESERVED".  (There is code elsewhere that correctly accesses that register to determine DEVICE_TYPE.)

  • So for your first question, when the boot ROM transfers control to SPL, the address of the booting parameters structure is in r0. Early in lowlevel_init.S it is save into SRAM from a call to save_boot_params. The code is below

    ENTRY(save_boot_params)
    ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
    str r0, [r1]
    b save_boot_params_ret
    ENDPROC(save_boot_params)

    In save_omap_boot_params, the boot device is determined by this code

    omap_boot_params = (struct omap_boot_parameters *)boot_params;
    boot_device = omap_boot_params->boot_device;

    The omap_boot_parameters structure is in arch/arm/include/asm/arch-omap5/omap.h and maps to the structure in the TRM

    struct omap_boot_parameters {
    unsigned int boot_message;
    unsigned int boot_device_descriptor;
    unsigned char boot_device;
    unsigned char reset_reason;
    unsigned char ch_flags;
    };

    So boot_device is the boot device the ROM set in the structure.

    For your second question, the control_status is not the one in prcm-regs.c. It is in the structure sys_ctrl_regs in arch/arm/include/asm/omap_common.h

    struct omap_sys_ctrl_regs {
    u32 control_status;
    u32 control_core_mac_id_0_lo;
    u32 control_core_mac_id_0_hi;

    Steve K.
  • First let me thank you for clearing up my confusion about my second question.  I now see how that works.

    As to my first question, I had been able to follow the description in the TRM and the code down to the point where struct omap_boot_parameters is populated.  At that point, I'm trying to understand the computation of boot_mode.  For my hardware/configuration, the code flow eventually gets to save_omap_boot_params() in arch/arm/mach-omap2/boot-common.c.  There are several points in the flow that boot_mode can potentially be determined but for my world, none of those points are hit until the flow gets to around line 132 (at least in the version of boot-common.c that came with the SDK we started with).  Ignoring all the error checks, here's the essential computation:

    	boot_params = omap_boot_params->boot_device_descriptor;
    	boot_params = *((u32 *)(boot_params + DEVICE_DATA_OFFSET));
    	boot_mode = *((u32 *)(boot_params + BOOT_MODE_OFFSET));
    

    So it's what boot_device_descriptor looks like that is of interest.  The TRM documents all the fields that comprise struct omap_boot_parameters except, as far as I can tell, boot_device_descriptor. The TRM has some references to "device_descriptor" but in all cases, it's in the context of USB and that's clearly not my situation nor does the USB device_descriptor have a layout compatible with the above code.  The only documentation in the code concerning those two offsets (found in arch/arm/include/asm/omap_common.h) is that they are "Boot parameters".

  • EDIT: looks like something happened when I was pasting the code . Those "strong" tags in the first line aren't there. The line is just:

    boot_params = omap_boot_params->boot_device_descriptor;
  • Which SDK are you using?

    Steve K.

  • The guy that knows the SDK version isn't around at the moment but I had earlier managed to figure out where we are with respect to TI's U-Boot tree at git://git.ti.com/ti-u-boot/ti-u-boot.git. We are at tag ti2017.04-rc1.
  • I have asked the TRM owner if there is a description somewhere.

    Steve K.
  • The descriptor is internal to the boot ROM so it is not described anywhere. The software team is looking into why u-boot is using it.

    Steve K.