diff options
Diffstat (limited to 'arch/mips/lantiq/xway/devices.c')
-rw-r--r-- | arch/mips/lantiq/xway/devices.c | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/arch/mips/lantiq/xway/devices.c b/arch/mips/lantiq/xway/devices.c new file mode 100644 index 000000000000..e09e789dfc27 --- /dev/null +++ b/arch/mips/lantiq/xway/devices.c | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify it | ||
3 | * under the terms of the GNU General Public License version 2 as published | ||
4 | * by the Free Software Foundation. | ||
5 | * | ||
6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> | ||
7 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/mtd/physmap.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/reboot.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/leds.h> | ||
18 | #include <linux/etherdevice.h> | ||
19 | #include <linux/reboot.h> | ||
20 | #include <linux/time.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/gpio.h> | ||
23 | #include <linux/leds.h> | ||
24 | |||
25 | #include <asm/bootinfo.h> | ||
26 | #include <asm/irq.h> | ||
27 | |||
28 | #include <lantiq_soc.h> | ||
29 | #include <lantiq_irq.h> | ||
30 | #include <lantiq_platform.h> | ||
31 | |||
32 | #include "devices.h" | ||
33 | |||
34 | /* gpio */ | ||
35 | static struct resource ltq_gpio_resource[] = { | ||
36 | { | ||
37 | .name = "gpio0", | ||
38 | .start = LTQ_GPIO0_BASE_ADDR, | ||
39 | .end = LTQ_GPIO0_BASE_ADDR + LTQ_GPIO_SIZE - 1, | ||
40 | .flags = IORESOURCE_MEM, | ||
41 | }, { | ||
42 | .name = "gpio1", | ||
43 | .start = LTQ_GPIO1_BASE_ADDR, | ||
44 | .end = LTQ_GPIO1_BASE_ADDR + LTQ_GPIO_SIZE - 1, | ||
45 | .flags = IORESOURCE_MEM, | ||
46 | }, { | ||
47 | .name = "gpio2", | ||
48 | .start = LTQ_GPIO2_BASE_ADDR, | ||
49 | .end = LTQ_GPIO2_BASE_ADDR + LTQ_GPIO_SIZE - 1, | ||
50 | .flags = IORESOURCE_MEM, | ||
51 | } | ||
52 | }; | ||
53 | |||
54 | void __init ltq_register_gpio(void) | ||
55 | { | ||
56 | platform_device_register_simple("ltq_gpio", 0, | ||
57 | <q_gpio_resource[0], 1); | ||
58 | platform_device_register_simple("ltq_gpio", 1, | ||
59 | <q_gpio_resource[1], 1); | ||
60 | |||
61 | /* AR9 and VR9 have an extra gpio block */ | ||
62 | if (ltq_is_ar9() || ltq_is_vr9()) { | ||
63 | platform_device_register_simple("ltq_gpio", 2, | ||
64 | <q_gpio_resource[2], 1); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | /* serial to parallel conversion */ | ||
69 | static struct resource ltq_stp_resource = { | ||
70 | .name = "stp", | ||
71 | .start = LTQ_STP_BASE_ADDR, | ||
72 | .end = LTQ_STP_BASE_ADDR + LTQ_STP_SIZE - 1, | ||
73 | .flags = IORESOURCE_MEM, | ||
74 | }; | ||
75 | |||
76 | void __init ltq_register_gpio_stp(void) | ||
77 | { | ||
78 | platform_device_register_simple("ltq_stp", 0, <q_stp_resource, 1); | ||
79 | } | ||
80 | |||
81 | /* asc ports - amazon se has its own serial mapping */ | ||
82 | static struct resource ltq_ase_asc_resources[] = { | ||
83 | { | ||
84 | .name = "asc0", | ||
85 | .start = LTQ_ASC1_BASE_ADDR, | ||
86 | .end = LTQ_ASC1_BASE_ADDR + LTQ_ASC_SIZE - 1, | ||
87 | .flags = IORESOURCE_MEM, | ||
88 | }, | ||
89 | IRQ_RES(tx, LTQ_ASC_ASE_TIR), | ||
90 | IRQ_RES(rx, LTQ_ASC_ASE_RIR), | ||
91 | IRQ_RES(err, LTQ_ASC_ASE_EIR), | ||
92 | }; | ||
93 | |||
94 | void __init ltq_register_ase_asc(void) | ||
95 | { | ||
96 | platform_device_register_simple("ltq_asc", 0, | ||
97 | ltq_ase_asc_resources, ARRAY_SIZE(ltq_ase_asc_resources)); | ||
98 | } | ||
99 | |||
100 | /* ethernet */ | ||
101 | static struct resource ltq_etop_resources = { | ||
102 | .name = "etop", | ||
103 | .start = LTQ_ETOP_BASE_ADDR, | ||
104 | .end = LTQ_ETOP_BASE_ADDR + LTQ_ETOP_SIZE - 1, | ||
105 | .flags = IORESOURCE_MEM, | ||
106 | }; | ||
107 | |||
108 | static struct platform_device ltq_etop = { | ||
109 | .name = "ltq_etop", | ||
110 | .resource = <q_etop_resources, | ||
111 | .num_resources = 1, | ||
112 | }; | ||
113 | |||
114 | void __init | ||
115 | ltq_register_etop(struct ltq_eth_data *eth) | ||
116 | { | ||
117 | if (eth) { | ||
118 | ltq_etop.dev.platform_data = eth; | ||
119 | platform_device_register(<q_etop); | ||
120 | } | ||
121 | } | ||