riscpc.c 4.6 KB

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