core.c 3.1 KB

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