core.c 2.4 KB

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