blob: 91349948740bcbe01c5096dad653fa8faeffeddc [file] [log] [blame]
huang lina77e50c2015-12-07 11:08:57 +08001/*
2 * (C) Copyright 2015 Rockchip Electronics Co., Ltd
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <asm/io.h>
10#include <asm/arch/uart.h>
11#include <asm/arch/sdram_rk3036.h>
Jeffy Chena32d0092016-01-14 10:19:40 +080012#include <asm/gpio.h>
huang lina77e50c2015-12-07 11:08:57 +080013
14DECLARE_GLOBAL_DATA_PTR;
15
16void get_ddr_config(struct rk3036_ddr_config *config)
17{
18 /* K4B4G1646Q config */
19 config->ddr_type = 3;
20 config->rank = 1;
21 config->cs0_row = 15;
22 config->cs1_row = 15;
23
24 /* 8bank */
25 config->bank = 3;
26 config->col = 10;
27
28 /* 16bit bw */
29 config->bw = 1;
30}
31
Jeffy Chena32d0092016-01-14 10:19:40 +080032#define FASTBOOT_KEY_GPIO 93
33
34int fastboot_key_pressed(void)
35{
36 gpio_request(FASTBOOT_KEY_GPIO, "fastboot_key");
37 gpio_direction_input(FASTBOOT_KEY_GPIO);
38 return !gpio_get_value(FASTBOOT_KEY_GPIO);
39}
40
41#define ROCKCHIP_BOOT_MODE_FASTBOOT 0x5242C309
42
Jacob Chenc95f3782016-09-19 18:46:28 +080043int rk_board_late_init(void)
Jeffy Chena32d0092016-01-14 10:19:40 +080044{
Jacob Chenc95f3782016-09-19 18:46:28 +080045 if (fastboot_key_pressed()) {
Jeffy Chena32d0092016-01-14 10:19:40 +080046 printf("enter fastboot!\n");
Simon Glass6a38e412017-08-03 12:22:09 -060047 env_set("preboot", "setenv preboot; fastboot usb0");
Jeffy Chena32d0092016-01-14 10:19:40 +080048 }
49
50 return 0;
51}