conxs.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. * (C) Copyright 2007
  3. * Stefano Babic, DENX Gmbh, sbabic@denx.de
  4. *
  5. * (C) Copyright 2004
  6. * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net
  7. *
  8. * (C) Copyright 2002
  9. * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
  10. *
  11. * (C) Copyright 2002
  12. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  13. * Marius Groeger <mgroeger@sysgo.de>
  14. *
  15. * See file CREDITS for list of people who contributed to this
  16. * project.
  17. *
  18. * This program is free software; you can redistribute it and/or
  19. * modify it under the terms of the GNU General Public License as
  20. * published by the Free Software Foundation; either version 2 of
  21. * the License, or (at your option) any later version.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program; if not, write to the Free Software
  30. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  31. * MA 02111-1307 USA
  32. */
  33. #include <common.h>
  34. #include <asm/arch/pxa-regs.h>
  35. #include <netdev.h>
  36. #include <asm/io.h>
  37. DECLARE_GLOBAL_DATA_PTR;
  38. #define RH_A_PSM (1 << 8) /* power switching mode */
  39. #define RH_A_NPS (1 << 9) /* no power switching */
  40. extern struct serial_device serial_ffuart_device;
  41. extern struct serial_device serial_btuart_device;
  42. extern struct serial_device serial_stuart_device;
  43. #if CONFIG_MK_POLARIS
  44. #define BOOT_CONSOLE "serial_stuart"
  45. #else
  46. #define BOOT_CONSOLE "serial_ffuart"
  47. #endif
  48. /* ------------------------------------------------------------------------- */
  49. /*
  50. * Miscelaneous platform dependent initialisations
  51. */
  52. int usb_board_init(void)
  53. {
  54. writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
  55. ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
  56. UHCHR);
  57. writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
  58. while (readl(UHCHR) & UHCHR_FSBIR)
  59. ;
  60. writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
  61. writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
  62. /* Clear any OTG Pin Hold */
  63. if (readl(PSSR) & PSSR_OTGPH)
  64. writel(readl(PSSR) | PSSR_OTGPH, PSSR);
  65. writel(readl(UHCRHDA) & ~(RH_A_NPS), UHCRHDA);
  66. writel(readl(UHCRHDA) | RH_A_PSM, UHCRHDA);
  67. /* Set port power control mask bits, only 3 ports. */
  68. writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
  69. return 0;
  70. }
  71. void usb_board_init_fail(void)
  72. {
  73. return;
  74. }
  75. void usb_board_stop(void)
  76. {
  77. writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
  78. udelay(11);
  79. writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
  80. writel(readl(UHCCOMS) | 1, UHCCOMS);
  81. udelay(10);
  82. writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
  83. return;
  84. }
  85. int board_init (void)
  86. {
  87. /* We have RAM, disable cache */
  88. dcache_disable();
  89. icache_disable();
  90. /* arch number of ConXS Board */
  91. gd->bd->bi_arch_number = 776;
  92. /* adress of boot parameters */
  93. gd->bd->bi_boot_params = 0xa000003c;
  94. return 0;
  95. }
  96. int board_late_init(void)
  97. {
  98. #if defined(CONFIG_SERIAL_MULTI)
  99. char *console=getenv("boot_console");
  100. if ((console == NULL) || (strcmp(console,"serial_btuart") &&
  101. strcmp(console,"serial_stuart") &&
  102. strcmp(console,"serial_ffuart"))) {
  103. console = BOOT_CONSOLE;
  104. }
  105. setenv("stdout",console);
  106. setenv("stdin", console);
  107. setenv("stderr",console);
  108. #endif
  109. return 0;
  110. }
  111. struct serial_device *default_serial_console (void)
  112. {
  113. return &serial_ffuart_device;
  114. }
  115. extern void pxa_dram_init(void);
  116. int dram_init(void)
  117. {
  118. pxa_dram_init();
  119. gd->ram_size = PHYS_SDRAM_1_SIZE;
  120. return 0;
  121. }
  122. void dram_init_banksize(void)
  123. {
  124. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  125. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  126. }
  127. #ifdef CONFIG_DRIVER_DM9000
  128. int board_eth_init(bd_t *bis)
  129. {
  130. return dm9000_initialize(bis);
  131. }
  132. #endif