First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / arm / mach-ks8695 / devices.c
blobb89fb6d46cccc9efc5ed9f112875ef039da17595
1 /*
2 * arch/arm/mach-ks8695/devices.c
4 * Copyright (C) 2006 Andrew Victor
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <asm/mach/arch.h>
21 #include <asm/mach/map.h>
23 #include <linux/platform_device.h>
25 #include <mach/irqs.h>
26 #include <mach/regs-wan.h>
27 #include <mach/regs-lan.h>
28 #include <mach/regs-hpna.h>
29 #include <mach/regs-switch.h>
30 #include <mach/regs-misc.h>
33 /* --------------------------------------------------------------------
34 * Ethernet
35 * -------------------------------------------------------------------- */
37 static u64 eth_dmamask = 0xffffffffUL;
39 static struct resource ks8695_wan_resources[] = {
40 [0] = {
41 .start = KS8695_WAN_PA,
42 .end = KS8695_WAN_PA + 0x00ff,
43 .flags = IORESOURCE_MEM,
45 [1] = {
46 .name = "WAN RX",
47 .start = KS8695_IRQ_WAN_RX_STATUS,
48 .end = KS8695_IRQ_WAN_RX_STATUS,
49 .flags = IORESOURCE_IRQ,
51 [2] = {
52 .name = "WAN TX",
53 .start = KS8695_IRQ_WAN_TX_STATUS,
54 .end = KS8695_IRQ_WAN_TX_STATUS,
55 .flags = IORESOURCE_IRQ,
57 [3] = {
58 .name = "WAN Link",
59 .start = KS8695_IRQ_WAN_LINK,
60 .end = KS8695_IRQ_WAN_LINK,
61 .flags = IORESOURCE_IRQ,
63 [4] = {
64 .name = "WAN PHY",
65 .start = KS8695_MISC_PA,
66 .end = KS8695_MISC_PA + 0x1f,
67 .flags = IORESOURCE_MEM,
71 static struct platform_device ks8695_wan_device = {
72 .name = "ks8695_ether",
73 .id = 0,
74 .dev = {
75 .dma_mask = &eth_dmamask,
76 .coherent_dma_mask = 0xffffffff,
78 .resource = ks8695_wan_resources,
79 .num_resources = ARRAY_SIZE(ks8695_wan_resources),
83 static struct resource ks8695_lan_resources[] = {
84 [0] = {
85 .start = KS8695_LAN_PA,
86 .end = KS8695_LAN_PA + 0x00ff,
87 .flags = IORESOURCE_MEM,
89 [1] = {
90 .name = "LAN RX",
91 .start = KS8695_IRQ_LAN_RX_STATUS,
92 .end = KS8695_IRQ_LAN_RX_STATUS,
93 .flags = IORESOURCE_IRQ,
95 [2] = {
96 .name = "LAN TX",
97 .start = KS8695_IRQ_LAN_TX_STATUS,
98 .end = KS8695_IRQ_LAN_TX_STATUS,
99 .flags = IORESOURCE_IRQ,
101 [3] = {
102 .name = "LAN SWITCH",
103 .start = KS8695_SWITCH_PA,
104 .end = KS8695_SWITCH_PA + 0x4f,
105 .flags = IORESOURCE_MEM,
109 static struct platform_device ks8695_lan_device = {
110 .name = "ks8695_ether",
111 .id = 1,
112 .dev = {
113 .dma_mask = &eth_dmamask,
114 .coherent_dma_mask = 0xffffffff,
116 .resource = ks8695_lan_resources,
117 .num_resources = ARRAY_SIZE(ks8695_lan_resources),
121 static struct resource ks8695_hpna_resources[] = {
122 [0] = {
123 .start = KS8695_HPNA_PA,
124 .end = KS8695_HPNA_PA + 0x00ff,
125 .flags = IORESOURCE_MEM,
127 [1] = {
128 .name = "HPNA RX",
129 .start = KS8695_IRQ_HPNA_RX_STATUS,
130 .end = KS8695_IRQ_HPNA_RX_STATUS,
131 .flags = IORESOURCE_IRQ,
133 [2] = {
134 .name = "HPNA TX",
135 .start = KS8695_IRQ_HPNA_TX_STATUS,
136 .end = KS8695_IRQ_HPNA_TX_STATUS,
137 .flags = IORESOURCE_IRQ,
141 static struct platform_device ks8695_hpna_device = {
142 .name = "ks8695_ether",
143 .id = 2,
144 .dev = {
145 .dma_mask = &eth_dmamask,
146 .coherent_dma_mask = 0xffffffff,
148 .resource = ks8695_hpna_resources,
149 .num_resources = ARRAY_SIZE(ks8695_hpna_resources),
152 void __init ks8695_add_device_wan(void)
154 platform_device_register(&ks8695_wan_device);
157 void __init ks8695_add_device_lan(void)
159 platform_device_register(&ks8695_lan_device);
162 void __init ks8696_add_device_hpna(void)
164 platform_device_register(&ks8695_hpna_device);
168 /* --------------------------------------------------------------------
169 * Watchdog
170 * -------------------------------------------------------------------- */
172 static struct platform_device ks8695_wdt_device = {
173 .name = "ks8695_wdt",
174 .id = -1,
175 .num_resources = 0,
178 static void __init ks8695_add_device_watchdog(void)
180 platform_device_register(&ks8695_wdt_device);
184 /* --------------------------------------------------------------------
185 * LEDs
186 * -------------------------------------------------------------------- */
188 #if defined(CONFIG_LEDS)
189 short ks8695_leds_cpu = -1;
190 short ks8695_leds_timer = -1;
192 void __init ks8695_init_leds(u8 cpu_led, u8 timer_led)
194 /* Enable GPIO to access the LEDs */
195 gpio_direction_output(cpu_led, 1);
196 gpio_direction_output(timer_led, 1);
198 ks8695_leds_cpu = cpu_led;
199 ks8695_leds_timer = timer_led;
201 #else
202 void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {}
203 #endif
205 /* -------------------------------------------------------------------- */
208 * These devices are always present and don't need any board-specific
209 * setup.
211 static int __init ks8695_add_standard_devices(void)
213 ks8695_add_device_watchdog();
214 return 0;
217 arch_initcall(ks8695_add_standard_devices);