blob: 0154b7f44ff199a72483c70a94dcffe11bfb60cf [file] [log] [blame]
Greg Ungerereb1d65a2007-07-30 02:38:57 +01001/*
2 * arch/arm/mach-at91/at91x40.c
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com>
5 * Copyright (C) 2005 SAN People
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/irq.h>
Nicolas Pitrec9dfafb2011-08-02 10:21:36 -040016#include <asm/proc-fns.h>
Greg Ungerereb1d65a2007-07-30 02:38:57 +010017#include <asm/mach/arch.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010018#include <mach/at91x40.h>
19#include <mach/at91_st.h>
20#include <mach/timex.h>
Greg Ungerereb1d65a2007-07-30 02:38:57 +010021#include "generic.h"
22
23/*
Greg Ungerer66aaeff2008-05-23 08:26:24 +010024 * Export the clock functions for the AT91X40. Some external code common
25 * to all AT91 family parts relys on this, like the gpio and serial support.
Greg Ungerereb1d65a2007-07-30 02:38:57 +010026 */
27int clk_enable(struct clk *clk)
28{
29 return 0;
30}
31
Greg Ungerer66aaeff2008-05-23 08:26:24 +010032void clk_disable(struct clk *clk)
33{
34}
35
36unsigned long clk_get_rate(struct clk *clk)
37{
38 return AT91X40_MASTER_CLOCK;
39}
40
Nicolas Pitrec9dfafb2011-08-02 10:21:36 -040041static void at91x40_idle(void)
42{
43 /*
44 * Disable the processor clock. The processor will be automatically
45 * re-enabled by an interrupt or by a reset.
46 */
47 at91_sys_write(AT91_PS_CR, AT91_PS_CR_CPU);
48 cpu_do_idle();
49}
50
Greg Ungerereb1d65a2007-07-30 02:38:57 +010051void __init at91x40_initialize(unsigned long main_clock)
52{
Nicolas Pitrec9dfafb2011-08-02 10:21:36 -040053 arm_pm_idle = at91x40_idle;
Greg Ungerereb1d65a2007-07-30 02:38:57 +010054 at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
55 | (1 << AT91X40_ID_IRQ2);
56}
57
58/*
59 * The default interrupt priority levels (0 = lowest, 7 = highest).
60 */
61static unsigned int at91x40_default_irq_priority[NR_AIC_IRQS] __initdata = {
62 7, /* Advanced Interrupt Controller (FIQ) */
63 0, /* System Peripherals */
64 0, /* USART 0 */
65 0, /* USART 1 */
66 2, /* Timer Counter 0 */
67 2, /* Timer Counter 1 */
68 2, /* Timer Counter 2 */
69 0, /* Watchdog timer */
70 0, /* Parallel IO Controller A */
71 0, /* Reserved */
72 0, /* Reserved */
73 0, /* Reserved */
74 0, /* Reserved */
75 0, /* Reserved */
76 0, /* Reserved */
77 0, /* Reserved */
78 0, /* External IRQ0 */
79 0, /* External IRQ1 */
80 0, /* External IRQ2 */
81};
82
83void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS])
84{
85 if (!priority)
86 priority = at91x40_default_irq_priority;
87
88 at91_aic_init(priority);
89}
90