From: Vinod Koul <vkoul@kernel.org>
To: Wen He <wen.he_1@nxp.com>
Cc: dmaengine@vger.kernel.org, robh+dt@kernel.org,
leoyang.li@nxp.com, jiafei.pan@nxp.com, peng.ma@nxp.com
Subject: [v8,2/7] dmaengine: fsldma: Adding macro FSL_DMA_IN/OUT implement for ARM platform
Date: Mon, 27 Aug 2018 12:05:37 +0530 [thread overview]
Message-ID: <20180827063537.GX2388@vkoul-mobl> (raw)
On 17-08-18, 10:54, Wen He wrote:
> This patch add the macro FSL_DMA_IN/OUT implement for ARM platform.
>
> Signed-off-by: Wen He <wen.he_1@nxp.com>
> ---
> drivers/dma/fsldma.h | 57 ++++++++++++++++++++++++++++++++++------------------
> 1 file changed, 38 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h
> index 982845b..1dc64c9 100644
> --- a/drivers/dma/fsldma.h
> +++ b/drivers/dma/fsldma.h
> @@ -196,39 +196,58 @@ struct fsldma_chan {
> #define to_fsl_desc(lh) container_of(lh, struct fsl_desc_sw, node)
> #define tx_to_fsl_desc(tx) container_of(tx, struct fsl_desc_sw, async_tx)
>
> +#ifdef CONFIG_PPC
> +#define fsl_ioread32(p) in_le32(p)
> +#define fsl_ioread32be(p) in_be32(p)
> +#define fsl_iowrite32(v, p) out_le32(p, v)
> +#define fsl_iowrite32be(v, p) out_be32(p, v)
> +
> #ifndef __powerpc64__
> -static u64 in_be64(const u64 __iomem *addr)
> +static u64 fsl_ioread64(const u64 __iomem *addr)
> {
> - return ((u64)in_be32((u32 __iomem *)addr) << 32) |
> - (in_be32((u32 __iomem *)addr + 1));
> + return ((u64)in_le32((u32 __iomem *)addr + 1) << 32) |
> + (in_le32((u32 __iomem *)addr));
I do not like this very much
This is targeted for ARM (bit no dependency on ARM) which
means it can be triggered in others too...
Second, this casts seem not so great. can we do better?
u32 addr = lower_32_bits(addr);
return in_be32(addr) | in_be32(addr + 1) < 32;
makes a better read, unless I missed something?
/
> }
>
> -static void out_be64(u64 __iomem *addr, u64 val)
> +static void fsl_iowrite64(u64 val, u64 __iomem *addr)
> {
> - out_be32((u32 __iomem *)addr, val >> 32);
> - out_be32((u32 __iomem *)addr + 1, (u32)val);
> + out_le32((u32 __iomem *)addr + 1, val >> 32);
> + out_le32((u32 __iomem *)addr, (u32)val);
> }
>
> -/* There is no asm instructions for 64 bits reverse loads and stores */
> -static u64 in_le64(const u64 __iomem *addr)
> +static u64 fsl_ioread64be(const u64 __iomem *addr)
> {
> - return ((u64)in_le32((u32 __iomem *)addr + 1) << 32) |
> - (in_le32((u32 __iomem *)addr));
> + return ((u64)in_be32((u32 __iomem *)addr) << 32) |
> + (in_be32((u32 __iomem *)addr + 1));
Improve this as well, please
next reply other threads:[~2018-08-27 6:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 6:35 Vinod Koul [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-08-17 2:54 [v8,2/7] dmaengine: fsldma: Adding macro FSL_DMA_IN/OUT implement for ARM platform Wen He
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=20180827063537.GX2388@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=jiafei.pan@nxp.com \
--cc=leoyang.li@nxp.com \
--cc=peng.ma@nxp.com \
--cc=robh+dt@kernel.org \
--cc=wen.he_1@nxp.com \
/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