]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drivers/soc/litex: separate MMIO from subregister offset calculation
authorGabriel Somlo <gsomlo@gmail.com>
Tue, 12 Jan 2021 17:31:41 +0000 (12:31 -0500)
committerStafford Horne <shorne@gmail.com>
Thu, 14 Jan 2021 00:52:54 +0000 (09:52 +0900)
Separate MMIO (read/write) access into _[read|write]_litex_subregister()
static inline functions, leaving existing "READ|WRITE" macros to handle
calculation of the subregister offset only.

NOTE: this is a non-functional change.

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
Signed-off-by: Stafford Horne <shorne@gmail.com>
include/linux/litex.h

index 67c1a18a74252aa1bffccfb1bdb084be4e0f4669..918bab45243cae16c7048c5f8eec2679d7468761 100644 (file)
 #define LITEX_SUBREG_SIZE      0x1
 #define LITEX_SUBREG_SIZE_BIT   (LITEX_SUBREG_SIZE * 8)
 
+static inline void _write_litex_subregister(u32 val, void __iomem *addr)
+{
+       writel((u32 __force)cpu_to_le32(val), addr);
+}
+
+static inline u32 _read_litex_subregister(void __iomem *addr)
+{
+       return le32_to_cpu((__le32 __force)readl(addr));
+}
+
 #define WRITE_LITEX_SUBREGISTER(val, base_offset, subreg_id) \
-       writel((u32 __force)cpu_to_le32(val), base_offset + (LITEX_REG_SIZE * subreg_id))
+       _write_litex_subregister(val, (base_offset) + \
+                                       LITEX_REG_SIZE * (subreg_id))
 
 #define READ_LITEX_SUBREGISTER(base_offset, subreg_id) \
-       le32_to_cpu((__le32 __force)readl(base_offset + (LITEX_REG_SIZE * subreg_id)))
+       _read_litex_subregister((base_offset) + \
+                                       LITEX_REG_SIZE * (subreg_id))
 
 /*
  * LiteX SoC Generator, depending on the configuration, can split a single