v2.6.22.24-op1
[linux-2.6.22.y-op.git] / arch / arm / mach-ks8695 / devices.c
blob386593f8ac65b8476bba078a666a55cb3f951be0
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 <asm/arch/regs-wan.h>
26 #include <asm/arch/regs-lan.h>
27 #include <asm/arch/regs-hpna.h>
30 /* --------------------------------------------------------------------
31 * Ethernet
32 * -------------------------------------------------------------------- */
34 #if defined(CONFIG_ARM_KS8695_ETHER) || defined(CONFIG_ARM_KS8695_ETHER_MODULE)
35 static u64 eth_dmamask = 0xffffffffUL;
37 static struct resource ks8695_wan_resources[] = {
38 [0] = {
39 .start = KS8695_WAN_VA,
40 .end = KS8695_WAN_VA + 0x00ff,
41 .flags = IORESOURCE_MEM,
43 [1] = {
44 .name = "WAN RX",
45 .start = KS8695_IRQ_WAN_RX_STATUS,
46 .end = KS8695_IRQ_WAN_RX_STATUS,
47 .flags = IORESOURCE_IRQ,
49 [2] = {
50 .name = "WAN TX",
51 .start = KS8695_IRQ_WAN_TX_STATUS,
52 .end = KS8695_IRQ_WAN_TX_STATUS,
53 .flags = IORESOURCE_IRQ,
55 [3] = {
56 .name = "WAN Link",
57 .start = KS8695_IRQ_WAN_LINK,
58 .end = KS8695_IRQ_WAN_LINK,
59 .flags = IORESOURCE_IRQ,
63 static struct platform_device ks8695_wan_device = {
64 .name = "ks8695_ether",
65 .id = 0,
66 .dev = {
67 .dma_mask = &eth_dmamask,
68 .coherent_dma_mask = 0xffffffff,
70 .resource = ks8695_wan_resources,
71 .num_resources = ARRAY_SIZE(ks8695_wan_resources),
75 static struct resource ks8695_lan_resources[] = {
76 [0] = {
77 .start = KS8695_LAN_VA,
78 .end = KS8695_LAN_VA + 0x00ff,
79 .flags = IORESOURCE_MEM,
81 [1] = {
82 .name = "LAN RX",
83 .start = KS8695_IRQ_LAN_RX_STATUS,
84 .end = KS8695_IRQ_LAN_RX_STATUS,
85 .flags = IORESOURCE_IRQ,
87 [2] = {
88 .name = "LAN TX",
89 .start = KS8695_IRQ_LAN_TX_STATUS,
90 .end = KS8695_IRQ_LAN_TX_STATUS,
91 .flags = IORESOURCE_IRQ,
95 static struct platform_device ks8695_lan_device = {
96 .name = "ks8695_ether",
97 .id = 1,
98 .dev = {
99 .dma_mask = &eth_dmamask,
100 .coherent_dma_mask = 0xffffffff,
102 .resource = ks8695_lan_resources,
103 .num_resources = ARRAY_SIZE(ks8695_lan_resources),
107 static struct resource ks8695_hpna_resources[] = {
108 [0] = {
109 .start = KS8695_HPNA_VA,
110 .end = KS8695_HPNA_VA + 0x00ff,
111 .flags = IORESOURCE_MEM,
113 [1] = {
114 .name = "HPNA RX",
115 .start = KS8695_IRQ_HPNA_RX_STATUS,
116 .end = KS8695_IRQ_HPNA_RX_STATUS,
117 .flags = IORESOURCE_IRQ,
119 [2] = {
120 .name = "HPNA TX",
121 .start = KS8695_IRQ_HPNA_TX_STATUS,
122 .end = KS8695_IRQ_HPNA_TX_STATUS,
123 .flags = IORESOURCE_IRQ,
127 static struct platform_device ks8695_hpna_device = {
128 .name = "ks8695_ether",
129 .id = 2,
130 .dev = {
131 .dma_mask = &eth_dmamask,
132 .coherent_dma_mask = 0xffffffff,
134 .resource = ks8695_hpna_resources,
135 .num_resources = ARRAY_SIZE(ks8695_hpna_resources),
138 void __init ks8695_add_device_wan(void)
140 platform_device_register(&ks8695_wan_device);
143 void __init ks8695_add_device_lan(void)
145 platform_device_register(&ks8695_lan_device);
148 void __init ks8696_add_device_hpna(void)
150 platform_device_register(&ks8695_hpna_device);
152 #else
153 void __init ks8695_add_device_wan(void) {}
154 void __init ks8695_add_device_lan(void) {}
155 void __init ks8696_add_device_hpna(void) {}
156 #endif
159 /* --------------------------------------------------------------------
160 * Watchdog
161 * -------------------------------------------------------------------- */
163 #if defined(CONFIG_KS8695_WATCHDOG) || defined(CONFIG_KS8695_WATCHDOG_MODULE)
164 static struct platform_device ks8695_wdt_device = {
165 .name = "ks8695_wdt",
166 .id = -1,
167 .num_resources = 0,
170 static void __init ks8695_add_device_watchdog(void)
172 platform_device_register(&ks8695_wdt_device);
174 #else
175 static void __init ks8695_add_device_watchdog(void) {}
176 #endif
179 /* -------------------------------------------------------------------- */
182 * These devices are always present and don't need any board-specific
183 * setup.
185 static int __init ks8695_add_standard_devices(void)
187 ks8695_add_device_watchdog();
188 return 0;
191 arch_initcall(ks8695_add_standard_devices);