diff options
author | Felipe Balbi <balbi@ti.com> | 2012-07-19 07:09:48 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-10 12:29:43 -0400 |
commit | 51e1e7bcef53e6a91cfffff0145ab315def61f61 (patch) | |
tree | 5c8abd62f7d4b9a64208b8f2eababc948b158832 /drivers/usb/dwc3 | |
parent | d720f057fda4bae91a5108a11587374b9e396c6a (diff) |
usb: dwc3: add basic PHY support
this will let us control PHYs on platforms which
need them.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r-- | drivers/usb/dwc3/core.c | 15 | ||||
-rw-r--r-- | drivers/usb/dwc3/core.h | 5 |
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index c34452a7304f..79a24fab13d1 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/dma-mapping.h> | 50 | #include <linux/dma-mapping.h> |
51 | #include <linux/of.h> | 51 | #include <linux/of.h> |
52 | 52 | ||
53 | #include <linux/usb/otg.h> | ||
53 | #include <linux/usb/ch9.h> | 54 | #include <linux/usb/ch9.h> |
54 | #include <linux/usb/gadget.h> | 55 | #include <linux/usb/gadget.h> |
55 | 56 | ||
@@ -136,6 +137,8 @@ static void dwc3_core_soft_reset(struct dwc3 *dwc) | |||
136 | reg |= DWC3_GUSB2PHYCFG_PHYSOFTRST; | 137 | reg |= DWC3_GUSB2PHYCFG_PHYSOFTRST; |
137 | dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); | 138 | dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); |
138 | 139 | ||
140 | usb_phy_init(dwc->usb2_phy); | ||
141 | usb_phy_init(dwc->usb3_phy); | ||
139 | mdelay(100); | 142 | mdelay(100); |
140 | 143 | ||
141 | /* Clear USB3 PHY reset */ | 144 | /* Clear USB3 PHY reset */ |
@@ -465,6 +468,18 @@ static int __devinit dwc3_probe(struct platform_device *pdev) | |||
465 | return -ENOMEM; | 468 | return -ENOMEM; |
466 | } | 469 | } |
467 | 470 | ||
471 | dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); | ||
472 | if (IS_ERR_OR_NULL(dwc->usb2_phy)) { | ||
473 | dev_err(dev, "no usb2 phy configured\n"); | ||
474 | return -EPROBE_DEFER; | ||
475 | } | ||
476 | |||
477 | dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3); | ||
478 | if (IS_ERR_OR_NULL(dwc->usb3_phy)) { | ||
479 | dev_err(dev, "no usb3 phy configured\n"); | ||
480 | return -EPROBE_DEFER; | ||
481 | } | ||
482 | |||
468 | spin_lock_init(&dwc->lock); | 483 | spin_lock_init(&dwc->lock); |
469 | platform_set_drvdata(pdev, dwc); | 484 | platform_set_drvdata(pdev, dwc); |
470 | 485 | ||
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 151eca876dfd..dbc5713d84fb 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h | |||
@@ -624,6 +624,8 @@ struct dwc3_scratchpad_array { | |||
624 | * @maximum_speed: maximum speed requested (mainly for testing purposes) | 624 | * @maximum_speed: maximum speed requested (mainly for testing purposes) |
625 | * @revision: revision register contents | 625 | * @revision: revision register contents |
626 | * @mode: mode of operation | 626 | * @mode: mode of operation |
627 | * @usb2_phy: pointer to USB2 PHY | ||
628 | * @usb3_phy: pointer to USB3 PHY | ||
627 | * @is_selfpowered: true when we are selfpowered | 629 | * @is_selfpowered: true when we are selfpowered |
628 | * @three_stage_setup: set if we perform a three phase setup | 630 | * @three_stage_setup: set if we perform a three phase setup |
629 | * @ep0_bounced: true when we used bounce buffer | 631 | * @ep0_bounced: true when we used bounce buffer |
@@ -667,6 +669,9 @@ struct dwc3 { | |||
667 | struct usb_gadget gadget; | 669 | struct usb_gadget gadget; |
668 | struct usb_gadget_driver *gadget_driver; | 670 | struct usb_gadget_driver *gadget_driver; |
669 | 671 | ||
672 | struct usb_phy *usb2_phy; | ||
673 | struct usb_phy *usb3_phy; | ||
674 | |||
670 | void __iomem *regs; | 675 | void __iomem *regs; |
671 | size_t regs_size; | 676 | size_t regs_size; |
672 | 677 | ||