diff options
author | Suzuki K Poulose <suzuki.poulose@arm.com> | 2017-08-02 12:22:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-08-28 10:05:49 -0400 |
commit | ff11f5bc5a42f2cfc9705481eedf1b4d470ade2c (patch) | |
tree | a3d15c9886f66e0d152c5ca60c4546a019e29aab /drivers/hwtracing | |
parent | 2e21934568c0f9fcd2e01060007506a74d49152b (diff) |
coresight tmc etr: Detect address width at runtime
TMC in Coresight SoC-600 advertises the AXI address width
in the device configuration register.
Bit 16 - AXIAW_VALID
0 - AXI Address Width not valid
1 - Valid AXI Address width in Bits[23-17]
Bits [23-17] - AXIAW. If AXIAW_VALID = b01 then
0x20 - 32bit AXI address bus
0x28 - 40bit AXI address bus
0x2c - 44bit AXI address bus
0x30 - 48bit AXI address bus
0x34 - 52bit AXI address bus
Use the address bits from the device configuration register, if
available. Otherwise, default to 40bit.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r-- | drivers/hwtracing/coresight/coresight-tmc.c | 26 | ||||
-rw-r--r-- | drivers/hwtracing/coresight/coresight-tmc.h | 4 |
2 files changed, 27 insertions, 3 deletions
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index bb409c485d05..5bfc1b3ab80c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c | |||
@@ -303,16 +303,36 @@ const struct attribute_group *coresight_tmc_groups[] = { | |||
303 | static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata, | 303 | static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata, |
304 | u32 devid, void *dev_caps) | 304 | u32 devid, void *dev_caps) |
305 | { | 305 | { |
306 | u32 dma_mask = 0; | ||
307 | |||
306 | /* Set the unadvertised capabilities */ | 308 | /* Set the unadvertised capabilities */ |
307 | tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps); | 309 | tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps); |
308 | 310 | ||
309 | if (!(devid & TMC_DEVID_NOSCAT)) | 311 | if (!(devid & TMC_DEVID_NOSCAT)) |
310 | tmc_etr_set_cap(drvdata, TMC_ETR_SG); | 312 | tmc_etr_set_cap(drvdata, TMC_ETR_SG); |
313 | |||
314 | /* Check if the AXI address width is available */ | ||
315 | if (devid & TMC_DEVID_AXIAW_VALID) | ||
316 | dma_mask = ((devid >> TMC_DEVID_AXIAW_SHIFT) & | ||
317 | TMC_DEVID_AXIAW_MASK); | ||
318 | |||
311 | /* | 319 | /* |
312 | * ETR configuration uses a 40-bit AXI master in place of | 320 | * Unless specified in the device configuration, ETR uses a 40-bit |
313 | * the embedded SRAM of ETB/ETF. | 321 | * AXI master in place of the embedded SRAM of ETB/ETF. |
314 | */ | 322 | */ |
315 | return dma_set_mask_and_coherent(drvdata->dev, DMA_BIT_MASK(40)); | 323 | switch (dma_mask) { |
324 | case 32: | ||
325 | case 40: | ||
326 | case 44: | ||
327 | case 48: | ||
328 | case 52: | ||
329 | dev_info(drvdata->dev, "Detected dma mask %dbits\n", dma_mask); | ||
330 | break; | ||
331 | default: | ||
332 | dma_mask = 40; | ||
333 | } | ||
334 | |||
335 | return dma_set_mask_and_coherent(drvdata->dev, DMA_BIT_MASK(dma_mask)); | ||
316 | } | 336 | } |
317 | 337 | ||
318 | static int tmc_probe(struct amba_device *adev, const struct amba_id *id) | 338 | static int tmc_probe(struct amba_device *adev, const struct amba_id *id) |
diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index bb6a3e3314b8..f55203d48673 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h | |||
@@ -71,6 +71,10 @@ | |||
71 | 71 | ||
72 | #define TMC_DEVID_NOSCAT BIT(24) | 72 | #define TMC_DEVID_NOSCAT BIT(24) |
73 | 73 | ||
74 | #define TMC_DEVID_AXIAW_VALID BIT(16) | ||
75 | #define TMC_DEVID_AXIAW_SHIFT 17 | ||
76 | #define TMC_DEVID_AXIAW_MASK 0x7f | ||
77 | |||
74 | enum tmc_config_type { | 78 | enum tmc_config_type { |
75 | TMC_CONFIG_TYPE_ETB, | 79 | TMC_CONFIG_TYPE_ETB, |
76 | TMC_CONFIG_TYPE_ETR, | 80 | TMC_CONFIG_TYPE_ETR, |