at91x40.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  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. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/irq.h>
  15. #include <asm/proc-fns.h>
  16. #include <asm/system_misc.h>
  17. #include <asm/mach/arch.h>
  18. #include <mach/at91x40.h>
  19. #include <mach/at91_st.h>
  20. #include <mach/timex.h>
  21. #include "generic.h"
  22. /*
  23. * Export the clock functions for the AT91X40. Some external code common
  24. * to all AT91 family parts relys on this, like the gpio and serial support.
  25. */
  26. int clk_enable(struct clk *clk)
  27. {
  28. return 0;
  29. }
  30. void clk_disable(struct clk *clk)
  31. {
  32. }
  33. unsigned long clk_get_rate(struct clk *clk)
  34. {
  35. return AT91X40_MASTER_CLOCK;
  36. }
  37. static void at91x40_idle(void)
  38. {
  39. /*
  40. * Disable the processor clock. The processor will be automatically
  41. * re-enabled by an interrupt or by a reset.
  42. */
  43. __raw_writel(AT91_PS_CR_CPU, AT91_PS_CR);
  44. cpu_do_idle();
  45. }
  46. void __init at91x40_initialize(unsigned long main_clock)
  47. {
  48. arm_pm_idle = at91x40_idle;
  49. at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
  50. | (1 << AT91X40_ID_IRQ2);
  51. }
  52. /*
  53. * The default interrupt priority levels (0 = lowest, 7 = highest).
  54. */
  55. static unsigned int at91x40_default_irq_priority[NR_AIC_IRQS] __initdata = {
  56. 7, /* Advanced Interrupt Controller (FIQ) */
  57. 0, /* System Peripherals */
  58. 0, /* USART 0 */
  59. 0, /* USART 1 */
  60. 2, /* Timer Counter 0 */
  61. 2, /* Timer Counter 1 */
  62. 2, /* Timer Counter 2 */
  63. 0, /* Watchdog timer */
  64. 0, /* Parallel IO Controller A */
  65. 0, /* Reserved */
  66. 0, /* Reserved */
  67. 0, /* Reserved */
  68. 0, /* Reserved */
  69. 0, /* Reserved */
  70. 0, /* Reserved */
  71. 0, /* Reserved */
  72. 0, /* External IRQ0 */
  73. 0, /* External IRQ1 */
  74. 0, /* External IRQ2 */
  75. };
  76. void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS])
  77. {
  78. if (!priority)
  79. priority = at91x40_default_irq_priority;
  80. at91_aic_init(priority);
  81. }