Skip to contentSkip to conversation

omap: Provide fastboot variables for fastboot.sh

PATCH Superseded Sam Protsenko 2 participants 8 messages May 18, 2017 – May 22, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover omap: Provide fastboot variables for fastboot.sh

fastboot.sh is a script used for flashing Android images for TI boards (and can be found in corresponding AOSP sources). This script relies on some fastboot variables, which can be accessed with "fastboot getvar" command.

This patch series exports those variables, which fastboot.sh script relies on. The list of added variables:
- "cpu": CPU type (string, like "J6")
- "secure": CPU security index (string, like "GP")
- "board_rev": board revision (string, like "A.30")
- "userdata_size": size of userdata partition (number, in KiB)

Variables are enabled for AM57x EVM and DRA7 EVM boards, which are mainly supported TI boards, capable of Android running.

Sam Protsenko (3):
omap: Add routine for setting fastboot variables
arm: am57xx: Set fastboot variables in environment
arm: dra7: Set fastboot variables in environment

 arch/arm/include/asm/omap_common.h |   2 +
 arch/arm/mach-omap2/utils.c        | 134 +++++++++++++++++++++++++++++++++++++
 board/ti/am57xx/board.c            |   1 +
 board/ti/dra7xx/evm.c              |   1 +
 4 files changed, 138 insertions(+)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 omap: Add routine for setting fastboot variables

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.

---
 arch/arm/include/asm/omap_common.h |   2 +
 arch/arm/mach-omap2/utils.c        | 134 +++++++++++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+)
arch/arm/include/asm/omap_common.h +2 -0
index c1a70b15d0..cede2f7b28 100644
@@ -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);
arch/arm/mach-omap2/utils.c +134 -0

149 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

PATCH 1/3 omap: Add routine for setting fastboot variables

Quoted 57 lines · Sam Protsenko

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.

---
 arch/arm/include/asm/omap_common.h |   2 +
 arch/arm/mach-omap2/utils.c        | 134 +++++++++++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+)
arch/arm/include/asm/omap_common.h +2 -0
index c1a70b15d0..cede2f7b28 100644
@@ -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);
arch/arm/mach-omap2/utils.c +19 -0
index 2d03ebfbd3..0689c879b0 100644
@@ -6,6 +6,16 @@
  */
 #include <common.h>
 #include <asm/arch/sys_proto.h>
+
+/* 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) {

arch/arm/mach-omap2/utils.c static void do_cancel_out(u32 *num, u32 *den, u32 factor) · line 49

Quoted 10 lines
arch/arm/mach-omap2/utils.c +10 -0
+	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

#3 lore raw

PATCH 1/3 omap: Add routine for setting fastboot variables

Quoted 64 lines · Lokesh Vutla
Quoted 61 lines · Sam Protsenko

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.

---
 arch/arm/include/asm/omap_common.h |   2 +
 arch/arm/mach-omap2/utils.c        | 134 +++++++++++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+)
arch/arm/include/asm/omap_common.h +2 -0
index c1a70b15d0..cede2f7b28 100644
@@ -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);
arch/arm/mach-omap2/utils.c +23 -0
index 2d03ebfbd3..0689c879b0 100644
@@ -6,6 +6,16 @@
  */
 #include <common.h>
 #include <asm/arch/sys_proto.h>
+
+/* 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";
Quoted 9 lines

arch/arm/mach-omap2/utils.c static void do_cancel_out(u32 *num, u32 *den, u32 factor) · line 49

Quoted 6 lines
arch/arm/mach-omap2/utils.c +6 -0
+     case OMAP_TYPE_GP:
+             return "GP";
+     default:
+             return NULL;
+     }
+}

use get_device_type() and drop this function.

Thanks for suggestion. Fixed that in v2 series. Please review.

Quoted 3 lines

Thanks and regards,
Lokesh

#4 lore raw

PATCH 2/3 arm: am57xx: Set fastboot variables in environment

In reply to Sam Protsenko

One can obtain those variables using next commands:

    $ fastboot getvar cpu
    $ fastboot getvar secure
    $ fastboot getvar board_rev
    $ fastboot getvar userdata_size

Those variables are needed for fastboot.sh script.

---
 board/ti/am57xx/board.c | 1 +
 1 file changed, 1 insertion(+)
board/ti/am57xx/board.c +1 -0
index 3be697a6ea..c8ebcdbcc8 100644
@@ -573,6 +573,7 @@ int board_late_init(void)
 			    val);
 
 	omap_die_id_serial();
+	omap_set_fastboot_vars();
 
 	am57x_idk_lcd_detect();
 
Signature · 1 line
2.11.0
#5 lore raw

PATCH 2/3 arm: am57xx: Set fastboot variables in environment

Quoted 19 lines · Sam Protsenko

One can obtain those variables using next commands:

    $ fastboot getvar cpu
    $ fastboot getvar secure
    $ fastboot getvar board_rev
    $ fastboot getvar userdata_size

Those variables are needed for fastboot.sh script.

---
 board/ti/am57xx/board.c | 1 +
 1 file changed, 1 insertion(+)
board/ti/am57xx/board.c +0 -0
index 3be697a6ea..c8ebcdbcc8 100644

board/ti/am57xx/board.c int board_late_init(void) · line 576

Quoted 4 lines
board/ti/am57xx/board.c +1 -0
@@ -573,6 +573,7 @@ int board_late_init(void)
 			    val);
 
 	omap_die_id_serial();
+	omap_set_fastboot_vars();

Any chance that we can guard this function with CONFIG_*_FASTBOOT?

Thanks and regards,
Lokesh

#6 lore raw

PATCH 2/3 arm: am57xx: Set fastboot variables in environment

Quoted 24 lines · Lokesh Vutla
Quoted 21 lines · Sam Protsenko

One can obtain those variables using next commands:

    $ fastboot getvar cpu
    $ fastboot getvar secure
    $ fastboot getvar board_rev
    $ fastboot getvar userdata_size

Those variables are needed for fastboot.sh script.

---
 board/ti/am57xx/board.c | 1 +
 1 file changed, 1 insertion(+)
board/ti/am57xx/board.c +0 -0
index 3be697a6ea..c8ebcdbcc8 100644
@@ -573,6 +573,7 @@ int board_late_init(void)
                          val);
 
Quoted 5 lines

board/ti/am57xx/board.c int board_late_init(void) · line 576

Quoted 2 lines
board/ti/am57xx/board.c +1 -0
      omap_die_id_serial();
+     omap_set_fastboot_vars();

Any chance that we can guard this function with CONFIG_*_FASTBOOT?

Done. Just sent v2, please review.

Thanks.

Quoted 2 lines

Thanks and regards,
Lokesh

#7 lore raw

PATCH 3/3 arm: dra7: Set fastboot variables in environment

In reply to Sam Protsenko

One can obtain those variables using next commands:

    $ fastboot getvar cpu
    $ fastboot getvar secure
    $ fastboot getvar board_rev
    $ fastboot getvar userdata_size

Those variables are needed for fastboot.sh script.

---
 board/ti/dra7xx/evm.c | 1 +
 1 file changed, 1 insertion(+)
board/ti/dra7xx/evm.c +1 -0
index 8c02addd08..7d36f03fa1 100644
@@ -561,6 +561,7 @@ int board_late_init(void)
 		setenv("boot_fit", "1");
 
 	omap_die_id_serial();
+	omap_set_fastboot_vars();
 #endif
 	return 0;
 }
Signature · 1 line
2.11.0