diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2014-02-19 00:41:43 -0500 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:58:01 -0400 |
commit | 1a72b128812847d2ab426e044b0db65b8c2e3d2a (patch) | |
tree | 57c2704ac7bfab68c3f7c6b073a5c785af072bbf | |
parent | 4855dc3ae035df5313b61422a90c7055a2e60522 (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/ci13xxx-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/ci13xxx-imx.txt b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt index 8d58c8ce91ca..881901a59604 100644 --- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt +++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt | |||
@@ -30,6 +30,7 @@ at imx6 SoC series | |||
30 | - osc-clkgate-delay: the delay between powering up the xtal 24MHz clock | 30 | - osc-clkgate-delay: the delay between powering up the xtal 24MHz clock |
31 | and release the clock to the digital logic inside the analog block, | 31 | and release the clock to the digital logic inside the analog block, |
32 | 0 <= osc-clkgate-delay <= 7. | 32 | 0 <= osc-clkgate-delay <= 7. |
33 | - maximum-speed: limit the maximum connection speed to "full-speed". | ||
33 | 34 | ||
34 | Examples: | 35 | Examples: |
35 | usb@02184000 { /* USB OTG */ | 36 | usb@02184000 { /* USB OTG */ |
@@ -46,4 +47,5 @@ usb@02184000 { /* USB OTG */ | |||
46 | pinctrl-0 = <&pinctrl_usbh2_1>; | 47 | pinctrl-0 = <&pinctrl_usbh2_1>; |
47 | pinctrl-1 = <&pinctrl_usbh2_2>; | 48 | pinctrl-1 = <&pinctrl_usbh2_2>; |
48 | osc-clkgate-delay = <0x3>; | 49 | osc-clkgate-delay = <0x3>; |
50 | maximum-speed = "full-speed"; | ||
49 | }; | 51 | }; |
diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 9f936a361f95..aa82c8517bcd 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 | ((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) | 55 | ((((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 798598ed8791..36cada7ae4c6 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 | ||
@@ -310,6 +311,13 @@ int hw_device_reset(struct ci_hdrc *ci, u32 mode) | |||
310 | if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING) | 311 | if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING) |
311 | hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); | 312 | hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); |
312 | 313 | ||
314 | if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) { | ||
315 | if (ci->hw_bank.lpm) | ||
316 | hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC); | ||
317 | else | ||
318 | hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC); | ||
319 | } | ||
320 | |||
313 | /* USBMODE should be configured step by step */ | 321 | /* USBMODE should be configured step by step */ |
314 | hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE); | 322 | hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE); |
315 | hw_write(ci, OP_USBMODE, USBMODE_CM, mode); | 323 | hw_write(ci, OP_USBMODE, USBMODE_CM, mode); |
@@ -431,6 +439,9 @@ static int ci_get_platdata(struct device *dev, | |||
431 | } | 439 | } |
432 | } | 440 | } |
433 | 441 | ||
442 | if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL) | ||
443 | platdata->flags |= CI_HDRC_FORCE_FULLSPEED; | ||
444 | |||
434 | return 0; | 445 | return 0; |
435 | } | 446 | } |
436 | 447 | ||
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 8820c88621df..f0328724e2e4 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h | |||
@@ -28,6 +28,7 @@ struct ci_hdrc_platform_data { | |||
28 | #define CI_HDRC_IMX28_WRITE_FIX BIT(5) | 28 | #define CI_HDRC_IMX28_WRITE_FIX BIT(5) |
29 | #define CI_HDRC_IMX_EHCI_QUIRK BIT(6) | 29 | #define CI_HDRC_IMX_EHCI_QUIRK BIT(6) |
30 | #define CI_HDRC_IMX_IS_HSIC BIT(7) | 30 | #define CI_HDRC_IMX_IS_HSIC BIT(7) |
31 | #define CI_HDRC_FORCE_FULLSPEED BIT(8) | ||
31 | enum usb_dr_mode dr_mode; | 32 | enum usb_dr_mode dr_mode; |
32 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 | 33 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 |
33 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 | 34 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 |