lkml.org 
[lkml]   [2008]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] atmel-mci: support multiple mmc slots
Pierre Ossman <drzeus-list@drzeus.cx> wrote:
> On Mon, 22 Sep 2008 18:38:16 +0200
> Haavard Skinnemoen <haavard.skinnemoen@atmel.com> wrote:
>
> > The Atmel MCI controller can drive multiple cards through separate sets
> > of pins, but only one at a time. This patch adds support for
> > multiplexing access to the controller so that multiple card slots can be
> > used as if they were hooked up to separate mmc controllers.
> >
>
> This multiplexing shenanigans seems to be all the rage these days...

Apparently. I suppose it saves a few gates.

> >
> > static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> > {
> > - struct atmel_mci *host = mmc_priv(mmc);
> > + struct atmel_mci_slot *slot = mmc_priv(mmc);
> > + struct atmel_mci *host = slot->host;
> >
> > if (ios->clock) {
> > u32 clkdiv;
>
> You forgot the most important part; how to handle the clock given two
> different requests.

I don't think I did. The set_ios() function merely calculates the value
of MR and stashes it away. It isn't written to the controller until
after the host has been claimed for a request.

> (This will also get a bit more painful when/if the core starts
> disabling the clock when a card is idle)

The atmel-mci driver already stops the clock between requests. Though I
don't understand why the core would care about clocks.

> > +
> > + if (gpio_is_valid(slot->detect_pin)) {
> > + int ret;
> > +
> > + setup_timer(&slot->detect_timer, atmci_detect_change,
> > + (unsigned long)slot);
> > +
> > + ret = request_irq(gpio_to_irq(slot->detect_pin),
> > + atmci_detect_interrupt,
> > + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
> > + "mmc-detect", slot);
> > + if (ret) {
> > + dev_dbg(&mmc->class_dev,
> > + "could not request IRQ %d for detect pin\n",
> > + gpio_to_irq(slot->detect_pin));
> > + gpio_free(slot->detect_pin);
> > + slot->detect_pin = -EBUSY;
> > + }
> > + }
>
> Fall back to polling?

Probably, yes. Can I fall back to polling after the host has been
registered?

> > + /* We need at least one slot to succeed */
> > + ret = -1;
> > + if (pdata->slot[0].bus_width)
> > + ret &= atmci_init_slot(host, &pdata->slot[0],
> > + MCI_SDCSEL_SLOT_A);
> > + if (pdata->slot[1].bus_width)
> > + ret &= atmci_init_slot(host, &pdata->slot[1],
> > + MCI_SDCSEL_SLOT_B);
> > + if (ret) {
> > + ret = -ENODEV;
> > + goto err_init_slot;
> > }
>
> Memory/resource leak.

Hmm...I guess I was being too clever. I'll redo it with less clever
code.

Haavard


\
 
 \ /
  Last update: 2008-09-23 20:19    [W:0.087 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site