1 /* 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> 12 #include <asm/gpio.h> 13 14 DECLARE_GLOBAL_DATA_PTR; 15 16 void 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 32 #define FASTBOOT_KEY_GPIO 93 33 34 int 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 43 int rk_board_late_init(void) 44 { 45 if (fastboot_key_pressed()) { 46 printf("enter fastboot!\n"); 47 env_set("preboot", "setenv preboot; fastboot usb0"); 48 } 49 50 return 0; 51 } 52