diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/mips/lantiq/xway/devices.c | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'arch/mips/lantiq/xway/devices.c')
-rw-r--r-- | arch/mips/lantiq/xway/devices.c | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/arch/mips/lantiq/xway/devices.c b/arch/mips/lantiq/xway/devices.c new file mode 100644 index 00000000000..d0e32ab2ea0 --- /dev/null +++ b/arch/mips/lantiq/xway/devices.c | |||
@@ -0,0 +1,119 @@ | |||
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/time.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/gpio.h> | ||
22 | |||
23 | #include <asm/bootinfo.h> | ||
24 | #include <asm/irq.h> | ||
25 | |||
26 | #include <lantiq_soc.h> | ||
27 | #include <lantiq_irq.h> | ||
28 | #include <lantiq_platform.h> | ||
29 | |||
30 | #include "devices.h" | ||
31 | |||
32 | /* gpio */ | ||
33 | static struct resource ltq_gpio_resource[] = { | ||
34 | { | ||
35 | .name = "gpio0", | ||
36 | .start = LTQ_GPIO0_BASE_ADDR, | ||
37 | .end = LTQ_GPIO0_BASE_ADDR + LTQ_GPIO_SIZE - 1, | ||
38 | .flags = IORESOURCE_MEM, | ||
39 | }, { | ||
40 | .name = "gpio1", | ||
41 | .start = LTQ_GPIO1_BASE_ADDR, | ||
42 | .end = LTQ_GPIO1_BASE_ADDR + LTQ_GPIO_SIZE - 1, | ||
43 | .flags = IORESOURCE_MEM, | ||
44 | }, { | ||
45 | .name = "gpio2", | ||
46 | .start = LTQ_GPIO2_BASE_ADDR, | ||
47 | .end = LTQ_GPIO2_BASE_ADDR + LTQ_GPIO_SIZE - 1, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | } | ||
50 | }; | ||
51 | |||
52 | void __init ltq_register_gpio(void) | ||
53 | { | ||
54 | platform_device_register_simple("ltq_gpio", 0, | ||
55 | <q_gpio_resource[0], 1); | ||
56 | platform_device_register_simple("ltq_gpio", 1, | ||
57 | <q_gpio_resource[1], 1); | ||
58 | |||
59 | /* AR9 and VR9 have an extra gpio block */ | ||
60 | if (ltq_is_ar9() || ltq_is_vr9()) { | ||
61 | platform_device_register_simple("ltq_gpio", 2, | ||
62 | <q_gpio_resource[2], 1); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | /* serial to parallel conversion */ | ||
67 | static struct resource ltq_stp_resource = { | ||
68 | .name = "stp", | ||
69 | .start = LTQ_STP_BASE_ADDR, | ||
70 | .end = LTQ_STP_BASE_ADDR + LTQ_STP_SIZE - 1, | ||
71 | .flags = IORESOURCE_MEM, | ||
72 | }; | ||
73 | |||
74 | void __init ltq_register_gpio_stp(void) | ||
75 | { | ||
76 | platform_device_register_simple("ltq_stp", 0, <q_stp_resource, 1); | ||
77 | } | ||
78 | |||
79 | /* asc ports - amazon se has its own serial mapping */ | ||
80 | static struct resource ltq_ase_asc_resources[] = { | ||
81 | { | ||
82 | .name = "asc0", | ||
83 | .start = LTQ_ASC1_BASE_ADDR, | ||
84 | .end = LTQ_ASC1_BASE_ADDR + LTQ_ASC_SIZE - 1, | ||
85 | .flags = IORESOURCE_MEM, | ||
86 | }, | ||
87 | IRQ_RES(tx, LTQ_ASC_ASE_TIR), | ||
88 | IRQ_RES(rx, LTQ_ASC_ASE_RIR), | ||
89 | IRQ_RES(err, LTQ_ASC_ASE_EIR), | ||
90 | }; | ||
91 | |||
92 | void __init ltq_register_ase_asc(void) | ||
93 | { | ||
94 | platform_device_register_simple("ltq_asc", 0, | ||
95 | ltq_ase_asc_resources, ARRAY_SIZE(ltq_ase_asc_resources)); | ||
96 | } | ||
97 | |||
98 | /* ethernet */ | ||
99 | static struct resource ltq_etop_resources = { | ||
100 | .name = "etop", | ||
101 | .start = LTQ_ETOP_BASE_ADDR, | ||
102 | .end = LTQ_ETOP_BASE_ADDR + LTQ_ETOP_SIZE - 1, | ||
103 | .flags = IORESOURCE_MEM, | ||
104 | }; | ||
105 | |||
106 | static struct platform_device ltq_etop = { | ||
107 | .name = "ltq_etop", | ||
108 | .resource = <q_etop_resources, | ||
109 | .num_resources = 1, | ||
110 | }; | ||
111 | |||
112 | void __init | ||
113 | ltq_register_etop(struct ltq_eth_data *eth) | ||
114 | { | ||
115 | if (eth) { | ||
116 | ltq_etop.dev.platform_data = eth; | ||
117 | platform_device_register(<q_etop); | ||
118 | } | ||
119 | } | ||