mx1ads.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * board/mx1ads/mx1ads.c
  3. *
  4. * (c) Copyright 2004
  5. * Techware Information Technology, Inc.
  6. * http://www.techware.com.tw/
  7. *
  8. * Ming-Len Wu <minglen_wu@techware.com.tw>
  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 <mc9328.h>*/
  28. #include <asm/arch/imx-regs.h>
  29. DECLARE_GLOBAL_DATA_PTR;
  30. #define FCLK_SPEED 1
  31. #if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */
  32. #define M_MDIV 0xC3
  33. #define M_PDIV 0x4
  34. #define M_SDIV 0x1
  35. #elif FCLK_SPEED==1 /* Fout = 202.8MHz */
  36. #define M_MDIV 0xA1
  37. #define M_PDIV 0x3
  38. #define M_SDIV 0x1
  39. #endif
  40. #define USB_CLOCK 1
  41. #if USB_CLOCK==0
  42. #define U_M_MDIV 0xA1
  43. #define U_M_PDIV 0x3
  44. #define U_M_SDIV 0x1
  45. #elif USB_CLOCK==1
  46. #define U_M_MDIV 0x48
  47. #define U_M_PDIV 0x3
  48. #define U_M_SDIV 0x2
  49. #endif
  50. #if 0
  51. static inline void delay (unsigned long loops)
  52. {
  53. __asm__ volatile ("1:\n"
  54. "subs %0, %1, #1\n"
  55. "bne 1b":"=r" (loops):"0" (loops));
  56. }
  57. #endif
  58. /*
  59. * Miscellaneous platform dependent initialisations
  60. */
  61. void SetAsynchMode (void)
  62. {
  63. __asm__ ("mrc p15,0,r0,c1,c0,0 \n"
  64. "mov r2, #0xC0000000 \n"
  65. "orr r0,r2,r0 \n" "mcr p15,0,r0,c1,c0,0 \n");
  66. }
  67. static u32 mc9328sid;
  68. int board_early_init_f(void)
  69. {
  70. volatile unsigned int tmp;
  71. mc9328sid = SIDR;
  72. GPCR = 0x000003AB; /* I/O pad driving strength */
  73. /* MX1_CS1U = 0x00000A00; */ /* SRAM initialization */
  74. /* MX1_CS1L = 0x11110601; */
  75. MPCTL0 = 0x04632410; /* setting for 150 MHz MCU PLL CLK */
  76. /* set FCLK divider 1 (i.e. FCLK to MCU PLL CLK) and
  77. * BCLK divider to 2 (i.e. BCLK to 48 MHz)
  78. */
  79. CSCR = 0xAF000403;
  80. CSCR |= 0x00200000; /* Trigger the restart bit(bit 21) */
  81. CSCR &= 0xFFFF7FFF; /* Program PRESC bit(bit 15) to 0 to divide-by-1 */
  82. /* setup cs4 for cs8900 ethernet */
  83. CS4U = 0x00000F00; /* Initialize CS4 for CS8900 ethernet */
  84. CS4L = 0x00001501;
  85. GIUS (0) &= 0xFF3FFFFF;
  86. GPR (0) &= 0xFF3FFFFF;
  87. tmp = *(unsigned int *) (0x1500000C);
  88. tmp = *(unsigned int *) (0x1500000C);
  89. SetAsynchMode ();
  90. icache_enable ();
  91. dcache_enable ();
  92. /* set PERCLKs */
  93. PCDR = 0x00000055; /* set PERCLKS */
  94. /* PERCLK3 is only used by SSI so the SSI driver can set it any value it likes
  95. * PERCLK1 and PERCLK2 are shared so DO NOT change it in any other place
  96. * all sources selected as normal interrupt
  97. */
  98. /* MX1_INTTYPEH = 0;
  99. MX1_INTTYPEL = 0;
  100. */
  101. return 0;
  102. }
  103. int board_init(void)
  104. {
  105. gd->bd->bi_arch_number = MACH_TYPE_MX1ADS;
  106. gd->bd->bi_boot_params = 0x08000100; /* adress of boot parameters */
  107. return 0;
  108. }
  109. int board_late_init (void)
  110. {
  111. setenv ("stdout", "serial");
  112. setenv ("stderr", "serial");
  113. switch (mc9328sid) {
  114. case 0x0005901d:
  115. printf ("MX1ADS board with MC9328 MX1 (0L44N), Silicon ID 0x%08x \n\n",
  116. mc9328sid);
  117. break;
  118. case 0x04d4c01d:
  119. printf ("MX1ADS board with MC9328 MXL (1L45N), Silicon ID 0x%08x \n\n",
  120. mc9328sid);
  121. break;
  122. case 0x00d4c01d:
  123. printf ("MX1ADS board with MC9328 MXL (2L45N), Silicon ID 0x%08x \n\n",
  124. mc9328sid);
  125. break;
  126. default:
  127. printf ("MX1ADS board with UNKNOWN MC9328 cpu, Silicon ID 0x%08x \n",
  128. mc9328sid);
  129. break;
  130. }
  131. return 0;
  132. }
  133. int dram_init(void)
  134. {
  135. /* dram_init must store complete ramsize in gd->ram_size */
  136. gd->ram_size = get_ram_size((void *)PHYS_SDRAM_1,
  137. PHYS_SDRAM_1_SIZE);
  138. return 0;
  139. }
  140. void dram_init_banksize(void)
  141. {
  142. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  143. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  144. }
  145. #ifdef CONFIG_CMD_NET
  146. int board_eth_init(bd_t *bis)
  147. {
  148. int rc = 0;
  149. #ifdef CONFIG_CS8900
  150. rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
  151. #endif
  152. return rc;
  153. }
  154. #endif