aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2013-02-13 06:16:25 -0500
committerRoger Quadros <rogerq@ti.com>2013-02-13 06:22:35 -0500
commit9d9c6ae79c5e3452721c5eaebdd793edde9d93df (patch)
treeba3a6a90f83c5fd867eec2e905c19d160cc51415 /drivers/mfd
parent7f07863ec60f7d3dbeec5aff881ea074db3925ed (diff)
mfd: omap-usb-host: Consolidate OMAP USB-HS platform data (part 2/3)
Let's have a single platform data structure for the OMAP's High-Speed USB host subsystem instead of having 3 separate ones i.e. one for board data, one for USB Host (UHH) module and one for USB-TLL module. This makes the code much simpler and avoids creating multiple copies of platform data. Signed-off-by: Roger Quadros <rogerq@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> For the ehci-omap.c part: Acked-by: Alan Stern <stern@rowland.harvard.edu>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/omap-usb-host.c63
-rw-r--r--drivers/mfd/omap-usb-tll.c11
2 files changed, 31 insertions, 43 deletions
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 05164d7f054b..d6e6b8ca854c 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -102,7 +102,7 @@ struct usbhs_hcd_omap {
102 102
103 void __iomem *uhh_base; 103 void __iomem *uhh_base;
104 104
105 struct usbhs_omap_platform_data platdata; 105 struct usbhs_omap_platform_data *pdata;
106 106
107 u32 usbhs_rev; 107 u32 usbhs_rev;
108 spinlock_t lock; 108 spinlock_t lock;
@@ -184,19 +184,13 @@ err_end:
184static int omap_usbhs_alloc_children(struct platform_device *pdev) 184static int omap_usbhs_alloc_children(struct platform_device *pdev)
185{ 185{
186 struct device *dev = &pdev->dev; 186 struct device *dev = &pdev->dev;
187 struct usbhs_hcd_omap *omap; 187 struct usbhs_omap_platform_data *pdata = dev->platform_data;
188 struct ehci_hcd_omap_platform_data *ehci_data;
189 struct ohci_hcd_omap_platform_data *ohci_data;
190 struct platform_device *ehci; 188 struct platform_device *ehci;
191 struct platform_device *ohci; 189 struct platform_device *ohci;
192 struct resource *res; 190 struct resource *res;
193 struct resource resources[2]; 191 struct resource resources[2];
194 int ret; 192 int ret;
195 193
196 omap = platform_get_drvdata(pdev);
197 ehci_data = omap->platdata.ehci_data;
198 ohci_data = omap->platdata.ohci_data;
199
200 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ehci"); 194 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ehci");
201 if (!res) { 195 if (!res) {
202 dev_err(dev, "EHCI get resource IORESOURCE_MEM failed\n"); 196 dev_err(dev, "EHCI get resource IORESOURCE_MEM failed\n");
@@ -213,8 +207,8 @@ static int omap_usbhs_alloc_children(struct platform_device *pdev)
213 } 207 }
214 resources[1] = *res; 208 resources[1] = *res;
215 209
216 ehci = omap_usbhs_alloc_child(OMAP_EHCI_DEVICE, resources, 2, ehci_data, 210 ehci = omap_usbhs_alloc_child(OMAP_EHCI_DEVICE, resources, 2, pdata,
217 sizeof(*ehci_data), dev); 211 sizeof(*pdata), dev);
218 212
219 if (!ehci) { 213 if (!ehci) {
220 dev_err(dev, "omap_usbhs_alloc_child failed\n"); 214 dev_err(dev, "omap_usbhs_alloc_child failed\n");
@@ -238,8 +232,8 @@ static int omap_usbhs_alloc_children(struct platform_device *pdev)
238 } 232 }
239 resources[1] = *res; 233 resources[1] = *res;
240 234
241 ohci = omap_usbhs_alloc_child(OMAP_OHCI_DEVICE, resources, 2, ohci_data, 235 ohci = omap_usbhs_alloc_child(OMAP_OHCI_DEVICE, resources, 2, pdata,
242 sizeof(*ohci_data), dev); 236 sizeof(*pdata), dev);
243 if (!ohci) { 237 if (!ohci) {
244 dev_err(dev, "omap_usbhs_alloc_child failed\n"); 238 dev_err(dev, "omap_usbhs_alloc_child failed\n");
245 ret = -ENOMEM; 239 ret = -ENOMEM;
@@ -278,7 +272,7 @@ static bool is_ohci_port(enum usbhs_omap_port_mode pmode)
278static int usbhs_runtime_resume(struct device *dev) 272static int usbhs_runtime_resume(struct device *dev)
279{ 273{
280 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); 274 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
281 struct usbhs_omap_platform_data *pdata = &omap->platdata; 275 struct usbhs_omap_platform_data *pdata = omap->pdata;
282 unsigned long flags; 276 unsigned long flags;
283 277
284 dev_dbg(dev, "usbhs_runtime_resume\n"); 278 dev_dbg(dev, "usbhs_runtime_resume\n");
@@ -310,7 +304,7 @@ static int usbhs_runtime_resume(struct device *dev)
310static int usbhs_runtime_suspend(struct device *dev) 304static int usbhs_runtime_suspend(struct device *dev)
311{ 305{
312 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); 306 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
313 struct usbhs_omap_platform_data *pdata = &omap->platdata; 307 struct usbhs_omap_platform_data *pdata = omap->pdata;
314 unsigned long flags; 308 unsigned long flags;
315 309
316 dev_dbg(dev, "usbhs_runtime_suspend\n"); 310 dev_dbg(dev, "usbhs_runtime_suspend\n");
@@ -342,19 +336,19 @@ static int usbhs_runtime_suspend(struct device *dev)
342static void omap_usbhs_init(struct device *dev) 336static void omap_usbhs_init(struct device *dev)
343{ 337{
344 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); 338 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
345 struct usbhs_omap_platform_data *pdata = &omap->platdata; 339 struct usbhs_omap_platform_data *pdata = omap->pdata;
346 unsigned long flags; 340 unsigned long flags;
347 unsigned reg; 341 unsigned reg;
348 342
349 dev_dbg(dev, "starting TI HSUSB Controller\n"); 343 dev_dbg(dev, "starting TI HSUSB Controller\n");
350 344
351 if (pdata->ehci_data->phy_reset) { 345 if (pdata->phy_reset) {
352 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 346 if (gpio_is_valid(pdata->reset_gpio_port[0]))
353 gpio_request_one(pdata->ehci_data->reset_gpio_port[0], 347 gpio_request_one(pdata->reset_gpio_port[0],
354 GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); 348 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
355 349
356 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 350 if (gpio_is_valid(pdata->reset_gpio_port[1]))
357 gpio_request_one(pdata->ehci_data->reset_gpio_port[1], 351 gpio_request_one(pdata->reset_gpio_port[1],
358 GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); 352 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
359 353
360 /* Hold the PHY in RESET for enough time till DIR is high */ 354 /* Hold the PHY in RESET for enough time till DIR is high */
@@ -430,33 +424,33 @@ static void omap_usbhs_init(struct device *dev)
430 spin_unlock_irqrestore(&omap->lock, flags); 424 spin_unlock_irqrestore(&omap->lock, flags);
431 425
432 pm_runtime_put_sync(dev); 426 pm_runtime_put_sync(dev);
433 if (pdata->ehci_data->phy_reset) { 427 if (pdata->phy_reset) {
434 /* Hold the PHY in RESET for enough time till 428 /* Hold the PHY in RESET for enough time till
435 * PHY is settled and ready 429 * PHY is settled and ready
436 */ 430 */
437 udelay(10); 431 udelay(10);
438 432
439 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 433 if (gpio_is_valid(pdata->reset_gpio_port[0]))
440 gpio_set_value_cansleep 434 gpio_set_value_cansleep
441 (pdata->ehci_data->reset_gpio_port[0], 1); 435 (pdata->reset_gpio_port[0], 1);
442 436
443 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 437 if (gpio_is_valid(pdata->reset_gpio_port[1]))
444 gpio_set_value_cansleep 438 gpio_set_value_cansleep
445 (pdata->ehci_data->reset_gpio_port[1], 1); 439 (pdata->reset_gpio_port[1], 1);
446 } 440 }
447} 441}
448 442
449static void omap_usbhs_deinit(struct device *dev) 443static void omap_usbhs_deinit(struct device *dev)
450{ 444{
451 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); 445 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
452 struct usbhs_omap_platform_data *pdata = &omap->platdata; 446 struct usbhs_omap_platform_data *pdata = omap->pdata;
453 447
454 if (pdata->ehci_data->phy_reset) { 448 if (pdata->phy_reset) {
455 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 449 if (gpio_is_valid(pdata->reset_gpio_port[0]))
456 gpio_free(pdata->ehci_data->reset_gpio_port[0]); 450 gpio_free(pdata->reset_gpio_port[0]);
457 451
458 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 452 if (gpio_is_valid(pdata->reset_gpio_port[1]))
459 gpio_free(pdata->ehci_data->reset_gpio_port[1]); 453 gpio_free(pdata->reset_gpio_port[1]);
460 } 454 }
461} 455}
462 456
@@ -490,15 +484,10 @@ static int usbhs_omap_probe(struct platform_device *pdev)
490 484
491 spin_lock_init(&omap->lock); 485 spin_lock_init(&omap->lock);
492 486
493 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) 487 omap->pdata = pdata;
494 omap->platdata.port_mode[i] = pdata->port_mode[i];
495
496 omap->platdata.ehci_data = pdata->ehci_data;
497 omap->platdata.ohci_data = pdata->ohci_data;
498 488
499 pm_runtime_enable(dev); 489 pm_runtime_enable(dev);
500 490
501
502 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) 491 for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
503 if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) || 492 if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) ||
504 is_ehci_hsic_mode(i)) { 493 is_ehci_hsic_mode(i)) {
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index eb869153206d..e45948969907 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -98,7 +98,7 @@
98struct usbtll_omap { 98struct usbtll_omap {
99 struct clk *usbtll_p1_fck; 99 struct clk *usbtll_p1_fck;
100 struct clk *usbtll_p2_fck; 100 struct clk *usbtll_p2_fck;
101 struct usbtll_omap_platform_data platdata; 101 struct usbhs_omap_platform_data *pdata;
102 /* secure the register updates */ 102 /* secure the register updates */
103 spinlock_t lock; 103 spinlock_t lock;
104}; 104};
@@ -203,7 +203,7 @@ static unsigned ohci_omap3_fslsmode(enum usbhs_omap_port_mode mode)
203static int usbtll_omap_probe(struct platform_device *pdev) 203static int usbtll_omap_probe(struct platform_device *pdev)
204{ 204{
205 struct device *dev = &pdev->dev; 205 struct device *dev = &pdev->dev;
206 struct usbtll_omap_platform_data *pdata = dev->platform_data; 206 struct usbhs_omap_platform_data *pdata = dev->platform_data;
207 void __iomem *base; 207 void __iomem *base;
208 struct resource *res; 208 struct resource *res;
209 struct usbtll_omap *tll; 209 struct usbtll_omap *tll;
@@ -223,8 +223,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)
223 223
224 spin_lock_init(&tll->lock); 224 spin_lock_init(&tll->lock);
225 225
226 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) 226 tll->pdata = pdata;
227 tll->platdata.port_mode[i] = pdata->port_mode[i];
228 227
229 tll->usbtll_p1_fck = clk_get(dev, "usb_tll_hs_usb_ch0_clk"); 228 tll->usbtll_p1_fck = clk_get(dev, "usb_tll_hs_usb_ch0_clk");
230 if (IS_ERR(tll->usbtll_p1_fck)) { 229 if (IS_ERR(tll->usbtll_p1_fck)) {
@@ -362,7 +361,7 @@ static int usbtll_omap_remove(struct platform_device *pdev)
362static int usbtll_runtime_resume(struct device *dev) 361static int usbtll_runtime_resume(struct device *dev)
363{ 362{
364 struct usbtll_omap *tll = dev_get_drvdata(dev); 363 struct usbtll_omap *tll = dev_get_drvdata(dev);
365 struct usbtll_omap_platform_data *pdata = &tll->platdata; 364 struct usbhs_omap_platform_data *pdata = tll->pdata;
366 unsigned long flags; 365 unsigned long flags;
367 366
368 dev_dbg(dev, "usbtll_runtime_resume\n"); 367 dev_dbg(dev, "usbtll_runtime_resume\n");
@@ -388,7 +387,7 @@ static int usbtll_runtime_resume(struct device *dev)
388static int usbtll_runtime_suspend(struct device *dev) 387static int usbtll_runtime_suspend(struct device *dev)
389{ 388{
390 struct usbtll_omap *tll = dev_get_drvdata(dev); 389 struct usbtll_omap *tll = dev_get_drvdata(dev);
391 struct usbtll_omap_platform_data *pdata = &tll->platdata; 390 struct usbhs_omap_platform_data *pdata = tll->pdata;
392 unsigned long flags; 391 unsigned long flags;
393 392
394 dev_dbg(dev, "usbtll_runtime_suspend\n"); 393 dev_dbg(dev, "usbtll_runtime_suspend\n");