Message ID | 20220923123121.49411-2-samuel.obuch@codasip.com |
---|---|
State | Superseded |
Delegated to: | Ramon Fried |
Headers | show |
Series | [v2,1/3] net: emaclite: fix broken build | expand |
On Fri, Sep 23, 2022 at 3:31 PM <samuel.obuch@codasip.com> wrote: > > From: Samuel Obuch <samuel.obuch@codasip.com> > > Use __raw_read* and __raw_write* functions to ensure read/write > is passed to the memory-mapped regions, as non-volatile accesses > may get optimised out. > > Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com> > --- > drivers/net/xilinx_emaclite.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c > index 2e152bf873..c12736d0ee 100644 > --- a/drivers/net/xilinx_emaclite.c > +++ b/drivers/net/xilinx_emaclite.c > @@ -113,12 +113,12 @@ static void xemaclite_alignedread(u32 *srcptr, void *destptr, u32 bytecount) > /* Word aligned buffer, no correction needed. */ > to32ptr = (u32 *) destptr; > while (bytecount > 3) { > - *to32ptr++ = *from32ptr++; > + *to32ptr++ = __raw_readl(from32ptr++); > bytecount -= 4; > } > to8ptr = (u8 *) to32ptr; > > - alignbuffer = *from32ptr++; > + alignbuffer = __raw_readl(from32ptr++); > from8ptr = (u8 *) &alignbuffer; > > for (i = 0; i < bytecount; i++) > @@ -136,8 +136,7 @@ static void xemaclite_alignedwrite(void *srcptr, u32 *destptr, u32 bytecount) > > from32ptr = (u32 *) srcptr; > while (bytecount > 3) { > - > - *to32ptr++ = *from32ptr++; > + __raw_writel(*from32ptr++, to32ptr++); > bytecount -= 4; > } > > @@ -148,7 +147,7 @@ static void xemaclite_alignedwrite(void *srcptr, u32 *destptr, u32 bytecount) > for (i = 0; i < bytecount; i++) > *to8ptr++ = *from8ptr++; > > - *to32ptr++ = alignbuffer; > + __raw_writel(alignbuffer, to32ptr++); > } > > static int wait_for_bit(const char *func, u32 *reg, const u32 mask, > -- > 2.31.1 > Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 2e152bf873..c12736d0ee 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -113,12 +113,12 @@ static void xemaclite_alignedread(u32 *srcptr, void *destptr, u32 bytecount) /* Word aligned buffer, no correction needed. */ to32ptr = (u32 *) destptr; while (bytecount > 3) { - *to32ptr++ = *from32ptr++; + *to32ptr++ = __raw_readl(from32ptr++); bytecount -= 4; } to8ptr = (u8 *) to32ptr; - alignbuffer = *from32ptr++; + alignbuffer = __raw_readl(from32ptr++); from8ptr = (u8 *) &alignbuffer; for (i = 0; i < bytecount; i++) @@ -136,8 +136,7 @@ static void xemaclite_alignedwrite(void *srcptr, u32 *destptr, u32 bytecount) from32ptr = (u32 *) srcptr; while (bytecount > 3) { - - *to32ptr++ = *from32ptr++; + __raw_writel(*from32ptr++, to32ptr++); bytecount -= 4; } @@ -148,7 +147,7 @@ static void xemaclite_alignedwrite(void *srcptr, u32 *destptr, u32 bytecount) for (i = 0; i < bytecount; i++) *to8ptr++ = *from8ptr++; - *to32ptr++ = alignbuffer; + __raw_writel(alignbuffer, to32ptr++); } static int wait_for_bit(const char *func, u32 *reg, const u32 mask,