cairo.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (c) 2014 DENX
  4. * Written-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
  5. *
  6. * Derived from code written by Robert Aigner (ra@spiid.net)
  7. *
  8. * Itself derived from Beagle Board and 3430 SDP code by
  9. * Richard Woodruff <r-woodruff2@ti.com>
  10. * Syed Mohammed Khasim <khasim@ti.com>
  11. */
  12. #include <common.h>
  13. #include <dm.h>
  14. #include <netdev.h>
  15. #include <ns16550.h>
  16. #include <asm/io.h>
  17. #include <asm/arch/mem.h>
  18. #include <asm/arch/mux.h>
  19. #include <asm/arch/sys_proto.h>
  20. #include <i2c.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/omap_mmc.h>
  23. #include "cairo.h"
  24. DECLARE_GLOBAL_DATA_PTR;
  25. /*
  26. * Routine: board_init
  27. * Description: Early hardware init.
  28. */
  29. int board_init(void)
  30. {
  31. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  32. /* board id for Linux */
  33. gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
  34. /* boot param addr */
  35. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  36. return 0;
  37. }
  38. /*
  39. * Routine: set_muxconf_regs
  40. * Description: Setting up the configuration Mux registers specific to the
  41. * hardware. Many pins need to be moved from protect to primary
  42. * mode.
  43. */
  44. void set_muxconf_regs(void)
  45. {
  46. MUX_CAIRO();
  47. }
  48. #if defined(CONFIG_MMC)
  49. int board_mmc_init(bd_t *bis)
  50. {
  51. return omap_mmc_init(0, 0, 0, -1, -1);
  52. }
  53. #endif
  54. #ifdef CONFIG_SPL_BUILD
  55. /*
  56. * Routine: get_board_mem_timings
  57. * Description: If we use SPL then there is no x-loader nor config header
  58. * so we have to setup the DDR timings ourself on the first bank. This
  59. * provides the timing values back to the function that configures
  60. * the memory.
  61. *
  62. * The Cairo board uses SAMSUNG DDR - K4X51163PG-FGC6
  63. */
  64. void get_board_mem_timings(struct board_sdrc_timings *timings)
  65. {
  66. timings->sharing = SAMSUNG_SHARING;
  67. timings->mcfg = SAMSUNG_V_MCFG_165(128 << 20);
  68. timings->ctrla = SAMSUNG_V_ACTIMA_165;
  69. timings->ctrlb = SAMSUNG_V_ACTIMB_165;
  70. timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
  71. timings->mr = SAMSUNG_V_MR_165;
  72. }
  73. #endif
  74. static const struct ns16550_platdata cairo_serial = {
  75. .base = OMAP34XX_UART2,
  76. .reg_shift = 2,
  77. .clock = V_NS16550_CLK,
  78. .fcr = UART_FCR_DEFVAL,
  79. };
  80. U_BOOT_DEVICE(cairo_uart) = {
  81. "ns16550_serial",
  82. &cairo_serial
  83. };
  84. /* force SPL booting into U-Boot, not Linux */
  85. #ifdef CONFIG_SPL_OS_BOOT
  86. int spl_start_uboot(void)
  87. {
  88. return 1;
  89. }
  90. #endif