 +	if (IS_ERR_OR_NULL(soc_ctrl_dev->base))
 +		return -EIO;
 +
-+	return litex_soc_ctrl_check_endianness(soc_ctrl_dev->base);
++	return litex_check_csr_access(soc_ctrl_dev->base);
 +}
 +
 +static int litex_soc_ctrl_remove(struct platform_device *pdev)

+#define LITEX_SUBREG_SIZE          0x1
+#define LITEX_SUBREG_SIZE_BIT      (LITEX_SUBREG_SIZE * 8)
+
+// pointers to read and write functions
+// set in soc controller driver
+//
+// note: or1k and vexriscv kernels use different CONFIG_GENERIC_IOMAP
+//	setting and it changes the definition of io{read,write}32
+//	functions so we are checking here to use correct definition
+#ifndef CONFIG_GENERIC_IOMAP
+extern unsigned int (*litex_read_reg)(const volatile void __iomem *addr);
+extern void (*litex_write_reg)(u32 val, volatile void __iomem *addr);
+#else
+extern unsigned int (*litex_read_reg)(void __iomem *addr);
+extern void (*litex_write_reg)(u32 val, void __iomem *addr);
+#endif
+
+// function implemented in
+// drivers/soc/litex/litex_soc_controller.c
+// to check if accessors are ready to use
+// returns true if yes - false if not
+//
+// Important: all drivers that use functions from this header
+// must check at the beginning of their probe()
+// if litex_read_reg and litex_write_reg are initialized
+// and return -EPROBE_DEFER when they are not
+//
+// example:
+// if (!litex_check_accessors())
+//	return -EPROBE_DEFER;
+int litex_check_accessors(void);
+
+// Helper functions for manipulating LiteX registers
+static inline void litex_set_reg(void __iomem *reg, u32 reg_size, u32 val)

index 000000000000..ddae454b52e5
--- /dev/null
+++ b/include/linux/litex.h
@@ -0,0 +1,70 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_LITEX_H
+#define _LINUX_LITEX_H
