aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9260.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91/at91sam9260.c')
-rw-r--r--arch/arm/mach-at91/at91sam9260.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 195208b30024..7d606b04d313 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -231,6 +231,28 @@ static struct clk *periph_clocks[] __initdata = {
231 // irq0 .. irq2 231 // irq0 .. irq2
232}; 232};
233 233
234static struct clk_lookup periph_clocks_lookups[] = {
235 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
236 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
237 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
238 CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
239 CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
240 CLKDEV_CON_DEV_ID("t3_clk", "atmel_tcb.1", &tc3_clk),
241 CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
242 CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
243 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
244};
245
246static struct clk_lookup usart_clocks_lookups[] = {
247 CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck),
248 CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk),
249 CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk),
250 CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk),
251 CLKDEV_CON_DEV_ID("usart", "atmel_usart.4", &usart3_clk),
252 CLKDEV_CON_DEV_ID("usart", "atmel_usart.5", &usart4_clk),
253 CLKDEV_CON_DEV_ID("usart", "atmel_usart.6", &usart5_clk),
254};
255
234/* 256/*
235 * The two programmable clocks. 257 * The two programmable clocks.
236 * You must configure pin multiplexing to bring these signals out. 258 * You must configure pin multiplexing to bring these signals out.
@@ -255,10 +277,27 @@ static void __init at91sam9260_register_clocks(void)
255 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) 277 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
256 clk_register(periph_clocks[i]); 278 clk_register(periph_clocks[i]);
257 279
280 clkdev_add_table(periph_clocks_lookups,
281 ARRAY_SIZE(periph_clocks_lookups));
282 clkdev_add_table(usart_clocks_lookups,
283 ARRAY_SIZE(usart_clocks_lookups));
284
258 clk_register(&pck0); 285 clk_register(&pck0);
259 clk_register(&pck1); 286 clk_register(&pck1);
260} 287}
261 288
289static struct clk_lookup console_clock_lookup;
290
291void __init at91sam9260_set_console_clock(int id)
292{
293 if (id >= ARRAY_SIZE(usart_clocks_lookups))
294 return;
295
296 console_clock_lookup.con_id = "usart";
297 console_clock_lookup.clk = usart_clocks_lookups[id].clk;
298 clkdev_add(&console_clock_lookup);
299}
300
262/* -------------------------------------------------------------------- 301/* --------------------------------------------------------------------
263 * GPIO 302 * GPIO
264 * -------------------------------------------------------------------- */ 303 * -------------------------------------------------------------------- */
@@ -289,7 +328,7 @@ static void at91sam9260_poweroff(void)
289 * AT91SAM9260 processor initialization 328 * AT91SAM9260 processor initialization
290 * -------------------------------------------------------------------- */ 329 * -------------------------------------------------------------------- */
291 330
292static void __init at91sam9xe_initialize(void) 331static void __init at91sam9xe_map_io(void)
293{ 332{
294 unsigned long cidr, sram_size; 333 unsigned long cidr, sram_size;
295 334
@@ -310,18 +349,21 @@ static void __init at91sam9xe_initialize(void)
310 iotable_init(at91sam9xe_sram_desc, ARRAY_SIZE(at91sam9xe_sram_desc)); 349 iotable_init(at91sam9xe_sram_desc, ARRAY_SIZE(at91sam9xe_sram_desc));
311} 350}
312 351
313void __init at91sam9260_initialize(unsigned long main_clock) 352void __init at91sam9260_map_io(void)
314{ 353{
315 /* Map peripherals */ 354 /* Map peripherals */
316 iotable_init(at91sam9260_io_desc, ARRAY_SIZE(at91sam9260_io_desc)); 355 iotable_init(at91sam9260_io_desc, ARRAY_SIZE(at91sam9260_io_desc));
317 356
318 if (cpu_is_at91sam9xe()) 357 if (cpu_is_at91sam9xe())
319 at91sam9xe_initialize(); 358 at91sam9xe_map_io();
320 else if (cpu_is_at91sam9g20()) 359 else if (cpu_is_at91sam9g20())
321 iotable_init(at91sam9g20_sram_desc, ARRAY_SIZE(at91sam9g20_sram_desc)); 360 iotable_init(at91sam9g20_sram_desc, ARRAY_SIZE(at91sam9g20_sram_desc));
322 else 361 else
323 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc)); 362 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc));
363}
324 364
365void __init at91sam9260_initialize(unsigned long main_clock)
366{
325 at91_arch_reset = at91sam9_alt_reset; 367 at91_arch_reset = at91sam9_alt_reset;
326 pm_power_off = at91sam9260_poweroff; 368 pm_power_off = at91sam9260_poweroff;
327 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1) 369 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)