mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/1] mtd: nand: fix unaligned write support
Date: Fri, 7 Dec 2012 14:17:05 +0100	[thread overview]
Message-ID: <20121207131705.GL8327@game.jcrosoft.org> (raw)
In-Reply-To: <20121205182801.GI10369@pengutronix.de>

On 19:28 Wed 05 Dec     , Sascha Hauer wrote:
> On Wed, Dec 05, 2012 at 06:15:20PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > via cdev we may write unaligned data the code was drop in the commit
> > 0a4b1c7e440a81819eb2137f923573a3055dc7a2
> > mtd core: call driver write function with complete buffer
> > 
> > which is true for spi flashes but the code is still mandatory on nand
> 
> I suggest the following simpler approach.
> 
> Sascha
> 
yes it work here

Best Regards,
J.
> 
> From 5248abe7e59f60085b9a2affd3db11a6ac0a9da9 Mon Sep 17 00:00:00 2001
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Date: Wed, 5 Dec 2012 19:24:41 +0100
> Subject: [PATCH] mtd nand: allow partial page writes
> 
> The nand layer handles partial page writes just fine. If the start or
> end of the data is not page aligned, the nand layer will copy the data
> to a temporary page buffer.
> Remove the check which disallows partial page writes since this is what
> we want to do on barebox when for example an image is written to nand
> which is not padded to page size.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/mtd/nand/nand_write.c |    7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_write.c b/drivers/mtd/nand/nand_write.c
> index 5ed04ce..9997127 100644
> --- a/drivers/mtd/nand/nand_write.c
> +++ b/drivers/mtd/nand/nand_write.c
> @@ -273,13 +273,6 @@ int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
>  	if (!writelen)
>  		return 0;
>  
> -	/* reject writes, which are not page aligned */
> -	if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
> -		printk(KERN_NOTICE "nand_write: "
> -		       "Attempt to write not page aligned data\n");
> -		return -EINVAL;
> -	}
> -
>  	column = to & (mtd->writesize - 1);
>  	subpage = column || (writelen & (mtd->writesize - 1));
>  
> -- 
> 1.7.10.4
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2012-12-07 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 19:03 [PATCH 1/2] mtd oob: do not register oob device for devices without oob Sascha Hauer
2012-11-29 19:03 ` [PATCH 2/2] mtd core: call driver write function with complete buffer Sascha Hauer
2012-12-03 19:10   ` Robert Jarzmik
2012-12-05 16:53   ` Jean-Christophe PLAGNIOL-VILLARD
2012-12-05 17:15     ` [PATCH 1/1] mtd: nand: fix unaligned write support Jean-Christophe PLAGNIOL-VILLARD
2012-12-05 18:28       ` Sascha Hauer
2012-12-07 13:17         ` Jean-Christophe PLAGNIOL-VILLARD [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=20121207131705.GL8327@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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