db1xxx.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * Alchemy DB/PB1xxx board support.
  3. */
  4. #include <asm/mach-au1x00/au1000.h>
  5. #include <asm/mach-db1x00/bcsr.h>
  6. int __init db1000_board_setup(void);
  7. int __init db1000_dev_setup(void);
  8. int __init db1500_pci_setup(void);
  9. int __init db1200_board_setup(void);
  10. int __init db1200_dev_setup(void);
  11. int __init db1300_board_setup(void);
  12. int __init db1300_dev_setup(void);
  13. int __init db1550_board_setup(void);
  14. int __init db1550_dev_setup(void);
  15. int __init db1550_pci_setup(int);
  16. static const char *board_type_str(void)
  17. {
  18. switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
  19. case BCSR_WHOAMI_DB1000:
  20. return "DB1000";
  21. case BCSR_WHOAMI_DB1500:
  22. return "DB1500";
  23. case BCSR_WHOAMI_DB1100:
  24. return "DB1100";
  25. case BCSR_WHOAMI_PB1500:
  26. case BCSR_WHOAMI_PB1500R2:
  27. return "PB1500";
  28. case BCSR_WHOAMI_PB1100:
  29. return "PB1100";
  30. case BCSR_WHOAMI_PB1200_DDR1:
  31. case BCSR_WHOAMI_PB1200_DDR2:
  32. return "PB1200";
  33. case BCSR_WHOAMI_DB1200:
  34. return "DB1200";
  35. case BCSR_WHOAMI_DB1300:
  36. return "DB1300";
  37. case BCSR_WHOAMI_DB1550:
  38. return "DB1550";
  39. case BCSR_WHOAMI_PB1550_SDR:
  40. case BCSR_WHOAMI_PB1550_DDR:
  41. return "PB1550";
  42. default:
  43. return "(unknown)";
  44. }
  45. }
  46. const char *get_system_type(void)
  47. {
  48. return board_type_str();
  49. }
  50. void __init board_setup(void)
  51. {
  52. int ret;
  53. switch (alchemy_get_cputype()) {
  54. case ALCHEMY_CPU_AU1000:
  55. case ALCHEMY_CPU_AU1500:
  56. case ALCHEMY_CPU_AU1100:
  57. ret = db1000_board_setup();
  58. break;
  59. case ALCHEMY_CPU_AU1550:
  60. ret = db1550_board_setup();
  61. break;
  62. case ALCHEMY_CPU_AU1200:
  63. ret = db1200_board_setup();
  64. break;
  65. case ALCHEMY_CPU_AU1300:
  66. ret = db1300_board_setup();
  67. break;
  68. default:
  69. pr_err("unsupported CPU on board\n");
  70. ret = -ENODEV;
  71. }
  72. if (ret)
  73. panic("cannot initialize board support");
  74. }
  75. static int __init db1xxx_arch_init(void)
  76. {
  77. int id = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
  78. if (id == BCSR_WHOAMI_DB1550)
  79. return db1550_pci_setup(0);
  80. else if ((id == BCSR_WHOAMI_PB1550_SDR) ||
  81. (id == BCSR_WHOAMI_PB1550_DDR))
  82. return db1550_pci_setup(1);
  83. else if ((id == BCSR_WHOAMI_DB1500) || (id == BCSR_WHOAMI_PB1500) ||
  84. (id == BCSR_WHOAMI_PB1500R2))
  85. return db1500_pci_setup();
  86. return 0;
  87. }
  88. arch_initcall(db1xxx_arch_init);
  89. static int __init db1xxx_dev_init(void)
  90. {
  91. switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
  92. case BCSR_WHOAMI_DB1000:
  93. case BCSR_WHOAMI_DB1500:
  94. case BCSR_WHOAMI_DB1100:
  95. case BCSR_WHOAMI_PB1500:
  96. case BCSR_WHOAMI_PB1500R2:
  97. case BCSR_WHOAMI_PB1100:
  98. return db1000_dev_setup();
  99. case BCSR_WHOAMI_PB1200_DDR1:
  100. case BCSR_WHOAMI_PB1200_DDR2:
  101. case BCSR_WHOAMI_DB1200:
  102. return db1200_dev_setup();
  103. case BCSR_WHOAMI_DB1300:
  104. return db1300_dev_setup();
  105. case BCSR_WHOAMI_DB1550:
  106. case BCSR_WHOAMI_PB1550_SDR:
  107. case BCSR_WHOAMI_PB1550_DDR:
  108. return db1550_dev_setup();
  109. }
  110. return 0;
  111. }
  112. device_initcall(db1xxx_dev_init);