nios2-generic.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * (C) Copyright 2005, Psyent Corporation <www.psyent.com>
  3. * Scott McNutt <smcnutt@psyent.com>
  4. * (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #include <common.h>
  25. #include <netdev.h>
  26. #include <mtd/cfi_flash.h>
  27. #include <asm/io.h>
  28. void text_base_hook(void); /* nop hook for text_base.S */
  29. #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
  30. static void __early_flash_cmd_reset(void)
  31. {
  32. /* reset flash before we read env */
  33. writeb(AMD_CMD_RESET, CONFIG_ENV_ADDR);
  34. writeb(FLASH_CMD_RESET, CONFIG_ENV_ADDR);
  35. }
  36. void early_flash_cmd_reset(void)
  37. __attribute__((weak,alias("__early_flash_cmd_reset")));
  38. #endif
  39. int board_early_init_f(void)
  40. {
  41. text_base_hook();
  42. #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
  43. early_flash_cmd_reset();
  44. #endif
  45. return 0;
  46. }
  47. int checkboard(void)
  48. {
  49. printf("BOARD : %s\n", CONFIG_BOARD_NAME);
  50. return 0;
  51. }
  52. phys_size_t initdram(int board_type)
  53. {
  54. return 0;
  55. }
  56. #ifdef CONFIG_CMD_NET
  57. int board_eth_init(bd_t *bis)
  58. {
  59. int rc = 0;
  60. #ifdef CONFIG_SMC91111
  61. rc += smc91111_initialize(0, CONFIG_SMC91111_BASE);
  62. #endif
  63. #ifdef CONFIG_DRIVER_DM9000
  64. rc += dm9000_initialize(bis);
  65. #endif
  66. #ifdef CONFIG_ALTERA_TSE
  67. rc += altera_tse_initialize(0,
  68. CONFIG_SYS_ALTERA_TSE_MAC_BASE,
  69. CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
  70. CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE,
  71. #if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \
  72. (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0)
  73. CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE,
  74. CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE);
  75. #else
  76. 0,
  77. 0);
  78. #endif
  79. #endif
  80. #ifdef CONFIG_ETHOC
  81. rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
  82. #endif
  83. return rc;
  84. }
  85. #endif