[U-Boot] [PATCH v5 19/26] musb-new: sunxi: Use CLK and RESET support

Marek Vasut marex at denx.de
Mon Dec 31 18:30:30 UTC 2018


On 12/31/18 5:59 PM, Jagan Teki wrote:
> Now clock and reset drivers are available for respective
> SoC's so use clk and reset ops on musb driver.
> 
> Cc: Marek Vasut <marex at denx.de> 
> Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
> Acked-by: Maxime Ripard <maxime.ripard at bootlin.com>
> ---
>  drivers/usb/musb-new/sunxi.c | 81 ++++++++++++++++++------------------
>  1 file changed, 40 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
> index f542a181fa..f79b3eedcf 100644
> --- a/drivers/usb/musb-new/sunxi.c
> +++ b/drivers/usb/musb-new/sunxi.c
> @@ -16,9 +16,11 @@
>   * This file is part of the Inventra Controller Driver for Linux.
>   */
>  #include <common.h>
> +#include <clk.h>
>  #include <dm.h>
>  #include <generic-phy.h>
>  #include <phy-sun4i-usb.h>
> +#include <reset.h>
>  #include <asm/arch/cpu.h>
>  #include <asm/arch/clock.h>
>  #include <asm/arch/gpio.h>
> @@ -80,16 +82,12 @@
>  
>  struct sunxi_musb_config {
>  	struct musb_hdrc_config *config;
> -	bool has_reset;
> -	u8 rst_bit;
> -	u8 clkgate_bit;
> -	u32 off_reset0;
>  };
>  
>  struct sunxi_glue {
>  	struct musb_host_data mdata;
> -	struct sunxi_ccm_reg *ccm;
> -	u32 *reg_reset0;
> +	struct clk clk;
> +	struct reset_ctl rst;
>  	struct sunxi_musb_config *cfg;
>  	struct device dev;
>  	struct phy phy;
> @@ -296,24 +294,27 @@ static int sunxi_musb_init(struct musb *musb)
>  
>  	pr_debug("%s():\n", __func__);
>  
> -	ret = generic_phy_init(&glue->phy);
> +	ret = clk_enable(&glue->clk);
>  	if (ret) {
> -		pr_err("failed to init USB PHY\n");
> +		pr_err("failed to enable clock\n");
>  		return ret;
>  	}
>  
> -	musb->isr = sunxi_musb_interrupt;
> -
> -	setbits_le32(&glue->ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_USB0));
> -	if (glue->cfg->clkgate_bit)
> -		setbits_le32(&glue->ccm->ahb_gate0,
> -			     BIT(glue->cfg->clkgate_bit));
> +	if (reset_valid(&glue->rst)) {
> +		ret = reset_deassert(&glue->rst);
> +		if (ret) {
> +			pr_err("failed to deassert reset\n");

dev_err(dev, ...), fix globally

[...]


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list