Lines Matching refs:drvdata
23 static void tpdm_enable_dsb(struct tpdm_drvdata *drvdata) in tpdm_enable_dsb() argument
28 val = readl_relaxed(drvdata->base + TPDM_DSB_CR); in tpdm_enable_dsb()
30 writel_relaxed(val, drvdata->base + TPDM_DSB_CR); in tpdm_enable_dsb()
34 static void __tpdm_enable(struct tpdm_drvdata *drvdata) in __tpdm_enable() argument
36 CS_UNLOCK(drvdata->base); in __tpdm_enable()
39 if (drvdata->datasets & TPDM_PIDR0_DS_DSB) in __tpdm_enable()
40 tpdm_enable_dsb(drvdata); in __tpdm_enable()
42 CS_LOCK(drvdata->base); in __tpdm_enable()
48 struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); in tpdm_enable() local
50 spin_lock(&drvdata->spinlock); in tpdm_enable()
51 if (drvdata->enable) { in tpdm_enable()
52 spin_unlock(&drvdata->spinlock); in tpdm_enable()
56 __tpdm_enable(drvdata); in tpdm_enable()
57 drvdata->enable = true; in tpdm_enable()
58 spin_unlock(&drvdata->spinlock); in tpdm_enable()
60 dev_dbg(drvdata->dev, "TPDM tracing enabled\n"); in tpdm_enable()
64 static void tpdm_disable_dsb(struct tpdm_drvdata *drvdata) in tpdm_disable_dsb() argument
69 val = readl_relaxed(drvdata->base + TPDM_DSB_CR); in tpdm_disable_dsb()
71 writel_relaxed(val, drvdata->base + TPDM_DSB_CR); in tpdm_disable_dsb()
75 static void __tpdm_disable(struct tpdm_drvdata *drvdata) in __tpdm_disable() argument
77 CS_UNLOCK(drvdata->base); in __tpdm_disable()
80 if (drvdata->datasets & TPDM_PIDR0_DS_DSB) in __tpdm_disable()
81 tpdm_disable_dsb(drvdata); in __tpdm_disable()
83 CS_LOCK(drvdata->base); in __tpdm_disable()
89 struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); in tpdm_disable() local
91 spin_lock(&drvdata->spinlock); in tpdm_disable()
92 if (!drvdata->enable) { in tpdm_disable()
93 spin_unlock(&drvdata->spinlock); in tpdm_disable()
97 __tpdm_disable(drvdata); in tpdm_disable()
98 drvdata->enable = false; in tpdm_disable()
99 spin_unlock(&drvdata->spinlock); in tpdm_disable()
101 dev_dbg(drvdata->dev, "TPDM tracing disabled\n"); in tpdm_disable()
113 static void tpdm_init_default_data(struct tpdm_drvdata *drvdata) in tpdm_init_default_data() argument
117 CS_UNLOCK(drvdata->base); in tpdm_init_default_data()
119 pidr = readl_relaxed(drvdata->base + CORESIGHT_PERIPHIDR0); in tpdm_init_default_data()
120 drvdata->datasets |= pidr & GENMASK(TPDM_DATASETS - 1, 0); in tpdm_init_default_data()
121 CS_LOCK(drvdata->base); in tpdm_init_default_data()
135 struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); in integration_test_store() local
144 if (!drvdata->enable) in integration_test_store()
151 CS_UNLOCK(drvdata->base); in integration_test_store()
152 writel_relaxed(0x1, drvdata->base + TPDM_ITCNTRL); in integration_test_store()
155 writel_relaxed(val, drvdata->base + TPDM_ITATBCNTRL); in integration_test_store()
157 writel_relaxed(0, drvdata->base + TPDM_ITCNTRL); in integration_test_store()
158 CS_LOCK(drvdata->base); in integration_test_store()
182 struct tpdm_drvdata *drvdata; in tpdm_probe() local
191 drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); in tpdm_probe()
192 if (!drvdata) in tpdm_probe()
194 drvdata->dev = &adev->dev; in tpdm_probe()
195 dev_set_drvdata(dev, drvdata); in tpdm_probe()
201 drvdata->base = base; in tpdm_probe()
214 drvdata->csdev = coresight_register(&desc); in tpdm_probe()
215 if (IS_ERR(drvdata->csdev)) in tpdm_probe()
216 return PTR_ERR(drvdata->csdev); in tpdm_probe()
218 spin_lock_init(&drvdata->spinlock); in tpdm_probe()
219 tpdm_init_default_data(drvdata); in tpdm_probe()
228 struct tpdm_drvdata *drvdata = dev_get_drvdata(&adev->dev); in tpdm_remove() local
230 coresight_unregister(drvdata->csdev); in tpdm_remove()