soc.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * (C) Copyright 2007
  3. * Sascha Hauer, Pengutronix
  4. *
  5. * (C) Copyright 2009 Freescale Semiconductor, Inc.
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #include <common.h>
  26. #include <asm/arch/imx-regs.h>
  27. #include <asm/arch/clock.h>
  28. #include <asm/errno.h>
  29. #include <asm/io.h>
  30. #ifdef CONFIG_FSL_ESDHC
  31. #include <fsl_esdhc.h>
  32. #endif
  33. u32 get_cpu_rev(void)
  34. {
  35. int reg;
  36. int system_rev;
  37. reg = __raw_readl(ROM_SI_REV);
  38. switch (reg) {
  39. case 0x02:
  40. system_rev = 0x51000 | CHIP_REV_1_1;
  41. break;
  42. case 0x10:
  43. if ((__raw_readl(GPIO1_BASE_ADDR + 0x0) & (0x1 << 22)) == 0)
  44. system_rev = 0x51000 | CHIP_REV_2_5;
  45. else
  46. system_rev = 0x51000 | CHIP_REV_2_0;
  47. break;
  48. case 0x20:
  49. system_rev = 0x51000 | CHIP_REV_3_0;
  50. break;
  51. return system_rev;
  52. default:
  53. system_rev = 0x51000 | CHIP_REV_1_0;
  54. break;
  55. }
  56. return system_rev;
  57. }
  58. #if defined(CONFIG_DISPLAY_CPUINFO)
  59. int print_cpuinfo(void)
  60. {
  61. u32 cpurev;
  62. cpurev = get_cpu_rev();
  63. printf("CPU: Freescale i.MX51 family rev%d.%d at %d MHz\n",
  64. (cpurev & 0xF0) >> 4,
  65. (cpurev & 0x0F) >> 4,
  66. mxc_get_clock(MXC_ARM_CLK) / 1000000);
  67. return 0;
  68. }
  69. #endif
  70. /*
  71. * Initializes on-chip ethernet controllers.
  72. * to override, implement board_eth_init()
  73. */
  74. #if defined(CONFIG_FEC_MXC)
  75. extern int fecmxc_initialize(bd_t *bis);
  76. #endif
  77. int cpu_eth_init(bd_t *bis)
  78. {
  79. int rc = -ENODEV;
  80. #if defined(CONFIG_FEC_MXC)
  81. rc = fecmxc_initialize(bis);
  82. #endif
  83. return rc;
  84. }
  85. /*
  86. * Initializes on-chip MMC controllers.
  87. * to override, implement board_mmc_init()
  88. */
  89. int cpu_mmc_init(bd_t *bis)
  90. {
  91. #ifdef CONFIG_FSL_ESDHC
  92. return fsl_esdhc_mmc_init(bis);
  93. #else
  94. return 0;
  95. #endif
  96. }
  97. void reset_cpu(ulong addr)
  98. {
  99. __raw_writew(4, WDOG1_BASE_ADDR);
  100. }