[rtems-libbsd commit] regulator: Add to build.
Christian Mauderer
christianm at rtems.org
Wed Apr 15 15:11:43 UTC 2020
Module: rtems-libbsd
Branch: master
Commit: e518d8c72cee8ae2bda245be5381c88d1a9e1e2e
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=e518d8c72cee8ae2bda245be5381c88d1a9e1e2e
Author: Christian Mauderer <christian.mauderer at embedded-brains.de>
Date: Thu Feb 13 10:56:26 2020 +0100
regulator: Add to build.
Update #3869.
---
Makefile.todo | 26 +++++++
buildset/default.ini | 1 +
libbsd.py | 30 ++++++++
rtemsbsd/include/bsp/nexus-devices.h | 3 +
rtemsbsd/include/rtems/bsd/local/regdev_if.h | 36 +++++++++
rtemsbsd/include/rtems/bsd/local/regnode_if.h | 107 ++++++++++++++++++++++++++
rtemsbsd/local/regdev_if.c | 27 +++++++
rtemsbsd/local/regnode_if.c | 52 +++++++++++++
8 files changed, 282 insertions(+)
diff --git a/Makefile.todo b/Makefile.todo
index 80d582c..6822e81 100644
--- a/Makefile.todo
+++ b/Makefile.todo
@@ -55,6 +55,10 @@ GENERATED += $(LOCAL_INC)/hdmi_if.h
GENERATED += $(LOCAL_SRC)/hdmi_if.c
GENERATED += $(LOCAL_INC)/fb_if.h
GENERATED += $(LOCAL_SRC)/fb_if.c
+GENERATED += $(LOCAL_INC)/regdev_if.h
+GENERATED += $(LOCAL_SRC)/regdev_if.c
+GENERATED += $(LOCAL_INC)/regnode_if.h
+GENERATED += $(LOCAL_SRC)/regnode_if.c
GENERATED += rtemsbsd/include/machine/rtems-bsd-regdomain.h
GENERATED += rtemsbsd/rtems/rtems-bsd-regdomain.c
@@ -295,6 +299,28 @@ $(LOCAL_SRC)/gpio_if.c: $(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m
awk -f $(TOOLS)/makeobjops.awk $< -c
mv gpio_if.c $@
+$(LOCAL_INC)/regnode_if.h: $(FREEBSD_SRC)/sys/dev/extres/regulator/regnode_if.m
+ awk -f $(TOOLS)/makeobjops.awk $< -h
+ mv regnode_if.h $@
+
+$(LOCAL_SRC)/regnode_if.c: $(FREEBSD_SRC)/sys/dev/extres/regulator/regnode_if.m
+ awk -f $(TOOLS)/makeobjops.awk $< -c
+ sed -i regnode_if.c \
+ -e '1 i\#include <machine/rtems-bsd-kernel-space.h>\n' \
+ -e 's|#include "regnode_if.h"|#include <rtems/bsd/local/regnode_if.h>|'
+ mv regnode_if.c $@
+
+$(LOCAL_INC)/regdev_if.h: $(FREEBSD_SRC)/sys/dev/extres/regulator/regdev_if.m
+ awk -f $(TOOLS)/makeobjops.awk $< -h
+ mv regdev_if.h $@
+
+$(LOCAL_SRC)/regdev_if.c: $(FREEBSD_SRC)/sys/dev/extres/regulator/regdev_if.m
+ awk -f $(TOOLS)/makeobjops.awk $< -c
+ sed -i regdev_if.c \
+ -e '1 i\#include <machine/rtems-bsd-kernel-space.h>\n' \
+ -e 's|#include "regdev_if.h"|#include <rtems/bsd/local/regdev_if.h>|'
+ mv regdev_if.c $@
+
$(LOCAL_SRC)/rtwn-rtl8192cfwT.c: $(FREEBSD_SRC)/sys/contrib/dev/rtwn/rtwn-rtl8192cfwT.fw.uu
uudecode -o /dev/stdout $< | python firmware-gen.py \
-l "$(FREEBSD_SRC)/sys/contrib/dev/rtwn/LICENSE" \
diff --git a/buildset/default.ini b/buildset/default.ini
index 04d9952..741357f 100644
--- a/buildset/default.ini
+++ b/buildset/default.ini
@@ -57,6 +57,7 @@ nvme = on
opencrypto = on
pci = on
pf = on
+regulator = on
rtems = on
tests = on
tty = on
diff --git a/libbsd.py b/libbsd.py
index 2c25983..0673eb5 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -5205,6 +5205,35 @@ class imx(builder.Module):
mm.generator['source']()
)
+class regulator(builder.Module):
+ def __init__(self, manager):
+ super(regulator, self).__init__(manager, type(self).__name__)
+
+ def generate(self):
+ mm = self.manager
+ self.addRTEMSSourceFiles(
+ [
+ 'local/regdev_if.c',
+ 'local/regnode_if.c',
+ ],
+ mm.generator['source']()
+ )
+ self.addKernelSpaceHeaderFiles(
+ [
+ 'sys/dev/extres/regulator/regulator.h',
+ 'sys/dev/extres/regulator/regulator_fixed.h',
+ ]
+ )
+ self.addKernelSpaceSourceFiles(
+ [
+ 'sys/dev/extres/regulator/regulator.c',
+ 'sys/dev/extres/regulator/regulator_bus.c',
+ 'sys/dev/extres/regulator/regulator_fixed.c',
+ 'sys/dev/gpio/gpioregulator.c',
+ ],
+ mm.generator['source']()
+ )
+
#
# Tests
#
@@ -5365,6 +5394,7 @@ def load(mm):
mm.addModule(nvme(mm))
mm.addModule(imx(mm))
+ mm.addModule(regulator(mm))
# Add in_chksum
mm.addModule(in_cksum(mm))
diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
index 5b60cf2..d779ea5 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -145,6 +145,9 @@ SYSINIT_DRIVER_REFERENCE(imx51_gpio, simplebus);
SYSINIT_DRIVER_REFERENCE(sdhci_fsl, simplebus);
RTEMS_BSD_DRIVER_MMC;
+SYSINIT_DRIVER_REFERENCE(ofw_regulator_bus, simplebus);
+SYSINIT_DRIVER_REFERENCE(gpioregulator, simplebus);
+
#elif defined(LIBBSP_ARM_LPC24XX_BSP_H)
RTEMS_BSD_DEFINE_NEXUS_DEVICE(ohci, 0, 0, NULL);
diff --git a/rtemsbsd/include/rtems/bsd/local/regdev_if.h b/rtemsbsd/include/rtems/bsd/local/regdev_if.h
new file mode 100644
index 0000000..37bfe09
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/regdev_if.h
@@ -0,0 +1,36 @@
+/*
+ * This file is @generated automatically.
+ * Do not modify anything in here by hand.
+ *
+ * Created from source file
+ * freebsd-org/sys/dev/extres/regulator/regdev_if.m
+ * with
+ * makeobjops.awk
+ *
+ * See the source file for legal information
+ */
+
+
+#ifndef _regdev_if_h_
+#define _regdev_if_h_
+
+
+int regdev_default_ofw_map(device_t , phandle_t, int, pcell_t *, intptr_t *);
+
+/** @brief Unique descriptor for the REGDEV_MAP() method */
+extern struct kobjop_desc regdev_map_desc;
+/** @brief A function implementing the REGDEV_MAP() method */
+typedef int regdev_map_t(device_t provider_dev, phandle_t xref, int ncells,
+ pcell_t *cells, intptr_t *id);
+
+static __inline int REGDEV_MAP(device_t provider_dev, phandle_t xref,
+ int ncells, pcell_t *cells, intptr_t *id)
+{
+ kobjop_t _m;
+ int rc;
+ KOBJOPLOOKUP(((kobj_t)provider_dev)->ops,regdev_map);
+ rc = ((regdev_map_t *) _m)(provider_dev, xref, ncells, cells, id);
+ return (rc);
+}
+
+#endif /* _regdev_if_h_ */
diff --git a/rtemsbsd/include/rtems/bsd/local/regnode_if.h b/rtemsbsd/include/rtems/bsd/local/regnode_if.h
new file mode 100644
index 0000000..7e40deb
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/regnode_if.h
@@ -0,0 +1,107 @@
+/*
+ * This file is @generated automatically.
+ * Do not modify anything in here by hand.
+ *
+ * Created from source file
+ * freebsd-org/sys/dev/extres/regulator/regnode_if.m
+ * with
+ * makeobjops.awk
+ *
+ * See the source file for legal information
+ */
+
+
+#ifndef _regnode_if_h_
+#define _regnode_if_h_
+
+
+struct regnode;
+
+/** @brief Unique descriptor for the REGNODE_INIT() method */
+extern struct kobjop_desc regnode_init_desc;
+/** @brief A function implementing the REGNODE_INIT() method */
+typedef int regnode_init_t(struct regnode *regnode);
+
+static __inline int REGNODE_INIT(struct regnode *regnode)
+{
+ kobjop_t _m;
+ int rc;
+ KOBJOPLOOKUP(((kobj_t)regnode)->ops,regnode_init);
+ rc = ((regnode_init_t *) _m)(regnode);
+ return (rc);
+}
+
+/** @brief Unique descriptor for the REGNODE_ENABLE() method */
+extern struct kobjop_desc regnode_enable_desc;
+/** @brief A function implementing the REGNODE_ENABLE() method */
+typedef int regnode_enable_t(struct regnode *regnode, bool enable, int *udelay);
+
+static __inline int REGNODE_ENABLE(struct regnode *regnode, bool enable,
+ int *udelay)
+{
+ kobjop_t _m;
+ int rc;
+ KOBJOPLOOKUP(((kobj_t)regnode)->ops,regnode_enable);
+ rc = ((regnode_enable_t *) _m)(regnode, enable, udelay);
+ return (rc);
+}
+
+/** @brief Unique descriptor for the REGNODE_STATUS() method */
+extern struct kobjop_desc regnode_status_desc;
+/** @brief A function implementing the REGNODE_STATUS() method */
+typedef int regnode_status_t(struct regnode *regnode, int *status);
+
+static __inline int REGNODE_STATUS(struct regnode *regnode, int *status)
+{
+ kobjop_t _m;
+ int rc;
+ KOBJOPLOOKUP(((kobj_t)regnode)->ops,regnode_status);
+ rc = ((regnode_status_t *) _m)(regnode, status);
+ return (rc);
+}
+
+/** @brief Unique descriptor for the REGNODE_SET_VOLTAGE() method */
+extern struct kobjop_desc regnode_set_voltage_desc;
+/** @brief A function implementing the REGNODE_SET_VOLTAGE() method */
+typedef int regnode_set_voltage_t(struct regnode *regnode, int min_uvolt,
+ int max_uvolt, int *udelay);
+
+static __inline int REGNODE_SET_VOLTAGE(struct regnode *regnode, int min_uvolt,
+ int max_uvolt, int *udelay)
+{
+ kobjop_t _m;
+ int rc;
+ KOBJOPLOOKUP(((kobj_t)regnode)->ops,regnode_set_voltage);
+ rc = ((regnode_set_voltage_t *) _m)(regnode, min_uvolt, max_uvolt, udelay);
+ return (rc);
+}
+
+/** @brief Unique descriptor for the REGNODE_GET_VOLTAGE() method */
+extern struct kobjop_desc regnode_get_voltage_desc;
+/** @brief A function implementing the REGNODE_GET_VOLTAGE() method */
+typedef int regnode_get_voltage_t(struct regnode *regnode, int *uvolt);
+
+static __inline int REGNODE_GET_VOLTAGE(struct regnode *regnode, int *uvolt)
+{
+ kobjop_t _m;
+ int rc;
+ KOBJOPLOOKUP(((kobj_t)regnode)->ops,regnode_get_voltage);
+ rc = ((regnode_get_voltage_t *) _m)(regnode, uvolt);
+ return (rc);
+}
+
+/** @brief Unique descriptor for the REGNODE_STOP() method */
+extern struct kobjop_desc regnode_stop_desc;
+/** @brief A function implementing the REGNODE_STOP() method */
+typedef int regnode_stop_t(struct regnode *regnode, int *udelay);
+
+static __inline int REGNODE_STOP(struct regnode *regnode, int *udelay)
+{
+ kobjop_t _m;
+ int rc;
+ KOBJOPLOOKUP(((kobj_t)regnode)->ops,regnode_stop);
+ rc = ((regnode_stop_t *) _m)(regnode, udelay);
+ return (rc);
+}
+
+#endif /* _regnode_if_h_ */
diff --git a/rtemsbsd/local/regdev_if.c b/rtemsbsd/local/regdev_if.c
new file mode 100644
index 0000000..2a8f5fe
--- /dev/null
+++ b/rtemsbsd/local/regdev_if.c
@@ -0,0 +1,27 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
+/*
+ * This file is @generated automatically.
+ * Do not modify anything in here by hand.
+ *
+ * Created from source file
+ * freebsd-org/sys/dev/extres/regulator/regdev_if.m
+ * with
+ * makeobjops.awk
+ *
+ * See the source file for legal information
+ */
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/kernel.h>
+#include <sys/kobj.h>
+#include <sys/types.h>
+#include <dev/ofw/ofw_bus.h>
+#include <machine/bus.h>
+#include <rtems/bsd/local/regdev_if.h>
+
+struct kobjop_desc regdev_map_desc = {
+ 0, { ®dev_map_desc, (kobjop_t)regdev_default_ofw_map }
+};
+
diff --git a/rtemsbsd/local/regnode_if.c b/rtemsbsd/local/regnode_if.c
new file mode 100644
index 0000000..1be5aac
--- /dev/null
+++ b/rtemsbsd/local/regnode_if.c
@@ -0,0 +1,52 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
+/*
+ * This file is @generated automatically.
+ * Do not modify anything in here by hand.
+ *
+ * Created from source file
+ * freebsd-org/sys/dev/extres/regulator/regnode_if.m
+ * with
+ * makeobjops.awk
+ *
+ * See the source file for legal information
+ */
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/kernel.h>
+#include <sys/kobj.h>
+#include <rtems/bsd/local/regnode_if.h>
+
+
+static int
+regnode_default_stop(struct regnode *regnode, int *udelay)
+{
+
+ return(REGNODE_ENABLE(regnode, false, udelay));
+}
+
+struct kobjop_desc regnode_init_desc = {
+ 0, { ®node_init_desc, (kobjop_t)kobj_error_method }
+};
+
+struct kobjop_desc regnode_enable_desc = {
+ 0, { ®node_enable_desc, (kobjop_t)kobj_error_method }
+};
+
+struct kobjop_desc regnode_status_desc = {
+ 0, { ®node_status_desc, (kobjop_t)kobj_error_method }
+};
+
+struct kobjop_desc regnode_set_voltage_desc = {
+ 0, { ®node_set_voltage_desc, (kobjop_t)kobj_error_method }
+};
+
+struct kobjop_desc regnode_get_voltage_desc = {
+ 0, { ®node_get_voltage_desc, (kobjop_t)kobj_error_method }
+};
+
+struct kobjop_desc regnode_stop_desc = {
+ 0, { ®node_stop_desc, (kobjop_t)regnode_default_stop }
+};
+
More information about the vc
mailing list