Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Thomas Gleixner | 5a67b77 | 2006-07-01 22:32:37 +0100 | [diff] [blame] | 9 | #include <linux/irq.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/sched.h> |
| 11 | #include <linux/serial_8250.h> |
| 12 | |
| 13 | #include <asm/setup.h> |
| 14 | #include <asm/mach-types.h> |
| 15 | #include <asm/io.h> |
| 16 | #include <asm/leds.h> |
| 17 | #include <asm/param.h> |
| 18 | |
| 19 | #include <asm/mach/map.h> |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach/time.h> |
| 22 | |
| 23 | static struct plat_serial8250_port serial_platform_data[] = { |
| 24 | { |
| 25 | .iobase = 0x3f8, |
| 26 | .irq = 4, |
| 27 | .uartclk = 1843200, |
Alexander Schulz | b752341 | 2005-07-16 17:17:18 +0100 | [diff] [blame] | 28 | .regshift = 0, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | .iotype = UPIO_PORT, |
| 30 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 31 | }, |
| 32 | { |
| 33 | .iobase = 0x2f8, |
| 34 | .irq = 3, |
| 35 | .uartclk = 1843200, |
Alexander Schulz | b752341 | 2005-07-16 17:17:18 +0100 | [diff] [blame] | 36 | .regshift = 0, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | .iotype = UPIO_PORT, |
| 38 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 39 | }, |
| 40 | { }, |
| 41 | }; |
| 42 | |
| 43 | static struct platform_device serial_device = { |
| 44 | .name = "serial8250", |
Russell King | 6df29de | 2005-09-08 16:04:41 +0100 | [diff] [blame] | 45 | .id = PLAT8250_DEV_PLATFORM, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | .dev = { |
| 47 | .platform_data = serial_platform_data, |
| 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static int __init shark_init(void) |
| 52 | { |
| 53 | int ret; |
| 54 | |
| 55 | if (machine_is_shark()) |
| 56 | ret = platform_device_register(&serial_device); |
| 57 | |
| 58 | return ret; |
| 59 | } |
| 60 | |
| 61 | arch_initcall(shark_init); |
| 62 | |
| 63 | extern void shark_init_irq(void); |
| 64 | |
| 65 | static struct map_desc shark_io_desc[] __initdata = { |
Deepak Saxena | cd5fc8b | 2005-10-28 15:19:03 +0100 | [diff] [blame] | 66 | { |
| 67 | .virtual = IO_BASE, |
| 68 | .pfn = __phys_to_pfn(IO_START), |
| 69 | .length = IO_SIZE, |
| 70 | .type = MT_DEVICE |
| 71 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | static void __init shark_map_io(void) |
| 75 | { |
| 76 | iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc)); |
| 77 | } |
| 78 | |
| 79 | #define IRQ_TIMER 0 |
| 80 | #define HZ_TIME ((1193180 + HZ/2) / HZ) |
| 81 | |
| 82 | static irqreturn_t |
Linus Torvalds | 0cd61b6 | 2006-10-06 10:53:39 -0700 | [diff] [blame] | 83 | shark_timer_interrupt(int irq, void *dev_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | { |
| 85 | write_seqlock(&xtime_lock); |
Linus Torvalds | 0cd61b6 | 2006-10-06 10:53:39 -0700 | [diff] [blame] | 86 | timer_tick(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | write_sequnlock(&xtime_lock); |
| 88 | return IRQ_HANDLED; |
| 89 | } |
| 90 | |
| 91 | static struct irqaction shark_timer_irq = { |
| 92 | .name = "Shark Timer Tick", |
Bernhard Walle | b30faba | 2007-05-08 00:35:39 -0700 | [diff] [blame] | 93 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
Russell King | 09b8b5f | 2005-06-26 17:06:36 +0100 | [diff] [blame] | 94 | .handler = shark_timer_interrupt, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | /* |
| 98 | * Set up timer interrupt, and return the current time in seconds. |
| 99 | */ |
| 100 | static void __init shark_timer_init(void) |
| 101 | { |
| 102 | outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */ |
| 103 | outb(HZ_TIME & 0xff, 0x40); /* LSB of count */ |
| 104 | outb(HZ_TIME >> 8, 0x40); |
| 105 | |
| 106 | setup_irq(IRQ_TIMER, &shark_timer_irq); |
| 107 | } |
| 108 | |
| 109 | static struct sys_timer shark_timer = { |
| 110 | .init = shark_timer_init, |
| 111 | }; |
| 112 | |
| 113 | MACHINE_START(SHARK, "Shark") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 114 | /* Maintainer: Alexander Schulz */ |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 115 | .phys_io = 0x40000000, |
| 116 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
| 117 | .boot_params = 0x08003000, |
| 118 | .map_io = shark_map_io, |
| 119 | .init_irq = shark_init_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | .timer = &shark_timer, |
| 121 | MACHINE_END |