nx25-ae250.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2017 Andes Technology Corporation
  3. * Rick Chen, Andes Technology Corporation <rick@andestech.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <asm/mach-types.h>
  8. #include <common.h>
  9. #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
  10. #include <netdev.h>
  11. #endif
  12. #include <linux/io.h>
  13. DECLARE_GLOBAL_DATA_PTR;
  14. /*
  15. * Miscellaneous platform dependent initializations
  16. */
  17. int board_init(void)
  18. {
  19. gd->bd->bi_arch_number = MACH_TYPE_AE250;
  20. gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400;
  21. return 0;
  22. }
  23. int dram_init(void)
  24. {
  25. unsigned long sdram_base = PHYS_SDRAM_0;
  26. unsigned long expected_size = PHYS_SDRAM_0_SIZE + PHYS_SDRAM_1_SIZE;
  27. unsigned long actual_size;
  28. actual_size = get_ram_size((void *)sdram_base, expected_size);
  29. gd->ram_size = actual_size;
  30. if (expected_size != actual_size) {
  31. printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
  32. actual_size >> 20, expected_size >> 20);
  33. }
  34. return 0;
  35. }
  36. int dram_init_banksize(void)
  37. {
  38. gd->bd->bi_dram[0].start = PHYS_SDRAM_0;
  39. gd->bd->bi_dram[0].size = PHYS_SDRAM_0_SIZE;
  40. gd->bd->bi_dram[1].start = PHYS_SDRAM_1;
  41. gd->bd->bi_dram[1].size = PHYS_SDRAM_1_SIZE;
  42. return 0;
  43. }
  44. #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
  45. int board_eth_init(bd_t *bd)
  46. {
  47. return ftmac100_initialize(bd);
  48. }
  49. #endif
  50. ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
  51. {
  52. return 0;
  53. }
  54. void *board_fdt_blob_setup(void)
  55. {
  56. void **ptr = (void *)CONFIG_SYS_SDRAM_BASE;
  57. if (fdt_magic(*ptr) == FDT_MAGIC)
  58. return (void *)*ptr;
  59. return (void *)CONFIG_SYS_FDT_BASE;
  60. }