aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-ks8695/devices.c
blob: 386593f8ac65b8476bba078a666a55cb3f951be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
 * arch/arm/mach-ks8695/devices.c
 *
 * Copyright (C) 2006 Andrew Victor
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <asm/mach/arch.h>
#include <asm/mach/map.h>

#include <linux/platform_device.h>

#include <asm/arch/regs-wan.h>
#include <asm/arch/regs-lan.h>
#include <asm/arch/regs-hpna.h>


/* --------------------------------------------------------------------
 *  Ethernet
 * -------------------------------------------------------------------- */

#if defined(CONFIG_ARM_KS8695_ETHER) || defined(CONFIG_ARM_KS8695_ETHER_MODULE)
static u64 eth_dmamask = 0xffffffffUL;

static struct resource ks8695_wan_resources[] = {
	[0] = {
		.start	= KS8695_WAN_VA,
		.end	= KS8695_WAN_VA + 0x00ff,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.name	= "WAN RX",
		.start	= KS8695_IRQ_WAN_RX_STATUS,
		.end	= KS8695_IRQ_WAN_RX_STATUS,
		.flags	= IORESOURCE_IRQ,
	},
	[2] = {
		.name	= "WAN TX",
		.start	= KS8695_IRQ_WAN_TX_STATUS,
		.end	= KS8695_IRQ_WAN_TX_STATUS,
		.flags	= IORESOURCE_IRQ,
	},
	[3] = {
		.name	= "WAN Link",
		.start	= KS8695_IRQ_WAN_LINK,
		.end	= KS8695_IRQ_WAN_LINK,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device ks8695_wan_device = {
	.name		= "ks8695_ether",
	.id		= 0,
	.dev		= {
				.dma_mask		= &eth_dmamask,
				.coherent_dma_mask	= 0xffffffff,
	},
	.resource	= ks8695_wan_resources,
	.num_resources	= ARRAY_SIZE(ks8695_wan_resources),
};


static struct resource ks8695_lan_resources[] = {
	[0] = {
		.start	= KS8695_LAN_VA,
		.end	= KS8695_LAN_VA + 0x00ff,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.name	= "LAN RX",
		.start	= KS8695_IRQ_LAN_RX_STATUS,
		.end	= KS8695_IRQ_LAN_RX_STATUS,
		.flags	= IORESOURCE_IRQ,
	},
	[2] = {
		.name	= "LAN TX",
		.start	= KS8695_IRQ_LAN_TX_STATUS,
		.end	= KS8695_IRQ_LAN_TX_STATUS,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device ks8695_lan_device = {
	.name		= "ks8695_ether",
	.id		= 1,
	.dev		= {
				.dma_mask		= &eth_dmamask,
				.coherent_dma_mask	= 0xffffffff,
	},
	.resource	= ks8695_lan_resources,
	.num_resources	= ARRAY_SIZE(ks8695_lan_resources),
};


static struct resource ks8695_hpna_resources[] = {
	[0] = {
		.start	= KS8695_HPNA_VA,
		.end	= KS8695_HPNA_VA + 0x00ff,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.name	= "HPNA RX",
		.start	= KS8695_IRQ_HPNA_RX_STATUS,
		.end	= KS8695_IRQ_HPNA_RX_STATUS,
		.flags	= IORESOURCE_IRQ,
	},
	[2] = {
		.name	= "HPNA TX",
		.start	= KS8695_IRQ_HPNA_TX_STATUS,
		.end	= KS8695_IRQ_HPNA_TX_STATUS,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device ks8695_hpna_device = {
	.name		= "ks8695_ether",
	.id		= 2,
	.dev		= {
				.dma_mask		= &eth_dmamask,
				.coherent_dma_mask	= 0xffffffff,
	},
	.resource	= ks8695_hpna_resources,
	.num_resources	= ARRAY_SIZE(ks8695_hpna_resources),
};

void __init ks8695_add_device_wan(void)
{
	platform_device_register(&ks8695_wan_device);
}

void __init ks8695_add_device_lan(void)
{
	platform_device_register(&ks8695_lan_device);
}

void __init ks8696_add_device_hpna(void)
{
	platform_device_register(&ks8695_hpna_device);
}
#else
void __init ks8695_add_device_wan(void) {}
void __init ks8695_add_device_lan(void) {}
void __init ks8696_add_device_hpna(void) {}
#endif


/* --------------------------------------------------------------------
 *  Watchdog
 * -------------------------------------------------------------------- */

#if defined(CONFIG_KS8695_WATCHDOG) || defined(CONFIG_KS8695_WATCHDOG_MODULE)
static struct platform_device ks8695_wdt_device = {
	.name		= "ks8695_wdt",
	.id		= -1,
	.num_resources	= 0,
};

static void __init ks8695_add_device_watchdog(void)
{
	platform_device_register(&ks8695_wdt_device);
}
#else
static void __init ks8695_add_device_watchdog(void) {}
#endif


/* -------------------------------------------------------------------- */

/*
 * These devices are always present and don't need any board-specific
 * setup.
 */
static int __init ks8695_add_standard_devices(void)
{
	ks8695_add_device_watchdog();
	return 0;
}

arch_initcall(ks8695_add_standard_devices);