[ARM] KS8695: Fix up device registration.
[linux-2.6/mini2440.git] / arch / arm / mach-ks8695 / devices.c
blob36ab0fd3d9b687ace1c166a3d4231262d6dedb12
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/regs-wan.h>
26 #include <mach/regs-lan.h>
27 #include <mach/regs-hpna.h>
28 #include <mach/regs-switch.h>
29 #include <mach/regs-misc.h>
32 /* --------------------------------------------------------------------
33 * Ethernet
34 * -------------------------------------------------------------------- */
36 static u64 eth_dmamask = 0xffffffffUL;
38 static struct resource ks8695_wan_resources[] = {
39 [0] = {
40 .start = KS8695_WAN_PA,
41 .end = KS8695_WAN_PA + 0x00ff,
42 .flags = IORESOURCE_MEM,
44 [1] = {
45 .name = "WAN RX",
46 .start = KS8695_IRQ_WAN_RX_STATUS,
47 .end = KS8695_IRQ_WAN_RX_STATUS,
48 .flags = IORESOURCE_IRQ,
50 [2] = {
51 .name = "WAN TX",
52 .start = KS8695_IRQ_WAN_TX_STATUS,
53 .end = KS8695_IRQ_WAN_TX_STATUS,
54 .flags = IORESOURCE_IRQ,
56 [3] = {
57 .name = "WAN Link",
58 .start = KS8695_IRQ_WAN_LINK,
59 .end = KS8695_IRQ_WAN_LINK,
60 .flags = IORESOURCE_IRQ,
62 [4] = {
63 .name = "WAN PHY",
64 .start = KS8695_MISC_PA,
65 .end = KS8695_MISC_PA + 0x1f,
66 .flags = IORESOURCE_MEM,
70 static struct platform_device ks8695_wan_device = {
71 .name = "ks8695_ether",
72 .id = 0,
73 .dev = {
74 .dma_mask = &eth_dmamask,
75 .coherent_dma_mask = 0xffffffff,
77 .resource = ks8695_wan_resources,
78 .num_resources = ARRAY_SIZE(ks8695_wan_resources),
82 static struct resource ks8695_lan_resources[] = {
83 [0] = {
84 .start = KS8695_LAN_PA,
85 .end = KS8695_LAN_PA + 0x00ff,
86 .flags = IORESOURCE_MEM,
88 [1] = {
89 .name = "LAN RX",
90 .start = KS8695_IRQ_LAN_RX_STATUS,
91 .end = KS8695_IRQ_LAN_RX_STATUS,
92 .flags = IORESOURCE_IRQ,
94 [2] = {
95 .name = "LAN TX",
96 .start = KS8695_IRQ_LAN_TX_STATUS,
97 .end = KS8695_IRQ_LAN_TX_STATUS,
98 .flags = IORESOURCE_IRQ,
100 [3] = {
101 .name = "LAN SWITCH",
102 .start = KS8695_SWITCH_PA,
103 .end = KS8695_SWITCH_PA + 0x4f,
104 .flags = IORESOURCE_MEM,
108 static struct platform_device ks8695_lan_device = {
109 .name = "ks8695_ether",
110 .id = 1,
111 .dev = {
112 .dma_mask = &eth_dmamask,
113 .coherent_dma_mask = 0xffffffff,
115 .resource = ks8695_lan_resources,
116 .num_resources = ARRAY_SIZE(ks8695_lan_resources),
120 static struct resource ks8695_hpna_resources[] = {
121 [0] = {
122 .start = KS8695_HPNA_PA,
123 .end = KS8695_HPNA_PA + 0x00ff,
124 .flags = IORESOURCE_MEM,
126 [1] = {
127 .name = "HPNA RX",
128 .start = KS8695_IRQ_HPNA_RX_STATUS,
129 .end = KS8695_IRQ_HPNA_RX_STATUS,
130 .flags = IORESOURCE_IRQ,
132 [2] = {
133 .name = "HPNA TX",
134 .start = KS8695_IRQ_HPNA_TX_STATUS,
135 .end = KS8695_IRQ_HPNA_TX_STATUS,
136 .flags = IORESOURCE_IRQ,
140 static struct platform_device ks8695_hpna_device = {
141 .name = "ks8695_ether",
142 .id = 2,
143 .dev = {
144 .dma_mask = &eth_dmamask,
145 .coherent_dma_mask = 0xffffffff,
147 .resource = ks8695_hpna_resources,
148 .num_resources = ARRAY_SIZE(ks8695_hpna_resources),
151 void __init ks8695_add_device_wan(void)
153 platform_device_register(&ks8695_wan_device);
156 void __init ks8695_add_device_lan(void)
158 platform_device_register(&ks8695_lan_device);
161 void __init ks8696_add_device_hpna(void)
163 platform_device_register(&ks8695_hpna_device);
167 /* --------------------------------------------------------------------
168 * Watchdog
169 * -------------------------------------------------------------------- */
171 static struct platform_device ks8695_wdt_device = {
172 .name = "ks8695_wdt",
173 .id = -1,
174 .num_resources = 0,
177 static void __init ks8695_add_device_watchdog(void)
179 platform_device_register(&ks8695_wdt_device);
183 /* --------------------------------------------------------------------
184 * LEDs
185 * -------------------------------------------------------------------- */
187 #if defined(CONFIG_LEDS)
188 short ks8695_leds_cpu = -1;
189 short ks8695_leds_timer = -1;
191 void __init ks8695_init_leds(u8 cpu_led, u8 timer_led)
193 /* Enable GPIO to access the LEDs */
194 gpio_direction_output(cpu_led, 1);
195 gpio_direction_output(timer_led, 1);
197 ks8695_leds_cpu = cpu_led;
198 ks8695_leds_timer = timer_led;
200 #else
201 void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {}
202 #endif
204 /* -------------------------------------------------------------------- */
207 * These devices are always present and don't need any board-specific
208 * setup.
210 static int __init ks8695_add_standard_devices(void)
212 ks8695_add_device_watchdog();
213 return 0;
216 arch_initcall(ks8695_add_standard_devices);