riscpc.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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/ata_platform.h>
  21. #include <linux/io.h>
  22. #include <linux/i2c.h>
  23. #include <asm/elf.h>
  24. #include <asm/mach-types.h>
  25. #include <mach/hardware.h>
  26. #include <asm/hardware/iomd.h>
  27. #include <asm/page.h>
  28. #include <asm/domain.h>
  29. #include <asm/setup.h>
  30. #include <asm/mach/map.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/time.h>
  33. extern void rpc_init_irq(void);
  34. unsigned int vram_size;
  35. unsigned int memc_ctrl_reg;
  36. unsigned int number_mfm_drives;
  37. static int __init parse_tag_acorn(const struct tag *tag)
  38. {
  39. memc_ctrl_reg = tag->u.acorn.memc_control_reg;
  40. number_mfm_drives = tag->u.acorn.adfsdrives;
  41. switch (tag->u.acorn.vram_pages) {
  42. case 512:
  43. vram_size += PAGE_SIZE * 256;
  44. case 256:
  45. vram_size += PAGE_SIZE * 256;
  46. default:
  47. break;
  48. }
  49. #if 0
  50. if (vram_size) {
  51. desc->video_start = 0x02000000;
  52. desc->video_end = 0x02000000 + vram_size;
  53. }
  54. #endif
  55. return 0;
  56. }
  57. __tagtable(ATAG_ACORN, parse_tag_acorn);
  58. static struct map_desc rpc_io_desc[] __initdata = {
  59. { /* VRAM */
  60. .virtual = SCREEN_BASE,
  61. .pfn = __phys_to_pfn(SCREEN_START),
  62. .length = 2*1048576,
  63. .type = MT_DEVICE
  64. }, { /* IO space */
  65. .virtual = (u32)IO_BASE,
  66. .pfn = __phys_to_pfn(IO_START),
  67. .length = IO_SIZE ,
  68. .type = MT_DEVICE
  69. }, { /* EASI space */
  70. .virtual = (unsigned long)EASI_BASE,
  71. .pfn = __phys_to_pfn(EASI_START),
  72. .length = EASI_SIZE,
  73. .type = MT_DEVICE
  74. }
  75. };
  76. static void __init rpc_map_io(void)
  77. {
  78. iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
  79. /*
  80. * Turn off floppy.
  81. */
  82. writeb(0xc, PCIO_BASE + (0x3f2 << 2));
  83. /*
  84. * RiscPC can't handle half-word loads and stores
  85. */
  86. elf_hwcap &= ~HWCAP_HALF;
  87. }
  88. static struct resource acornfb_resources[] = {
  89. { /* VIDC */
  90. .start = 0x03400000,
  91. .end = 0x035fffff,
  92. .flags = IORESOURCE_MEM,
  93. }, {
  94. .start = IRQ_VSYNCPULSE,
  95. .end = IRQ_VSYNCPULSE,
  96. .flags = IORESOURCE_IRQ,
  97. },
  98. };
  99. static struct platform_device acornfb_device = {
  100. .name = "acornfb",
  101. .id = -1,
  102. .dev = {
  103. .coherent_dma_mask = 0xffffffff,
  104. },
  105. .num_resources = ARRAY_SIZE(acornfb_resources),
  106. .resource = acornfb_resources,
  107. };
  108. static struct resource iomd_resources[] = {
  109. {
  110. .start = 0x03200000,
  111. .end = 0x0320ffff,
  112. .flags = IORESOURCE_MEM,
  113. },
  114. };
  115. static struct platform_device iomd_device = {
  116. .name = "iomd",
  117. .id = -1,
  118. .num_resources = ARRAY_SIZE(iomd_resources),
  119. .resource = iomd_resources,
  120. };
  121. static struct resource iomd_kart_resources[] = {
  122. DEFINE_RES_IRQ(IRQ_KEYBOARDRX),
  123. DEFINE_RES_IRQ(IRQ_KEYBOARDTX),
  124. };
  125. static struct platform_device kbd_device = {
  126. .name = "kart",
  127. .id = -1,
  128. .dev = {
  129. .parent = &iomd_device.dev,
  130. },
  131. .num_resources = ARRAY_SIZE(iomd_kart_resources),
  132. .resource = iomd_kart_resources,
  133. };
  134. static struct plat_serial8250_port serial_platform_data[] = {
  135. {
  136. .mapbase = 0x03010fe0,
  137. .irq = 10,
  138. .uartclk = 1843200,
  139. .regshift = 2,
  140. .iotype = UPIO_MEM,
  141. .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
  142. },
  143. { },
  144. };
  145. static struct platform_device serial_device = {
  146. .name = "serial8250",
  147. .id = PLAT8250_DEV_PLATFORM,
  148. .dev = {
  149. .platform_data = serial_platform_data,
  150. },
  151. };
  152. static struct pata_platform_info pata_platform_data = {
  153. .ioport_shift = 2,
  154. };
  155. static struct resource pata_resources[] = {
  156. [0] = {
  157. .start = 0x030107c0,
  158. .end = 0x030107df,
  159. .flags = IORESOURCE_MEM,
  160. },
  161. [1] = {
  162. .start = 0x03010fd8,
  163. .end = 0x03010fdb,
  164. .flags = IORESOURCE_MEM,
  165. },
  166. [2] = {
  167. .start = IRQ_HARDDISK,
  168. .end = IRQ_HARDDISK,
  169. .flags = IORESOURCE_IRQ,
  170. },
  171. };
  172. static struct platform_device pata_device = {
  173. .name = "pata_platform",
  174. .id = -1,
  175. .num_resources = ARRAY_SIZE(pata_resources),
  176. .resource = pata_resources,
  177. .dev = {
  178. .platform_data = &pata_platform_data,
  179. .coherent_dma_mask = ~0, /* grumble */
  180. },
  181. };
  182. static struct platform_device *devs[] __initdata = {
  183. &iomd_device,
  184. &kbd_device,
  185. &serial_device,
  186. &acornfb_device,
  187. &pata_device,
  188. };
  189. static struct i2c_board_info i2c_rtc = {
  190. I2C_BOARD_INFO("pcf8583", 0x50)
  191. };
  192. static int __init rpc_init(void)
  193. {
  194. i2c_register_board_info(0, &i2c_rtc, 1);
  195. return platform_add_devices(devs, ARRAY_SIZE(devs));
  196. }
  197. arch_initcall(rpc_init);
  198. static void rpc_restart(char mode, const char *cmd)
  199. {
  200. iomd_writeb(0, IOMD_ROMCR0);
  201. /*
  202. * Jump into the ROM
  203. */
  204. soft_restart(0);
  205. }
  206. extern struct sys_timer ioc_timer;
  207. MACHINE_START(RISCPC, "Acorn-RiscPC")
  208. /* Maintainer: Russell King */
  209. .atag_offset = 0x100,
  210. .reserve_lp0 = 1,
  211. .reserve_lp1 = 1,
  212. .map_io = rpc_map_io,
  213. .init_irq = rpc_init_irq,
  214. .timer = &ioc_timer,
  215. .restart = rpc_restart,
  216. MACHINE_END