riscpc.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. * linux/arch/arm/mach-rpc/riscpc.c
  3. *
  4. * Copyright (C) 1998-2001 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Architecture specific fixups.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/tty.h>
  14. #include <linux/delay.h>
  15. #include <linux/pm.h>
  16. #include <linux/init.h>
  17. #include <linux/sched.h>
  18. #include <linux/device.h>
  19. #include <linux/serial_8250.h>
  20. #include <linux/pata_platform.h>
  21. #include <asm/elf.h>
  22. #include <asm/io.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/hardware.h>
  25. #include <asm/page.h>
  26. #include <asm/domain.h>
  27. #include <asm/setup.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/time.h>
  31. extern void rpc_init_irq(void);
  32. unsigned int vram_size;
  33. unsigned int memc_ctrl_reg;
  34. unsigned int number_mfm_drives;
  35. static int __init parse_tag_acorn(const struct tag *tag)
  36. {
  37. memc_ctrl_reg = tag->u.acorn.memc_control_reg;
  38. number_mfm_drives = tag->u.acorn.adfsdrives;
  39. switch (tag->u.acorn.vram_pages) {
  40. case 512:
  41. vram_size += PAGE_SIZE * 256;
  42. case 256:
  43. vram_size += PAGE_SIZE * 256;
  44. default:
  45. break;
  46. }
  47. #if 0
  48. if (vram_size) {
  49. desc->video_start = 0x02000000;
  50. desc->video_end = 0x02000000 + vram_size;
  51. }
  52. #endif
  53. return 0;
  54. }
  55. __tagtable(ATAG_ACORN, parse_tag_acorn);
  56. static struct map_desc rpc_io_desc[] __initdata = {
  57. { /* VRAM */
  58. .virtual = SCREEN_BASE,
  59. .pfn = __phys_to_pfn(SCREEN_START),
  60. .length = 2*1048576,
  61. .type = MT_DEVICE
  62. }, { /* IO space */
  63. .virtual = (u32)IO_BASE,
  64. .pfn = __phys_to_pfn(IO_START),
  65. .length = IO_SIZE ,
  66. .type = MT_DEVICE
  67. }, { /* EASI space */
  68. .virtual = EASI_BASE,
  69. .pfn = __phys_to_pfn(EASI_START),
  70. .length = EASI_SIZE,
  71. .type = MT_DEVICE
  72. }
  73. };
  74. static void __init rpc_map_io(void)
  75. {
  76. iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
  77. /*
  78. * Turn off floppy.
  79. */
  80. writeb(0xc, PCIO_BASE + (0x3f2 << 2));
  81. /*
  82. * RiscPC can't handle half-word loads and stores
  83. */
  84. elf_hwcap &= ~HWCAP_HALF;
  85. }
  86. static struct resource acornfb_resources[] = {
  87. { /* VIDC */
  88. .start = 0x03400000,
  89. .end = 0x035fffff,
  90. .flags = IORESOURCE_MEM,
  91. }, {
  92. .start = IRQ_VSYNCPULSE,
  93. .end = IRQ_VSYNCPULSE,
  94. .flags = IORESOURCE_IRQ,
  95. },
  96. };
  97. static struct platform_device acornfb_device = {
  98. .name = "acornfb",
  99. .id = -1,
  100. .dev = {
  101. .coherent_dma_mask = 0xffffffff,
  102. },
  103. .num_resources = ARRAY_SIZE(acornfb_resources),
  104. .resource = acornfb_resources,
  105. };
  106. static struct resource iomd_resources[] = {
  107. {
  108. .start = 0x03200000,
  109. .end = 0x0320ffff,
  110. .flags = IORESOURCE_MEM,
  111. },
  112. };
  113. static struct platform_device iomd_device = {
  114. .name = "iomd",
  115. .id = -1,
  116. .num_resources = ARRAY_SIZE(iomd_resources),
  117. .resource = iomd_resources,
  118. };
  119. static struct platform_device kbd_device = {
  120. .name = "kart",
  121. .id = -1,
  122. .dev = {
  123. .parent = &iomd_device.dev,
  124. },
  125. };
  126. static struct plat_serial8250_port serial_platform_data[] = {
  127. {
  128. .mapbase = 0x03010fe0,
  129. .irq = 10,
  130. .uartclk = 1843200,
  131. .regshift = 2,
  132. .iotype = UPIO_MEM,
  133. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
  134. },
  135. { },
  136. };
  137. static struct platform_device serial_device = {
  138. .name = "serial8250",
  139. .id = PLAT8250_DEV_PLATFORM,
  140. .dev = {
  141. .platform_data = serial_platform_data,
  142. },
  143. };
  144. static struct pata_platform_info pata_platform_data = {
  145. .ioport_shift = 2,
  146. };
  147. static struct resource pata_resources[] = {
  148. [0] = {
  149. .start = 0x030107c0,
  150. .end = 0x030107df,
  151. .flags = IORESOURCE_MEM,
  152. },
  153. [1] = {
  154. .start = 0x03010fd8,
  155. .end = 0x03010fdb,
  156. .flags = IORESOURCE_MEM,
  157. },
  158. [2] = {
  159. .start = IRQ_HARDDISK,
  160. .end = IRQ_HARDDISK,
  161. .flags = IORESOURCE_IRQ,
  162. },
  163. };
  164. static struct platform_device pata_device = {
  165. .name = "pata_platform",
  166. .id = -1,
  167. .num_resources = ARRAY_SIZE(pata_resources),
  168. .resource = pata_resources,
  169. .dev = {
  170. .platform_data = &pata_platform_data,
  171. .coherent_dma_mask = ~0, /* grumble */
  172. },
  173. };
  174. static struct platform_device *devs[] __initdata = {
  175. &iomd_device,
  176. &kbd_device,
  177. &serial_device,
  178. &acornfb_device,
  179. &pata_device,
  180. };
  181. static int __init rpc_init(void)
  182. {
  183. return platform_add_devices(devs, ARRAY_SIZE(devs));
  184. }
  185. arch_initcall(rpc_init);
  186. extern struct sys_timer ioc_timer;
  187. MACHINE_START(RISCPC, "Acorn-RiscPC")
  188. /* Maintainer: Russell King */
  189. .phys_io = 0x03000000,
  190. .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
  191. .boot_params = 0x10000100,
  192. .reserve_lp0 = 1,
  193. .reserve_lp1 = 1,
  194. .map_io = rpc_map_io,
  195. .init_irq = rpc_init_irq,
  196. .timer = &ioc_timer,
  197. MACHINE_END