linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Grazvydas Ignotas <notasas@gmail.com>
Cc: Kalle Valo <kalle.valo@iki.fi>,
	linux-mmc@vger.kernel.org, dimitrysh@google.com
Subject: Re: [PATCH] sdio: add new function for RAW (Read after Write) operation
Date: Fri, 14 May 2010 15:06:20 -0700	[thread overview]
Message-ID: <20100514150620.70323c76.akpm@linux-foundation.org> (raw)
In-Reply-To: <AANLkTinEGhNI_n25FVZ4NrLr6ClNw3JVusnJVDZdQchn@mail.gmail.com>

On Fri, 14 May 2010 14:04:17 +0300
Grazvydas Ignotas <notasas@gmail.com> wrote:

> Hi Kalle,
> 
> On Wed, Apr 28, 2010 at 12:18 AM, Grazvydas Ignotas <notasas@gmail.com> wrote:
> > SDIO specification allows RAW (Read after Write) operation using
> > IO_RW_DIRECT command (CMD52) by setting the RAW bit. This operation is
> > similar to ordinary read/write commands, except that both write and read
> > are performed using single command/response pair. The Linux SDIO layer
> > already supports this internaly, only external function is missing for
> > drivers to make use, which is added by this patch.
> >
> > This type of command is required to implement proper power save mode
> > support in wl1251 wifi driver.
> 
> As wl1251 maintainer, can you confirm this is needed for wl1251 driver
> to function in SDIO mode? Perhaps this could help convince Andrew to
> merge this patch.

I kinda ducked the patch because there are no callers of the function.

> Without this the chip is having problems leaving ELP
> mode. Android has similar patch for G1 in it's tree for the same
> reason:
> 
> http://android.git.kernel.org/?p=kernel/common.git;a=commitdiff;h=74a47786f6ecbe6c1cf9fb15efe6a968451deb52

Well let's cc Dmitry then.  Dmitry's patch is somewhat different from
yours and that needs to be looked at.

Some comments:

: From: Grazvydas Ignotas <notasas@gmail.com>
: 
: SDIO specification allows RAW (Read after Write) operation using
: IO_RW_DIRECT command (CMD52) by setting the RAW bit.  This operation is
: similar to ordinary read/write commands, except that both write and read
: are performed using single command/response pair.  The Linux SDIO layer
: already supports this internaly, only external function is missing for
: drivers to make use, which is added by this patch.
: 
: This type of command is required to implement proper power save mode
: support in wl1251 wifi driver.
: 
: Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
: Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
: ---
: 
:  drivers/mmc/core/sdio_io.c    |   31 +++++++++++++++++++++++++++++++
:  include/linux/mmc/sdio_func.h |    3 +++
:  2 files changed, 34 insertions(+)
: 
: diff -puN drivers/mmc/core/sdio_io.c~sdio-add-new-function-for-raw-read-after-write-operation drivers/mmc/core/sdio_io.c
: --- a/drivers/mmc/core/sdio_io.c~sdio-add-new-function-for-raw-read-after-write-operation
: +++ a/drivers/mmc/core/sdio_io.c
: @@ -406,6 +406,37 @@ void sdio_writeb(struct sdio_func *func,
:  EXPORT_SYMBOL_GPL(sdio_writeb);
:  
:  /**
: + *	sdio_writeb_readb - write and read a byte from SDIO function
: + *	@func: SDIO function to access
: + *	@b: byte to write
: + *	@addr: address to write to
: + *	@err_ret: optional status value from transfer
: + *
: + *	Performs a RAW (Read after Write) operation as defined by SDIO spec -
: + *	single byte is written to address space of a given SDIO function and
: + *	response is read back from the same address, both using single request.
: + *	If there is a problem with the operation, 0xff is returned and
: + *	@err_ret will contain the error code.
: + */
: +u8 sdio_writeb_readb(struct sdio_func *func, u8 b,

"b" is a poor name.  Please choose something meaningful.

: +	unsigned int addr, int *err_ret)
: +{
: +	int ret;
: +	u8 val;
: +
: +	BUG_ON(!func);

This test doesn't gain us much.  If `func' is NULL, we'll reliably oops
when dereferencing it, which gives the same info as the BUG_ON().

: +	ret = mmc_io_rw_direct(func->card, 1, func->num, addr, b, &val);
: +	if (err_ret)
: +		*err_ret = ret;
: +	if (ret)
: +		val = 0xff;
: +
: +	return val;
: +}
: +EXPORT_SYMBOL_GPL(sdio_writeb_readb);
: +
: +/**
:   *	sdio_memcpy_fromio - read a chunk of memory from a SDIO function
:   *	@func: SDIO function to access
:   *	@dst: buffer to store the data
: diff -puN include/linux/mmc/sdio_func.h~sdio-add-new-function-for-raw-read-after-write-operation include/linux/mmc/sdio_func.h
: --- a/include/linux/mmc/sdio_func.h~sdio-add-new-function-for-raw-read-after-write-operation
: +++ a/include/linux/mmc/sdio_func.h
: @@ -145,6 +145,9 @@ extern void sdio_writew(struct sdio_func
:  extern void sdio_writel(struct sdio_func *func, u32 b,
:  	unsigned int addr, int *err_ret);
:  
: +extern u8 sdio_writeb_readb(struct sdio_func *func, u8 b,
: +	unsigned int addr, int *err_ret);
: +
:  extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
:  	void *src, int count);
:  extern int sdio_writesb(struct sdio_func *func, unsigned int addr,



  reply	other threads:[~2010-05-14 22:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27 21:18 [PATCH] sdio: add new function for RAW (Read after Write) operation Grazvydas Ignotas
2010-05-14 11:04 ` Grazvydas Ignotas
2010-05-14 22:06   ` Andrew Morton [this message]
2010-05-15  0:02     ` Dmitry Shmidt
2010-05-15 12:16       ` Grazvydas Ignotas
2010-05-15 16:25         ` Dmitry Shmidt
2010-05-15 20:46           ` Grazvydas Ignotas
2010-05-17  6:43   ` Kalle Valo

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=20100514150620.70323c76.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dimitrysh@google.com \
    --cc=kalle.valo@iki.fi \
    --cc=linux-mmc@vger.kernel.org \
    --cc=notasas@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).