kylin_rk3036.c 929 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2015 Rockchip Electronics Co., Ltd
  4. */
  5. #include <common.h>
  6. #include <dm.h>
  7. #include <asm/io.h>
  8. #include <asm/arch-rockchip/uart.h>
  9. #include <asm/arch-rockchip/sdram_rk3036.h>
  10. #include <asm/gpio.h>
  11. void get_ddr_config(struct rk3036_ddr_config *config)
  12. {
  13. /* K4B4G1646Q config */
  14. config->ddr_type = 3;
  15. config->rank = 1;
  16. config->cs0_row = 15;
  17. config->cs1_row = 15;
  18. /* 8bank */
  19. config->bank = 3;
  20. config->col = 10;
  21. /* 16bit bw */
  22. config->bw = 1;
  23. }
  24. #define FASTBOOT_KEY_GPIO 93
  25. int fastboot_key_pressed(void)
  26. {
  27. gpio_request(FASTBOOT_KEY_GPIO, "fastboot_key");
  28. gpio_direction_input(FASTBOOT_KEY_GPIO);
  29. return !gpio_get_value(FASTBOOT_KEY_GPIO);
  30. }
  31. #define ROCKCHIP_BOOT_MODE_FASTBOOT 0x5242C309
  32. int rk_board_late_init(void)
  33. {
  34. if (fastboot_key_pressed()) {
  35. printf("enter fastboot!\n");
  36. env_set("preboot", "setenv preboot; fastboot usb0");
  37. }
  38. return 0;
  39. }