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 /* --------------------------------------------------------------------
35 * -------------------------------------------------------------------- */
37 static u64 eth_dmamask = 0xffffffffUL;
39 static struct resource ks8695_wan_resources[] = {
41 .start = KS8695_WAN_PA,
42 .end = KS8695_WAN_PA + 0x00ff,
43 .flags = IORESOURCE_MEM,
47 .start = KS8695_IRQ_WAN_RX_STATUS,
48 .end = KS8695_IRQ_WAN_RX_STATUS,
49 .flags = IORESOURCE_IRQ,
53 .start = KS8695_IRQ_WAN_TX_STATUS,
54 .end = KS8695_IRQ_WAN_TX_STATUS,
55 .flags = IORESOURCE_IRQ,
59 .start = KS8695_IRQ_WAN_LINK,
60 .end = KS8695_IRQ_WAN_LINK,
61 .flags = IORESOURCE_IRQ,
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",
75 .dma_mask = ð_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[] = {
85 .start = KS8695_LAN_PA,
86 .end = KS8695_LAN_PA + 0x00ff,
87 .flags = IORESOURCE_MEM,
91 .start = KS8695_IRQ_LAN_RX_STATUS,
92 .end = KS8695_IRQ_LAN_RX_STATUS,
93 .flags = IORESOURCE_IRQ,
97 .start = KS8695_IRQ_LAN_TX_STATUS,
98 .end = KS8695_IRQ_LAN_TX_STATUS,
99 .flags = IORESOURCE_IRQ,
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",
113 .dma_mask = ð_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[] = {
123 .start = KS8695_HPNA_PA,
124 .end = KS8695_HPNA_PA + 0x00ff,
125 .flags = IORESOURCE_MEM,
129 .start = KS8695_IRQ_HPNA_RX_STATUS,
130 .end = KS8695_IRQ_HPNA_RX_STATUS,
131 .flags = IORESOURCE_IRQ,
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",
145 .dma_mask = ð_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 /* --------------------------------------------------------------------
170 * -------------------------------------------------------------------- */
172 static struct platform_device ks8695_wdt_device = {
173 .name = "ks8695_wdt",
178 static void __init ks8695_add_device_watchdog(void)
180 platform_device_register(&ks8695_wdt_device);
184 /* --------------------------------------------------------------------
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;
202 void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {}
205 /* -------------------------------------------------------------------- */
208 * These devices are always present and don't need any board-specific
211 static int __init ks8695_add_standard_devices(void)
213 ks8695_add_device_watchdog();
217 arch_initcall(ks8695_add_standard_devices);