diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2014-02-19 00:41:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-24 20:07:52 -0500 |
commit | 4f6743d5ca97ac66831add302cc5467db4ee3809 (patch) | |
tree | 83fa601c662360f5f52c80421267a271317a509f | |
parent | fad56745a641750745d85f59d5cc640a1a4c1719 (diff) |
usb: chipidea: udc: add maximum-speed = full-speed option
This patch makes it possible to set the chipidea udc into full-speed only mode.
It is set by the oftree property "maximum-speed = full-speed".
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt | 2 | ||||
-rw-r--r-- | drivers/usb/chipidea/bits.h | 2 | ||||
-rw-r--r-- | drivers/usb/chipidea/core.c | 11 | ||||
-rw-r--r-- | include/linux/usb/chipidea.h | 1 |
4 files changed, 16 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt index b4b5b7906c88..a6a32cb7f777 100644 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt | |||
@@ -18,6 +18,7 @@ Optional properties: | |||
18 | - vbus-supply: regulator for vbus | 18 | - vbus-supply: regulator for vbus |
19 | - disable-over-current: disable over current detect | 19 | - disable-over-current: disable over current detect |
20 | - external-vbus-divider: enables off-chip resistor divider for Vbus | 20 | - external-vbus-divider: enables off-chip resistor divider for Vbus |
21 | - maximum-speed: limit the maximum connection speed to "full-speed". | ||
21 | 22 | ||
22 | Examples: | 23 | Examples: |
23 | usb@02184000 { /* USB OTG */ | 24 | usb@02184000 { /* USB OTG */ |
@@ -28,4 +29,5 @@ usb@02184000 { /* USB OTG */ | |||
28 | fsl,usbmisc = <&usbmisc 0>; | 29 | fsl,usbmisc = <&usbmisc 0>; |
29 | disable-over-current; | 30 | disable-over-current; |
30 | external-vbus-divider; | 31 | external-vbus-divider; |
32 | maximum-speed = "full-speed"; | ||
31 | }; | 33 | }; |
diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index a85713165688..83d06c1455b7 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h | |||
@@ -50,12 +50,14 @@ | |||
50 | #define PORTSC_PTC (0x0FUL << 16) | 50 | #define PORTSC_PTC (0x0FUL << 16) |
51 | #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) | 51 | #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) |
52 | /* PTS and PTW for non lpm version only */ | 52 | /* PTS and PTW for non lpm version only */ |
53 | #define PORTSC_PFSC BIT(24) | ||
53 | #define PORTSC_PTS(d) \ | 54 | #define PORTSC_PTS(d) \ |
54 | (u32)((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) | 55 | (u32)((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) |
55 | #define PORTSC_PTW BIT(28) | 56 | #define PORTSC_PTW BIT(28) |
56 | #define PORTSC_STS BIT(29) | 57 | #define PORTSC_STS BIT(29) |
57 | 58 | ||
58 | /* DEVLC */ | 59 | /* DEVLC */ |
60 | #define DEVLC_PFSC BIT(23) | ||
59 | #define DEVLC_PSPD (0x03UL << 25) | 61 | #define DEVLC_PSPD (0x03UL << 25) |
60 | #define DEVLC_PSPD_HS (0x02UL << 25) | 62 | #define DEVLC_PSPD_HS (0x02UL << 25) |
61 | #define DEVLC_PTW BIT(27) | 63 | #define DEVLC_PTW BIT(27) |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 47b4bd860b65..65aeaacda6cd 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <linux/usb/otg.h> | 64 | #include <linux/usb/otg.h> |
65 | #include <linux/usb/chipidea.h> | 65 | #include <linux/usb/chipidea.h> |
66 | #include <linux/usb/of.h> | 66 | #include <linux/usb/of.h> |
67 | #include <linux/of.h> | ||
67 | #include <linux/phy.h> | 68 | #include <linux/phy.h> |
68 | #include <linux/regulator/consumer.h> | 69 | #include <linux/regulator/consumer.h> |
69 | 70 | ||
@@ -298,6 +299,13 @@ int hw_device_reset(struct ci_hdrc *ci, u32 mode) | |||
298 | if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING) | 299 | if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING) |
299 | hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); | 300 | hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); |
300 | 301 | ||
302 | if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) { | ||
303 | if (ci->hw_bank.lpm) | ||
304 | hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC); | ||
305 | else | ||
306 | hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC); | ||
307 | } | ||
308 | |||
301 | /* USBMODE should be configured step by step */ | 309 | /* USBMODE should be configured step by step */ |
302 | hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE); | 310 | hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE); |
303 | hw_write(ci, OP_USBMODE, USBMODE_CM, mode); | 311 | hw_write(ci, OP_USBMODE, USBMODE_CM, mode); |
@@ -412,6 +420,9 @@ static int ci_get_platdata(struct device *dev, | |||
412 | } | 420 | } |
413 | } | 421 | } |
414 | 422 | ||
423 | if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL) | ||
424 | platdata->flags |= CI_HDRC_FORCE_FULLSPEED; | ||
425 | |||
415 | return 0; | 426 | return 0; |
416 | } | 427 | } |
417 | 428 | ||
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 708bd119627f..bbe779f640be 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h | |||
@@ -25,6 +25,7 @@ struct ci_hdrc_platform_data { | |||
25 | */ | 25 | */ |
26 | #define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) | 26 | #define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) |
27 | #define CI_HDRC_IMX28_WRITE_FIX BIT(5) | 27 | #define CI_HDRC_IMX28_WRITE_FIX BIT(5) |
28 | #define CI_HDRC_FORCE_FULLSPEED BIT(6) | ||
28 | enum usb_dr_mode dr_mode; | 29 | enum usb_dr_mode dr_mode; |
29 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 | 30 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 |
30 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 | 31 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 |