mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: David Brownell <david-b@pacbell.net>
Cc: linux-kernel@vger.kernel.org,
	spi-devel-general@lists.sourceforge.net, mike@steroidmicros.com
Subject: Re: [patch 2.6.15-rc5-mm3] M25 series SPI flash
Date: Tue, 3 Jan 2006 17:26:35 -0800	[thread overview]
Message-ID: <20060103172635.17b641fa.akpm@osdl.org> (raw)
In-Reply-To: <200512192243.21889.david-b@pacbell.net>

David Brownell <david-b@pacbell.net> wrote:
>
> Here's a driver for more traditional types of SPI flash, as found
> in the ST M25 series.  Contributed by Mike Lavender (thanks Mike!)
> and tested on some ColdFire boards.
> 

bah, attachments..

> This was originally a driver for the ST M25P80 SPI flash.   It's been
> updated slightly to handle other M25P series chips.
> 
> For many of these chips, the specific type could be probed, but for now
> this just requires static setup with flash_platform_data that lists the
> chip type (size, format) and any default partitioning to use.
> 
> From: Mike Lavender <mike@steroidmicros.com>
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> 

Please put the From: at the very first line of the changelog.

Mike, please review section 11 of Documentation/SubmittingPatches and send
a Signed-off-by: for this work, thanks.


> +static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
> +	size_t *retlen, const u_char *buf)
> +{
> +	struct m25p *flash = mtd_to_m25p(mtd);
> +	u32 page_offset, page_size;
> +	struct spi_transfer t[2];
> +	struct spi_message m;
> +
> +	DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %z\n", spi->dev.bus_id,
> +			__FUNCTION__, "to", (u32) to, len);
> +
> +	if (retlen)
> +		*retlen = 0;

If retlen can be NULL

> +	/* sanity checks */
> +	if (!len)
> +		return(0);
> +
> +	if (to + len > flash->mtd.size)
> +		return -EINVAL;
> +
> +  	down(&flash->lock);
> +
> +	/* Wait until finished previous write command. */
> +	if (wait_till_ready(flash))
> +		return 1;
> +
> +	write_enable(flash);
> +
> +	memset(t, 0, (sizeof t));
> +
> +	/* Set up the opcode in the write buffer. */
> +	flash->command[0] = OPCODE_PP;
> +	flash->command[1] = to >> 16;
> +	flash->command[2] = to >> 8;
> +	flash->command[3] = to;
> +
> +	t[0].tx_buf = flash->command;
> +	t[0].len = sizeof(flash->command);
> +
> +	m.transfers = t;
> +	m.n_transfer = 2;
> +
> +	/* what page do we start with? */
> +	page_offset = to % FLASH_PAGESIZE;
> +
> +	/* do all the bytes fit onto one page? */
> +	if (page_offset + len <= FLASH_PAGESIZE) {
> +		t[1].tx_buf = buf;
> +		t[1].len = len;
> +
> +		spi_sync(flash->spi, &m);
> +
> +		*retlen = m.actual_length - sizeof(flash->command);

this will oops.


      reply	other threads:[~2006-01-04  1:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-18 18:37 [patch 2.6.15-rc5-mm3 1/3] SPI core tweaks, bugfix David Brownell
2005-12-20  6:43 ` [patch 2.6.15-rc5-mm3] M25 series SPI flash David Brownell
2006-01-04  1:26   ` Andrew Morton [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=20060103172635.17b641fa.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike@steroidmicros.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®