board.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * (C) Copyright 2012 Michal Simek <monstr@monstr.eu>
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <netdev.h>
  24. #include <zynqpl.h>
  25. #include <asm/arch/hardware.h>
  26. #include <asm/arch/sys_proto.h>
  27. DECLARE_GLOBAL_DATA_PTR;
  28. #ifdef CONFIG_FPGA
  29. Xilinx_desc fpga;
  30. /* It can be done differently */
  31. Xilinx_desc fpga010 = XILINX_XC7Z010_DESC(0x10);
  32. Xilinx_desc fpga020 = XILINX_XC7Z020_DESC(0x20);
  33. Xilinx_desc fpga030 = XILINX_XC7Z030_DESC(0x30);
  34. Xilinx_desc fpga045 = XILINX_XC7Z045_DESC(0x45);
  35. #endif
  36. int board_init(void)
  37. {
  38. #ifdef CONFIG_FPGA
  39. u32 idcode;
  40. idcode = zynq_slcr_get_idcode();
  41. switch (idcode) {
  42. case XILINX_ZYNQ_7010:
  43. fpga = fpga010;
  44. break;
  45. case XILINX_ZYNQ_7020:
  46. fpga = fpga020;
  47. break;
  48. case XILINX_ZYNQ_7030:
  49. fpga = fpga030;
  50. break;
  51. case XILINX_ZYNQ_7045:
  52. fpga = fpga045;
  53. break;
  54. }
  55. #endif
  56. icache_enable();
  57. #ifdef CONFIG_FPGA
  58. fpga_init();
  59. fpga_add(fpga_xilinx, &fpga);
  60. #endif
  61. return 0;
  62. }
  63. #ifdef CONFIG_CMD_NET
  64. int board_eth_init(bd_t *bis)
  65. {
  66. u32 ret = 0;
  67. #if defined(CONFIG_ZYNQ_GEM)
  68. # if defined(CONFIG_ZYNQ_GEM0)
  69. ret |= zynq_gem_initialize(bis, ZYNQ_GEM_BASEADDR0,
  70. CONFIG_ZYNQ_GEM_PHY_ADDR0, 0);
  71. # endif
  72. # if defined(CONFIG_ZYNQ_GEM1)
  73. ret |= zynq_gem_initialize(bis, ZYNQ_GEM_BASEADDR1,
  74. CONFIG_ZYNQ_GEM_PHY_ADDR1, 0);
  75. # endif
  76. #endif
  77. return ret;
  78. }
  79. #endif
  80. #ifdef CONFIG_CMD_MMC
  81. int board_mmc_init(bd_t *bd)
  82. {
  83. int ret = 0;
  84. #if defined(CONFIG_ZYNQ_SDHCI)
  85. # if defined(CONFIG_ZYNQ_SDHCI0)
  86. ret = zynq_sdhci_init(ZYNQ_SDHCI_BASEADDR0);
  87. # endif
  88. # if defined(CONFIG_ZYNQ_SDHCI1)
  89. ret |= zynq_sdhci_init(ZYNQ_SDHCI_BASEADDR1);
  90. # endif
  91. #endif
  92. return ret;
  93. }
  94. #endif
  95. int dram_init(void)
  96. {
  97. gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
  98. return 0;
  99. }