Re: [PATCH v2 2/3] m68k: mmu: fix IO access endianness for ColdFire family

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert,

thanks for catching issues.

On Wed, Feb 28, 2018 at 10:59:38AM +0100, Geert Uytterhoeven wrote:
Hi Angelo,

On Tue, Feb 27, 2018 at 3:45 PM, Angelo Dureghello <angelo@xxxxxxxx> wrote:
This patch fixes IO access endianness, that should be big endian.
If any little endian peripheral may be connected, bytes should
be swapped in hardware.

Thanks for your patch!

In general, {read,write}[wl]() are meant for PCI IO memory access, and thus
intended to be little endian.... May vary on some systems, though.


Ok, i thought there was a reason but couldn't realize that.
Btw, with mmu enabled, SPI (and likely other drivers) regmap reads and writes
end up to same io_mm.h read,write[wl].

Yes, I/O macros are a mess.

---
Changes from v1:
- patch split into 3

Signed-off-by: Angelo Dureghello <angelo@xxxxxxxx>
---
 arch/m68k/include/asm/io_mm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index ed5333e87879..5ee6d7729dad 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -444,13 +444,13 @@ static inline void isa_delay(void)
  */
 #define readb(addr)      in_8(addr)
 #define writeb(val,addr) out_8((addr),(val))
-#define readw(addr)      in_le16(addr)
-#define writew(val,addr) out_le16((addr),(val))
+#define readw(addr)      in_be16(addr)
+#define writew(val,addr) out_be16((addr),(val))

The above two affect non-ISA and non-Atari ROM-port ISA systems.
So that indeed includes your Coldfire system (M54415?).


Yes. ColdFire enters that ifdef. 

BTW, is it correct none of the M5441x SoCs have PCI?

Good catch.
I don't see any PCI interface in mcf5441x, but MCF547x has PCI bus.

Else, enabling CONFIG_PCI will select a completely different set of
I/O macros at the top of arch/m68k/include/asm/io_mm.h.

 #endif /* !CONFIG_ISA && !CONFIG_ATARI_ROM_ISA */

-#define readl(addr)      in_le32(addr)
-#define writel(val,addr) out_le32((addr),(val))
+#define readl(addr)      in_be32(addr)
+#define writel(val,addr) out_be32((addr),(val))

The above two affect _all_ m68k platforms, hence changing them could
introduce regressions.


Ok, big issue so.

Since i cannot test anything else than mcf5441x now, i would isolate
32 bit(and also 16) IO accesses to be big endian for mcf5441x by proper
ifdefs. 

Yes, I/O macros are a mess...

Gr{oetje,eeting}s,

                        Geert


Regards,
Angelo

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux