Help!

[RFC] New MMC driver model

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Kernel (archive) RSS
Next:  [PATCH] [MMC] Fix SD timeout calculation  
Author Message
Pierre Ossman
External


Since: May 20, 2006
Posts: 202



PostPosted: Sun Jun 18, 2006 3:30 pm    Post subject: [RFC] New MMC driver model
Archived from groups: linux>kernel (more info?)

I've been looking at how we can support SDIO cards and how we need to
adapt our driver model for it.

Functions
=========

First of all, we need to have multiple drivers for one physical card.
This is needed to handle both "combo cards" (mem and I/O) and because
SDIO cards can have seven distinct functions in one card.

For this I propose we add the concept of "function" and that each "card"
has 1 to 8 of these. The drivers then bind to these functions, not to
the card.

Identification
==============

SDIO uses the PCMCIA CIS structure for its generic fields. This includes
the CISTPL_MANFID tuple, which has one 16-bit value for manufacturer and
one 16-bit value for card id. The standard also has a special field for
"standard" interfaces, which are similar to PCI classes.

This scheme would allow us to handle storage cards quite nicely:

#define SDIO_ID_ANY 0xFFFFFFFF

#define SDIO_VENDOR_STORAGE 0xFFFFFFFE
#define SDIO_DEVICE_ID_STORAGE_MMC 0x00000000
#define SDIO_DEVICE_ID_STORAGE_SD 0x00000001

(If the prefix makes the MMC layer a bit SDIO centric, feel free to come
with other suggestions)

Interrupts
==========

SDIO has generic interrupts that cards can use how they damn well
please. The interrupts are also level triggered and have the nice
"feature" of being active when there is no card in the slot.

So I propose the following:

* We add a "interrupt enable" field to the ios structure so that hosts
know when a SDIO card has been inserted and card interrupts should be
caught.

* When a interrupt is caught, the host driver masks it and tells the
MMC layer that a interrupt is pending. The MMC layer then calls a card
interrupt handler in some deferred manner (suggestions welcome).

* When the card driver feels that it has handled the interrupt, it
calls a special acknowledge command that removes the mask the host has set.

Since SDIO cards can have seven distinct functions, there is a generic
register that tells which of the seven that currently has a pending
interrupt. This allows us to call only the relevant handlers.

The "interrupt pending" register also allows us to do a polled solution
for non-SDIO capable hosts. I'm unsure how to get a good balance between
latency and resource usage though.

Register functions
==================

I also intend to write a couple of register functions (sdio_read[bwl])
so that card drivers doesn't have to deal with MMC requests more than
necessary. Endianness can also be handled there (SDIO are always LE).


Comment away! Smile

Rgds
Pierre
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Marcel Holtmann
External


Since: Jul 06, 2006
Posts: 155



PostPosted: Tue Jun 20, 2006 12:00 pm    Post subject: Re: [RFC] New MMC driver model [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Pierre,

> I've been looking at how we can support SDIO cards and how we need to
> adapt our driver model for it.
>
> Functions
> =========
>
> First of all, we need to have multiple drivers for one physical card.
> This is needed to handle both "combo cards" (mem and I/O) and because
> SDIO cards can have seven distinct functions in one card.
>
> For this I propose we add the concept of "function" and that each "card"
> has 1 to 8 of these. The drivers then bind to these functions, not to
> the card.

sounds reasonable to me and a storage only card has only one function.

> Identification
> ==============
>
> SDIO uses the PCMCIA CIS structure for its generic fields. This includes
> the CISTPL_MANFID tuple, which has one 16-bit value for manufacturer and
> one 16-bit value for card id. The standard also has a special field for
> "standard" interfaces, which are similar to PCI classes.
>
> This scheme would allow us to handle storage cards quite nicely:
>
> #define SDIO_ID_ANY 0xFFFFFFFF
>
> #define SDIO_VENDOR_STORAGE 0xFFFFFFFE
> #define SDIO_DEVICE_ID_STORAGE_MMC 0x00000000
> #define SDIO_DEVICE_ID_STORAGE_SD 0x00000001
>
> (If the prefix makes the MMC layer a bit SDIO centric, feel free to come
> with other suggestions)

So we can have SDIO_DEVICE and SDIO_DEVICE_CLASS macros for the matching
drivers to functions.

> Interrupts
> ==========
>
> SDIO has generic interrupts that cards can use how they damn well
> please. The interrupts are also level triggered and have the nice
> "feature" of being active when there is no card in the slot.
>
> So I propose the following:
>
> * We add a "interrupt enable" field to the ios structure so that hosts
> know when a SDIO card has been inserted and card interrupts should be
> caught.
>
> * When a interrupt is caught, the host driver masks it and tells the
> MMC layer that a interrupt is pending. The MMC layer then calls a card
> interrupt handler in some deferred manner (suggestions welcome).
>
> * When the card driver feels that it has handled the interrupt, it
> calls a special acknowledge command that removes the mask the host has set.

It looks very straight forward to me.

> Since SDIO cards can have seven distinct functions, there is a generic
> register that tells which of the seven that currently has a pending
> interrupt. This allows us to call only the relevant handlers.
>
> The "interrupt pending" register also allows us to do a polled solution
> for non-SDIO capable hosts. I'm unsure how to get a good balance between
> latency and resource usage though.

I think that polled solution is not really working out. Especially if
you need some high speed transfers.

> Register functions
> ==================
>
> I also intend to write a couple of register functions (sdio_read[bwl])
> so that card drivers doesn't have to deal with MMC requests more than
> necessary. Endianness can also be handled there (SDIO are always LE).

Good idea.

> Comment away! Smile

My understanding of the current MMC core is rather limited and I think
that I am not of any good help to get this started. However I have a
couple of SDIO cards (various types) for testing and I am happy to test
any patch you send around.

Regards

Marcel


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Marcel Holtmann
External


Since: Jul 06, 2006
Posts: 155



PostPosted: Tue Jun 20, 2006 7:50 pm    Post subject: Re: [RFC] New MMC driver model [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Pierre,

> > My understanding of the current MMC core is rather limited and I think
> > that I am not of any good help to get this started. However I have a
> > couple of SDIO cards (various types) for testing and I am happy to test
> > any patch you send around.
>
> If you have any SDIO cards to spare, I'd really appreciate if I could
> borrow one or two for testing.

let me send you one of my SDIO WiFi cards. Please send me your address
via private email an I try to get it to you as soon as possible.

Regards

Marcel


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
pierre Tardy
External


Since: Jan 09, 2007
Posts: 1



PostPosted: Tue Jan 09, 2007 3:50 pm    Post subject: Re: [RFC] New MMC driver model [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Pierre Ossman <drzeus-list <at> drzeus.cx> writes:

>
> Register functions
> ==================
>
> I also intend to write a couple of register functions (sdio_read[bwl])
> so that card drivers doesn't have to deal with MMC requests more than
> necessary.

Good idea. Another need may be a sdio_read[bwl]_sync, which will poll for the
end of the cmd52s, instead of waiting for the irq. This polling is faster than
wait_for_completion/irq/tasklet/complete mechanism, which involve several
context switches.

> Endianness can also be handled there (SDIO are always LE).
I dont remember sdio spec forcing HW registers to be LE. Function 0 registers
are (BLKSZ for ex), but Function 1-7 register may be BE if the designers found
an advantage to it..




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Pierre Ossman
External


Since: May 20, 2006
Posts: 202



PostPosted: Wed Jan 10, 2007 9:40 pm    Post subject: Re: [RFC] New MMC driver model [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

(Please keep me as cc as I will almost always overlook you replies
otherwise)

pierre Tardy wrote:
> Pierre Ossman <drzeus-list <at> drzeus.cx> writes:
>
>> Register functions
>> ==================
>>
>> I also intend to write a couple of register functions (sdio_read[bwl])
>> so that card drivers doesn't have to deal with MMC requests more than
>> necessary.
>
> Good idea. Another need may be a sdio_read[bwl]_sync, which will poll for the
> end of the cmd52s, instead of waiting for the irq. This polling is faster than
> wait_for_completion/irq/tasklet/complete mechanism, which involve several
> context switches.
>

Hadn't thought of that. I will have to do some tests once I have
something functional.

>> Endianness can also be handled there (SDIO are always LE).
> I dont remember sdio spec forcing HW registers to be LE. Function 0 registers
> are (BLKSZ for ex), but Function 1-7 register may be BE if the designers found
> an advantage to it..
>

Hmm... It's been a while since I read the spec, but perhaps the LE
requirement was only for the base registers.

Rgds
--
-- Pierre Ossman

Linux kernel, MMC maintainer http://www.kernel.org
PulseAudio, core developer http://pulseaudio.org
rdesktop, core developer http://www.rdesktop.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Kernel (archive) All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum