aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/coresight.h
diff options
context:
space:
mode:
authorJames Clark <james.clark@arm.com>2022-08-30 18:26:10 +0100
committerMathieu Poirier <mathieu.poirier@linaro.org>2022-08-31 10:54:59 -0600
commitb6df1cbb415e543f2908f9c59a8fb20714b86879 (patch)
tree636bba43bb8f9367565ecb86c3b319c90557b08a /include/linux/coresight.h
parentcoresight: Remove unused function parameter (diff)
downloadwireguard-linux-b6df1cbb415e543f2908f9c59a8fb20714b86879.tar.xz
wireguard-linux-b6df1cbb415e543f2908f9c59a8fb20714b86879.zip
coresight: Simplify sysfs accessors by using csdev_access abstraction
The coresight_device struct is available in the sysfs accessor, and this contains a csdev_access struct which can be used to access registers. Use this instead of passing in the type of each drvdata so that a common function can be shared between all the cs drivers. No functional changes. Signed-off-by: James Clark <james.clark@arm.com> Reviewed-by: Mike Leach <mike.leach@linaro.org> Link: https://lore.kernel.org/r/20220830172614.340962-3-james.clark@arm.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'include/linux/coresight.h')
-rw-r--r--include/linux/coresight.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index 9f445f09fcfe..a47dd1f62216 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -372,6 +372,24 @@ static inline u32 csdev_access_relaxed_read32(struct csdev_access *csa,
return csa->read(offset, true, false);
}
+static inline u64 csdev_access_relaxed_read_pair(struct csdev_access *csa,
+ s32 lo_offset, s32 hi_offset)
+{
+ u64 val;
+
+ if (likely(csa->io_mem)) {
+ val = readl_relaxed(csa->base + lo_offset);
+ val |= (hi_offset < 0) ? 0 :
+ (u64)readl_relaxed(csa->base + hi_offset) << 32;
+ return val;
+ }
+
+ val = csa->read(lo_offset, true, false);
+ val |= (hi_offset < 0) ? 0 :
+ (u64)csa->read(hi_offset, true, false) << 32;
+ return val;
+}
+
static inline u32 csdev_access_read32(struct csdev_access *csa, u32 offset)
{
if (likely(csa->io_mem))