[PATCH 1/2] usb: musb-new: sunxi: only perform SRAM initialization when necessary

Andre Przywara andre.przywara at arm.com
Thu Jun 8 14:03:10 CEST 2023


On Wed,  7 Jun 2023 17:16:43 -0600
Sam Edwards <cfsworks at gmail.com> wrote:

> Only the older (ca. A10, A20) sunxis need this poke for the MUSB to
> function. Mimic the Linux kernel and add a `has_sram` flag to the config
> structure that is only set for the specific compatibles that require
> this initialization.

The patch looks alright in general, thanks for sending this! I will try to
test it on an older SoC in the next days. As an added bonus, that should
actually help the F1C100s USB(-OTG) support.

Cheers,
Andre

> Signed-off-by: Sam Edwards <CFSworks at gmail.com>
> ---
>  drivers/usb/musb-new/sunxi.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
> index ab55d68620..c05c0d5561 100644
> --- a/drivers/usb/musb-new/sunxi.c
> +++ b/drivers/usb/musb-new/sunxi.c
> @@ -85,6 +85,7 @@
>  
>  struct sunxi_musb_config {
>  	struct musb_hdrc_config *config;
> +	bool has_sram;
>  };
>  
>  struct sunxi_glue {
> @@ -313,7 +314,10 @@ static int sunxi_musb_init(struct musb *musb)
>  
>  	musb->isr = sunxi_musb_interrupt;
>  
> -	USBC_ConfigFIFO_Base();
> +	if (glue->cfg->has_sram) {
> +		USBC_ConfigFIFO_Base();
> +	}
> +
>  	USBC_EnableDpDmPullUp(musb->mregs);
>  	USBC_EnableIdPullUp(musb->mregs);
>  
> @@ -525,6 +529,7 @@ static int musb_usb_remove(struct udevice *dev)
>  
>  static const struct sunxi_musb_config sun4i_a10_cfg = {
>  	.config = &musb_config,
> +	.has_sram = true,
>  };
>  
>  static const struct sunxi_musb_config sun6i_a31_cfg = {



More information about the U-Boot mailing list