On Mon, Jan 06, 2014 at 10:10:42AM +0800, Peter Chen wrote:
> According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB
> register error issue", All USB register write operations must
> use the ARM SWP instruction. So, we implement special hw_write
> and hw_test_and_clear for imx28.
> 
> Discussion for it at below:
> http://marc.info/?l=linux-usb&m=137996395529294&w=2
> 
> Signed-off-by: Peter Chen <peter.c...@freescale.com>
> Signed-off-by: Marc Kleine-Budde <m...@pengutronix.de>
> Tested-by: Marc Kleine-Budde <m...@pengutronix.de>
> ---
>  drivers/usb/chipidea/ci.h    |   26 ++++++++++++++++++++++++--
>  drivers/usb/chipidea/core.c  |    2 ++
>  drivers/usb/chipidea/host.c  |    1 +
>  include/linux/usb/chipidea.h |    1 +
>  4 files changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> index a71dc1c..e5506ce 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -164,6 +164,7 @@ struct hw_bank {
>   * @id_event: indicates there is an id event, and handled at ci_otg_work
>   * @b_sess_valid_event: indicates there is a vbus event, and handled
>   * at ci_otg_work
> + * @imx28_write_fix: Freescale imx28 needs swp instruction for writing
>   */
>  struct ci_hdrc {
>       struct device                   *dev;
> @@ -202,6 +203,7 @@ struct ci_hdrc {
>       struct dentry                   *debugfs;
>       bool                            id_event;
>       bool                            b_sess_valid_event;
> +     bool                            imx28_write_fix;
>  };
>  
>  static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci)
> @@ -250,6 +252,26 @@ static inline u32 hw_read(struct ci_hdrc *ci, enum 
> ci_hw_regs reg, u32 mask)
>       return ioread32(ci->hw_bank.regmap[reg]) & mask;
>  }
>  
> +#ifdef CONFIG_SOC_IMX28
> +static inline void imx28_ci_writel(u32 val, volatile void __iomem *addr)
> +{
> +     __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr));
> +}
> +#else
> +static inline void imx28_ci_writel(u32 val, volatile void __iomem *addr)
> +{
> +}
> +#endif
> +
> +static inline void __hw_write(struct ci_hdrc *ci, u32 val,
> +             void __iomem *addr)
> +{
> +     if (IS_ENABLED(CONFIG_SOC_IMX28) && ci->imx28_write_fix)
> +             imx28_ci_writel(val, addr);

Same here, this IS_ENABLED() isn't needed, right?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to