diff mbox series

[RFC,2/2] ARM: mstar: Add header with macros for XIU register access

Message ID 20210422140945.4131092-3-daniel@0x0f.com (mailing list archive)
State Changes Requested
Headers show
Series ARM: mstar: Internal bus madness | expand

Commit Message

Daniel Palmer April 22, 2021, 2:09 p.m. UTC
Registers connected to the CPU via "XIU" (Maybe eXtended Interface
Unit) are 32bits wide with a 64bit stride.

Apparently someone realised that splitting 32bit registers into
two 16bit ones was silly but at the same time didn't want to
fix all of the register offsets used for "RIU" in their code.

This means that any existing driver (i.e. the usb and ethernet)
cannot be used as is and needs to use a special readl()/writel()
to fix up the address of the register that needs to be accessed.

To avoid having this code in every driver add a header with an
implementation of readl()/writel() that patches over the insanity.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
 include/soc/mstar/xiu.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 include/soc/mstar/xiu.h
diff mbox series


diff --git a/include/soc/mstar/xiu.h b/include/soc/mstar/xiu.h
new file mode 100644
index 000000000000..d658338b8006
--- /dev/null
+++ b/include/soc/mstar/xiu.h
@@ -0,0 +1,22 @@ 
+/* SPDX-License-Identifier: GPL-2.0+ */
+#ifndef _SOC_MSTAR_XIU_H_
+#define _SOC_MSTAR_XIU_H_
+#include <linux/io.h>
+static inline u32 xiu_readl(__iomem void *base, unsigned int offset)
+	__iomem void *reg = base + (offset * 2);
+	return readl_relaxed(reg);
+static inline void xiu_writel(__iomem void *base, unsigned int offset, u32 value)
+	__iomem void *reg = base + (offset * 2);
+	writel_relaxed(value, reg);