]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: emaclite: fix xemaclite_alignedread/write functions
authorSamuel Obuch <samuel.obuch@codasip.com>
Tue, 27 Sep 2022 11:21:02 +0000 (13:21 +0200)
committerMichal Simek <michal.simek@amd.com>
Wed, 5 Oct 2022 09:36:54 +0000 (11:36 +0200)
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>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Link: https://lore.kernel.org/r/20220927112103.155689-2-samuel.obuch@codasip.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
drivers/net/xilinx_emaclite.c

index 29e8271c63b51c735f252196deb0627f3e41f8df..a4851ad36f765a9e5d3d9e70826cb5efe4c22d01 100644 (file)
@@ -112,12 +112,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++)
@@ -135,8 +135,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;
        }
 
@@ -147,7 +146,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,