core.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * linux/arch/arm/mach-shark/arch.c
  3. *
  4. * Architecture specific stuff.
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/init.h>
  8. #include <linux/interrupt.h>
  9. #include <linux/irq.h>
  10. #include <linux/sched.h>
  11. #include <linux/serial_8250.h>
  12. #include <linux/io.h>
  13. #include <asm/setup.h>
  14. #include <asm/mach-types.h>
  15. #include <asm/leds.h>
  16. #include <asm/param.h>
  17. #include <asm/system_misc.h>
  18. #include <asm/mach/map.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/time.h>
  21. #define IO_BASE 0xe0000000
  22. #define IO_SIZE 0x08000000
  23. #define IO_START 0x40000000
  24. #define ROMCARD_SIZE 0x08000000
  25. #define ROMCARD_START 0x10000000
  26. static void shark_restart(char mode, const char *cmd)
  27. {
  28. short temp;
  29. /* Reset the Machine via pc[3] of the sequoia chipset */
  30. outw(0x09,0x24);
  31. temp=inw(0x26);
  32. temp = temp | (1<<3) | (1<<10);
  33. outw(0x09,0x24);
  34. outw(temp,0x26);
  35. }
  36. static struct plat_serial8250_port serial_platform_data[] = {
  37. {
  38. .iobase = 0x3f8,
  39. .irq = 4,
  40. .uartclk = 1843200,
  41. .regshift = 0,
  42. .iotype = UPIO_PORT,
  43. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  44. },
  45. {
  46. .iobase = 0x2f8,
  47. .irq = 3,
  48. .uartclk = 1843200,
  49. .regshift = 0,
  50. .iotype = UPIO_PORT,
  51. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  52. },
  53. { },
  54. };
  55. static struct platform_device serial_device = {
  56. .name = "serial8250",
  57. .id = PLAT8250_DEV_PLATFORM,
  58. .dev = {
  59. .platform_data = serial_platform_data,
  60. },
  61. };
  62. static struct resource rtc_resources[] = {
  63. [0] = {
  64. .start = 0x70,
  65. .end = 0x73,
  66. .flags = IORESOURCE_IO,
  67. },
  68. [1] = {
  69. .start = IRQ_ISA_RTC_ALARM,
  70. .end = IRQ_ISA_RTC_ALARM,
  71. .flags = IORESOURCE_IRQ,
  72. }
  73. };
  74. static struct platform_device rtc_device = {
  75. .name = "rtc_cmos",
  76. .id = -1,
  77. .resource = rtc_resources,
  78. .num_resources = ARRAY_SIZE(rtc_resources),
  79. };
  80. static int __init shark_init(void)
  81. {
  82. int ret;
  83. if (machine_is_shark())
  84. {
  85. ret = platform_device_register(&rtc_device);
  86. if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret);
  87. ret = platform_device_register(&serial_device);
  88. if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret);
  89. }
  90. return 0;
  91. }
  92. arch_initcall(shark_init);
  93. extern void shark_init_irq(void);
  94. static struct map_desc shark_io_desc[] __initdata = {
  95. {
  96. .virtual = IO_BASE,
  97. .pfn = __phys_to_pfn(IO_START),
  98. .length = IO_SIZE,
  99. .type = MT_DEVICE
  100. }
  101. };
  102. static void __init shark_map_io(void)
  103. {
  104. iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc));
  105. }
  106. #define IRQ_TIMER 0
  107. #define HZ_TIME ((1193180 + HZ/2) / HZ)
  108. static irqreturn_t
  109. shark_timer_interrupt(int irq, void *dev_id)
  110. {
  111. timer_tick();
  112. return IRQ_HANDLED;
  113. }
  114. static struct irqaction shark_timer_irq = {
  115. .name = "Shark Timer Tick",
  116. .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
  117. .handler = shark_timer_interrupt,
  118. };
  119. /*
  120. * Set up timer interrupt, and return the current time in seconds.
  121. */
  122. static void __init shark_timer_init(void)
  123. {
  124. outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
  125. outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
  126. outb(HZ_TIME >> 8, 0x40);
  127. setup_irq(IRQ_TIMER, &shark_timer_irq);
  128. }
  129. static struct sys_timer shark_timer = {
  130. .init = shark_timer_init,
  131. };
  132. static void shark_init_early(void)
  133. {
  134. disable_hlt();
  135. }
  136. MACHINE_START(SHARK, "Shark")
  137. /* Maintainer: Alexander Schulz */
  138. .atag_offset = 0x3000,
  139. .map_io = shark_map_io,
  140. .init_early = shark_init_early,
  141. .init_irq = shark_init_irq,
  142. .timer = &shark_timer,
  143. .dma_zone_size = SZ_4M,
  144. .restart = shark_restart,
  145. MACHINE_END