From: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org> To: u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org, Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>, huang lin <hl-TNX95d0MmH7DzftRWevZcw@public.gmane.org> Subject: [PATCH v1 6/6] rockchip: kylin: Check fastboot request Date: Mon, 4 Jan 2016 15:50:23 +0800 [thread overview] Message-ID: <1451893823-20309-7-git-send-email-jeffy.chen@rock-chips.com> (raw) In-Reply-To: <1451893823-20309-1-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org> We will save boot mode flag in grf's os_reg[0], if fastboot requested or fastboot key pressed, try to enter fastboot mode at preboot stage. Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org> --- board/kylin/kylin_rk3036/kylin_rk3036.c | 32 ++++++++++++++++++++++++++++++++ include/configs/kylin_rk3036.h | 3 +++ 2 files changed, 35 insertions(+) diff --git a/board/kylin/kylin_rk3036/kylin_rk3036.c b/board/kylin/kylin_rk3036/kylin_rk3036.c index 40d6b52..df2c123 100644 --- a/board/kylin/kylin_rk3036/kylin_rk3036.c +++ b/board/kylin/kylin_rk3036/kylin_rk3036.c @@ -8,10 +8,15 @@ #include <dm.h> #include <asm/io.h> #include <asm/arch/uart.h> +#include <asm/arch-rockchip/grf_rk3036.h> #include <asm/arch/sdram_rk3036.h> +#include <asm/gpio.h> DECLARE_GLOBAL_DATA_PTR; +#define GRF_BASE 0x20008000 +static struct rk3036_grf * const grf = (void *)GRF_BASE; + void get_ddr_config(struct rk3036_ddr_config *config) { /* K4B4G1646Q config */ @@ -28,6 +33,33 @@ void get_ddr_config(struct rk3036_ddr_config *config) config->bw = 1; } +#define FASTBOOT_KEY_GPIO 93 +#define ROCKCHIP_BOOT_MODE_NORMAL 0 +#define ROCKCHIP_BOOT_MODE_FASTBOOT 1 + +int fastboot_key_pressed(void) +{ + gpio_request(FASTBOOT_KEY_GPIO, "fastboot_key"); + gpio_direction_input(FASTBOOT_KEY_GPIO); + return !gpio_get_value(FASTBOOT_KEY_GPIO); +} + +int board_late_init(void) +{ + int boot_mode = readl(&grf->os_reg[0]); + + /* Clear boot mode */ + writel(ROCKCHIP_BOOT_MODE_NORMAL, &grf->os_reg[0]); + + if (boot_mode == ROCKCHIP_BOOT_MODE_FASTBOOT || + fastboot_key_pressed()) { + printf("enter fastboot!\n"); + setenv("preboot", "setenv preboot; fastboot usb0"); + } + + return 0; +} + int board_init(void) { return 0; diff --git a/include/configs/kylin_rk3036.h b/include/configs/kylin_rk3036.h index 49997ec..424e81b 100644 --- a/include/configs/kylin_rk3036.h +++ b/include/configs/kylin_rk3036.h @@ -39,6 +39,9 @@ "mmcpart=5\0" \ "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_PREBOOT + #define CONFIG_ANDROID_BOOT_IMAGE #define CONFIG_SYS_BOOT_RAMDISK_HIGH #define CONFIG_SYS_HUSH_PARSER -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Jeffy Chen <jeffy.chen@rock-chips.com> To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v1 6/6] rockchip: kylin: Check fastboot request Date: Mon, 4 Jan 2016 15:50:23 +0800 [thread overview] Message-ID: <1451893823-20309-7-git-send-email-jeffy.chen@rock-chips.com> (raw) In-Reply-To: <1451893823-20309-1-git-send-email-jeffy.chen@rock-chips.com> We will save boot mode flag in grf's os_reg[0], if fastboot requested or fastboot key pressed, try to enter fastboot mode at preboot stage. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> --- board/kylin/kylin_rk3036/kylin_rk3036.c | 32 ++++++++++++++++++++++++++++++++ include/configs/kylin_rk3036.h | 3 +++ 2 files changed, 35 insertions(+) diff --git a/board/kylin/kylin_rk3036/kylin_rk3036.c b/board/kylin/kylin_rk3036/kylin_rk3036.c index 40d6b52..df2c123 100644 --- a/board/kylin/kylin_rk3036/kylin_rk3036.c +++ b/board/kylin/kylin_rk3036/kylin_rk3036.c @@ -8,10 +8,15 @@ #include <dm.h> #include <asm/io.h> #include <asm/arch/uart.h> +#include <asm/arch-rockchip/grf_rk3036.h> #include <asm/arch/sdram_rk3036.h> +#include <asm/gpio.h> DECLARE_GLOBAL_DATA_PTR; +#define GRF_BASE 0x20008000 +static struct rk3036_grf * const grf = (void *)GRF_BASE; + void get_ddr_config(struct rk3036_ddr_config *config) { /* K4B4G1646Q config */ @@ -28,6 +33,33 @@ void get_ddr_config(struct rk3036_ddr_config *config) config->bw = 1; } +#define FASTBOOT_KEY_GPIO 93 +#define ROCKCHIP_BOOT_MODE_NORMAL 0 +#define ROCKCHIP_BOOT_MODE_FASTBOOT 1 + +int fastboot_key_pressed(void) +{ + gpio_request(FASTBOOT_KEY_GPIO, "fastboot_key"); + gpio_direction_input(FASTBOOT_KEY_GPIO); + return !gpio_get_value(FASTBOOT_KEY_GPIO); +} + +int board_late_init(void) +{ + int boot_mode = readl(&grf->os_reg[0]); + + /* Clear boot mode */ + writel(ROCKCHIP_BOOT_MODE_NORMAL, &grf->os_reg[0]); + + if (boot_mode == ROCKCHIP_BOOT_MODE_FASTBOOT || + fastboot_key_pressed()) { + printf("enter fastboot!\n"); + setenv("preboot", "setenv preboot; fastboot usb0"); + } + + return 0; +} + int board_init(void) { return 0; diff --git a/include/configs/kylin_rk3036.h b/include/configs/kylin_rk3036.h index 49997ec..424e81b 100644 --- a/include/configs/kylin_rk3036.h +++ b/include/configs/kylin_rk3036.h @@ -39,6 +39,9 @@ "mmcpart=5\0" \ "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_PREBOOT + #define CONFIG_ANDROID_BOOT_IMAGE #define CONFIG_SYS_BOOT_RAMDISK_HIGH #define CONFIG_SYS_HUSH_PARSER -- 2.1.4
next prev parent reply other threads:[~2016-01-04 7:50 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-01-04 7:50 [PATCH v1 0/6] rockchip: kylin: Boot with android boot image Jeffy Chen 2016-01-04 7:50 ` [U-Boot] " Jeffy Chen [not found] ` <1451893823-20309-1-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org> 2016-01-04 7:50 ` [PATCH v1 1/6] common/image-fdt.c: Make boot_get_fdt() perform a check for Android images Jeffy Chen 2016-01-04 7:50 ` [U-Boot] " Jeffy Chen 2016-01-08 3:33 ` Simon Glass 2016-01-08 3:33 ` [U-Boot] " Simon Glass 2016-01-04 7:50 ` [PATCH v1 2/6] ARM: bootm: Try to use relocated ramdisk Jeffy Chen 2016-01-04 7:50 ` [U-Boot] " Jeffy Chen 2016-01-08 3:34 ` Simon Glass 2016-01-08 3:34 ` [U-Boot] " Simon Glass 2016-01-04 7:50 ` [PATCH v1 3/6] rockchip: rk3036: Bind GPIO banks Jeffy Chen 2016-01-04 7:50 ` [U-Boot] " Jeffy Chen 2016-01-08 3:34 ` Simon Glass 2016-01-08 3:34 ` [U-Boot] " Simon Glass 2016-01-04 7:50 ` [PATCH v1 4/6] rockchip: kylin: Add default gpt partition table Jeffy Chen 2016-01-04 7:50 ` [U-Boot] " Jeffy Chen 2016-01-08 3:34 ` Simon Glass 2016-01-08 3:34 ` [U-Boot] " Simon Glass 2016-01-04 7:50 ` [PATCH v1 5/6] rockchip: kylin: Enable boot with android boot image Jeffy Chen 2016-01-04 7:50 ` [U-Boot] " Jeffy Chen [not found] ` <1451893823-20309-6-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org> 2016-01-08 3:34 ` Simon Glass 2016-01-08 3:34 ` [U-Boot] " Simon Glass [not found] ` <CAPnjgZ1G=5=gqy6yGV1NZ13Zv0BACRYMPpdAoFAi+sv2TPXknw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2016-01-08 10:51 ` Jeffy Chen 2016-01-08 10:51 ` [U-Boot] " Jeffy Chen [not found] ` <568F94B8.60101-TNX95d0MmH7DzftRWevZcw@public.gmane.org> 2016-01-11 16:58 ` Simon Glass 2016-01-11 16:58 ` [U-Boot] " Simon Glass [not found] ` <CAPnjgZ2_wS1N8uO23+M0RJZovVFx7Wc_uMqOC37nGGBQN7NZZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2016-01-12 2:36 ` Jeffy Chen 2016-01-12 2:36 ` [U-Boot] " Jeffy Chen 2016-01-04 7:50 ` Jeffy Chen [this message] 2016-01-04 7:50 ` [U-Boot] [PATCH v1 6/6] rockchip: kylin: Check fastboot request Jeffy Chen [not found] ` <1451893823-20309-7-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org> 2016-01-08 3:34 ` Simon Glass 2016-01-08 3:34 ` [U-Boot] " Simon Glass
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1451893823-20309-7-git-send-email-jeffy.chen@rock-chips.com \ --to=jeffy.chen-tnx95d0mmh7dzftrwevzcw@public.gmane.org \ --cc=hl-TNX95d0MmH7DzftRWevZcw@public.gmane.org \ --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \ --cc=u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.