aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-07-12 16:43:51 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-12 16:43:51 -0400
commit37d7035da5b1f184c610b038b376c0c647d8d72b (patch)
treec38d4058ad3232f985d9ed4501a8a842a2a47028 /arch/arm/mach-pxa
parent0fc3ff31f1f0fa023bb61e9336a7aa3591f2dffe (diff)
parent54b238469bce3a1b5012b2f0ebf261cf1c53e664 (diff)
Merge branch 'pxa-devel' into pxa
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/Kconfig2
-rw-r--r--arch/arm/mach-pxa/clock.h24
-rw-r--r--arch/arm/mach-pxa/devices.c43
-rw-r--r--arch/arm/mach-pxa/devices.h2
-rw-r--r--arch/arm/mach-pxa/littleton.c61
-rw-r--r--arch/arm/mach-pxa/mainstone.c8
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c71
-rw-r--r--arch/arm/mach-pxa/pxa300.c19
-rw-r--r--arch/arm/mach-pxa/pxa320.c21
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c25
-rw-r--r--arch/arm/mach-pxa/ssp.c13
-rw-r--r--arch/arm/mach-pxa/zylonite.c94
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c46
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c6
14 files changed, 366 insertions, 69 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index fdea1e7dc349..3e28521b9ebc 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -184,7 +184,7 @@ config MACH_COLIBRI
184 select PXA27x 184 select PXA27x
185 185
186config MACH_ZYLONITE 186config MACH_ZYLONITE
187 bool "PXA3xx Development Platform" 187 bool "PXA3xx Development Platform (aka Zylonite)"
188 select PXA3xx 188 select PXA3xx
189 select HAVE_PWM 189 select HAVE_PWM
190 190
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 32d0c074b351..1ec8f9178aaf 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -61,4 +61,28 @@ extern const struct clkops clk_cken_ops;
61void clk_cken_enable(struct clk *clk); 61void clk_cken_enable(struct clk *clk);
62void clk_cken_disable(struct clk *clk); 62void clk_cken_disable(struct clk *clk);
63 63
64#ifdef CONFIG_PXA3xx
65#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \
66 { \
67 .name = _name, \
68 .dev = _dev, \
69 .ops = &clk_pxa3xx_cken_ops, \
70 .rate = _rate, \
71 .cken = CKEN_##_cken, \
72 .delay = _delay, \
73 }
74
75#define PXA3xx_CK(_name, _cken, _ops, _dev) \
76 { \
77 .name = _name, \
78 .dev = _dev, \
79 .ops = _ops, \
80 .cken = CKEN_##_cken, \
81 }
82
83extern const struct clkops clk_pxa3xx_cken_ops;
84extern void clk_pxa3xx_cken_enable(struct clk *);
85extern void clk_pxa3xx_cken_disable(struct clk *);
86#endif
87
64void clks_register(struct clk *clks, size_t num); 88void clks_register(struct clk *clks, size_t num);
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index abc161dd083a..84489dc51d81 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -16,6 +16,7 @@
16#include <asm/arch/pxa2xx_spi.h> 16#include <asm/arch/pxa2xx_spi.h>
17#include <asm/arch/camera.h> 17#include <asm/arch/camera.h>
18#include <asm/arch/audio.h> 18#include <asm/arch/audio.h>
19#include <asm/arch/pxa3xx_nand.h>
19 20
20#include "devices.h" 21#include "devices.h"
21#include "generic.h" 22#include "generic.h"
@@ -831,6 +832,48 @@ void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
831 pxa_register_device(&pxa3xx_device_mci3, info); 832 pxa_register_device(&pxa3xx_device_mci3, info);
832} 833}
833 834
835static struct resource pxa3xx_resources_nand[] = {
836 [0] = {
837 .start = 0x43100000,
838 .end = 0x43100053,
839 .flags = IORESOURCE_MEM,
840 },
841 [1] = {
842 .start = IRQ_NAND,
843 .end = IRQ_NAND,
844 .flags = IORESOURCE_IRQ,
845 },
846 [2] = {
847 /* DRCMR for Data DMA */
848 .start = 97,
849 .end = 97,
850 .flags = IORESOURCE_DMA,
851 },
852 [3] = {
853 /* DRCMR for Command DMA */
854 .start = 99,
855 .end = 99,
856 .flags = IORESOURCE_DMA,
857 },
858};
859
860static u64 pxa3xx_nand_dma_mask = DMA_BIT_MASK(32);
861
862struct platform_device pxa3xx_device_nand = {
863 .name = "pxa3xx-nand",
864 .id = -1,
865 .dev = {
866 .dma_mask = &pxa3xx_nand_dma_mask,
867 .coherent_dma_mask = DMA_BIT_MASK(32),
868 },
869 .num_resources = ARRAY_SIZE(pxa3xx_resources_nand),
870 .resource = pxa3xx_resources_nand,
871};
872
873void __init pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info)
874{
875 pxa_register_device(&pxa3xx_device_nand, info);
876}
834#endif /* CONFIG_PXA3xx */ 877#endif /* CONFIG_PXA3xx */
835 878
836/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1. 879/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index b852eb18daa5..887c738f5911 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -31,4 +31,6 @@ extern struct platform_device pxa25x_device_pwm1;
31extern struct platform_device pxa27x_device_pwm0; 31extern struct platform_device pxa27x_device_pwm0;
32extern struct platform_device pxa27x_device_pwm1; 32extern struct platform_device pxa27x_device_pwm1;
33 33
34extern struct platform_device pxa3xx_device_nand;
35
34void __init pxa_register_device(struct platform_device *dev, void *data); 36void __init pxa_register_device(struct platform_device *dev, void *data);
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index 530654474bb2..9a4f51d48758 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -38,6 +38,7 @@
38#include <asm/arch/pxafb.h> 38#include <asm/arch/pxafb.h>
39#include <asm/arch/ssp.h> 39#include <asm/arch/ssp.h>
40#include <asm/arch/pxa27x_keypad.h> 40#include <asm/arch/pxa27x_keypad.h>
41#include <asm/arch/pxa3xx_nand.h>
41#include <asm/arch/littleton.h> 42#include <asm/arch/littleton.h>
42 43
43#include "generic.h" 44#include "generic.h"
@@ -101,7 +102,7 @@ static struct resource smc91x_resources[] = {
101 [1] = { 102 [1] = {
102 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)), 103 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
103 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)), 104 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
104 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, 105 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
105 } 106 }
106}; 107};
107 108
@@ -112,7 +113,7 @@ static struct platform_device smc91x_device = {
112 .resource = smc91x_resources, 113 .resource = smc91x_resources,
113}; 114};
114 115
115#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULES) 116#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
116/* use bit 30, 31 as the indicator of command parameter number */ 117/* use bit 30, 31 as the indicator of command parameter number */
117#define CMD0(x) ((0x00000000) | ((x) << 9)) 118#define CMD0(x) ((0x00000000) | ((x) << 9))
118#define CMD1(x, x1) ((0x40000000) | ((x) << 9) | 0x100 | (x1)) 119#define CMD1(x, x1) ((0x40000000) | ((x) << 9) | 0x100 | (x1))
@@ -311,9 +312,9 @@ static void littleton_init_lcd(void)
311} 312}
312#else 313#else
313static inline void littleton_init_lcd(void) {}; 314static inline void littleton_init_lcd(void) {};
314#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULES */ 315#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
315 316
316#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) 317#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
317static unsigned int littleton_matrix_key_map[] = { 318static unsigned int littleton_matrix_key_map[] = {
318 /* KEY(row, col, key_code) */ 319 /* KEY(row, col, key_code) */
319 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3), 320 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
@@ -361,6 +362,57 @@ static void __init littleton_init_keypad(void)
361static inline void littleton_init_keypad(void) {} 362static inline void littleton_init_keypad(void) {}
362#endif 363#endif
363 364
365#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
366static struct mtd_partition littleton_nand_partitions[] = {
367 [0] = {
368 .name = "Bootloader",
369 .offset = 0,
370 .size = 0x060000,
371 .mask_flags = MTD_WRITEABLE, /* force read-only */
372 },
373 [1] = {
374 .name = "Kernel",
375 .offset = 0x060000,
376 .size = 0x200000,
377 .mask_flags = MTD_WRITEABLE, /* force read-only */
378 },
379 [2] = {
380 .name = "Filesystem",
381 .offset = 0x0260000,
382 .size = 0x3000000, /* 48M - rootfs */
383 },
384 [3] = {
385 .name = "MassStorage",
386 .offset = 0x3260000,
387 .size = 0x3d40000,
388 },
389 [4] = {
390 .name = "BBT",
391 .offset = 0x6FA0000,
392 .size = 0x80000,
393 .mask_flags = MTD_WRITEABLE, /* force read-only */
394 },
395 /* NOTE: we reserve some blocks at the end of the NAND flash for
396 * bad block management, and the max number of relocation blocks
397 * differs on different platforms. Please take care with it when
398 * defining the partition table.
399 */
400};
401
402static struct pxa3xx_nand_platform_data littleton_nand_info = {
403 .enable_arbiter = 1,
404 .parts = littleton_nand_partitions,
405 .nr_parts = ARRAY_SIZE(littleton_nand_partitions),
406};
407
408static void __init littleton_init_nand(void)
409{
410 pxa3xx_set_nand_info(&littleton_nand_info);
411}
412#else
413static inline void littleton_init_nand(void) {}
414#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
415
364static void __init littleton_init(void) 416static void __init littleton_init(void)
365{ 417{
366 /* initialize MFP configurations */ 418 /* initialize MFP configurations */
@@ -374,6 +426,7 @@ static void __init littleton_init(void)
374 426
375 littleton_init_lcd(); 427 littleton_init_lcd();
376 littleton_init_keypad(); 428 littleton_init_keypad();
429 littleton_init_nand();
377} 430}
378 431
379MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)") 432MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 8cd3f81558cb..14eac2287e3f 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -110,9 +110,9 @@ static unsigned long mainstone_pin_config[] = {
110 GPIO45_AC97_SYSCLK, 110 GPIO45_AC97_SYSCLK,
111 111
112 /* Keypad */ 112 /* Keypad */
113 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, 113 GPIO93_KP_DKIN_0,
114 GPIO94_KP_DKIN_1 | WAKEUP_ON_LEVEL_HIGH, 114 GPIO94_KP_DKIN_1,
115 GPIO95_KP_DKIN_2 | WAKEUP_ON_LEVEL_HIGH, 115 GPIO95_KP_DKIN_2,
116 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, 116 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
117 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, 117 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
118 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, 118 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
@@ -514,7 +514,7 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = {
514 .init = mainstone_ohci_init, 514 .init = mainstone_ohci_init,
515}; 515};
516 516
517#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) 517#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
518static unsigned int mainstone_matrix_keys[] = { 518static unsigned int mainstone_matrix_keys[] = {
519 KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C), 519 KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C),
520 KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F), 520 KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F),
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index d1cdb4ecb0b8..fd4545eab803 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -39,6 +39,28 @@ struct gpio_desc {
39 39
40static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1]; 40static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
41 41
42static int __mfp_config_lpm(unsigned gpio, unsigned long lpm)
43{
44 unsigned mask = GPIO_bit(gpio);
45
46 /* low power state */
47 switch (lpm) {
48 case MFP_LPM_DRIVE_HIGH:
49 PGSR(gpio) |= mask;
50 break;
51 case MFP_LPM_DRIVE_LOW:
52 PGSR(gpio) &= ~mask;
53 break;
54 case MFP_LPM_INPUT:
55 break;
56 default:
57 pr_warning("%s: invalid low power state for GPIO%d\n",
58 __func__, gpio);
59 return -EINVAL;
60 }
61 return 0;
62}
63
42static int __mfp_config_gpio(unsigned gpio, unsigned long c) 64static int __mfp_config_gpio(unsigned gpio, unsigned long c)
43{ 65{
44 unsigned long gafr, mask = GPIO_bit(gpio); 66 unsigned long gafr, mask = GPIO_bit(gpio);
@@ -57,21 +79,8 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
57 else 79 else
58 GPDR(gpio) &= ~mask; 80 GPDR(gpio) &= ~mask;
59 81
60 /* low power state */ 82 if (__mfp_config_lpm(gpio, c & MFP_LPM_STATE_MASK))
61 switch (c & MFP_LPM_STATE_MASK) {
62 case MFP_LPM_DRIVE_HIGH:
63 PGSR(gpio) |= mask;
64 break;
65 case MFP_LPM_DRIVE_LOW:
66 PGSR(gpio) &= ~mask;
67 break;
68 case MFP_LPM_INPUT:
69 break;
70 default:
71 pr_warning("%s: invalid low power state for GPIO%d\n",
72 __func__, gpio);
73 return -EINVAL; 83 return -EINVAL;
74 }
75 84
76 /* give early warning if MFP_LPM_CAN_WAKEUP is set on the 85 /* give early warning if MFP_LPM_CAN_WAKEUP is set on the
77 * configurations of those pins not able to wakeup 86 * configurations of those pins not able to wakeup
@@ -91,6 +100,18 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
91 return 0; 100 return 0;
92} 101}
93 102
103static inline int __mfp_validate(int mfp)
104{
105 int gpio = mfp_to_gpio(mfp);
106
107 if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
108 pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio);
109 return -1;
110 }
111
112 return gpio;
113}
114
94void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num) 115void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
95{ 116{
96 unsigned long flags; 117 unsigned long flags;
@@ -99,13 +120,9 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
99 120
100 for (i = 0, c = mfp_cfgs; i < num; i++, c++) { 121 for (i = 0, c = mfp_cfgs; i < num; i++, c++) {
101 122
102 gpio = mfp_to_gpio(MFP_PIN(*c)); 123 gpio = __mfp_validate(MFP_PIN(*c));
103 124 if (gpio < 0)
104 if (!gpio_desc[gpio].valid) {
105 pr_warning("%s: GPIO%d is invalid pin\n",
106 __func__, gpio);
107 continue; 125 continue;
108 }
109 126
110 local_irq_save(flags); 127 local_irq_save(flags);
111 128
@@ -116,6 +133,20 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
116 } 133 }
117} 134}
118 135
136void pxa2xx_mfp_set_lpm(int mfp, unsigned long lpm)
137{
138 unsigned long flags;
139 int gpio;
140
141 gpio = __mfp_validate(mfp);
142 if (gpio < 0)
143 return;
144
145 local_irq_save(flags);
146 __mfp_config_lpm(gpio, lpm);
147 local_irq_restore(flags);
148}
149
119int gpio_set_wake(unsigned int gpio, unsigned int on) 150int gpio_set_wake(unsigned int gpio, unsigned int on)
120{ 151{
121 struct gpio_desc *d; 152 struct gpio_desc *d;
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index 0a0d3877f212..da92e9733886 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -15,10 +15,16 @@
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/platform_device.h>
18 19
19#include <asm/hardware.h> 20#include <asm/hardware.h>
21#include <asm/arch/pxa3xx-regs.h>
20#include <asm/arch/mfp-pxa300.h> 22#include <asm/arch/mfp-pxa300.h>
21 23
24#include "generic.h"
25#include "devices.h"
26#include "clock.h"
27
22static struct pxa3xx_mfp_addr_map pxa300_mfp_addr_map[] __initdata = { 28static struct pxa3xx_mfp_addr_map pxa300_mfp_addr_map[] __initdata = {
23 29
24 MFP_ADDR_X(GPIO0, GPIO2, 0x00b4), 30 MFP_ADDR_X(GPIO0, GPIO2, 0x00b4),
@@ -79,15 +85,26 @@ static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = {
79 MFP_ADDR_END, 85 MFP_ADDR_END,
80}; 86};
81 87
88static struct clk common_clks[] = {
89 PXA3xx_CKEN("NANDCLK", NAND, 156000000, 0, &pxa3xx_device_nand.dev),
90};
91
92static struct clk pxa310_clks[] = {
93 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev),
94};
95
82static int __init pxa300_init(void) 96static int __init pxa300_init(void)
83{ 97{
84 if (cpu_is_pxa300() || cpu_is_pxa310()) { 98 if (cpu_is_pxa300() || cpu_is_pxa310()) {
85 pxa3xx_init_mfp(); 99 pxa3xx_init_mfp();
86 pxa3xx_mfp_init_addr(pxa300_mfp_addr_map); 100 pxa3xx_mfp_init_addr(pxa300_mfp_addr_map);
101 clks_register(ARRAY_AND_SIZE(common_clks));
87 } 102 }
88 103
89 if (cpu_is_pxa310()) 104 if (cpu_is_pxa310()) {
90 pxa3xx_mfp_init_addr(pxa310_mfp_addr_map); 105 pxa3xx_mfp_init_addr(pxa310_mfp_addr_map);
106 clks_register(ARRAY_AND_SIZE(pxa310_clks));
107 }
91 108
92 return 0; 109 return 0;
93} 110}
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 74128eb8f8d0..c557c23a1efe 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -15,11 +15,17 @@
15 15
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/platform_device.h>
18 19
19#include <asm/hardware.h> 20#include <asm/hardware.h>
20#include <asm/arch/mfp.h> 21#include <asm/arch/mfp.h>
22#include <asm/arch/pxa3xx-regs.h>
21#include <asm/arch/mfp-pxa320.h> 23#include <asm/arch/mfp-pxa320.h>
22 24
25#include "generic.h"
26#include "devices.h"
27#include "clock.h"
28
23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = { 29static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
24 30
25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124), 31 MFP_ADDR_X(GPIO0, GPIO4, 0x0124),
@@ -74,16 +80,17 @@ static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
74 MFP_ADDR_END, 80 MFP_ADDR_END,
75}; 81};
76 82
77static void __init pxa320_init_mfp(void) 83static struct clk pxa320_clks[] = {
78{ 84 PXA3xx_CKEN("NANDCLK", NAND, 104000000, 0, &pxa3xx_device_nand.dev),
79 pxa3xx_init_mfp(); 85};
80 pxa3xx_mfp_init_addr(pxa320_mfp_addr_map);
81}
82 86
83static int __init pxa320_init(void) 87static int __init pxa320_init(void)
84{ 88{
85 if (cpu_is_pxa320()) 89 if (cpu_is_pxa320()) {
86 pxa320_init_mfp(); 90 pxa3xx_init_mfp();
91 pxa3xx_mfp_init_addr(pxa320_mfp_addr_map);
92 clks_register(ARRAY_AND_SIZE(pxa320_clks));
93 }
87 94
88 return 0; 95 return 0;
89} 96}
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 15685d2b8f8c..f491025a0c82 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -144,7 +144,7 @@ static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk)
144 return hsio_clk; 144 return hsio_clk;
145} 145}
146 146
147static void clk_pxa3xx_cken_enable(struct clk *clk) 147void clk_pxa3xx_cken_enable(struct clk *clk)
148{ 148{
149 unsigned long mask = 1ul << (clk->cken & 0x1f); 149 unsigned long mask = 1ul << (clk->cken & 0x1f);
150 150
@@ -154,7 +154,7 @@ static void clk_pxa3xx_cken_enable(struct clk *clk)
154 CKENB |= mask; 154 CKENB |= mask;
155} 155}
156 156
157static void clk_pxa3xx_cken_disable(struct clk *clk) 157void clk_pxa3xx_cken_disable(struct clk *clk)
158{ 158{
159 unsigned long mask = 1ul << (clk->cken & 0x1f); 159 unsigned long mask = 1ul << (clk->cken & 0x1f);
160 160
@@ -164,7 +164,7 @@ static void clk_pxa3xx_cken_disable(struct clk *clk)
164 CKENB &= ~mask; 164 CKENB &= ~mask;
165} 165}
166 166
167static const struct clkops clk_pxa3xx_cken_ops = { 167const struct clkops clk_pxa3xx_cken_ops = {
168 .enable = clk_pxa3xx_cken_enable, 168 .enable = clk_pxa3xx_cken_enable,
169 .disable = clk_pxa3xx_cken_disable, 169 .disable = clk_pxa3xx_cken_disable,
170}; 170};
@@ -196,24 +196,6 @@ static const struct clkops clk_pout_ops = {
196 .disable = clk_pout_disable, 196 .disable = clk_pout_disable,
197}; 197};
198 198
199#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \
200 { \
201 .name = _name, \
202 .dev = _dev, \
203 .ops = &clk_pxa3xx_cken_ops, \
204 .rate = _rate, \
205 .cken = CKEN_##_cken, \
206 .delay = _delay, \
207 }
208
209#define PXA3xx_CK(_name, _cken, _ops, _dev) \
210 { \
211 .name = _name, \
212 .dev = _dev, \
213 .ops = _ops, \
214 .cken = CKEN_##_cken, \
215 }
216
217static struct clk pxa3xx_clks[] = { 199static struct clk pxa3xx_clks[] = {
218 { 200 {
219 .name = "CLK_POUT", 201 .name = "CLK_POUT",
@@ -244,7 +226,6 @@ static struct clk pxa3xx_clks[] = {
244 226
245 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev), 227 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev),
246 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev), 228 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev),
247 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev),
248}; 229};
249 230
250#ifdef CONFIG_PM 231#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 0bb31982fb6f..89f38683787e 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -14,13 +14,6 @@
14 * IO-based SSP applications and allows easy port setup for DMA access. 14 * IO-based SSP applications and allows easy port setup for DMA access.
15 * 15 *
16 * Author: Liam Girdwood <liam.girdwood@wolfsonmicro.com> 16 * Author: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
17 *
18 * Revision history:
19 * 22nd Aug 2003 Initial version.
20 * 20th Dec 2004 Added ssp_config for changing port config without
21 * closing the port.
22 * 4th Aug 2005 Added option to disable irq handler registration and
23 * cleaned up irq and clock detection.
24 */ 17 */
25 18
26#include <linux/module.h> 19#include <linux/module.h>
@@ -285,7 +278,7 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags)
285 goto out_region; 278 goto out_region;
286 dev->irq = ssp->irq; 279 dev->irq = ssp->irq;
287 } else 280 } else
288 dev->irq = 0; 281 dev->irq = NO_IRQ;
289 282
290 /* turn on SSP port clock */ 283 /* turn on SSP port clock */
291 clk_enable(ssp->clk); 284 clk_enable(ssp->clk);
@@ -306,7 +299,8 @@ void ssp_exit(struct ssp_dev *dev)
306 struct ssp_device *ssp = dev->ssp; 299 struct ssp_device *ssp = dev->ssp;
307 300
308 ssp_disable(dev); 301 ssp_disable(dev);
309 free_irq(dev->irq, dev); 302 if (dev->irq != NO_IRQ)
303 free_irq(dev->irq, dev);
310 clk_disable(ssp->clk); 304 clk_disable(ssp->clk);
311 ssp_free(ssp); 305 ssp_free(ssp);
312} 306}
@@ -360,6 +354,7 @@ static int __devinit ssp_probe(struct platform_device *pdev, int type)
360 dev_err(&pdev->dev, "failed to allocate memory"); 354 dev_err(&pdev->dev, "failed to allocate memory");
361 return -ENOMEM; 355 return -ENOMEM;
362 } 356 }
357 ssp->pdev = pdev;
363 358
364 ssp->clk = clk_get(&pdev->dev, "SSPCLK"); 359 ssp->clk = clk_get(&pdev->dev, "SSPCLK");
365 if (IS_ERR(ssp->clk)) { 360 if (IS_ERR(ssp->clk)) {
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 66b446ca273d..4a4711d36e73 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -29,6 +29,7 @@
29#include <asm/arch/zylonite.h> 29#include <asm/arch/zylonite.h>
30#include <asm/arch/mmc.h> 30#include <asm/arch/mmc.h>
31#include <asm/arch/pxa27x_keypad.h> 31#include <asm/arch/pxa27x_keypad.h>
32#include <asm/arch/pxa3xx_nand.h>
32 33
33#include "devices.h" 34#include "devices.h"
34#include "generic.h" 35#include "generic.h"
@@ -37,6 +38,8 @@
37struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; 38struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
38 39
39int gpio_eth_irq; 40int gpio_eth_irq;
41int gpio_debug_led1;
42int gpio_debug_led2;
40 43
41int wm9713_irq; 44int wm9713_irq;
42 45
@@ -63,6 +66,42 @@ static struct platform_device smc91x_device = {
63 .resource = smc91x_resources, 66 .resource = smc91x_resources,
64}; 67};
65 68
69#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
70static struct gpio_led zylonite_debug_leds[] = {
71 [0] = {
72 .name = "zylonite:yellow:1",
73 .default_trigger = "heartbeat",
74 },
75 [1] = {
76 .name = "zylonite:yellow:2",
77 .default_trigger = "default-on",
78 },
79};
80
81static struct gpio_led_platform_data zylonite_debug_leds_info = {
82 .leds = zylonite_debug_leds,
83 .num_leds = ARRAY_SIZE(zylonite_debug_leds),
84};
85
86static struct platform_device zylonite_device_leds = {
87 .name = "leds-gpio",
88 .id = -1,
89 .dev = {
90 .platform_data = &zylonite_debug_leds_info,
91 }
92};
93
94static void __init zylonite_init_leds(void)
95{
96 zylonite_debug_leds[0].gpio = gpio_debug_led1;
97 zylonite_debug_leds[1].gpio = gpio_debug_led2;
98
99 platform_device_register(&zylonite_device_leds);
100}
101#else
102static inline void zylonite_init_leds(void) {}
103#endif
104
66#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) 105#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
67static struct platform_pwm_backlight_data zylonite_backlight_data = { 106static struct platform_pwm_backlight_data zylonite_backlight_data = {
68 .pwm_id = 3, 107 .pwm_id = 3,
@@ -259,7 +298,7 @@ static void __init zylonite_init_mmc(void)
259static inline void zylonite_init_mmc(void) {} 298static inline void zylonite_init_mmc(void) {}
260#endif 299#endif
261 300
262#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) 301#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
263static unsigned int zylonite_matrix_key_map[] = { 302static unsigned int zylonite_matrix_key_map[] = {
264 /* KEY(row, col, key_code) */ 303 /* KEY(row, col, key_code) */
265 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D), 304 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
@@ -324,6 +363,57 @@ static void __init zylonite_init_keypad(void)
324static inline void zylonite_init_keypad(void) {} 363static inline void zylonite_init_keypad(void) {}
325#endif 364#endif
326 365
366#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
367static struct mtd_partition zylonite_nand_partitions[] = {
368 [0] = {
369 .name = "Bootloader",
370 .offset = 0,
371 .size = 0x060000,
372 .mask_flags = MTD_WRITEABLE, /* force read-only */
373 },
374 [1] = {
375 .name = "Kernel",
376 .offset = 0x060000,
377 .size = 0x200000,
378 .mask_flags = MTD_WRITEABLE, /* force read-only */
379 },
380 [2] = {
381 .name = "Filesystem",
382 .offset = 0x0260000,
383 .size = 0x3000000, /* 48M - rootfs */
384 },
385 [3] = {
386 .name = "MassStorage",
387 .offset = 0x3260000,
388 .size = 0x3d40000,
389 },
390 [4] = {
391 .name = "BBT",
392 .offset = 0x6FA0000,
393 .size = 0x80000,
394 .mask_flags = MTD_WRITEABLE, /* force read-only */
395 },
396 /* NOTE: we reserve some blocks at the end of the NAND flash for
397 * bad block management, and the max number of relocation blocks
398 * differs on different platforms. Please take care with it when
399 * defining the partition table.
400 */
401};
402
403static struct pxa3xx_nand_platform_data zylonite_nand_info = {
404 .enable_arbiter = 1,
405 .parts = zylonite_nand_partitions,
406 .nr_parts = ARRAY_SIZE(zylonite_nand_partitions),
407};
408
409static void __init zylonite_init_nand(void)
410{
411 pxa3xx_set_nand_info(&zylonite_nand_info);
412}
413#else
414static inline void zylonite_init_nand(void) {}
415#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
416
327static void __init zylonite_init(void) 417static void __init zylonite_init(void)
328{ 418{
329 /* board-processor specific initialization */ 419 /* board-processor specific initialization */
@@ -342,6 +432,8 @@ static void __init zylonite_init(void)
342 zylonite_init_lcd(); 432 zylonite_init_lcd();
343 zylonite_init_mmc(); 433 zylonite_init_mmc();
344 zylonite_init_keypad(); 434 zylonite_init_keypad();
435 zylonite_init_nand();
436 zylonite_init_leds();
345} 437}
346 438
347MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") 439MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index 6f7ae972b8db..b28d46e081d3 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -16,9 +16,12 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/i2c.h>
20#include <linux/i2c/pca953x.h>
19 21
20#include <asm/gpio.h> 22#include <asm/gpio.h>
21#include <asm/arch/mfp-pxa300.h> 23#include <asm/arch/mfp-pxa300.h>
24#include <asm/arch/i2c.h>
22#include <asm/arch/zylonite.h> 25#include <asm/arch/zylonite.h>
23 26
24#include "generic.h" 27#include "generic.h"
@@ -109,6 +112,10 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
109 GPIO12_MMC2_DAT3, 112 GPIO12_MMC2_DAT3,
110 GPIO13_MMC2_CLK, 113 GPIO13_MMC2_CLK,
111 GPIO14_MMC2_CMD, 114 GPIO14_MMC2_CMD,
115
116 /* Standard I2C */
117 GPIO21_I2C_SCL,
118 GPIO22_I2C_SDA,
112}; 119};
113 120
114static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { 121static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
@@ -192,6 +199,39 @@ static void __init zylonite_detect_lcd_panel(void)
192 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]); 199 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
193} 200}
194 201
202#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
203static struct pca953x_platform_data gpio_exp[] = {
204 [0] = {
205 .gpio_base = 128,
206 },
207 [1] = {
208 .gpio_base = 144,
209 },
210};
211
212struct i2c_board_info zylonite_i2c_board_info[] = {
213 {
214 .type = "pca9539",
215 .addr = 0x74,
216 .platform_data = &gpio_exp[0],
217 .irq = IRQ_GPIO(18),
218 }, {
219 .type = "pca9539",
220 .addr = 0x75,
221 .platform_data = &gpio_exp[1],
222 .irq = IRQ_GPIO(19),
223 },
224};
225
226static void __init zylonite_init_i2c(void)
227{
228 pxa_set_i2c_info(NULL);
229 i2c_register_board_info(0, ARRAY_AND_SIZE(zylonite_i2c_board_info));
230}
231#else
232static inline void zylonite_init_i2c(void) {}
233#endif
234
195void __init zylonite_pxa300_init(void) 235void __init zylonite_pxa300_init(void)
196{ 236{
197 if (cpu_is_pxa300() || cpu_is_pxa310()) { 237 if (cpu_is_pxa300() || cpu_is_pxa310()) {
@@ -207,6 +247,8 @@ void __init zylonite_pxa300_init(void)
207 247
208 /* WM9713 IRQ */ 248 /* WM9713 IRQ */
209 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26); 249 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26);
250
251 zylonite_init_i2c();
210 } 252 }
211 253
212 if (cpu_is_pxa300()) { 254 if (cpu_is_pxa300()) {
@@ -222,4 +264,8 @@ void __init zylonite_pxa300_init(void)
222 zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30); 264 zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
223 zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31); 265 zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31);
224 } 266 }
267
268 /* GPIOs for Debug LEDs */
269 gpio_debug_led1 = EXT_GPIO(25);
270 gpio_debug_led2 = EXT_GPIO(26);
225} 271}
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 2b4fc34919ac..2b7fba7a2921 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -116,6 +116,10 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
116 GPIO27_MMC2_DAT3, 116 GPIO27_MMC2_DAT3,
117 GPIO28_MMC2_CLK, 117 GPIO28_MMC2_CLK,
118 GPIO29_MMC2_CMD, 118 GPIO29_MMC2_CMD,
119
120 /* Debug LEDs */
121 GPIO1_2_GPIO | MFP_LPM_DRIVE_HIGH,
122 GPIO4_2_GPIO | MFP_LPM_DRIVE_HIGH,
119}; 123};
120 124
121#define NUM_LCD_DETECT_PINS 7 125#define NUM_LCD_DETECT_PINS 7
@@ -189,6 +193,8 @@ void __init zylonite_pxa320_init(void)
189 193
190 /* GPIO pin assignment */ 194 /* GPIO pin assignment */
191 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9); 195 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);
196 gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2);
197 gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2);
192 198
193 /* MMC card detect & write protect for controller 0 */ 199 /* MMC card detect & write protect for controller 0 */
194 zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1); 200 zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1);