coresight: tmc: cleaning up header file
[firefly-linux-kernel-4.4.55.git] / drivers / hwtracing / coresight / coresight-tmc.h
1 /*
2  * Copyright(C) 2015 Linaro Limited. All rights reserved.
3  * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published by
7  * the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #ifndef _CORESIGHT_TMC_H
19 #define _CORESIGHT_TMC_H
20
21 #define TMC_RSZ                 0x004
22 #define TMC_STS                 0x00c
23 #define TMC_RRD                 0x010
24 #define TMC_RRP                 0x014
25 #define TMC_RWP                 0x018
26 #define TMC_TRG                 0x01c
27 #define TMC_CTL                 0x020
28 #define TMC_RWD                 0x024
29 #define TMC_MODE                0x028
30 #define TMC_LBUFLEVEL           0x02c
31 #define TMC_CBUFLEVEL           0x030
32 #define TMC_BUFWM               0x034
33 #define TMC_RRPHI               0x038
34 #define TMC_RWPHI               0x03c
35 #define TMC_AXICTL              0x110
36 #define TMC_DBALO               0x118
37 #define TMC_DBAHI               0x11c
38 #define TMC_FFSR                0x300
39 #define TMC_FFCR                0x304
40 #define TMC_PSCR                0x308
41 #define TMC_ITMISCOP0           0xee0
42 #define TMC_ITTRFLIN            0xee8
43 #define TMC_ITATBDATA0          0xeec
44 #define TMC_ITATBCTR2           0xef0
45 #define TMC_ITATBCTR1           0xef4
46 #define TMC_ITATBCTR0           0xef8
47
48 /* register description */
49 /* TMC_CTL - 0x020 */
50 #define TMC_CTL_CAPT_EN         BIT(0)
51 /* TMC_STS - 0x00C */
52 #define TMC_STS_TMCREADY_BIT    2
53 #define TMC_STS_TRIGGERED       BIT(1)
54 /* TMC_AXICTL - 0x110 */
55 #define TMC_AXICTL_PROT_CTL_B0  BIT(0)
56 #define TMC_AXICTL_PROT_CTL_B1  BIT(1)
57 #define TMC_AXICTL_SCT_GAT_MODE BIT(7)
58 #define TMC_AXICTL_WR_BURST_16  0xF00
59 /* TMC_FFCR - 0x304 */
60 #define TMC_FFCR_FLUSHMAN_BIT   6
61 #define TMC_FFCR_EN_FMT         BIT(0)
62 #define TMC_FFCR_EN_TI          BIT(1)
63 #define TMC_FFCR_FON_FLIN       BIT(4)
64 #define TMC_FFCR_FON_TRIG_EVT   BIT(5)
65 #define TMC_FFCR_TRIGON_TRIGIN  BIT(8)
66 #define TMC_FFCR_STOP_ON_FLUSH  BIT(12)
67
68
69 enum tmc_config_type {
70         TMC_CONFIG_TYPE_ETB,
71         TMC_CONFIG_TYPE_ETR,
72         TMC_CONFIG_TYPE_ETF,
73 };
74
75 enum tmc_mode {
76         TMC_MODE_CIRCULAR_BUFFER,
77         TMC_MODE_SOFTWARE_FIFO,
78         TMC_MODE_HARDWARE_FIFO,
79 };
80
81 enum tmc_mem_intf_width {
82         TMC_MEM_INTF_WIDTH_32BITS       = 0x2,
83         TMC_MEM_INTF_WIDTH_64BITS       = 0x3,
84         TMC_MEM_INTF_WIDTH_128BITS      = 0x4,
85         TMC_MEM_INTF_WIDTH_256BITS      = 0x5,
86 };
87
88 /**
89  * struct tmc_drvdata - specifics associated to an TMC component
90  * @base:       memory mapped base address for this component.
91  * @dev:        the device entity associated to this component.
92  * @csdev:      component vitals needed by the framework.
93  * @miscdev:    specifics to handle "/dev/xyz.tmc" entry.
94  * @spinlock:   only one at a time pls.
95  * @read_count: manages preparation of buffer for reading.
96  * @buf:        area of memory where trace data get sent.
97  * @paddr:      DMA start location in RAM.
98  * @vaddr:      virtual representation of @paddr.
99  * @size:       @buf size.
100  * @enable:     this TMC is being used.
101  * @config_type: TMC variant, must be of type @tmc_config_type.
102  * @trigger_cntr: amount of words to store after a trigger.
103  */
104 struct tmc_drvdata {
105         void __iomem            *base;
106         struct device           *dev;
107         struct coresight_device *csdev;
108         struct miscdevice       miscdev;
109         spinlock_t              spinlock;
110         int                     read_count;
111         bool                    reading;
112         char                    *buf;
113         dma_addr_t              paddr;
114         void __iomem            *vaddr;
115         u32                     size;
116         bool                    enable;
117         enum tmc_config_type    config_type;
118         u32                     trigger_cntr;
119 };
120
121 #endif