assabet.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * (C) Copyright 2002
  3. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  4. * Marius Groeger <mgroeger@sysgo.de>
  5. *
  6. * 2004 (c) MontaVista Software, Inc.
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <common.h>
  27. #include <netdev.h>
  28. #include <SA-1100.h>
  29. DECLARE_GLOBAL_DATA_PTR;
  30. /* ------------------------------------------------------------------------- */
  31. /*
  32. * Board dependent initialisation
  33. */
  34. #define ECOR 0x8000
  35. #define ECOR_RESET 0x80
  36. #define ECOR_LEVEL_IRQ 0x40
  37. #define ECOR_WR_ATTRIB 0x04
  38. #define ECOR_ENABLE 0x01
  39. #define ECSR 0x8002
  40. #define ECSR_IOIS8 0x20
  41. #define ECSR_PWRDWN 0x04
  42. #define ECSR_INT 0x02
  43. #define SMC_IO_SHIFT 2
  44. #define NCR_0 (*((volatile u_char *)(0x100000a0)))
  45. #define NCR_ENET_OSC_EN (1<<3)
  46. static inline u8
  47. readb(volatile u8 * p)
  48. {
  49. return *p;
  50. }
  51. static inline void
  52. writeb(u8 v, volatile u8 * p)
  53. {
  54. *p = v;
  55. }
  56. static void
  57. smc_init(void)
  58. {
  59. u8 ecor;
  60. u8 ecsr;
  61. volatile u8 *addr = (volatile u8 *)(0x18000000 + (1 << 25));
  62. NCR_0 |= NCR_ENET_OSC_EN;
  63. udelay(100);
  64. ecor = readb(addr + (ECOR << SMC_IO_SHIFT)) & ~ECOR_RESET;
  65. writeb(ecor | ECOR_RESET, addr + (ECOR << SMC_IO_SHIFT));
  66. udelay(100);
  67. /*
  68. * The device will ignore all writes to the enable bit while
  69. * reset is asserted, even if the reset bit is cleared in the
  70. * same write. Must clear reset first, then enable the device.
  71. */
  72. writeb(ecor, addr + (ECOR << SMC_IO_SHIFT));
  73. writeb(ecor | ECOR_ENABLE, addr + (ECOR << SMC_IO_SHIFT));
  74. /*
  75. * Set the appropriate byte/word mode.
  76. */
  77. ecsr = readb(addr + (ECSR << SMC_IO_SHIFT)) & ~ECSR_IOIS8;
  78. ecsr |= ECSR_IOIS8;
  79. writeb(ecsr, addr + (ECSR << SMC_IO_SHIFT));
  80. udelay(100);
  81. }
  82. static void
  83. neponset_init(void)
  84. {
  85. smc_init();
  86. }
  87. int
  88. board_init(void)
  89. {
  90. gd->bd->bi_arch_number = MACH_TYPE_ASSABET;
  91. gd->bd->bi_boot_params = 0xc0000100;
  92. neponset_init();
  93. return 0;
  94. }
  95. int
  96. dram_init(void)
  97. {
  98. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  99. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  100. return (0);
  101. }
  102. #ifdef CONFIG_CMD_NET
  103. int board_eth_init(bd_t *bis)
  104. {
  105. int rc = 0;
  106. #ifdef CONFIG_LAN91C96
  107. rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
  108. #endif
  109. return rc;
  110. }
  111. #endif