unit-init.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* ASB2364 initialisation
  2. *
  3. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/param.h>
  13. #include <linux/init.h>
  14. #include <linux/device.h>
  15. #include <linux/delay.h>
  16. #include <asm/io.h>
  17. #include <asm/setup.h>
  18. #include <asm/processor.h>
  19. #include <asm/irq.h>
  20. #include <asm/intctl-regs.h>
  21. #include <unit/fpga-regs.h>
  22. /*
  23. * initialise some of the unit hardware before gdbstub is set up
  24. */
  25. asmlinkage void __init unit_init(void)
  26. {
  27. /* set up the external interrupts */
  28. /* XIRQ[0]: NAND RXBY */
  29. /* SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_LOWLEVEL); */
  30. /* XIRQ[1]: LAN, UART, I2C, USB, PCI, FPGA */
  31. SET_XIRQ_TRIGGER(1, XIRQ_TRIGGER_LOWLEVEL);
  32. /* XIRQ[2]: Extend Slot 1-9 */
  33. /* SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); */
  34. #if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL) && \
  35. defined(CONFIG_ETHERNET_IRQ_LEVEL) && \
  36. (CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL)
  37. # error CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL
  38. #endif
  39. #if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL)
  40. set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL));
  41. #elif defined(CONFIG_ETHERNET_IRQ_LEVEL)
  42. set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_ETHERNET_IRQ_LEVEL));
  43. #endif
  44. }
  45. /*
  46. * initialise the rest of the unit hardware after gdbstub is ready
  47. */
  48. asmlinkage void __init unit_setup(void)
  49. {
  50. }
  51. /*
  52. * initialise the external interrupts used by a unit of this type
  53. */
  54. void __init unit_init_IRQ(void)
  55. {
  56. unsigned int extnum;
  57. for (extnum = 0 ; extnum < NR_XIRQS ; extnum++) {
  58. switch (GET_XIRQ_TRIGGER(extnum)) {
  59. /* LEVEL triggered interrupts should be made
  60. * post-ACK'able as they hold their lines until
  61. * serviced
  62. */
  63. case XIRQ_TRIGGER_HILEVEL:
  64. case XIRQ_TRIGGER_LOWLEVEL:
  65. mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum));
  66. break;
  67. default:
  68. break;
  69. }
  70. }
  71. #define IRQCTL __SYSREG(0xd5000090, u32)
  72. IRQCTL |= 0x02;
  73. irq_fpga_init();
  74. }