* [PATCH v2 1/3] ARM: mmp: add pxa910 mmc resource
@ 2011-04-21 1:56 Jun Nie
2011-04-28 9:11 ` Russell King - ARM Linux
0 siblings, 1 reply; 5+ messages in thread
From: Jun Nie @ 2011-04-21 1:56 UTC (permalink / raw)
To: linux-arm-kernel
ARM: mmp: add pxa910 mmc resource
Add resource, devices, etc
Signed-off-by: Jun Nie <njun@marvell.com>
---
arch/arm/mach-mmp/include/mach/pxa910.h | 19 +++++++++++++++++++
arch/arm/mach-mmp/include/mach/regs-apmu.h | 1 +
arch/arm/mach-mmp/pxa910.c | 9 +++++++++
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h
b/arch/arm/mach-mmp/include/mach/pxa910.h
index 91be755..ac0aaa3 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -10,6 +10,7 @@ extern void __init pxa910_init_irq(void);
#include <linux/i2c/pxa-i2c.h>
#include <mach/devices.h>
#include <plat/pxa3xx_nand.h>
+#include <plat/sdhci.h>
extern struct pxa_device_desc pxa910_device_uart1;
extern struct pxa_device_desc pxa910_device_uart2;
@@ -20,6 +21,9 @@ extern struct pxa_device_desc pxa910_device_pwm2;
extern struct pxa_device_desc pxa910_device_pwm3;
extern struct pxa_device_desc pxa910_device_pwm4;
extern struct pxa_device_desc pxa910_device_nand;
+extern struct pxa_device_desc pxa910_device_sdh0;
+extern struct pxa_device_desc pxa910_device_sdh1;
+extern struct pxa_device_desc pxa910_device_sdh2;
static inline int pxa910_add_uart(int id)
{
@@ -76,4 +80,19 @@ static inline int pxa910_add_nand(struct
pxa3xx_nand_platform_data *info)
{
return pxa_register_device(&pxa910_device_nand, info, sizeof(*info));
}
+
+static inline int pxa910_add_sdhost(int id, struct sdhci_pxa_platdata *data)
+{
+ struct pxa_device_desc *d = NULL;
+
+ switch (id) {
+ case 0: d = &pxa910_device_sdh0; break;
+ case 1: d = &pxa910_device_sdh1; break;
+ case 2: d = &pxa910_device_sdh2; break;
+ default:
+ return -EINVAL;
+ }
+
+ return pxa_register_device(d, data, sizeof(*data));
+}
#endif /* __ASM_MACH_PXA910_H */
diff --git a/arch/arm/mach-mmp/include/mach/regs-apmu.h
b/arch/arm/mach-mmp/include/mach/regs-apmu.h
index f7011ef..a44ea49 100644
--- a/arch/arm/mach-mmp/include/mach/regs-apmu.h
+++ b/arch/arm/mach-mmp/include/mach/regs-apmu.h
@@ -28,6 +28,7 @@
#define APMU_GEU APMU_REG(0x068)
#define APMU_BUS APMU_REG(0x06c)
#define APMU_SDH2 APMU_REG(0x0e8)
+#define APMU_SDH2_PXA910 APMU_REG(0x0e0)
#define APMU_SDH3 APMU_REG(0x0ec)
#define APMU_FNCLK_EN (1 << 4)
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 8f92ccd..9432f15 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -112,6 +112,9 @@ static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
static APMU_CLK(nand, NAND, 0x01db, 208000000);
static APMU_CLK(u2o, USB, 0x1b, 480000000);
+static APMU_CLK(sdh0, SDH0, 0x001b, 48000000);
+static APMU_CLK(sdh1, SDH1, 0x001b, 48000000);
+static APMU_CLK(sdh2, SDH2_PXA910, 0x001b, 48000000);
/* device and clock bindings */
static struct clk_lookup pxa910_clkregs[] = {
@@ -125,6 +128,9 @@ static struct clk_lookup pxa910_clkregs[] = {
INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"),
+ INIT_CLKREG(&clk_sdh0, "sdhci-pxa.0", "PXA-SDHCLK"),
+ INIT_CLKREG(&clk_sdh1, "sdhci-pxa.1", "PXA-SDHCLK"),
+ INIT_CLKREG(&clk_sdh2, "sdhci-pxa.2", "PXA-SDHCLK"),
};
static int __init pxa910_init(void)
@@ -180,3 +186,6 @@ PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE,
0xd401a400, 0x10);
PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
PXA910_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99);
+PXA910_DEVICE(sdh0, "sdhci-pxa", 0, MMC, 0xd4280000, 0x120);
+PXA910_DEVICE(sdh1, "sdhci-pxa", 1, MMC, 0xd4280800, 0x120);
+PXA910_DEVICE(sdh2, "sdhci-pxa", 2, MMC, 0xd4281000, 0x120);
--
1.7.0.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ARM-mmp-add-pxa910-mmc-resource.patch
Type: text/x-diff
Size: 3908 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110421/43b99196/attachment-0001.bin>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] ARM: mmp: add pxa910 mmc resource
2011-04-21 1:56 [PATCH v2 1/3] ARM: mmp: add pxa910 mmc resource Jun Nie
@ 2011-04-28 9:11 ` Russell King - ARM Linux
2011-04-28 9:15 ` Eric Miao
0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2011-04-28 9:11 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 21, 2011 at 09:56:53AM +0800, Jun Nie wrote:
> +static inline int pxa910_add_sdhost(int id, struct sdhci_pxa_platdata *data)
> +{
> + struct pxa_device_desc *d = NULL;
> +
> + switch (id) {
> + case 0: d = &pxa910_device_sdh0; break;
> + case 1: d = &pxa910_device_sdh1; break;
> + case 2: d = &pxa910_device_sdh2; break;
> + default:
> + return -EINVAL;
> + }
> +
> + return pxa_register_device(d, data, sizeof(*data));
> +}
How about:
static inline int pxa910_add_sdhost(struct pxa_device_desc *dev,
struct sdhci_pxa_platdata *data)
{
return pxa_register_device(dev, data, sizeof(*data));
}
#define pxa910_add_sdhost0(data) pxa910_add_sdhost(&pxa910_device_sdh0, data)
#define pxa910_add_sdhost1(data) pxa910_add_sdhost(&pxa910_device_sdh1, data)
#define pxa910_add_sdhost2(data) pxa910_add_sdhost(&pxa910_device_sdh2, data)
instead - which seems more sane if you're going to call the function with
constant ID values.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] ARM: mmp: add pxa910 mmc resource
2011-04-28 9:11 ` Russell King - ARM Linux
@ 2011-04-28 9:15 ` Eric Miao
2011-04-29 2:13 ` Jun Nie
0 siblings, 1 reply; 5+ messages in thread
From: Eric Miao @ 2011-04-28 9:15 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 28, 2011 at 5:11 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Thu, Apr 21, 2011 at 09:56:53AM +0800, Jun Nie wrote:
>> +static inline int pxa910_add_sdhost(int id, struct sdhci_pxa_platdata *data)
>> +{
>> + ? ? struct pxa_device_desc *d = NULL;
>> +
>> + ? ? switch (id) {
>> + ? ? case 0: d = &pxa910_device_sdh0; break;
>> + ? ? case 1: d = &pxa910_device_sdh1; break;
>> + ? ? case 2: d = &pxa910_device_sdh2; break;
>> + ? ? default:
>> + ? ? ? ? ? ? return -EINVAL;
>> + ? ? }
>> +
>> + ? ? return pxa_register_device(d, data, sizeof(*data));
>> +}
>
> How about:
>
> static inline int pxa910_add_sdhost(struct pxa_device_desc *dev,
> ? ? ? ?struct sdhci_pxa_platdata *data)
> {
> ? ? ? ?return pxa_register_device(dev, data, sizeof(*data));
> }
>
> #define pxa910_add_sdhost0(data) pxa910_add_sdhost(&pxa910_device_sdh0, data)
> #define pxa910_add_sdhost1(data) pxa910_add_sdhost(&pxa910_device_sdh1, data)
> #define pxa910_add_sdhost2(data) pxa910_add_sdhost(&pxa910_device_sdh2, data)
>
> instead - which seems more sane if you're going to call the function with
> constant ID values.
>
Indeed. Better to revise the original code as well.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] ARM: mmp: add pxa910 mmc resource
2011-04-28 9:15 ` Eric Miao
@ 2011-04-29 2:13 ` Jun Nie
2011-04-29 2:21 ` Eric Miao
0 siblings, 1 reply; 5+ messages in thread
From: Jun Nie @ 2011-04-29 2:13 UTC (permalink / raw)
To: linux-arm-kernel
2011/4/28 Eric Miao <eric.y.miao@gmail.com>:
> On Thu, Apr 28, 2011 at 5:11 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> On Thu, Apr 21, 2011 at 09:56:53AM +0800, Jun Nie wrote:
>>> +static inline int pxa910_add_sdhost(int id, struct sdhci_pxa_platdata *data)
>>> +{
>>> + ? ? struct pxa_device_desc *d = NULL;
>>> +
>>> + ? ? switch (id) {
>>> + ? ? case 0: d = &pxa910_device_sdh0; break;
>>> + ? ? case 1: d = &pxa910_device_sdh1; break;
>>> + ? ? case 2: d = &pxa910_device_sdh2; break;
>>> + ? ? default:
>>> + ? ? ? ? ? ? return -EINVAL;
>>> + ? ? }
>>> +
>>> + ? ? return pxa_register_device(d, data, sizeof(*data));
>>> +}
>>
>> How about:
>>
>> static inline int pxa910_add_sdhost(struct pxa_device_desc *dev,
>> ? ? ? ?struct sdhci_pxa_platdata *data)
>> {
>> ? ? ? ?return pxa_register_device(dev, data, sizeof(*data));
>> }
>>
>> #define pxa910_add_sdhost0(data) pxa910_add_sdhost(&pxa910_device_sdh0, data)
>> #define pxa910_add_sdhost1(data) pxa910_add_sdhost(&pxa910_device_sdh1, data)
>> #define pxa910_add_sdhost2(data) pxa910_add_sdhost(&pxa910_device_sdh2, data)
>>
>> instead - which seems more sane if you're going to call the function with
>> constant ID values.
>>
>
> Indeed. Better to revise the original code as well.
>
I am thinking to move QUIRKs into this function for it is SOC
specific, not board specific. Another item I want to move is bus
timing adjustment register setting API, which is for clock fine tune
and have different address/detail definition for different PXAs.
Zhangfei is preparing driver code for timing register setting.
How do you think about below change?
@@ -110,6 +110,8 @@ static inline int pxa910_add_sdh(int id, struct
sdhci_pxa_platdata *data)
case 2: d = &pxa910_device_sdh2; break;
default:
return -EINVAL;
}
+ data->quirks = SDHCI_QUIRK_BROKEN_ADMA,
+ data->soc_set_timing = pxa910_sdh_specific_ctrl,
return pxa_register_device(d, data, sizeof(*data));
}
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index d616d09..fdd3457 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -1534,13 +1534,11 @@ static void mmc2_set_ops(struct sdhci_pxa *pxa)
/* MMC0 controller for SD-MMC */
static struct sdhci_pxa_platdata pxa910_sdh_platdata_mmc0 = {
- .quirks = SDHCI_QUIRK_BROKEN_ADMA,
.max_speed = 48000000,
- .soc_set_timing = pxa910_sdh_specific_ctrl,
};
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] ARM: mmp: add pxa910 mmc resource
2011-04-29 2:13 ` Jun Nie
@ 2011-04-29 2:21 ` Eric Miao
0 siblings, 0 replies; 5+ messages in thread
From: Eric Miao @ 2011-04-29 2:21 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 29, 2011 at 10:13 AM, Jun Nie <niej0001@gmail.com> wrote:
> 2011/4/28 Eric Miao <eric.y.miao@gmail.com>:
>> On Thu, Apr 28, 2011 at 5:11 PM, Russell King - ARM Linux
>> <linux@arm.linux.org.uk> wrote:
>>> On Thu, Apr 21, 2011 at 09:56:53AM +0800, Jun Nie wrote:
>>>> +static inline int pxa910_add_sdhost(int id, struct sdhci_pxa_platdata *data)
>>>> +{
>>>> + ? ? struct pxa_device_desc *d = NULL;
>>>> +
>>>> + ? ? switch (id) {
>>>> + ? ? case 0: d = &pxa910_device_sdh0; break;
>>>> + ? ? case 1: d = &pxa910_device_sdh1; break;
>>>> + ? ? case 2: d = &pxa910_device_sdh2; break;
>>>> + ? ? default:
>>>> + ? ? ? ? ? ? return -EINVAL;
>>>> + ? ? }
>>>> +
>>>> + ? ? return pxa_register_device(d, data, sizeof(*data));
>>>> +}
>>>
>>> How about:
>>>
>>> static inline int pxa910_add_sdhost(struct pxa_device_desc *dev,
>>> ? ? ? ?struct sdhci_pxa_platdata *data)
>>> {
>>> ? ? ? ?return pxa_register_device(dev, data, sizeof(*data));
>>> }
>>>
>>> #define pxa910_add_sdhost0(data) pxa910_add_sdhost(&pxa910_device_sdh0, data)
>>> #define pxa910_add_sdhost1(data) pxa910_add_sdhost(&pxa910_device_sdh1, data)
>>> #define pxa910_add_sdhost2(data) pxa910_add_sdhost(&pxa910_device_sdh2, data)
>>>
>>> instead - which seems more sane if you're going to call the function with
>>> constant ID values.
>>>
>>
>> Indeed. Better to revise the original code as well.
>>
>
> I am thinking to move QUIRKs into this function for it is SOC
> specific, not board specific. Another item I want to move is bus
> timing adjustment register setting API, which is for clock fine tune
> and have different address/detail definition for different PXAs.
> Zhangfei is preparing driver code for timing register setting.
> How do you think about below change?
>
Basically I'm good with the move. Yet we can still incorporate this change
into the function Russell suggested pxa910_add_sdh().
> @@ -110,6 +110,8 @@ static inline int pxa910_add_sdh(int id, struct
> sdhci_pxa_platdata *data)
> ? ? ? ? ? ? ? ?case 2: d = &pxa910_device_sdh2; break;
> ? ? ? ? ? ? ? ?default:
> ? ? ? ? ? ? ? ? ? ? ? ? ? return -EINVAL;
> ? ? ? ?}
>
> + ? ? ? data->quirks ? ?= SDHCI_QUIRK_BROKEN_ADMA,
> + ? ? ? data->soc_set_timing ? ? ? ? ? ?= pxa910_sdh_specific_ctrl,
> ? ? ? ?return pxa_register_device(d, data, sizeof(*data));
> ?}
>
> diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
> index d616d09..fdd3457 100644
> --- a/arch/arm/mach-mmp/ttc_dkb.c
> +++ b/arch/arm/mach-mmp/ttc_dkb.c
> @@ -1534,13 +1534,11 @@ static void mmc2_set_ops(struct sdhci_pxa *pxa)
>
> ?/* MMC0 controller for SD-MMC */
> ?static struct sdhci_pxa_platdata pxa910_sdh_platdata_mmc0 = {
> - ? ? ? .quirks ? ? ? ? ? ? ? ? = SDHCI_QUIRK_BROKEN_ADMA,
> ? ? ? ?.max_speed ? ? ? ? ? ? ?= 48000000,
> - ? ? ? .soc_set_timing ? ? ? ? = pxa910_sdh_specific_ctrl,
> ?};
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-04-29 2:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21 1:56 [PATCH v2 1/3] ARM: mmp: add pxa910 mmc resource Jun Nie
2011-04-28 9:11 ` Russell King - ARM Linux
2011-04-28 9:15 ` Eric Miao
2011-04-29 2:13 ` Jun Nie
2011-04-29 2:21 ` Eric Miao
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).