at91x40.c 2.1 KB

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