netstar.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * (C) Copyright 2005 2N TELEKOMUNIKACE, Ladislav Michl
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <netdev.h>
  24. #include <i2c.h>
  25. #include <flash.h>
  26. #include <nand.h>
  27. #include <asm/io.h>
  28. DECLARE_GLOBAL_DATA_PTR;
  29. int board_init(void)
  30. {
  31. /* arch number of NetStar board */
  32. gd->bd->bi_arch_number = MACH_TYPE_NETSTAR;
  33. /* adress of boot parameters */
  34. gd->bd->bi_boot_params = 0x10000100;
  35. return 0;
  36. }
  37. int dram_init(void)
  38. {
  39. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  40. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  41. /* Take the Ethernet controller out of reset and wait
  42. * for the EEPROM load to complete. */
  43. *((volatile unsigned short *) GPIO_DATA_OUTPUT_REG) |= 0x80;
  44. udelay(10); /* doesn't work before timer_init call */
  45. *((volatile unsigned short *) GPIO_DATA_OUTPUT_REG) &= ~0x80;
  46. udelay(500);
  47. return 0;
  48. }
  49. int misc_init_r(void)
  50. {
  51. #if defined(CONFIG_RTC_DS1307)
  52. /* enable trickle charge */
  53. i2c_reg_write(CONFIG_SYS_I2C_RTC_ADDR, 0x10, 0xaa);
  54. #endif
  55. return 0;
  56. }
  57. int board_late_init(void)
  58. {
  59. return 0;
  60. }
  61. #if defined(CONFIG_CMD_FLASH)
  62. ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t * info)
  63. {
  64. if (banknum == 0) { /* AM29LV800 boot flash */
  65. info->portwidth = FLASH_CFI_16BIT;
  66. info->chipwidth = FLASH_CFI_BY16;
  67. info->interface = FLASH_CFI_X16;
  68. return 1;
  69. }
  70. return 0;
  71. }
  72. #endif
  73. #if defined(CONFIG_CMD_NAND)
  74. /*
  75. * hardware specific access to control-lines
  76. *
  77. * NAND_NCE: bit 0 - don't care
  78. * NAND_CLE: bit 1 -> bit 1 (0x0002)
  79. * NAND_ALE: bit 2 -> bit 2 (0x0004)
  80. */
  81. static void netstar_nand_hwcontrol(struct mtd_info *mtd, int cmd,
  82. unsigned int ctrl)
  83. {
  84. struct nand_chip *chip = mtd->priv;
  85. unsigned long mask;
  86. if (cmd == NAND_CMD_NONE)
  87. return;
  88. mask = (ctrl & NAND_CLE) ? 0x02 : 0;
  89. if (ctrl & NAND_ALE)
  90. mask |= 0x04;
  91. writeb(cmd, (unsigned long)chip->IO_ADDR_W | mask);
  92. }
  93. int board_nand_init(struct nand_chip *nand)
  94. {
  95. nand->options = NAND_SAMSUNG_LP_OPTIONS;
  96. nand->ecc.mode = NAND_ECC_SOFT;
  97. nand->cmd_ctrl = netstar_nand_hwcontrol;
  98. nand->chip_delay = 400;
  99. return 0;
  100. }
  101. #endif
  102. #ifdef CONFIG_CMD_NET
  103. int board_eth_init(bd_t *bis)
  104. {
  105. int rc = 0;
  106. #ifdef CONFIG_SMC91111
  107. rc = smc91111_initialize(0, CONFIG_SMC91111_BASE);
  108. #endif
  109. return rc;
  110. }
  111. #endif