adp-ag102.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright (C) 2011 Andes Technology Corporation
  3. * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
  4. * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
  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 modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (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., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */
  23. #include <common.h>
  24. #include <netdev.h>
  25. #include <asm/io.h>
  26. #include <faraday/ftsdc010.h>
  27. #ifdef CONFIG_FTSMC020
  28. #include <faraday/ftsmc020.h>
  29. #endif
  30. DECLARE_GLOBAL_DATA_PTR;
  31. /*
  32. * Miscellaneous platform dependent initializations
  33. */
  34. int board_init(void)
  35. {
  36. /*
  37. * refer to BOOT_PARAMETER_PA_BASE within
  38. * "linux/arch/nds32/include/asm/misc_spec.h"
  39. */
  40. gd->bd->bi_arch_number = MACH_TYPE_ADPAG102;
  41. gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400;
  42. #if !defined(CONFIG_SYS_NO_FLASH)
  43. ftsmc020_init(); /* initialize Flash */
  44. #endif /* CONFIG_SYS_NO_FLASH */
  45. return 0;
  46. }
  47. int dram_init(void)
  48. {
  49. unsigned long sdram_base = PHYS_SDRAM_0;
  50. unsigned long expected_size = PHYS_SDRAM_0_SIZE;
  51. unsigned long actual_size;
  52. actual_size = get_ram_size((void *)sdram_base, expected_size);
  53. gd->ram_size = actual_size;
  54. if (expected_size != actual_size) {
  55. printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
  56. actual_size >> 20, expected_size >> 20);
  57. }
  58. return 0;
  59. }
  60. int board_eth_init(bd_t *bd)
  61. {
  62. return ftgmac100_initialize(bd);
  63. }
  64. #if !defined(CONFIG_SYS_NO_FLASH)
  65. ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
  66. {
  67. if (banknum == 0) { /* non-CFI boot flash */
  68. info->portwidth = FLASH_CFI_8BIT;
  69. info->chipwidth = FLASH_CFI_BY8;
  70. info->interface = FLASH_CFI_X8;
  71. return 1;
  72. } else {
  73. return 0;
  74. }
  75. }
  76. #endif /* CONFIG_SYS_NO_FLASH */
  77. #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
  78. void pci_init_board(void)
  79. {
  80. /* should be pci_ftpci100_init() */
  81. extern void pci_ftpci_init();
  82. pci_ftpci_init();
  83. }
  84. #endif
  85. #ifdef CONFIG_GENERIC_MMC
  86. int board_mmc_init(bd_t *bis)
  87. {
  88. ftsdc010_mmc_init(0);
  89. return 0;
  90. }
  91. #endif