mx31pdk.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. *
  3. * (C) Copyright 2009 Magnus Lilja <lilja.magnus@gmail.com>
  4. *
  5. * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
  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 <netdev.h>
  27. #include <asm/arch/clock.h>
  28. #include <asm/arch/imx-regs.h>
  29. #include <asm/arch/sys_proto.h>
  30. #include <watchdog.h>
  31. #include <power/pmic.h>
  32. #include <fsl_pmic.h>
  33. #include <errno.h>
  34. DECLARE_GLOBAL_DATA_PTR;
  35. #ifdef CONFIG_HW_WATCHDOG
  36. void hw_watchdog_reset(void)
  37. {
  38. mxc_hw_watchdog_reset();
  39. }
  40. #endif
  41. int dram_init(void)
  42. {
  43. /* dram_init must store complete ramsize in gd->ram_size */
  44. gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
  45. PHYS_SDRAM_1_SIZE);
  46. return 0;
  47. }
  48. int board_early_init_f(void)
  49. {
  50. /* CS5: CPLD incl. network controller */
  51. static const struct mxc_weimcs cs5 = {
  52. /* sp wp bcd bcs psz pme sync dol cnc wsc ew wws edc */
  53. CSCR_U(0, 0, 0, 0, 0, 0, 0, 0, 3, 24, 0, 4, 3),
  54. /* oea oen ebwa ebwn csa ebc dsz csn psr cre wrap csen */
  55. CSCR_L(2, 2, 2, 5, 2, 0, 5, 2, 0, 0, 0, 1),
  56. /* ebra ebrn rwa rwn mum lah lbn lba dww dct wwu age cnc2 fce*/
  57. CSCR_A(2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0)
  58. };
  59. mxc_setup_weimcs(5, &cs5);
  60. /* Setup UART1 and SPI2 pins */
  61. mx31_uart1_hw_init();
  62. mx31_spi2_hw_init();
  63. return 0;
  64. }
  65. int board_init(void)
  66. {
  67. /* adress of boot parameters */
  68. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  69. return 0;
  70. }
  71. int board_late_init(void)
  72. {
  73. u32 val;
  74. struct pmic *p;
  75. int ret;
  76. ret = pmic_init(I2C_PMIC);
  77. if (ret)
  78. return ret;
  79. p = pmic_get("FSL_PMIC");
  80. if (!p)
  81. return -ENODEV;
  82. /* Enable RTC battery */
  83. pmic_reg_read(p, REG_POWER_CTL0, &val);
  84. pmic_reg_write(p, REG_POWER_CTL0, val | COINCHEN);
  85. pmic_reg_write(p, REG_INT_STATUS1, RTCRSTI);
  86. #ifdef CONFIG_HW_WATCHDOG
  87. mxc_hw_watchdog_enable();
  88. #endif
  89. return 0;
  90. }
  91. int checkboard(void)
  92. {
  93. printf("Board: MX31PDK\n");
  94. return 0;
  95. }
  96. int board_eth_init(bd_t *bis)
  97. {
  98. int rc = 0;
  99. #ifdef CONFIG_SMC911X
  100. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  101. #endif
  102. return rc;
  103. }