From 37c7e4e538c207514706b767e26fe0aa93bdd2cf Mon Sep 17 00:00:00 2001 From: Victor Kamensky Date: Fri, 8 Nov 2013 15:10:10 +0200 Subject: OMAPDSS: raw read and write endian fix All OMAP IP blocks expect LE data, but CPU may operate in BE mode. Need to use endian neutral functions to read/write h/w registers. I.e instead of __raw_read[lw] and __raw_write[lw] functions code need to use read[lw]_relaxed and write[lw]_relaxed functions. If the first simply reads/writes register, the second will byteswap it if host operates in BE mode. Changes are trivial sed like replacement of __raw_xxx functions with xxx_relaxed variant. Signed-off-by: Victor Kamensky Signed-off-by: Taras Kondratiuk --- drivers/video/omap2/dss/dispc.c | 4 ++-- drivers/video/omap2/dss/dsi.c | 4 ++-- drivers/video/omap2/dss/dss.c | 4 ++-- drivers/video/omap2/dss/hdmi.h | 4 ++-- drivers/video/omap2/dss/rfbi.c | 16 ++++++++-------- drivers/video/omap2/dss/venc.c | 4 ++-- drivers/video/omap2/omapfb/omapfb-main.c | 10 +++++----- drivers/video/omap2/vrfb.c | 6 +++--- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 77d6221618f4..e3136ef287cb 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -230,12 +230,12 @@ static unsigned long dispc_plane_lclk_rate(enum omap_plane plane); static inline void dispc_write_reg(const u16 idx, u32 val) { - __raw_writel(val, dispc.base + idx); + writel_relaxed(val, dispc.base + idx); } static inline u32 dispc_read_reg(const u16 idx) { - return __raw_readl(dispc.base + idx); + return readl_relaxed(dispc.base + idx); } static u32 mgr_fld_read(enum omap_channel channel, enum mgr_reg_fields regfld) diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index a820c37e323e..1c6aef4e5f9c 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -435,7 +435,7 @@ static inline void dsi_write_reg(struct platform_device *dsidev, default: return; } - __raw_writel(val, base + idx.idx); + writel_relaxed(val, base + idx.idx); } static inline u32 dsi_read_reg(struct platform_device *dsidev, @@ -451,7 +451,7 @@ static inline u32 dsi_read_reg(struct platform_device *dsidev, default: return 0; } - return __raw_readl(base + idx.idx); + return readl_relaxed(base + idx.idx); } static void dsi_bus_lock(struct omap_dss_device *dssdev) diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 9a145da35ad3..a6b2fcdc5814 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c @@ -103,12 +103,12 @@ static const char * const dss_generic_clk_source_names[] = { static inline void dss_write_reg(const struct dss_reg idx, u32 val) { - __raw_writel(val, dss.base + idx.idx); + writel_relaxed(val, dss.base + idx.idx); } static inline u32 dss_read_reg(const struct dss_reg idx) { - return __raw_readl(dss.base + idx.idx); + return readl_relaxed(dss.base + idx.idx); } #define SR(reg) \ diff --git a/drivers/video/omap2/dss/hdmi.h b/drivers/video/omap2/dss/hdmi.h index e25681ff5a70..d148b70346fd 100644 --- a/drivers/video/omap2/dss/hdmi.h +++ b/drivers/video/omap2/dss/hdmi.h @@ -363,12 +363,12 @@ struct hdmi_core_data { static inline void hdmi_write_reg(void __iomem *base_addr, const u16 idx, u32 val) { - __raw_writel(val, base_addr + idx); + writel_relaxed(val, base_addr + idx); } static inline u32 hdmi_read_reg(void __iomem *base_addr, const u16 idx) { - return __raw_readl(base_addr + idx); + return readl_relaxed(base_addr + idx); } #define REG_FLD_MOD(base, idx, val, start, end) \ diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index c8a81a2b879c..7772e3323e5d 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -122,12 +122,12 @@ static struct { static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val) { - __raw_writel(val, rfbi.base + idx.idx); + writel_relaxed(val, rfbi.base + idx.idx); } static inline u32 rfbi_read_reg(const struct rfbi_reg idx) { - return __raw_readl(rfbi.base + idx.idx); + return readl_relaxed(rfbi.base + idx.idx); } static int rfbi_runtime_get(void) @@ -263,8 +263,8 @@ static void rfbi_write_pixels(const void __iomem *buf, int scr_width, for (; h; --h) { for (i = 0; i < w; ++i) { const u8 __iomem *b = (const u8 __iomem *)pd; - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+1)); - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+0)); + rfbi_write_reg(RFBI_PARAM, readb_relaxed(b+1)); + rfbi_write_reg(RFBI_PARAM, readb_relaxed(b+0)); ++pd; } pd += horiz_offset; @@ -277,9 +277,9 @@ static void rfbi_write_pixels(const void __iomem *buf, int scr_width, for (; h; --h) { for (i = 0; i < w; ++i) { const u8 __iomem *b = (const u8 __iomem *)pd; - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+2)); - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+1)); - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+0)); + rfbi_write_reg(RFBI_PARAM, readb_relaxed(b+2)); + rfbi_write_reg(RFBI_PARAM, readb_relaxed(b+1)); + rfbi_write_reg(RFBI_PARAM, readb_relaxed(b+0)); ++pd; } pd += horiz_offset; @@ -291,7 +291,7 @@ static void rfbi_write_pixels(const void __iomem *buf, int scr_width, for (; h; --h) { for (i = 0; i < w; ++i) { - rfbi_write_reg(RFBI_PARAM, __raw_readw(pd)); + rfbi_write_reg(RFBI_PARAM, readw_relaxed(pd)); ++pd; } pd += horiz_offset; diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 2cd7f7e42105..92af50bcbb1a 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -309,12 +309,12 @@ static struct { static inline void venc_write_reg(int idx, u32 val) { - __raw_writel(val, venc.base + idx); + writel_relaxed(val, venc.base + idx); } static inline u32 venc_read_reg(int idx) { - u32 l = __raw_readl(venc.base + idx); + u32 l = readl_relaxed(venc.base + idx); return l; } diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index fcb9e932d00c..45fc52fadebe 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c @@ -82,18 +82,18 @@ static void draw_pixel(struct fb_info *fbi, int x, int y, unsigned color) g = g * 64 / 256; b = b * 32 / 256; - __raw_writew((r << 11) | (g << 5) | (b << 0), p); + writew_relaxed((r << 11) | (g << 5) | (b << 0), p); } else if (var->bits_per_pixel == 24) { u8 __iomem *p = (u8 __iomem *)addr; p += (y * line_len + x) * 3; - __raw_writeb(b, p + 0); - __raw_writeb(g, p + 1); - __raw_writeb(r, p + 2); + writeb_relaxed(b, p + 0); + writeb_relaxed(g, p + 1); + writeb_relaxed(r, p + 2); } else if (var->bits_per_pixel == 32) { u32 __iomem *p = (u32 __iomem *)addr; p += y * line_len + x; - __raw_writel(color, p); + writel_relaxed(color, p); } } diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index f346b02eee1d..032469079bfe 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c @@ -82,17 +82,17 @@ static bool vrfb_loaded; static void omap2_sms_write_rot_control(u32 val, unsigned ctx) { - __raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx)); + writel_relaxed(val, vrfb_base + SMS_ROT_CONTROL(ctx)); } static void omap2_sms_write_rot_size(u32 val, unsigned ctx) { - __raw_writel(val, vrfb_base + SMS_ROT_SIZE(ctx)); + writel_relaxed(val, vrfb_base + SMS_ROT_SIZE(ctx)); } static void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx) { - __raw_writel(val, vrfb_base + SMS_ROT_PHYSICAL_BA(ctx)); + writel_relaxed(val, vrfb_base + SMS_ROT_PHYSICAL_BA(ctx)); } static inline void restore_hw_context(int ctx) -- cgit v1.2.3