/arch/arm/mach-shark/core.c

https://bitbucket.org/evzijst/gittest · C · 114 lines · 88 code · 18 blank · 8 comment · 1 complexity · 7db21d21d43c326a45b642e3fa05365f MD5 · raw file

  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 = 2,
  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 = 2,
  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 = 0,
  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,
  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. BOOT_MEM(0x08000000, 0x40000000, 0xe0000000)
  92. BOOT_PARAMS(0x08003000)
  93. MAPIO(shark_map_io)
  94. INITIRQ(shark_init_irq)
  95. .timer = &shark_timer,
  96. MACHINE_END