On Mon, May 22, 2017 at 07:16:40PM +0300, Sam Protsenko wrote:

> This patch reuses new option, which allows us to expose variables
> from environment to "fastboot getvar" command. Those variables must be
> of "fastboot.%s" format.
> 
> Signed-off-by: Sam Protsenko <semen.protse...@linaro.org>
> ---
> Changes in v2:
>  - use get_device_type() instead of omap_get_cpu_type()
>  - guard omap_set_fastboot_vars() with CONFIG_FASTBOOT_FLASH
>  - use correct board names
> 
>  arch/arm/include/asm/omap_common.h |   6 ++
>  arch/arm/mach-omap2/utils.c        | 115 
> +++++++++++++++++++++++++++++++++++++
>  2 files changed, 121 insertions(+)
> 
> diff --git a/arch/arm/include/asm/omap_common.h 
> b/arch/arm/include/asm/omap_common.h
> index c1a70b15d0..a4bfa0c451 100644
> --- a/arch/arm/include/asm/omap_common.h
> +++ b/arch/arm/include/asm/omap_common.h
> @@ -643,6 +643,12 @@ void omap_die_id_get_board_serial(struct tag_serialnr 
> *serialnr);
>  void omap_die_id_usbethaddr(void);
>  void omap_die_id_display(void);
>  
> +#ifdef CONFIG_FASTBOOT_FLASH
> +void omap_set_fastboot_vars(void);
> +#else
> +static inline void omap_set_fastboot_vars(void) { }
> +#endif
> +
>  void recalibrate_iodelay(void);
>  
>  void omap_smc1(u32 service, u32 val);
> diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
> index 2d03ebfbd3..1d0b63350a 100644
> --- a/arch/arm/mach-omap2/utils.c
> +++ b/arch/arm/mach-omap2/utils.c
> @@ -18,6 +18,121 @@ static void do_cancel_out(u32 *num, u32 *den, u32 factor)
>       }
>  }
>  
> +#ifdef CONFIG_FASTBOOT_FLASH
> +static void omap_set_fastboot_cpu(void)
> +{
> +     char *cpu;
> +     u32 cpu_rev = omap_revision();
> +
> +     switch (cpu_rev) {
> +     case DRA752_ES1_0:
> +     case DRA752_ES1_1:
> +     case DRA752_ES2_0:
> +             cpu = "DRA752";
> +             break;
> +     case DRA722_ES1_0:
> +     case DRA722_ES2_0:
> +             cpu = "DRA722";
> +             break;
> +     default:
> +             cpu = NULL;
> +             printf("Warning: fastboot.cpu: unknown CPU rev: %u\n", cpu_rev);
> +     }
> +
> +     setenv("fastboot.cpu", cpu);
> +}
> +
> +static void omap_set_fastboot_secure(void)
> +{
> +     const char *secure;
> +     u32 dev = get_device_type();
> +
> +     switch (dev) {
> +     case EMU_DEVICE:
> +             secure = "EMU";
> +             break;
> +     case HS_DEVICE:
> +             secure = "HS";
> +             break;
> +     case GP_DEVICE:
> +             secure = "GP";
> +             break;
> +     default:
> +             secure = NULL;
> +             printf("Warning: fastboot.secure: unknown CPU sec: %u\n", dev);
> +     }
> +
> +     setenv("fastboot.secure", secure);
> +}

OK, this shows that the code we have in
arch/arm/mach-omap2/am33xx/sys_info.c and
arch/arm/mach-omap2/hwinit-common.c and
arch/arm/mach-omap2/omap3/sys_info.c needs to get re-worked a bit so
that we:
- Don't bloat families that we won't have (since we know at build time
  what's possible)
- Don't repeat the same code in N places to check device type / family /
  PG.

Yes, this will require a little more work as the fastboot side is OK
with "DRA722", the question I have is can we construct that similar to
what omap_rev_string() does?  Thanks!

-- 
Tom

Attachment: signature.asc
Description: Digital signature

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to