aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-01 00:15:15 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-01 00:15:15 -0400
commitba1ba3a4ed0c5c6a6121169abe61802aeab6c1d2 (patch)
tree91ca78d7105c0fbe46821f1896f44c05351e5fd6
parent8ecd93ab84ce018e032298f55e1b18ada0362850 (diff)
parent8035691365b80428c58908215d4408559afe7cb3 (diff)
Merge tag 'fixes-for-v3.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus
Felipe writes: usb: fixes for v3.16-rc4 A few more fixes for this RC cycle. There's a revert of a previous patch which ended up being the wrong version, so we reverted that commit and applied a better fix. CPPI41 got a race condition fix which was found by Thomas Gleixner. The MSM PHY driver got a runtime pm usage fix so that it wouldn't kill the PHY while it was still being used. We also have a fix for a panic caused when removing musb_am335x driver. Other than that, a few other minor fixes. Signed-of-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/gadget/gr_udc.c5
-rw-r--r--drivers/usb/musb/musb_am335x.c23
-rw-r--r--drivers/usb/musb/musb_cppi41.c2
-rw-r--r--drivers/usb/musb/musb_dsps.c9
-rw-r--r--drivers/usb/phy/phy-msm-usb.c4
-rw-r--r--include/uapi/linux/usb/functionfs.h9
-rw-r--r--tools/usb/Makefile6
-rw-r--r--tools/usb/ffs-test.c24
8 files changed, 30 insertions, 52 deletions
diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c
index 99a37ed03e27..c7004ee89c90 100644
--- a/drivers/usb/gadget/gr_udc.c
+++ b/drivers/usb/gadget/gr_udc.c
@@ -1532,8 +1532,9 @@ static int gr_ep_enable(struct usb_ep *_ep,
1532 "%s mode: multiple trans./microframe not valid\n", 1532 "%s mode: multiple trans./microframe not valid\n",
1533 (mode == 2 ? "Bulk" : "Control")); 1533 (mode == 2 ? "Bulk" : "Control"));
1534 return -EINVAL; 1534 return -EINVAL;
1535 } else if (nt == 0x11) { 1535 } else if (nt == 0x3) {
1536 dev_err(dev->dev, "Invalid value for trans./microframe\n"); 1536 dev_err(dev->dev,
1537 "Invalid value 0x3 for additional trans./microframe\n");
1537 return -EINVAL; 1538 return -EINVAL;
1538 } else if ((nt + 1) * max > buffer_size) { 1539 } else if ((nt + 1) * max > buffer_size) {
1539 dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", 1540 dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n",
diff --git a/drivers/usb/musb/musb_am335x.c b/drivers/usb/musb/musb_am335x.c
index d2353781bd2d..1e58ed2361cc 100644
--- a/drivers/usb/musb/musb_am335x.c
+++ b/drivers/usb/musb/musb_am335x.c
@@ -19,21 +19,6 @@ err:
19 return ret; 19 return ret;
20} 20}
21 21
22static int of_remove_populated_child(struct device *dev, void *d)
23{
24 struct platform_device *pdev = to_platform_device(dev);
25
26 of_device_unregister(pdev);
27 return 0;
28}
29
30static int am335x_child_remove(struct platform_device *pdev)
31{
32 device_for_each_child(&pdev->dev, NULL, of_remove_populated_child);
33 pm_runtime_disable(&pdev->dev);
34 return 0;
35}
36
37static const struct of_device_id am335x_child_of_match[] = { 22static const struct of_device_id am335x_child_of_match[] = {
38 { .compatible = "ti,am33xx-usb" }, 23 { .compatible = "ti,am33xx-usb" },
39 { }, 24 { },
@@ -42,13 +27,17 @@ MODULE_DEVICE_TABLE(of, am335x_child_of_match);
42 27
43static struct platform_driver am335x_child_driver = { 28static struct platform_driver am335x_child_driver = {
44 .probe = am335x_child_probe, 29 .probe = am335x_child_probe,
45 .remove = am335x_child_remove,
46 .driver = { 30 .driver = {
47 .name = "am335x-usb-childs", 31 .name = "am335x-usb-childs",
48 .of_match_table = am335x_child_of_match, 32 .of_match_table = am335x_child_of_match,
49 }, 33 },
50}; 34};
51 35
52module_platform_driver(am335x_child_driver); 36static int __init am335x_child_init(void)
37{
38 return platform_driver_register(&am335x_child_driver);
39}
40module_init(am335x_child_init);
41
53MODULE_DESCRIPTION("AM33xx child devices"); 42MODULE_DESCRIPTION("AM33xx child devices");
54MODULE_LICENSE("GPL v2"); 43MODULE_LICENSE("GPL v2");
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index 7b8bbf53127e..5341bb223b7c 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -318,7 +318,7 @@ static void cppi41_dma_callback(void *private_data)
318 } 318 }
319 list_add_tail(&cppi41_channel->tx_check, 319 list_add_tail(&cppi41_channel->tx_check,
320 &controller->early_tx_list); 320 &controller->early_tx_list);
321 if (!hrtimer_active(&controller->early_tx)) { 321 if (!hrtimer_is_queued(&controller->early_tx)) {
322 hrtimer_start_range_ns(&controller->early_tx, 322 hrtimer_start_range_ns(&controller->early_tx,
323 ktime_set(0, 140 * NSEC_PER_USEC), 323 ktime_set(0, 140 * NSEC_PER_USEC),
324 40 * NSEC_PER_USEC, 324 40 * NSEC_PER_USEC,
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 51beb13c7e1a..09529f94e72d 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -494,10 +494,9 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
494 struct dsps_glue *glue = dev_get_drvdata(dev->parent); 494 struct dsps_glue *glue = dev_get_drvdata(dev->parent);
495 const struct dsps_musb_wrapper *wrp = glue->wrp; 495 const struct dsps_musb_wrapper *wrp = glue->wrp;
496 void __iomem *ctrl_base = musb->ctrl_base; 496 void __iomem *ctrl_base = musb->ctrl_base;
497 void __iomem *base = musb->mregs;
498 u32 reg; 497 u32 reg;
499 498
500 reg = dsps_readl(base, wrp->mode); 499 reg = dsps_readl(ctrl_base, wrp->mode);
501 500
502 switch (mode) { 501 switch (mode) {
503 case MUSB_HOST: 502 case MUSB_HOST:
@@ -510,7 +509,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
510 */ 509 */
511 reg |= (1 << wrp->iddig_mux); 510 reg |= (1 << wrp->iddig_mux);
512 511
513 dsps_writel(base, wrp->mode, reg); 512 dsps_writel(ctrl_base, wrp->mode, reg);
514 dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); 513 dsps_writel(ctrl_base, wrp->phy_utmi, 0x02);
515 break; 514 break;
516 case MUSB_PERIPHERAL: 515 case MUSB_PERIPHERAL:
@@ -523,10 +522,10 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
523 */ 522 */
524 reg |= (1 << wrp->iddig_mux); 523 reg |= (1 << wrp->iddig_mux);
525 524
526 dsps_writel(base, wrp->mode, reg); 525 dsps_writel(ctrl_base, wrp->mode, reg);
527 break; 526 break;
528 case MUSB_OTG: 527 case MUSB_OTG:
529 dsps_writel(base, wrp->phy_utmi, 0x02); 528 dsps_writel(ctrl_base, wrp->phy_utmi, 0x02);
530 break; 529 break;
531 default: 530 default:
532 dev_err(glue->dev, "unsupported mode %d\n", mode); 531 dev_err(glue->dev, "unsupported mode %d\n", mode);
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index ced34f39bdd4..c929370cdaa6 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1229,7 +1229,9 @@ static void msm_otg_sm_work(struct work_struct *w)
1229 motg->chg_state = USB_CHG_STATE_UNDEFINED; 1229 motg->chg_state = USB_CHG_STATE_UNDEFINED;
1230 motg->chg_type = USB_INVALID_CHARGER; 1230 motg->chg_type = USB_INVALID_CHARGER;
1231 } 1231 }
1232 pm_runtime_put_sync(otg->phy->dev); 1232
1233 if (otg->phy->state == OTG_STATE_B_IDLE)
1234 pm_runtime_put_sync(otg->phy->dev);
1233 break; 1235 break;
1234 case OTG_STATE_B_PERIPHERAL: 1236 case OTG_STATE_B_PERIPHERAL:
1235 dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); 1237 dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n");
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
index ecb3a31f7ca6..24b68c59dcf8 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -33,6 +33,13 @@ struct usb_endpoint_descriptor_no_audio {
33 __u8 bInterval; 33 __u8 bInterval;
34} __attribute__((packed)); 34} __attribute__((packed));
35 35
36/* Legacy format, deprecated as of 3.14. */
37struct usb_functionfs_descs_head {
38 __le32 magic;
39 __le32 length;
40 __le32 fs_count;
41 __le32 hs_count;
42} __attribute__((packed, deprecated));
36 43
37/* 44/*
38 * Descriptors format: 45 * Descriptors format:
@@ -53,7 +60,7 @@ struct usb_endpoint_descriptor_no_audio {
53 * structure. Any flags that are not recognised cause the whole block to be 60 * structure. Any flags that are not recognised cause the whole block to be
54 * rejected with -ENOSYS. 61 * rejected with -ENOSYS.
55 * 62 *
56 * Legacy descriptors format (deprecated as of 3.14): 63 * Legacy descriptors format:
57 * 64 *
58 * | off | name | type | description | 65 * | off | name | type | description |
59 * |-----+-----------+--------------+--------------------------------------| 66 * |-----+-----------+--------------+--------------------------------------|
diff --git a/tools/usb/Makefile b/tools/usb/Makefile
index d576b3bac3cf..acf2165c04e6 100644
--- a/tools/usb/Makefile
+++ b/tools/usb/Makefile
@@ -6,11 +6,7 @@ WARNINGS = -Wall -Wextra
6CFLAGS = $(WARNINGS) -g -I../include 6CFLAGS = $(WARNINGS) -g -I../include
7LDFLAGS = $(PTHREAD_LIBS) 7LDFLAGS = $(PTHREAD_LIBS)
8 8
9all: testusb ffs-test ffs-test-legacy 9all: testusb ffs-test
10
11ffs-test-legacy: ffs-test.c
12 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) -DUSE_LEGACY_DESC_HEAD
13
14%: %.c 10%: %.c
15 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 11 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
16 12
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index 74b353d9eb50..a87e99f37c52 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * ffs-test.c -- user mode filesystem api for usb composite function 2 * ffs-test.c.c -- user mode filesystem api for usb composite function
3 * 3 *
4 * Copyright (C) 2010 Samsung Electronics 4 * Copyright (C) 2010 Samsung Electronics
5 * Author: Michal Nazarewicz <mina86@mina86.com> 5 * Author: Michal Nazarewicz <mina86@mina86.com>
@@ -21,8 +21,6 @@
21 21
22/* $(CROSS_COMPILE)cc -Wall -Wextra -g -o ffs-test ffs-test.c -lpthread */ 22/* $(CROSS_COMPILE)cc -Wall -Wextra -g -o ffs-test ffs-test.c -lpthread */
23 23
24/* Uncomment to make the tool use legacy FFS descriptor headers. */
25/* #define USE_LEGACY_DESC_HEAD */
26 24
27#define _BSD_SOURCE /* for endian.h */ 25#define _BSD_SOURCE /* for endian.h */
28 26
@@ -108,15 +106,7 @@ static void _msg(unsigned level, const char *fmt, ...)
108/******************** Descriptors and Strings *******************************/ 106/******************** Descriptors and Strings *******************************/
109 107
110static const struct { 108static const struct {
111 struct { 109 struct usb_functionfs_descs_head header;
112 __le32 magic;
113 __le32 length;
114#ifndef USE_LEGACY_DESC_HEAD
115 __le32 flags;
116#endif
117 __le32 fs_count;
118 __le32 hs_count;
119 } __attribute__((packed)) header;
120 struct { 110 struct {
121 struct usb_interface_descriptor intf; 111 struct usb_interface_descriptor intf;
122 struct usb_endpoint_descriptor_no_audio sink; 112 struct usb_endpoint_descriptor_no_audio sink;
@@ -124,16 +114,10 @@ static const struct {
124 } __attribute__((packed)) fs_descs, hs_descs; 114 } __attribute__((packed)) fs_descs, hs_descs;
125} __attribute__((packed)) descriptors = { 115} __attribute__((packed)) descriptors = {
126 .header = { 116 .header = {
127#ifdef USE_LEGACY_DESC_HEAD
128 .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), 117 .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC),
129#else
130 .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
131 .flags = cpu_to_le32(FUNCTIONFS_HAS_FS_DESC |
132 FUNCTIONFS_HAS_HS_DESC),
133#endif
134 .length = cpu_to_le32(sizeof descriptors), 118 .length = cpu_to_le32(sizeof descriptors),
135 .fs_count = 3, 119 .fs_count = cpu_to_le32(3),
136 .hs_count = 3, 120 .hs_count = cpu_to_le32(3),
137 }, 121 },
138 .fs_descs = { 122 .fs_descs = {
139 .intf = { 123 .intf = {