Skip to content

Commit c3e22ca

Browse files
coresight: tmc: introducing new header file
The amount of #define, enumeration and structure definition is big enough to justify moving them to a new header file. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 4c324b5f0e8a692c8d077da9d18533820c2ab636)
1 parent 00bc807 commit c3e22ca

2 files changed

Lines changed: 123 additions & 101 deletions

File tree

drivers/hwtracing/coresight/coresight-tmc.c

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -30,107 +30,7 @@
3030
#include <linux/amba/bus.h>
3131

3232
#include "coresight-priv.h"
33-
34-
#define TMC_RSZ 0x004
35-
#define TMC_STS 0x00c
36-
#define TMC_RRD 0x010
37-
#define TMC_RRP 0x014
38-
#define TMC_RWP 0x018
39-
#define TMC_TRG 0x01c
40-
#define TMC_CTL 0x020
41-
#define TMC_RWD 0x024
42-
#define TMC_MODE 0x028
43-
#define TMC_LBUFLEVEL 0x02c
44-
#define TMC_CBUFLEVEL 0x030
45-
#define TMC_BUFWM 0x034
46-
#define TMC_RRPHI 0x038
47-
#define TMC_RWPHI 0x03c
48-
#define TMC_AXICTL 0x110
49-
#define TMC_DBALO 0x118
50-
#define TMC_DBAHI 0x11c
51-
#define TMC_FFSR 0x300
52-
#define TMC_FFCR 0x304
53-
#define TMC_PSCR 0x308
54-
#define TMC_ITMISCOP0 0xee0
55-
#define TMC_ITTRFLIN 0xee8
56-
#define TMC_ITATBDATA0 0xeec
57-
#define TMC_ITATBCTR2 0xef0
58-
#define TMC_ITATBCTR1 0xef4
59-
#define TMC_ITATBCTR0 0xef8
60-
61-
/* register description */
62-
/* TMC_CTL - 0x020 */
63-
#define TMC_CTL_CAPT_EN BIT(0)
64-
/* TMC_STS - 0x00C */
65-
#define TMC_STS_TRIGGERED BIT(1)
66-
/* TMC_AXICTL - 0x110 */
67-
#define TMC_AXICTL_PROT_CTL_B0 BIT(0)
68-
#define TMC_AXICTL_PROT_CTL_B1 BIT(1)
69-
#define TMC_AXICTL_SCT_GAT_MODE BIT(7)
70-
#define TMC_AXICTL_WR_BURST_16 0xF00
71-
/* TMC_FFCR - 0x304 */
72-
#define TMC_FFCR_EN_FMT BIT(0)
73-
#define TMC_FFCR_EN_TI BIT(1)
74-
#define TMC_FFCR_FON_FLIN BIT(4)
75-
#define TMC_FFCR_FON_TRIG_EVT BIT(5)
76-
#define TMC_FFCR_FLUSHMAN BIT(6)
77-
#define TMC_FFCR_TRIGON_TRIGIN BIT(8)
78-
#define TMC_FFCR_STOP_ON_FLUSH BIT(12)
79-
80-
#define TMC_STS_TMCREADY_BIT 2
81-
#define TMC_FFCR_FLUSHMAN_BIT 6
82-
83-
enum tmc_config_type {
84-
TMC_CONFIG_TYPE_ETB,
85-
TMC_CONFIG_TYPE_ETR,
86-
TMC_CONFIG_TYPE_ETF,
87-
};
88-
89-
enum tmc_mode {
90-
TMC_MODE_CIRCULAR_BUFFER,
91-
TMC_MODE_SOFTWARE_FIFO,
92-
TMC_MODE_HARDWARE_FIFO,
93-
};
94-
95-
enum tmc_mem_intf_width {
96-
TMC_MEM_INTF_WIDTH_32BITS = 0x2,
97-
TMC_MEM_INTF_WIDTH_64BITS = 0x3,
98-
TMC_MEM_INTF_WIDTH_128BITS = 0x4,
99-
TMC_MEM_INTF_WIDTH_256BITS = 0x5,
100-
};
101-
102-
/**
103-
* struct tmc_drvdata - specifics associated to an TMC component
104-
* @base: memory mapped base address for this component.
105-
* @dev: the device entity associated to this component.
106-
* @csdev: component vitals needed by the framework.
107-
* @miscdev: specifics to handle "/dev/xyz.tmc" entry.
108-
* @spinlock: only one at a time pls.
109-
* @read_count: manages preparation of buffer for reading.
110-
* @buf: area of memory where trace data get sent.
111-
* @paddr: DMA start location in RAM.
112-
* @vaddr: virtual representation of @paddr.
113-
* @size: @buf size.
114-
* @enable: this TMC is being used.
115-
* @config_type: TMC variant, must be of type @tmc_config_type.
116-
* @trigger_cntr: amount of words to store after a trigger.
117-
*/
118-
struct tmc_drvdata {
119-
void __iomem *base;
120-
struct device *dev;
121-
struct coresight_device *csdev;
122-
struct miscdevice miscdev;
123-
spinlock_t spinlock;
124-
int read_count;
125-
bool reading;
126-
char *buf;
127-
dma_addr_t paddr;
128-
void *vaddr;
129-
u32 size;
130-
bool enable;
131-
enum tmc_config_type config_type;
132-
u32 trigger_cntr;
133-
};
33+
#include "coresight-tmc.h"
13434

13535
static void tmc_wait_for_tmcready(struct tmc_drvdata *drvdata)
13636
{
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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_TRIGGERED BIT(1)
53+
/* TMC_AXICTL - 0x110 */
54+
#define TMC_AXICTL_PROT_CTL_B0 BIT(0)
55+
#define TMC_AXICTL_PROT_CTL_B1 BIT(1)
56+
#define TMC_AXICTL_SCT_GAT_MODE BIT(7)
57+
#define TMC_AXICTL_WR_BURST_16 0xF00
58+
/* TMC_FFCR - 0x304 */
59+
#define TMC_FFCR_EN_FMT BIT(0)
60+
#define TMC_FFCR_EN_TI BIT(1)
61+
#define TMC_FFCR_FON_FLIN BIT(4)
62+
#define TMC_FFCR_FON_TRIG_EVT BIT(5)
63+
#define TMC_FFCR_FLUSHMAN BIT(6)
64+
#define TMC_FFCR_TRIGON_TRIGIN BIT(8)
65+
#define TMC_FFCR_STOP_ON_FLUSH BIT(12)
66+
67+
#define TMC_STS_TMCREADY_BIT 2
68+
#define TMC_FFCR_FLUSHMAN_BIT 6
69+
70+
enum tmc_config_type {
71+
TMC_CONFIG_TYPE_ETB,
72+
TMC_CONFIG_TYPE_ETR,
73+
TMC_CONFIG_TYPE_ETF,
74+
};
75+
76+
enum tmc_mode {
77+
TMC_MODE_CIRCULAR_BUFFER,
78+
TMC_MODE_SOFTWARE_FIFO,
79+
TMC_MODE_HARDWARE_FIFO,
80+
};
81+
82+
enum tmc_mem_intf_width {
83+
TMC_MEM_INTF_WIDTH_32BITS = 0x2,
84+
TMC_MEM_INTF_WIDTH_64BITS = 0x3,
85+
TMC_MEM_INTF_WIDTH_128BITS = 0x4,
86+
TMC_MEM_INTF_WIDTH_256BITS = 0x5,
87+
};
88+
89+
/**
90+
* struct tmc_drvdata - specifics associated to an TMC component
91+
* @base: memory mapped base address for this component.
92+
* @dev: the device entity associated to this component.
93+
* @csdev: component vitals needed by the framework.
94+
* @miscdev: specifics to handle "/dev/xyz.tmc" entry.
95+
* @spinlock: only one at a time pls.
96+
* @read_count: manages preparation of buffer for reading.
97+
* @buf: area of memory where trace data get sent.
98+
* @paddr: DMA start location in RAM.
99+
* @vaddr: virtual representation of @paddr.
100+
* @size: @buf size.
101+
* @enable: this TMC is being used.
102+
* @config_type: TMC variant, must be of type @tmc_config_type.
103+
* @trigger_cntr: amount of words to store after a trigger.
104+
*/
105+
struct tmc_drvdata {
106+
void __iomem *base;
107+
struct device *dev;
108+
struct coresight_device *csdev;
109+
struct miscdevice miscdev;
110+
spinlock_t spinlock;
111+
int read_count;
112+
bool reading;
113+
char *buf;
114+
dma_addr_t paddr;
115+
void __iomem *vaddr;
116+
u32 size;
117+
bool enable;
118+
enum tmc_config_type config_type;
119+
u32 trigger_cntr;
120+
};
121+
122+
#endif

0 commit comments

Comments
 (0)