mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
To: Pierre Ossman <drzeus-mmc@drzeus.cx>
Cc: linux-kernel@vger.kernel.org, oakad@yahoo.com
Subject: Re: MMC host driver requirements
Date: Tue, 9 Sep 2008 11:06:13 +0200	[thread overview]
Message-ID: <20080909090613.GA22158@rere.qmqm.pl> (raw)
In-Reply-To: <20080909091800.37eccc0f@mjolnir.drzeus.cx>

On Tue, Sep 09, 2008 at 09:18:00AM +0200, Pierre Ossman wrote:
> On Sun, 7 Sep 2008 23:52:28 +0200
> Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote:
> > I'm writing a driver for ENE CB710/720 memory card readers found in some
> > laptops (ie. some versions of HP Compaq nx9500). This chip has three
> > memory card interfaces: MMC/SD, SmartMedia, MemoryStick. I started with
> > the MMC interface as I have a card to test it with, but I could not find
> > any documentation about MMC stack besides the source code.
> Hmm... I thought the CB710/720 only had an SDHCI interface for the
> MMC/SD portion.

SDHCI supports CB712/714 parts. I already investigated that CB710 is not
SDHCI-compatible (register layout is a bit different, for a start).

> > So here are some questions:
> > 
> > 1. Can I call mmc_detect_change() after mmc_alloc_host() but before or
> >    during mmc_add_host() (ie. from interrupt handler)? If yes, what
> >    if mmc_alloc_host() fails then?
> No you can't.

> > 2. Can I call mmc_request_done() from ->request() handler?
> Yes, although I'm not sure how well tested it is.

I checked yesterday that indeed nothing bad happens, but looking at
the code I can see that mmc_request_done can call ->request() with
a retried request so, unless gcc optimizes tail-calls, recursion
there might eat up all stack space someday.

> > 3. Does MMC stack serialize calls to ->request() or any other host
> >    driver ops?
> Requests are serialised, yes. But you could in theory get set_ios()
> calls during an ongoing request. Doing so would be very undefined
> though so it should be sufficient to just avoid crashing the entire
> system if that happens.

This should be easy.

> > 4. What is the difference (if any) between mrq->data and mrq->cmd->data
> >    as seen from ->request()?
> Not much really. The cmd->data pointer is for convenience as it allows
> common code paths for handling mrq->cmd and mrq->stop.

Is it safe to assume that cmd->data is NULL when command type is other
than ADTC? I've looked briefly through drivers/mmc/core/*_ops.c, but
maybe I missed something?

> > 5. Are there any constraints to scatterlist passed to ->request()
> >    - number of elements, data alignment, element data size?
> >    (At first I assumed that there are none and have writted a simple
> >    wrapper to guarantee multiple-of-16-byte data blocks - but maybe
> >    its just not needed?)
> None at all. You have to specify your restrictions in the mmc_host
> structure fields (note that you cannot restrict alignment in any way).
> The mmc_test driver is useful for testing some of the corner cases.

I'll give it a try.

Thanks for your reply. I'll post the code for review when it does more
than just blinking LEDs. ;)

Best Regards,
Michał Mirosław


  reply	other threads:[~2008-09-09  9:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-07 21:52 Michał Mirosław
2008-09-09  7:18 ` Pierre Ossman
2008-09-09  9:06   ` Michał Mirosław [this message]
2008-09-11 20:13     ` Driver for CB710/720 memory card reader (MMC part) Michał Mirosław
2008-09-12 23:43       ` RFC: " Michał Mirosław
2008-09-20 11:00         ` Pierre Ossman
2008-09-25  6:29           ` RFC: Driver for CB710/720 memory card reader (MMC part) - v2 Michał Mirosław
2008-10-04 19:51             ` Pierre Ossman
2008-10-29 14:11               ` RFC: Driver for CB710/720 memory card reader (MMC part) - v3 Michał Mirosław
2008-11-14 21:06                 ` Pierre Ossman
2009-02-01 18:54                   ` Michał Mirosław
2009-02-21 12:46                     ` Pierre Ossman
2009-05-08 15:16                       ` [PATCH/RFC 2.6.29.2] Driver for CB710/720 memory card reader (MMC part) - v4 Michał Mirosław
2009-05-22 11:27                         ` Pierre Ossman
2009-05-22 17:55                           ` [PATCH 2.6.29.3] Driver for CB710/720 memory card reader (MMC part) - v5 Michał Mirosław
2009-05-22 18:33                             ` [PATCH 2.6.29.4] Driver for CB710/720 memory card reader (MMC part) - v5 fixed Michał Mirosław
2009-05-27 20:13                               ` Pierre Ossman
2009-06-04 10:24                                 ` Michał Mirosław
2009-06-05  9:26                                   ` Michał Mirosław
2009-06-13 10:39                                   ` Pierre Ossman
2009-05-22 19:04                           ` [PATCH/RFC 2.6.29.2] Driver for CB710/720 memory card reader (MMC part) - v4 Bartlomiej Zolnierkiewicz

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=20080909090613.GA22158@rere.qmqm.pl \
    --to=mirq-linux@rere.qmqm.pl \
    --cc=drzeus-mmc@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oakad@yahoo.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

all inboxes | Powered by JetHome®