From: Lokesh Vutla Date: Fri, 19 May 2017 07:33:12 +0530 Subject: [U-Boot] [PATCH 1/3] omap: Add routine for setting fastboot variables In-Reply-To: <20170518130102.6820-2-semen.protsenko@linaro.org> References: <20170518130102.6820-1-semen.protsenko@linaro.org> <20170518130102.6820-2-semen.protsenko@linaro.org> Message-ID: <52499176-be2f-519d-3dd9-cd137f0061de@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thursday 18 May 2017 06:31 PM, 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 > --- > arch/arm/include/asm/omap_common.h | 2 + > arch/arm/mach-omap2/utils.c | 134 +++++++++++++++++++++++++++++++++++++ > 2 files changed, 136 insertions(+) > > diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h > index c1a70b15d0..cede2f7b28 100644 > --- a/arch/arm/include/asm/omap_common.h > +++ b/arch/arm/include/asm/omap_common.h > @@ -643,6 +643,8 @@ void omap_die_id_get_board_serial(struct tag_serialnr *serialnr); > void omap_die_id_usbethaddr(void); > void omap_die_id_display(void); > > +void omap_set_fastboot_vars(void); > + > 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..0689c879b0 100644 > --- a/arch/arm/mach-omap2/utils.c > +++ b/arch/arm/mach-omap2/utils.c > @@ -6,6 +6,16 @@ > */ > #include > #include > + > +/* Device type bits in CONTROL_STATUS register */ > +#define DEVICETYPE_OFFSET 6 > +#define DEVICETYPE_MASK (0x7 << DEVICETYPE_OFFSET) > +#define OMAP_TYPE_TEST 0x0 > +#define OMAP_TYPE_EMU 0x1 > +#define OMAP_TYPE_SEC 0x2 > +#define OMAP_TYPE_GP 0x3 > +#define OMAP_TYPE_BAD 0x4 > + > static void do_cancel_out(u32 *num, u32 *den, u32 factor) > { > while (1) { > @@ -18,6 +28,122 @@ static void do_cancel_out(u32 *num, u32 *den, u32 factor) > } > } > > +static const char *omap_get_cpu_type(void) > +{ > + u32 type; > + > + type = readl((*ctrl)->control_status); > + type &= DEVICETYPE_MASK; > + type >>= DEVICETYPE_OFFSET; > + > + switch (type) { > + case OMAP_TYPE_EMU: > + return "EMU"; > + case OMAP_TYPE_SEC: > + return "HS"; > + case OMAP_TYPE_GP: > + return "GP"; > + default: > + return NULL; > + } > +} use get_device_type() and drop this function. Thanks and regards, Lokesh