Re: [PATCH 3/3] soc: qcom: geni: Optimize select fifo/dma mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Douglas Anderson (2020-10-08 15:52:35)
> diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
> index 751a49f6534f..746854745b15 100644
> --- a/drivers/soc/qcom/qcom-geni-se.c
> +++ b/drivers/soc/qcom/qcom-geni-se.c
> @@ -266,49 +266,53 @@ EXPORT_SYMBOL(geni_se_init);
>  static void geni_se_select_fifo_mode(struct geni_se *se)
>  {
>         u32 proto = geni_se_read_proto(se);
> -       u32 val;
> +       u32 val, val_old;
>  
>         geni_se_irq_clear(se);
>  
> -       val = readl_relaxed(se->base + SE_GENI_M_IRQ_EN);
>         if (proto != GENI_SE_UART) {
> +               val_old = val = readl_relaxed(se->base + SE_GENI_M_IRQ_EN);
>                 val |= M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN;
>                 val |= M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN;
> -       }
> -       writel_relaxed(val, se->base + SE_GENI_M_IRQ_EN);
> +               if (val != val_old)
> +                       writel_relaxed(val, se->base + SE_GENI_M_IRQ_EN);
>  
> -       val = readl_relaxed(se->base + SE_GENI_S_IRQ_EN);
> -       if (proto != GENI_SE_UART)
> -               val |= S_CMD_DONE_EN;
> -       writel_relaxed(val, se->base + SE_GENI_S_IRQ_EN);
> +               val = readl_relaxed(se->base + SE_GENI_S_IRQ_EN);

Can we use the val_old trick here too?

> +               if (!(val & S_CMD_DONE_EN))
> +                       writel_relaxed(val | S_CMD_DONE_EN,

Because this val | S_CMD_DONE_EN thing is just hard to read :/

> +                                      se->base + SE_GENI_S_IRQ_EN);
> +       }
>  
>         val = readl_relaxed(se->base + SE_GENI_DMA_MODE_EN);
> -       val &= ~GENI_DMA_MODE_EN;
> -       writel_relaxed(val, se->base + SE_GENI_DMA_MODE_EN);
> +       if (val & GENI_DMA_MODE_EN)
> +               writel_relaxed(val & ~GENI_DMA_MODE_EN,
> +                              se->base + SE_GENI_DMA_MODE_EN);
>  }
>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux