Skip to content

Commit a1b0e77

Browse files
james-c-linaroSuzuki K Poulose
authored andcommitted
coresight: etm3x: Convert raw base pointer to struct coresight access
This is so that etm3x can use the new claim tag functions which take a csa pointer in a later commit. Reviewed-by: Leo Yan <[email protected]> Reviewed-by: Yeoreum Yun <[email protected]> Signed-off-by: James Clark <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a244a18 commit a1b0e77

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

drivers/hwtracing/coresight/coresight-etm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ struct etm_config {
229229
* @config: structure holding configuration parameters.
230230
*/
231231
struct etm_drvdata {
232-
void __iomem *base;
232+
struct csdev_access csa;
233233
struct clk *atclk;
234234
struct coresight_device *csdev;
235235
spinlock_t spinlock;
@@ -260,7 +260,7 @@ static inline void etm_writel(struct etm_drvdata *drvdata,
260260
"invalid CP14 access to ETM reg: %#x", off);
261261
}
262262
} else {
263-
writel_relaxed(val, drvdata->base + off);
263+
writel_relaxed(val, drvdata->csa.base + off);
264264
}
265265
}
266266

@@ -274,7 +274,7 @@ static inline unsigned int etm_readl(struct etm_drvdata *drvdata, u32 off)
274274
"invalid CP14 access to ETM reg: %#x", off);
275275
}
276276
} else {
277-
val = readl_relaxed(drvdata->base + off);
277+
val = readl_relaxed(drvdata->csa.base + off);
278278
}
279279

280280
return val;

drivers/hwtracing/coresight/coresight-etm3x-core.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ static void etm_set_pwrup(struct etm_drvdata *drvdata)
8686
{
8787
u32 etmpdcr;
8888

89-
etmpdcr = readl_relaxed(drvdata->base + ETMPDCR);
89+
etmpdcr = readl_relaxed(drvdata->csa.base + ETMPDCR);
9090
etmpdcr |= ETMPDCR_PWD_UP;
91-
writel_relaxed(etmpdcr, drvdata->base + ETMPDCR);
91+
writel_relaxed(etmpdcr, drvdata->csa.base + ETMPDCR);
9292
/* Ensure pwrup completes before subsequent cp14 accesses */
9393
mb();
9494
isb();
@@ -101,9 +101,9 @@ static void etm_clr_pwrup(struct etm_drvdata *drvdata)
101101
/* Ensure pending cp14 accesses complete before clearing pwrup */
102102
mb();
103103
isb();
104-
etmpdcr = readl_relaxed(drvdata->base + ETMPDCR);
104+
etmpdcr = readl_relaxed(drvdata->csa.base + ETMPDCR);
105105
etmpdcr &= ~ETMPDCR_PWD_UP;
106-
writel_relaxed(etmpdcr, drvdata->base + ETMPDCR);
106+
writel_relaxed(etmpdcr, drvdata->csa.base + ETMPDCR);
107107
}
108108

109109
/**
@@ -365,7 +365,7 @@ static int etm_enable_hw(struct etm_drvdata *drvdata)
365365
struct etm_config *config = &drvdata->config;
366366
struct coresight_device *csdev = drvdata->csdev;
367367

368-
CS_UNLOCK(drvdata->base);
368+
CS_UNLOCK(drvdata->csa.base);
369369

370370
rc = coresight_claim_device_unlocked(csdev);
371371
if (rc)
@@ -427,7 +427,7 @@ static int etm_enable_hw(struct etm_drvdata *drvdata)
427427
etm_clr_prog(drvdata);
428428

429429
done:
430-
CS_LOCK(drvdata->base);
430+
CS_LOCK(drvdata->csa.base);
431431

432432
dev_dbg(&drvdata->csdev->dev, "cpu: %d enable smp call done: %d\n",
433433
drvdata->cpu, rc);
@@ -549,7 +549,7 @@ static void etm_disable_hw(void *info)
549549
struct etm_config *config = &drvdata->config;
550550
struct coresight_device *csdev = drvdata->csdev;
551551

552-
CS_UNLOCK(drvdata->base);
552+
CS_UNLOCK(drvdata->csa.base);
553553
etm_set_prog(drvdata);
554554

555555
/* Read back sequencer and counters for post trace analysis */
@@ -561,7 +561,7 @@ static void etm_disable_hw(void *info)
561561
etm_set_pwrdwn(drvdata);
562562
coresight_disclaim_device_unlocked(csdev);
563563

564-
CS_LOCK(drvdata->base);
564+
CS_LOCK(drvdata->csa.base);
565565

566566
dev_dbg(&drvdata->csdev->dev,
567567
"cpu: %d disable smp call done\n", drvdata->cpu);
@@ -574,7 +574,7 @@ static void etm_disable_perf(struct coresight_device *csdev)
574574
if (WARN_ON_ONCE(drvdata->cpu != smp_processor_id()))
575575
return;
576576

577-
CS_UNLOCK(drvdata->base);
577+
CS_UNLOCK(drvdata->csa.base);
578578

579579
/* Setting the prog bit disables tracing immediately */
580580
etm_set_prog(drvdata);
@@ -586,7 +586,7 @@ static void etm_disable_perf(struct coresight_device *csdev)
586586
etm_set_pwrdwn(drvdata);
587587
coresight_disclaim_device_unlocked(csdev);
588588

589-
CS_LOCK(drvdata->base);
589+
CS_LOCK(drvdata->csa.base);
590590

591591
/*
592592
* perf will release trace ids when _free_aux()
@@ -733,7 +733,7 @@ static void etm_init_arch_data(void *info)
733733
/* Make sure all registers are accessible */
734734
etm_os_unlock(drvdata);
735735

736-
CS_UNLOCK(drvdata->base);
736+
CS_UNLOCK(drvdata->csa.base);
737737

738738
/* First dummy read */
739739
(void)etm_readl(drvdata, ETMPDSR);
@@ -766,7 +766,7 @@ static void etm_init_arch_data(void *info)
766766

767767
etm_set_pwrdwn(drvdata);
768768
etm_clr_pwrup(drvdata);
769-
CS_LOCK(drvdata->base);
769+
CS_LOCK(drvdata->csa.base);
770770
}
771771

772772
static int __init etm_hp_setup(void)
@@ -827,8 +827,7 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
827827
if (IS_ERR(base))
828828
return PTR_ERR(base);
829829

830-
drvdata->base = base;
831-
desc.access = CSDEV_ACCESS_IOMEM(base);
830+
desc.access = drvdata->csa = CSDEV_ACCESS_IOMEM(base);
832831

833832
spin_lock_init(&drvdata->spinlock);
834833

drivers/hwtracing/coresight/coresight-etm3x-sysfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ static ssize_t etmsr_show(struct device *dev,
5050

5151
pm_runtime_get_sync(dev->parent);
5252
spin_lock_irqsave(&drvdata->spinlock, flags);
53-
CS_UNLOCK(drvdata->base);
53+
CS_UNLOCK(drvdata->csa.base);
5454

5555
val = etm_readl(drvdata, ETMSR);
5656

57-
CS_LOCK(drvdata->base);
57+
CS_LOCK(drvdata->csa.base);
5858
spin_unlock_irqrestore(&drvdata->spinlock, flags);
5959
pm_runtime_put(dev->parent);
6060

@@ -949,9 +949,9 @@ static ssize_t seq_curr_state_show(struct device *dev,
949949
pm_runtime_get_sync(dev->parent);
950950
spin_lock_irqsave(&drvdata->spinlock, flags);
951951

952-
CS_UNLOCK(drvdata->base);
952+
CS_UNLOCK(drvdata->csa.base);
953953
val = (etm_readl(drvdata, ETMSQR) & ETM_SQR_MASK);
954-
CS_LOCK(drvdata->base);
954+
CS_LOCK(drvdata->csa.base);
955955

956956
spin_unlock_irqrestore(&drvdata->spinlock, flags);
957957
pm_runtime_put(dev->parent);

0 commit comments

Comments
 (0)