linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh: landisk: Add missing initialization of sh_io_port_base
@ 2020-08-14 12:42 Geert Uytterhoeven
  2020-08-14 13:37 ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2020-08-14 12:42 UTC (permalink / raw)
  To: linux-sh

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(+)

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);
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sh: landisk: Add missing initialization of sh_io_port_base
  2020-08-14 12:42 [PATCH] sh: landisk: Add missing initialization of sh_io_port_base Geert Uytterhoeven
@ 2020-08-14 13:37 ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 2+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-08-14 13:37 UTC (permalink / raw)
  To: linux-sh

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

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-14 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14 12:42 [PATCH] sh: landisk: Add missing initialization of sh_io_port_base Geert Uytterhoeven
2020-08-14 13:37 ` John Paul Adrian Glaubitz

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).