Jamie Iles | af75655 | 2011-07-25 17:36:42 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 Picochip Ltd., Jamie Iles |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * All enquiries to support@picochip.com |
| 9 | */ |
| 10 | #include <linux/irq.h> |
| 11 | #include <linux/irqdomain.h> |
| 12 | #include <linux/of.h> |
| 13 | #include <linux/of_address.h> |
Jamie Iles | c05012c | 2011-11-03 17:29:03 +0000 | [diff] [blame] | 14 | #include <linux/of_irq.h> |
Jamie Iles | af75655 | 2011-07-25 17:36:42 +0100 | [diff] [blame] | 15 | #include <linux/of_platform.h> |
| 16 | |
| 17 | #include <asm/mach/arch.h> |
| 18 | #include <asm/hardware/vic.h> |
Jamie Iles | 8f37a0b | 2011-12-12 20:21:39 +0000 | [diff] [blame^] | 19 | #include <asm/mach/map.h> |
Jamie Iles | af75655 | 2011-07-25 17:36:42 +0100 | [diff] [blame] | 20 | |
| 21 | #include <mach/map.h> |
| 22 | #include <mach/picoxcell_soc.h> |
| 23 | |
| 24 | #include "common.h" |
| 25 | |
Jamie Iles | 8f37a0b | 2011-12-12 20:21:39 +0000 | [diff] [blame^] | 26 | static struct map_desc io_map __initdata = { |
| 27 | .virtual = PHYS_TO_IO(PICOXCELL_PERIPH_BASE), |
| 28 | .pfn = __phys_to_pfn(PICOXCELL_PERIPH_BASE), |
| 29 | .length = PICOXCELL_PERIPH_LENGTH, |
| 30 | .type = MT_DEVICE, |
| 31 | }; |
| 32 | |
| 33 | static void __init picoxcell_map_io(void) |
| 34 | { |
| 35 | iotable_init(&io_map, 1); |
| 36 | } |
| 37 | |
Jamie Iles | af75655 | 2011-07-25 17:36:42 +0100 | [diff] [blame] | 38 | static void __init picoxcell_init_machine(void) |
| 39 | { |
| 40 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 41 | } |
| 42 | |
| 43 | static const char *picoxcell_dt_match[] = { |
| 44 | "picochip,pc3x2", |
| 45 | "picochip,pc3x3", |
| 46 | NULL |
| 47 | }; |
| 48 | |
| 49 | static const struct of_device_id vic_of_match[] __initconst = { |
Jamie Iles | c05012c | 2011-11-03 17:29:03 +0000 | [diff] [blame] | 50 | { .compatible = "arm,pl192-vic", .data = vic_of_init, }, |
Jamie Iles | af75655 | 2011-07-25 17:36:42 +0100 | [diff] [blame] | 51 | { /* Sentinel */ } |
| 52 | }; |
| 53 | |
| 54 | static void __init picoxcell_init_irq(void) |
| 55 | { |
Jamie Iles | c05012c | 2011-11-03 17:29:03 +0000 | [diff] [blame] | 56 | of_irq_init(vic_of_match); |
Jamie Iles | af75655 | 2011-07-25 17:36:42 +0100 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | DT_MACHINE_START(PICOXCELL, "Picochip picoXcell") |
| 60 | .map_io = picoxcell_map_io, |
Jamie Iles | 98e27a5 | 2011-12-12 20:17:37 +0000 | [diff] [blame] | 61 | .nr_irqs = NR_IRQS_LEGACY, |
Jamie Iles | af75655 | 2011-07-25 17:36:42 +0100 | [diff] [blame] | 62 | .init_irq = picoxcell_init_irq, |
Jamie Iles | c05012c | 2011-11-03 17:29:03 +0000 | [diff] [blame] | 63 | .handle_irq = vic_handle_irq, |
Jamie Iles | af75655 | 2011-07-25 17:36:42 +0100 | [diff] [blame] | 64 | .timer = &picoxcell_timer, |
| 65 | .init_machine = picoxcell_init_machine, |
| 66 | .dt_compat = picoxcell_dt_match, |
| 67 | MACHINE_END |