summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorGuEe-GUI <[email protected]>2024-10-31 19:33:15 +0800
committerRbb666 <[email protected]>2024-11-20 15:53:23 +0800
commit10cac76d3bfc86fda251013c5573c146836762e7 (patch)
treefdb34e5a9102d92d7db672fd0a25e2d1b67320e7 /components/drivers/include
parentf5aca55a26f2f9f092267e3cd67da3cef2c87a6a (diff)
[DM/FEATURE] Support MFD syscon
MFD (Multifunction device) with System Controller Register Read/Write. Signed-off-by: GuEe-GUI <[email protected]>
Diffstat (limited to 'components/drivers/include')
-rwxr-xr-xcomponents/drivers/include/drivers/syscon.h35
-rw-r--r--components/drivers/include/rtdevice.h4
2 files changed, 39 insertions, 0 deletions
diff --git a/components/drivers/include/drivers/syscon.h b/components/drivers/include/drivers/syscon.h
new file mode 100755
index 0000000000..15bb98b6a2
--- /dev/null
+++ b/components/drivers/include/drivers/syscon.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-25 GuEe-GUI the first version
+ */
+
+#ifndef __SYSCON_H__
+#define __SYSCON_H__
+
+#include <drivers/ofw.h>
+
+struct rt_syscon
+{
+ rt_list_t list;
+
+ struct rt_ofw_node *np;
+
+ void *iomem_base;
+ rt_size_t iomem_size;
+ struct rt_spinlock rw_lock;
+};
+
+rt_err_t rt_syscon_read(struct rt_syscon *syscon, rt_off_t offset, rt_uint32_t *out_val);
+rt_err_t rt_syscon_write(struct rt_syscon *syscon, rt_off_t offset, rt_uint32_t val);
+rt_err_t rt_syscon_update_bits(struct rt_syscon *syscon, rt_off_t offset, rt_uint32_t mask, rt_uint32_t val);
+
+struct rt_syscon *rt_syscon_find_by_ofw_node(struct rt_ofw_node *np);
+struct rt_syscon *rt_syscon_find_by_ofw_compatible(const char *compatible);
+struct rt_syscon *rt_syscon_find_by_ofw_phandle(struct rt_ofw_node *np, const char *propname);
+
+#endif /* __SYSCON_H__ */
diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h
index a9a8515b7f..2a30d8f0d5 100644
--- a/components/drivers/include/rtdevice.h
+++ b/components/drivers/include/rtdevice.h
@@ -56,6 +56,10 @@ extern "C" {
#ifdef RT_USING_PIC
#include "drivers/pic.h"
#endif
+
+#ifdef RT_MFD_SYSCON
+#include "drivers/syscon.h"
+#endif
#endif /* RT_USING_DM */
#ifdef RT_USING_RTC