* [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
@ 2010-09-29 20:07 ` Wolfram Sang
2010-09-29 21:24 ` Richard Röjfors
2010-09-29 20:08 ` [PATCH 2/6] mmc: sdhci-pltfm: move .h-file into apropriate subdir Wolfram Sang
` (9 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2010-09-29 20:07 UTC (permalink / raw)
To: linux-arm-kernel
We need to carry some information per host, e.g. the clock. Add a
structure for it and initialize it in the generic part. Also do not use
the parent of the platform_device (if it is available), this breaks the
clock-matching on ARM.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Richard R?jfors <richard.rojfors.ext@mocean-labs.com>
---
Changes since last version:
* added types.h
* removed usage of pdev->dev.parent to ensure clk-matching
Please speak up if this has a use case I failed to see!
drivers/mmc/host/sdhci-pltfm.c | 8 ++++----
drivers/mmc/host/sdhci-pltfm.h | 7 +++++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e045e3c..095ca9d 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -55,6 +55,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
const struct platform_device_id *platid = platform_get_device_id(pdev);
struct sdhci_host *host;
+ struct sdhci_pltfm_host *pltfm_host;
struct resource *iomem;
int ret;
@@ -71,16 +72,15 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Invalid iomem size. You may "
"experience problems.\n");
- if (pdev->dev.parent)
- host = sdhci_alloc_host(pdev->dev.parent, 0);
- else
- host = sdhci_alloc_host(&pdev->dev, 0);
+ host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
if (IS_ERR(host)) {
ret = PTR_ERR(host);
goto err;
}
+ pltfm_host = sdhci_priv(host);
+
host->hw_name = "platform";
if (pdata && pdata->ops)
host->ops = pdata->ops;
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 900f329..93a0319 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -11,8 +11,15 @@
#ifndef _DRIVERS_MMC_SDHCI_PLTFM_H
#define _DRIVERS_MMC_SDHCI_PLTFM_H
+#include <linux/clk.h>
+#include <linux/types.h>
#include <linux/sdhci-pltfm.h>
+struct sdhci_pltfm_host {
+ struct clk *clk;
+ u32 scratchpad; /* to handle quirks across io-accessor calls */
+};
+
extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
#endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */
--
1.7.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data
2010-09-29 20:07 ` [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data Wolfram Sang
@ 2010-09-29 21:24 ` Richard Röjfors
2010-09-30 8:16 ` Wolfram Sang
0 siblings, 1 reply; 22+ messages in thread
From: Richard Röjfors @ 2010-09-29 21:24 UTC (permalink / raw)
To: linux-arm-kernel
On 09/29/2010 10:07 PM, Wolfram Sang wrote:
> We need to carry some information per host, e.g. the clock. Add a
> structure for it and initialize it in the generic part. Also do not use
> the parent of the platform_device (if it is available), this breaks the
> clock-matching on ARM.
The reason it's there is for instance a case when the shdci device is exposed
from a MFD device which sits on top of PCI. Then the parent (PCI device)
is the device that is DMA capable. This patch will break such usage.
What is the purpose of this patch? You allocate space for an extra struct,
which you have a pointer pointing to, but you never use the pointer?
>
> Signed-off-by: Wolfram Sang<w.sang@pengutronix.de>
> Cc: Richard R?jfors<richard.rojfors.ext@mocean-labs.com>
> ---
>
> Changes since last version:
>
> * added types.h
I saw no types.h?
> * removed usage of pdev->dev.parent to ensure clk-matching
> Please speak up if this has a use case I failed to see!
>
> drivers/mmc/host/sdhci-pltfm.c | 8 ++++----
> drivers/mmc/host/sdhci-pltfm.h | 7 +++++++
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index e045e3c..095ca9d 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -55,6 +55,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
> struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
> const struct platform_device_id *platid = platform_get_device_id(pdev);
> struct sdhci_host *host;
> + struct sdhci_pltfm_host *pltfm_host;
> struct resource *iomem;
> int ret;
>
> @@ -71,16 +72,15 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "Invalid iomem size. You may "
> "experience problems.\n");
>
> - if (pdev->dev.parent)
> - host = sdhci_alloc_host(pdev->dev.parent, 0);
> - else
> - host = sdhci_alloc_host(&pdev->dev, 0);
> + host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
>
> if (IS_ERR(host)) {
> ret = PTR_ERR(host);
> goto err;
> }
>
> + pltfm_host = sdhci_priv(host);
> +
> host->hw_name = "platform";
> if (pdata&& pdata->ops)
> host->ops = pdata->ops;
> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
> index 900f329..93a0319 100644
> --- a/drivers/mmc/host/sdhci-pltfm.h
> +++ b/drivers/mmc/host/sdhci-pltfm.h
> @@ -11,8 +11,15 @@
> #ifndef _DRIVERS_MMC_SDHCI_PLTFM_H
> #define _DRIVERS_MMC_SDHCI_PLTFM_H
>
> +#include<linux/clk.h>
> +#include<linux/types.h>
> #include<linux/sdhci-pltfm.h>
>
> +struct sdhci_pltfm_host {
> + struct clk *clk;
> + u32 scratchpad; /* to handle quirks across io-accessor calls */
> +};
> +
> extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
>
> #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data
2010-09-29 21:24 ` Richard Röjfors
@ 2010-09-30 8:16 ` Wolfram Sang
2010-09-30 9:54 ` Richard Röjfors
0 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2010-09-30 8:16 UTC (permalink / raw)
To: linux-arm-kernel
Hi Richard,
On Wed, Sep 29, 2010 at 11:24:25PM +0200, Richard R?jfors wrote:
> On 09/29/2010 10:07 PM, Wolfram Sang wrote:
> >We need to carry some information per host, e.g. the clock. Add a
> >structure for it and initialize it in the generic part. Also do not use
> >the parent of the platform_device (if it is available), this breaks the
> >clock-matching on ARM.
>
> The reason it's there is for instance a case when the shdci device is exposed
> from a MFD device which sits on top of PCI. Then the parent (PCI device)
> is the device that is DMA capable. This patch will break such usage.
I feared that there is a reason. The problem I see is now, that the parent gets
always set (from drivers/base/platform.c):
37c12e74 (Russell King 2005-11-05 21:19:33 +0000 235) int platform_device_add(struct platform_device *pdev)
^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 236) {
^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 237) int i, ret = 0;
^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 238)
^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 239) if (!pdev)
^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 240) return -EINVAL;
^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 241)
^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 242) if (!pdev->dev.parent)
^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 243) pdev->dev.parent = &platform_bus;
...
So, sdhci-plftm cannot access the platform_data connected to the original
platform_device via host->mmc->parent.
> What is the purpose of this patch? You allocate space for an extra struct,
> which you have a pointer pointing to, but you never use the pointer?
We want to extend sdhci-pltfm to support the various sdhci-cores on (for now
mainly) ARM platforms. A number of those cores need board specific information
to be used in a custom init()-call, which shall be passed via platform_data.
The pointer will be used in the platform specific extensions.
> >
> >Signed-off-by: Wolfram Sang<w.sang@pengutronix.de>
> >Cc: Richard R?jfors<richard.rojfors.ext@mocean-labs.com>
> >---
> >
> >Changes since last version:
> >
> >* added types.h
>
> I saw no types.h?
In the second chunk, the include file.
Thanks,
Wolfram
>
> >* removed usage of pdev->dev.parent to ensure clk-matching
> > Please speak up if this has a use case I failed to see!
> >
> > drivers/mmc/host/sdhci-pltfm.c | 8 ++++----
> > drivers/mmc/host/sdhci-pltfm.h | 7 +++++++
> > 2 files changed, 11 insertions(+), 4 deletions(-)
> >
> >diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> >index e045e3c..095ca9d 100644
> >--- a/drivers/mmc/host/sdhci-pltfm.c
> >+++ b/drivers/mmc/host/sdhci-pltfm.c
> >@@ -55,6 +55,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
> > struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
> > const struct platform_device_id *platid = platform_get_device_id(pdev);
> > struct sdhci_host *host;
> >+ struct sdhci_pltfm_host *pltfm_host;
> > struct resource *iomem;
> > int ret;
> >
> >@@ -71,16 +72,15 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
> > dev_err(&pdev->dev, "Invalid iomem size. You may "
> > "experience problems.\n");
> >
> >- if (pdev->dev.parent)
> >- host = sdhci_alloc_host(pdev->dev.parent, 0);
> >- else
> >- host = sdhci_alloc_host(&pdev->dev, 0);
> >+ host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
> >
> > if (IS_ERR(host)) {
> > ret = PTR_ERR(host);
> > goto err;
> > }
> >
> >+ pltfm_host = sdhci_priv(host);
> >+
> > host->hw_name = "platform";
> > if (pdata&& pdata->ops)
> > host->ops = pdata->ops;
> >diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
> >index 900f329..93a0319 100644
> >--- a/drivers/mmc/host/sdhci-pltfm.h
> >+++ b/drivers/mmc/host/sdhci-pltfm.h
> >@@ -11,8 +11,15 @@
> > #ifndef _DRIVERS_MMC_SDHCI_PLTFM_H
> > #define _DRIVERS_MMC_SDHCI_PLTFM_H
> >
> >+#include<linux/clk.h>
> >+#include<linux/types.h>
> > #include<linux/sdhci-pltfm.h>
> >
> >+struct sdhci_pltfm_host {
> >+ struct clk *clk;
> >+ u32 scratchpad; /* to handle quirks across io-accessor calls */
> >+};
> >+
> > extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
> >
> > #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100930/fba09373/attachment.sig>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data
2010-09-30 8:16 ` Wolfram Sang
@ 2010-09-30 9:54 ` Richard Röjfors
2010-09-30 10:19 ` Wolfram Sang
0 siblings, 1 reply; 22+ messages in thread
From: Richard Röjfors @ 2010-09-30 9:54 UTC (permalink / raw)
To: linux-arm-kernel
On 09/30/2010 10:16 AM, Wolfram Sang wrote:
> Hi Richard,
>
> On Wed, Sep 29, 2010 at 11:24:25PM +0200, Richard R?jfors wrote:
>> On 09/29/2010 10:07 PM, Wolfram Sang wrote:
>>> We need to carry some information per host, e.g. the clock. Add a
>>> structure for it and initialize it in the generic part. Also do not use
>>> the parent of the platform_device (if it is available), this breaks the
>>> clock-matching on ARM.
>>
>> The reason it's there is for instance a case when the shdci device is exposed
>> from a MFD device which sits on top of PCI. Then the parent (PCI device)
>> is the device that is DMA capable. This patch will break such usage.
>
> I feared that there is a reason. The problem I see is now, that the parent gets
> always set (from drivers/base/platform.c):
Then we obviously need to pass more information in the platform_data to be able
to chose which device to be used.
>
> So, sdhci-plftm cannot access the platform_data connected to the original
> platform_device via host->mmc->parent.
You're right it wouldn't. But isn't it a bit risky even if you could access it,
in the long the platform_data coild point to something that is in the __devinit section
or similar?
What about extend the struct you defined with the pieces needed, and access it via
sdhci_priv?
>> What is the purpose of this patch? You allocate space for an extra struct,
>> which you have a pointer pointing to, but you never use the pointer?
>
> We want to extend sdhci-pltfm to support the various sdhci-cores on (for now
> mainly) ARM platforms. A number of those cores need board specific information
> to be used in a custom init()-call, which shall be passed via platform_data.
> The pointer will be used in the platform specific extensions.
Sounds good.
Regards,
Richard
>
>>>
>>> Signed-off-by: Wolfram Sang<w.sang@pengutronix.de>
>>> Cc: Richard R?jfors<richard.rojfors.ext@mocean-labs.com>
>>> ---
>>>
>>> Changes since last version:
>>>
>>> * added types.h
>>
>> I saw no types.h?
>
> In the second chunk, the include file.
>
> Thanks,
>
> Wolfram
>
>>
>>> * removed usage of pdev->dev.parent to ensure clk-matching
>>> Please speak up if this has a use case I failed to see!
>>>
>>> drivers/mmc/host/sdhci-pltfm.c | 8 ++++----
>>> drivers/mmc/host/sdhci-pltfm.h | 7 +++++++
>>> 2 files changed, 11 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
>>> index e045e3c..095ca9d 100644
>>> --- a/drivers/mmc/host/sdhci-pltfm.c
>>> +++ b/drivers/mmc/host/sdhci-pltfm.c
>>> @@ -55,6 +55,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
>>> struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
>>> const struct platform_device_id *platid = platform_get_device_id(pdev);
>>> struct sdhci_host *host;
>>> + struct sdhci_pltfm_host *pltfm_host;
>>> struct resource *iomem;
>>> int ret;
>>>
>>> @@ -71,16 +72,15 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
>>> dev_err(&pdev->dev, "Invalid iomem size. You may "
>>> "experience problems.\n");
>>>
>>> - if (pdev->dev.parent)
>>> - host = sdhci_alloc_host(pdev->dev.parent, 0);
>>> - else
>>> - host = sdhci_alloc_host(&pdev->dev, 0);
>>> + host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
>>>
>>> if (IS_ERR(host)) {
>>> ret = PTR_ERR(host);
>>> goto err;
>>> }
>>>
>>> + pltfm_host = sdhci_priv(host);
>>> +
>>> host->hw_name = "platform";
>>> if (pdata&& pdata->ops)
>>> host->ops = pdata->ops;
>>> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
>>> index 900f329..93a0319 100644
>>> --- a/drivers/mmc/host/sdhci-pltfm.h
>>> +++ b/drivers/mmc/host/sdhci-pltfm.h
>>> @@ -11,8 +11,15 @@
>>> #ifndef _DRIVERS_MMC_SDHCI_PLTFM_H
>>> #define _DRIVERS_MMC_SDHCI_PLTFM_H
>>>
>>> +#include<linux/clk.h>
>>> +#include<linux/types.h>
>>> #include<linux/sdhci-pltfm.h>
>>>
>>> +struct sdhci_pltfm_host {
>>> + struct clk *clk;
>>> + u32 scratchpad; /* to handle quirks across io-accessor calls */
>>> +};
>>> +
>>> extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
>>>
>>> #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data
2010-09-30 9:54 ` Richard Röjfors
@ 2010-09-30 10:19 ` Wolfram Sang
2010-09-30 11:09 ` Anton Vorontsov
0 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2010-09-30 10:19 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Sep 30, 2010 at 11:54:53AM +0200, Richard R?jfors wrote:
> On 09/30/2010 10:16 AM, Wolfram Sang wrote:
> >Hi Richard,
> >
> >On Wed, Sep 29, 2010 at 11:24:25PM +0200, Richard R?jfors wrote:
> >>On 09/29/2010 10:07 PM, Wolfram Sang wrote:
> >>>We need to carry some information per host, e.g. the clock. Add a
> >>>structure for it and initialize it in the generic part. Also do not use
> >>>the parent of the platform_device (if it is available), this breaks the
> >>>clock-matching on ARM.
> >>
> >>The reason it's there is for instance a case when the shdci device is exposed
> >>from a MFD device which sits on top of PCI. Then the parent (PCI device)
> >>is the device that is DMA capable. This patch will break such usage.
> >
> >I feared that there is a reason. The problem I see is now, that the parent gets
> >always set (from drivers/base/platform.c):
>
> Then we obviously need to pass more information in the platform_data to be able
> to chose which device to be used.
Yeah, that was my idea, too.
> >So, sdhci-plftm cannot access the platform_data connected to the original
> >platform_device via host->mmc->parent.
>
> You're right it wouldn't. But isn't it a bit risky even if you could access it,
> in the long the platform_data coild point to something that is in the __devinit section
> or similar?
The use-case we see now is in the custom init() call, i.e. setting up
GPIO, enabling clocks. That is in the same section. Accessing
platform_data later is in deed always risky and should not be done,
sdhci-pltfm is no special case here.
> What about extend the struct you defined with the pieces needed, and access it via
> sdhci_priv?
At the moment, I don't think this is needed. Will think more about it
(and the other comments) next week, already preparing for a long weekend
\o/
Thanks,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100930/d0f79250/attachment.sig>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data
2010-09-30 10:19 ` Wolfram Sang
@ 2010-09-30 11:09 ` Anton Vorontsov
0 siblings, 0 replies; 22+ messages in thread
From: Anton Vorontsov @ 2010-09-30 11:09 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Sep 30, 2010 at 12:19:38PM +0200, Wolfram Sang wrote:
[...]
> > You're right it wouldn't. But isn't it a bit risky even if you could access it,
> > in the long the platform_data coild point to something that is in the __devinit section
> > or similar?
>
> The use-case we see now is in the custom init() call, i.e. setting up
> GPIO, enabling clocks. That is in the same section. Accessing
> platform_data later is in deed always risky and should not be done,
> sdhci-pltfm is no special case here.
I don't think that it's always risky, it's more driver-specific.
Many drivers access it from everywhere, see drivers/mmc/host/mmc_spi.c
for example. In general, if the driver needs most of the platform data
in the run-time, it makes no sense to duplicate or copy the pdata into
the private struct field by field.
Thanks,
--
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 2/6] mmc: sdhci-pltfm: move .h-file into apropriate subdir
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
2010-09-29 20:07 ` [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data Wolfram Sang
@ 2010-09-29 20:08 ` Wolfram Sang
2010-09-29 20:08 ` [PATCH 3/6] mmc: sdhci: introduce private get_ro Wolfram Sang
` (8 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2010-09-29 20:08 UTC (permalink / raw)
To: linux-arm-kernel
Make use of the mmc-directory.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
drivers/mmc/host/sdhci-cns3xxx.c | 2 +-
drivers/mmc/host/sdhci-pltfm.c | 2 +-
drivers/mmc/host/sdhci-pltfm.h | 2 +-
include/linux/mmc/sdhci-pltfm.h | 35 +++++++++++++++++++++++++++++++++++
include/linux/sdhci-pltfm.h | 35 -----------------------------------
5 files changed, 38 insertions(+), 38 deletions(-)
create mode 100644 include/linux/mmc/sdhci-pltfm.h
delete mode 100644 include/linux/sdhci-pltfm.h
diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c
index b7050b3..9ebd1d7 100644
--- a/drivers/mmc/host/sdhci-cns3xxx.c
+++ b/drivers/mmc/host/sdhci-cns3xxx.c
@@ -15,7 +15,7 @@
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/mmc/host.h>
-#include <linux/sdhci-pltfm.h>
+#include <linux/mmc/sdhci-pltfm.h>
#include <mach/cns3xxx.h>
#include "sdhci.h"
#include "sdhci-pltfm.h"
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 095ca9d..e95b454 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -30,7 +30,7 @@
#include <linux/mmc/host.h>
#include <linux/io.h>
-#include <linux/sdhci-pltfm.h>
+#include <linux/mmc/sdhci-pltfm.h>
#include "sdhci.h"
#include "sdhci-pltfm.h"
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 93a0319..562b929 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -13,7 +13,7 @@
#include <linux/clk.h>
#include <linux/types.h>
-#include <linux/sdhci-pltfm.h>
+#include <linux/mmc/sdhci-pltfm.h>
struct sdhci_pltfm_host {
struct clk *clk;
diff --git a/include/linux/mmc/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h
new file mode 100644
index 0000000..0239bd7
--- /dev/null
+++ b/include/linux/mmc/sdhci-pltfm.h
@@ -0,0 +1,35 @@
+/*
+ * Platform data declarations for the sdhci-pltfm driver.
+ *
+ * Copyright (c) 2010 MontaVista Software, LLC.
+ *
+ * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+#ifndef _SDHCI_PLTFM_H
+#define _SDHCI_PLTFM_H
+
+struct sdhci_ops;
+struct sdhci_host;
+
+/**
+ * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks
+ * @ops: optional pointer to the platform-provided SDHCI ops
+ * @quirks: optional SDHCI quirks
+ * @init: optional hook that is called during device probe, before the
+ * driver tries to access any SDHCI registers
+ * @exit: optional hook that is called during device removal
+ */
+struct sdhci_pltfm_data {
+ struct sdhci_ops *ops;
+ unsigned int quirks;
+ int (*init)(struct sdhci_host *host);
+ void (*exit)(struct sdhci_host *host);
+};
+
+#endif /* _SDHCI_PLTFM_H */
diff --git a/include/linux/sdhci-pltfm.h b/include/linux/sdhci-pltfm.h
deleted file mode 100644
index 0239bd7..0000000
--- a/include/linux/sdhci-pltfm.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Platform data declarations for the sdhci-pltfm driver.
- *
- * Copyright (c) 2010 MontaVista Software, LLC.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- */
-
-#ifndef _SDHCI_PLTFM_H
-#define _SDHCI_PLTFM_H
-
-struct sdhci_ops;
-struct sdhci_host;
-
-/**
- * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks
- * @ops: optional pointer to the platform-provided SDHCI ops
- * @quirks: optional SDHCI quirks
- * @init: optional hook that is called during device probe, before the
- * driver tries to access any SDHCI registers
- * @exit: optional hook that is called during device removal
- */
-struct sdhci_pltfm_data {
- struct sdhci_ops *ops;
- unsigned int quirks;
- int (*init)(struct sdhci_host *host);
- void (*exit)(struct sdhci_host *host);
-};
-
-#endif /* _SDHCI_PLTFM_H */
--
1.7.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 3/6] mmc: sdhci: introduce private get_ro
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
2010-09-29 20:07 ` [PATCH 1/6] mmc: sdhci-pltfm: Add structure for host-specific data Wolfram Sang
2010-09-29 20:08 ` [PATCH 2/6] mmc: sdhci-pltfm: move .h-file into apropriate subdir Wolfram Sang
@ 2010-09-29 20:08 ` Wolfram Sang
2010-09-29 20:08 ` [PATCH 4/6] mmc: sdhci_pltfm: pass more data on custom init-call Wolfram Sang
` (7 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2010-09-29 20:08 UTC (permalink / raw)
To: linux-arm-kernel
Some controllers handle their write-protection differently. Introduce a
callback to be able to handle it, ensuring the same locking takes place
for it.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
drivers/mmc/host/sdhci.c | 11 +++++++----
drivers/mmc/host/sdhci.h | 1 +
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 96c7f60..129958e 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1229,14 +1229,17 @@ static int sdhci_get_ro(struct mmc_host *mmc)
if (host->flags & SDHCI_DEVICE_DEAD)
present = 0;
+ else if (host->ops->get_ro)
+ present = host->ops->get_ro(host);
else
- present = sdhci_readl(host, SDHCI_PRESENT_STATE);
+ present = !(sdhci_readl(host, SDHCI_PRESENT_STATE)
+ & SDHCI_WRITE_PROTECT);
spin_unlock_irqrestore(&host->lock, flags);
- if (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT)
- return !!(present & SDHCI_WRITE_PROTECT);
- return !(present & SDHCI_WRITE_PROTECT);
+ /* This quirk needs to be replaced by a callback-function later */
+ return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ?
+ !present : present;
}
static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 112543a..66f83f4 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -336,6 +336,7 @@ struct sdhci_ops {
unsigned int (*get_max_clock)(struct sdhci_host *host);
unsigned int (*get_min_clock)(struct sdhci_host *host);
unsigned int (*get_timeout_clock)(struct sdhci_host *host);
+ unsigned int (*get_ro)(struct sdhci_host *host);
};
#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--
1.7.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 4/6] mmc: sdhci_pltfm: pass more data on custom init-call
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
` (2 preceding siblings ...)
2010-09-29 20:08 ` [PATCH 3/6] mmc: sdhci: introduce private get_ro Wolfram Sang
@ 2010-09-29 20:08 ` Wolfram Sang
2010-09-30 8:31 ` Lothar Waßmann
2010-09-29 20:08 ` [PATCH 5/6] mmc: sdhci-of-esdhc: factor out common stuff Wolfram Sang
` (6 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2010-09-29 20:08 UTC (permalink / raw)
To: linux-arm-kernel
The custom init call may need more data to perform its job, so we pass
it a pointer to pdata, too. Also, always use the platform_id specific
data even if platform_data is present. Doing that, platform_data can
additionally be parsed by init() for board-specific information (via
sdhci->mmc->parent).
(Note: the old behaviour was that you could override the platform_id
specific data with your own. However, one can still do this by using the
"sdhci" id instead of "sdhci-<something>".)
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
Changes since last version:
* Removed priv_data-variable.
drivers/mmc/host/sdhci-pltfm.c | 8 +++++---
include/linux/mmc/sdhci-pltfm.h | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e95b454..5d963fe 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -52,15 +52,17 @@ static struct sdhci_ops sdhci_pltfm_ops = {
static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
{
- struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
const struct platform_device_id *platid = platform_get_device_id(pdev);
+ struct sdhci_pltfm_data *pdata;
struct sdhci_host *host;
struct sdhci_pltfm_host *pltfm_host;
struct resource *iomem;
int ret;
- if (!pdata && platid && platid->driver_data)
+ if (platid && platid->driver_data)
pdata = (void *)platid->driver_data;
+ else
+ pdata = pdev->dev.platform_data;
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!iomem) {
@@ -105,7 +107,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
}
if (pdata && pdata->init) {
- ret = pdata->init(host);
+ ret = pdata->init(host, pdata);
if (ret)
goto err_plat_init;
}
diff --git a/include/linux/mmc/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h
index 0239bd7..548d59d 100644
--- a/include/linux/mmc/sdhci-pltfm.h
+++ b/include/linux/mmc/sdhci-pltfm.h
@@ -28,7 +28,7 @@ struct sdhci_host;
struct sdhci_pltfm_data {
struct sdhci_ops *ops;
unsigned int quirks;
- int (*init)(struct sdhci_host *host);
+ int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata);
void (*exit)(struct sdhci_host *host);
};
--
1.7.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 4/6] mmc: sdhci_pltfm: pass more data on custom init-call
2010-09-29 20:08 ` [PATCH 4/6] mmc: sdhci_pltfm: pass more data on custom init-call Wolfram Sang
@ 2010-09-30 8:31 ` Lothar Waßmann
2010-09-30 9:42 ` Anton Vorontsov
0 siblings, 1 reply; 22+ messages in thread
From: Lothar Waßmann @ 2010-09-30 8:31 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Wolfram Sang writes:
> The custom init call may need more data to perform its job, so we pass
> it a pointer to pdata, too. Also, always use the platform_id specific
> data even if platform_data is present. Doing that, platform_data can
> additionally be parsed by init() for board-specific information (via
> sdhci->mmc->parent).
>
Why not a pointer to the platform_device itself? Then the callback
function would have even more information (e.g. platform_device ID)
and could easily get at the platform_data too.
Lothar Wa?mann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 4/6] mmc: sdhci_pltfm: pass more data on custom init-call
2010-09-30 8:31 ` Lothar Waßmann
@ 2010-09-30 9:42 ` Anton Vorontsov
2010-10-11 11:07 ` Wolfram Sang
0 siblings, 1 reply; 22+ messages in thread
From: Anton Vorontsov @ 2010-09-30 9:42 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Sep 30, 2010 at 10:31:58AM +0200, Lothar Wa?mann wrote:
> > The custom init call may need more data to perform its job, so we pass
> > it a pointer to pdata, too. Also, always use the platform_id specific
> > data even if platform_data is present. Doing that, platform_data can
> > additionally be parsed by init() for board-specific information (via
> > sdhci->mmc->parent).
> >
> Why not a pointer to the platform_device itself? Then the callback
> function would have even more information (e.g. platform_device ID)
> and could easily get at the platform_data too.
dev->platform_data may not be there. There are two ways to pass
the "platform data" to the sdhci-pltfm driver:
a) via dev->platform_data
b) via platform_device_id->driver_data
Technically, we can do something like this in the probe():
if (!pdev->dev.platform_data)
pdev->dev.platform_data = platform_device_id->driver_data;
pdata->init(dev);
Note, in this case we must also NULLify platform_data it at remove(),
as platform_device_release() will try to free statically allocated
memory.
Thanks,
--
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 4/6] mmc: sdhci_pltfm: pass more data on custom init-call
2010-09-30 9:42 ` Anton Vorontsov
@ 2010-10-11 11:07 ` Wolfram Sang
0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2010-10-11 11:07 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Sep 30, 2010 at 01:42:02PM +0400, Anton Vorontsov wrote:
> On Thu, Sep 30, 2010 at 10:31:58AM +0200, Lothar Wa?mann wrote:
> > > The custom init call may need more data to perform its job, so we pass
> > > it a pointer to pdata, too. Also, always use the platform_id specific
> > > data even if platform_data is present. Doing that, platform_data can
> > > additionally be parsed by init() for board-specific information (via
> > > sdhci->mmc->parent).
> > >
> > Why not a pointer to the platform_device itself? Then the callback
> > function would have even more information (e.g. platform_device ID)
> > and could easily get at the platform_data too.
>
> dev->platform_data may not be there. There are two ways to pass
> the "platform data" to the sdhci-pltfm driver:
>
> a) via dev->platform_data
> b) via platform_device_id->driver_data
or c) both :)
which is the reason for the current implementation.
platform_device_id->driver_data may still need additional information
from the board (e.g. a write protect pin from board pcm043) while the
larger part of the driver_data-extensions are still generic (e.g. to
imx-esdhc).
>
> Technically, we can do something like this in the probe():
>
> if (!pdev->dev.platform_data)
> pdev->dev.platform_data = platform_device_id->driver_data;
>
> pdata->init(dev);
>
> Note, in this case we must also NULLify platform_data it at remove(),
> as platform_device_release() will try to free statically allocated
> memory.
>
> Thanks,
>
> --
> Anton Vorontsov
> email: cbouatmailru at gmail.com
> irc://irc.freenode.net/bd2
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20101011/f3816841/attachment.sig>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 5/6] mmc: sdhci-of-esdhc: factor out common stuff
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
` (3 preceding siblings ...)
2010-09-29 20:08 ` [PATCH 4/6] mmc: sdhci_pltfm: pass more data on custom init-call Wolfram Sang
@ 2010-09-29 20:08 ` Wolfram Sang
2010-09-29 20:08 ` [PATCH 6/6] mmc: sdhci-pltfm: add pltfm-driver for imx35/51 Wolfram Sang
` (5 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2010-09-29 20:08 UTC (permalink / raw)
To: linux-arm-kernel
Put everything which can be shared between the OF and platform version
of this driver into a local .h-file.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
Changes since last version:
* use inline for set_clock()
drivers/mmc/host/sdhci-esdhc.h | 81 +++++++++++++++++++++++++++++++++++++
drivers/mmc/host/sdhci-of-esdhc.c | 70 ++++----------------------------
2 files changed, 89 insertions(+), 62 deletions(-)
create mode 100644 drivers/mmc/host/sdhci-esdhc.h
diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h
new file mode 100644
index 0000000..7ccc8cb
--- /dev/null
+++ b/drivers/mmc/host/sdhci-esdhc.h
@@ -0,0 +1,81 @@
+/*
+ * Freescale eSDHC controller driver generics for OF and pltfm.
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ * Copyright (c) 2009 MontaVista Software, Inc.
+ * Copyright (c) 2010 Pengutronix e.K.
+ * Author: Wolfram Sang <w.sang@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ */
+
+#ifndef _DRIVERS_MMC_SDHCI_ESDHC_H
+#define _DRIVERS_MMC_SDHCI_ESDHC_H
+
+/*
+ * Ops and quirks for the Freescale eSDHC controller.
+ */
+
+#define ESDHC_DEFAULT_QUIRKS (SDHCI_QUIRK_FORCE_BLK_SZ_2048 | \
+ SDHCI_QUIRK_BROKEN_CARD_DETECTION | \
+ SDHCI_QUIRK_NO_BUSY_IRQ | \
+ SDHCI_QUIRK_NONSTANDARD_CLOCK | \
+ SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | \
+ SDHCI_QUIRK_PIO_NEEDS_DELAY | \
+ SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET | \
+ SDHCI_QUIRK_NO_CARD_NO_RESET)
+
+#define ESDHC_SYSTEM_CONTROL 0x2c
+#define ESDHC_CLOCK_MASK 0x0000fff0
+#define ESDHC_PREDIV_SHIFT 8
+#define ESDHC_DIVIDER_SHIFT 4
+#define ESDHC_CLOCK_PEREN 0x00000004
+#define ESDHC_CLOCK_HCKEN 0x00000002
+#define ESDHC_CLOCK_IPGEN 0x00000001
+
+/* pltfm-specific */
+#define ESDHC_HOST_CONTROL_LE 0x20
+
+/* OF-specific */
+#define ESDHC_DMA_SYSCTL 0x40c
+#define ESDHC_DMA_SNOOP 0x00000040
+
+#define ESDHC_HOST_CONTROL_RES 0x05
+
+static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
+{
+ int pre_div = 2;
+ int div = 1;
+ u32 temp;
+
+ temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL);
+ temp &= ~(ESDHC_CLOCK_IPGEN | ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN | ESDHC_CLOCK_MASK);
+ sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
+
+ if (clock == 0)
+ goto out;
+
+ while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
+ pre_div *= 2;
+
+ while (host->max_clk / pre_div / div > clock && div < 16)
+ div++;
+
+ dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n",
+ clock, host->max_clk / pre_div / div);
+
+ pre_div >>= 1;
+ div--;
+
+ temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL);
+ temp |= (ESDHC_CLOCK_IPGEN | ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN |
+ (div << ESDHC_DIVIDER_SHIFT) | (pre_div << ESDHC_PREDIV_SHIFT));
+ sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
+ mdelay(100);
+out:
+ host->clock = clock;
+}
+
+#endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index c8623de..277fcb9 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -18,23 +18,7 @@
#include <linux/mmc/host.h>
#include "sdhci-of.h"
#include "sdhci.h"
-
-/*
- * Ops and quirks for the Freescale eSDHC controller.
- */
-
-#define ESDHC_DMA_SYSCTL 0x40c
-#define ESDHC_DMA_SNOOP 0x00000040
-
-#define ESDHC_SYSTEM_CONTROL 0x2c
-#define ESDHC_CLOCK_MASK 0x0000fff0
-#define ESDHC_PREDIV_SHIFT 8
-#define ESDHC_DIVIDER_SHIFT 4
-#define ESDHC_CLOCK_PEREN 0x00000004
-#define ESDHC_CLOCK_HCKEN 0x00000002
-#define ESDHC_CLOCK_IPGEN 0x00000001
-
-#define ESDHC_HOST_CONTROL_RES 0x05
+#include "sdhci-esdhc.c"
static u16 esdhc_readw(struct sdhci_host *host, int reg)
{
@@ -68,51 +52,20 @@ static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg)
sdhci_be32bs_writeb(host, val, reg);
}
-static void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
-{
- int pre_div = 2;
- int div = 1;
-
- clrbits32(host->ioaddr + ESDHC_SYSTEM_CONTROL, ESDHC_CLOCK_IPGEN |
- ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN | ESDHC_CLOCK_MASK);
-
- if (clock == 0)
- goto out;
-
- while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
- pre_div *= 2;
-
- while (host->max_clk / pre_div / div > clock && div < 16)
- div++;
-
- dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n",
- clock, host->max_clk / pre_div / div);
-
- pre_div >>= 1;
- div--;
-
- setbits32(host->ioaddr + ESDHC_SYSTEM_CONTROL, ESDHC_CLOCK_IPGEN |
- ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN |
- div << ESDHC_DIVIDER_SHIFT | pre_div << ESDHC_PREDIV_SHIFT);
- mdelay(100);
-out:
- host->clock = clock;
-}
-
-static int esdhc_enable_dma(struct sdhci_host *host)
+static int esdhc_of_enable_dma(struct sdhci_host *host)
{
setbits32(host->ioaddr + ESDHC_DMA_SYSCTL, ESDHC_DMA_SNOOP);
return 0;
}
-static unsigned int esdhc_get_max_clock(struct sdhci_host *host)
+static unsigned int esdhc_of_get_max_clock(struct sdhci_host *host)
{
struct sdhci_of_host *of_host = sdhci_priv(host);
return of_host->clock;
}
-static unsigned int esdhc_get_min_clock(struct sdhci_host *host)
+static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
{
struct sdhci_of_host *of_host = sdhci_priv(host);
@@ -120,14 +73,7 @@ static unsigned int esdhc_get_min_clock(struct sdhci_host *host)
}
struct sdhci_of_data sdhci_esdhc = {
- .quirks = SDHCI_QUIRK_FORCE_BLK_SZ_2048 |
- SDHCI_QUIRK_BROKEN_CARD_DETECTION |
- SDHCI_QUIRK_NO_BUSY_IRQ |
- SDHCI_QUIRK_NONSTANDARD_CLOCK |
- SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
- SDHCI_QUIRK_PIO_NEEDS_DELAY |
- SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET |
- SDHCI_QUIRK_NO_CARD_NO_RESET,
+ .quirks = ESDHC_DEFAULT_QUIRKS,
.ops = {
.read_l = sdhci_be32bs_readl,
.read_w = esdhc_readw,
@@ -136,8 +82,8 @@ struct sdhci_of_data sdhci_esdhc = {
.write_w = esdhc_writew,
.write_b = esdhc_writeb,
.set_clock = esdhc_set_clock,
- .enable_dma = esdhc_enable_dma,
- .get_max_clock = esdhc_get_max_clock,
- .get_min_clock = esdhc_get_min_clock,
+ .enable_dma = esdhc_of_enable_dma,
+ .get_max_clock = esdhc_of_get_max_clock,
+ .get_min_clock = esdhc_of_get_min_clock,
},
};
--
1.7.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 6/6] mmc: sdhci-pltfm: add pltfm-driver for imx35/51
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
` (4 preceding siblings ...)
2010-09-29 20:08 ` [PATCH 5/6] mmc: sdhci-of-esdhc: factor out common stuff Wolfram Sang
@ 2010-09-29 20:08 ` Wolfram Sang
2010-09-29 20:14 ` Chris Ball
2010-10-02 15:15 ` [PATCH 1/4] mach-cpuimx35: remove unecessary tsc2007 functions + style cleanup Eric Bénard
` (4 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2010-09-29 20:08 UTC (permalink / raw)
To: linux-arm-kernel
This driver adds basic support for the esdhc-core found on e.g.
imx35/51. It adds up to the pltfm-core.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
Changes since last version:
* some more -imx suffixes added
* reworked the clock-matching. Now matching the pdev
drivers/mmc/host/Kconfig | 10 +++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/sdhci-esdhc-imx.c | 143 ++++++++++++++++++++++++++++++++++++
drivers/mmc/host/sdhci-pltfm.c | 3 +
drivers/mmc/host/sdhci-pltfm.h | 1 +
5 files changed, 158 insertions(+), 0 deletions(-)
create mode 100644 drivers/mmc/host/sdhci-esdhc-imx.c
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 6f12d5d..3c8c286 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -143,6 +143,16 @@ config MMC_SDHCI_MV
If unsure, say N.
+config MMC_SDHCI_ESDHC_IMX
+ bool "SDHCI platform support for the Freescale eSDHC i.MX controller"
+ depends on MMC_SDHCI_PLTFM
+ select MMC_SDHCI_IO_ACCESSORS
+ help
+ This selects the Freescale eSDHC controller support on the platform
+ bus, found on platforms like mx35/51.
+
+ If unsure, say N.
+
config MMC_SDHCI_S3C
tristate "SDHCI support on Samsung S3C SoC"
depends on MMC_SDHCI && PLAT_SAMSUNG
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index ef32c32..5f283b5 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_MMC_USHC) += ushc.o
obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o
sdhci-platform-y := sdhci-pltfm.o
sdhci-platform-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o
+sdhci-platform-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o
obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o
sdhci-of-y := sdhci-of-core.o
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
new file mode 100644
index 0000000..68cf78c
--- /dev/null
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -0,0 +1,143 @@
+/*
+ * Freescale eSDHC i.MX controller driver for the platform bus.
+ *
+ * derived from the OF-version.
+ *
+ * Copyright (c) 2010 Pengutronix e.K.
+ * Author: Wolfram Sang <w.sang@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ */
+
+#include <linux/io.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/sdhci-pltfm.h>
+#include "sdhci.h"
+#include "sdhci-pltfm.h"
+#include "sdhci-esdhc.h"
+
+static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg)
+{
+ void __iomem *base = host->ioaddr + (reg & ~0x3);
+ u32 shift = (reg & 0x3) * 8;
+
+ writel(((readl(base) & ~(mask << shift)) | (val << shift)), base);
+}
+
+static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
+{
+ if (unlikely(reg == SDHCI_HOST_VERSION))
+ reg ^= 2;
+
+ return readw(host->ioaddr + reg);
+}
+
+static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+ switch (reg) {
+ case SDHCI_TRANSFER_MODE:
+ /*
+ * Postpone this write, we must do it together with a
+ * command write that is down below.
+ */
+ pltfm_host->scratchpad = val;
+ return;
+ case SDHCI_COMMAND:
+ writel(val << 16 | pltfm_host->scratchpad,
+ host->ioaddr + SDHCI_TRANSFER_MODE);
+ return;
+ case SDHCI_BLOCK_SIZE:
+ val &= ~SDHCI_MAKE_BLKSZ(0x7, 0);
+ break;
+ }
+ esdhc_clrset_le(host, 0xffff, val, reg);
+}
+
+static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
+{
+ u32 new_val;
+
+ switch (reg) {
+ case SDHCI_POWER_CONTROL:
+ /*
+ * FSL put some DMA bits here
+ * If your board has a regulator, code should be here
+ */
+ return;
+ case SDHCI_HOST_CONTROL:
+ /* FSL messed up here, so we can just keep those two */
+ new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
+ /* ensure the endianess */
+ new_val |= ESDHC_HOST_CONTROL_LE;
+ /* DMA mode bits are shifted */
+ new_val |= (val & SDHCI_CTRL_DMA_MASK) << 5;
+
+ esdhc_clrset_le(host, 0xffff, new_val, reg);
+ return;
+ }
+ esdhc_clrset_le(host, 0xff, val, reg);
+}
+
+static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+ return clk_get_rate(pltfm_host->clk);
+}
+
+static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+ return clk_get_rate(pltfm_host->clk) / 256 / 16;
+}
+
+static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pdata)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct clk *clk;
+
+ clk = clk_get(mmc_dev(host->mmc), NULL);
+ if (IS_ERR(clk)) {
+ dev_err(mmc_dev(host->mmc), "clk err\n");
+ return -ENODEV;
+ }
+ clk_enable(clk);
+ pltfm_host->clk = clk;
+
+ return 0;
+}
+
+static void esdhc_pltfm_exit(struct sdhci_host *host)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+ clk_disable(pltfm_host->clk);
+ clk_put(pltfm_host->clk);
+}
+
+static struct sdhci_ops sdhci_esdhc_ops = {
+ .read_w = esdhc_readw_le,
+ .write_w = esdhc_writew_le,
+ .write_b = esdhc_writeb_le,
+ .set_clock = esdhc_set_clock,
+ .get_max_clock = esdhc_pltfm_get_max_clock,
+ .get_min_clock = esdhc_pltfm_get_min_clock,
+};
+
+struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
+ .quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_NO_MULTIBLOCK
+ | SDHCI_QUIRK_BROKEN_ADMA,
+ /* ADMA has issues. Might be fixable */
+ /* NO_MULTIBLOCK might be MX35 only (Errata: ENGcm07207) */
+ .ops = &sdhci_esdhc_ops,
+ .init = esdhc_pltfm_init,
+ .exit = esdhc_pltfm_exit,
+};
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 2b315e9..9ef7050 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -164,6 +164,9 @@ static const struct platform_device_id sdhci_pltfm_ids[] = {
#ifdef CONFIG_MMC_SDHCI_CNS3XXX
{ "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_pdata },
#endif
+#ifdef CONFIG_MMC_SDHCI_ESDHC_IMX
+ { "sdhci-esdhc-imx", (kernel_ulong_t)&sdhci_esdhc_imx_pdata },
+#endif
{ },
};
MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids);
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 562b929..c1bfe48 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -21,5 +21,6 @@ struct sdhci_pltfm_host {
};
extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
+extern struct sdhci_pltfm_data sdhci_esdhc_imx_pdata;
#endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */
--
1.7.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 6/6] mmc: sdhci-pltfm: add pltfm-driver for imx35/51
2010-09-29 20:08 ` [PATCH 6/6] mmc: sdhci-pltfm: add pltfm-driver for imx35/51 Wolfram Sang
@ 2010-09-29 20:14 ` Chris Ball
0 siblings, 0 replies; 22+ messages in thread
From: Chris Ball @ 2010-09-29 20:14 UTC (permalink / raw)
To: linux-arm-kernel
Hi Wolfram,
On Wed, Sep 29, 2010 at 10:08:04PM +0200, Wolfram Sang wrote:
> This driver adds basic support for the esdhc-core found on e.g.
> imx35/51. It adds up to the pltfm-core.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
> ---
>
> Changes since last version:
>
> * some more -imx suffixes added
> * reworked the clock-matching. Now matching the pdev
>
> drivers/mmc/host/Kconfig | 10 +++
> drivers/mmc/host/Makefile | 1 +
> drivers/mmc/host/sdhci-esdhc-imx.c | 143 ++++++++++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci-pltfm.c | 3 +
> drivers/mmc/host/sdhci-pltfm.h | 1 +
> 5 files changed, 158 insertions(+), 0 deletions(-)
> create mode 100644 drivers/mmc/host/sdhci-esdhc-imx.c
>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 6f12d5d..3c8c286 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -143,6 +143,16 @@ config MMC_SDHCI_MV
>
> If unsure, say N.
>
> +config MMC_SDHCI_ESDHC_IMX
> + bool "SDHCI platform support for the Freescale eSDHC i.MX controller"
> + depends on MMC_SDHCI_PLTFM
> + select MMC_SDHCI_IO_ACCESSORS
> + help
> + This selects the Freescale eSDHC controller support on the platform
> + bus, found on platforms like mx35/51.
> +
> + If unsure, say N.
> +
> config MMC_SDHCI_S3C
> tristate "SDHCI support on Samsung S3C SoC"
> depends on MMC_SDHCI && PLAT_SAMSUNG
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index ef32c32..5f283b5 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -38,6 +38,7 @@ obj-$(CONFIG_MMC_USHC) += ushc.o
> obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o
> sdhci-platform-y := sdhci-pltfm.o
> sdhci-platform-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o
> +sdhci-platform-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o
>
> obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o
> sdhci-of-y := sdhci-of-core.o
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> new file mode 100644
> index 0000000..68cf78c
> --- /dev/null
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -0,0 +1,143 @@
> +/*
> + * Freescale eSDHC i.MX controller driver for the platform bus.
> + *
> + * derived from the OF-version.
> + *
> + * Copyright (c) 2010 Pengutronix e.K.
> + * Author: Wolfram Sang <w.sang@pengutronix.de>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License.
> + */
> +
> +#include <linux/io.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/clk.h>
> +#include <linux/mmc/host.h>
> +#include <linux/mmc/sdhci-pltfm.h>
> +#include "sdhci.h"
> +#include "sdhci-pltfm.h"
> +#include "sdhci-esdhc.h"
> +
> +static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg)
> +{
> + void __iomem *base = host->ioaddr + (reg & ~0x3);
> + u32 shift = (reg & 0x3) * 8;
> +
> + writel(((readl(base) & ~(mask << shift)) | (val << shift)), base);
> +}
> +
> +static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
> +{
> + if (unlikely(reg == SDHCI_HOST_VERSION))
> + reg ^= 2;
> +
> + return readw(host->ioaddr + reg);
> +}
> +
> +static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
> +{
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +
> + switch (reg) {
> + case SDHCI_TRANSFER_MODE:
> + /*
> + * Postpone this write, we must do it together with a
> + * command write that is down below.
> + */
> + pltfm_host->scratchpad = val;
> + return;
> + case SDHCI_COMMAND:
> + writel(val << 16 | pltfm_host->scratchpad,
> + host->ioaddr + SDHCI_TRANSFER_MODE);
> + return;
> + case SDHCI_BLOCK_SIZE:
> + val &= ~SDHCI_MAKE_BLKSZ(0x7, 0);
> + break;
> + }
> + esdhc_clrset_le(host, 0xffff, val, reg);
> +}
> +
> +static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
> +{
> + u32 new_val;
> +
> + switch (reg) {
> + case SDHCI_POWER_CONTROL:
> + /*
> + * FSL put some DMA bits here
> + * If your board has a regulator, code should be here
> + */
> + return;
> + case SDHCI_HOST_CONTROL:
> + /* FSL messed up here, so we can just keep those two */
> + new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS);
> + /* ensure the endianess */
> + new_val |= ESDHC_HOST_CONTROL_LE;
> + /* DMA mode bits are shifted */
> + new_val |= (val & SDHCI_CTRL_DMA_MASK) << 5;
> +
> + esdhc_clrset_le(host, 0xffff, new_val, reg);
> + return;
> + }
> + esdhc_clrset_le(host, 0xff, val, reg);
> +}
> +
> +static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host)
> +{
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +
> + return clk_get_rate(pltfm_host->clk);
> +}
> +
> +static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host)
> +{
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +
> + return clk_get_rate(pltfm_host->clk) / 256 / 16;
> +}
> +
> +static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pdata)
> +{
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + struct clk *clk;
> +
> + clk = clk_get(mmc_dev(host->mmc), NULL);
> + if (IS_ERR(clk)) {
> + dev_err(mmc_dev(host->mmc), "clk err\n");
> + return -ENODEV;
> + }
Is there a reason to return -ENODEV instead of PTR_ERR(clk)?
Patchset is looking good, thanks very much for keeping work going
on -pltfm,
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/4] mach-cpuimx35: remove unecessary tsc2007 functions + style cleanup
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
` (5 preceding siblings ...)
2010-09-29 20:08 ` [PATCH 6/6] mmc: sdhci-pltfm: add pltfm-driver for imx35/51 Wolfram Sang
@ 2010-10-02 15:15 ` Eric Bénard
2010-10-02 15:15 ` [PATCH 2/4] eukrea_mbimxsd for cpuimx35: add CAN & SDCard support Eric Bénard
` (3 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Eric Bénard @ 2010-10-02 15:15 UTC (permalink / raw)
To: linux-arm-kernel
- remove functions which are no more necessary for tsc2007
- indent platform_data for better readability
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
arch/arm/mach-mx3/mach-cpuimx35.c | 32 +++++---------------------------
1 files changed, 5 insertions(+), 27 deletions(-)
diff --git a/arch/arm/mach-mx3/mach-cpuimx35.c b/arch/arm/mach-mx3/mach-cpuimx35.c
index 2a4f8b7..ea0a85f 100644
--- a/arch/arm/mach-mx3/mach-cpuimx35.c
+++ b/arch/arm/mach-mx3/mach-cpuimx35.c
@@ -31,6 +31,7 @@
#include <linux/usb/otg.h>
#include <linux/usb/ulpi.h>
#include <linux/fsl_devices.h>
+#include <linux/i2c-gpio.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -53,39 +54,16 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
};
static const struct imxi2c_platform_data
-eukrea_cpuimx35_i2c0_data __initconst = {
- .bitrate = 50000,
+ eukrea_cpuimx35_i2c0_data __initconst = {
+ .bitrate = 100000,
};
-#define TSC2007_IRQGPIO (2 * 32 + 2)
-static int ts_get_pendown_state(void)
-{
- int val = 0;
- gpio_free(TSC2007_IRQGPIO);
- gpio_request(TSC2007_IRQGPIO, NULL);
- gpio_direction_input(TSC2007_IRQGPIO);
-
- val = gpio_get_value(TSC2007_IRQGPIO);
-
- gpio_free(TSC2007_IRQGPIO);
- gpio_request(TSC2007_IRQGPIO, NULL);
-
- return val ? 0 : 1;
-}
-
-static int ts_init(void)
-{
- gpio_request(TSC2007_IRQGPIO, NULL);
- return 0;
-}
-
static struct tsc2007_platform_data tsc2007_info = {
.model = 2007,
.x_plate_ohms = 180,
- .get_pendown_state = ts_get_pendown_state,
- .init_platform_hw = ts_init,
};
+#define TSC2007_IRQGPIO (2 * 32 + 2)
static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
{
I2C_BOARD_INFO("pcf8563", 0x51),
@@ -135,7 +113,7 @@ static struct pad_desc eukrea_cpuimx35_pads[] = {
};
static const struct mxc_nand_platform_data
-eukrea_cpuimx35_nand_board_info __initconst = {
+ eukrea_cpuimx35_nand_board_info __initconst = {
.width = 1,
.hw_ecc = 1,
.flash_bbt = 1,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 2/4] eukrea_mbimxsd for cpuimx35: add CAN & SDCard support
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
` (6 preceding siblings ...)
2010-10-02 15:15 ` [PATCH 1/4] mach-cpuimx35: remove unecessary tsc2007 functions + style cleanup Eric Bénard
@ 2010-10-02 15:15 ` Eric Bénard
2010-10-08 13:43 ` imx-for-2.6.37 broken [Was: [PATCH 2/4] eukrea_mbimxsd for cpuimx35: add CAN & SDCard support] Uwe Kleine-König
2010-10-02 15:15 ` [PATCH 3/4] i.mx25: add esdhc support Eric Bénard
` (2 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Eric Bénard @ 2010-10-02 15:15 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
arch/arm/mach-mx3/Kconfig | 2 ++
arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c | 13 +++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 2f4d6cb..2c08dfd 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -160,6 +160,8 @@ config MACH_EUKREA_CPUIMX35
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_IMX_I2C
select IMX_HAVE_PLATFORM_MXC_NAND
+ select IMX_HAVE_PLATFORM_FLEXCAN
+ select IMX_HAVE_PLATFORM_ESDHC
select MXC_ULPI if USB_ULPI
help
Include support for Eukrea CPUIMX35 platform. This includes
diff --git a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
index f8f15e3..0d219bb 100644
--- a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
+++ b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
@@ -120,6 +120,16 @@ static struct pad_desc eukrea_mbimxsd_pads[] = {
MX35_PAD_STXD4__AUDMUX_AUD4_TXD,
MX35_PAD_SRXD4__AUDMUX_AUD4_RXD,
MX35_PAD_SCK4__AUDMUX_AUD4_TXC,
+ /* CAN2 */
+ MX35_PAD_TX5_RX0__CAN2_TXCAN,
+ MX35_PAD_TX4_RX1__CAN2_RXCAN,
+ /* SDCARD */
+ MX35_PAD_SD1_CMD__ESDHC1_CMD,
+ MX35_PAD_SD1_CLK__ESDHC1_CLK,
+ MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
+ MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
+ MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
+ MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
};
#define GPIO_LED1 (2 * 32 + 29)
@@ -244,6 +254,9 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
+ imx35_add_flexcan1(NULL);
+ imx35_add_esdhc0(NULL);
+
gpio_request(GPIO_LED1, "LED1");
gpio_direction_output(GPIO_LED1, 1);
gpio_free(GPIO_LED1);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 3/4] i.mx25: add esdhc support
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
` (7 preceding siblings ...)
2010-10-02 15:15 ` [PATCH 2/4] eukrea_mbimxsd for cpuimx35: add CAN & SDCard support Eric Bénard
@ 2010-10-02 15:15 ` Eric Bénard
2010-10-02 15:15 ` [PATCH 4/4] eukrea_mbimxsd for cpuimx25: add CAN & SDCard support Eric Bénard
2010-10-02 15:17 ` [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Eric Bénard
10 siblings, 0 replies; 22+ messages in thread
From: Eric Bénard @ 2010-10-02 15:15 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
arch/arm/mach-mx25/clock.c | 22 ++++++++++++++++++++++
arch/arm/mach-mx25/devices-imx25.h | 5 +++++
arch/arm/plat-mxc/include/mach/mx25.h | 4 ++++
3 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx25/clock.c b/arch/arm/mach-mx25/clock.c
index 40c7cc4..7a3d4e6 100644
--- a/arch/arm/mach-mx25/clock.c
+++ b/arch/arm/mach-mx25/clock.c
@@ -139,6 +139,16 @@ static unsigned long get_rate_lcdc(struct clk *clk)
return get_rate_per(7);
}
+static unsigned long get_rate_esdhc1(struct clk *clk)
+{
+ return get_rate_per(3);
+}
+
+static unsigned long get_rate_esdhc2(struct clk *clk)
+{
+ return get_rate_per(4);
+}
+
static unsigned long get_rate_csi(struct clk *clk)
{
return get_rate_per(0);
@@ -213,6 +223,12 @@ DEFINE_CLOCK(ssi2_per_clk, 0, CCM_CGCR0, 14, get_rate_ipg, NULL, NULL);
DEFINE_CLOCK(cspi1_clk, 0, CCM_CGCR1, 5, get_rate_ipg, NULL, NULL);
DEFINE_CLOCK(cspi2_clk, 0, CCM_CGCR1, 6, get_rate_ipg, NULL, NULL);
DEFINE_CLOCK(cspi3_clk, 0, CCM_CGCR1, 7, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(esdhc1_ahb_clk, 0, CCM_CGCR0, 21, get_rate_esdhc1, NULL, NULL);
+DEFINE_CLOCK(esdhc1_per_clk, 0, CCM_CGCR0, 3, get_rate_esdhc1, NULL,
+ &esdhc1_ahb_clk);
+DEFINE_CLOCK(esdhc2_ahb_clk, 0, CCM_CGCR0, 22, get_rate_esdhc2, NULL, NULL);
+DEFINE_CLOCK(esdhc2_per_clk, 0, CCM_CGCR0, 4, get_rate_esdhc2, NULL,
+ &esdhc2_ahb_clk);
DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL, NULL, NULL);
DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL, NULL, NULL);
DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0, 7, NULL, NULL, &lcdc_ahb_clk);
@@ -238,6 +254,10 @@ DEFINE_CLOCK(lcdc_clk, 0, CCM_CGCR1, 29, get_rate_lcdc, NULL, &lcdc_per_clk);
DEFINE_CLOCK(wdt_clk, 0, CCM_CGCR2, 19, get_rate_ipg, NULL, NULL);
DEFINE_CLOCK(ssi1_clk, 0, CCM_CGCR2, 11, get_rate_ssi1, NULL, &ssi1_per_clk);
DEFINE_CLOCK(ssi2_clk, 1, CCM_CGCR2, 12, get_rate_ssi2, NULL, &ssi2_per_clk);
+DEFINE_CLOCK(esdhc1_clk, 0, CCM_CGCR1, 13, get_rate_esdhc1, NULL,
+ &esdhc1_per_clk);
+DEFINE_CLOCK(esdhc2_clk, 1, CCM_CGCR1, 14, get_rate_esdhc2, NULL,
+ &esdhc2_per_clk);
DEFINE_CLOCK(audmux_clk, 0, CCM_CGCR1, 0, NULL, NULL, NULL);
DEFINE_CLOCK(csi_clk, 0, CCM_CGCR1, 4, get_rate_csi, NULL, &csi_per_clk);
DEFINE_CLOCK(can1_clk, 0, CCM_CGCR1, 2, get_rate_ipg, NULL, NULL);
@@ -279,6 +299,8 @@ static struct clk_lookup lookups[] = {
_REGISTER_CLOCK("imx-wdt.0", NULL, wdt_clk)
_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
+ _REGISTER_CLOCK(NULL, "sdhc", esdhc1_clk)
+ _REGISTER_CLOCK(NULL, "sdhc", esdhc2_clk)
_REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
_REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h
index d86a7c3..4acb0c9 100644
--- a/arch/arm/mach-mx25/devices-imx25.h
+++ b/arch/arm/mach-mx25/devices-imx25.h
@@ -41,3 +41,8 @@
imx_add_spi_imx(1, MX25_CSPI2_BASE_ADDR, SZ_16K, MX25_INT_CSPI2, pdata)
#define imx25_add_spi_imx2(pdata) \
imx_add_spi_imx(2, MX25_CSPI3_BASE_ADDR, SZ_16K, MX25_INT_CSPI3, pdata)
+
+#define imx25_add_esdhc0(pdata) \
+ imx_add_esdhc(0, MX25_ESDHC1_BASE_ADDR, SZ_16K, MX25_INT_MMC_SDHC1, pdata)
+#define imx25_add_esdhc1(pdata) \
+ imx_add_esdhc(1, MX25_ESDHC2_BASE_ADDR, SZ_16K, MX25_INT_MMC_SDHC2, pdata)
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h
index 4a6f800..67060e9 100644
--- a/arch/arm/plat-mxc/include/mach/mx25.h
+++ b/arch/arm/plat-mxc/include/mach/mx25.h
@@ -50,6 +50,8 @@
#define MX25_SSI1_BASE_ADDR 0x50034000
#define MX25_NFC_BASE_ADDR 0xbb000000
#define MX25_DRYICE_BASE_ADDR 0x53ffc000
+#define MX25_ESDHC1_BASE_ADDR 0x53fb4000
+#define MX25_ESDHC2_BASE_ADDR 0x53fb8000
#define MX25_LCDC_BASE_ADDR 0x53fbc000
#define MX25_KPP_BASE_ADDR 0x43fa8000
#define MX25_OTG_BASE_ADDR 0x53ff4000
@@ -59,6 +61,8 @@
#define MX25_INT_I2C1 3
#define MX25_INT_I2C2 4
#define MX25_INT_UART4 5
+#define MX25_INT_MMC_SDHC2 8
+#define MX25_INT_MMC_SDHC1 9
#define MX25_INT_I2C3 10
#define MX25_INT_SSI2 11
#define MX25_INT_SSI1 12
--
1.7.0.4
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 4/4] eukrea_mbimxsd for cpuimx25: add CAN & SDCard support
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
` (8 preceding siblings ...)
2010-10-02 15:15 ` [PATCH 3/4] i.mx25: add esdhc support Eric Bénard
@ 2010-10-02 15:15 ` Eric Bénard
2010-10-02 15:17 ` [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Eric Bénard
10 siblings, 0 replies; 22+ messages in thread
From: Eric Bénard @ 2010-10-02 15:15 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
arch/arm/mach-mx25/Kconfig | 2 ++
arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c | 5 +++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx25/Kconfig b/arch/arm/mach-mx25/Kconfig
index c71a7bc..60cc16e 100644
--- a/arch/arm/mach-mx25/Kconfig
+++ b/arch/arm/mach-mx25/Kconfig
@@ -12,6 +12,8 @@ config MACH_EUKREA_CPUIMX25
select IMX_HAVE_PLATFORM_IMX_I2C
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_MXC_NAND
+ select IMX_HAVE_PLATFORM_FLEXCAN
+ select IMX_HAVE_PLATFORM_ESDHC
select MXC_ULPI if USB_ULPI
choice
diff --git a/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
index 4aaadc7..f4c4c6f 100644
--- a/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
+++ b/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
@@ -90,6 +90,9 @@ static struct pad_desc eukrea_mbimxsd_pads[] = {
MX25_PAD_KPP_COL2__AUD5_TXC,
MX25_PAD_KPP_COL1__AUD5_RXD,
MX25_PAD_KPP_COL0__AUD5_TXD,
+ /* CAN */
+ MX25_PAD_GPIO_D__CAN2_RX,
+ MX25_PAD_GPIO_C__CAN2_TX,
};
#define GPIO_LED1 83
@@ -240,6 +243,8 @@ void __init eukrea_mbimxsd25_baseboard_init(void)
imx25_add_imx_uart1(&uart_pdata);
mxc_register_device(&mx25_fb_device, &eukrea_mximxsd_fb_pdata);
mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
+ imx25_add_flexcan1(NULL);
+ imx25_add_esdhc0(NULL);
gpio_request(GPIO_LED1, "LED1");
gpio_direction_output(GPIO_LED1, 1);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI)
2010-09-29 20:07 [PATCH V3 0/6] SD/MMC-driver for MX35/51 (and improvements to SDHCI) Wolfram Sang
` (9 preceding siblings ...)
2010-10-02 15:15 ` [PATCH 4/4] eukrea_mbimxsd for cpuimx25: add CAN & SDCard support Eric Bénard
@ 2010-10-02 15:17 ` Eric Bénard
10 siblings, 0 replies; 22+ messages in thread
From: Eric Bénard @ 2010-10-02 15:17 UTC (permalink / raw)
To: linux-arm-kernel
Le 29/09/2010 22:07, Wolfram Sang a ?crit :
> Okay, here is the next version of my patch series. The first four are
> updates/improvements for sdhci and sdhci-pltfm and are of generic interest,
> too. I am still hoping for some Acked-by/Tested-by tags ;) Changes from the
> previous version are mentioned in the seperate files. I should have addressed
> all concerns raised. If not, please speak up.
>
Tested-by : Eric B?nard <eric@eukrea.com>
Eric
^ permalink raw reply [flat|nested] 22+ messages in thread