dvlhost.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * (C) Copyright 2009
  3. * Michael Schwingen, michael@schwingen.org
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <config.h>
  25. #include <command.h>
  26. #include <malloc.h>
  27. #include <asm/arch/ixp425.h>
  28. #include <asm/io.h>
  29. #include <miiphy.h>
  30. #ifdef CONFIG_PCI
  31. #include <pci.h>
  32. #include <asm/arch/ixp425pci.h>
  33. #endif
  34. #include "dvlhost_hw.h"
  35. DECLARE_GLOBAL_DATA_PTR;
  36. int board_early_init_f(void)
  37. {
  38. /* CS1: LED Latch */
  39. writel(0xBFFF0002, IXP425_EXP_CS1);
  40. return 0;
  41. }
  42. int board_init(void)
  43. {
  44. gd->bd->bi_arch_number = MACH_TYPE_DVLHOST;
  45. /* adress of boot parameters */
  46. gd->bd->bi_boot_params = 0x00000100;
  47. /* Setup GPIOs used as output */
  48. GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_WDGTRIGGER);
  49. GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_DLAN_PAIRING);
  50. GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_PCIRST);
  51. /*
  52. * LED latch enable and watchdog enable are tied to the same GPIO,
  53. * so we need to trigger the watchdog if we want to enable the LEDs.
  54. */
  55. #ifdef CONFIG_HW_WATCHDOG
  56. GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_WDG_LED_EN);
  57. #else
  58. GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_WDG_LED_EN);
  59. #endif
  60. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_WDGTRIGGER);
  61. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_DLAN_PAIRING);
  62. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_WDG_LED_EN);
  63. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCIRST);
  64. /* Setup GPIOs for Interrupt inputs */
  65. GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_BTN_WLAN);
  66. GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_BTN_PAIRING);
  67. GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_BTN_RESET);
  68. GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_IRQA);
  69. GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_IRQB);
  70. /* Setup GPIO's for 33MHz clock output */
  71. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_CLK);
  72. GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_EXTBUS_CLK);
  73. writel(0x01FF01FF, IXP425_GPIO_GPCLKR);
  74. /* turn off all LEDs */
  75. writew(0x0000, DVLHOST_LED_LATCH);
  76. udelay(533);
  77. GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_PCIRST);
  78. return 0;
  79. }
  80. /* Check Board Identity */
  81. int checkboard(void)
  82. {
  83. char *s = getenv("serial#");
  84. puts("Board: dLAN 200AV (dvlhost)");
  85. if (s != NULL) {
  86. puts(", serial# ");
  87. puts(s);
  88. }
  89. putc('\n');
  90. return 0;
  91. }
  92. int dram_init(void)
  93. {
  94. gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE, 128<<20);
  95. return 0;
  96. }
  97. #ifdef CONFIG_PCI
  98. struct pci_controller hose;
  99. void pci_init_board(void)
  100. {
  101. pci_ixp_init(&hose);
  102. }
  103. #endif
  104. void reset_phy(void)
  105. {
  106. /* init IcPlus IP175C ethernet switch to native IP175C mode */
  107. miiphy_write("NPE1", 29, 31, 0x175C);
  108. }