ioc3.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (c) 2005 Stanislaw Skowronek <skylark@linux-mips.org>
  7. */
  8. #ifndef _LINUX_IOC3_H
  9. #define _LINUX_IOC3_H
  10. #include <asm/sn/ioc3.h>
  11. #define IOC3_MAX_SUBMODULES 32
  12. #define IOC3_CLASS_NONE 0
  13. #define IOC3_CLASS_BASE_IP27 1
  14. #define IOC3_CLASS_BASE_IP30 2
  15. #define IOC3_CLASS_MENET_123 3
  16. #define IOC3_CLASS_MENET_4 4
  17. #define IOC3_CLASS_CADDUO 5
  18. #define IOC3_CLASS_SERIAL 6
  19. /* One of these per IOC3 */
  20. struct ioc3_driver_data {
  21. struct list_head list;
  22. int id; /* IOC3 sequence number */
  23. /* PCI mapping */
  24. unsigned long pma; /* physical address */
  25. struct ioc3 __iomem *vma; /* pointer to registers */
  26. struct pci_dev *pdev; /* PCI device */
  27. /* IRQ stuff */
  28. int dual_irq; /* set if separate IRQs are used */
  29. int irq_io, irq_eth; /* IRQ numbers */
  30. /* GPIO magic */
  31. spinlock_t gpio_lock;
  32. unsigned int gpdr_shadow;
  33. /* NIC identifiers */
  34. char nic_part[32];
  35. char nic_serial[16];
  36. char nic_mac[6];
  37. /* submodule set */
  38. int class;
  39. void *data[IOC3_MAX_SUBMODULES]; /* for submodule use */
  40. int active[IOC3_MAX_SUBMODULES]; /* set if probe succeeds */
  41. /* is_ir_lock must be held while
  42. * modifying sio_ie values, so
  43. * we can be sure that sio_ie is
  44. * not changing when we read it
  45. * along with sio_ir.
  46. */
  47. spinlock_t ir_lock; /* SIO_IE[SC] mod lock */
  48. };
  49. /* One per submodule */
  50. struct ioc3_submodule {
  51. char *name; /* descriptive submodule name */
  52. struct module *owner; /* owning kernel module */
  53. int ethernet; /* set for ethernet drivers */
  54. int (*probe) (struct ioc3_submodule *, struct ioc3_driver_data *);
  55. int (*remove) (struct ioc3_submodule *, struct ioc3_driver_data *);
  56. int id; /* assigned by IOC3, index for the "data" array */
  57. /* IRQ stuff */
  58. unsigned int irq_mask; /* IOC3 IRQ mask, leave clear for Ethernet */
  59. int reset_mask; /* non-zero if you want the ioc3.c module to reset interrupts */
  60. int (*intr) (struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
  61. /* private submodule data */
  62. void *data; /* assigned by submodule */
  63. };
  64. /**********************************
  65. * Functions needed by submodules *
  66. **********************************/
  67. #define IOC3_W_IES 0
  68. #define IOC3_W_IEC 1
  69. /* registers a submodule for all existing and future IOC3 chips */
  70. extern int ioc3_register_submodule(struct ioc3_submodule *);
  71. /* unregisters a submodule */
  72. extern void ioc3_unregister_submodule(struct ioc3_submodule *);
  73. /* enables IRQs indicated by irq_mask for a specified IOC3 chip */
  74. extern void ioc3_enable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
  75. /* ackowledges specified IRQs */
  76. extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
  77. /* disables IRQs indicated by irq_mask for a specified IOC3 chip */
  78. extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
  79. /* atomically sets GPCR bits */
  80. extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int);
  81. /* general ireg writer */
  82. extern void ioc3_write_ireg(struct ioc3_driver_data *idd, uint32_t value, int reg);
  83. #endif