new file mode 100644
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PlayStation 2 I/O processor (IOP) registers
+ *
+ * Copyright (C) 2017-2019 Fredrik Noring
+ */
+
+#ifndef __ASM_MACH_PS2_IOP_REGISTERS_H
+#define __ASM_MACH_PS2_IOP_REGISTERS_H
+
+#include <linux/types.h>
+
+#define IOP_DMA_DPCR2_OHCI 0x08000000 /* USB OHCI */
+#define IOP_DMA_DPCR2_DEV9 0x00000080 /* DEV9 (Expansion Bay, USB) */
+
+void iop_set_dma_dpcr2(const u32 mask);
+void iop_clr_dma_dpcr2(const u32 mask);
+
+#endif /* __ASM_MACH_PS2_IOP_REGISTERS_H */
new file mode 100644
@@ -0,0 +1 @@
+obj-m += iop-registers.o
new file mode 100644
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PlayStation 2 I/O processor (IOP) registers
+ *
+ * Copyright (C) 2019 Fredrik Noring
+ */
+
+#include <linux/module.h>
+#include <linux/spinlock.h>
+
+#include <asm/io.h>
+
+#include <asm/mach-ps2/iop-registers.h>
+
+#define IOP_DMA_DPCR2 0x1f801570
+
+static DEFINE_SPINLOCK(reg_lock);
+
+void iop_set_dma_dpcr2(const u32 mask)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(®_lock, flags);
+ outl(inl(IOP_DMA_DPCR2) | mask, IOP_DMA_DPCR2);
+ spin_unlock_irqrestore(®_lock, flags);
+}
+EXPORT_SYMBOL_GPL(iop_set_dma_dpcr2);
+
+void iop_clr_dma_dpcr2(const u32 mask)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(®_lock, flags);
+ outl(inl(IOP_DMA_DPCR2) & ~mask, IOP_DMA_DPCR2);
+ spin_unlock_irqrestore(®_lock, flags);
+}
+EXPORT_SYMBOL_GPL(iop_clr_dma_dpcr2);
+
+MODULE_LICENSE("GPL");
Signed-off-by: Fredrik Noring <noring@nocrew.org> --- The documentation for the DEV9 is rather poor, unfortunately. --- .../mips/include/asm/mach-ps2/iop-registers.h | 19 +++++++++ drivers/ps2/Makefile | 1 + drivers/ps2/iop-registers.c | 39 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 arch/mips/include/asm/mach-ps2/iop-registers.h create mode 100644 drivers/ps2/Makefile create mode 100644 drivers/ps2/iop-registers.c