aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2018-04-09 18:02:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-23 03:50:57 -0400
commitf59cd940051459f04eb5cbdf07cab27d628439cf (patch)
treeed877a80cddafb486655a49034bddafb998be6a8
parentb462e2e0d62a716f7a1b7a7ecea966edc3de45d7 (diff)
usb: phy: tegra: Cleanup error messages
Tegra's PHY driver has a mix of pr_err() and dev_err(), let's switch to dev_err() and use common errors message formatting across the driver for consistency. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/phy/phy-tegra-usb.c69
1 files changed, 41 insertions, 28 deletions
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index 0e8d23e51732..e46219e7fa93 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -236,10 +236,14 @@ static void set_phcd(struct tegra_usb_phy *phy, bool enable)
236 236
237static int utmip_pad_open(struct tegra_usb_phy *phy) 237static int utmip_pad_open(struct tegra_usb_phy *phy)
238{ 238{
239 int err;
240
239 phy->pad_clk = devm_clk_get(phy->u_phy.dev, "utmi-pads"); 241 phy->pad_clk = devm_clk_get(phy->u_phy.dev, "utmi-pads");
240 if (IS_ERR(phy->pad_clk)) { 242 if (IS_ERR(phy->pad_clk)) {
241 pr_err("%s: can't get utmip pad clock\n", __func__); 243 err = PTR_ERR(phy->pad_clk);
242 return PTR_ERR(phy->pad_clk); 244 dev_err(phy->u_phy.dev,
245 "Failed to get UTMIP pad clock: %d\n", err);
246 return err;
243 } 247 }
244 248
245 return 0; 249 return 0;
@@ -282,7 +286,7 @@ static int utmip_pad_power_off(struct tegra_usb_phy *phy)
282 void __iomem *base = phy->pad_regs; 286 void __iomem *base = phy->pad_regs;
283 287
284 if (!utmip_pad_count) { 288 if (!utmip_pad_count) {
285 pr_err("%s: utmip pad already powered off\n", __func__); 289 dev_err(phy->u_phy.dev, "UTMIP pad already powered off\n");
286 return -EINVAL; 290 return -EINVAL;
287 } 291 }
288 292
@@ -338,7 +342,8 @@ static void utmi_phy_clk_disable(struct tegra_usb_phy *phy)
338 set_phcd(phy, true); 342 set_phcd(phy, true);
339 343
340 if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0) 344 if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0)
341 pr_err("%s: timeout waiting for phy to stabilize\n", __func__); 345 dev_err(phy->u_phy.dev,
346 "Timeout waiting for PHY to stabilize on disable\n");
342} 347}
343 348
344static void utmi_phy_clk_enable(struct tegra_usb_phy *phy) 349static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
@@ -370,7 +375,8 @@ static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
370 375
371 if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 376 if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID,
372 USB_PHY_CLK_VALID)) 377 USB_PHY_CLK_VALID))
373 pr_err("%s: timeout waiting for phy to stabilize\n", __func__); 378 dev_err(phy->u_phy.dev,
379 "Timeout waiting for PHY to stabilize on enable\n");
374} 380}
375 381
376static int utmi_phy_power_on(struct tegra_usb_phy *phy) 382static int utmi_phy_power_on(struct tegra_usb_phy *phy)
@@ -617,15 +623,15 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
617 623
618 ret = gpio_direction_output(phy->reset_gpio, 0); 624 ret = gpio_direction_output(phy->reset_gpio, 0);
619 if (ret < 0) { 625 if (ret < 0) {
620 dev_err(phy->u_phy.dev, "gpio %d not set to 0\n", 626 dev_err(phy->u_phy.dev, "GPIO %d not set to 0: %d\n",
621 phy->reset_gpio); 627 phy->reset_gpio, ret);
622 return ret; 628 return ret;
623 } 629 }
624 msleep(5); 630 msleep(5);
625 ret = gpio_direction_output(phy->reset_gpio, 1); 631 ret = gpio_direction_output(phy->reset_gpio, 1);
626 if (ret < 0) { 632 if (ret < 0) {
627 dev_err(phy->u_phy.dev, "gpio %d not set to 1\n", 633 dev_err(phy->u_phy.dev, "GPIO %d not set to 1: %d\n",
628 phy->reset_gpio); 634 phy->reset_gpio, ret);
629 return ret; 635 return ret;
630 } 636 }
631 637
@@ -661,13 +667,13 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
661 /* Fix VbusInvalid due to floating VBUS */ 667 /* Fix VbusInvalid due to floating VBUS */
662 ret = usb_phy_io_write(phy->ulpi, 0x40, 0x08); 668 ret = usb_phy_io_write(phy->ulpi, 0x40, 0x08);
663 if (ret) { 669 if (ret) {
664 pr_err("%s: ulpi write failed\n", __func__); 670 dev_err(phy->u_phy.dev, "ULPI write failed: %d\n", ret);
665 return ret; 671 return ret;
666 } 672 }
667 673
668 ret = usb_phy_io_write(phy->ulpi, 0x80, 0x0B); 674 ret = usb_phy_io_write(phy->ulpi, 0x80, 0x0B);
669 if (ret) { 675 if (ret) {
670 pr_err("%s: ulpi write failed\n", __func__); 676 dev_err(phy->u_phy.dev, "ULPI write failed: %d\n", ret);
671 return ret; 677 return ret;
672 } 678 }
673 679
@@ -728,28 +734,30 @@ static int ulpi_open(struct tegra_usb_phy *phy)
728 734
729 phy->clk = devm_clk_get(phy->u_phy.dev, "ulpi-link"); 735 phy->clk = devm_clk_get(phy->u_phy.dev, "ulpi-link");
730 if (IS_ERR(phy->clk)) { 736 if (IS_ERR(phy->clk)) {
731 pr_err("%s: can't get ulpi clock\n", __func__); 737 err = PTR_ERR(phy->clk);
732 return PTR_ERR(phy->clk); 738 dev_err(phy->u_phy.dev, "Failed to get ULPI clock: %d\n", err);
739 return err;
733 } 740 }
734 741
735 err = devm_gpio_request(phy->u_phy.dev, phy->reset_gpio, 742 err = devm_gpio_request(phy->u_phy.dev, phy->reset_gpio,
736 "ulpi_phy_reset_b"); 743 "ulpi_phy_reset_b");
737 if (err < 0) { 744 if (err < 0) {
738 dev_err(phy->u_phy.dev, "request failed for gpio: %d\n", 745 dev_err(phy->u_phy.dev, "Request failed for GPIO %d: %d\n",
739 phy->reset_gpio); 746 phy->reset_gpio, err);
740 return err; 747 return err;
741 } 748 }
742 749
743 err = gpio_direction_output(phy->reset_gpio, 0); 750 err = gpio_direction_output(phy->reset_gpio, 0);
744 if (err < 0) { 751 if (err < 0) {
745 dev_err(phy->u_phy.dev, "gpio %d direction not set to output\n", 752 dev_err(phy->u_phy.dev,
746 phy->reset_gpio); 753 "GPIO %d direction not set to output: %d\n",
754 phy->reset_gpio, err);
747 return err; 755 return err;
748 } 756 }
749 757
750 phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); 758 phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
751 if (!phy->ulpi) { 759 if (!phy->ulpi) {
752 dev_err(phy->u_phy.dev, "otg_ulpi_create returned NULL\n"); 760 dev_err(phy->u_phy.dev, "Failed to create ULPI OTG\n");
753 err = -ENOMEM; 761 err = -ENOMEM;
754 return err; 762 return err;
755 } 763 }
@@ -766,8 +774,10 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
766 774
767 phy->pll_u = devm_clk_get(phy->u_phy.dev, "pll_u"); 775 phy->pll_u = devm_clk_get(phy->u_phy.dev, "pll_u");
768 if (IS_ERR(phy->pll_u)) { 776 if (IS_ERR(phy->pll_u)) {
769 pr_err("Can't get pll_u clock\n"); 777 err = PTR_ERR(phy->pll_u);
770 return PTR_ERR(phy->pll_u); 778 dev_err(phy->u_phy.dev,
779 "Failed to get pll_u clock: %d\n", err);
780 return err;
771 } 781 }
772 782
773 err = clk_prepare_enable(phy->pll_u); 783 err = clk_prepare_enable(phy->pll_u);
@@ -782,7 +792,8 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
782 } 792 }
783 } 793 }
784 if (!phy->freq) { 794 if (!phy->freq) {
785 pr_err("invalid pll_u parent rate %ld\n", parent_rate); 795 dev_err(phy->u_phy.dev, "Invalid pll_u parent rate %ld\n",
796 parent_rate);
786 err = -EINVAL; 797 err = -EINVAL;
787 goto fail; 798 goto fail;
788 } 799 }
@@ -791,7 +802,7 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
791 err = regulator_enable(phy->vbus); 802 err = regulator_enable(phy->vbus);
792 if (err) { 803 if (err) {
793 dev_err(phy->u_phy.dev, 804 dev_err(phy->u_phy.dev,
794 "failed to enable usb vbus regulator: %d\n", 805 "Failed to enable USB VBUS regulator: %d\n",
795 err); 806 err);
796 goto fail; 807 goto fail;
797 } 808 }
@@ -855,7 +866,8 @@ static int read_utmi_param(struct platform_device *pdev, const char *param,
855 int err = of_property_read_u32(pdev->dev.of_node, param, &value); 866 int err = of_property_read_u32(pdev->dev.of_node, param, &value);
856 *dest = (u8)value; 867 *dest = (u8)value;
857 if (err < 0) 868 if (err < 0)
858 dev_err(&pdev->dev, "Failed to read USB UTMI parameter %s: %d\n", 869 dev_err(&pdev->dev,
870 "Failed to read USB UTMI parameter %s: %d\n",
859 param, err); 871 param, err);