[PATCH v4] mtd/nand: don't use {read,write}_buf for 8-bit transfers

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Jan 14 03:29:48 EST 2014


Hello,

On Tue, Jan 14, 2014 at 12:12:16AM -0800, Brian Norris wrote:
> On Thu, Dec 05, 2013 at 10:22:04PM +0100, Uwe Kleine-König wrote:
> > According to the Open NAND Flash Interface Specification (ONFI) Revision
> > 3.1 "Parameters are always transferred on the lower 8-bits of the data
> > bus." for the Get Features and Set Features commands.
> > 
> > So using read_buf and write_buf is wrong for 16-bit wide nand chips as
> > they use I/O[15:0]. The Get Features command is easily fixed using 4
> > times the read_byte callback. For Set Features implement a new
> > overwritable callback "write_byte". Still I expect the default to work
> > just fine for all controllers and making it overwriteable was just done
> > for symmetry.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> 
> I think this patch is good now, so pushed to l2-mtd.git (with a fix
> [1]). Thanks Uwe!
> 
> I know there was some more discussion and other patch ideas being thrown
> around (by me and others). Feel free to send patches/comments (or
> Ack's/Tested-by's) if you think they need applied on top.
> 
> Brian
> 
> [1] I got a type safety warning as I pushed this out, so I squashed in
>     this diff:
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 7acbce3b3675..d388c7f6fec9 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -245,7 +245,7 @@ static void nand_write_byte16(struct mtd_info *mtd, uint8_t byte)
>  	 * neither an address nor a command transfer. Let's assume a 0 on the
>  	 * upper I/O lines is OK.
>  	 */
> -	chip->write_buf(mtd, &word, 2);
> +	chip->write_buf(mtd, (uint8_t *)&word, 2);
That's exactly what I suggested before reading your mail. Very
appreciated.

Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the linux-mtd mailing list