coresight-priv.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _CORESIGHT_PRIV_H
  13. #define _CORESIGHT_PRIV_H
  14. #include <linux/bitops.h>
  15. #include <linux/io.h>
  16. #include <linux/coresight.h>
  17. /*
  18. * Coresight management registers (0xf00-0xfcc)
  19. * 0xfa0 - 0xfa4: Management registers in PFTv1.0
  20. * Trace registers in PFTv1.1
  21. */
  22. #define CORESIGHT_ITCTRL 0xf00
  23. #define CORESIGHT_CLAIMSET 0xfa0
  24. #define CORESIGHT_CLAIMCLR 0xfa4
  25. #define CORESIGHT_LAR 0xfb0
  26. #define CORESIGHT_LSR 0xfb4
  27. #define CORESIGHT_AUTHSTATUS 0xfb8
  28. #define CORESIGHT_DEVID 0xfc8
  29. #define CORESIGHT_DEVTYPE 0xfcc
  30. #define TIMEOUT_US 100
  31. #define BMVAL(val, lsb, msb) ((val & GENMASK(msb, lsb)) >> lsb)
  32. static inline void CS_LOCK(void __iomem *addr)
  33. {
  34. do {
  35. /* Wait for things to settle */
  36. mb();
  37. writel_relaxed(0x0, addr + CORESIGHT_LAR);
  38. } while (0);
  39. }
  40. static inline void CS_UNLOCK(void __iomem *addr)
  41. {
  42. do {
  43. writel_relaxed(CORESIGHT_UNLOCK, addr + CORESIGHT_LAR);
  44. /* Make sure everyone has seen this */
  45. mb();
  46. } while (0);
  47. }
  48. #ifdef CONFIG_CORESIGHT_SOURCE_ETM3X
  49. extern int etm_readl_cp14(u32 off, unsigned int *val);
  50. extern int etm_writel_cp14(u32 off, u32 val);
  51. #else
  52. static inline int etm_readl_cp14(u32 off, unsigned int *val) { return 0; }
  53. static inline int etm_writel_cp14(u32 off, u32 val) { return 0; }
  54. #endif
  55. #endif