chip.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (c) 2014 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 BRCMF_CHIP_H
  17. #define BRCMF_CHIP_H
  18. #include <linux/types.h>
  19. #define CORE_CC_REG(base, field) \
  20. (base + offsetof(struct chipcregs, field))
  21. /**
  22. * struct brcmf_chip - chip level information.
  23. *
  24. * @chip: chip identifier.
  25. * @chiprev: chip revision.
  26. * @cc_caps: chipcommon core capabilities.
  27. * @pmucaps: PMU capabilities.
  28. * @pmurev: PMU revision.
  29. * @rambase: RAM base address (only applicable for ARM CR4 chips).
  30. * @ramsize: amount of RAM on chip.
  31. * @name: string representation of the chip identifier.
  32. */
  33. struct brcmf_chip {
  34. u32 chip;
  35. u32 chiprev;
  36. u32 cc_caps;
  37. u32 pmucaps;
  38. u32 pmurev;
  39. u32 rambase;
  40. u32 ramsize;
  41. char name[8];
  42. };
  43. /**
  44. * struct brcmf_core - core related information.
  45. *
  46. * @id: core identifier.
  47. * @rev: core revision.
  48. * @base: base address of core register space.
  49. */
  50. struct brcmf_core {
  51. u16 id;
  52. u16 rev;
  53. u32 base;
  54. };
  55. /**
  56. * struct brcmf_buscore_ops - buscore specific callbacks.
  57. *
  58. * @read32: read 32-bit value over bus.
  59. * @write32: write 32-bit value over bus.
  60. * @prepare: prepare bus for core configuration.
  61. * @setup: bus-specific core setup.
  62. * @exit_dl: exit download state.
  63. * The callback should use the provided @rstvec when non-zero.
  64. */
  65. struct brcmf_buscore_ops {
  66. u32 (*read32)(void *ctx, u32 addr);
  67. void (*write32)(void *ctx, u32 addr, u32 value);
  68. int (*prepare)(void *ctx);
  69. int (*setup)(void *ctx, struct brcmf_chip *chip);
  70. void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  71. };
  72. struct brcmf_chip *brcmf_chip_attach(void *ctx,
  73. const struct brcmf_buscore_ops *ops);
  74. void brcmf_chip_detach(struct brcmf_chip *chip);
  75. struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  76. struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  77. bool brcmf_chip_iscoreup(struct brcmf_core *core);
  78. void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  79. void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  80. u32 postreset);
  81. void brcmf_chip_enter_download(struct brcmf_chip *ci);
  82. bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
  83. bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
  84. #endif /* BRCMF_AXIDMP_H */