summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnup Patel <[email protected]>2023-07-21 13:39:57 +0530
committerAnup Patel <[email protected]>2023-07-31 14:09:10 +0530
commit8e97275d97bbfb9b990a5e7beafe99bea0e3f538 (patch)
treeda406041af54a250f93a87638961019740a1dd8c /include
parent14a35b0e0e8ceaeb664c5078d6a1fec9e7193c72 (diff)
lib: utils/regmap: Add simple FDT based regmap framework
We add a simple FDT based regmap framework which is built on top of generic regmap library. The phandle of FDT regmap DT node is treated as unique regmap ID. The FDT based regmap drivers will be probed on-demand from fdt_regmap_get_by_phandle() and fdt_regmap_get() called by the regmap client drivers. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Xiang W <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sbi_utils/regmap/fdt_regmap.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/sbi_utils/regmap/fdt_regmap.h b/include/sbi_utils/regmap/fdt_regmap.h
new file mode 100644
index 00000000..0672162c
--- /dev/null
+++ b/include/sbi_utils/regmap/fdt_regmap.h
@@ -0,0 +1,31 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2023 Ventana Micro Systems Inc.
+ *
+ * Authors:
+ * Anup Patel <[email protected]>
+ */
+
+#ifndef __FDT_REGMAP_H__
+#define __FDT_REGMAP_H__
+
+#include <sbi_utils/regmap/regmap.h>
+
+struct fdt_phandle_args;
+
+/** FDT based regmap driver */
+struct fdt_regmap {
+ const struct fdt_match *match_table;
+ int (*init)(void *fdt, int nodeoff, u32 phandle,
+ const struct fdt_match *match);
+};
+
+/** Get regmap instance based on phandle */
+int fdt_regmap_get_by_phandle(void *fdt, u32 phandle,
+ struct regmap **out_rmap);
+
+/** Get regmap instance based on "regmap' property of the specified DT node */
+int fdt_regmap_get(void *fdt, int nodeoff, struct regmap **out_rmap);
+
+#endif