p54pci.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #ifndef P54PCI_H
  2. #define P54PCI_H
  3. /*
  4. * Defines for PCI based mac80211 Prism54 driver
  5. *
  6. * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
  7. *
  8. * Based on the islsm (softmac prism54) driver, which is:
  9. * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. /* Device Interrupt register bits */
  16. #define ISL38XX_DEV_INT_RESET 0x0001
  17. #define ISL38XX_DEV_INT_UPDATE 0x0002
  18. #define ISL38XX_DEV_INT_WAKEUP 0x0008
  19. #define ISL38XX_DEV_INT_SLEEP 0x0010
  20. #define ISL38XX_DEV_INT_ABORT 0x0020
  21. /* these two only used in USB */
  22. #define ISL38XX_DEV_INT_DATA 0x0040
  23. #define ISL38XX_DEV_INT_MGMT 0x0080
  24. #define ISL38XX_DEV_INT_PCIUART_CTS 0x4000
  25. #define ISL38XX_DEV_INT_PCIUART_DR 0x8000
  26. /* Interrupt Identification/Acknowledge/Enable register bits */
  27. #define ISL38XX_INT_IDENT_UPDATE 0x0002
  28. #define ISL38XX_INT_IDENT_INIT 0x0004
  29. #define ISL38XX_INT_IDENT_WAKEUP 0x0008
  30. #define ISL38XX_INT_IDENT_SLEEP 0x0010
  31. #define ISL38XX_INT_IDENT_PCIUART_CTS 0x4000
  32. #define ISL38XX_INT_IDENT_PCIUART_DR 0x8000
  33. /* Control/Status register bits */
  34. #define ISL38XX_CTRL_STAT_SLEEPMODE 0x00000200
  35. #define ISL38XX_CTRL_STAT_CLKRUN 0x00800000
  36. #define ISL38XX_CTRL_STAT_RESET 0x10000000
  37. #define ISL38XX_CTRL_STAT_RAMBOOT 0x20000000
  38. #define ISL38XX_CTRL_STAT_STARTHALTED 0x40000000
  39. #define ISL38XX_CTRL_STAT_HOST_OVERRIDE 0x80000000
  40. struct p54p_csr {
  41. __le32 dev_int;
  42. u8 unused_1[12];
  43. __le32 int_ident;
  44. __le32 int_ack;
  45. __le32 int_enable;
  46. u8 unused_2[4];
  47. union {
  48. __le32 ring_control_base;
  49. __le32 gen_purp_com[2];
  50. };
  51. u8 unused_3[8];
  52. __le32 direct_mem_base;
  53. u8 unused_4[44];
  54. __le32 dma_addr;
  55. __le32 dma_len;
  56. __le32 dma_ctrl;
  57. u8 unused_5[12];
  58. __le32 ctrl_stat;
  59. u8 unused_6[1924];
  60. u8 cardbus_cis[0x800];
  61. u8 direct_mem_win[0x1000];
  62. } __attribute__ ((packed));
  63. /* usb backend only needs the register defines above */
  64. #ifndef P54USB_H
  65. struct p54p_desc {
  66. __le32 host_addr;
  67. __le32 device_addr;
  68. __le16 len;
  69. __le16 flags;
  70. } __attribute__ ((packed));
  71. struct p54p_ring_control {
  72. __le32 host_idx[4];
  73. __le32 device_idx[4];
  74. struct p54p_desc rx_data[8];
  75. struct p54p_desc tx_data[32];
  76. struct p54p_desc rx_mgmt[4];
  77. struct p54p_desc tx_mgmt[4];
  78. } __attribute__ ((packed));
  79. #define P54P_READ(r) (__force __le32)__raw_readl(&priv->map->r)
  80. #define P54P_WRITE(r, val) __raw_writel((__force u32)(__le32)(val), &priv->map->r)
  81. struct p54p_priv {
  82. struct p54_common common;
  83. struct pci_dev *pdev;
  84. struct p54p_csr __iomem *map;
  85. struct tasklet_struct rx_tasklet;
  86. const struct firmware *firmware;
  87. spinlock_t lock;
  88. struct p54p_ring_control *ring_control;
  89. dma_addr_t ring_control_dma;
  90. u32 rx_idx_data, tx_idx_data;
  91. u32 rx_idx_mgmt, tx_idx_mgmt;
  92. struct sk_buff *rx_buf_data[8];
  93. struct sk_buff *rx_buf_mgmt[4];
  94. void *tx_buf_data[32];
  95. void *tx_buf_mgmt[4];
  96. struct completion boot_comp;
  97. };
  98. #endif /* P54USB_H */
  99. #endif /* P54PCI_H */