core.c 3.4 KB

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