diff mbox series

[1/1] sh: dreamcast: Fix GAPS PCI bridge addressing

Message ID 20240511191614.68561-2-contact@artur-rojek.eu (mailing list archive)
State New
Headers show
Series Fix Dreamcast GAPS PCI bridge | expand

Commit Message

Artur Rojek May 11, 2024, 7:16 p.m. UTC
The G2-to-PCI bridge chip found in SEGA Dreamcast assumes P2 area
relative addresses.

Set the appropriate IOPORT base offset.

Tested-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
---
 arch/sh/Kconfig                       | 3 ++-
 arch/sh/boards/mach-dreamcast/setup.c | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

John Paul Adrian Glaubitz May 11, 2024, 7:30 p.m. UTC | #1
Hi,

On Sat, 2024-05-11 at 21:16 +0200, Artur Rojek wrote:
> The G2-to-PCI bridge chip found in SEGA Dreamcast assumes P2 area
> relative addresses.
> 
> Set the appropriate IOPORT base offset.
> 
> Tested-by: Paul Cercueil <paul@crapouillou.net>
> Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
> ---
>  arch/sh/Kconfig                       | 3 ++-
>  arch/sh/boards/mach-dreamcast/setup.c | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 217bdc4d0201..f723e2256c9c 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -126,7 +126,8 @@ config ARCH_HAS_ILOG2_U64
>  
>  config NO_IOPORT_MAP
>  	def_bool !PCI
> -	depends on !SH_SHMIN && !SH_HP6XX && !SH_SOLUTION_ENGINE
> +	depends on !SH_SHMIN && !SH_HP6XX && !SH_SOLUTION_ENGINE && \
> +		   !SH_DREAMCAST
>  
>  config IO_TRAPPED
>  	bool
> diff --git a/arch/sh/boards/mach-dreamcast/setup.c b/arch/sh/boards/mach-dreamcast/setup.c
> index 2d966c1c2cc1..daa8455549fa 100644
> --- a/arch/sh/boards/mach-dreamcast/setup.c
> +++ b/arch/sh/boards/mach-dreamcast/setup.c
> @@ -25,10 +25,13 @@
>  #include <asm/irq.h>
>  #include <asm/rtc.h>
>  #include <asm/machvec.h>
> +#include <cpu/addrspace.h>
>  #include <mach/sysasic.h>
>  
>  static void __init dreamcast_setup(char **cmdline_p)
>  {
> +	/* GAPS PCI bridge assumes P2 area relative addresses. */
> +	__set_io_port_base(P2SEG);
>  }
>  
>  static struct sh_machine_vector mv_dreamcast __initmv = {

Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

Adrian
diff mbox series

Patch

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 217bdc4d0201..f723e2256c9c 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -126,7 +126,8 @@  config ARCH_HAS_ILOG2_U64
 
 config NO_IOPORT_MAP
 	def_bool !PCI
-	depends on !SH_SHMIN && !SH_HP6XX && !SH_SOLUTION_ENGINE
+	depends on !SH_SHMIN && !SH_HP6XX && !SH_SOLUTION_ENGINE && \
+		   !SH_DREAMCAST
 
 config IO_TRAPPED
 	bool
diff --git a/arch/sh/boards/mach-dreamcast/setup.c b/arch/sh/boards/mach-dreamcast/setup.c
index 2d966c1c2cc1..daa8455549fa 100644
--- a/arch/sh/boards/mach-dreamcast/setup.c
+++ b/arch/sh/boards/mach-dreamcast/setup.c
@@ -25,10 +25,13 @@ 
 #include <asm/irq.h>
 #include <asm/rtc.h>
 #include <asm/machvec.h>
+#include <cpu/addrspace.h>
 #include <mach/sysasic.h>
 
 static void __init dreamcast_setup(char **cmdline_p)
 {
+	/* GAPS PCI bridge assumes P2 area relative addresses. */
+	__set_io_port_base(P2SEG);
 }
 
 static struct sh_machine_vector mv_dreamcast __initmv = {