aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2013-09-27 02:23:26 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-27 20:36:21 -0400
commit5d93d1e76afbe629caf5d995fd7f8ddd6e3d4d01 (patch)
tree2c41ecee25b1583f388054961e568615eb05d9ee /drivers
parentff764963479a1b18721ab96e531404c50fefe8b1 (diff)
usb: phy: omap-usb2: use the new generic PHY framework
Used the generic PHY framework API to create the PHY. Now the power off and power on are done in omap_usb_power_off and omap_usb_power_on respectively. The omap-usb2 driver is also moved to driver/phy. However using the old USB PHY library cannot be completely removed because OTG is intertwined with PHY and moving to the new framework will break OTG. Once we have a separate OTG state machine, we can get rid of the USB PHY library. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/phy/Kconfig12
-rw-r--r--drivers/phy/Makefile1
-rw-r--r--drivers/phy/phy-omap-usb2.c (renamed from drivers/usb/phy/phy-omap-usb2.c)45
-rw-r--r--drivers/usb/phy/Kconfig11
-rw-r--r--drivers/usb/phy/Makefile1
5 files changed, 54 insertions, 16 deletions
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 349bef2e6e4e..38c3477ead4c 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -15,4 +15,16 @@ config GENERIC_PHY
15 phy users can obtain reference to the PHY. All the users of this 15 phy users can obtain reference to the PHY. All the users of this
16 framework should select this config. 16 framework should select this config.
17 17
18config OMAP_USB2
19 tristate "OMAP USB2 PHY Driver"
20 depends on ARCH_OMAP2PLUS
21 select GENERIC_PHY
22 select USB_PHY
23 select OMAP_CONTROL_USB
24 help
25 Enable this to support the transceiver that is part of SOC. This
26 driver takes care of all the PHY functionality apart from comparator.
27 The USB OTG controller communicates with the comparator using this
28 driver.
29
18endmenu 30endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9e9560fbb14d..ed5b088abaee 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -3,3 +3,4 @@
3# 3#
4 4
5obj-$(CONFIG_GENERIC_PHY) += phy-core.o 5obj-$(CONFIG_GENERIC_PHY) += phy-core.o
6obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o
diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index d266861d24f7..4d7b4e5a9659 100644
--- a/drivers/usb/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -28,6 +28,7 @@
28#include <linux/pm_runtime.h> 28#include <linux/pm_runtime.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/usb/omap_control_usb.h> 30#include <linux/usb/omap_control_usb.h>
31#include <linux/phy/phy.h>
31 32
32/** 33/**
33 * omap_usb2_set_comparator - links the comparator present in the sytem with 34 * omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -118,10 +119,36 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)
118 return 0; 119 return 0;
119} 120}
120 121
122static int omap_usb_power_off(struct phy *x)
123{
124 struct omap_usb *phy = phy_get_drvdata(x);
125
126 omap_control_usb_phy_power(phy->control_dev, 0);
127
128 return 0;
129}
130
131static int omap_usb_power_on(struct phy *x)
132{
133 struct omap_usb *phy = phy_get_drvdata(x);
134
135 omap_control_usb_phy_power(phy->control_dev, 1);
136
137 return 0;
138}
139
140static struct phy_ops ops = {
141 .power_on = omap_usb_power_on,
142 .power_off = omap_usb_power_off,
143 .owner = THIS_MODULE,
144};
145
121static int omap_usb2_probe(struct platform_device *pdev) 146static int omap_usb2_probe(struct platform_device *pdev)
122{ 147{
123 struct omap_usb *phy; 148 struct omap_usb *phy;
149 struct phy *generic_phy;
124 struct usb_otg *otg; 150 struct usb_otg *otg;
151 struct phy_provider *phy_provider;
125 152
126 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); 153 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
127 if (!phy) { 154 if (!phy) {
@@ -143,6 +170,11 @@ static int omap_usb2_probe(struct platform_device *pdev)
143 phy->phy.otg = otg; 170 phy->phy.otg = otg;
144 phy->phy.type = USB_PHY_TYPE_USB2; 171 phy->phy.type = USB_PHY_TYPE_USB2;
145 172
173 phy_provider = devm_of_phy_provider_register(phy->dev,
174 of_phy_simple_xlate);
175 if (IS_ERR(phy_provider))
176 return PTR_ERR(phy_provider);
177
146 phy->control_dev = omap_get_control_dev(); 178 phy->control_dev = omap_get_control_dev();
147 if (IS_ERR(phy->control_dev)) { 179 if (IS_ERR(phy->control_dev)) {
148 dev_dbg(&pdev->dev, "Failed to get control device\n"); 180 dev_dbg(&pdev->dev, "Failed to get control device\n");
@@ -158,6 +190,15 @@ static int omap_usb2_probe(struct platform_device *pdev)
158 otg->start_srp = omap_usb_start_srp; 190 otg->start_srp = omap_usb_start_srp;
159 otg->phy = &phy->phy; 191 otg->phy = &phy->phy;
160 192
193 platform_set_drvdata(pdev, phy);
194 pm_runtime_enable(phy->dev);
195
196 generic_phy = devm_phy_create(phy->dev, &ops, NULL);
197 if (IS_ERR(generic_phy))
198 return PTR_ERR(generic_phy);
199
200 phy_set_drvdata(generic_phy, phy);
201
161 phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k"); 202 phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");
162 if (IS_ERR(phy->wkupclk)) { 203 if (IS_ERR(phy->wkupclk)) {
163 dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n"); 204 dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n");
@@ -173,10 +214,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
173 214
174 usb_add_phy_dev(&phy->phy); 215 usb_add_phy_dev(&phy->phy);
175 216
176 platform_set_drvdata(pdev, phy);
177
178 pm_runtime_enable(phy->dev);
179
180 return 0; 217 return 0;
181} 218}
182 219
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 51ffe11cf38a..2ce041109993 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -66,17 +66,6 @@ config OMAP_CONTROL_USB
66 power on the USB2 PHY is present in OMAP4 and OMAP5. OMAP5 has an 66 power on the USB2 PHY is present in OMAP4 and OMAP5. OMAP5 has an
67 additional register to power on USB3 PHY. 67 additional register to power on USB3 PHY.
68 68
69config OMAP_USB2
70 tristate "OMAP USB2 PHY Driver"
71 depends on ARCH_OMAP2PLUS
72 select OMAP_CONTROL_USB
73 select USB_PHY
74 help
75 Enable this to support the transceiver that is part of SOC. This
76 driver takes care of all the PHY functionality apart from comparator.
77 The USB OTG controller communicates with the comparator using this
78 driver.
79
80config OMAP_USB3 69config OMAP_USB3
81 tristate "OMAP USB3 PHY Driver" 70 tristate "OMAP USB3 PHY Driver"
82 depends on ARCH_OMAP2PLUS || COMPILE_TEST 71 depends on ARCH_OMAP2PLUS || COMPILE_TEST
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 2135e85f46ed..fa4db0e4bdb9 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -15,7 +15,6 @@ obj-$(CONFIG_NOP_USB_XCEIV) += phy-generic.o
15obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o 15obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o
16obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o 16obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o
17obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o 17obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o
18obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o
19obj-$(CONFIG_OMAP_USB3) += phy-omap-usb3.o 18obj-$(CONFIG_OMAP_USB3) += phy-omap-usb3.o
20obj-$(CONFIG_SAMSUNG_USBPHY) += phy-samsung-usb.o 19obj-$(CONFIG_SAMSUNG_USBPHY) += phy-samsung-usb.o
21obj-$(CONFIG_SAMSUNG_USB2PHY) += phy-samsung-usb2.o 20obj-$(CONFIG_SAMSUNG_USB2PHY) += phy-samsung-usb2.o