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