H A D | phy-exynos5-usbdrd.c | 136 void (*phy_init)(struct exynos5_usbdrd_phy *phy_drd); 253 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); exynos5_usbdrd_pipe3_set_refclk() local 256 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); exynos5_usbdrd_pipe3_set_refclk() 266 switch (phy_drd->extrefclk) { exynos5_usbdrd_pipe3_set_refclk() 284 dev_dbg(phy_drd->dev, "unsupported ref clk\n"); exynos5_usbdrd_pipe3_set_refclk() 299 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); exynos5_usbdrd_utmi_set_refclk() local 302 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); exynos5_usbdrd_utmi_set_refclk() 310 reg |= PHYCLKRST_FSEL(phy_drd->extrefclk); exynos5_usbdrd_utmi_set_refclk() 315 static void exynos5_usbdrd_pipe3_init(struct exynos5_usbdrd_phy *phy_drd) exynos5_usbdrd_pipe3_init() argument 319 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); exynos5_usbdrd_pipe3_init() 323 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); exynos5_usbdrd_pipe3_init() 325 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); exynos5_usbdrd_pipe3_init() 327 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); exynos5_usbdrd_pipe3_init() 330 static void exynos5_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd) exynos5_usbdrd_utmi_init() argument 334 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); exynos5_usbdrd_utmi_init() 338 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); exynos5_usbdrd_utmi_init() 340 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); exynos5_usbdrd_utmi_init() 344 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM1); exynos5_usbdrd_utmi_init() 347 writel(PHYUTMI_OTGDISABLE, phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMI); exynos5_usbdrd_utmi_init() 349 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); exynos5_usbdrd_utmi_init() 351 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); exynos5_usbdrd_utmi_init() 359 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); exynos5_usbdrd_phy_init() local 361 ret = clk_prepare_enable(phy_drd->clk); exynos5_usbdrd_phy_init() 366 writel(0x0, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0); exynos5_usbdrd_phy_init() 367 writel(0x0, phy_drd->reg_phy + EXYNOS5_DRD_PHYRESUME); exynos5_usbdrd_phy_init() 375 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_LINKSYSTEM); exynos5_usbdrd_phy_init() 377 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); exynos5_usbdrd_phy_init() 380 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYPARAM0); exynos5_usbdrd_phy_init() 383 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMICLKSEL); exynos5_usbdrd_phy_init() 385 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMICLKSEL); exynos5_usbdrd_phy_init() 388 inst->phy_cfg->phy_init(phy_drd); exynos5_usbdrd_phy_init() 404 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); exynos5_usbdrd_phy_init() 409 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); exynos5_usbdrd_phy_init() 411 clk_disable_unprepare(phy_drd->clk); exynos5_usbdrd_phy_init() 421 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); exynos5_usbdrd_phy_exit() local 423 ret = clk_prepare_enable(phy_drd->clk); exynos5_usbdrd_phy_exit() 430 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMI); exynos5_usbdrd_phy_exit() 433 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); exynos5_usbdrd_phy_exit() 437 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST); exynos5_usbdrd_phy_exit() 440 reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); exynos5_usbdrd_phy_exit() 443 writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST); exynos5_usbdrd_phy_exit() 445 clk_disable_unprepare(phy_drd->clk); exynos5_usbdrd_phy_exit() 454 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); exynos5_usbdrd_phy_power_on() local 456 dev_dbg(phy_drd->dev, "Request to power_on usbdrd_phy phy\n"); exynos5_usbdrd_phy_power_on() 458 clk_prepare_enable(phy_drd->ref_clk); exynos5_usbdrd_phy_power_on() 459 if (!phy_drd->drv_data->has_common_clk_gate) { exynos5_usbdrd_phy_power_on() 460 clk_prepare_enable(phy_drd->pipeclk); exynos5_usbdrd_phy_power_on() 461 clk_prepare_enable(phy_drd->utmiclk); exynos5_usbdrd_phy_power_on() 462 clk_prepare_enable(phy_drd->itpclk); exynos5_usbdrd_phy_power_on() 466 if (phy_drd->vbus_boost) { exynos5_usbdrd_phy_power_on() 467 ret = regulator_enable(phy_drd->vbus_boost); exynos5_usbdrd_phy_power_on() 469 dev_err(phy_drd->dev, exynos5_usbdrd_phy_power_on() 475 if (phy_drd->vbus) { exynos5_usbdrd_phy_power_on() 476 ret = regulator_enable(phy_drd->vbus); exynos5_usbdrd_phy_power_on() 478 dev_err(phy_drd->dev, "Failed to enable VBUS supply\n"); exynos5_usbdrd_phy_power_on() 489 if (phy_drd->vbus_boost) exynos5_usbdrd_phy_power_on() 490 regulator_disable(phy_drd->vbus_boost); exynos5_usbdrd_phy_power_on() 493 clk_disable_unprepare(phy_drd->ref_clk); exynos5_usbdrd_phy_power_on() 494 if (!phy_drd->drv_data->has_common_clk_gate) { exynos5_usbdrd_phy_power_on() 495 clk_disable_unprepare(phy_drd->itpclk); exynos5_usbdrd_phy_power_on() 496 clk_disable_unprepare(phy_drd->utmiclk); exynos5_usbdrd_phy_power_on() 497 clk_disable_unprepare(phy_drd->pipeclk); exynos5_usbdrd_phy_power_on() 506 struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); exynos5_usbdrd_phy_power_off() local 508 dev_dbg(phy_drd->dev, "Request to power_off usbdrd_phy phy\n"); exynos5_usbdrd_phy_power_off() 514 if (phy_drd->vbus) exynos5_usbdrd_phy_power_off() 515 regulator_disable(phy_drd->vbus); exynos5_usbdrd_phy_power_off() 516 if (phy_drd->vbus_boost) exynos5_usbdrd_phy_power_off() 517 regulator_disable(phy_drd->vbus_boost); exynos5_usbdrd_phy_power_off() 519 clk_disable_unprepare(phy_drd->ref_clk); exynos5_usbdrd_phy_power_off() 520 if (!phy_drd->drv_data->has_common_clk_gate) { exynos5_usbdrd_phy_power_off() 521 clk_disable_unprepare(phy_drd->itpclk); exynos5_usbdrd_phy_power_off() 522 clk_disable_unprepare(phy_drd->pipeclk); exynos5_usbdrd_phy_power_off() 523 clk_disable_unprepare(phy_drd->utmiclk); exynos5_usbdrd_phy_power_off() 532 struct exynos5_usbdrd_phy *phy_drd = dev_get_drvdata(dev); exynos5_usbdrd_phy_xlate() local 537 return phy_drd->phys[args->args[0]].phy; exynos5_usbdrd_phy_xlate() 548 static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd) exynos5_usbdrd_phy_clk_handle() argument 553 phy_drd->clk = devm_clk_get(phy_drd->dev, "phy"); exynos5_usbdrd_phy_clk_handle() 554 if (IS_ERR(phy_drd->clk)) { exynos5_usbdrd_phy_clk_handle() 555 dev_err(phy_drd->dev, "Failed to get phy clock\n"); exynos5_usbdrd_phy_clk_handle() 556 return PTR_ERR(phy_drd->clk); exynos5_usbdrd_phy_clk_handle() 559 phy_drd->ref_clk = devm_clk_get(phy_drd->dev, "ref"); exynos5_usbdrd_phy_clk_handle() 560 if (IS_ERR(phy_drd->ref_clk)) { exynos5_usbdrd_phy_clk_handle() 561 dev_err(phy_drd->dev, "Failed to get phy reference clock\n"); exynos5_usbdrd_phy_clk_handle() 562 return PTR_ERR(phy_drd->ref_clk); exynos5_usbdrd_phy_clk_handle() 564 ref_rate = clk_get_rate(phy_drd->ref_clk); exynos5_usbdrd_phy_clk_handle() 566 ret = exynos5_rate_to_clk(ref_rate, &phy_drd->extrefclk); exynos5_usbdrd_phy_clk_handle() 568 dev_err(phy_drd->dev, "Clock rate (%ld) not supported\n", exynos5_usbdrd_phy_clk_handle() 573 if (!phy_drd->drv_data->has_common_clk_gate) { exynos5_usbdrd_phy_clk_handle() 574 phy_drd->pipeclk = devm_clk_get(phy_drd->dev, "phy_pipe"); exynos5_usbdrd_phy_clk_handle() 575 if (IS_ERR(phy_drd->pipeclk)) { exynos5_usbdrd_phy_clk_handle() 576 dev_info(phy_drd->dev, exynos5_usbdrd_phy_clk_handle() 578 phy_drd->pipeclk = NULL; exynos5_usbdrd_phy_clk_handle() 581 phy_drd->utmiclk = devm_clk_get(phy_drd->dev, "phy_utmi"); exynos5_usbdrd_phy_clk_handle() 582 if (IS_ERR(phy_drd->utmiclk)) { exynos5_usbdrd_phy_clk_handle() 583 dev_info(phy_drd->dev, exynos5_usbdrd_phy_clk_handle() 585 phy_drd->utmiclk = NULL; exynos5_usbdrd_phy_clk_handle() 588 phy_drd->itpclk = devm_clk_get(phy_drd->dev, "itp"); exynos5_usbdrd_phy_clk_handle() 589 if (IS_ERR(phy_drd->itpclk)) { exynos5_usbdrd_phy_clk_handle() 590 dev_info(phy_drd->dev, exynos5_usbdrd_phy_clk_handle() 592 phy_drd->itpclk = NULL; exynos5_usbdrd_phy_clk_handle() 662 struct exynos5_usbdrd_phy *phy_drd; exynos5_usbdrd_phy_probe() local 672 phy_drd = devm_kzalloc(dev, sizeof(*phy_drd), GFP_KERNEL); exynos5_usbdrd_phy_probe() 673 if (!phy_drd) exynos5_usbdrd_phy_probe() 676 dev_set_drvdata(dev, phy_drd); exynos5_usbdrd_phy_probe() 677 phy_drd->dev = dev; exynos5_usbdrd_phy_probe() 680 phy_drd->reg_phy = devm_ioremap_resource(dev, res); exynos5_usbdrd_phy_probe() 681 if (IS_ERR(phy_drd->reg_phy)) exynos5_usbdrd_phy_probe() 682 return PTR_ERR(phy_drd->reg_phy); exynos5_usbdrd_phy_probe() 687 phy_drd->drv_data = drv_data; exynos5_usbdrd_phy_probe() 689 ret = exynos5_usbdrd_phy_clk_handle(phy_drd); exynos5_usbdrd_phy_probe() 713 pmu_offset = phy_drd->drv_data->pmu_offset_usbdrd1_phy; exynos5_usbdrd_phy_probe() 717 pmu_offset = phy_drd->drv_data->pmu_offset_usbdrd0_phy; exynos5_usbdrd_phy_probe() 722 phy_drd->vbus = devm_regulator_get(dev, "vbus"); exynos5_usbdrd_phy_probe() 723 if (IS_ERR(phy_drd->vbus)) { exynos5_usbdrd_phy_probe() 724 ret = PTR_ERR(phy_drd->vbus); exynos5_usbdrd_phy_probe() 729 phy_drd->vbus = NULL; exynos5_usbdrd_phy_probe() 732 phy_drd->vbus_boost = devm_regulator_get(dev, "vbus-boost"); exynos5_usbdrd_phy_probe() 733 if (IS_ERR(phy_drd->vbus_boost)) { exynos5_usbdrd_phy_probe() 734 ret = PTR_ERR(phy_drd->vbus_boost); exynos5_usbdrd_phy_probe() 739 phy_drd->vbus_boost = NULL; exynos5_usbdrd_phy_probe() 752 phy_drd->phys[i].phy = phy; exynos5_usbdrd_phy_probe() 753 phy_drd->phys[i].index = i; exynos5_usbdrd_phy_probe() 754 phy_drd->phys[i].reg_pmu = reg_pmu; exynos5_usbdrd_phy_probe() 755 phy_drd->phys[i].pmu_offset = pmu_offset; exynos5_usbdrd_phy_probe() 756 phy_drd->phys[i].phy_cfg = &drv_data->phy_cfg[i]; exynos5_usbdrd_phy_probe() 757 phy_set_drvdata(phy, &phy_drd->phys[i]); exynos5_usbdrd_phy_probe() 763 dev_err(phy_drd->dev, "Failed to register phy provider\n"); exynos5_usbdrd_phy_probe()
|