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

John Crispin blogic at openwrt.org
Thu Jan 6 05:06:22 EST 2011


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





More information about the linux-mtd mailing list