core.c 3.1 KB

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