linux-mips
[Top] [All Lists]

Re: [PATCH 07/10] MIPS: lantiq: add NOR flash CFI address swizzle

To: David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 07/10] MIPS: lantiq: add NOR flash CFI address swizzle
From: John Crispin <blogic@openwrt.org>
Date: Thu, 06 Jan 2011 11:06:22 +0100
Cc: Ralf Baechle <ralf@linux-mips.org>, Ralph Hempel <ralph.hempel@lantiq.com>, linux-mips@linux-mips.org, linux-mtd@lists.infradead.org
In-reply-to: <1294257379-417-8-git-send-email-blogic@openwrt.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1294257379-417-1-git-send-email-blogic@openwrt.org> <1294257379-417-8-git-send-email-blogic@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100913 Icedove/3.0.7
On 05/01/11 20:56, John Crispin wrote:
>  
>       adr += chip->start;
> +#ifdef CONFIG_MTD_CFI_CMD_SWIZZLE
> +     adr ^= 2;
> +#endif
>  
>       mutex_lock(&chip->mutex);
>       ret = get_chip(map, chip, adr, FL_WRITING);
>   

Hi,

What this patch essentially does is to make sure to pass a addr with the
^=2 hack already applied, so that the complex map ends up with an un
swizzled addr as it applies the hack internally again.

I think it would be cleanest to extend the read/write callbacks of
struct map_info; with a flag indicating whether we are doing a CMD or
DATA action. as the 2 following macros are used anyway, it should not be
too hard to implement this.

#define map_read(map, ofs) (map)->read(map, ofs)
#define map_write(map, datum, ofs) (map)->write(map, datum, ofs)

I am not sure however if this is the correct fix.

Thanks,
John



<Prev in Thread] Current Thread [Next in Thread>