kylin_rk3036.c 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 <env.h>
  8. #include <init.h>
  9. #include <asm/io.h>
  10. #include <asm/arch-rockchip/uart.h>
  11. #include <asm/arch-rockchip/sdram_rk3036.h>
  12. #include <asm/gpio.h>
  13. void 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. /* 8bank */
  21. config->bank = 3;
  22. config->col = 10;
  23. /* 16bit bw */
  24. config->bw = 1;
  25. }
  26. #define FASTBOOT_KEY_GPIO 93
  27. int fastboot_key_pressed(void)
  28. {
  29. gpio_request(FASTBOOT_KEY_GPIO, "fastboot_key");
  30. gpio_direction_input(FASTBOOT_KEY_GPIO);
  31. return !gpio_get_value(FASTBOOT_KEY_GPIO);
  32. }
  33. #define ROCKCHIP_BOOT_MODE_FASTBOOT 0x5242C309
  34. int rk_board_late_init(void)
  35. {
  36. if (fastboot_key_pressed()) {
  37. printf("enter fastboot!\n");
  38. env_set("preboot", "setenv preboot; fastboot usb0");
  39. }
  40. return 0;
  41. }