From: Philip Langdale <philipl@overt.org>
To: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: linux-mmc@vger.kernel.org,
linux-kernel <linux-kernel@vger.kernel.org>,
Andrew de Quincey <adq_dvb@lidskialf.net>
Subject: Re: [PATCH 1/2] mmc: make sdhci work with ricoh mmc controller
Date: Sun, 06 Jun 2010 19:11:29 -0400 [thread overview]
Message-ID: <b99ba230e4a7f8b2174d7f52f1e7324c@localhost> (raw)
In-Reply-To: <1275859731-2898-1-git-send-email-maximlevitsky@gmail.com>
On Mon, 7 Jun 2010 00:28:50 +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'
> Most of the credit for this goes to Andrew de Quincey
>
>
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> CC: Andrew de Quincey <adq_dvb@lidskialf.net>
> CC: linux-mmc@vger.kernel.org <linux-mmc@vger.kernel.org>
ACK with one change to add a #define for the device ID.
> ---
> drivers/mmc/host/sdhci-pci.c | 31 +++++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci.c | 3 ++-
> drivers/mmc/host/sdhci.h | 4 ++++
> 3 files changed, 37 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
> index 65483fd..c4bcaeb 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>
>
> @@ -84,7 +85,21 @@ static int ricoh_probe(struct sdhci_pci_chip *chip)
> if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG ||
> chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
> chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
> + return 0;
> +}
> +
> +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;
> return 0;
> }
As we discussed, highspeed works. Of course, sdhci never sets the MMC
highspeed flag so the cap is irrelevant. We'd need another quirk to
indicate highspeed MMC is supported.
This can be done in a separate patch.
> @@ -95,6 +110,14 @@ 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_32BIT_DMA_ADDR |
> + SDHCI_QUIRK_CLOCK_BEFORE_RESET |
> + SDHCI_QUIRK_NO_CARD_NO_RESET |
> + SDHCI_QUIRK_MISSING_CAPS
> +};
> +
> static const struct sdhci_pci_fixes sdhci_ene_712 = {
> .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
> SDHCI_QUIRK_BROKEN_DMA,
> @@ -374,6 +397,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,
> + },
> +
> + {
It seems we generally want to add a #define for the device ID.
The ENE device below has one.
> .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..483b78e 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1687,7 +1687,8 @@ int sdhci_add_host(struct sdhci_host *host)
> host->version);
> }
>
> - caps = sdhci_readl(host, SDHCI_CAPABILITIES);
> + caps = (host->quirks & SDHCI_QUIRK_MISSING_CAPS) ? host->caps :
> + sdhci_readl(host, SDHCI_CAPABILITIES);
>
> 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..b1839a3 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -240,6 +240,8 @@ struct sdhci_host {
> #define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25)
> /* Controller cannot support End Attribute in NOP ADMA descriptor */
> #define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26)
> +/* Controller is missing device caps. Use caps provided by host */
> +#define SDHCI_QUIRK_MISSING_CAPS (1<<27)
>
> int irq; /* Device IRQ */
> void __iomem * ioaddr; /* Mapped address */
> @@ -292,6 +294,8 @@ struct sdhci_host {
>
> struct timer_list timer; /* Timer for timeouts */
>
> + unsigned int caps; /* Alternative capabilities */
> +
> unsigned long private[0] ____cacheline_aligned;
> };
--phil
next prev parent reply other threads:[~2010-06-06 23:11 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1275516180.30272.4.camel@maxim-laptop>
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
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 23:11 ` Philip Langdale [this message]
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-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-08 8:52 ` Maxim Levitsky
2010-07-30 13:57 MMC: [PATCH 0/2] Two fixes for mmc system Maxim Levitsky
2010-07-30 13:57 ` [PATCH 1/2] MMC: make sdhci work with ricoh mmc controller Maxim Levitsky
-- strict thread matches above, loose matches on Subject: below --
2010-07-31 12:37 MMC: [PATCH 0/2 v2] Two fixes for mmc system Maxim Levitsky
2010-07-31 12:37 ` [PATCH 1/2] MMC: make sdhci work with ricoh mmc controller 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=b99ba230e4a7f8b2174d7f52f1e7324c@localhost \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).