riscpc.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 <asm/elf.h>
  21. #include <asm/io.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/hardware.h>
  24. #include <asm/page.h>
  25. #include <asm/domain.h>
  26. #include <asm/setup.h>
  27. #include <asm/mach/map.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/time.h>
  30. extern void rpc_init_irq(void);
  31. unsigned int vram_size;
  32. unsigned int memc_ctrl_reg;
  33. unsigned int number_mfm_drives;
  34. static int __init parse_tag_acorn(const struct tag *tag)
  35. {
  36. memc_ctrl_reg = tag->u.acorn.memc_control_reg;
  37. number_mfm_drives = tag->u.acorn.adfsdrives;
  38. switch (tag->u.acorn.vram_pages) {
  39. case 512:
  40. vram_size += PAGE_SIZE * 256;
  41. case 256:
  42. vram_size += PAGE_SIZE * 256;
  43. default:
  44. break;
  45. }
  46. #if 0
  47. if (vram_size) {
  48. desc->video_start = 0x02000000;
  49. desc->video_end = 0x02000000 + vram_size;
  50. }
  51. #endif
  52. return 0;
  53. }
  54. __tagtable(ATAG_ACORN, parse_tag_acorn);
  55. static struct map_desc rpc_io_desc[] __initdata = {
  56. { /* VRAM */
  57. .virtual = SCREEN_BASE,
  58. .pfn = __phys_to_pfn(SCREEN_START),
  59. .length = 2*1048576,
  60. .type = MT_DEVICE
  61. }, { /* IO space */
  62. .virtual = (u32)IO_BASE,
  63. .pfn = __phys_to_pfn(IO_START),
  64. .length = IO_SIZE ,
  65. .type = MT_DEVICE
  66. }, { /* EASI space */
  67. .virtual = EASI_BASE,
  68. .pfn = __phys_to_pfn(EASI_START),
  69. .length = EASI_SIZE,
  70. .type = MT_DEVICE
  71. }
  72. };
  73. static void __init rpc_map_io(void)
  74. {
  75. iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
  76. /*
  77. * Turn off floppy.
  78. */
  79. outb(0xc, 0x3f2);
  80. /*
  81. * RiscPC can't handle half-word loads and stores
  82. */
  83. elf_hwcap &= ~HWCAP_HALF;
  84. }
  85. static struct resource acornfb_resources[] = {
  86. { /* VIDC */
  87. .start = 0x03400000,
  88. .end = 0x035fffff,
  89. .flags = IORESOURCE_MEM,
  90. }, {
  91. .start = IRQ_VSYNCPULSE,
  92. .end = IRQ_VSYNCPULSE,
  93. .flags = IORESOURCE_IRQ,
  94. },
  95. };
  96. static struct platform_device acornfb_device = {
  97. .name = "acornfb",
  98. .id = -1,
  99. .dev = {
  100. .coherent_dma_mask = 0xffffffff,
  101. },
  102. .num_resources = ARRAY_SIZE(acornfb_resources),
  103. .resource = acornfb_resources,
  104. };
  105. static struct resource iomd_resources[] = {
  106. {
  107. .start = 0x03200000,
  108. .end = 0x0320ffff,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. };
  112. static struct platform_device iomd_device = {
  113. .name = "iomd",
  114. .id = -1,
  115. .num_resources = ARRAY_SIZE(iomd_resources),
  116. .resource = iomd_resources,
  117. };
  118. static struct platform_device kbd_device = {
  119. .name = "kart",
  120. .id = -1,
  121. .dev = {
  122. .parent = &iomd_device.dev,
  123. },
  124. };
  125. static struct plat_serial8250_port serial_platform_data[] = {
  126. {
  127. .mapbase = 0x03010fe0,
  128. .irq = 10,
  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 platform_device *devs[] __initdata = {
  144. &iomd_device,
  145. &kbd_device,
  146. &serial_device,
  147. &acornfb_device,
  148. };
  149. static int __init rpc_init(void)
  150. {
  151. return platform_add_devices(devs, ARRAY_SIZE(devs));
  152. }
  153. arch_initcall(rpc_init);
  154. extern struct sys_timer ioc_timer;
  155. MACHINE_START(RISCPC, "Acorn-RiscPC")
  156. /* Maintainer: Russell King */
  157. .phys_io = 0x03000000,
  158. .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
  159. .boot_params = 0x10000100,
  160. .reserve_lp0 = 1,
  161. .reserve_lp1 = 1,
  162. .map_io = rpc_map_io,
  163. .init_irq = rpc_init_irq,
  164. .timer = &ioc_timer,
  165. MACHINE_END