Re: [PATCH] dma: cppi41: delete channel from pending list when stop channel
On 12-11-18, 09:43, Bin Liu wrote: > The driver defines three states for a cppi channel. > - idle: .chan_busy == 0 && not in .pending list > - pending: .chan_busy == 0 && in .pending list > - busy: .chan_busy == 1 && not in .pending list > > There are cases in which the cppi channel could be in the pending state > when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend() > is called. > > cppi41_stop_chan() has a bug for these cases to set channels to idle state. > It only checks the .chan_busy flag, but not the .pending list, then later > when cppi41_runtime_resume() is called the channels in .pending list will > be transitioned to busy state. > > Removing channels from the .pending list solves the problem. I would like some testing, given that intent is to go to stable. Peter..? > > Fixes: 975faaeb9985 ("dma: cppi41: start tear down only if channel is busy") > Cc: sta...@vger.kernel.org # v3.15+ > Signed-off-by: Bin Liu > --- > drivers/dma/ti/cppi41.c | 16 +++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c > index 1497da367710..e507ec36c0d3 100644 > --- a/drivers/dma/ti/cppi41.c > +++ b/drivers/dma/ti/cppi41.c > @@ -723,8 +723,22 @@ static int cppi41_stop_chan(struct dma_chan *chan) > > desc_phys = lower_32_bits(c->desc_phys); > desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc); > - if (!cdd->chan_busy[desc_num]) > + if (!cdd->chan_busy[desc_num]) { > + struct cppi41_channel *cc, *_ct; > + > + /* > + * channels might still be in the pendling list if > + * cppi41_dma_issue_pending() is called after > + * cppi41_runtime_suspend() is called > + */ > + list_for_each_entry_safe(cc, _ct, &cdd->pending, node) { > + if (cc != c) > + continue; > + list_del(&cc->node); > + break; > + } > return 0; > + } > > ret = cppi41_tear_down_chan(c); > if (ret) > -- > 2.17.1 -- ~Vinod
Re: pl2303 regression after v4.17. Bisected to 7041d9c3f01b
Hi, > Requested baud setting looks odd to me. Maybe related to this > --keep-baud flag in "/sbin/agetty -o -p -- \u --keep-baud > 115200,38400,9600 ttyUSB0 vt220"? Well, what is the baud rate of the other side? It seems a bit strange that ... > 1. serial-getty@ttyUSB0.service disabled > > speed 9600 baud; rows 0; columns 0; line = 0; ... this works ... > 3. serial-getty@ttyUSB0.service disabled && picocom -b 115200 /dev/ttyUSB0 > > speed 115200 baud; rows 0; columns 0; line = 0; ... and this works as well?! I think before debugging a potential problem with the new flow control feature, it would be a good idea to first make sure the baud rate is configured correctly. Maybe agetty's baud rate selection is somehow influenced by the new flow control support? I don't see how it would, and maybe that's still a bug somehow, but I suspect that there is no flow control problem at all, but rather it's just a baud rate mismatch that prevents communication. Regards, Florian
[PATCH v2 4/5] USB: omap_udc: fix USB gadget functionality on Palm Tungsten E
On Palm TE nothing happens when you try to use gadget drivers and plug the USB cable. Fix by adding the board to the vbus sense quirk list. Signed-off-by: Aaro Koskinen --- drivers/usb/gadget/udc/omap_udc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index 33250e569af8..9b23e04c8f02 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2033,6 +2033,7 @@ static inline int machine_without_vbus_sense(void) { return machine_is_omap_innovator() || machine_is_omap_osk() + || machine_is_omap_palmte() || machine_is_sx1() /* No known omap7xx boards with vbus sense */ || cpu_is_omap7xx(); -- 2.17.0
[PATCH v2 1/5] USB: omap_udc: use devm_request_irq()
The current code fails to release the third irq on the error path (observed by reading the code), and we get also multiple WARNs with failing gadget drivers due to duplicate IRQ releases. Fix by using devm_request_irq(). Signed-off-by: Aaro Koskinen --- drivers/usb/gadget/udc/omap_udc.c | 37 +-- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index 3a16431da321..1c77218c82af 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2867,8 +2867,8 @@ static int omap_udc_probe(struct platform_device *pdev) udc->clr_halt = UDC_RESET_EP; /* USB general purpose IRQ: ep0, state changes, dma, etc */ - status = request_irq(pdev->resource[1].start, omap_udc_irq, - 0, driver_name, udc); + status = devm_request_irq(&pdev->dev, pdev->resource[1].start, + omap_udc_irq, 0, driver_name, udc); if (status != 0) { ERR("can't get irq %d, err %d\n", (int) pdev->resource[1].start, status); @@ -2876,20 +2876,20 @@ static int omap_udc_probe(struct platform_device *pdev) } /* USB "non-iso" IRQ (PIO for all but ep0) */ - status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, - 0, "omap_udc pio", udc); + status = devm_request_irq(&pdev->dev, pdev->resource[2].start, + omap_udc_pio_irq, 0, "omap_udc pio", udc); if (status != 0) { ERR("can't get irq %d, err %d\n", (int) pdev->resource[2].start, status); - goto cleanup2; + goto cleanup1; } #ifdef USE_ISO - status = request_irq(pdev->resource[3].start, omap_udc_iso_irq, - 0, "omap_udc iso", udc); + status = devm_request_irq(&pdev->dev, pdev->resource[3].start, + omap_udc_iso_irq, 0, "omap_udc iso", udc); if (status != 0) { ERR("can't get irq %d, err %d\n", (int) pdev->resource[3].start, status); - goto cleanup3; + goto cleanup1; } #endif if (cpu_is_omap16xx() || cpu_is_omap7xx()) { @@ -2902,22 +2902,11 @@ static int omap_udc_probe(struct platform_device *pdev) create_proc_file(); status = usb_add_gadget_udc_release(&pdev->dev, &udc->gadget, omap_udc_release); - if (status) - goto cleanup4; - - return 0; + if (!status) + return 0; -cleanup4: remove_proc_file(); -#ifdef USE_ISO -cleanup3: - free_irq(pdev->resource[2].start, udc); -#endif - -cleanup2: - free_irq(pdev->resource[1].start, udc); - cleanup1: kfree(udc); udc = NULL; @@ -2961,12 +2950,6 @@ static int omap_udc_remove(struct platform_device *pdev) remove_proc_file(); -#ifdef USE_ISO - free_irq(pdev->resource[3].start, udc); -#endif - free_irq(pdev->resource[2].start, udc); - free_irq(pdev->resource[1].start, udc); - if (udc->dc_clk) { if (udc->clk_requested) omap_udc_enable_clock(0); -- 2.17.0
[PATCH v2 2/5] USB: omap_udc: fix crashes on probe error and module removal
We currently crash if usb_add_gadget_udc_release() fails, since the udc->done is not initialized until in the remove function. Furthermore, on module removal the udc data is accessed although the release function is already triggered by usb_del_gadget_udc() early in the function. Fix by rewriting the release and remove functions, basically moving all the cleanup into the release function, and doing the completion only in the module removal case. The patch fixes omap_udc module probe with a failing gadged, and also allows the removal of omap_udc. Tested by running "modprobe omap_udc; modprobe -r omap_udc" in a loop. Signed-off-by: Aaro Koskinen --- drivers/usb/gadget/udc/omap_udc.c | 50 --- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index 1c77218c82af..240ccba44592 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2593,9 +2593,22 @@ omap_ep_setup(char *name, u8 addr, u8 type, static void omap_udc_release(struct device *dev) { - complete(udc->done); + pullup_disable(udc); + if (!IS_ERR_OR_NULL(udc->transceiver)) { + usb_put_phy(udc->transceiver); + udc->transceiver = NULL; + } + omap_writew(0, UDC_SYSCON1); + remove_proc_file(); + if (udc->dc_clk) { + if (udc->clk_requested) + omap_udc_enable_clock(0); + clk_put(udc->hhc_clk); + clk_put(udc->dc_clk); + } + if (udc->done) + complete(udc->done); kfree(udc); - udc = NULL; } static int @@ -2900,12 +2913,8 @@ static int omap_udc_probe(struct platform_device *pdev) } create_proc_file(); - status = usb_add_gadget_udc_release(&pdev->dev, &udc->gadget, - omap_udc_release); - if (!status) - return 0; - - remove_proc_file(); + return usb_add_gadget_udc_release(&pdev->dev, &udc->gadget, + omap_udc_release); cleanup1: kfree(udc); @@ -2932,36 +2941,15 @@ static int omap_udc_remove(struct platform_device *pdev) { DECLARE_COMPLETION_ONSTACK(done); - if (!udc) - return -ENODEV; - - usb_del_gadget_udc(&udc->gadget); - if (udc->driver) - return -EBUSY; - udc->done = &done; - pullup_disable(udc); - if (!IS_ERR_OR_NULL(udc->transceiver)) { - usb_put_phy(udc->transceiver); - udc->transceiver = NULL; - } - omap_writew(0, UDC_SYSCON1); - - remove_proc_file(); + usb_del_gadget_udc(&udc->gadget); - if (udc->dc_clk) { - if (udc->clk_requested) - omap_udc_enable_clock(0); - clk_put(udc->hhc_clk); - clk_put(udc->dc_clk); - } + wait_for_completion(&done); release_mem_region(pdev->resource[0].start, pdev->resource[0].end - pdev->resource[0].start + 1); - wait_for_completion(&done); - return 0; } -- 2.17.0
[PATCH v2 0/5] omap_udc bug fixes
Hello, Some fixes for omap_udc making the driver usable again on Palm TE & 770. v2: Patch #2 rewritten, now usb_add_gadget_udc_release() should be properly used. Patch #5 added. v1: https://marc.info/?l=linux-usb&m=154258778216930&w=2 https://marc.info/?l=linux-usb&m=154258778316932&w=2 https://marc.info/?l=linux-usb&m=154258778316931&w=2 https://marc.info/?l=linux-usb&m=154258778216929&w=2 Aaro Koskinen (5): USB: omap_udc: use devm_request_irq() USB: omap_udc: fix crashes on probe error and module removal USB: omap_udc: fix omap_udc_start() on 15xx machines USB: omap_udc: fix USB gadget functionality on Palm Tungsten E USB: omap_udc: fix rejection of out transfers when DMA is used drivers/usb/gadget/udc/omap_udc.c | 88 +++ 1 file changed, 31 insertions(+), 57 deletions(-) -- 2.17.0
[PATCH v2 5/5] USB: omap_udc: fix rejection of out transfers when DMA is used
Commit 387f869d2579 ("usb: gadget: u_ether: conditionally align transfer size") started aligning transfer size only if requested, breaking omap_udc DMA mode. Set quirk_ep_out_aligned_size to restore the old behaviour. Fixes: 387f869d2579 ("usb: gadget: u_ether: conditionally align transfer size") Signed-off-by: Aaro Koskinen --- drivers/usb/gadget/udc/omap_udc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index 9b23e04c8f02..fcf13ef33b31 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2642,6 +2642,7 @@ omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv) udc->gadget.speed = USB_SPEED_UNKNOWN; udc->gadget.max_speed = USB_SPEED_FULL; udc->gadget.name = driver_name; + udc->gadget.quirk_ep_out_aligned_size = 1; udc->transceiver = xceiv; /* ep0 is special; put it right after the SETUP buffer */ -- 2.17.0
[PATCH v2 3/5] USB: omap_udc: fix omap_udc_start() on 15xx machines
On OMAP 15xx machines there are no transceivers, and omap_udc_start() always fails as it forgot to adjust the default return value. Signed-off-by: Aaro Koskinen --- drivers/usb/gadget/udc/omap_udc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index 240ccba44592..33250e569af8 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2041,7 +2041,7 @@ static inline int machine_without_vbus_sense(void) static int omap_udc_start(struct usb_gadget *g, struct usb_gadget_driver *driver) { - int status = -ENODEV; + int status; struct omap_ep *ep; unsigned long flags; @@ -2079,6 +2079,7 @@ static int omap_udc_start(struct usb_gadget *g, goto done; } } else { + status = 0; if (can_pullup(udc)) pullup_enable(udc); else -- 2.17.0
RE: [RFC PATCH v2 03/15] dt-bindings: add binding for USBSS-DRD controller.
Hi Roger >On 18/11/18 12:08, Pawel Laszczak wrote: >> Thsi patch aim at documenting USB related dt-bindings for the > >s/Thsi/This > >> Cadence USBSS-DRD controller. >> >> Signed-off-by: Pawel Laszczak >> --- >> .../devicetree/bindings/usb/cdns3-usb.txt | 17 + >> 1 file changed, 17 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/usb/cdns3-usb.txt >> >> diff --git a/Documentation/devicetree/bindings/usb/cdns3-usb.txt >> b/Documentation/devicetree/bindings/usb/cdns3-usb.txt >> new file mode 100644 >> index ..f9e953f32d47 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/usb/cdns3-usb.txt >> @@ -0,0 +1,17 @@ >> +Binding for the Cadence USBSS-DRD controller >> + >> +Required properties: >> + - reg: Physical base address and size of the controller's register area. >> + - compatible: Should contain: "cdns,usb3" >> + - interrupts: Interrupt specifier. Refer to interrupt bindings. > >Do you also comply with USB generic bindings for dr_mode, speed, etc? >i.e. Documentation/devicetree/bindings/usb/generic.txt > >If yes it must be mentioned in Optional properties: I took a look at this document and I think that only dr_mode and maximum-speed make sense as optional parameters. I will add these two as optional. Thanks. > >> + >> + >> +Example: >> +cdns3@f300 { >> +compatible = "cdns,usb3"; >> +interrupts = ; >> +reg = <0xf300 0x1 //memory area for OTG/DRD >> registers >> +0xf301 0x1 //memory area for HOST registers >> +0xf302 0x1>;//memory area for Device >> registers >> +}; >> + >> > >cheers, >-roger >-- >Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. >Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki Cheers, Pawel