diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-07 11:31:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-07 11:31:43 -0400 |
commit | 39ec5cbed0bb1878d0b65af0c5e653e37e1945a5 (patch) | |
tree | 66f67929c498f58e083bd915ea589aaa9eaaf7b9 | |
parent | 5a07975ad0a36708c6b0a5b9fea1ff811d0b0c1f (diff) | |
parent | adf9a3ab90eb44e57f9dbf757acd897838b5ec21 (diff) |
Merge tag 'fixes-for-v4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus
Felipe writes:
usb: fixes for v4.6-rc3
We have two more fixes to f_midi. It should now
behave much better.
dwc3-keystone.c has gotten a fix which now allows it
to work on keystone device when running in
peripheral mode. A similar fix for DMA configuration
was made for udc-core, too.
We have a new PCI ID for Intel's Broxton
platform. DWC3 can run on those platforms as well.
And we also have some dwc2 got a fix for dr_mode
usage, while renesas controller got 3 important
fixes: a NULL pointer deref fix, IRQ <-> DMA race
fix, and a fix to prevent a situation where we would
queue a request to a disabled endpoint.
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 23 | ||||
-rw-r--r-- | drivers/usb/dwc3/dwc3-keystone.c | 5 | ||||
-rw-r--r-- | drivers/usb/dwc3/dwc3-pci.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/function/f_midi.c | 8 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/udc-core.c | 6 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/fifo.c | 4 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/mod_gadget.c | 6 |
7 files changed, 34 insertions, 20 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index e9940dd004e4..818f158232bb 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -2254,6 +2254,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, | |||
2254 | { | 2254 | { |
2255 | u32 intmsk; | 2255 | u32 intmsk; |
2256 | u32 val; | 2256 | u32 val; |
2257 | u32 usbcfg; | ||
2257 | 2258 | ||
2258 | /* Kill any ep0 requests as controller will be reinitialized */ | 2259 | /* Kill any ep0 requests as controller will be reinitialized */ |
2259 | kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); | 2260 | kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); |
@@ -2267,10 +2268,16 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, | |||
2267 | * set configuration. | 2268 | * set configuration. |
2268 | */ | 2269 | */ |
2269 | 2270 | ||
2271 | /* keep other bits untouched (so e.g. forced modes are not lost) */ | ||
2272 | usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); | ||
2273 | usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP | | ||
2274 | GUSBCFG_HNPCAP); | ||
2275 | |||
2270 | /* set the PLL on, remove the HNP/SRP and set the PHY */ | 2276 | /* set the PLL on, remove the HNP/SRP and set the PHY */ |
2271 | val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5; | 2277 | val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5; |
2272 | dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) | | 2278 | usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) | |
2273 | (val << GUSBCFG_USBTRDTIM_SHIFT), hsotg->regs + GUSBCFG); | 2279 | (val << GUSBCFG_USBTRDTIM_SHIFT); |
2280 | dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); | ||
2274 | 2281 | ||
2275 | dwc2_hsotg_init_fifo(hsotg); | 2282 | dwc2_hsotg_init_fifo(hsotg); |
2276 | 2283 | ||
@@ -3031,6 +3038,7 @@ static struct usb_ep_ops dwc2_hsotg_ep_ops = { | |||
3031 | static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg) | 3038 | static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg) |
3032 | { | 3039 | { |
3033 | u32 trdtim; | 3040 | u32 trdtim; |
3041 | u32 usbcfg; | ||
3034 | /* unmask subset of endpoint interrupts */ | 3042 | /* unmask subset of endpoint interrupts */ |
3035 | 3043 | ||
3036 | dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK | | 3044 | dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK | |
@@ -3054,11 +3062,16 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg) | |||
3054 | 3062 | ||
3055 | dwc2_hsotg_init_fifo(hsotg); | 3063 | dwc2_hsotg_init_fifo(hsotg); |
3056 | 3064 | ||
3065 | /* keep other bits untouched (so e.g. forced modes are not lost) */ | ||
3066 | usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); | ||
3067 | usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP | | ||
3068 | GUSBCFG_HNPCAP); | ||
3069 | |||
3057 | /* set the PLL on, remove the HNP/SRP and set the PHY */ | 3070 | /* set the PLL on, remove the HNP/SRP and set the PHY */ |
3058 | trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5; | 3071 | trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5; |
3059 | dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) | | 3072 | usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) | |
3060 | (trdtim << GUSBCFG_USBTRDTIM_SHIFT), | 3073 | (trdtim << GUSBCFG_USBTRDTIM_SHIFT); |
3061 | hsotg->regs + GUSBCFG); | 3074 | dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); |
3062 | 3075 | ||
3063 | if (using_dma(hsotg)) | 3076 | if (using_dma(hsotg)) |
3064 | __orr32(hsotg->regs + GAHBCFG, GAHBCFG_DMA_EN); | 3077 | __orr32(hsotg->regs + GAHBCFG, GAHBCFG_DMA_EN); |
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 2be268d2423d..72664700b8a2 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c | |||
@@ -39,8 +39,6 @@ | |||
39 | #define USBSS_IRQ_COREIRQ_EN BIT(0) | 39 | #define USBSS_IRQ_COREIRQ_EN BIT(0) |
40 | #define USBSS_IRQ_COREIRQ_CLR BIT(0) | 40 | #define USBSS_IRQ_COREIRQ_CLR BIT(0) |
41 | 41 | ||
42 | static u64 kdwc3_dma_mask; | ||
43 | |||
44 | struct dwc3_keystone { | 42 | struct dwc3_keystone { |
45 | struct device *dev; | 43 | struct device *dev; |
46 | struct clk *clk; | 44 | struct clk *clk; |
@@ -108,9 +106,6 @@ static int kdwc3_probe(struct platform_device *pdev) | |||
108 | if (IS_ERR(kdwc->usbss)) | 106 | if (IS_ERR(kdwc->usbss)) |
109 | return PTR_ERR(kdwc->usbss); | 107 | return PTR_ERR(kdwc->usbss); |
110 | 108 | ||
111 | kdwc3_dma_mask = dma_get_mask(dev); | ||
112 | dev->dma_mask = &kdwc3_dma_mask; | ||
113 | |||
114 | kdwc->clk = devm_clk_get(kdwc->dev, "usb"); | 109 | kdwc->clk = devm_clk_get(kdwc->dev, "usb"); |
115 | 110 | ||
116 | error = clk_prepare_enable(kdwc->clk); | 111 | error = clk_prepare_enable(kdwc->clk); |
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 009d83048c8c..adc1e8a624cb 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #define PCI_DEVICE_ID_INTEL_SPTLP 0x9d30 | 35 | #define PCI_DEVICE_ID_INTEL_SPTLP 0x9d30 |
36 | #define PCI_DEVICE_ID_INTEL_SPTH 0xa130 | 36 | #define PCI_DEVICE_ID_INTEL_SPTH 0xa130 |
37 | #define PCI_DEVICE_ID_INTEL_BXT 0x0aaa | 37 | #define PCI_DEVICE_ID_INTEL_BXT 0x0aaa |
38 | #define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa | ||
38 | #define PCI_DEVICE_ID_INTEL_APL 0x5aaa | 39 | #define PCI_DEVICE_ID_INTEL_APL 0x5aaa |
39 | 40 | ||
40 | static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; | 41 | static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; |
@@ -213,6 +214,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | |||
213 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTLP), }, | 214 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTLP), }, |
214 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTH), }, | 215 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTH), }, |
215 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), }, | 216 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), }, |
217 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), }, | ||
216 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, | 218 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, |
217 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, | 219 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, |
218 | { } /* Terminating Entry */ | 220 | { } /* Terminating Entry */ |
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 56e2dde99b03..58fc199a18ec 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c | |||
@@ -360,7 +360,9 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
360 | /* allocate a bunch of read buffers and queue them all at once. */ | 360 | /* allocate a bunch of read buffers and queue them all at once. */ |
361 | for (i = 0; i < midi->qlen && err == 0; i++) { | 361 | for (i = 0; i < midi->qlen && err == 0; i++) { |
362 | struct usb_request *req = | 362 | struct usb_request *req = |
363 | midi_alloc_ep_req(midi->out_ep, midi->buflen); | 363 | midi_alloc_ep_req(midi->out_ep, |
364 | max_t(unsigned, midi->buflen, | ||
365 | bulk_out_desc.wMaxPacketSize)); | ||
364 | if (req == NULL) | 366 | if (req == NULL) |
365 | return -ENOMEM; | 367 | return -ENOMEM; |
366 | 368 | ||
@@ -609,8 +611,10 @@ static void f_midi_transmit(struct f_midi *midi) | |||
609 | 611 | ||
610 | do { | 612 | do { |
611 | ret = f_midi_do_transmit(midi, ep); | 613 | ret = f_midi_do_transmit(midi, ep); |
612 | if (ret < 0) | 614 | if (ret < 0) { |
615 | spin_unlock_irqrestore(&midi->transmit_lock, flags); | ||
613 | goto drop_out; | 616 | goto drop_out; |
617 | } | ||
614 | } while (ret); | 618 | } while (ret); |
615 | 619 | ||
616 | spin_unlock_irqrestore(&midi->transmit_lock, flags); | 620 | spin_unlock_irqrestore(&midi->transmit_lock, flags); |
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index 4151597e9d28..e4e70e11d0f6 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c | |||
@@ -371,12 +371,6 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, | |||
371 | INIT_WORK(&gadget->work, usb_gadget_state_work); | 371 | INIT_WORK(&gadget->work, usb_gadget_state_work); |
372 | gadget->dev.parent = parent; | 372 | gadget->dev.parent = parent; |
373 | 373 | ||
374 | #ifdef CONFIG_HAS_DMA | ||
375 | dma_set_coherent_mask(&gadget->dev, parent->coherent_dma_mask); | ||
376 | gadget->dev.dma_parms = parent->dma_parms; | ||
377 | gadget->dev.dma_mask = parent->dma_mask; | ||
378 | #endif | ||
379 | |||
380 | if (release) | 374 | if (release) |
381 | gadget->dev.release = release; | 375 | gadget->dev.release = release; |
382 | else | 376 | else |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index b4de70ee16d3..000f9750149f 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -190,7 +190,8 @@ static int usbhsf_pkt_handler(struct usbhs_pipe *pipe, int type) | |||
190 | goto __usbhs_pkt_handler_end; | 190 | goto __usbhs_pkt_handler_end; |
191 | } | 191 | } |
192 | 192 | ||
193 | ret = func(pkt, &is_done); | 193 | if (likely(func)) |
194 | ret = func(pkt, &is_done); | ||
194 | 195 | ||
195 | if (is_done) | 196 | if (is_done) |
196 | __usbhsf_pkt_del(pkt); | 197 | __usbhsf_pkt_del(pkt); |
@@ -889,6 +890,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) | |||
889 | 890 | ||
890 | pkt->trans = len; | 891 | pkt->trans = len; |
891 | 892 | ||
893 | usbhsf_tx_irq_ctrl(pipe, 0); | ||
892 | INIT_WORK(&pkt->work, xfer_work); | 894 | INIT_WORK(&pkt->work, xfer_work); |
893 | schedule_work(&pkt->work); | 895 | schedule_work(&pkt->work); |
894 | 896 | ||
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 664b263e4b20..53d104b56ef1 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -158,10 +158,14 @@ static void usbhsg_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt) | |||
158 | struct usbhs_pipe *pipe = pkt->pipe; | 158 | struct usbhs_pipe *pipe = pkt->pipe; |
159 | struct usbhsg_uep *uep = usbhsg_pipe_to_uep(pipe); | 159 | struct usbhsg_uep *uep = usbhsg_pipe_to_uep(pipe); |
160 | struct usbhsg_request *ureq = usbhsg_pkt_to_ureq(pkt); | 160 | struct usbhsg_request *ureq = usbhsg_pkt_to_ureq(pkt); |
161 | unsigned long flags; | ||
161 | 162 | ||
162 | ureq->req.actual = pkt->actual; | 163 | ureq->req.actual = pkt->actual; |
163 | 164 | ||
164 | usbhsg_queue_pop(uep, ureq, 0); | 165 | usbhs_lock(priv, flags); |
166 | if (uep) | ||
167 | __usbhsg_queue_pop(uep, ureq, 0); | ||
168 | usbhs_unlock(priv, flags); | ||
165 | } | 169 | } |
166 | 170 | ||
167 | static void usbhsg_queue_push(struct usbhsg_uep *uep, | 171 | static void usbhsg_queue_push(struct usbhsg_uep *uep, |