setup.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * linux/arch/sh/boards/snapgear/setup.c
  3. *
  4. * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
  5. * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
  6. *
  7. * Based on files with the following comments:
  8. *
  9. * Copyright (C) 2000 Kazumoto Kojima
  10. *
  11. * Modified for 7751 Solution Engine by
  12. * Ian da Silva and Jeremy Siegel, 2001.
  13. */
  14. #include <linux/init.h>
  15. #include <linux/irq.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/timer.h>
  18. #include <linux/delay.h>
  19. #include <linux/module.h>
  20. #include <linux/sched.h>
  21. #include <asm/machvec.h>
  22. #include <asm/snapgear.h>
  23. #include <asm/irq.h>
  24. #include <asm/io.h>
  25. #include <asm/rtc.h>
  26. #include <asm/cpu/timer.h>
  27. extern void secureedge5410_rtc_init(void);
  28. extern void pcibios_init(void);
  29. /****************************************************************************/
  30. /*
  31. * EraseConfig handling functions
  32. */
  33. static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
  34. {
  35. volatile char dummy __attribute__((unused)) = * (volatile char *) 0xb8000000;
  36. printk("SnapGear: erase switch interrupt!\n");
  37. return IRQ_HANDLED;
  38. }
  39. static int __init eraseconfig_init(void)
  40. {
  41. printk("SnapGear: EraseConfig init\n");
  42. /* Setup "EraseConfig" switch on external IRQ 0 */
  43. if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED,
  44. "Erase Config", NULL))
  45. printk("SnapGear: failed to register IRQ%d for Reset witch\n",
  46. IRL0_IRQ);
  47. else
  48. printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
  49. IRL0_IRQ);
  50. return(0);
  51. }
  52. module_init(eraseconfig_init);
  53. /****************************************************************************/
  54. /*
  55. * Initialize IRQ setting
  56. *
  57. * IRL0 = erase switch
  58. * IRL1 = eth0
  59. * IRL2 = eth1
  60. * IRL3 = crypto
  61. */
  62. static void __init init_snapgear_IRQ(void)
  63. {
  64. /* enable individual interrupt mode for externals */
  65. ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
  66. printk("Setup SnapGear IRQ/IPR ...\n");
  67. make_ipr_irq(IRL0_IRQ, IRL0_IPR_ADDR, IRL0_IPR_POS, IRL0_PRIORITY);
  68. make_ipr_irq(IRL1_IRQ, IRL1_IPR_ADDR, IRL1_IPR_POS, IRL1_PRIORITY);
  69. make_ipr_irq(IRL2_IRQ, IRL2_IPR_ADDR, IRL2_IPR_POS, IRL2_PRIORITY);
  70. make_ipr_irq(IRL3_IRQ, IRL3_IPR_ADDR, IRL3_IPR_POS, IRL3_PRIORITY);
  71. }
  72. /*
  73. * Initialize the board
  74. */
  75. static void __init snapgear_setup(char **cmdline_p)
  76. {
  77. board_time_init = secureedge5410_rtc_init;
  78. }
  79. /*
  80. * The Machine Vector
  81. */
  82. struct sh_machine_vector mv_snapgear __initmv = {
  83. .mv_name = "SnapGear SecureEdge5410",
  84. .mv_setup = snapgear_setup,
  85. .mv_nr_irqs = 72,
  86. .mv_inb = snapgear_inb,
  87. .mv_inw = snapgear_inw,
  88. .mv_inl = snapgear_inl,
  89. .mv_outb = snapgear_outb,
  90. .mv_outw = snapgear_outw,
  91. .mv_outl = snapgear_outl,
  92. .mv_inb_p = snapgear_inb_p,
  93. .mv_inw_p = snapgear_inw,
  94. .mv_inl_p = snapgear_inl,
  95. .mv_outb_p = snapgear_outb_p,
  96. .mv_outw_p = snapgear_outw,
  97. .mv_outl_p = snapgear_outl,
  98. .mv_init_irq = init_snapgear_IRQ,
  99. };
  100. ALIAS_MV(snapgear)