Pratik Patel | 17f3b82 | 2011-11-21 12:41:47 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. 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 | |
| 13 | #ifndef _ARCH_ARM_MACH_MSM_QDSS_H_ |
| 14 | #define _ARCH_ARM_MACH_MSM_QDSS_H_ |
| 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 | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 22 | #define CS_ITCTRL (0xF00) |
| 23 | #define CS_CLAIMSET (0xFA0) |
| 24 | #define CS_CLAIMCLR (0xFA4) |
| 25 | #define CS_LAR (0xFB0) |
| 26 | #define CS_LSR (0xFB4) |
| 27 | #define CS_AUTHSTATUS (0xFB8) |
| 28 | #define CS_DEVID (0xFC8) |
| 29 | #define CS_DEVTYPE (0xFCC) |
| 30 | /* Peripheral id registers (0xFD0-0xFEC) */ |
| 31 | #define CS_PIDR4 (0xFD0) |
| 32 | #define CS_PIDR5 (0xFD4) |
| 33 | #define CS_PIDR6 (0xFD8) |
| 34 | #define CS_PIDR7 (0xFDC) |
| 35 | #define CS_PIDR0 (0xFE0) |
| 36 | #define CS_PIDR1 (0xFE4) |
| 37 | #define CS_PIDR2 (0xFE8) |
| 38 | #define CS_PIDR3 (0xFEC) |
| 39 | /* Component id registers (0xFF0-0xFFC) */ |
| 40 | #define CS_CIDR0 (0xFF0) |
| 41 | #define CS_CIDR1 (0xFF4) |
| 42 | #define CS_CIDR2 (0xFF8) |
| 43 | #define CS_CIDR3 (0xFFC) |
| 44 | |
Pratik Patel | 17f3b82 | 2011-11-21 12:41:47 -0800 | [diff] [blame] | 45 | /* DBGv7 with baseline CP14 registers implemented */ |
| 46 | #define ARM_DEBUG_ARCH_V7B (0x3) |
| 47 | /* DBGv7 with all CP14 registers implemented */ |
| 48 | #define ARM_DEBUG_ARCH_V7 (0x4) |
| 49 | #define ARM_DEBUG_ARCH_V7_1 (0x5) |
| 50 | #define ETM_ARCH_V3_3 (0x23) |
| 51 | #define PFT_ARCH_V1_1 (0x31) |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 52 | |
Pratik Patel | 17f3b82 | 2011-11-21 12:41:47 -0800 | [diff] [blame] | 53 | #define TIMEOUT_US (100) |
| 54 | #define OSLOCK_MAGIC (0xC5ACCE55) |
| 55 | #define CS_UNLOCK_MAGIC (0xC5ACCE55) |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 56 | |
| 57 | #define BM(lsb, msb) ((BIT(msb) - BIT(lsb)) + BIT(msb)) |
| 58 | #define BMVAL(val, lsb, msb) ((val & BM(lsb, msb)) >> lsb) |
| 59 | #define BVAL(val, n) ((val & BIT(n)) >> n) |
| 60 | |
Pratik Patel | 59e2994 | 2011-12-27 10:31:33 -0800 | [diff] [blame] | 61 | int etb_init(void); |
| 62 | void etb_exit(void); |
| 63 | int tpiu_init(void); |
| 64 | void tpiu_exit(void); |
| 65 | int funnel_init(void); |
| 66 | void funnel_exit(void); |
| 67 | int ptm_init(void); |
| 68 | void ptm_exit(void); |
| 69 | |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 70 | void etb_enable(void); |
| 71 | void etb_disable(void); |
| 72 | void etb_dump(void); |
| 73 | void tpiu_disable(void); |
| 74 | void funnel_enable(uint8_t id, uint32_t port_mask); |
| 75 | void funnel_disable(uint8_t id, uint32_t port_mask); |
Pratik Patel | 7492943 | 2011-12-26 12:03:41 -0800 | [diff] [blame] | 76 | int qdss_clk_enable(void); |
| 77 | void qdss_clk_disable(void); |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 78 | |
Pratik Patel | 17f3b82 | 2011-11-21 12:41:47 -0800 | [diff] [blame] | 79 | #ifdef CONFIG_MSM_JTAG |
| 80 | extern void msm_jtag_save_state(void); |
| 81 | extern void msm_jtag_restore_state(void); |
Pratik Patel | fd6f56a | 2011-10-10 17:47:55 -0700 | [diff] [blame] | 82 | #else |
Pratik Patel | 17f3b82 | 2011-11-21 12:41:47 -0800 | [diff] [blame] | 83 | static inline void msm_jtag_save_state(void) {} |
| 84 | static inline void msm_jtag_restore_state(void) {} |
Pratik Patel | e577179 | 2011-09-17 18:33:54 -0700 | [diff] [blame] | 85 | #endif |
| 86 | |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 87 | #endif |