command: Remove the cmd_tbl_t typedef
[oweals/u-boot.git] / board / rockchip / kylin_rk3036 / kylin_rk3036.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2015 Rockchip Electronics Co., Ltd
4  */
5
6 #include <common.h>
7 #include <dm.h>
8 #include <env.h>
9 #include <init.h>
10 #include <asm/io.h>
11 #include <asm/arch-rockchip/uart.h>
12 #include <asm/arch-rockchip/sdram_rk3036.h>
13 #include <asm/gpio.h>
14
15 void get_ddr_config(struct rk3036_ddr_config *config)
16 {
17         /* K4B4G1646Q config */
18         config->ddr_type = 3;
19         config->rank = 1;
20         config->cs0_row = 15;
21         config->cs1_row = 15;
22
23         /* 8bank */
24         config->bank = 3;
25         config->col = 10;
26
27         /* 16bit bw */
28         config->bw = 1;
29 }
30
31 #define FASTBOOT_KEY_GPIO 93
32
33 int fastboot_key_pressed(void)
34 {
35         gpio_request(FASTBOOT_KEY_GPIO, "fastboot_key");
36         gpio_direction_input(FASTBOOT_KEY_GPIO);
37         return !gpio_get_value(FASTBOOT_KEY_GPIO);
38 }
39
40 #define ROCKCHIP_BOOT_MODE_FASTBOOT     0x5242C309
41
42 int rk_board_late_init(void)
43 {
44         if (fastboot_key_pressed()) {
45                 printf("enter fastboot!\n");
46                 env_set("preboot", "setenv preboot; fastboot usb0");
47         }
48
49         return 0;
50 }