2 * Copyright (C) 2006 Atmel Corporation
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #include <asm/arch/memory-map.h>
25 #include <asm/arch/platform.h>
29 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
31 const struct clock_domain chip_clock[] = {
33 .reg = SM_PM_CPU_MASK,
38 .reg = SM_PM_HSB_MASK,
43 .reg = SM_PM_PBA_MASK,
45 .bridge = DEVICE_PBA_BRIDGE,
48 .reg = SM_PM_PBB_MASK,
50 .bridge = DEVICE_PBB_BRIDGE,
54 static const struct resource hebi_resource[] = {
56 .type = RESOURCE_CLOCK,
58 .clock = { CLOCK_HSB, 0 },
61 .type = RESOURCE_CLOCK,
63 .clock = { CLOCK_PBB, 13 },
66 .type = RESOURCE_CLOCK,
68 .clock = { CLOCK_PBB, 14 },
71 .type = RESOURCE_GPIO,
73 .gpio = { 27, DEVICE_PIOE, GPIO_FUNC_A, 0 },
77 static const struct resource pba_bridge_resource[] = {
79 .type = RESOURCE_CLOCK,
81 .clock = { CLOCK_HSB, 1 },
84 .type = RESOURCE_CLOCK,
87 .clock = { CLOCK_HSB, 4 },
91 static const struct resource pbb_bridge_resource[] = {
93 .type = RESOURCE_CLOCK,
95 .clock = { CLOCK_HSB, 2 },
99 static const struct resource hramc_resource[] = {
101 .type = RESOURCE_CLOCK,
103 .clock = { CLOCK_HSB, 3 },
107 static const struct resource pioa_resource[] = {
109 .type = RESOURCE_CLOCK,
111 .clock = { CLOCK_PBA, 10 },
115 static const struct resource piob_resource[] = {
117 .type = RESOURCE_CLOCK,
119 .clock = { CLOCK_PBA, 11 },
123 static const struct resource pioc_resource[] = {
125 .type = RESOURCE_CLOCK,
127 .clock = { CLOCK_PBA, 12 },
131 static const struct resource piod_resource[] = {
133 .type = RESOURCE_CLOCK,
135 .clock = { CLOCK_PBA, 13 },
139 static const struct resource pioe_resource[] = {
141 .type = RESOURCE_CLOCK,
143 .clock = { CLOCK_PBA, 14 },
147 static const struct resource sm_resource[] = {
149 .type = RESOURCE_CLOCK,
151 .clock = { CLOCK_PBB, 0 },
155 static const struct resource intc_resource[] = {
157 .type = RESOURCE_CLOCK,
159 .clock = { CLOCK_PBB, 1 },
163 static const struct resource hmatrix_resource[] = {
165 .type = RESOURCE_CLOCK,
167 .clock = { CLOCK_PBB, 2 },
171 #if defined(CFG_HPDC)
172 static const struct resource hpdc_resource[] = {
174 .type = RESOURCE_CLOCK,
176 .clock = { CLOCK_PBA, 16 },
181 #if defined(CFG_MACB0)
182 static const struct resource macb0_resource[] = {
184 .type = RESOURCE_CLOCK,
186 .clock = { CLOCK_HSB, 8 },
189 .type = RESOURCE_CLOCK,
191 .clock = { CLOCK_PBB, 6 },
194 .type = RESOURCE_GPIO,
196 .gpio = { 19, DEVICE_PIOC, GPIO_FUNC_A, 0 },
201 #if defined(CFG_MACB1)
202 static const struct resource macb1_resource[] = {
204 .type = RESOURCE_CLOCK,
206 .clock = { CLOCK_HSB, 9 },
209 .type = RESOURCE_CLOCK,
211 .clock = { CLOCK_PBB, 7 },
214 .type = RESOURCE_GPIO,
216 .gpio = { 12, DEVICE_PIOC, GPIO_FUNC_B, 19 },
219 .type = RESOURCE_GPIO,
221 .gpio = { 14, DEVICE_PIOD, GPIO_FUNC_B, 2 },
226 #if defined(CFG_LCDC)
227 static const struct resource lcdc_resource[] = {
229 .type = RESOURCE_CLOCK,
231 .clock = { CLOCK_HSB, 7 },
236 #if defined(CFG_USART0)
237 static const struct resource usart0_resource[] = {
239 .type = RESOURCE_CLOCK,
241 .clock = { CLOCK_PBA, 3 },
244 .type = RESOURCE_GPIO,
246 .gpio = { 2, DEVICE_PIOA, GPIO_FUNC_B, 8 },
251 #if defined(CFG_USART1)
252 static const struct resource usart1_resource[] = {
254 .type = RESOURCE_CLOCK,
256 .clock = { CLOCK_PBA, 4 },
259 .type = RESOURCE_GPIO,
261 .gpio = { 2, DEVICE_PIOA, GPIO_FUNC_A, 17 },
266 #if defined(CFG_USART2)
267 static const struct resource usart2_resource[] = {
269 .type = RESOURCE_CLOCK,
271 .clock = { CLOCK_PBA, 5 },
274 .type = RESOURCE_GPIO,
276 .gpio = { 2, DEVICE_PIOB, GPIO_FUNC_B, 26 },
281 #if defined(CFG_USART3)
282 static const struct resource usart3_resource[] = {
284 .type = RESOURCE_CLOCK,
286 .clock = { CLOCK_PBA, 6 },
289 .type = RESOURCE_GPIO,
291 .gpio = { 2, DEVICE_PIOB, GPIO_FUNC_B, 17 },
296 #if defined(CFG_MMCI)
297 static const struct resource mmci_resource[] = {
299 .type = RESOURCE_CLOCK,
301 .clock = { CLOCK_PBB, 9 },
304 .type = RESOURCE_GPIO,
306 .gpio = { 6, DEVICE_PIOA, GPIO_FUNC_A, 10 },
311 #if defined(CFG_DMAC)
312 static const struct resource dmac_resource[] = {
314 .type = RESOURCE_CLOCK,
316 .clock = { CLOCK_HSB, 10 },
322 const struct device chip_device[] = {
324 .regs = (void *)HSMC_BASE,
325 .nr_resources = ARRAY_SIZE(hebi_resource),
326 .resource = hebi_resource,
328 [DEVICE_PBA_BRIDGE] = {
329 .nr_resources = ARRAY_SIZE(pba_bridge_resource),
330 .resource = pba_bridge_resource,
332 [DEVICE_PBB_BRIDGE] = {
333 .nr_resources = ARRAY_SIZE(pbb_bridge_resource),
334 .resource = pbb_bridge_resource,
337 .nr_resources = ARRAY_SIZE(hramc_resource),
338 .resource = hramc_resource,
341 .regs = (void *)PIOA_BASE,
342 .nr_resources = ARRAY_SIZE(pioa_resource),
343 .resource = pioa_resource,
346 .regs = (void *)PIOB_BASE,
347 .nr_resources = ARRAY_SIZE(piob_resource),
348 .resource = piob_resource,
351 .regs = (void *)PIOC_BASE,
352 .nr_resources = ARRAY_SIZE(pioc_resource),
353 .resource = pioc_resource,
356 .regs = (void *)PIOD_BASE,
357 .nr_resources = ARRAY_SIZE(piod_resource),
358 .resource = piod_resource,
361 .regs = (void *)PIOE_BASE,
362 .nr_resources = ARRAY_SIZE(pioe_resource),
363 .resource = pioe_resource,
366 .regs = (void *)SM_BASE,
367 .nr_resources = ARRAY_SIZE(sm_resource),
368 .resource = sm_resource,
371 .regs = (void *)INTC_BASE,
372 .nr_resources = ARRAY_SIZE(intc_resource),
373 .resource = intc_resource,
376 .regs = (void *)HMATRIX_BASE,
377 .nr_resources = ARRAY_SIZE(hmatrix_resource),
378 .resource = hmatrix_resource,
380 #if defined(CFG_HPDC)
382 .nr_resources = ARRAY_SIZE(hpdc_resource),
383 .resource = hpdc_resource,
386 #if defined(CFG_MACB0)
388 .regs = (void *)MACB0_BASE,
389 .nr_resources = ARRAY_SIZE(macb0_resource),
390 .resource = macb0_resource,
393 #if defined(CFG_MACB1)
395 .regs = (void *)MACB1_BASE,
396 .nr_resources = ARRAY_SIZE(macb1_resource),
397 .resource = macb1_resource,
400 #if defined(CFG_LCDC)
402 .nr_resources = ARRAY_SIZE(lcdc_resource),
403 .resource = lcdc_resource,
406 #if defined(CFG_USART0)
408 .regs = (void *)USART0_BASE,
409 .nr_resources = ARRAY_SIZE(usart0_resource),
410 .resource = usart0_resource,
413 #if defined(CFG_USART1)
415 .regs = (void *)USART1_BASE,
416 .nr_resources = ARRAY_SIZE(usart1_resource),
417 .resource = usart1_resource,
420 #if defined(CFG_USART2)
422 .regs = (void *)USART2_BASE,
423 .nr_resources = ARRAY_SIZE(usart2_resource),
424 .resource = usart2_resource,
427 #if defined(CFG_USART3)
429 .regs = (void *)USART3_BASE,
430 .nr_resources = ARRAY_SIZE(usart3_resource),
431 .resource = usart3_resource,
434 #if defined(CFG_MMCI)
436 .regs = (void *)MMCI_BASE,
437 .nr_resources = ARRAY_SIZE(mmci_resource),
438 .resource = mmci_resource,
441 #if defined(CFG_DMAC)
443 .regs = (void *)DMAC_BASE,
444 .nr_resources = ARRAY_SIZE(dmac_resource),
445 .resource = dmac_resource,