diff mbox series

sh: landisk: Add missing initialization of sh_io_port_base

Message ID 20200814124245.29692-1-geert+renesas@glider.be
State New
Headers show
Series sh: landisk: Add missing initialization of sh_io_port_base | expand

Commit Message

Geert Uytterhoeven Aug. 14, 2020, 12:42 p.m. UTC
The Landisk setup code maps the CF IDE area using ioremap_prot(), and
passes the resulting virtual addresses to the pata_platform driver,
disguising them as I/O port addresses.  Hence the pata_platform driver
translates them again using ioport_map().
As CONFIG_GENERIC_IOMAP=n, and CONFIG_HAS_IOPORT_MAP=y, the
SuperH-specific mapping code in arch/sh/kernel/ioport.c translates
I/O port addresses to virtual addresses by adding sh_io_port_base, which
defaults to -1, thus breaking the assumption of an identity mapping.

Fix this by setting sh_io_port_base to zero.

Fixes: 37b7a97884ba64bf ("sh: machvec IO death.")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Tested on USL-5P, using either
CONFIG_ATA/CONFIG_ATA_SFF/CONFIG_PATA_PLATFORM, or legacy
CONFIG_IDE/CONFIG_BLK_DEV_PLATFORM.

Sato-san: As you said IDE works fine on Landisk using
	  CONFIG_BLK_DEV_AEC62XX, I assume you have a different model
	  than the USL-5P, with PCI IDE?
---
 arch/sh/boards/mach-landisk/setup.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

John Paul Adrian Glaubitz Aug. 14, 2020, 1:37 p.m. UTC | #1
Hi Geert!

On 8/14/20 2:42 PM, Geert Uytterhoeven wrote:
> The Landisk setup code maps the CF IDE area using ioremap_prot(), and
> passes the resulting virtual addresses to the pata_platform driver,
> disguising them as I/O port addresses.  Hence the pata_platform driver
> translates them again using ioport_map().
> As CONFIG_GENERIC_IOMAP=n, and CONFIG_HAS_IOPORT_MAP=y, the
> SuperH-specific mapping code in arch/sh/kernel/ioport.c translates
> I/O port addresses to virtual addresses by adding sh_io_port_base, which
> defaults to -1, thus breaking the assumption of an identity mapping.
> 
> Fix this by setting sh_io_port_base to zero.
> 
> Fixes: 37b7a97884ba64bf ("sh: machvec IO death.")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Wow, that was fast :-).

> ---
> Tested on USL-5P, using either
> CONFIG_ATA/CONFIG_ATA_SFF/CONFIG_PATA_PLATFORM, or legacy
> CONFIG_IDE/CONFIG_BLK_DEV_PLATFORM.
> 
> Sato-san: As you said IDE works fine on Landisk using
> 	  CONFIG_BLK_DEV_AEC62XX, I assume you have a different model
> 	  than the USL-5P, with PCI IDE?
I think Yoshinori is using one which has the HDD built in [1] and not the
USL-5P boards which are for external USB disks only.

I also got one of the models with an HDD built in, but I have never tried
to install Linux on it yet.

Adrian

> [1] https://www.iodata.jp/lib/product/h/1049.htm
diff mbox series

Patch

diff --git a/arch/sh/boards/mach-landisk/setup.c b/arch/sh/boards/mach-landisk/setup.c
index 16b4d8b0bb8503d9..2c44b94f82fb2740 100644
--- a/arch/sh/boards/mach-landisk/setup.c
+++ b/arch/sh/boards/mach-landisk/setup.c
@@ -82,6 +82,9 @@  device_initcall(landisk_devices_setup);
 
 static void __init landisk_setup(char **cmdline_p)
 {
+	/* I/O port identity mapping */
+	__set_io_port_base(0);
+
 	/* LED ON */
 	__raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);