riscpc.c 4.7 KB

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