core.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. { IO_BASE , IO_START , IO_SIZE , MT_DEVICE }
  56. };
  57. static void __init shark_map_io(void)
  58. {
  59. iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc));
  60. }
  61. #define IRQ_TIMER 0
  62. #define HZ_TIME ((1193180 + HZ/2) / HZ)
  63. static irqreturn_t
  64. shark_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
  65. {
  66. write_seqlock(&xtime_lock);
  67. timer_tick(regs);
  68. write_sequnlock(&xtime_lock);
  69. return IRQ_HANDLED;
  70. }
  71. static struct irqaction shark_timer_irq = {
  72. .name = "Shark Timer Tick",
  73. .flags = SA_INTERRUPT | SA_TIMER,
  74. .handler = shark_timer_interrupt,
  75. };
  76. /*
  77. * Set up timer interrupt, and return the current time in seconds.
  78. */
  79. static void __init shark_timer_init(void)
  80. {
  81. outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
  82. outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
  83. outb(HZ_TIME >> 8, 0x40);
  84. setup_irq(IRQ_TIMER, &shark_timer_irq);
  85. }
  86. static struct sys_timer shark_timer = {
  87. .init = shark_timer_init,
  88. };
  89. MACHINE_START(SHARK, "Shark")
  90. /* Maintainer: Alexander Schulz */
  91. .phys_ram = 0x08000000,
  92. .phys_io = 0x40000000,
  93. .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
  94. .boot_params = 0x08003000,
  95. .map_io = shark_map_io,
  96. .init_irq = shark_init_irq,
  97. .timer = &shark_timer,
  98. MACHINE_END