Pratik Patel | bfd2de6 | 2013-01-26 12:14:59 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 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 | |
Pratik Patel | 6fb3834 | 2012-06-03 14:51:38 -0700 | [diff] [blame] | 13 | #ifndef _CORESIGHT_PRIV_H |
| 14 | #define _CORESIGHT_PRIV_H |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 15 | |
Pratik Patel | cf41862 | 2011-09-22 11:15:11 -0700 | [diff] [blame] | 16 | #include <linux/bitops.h> |
| 17 | |
Pratik Patel | 17f3b82 | 2011-11-21 12:41:47 -0800 | [diff] [blame] | 18 | /* Coresight management registers (0xF00-0xFCC) |
| 19 | * 0xFA0 - 0xFA4: Management registers in PFTv1.0 |
| 20 | * Trace registers in PFTv1.1 |
| 21 | */ |
Pratik Patel | 6fb3834 | 2012-06-03 14:51:38 -0700 | [diff] [blame] | 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) |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 30 | |
Pratik Patel | 6fb3834 | 2012-06-03 14:51:38 -0700 | [diff] [blame] | 31 | #define CORESIGHT_UNLOCK (0xC5ACCE55) |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 32 | |
Pratik Patel | 17f3b82 | 2011-11-21 12:41:47 -0800 | [diff] [blame] | 33 | #define TIMEOUT_US (100) |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 34 | |
| 35 | #define BM(lsb, msb) ((BIT(msb) - BIT(lsb)) + BIT(msb)) |
| 36 | #define BMVAL(val, lsb, msb) ((val & BM(lsb, msb)) >> lsb) |
| 37 | #define BVAL(val, n) ((val & BIT(n)) >> n) |
| 38 | |
Pratik Patel | 9266be3 | 2013-06-13 23:21:40 -0700 | [diff] [blame] | 39 | #ifdef CONFIG_CORESIGHT_FUSE |
| 40 | extern bool coresight_fuse_access_disabled(void); |
| 41 | extern bool coresight_fuse_apps_access_disabled(void); |
| 42 | #else |
| 43 | static inline bool coresight_fuse_access_disabled(void) { return false; } |
| 44 | static inline bool coresight_fuse_apps_access_disabled(void) { return false; } |
| 45 | #endif |
Pratik Patel | 61e9170 | 2013-01-27 20:30:42 -0800 | [diff] [blame] | 46 | #ifdef CONFIG_CORESIGHT_CSR |
Pratik Patel | b8bb403 | 2012-07-22 23:09:11 -0700 | [diff] [blame] | 47 | extern void msm_qdss_csr_enable_bam_to_usb(void); |
| 48 | extern void msm_qdss_csr_disable_bam_to_usb(void); |
Pratik Patel | bfd2de6 | 2013-01-26 12:14:59 -0800 | [diff] [blame] | 49 | extern void msm_qdss_csr_disable_flush(void); |
Pushkar Joshi | c791fb3 | 2013-07-22 15:19:42 -0700 | [diff] [blame] | 50 | extern int coresight_csr_hwctrl_set(uint64_t addr, uint32_t val); |
Pushkar Joshi | bf213a0 | 2013-05-03 13:18:44 -0700 | [diff] [blame] | 51 | extern void coresight_csr_set_byte_cntr(uint32_t); |
Pratik Patel | b8bb403 | 2012-07-22 23:09:11 -0700 | [diff] [blame] | 52 | #else |
| 53 | static inline void msm_qdss_csr_enable_bam_to_usb(void) {} |
| 54 | static inline void msm_qdss_csr_disable_bam_to_usb(void) {} |
Pratik Patel | bfd2de6 | 2013-01-26 12:14:59 -0800 | [diff] [blame] | 55 | static inline void msm_qdss_csr_disable_flush(void) {} |
Pushkar Joshi | c791fb3 | 2013-07-22 15:19:42 -0700 | [diff] [blame] | 56 | static inline int coresight_csr_hwctrl_set(uint64_t addr, |
Aparna Das | 3b8a708 | 2013-04-02 13:51:13 -0700 | [diff] [blame] | 57 | uint32_t val) { return -ENOSYS; } |
Pushkar Joshi | bf213a0 | 2013-05-03 13:18:44 -0700 | [diff] [blame] | 58 | static inline void coresight_csr_set_byte_cntr(uint32_t val) {} |
Pratik Patel | 61e9170 | 2013-01-27 20:30:42 -0800 | [diff] [blame] | 59 | #endif |
| 60 | #ifdef CONFIG_CORESIGHT_ETM |
| 61 | extern unsigned int etm_readl_cp14(uint32_t off); |
| 62 | extern void etm_writel_cp14(uint32_t val, uint32_t off); |
| 63 | #else |
Pratik Patel | e6e41da | 2012-09-12 12:50:29 -0700 | [diff] [blame] | 64 | static inline unsigned int etm_readl_cp14(uint32_t off) { return 0; } |
| 65 | static inline void etm_writel_cp14(uint32_t val, uint32_t off) {} |
Pratik Patel | b8bb403 | 2012-07-22 23:09:11 -0700 | [diff] [blame] | 66 | #endif |
| 67 | |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 68 | #endif |