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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250605002011.d3qmst57d5zwtuow@synopsys.com>
Date: Thu, 5 Jun 2025 00:20:15 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Frank Li <Frank.li@....com>
CC: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Rob Herring <robh@...nel.org>,
        Krzysztof Kozlowski <krzk+dt@...nel.org>,
        Conor Dooley <conor+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
        "bjorn.andersson@....qualcomm.com" <bjorn.andersson@....qualcomm.com>
Subject: Re: [PATCH 2/3] usb: dwc3: add layerscape dwc3 support

On Tue, Jun 03, 2025, Frank Li wrote:
> On Tue, Jun 03, 2025 at 01:23:03AM +0000, Thinh Nguyen wrote:
> > Hi,
> >
> > On Mon, Jun 02, 2025, Frank Li wrote:
> > > 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@....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@....com>");
> > > +MODULE_LICENSE("GPL");
> > > +MODULE_DESCRIPTION("Freescale Layerscape USB3 Controller Driver");
> > >
> > > --
> > > 2.34.1
> > >
> >
> > Is this something that can be enhanced in dwc3-generic-plat glue from Ze
> > Huang:
> 
> Yes, I can base on Zehuang's work with little modify. Please let me know
> when his patch merged.
> 

Sure thing.

BR,
Thinh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ