From: samuel.obuch@codasip.com
To: u-boot@lists.denx.de
Cc: rfried.dev@gmail.com, michal.simek@amd.com,
Samuel Obuch <samuel.obuch@codasip.com>
Subject: [PATCH v3 2/3] net: emaclite: fix xemaclite_alignedread/write functions
Date: Tue, 27 Sep 2022 13:21:02 +0200 [thread overview]
Message-ID: <20220927112103.155689-2-samuel.obuch@codasip.com> (raw)
In-Reply-To: <20220927112103.155689-1-samuel.obuch@codasip.com>
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 29e8271c63..a4851ad36f 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -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,
--
2.31.1
next prev parent reply other threads:[~2022-09-27 11:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 11:21 [PATCH v3 1/3] net: emaclite: enable for more architectures samuel.obuch
2022-09-27 11:21 ` samuel.obuch [this message]
2022-09-27 11:21 ` [PATCH v3 3/3] net: emaclite: fix handling for IP packets with specific lengths samuel.obuch
2022-10-04 12:14 ` [PATCH v3 1/3] net: emaclite: enable for more architectures Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220927112103.155689-2-samuel.obuch@codasip.com \
--to=samuel.obuch@codasip.com \
--cc=michal.simek@amd.com \
--cc=rfried.dev@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox