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 /* --------------------------------------------------------------------
34 * -------------------------------------------------------------------- */
36 static u64 eth_dmamask = 0xffffffffUL;
38 static struct resource ks8695_wan_resources[] = {
40 .start = KS8695_WAN_PA,
41 .end = KS8695_WAN_PA + 0x00ff,
42 .flags = IORESOURCE_MEM,
46 .start = KS8695_IRQ_WAN_RX_STATUS,
47 .end = KS8695_IRQ_WAN_RX_STATUS,
48 .flags = IORESOURCE_IRQ,
52 .start = KS8695_IRQ_WAN_TX_STATUS,
53 .end = KS8695_IRQ_WAN_TX_STATUS,
54 .flags = IORESOURCE_IRQ,
58 .start = KS8695_IRQ_WAN_LINK,
59 .end = KS8695_IRQ_WAN_LINK,
60 .flags = IORESOURCE_IRQ,
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",
74 .dma_mask = ð_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[] = {
84 .start = KS8695_LAN_PA,
85 .end = KS8695_LAN_PA + 0x00ff,
86 .flags = IORESOURCE_MEM,
90 .start = KS8695_IRQ_LAN_RX_STATUS,
91 .end = KS8695_IRQ_LAN_RX_STATUS,
92 .flags = IORESOURCE_IRQ,
96 .start = KS8695_IRQ_LAN_TX_STATUS,
97 .end = KS8695_IRQ_LAN_TX_STATUS,
98 .flags = IORESOURCE_IRQ,
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",
112 .dma_mask = ð_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[] = {
122 .start = KS8695_HPNA_PA,
123 .end = KS8695_HPNA_PA + 0x00ff,
124 .flags = IORESOURCE_MEM,
128 .start = KS8695_IRQ_HPNA_RX_STATUS,
129 .end = KS8695_IRQ_HPNA_RX_STATUS,
130 .flags = IORESOURCE_IRQ,
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",
144 .dma_mask = ð_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 /* --------------------------------------------------------------------
169 * -------------------------------------------------------------------- */
171 static struct platform_device ks8695_wdt_device = {
172 .name = "ks8695_wdt",
177 static void __init ks8695_add_device_watchdog(void)
179 platform_device_register(&ks8695_wdt_device);
183 /* --------------------------------------------------------------------
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;
201 void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {}
204 /* -------------------------------------------------------------------- */
207 * These devices are always present and don't need any board-specific
210 static int __init ks8695_add_standard_devices(void)
212 ks8695_add_device_watchdog();
216 arch_initcall(ks8695_add_standard_devices);