[RK3288] [Android6.0] Debug Notes---System recognizes different hardware versions method "Go"

Source: Internet
Author: User

This article was reproduced from: http://m.blog.csdn.net/kris_fei/article/details/70226451

Platform:rockchip
Os:android 6.0
kernel:3.10.92

Demand:
The hardware version is different, by the high and low levels of a few gpio to represent the various versions,
U-boot/kernel/hal/framework/app layer needs to be used, then
It can be implemented using the system's own parameter passing mechanism and the property API.

Take a gpio as an example.
Changes:
U-boot
Diff--git A/board/rockchip/rk32xx/rk32xx.c B/board/rockchip/rk32xx/rk32xx.c
Index f043f77: e9a7466 100644
---a/board/rockchip/rk32xx/rk32xx.c
+ + B/BOARD/ROCKCHIP/RK32XX/RK32XX.C
@@ -164,6 +164,12 @@ -164,6 void board_init_adjust_env (void)
}
}
Macro Definition Package up
+/*kris,161219, HW version verify. {*/
+ #ifdef Config_eco_hw_rev
+u8 Eco_hw_rev = 0;
+ #endif
+/*kris,161219, HW version verify. }*/
+
#ifdef Config_board_late_init
extern Char bootloader_ver[24];
int board_late_init (void)
@@ -182,6 +188,15 @@ -182,6 board_late_init (void)
Key_init ();
#endif

+/*kris,161219, HW version verify. {*/
+ #ifdef Config_eco_hw_rev
+ #define GPIO_ECO_HW_REV (Gpio_bank8 | GPIO_A7)
Get GPIO Status
+ gpio_direction_input (Gpio_eco_hw_rev);
+ Eco_hw_rev = Gpio_get_value (Gpio_eco_hw_rev);
+ printf ("HW board check version:%d\n", Gpio_get_value (Gpio_eco_hw_rev));
+ #endif
+/*kris,161219, HW version verify. }*/
+
#ifdef Config_rk_power
Debug ("pmic_init\n");
Pmic_init (0);
Diff--git A/common/cmd_bootrk.c B/common/cmd_bootrk.c
Index 17ad496: 9f101c6 100755
---a/common/cmd_bootrk.c
+ + B/COMMON/CMD_BOOTRK.C
@@ -42,6 +42,14 @@ -42,6 int do_bootm_linux (int flag, int argc, char *argv[],
#if defined (config_power_rk818)
extern bool Is_rk81x_fg_init (void);
#endif
+
+/*kris,161219, HW version verify. {*/
+ #ifdef Config_eco_hw_rev
+extern U8 Eco_hw_rev;
+ #endif
+/*kris,161219, HW version verify. }*/
+
+
extern int Rkimage_load_image (RK_BOOT_IMG_HDR *hdr,
Const disk_partition_t *BOOT_PTN, const disk_partition_t *KERNEL_PTN);

@@ -486,6 +494,13 @@ -486,6 void rk_commandline_setenv (const char *boot_name, RK_BOOT_IMG_HDR *hdr, b
"%s adc.incre=%d", Command_line, g_increment);
#endif

+/*kris,161219, HW version verify. {*/
+ #ifdef Config_eco_hw_rev
The CmdLine parameter transfer mechanism of U-boot to kernel is used to transmit to kernel.
+snprintf (command_line, sizeof (command_line),
+ "%s androidboot.eco_hw_rev=%s", Command_line, Eco_hw_rev? " Primary ":" secondary ");
+ #endif
+/*kris,161219, HW version verify. }*/
+
Char *sn = getenv ("fbt_sn#");
if (sn! = NULL) {
/* Append serial number if it wasn ' t in device_info already */
Diff--git A/include/configs/rk32plat.h B/include/configs/rk32plat.h
Index f80799f: EC5E41D 100755
---a/include/configs/rk32plat.h
+ + B/include/configs/rk32plat.h
@@ -224,4 +224,8 @@

#endif/* Config_rk_power */

+
+/*kris,161219, HW version verify.*/
+ #define Config_eco_hw_rev
+
#endif/* __rk32plat_config_h */

Kernel:
Diff--git A/arch/arm/mach-rockchip/common.c B/arch/arm/mach-rockchip/common.c
Index E80880E: 107b58c 100755
---a/arch/arm/mach-rockchip/common.c
+ + B/ARCH/ARM/MACH-ROCKCHIP/COMMON.C
@@ -340,6 +340,21 @@ -340,6 int __init rockchip_uboot_logo_setup (char *p)
}
Early_param ("Uboot_logo", Rockchip_uboot_logo_setup);

+/*kris, 20161219, add check HW Rev interface. {*/
Kernel can be used to judge the Eco_hw_rev.
+int Eco_hw_rev;
+static int __init Early_eco_hw_rev (char *p)
+{
+ get_option (&p, &eco_hw_rev);
+ if (!strncmp (p, "Primary", 7))
+ Eco_hw_rev = 1;
+ Else if (!strncmp (p, "secondary", 9))
+ Eco_hw_rev = 0;
+ PRINTK ("androidboot.eco_hw_rev:%s\n", p);
+ return 0;
+}
+early_param ("Androidboot.eco_hw_rev", Early_eco_hw_rev);
+/*kris, 20161219, add check HW Rev interface. }*/
+

Userspace:
Notice that the CmdLine parameter is Androidboot.eco_hw_rev, and the CmdLine parameter that starts with Androidboot is parsed in the init process.
Refer to: http://blog.csdn.net/kris_fei/article/details/50925356
The property is eventually generated in the RO.BOOT.XXX format. In Hal, Natvie, the app layer has a corresponding API to parse the property so that the entire system can be used.

[RK3288] [Android6.0] Debug Notes---System recognizes different hardware versions method "Go"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.