From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from nbd.name ([46.4.11.11]) by casper.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Pamj0-0006N7-98 for linux-mtd@lists.infradead.org; Thu, 06 Jan 2011 10:05:42 +0000 Message-ID: <4D25941E.80702@openwrt.org> Date: Thu, 06 Jan 2011 11:06:22 +0100 From: John Crispin MIME-Version: 1.0 To: David Woodhouse Subject: Re: [PATCH 07/10] MIPS: lantiq: add NOR flash CFI address swizzle References: <1294257379-417-1-git-send-email-blogic@openwrt.org> <1294257379-417-8-git-send-email-blogic@openwrt.org> In-Reply-To: <1294257379-417-8-git-send-email-blogic@openwrt.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: linux-mips@linux-mips.org, Ralph Hempel , linux-mtd@lists.infradead.org, Ralf Baechle List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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