[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aNTAjk1zsWF5lm3p@lizhi-Precision-Tower-5810>
Date: Thu, 25 Sep 2025 00:09:50 -0400
From: Frank Li <Frank.li@....com>
To: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
Cc: 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>,
Ze Huang <huang.ze@...ux.dev>
Subject: Re: [PATCH v2 2/3] usb: dwc3: dwc3-generic-plat: add layerscape dwc3
support
On Wed, Sep 24, 2025 at 10:13:36PM +0000, Thinh Nguyen wrote:
> On Tue, Sep 23, 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/dwc3-generic-plat.c | 30 +++++++++++++++++++++++++++++-
> > 1 file changed, 29 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
> > index d96b20570002dc619ea813f4d6a8013636a0f346..d886b6e557b12edda71203e4f640a9a0a53b4f35 100644
> > --- a/drivers/usb/dwc3/dwc3-generic-plat.c
> > +++ b/drivers/usb/dwc3/dwc3-generic-plat.c
> > @@ -8,10 +8,15 @@
> > */
> >
> > #include <linux/clk.h>
> > +#include <linux/of_address.h>
> > #include <linux/platform_device.h>
> > #include <linux/reset.h>
> > #include "glue.h"
> >
> > +struct dwc3_generic_drvdata {
> > + u32 gsbuscfg0;
>
> Are we going to overwrite the entire register or just the REQINFO
> fields? The "snps,gsbuscfg0-reqinfo" property only updates the reqinfo
> of GSBUSCFG0. Perhaps rename this?
Yes
>
> > +};
> > +
> > struct dwc3_generic {
> > struct device *dev;
> > struct dwc3 dwc;
> > @@ -29,6 +34,7 @@ static void dwc3_generic_reset_control_assert(void *data)
> >
> > static int dwc3_generic_probe(struct platform_device *pdev)
> > {
> > + const struct dwc3_generic_drvdata *drvdata;
> > struct dwc3_probe_data probe_data = {};
> > struct device *dev = &pdev->dev;
> > struct dwc3_generic *dwc3g;
> > @@ -41,6 +47,8 @@ static int dwc3_generic_probe(struct platform_device *pdev)
> >
> > dwc3g->dev = dev;
> >
> > + drvdata = of_device_get_match_data(dev);
> > +
> > res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > if (!res) {
> > dev_err(&pdev->dev, "missing memory resource\n");
> > @@ -70,6 +78,17 @@ static int dwc3_generic_probe(struct platform_device *pdev)
> > if (ret < 0)
> > return dev_err_probe(dev, ret, "failed to get clocks\n");
> >
> > + if (of_dma_is_coherent(pdev->dev.of_node)) {
> > + struct property_entry props[2] = {};
> > +
> > + props[0] = PROPERTY_ENTRY_U16("snps,gsbuscfg0-reqinfo", drvdata->gsbuscfg0);
> > +
> > + ret = device_create_managed_software_node(dev, props, NULL);
> > + if (ret)
> > + return dev_err_probe(dev, ret,
> > + "fail create software managed property node\n");
> > + }
> > +
> > dwc3g->num_clocks = ret;
> > dwc3g->dwc.dev = dev;
> > probe_data.dwc = &dwc3g->dwc;
> > @@ -145,8 +164,17 @@ static const struct dev_pm_ops dwc3_generic_dev_pm_ops = {
> > dwc3_generic_runtime_idle)
> > };
> >
> > +static const struct dwc3_generic_drvdata spacemit_k1_dwc3 = {
> > + .gsbuscfg0 = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED,
>
> Why do we need to do this?
because is 0 valildate setting for cfg0_regqinfo.
Avoid add new flags like REGINFO_VALDATE in drvdata. dwc3 will use default
value if reginfo is DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED.
of cousre, if you like add bool b_usebuscfg0 in drvdata, I am also fine.
Frank
>
> > +};
> > +
> > +static const struct dwc3_generic_drvdata fsl_ls1028_dwc3 = {
> > + .gsbuscfg0 = 0x2222,
> > +};
> > +
> > static const struct of_device_id dwc3_generic_of_match[] = {
> > - { .compatible = "spacemit,k1-dwc3", },
> > + { .compatible = "spacemit,k1-dwc3", &spacemit_k1_dwc3},
> > + { .compatible = "fsl,ls1028a-dwc3", &fsl_ls1028_dwc3},
> > { /* sentinel */ }
> > };
> > MODULE_DEVICE_TABLE(of, dwc3_generic_of_match);
> >
> > --
> > 2.34.1
> >
>
> Thanks,
> Thinh
Powered by blists - more mailing lists