mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 6/8] mci: imx-esdhc: implement static inline io wrappers
Date: Wed, 6 Feb 2019 16:55:54 -0800	[thread overview]
Message-ID: <CAHQ1cqGPim3-3nayOZ4H_6aBSr71b0kNhdG16QwNZmcLEseidQ@mail.gmail.com> (raw)
In-Reply-To: <20190206074921.11115-7-s.hauer@pengutronix.de>

On Tue, Feb 5, 2019 at 11:49 PM Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> Layerscape will need accesses in big endian mode. To make this
> possible create static inline wrappers for the io accessors.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/mci/imx-esdhc.c | 149 ++++++++++++++++++++++++----------------
>  drivers/mci/imx-esdhc.h |   6 --
>  2 files changed, 91 insertions(+), 64 deletions(-)
>
> diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
> index 9ccc34fbd5..b7d5c01fb5 100644
> --- a/drivers/mci/imx-esdhc.c
> +++ b/drivers/mci/imx-esdhc.c
> @@ -106,6 +106,47 @@ static inline int esdhc_is_usdhc(struct fsl_esdhc_host *data)
>         return !!(data->socdata->flags & ESDHC_FLAG_USDHC);
>  }
>
> +static inline u32 esdhc_read32(struct fsl_esdhc_host *host, unsigned int reg)
> +{
> +       return readl(host->regs + reg);
> +}
> +
> +static inline void esdhc_write32(struct fsl_esdhc_host *host, unsigned int reg,
> +                                u32 val)
> +{
> +       writel(val, host->regs + reg);
> +}
> +
> +static inline void esdhc_clrsetbits32(struct fsl_esdhc_host *host, unsigned int reg,
> +                                     u32 clear, u32 set)
> +{
> +       u32 val;
> +
> +       val = esdhc_read32(host, reg);
> +       val &= ~clear;
> +       val |= set;
> +       esdhc_write32(host, reg, val);
> +}
> +
> +static inline void esdhc_clrbits32(struct fsl_esdhc_host *host, unsigned int reg,
> +                                     u32 clear)
> +{
> +       u32 val;
> +
> +       val = esdhc_read32(host, reg);
> +       val &= ~clear;
> +       esdhc_write32(host, reg, val);

You can simplify this to:

esdhc_clrsetbits32(host, reg, clear, 0);

> +}
> +
> +static inline void esdhc_setbits32(struct fsl_esdhc_host *host, unsigned int reg,
> +                                  u32 set)
> +{
> +       u32 val;
> +
> +       val = esdhc_read32(host, reg);
> +       val |= set;
> +       esdhc_write32(host, reg, val);

and this to:

esdhc_clrsetbits32(host, reg, 0, set);


Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-02-07  0:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06  7:49 [PATCH 0/8] MMC: esdhc: Add Layerscape support Sascha Hauer
2019-02-06  7:49 ` [PATCH 1/8] mci: imx-esdhc: Do not reset twice Sascha Hauer
2019-02-06  7:49 ` [PATCH 2/8] mci: imx-esdhc: use dev_id Sascha Hauer
2019-02-06  7:49 ` [PATCH 3/8] mci: imx-esdhc: move platform_data Sascha Hauer
2019-02-06  7:49 ` [PATCH 4/8] mci: imx-esdhc: make clkidx configurable Sascha Hauer
2019-02-06  7:49 ` [PATCH 5/8] mci: imx-esdhc: remove unnecessary include Sascha Hauer
2019-02-06  7:49 ` [PATCH 6/8] mci: imx-esdhc: implement static inline io wrappers Sascha Hauer
2019-02-07  0:55   ` Andrey Smirnov [this message]
2019-02-07  7:56     ` Sascha Hauer
2019-02-06  7:49 ` [PATCH 7/8] mci: imx-esdhc: Add bigendian register access support Sascha Hauer
2019-02-06  7:49 ` [PATCH 8/8] mci: imx-esdhc: Add layerscape support Sascha Hauer
2019-02-07  1:02   ` Andrey Smirnov
2019-02-12  8:42     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHQ1cqGPim3-3nayOZ4H_6aBSr71b0kNhdG16QwNZmcLEseidQ@mail.gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox