blob: 47399bc3c024c1bdce49d19c08a59f41b982b0c8 [file] [log] [blame]
Andrew Victorc53c9cf2007-05-11 21:01:28 +01001/*
2 * arch/arm/mach-ks8695/devices.c
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
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.
9 *
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.
14 *
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
18 */
19
20#include <asm/mach/arch.h>
21#include <asm/mach/map.h>
22
Linus Walleij386ab642011-08-22 08:38:06 +010023#include <linux/gpio.h>
Andrew Victorc53c9cf2007-05-11 21:01:28 +010024#include <linux/platform_device.h>
25
Russell King80b02c12009-01-08 10:01:47 +000026#include <mach/irqs.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/regs-wan.h>
28#include <mach/regs-lan.h>
29#include <mach/regs-hpna.h>
Daniel Silverstonefbd62712008-12-13 20:44:11 +000030#include <mach/regs-switch.h>
31#include <mach/regs-misc.h>
Andrew Victorc53c9cf2007-05-11 21:01:28 +010032
33
34/* --------------------------------------------------------------------
35 * Ethernet
36 * -------------------------------------------------------------------- */
37
Andrew Victorc53c9cf2007-05-11 21:01:28 +010038static u64 eth_dmamask = 0xffffffffUL;
39
40static struct resource ks8695_wan_resources[] = {
41 [0] = {
Daniel Silverstonefbd62712008-12-13 20:44:11 +000042 .start = KS8695_WAN_PA,
43 .end = KS8695_WAN_PA + 0x00ff,
Andrew Victorc53c9cf2007-05-11 21:01:28 +010044 .flags = IORESOURCE_MEM,
45 },
46 [1] = {
47 .name = "WAN RX",
48 .start = KS8695_IRQ_WAN_RX_STATUS,
49 .end = KS8695_IRQ_WAN_RX_STATUS,
50 .flags = IORESOURCE_IRQ,
51 },
52 [2] = {
53 .name = "WAN TX",
54 .start = KS8695_IRQ_WAN_TX_STATUS,
55 .end = KS8695_IRQ_WAN_TX_STATUS,
56 .flags = IORESOURCE_IRQ,
57 },
58 [3] = {
59 .name = "WAN Link",
60 .start = KS8695_IRQ_WAN_LINK,
61 .end = KS8695_IRQ_WAN_LINK,
62 .flags = IORESOURCE_IRQ,
63 },
Daniel Silverstonefbd62712008-12-13 20:44:11 +000064 [4] = {
65 .name = "WAN PHY",
66 .start = KS8695_MISC_PA,
67 .end = KS8695_MISC_PA + 0x1f,
68 .flags = IORESOURCE_MEM,
69 },
Andrew Victorc53c9cf2007-05-11 21:01:28 +010070};
71
72static 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,
78 },
79 .resource = ks8695_wan_resources,
80 .num_resources = ARRAY_SIZE(ks8695_wan_resources),
81};
82
83
84static struct resource ks8695_lan_resources[] = {
85 [0] = {
Daniel Silverstonefbd62712008-12-13 20:44:11 +000086 .start = KS8695_LAN_PA,
87 .end = KS8695_LAN_PA + 0x00ff,
Andrew Victorc53c9cf2007-05-11 21:01:28 +010088 .flags = IORESOURCE_MEM,
89 },
90 [1] = {
91 .name = "LAN RX",
92 .start = KS8695_IRQ_LAN_RX_STATUS,
93 .end = KS8695_IRQ_LAN_RX_STATUS,
94 .flags = IORESOURCE_IRQ,
95 },
96 [2] = {
97 .name = "LAN TX",
98 .start = KS8695_IRQ_LAN_TX_STATUS,
99 .end = KS8695_IRQ_LAN_TX_STATUS,
100 .flags = IORESOURCE_IRQ,
101 },
Daniel Silverstonefbd62712008-12-13 20:44:11 +0000102 [3] = {
103 .name = "LAN SWITCH",
104 .start = KS8695_SWITCH_PA,
105 .end = KS8695_SWITCH_PA + 0x4f,
106 .flags = IORESOURCE_MEM,
107 },
Andrew Victorc53c9cf2007-05-11 21:01:28 +0100108};
109
110static 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,
116 },
117 .resource = ks8695_lan_resources,
118 .num_resources = ARRAY_SIZE(ks8695_lan_resources),
119};
120
121
122static struct resource ks8695_hpna_resources[] = {
123 [0] = {
Daniel Silverstonefbd62712008-12-13 20:44:11 +0000124 .start = KS8695_HPNA_PA,
125 .end = KS8695_HPNA_PA + 0x00ff,
Andrew Victorc53c9cf2007-05-11 21:01:28 +0100126 .flags = IORESOURCE_MEM,
127 },
128 [1] = {
129 .name = "HPNA RX",
130 .start = KS8695_IRQ_HPNA_RX_STATUS,
131 .end = KS8695_IRQ_HPNA_RX_STATUS,
132 .flags = IORESOURCE_IRQ,
133 },
134 [2] = {
135 .name = "HPNA TX",
136 .start = KS8695_IRQ_HPNA_TX_STATUS,
137 .end = KS8695_IRQ_HPNA_TX_STATUS,
138 .flags = IORESOURCE_IRQ,
139 },
140};
141
142static 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,
148 },
149 .resource = ks8695_hpna_resources,
150 .num_resources = ARRAY_SIZE(ks8695_hpna_resources),
151};
152
153void __init ks8695_add_device_wan(void)
154{
155 platform_device_register(&ks8695_wan_device);
156}
157
158void __init ks8695_add_device_lan(void)
159{
160 platform_device_register(&ks8695_lan_device);
161}
162
163void __init ks8696_add_device_hpna(void)
164{
165 platform_device_register(&ks8695_hpna_device);
166}
Andrew Victorc53c9cf2007-05-11 21:01:28 +0100167
168
169/* --------------------------------------------------------------------
170 * Watchdog
171 * -------------------------------------------------------------------- */
172
Andrew Victorc53c9cf2007-05-11 21:01:28 +0100173static struct platform_device ks8695_wdt_device = {
174 .name = "ks8695_wdt",
175 .id = -1,
176 .num_resources = 0,
177};
178
179static void __init ks8695_add_device_watchdog(void)
180{
181 platform_device_register(&ks8695_wdt_device);
182}
Andrew Victorc53c9cf2007-05-11 21:01:28 +0100183
184
Andrew Victorc53c9cf2007-05-11 21:01:28 +0100185/* -------------------------------------------------------------------- */
186
187/*
188 * These devices are always present and don't need any board-specific
189 * setup.
190 */
191static int __init ks8695_add_standard_devices(void)
192{
193 ks8695_add_device_watchdog();
194 return 0;
195}
196
197arch_initcall(ks8695_add_standard_devices);