spi-topcliff-pch: supports a spi mode setup and bit order setup by IO control
[zen-stable.git] / arch / arm / mach-ks8695 / devices.c
blob73bd63812878548fcd1e7526ff3c5c22592a2664
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/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 /* --------------------------------------------------------------------
35 * Ethernet
36 * -------------------------------------------------------------------- */
38 static u64 eth_dmamask = 0xffffffffUL;
40 static struct resource ks8695_wan_resources[] = {
41 [0] = {
42 .start = KS8695_WAN_PA,
43 .end = KS8695_WAN_PA + 0x00ff,
44 .flags = IORESOURCE_MEM,
46 [1] = {
47 .name = "WAN RX",
48 .start = KS8695_IRQ_WAN_RX_STATUS,
49 .end = KS8695_IRQ_WAN_RX_STATUS,
50 .flags = IORESOURCE_IRQ,
52 [2] = {
53 .name = "WAN TX",
54 .start = KS8695_IRQ_WAN_TX_STATUS,
55 .end = KS8695_IRQ_WAN_TX_STATUS,
56 .flags = IORESOURCE_IRQ,
58 [3] = {
59 .name = "WAN Link",
60 .start = KS8695_IRQ_WAN_LINK,
61 .end = KS8695_IRQ_WAN_LINK,
62 .flags = IORESOURCE_IRQ,
64 [4] = {
65 .name = "WAN PHY",
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",
74 .id = 0,
75 .dev = {
76 .dma_mask = &eth_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[] = {
85 [0] = {
86 .start = KS8695_LAN_PA,
87 .end = KS8695_LAN_PA + 0x00ff,
88 .flags = IORESOURCE_MEM,
90 [1] = {
91 .name = "LAN RX",
92 .start = KS8695_IRQ_LAN_RX_STATUS,
93 .end = KS8695_IRQ_LAN_RX_STATUS,
94 .flags = IORESOURCE_IRQ,
96 [2] = {
97 .name = "LAN TX",
98 .start = KS8695_IRQ_LAN_TX_STATUS,
99 .end = KS8695_IRQ_LAN_TX_STATUS,
100 .flags = IORESOURCE_IRQ,
102 [3] = {
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",
112 .id = 1,
113 .dev = {
114 .dma_mask = &eth_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[] = {
123 [0] = {
124 .start = KS8695_HPNA_PA,
125 .end = KS8695_HPNA_PA + 0x00ff,
126 .flags = IORESOURCE_MEM,
128 [1] = {
129 .name = "HPNA RX",
130 .start = KS8695_IRQ_HPNA_RX_STATUS,
131 .end = KS8695_IRQ_HPNA_RX_STATUS,
132 .flags = IORESOURCE_IRQ,
134 [2] = {
135 .name = "HPNA TX",
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",
144 .id = 2,
145 .dev = {
146 .dma_mask = &eth_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 /* --------------------------------------------------------------------
170 * Watchdog
171 * -------------------------------------------------------------------- */
173 static struct platform_device ks8695_wdt_device = {
174 .name = "ks8695_wdt",
175 .id = -1,
176 .num_resources = 0,
179 static void __init ks8695_add_device_watchdog(void)
181 platform_device_register(&ks8695_wdt_device);
185 /* --------------------------------------------------------------------
186 * LEDs
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;
202 #else
203 void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {}
204 #endif
206 /* -------------------------------------------------------------------- */
209 * These devices are always present and don't need any board-specific
210 * setup.
212 static int __init ks8695_add_standard_devices(void)
214 ks8695_add_device_watchdog();
215 return 0;
218 arch_initcall(ks8695_add_standard_devices);