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