summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTim Harvey <tharvey@gateworks.com>2023-07-13 11:56:08 -0700
committerMarek Vasut <marex@denx.de>2023-08-25 02:36:19 +0200
commite3380e1c1a88af454c1a41b6b63a8822e57f9a45 (patch)
tree25849eccc5a630b9896d69fe8cb4b8b6a34aca41 /drivers
parentc90729c46348cbc90d510708c407c8b783c970a9 (diff)
downloadu-boot-e3380e1c1a88af454c1a41b6b63a8822e57f9a45.tar.gz
u-boot-e3380e1c1a88af454c1a41b6b63a8822e57f9a45.tar.bz2
u-boot-e3380e1c1a88af454c1a41b6b63a8822e57f9a45.zip
phy: phy-imx8mq-usb: clean up clock code
use CONFIG_IS_ENABLED for clock enable/disable and change printf's to dev_err. Additionlly remove the comment that does not make sense. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/phy/phy-imx8mq-usb.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/drivers/phy/phy-imx8mq-usb.c b/drivers/phy/phy-imx8mq-usb.c
index 9fa78ef4da..b660eadecf 100644
--- a/drivers/phy/phy-imx8mq-usb.c
+++ b/drivers/phy/phy-imx8mq-usb.c
@@ -78,9 +78,7 @@ enum imx8mpq_phy_type {
};
struct imx8mq_usb_phy {
-#if CONFIG_IS_ENABLED(CLK)
struct clk phy_clk;
-#endif
void __iomem *base;
enum imx8mpq_phy_type type;
struct udevice *vbus_supply;
@@ -178,13 +176,13 @@ static int imx8mq_usb_phy_power_on(struct phy *usb_phy)
u32 value;
int ret;
-#if CONFIG_IS_ENABLED(CLK)
- ret = clk_enable(&imx_phy->phy_clk);
- if (ret) {
- printf("Failed to enable usb phy clock\n");
- return ret;
+ if (CONFIG_IS_ENABLED(CLK)) {
+ ret = clk_enable(&imx_phy->phy_clk);
+ if (ret) {
+ dev_err(dev, "Failed to enable usb phy clock: %d\n", ret);
+ return ret;
+ }
}
-#endif
if (CONFIG_IS_ENABLED(DM_REGULATOR) && imx_phy->vbus_supply) {
ret = regulator_set_enable_if_allowed(imx_phy->vbus_supply, true);
@@ -202,9 +200,8 @@ static int imx8mq_usb_phy_power_on(struct phy *usb_phy)
return 0;
err:
-#if CONFIG_IS_ENABLED(CLK)
- clk_disable(&imx_phy->phy_clk);
-#endif
+ if (CONFIG_IS_ENABLED(CLK))
+ clk_disable(&imx_phy->phy_clk);
return ret;
}
@@ -220,9 +217,8 @@ static int imx8mq_usb_phy_power_off(struct phy *usb_phy)
value |= PHY_CTRL6_RXTERM_OVERRIDE_SEL;
writel(value, imx_phy->base + PHY_CTRL6);
-#if CONFIG_IS_ENABLED(CLK)
- clk_disable(&imx_phy->phy_clk);
-#endif
+ if (CONFIG_IS_ENABLED(CLK))
+ clk_disable(&imx_phy->phy_clk);
if (CONFIG_IS_ENABLED(DM_REGULATOR) && imx_phy->vbus_supply) {
ret = regulator_set_enable_if_allowed(imx_phy->vbus_supply, false);
@@ -258,14 +254,14 @@ int imx8mq_usb_phy_probe(struct udevice *dev)
if (!priv->base)
return -EINVAL;
-#if CONFIG_IS_ENABLED(CLK)
- /* Assigned clock already set clock */
- ret = clk_get_by_name(dev, "phy", &priv->phy_clk);
- if (ret) {
- printf("Failed to get usb phy clock\n");
- return ret;
+ if (CONFIG_IS_ENABLED(CLK)) {
+ ret = clk_get_by_name(dev, "phy", &priv->phy_clk);
+ if (ret) {
+ dev_err(dev, "Failed to get usb phy clock %d\n", ret);
+ return ret;
+ }
}
-#endif
+
if (CONFIG_IS_ENABLED(DM_REGULATOR)) {
ret = device_get_supply_regulator(dev, "vbus-supply",
&priv->vbus_supply);