ls1012aqds.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 <fdt_support.h>
  9. #include <asm/io.h>
  10. #include <asm/arch/clock.h>
  11. #include <asm/arch/fsl_serdes.h>
  12. #include <asm/arch/fdt.h>
  13. #include <asm/arch/soc.h>
  14. #include <ahci.h>
  15. #include <hwconfig.h>
  16. #include <mmc.h>
  17. #include <scsi.h>
  18. #include <fm_eth.h>
  19. #include <fsl_esdhc.h>
  20. #include <fsl_mmdc.h>
  21. #include <spl.h>
  22. #include <netdev.h>
  23. #include "../common/qixis.h"
  24. #include "ls1012aqds_qixis.h"
  25. DECLARE_GLOBAL_DATA_PTR;
  26. int checkboard(void)
  27. {
  28. char buf[64];
  29. u8 sw;
  30. sw = QIXIS_READ(arch);
  31. printf("Board Arch: V%d, ", sw >> 4);
  32. printf("Board version: %c, boot from ", (sw & 0xf) + 'A' - 1);
  33. sw = QIXIS_READ(brdcfg[QIXIS_LBMAP_BRDCFG_REG]);
  34. if (sw & QIXIS_LBMAP_ALTBANK)
  35. printf("flash: 2\n");
  36. else
  37. printf("flash: 1\n");
  38. printf("FPGA: v%d (%s), build %d",
  39. (int)QIXIS_READ(scver), qixis_read_tag(buf),
  40. (int)qixis_read_minor());
  41. /* the timestamp string contains "\n" at the end */
  42. printf(" on %s", qixis_read_time(buf));
  43. return 0;
  44. }
  45. int dram_init(void)
  46. {
  47. static const struct fsl_mmdc_info mparam = {
  48. 0x05180000, /* mdctl */
  49. 0x00030035, /* mdpdc */
  50. 0x12554000, /* mdotc */
  51. 0xbabf7954, /* mdcfg0 */
  52. 0xdb328f64, /* mdcfg1 */
  53. 0x01ff00db, /* mdcfg2 */
  54. 0x00001680, /* mdmisc */
  55. 0x0f3c8000, /* mdref */
  56. 0x00002000, /* mdrwd */
  57. 0x00bf1023, /* mdor */
  58. 0x0000003f, /* mdasp */
  59. 0x0000022a, /* mpodtctrl */
  60. 0xa1390003, /* mpzqhwctrl */
  61. };
  62. mmdc_init(&mparam);
  63. gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
  64. return 0;
  65. }
  66. int board_early_init_f(void)
  67. {
  68. fsl_lsch2_early_init_f();
  69. return 0;
  70. }
  71. #ifdef CONFIG_MISC_INIT_R
  72. int misc_init_r(void)
  73. {
  74. u8 mux_sdhc_cd = 0x80;
  75. i2c_set_bus_num(0);
  76. i2c_write(CONFIG_SYS_I2C_FPGA_ADDR, 0x5a, 1, &mux_sdhc_cd, 1);
  77. return 0;
  78. }
  79. #endif
  80. int board_init(void)
  81. {
  82. struct ccsr_cci400 *cci = (struct ccsr_cci400 *)
  83. CONFIG_SYS_CCI400_ADDR;
  84. /* Set CCI-400 control override register to enable barrier
  85. * transaction */
  86. out_le32(&cci->ctrl_ord,
  87. CCI400_CTRLORD_EN_BARRIER);
  88. #ifdef CONFIG_SYS_FSL_ERRATUM_A010315
  89. erratum_a010315();
  90. #endif
  91. #ifdef CONFIG_ENV_IS_NOWHERE
  92. gd->env_addr = (ulong)&default_environment[0];
  93. #endif
  94. return 0;
  95. }
  96. int board_eth_init(bd_t *bis)
  97. {
  98. return pci_eth_init(bis);
  99. }
  100. #ifdef CONFIG_OF_BOARD_SETUP
  101. int ft_board_setup(void *blob, bd_t *bd)
  102. {
  103. arch_fixup_fdt(blob);
  104. ft_cpu_setup(blob, bd);
  105. return 0;
  106. }
  107. #endif