devkit3250_spl.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Timll DevKit3250 board support, SPL board configuration
  3. *
  4. * (C) Copyright 2015 Vladimir Zapolskiy <vz@mleia.com>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <common.h>
  9. #include <asm/io.h>
  10. #include <asm/arch/sys_proto.h>
  11. #include <asm/arch/cpu.h>
  12. #include <asm/arch/emc.h>
  13. #include <asm/arch-lpc32xx/gpio.h>
  14. #include <spl.h>
  15. static struct gpio_regs *gpio = (struct gpio_regs *)GPIO_BASE;
  16. /*
  17. * SDRAM K4S561632N-LC60 settings are selected in assumption that
  18. * SDRAM clock may be set up to 166 MHz, however at the moment
  19. * it is 104 MHz. Most delay values are converted to be a multiple of
  20. * base clock, and precise pinned values are not needed here.
  21. */
  22. struct emc_dram_settings dram_64mb = {
  23. .cmddelay = 0x0001C000,
  24. .config0 = 0x00005682,
  25. .rascas0 = 0x00000302,
  26. .rdconfig = 0x00000011, /* undocumented but crucial value */
  27. .trp = 83333333,
  28. .tras = 23809524,
  29. .tsrex = 12500000,
  30. .twr = 83000000, /* tWR = tRDL = 2 CLK */
  31. .trc = 15384616,
  32. .trfc = 15384616,
  33. .txsr = 12500000,
  34. .trrd = 1,
  35. .tmrd = 1,
  36. .tcdlr = 0,
  37. .refresh = 130000, /* 800 clock cycles */
  38. .mode = 0x00018000,
  39. .emode = 0x02000000,
  40. };
  41. void spl_board_init(void)
  42. {
  43. /* First of all silence buzzer controlled by GPO_20 */
  44. writel((1 << 20), &gpio->p3_outp_clr);
  45. lpc32xx_uart_init(CONFIG_SYS_LPC32XX_UART);
  46. preloader_console_init();
  47. ddr_init(&dram_64mb);
  48. /*
  49. * NAND initialization is done by nand_init(),
  50. * here just enable NAND SLC clocks
  51. */
  52. lpc32xx_slc_nand_init();
  53. }
  54. u32 spl_boot_device(void)
  55. {
  56. return BOOT_DEVICE_NAND;
  57. }