core.c 3.0 KB

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