[PATCH v6 2/2] phy: phy-imx8mq-usb: clean up clock code

Marek Vasut marex at denx.de
Thu Jul 13 19:55:48 CEST 2023


On 7/13/23 19:11, Tim Harvey wrote:
> 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 at gateworks.com>
> ---
> v6: new patch
> 
>   drivers/phy/phy-imx8mq-usb.c | 33 +++++++++++++++------------------
>   1 file changed, 15 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/phy/phy-imx8mq-usb.c b/drivers/phy/phy-imx8mq-usb.c
> index 0ab7965df2ff..bf9b0b6f3450 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);

You likely want some if (CONFIG_IS_ENABLED(CLK)) in the err: fail path 
at the end of this function too.


More information about the U-Boot mailing list