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
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 <[email protected]>
Signed-off-by: Artur Rojek <[email protected]>
---
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
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 <[email protected]>
> Signed-off-by: Artur Rojek <[email protected]>
> ---
> 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 <[email protected]>
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913