LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix Dreamcast GAPS PCI bridge
@ 2024-05-11 19:16 Artur Rojek
  2024-05-11 19:16 ` [PATCH 1/1] sh: dreamcast: Fix GAPS PCI bridge addressing Artur Rojek
  0 siblings, 1 reply; 3+ messages in thread
From: Artur Rojek @ 2024-05-11 19:16 UTC (permalink / raw
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
	Paul Cercueil
  Cc: linux-sh, linux-kernel, Artur Rojek

Hi all,

this patch fixes the G2-to-PCI bridge found in the SEGA Dreamcast
hardware, by setting the appropriate IOPORT base offset.

While being just a simple change, it's notable to mention that, when
combined with the DMAC fixes from e82e47584847, it allows Linux to boot
on the SEGA Dreamcast again, probably for the first time in a long
while.

Artur Rojek (1):
  sh: dreamcast: Fix GAPS PCI bridge addressing

 arch/sh/Kconfig                       | 3 ++-
 arch/sh/boards/mach-dreamcast/setup.c | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.45.0


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

* [PATCH 1/1] sh: dreamcast: Fix GAPS PCI bridge addressing
  2024-05-11 19:16 [PATCH 0/1] Fix Dreamcast GAPS PCI bridge Artur Rojek
@ 2024-05-11 19:16 ` Artur Rojek
  2024-05-11 19:30   ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 3+ messages in thread
From: Artur Rojek @ 2024-05-11 19:16 UTC (permalink / raw
  To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
	Paul Cercueil
  Cc: linux-sh, linux-kernel, Artur Rojek

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 = {
-- 
2.45.0


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

* Re: [PATCH 1/1] sh: dreamcast: Fix GAPS PCI bridge addressing
  2024-05-11 19:16 ` [PATCH 1/1] sh: dreamcast: Fix GAPS PCI bridge addressing Artur Rojek
@ 2024-05-11 19:30   ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 3+ messages in thread
From: John Paul Adrian Glaubitz @ 2024-05-11 19:30 UTC (permalink / raw
  To: Artur Rojek, Yoshinori Sato, Rich Felker, Paul Cercueil
  Cc: linux-sh, linux-kernel

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

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

end of thread, other threads:[~2024-05-11 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-11 19:16 [PATCH 0/1] Fix Dreamcast GAPS PCI bridge Artur Rojek
2024-05-11 19:16 ` [PATCH 1/1] sh: dreamcast: Fix GAPS PCI bridge addressing Artur Rojek
2024-05-11 19:30   ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).