]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
soc: sophgo: sg2044: Add support for SG2044 TOP syscon device
authorInochi Amaoto <inochiama@gmail.com>
Fri, 18 Apr 2025 02:03:21 +0000 (10:03 +0800)
committerInochi Amaoto <inochiama@gmail.com>
Tue, 6 May 2025 23:48:34 +0000 (07:48 +0800)
The SG2044 TOP device provide PLL clock function in its area.
Add a mfd definition for it.

Link: https://lore.kernel.org/r/20250418020325.421257-3-inochiama@gmail.com
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn>
drivers/soc/Kconfig
drivers/soc/Makefile
drivers/soc/sophgo/Kconfig [new file with mode: 0644]
drivers/soc/sophgo/Makefile [new file with mode: 0644]
drivers/soc/sophgo/sg2044-topsys.c [new file with mode: 0644]

index 6a8daeb8c4b96cd29d56343b338a423140b89896..11e2383c065465de9fff68c6fd5df1e82627ba5f 100644 (file)
@@ -23,6 +23,7 @@ source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/renesas/Kconfig"
 source "drivers/soc/rockchip/Kconfig"
 source "drivers/soc/samsung/Kconfig"
+source "drivers/soc/sophgo/Kconfig"
 source "drivers/soc/sunxi/Kconfig"
 source "drivers/soc/tegra/Kconfig"
 source "drivers/soc/ti/Kconfig"
index 2037a8695cb2898659a434803dcdfa2d95b1dbd6..0381a0abdec82deebc83bd60efe5ff13fd14ff37 100644 (file)
@@ -29,6 +29,7 @@ obj-y                         += qcom/
 obj-y                          += renesas/
 obj-y                          += rockchip/
 obj-$(CONFIG_SOC_SAMSUNG)      += samsung/
+obj-y                          += sophgo/
 obj-y                          += sunxi/
 obj-$(CONFIG_ARCH_TEGRA)       += tegra/
 obj-y                          += ti/
diff --git a/drivers/soc/sophgo/Kconfig b/drivers/soc/sophgo/Kconfig
new file mode 100644 (file)
index 0000000..d97de4a
--- /dev/null
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Sophgo SoC drivers
+#
+
+if ARCH_SOPHGO || COMPILE_TEST
+menu "Sophgo SoC drivers"
+
+config SOPHGO_SG2044_TOPSYS
+       tristate "Sophgo SG2044 TOP syscon driver"
+       select MFD_CORE
+       help
+         This is the core driver for the Sophgo SG2044 TOP system
+         controller device. This driver provide PLL clock device
+         for the SoC.
+
+         This driver can also be built as a module.  If so, the module
+         will be called sg2044-topsys.
+
+endmenu
+endif
diff --git a/drivers/soc/sophgo/Makefile b/drivers/soc/sophgo/Makefile
new file mode 100644 (file)
index 0000000..171a292
--- /dev/null
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_SOPHGO_SG2044_TOPSYS)     += sg2044-topsys.o
diff --git a/drivers/soc/sophgo/sg2044-topsys.c b/drivers/soc/sophgo/sg2044-topsys.c
new file mode 100644 (file)
index 0000000..179f262
--- /dev/null
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Sophgo SG2044 multi-function system controller driver
+ *
+ * Copyright (C) 2025 Inochi Amaoto <inochiama@gmail.com>
+ */
+
+#include <linux/mfd/core.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/property.h>
+#include <linux/resource.h>
+
+static const struct mfd_cell sg2044_topsys_subdev[] = {
+       {
+               .name = "sg2044-pll",
+       },
+};
+
+static int sg2044_topsys_probe(struct platform_device *pdev)
+{
+       return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
+                                   sg2044_topsys_subdev,
+                                   ARRAY_SIZE(sg2044_topsys_subdev),
+                                   NULL, 0, NULL);
+}
+
+static const struct of_device_id sg2044_topsys_of_match[] = {
+       { .compatible = "sophgo,sg2044-top-syscon" },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sg2044_topsys_of_match);
+
+static struct platform_driver sg2044_topsys_driver = {
+       .probe = sg2044_topsys_probe,
+       .driver = {
+               .name = "sg2044-topsys",
+               .of_match_table = sg2044_topsys_of_match,
+       },
+};
+module_platform_driver(sg2044_topsys_driver);
+
+MODULE_AUTHOR("Inochi Amaoto <inochiama@gmail.com>");
+MODULE_DESCRIPTION("Sophgo SG2044 multi-function system controller driver");
+MODULE_LICENSE("GPL");