blob: f208185cf1c84d36af150645189f3da985338382 [file] [log] [blame]
Pratik Patelbfd2de62013-01-26 12:14:59 -08001/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Pratik Patel7831c082011-06-08 21:44:37 -07002 *
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 Patel6fb38342012-06-03 14:51:38 -070013#ifndef _CORESIGHT_PRIV_H
14#define _CORESIGHT_PRIV_H
Pratik Patel7831c082011-06-08 21:44:37 -070015
Pratik Patelcf418622011-09-22 11:15:11 -070016#include <linux/bitops.h>
17
Pratik Patel17f3b822011-11-21 12:41:47 -080018/* Coresight management registers (0xF00-0xFCC)
19 * 0xFA0 - 0xFA4: Management registers in PFTv1.0
20 * Trace registers in PFTv1.1
21 */
Pratik Patel6fb38342012-06-03 14:51:38 -070022#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 Patel7831c082011-06-08 21:44:37 -070030
Pratik Patel6fb38342012-06-03 14:51:38 -070031#define CORESIGHT_UNLOCK (0xC5ACCE55)
Pratik Patel7831c082011-06-08 21:44:37 -070032
Pratik Patel17f3b822011-11-21 12:41:47 -080033#define TIMEOUT_US (100)
Pratik Patel7831c082011-06-08 21:44:37 -070034
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 Patel61e91702013-01-27 20:30:42 -080039#ifdef CONFIG_CORESIGHT_CSR
Pratik Patelb8bb4032012-07-22 23:09:11 -070040extern void msm_qdss_csr_enable_bam_to_usb(void);
41extern void msm_qdss_csr_disable_bam_to_usb(void);
Pratik Patelbfd2de62013-01-26 12:14:59 -080042extern void msm_qdss_csr_disable_flush(void);
Aparna Das3b8a7082013-04-02 13:51:13 -070043extern int coresight_csr_hwctrl_set(phys_addr_t addr, uint32_t val);
Pratik Patelb8bb4032012-07-22 23:09:11 -070044#else
45static inline void msm_qdss_csr_enable_bam_to_usb(void) {}
46static inline void msm_qdss_csr_disable_bam_to_usb(void) {}
Pratik Patelbfd2de62013-01-26 12:14:59 -080047static inline void msm_qdss_csr_disable_flush(void) {}
Aparna Das3b8a7082013-04-02 13:51:13 -070048static inline int coresight_csr_hwctrl_set(phys_addr_t addr,
49 uint32_t val) { return -ENOSYS; }
Pratik Patel61e91702013-01-27 20:30:42 -080050#endif
51#ifdef CONFIG_CORESIGHT_ETM
52extern unsigned int etm_readl_cp14(uint32_t off);
53extern void etm_writel_cp14(uint32_t val, uint32_t off);
54#else
Pratik Patele6e41da2012-09-12 12:50:29 -070055static inline unsigned int etm_readl_cp14(uint32_t off) { return 0; }
56static inline void etm_writel_cp14(uint32_t val, uint32_t off) {}
Pratik Patelb8bb4032012-07-22 23:09:11 -070057#endif
58
Pratik Patel7831c082011-06-08 21:44:37 -070059#endif