setup.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 <cpu/timer.h>
  26. /*
  27. * EraseConfig handling functions
  28. */
  29. static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
  30. {
  31. (void)ctrl_inb(0xb8000000); /* dummy read */
  32. printk("SnapGear: erase switch interrupt!\n");
  33. return IRQ_HANDLED;
  34. }
  35. static int __init eraseconfig_init(void)
  36. {
  37. printk("SnapGear: EraseConfig init\n");
  38. /* Setup "EraseConfig" switch on external IRQ 0 */
  39. if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED,
  40. "Erase Config", NULL))
  41. printk("SnapGear: failed to register IRQ%d for Reset witch\n",
  42. IRL0_IRQ);
  43. else
  44. printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
  45. IRL0_IRQ);
  46. return(0);
  47. }
  48. module_init(eraseconfig_init);
  49. /****************************************************************************/
  50. /*
  51. * Initialize IRQ setting
  52. *
  53. * IRL0 = erase switch
  54. * IRL1 = eth0
  55. * IRL2 = eth1
  56. * IRL3 = crypto
  57. */
  58. static void __init init_snapgear_IRQ(void)
  59. {
  60. printk("Setup SnapGear IRQ/IPR ...\n");
  61. /* enable individual interrupt mode for externals */
  62. plat_irq_setup_pins(IRQ_MODE_IRQ);
  63. }
  64. /*
  65. * The Machine Vector
  66. */
  67. static struct sh_machine_vector mv_snapgear __initmv = {
  68. .mv_name = "SnapGear SecureEdge5410",
  69. .mv_nr_irqs = 72,
  70. .mv_inb = snapgear_inb,
  71. .mv_inw = snapgear_inw,
  72. .mv_inl = snapgear_inl,
  73. .mv_outb = snapgear_outb,
  74. .mv_outw = snapgear_outw,
  75. .mv_outl = snapgear_outl,
  76. .mv_inb_p = snapgear_inb_p,
  77. .mv_inw_p = snapgear_inw,
  78. .mv_inl_p = snapgear_inl,
  79. .mv_outb_p = snapgear_outb_p,
  80. .mv_outw_p = snapgear_outw,
  81. .mv_outl_p = snapgear_outl,
  82. .mv_init_irq = init_snapgear_IRQ,
  83. };