nicpci.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2010 Broadcom Corporation
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _BRCM_NICPCI_H_
  17. #define _BRCM_NICPCI_H_
  18. #include "types.h"
  19. /* PCI configuration address space size */
  20. #define PCI_SZPCR 256
  21. /* Brcm PCI configuration registers */
  22. /* backplane address space accessed by BAR0 */
  23. #define PCI_BAR0_WIN 0x80
  24. /* sprom property control */
  25. #define PCI_SPROM_CONTROL 0x88
  26. /* mask of PCI and other cores interrupts */
  27. #define PCI_INT_MASK 0x94
  28. /* backplane core interrupt mask bits offset */
  29. #define PCI_SBIM_SHIFT 8
  30. /* backplane address space accessed by second 4KB of BAR0 */
  31. #define PCI_BAR0_WIN2 0xac
  32. /* pci config space gpio input (>=rev3) */
  33. #define PCI_GPIO_IN 0xb0
  34. /* pci config space gpio output (>=rev3) */
  35. #define PCI_GPIO_OUT 0xb4
  36. /* pci config space gpio output enable (>=rev3) */
  37. #define PCI_GPIO_OUTEN 0xb8
  38. /* bar0 + 4K accesses external sprom */
  39. #define PCI_BAR0_SPROM_OFFSET (4 * 1024)
  40. /* bar0 + 6K accesses pci core registers */
  41. #define PCI_BAR0_PCIREGS_OFFSET (6 * 1024)
  42. /*
  43. * pci core SB registers are at the end of the
  44. * 8KB window, so their address is the "regular"
  45. * address plus 4K
  46. */
  47. #define PCI_BAR0_PCISBR_OFFSET (4 * 1024)
  48. /* bar0 window size Match with corerev 13 */
  49. #define PCI_BAR0_WINSZ (16 * 1024)
  50. /* On pci corerev >= 13 and all pcie, the bar0 is now 16KB and it maps: */
  51. /* bar0 + 8K accesses pci/pcie core registers */
  52. #define PCI_16KB0_PCIREGS_OFFSET (8 * 1024)
  53. /* bar0 + 12K accesses chipc core registers */
  54. #define PCI_16KB0_CCREGS_OFFSET (12 * 1024)
  55. struct sbpciregs;
  56. struct sbpcieregs;
  57. extern struct pcicore_info *pcicore_init(struct si_pub *sih,
  58. struct bcma_device *core);
  59. extern void pcicore_deinit(struct pcicore_info *pch);
  60. extern void pcicore_attach(struct pcicore_info *pch, int state);
  61. extern void pcicore_hwup(struct pcicore_info *pch);
  62. extern void pcicore_up(struct pcicore_info *pch, int state);
  63. extern void pcicore_sleep(struct pcicore_info *pch);
  64. extern void pcicore_down(struct pcicore_info *pch, int state);
  65. extern u8 pcicore_find_pci_capability(struct pci_dev *dev, u8 req_cap_id,
  66. unsigned char *buf, u32 *buflen);
  67. extern void pcicore_fixcfg(struct pcicore_info *pch);
  68. extern void pcicore_pci_setup(struct pcicore_info *pch);
  69. #endif /* _BRCM_NICPCI_H_ */