ls1012afrdm.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright 2016 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <i2c.h>
  8. #include <asm/io.h>
  9. #include <asm/arch/clock.h>
  10. #include <asm/arch/fsl_serdes.h>
  11. #ifdef CONFIG_FSL_LS_PPA
  12. #include <asm/arch/ppa.h>
  13. #endif
  14. #include <asm/arch/soc.h>
  15. #include <hwconfig.h>
  16. #include <environment.h>
  17. #include <fsl_mmdc.h>
  18. #include <netdev.h>
  19. DECLARE_GLOBAL_DATA_PTR;
  20. int checkboard(void)
  21. {
  22. puts("Board: LS1012AFRDM ");
  23. return 0;
  24. }
  25. int dram_init(void)
  26. {
  27. static const struct fsl_mmdc_info mparam = {
  28. 0x04180000, /* mdctl */
  29. 0x00030035, /* mdpdc */
  30. 0x12554000, /* mdotc */
  31. 0xbabf7954, /* mdcfg0 */
  32. 0xdb328f64, /* mdcfg1 */
  33. 0x01ff00db, /* mdcfg2 */
  34. 0x00001680, /* mdmisc */
  35. 0x0f3c8000, /* mdref */
  36. 0x00002000, /* mdrwd */
  37. 0x00bf1023, /* mdor */
  38. 0x0000003f, /* mdasp */
  39. 0x0000022a, /* mpodtctrl */
  40. 0xa1390003, /* mpzqhwctrl */
  41. };
  42. mmdc_init(&mparam);
  43. gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
  44. return 0;
  45. }
  46. int board_eth_init(bd_t *bis)
  47. {
  48. return pci_eth_init(bis);
  49. }
  50. int board_early_init_f(void)
  51. {
  52. fsl_lsch2_early_init_f();
  53. return 0;
  54. }
  55. int board_init(void)
  56. {
  57. struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR;
  58. /*
  59. * Set CCI-400 control override register to enable barrier
  60. * transaction
  61. */
  62. out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
  63. #ifdef CONFIG_ENV_IS_NOWHERE
  64. gd->env_addr = (ulong)&default_environment[0];
  65. #endif
  66. #ifdef CONFIG_FSL_LS_PPA
  67. ppa_init();
  68. #endif
  69. return 0;
  70. }
  71. int ft_board_setup(void *blob, bd_t *bd)
  72. {
  73. arch_fixup_fdt(blob);
  74. ft_cpu_setup(blob, bd);
  75. return 0;
  76. }
  77. void dram_init_banksize(void)
  78. {
  79. /*
  80. * gd->arch.secure_ram tracks the location of secure memory.
  81. * It was set as if the memory starts from 0.
  82. * The address needs to add the offset of its bank.
  83. */
  84. gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
  85. if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
  86. gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
  87. gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
  88. gd->bd->bi_dram[1].size = gd->ram_size -
  89. CONFIG_SYS_DDR_BLOCK1_SIZE;
  90. #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
  91. gd->arch.secure_ram = gd->bd->bi_dram[1].start +
  92. gd->arch.secure_ram -
  93. CONFIG_SYS_DDR_BLOCK1_SIZE;
  94. gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
  95. #endif
  96. } else {
  97. gd->bd->bi_dram[0].size = gd->ram_size;
  98. #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
  99. gd->arch.secure_ram = gd->bd->bi_dram[0].start +
  100. gd->arch.secure_ram;
  101. gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
  102. #endif
  103. }
  104. }