From: Bjorn Andersson <quic_bjorande@quicinc.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
"Felipe Balbi" <balbi@kernel.org>,
Wesley Cheng <quic_wcheng@quicinc.com>,
"Saravana Kannan" <saravanak@google.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
"Konrad Dybcio" <konrad.dybcio@linaro.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH v2 4/7] usb: dwc3: core: Expose core driver as library
Date: Mon, 19 Aug 2024 14:14:41 -0700 [thread overview]
Message-ID: <ZsO1wbXSpaMk4ZMB@hu-bjorande-lv.qualcomm.com> (raw)
In-Reply-To: <20240814005638.dy4k545n7cwkdzkv@synopsys.com>
On Wed, Aug 14, 2024 at 12:56:44AM +0000, Thinh Nguyen wrote:
> On Sun, Aug 11, 2024, Bjorn Andersson wrote:
> > From: Bjorn Andersson <quic_bjorande@quicinc.com>
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
[..]
> > @@ -2076,10 +2077,11 @@ static int dwc3_get_num_ports(struct dwc3 *dwc)
> > return 0;
> > }
> >
> > -static int dwc3_probe(struct platform_device *pdev)
> > +struct dwc3 *dwc3_probe(struct platform_device *pdev, struct resource *res,
> > + bool ignore_clocks_and_resets, void *glue)
>
> Perhaps create a wrapper struct to hold the parameters above. I can see
> we may expand this in the future.
>
Sounds good.
There are a few cases where e.g. the Qualcomm glue needs to react to
role switching in the core, so we already know that we want to add some
callbacks here.
> > {
> > struct device *dev = &pdev->dev;
> > - struct resource *res, dwc_res;
> > + struct resource dwc_res;
> > unsigned int hw_mode;
> > void __iomem *regs;
> > struct dwc3 *dwc;
> > @@ -2087,15 +2089,10 @@ static int dwc3_probe(struct platform_device *pdev)
> >
> > dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
> > if (!dwc)
> > - return -ENOMEM;
> > + return ERR_PTR(-ENOMEM);
> >
> > dwc->dev = dev;
> > -
> > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > - if (!res) {
> > - dev_err(dev, "missing memory resource\n");
> > - return -ENODEV;
> > - }
> > + dwc->glue = glue;
> >
> > dwc->xhci_resources[0].start = res->start;
> > dwc->xhci_resources[0].end = dwc->xhci_resources[0].start +
> > @@ -2123,7 +2120,7 @@ static int dwc3_probe(struct platform_device *pdev)
> >
> > regs = devm_ioremap_resource(dev, &dwc_res);
> > if (IS_ERR(regs))
> > - return PTR_ERR(regs);
> > + return ERR_CAST(regs);
> >
> > dwc->regs = regs;
> > dwc->regs_size = resource_size(&dwc_res);
> > @@ -2132,15 +2129,17 @@ static int dwc3_probe(struct platform_device *pdev)
> >
> > dwc3_get_software_properties(dwc);
> >
> > - dwc->reset = devm_reset_control_array_get_optional_shared(dev);
> > - if (IS_ERR(dwc->reset)) {
> > - ret = PTR_ERR(dwc->reset);
> > - goto err_put_psy;
> > - }
> > + if (!ignore_clocks_and_resets) {
>
> This seems to be specific change for your platform. Let's keep this
> change separated from this patch.
>
The primary need here is that the glue code needs to be able to access
the hardware before the core's resume and after suspend. I'd expect
other glue implementations will have the same need.
But moving this change to a separate change allows us to reason about
that separately, so I like the suggestion.
Thanks,
Bjorn
> Thanks,
> Thinh
>
next prev parent reply other threads:[~2024-08-19 21:14 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-12 3:11 [PATCH v2 0/7] usb: dwc3: qcom: Flatten dwc3 structure Bjorn Andersson
2024-08-12 3:11 ` [PATCH v2 1/7] dt-bindings: usb: snps,dwc3: Split core description Bjorn Andersson
2024-08-18 14:33 ` Rob Herring
2024-08-12 3:11 ` [PATCH v2 2/7] dt-bindings: usb: Introduce qcom,snps-dwc3 Bjorn Andersson
2024-08-12 4:32 ` Rob Herring (Arm)
2024-08-12 3:12 ` [PATCH v2 3/7] of: dynamic: Don't discard children upon node attach Bjorn Andersson
2024-08-12 20:24 ` Rob Herring
2024-08-12 21:21 ` Bjorn Andersson
2024-08-12 3:12 ` [PATCH v2 4/7] usb: dwc3: core: Expose core driver as library Bjorn Andersson
2024-08-12 12:21 ` kernel test robot
2024-08-12 19:00 ` Bjorn Andersson
2024-08-12 12:21 ` kernel test robot
2024-08-13 18:15 ` Frank Li
2024-08-14 1:01 ` Thinh Nguyen
2024-08-19 21:35 ` Bjorn Andersson
2024-08-14 0:56 ` Thinh Nguyen
2024-08-19 21:14 ` Bjorn Andersson [this message]
2024-08-19 17:48 ` Krishna Kurapati
2024-08-19 21:36 ` Bjorn Andersson
2024-09-12 22:21 ` Masahiro Yamada
2024-09-13 2:34 ` Bjorn Andersson
2024-08-12 3:12 ` [PATCH v2 5/7] usb: dwc3: qcom: Don't reply on drvdata during probe Bjorn Andersson
2024-08-13 18:18 ` Frank Li
2024-08-19 21:17 ` Bjorn Andersson
2024-09-12 22:21 ` Masahiro Yamada
2024-08-12 3:12 ` [PATCH v2 6/7] usb: dwc3: qcom: Transition to flattened model Bjorn Andersson
2024-08-12 13:33 ` kernel test robot
2024-08-12 21:21 ` Rob Herring
2024-08-12 22:16 ` Bjorn Andersson
2024-08-13 15:06 ` Rob Herring
2024-08-13 18:33 ` Frank Li
2024-08-19 21:28 ` Bjorn Andersson
2024-08-12 3:12 ` [PATCH v2 7/7] arm64: dts: qcom: sc8280x: Flatten the USB nodes Bjorn Andersson
2024-08-13 18:07 ` [PATCH v2 0/7] usb: dwc3: qcom: Flatten dwc3 structure Frank Li
2024-10-08 20:09 ` Frank Li
2024-10-09 2:54 ` Bjorn Andersson
2025-01-10 16:55 ` 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=ZsO1wbXSpaMk4ZMB@hu-bjorande-lv.qualcomm.com \
--to=quic_bjorande@quicinc.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=andersson@kernel.org \
--cc=balbi@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_wcheng@quicinc.com \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
/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®