From: Simon Horman <horms@verge.net.au>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Paul Mundt <lethal@linux-sh.org>, Chris Ball <cjb@laptop.org>
Subject: Re: [PATCH 3/5] mmc: sdhi: Add write16_hook
Date: Tue, 21 Jun 2011 00:50:30 +0000 [thread overview]
Message-ID: <20110621005020.GB16230@verge.net.au> (raw)
In-Reply-To: <BANLkTikh9D=uaGmZ5BCMPmESexjDSczwhg@mail.gmail.com>
On Tue, Jun 21, 2011 at 09:36:03AM +0900, Magnus Damm wrote:
> On Tue, Jun 21, 2011 at 8:00 AM, Simon Horman <horms@verge.net.au> wrote:
> > Some controllers require waiting for the bus to become idle
> > before writing to some registers. I have implemented this
> > by adding a hook to sd_ctrl_write16() and implementing
> > a hook for SDHI which waits for the bus to become idle.
> >
> > Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Cc: Magnus Damm <magnus.damm@gmail.com>
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> >
> > ---
> >
> > Dependencies: "mmc: tmio: Share register access functions"
> >
> > v2:
> > * Include linux/delay.h instead of asm/delay.h
> > * Skip write if sh_mobile_sdhi_wait_idle() times out
> > - The bus will probably be in an inconsistent state and writing
> > may lock up the bus
> > * Only set hook if TMIO_MMC_HAS_IDLE_WAIT is set in platform data
> > rather than checking for TMIO_MMC_HAS_IDLE_WAIT each time the
> > hook is called.
> > ---
>
> Thanks Simon, this version looks much better!
>
> > index 5a90266..0dc9804 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -94,6 +101,7 @@ struct tmio_mmc_data {
> > void (*set_pwr)(struct platform_device *host, int state);
> > void (*set_clk_div)(struct platform_device *host, int state);
> > int (*get_cd)(struct platform_device *host);
> > + int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> > };
> >
> > static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
>
> What's the reason behind passing "struct tmio_mmc_host *" as an
> argument to the new hook? Performance? All other callbacks seem to
> take a "struct platform_device *", so being consistent here may be
> good unless it comes with too much overhead.
The reason is that
1) The hook is called from sd_ctrl_write16 which takes
struct tmio_mmc_host * as its first argument and;
2) The hook that has been implemented calls sd_ctrl_read16() which takes a
struct tmio_mmc_host * as its first argument.
So it seemed logical to pass that down.
In the caes of 1) we can get the struct platform_device * using host->pdev.
However, in the case of 2) is it less clear to me how we can get the
struct tmio_mmc_host * from a struct platform_device *.
next prev parent reply other threads:[~2011-06-21 0:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 23:00 [PATCH 0/5 v2] mmc: sdhi: Allow waiting for idle Simon Horman
2011-06-20 23:00 ` [PATCH 1/5] mmc: tmio: name 0xd8 as CTL_DMA_ENABLE Simon Horman
2011-06-20 23:00 ` [PATCH 2/5] mmc: tmio: Share register access functions Simon Horman
2011-06-20 23:00 ` [PATCH 3/5] mmc: sdhi: Add write16_hook Simon Horman
2011-06-21 0:36 ` Magnus Damm
2011-06-21 0:50 ` Simon Horman [this message]
2011-06-21 0:59 ` Magnus Damm
2011-06-21 1:13 ` Simon Horman
2011-06-21 1:36 ` Magnus Damm
2011-06-21 2:09 ` Simon Horman
2011-06-21 2:34 ` Magnus Damm
2011-06-20 23:00 ` [PATCH 4/5] ARM: mach-shmobile: ag5evm: consistently name sdhi info structures Simon Horman
2011-06-21 8:50 ` Paul Mundt
2011-06-20 23:00 ` [PATCH 5/5] ARM: mach-shmobile: ag5evm: SDHI requires waiting for idle Simon Horman
2011-06-21 16:10 ` Chris Ball
2011-06-21 16:27 ` Paul Mundt
2011-06-21 16:37 ` Chris Ball
-- strict thread matches above, loose matches on Subject: below --
2011-06-20 6:06 [PATCH 0/5] mmc: sdhi: Allow " Simon Horman
2011-06-20 6:06 ` [PATCH 3/5] mmc: sdhi: Add write16_hook Simon Horman
2011-06-20 6:25 ` Paul Mundt
2011-06-20 13:42 ` Simon Horman
2011-06-20 6:29 ` Guennadi Liakhovetski
2011-06-20 13:40 ` Simon Horman
2011-06-20 7:04 ` Magnus Damm
2011-06-20 13:40 ` Simon Horman
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=20110621005020.GB16230@verge.net.au \
--to=horms@verge.net.au \
--cc=cjb@laptop.org \
--cc=g.liakhovetski@gmx.de \
--cc=lethal@linux-sh.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@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