public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFT PATCH] mtd: ixp4xx: Unrequire CONFIG_MTD_CFI_BE_BYTE_SWAP
Date: Tue, 23 Sep 2014 20:13:16 +0200	[thread overview]
Message-ID: <3290917.AsGO4THCdo@wuerfel> (raw)
In-Reply-To: <719460394.273364.1411492720358.JavaMail.zimbra@xes-inc.com>

On Tuesday 23 September 2014 12:18:40 Aaron Sierra wrote:
> -#ifndef __ARMEB__
> -#ifndef CONFIG_MTD_CFI_BE_BYTE_SWAP
> -#  error CONFIG_MTD_CFI_BE_BYTE_SWAP required
> -#endif
>  
>  static inline u16 flash_read16(void __iomem *addr)
>  {
> -       return be16_to_cpu(__raw_readw((void __iomem *)((unsigned long)addr ^ 0x2)));
> +       return be16_to_cpu(__raw_readw(addr));
>  }
>  
>  static inline void flash_write16(u16 d, void __iomem *addr)
>  {
> -       __raw_writew(cpu_to_be16(d), (void __iomem *)((unsigned long)addr ^ 0x2));
> +       __raw_writew(cpu_to_be16(d), addr);
>  }
>  
>  #define        BYTE0(h)        ((h) & 0xFF)
>  #define        BYTE1(h)        (((h) >> 8) & 0xFF)
> 

Your patch looks like a good idea, but I think the above is still wrong
because you no longer fix up the address to swap the 16-bit halves of
a 32-bit word.

My guess is that you can just do 

static inline u16 flash_read16(void __iomem *addr)
{
	if (!IS_ENABLED(CPU_BIG_ENDIAN))
		addr = (void __iomem *)((unsigned long)addr ^ 0x2));

        return readl_relaxed(addr);
}

static inline void flash_write16(u16 d, void __iomem *addr)
{
	if (!IS_ENABLED(CPU_BIG_ENDIAN))
		addr = (void __iomem *)((unsigned long)addr ^ 0x2));

        writel_relaxed(d, addr);
}

to do this.

	Arnd

      reply	other threads:[~2014-09-23 18:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <786499164.272880.1411492623841.JavaMail.zimbra@xes-inc.com>
2014-09-23 17:18 ` [RFT PATCH] mtd: ixp4xx: Unrequire CONFIG_MTD_CFI_BE_BYTE_SWAP Aaron Sierra
2014-09-23 18:13   ` Arnd Bergmann [this message]

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=3290917.AsGO4THCdo@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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