summaryrefslogtreecommitdiff
path: root/drivers/misc/qcom-geni-se.c
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vladimir.zapolskiy@linaro.org>2023-04-21 20:50:33 +0300
committerTom Rini <trini@konsulko.com>2023-05-02 14:23:58 -0400
commit1b15483deb3f6e6975cdd13652a9b5ed2c81c42f (patch)
treec50637a8bbcef10181e49e4cf5bb7413e01726d6 /drivers/misc/qcom-geni-se.c
parent6f63c296fe9ee79316e787c1f9952d501645aa03 (diff)
misc: add Qualcomm GENI SE QUP device driver
This change adds a Qualcomm GENI SE QUP device driver as a wrapper for actually enabled and used serial devices found on a board. At the moment the driver is pretty simple, its intention is to populate childred devices and provide I/O mem read interface to them as clients, this is needed for GENI UART driver to set up a proper clock divider and provide the actually asked baud rate. Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Diffstat (limited to 'drivers/misc/qcom-geni-se.c')
-rw-r--r--drivers/misc/qcom-geni-se.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/misc/qcom-geni-se.c b/drivers/misc/qcom-geni-se.c
new file mode 100644
index 00000000000..281a5ec819a
--- /dev/null
+++ b/drivers/misc/qcom-geni-se.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Qualcomm Generic Interface (GENI) Serial Engine (SE) Wrapper
+ *
+ * Copyright (C) 2023 Linaro Ltd. <vladimir.zapolskiy@linaro.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <misc.h>
+#include <asm/io.h>
+
+static int geni_se_qup_read(struct udevice *dev, int offset,
+ void *buf, int size)
+{
+ fdt_addr_t base = dev_read_addr(dev);
+
+ if (size != sizeof(u32))
+ return -EINVAL;
+
+ *(u32 *)buf = readl(base + offset);
+
+ return size;
+}
+
+static struct misc_ops geni_se_qup_ops = {
+ .read = geni_se_qup_read,
+};
+
+static const struct udevice_id geni_se_qup_ids[] = {
+ { .compatible = "qcom,geni-se-qup" },
+ {}
+};
+
+U_BOOT_DRIVER(geni_se_qup) = {
+ .name = "geni_se_qup",
+ .id = UCLASS_MISC,
+ .of_match = geni_se_qup_ids,
+ .ops = &geni_se_qup_ops,
+ .flags = DM_FLAG_PRE_RELOC,
+};