blob: 2faeab9baf518245b42fe26e08fa5ed3d11209cf [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
huang lina77e50c2015-12-07 11:08:57 +08002/*
3 * (C) Copyright 2015 Rockchip Electronics Co., Ltd
huang lina77e50c2015-12-07 11:08:57 +08004 */
5
6#include <common.h>
7#include <dm.h>
8#include <asm/io.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +08009#include <asm/arch-rockchip/uart.h>
10#include <asm/arch-rockchip/sdram_rk3036.h>
Jeffy Chena32d0092016-01-14 10:19:40 +080011#include <asm/gpio.h>
huang lina77e50c2015-12-07 11:08:57 +080012
huang lina77e50c2015-12-07 11:08:57 +080013void get_ddr_config(struct rk3036_ddr_config *config)
14{
15 /* K4B4G1646Q config */
16 config->ddr_type = 3;
17 config->rank = 1;
18 config->cs0_row = 15;
19 config->cs1_row = 15;
20
21 /* 8bank */
22 config->bank = 3;
23 config->col = 10;
24
25 /* 16bit bw */
26 config->bw = 1;
27}
28
Jeffy Chena32d0092016-01-14 10:19:40 +080029#define FASTBOOT_KEY_GPIO 93
30
31int fastboot_key_pressed(void)
32{
33 gpio_request(FASTBOOT_KEY_GPIO, "fastboot_key");
34 gpio_direction_input(FASTBOOT_KEY_GPIO);
35 return !gpio_get_value(FASTBOOT_KEY_GPIO);
36}
37
38#define ROCKCHIP_BOOT_MODE_FASTBOOT 0x5242C309
39
Jacob Chenc95f3782016-09-19 18:46:28 +080040int rk_board_late_init(void)
Jeffy Chena32d0092016-01-14 10:19:40 +080041{
Jacob Chenc95f3782016-09-19 18:46:28 +080042 if (fastboot_key_pressed()) {
Jeffy Chena32d0092016-01-14 10:19:40 +080043 printf("enter fastboot!\n");
Simon Glass6a38e412017-08-03 12:22:09 -060044 env_set("preboot", "setenv preboot; fastboot usb0");
Jeffy Chena32d0092016-01-14 10:19:40 +080045 }
46
47 return 0;
48}