From: Philip Langdale <philipl@overt.org>
To: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
adq_dvb@lidskialf.net,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH] mmc: make sdhci work with ricoh mmc controller
Date: Thu, 3 Jun 2010 09:39:14 -0700 [thread overview]
Message-ID: <20100603093914.3397ac42@fido5> (raw)
In-Reply-To: <1275582709.2563.19.camel@maxim-laptop>
On Thu, 03 Jun 2010 19:31:49 +0300
Maxim Levitsky <maximlevitsky@gmail.com> wrote:
> On Thu, 2010-06-03 at 09:11 -0700, Philip Langdale wrote:
> > On Thu, 3 Jun 2010 04:16:27 +0300
> > Maxim Levitsky <maximlevitsky@gmail.com> wrote:
> >
> > > The current way of disabling it is not well tested by vendor
> > > and has all kinds of bugs that show up on resume from ram/disk.
> > >
> > > Old way of disabling is still supported by
> > > continuing to use CONFIG_MMC_RICOH_MMC.
> > >
> > > Based on
> > > 'http://list.drzeus.cx/pipermail/sdhci-devel/2007-December/002085.html'
> >
> > As long as this doesn't limit the performance of MMC cards, I can't
> > complain.
> >
> > BTW, the new PCIe native controllers from Ricoh don't require the
> > MMC controller to be disabled - the SD controller sees the cards by
> > default; I guess some bit has to be twiddled by the MMC driver.
> Can I distinguish between this and newer controllers.
> Could you help me with that?
I'll check in on it tomorrow - I don't have access to a relevant machine
today, but I'm pretty sure they changed the PCI ID so it won't be a
problem.
>
> >
> > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> > > CC: adq_dvb@lidskialf.net
> > > CC: linux-mmc@vger.kernel.org <linux-mmc@vger.kernel.org>
> > > ---
> > > drivers/mmc/host/sdhci-pci.c | 34
> > > ++++++++++++++++++++++++++++++++++ drivers/mmc/host/sdhci.c |
> > > 5 ++++- drivers/mmc/host/sdhci.h | 2 ++
> > > 3 files changed, 40 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/drivers/mmc/host/sdhci-pci.c
> > > b/drivers/mmc/host/sdhci-pci.c index 65483fd..3843780 100644
> > > --- a/drivers/mmc/host/sdhci-pci.c
> > > +++ b/drivers/mmc/host/sdhci-pci.c
> > > @@ -17,6 +17,7 @@
> > > #include <linux/pci.h>
> > > #include <linux/dma-mapping.h>
> > > #include <linux/slab.h>
> > > +#include <linux/device.h>
> > >
> > > #include <linux/mmc/host.h>
> > >
> > > @@ -85,6 +86,26 @@ static int ricoh_probe(struct sdhci_pci_chip
> > > *chip) chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
> > > chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
> > >
> > > + /* To disable hardware races against MMC part */
> > > + device_disable_async_suspend(&chip->pci_dev->dev);
> > > + return 0;
> > > +}
> >
> > It would be nice if this could be more selective so it only happens
> > if it's really needed.
> Same as above
Not sure how to do it in an elegant way. The probe function could search
the PCI bus for the other device - ugh. But if you can't reproduce the
race, then we don't need to worry.
> >
> > > +
> > > +static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot)
> > > +{
> > > + slot->host->caps =
> > > + ((0x21 << SDHCI_TIMEOUT_CLK_SHIFT)
> > > + & SDHCI_TIMEOUT_CLK_MASK) |
> > > +
> > > + ((0x21 << SDHCI_CLOCK_BASE_SHIFT)
> > > + & SDHCI_CLOCK_BASE_MASK) |
> > > +
> > > + SDHCI_TIMEOUT_CLK_UNIT |
> > > + SDHCI_CAN_VDD_330 |
> > > + SDHCI_CAN_DO_SDMA ;
> >
> > Have you been able to establish if 4bit and high-speed operations
> > work correctly through the MMC controller? I note that you didn't
> > set SDHCI_CAN_DO_HISPD.
> Didn't test that yet, will do.
> I hope my MMCPlus card can do high-speed.
I should get a chance today to test this as well; I'll let you know
what I see.
> >
> > > +
> > > + /* To disable hardware races against SDHC part */
> > > + device_disable_async_suspend(&slot->chip->pci_dev->dev);
> > > return 0;
> > > }
> > >
> > > @@ -95,6 +116,11 @@ static const struct sdhci_pci_fixes
> > > sdhci_ricoh = { SDHCI_QUIRK_CLOCK_BEFORE_RESET,
> > > };
> > >
> > > +static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
> > > + .probe_slot = ricoh_mmc_probe_slot,
> > > + .quirks = SDHCI_QUIRK_NO_CARD_NO_RESET,
> > > +};
> > > +
> > > static const struct sdhci_pci_fixes sdhci_ene_712 = {
> > > .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
> > > SDHCI_QUIRK_BROKEN_DMA,
> > > @@ -374,6 +400,14 @@ static const struct pci_device_id pci_ids[]
> > > __devinitdata = { },
> > >
> > > {
> > > + .vendor = PCI_VENDOR_ID_RICOH,
> > > + .device = 0x843,
> > > + .subvendor = PCI_ANY_ID,
> > > + .subdevice = PCI_ANY_ID,
> > > + .driver_data =
> > > (kernel_ulong_t)&sdhci_ricoh_mmc,
> > > + },
> > > +
> > > + {
> > > .vendor = PCI_VENDOR_ID_ENE,
> > > .device =
> > > PCI_DEVICE_ID_ENE_CB712_SD, .subvendor = PCI_ANY_ID,
> > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > > index c6d1bd8..dbd9367 100644
> > > --- a/drivers/mmc/host/sdhci.c
> > > +++ b/drivers/mmc/host/sdhci.c
> > > @@ -1687,7 +1687,10 @@ int sdhci_add_host(struct sdhci_host *host)
> > > host->version);
> > > }
> > >
> > > - caps = sdhci_readl(host, SDHCI_CAPABILITIES);
> > > + if (host->caps)
> > > + caps = host->caps;
> > > + else
> > > + caps = sdhci_readl(host, SDHCI_CAPABILITIES);
> >
> > I'd prefer keying this off an explicit quirk.
> Could you explain?
>
> Do you mean I should add SDHCI_QUIRK_MISSING_CAPS ?
> This is fine.
>
> If you mean that I should create a SDHCI_QUIRK_RICOH_MMC_CAPS,
> and hardcode caps in sdhci, I kind of disagree, too ugly :-)
I meant SDHCI_QUIRK_MISSING_CAPS. :-)
Use host->caps but only when the QUIRK is set.
>
> Btw, suspend/resume races seem to disappear. Maybe I didn't install
> the kernel (will test more)
> > >
> > > if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
> > > host->flags |= SDHCI_USE_SDMA;
> > > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> > > index c846813..b41581a 100644
> > > --- a/drivers/mmc/host/sdhci.h
> > > +++ b/drivers/mmc/host/sdhci.h
> > > @@ -292,6 +292,8 @@ struct sdhci_host {
> > >
> > > struct timer_list timer; /* Timer
> > > for timeouts */
> > > + unsigned int caps; /*
> > > Alternative capabilities */ +
> > > unsigned long private[0]
> > > ____cacheline_aligned; };
> > >
> >
> > --phil
>
>
> Best regards,
> Maxim Levitsky
>
>
--phil
next prev parent reply other threads:[~2010-06-03 16:39 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 18:56 strange problem with ricoh-mmc Maxim Levitsky
2010-06-02 19:54 ` Philip Langdale
2010-06-02 20:19 ` Maxim Levitsky
2010-06-02 20:42 ` Philip Langdale
2010-06-02 22:03 ` Maxim Levitsky
2010-06-03 1:16 ` [PATCH] mmc: make sdhci work with ricoh mmc controller Maxim Levitsky
2010-06-03 16:11 ` Philip Langdale
2010-06-03 16:31 ` Maxim Levitsky
2010-06-03 16:39 ` Philip Langdale [this message]
2010-06-03 17:05 ` Philip Langdale
2010-06-03 17:35 ` Maxim Levitsky
2010-06-04 4:42 ` Philip Langdale
2010-06-04 10:07 ` Maxim Levitsky
2010-06-04 15:05 ` Philip Langdale
2010-06-04 15:33 ` Maxim Levitsky
2010-06-06 21:24 ` Maxim Levitsky
2010-06-06 21:28 ` [PATCH 1/2] " Maxim Levitsky
2010-06-06 21:28 ` Maxim Levitsky
2010-06-06 23:11 ` Philip Langdale
2010-06-06 23:11 ` Philip Langdale
2010-06-07 0:37 ` Maxim Levitsky
2010-06-07 1:41 ` Philip Langdale
2010-06-11 19:08 ` [PATCH v3] " Maxim Levitsky
2010-06-11 19:15 ` [PATCH v4] " maximlevitsky
2010-06-13 11:29 ` Maxim Levitsky
2010-06-13 16:06 ` Philip Langdale
2010-06-06 21:28 ` [PATCH 2/2] mmc: fix mmc card disappearence on resume on ricoh mmc controllers Maxim Levitsky
2010-06-06 23:22 ` Philip Langdale
2010-06-06 23:22 ` Philip Langdale
2010-06-08 8:57 ` Maxim Levitsky
2010-06-06 23:23 ` Chris Ball
2010-06-07 0:33 ` Maxim Levitsky
2010-06-07 5:47 ` Chris Ball
2010-06-07 5:47 ` Chris Ball
2010-06-08 8:52 ` Maxim Levitsky
2010-06-03 1:22 ` strange problem with ricoh-mmc Maxim Levitsky
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=20100603093914.3397ac42@fido5 \
--to=philipl@overt.org \
--cc=adq_dvb@lidskialf.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=maximlevitsky@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.