aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy-samsung-usb2.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 14:31:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 14:31:09 -0400
commita84270189e2afc7028b1123415a66d444f460977 (patch)
tree0f239afe73655167c02b411d1cf84bf3211818af /drivers/usb/phy/phy-samsung-usb2.c
parentbcd7351e83728859833e3c5b8aae9a2816914e4b (diff)
parent3a0ddc714a1b8fcbff24c135a1332a28b4668d78 (diff)
Merge tag 'usb-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB updates from Greg KH: "Here's the big USB 3.11-rc1 merge request. Lots of gadget and finally, chipidea driver updates (they were much needed), along with a new host controller driver, lots of little serial driver fixes, the removal of the 255 usb-serial device limitation, and a variety of other minor things. All of these have been in the linux-next releases for a while" * tag 'usb-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (254 commits) usb: musb: omap2430: make it compile again usb: chipidea: ci_hdrc_imx: access phy via private data xhci: Add missing unlocks on error paths USB: option,qcserial: move Novatel Gobi1K IDs to qcserial ehci-atmel.c: prepare clk before calling enable USB: ohci-at91: prepare clk before calling enable USB: HWA: fix device probe failure wusbcore: add entries in Documentation/ABI for new wusbhc sysfs attributes wusbcore: add sysfs attribute for retry count wusbcore: add sysfs attribute for DNTS count and interval usb: chipidea: drop "13xxx" infix usb: phy: tegra: remove duplicated include from phy-tegra-usb.c usb: host: xhci-plat: release mem region while removing module usbmisc_imx: allow autoloading on according to dt ids usb: fix build error without CONFIG_USB_PHY usb: check usb_hub_to_struct_hub() return value xhci: check for failed dma pool allocation usb: gadget: f_subset: fix missing unlock on error in geth_alloc() usb: gadget: f_ncm: fix missing unlock on error in ncm_alloc() usb: gadget: f_ecm: fix missing unlock on error in ecm_alloc() ...
Diffstat (limited to 'drivers/usb/phy/phy-samsung-usb2.c')
-rw-r--r--drivers/usb/phy/phy-samsung-usb2.c62
1 files changed, 49 insertions, 13 deletions
diff --git a/drivers/usb/phy/phy-samsung-usb2.c b/drivers/usb/phy/phy-samsung-usb2.c
index 9d5e273abcc7..1011c16ade7e 100644
--- a/drivers/usb/phy/phy-samsung-usb2.c
+++ b/drivers/usb/phy/phy-samsung-usb2.c
@@ -176,6 +176,11 @@ static void samsung_usb2phy_enable(struct samsung_usbphy *sphy)
176 phypwr &= ~PHYPWR_NORMAL_MASK; 176 phypwr &= ~PHYPWR_NORMAL_MASK;
177 rstcon |= RSTCON_SWRST; 177 rstcon |= RSTCON_SWRST;
178 break; 178 break;
179 case TYPE_EXYNOS4X12:
180 phypwr &= ~(PHYPWR_NORMAL_MASK_HSIC0 |
181 PHYPWR_NORMAL_MASK_HSIC1 |
182 PHYPWR_NORMAL_MASK_PHY1);
183 rstcon |= RSTCON_HOSTPHY_SWRST;
179 case TYPE_EXYNOS4210: 184 case TYPE_EXYNOS4210:
180 phypwr &= ~PHYPWR_NORMAL_MASK_PHY0; 185 phypwr &= ~PHYPWR_NORMAL_MASK_PHY0;
181 rstcon |= RSTCON_SWRST; 186 rstcon |= RSTCON_SWRST;
@@ -189,6 +194,8 @@ static void samsung_usb2phy_enable(struct samsung_usbphy *sphy)
189 /* reset all ports of PHY and Link */ 194 /* reset all ports of PHY and Link */
190 writel(rstcon, regs + SAMSUNG_RSTCON); 195 writel(rstcon, regs + SAMSUNG_RSTCON);
191 udelay(10); 196 udelay(10);
197 if (sphy->drv_data->cpu_type == TYPE_EXYNOS4X12)
198 rstcon &= ~RSTCON_HOSTPHY_SWRST;
192 rstcon &= ~RSTCON_SWRST; 199 rstcon &= ~RSTCON_SWRST;
193 writel(rstcon, regs + SAMSUNG_RSTCON); 200 writel(rstcon, regs + SAMSUNG_RSTCON);
194} 201}
@@ -239,6 +246,10 @@ static void samsung_usb2phy_disable(struct samsung_usbphy *sphy)
239 case TYPE_S3C64XX: 246 case TYPE_S3C64XX:
240 phypwr |= PHYPWR_NORMAL_MASK; 247 phypwr |= PHYPWR_NORMAL_MASK;
241 break; 248 break;
249 case TYPE_EXYNOS4X12:
250 phypwr |= (PHYPWR_NORMAL_MASK_HSIC0 |
251 PHYPWR_NORMAL_MASK_HSIC1 |
252 PHYPWR_NORMAL_MASK_PHY1);
242 case TYPE_EXYNOS4210: 253 case TYPE_EXYNOS4210:
243 phypwr |= PHYPWR_NORMAL_MASK_PHY0; 254 phypwr |= PHYPWR_NORMAL_MASK_PHY0;
244 default: 255 default:
@@ -284,17 +295,14 @@ static int samsung_usb2phy_init(struct usb_phy *phy)
284 /* Disable phy isolation */ 295 /* Disable phy isolation */
285 if (sphy->plat && sphy->plat->pmu_isolation) 296 if (sphy->plat && sphy->plat->pmu_isolation)
286 sphy->plat->pmu_isolation(false); 297 sphy->plat->pmu_isolation(false);
287 else 298 else if (sphy->drv_data->set_isolation)
288 samsung_usbphy_set_isolation(sphy, false); 299 sphy->drv_data->set_isolation(sphy, false);
289 300
290 /* Selecting Host/OTG mode; After reset USB2.0PHY_CFG: HOST */ 301 /* Selecting Host/OTG mode; After reset USB2.0PHY_CFG: HOST */
291 samsung_usbphy_cfg_sel(sphy); 302 samsung_usbphy_cfg_sel(sphy);
292 303
293 /* Initialize usb phy registers */ 304 /* Initialize usb phy registers */
294 if (sphy->drv_data->cpu_type == TYPE_EXYNOS5250) 305 sphy->drv_data->phy_enable(sphy);
295 samsung_exynos5_usb2phy_enable(sphy);
296 else
297 samsung_usb2phy_enable(sphy);
298 306
299 spin_unlock_irqrestore(&sphy->lock, flags); 307 spin_unlock_irqrestore(&sphy->lock, flags);
300 308
@@ -334,16 +342,13 @@ static void samsung_usb2phy_shutdown(struct usb_phy *phy)
334 } 342 }
335 343
336 /* De-initialize usb phy registers */ 344 /* De-initialize usb phy registers */
337 if (sphy->drv_data->cpu_type == TYPE_EXYNOS5250) 345 sphy->drv_data->phy_disable(sphy);
338 samsung_exynos5_usb2phy_disable(sphy);
339 else
340 samsung_usb2phy_disable(sphy);
341 346
342 /* Enable phy isolation */ 347 /* Enable phy isolation */
343 if (sphy->plat && sphy->plat->pmu_isolation) 348 if (sphy->plat && sphy->plat->pmu_isolation)
344 sphy->plat->pmu_isolation(true); 349 sphy->plat->pmu_isolation(true);
345 else 350 else if (sphy->drv_data->set_isolation)
346 samsung_usbphy_set_isolation(sphy, true); 351 sphy->drv_data->set_isolation(sphy, true);
347 352
348 spin_unlock_irqrestore(&sphy->lock, flags); 353 spin_unlock_irqrestore(&sphy->lock, flags);
349 354
@@ -408,7 +413,10 @@ static int samsung_usb2phy_probe(struct platform_device *pdev)
408 sphy->phy.label = "samsung-usb2phy"; 413 sphy->phy.label = "samsung-usb2phy";
409 sphy->phy.init = samsung_usb2phy_init; 414 sphy->phy.init = samsung_usb2phy_init;
410 sphy->phy.shutdown = samsung_usb2phy_shutdown; 415 sphy->phy.shutdown = samsung_usb2phy_shutdown;
411 sphy->ref_clk_freq = samsung_usbphy_get_refclk_freq(sphy); 416
417 sphy->ref_clk_freq = samsung_usbphy_get_refclk_freq(sphy);
418 if (sphy->ref_clk_freq < 0)
419 return -EINVAL;
412 420
413 sphy->phy.otg = otg; 421 sphy->phy.otg = otg;
414 sphy->phy.otg->phy = &sphy->phy; 422 sphy->phy.otg->phy = &sphy->phy;
@@ -438,18 +446,40 @@ static int samsung_usb2phy_remove(struct platform_device *pdev)
438static const struct samsung_usbphy_drvdata usb2phy_s3c64xx = { 446static const struct samsung_usbphy_drvdata usb2phy_s3c64xx = {
439 .cpu_type = TYPE_S3C64XX, 447 .cpu_type = TYPE_S3C64XX,
440 .devphy_en_mask = S3C64XX_USBPHY_ENABLE, 448 .devphy_en_mask = S3C64XX_USBPHY_ENABLE,
449 .rate_to_clksel = samsung_usbphy_rate_to_clksel_64xx,
450 .set_isolation = NULL, /* TODO */
451 .phy_enable = samsung_usb2phy_enable,
452 .phy_disable = samsung_usb2phy_disable,
441}; 453};
442 454
443static const struct samsung_usbphy_drvdata usb2phy_exynos4 = { 455static const struct samsung_usbphy_drvdata usb2phy_exynos4 = {
444 .cpu_type = TYPE_EXYNOS4210, 456 .cpu_type = TYPE_EXYNOS4210,
445 .devphy_en_mask = EXYNOS_USBPHY_ENABLE, 457 .devphy_en_mask = EXYNOS_USBPHY_ENABLE,
446 .hostphy_en_mask = EXYNOS_USBPHY_ENABLE, 458 .hostphy_en_mask = EXYNOS_USBPHY_ENABLE,
459 .rate_to_clksel = samsung_usbphy_rate_to_clksel_64xx,
460 .set_isolation = samsung_usbphy_set_isolation_4210,
461 .phy_enable = samsung_usb2phy_enable,
462 .phy_disable = samsung_usb2phy_disable,
463};
464
465static const struct samsung_usbphy_drvdata usb2phy_exynos4x12 = {
466 .cpu_type = TYPE_EXYNOS4X12,
467 .devphy_en_mask = EXYNOS_USBPHY_ENABLE,
468 .hostphy_en_mask = EXYNOS_USBPHY_ENABLE,
469 .rate_to_clksel = samsung_usbphy_rate_to_clksel_4x12,
470 .set_isolation = samsung_usbphy_set_isolation_4210,
471 .phy_enable = samsung_usb2phy_enable,
472 .phy_disable = samsung_usb2phy_disable,
447}; 473};
448 474
449static struct samsung_usbphy_drvdata usb2phy_exynos5 = { 475static struct samsung_usbphy_drvdata usb2phy_exynos5 = {
450 .cpu_type = TYPE_EXYNOS5250, 476 .cpu_type = TYPE_EXYNOS5250,
451 .hostphy_en_mask = EXYNOS_USBPHY_ENABLE, 477 .hostphy_en_mask = EXYNOS_USBPHY_ENABLE,
452 .hostphy_reg_offset = EXYNOS_USBHOST_PHY_CTRL_OFFSET, 478 .hostphy_reg_offset = EXYNOS_USBHOST_PHY_CTRL_OFFSET,
479 .rate_to_clksel = samsung_usbphy_rate_to_clksel_4x12,
480 .set_isolation = samsung_usbphy_set_isolation_4210,
481 .phy_enable = samsung_exynos5_usb2phy_enable,
482 .phy_disable = samsung_exynos5_usb2phy_disable,
453}; 483};
454 484
455#ifdef CONFIG_OF 485#ifdef CONFIG_OF
@@ -461,6 +491,9 @@ static const struct of_device_id samsung_usbphy_dt_match[] = {
461 .compatible = "samsung,exynos4210-usb2phy", 491 .compatible = "samsung,exynos4210-usb2phy",
462 .data = &usb2phy_exynos4, 492 .data = &usb2phy_exynos4,
463 }, { 493 }, {
494 .compatible = "samsung,exynos4x12-usb2phy",
495 .data = &usb2phy_exynos4x12,
496 }, {
464 .compatible = "samsung,exynos5250-usb2phy", 497 .compatible = "samsung,exynos5250-usb2phy",
465 .data = &usb2phy_exynos5 498 .data = &usb2phy_exynos5
466 }, 499 },
@@ -477,6 +510,9 @@ static struct platform_device_id samsung_usbphy_driver_ids[] = {
477 .name = "exynos4210-usb2phy", 510 .name = "exynos4210-usb2phy",
478 .driver_data = (unsigned long)&usb2phy_exynos4, 511 .driver_data = (unsigned long)&usb2phy_exynos4,
479 }, { 512 }, {
513 .name = "exynos4x12-usb2phy",
514 .driver_data = (unsigned long)&usb2phy_exynos4x12,
515 }, {
480 .name = "exynos5250-usb2phy", 516 .name = "exynos5250-usb2phy",
481 .driver_data = (unsigned long)&usb2phy_exynos5, 517 .driver_data = (unsigned long)&usb2phy_exynos5,
482 }, 518 },