diff mbox series

[064/120] MIPS: PS2: IOP: Permit /dev/mem to access IOP memory

Message ID 63369b9b67d63891d34e854ca9110da78415d19b.1567326213.git.noring@nocrew.org (mailing list archive)
State RFC
Headers show
Series Linux for the PlayStation 2 | expand

Commit Message

Fredrik Noring Sept. 1, 2019, 4:03 p.m. UTC
Signed-off-by: Fredrik Noring <noring@nocrew.org>
---
 arch/mips/include/asm/mach-ps2/iop.h | 21 +++++++++++++++++++++
 arch/mips/ps2/memory.c               |  2 ++
 2 files changed, 23 insertions(+)
 create mode 100644 arch/mips/include/asm/mach-ps2/iop.h
diff mbox series

Patch

diff --git a/arch/mips/include/asm/mach-ps2/iop.h b/arch/mips/include/asm/mach-ps2/iop.h
new file mode 100644
index 000000000000..65585451e743
--- /dev/null
+++ b/arch/mips/include/asm/mach-ps2/iop.h
@@ -0,0 +1,21 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PlayStation 2 input/output processor (IOP)
+ *
+ * Copyright (C) 2019 Fredrik Noring
+ */
+
+#ifndef __ASM_MACH_PS2_IOP_H
+#define __ASM_MACH_PS2_IOP_H
+
+#define IOP_RAM_BASE	0x1c000000
+#define IOP_RAM_SIZE	0x200000
+
+#define IOP_OHCI_BASE	0x1f801600
+
+/**
+ * iop_addr_t - I/O processor (IOP) bus address
+ */
+typedef u32 iop_addr_t;
+
+#endif /* __ASM_MACH_PS2_IOP_H */
diff --git a/arch/mips/ps2/memory.c b/arch/mips/ps2/memory.c
index c513b6912bb0..51614b6d0515 100644
--- a/arch/mips/ps2/memory.c
+++ b/arch/mips/ps2/memory.c
@@ -13,11 +13,13 @@ 
 #include <asm/bootinfo.h>
 #include <asm/io.h>
 
+#include <asm/mach-ps2/iop.h>
 #include <asm/mach-ps2/rom.h>
 
 int valid_phys_addr_range(phys_addr_t addr, size_t size)
 {
 	return addr + size <= __pa(high_memory) ||
+	       (IOP_RAM_BASE <= addr && addr + size <= IOP_RAM_BASE + IOP_RAM_SIZE) ||
 	       (ROM0_BASE <= addr && addr + size <= ROM0_BASE + ROM0_SIZE) ||
 	       (ROM1_BASE <= addr && addr + size <= ROM1_BASE + ROM1_SIZE);
 }