Commit 40a72b0c authored by Sharat Masetty's avatar Sharat Masetty Committed by Rob Clark

drm/msm: rearrange the gpu_rmw() function

The register read-modify-write construct is generic enough
that it can be used by other subsystems as needed, create
a more generic rmw() function and have the gpu_rmw() use
this new function.
Signed-off-by: default avatarSharat Masetty <smasetty@codeaurora.org>
Reviewed-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: default avatarSai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 9e0673c0
...@@ -181,6 +181,14 @@ u32 msm_readl(const void __iomem *addr) ...@@ -181,6 +181,14 @@ u32 msm_readl(const void __iomem *addr)
return val; return val;
} }
void msm_rmw(void __iomem *addr, u32 mask, u32 or)
{
u32 val = msm_readl(addr);
val &= ~mask;
msm_writel(val | or, addr);
}
struct msm_vblank_work { struct msm_vblank_work {
struct work_struct work; struct work_struct work;
int crtc_id; int crtc_id;
......
...@@ -437,6 +437,7 @@ void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name, ...@@ -437,6 +437,7 @@ void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
const char *dbgname); const char *dbgname);
void msm_writel(u32 data, void __iomem *addr); void msm_writel(u32 data, void __iomem *addr);
u32 msm_readl(const void __iomem *addr); u32 msm_readl(const void __iomem *addr);
void msm_rmw(void __iomem *addr, u32 mask, u32 or);
struct msm_gpu_submitqueue; struct msm_gpu_submitqueue;
int msm_submitqueue_init(struct drm_device *drm, struct msm_file_private *ctx); int msm_submitqueue_init(struct drm_device *drm, struct msm_file_private *ctx);
......
...@@ -256,10 +256,7 @@ static inline u32 gpu_read(struct msm_gpu *gpu, u32 reg) ...@@ -256,10 +256,7 @@ static inline u32 gpu_read(struct msm_gpu *gpu, u32 reg)
static inline void gpu_rmw(struct msm_gpu *gpu, u32 reg, u32 mask, u32 or) static inline void gpu_rmw(struct msm_gpu *gpu, u32 reg, u32 mask, u32 or)
{ {
uint32_t val = gpu_read(gpu, reg); msm_rmw(gpu->mmio + (reg << 2), mask, or);
val &= ~mask;
gpu_write(gpu, reg, val | or);
} }
static inline u64 gpu_read64(struct msm_gpu *gpu, u32 lo, u32 hi) static inline u64 gpu_read64(struct msm_gpu *gpu, u32 lo, u32 hi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment