From: Frank Li <Frank.Li@nxp.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Shawn Guo <shawnguo@kernel.org>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
bjorn.andersson@oss.qualcomm.com, Frank Li <Frank.Li@nxp.com>
Subject: [PATCH 2/3] usb: dwc3: add layerscape dwc3 support
Date: Mon, 02 Jun 2025 18:01:02 -0400 [thread overview]
Message-ID: <20250602-ls_dma_coherence-v1-2-c67484d6ab64@nxp.com> (raw)
In-Reply-To: <20250602-ls_dma_coherence-v1-0-c67484d6ab64@nxp.com>
Add layerscape dwc3 support by using flatten dwc3 core library. Layerscape
dwc3 need set software managed property snps,gsbuscfg0-reqinfo as 0x2222
when dma-coherence set.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/usb/dwc3/Kconfig | 10 +++++
drivers/usb/dwc3/Makefile | 1 +
drivers/usb/dwc3/dwc3-layerscape.c | 88 ++++++++++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+)
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 310d182e10b50..13a86cf03b94b 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -150,6 +150,16 @@ config USB_DWC3_IMX8MP
functionality.
Say 'Y' or 'M' if you have one such device.
+config USB_DWC3_LAYERSCAPE
+ tristate "NXP Layerscape Platform"
+ depends on OF && COMMON_CLK
+ depends on ARCH_LAYERSCAPE || COMPILE_TEST
+ default USB_DWC3
+ help
+ NXP LAYERSCAPE SoC use DesignWare Core IP for USB2/3
+ functionality.
+ Say 'Y' or 'M' if you have one such device.
+
config USB_DWC3_XILINX
tristate "Xilinx Platforms"
depends on (ARCH_ZYNQMP || COMPILE_TEST) && OF
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 830e6c9e5fe07..cd635b77902fb 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_USB_DWC3_ST) += dwc3-st.o
obj-$(CONFIG_USB_DWC3_QCOM) += dwc3-qcom.o
obj-$(CONFIG_USB_DWC3_QCOM) += dwc3-qcom-legacy.o
obj-$(CONFIG_USB_DWC3_IMX8MP) += dwc3-imx8mp.o
+obj-$(CONFIG_USB_DWC3_LAYERSCAPE) += dwc3-layerscape.o
obj-$(CONFIG_USB_DWC3_XILINX) += dwc3-xilinx.o
obj-$(CONFIG_USB_DWC3_OCTEON) += dwc3-octeon.o
obj-$(CONFIG_USB_DWC3_RTK) += dwc3-rtk.o
diff --git a/drivers/usb/dwc3/dwc3-layerscape.c b/drivers/usb/dwc3/dwc3-layerscape.c
new file mode 100644
index 0000000000000..d093f178e1e35
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-layerscape.c
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020 NXP
+ */
+
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/usb/of.h>
+
+#include "core.h"
+#include "glue.h"
+
+struct dwc3_ls {
+ struct device *dev;
+ struct dwc3 dwc;
+};
+
+static int dwc3_ls_probe(struct platform_device *pdev)
+{
+ struct device_node *np = pdev->dev.of_node;
+ struct dwc3_probe_data probe_data = {};
+ struct property_entry props[2] = {};
+ struct device *dev = &pdev->dev;
+ struct resource *res;
+ struct dwc3_ls *ls;
+ int prop_idx = 0;
+ int ret = 0;
+
+ ls = devm_kzalloc(&pdev->dev, sizeof(*ls), GFP_KERNEL);
+ if (!ls)
+ return -ENOMEM;
+
+ ls->dev = &pdev->dev;
+
+ ls->dwc.dev = dev;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ dev_err_probe(&pdev->dev, -ENODEV, "missing memory resource\n");
+
+ if (of_dma_is_coherent(np))
+ props[prop_idx++] = PROPERTY_ENTRY_U16("snps,gsbuscfg0-reqinfo", 0x2222);
+
+ if (prop_idx)
+ ret = device_create_managed_software_node(dev, props, NULL);
+
+ if (ret)
+ return dev_err_probe(dev, ret, "fail create software managed property node\n");
+
+ probe_data.dwc = &ls->dwc;
+ probe_data.res = res;
+ ret = dwc3_core_probe(&probe_data);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register DWC3 Core\n");
+
+ return 0;
+}
+
+static void dwc3_ls_remove(struct platform_device *pdev)
+{
+ struct dwc3 *dwc = platform_get_drvdata(pdev);
+
+ dwc3_core_remove(dwc);
+}
+
+static const struct of_device_id of_dwc3_ls_match[] = {
+ {
+ .compatible = "fsl,ls1028a-dwc3"
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, of_dwc3_ls_match);
+
+static struct platform_driver dwc3_ls_driver = {
+ .probe = dwc3_ls_probe,
+ .remove = dwc3_ls_remove,
+ .driver = {
+ .name = "ls-dwc3",
+ .of_match_table = of_dwc3_ls_match,
+ },
+};
+
+module_platform_driver(dwc3_ls_driver);
+
+MODULE_AUTHOR("Frank Li <frank.li@nxp.com>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Freescale Layerscape USB3 Controller Driver");
--
2.34.1
next prev parent reply other threads:[~2025-06-02 22:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 22:01 [PATCH 0/3] usb: dwc3: add layerscape platform driver use flatten dwc3 core Frank Li
2025-06-02 22:01 ` [PATCH 1/3] dt-bindings: usb: add missed compatible string for arm64 layerscape Frank Li
2025-06-25 18:38 ` Rob Herring (Arm)
2025-06-02 22:01 ` Frank Li [this message]
2025-06-03 1:23 ` [PATCH 2/3] usb: dwc3: add layerscape dwc3 support Thinh Nguyen
2025-06-03 14:59 ` Frank Li
2025-06-05 0:20 ` Thinh Nguyen
2025-09-19 21:17 ` Thinh Nguyen
2025-09-19 22:20 ` Frank Li
2025-06-02 22:01 ` [PATCH 3/3] arm64: dts: layerscape: add dma-coherent for usb node Frank Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250602-ls_dma_coherence-v1-2-c67484d6ab64@nxp.com \
--to=frank.li@nxp.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=robh@kernel.org \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®