This series is a set of picked up acks and split from larger series [1]
The series is rebased on top of:
Repo: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
Branch: usb-testing
commit 03cf2af41b37 ("Revert "phy: qcom-qmp-usb: Add Qualcomm SDX75 USB3 PHY support"")
The patches present in series have been reviewed and acked by respective
maintainers. They dont break any existing implementation and is just a
subset of merge ready multiport code. The rest of the patches will be
rebased on top of the usb branch once this series is merged.
[1]: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
Krishna Kurapati (3):
usb: dwc3: core: Access XHCI address space temporarily to read port
info
usb: dwc3: core: Skip setting event buffers for host only controllers
usb: dwc3: qcom: Add helper function to request threaded IRQ
drivers/usb/dwc3/core.c | 74 ++++++++++++++++++++++++++++++++++++
drivers/usb/dwc3/core.h | 5 +++
drivers/usb/dwc3/dwc3-qcom.c | 59 +++++++++++++---------------
3 files changed, 105 insertions(+), 33 deletions(-)
--
2.42.0
Cleanup setup irq call by implementing a new prep_irq helper function
and using it to request threaded IRQ's.
Signed-off-by: Krishna Kurapati <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
---
drivers/usb/dwc3/dwc3-qcom.c | 59 ++++++++++++++++--------------------
1 file changed, 26 insertions(+), 33 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 3de43df6bbe8..ef2006db7601 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -535,6 +535,24 @@ static int dwc3_qcom_get_irq(struct platform_device *pdev,
return ret;
}
+static int dwc3_qcom_prep_irq(struct dwc3_qcom *qcom, char *irq_name,
+ char *disp_name, int irq)
+{
+ int ret;
+
+ /* Keep wakeup interrupts disabled until suspend */
+ irq_set_status_flags(irq, IRQ_NOAUTOEN);
+ ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
+ qcom_dwc3_resume_irq,
+ IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ disp_name, qcom);
+
+ if (ret)
+ dev_err(qcom->dev, "%s failed: %d\n", irq_name, ret);
+
+ return ret;
+}
+
static int dwc3_qcom_setup_irq(struct platform_device *pdev)
{
struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
@@ -545,61 +563,36 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
irq = dwc3_qcom_get_irq(pdev, "hs_phy_irq",
pdata ? pdata->hs_phy_irq_index : -1);
if (irq > 0) {
- /* Keep wakeup interrupts disabled until suspend */
- irq_set_status_flags(irq, IRQ_NOAUTOEN);
- ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
- qcom_dwc3_resume_irq,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "qcom_dwc3 HS", qcom);
- if (ret) {
- dev_err(qcom->dev, "hs_phy_irq failed: %d\n", ret);
+ ret = dwc3_qcom_prep_irq(qcom, "hs_phy_irq", "qcom_dwc3 HS", irq);
+ if (ret)
return ret;
- }
qcom->hs_phy_irq = irq;
}
irq = dwc3_qcom_get_irq(pdev, "dp_hs_phy_irq",
pdata ? pdata->dp_hs_phy_irq_index : -1);
if (irq > 0) {
- irq_set_status_flags(irq, IRQ_NOAUTOEN);
- ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
- qcom_dwc3_resume_irq,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "qcom_dwc3 DP_HS", qcom);
- if (ret) {
- dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret);
+ ret = dwc3_qcom_prep_irq(qcom, "dp_hs_phy_irq", "qcom_dwc3 DP_HS", irq);
+ if (ret)
return ret;
- }
qcom->dp_hs_phy_irq = irq;
}
irq = dwc3_qcom_get_irq(pdev, "dm_hs_phy_irq",
pdata ? pdata->dm_hs_phy_irq_index : -1);
if (irq > 0) {
- irq_set_status_flags(irq, IRQ_NOAUTOEN);
- ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
- qcom_dwc3_resume_irq,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "qcom_dwc3 DM_HS", qcom);
- if (ret) {
- dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret);
+ ret = dwc3_qcom_prep_irq(qcom, "dm_hs_phy_irq", "qcom_dwc3 DM_HS", irq);
+ if (ret)
return ret;
- }
qcom->dm_hs_phy_irq = irq;
}
irq = dwc3_qcom_get_irq(pdev, "ss_phy_irq",
pdata ? pdata->ss_phy_irq_index : -1);
if (irq > 0) {
- irq_set_status_flags(irq, IRQ_NOAUTOEN);
- ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
- qcom_dwc3_resume_irq,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "qcom_dwc3 SS", qcom);
- if (ret) {
- dev_err(qcom->dev, "ss_phy_irq failed: %d\n", ret);
+ ret = dwc3_qcom_prep_irq(qcom, "ss_phy_irq", "qcom_dwc3 SS", irq);
+ if (ret)
return ret;
- }
qcom->ss_phy_irq = irq;
}
--
2.42.0
On some SoC's like SA8295P where the tertiary controller is host-only
capable, GEVTADDRHI/LO, GEVTSIZ, GEVTCOUNT registers are not accessible.
Trying to access them leads to a crash.
For DRD/Peripheral supported controllers, event buffer setup is done
again in gadget_pullup. Skip setup or cleanup of event buffers if
controller is host-only capable.
Suggested-by: Johan Hovold <[email protected]>
Signed-off-by: Krishna Kurapati <[email protected]>
Acked-by: Thinh Nguyen <[email protected]>
---
drivers/usb/dwc3/core.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index d7c5669ebd06..3e507e4cc542 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -486,6 +486,13 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)
static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length)
{
struct dwc3_event_buffer *evt;
+ unsigned int hw_mode;
+
+ hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0);
+ if (hw_mode == DWC3_GHWPARAMS0_MODE_HOST) {
+ dwc->ev_buf = NULL;
+ return 0;
+ }
evt = dwc3_alloc_one_event_buffer(dwc, length);
if (IS_ERR(evt)) {
@@ -507,6 +514,9 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc)
{
struct dwc3_event_buffer *evt;
+ if (!dwc->ev_buf)
+ return 0;
+
evt = dwc->ev_buf;
evt->lpos = 0;
dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0),
@@ -524,6 +534,9 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc)
{
struct dwc3_event_buffer *evt;
+ if (!dwc->ev_buf)
+ return;
+
evt = dwc->ev_buf;
evt->lpos = 0;
--
2.42.0
On 10/5/2023 12:06 PM, Johan Hovold wrote:
> On Wed, Oct 04, 2023 at 10:29:19PM +0530, Krishna Kurapati wrote:
>> This series is a set of picked up acks and split from larger series [1]
>> The series is rebased on top of:
>> Repo: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
>> Branch: usb-testing
>> commit 03cf2af41b37 ("Revert "phy: qcom-qmp-usb: Add Qualcomm SDX75 USB3 PHY support"")
>>
>> The patches present in series have been reviewed and acked by respective
>> maintainers. They dont break any existing implementation and is just a
>> subset of merge ready multiport code. The rest of the patches will be
>> rebased on top of the usb branch once this series is merged.
>>
>> [1]: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
>>
>> Krishna Kurapati (3):
>> usb: dwc3: core: Access XHCI address space temporarily to read port
>> info
>> usb: dwc3: core: Skip setting event buffers for host only controllers
>> usb: dwc3: qcom: Add helper function to request threaded IRQ
>
> NAK.
>
> These patches make very little sense on their own and can't really be
> evaluated without the context of the larger series.
>
> Just work on getting the multiport series in shape and include any acks
> you've received so far when submitting new revisions.
>
Hi Johan,
This may be partially true for first patch of this series, (where we
read num_ports), but the other two patches are self explanatory and are
applicable for non-mp controllers as well. Intention was to ensure we
make the next rebase easy.
Will try to address all comments and send v12 again as a whole series
this week. I am actually blocked on [1]. Not able to repro the compile
error on my end. That's what stopped me from sending all at once.
[1]: https://lore.kernel.org/all/[email protected]/
Thanks,
Krishna,
On 10/5/2023 12:06 PM, Johan Hovold wrote:
> On Wed, Oct 04, 2023 at 10:29:19PM +0530, Krishna Kurapati wrote:
>> This series is a set of picked up acks and split from larger series [1]
>> The series is rebased on top of:
>> Repo: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
>> Branch: usb-testing
>> commit 03cf2af41b37 ("Revert "phy: qcom-qmp-usb: Add Qualcomm SDX75 USB3 PHY support"")
>>
>> The patches present in series have been reviewed and acked by respective
>> maintainers. They dont break any existing implementation and is just a
>> subset of merge ready multiport code. The rest of the patches will be
>> rebased on top of the usb branch once this series is merged.
>>
>> [1]: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
>>
>> Krishna Kurapati (3):
>> usb: dwc3: core: Access XHCI address space temporarily to read port
>> info
>> usb: dwc3: core: Skip setting event buffers for host only controllers
>> usb: dwc3: qcom: Add helper function to request threaded IRQ
>
> NAK.
>
> These patches make very little sense on their own and can't really be
> evaluated without the context of the larger series.
>
> Just work on getting the multiport series in shape and include any acks
> you've received so far when submitting new revisions
Hi Johan,
This may be partially true for first patch of this series, (where we
read num_ports), but the other two patches are self explanatory and are
applicable for non-mp controllers as well. Intention was to ensure we
make the next rebase easy.
Will try to address all comments and send v12 again as a whole series
this week. I am actually blocked on [1]. Not able to repro the compile
error on my end. That's what stopped me from sending all at once.
[1]: https://lore.kernel.org/all/[email protected]/
PS: I sent this mail once but some issue with my mail client and the
mail didn't reach the mailing list. If two copies of same mail comes up,
pls ignore it.
Thanks,
Krishna,
On Wed, Oct 04, 2023 at 10:29:19PM +0530, Krishna Kurapati wrote:
> This series is a set of picked up acks and split from larger series [1]
> The series is rebased on top of:
> Repo: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
> Branch: usb-testing
> commit 03cf2af41b37 ("Revert "phy: qcom-qmp-usb: Add Qualcomm SDX75 USB3 PHY support"")
>
> The patches present in series have been reviewed and acked by respective
> maintainers. They dont break any existing implementation and is just a
> subset of merge ready multiport code. The rest of the patches will be
> rebased on top of the usb branch once this series is merged.
>
> [1]: https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/
>
> Krishna Kurapati (3):
> usb: dwc3: core: Access XHCI address space temporarily to read port
> info
> usb: dwc3: core: Skip setting event buffers for host only controllers
> usb: dwc3: qcom: Add helper function to request threaded IRQ
NAK.
These patches make very little sense on their own and can't really be
evaluated without the context of the larger series.
Just work on getting the multiport series in shape and include any acks
you've received so far when submitting new revisions.
Johan
On Thu, Oct 05, 2023 at 02:32:54PM +0530, Krishna Kurapati PSSNV wrote:
> On 10/5/2023 12:06 PM, Johan Hovold wrote:
> > On Wed, Oct 04, 2023 at 10:29:19PM +0530, Krishna Kurapati wrote:
> >> Krishna Kurapati (3):
> >> usb: dwc3: core: Access XHCI address space temporarily to read port
> >> info
> >> usb: dwc3: core: Skip setting event buffers for host only controllers
> >> usb: dwc3: qcom: Add helper function to request threaded IRQ
> >
> > NAK.
> >
> > These patches make very little sense on their own and can't really be
> > evaluated without the context of the larger series.
> >
> > Just work on getting the multiport series in shape and include any acks
> > you've received so far when submitting new revisions.
> This may be partially true for first patch of this series, (where we
> read num_ports), but the other two patches are self explanatory and are
> applicable for non-mp controllers as well. Intention was to ensure we
> make the next rebase easy.
No, just send the whole series at once.
> Will try to address all comments and send v12 again as a whole series
> this week. I am actually blocked on [1]. Not able to repro the compile
> error on my end. That's what stopped me from sending all at once.
Looks like your buffer is too small for a u8 index. Should be easy to
fix.
Johan
> [1]: https://lore.kernel.org/all/[email protected]/