2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-12-07 03:08:57 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2015 Rockchip Electronics Co., Ltd
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <dm.h>
|
2020-05-10 17:40:03 +00:00
|
|
|
#include <env.h>
|
2019-11-14 19:57:46 +00:00
|
|
|
#include <init.h>
|
2015-12-07 03:08:57 +00:00
|
|
|
#include <asm/io.h>
|
2019-03-28 03:01:23 +00:00
|
|
|
#include <asm/arch-rockchip/uart.h>
|
|
|
|
#include <asm/arch-rockchip/sdram_rk3036.h>
|
2016-01-14 02:19:40 +00:00
|
|
|
#include <asm/gpio.h>
|
2015-12-07 03:08:57 +00:00
|
|
|
|
|
|
|
void get_ddr_config(struct rk3036_ddr_config *config)
|
|
|
|
{
|
|
|
|
/* K4B4G1646Q config */
|
|
|
|
config->ddr_type = 3;
|
|
|
|
config->rank = 1;
|
|
|
|
config->cs0_row = 15;
|
|
|
|
config->cs1_row = 15;
|
|
|
|
|
|
|
|
/* 8bank */
|
|
|
|
config->bank = 3;
|
|
|
|
config->col = 10;
|
|
|
|
|
|
|
|
/* 16bit bw */
|
|
|
|
config->bw = 1;
|
|
|
|
}
|
|
|
|
|
2016-01-14 02:19:40 +00:00
|
|
|
#define FASTBOOT_KEY_GPIO 93
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ROCKCHIP_BOOT_MODE_FASTBOOT 0x5242C309
|
|
|
|
|
2016-09-19 10:46:28 +00:00
|
|
|
int rk_board_late_init(void)
|
2016-01-14 02:19:40 +00:00
|
|
|
{
|
2016-09-19 10:46:28 +00:00
|
|
|
if (fastboot_key_pressed()) {
|
2016-01-14 02:19:40 +00:00
|
|
|
printf("enter fastboot!\n");
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("preboot", "setenv preboot; fastboot usb0");
|
2016-01-14 02:19:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|