diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-08-22 16:43:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-20 07:07:55 -0400 |
commit | a740f20d13b67fd4d91ede93980106f085111f10 (patch) | |
tree | 54aa6375a96902337263e41adffde91f89be8bde | |
parent | bd93227897007bac09c44fe67626035303905900 (diff) |
USB: EHCI: ehci-mv: use phy-pxa-usb
Use a proper PHY driver, instead of hooks to a board support package.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | arch/arm/mach-mmp/devices.c | 11 | ||||
-rw-r--r-- | drivers/usb/host/ehci-mv.c | 44 |
2 files changed, 23 insertions, 32 deletions
diff --git a/arch/arm/mach-mmp/devices.c b/arch/arm/mach-mmp/devices.c index 671c7a09ab3d..0fca63c80e1a 100644 --- a/arch/arm/mach-mmp/devices.c +++ b/arch/arm/mach-mmp/devices.c | |||
@@ -277,21 +277,12 @@ struct platform_device pxa168_device_u2o = { | |||
277 | 277 | ||
278 | #if IS_ENABLED(CONFIG_USB_EHCI_MV_U2O) | 278 | #if IS_ENABLED(CONFIG_USB_EHCI_MV_U2O) |
279 | struct resource pxa168_u2oehci_resources[] = { | 279 | struct resource pxa168_u2oehci_resources[] = { |
280 | /* regbase */ | ||
281 | [0] = { | 280 | [0] = { |
282 | .start = PXA168_U2O_REGBASE + U2x_CAPREGS_OFFSET, | 281 | .start = PXA168_U2O_REGBASE, |
283 | .end = PXA168_U2O_REGBASE + USB_REG_RANGE, | 282 | .end = PXA168_U2O_REGBASE + USB_REG_RANGE, |
284 | .flags = IORESOURCE_MEM, | 283 | .flags = IORESOURCE_MEM, |
285 | .name = "capregs", | ||
286 | }, | 284 | }, |
287 | /* phybase */ | ||
288 | [1] = { | 285 | [1] = { |
289 | .start = PXA168_U2O_PHYBASE, | ||
290 | .end = PXA168_U2O_PHYBASE + USB_PHY_RANGE, | ||
291 | .flags = IORESOURCE_MEM, | ||
292 | .name = "phyregs", | ||
293 | }, | ||
294 | [2] = { | ||
295 | .start = IRQ_PXA168_USB1, | 286 | .start = IRQ_PXA168_USB1, |
296 | .end = IRQ_PXA168_USB1, | 287 | .end = IRQ_PXA168_USB1, |
297 | .flags = IORESOURCE_IRQ, | 288 | .flags = IORESOURCE_IRQ, |
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index 705d1b43b2dd..43b300c90875 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c | |||
@@ -18,6 +18,9 @@ | |||
18 | 18 | ||
19 | #include "ehci.h" | 19 | #include "ehci.h" |
20 | 20 | ||
21 | /* registers */ | ||
22 | #define U2x_CAPREGS_OFFSET 0x100 | ||
23 | |||
21 | #define CAPLENGTH_MASK (0xff) | 24 | #define CAPLENGTH_MASK (0xff) |
22 | 25 | ||
23 | #define hcd_to_ehci_hcd_mv(h) ((struct ehci_hcd_mv *)hcd_to_ehci(h)->priv) | 26 | #define hcd_to_ehci_hcd_mv(h) ((struct ehci_hcd_mv *)hcd_to_ehci(h)->priv) |
@@ -26,13 +29,14 @@ struct ehci_hcd_mv { | |||
26 | /* Which mode does this ehci running OTG/Host ? */ | 29 | /* Which mode does this ehci running OTG/Host ? */ |
27 | int mode; | 30 | int mode; |
28 | 31 | ||
29 | void __iomem *phy_regs; | 32 | void __iomem *base; |
30 | void __iomem *cap_regs; | 33 | void __iomem *cap_regs; |
31 | void __iomem *op_regs; | 34 | void __iomem *op_regs; |
32 | 35 | ||
33 | struct usb_phy *otg; | 36 | struct usb_phy *otg; |
34 | 37 | ||
35 | struct mv_usb_platform_data *pdata; | 38 | struct mv_usb_platform_data *pdata; |
39 | struct phy *phy; | ||
36 | 40 | ||
37 | struct clk *clk; | 41 | struct clk *clk; |
38 | }; | 42 | }; |
@@ -49,22 +53,13 @@ static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv) | |||
49 | 53 | ||
50 | static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) | 54 | static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) |
51 | { | 55 | { |
52 | int retval; | ||
53 | |||
54 | ehci_clock_enable(ehci_mv); | 56 | ehci_clock_enable(ehci_mv); |
55 | if (ehci_mv->pdata->phy_init) { | 57 | return phy_init(ehci_mv->phy); |
56 | retval = ehci_mv->pdata->phy_init(ehci_mv->phy_regs); | ||
57 | if (retval) | ||
58 | return retval; | ||
59 | } | ||
60 | |||
61 | return 0; | ||
62 | } | 58 | } |
63 | 59 | ||
64 | static void mv_ehci_disable(struct ehci_hcd_mv *ehci_mv) | 60 | static void mv_ehci_disable(struct ehci_hcd_mv *ehci_mv) |
65 | { | 61 | { |
66 | if (ehci_mv->pdata->phy_deinit) | 62 | phy_exit(ehci_mv->phy); |
67 | ehci_mv->pdata->phy_deinit(ehci_mv->phy_regs); | ||
68 | ehci_clock_disable(ehci_mv); | 63 | ehci_clock_disable(ehci_mv); |
69 | } | 64 | } |
70 | 65 | ||
@@ -121,6 +116,14 @@ static int mv_ehci_probe(struct platform_device *pdev) | |||
121 | ehci_mv = hcd_to_ehci_hcd_mv(hcd); | 116 | ehci_mv = hcd_to_ehci_hcd_mv(hcd); |
122 | ehci_mv->pdata = pdata; | 117 | ehci_mv->pdata = pdata; |
123 | 118 | ||
119 | ehci_mv->phy = devm_phy_get(&pdev->dev, "usb"); | ||
120 | if (IS_ERR(ehci_mv->phy)) { | ||
121 | retval = PTR_ERR(ehci_mv->phy); | ||
122 | if (retval != -EPROBE_DEFER) | ||
123 | dev_err(&pdev->dev, "Failed to get phy.\n"); | ||
124 | goto err_put_hcd; | ||
125 | } | ||
126 | |||
124 | ehci_mv->clk = devm_clk_get(&pdev->dev, NULL); | 127 | ehci_mv->clk = devm_clk_get(&pdev->dev, NULL); |
125 | if (IS_ERR(ehci_mv->clk)) { | 128 | if (IS_ERR(ehci_mv->clk)) { |
126 | dev_err(&pdev->dev, "error getting clock\n"); | 129 | dev_err(&pdev->dev, "error getting clock\n"); |
@@ -128,17 +131,12 @@ static int mv_ehci_probe(struct platform_device *pdev) | |||
128 | goto err_put_hcd; | 131 | goto err_put_hcd; |
129 | } | 132 | } |
130 | 133 | ||
131 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs"); | ||
132 | ehci_mv->phy_regs = devm_ioremap_resource(&pdev->dev, r); | ||
133 | if (IS_ERR(ehci_mv->phy_regs)) { | ||
134 | retval = PTR_ERR(ehci_mv->phy_regs); | ||
135 | goto err_put_hcd; | ||
136 | } | ||
137 | 134 | ||
138 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "capregs"); | 135 | |
139 | ehci_mv->cap_regs = devm_ioremap_resource(&pdev->dev, r); | 136 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
140 | if (IS_ERR(ehci_mv->cap_regs)) { | 137 | ehci_mv->base = devm_ioremap_resource(&pdev->dev, r); |
141 | retval = PTR_ERR(ehci_mv->cap_regs); | 138 | if (IS_ERR(ehci_mv->base)) { |
139 | retval = PTR_ERR(ehci_mv->base); | ||
142 | goto err_put_hcd; | 140 | goto err_put_hcd; |
143 | } | 141 | } |
144 | 142 | ||
@@ -148,6 +146,8 @@ static int mv_ehci_probe(struct platform_device *pdev) | |||
148 | goto err_put_hcd; | 146 | goto err_put_hcd; |
149 | } | 147 | } |
150 | 148 | ||
149 | ehci_mv->cap_regs = | ||
150 | (void __iomem *) ((unsigned long) ehci_mv->base + U2x_CAPREGS_OFFSET); | ||
151 | offset = readl(ehci_mv->cap_regs) & CAPLENGTH_MASK; | 151 | offset = readl(ehci_mv->cap_regs) & CAPLENGTH_MASK; |
152 | ehci_mv->op_regs = | 152 | ehci_mv->op_regs = |
153 | (void __iomem *) ((unsigned long) ehci_mv->cap_regs + offset); | 153 | (void __iomem *) ((unsigned long) ehci_mv->cap_regs + offset); |