platform.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*
  2. * Copyright (C) 2007-2009 Geert Uytterhoeven
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file COPYING in the main directory of this archive
  6. * for more details.
  7. */
  8. #include <linux/init.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/zorro.h>
  11. #include <asm/amigahw.h>
  12. #include <asm/amigayle.h>
  13. #ifdef CONFIG_ZORRO
  14. static const struct resource zorro_resources[] __initconst = {
  15. /* Zorro II regions (on Zorro II/III) */
  16. {
  17. .name = "Zorro II exp",
  18. .start = 0x00e80000,
  19. .end = 0x00efffff,
  20. .flags = IORESOURCE_MEM,
  21. }, {
  22. .name = "Zorro II mem",
  23. .start = 0x00200000,
  24. .end = 0x009fffff,
  25. .flags = IORESOURCE_MEM,
  26. },
  27. /* Zorro III regions (on Zorro III only) */
  28. {
  29. .name = "Zorro III exp",
  30. .start = 0xff000000,
  31. .end = 0xffffffff,
  32. .flags = IORESOURCE_MEM,
  33. }, {
  34. .name = "Zorro III cfg",
  35. .start = 0x40000000,
  36. .end = 0x7fffffff,
  37. .flags = IORESOURCE_MEM,
  38. }
  39. };
  40. static int __init amiga_init_bus(void)
  41. {
  42. if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
  43. return -ENODEV;
  44. platform_device_register_simple("amiga-zorro", -1, zorro_resources,
  45. AMIGAHW_PRESENT(ZORRO3) ? 4 : 2);
  46. return 0;
  47. }
  48. subsys_initcall(amiga_init_bus);
  49. static int z_dev_present(zorro_id id)
  50. {
  51. unsigned int i;
  52. for (i = 0; i < zorro_num_autocon; i++)
  53. if (zorro_autocon[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
  54. zorro_autocon[i].rom.er_Product == ZORRO_PROD(id))
  55. return 1;
  56. return 0;
  57. }
  58. #else /* !CONFIG_ZORRO */
  59. static inline int z_dev_present(zorro_id id) { return 0; }
  60. #endif /* !CONFIG_ZORRO */
  61. static const struct resource a3000_scsi_resource __initconst = {
  62. .start = 0xdd0000,
  63. .end = 0xdd00ff,
  64. .flags = IORESOURCE_MEM,
  65. };
  66. static const struct resource a4000t_scsi_resource __initconst = {
  67. .start = 0xdd0000,
  68. .end = 0xdd0fff,
  69. .flags = IORESOURCE_MEM,
  70. };
  71. static const struct resource a1200_ide_resource __initconst = {
  72. .start = 0xda0000,
  73. .end = 0xda1fff,
  74. .flags = IORESOURCE_MEM,
  75. };
  76. static const struct gayle_ide_platform_data a1200_ide_pdata __initconst = {
  77. .base = 0xda0000,
  78. .irqport = 0xda9000,
  79. .explicit_ack = 1,
  80. };
  81. static const struct resource a4000_ide_resource __initconst = {
  82. .start = 0xdd2000,
  83. .end = 0xdd3fff,
  84. .flags = IORESOURCE_MEM,
  85. };
  86. static const struct gayle_ide_platform_data a4000_ide_pdata __initconst = {
  87. .base = 0xdd2020,
  88. .irqport = 0xdd3020,
  89. .explicit_ack = 0,
  90. };
  91. static const struct resource amiga_rtc_resource __initconst = {
  92. .start = 0x00dc0000,
  93. .end = 0x00dcffff,
  94. .flags = IORESOURCE_MEM,
  95. };
  96. static int __init amiga_init_devices(void)
  97. {
  98. struct platform_device *pdev;
  99. if (!MACH_IS_AMIGA)
  100. return -ENODEV;
  101. /* video hardware */
  102. if (AMIGAHW_PRESENT(AMI_VIDEO))
  103. platform_device_register_simple("amiga-video", -1, NULL, 0);
  104. /* sound hardware */
  105. if (AMIGAHW_PRESENT(AMI_AUDIO))
  106. platform_device_register_simple("amiga-audio", -1, NULL, 0);
  107. /* storage interfaces */
  108. if (AMIGAHW_PRESENT(AMI_FLOPPY))
  109. platform_device_register_simple("amiga-floppy", -1, NULL, 0);
  110. if (AMIGAHW_PRESENT(A3000_SCSI))
  111. platform_device_register_simple("amiga-a3000-scsi", -1,
  112. &a3000_scsi_resource, 1);
  113. if (AMIGAHW_PRESENT(A4000_SCSI))
  114. platform_device_register_simple("amiga-a4000t-scsi", -1,
  115. &a4000t_scsi_resource, 1);
  116. if (AMIGAHW_PRESENT(A1200_IDE) ||
  117. z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) {
  118. pdev = platform_device_register_simple("amiga-gayle-ide", -1,
  119. &a1200_ide_resource, 1);
  120. platform_device_add_data(pdev, &a1200_ide_pdata,
  121. sizeof(a1200_ide_pdata));
  122. }
  123. if (AMIGAHW_PRESENT(A4000_IDE)) {
  124. pdev = platform_device_register_simple("amiga-gayle-ide", -1,
  125. &a4000_ide_resource, 1);
  126. platform_device_add_data(pdev, &a4000_ide_pdata,
  127. sizeof(a4000_ide_pdata));
  128. }
  129. /* other I/O hardware */
  130. if (AMIGAHW_PRESENT(AMI_KEYBOARD))
  131. platform_device_register_simple("amiga-keyboard", -1, NULL, 0);
  132. if (AMIGAHW_PRESENT(AMI_MOUSE))
  133. platform_device_register_simple("amiga-mouse", -1, NULL, 0);
  134. if (AMIGAHW_PRESENT(AMI_SERIAL))
  135. platform_device_register_simple("amiga-serial", -1, NULL, 0);
  136. if (AMIGAHW_PRESENT(AMI_PARALLEL))
  137. platform_device_register_simple("amiga-parallel", -1, NULL, 0);
  138. /* real time clocks */
  139. if (AMIGAHW_PRESENT(A2000_CLK))
  140. platform_device_register_simple("rtc-msm6242", -1,
  141. &amiga_rtc_resource, 1);
  142. if (AMIGAHW_PRESENT(A3000_CLK))
  143. platform_device_register_simple("rtc-rp5c01", -1,
  144. &amiga_rtc_resource, 1);
  145. return 0;
  146. }
  147. device_initcall(amiga_init_devices);