riscpc.c 4.7 KB

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