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/gpio.h>
24 #include <linux/platform_device.h>
26 #include <mach/irqs.h>
27 #include <mach/regs-wan.h>
28 #include <mach/regs-lan.h>
29 #include <mach/regs-hpna.h>
30 #include <mach/regs-switch.h>
31 #include <mach/regs-misc.h>
34 /* --------------------------------------------------------------------
36 * -------------------------------------------------------------------- */
38 static u64 eth_dmamask
= 0xffffffffUL
;
40 static struct resource ks8695_wan_resources
[] = {
42 .start
= KS8695_WAN_PA
,
43 .end
= KS8695_WAN_PA
+ 0x00ff,
44 .flags
= IORESOURCE_MEM
,
48 .start
= KS8695_IRQ_WAN_RX_STATUS
,
49 .end
= KS8695_IRQ_WAN_RX_STATUS
,
50 .flags
= IORESOURCE_IRQ
,
54 .start
= KS8695_IRQ_WAN_TX_STATUS
,
55 .end
= KS8695_IRQ_WAN_TX_STATUS
,
56 .flags
= IORESOURCE_IRQ
,
60 .start
= KS8695_IRQ_WAN_LINK
,
61 .end
= KS8695_IRQ_WAN_LINK
,
62 .flags
= IORESOURCE_IRQ
,
66 .start
= KS8695_MISC_PA
,
67 .end
= KS8695_MISC_PA
+ 0x1f,
68 .flags
= IORESOURCE_MEM
,
72 static struct platform_device ks8695_wan_device
= {
73 .name
= "ks8695_ether",
76 .dma_mask
= ð_dmamask
,
77 .coherent_dma_mask
= 0xffffffff,
79 .resource
= ks8695_wan_resources
,
80 .num_resources
= ARRAY_SIZE(ks8695_wan_resources
),
84 static struct resource ks8695_lan_resources
[] = {
86 .start
= KS8695_LAN_PA
,
87 .end
= KS8695_LAN_PA
+ 0x00ff,
88 .flags
= IORESOURCE_MEM
,
92 .start
= KS8695_IRQ_LAN_RX_STATUS
,
93 .end
= KS8695_IRQ_LAN_RX_STATUS
,
94 .flags
= IORESOURCE_IRQ
,
98 .start
= KS8695_IRQ_LAN_TX_STATUS
,
99 .end
= KS8695_IRQ_LAN_TX_STATUS
,
100 .flags
= IORESOURCE_IRQ
,
103 .name
= "LAN SWITCH",
104 .start
= KS8695_SWITCH_PA
,
105 .end
= KS8695_SWITCH_PA
+ 0x4f,
106 .flags
= IORESOURCE_MEM
,
110 static struct platform_device ks8695_lan_device
= {
111 .name
= "ks8695_ether",
114 .dma_mask
= ð_dmamask
,
115 .coherent_dma_mask
= 0xffffffff,
117 .resource
= ks8695_lan_resources
,
118 .num_resources
= ARRAY_SIZE(ks8695_lan_resources
),
122 static struct resource ks8695_hpna_resources
[] = {
124 .start
= KS8695_HPNA_PA
,
125 .end
= KS8695_HPNA_PA
+ 0x00ff,
126 .flags
= IORESOURCE_MEM
,
130 .start
= KS8695_IRQ_HPNA_RX_STATUS
,
131 .end
= KS8695_IRQ_HPNA_RX_STATUS
,
132 .flags
= IORESOURCE_IRQ
,
136 .start
= KS8695_IRQ_HPNA_TX_STATUS
,
137 .end
= KS8695_IRQ_HPNA_TX_STATUS
,
138 .flags
= IORESOURCE_IRQ
,
142 static struct platform_device ks8695_hpna_device
= {
143 .name
= "ks8695_ether",
146 .dma_mask
= ð_dmamask
,
147 .coherent_dma_mask
= 0xffffffff,
149 .resource
= ks8695_hpna_resources
,
150 .num_resources
= ARRAY_SIZE(ks8695_hpna_resources
),
153 void __init
ks8695_add_device_wan(void)
155 platform_device_register(&ks8695_wan_device
);
158 void __init
ks8695_add_device_lan(void)
160 platform_device_register(&ks8695_lan_device
);
163 void __init
ks8696_add_device_hpna(void)
165 platform_device_register(&ks8695_hpna_device
);
169 /* --------------------------------------------------------------------
171 * -------------------------------------------------------------------- */
173 static struct platform_device ks8695_wdt_device
= {
174 .name
= "ks8695_wdt",
179 static void __init
ks8695_add_device_watchdog(void)
181 platform_device_register(&ks8695_wdt_device
);
185 /* --------------------------------------------------------------------
187 * -------------------------------------------------------------------- */
189 #if defined(CONFIG_LEDS)
190 short ks8695_leds_cpu
= -1;
191 short ks8695_leds_timer
= -1;
193 void __init
ks8695_init_leds(u8 cpu_led
, u8 timer_led
)
195 /* Enable GPIO to access the LEDs */
196 gpio_direction_output(cpu_led
, 1);
197 gpio_direction_output(timer_led
, 1);
199 ks8695_leds_cpu
= cpu_led
;
200 ks8695_leds_timer
= timer_led
;
203 void __init
ks8695_init_leds(u8 cpu_led
, u8 timer_led
) {}
206 /* -------------------------------------------------------------------- */
209 * These devices are always present and don't need any board-specific
212 static int __init
ks8695_add_standard_devices(void)
214 ks8695_add_device_watchdog();
218 arch_initcall(ks8695_add_standard_devices
);