core.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. static struct plat_serial8250_port serial_platform_data[] = {
  21. {
  22. .iobase = 0x3f8,
  23. .irq = 4,
  24. .uartclk = 1843200,
  25. .regshift = 0,
  26. .iotype = UPIO_PORT,
  27. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  28. },
  29. {
  30. .iobase = 0x2f8,
  31. .irq = 3,
  32. .uartclk = 1843200,
  33. .regshift = 0,
  34. .iotype = UPIO_PORT,
  35. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  36. },
  37. { },
  38. };
  39. static struct platform_device serial_device = {
  40. .name = "serial8250",
  41. .id = PLAT8250_DEV_PLATFORM,
  42. .dev = {
  43. .platform_data = serial_platform_data,
  44. },
  45. };
  46. static int __init shark_init(void)
  47. {
  48. int ret;
  49. if (machine_is_shark())
  50. ret = platform_device_register(&serial_device);
  51. return ret;
  52. }
  53. arch_initcall(shark_init);
  54. extern void shark_init_irq(void);
  55. static struct map_desc shark_io_desc[] __initdata = {
  56. {
  57. .virtual = IO_BASE,
  58. .pfn = __phys_to_pfn(IO_START),
  59. .length = IO_SIZE,
  60. .type = MT_DEVICE
  61. }
  62. };
  63. static void __init shark_map_io(void)
  64. {
  65. iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc));
  66. }
  67. #define IRQ_TIMER 0
  68. #define HZ_TIME ((1193180 + HZ/2) / HZ)
  69. static irqreturn_t
  70. shark_timer_interrupt(int irq, void *dev_id)
  71. {
  72. timer_tick();
  73. return IRQ_HANDLED;
  74. }
  75. static struct irqaction shark_timer_irq = {
  76. .name = "Shark Timer Tick",
  77. .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
  78. .handler = shark_timer_interrupt,
  79. };
  80. /*
  81. * Set up timer interrupt, and return the current time in seconds.
  82. */
  83. static void __init shark_timer_init(void)
  84. {
  85. outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
  86. outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
  87. outb(HZ_TIME >> 8, 0x40);
  88. setup_irq(IRQ_TIMER, &shark_timer_irq);
  89. }
  90. static struct sys_timer shark_timer = {
  91. .init = shark_timer_init,
  92. };
  93. MACHINE_START(SHARK, "Shark")
  94. /* Maintainer: Alexander Schulz */
  95. .phys_io = 0x40000000,
  96. .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
  97. .boot_params = 0x08003000,
  98. .map_io = shark_map_io,
  99. .init_irq = shark_init_irq,
  100. .timer = &shark_timer,
  101. MACHINE_END