From: Jan Remes <jan.remes@codasip.com>
To: Michal Simek <michal.simek@amd.com>
Cc: Ramon Fried <rfried.dev@gmail.com>,
Samuel Obuch <samuel.obuch@codasip.com>,
U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH 2/3] net: emaclite: fix xemaclite_alignedread/write functions
Date: Mon, 19 Sep 2022 19:03:06 +0200 [thread overview]
Message-ID: <CALXH3=Lac9SrfedGUKYD0aq+iONXR-z_RtQ1d0hThqXro-qkUw@mail.gmail.com> (raw)
In-Reply-To: <c476e166-d040-3462-f882-2e8a48197f63@amd.com>
On Mon, Aug 8, 2022 at 10:05 AM Michal Simek <michal.simek@amd.com> wrote:
>
>
>
> On 8/6/22 19:33, Ramon Fried wrote:
> > On Wed, Jul 13, 2022 at 5:02 PM Samuel Obuch <samuel.obuch@codasip.com> wrote:
> >>
> >> 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 5cd88e04fe..de7a2dee0b 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
> >>
> > I think that using readl/writel is fine, no need for raw_...
>
> For microblaze that should be fine but let me ask my team to rest it on ARM.
> I think that __raw version are safer because this IP can also run on big endian
> systems and I think that was the reason why readl/writel wasn't used in past.
>
> Thanks,
> Michal
Hi Michal,
Do you have any new information on this? For the v2, it would be good
to have this resolved.
Thanks,
Jan
next prev parent reply other threads:[~2022-09-20 12:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 13:52 net: emaclite: Fixes, enable driver for other archs Samuel Obuch
2022-07-13 13:52 ` [PATCH 1/3] net: emaclite: fix broken build Samuel Obuch
2022-08-06 17:31 ` Ramon Fried
2022-08-08 7:35 ` Michal Simek
2022-08-08 7:44 ` Michal Simek
2022-09-23 9:29 ` Samuel Obuch
2022-07-13 13:52 ` [PATCH 2/3] net: emaclite: fix xemaclite_alignedread/write functions Samuel Obuch
2022-08-06 17:33 ` Ramon Fried
2022-08-08 8:04 ` Michal Simek
2022-09-19 17:03 ` Jan Remes [this message]
2022-09-20 14:23 ` Michal Simek
2022-09-23 9:17 ` Samuel Obuch
2022-09-23 9:36 ` Michal Simek
2022-10-05 2:09 ` Ramon Fried
2022-07-13 13:52 ` [PATCH 3/3] net: emaclite: fix handling for IP packets with specific lengths Samuel Obuch
2022-08-06 17:35 ` Ramon Fried
2022-08-08 7:54 ` Michal Simek
2022-08-08 8:08 ` net: emaclite: Fixes, enable driver for other archs Michal Simek
2022-08-08 8:33 ` Samuel Obuch
2022-09-19 7:31 ` 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='CALXH3=Lac9SrfedGUKYD0aq+iONXR-z_RtQ1d0hThqXro-qkUw@mail.gmail.com' \
--to=jan.remes@codasip.com \
--cc=michal.simek@amd.com \
--cc=rfried.dev@gmail.com \
--cc=samuel.obuch@codasip.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;
as well as URLs for NNTP newsgroup(s).