diff options
author | George Cherian <george.cherian@ti.com> | 2014-03-06 07:41:52 -0500 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2014-03-09 03:15:07 -0400 |
commit | 09a0168de11a4a487c2d1c78366491b695e0c15a (patch) | |
tree | d3d86d247a388268d91eba2d6162f95cb74b461b /drivers/phy | |
parent | 64bf2b23697bcf9246cea4eea83c613ea791ed8a (diff) |
phy: omap-usb2: Adapt phy-omap-usb2 for AM437x
Adapt phy-omap-usb2 driver for AM437x.
- Add new comaptible "ti,am437x-usb2" for AM437x
- Pass proper data to differentiate AM437x and others.
- AM437x doesnot support set_vbus and start_srp.
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-omap-usb2.c | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 9c3f056b3ddf..0c78f54d0650 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c | |||
@@ -122,6 +122,31 @@ static struct phy_ops ops = { | |||
122 | .owner = THIS_MODULE, | 122 | .owner = THIS_MODULE, |
123 | }; | 123 | }; |
124 | 124 | ||
125 | #ifdef CONFIG_OF | ||
126 | static const struct usb_phy_data omap_usb2_data = { | ||
127 | .label = "omap_usb2", | ||
128 | .flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS, | ||
129 | }; | ||
130 | |||
131 | static const struct usb_phy_data am437x_usb2_data = { | ||
132 | .label = "am437x_usb2", | ||
133 | .flags = 0, | ||
134 | }; | ||
135 | |||
136 | static const struct of_device_id omap_usb2_id_table[] = { | ||
137 | { | ||
138 | .compatible = "ti,omap-usb2", | ||
139 | .data = &omap_usb2_data, | ||
140 | }, | ||
141 | { | ||
142 | .compatible = "ti,am437x-usb2", | ||
143 | .data = &am437x_usb2_data, | ||
144 | }, | ||
145 | {}, | ||
146 | }; | ||
147 | MODULE_DEVICE_TABLE(of, omap_usb2_id_table); | ||
148 | #endif | ||
149 | |||
125 | static int omap_usb2_probe(struct platform_device *pdev) | 150 | static int omap_usb2_probe(struct platform_device *pdev) |
126 | { | 151 | { |
127 | struct omap_usb *phy; | 152 | struct omap_usb *phy; |
@@ -131,10 +156,16 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
131 | struct device_node *node = pdev->dev.of_node; | 156 | struct device_node *node = pdev->dev.of_node; |
132 | struct device_node *control_node; | 157 | struct device_node *control_node; |
133 | struct platform_device *control_pdev; | 158 | struct platform_device *control_pdev; |
159 | const struct of_device_id *of_id; | ||
160 | struct usb_phy_data *phy_data; | ||
161 | |||
162 | of_id = of_match_device(of_match_ptr(omap_usb2_id_table), &pdev->dev); | ||
134 | 163 | ||
135 | if (!node) | 164 | if (!of_id) |
136 | return -EINVAL; | 165 | return -EINVAL; |
137 | 166 | ||
167 | phy_data = (struct usb_phy_data *)of_id->data; | ||
168 | |||
138 | phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); | 169 | phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); |
139 | if (!phy) { | 170 | if (!phy) { |
140 | dev_err(&pdev->dev, "unable to allocate memory for USB2 PHY\n"); | 171 | dev_err(&pdev->dev, "unable to allocate memory for USB2 PHY\n"); |
@@ -150,7 +181,7 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
150 | phy->dev = &pdev->dev; | 181 | phy->dev = &pdev->dev; |
151 | 182 | ||
152 | phy->phy.dev = phy->dev; | 183 | phy->phy.dev = phy->dev; |
153 | phy->phy.label = "omap-usb2"; | 184 | phy->phy.label = phy_data->label; |
154 | phy->phy.otg = otg; | 185 | phy->phy.otg = otg; |
155 | phy->phy.type = USB_PHY_TYPE_USB2; | 186 | phy->phy.type = USB_PHY_TYPE_USB2; |
156 | 187 | ||
@@ -171,8 +202,10 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
171 | 202 | ||
172 | otg->set_host = omap_usb_set_host; | 203 | otg->set_host = omap_usb_set_host; |
173 | otg->set_peripheral = omap_usb_set_peripheral; | 204 | otg->set_peripheral = omap_usb_set_peripheral; |
174 | otg->set_vbus = omap_usb_set_vbus; | 205 | if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS) |
175 | otg->start_srp = omap_usb_start_srp; | 206 | otg->set_vbus = omap_usb_set_vbus; |
207 | if (phy_data->flags & OMAP_USB2_HAS_START_SRP) | ||
208 | otg->start_srp = omap_usb_start_srp; | ||
176 | otg->phy = &phy->phy; | 209 | otg->phy = &phy->phy; |
177 | 210 | ||
178 | platform_set_drvdata(pdev, phy); | 211 | platform_set_drvdata(pdev, phy); |
@@ -272,14 +305,6 @@ static const struct dev_pm_ops omap_usb2_pm_ops = { | |||
272 | #define DEV_PM_OPS NULL | 305 | #define DEV_PM_OPS NULL |
273 | #endif | 306 | #endif |
274 | 307 | ||
275 | #ifdef CONFIG_OF | ||
276 | static const struct of_device_id omap_usb2_id_table[] = { | ||
277 | { .compatible = "ti,omap-usb2" }, | ||
278 | {} | ||
279 | }; | ||
280 | MODULE_DEVICE_TABLE(of, omap_usb2_id_table); | ||
281 | #endif | ||
282 | |||
283 | static struct platform_driver omap_usb2_driver = { | 308 | static struct platform_driver omap_usb2_driver = { |
284 | .probe = omap_usb2_probe, | 309 | .probe = omap_usb2_probe, |
285 | .remove = omap_usb2_remove, | 310 | .remove = omap_usb2_remove, |