sdio_chip.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright (c) 2011 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 _BRCMFMAC_SDIO_CHIP_H_
  17. #define _BRCMFMAC_SDIO_CHIP_H_
  18. /*
  19. * Core reg address translation.
  20. * Both macro's returns a 32 bits byte address on the backplane bus.
  21. */
  22. #define CORE_CC_REG(base, field) \
  23. (base + offsetof(struct chipcregs, field))
  24. #define CORE_BUS_REG(base, field) \
  25. (base + offsetof(struct sdpcmd_regs, field))
  26. #define CORE_SB(base, field) \
  27. (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  28. /* SDIO function 1 register CHIPCLKCSR */
  29. /* Force ALP request to backplane */
  30. #define SBSDIO_FORCE_ALP 0x01
  31. /* Force HT request to backplane */
  32. #define SBSDIO_FORCE_HT 0x02
  33. /* Force ILP request to backplane */
  34. #define SBSDIO_FORCE_ILP 0x04
  35. /* Make ALP ready (power up xtal) */
  36. #define SBSDIO_ALP_AVAIL_REQ 0x08
  37. /* Make HT ready (power up PLL) */
  38. #define SBSDIO_HT_AVAIL_REQ 0x10
  39. /* Squelch clock requests from HW */
  40. #define SBSDIO_FORCE_HW_CLKREQ_OFF 0x20
  41. /* Status: ALP is ready */
  42. #define SBSDIO_ALP_AVAIL 0x40
  43. /* Status: HT is ready */
  44. #define SBSDIO_HT_AVAIL 0x80
  45. #define SBSDIO_AVBITS (SBSDIO_HT_AVAIL | SBSDIO_ALP_AVAIL)
  46. #define SBSDIO_ALPAV(regval) ((regval) & SBSDIO_AVBITS)
  47. #define SBSDIO_HTAV(regval) (((regval) & SBSDIO_AVBITS) == SBSDIO_AVBITS)
  48. #define SBSDIO_ALPONLY(regval) (SBSDIO_ALPAV(regval) && !SBSDIO_HTAV(regval))
  49. #define SBSDIO_CLKAV(regval, alponly) \
  50. (SBSDIO_ALPAV(regval) && (alponly ? 1 : SBSDIO_HTAV(regval)))
  51. /* sbimstate */
  52. #define SBIM_IBE 0x20000 /* inbanderror */
  53. #define SBIM_TO 0x40000 /* timeout */
  54. #define SBIM_BY 0x01800000 /* busy (sonics >= 2.3) */
  55. #define SBIM_RJ 0x02000000 /* reject (sonics >= 2.3) */
  56. /* sbtmstatelow */
  57. #define SBTML_RESET 0x0001 /* reset */
  58. #define SBTML_REJ_MASK 0x0006 /* reject field */
  59. #define SBTML_REJ 0x0002 /* reject */
  60. #define SBTML_TMPREJ 0x0004 /* temporary reject(error recovery) */
  61. /* Shift to locate the SI control flags in sbtml */
  62. #define SBTML_SICF_SHIFT 16
  63. /* sbtmstatehigh */
  64. #define SBTMH_SERR 0x0001 /* serror */
  65. #define SBTMH_INT 0x0002 /* interrupt */
  66. #define SBTMH_BUSY 0x0004 /* busy */
  67. #define SBTMH_TO 0x0020 /* timeout (sonics >= 2.3) */
  68. /* Shift to locate the SI status flags in sbtmh */
  69. #define SBTMH_SISF_SHIFT 16
  70. /* sbidlow */
  71. #define SBIDL_INIT 0x80 /* initiator */
  72. struct chip_info {
  73. u32 chip;
  74. u32 chiprev;
  75. u32 cccorebase;
  76. u32 ccrev;
  77. u32 cccaps;
  78. u32 buscorebase; /* 32 bits backplane bus address */
  79. u32 buscorerev;
  80. u32 buscoretype;
  81. u32 ramcorebase;
  82. u32 armcorebase;
  83. u32 pmurev;
  84. u32 pmucaps;
  85. u32 ramsize;
  86. };
  87. struct sbconfig {
  88. u32 PAD[2];
  89. u32 sbipsflag; /* initiator port ocp slave flag */
  90. u32 PAD[3];
  91. u32 sbtpsflag; /* target port ocp slave flag */
  92. u32 PAD[11];
  93. u32 sbtmerrloga; /* (sonics >= 2.3) */
  94. u32 PAD;
  95. u32 sbtmerrlog; /* (sonics >= 2.3) */
  96. u32 PAD[3];
  97. u32 sbadmatch3; /* address match3 */
  98. u32 PAD;
  99. u32 sbadmatch2; /* address match2 */
  100. u32 PAD;
  101. u32 sbadmatch1; /* address match1 */
  102. u32 PAD[7];
  103. u32 sbimstate; /* initiator agent state */
  104. u32 sbintvec; /* interrupt mask */
  105. u32 sbtmstatelow; /* target state */
  106. u32 sbtmstatehigh; /* target state */
  107. u32 sbbwa0; /* bandwidth allocation table0 */
  108. u32 PAD;
  109. u32 sbimconfiglow; /* initiator configuration */
  110. u32 sbimconfighigh; /* initiator configuration */
  111. u32 sbadmatch0; /* address match0 */
  112. u32 PAD;
  113. u32 sbtmconfiglow; /* target configuration */
  114. u32 sbtmconfighigh; /* target configuration */
  115. u32 sbbconfig; /* broadcast configuration */
  116. u32 PAD;
  117. u32 sbbstate; /* broadcast state */
  118. u32 PAD[3];
  119. u32 sbactcnfg; /* activate configuration */
  120. u32 PAD[3];
  121. u32 sbflagst; /* current sbflags */
  122. u32 PAD[3];
  123. u32 sbidlow; /* identification */
  124. u32 sbidhigh; /* identification */
  125. };
  126. extern void brcmf_sdio_chip_coredisable(struct brcmf_sdio_dev *sdiodev,
  127. u32 corebase);
  128. extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev,
  129. struct chip_info **ci_ptr, u32 regs);
  130. #endif /* _BRCMFMAC_SDIO_CHIP_H_ */