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>
This commit is contained in:
James Clark
2022-08-30 18:26:10 +01:00
committed by Mathieu Poirier
parent 3727f03e2b
commit b6df1cbb41
8 changed files with 79 additions and 80 deletions

View File

@@ -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))