aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 17:24:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 17:24:26 -0400
commit48d10bda1f2c69980601a61194015bb0790fb7ab (patch)
treee4ea2021560b1f18b335f6e8e20761fb9514cd1b /drivers/usb/chipidea
parent96b9b1c95660d4bc5510c5d798d3817ae9f0b391 (diff)
parentce53bfc4374cada8b645765e2b4ad5831e760932 (diff)
Merge tag 'usb-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB updates from Greg KH: "Here is the big USB patchset for 4.6-rc1. The normal mess is here, gadget and xhci fixes and updates, and lots of other driver updates and cleanups as well. Full details are in the shortlog. All have been in linux-next for a while with no reported issues" * tag 'usb-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (266 commits) USB: core: let USB device know device node usb: devio: Add ioctl to disallow detaching kernel USB drivers. usb: gadget: f_acm: Fix configfs attr name usb: udc: lpc32xx: remove USB PLL and USB OTG clock management usb: udc: lpc32xx: remove direct access to clock controller registers usb: udc: lpc32xx: switch to clock prepare/unprepare model usb: renesas_usbhs: gadget: fix giveback status code in usbhsg_pipe_disable() usb: gadget: renesas_usb3: Use ARCH_RENESAS usb: dwc2: Fix issues in dwc2_complete_non_isoc_xfer_ddma() usb: dwc2: Add support for Lantiq ARX and XRX SoCs usb: phy: generic: Handle late registration of gadget usb: gadget: bdc_udc: fix race condition in bdc_udc_exit() usb: musb: core: added missing const qualifier to musb_hdrc_platform_data::config usb: dwc2: Move host-specific core functions into hcd.c usb: dwc2: Move register save and restore functions usb: dwc2: Use kmem_cache_free() usb: dwc2: host: If using uframe scheduler, end splits better usb: dwc2: host: Totally redo the microframe scheduler usb: dwc2: host: Properly set even/odd frame usb: dwc2: host: Add dwc2_hcd_get_future_frame_number() call ...
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/ci_hdrc_imx.c13
-rw-r--r--drivers/usb/chipidea/core.c3
-rw-r--r--drivers/usb/chipidea/debug.c5
-rw-r--r--drivers/usb/chipidea/otg_fsm.c29
-rw-r--r--drivers/usb/chipidea/otg_fsm.h2
-rw-r--r--drivers/usb/chipidea/udc.c4
6 files changed, 43 insertions, 13 deletions
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index f14f4ab47ebb..9ce8c9f91674 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -28,6 +28,11 @@ struct ci_hdrc_imx_platform_flag {
28 bool runtime_pm; 28 bool runtime_pm;
29}; 29};
30 30
31static const struct ci_hdrc_imx_platform_flag imx23_usb_data = {
32 .flags = CI_HDRC_TURN_VBUS_EARLY_ON |
33 CI_HDRC_DISABLE_STREAMING,
34};
35
31static const struct ci_hdrc_imx_platform_flag imx27_usb_data = { 36static const struct ci_hdrc_imx_platform_flag imx27_usb_data = {
32 CI_HDRC_DISABLE_STREAMING, 37 CI_HDRC_DISABLE_STREAMING,
33}; 38};
@@ -66,6 +71,7 @@ static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = {
66}; 71};
67 72
68static const struct of_device_id ci_hdrc_imx_dt_ids[] = { 73static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
74 { .compatible = "fsl,imx23-usb", .data = &imx23_usb_data},
69 { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data}, 75 { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data},
70 { .compatible = "fsl,imx27-usb", .data = &imx27_usb_data}, 76 { .compatible = "fsl,imx27-usb", .data = &imx27_usb_data},
71 { .compatible = "fsl,imx6q-usb", .data = &imx6q_usb_data}, 77 { .compatible = "fsl,imx6q-usb", .data = &imx6q_usb_data},
@@ -244,7 +250,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
244 struct ci_hdrc_platform_data pdata = { 250 struct ci_hdrc_platform_data pdata = {
245 .name = dev_name(&pdev->dev), 251 .name = dev_name(&pdev->dev),
246 .capoffset = DEF_CAPOFFSET, 252 .capoffset = DEF_CAPOFFSET,
247 .flags = CI_HDRC_SET_NON_ZERO_TTHA,
248 }; 253 };
249 int ret; 254 int ret;
250 const struct of_device_id *of_id; 255 const struct of_device_id *of_id;
@@ -302,9 +307,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
302 &pdata); 307 &pdata);
303 if (IS_ERR(data->ci_pdev)) { 308 if (IS_ERR(data->ci_pdev)) {
304 ret = PTR_ERR(data->ci_pdev); 309 ret = PTR_ERR(data->ci_pdev);
305 dev_err(&pdev->dev, 310 if (ret != -EPROBE_DEFER)
306 "Can't register ci_hdrc platform device, err=%d\n", 311 dev_err(&pdev->dev,
307 ret); 312 "ci_hdrc_add_device failed, err=%d\n", ret);
308 goto err_clk; 313 goto err_clk;
309 } 314 }
310 315
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 7404064b9bbc..69426e644d17 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -721,6 +721,9 @@ static int ci_get_platdata(struct device *dev,
721 return ret; 721 return ret;
722 } 722 }
723 723
724 if (of_find_property(dev->of_node, "non-zero-ttctrl-ttha", NULL))
725 platdata->flags |= CI_HDRC_SET_NON_ZERO_TTHA;
726
724 ext_id = ERR_PTR(-ENODEV); 727 ext_id = ERR_PTR(-ENODEV);
725 ext_vbus = ERR_PTR(-ENODEV); 728 ext_vbus = ERR_PTR(-ENODEV);
726 if (of_property_read_bool(dev->of_node, "extcon")) { 729 if (of_property_read_bool(dev->of_node, "extcon")) {
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
index df47110bad2d..6d23eede4d8c 100644
--- a/drivers/usb/chipidea/debug.c
+++ b/drivers/usb/chipidea/debug.c
@@ -175,7 +175,6 @@ static int ci_requests_show(struct seq_file *s, void *data)
175{ 175{
176 struct ci_hdrc *ci = s->private; 176 struct ci_hdrc *ci = s->private;
177 unsigned long flags; 177 unsigned long flags;
178 struct list_head *ptr = NULL;
179 struct ci_hw_req *req = NULL; 178 struct ci_hw_req *req = NULL;
180 struct td_node *node, *tmpnode; 179 struct td_node *node, *tmpnode;
181 unsigned i, j, qsize = sizeof(struct ci_hw_td)/sizeof(u32); 180 unsigned i, j, qsize = sizeof(struct ci_hw_td)/sizeof(u32);
@@ -187,9 +186,7 @@ static int ci_requests_show(struct seq_file *s, void *data)
187 186
188 spin_lock_irqsave(&ci->lock, flags); 187 spin_lock_irqsave(&ci->lock, flags);
189 for (i = 0; i < ci->hw_ep_max; i++) 188 for (i = 0; i < ci->hw_ep_max; i++)
190 list_for_each(ptr, &ci->ci_hw_ep[i].qh.queue) { 189 list_for_each_entry(req, &ci->ci_hw_ep[i].qh.queue, queue) {
191 req = list_entry(ptr, struct ci_hw_req, queue);
192
193 list_for_each_entry_safe(node, tmpnode, &req->tds, td) { 190 list_for_each_entry_safe(node, tmpnode, &req->tds, td) {
194 seq_printf(s, "EP=%02i: TD=%08X %s\n", 191 seq_printf(s, "EP=%02i: TD=%08X %s\n",
195 i % (ci->hw_ep_max / 2), 192 i % (ci->hw_ep_max / 2),
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index ba90dc66703d..de8e22ec3902 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -66,6 +66,11 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr,
66 return count; 66 return count;
67 } 67 }
68 ci->fsm.a_bus_req = 1; 68 ci->fsm.a_bus_req = 1;
69 if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) {
70 ci->gadget.host_request_flag = 1;
71 mutex_unlock(&ci->fsm.lock);
72 return count;
73 }
69 } 74 }
70 75
71 ci_otg_queue_work(ci); 76 ci_otg_queue_work(ci);
@@ -144,8 +149,14 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr,
144 mutex_lock(&ci->fsm.lock); 149 mutex_lock(&ci->fsm.lock);
145 if (buf[0] == '0') 150 if (buf[0] == '0')
146 ci->fsm.b_bus_req = 0; 151 ci->fsm.b_bus_req = 0;
147 else if (buf[0] == '1') 152 else if (buf[0] == '1') {
148 ci->fsm.b_bus_req = 1; 153 ci->fsm.b_bus_req = 1;
154 if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) {
155 ci->gadget.host_request_flag = 1;
156 mutex_unlock(&ci->fsm.lock);
157 return count;
158 }
159 }
149 160
150 ci_otg_queue_work(ci); 161 ci_otg_queue_work(ci);
151 mutex_unlock(&ci->fsm.lock); 162 mutex_unlock(&ci->fsm.lock);
@@ -198,6 +209,7 @@ static unsigned otg_timer_ms[] = {
198 TA_AIDL_BDIS, 209 TA_AIDL_BDIS,
199 TB_ASE0_BRST, 210 TB_ASE0_BRST,
200 TA_BIDL_ADIS, 211 TA_BIDL_ADIS,
212 TB_AIDL_BDIS,
201 TB_SE0_SRP, 213 TB_SE0_SRP,
202 TB_SRP_FAIL, 214 TB_SRP_FAIL,
203 0, 215 0,
@@ -309,6 +321,12 @@ static int a_bidl_adis_tmout(struct ci_hdrc *ci)
309 return 0; 321 return 0;
310} 322}
311 323
324static int b_aidl_bdis_tmout(struct ci_hdrc *ci)
325{
326 ci->fsm.a_bus_suspend = 1;
327 return 0;
328}
329
312static int b_se0_srp_tmout(struct ci_hdrc *ci) 330static int b_se0_srp_tmout(struct ci_hdrc *ci)
313{ 331{
314 ci->fsm.b_se0_srp = 1; 332 ci->fsm.b_se0_srp = 1;
@@ -353,6 +371,7 @@ static int (*otg_timer_handlers[])(struct ci_hdrc *) = {
353 a_aidl_bdis_tmout, /* A_AIDL_BDIS */ 371 a_aidl_bdis_tmout, /* A_AIDL_BDIS */
354 b_ase0_brst_tmout, /* B_ASE0_BRST */ 372 b_ase0_brst_tmout, /* B_ASE0_BRST */
355 a_bidl_adis_tmout, /* A_BIDL_ADIS */ 373 a_bidl_adis_tmout, /* A_BIDL_ADIS */
374 b_aidl_bdis_tmout, /* B_AIDL_BDIS */
356 b_se0_srp_tmout, /* B_SE0_SRP */ 375 b_se0_srp_tmout, /* B_SE0_SRP */
357 b_srp_fail_tmout, /* B_SRP_FAIL */ 376 b_srp_fail_tmout, /* B_SRP_FAIL */
358 NULL, /* A_WAIT_ENUM */ 377 NULL, /* A_WAIT_ENUM */
@@ -644,9 +663,9 @@ static void ci_otg_fsm_event(struct ci_hdrc *ci)
644 break; 663 break;
645 case OTG_STATE_B_PERIPHERAL: 664 case OTG_STATE_B_PERIPHERAL:
646 if ((intr_sts & USBi_SLI) && port_conn && otg_bsess_vld) { 665 if ((intr_sts & USBi_SLI) && port_conn && otg_bsess_vld) {
647 fsm->a_bus_suspend = 1; 666 ci_otg_add_timer(ci, B_AIDL_BDIS);
648 ci_otg_queue_work(ci);
649 } else if (intr_sts & USBi_PCI) { 667 } else if (intr_sts & USBi_PCI) {
668 ci_otg_del_timer(ci, B_AIDL_BDIS);
650 if (fsm->a_bus_suspend == 1) 669 if (fsm->a_bus_suspend == 1)
651 fsm->a_bus_suspend = 0; 670 fsm->a_bus_suspend = 0;
652 } 671 }
@@ -786,6 +805,10 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci)
786 ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; 805 ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0;
787 ci->fsm.otg->state = OTG_STATE_UNDEFINED; 806 ci->fsm.otg->state = OTG_STATE_UNDEFINED;
788 ci->fsm.ops = &ci_otg_ops; 807 ci->fsm.ops = &ci_otg_ops;
808 ci->gadget.hnp_polling_support = 1;
809 ci->fsm.host_req_flag = devm_kzalloc(ci->dev, 1, GFP_KERNEL);
810 if (!ci->fsm.host_req_flag)
811 return -ENOMEM;
789 812
790 mutex_init(&ci->fsm.lock); 813 mutex_init(&ci->fsm.lock);
791 814
diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h
index 262d6ef8df7c..6366fe398ba6 100644
--- a/drivers/usb/chipidea/otg_fsm.h
+++ b/drivers/usb/chipidea/otg_fsm.h
@@ -62,6 +62,8 @@
62/* SSEND time before SRP */ 62/* SSEND time before SRP */
63#define TB_SSEND_SRP (1500) /* minimum 1.5 sec, section:5.1.2 */ 63#define TB_SSEND_SRP (1500) /* minimum 1.5 sec, section:5.1.2 */
64 64
65#define TB_AIDL_BDIS (20) /* 4ms ~ 150ms, section 5.2.1 */
66
65#if IS_ENABLED(CONFIG_USB_OTG_FSM) 67#if IS_ENABLED(CONFIG_USB_OTG_FSM)
66 68
67int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci); 69int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 3eafa2c9a2ba..065f5d97aa67 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -819,7 +819,6 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
819 ci->ep0out : ci->ep0in; 819 ci->ep0out : ci->ep0in;
820 if (!list_empty(&hwep->qh.queue)) { 820 if (!list_empty(&hwep->qh.queue)) {
821 _ep_nuke(hwep); 821 _ep_nuke(hwep);
822 retval = -EOVERFLOW;
823 dev_warn(hwep->ci->dev, "endpoint ctrl %X nuked\n", 822 dev_warn(hwep->ci->dev, "endpoint ctrl %X nuked\n",
824 _usb_addr(hwep)); 823 _usb_addr(hwep));
825 } 824 }
@@ -1068,7 +1067,8 @@ __acquires(ci->lock)
1068 } 1067 }
1069 break; 1068 break;
1070 case USB_REQ_GET_STATUS: 1069 case USB_REQ_GET_STATUS:
1071 if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && 1070 if ((type != (USB_DIR_IN|USB_RECIP_DEVICE) ||
1071 le16_to_cpu(req.wIndex) == OTG_STS_SELECTOR) &&
1072 type != (USB_DIR_IN|USB_RECIP_ENDPOINT) && 1072 type != (USB_DIR_IN|USB_RECIP_ENDPOINT) &&
1073 type != (USB_DIR_IN|USB_RECIP_INTERFACE)) 1073 type != (USB_DIR_IN|USB_RECIP_INTERFACE))
1074 goto delegate; 1074 goto delegate;