vct.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * (C) Copyright 2008 Stefan Roese <sr@denx.de>, DENX Software Engineering
  3. *
  4. * Copyright (C) 2006 Micronas GmbH
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <common.h>
  9. #include <command.h>
  10. #include <netdev.h>
  11. #include <asm/mipsregs.h>
  12. #include "vct.h"
  13. #if defined(CONFIG_VCT_PREMIUM)
  14. #define BOARD_NAME "PremiumD"
  15. #elif defined(CONFIG_VCT_PLATINUM)
  16. #define BOARD_NAME "PlatinumD"
  17. #elif defined(CONFIG_VCT_PLATINUMAVC)
  18. #define BOARD_NAME "PlatinumAVC"
  19. #else
  20. #error "vct: No board variant defined!"
  21. #endif
  22. #if defined(CONFIG_VCT_ONENAND)
  23. #define BOARD_NAME_ADD " OneNAND"
  24. #else
  25. #define BOARD_NAME_ADD " NOR"
  26. #endif
  27. int board_early_init_f(void)
  28. {
  29. /*
  30. * First initialize the PIN mulitplexing
  31. */
  32. vct_pin_mux_initialize();
  33. /*
  34. * Init the EBI very early so that FLASH can be accessed
  35. */
  36. ebi_initialize();
  37. return 0;
  38. }
  39. void _machine_restart(void)
  40. {
  41. reg_write(DCGU_EN_WDT_RESET(DCGU_BASE), DCGU_MAGIC_WDT);
  42. reg_write(WDT_TORR(WDT_BASE), 0x00);
  43. reg_write(WDT_CR(WDT_BASE), 0x1D);
  44. /*
  45. * Now wait for the watchdog to trigger the reset
  46. */
  47. udelay(1000000);
  48. }
  49. /*
  50. * SDRAM is already configured by the bootstrap code, only return the
  51. * auto-detected size here
  52. */
  53. phys_size_t initdram(int board_type)
  54. {
  55. return get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
  56. CONFIG_SYS_MBYTES_SDRAM << 20);
  57. }
  58. int checkboard(void)
  59. {
  60. char buf[64];
  61. int i = getenv_f("serial#", buf, sizeof(buf));
  62. u32 config0 = read_c0_prid();
  63. if ((config0 & 0xff0000) == PRID_COMP_LEGACY
  64. && (config0 & 0xff00) == PRID_IMP_LX4280) {
  65. puts("Board: MDED \n");
  66. printf("CPU: LX4280 id: 0x%02x, rev: 0x%02x\n",
  67. (config0 >> 8) & 0xFF, config0 & 0xFF);
  68. } else if ((config0 & 0xff0000) == PRID_COMP_MIPS
  69. && (config0 & 0xff00) == PRID_IMP_VGC) {
  70. u32 jedec_id = *((u32 *) 0xBEBC71A0);
  71. if ((((jedec_id) >> 12) & 0xFF) == 0x40) {
  72. puts("Board: VGCA \n");
  73. } else if ((((jedec_id) >> 12) & 0xFF) == 0x48
  74. || (((jedec_id) >> 12) & 0xFF) == 0x49) {
  75. puts("Board: VGCB \n");
  76. }
  77. printf("CPU: MIPS 4K id: 0x%02x, rev: 0x%02x\n",
  78. (config0 >> 8) & 0xFF, config0 & 0xFF);
  79. } else if (config0 == 0x19378) {
  80. printf("CPU: MIPS 24K id: 0x%02x, rev: 0x%02x\n",
  81. (config0 >> 8) & 0xFF, config0 & 0xFF);
  82. } else {
  83. printf("Unsupported cpu %d, proc_id=0x%x\n", config0 >> 24,
  84. config0);
  85. }
  86. printf("Board: Micronas VCT " BOARD_NAME BOARD_NAME_ADD);
  87. if (i > 0) {
  88. puts(", serial# ");
  89. puts(buf);
  90. }
  91. putc('\n');
  92. return 0;
  93. }
  94. int board_eth_init(bd_t *bis)
  95. {
  96. int rc = 0;
  97. #ifdef CONFIG_SMC911X
  98. rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  99. #endif
  100. return rc;
  101. }