From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: "Martin Fäcknitz" <faecknitz@hotsplots.de>
Cc: mhi@lists.linux.dev, paul.davey@alliedtelesis.co.nz
Subject: Re: MHI MMIO endian issue
Date: Wed, 1 May 2024 12:25:04 +0530 [thread overview]
Message-ID: <20240501065504.GA1979@thinkpad> (raw)
In-Reply-To: <ZjFjEe0-tJ6un10J@dev2>
+ Paul Davey
On Tue, Apr 30, 2024 at 11:30:57PM +0200, Martin Fäcknitz wrote:
> Hello,
>
> the function mhi_init_mmio configures MMIO registers using the reg_info
> table:
>
> eg_info[] = {
> {
> CCABAP_HIGHER,
> upper_32_bits(mhi_cntrl->mhi_ctxt->chan_ctxt_addr),
> },
> ...
>
> mhi_write_reg(mhi_cntrl, base, reg_info[i].offset,
> reg_info[i].val);
>
> However, the values are in host byte orders, not in device byte order. I
> have a PPC64 system which is big endian, but the device is little
> endian. Without wrapping each value in eg_info using cpu_to_le32 the
> device (sdx55) doesn't response:
>
> cpu_to_le32(upper_32_bits(mhi_cntrl->mhi_ctxt->chan_ctxt_addr))
>
> Hard to believe i am the first one which has this issue? Let me know if
> i should make a patch.
>
You are not the first one to try MHI on a big endian machine. Paul did that a
while ago and fixed some issues w.r.t endianess [1]. But I'm wondering how Paul
didn't hit the issue that you are seeing.
Anyway, I think the fix is to modify mhi_{read/write}_reg to accept '__le32'
for the 'val' parameter and fix all the callers.
I can cook a patch if needed, but won't be able to do so for atleast 2-3 weeks.
- Mani
[1] https://lore.kernel.org/mhi/20220212182117.49438-3-manivannan.sadhasivam@linaro.org/
> --
> Martin Fäcknitz
>
> hotsplots GmbH
> Rotherstr. 22
> 10245 Berlin
> Fon: +49 (0)30 29 77 348-0
> Fax: +49 (0)30 29 77 348-99
> E-Mail: faecknitz@hotsplots.de
>
> Amtsgericht Charlottenburg HRB 93460B
> Geschäftsführung: Dipl. Ing. Sascha Schaub
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-05-01 6:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 21:30 MHI MMIO endian issue Martin Fäcknitz
2024-05-01 0:44 ` Mayank Rana
2024-05-01 6:55 ` Manivannan Sadhasivam [this message]
2024-05-10 0:54 ` Paul Davey
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=20240501065504.GA1979@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=faecknitz@hotsplots.de \
--cc=mhi@lists.linux.dev \
--cc=paul.davey@alliedtelesis.co.nz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.