lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251016094812.739-1-caohang@eswincomputing.com>
Date: Thu, 16 Oct 2025 17:48:12 +0800
From: caohang@...incomputing.com
To: gregkh@...uxfoundation.org,
	robh@...nel.org,
	krzk+dt@...nel.org,
	conor+dt@...nel.org,
	Thinh.Nguyen@...opsys.com,
	p.zabel@...gutronix.de,
	linux-kernel@...r.kernel.org,
	linux-usb@...r.kernel.org,
	devicetree@...r.kernel.org
Cc: ningyu@...incomputing.com,
	linmin@...incomputing.com,
	pinkesh.vaghela@...fochips.com,
	Hang Cao <caohang@...incomputing.com>,
	Senchuan Zhang <zhangsenchuan@...incomputing.com>
Subject: [PATCH] usb: dwc3: eic7700: Add EIC7700 USB driver

From: Hang Cao <caohang@...incomputing.com>

Add the eic7700 usb driver, which is responsible for
identifying,configuring and connecting usb devices.

Signed-off-by: Senchuan Zhang <zhangsenchuan@...incomputing.com>
Signed-off-by: Hang Cao <caohang@...incomputing.com>
---
 drivers/usb/dwc3/dwc3-generic-plat.c | 58 ++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
index d96b20570002..98448bc434a5 100644
--- a/drivers/usb/dwc3/dwc3-generic-plat.c
+++ b/drivers/usb/dwc3/dwc3-generic-plat.c
@@ -10,8 +10,16 @@
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
 #include "glue.h"
 
+#define EIC7700_HSP_BUS_FILTER_EN	BIT(0)
+#define EIC7700_HSP_BUS_CLKEN_GM	BIT(9)
+#define EIC7700_HSP_BUS_CLKEN_GS	BIT(16)
+#define EIC7700_HSP_AXI_LP_XM_CSYSREQ	BIT(0)
+#define EIC7700_HSP_AXI_LP_XS_CSYSREQ	BIT(16)
+
 struct dwc3_generic {
 	struct device		*dev;
 	struct dwc3		dwc;
@@ -20,8 +28,41 @@ struct dwc3_generic {
 	struct reset_control	*resets;
 };
 
+struct dwc3_generic_match_data {
+	int (*init_ops)(struct device *dev);
+};
+
 #define to_dwc3_generic(d) container_of((d), struct dwc3_generic, dwc)
 
+static int eic7700_dwc3_bus_init(struct device *dev)
+{
+	struct regmap *regmap;
+	u32 hsp_usb_axi_lp;
+	u32 hsp_usb_bus;
+	u32 args[2];
+	u32 val;
+
+	regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node,
+						      "eswin,hsp-sp-csr",
+						      ARRAY_SIZE(args), args);
+	if (IS_ERR(regmap)) {
+		dev_err(dev, "No hsp-sp-csr phandle specified\n");
+		return PTR_ERR(regmap);
+	}
+
+	hsp_usb_bus       = args[0];
+	hsp_usb_axi_lp    = args[1];
+
+	regmap_read(regmap, hsp_usb_bus, &val);
+	regmap_write(regmap, hsp_usb_bus, val | EIC7700_HSP_BUS_FILTER_EN |
+		     EIC7700_HSP_BUS_CLKEN_GM | EIC7700_HSP_BUS_CLKEN_GS);
+
+	regmap_write(regmap, hsp_usb_axi_lp, EIC7700_HSP_AXI_LP_XM_CSYSREQ |
+		     EIC7700_HSP_AXI_LP_XS_CSYSREQ);
+
+	return 0;
+}
+
 static void dwc3_generic_reset_control_assert(void *data)
 {
 	reset_control_assert(data);
@@ -29,6 +70,7 @@ static void dwc3_generic_reset_control_assert(void *data)
 
 static int dwc3_generic_probe(struct platform_device *pdev)
 {
+	const struct dwc3_generic_match_data *data;
 	struct dwc3_probe_data probe_data = {};
 	struct device *dev = &pdev->dev;
 	struct dwc3_generic *dwc3g;
@@ -75,6 +117,14 @@ static int dwc3_generic_probe(struct platform_device *pdev)
 	probe_data.dwc = &dwc3g->dwc;
 	probe_data.res = res;
 	probe_data.ignore_clocks_and_resets = true;
+
+	data = of_device_get_match_data(dev);
+	if (data && data->init_ops) {
+		ret = data->init_ops(dev);
+		if (ret < 0)
+			return dev_err_probe(dev, ret, "failed to init ops\n");
+	}
+
 	ret = dwc3_core_probe(&probe_data);
 	if (ret)
 		return dev_err_probe(dev, ret, "failed to register DWC3 Core\n");
@@ -139,6 +189,10 @@ static int dwc3_generic_runtime_idle(struct device *dev)
 	return dwc3_runtime_idle(dev_get_drvdata(dev));
 }
 
+static const struct dwc3_generic_match_data eic7700_dwc3_data = {
+	.init_ops = eic7700_dwc3_bus_init,
+};
+
 static const struct dev_pm_ops dwc3_generic_dev_pm_ops = {
 	SYSTEM_SLEEP_PM_OPS(dwc3_generic_suspend, dwc3_generic_resume)
 	RUNTIME_PM_OPS(dwc3_generic_runtime_suspend, dwc3_generic_runtime_resume,
@@ -147,6 +201,10 @@ static const struct dev_pm_ops dwc3_generic_dev_pm_ops = {
 
 static const struct of_device_id dwc3_generic_of_match[] = {
 	{ .compatible = "spacemit,k1-dwc3", },
+	{
+		.compatible = "eswin,eic7700-dwc3",
+		.data = &eic7700_dwc3_data,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, dwc3_generic_of_match);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ