aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/Kconfig59
-rw-r--r--arch/arm/mach-pxa/Makefile5
-rw-r--r--arch/arm/mach-pxa/clock.c5
-rw-r--r--arch/arm/mach-pxa/clock.h12
-rw-r--r--arch/arm/mach-pxa/cm-x270-pci.c26
-rw-r--r--arch/arm/mach-pxa/cm-x270.c11
-rw-r--r--arch/arm/mach-pxa/corgi.c1
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c7
-rw-r--r--arch/arm/mach-pxa/devices.c116
-rw-r--r--arch/arm/mach-pxa/devices.h9
-rw-r--r--arch/arm/mach-pxa/em-x270.c12
-rw-r--r--arch/arm/mach-pxa/generic.c17
-rw-r--r--arch/arm/mach-pxa/irq.c1
-rw-r--r--arch/arm/mach-pxa/lpd270.c55
-rw-r--r--arch/arm/mach-pxa/lubbock.c8
-rw-r--r--arch/arm/mach-pxa/magician.c69
-rw-r--r--arch/arm/mach-pxa/mainstone.c71
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c1
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c131
-rw-r--r--arch/arm/mach-pxa/poodle.c1
-rw-r--r--arch/arm/mach-pxa/pwm.c319
-rw-r--r--arch/arm/mach-pxa/pxa25x.c19
-rw-r--r--arch/arm/mach-pxa/pxa27x.c12
-rw-r--r--arch/arm/mach-pxa/pxa2xx.c46
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c8
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c7
-rw-r--r--arch/arm/mach-pxa/ssp.c2
-rw-r--r--arch/arm/mach-pxa/standby.S83
-rw-r--r--arch/arm/mach-pxa/tosa.c4
-rw-r--r--arch/arm/mach-pxa/trizeps4.c12
-rw-r--r--arch/arm/mach-pxa/zylonite.c28
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c4
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c2
33 files changed, 869 insertions, 294 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 5da7a6820492..914bb33dab92 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -20,8 +20,7 @@ endmenu
20 20
21endif 21endif
22 22
23choice 23menu "Select target boards"
24 prompt "Select target board"
25 24
26config ARCH_GUMSTIX 25config ARCH_GUMSTIX
27 bool "Gumstix XScale boards" 26 bool "Gumstix XScale boards"
@@ -37,10 +36,12 @@ config ARCH_LUBBOCK
37config MACH_LOGICPD_PXA270 36config MACH_LOGICPD_PXA270
38 bool "LogicPD PXA270 Card Engine Development Platform" 37 bool "LogicPD PXA270 Card Engine Development Platform"
39 select PXA27x 38 select PXA27x
39 select HAVE_PWM
40 40
41config MACH_MAINSTONE 41config MACH_MAINSTONE
42 bool "Intel HCDDBBVA0 Development Platform" 42 bool "Intel HCDDBBVA0 Development Platform"
43 select PXA27x 43 select PXA27x
44 select HAVE_PWM
44 45
45config ARCH_PXA_IDP 46config ARCH_PXA_IDP
46 bool "Accelent Xscale IDP" 47 bool "Accelent Xscale IDP"
@@ -116,6 +117,7 @@ config MACH_COLIBRI
116config MACH_ZYLONITE 117config MACH_ZYLONITE
117 bool "PXA3xx Development Platform" 118 bool "PXA3xx Development Platform"
118 select PXA3xx 119 select PXA3xx
120 select HAVE_PWM
119 121
120config MACH_LITTLETON 122config MACH_LITTLETON
121 bool "PXA3xx Form Factor Platform (aka Littleton)" 123 bool "PXA3xx Form Factor Platform (aka Littleton)"
@@ -138,7 +140,7 @@ config MACH_PCM027
138 select PXA27x 140 select PXA27x
139 select IWMMXT 141 select IWMMXT
140 142
141endchoice 143endmenu
142 144
143choice 145choice
144 prompt "Used baseboard" 146 prompt "Used baseboard"
@@ -146,25 +148,24 @@ choice
146 148
147config MACH_PCM990_BASEBOARD 149config MACH_PCM990_BASEBOARD
148 bool "PHYTEC PCM-990 development board" 150 bool "PHYTEC PCM-990 development board"
151 select HAVE_PWM
149 152
150endchoice 153endchoice
151 154
152if PXA_SHARPSL
153
154choice 155choice
155 prompt "Select target Sharp Zaurus device range" 156 prompt "display on pcm990"
157 depends on MACH_PCM990_BASEBOARD
156 158
157config PXA_SHARPSL_25x 159config PCM990_DISPLAY_SHARP
158 bool "Sharp PXA25x models (SL-5600, SL-C7xx and SL-C6000x)" 160 bool "sharp lq084v1dg21 stn display"
159 select PXA25x
160 161
161config PXA_SHARPSL_27x 162config PCM990_DISPLAY_NEC
162 bool "Sharp PXA270 models (SL-Cxx00)" 163 bool "nec nl6448bc20_18d tft display"
163 select PXA27x
164 164
165endchoice 165config PCM990_DISPLAY_NONE
166 bool "no display"
166 167
167endif 168endchoice
168 169
169if ARCH_GUMSTIX 170if ARCH_GUMSTIX
170 171
@@ -199,28 +200,33 @@ endmenu
199 200
200config MACH_POODLE 201config MACH_POODLE
201 bool "Enable Sharp SL-5600 (Poodle) Support" 202 bool "Enable Sharp SL-5600 (Poodle) Support"
202 depends on PXA_SHARPSL_25x 203 depends on PXA_SHARPSL
204 select PXA25x
203 select SHARP_LOCOMO 205 select SHARP_LOCOMO
204 select PXA_SSP 206 select PXA_SSP
205 207
206config MACH_CORGI 208config MACH_CORGI
207 bool "Enable Sharp SL-C700 (Corgi) Support" 209 bool "Enable Sharp SL-C700 (Corgi) Support"
208 depends on PXA_SHARPSL_25x 210 depends on PXA_SHARPSL
211 select PXA25x
209 select PXA_SHARP_C7xx 212 select PXA_SHARP_C7xx
210 213
211config MACH_SHEPHERD 214config MACH_SHEPHERD
212 bool "Enable Sharp SL-C750 (Shepherd) Support" 215 bool "Enable Sharp SL-C750 (Shepherd) Support"
213 depends on PXA_SHARPSL_25x 216 depends on PXA_SHARPSL
217 select PXA25x
214 select PXA_SHARP_C7xx 218 select PXA_SHARP_C7xx
215 219
216config MACH_HUSKY 220config MACH_HUSKY
217 bool "Enable Sharp SL-C760 (Husky) Support" 221 bool "Enable Sharp SL-C760 (Husky) Support"
218 depends on PXA_SHARPSL_25x 222 depends on PXA_SHARPSL
223 select PXA25x
219 select PXA_SHARP_C7xx 224 select PXA_SHARP_C7xx
220 225
221config MACH_AKITA 226config MACH_AKITA
222 bool "Enable Sharp SL-1000 (Akita) Support" 227 bool "Enable Sharp SL-1000 (Akita) Support"
223 depends on PXA_SHARPSL_27x 228 depends on PXA_SHARPSL
229 select PXA27x
224 select PXA_SHARP_Cxx00 230 select PXA_SHARP_Cxx00
225 select MACH_SPITZ 231 select MACH_SPITZ
226 select I2C 232 select I2C
@@ -228,17 +234,20 @@ config MACH_AKITA
228 234
229config MACH_SPITZ 235config MACH_SPITZ
230 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support" 236 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
231 depends on PXA_SHARPSL_27x 237 depends on PXA_SHARPSL
238 select PXA27x
232 select PXA_SHARP_Cxx00 239 select PXA_SHARP_Cxx00
233 240
234config MACH_BORZOI 241config MACH_BORZOI
235 bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support" 242 bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support"
236 depends on PXA_SHARPSL_27x 243 depends on PXA_SHARPSL
244 select PXA27x
237 select PXA_SHARP_Cxx00 245 select PXA_SHARP_Cxx00
238 246
239config MACH_TOSA 247config MACH_TOSA
240 bool "Enable Sharp SL-6000x (Tosa) Support" 248 bool "Enable Sharp SL-6000x (Tosa) Support"
241 depends on PXA_SHARPSL_25x 249 depends on PXA_SHARPSL
250 select PXA25x
242 251
243config PXA25x 252config PXA25x
244 bool 253 bool
@@ -273,4 +282,10 @@ config PXA_SSP
273 tristate 282 tristate
274 help 283 help
275 Enable support for PXA2xx SSP ports 284 Enable support for PXA2xx SSP ports
285
286config PXA_PWM
287 tristate
288 default BACKLIGHT_PWM
289 help
290 Enable support for PXA2xx/PXA3xx PWM controllers
276endif 291endif
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 0e6d05bb81aa..c4dfbe87fc4e 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -10,10 +10,11 @@ obj-$(CONFIG_CPU_FREQ) += cpu-pxa.o
10 10
11# Generic drivers that other drivers may depend upon 11# Generic drivers that other drivers may depend upon
12obj-$(CONFIG_PXA_SSP) += ssp.o 12obj-$(CONFIG_PXA_SSP) += ssp.o
13obj-$(CONFIG_PXA_PWM) += pwm.o
13 14
14# SoC-specific code 15# SoC-specific code
15obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa25x.o 16obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa2xx.o pxa25x.o
16obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa27x.o 17obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa2xx.o pxa27x.o
17obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o 18obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o
18obj-$(CONFIG_CPU_PXA300) += pxa300.o 19obj-$(CONFIG_CPU_PXA300) += pxa300.o
19obj-$(CONFIG_CPU_PXA320) += pxa320.o 20obj-$(CONFIG_CPU_PXA320) += pxa320.o
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index e97dc59813c8..b4d04955dcb0 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -12,7 +12,7 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14 14
15#include <asm/arch/pxa-regs.h> 15#include <asm/arch/pxa2xx-regs.h>
16#include <asm/arch/pxa2xx-gpio.h> 16#include <asm/arch/pxa2xx-gpio.h>
17#include <asm/hardware.h> 17#include <asm/hardware.h>
18 18
@@ -47,6 +47,9 @@ struct clk *clk_get(struct device *dev, const char *id)
47 clk = p; 47 clk = p;
48 mutex_unlock(&clocks_mutex); 48 mutex_unlock(&clocks_mutex);
49 49
50 if (!IS_ERR(clk) && clk->ops == NULL)
51 clk = clk->other;
52
50 return clk; 53 return clk;
51} 54}
52EXPORT_SYMBOL(clk_get); 55EXPORT_SYMBOL(clk_get);
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index bc6b77e1592e..83cbfaba485d 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -15,6 +15,7 @@ struct clk {
15 unsigned int cken; 15 unsigned int cken;
16 unsigned int delay; 16 unsigned int delay;
17 unsigned int enabled; 17 unsigned int enabled;
18 struct clk *other;
18}; 19};
19 20
20#define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \ 21#define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \
@@ -35,6 +36,17 @@ struct clk {
35 .cken = CKEN_##_cken, \ 36 .cken = CKEN_##_cken, \
36 } 37 }
37 38
39/*
40 * This is a placeholder to alias one clock device+name pair
41 * to another struct clk.
42 */
43#define INIT_CKOTHER(_name, _other, _dev) \
44 { \
45 .name = _name, \
46 .dev = _dev, \
47 .other = _other, \
48 }
49
38extern const struct clkops clk_cken_ops; 50extern const struct clkops clk_cken_ops;
39 51
40void clk_cken_enable(struct clk *clk); 52void clk_cken_enable(struct clk *clk);
diff --git a/arch/arm/mach-pxa/cm-x270-pci.c b/arch/arm/mach-pxa/cm-x270-pci.c
index ac7f05f9f3eb..319c9ff3ab9a 100644
--- a/arch/arm/mach-pxa/cm-x270-pci.c
+++ b/arch/arm/mach-pxa/cm-x270-pci.c
@@ -41,18 +41,20 @@ void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size,
41{ 41{
42 unsigned int sz = SZ_64M >> PAGE_SHIFT; 42 unsigned int sz = SZ_64M >> PAGE_SHIFT;
43 43
44 pr_info("Adjusting zones for CM-x270\n"); 44 if (machine_is_armcore()) {
45 45 pr_info("Adjusting zones for CM-x270\n");
46 /* 46
47 * Only adjust if > 64M on current system 47 /*
48 */ 48 * Only adjust if > 64M on current system
49 if (node || (zone_size[0] <= sz)) 49 */
50 return; 50 if (node || (zone_size[0] <= sz))
51 51 return;
52 zone_size[1] = zone_size[0] - sz; 52
53 zone_size[0] = sz; 53 zone_size[1] = zone_size[0] - sz;
54 zhole_size[1] = zhole_size[0]; 54 zone_size[0] = sz;
55 zhole_size[0] = 0; 55 zhole_size[1] = zhole_size[0];
56 zhole_size[0] = 0;
57 }
56} 58}
57 59
58static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) 60static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 6d4416a4f378..01b9964acec1 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -31,6 +31,7 @@
31#include <asm/arch/pxa-regs.h> 31#include <asm/arch/pxa-regs.h>
32#include <asm/arch/pxa2xx-regs.h> 32#include <asm/arch/pxa2xx-regs.h>
33#include <asm/arch/pxa2xx-gpio.h> 33#include <asm/arch/pxa2xx-gpio.h>
34#include <asm/arch/audio.h>
34#include <asm/arch/pxafb.h> 35#include <asm/arch/pxafb.h>
35#include <asm/arch/ohci.h> 36#include <asm/arch/ohci.h>
36#include <asm/arch/mmc.h> 37#include <asm/arch/mmc.h>
@@ -59,7 +60,7 @@ static struct resource cmx270_dm9k_resource[] = {
59 [2] = { 60 [2] = {
60 .start = CMX270_ETHIRQ, 61 .start = CMX270_ETHIRQ,
61 .end = CMX270_ETHIRQ, 62 .end = CMX270_ETHIRQ,
62 .flags = IORESOURCE_IRQ, 63 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
63 } 64 }
64}; 65};
65 66
@@ -81,12 +82,6 @@ static struct platform_device cmx270_device_dm9k = {
81 } 82 }
82}; 83};
83 84
84/* audio device */
85static struct platform_device cmx270_audio_device = {
86 .name = "pxa2xx-ac97",
87 .id = -1,
88};
89
90/* touchscreen controller */ 85/* touchscreen controller */
91static struct platform_device cmx270_ts_device = { 86static struct platform_device cmx270_ts_device = {
92 .name = "ucb1400_ts", 87 .name = "ucb1400_ts",
@@ -219,7 +214,6 @@ static struct platform_device cmx270_ata = {
219/* platform devices */ 214/* platform devices */
220static struct platform_device *platform_devices[] __initdata = { 215static struct platform_device *platform_devices[] __initdata = {
221 &cmx270_device_dm9k, 216 &cmx270_device_dm9k,
222 &cmx270_audio_device,
223 &cmx270_rtc_device, 217 &cmx270_rtc_device,
224 &cmx270_2700G, 218 &cmx270_2700G,
225 &cmx270_led_device, 219 &cmx270_led_device,
@@ -594,6 +588,7 @@ static void __init cmx270_init(void)
594 588
595 /* register CM-X270 platform devices */ 589 /* register CM-X270 platform devices */
596 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 590 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
591 pxa_set_ac97_info(NULL);
597 592
598 /* set MCI and OHCI platform parameters */ 593 /* set MCI and OHCI platform parameters */
599 pxa_set_mci_info(&cmx270_mci_platform_data); 594 pxa_set_mci_info(&cmx270_mci_platform_data);
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index b757dd756655..b37671b71886 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -36,6 +36,7 @@
36#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
37 37
38#include <asm/arch/pxa-regs.h> 38#include <asm/arch/pxa-regs.h>
39#include <asm/arch/pxa2xx-regs.h>
39#include <asm/arch/pxa2xx-gpio.h> 40#include <asm/arch/pxa2xx-gpio.h>
40#include <asm/arch/irda.h> 41#include <asm/arch/irda.h>
41#include <asm/arch/mmc.h> 42#include <asm/arch/mmc.h>
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 0a85f706e887..e91c0f26c412 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -26,6 +26,7 @@
26#include <asm/arch/sharpsl.h> 26#include <asm/arch/sharpsl.h>
27#include <asm/arch/corgi.h> 27#include <asm/arch/corgi.h>
28#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h>
29#include <asm/arch/pxa2xx-gpio.h> 30#include <asm/arch/pxa2xx-gpio.h>
30#include "sharpsl.h" 31#include "sharpsl.h"
31 32
@@ -204,7 +205,9 @@ static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
204 .read_devdata = corgipm_read_devdata, 205 .read_devdata = corgipm_read_devdata,
205 .charger_wakeup = corgi_charger_wakeup, 206 .charger_wakeup = corgi_charger_wakeup,
206 .should_wakeup = corgi_should_wakeup, 207 .should_wakeup = corgi_should_wakeup,
208#ifdef CONFIG_BACKLIGHT_CORGI
207 .backlight_limit = corgibl_limit_intensity, 209 .backlight_limit = corgibl_limit_intensity,
210#endif
208 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, 211 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
209 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, 212 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP,
210 .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH, 213 .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH,
@@ -226,6 +229,10 @@ static int __devinit corgipm_init(void)
226{ 229{
227 int ret; 230 int ret;
228 231
232 if (!machine_is_corgi() && !machine_is_shepherd()
233 && !machine_is_husky())
234 return -ENODEV;
235
229 corgipm_device = platform_device_alloc("sharpsl-pm", -1); 236 corgipm_device = platform_device_alloc("sharpsl-pm", -1);
230 if (!corgipm_device) 237 if (!corgipm_device)
231 return -ENOMEM; 238 return -ENOMEM;
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index d6c05b6eab35..a6f2390ce662 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -10,11 +10,14 @@
10#include <asm/arch/mmc.h> 10#include <asm/arch/mmc.h>
11#include <asm/arch/irda.h> 11#include <asm/arch/irda.h>
12#include <asm/arch/i2c.h> 12#include <asm/arch/i2c.h>
13#include <asm/arch/mfp-pxa27x.h>
13#include <asm/arch/ohci.h> 14#include <asm/arch/ohci.h>
14#include <asm/arch/pxa27x_keypad.h> 15#include <asm/arch/pxa27x_keypad.h>
15#include <asm/arch/camera.h> 16#include <asm/arch/camera.h>
17#include <asm/arch/audio.h>
16 18
17#include "devices.h" 19#include "devices.h"
20#include "generic.h"
18 21
19void __init pxa_register_device(struct platform_device *dev, void *data) 22void __init pxa_register_device(struct platform_device *dev, void *data)
20{ 23{
@@ -91,8 +94,19 @@ static struct resource pxa2xx_udc_resources[] = {
91 94
92static u64 udc_dma_mask = ~(u32)0; 95static u64 udc_dma_mask = ~(u32)0;
93 96
94struct platform_device pxa_device_udc = { 97struct platform_device pxa25x_device_udc = {
95 .name = "pxa2xx-udc", 98 .name = "pxa25x-udc",
99 .id = -1,
100 .resource = pxa2xx_udc_resources,
101 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
102 .dev = {
103 .platform_data = &pxa_udc_info,
104 .dma_mask = &udc_dma_mask,
105 }
106};
107
108struct platform_device pxa27x_device_udc = {
109 .name = "pxa27x-udc",
96 .id = -1, 110 .id = -1,
97 .resource = pxa2xx_udc_resources, 111 .resource = pxa2xx_udc_resources,
98 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources), 112 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
@@ -233,8 +247,15 @@ struct platform_device pxa_device_i2c = {
233 .num_resources = ARRAY_SIZE(pxai2c_resources), 247 .num_resources = ARRAY_SIZE(pxai2c_resources),
234}; 248};
235 249
250static unsigned long pxa27x_i2c_mfp_cfg[] = {
251 GPIO117_I2C_SCL,
252 GPIO118_I2C_SDA,
253};
254
236void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) 255void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
237{ 256{
257 if (cpu_is_pxa27x())
258 pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
238 pxa_register_device(&pxa_device_i2c, info); 259 pxa_register_device(&pxa_device_i2c, info);
239} 260}
240 261
@@ -278,8 +299,69 @@ struct platform_device pxa_device_rtc = {
278 .id = -1, 299 .id = -1,
279}; 300};
280 301
302static struct resource pxa_ac97_resources[] = {
303 [0] = {
304 .start = 0x40500000,
305 .end = 0x40500000 + 0xfff,
306 .flags = IORESOURCE_MEM,
307 },
308 [1] = {
309 .start = IRQ_AC97,
310 .end = IRQ_AC97,
311 .flags = IORESOURCE_IRQ,
312 },
313};
314
315static u64 pxa_ac97_dmamask = 0xffffffffUL;
316
317struct platform_device pxa_device_ac97 = {
318 .name = "pxa2xx-ac97",
319 .id = -1,
320 .dev = {
321 .dma_mask = &pxa_ac97_dmamask,
322 .coherent_dma_mask = 0xffffffff,
323 },
324 .num_resources = ARRAY_SIZE(pxa_ac97_resources),
325 .resource = pxa_ac97_resources,
326};
327
328void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
329{
330 pxa_register_device(&pxa_device_ac97, ops);
331}
332
281#ifdef CONFIG_PXA25x 333#ifdef CONFIG_PXA25x
282 334
335static struct resource pxa25x_resource_pwm0[] = {
336 [0] = {
337 .start = 0x40b00000,
338 .end = 0x40b0000f,
339 .flags = IORESOURCE_MEM,
340 },
341};
342
343struct platform_device pxa25x_device_pwm0 = {
344 .name = "pxa25x-pwm",
345 .id = 0,
346 .resource = pxa25x_resource_pwm0,
347 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
348};
349
350static struct resource pxa25x_resource_pwm1[] = {
351 [0] = {
352 .start = 0x40c00000,
353 .end = 0x40c0000f,
354 .flags = IORESOURCE_MEM,
355 },
356};
357
358struct platform_device pxa25x_device_pwm1 = {
359 .name = "pxa25x-pwm",
360 .id = 1,
361 .resource = pxa25x_resource_pwm1,
362 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
363};
364
283static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32); 365static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
284 366
285static struct resource pxa25x_resource_ssp[] = { 367static struct resource pxa25x_resource_ssp[] = {
@@ -568,6 +650,36 @@ struct platform_device pxa27x_device_ssp3 = {
568 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), 650 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
569}; 651};
570 652
653static struct resource pxa27x_resource_pwm0[] = {
654 [0] = {
655 .start = 0x40b00000,
656 .end = 0x40b0001f,
657 .flags = IORESOURCE_MEM,
658 },
659};
660
661struct platform_device pxa27x_device_pwm0 = {
662 .name = "pxa27x-pwm",
663 .id = 0,
664 .resource = pxa27x_resource_pwm0,
665 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
666};
667
668static struct resource pxa27x_resource_pwm1[] = {
669 [0] = {
670 .start = 0x40c00000,
671 .end = 0x40c0001f,
672 .flags = IORESOURCE_MEM,
673 },
674};
675
676struct platform_device pxa27x_device_pwm1 = {
677 .name = "pxa27x-pwm",
678 .id = 1,
679 .resource = pxa27x_resource_pwm1,
680 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
681};
682
571static struct resource pxa27x_resource_camera[] = { 683static struct resource pxa27x_resource_camera[] = {
572 [0] = { 684 [0] = {
573 .start = 0x50000000, 685 .start = 0x50000000,
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index fcab017f27ee..b852eb18daa5 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -1,7 +1,8 @@
1extern struct platform_device pxa_device_mci; 1extern struct platform_device pxa_device_mci;
2extern struct platform_device pxa3xx_device_mci2; 2extern struct platform_device pxa3xx_device_mci2;
3extern struct platform_device pxa3xx_device_mci3; 3extern struct platform_device pxa3xx_device_mci3;
4extern struct platform_device pxa_device_udc; 4extern struct platform_device pxa25x_device_udc;
5extern struct platform_device pxa27x_device_udc;
5extern struct platform_device pxa_device_fb; 6extern struct platform_device pxa_device_fb;
6extern struct platform_device pxa_device_ffuart; 7extern struct platform_device pxa_device_ffuart;
7extern struct platform_device pxa_device_btuart; 8extern struct platform_device pxa_device_btuart;
@@ -11,6 +12,7 @@ extern struct platform_device pxa_device_i2c;
11extern struct platform_device pxa_device_i2s; 12extern struct platform_device pxa_device_i2s;
12extern struct platform_device pxa_device_ficp; 13extern struct platform_device pxa_device_ficp;
13extern struct platform_device pxa_device_rtc; 14extern struct platform_device pxa_device_rtc;
15extern struct platform_device pxa_device_ac97;
14 16
15extern struct platform_device pxa27x_device_i2c_power; 17extern struct platform_device pxa27x_device_i2c_power;
16extern struct platform_device pxa27x_device_ohci; 18extern struct platform_device pxa27x_device_ohci;
@@ -24,4 +26,9 @@ extern struct platform_device pxa27x_device_ssp2;
24extern struct platform_device pxa27x_device_ssp3; 26extern struct platform_device pxa27x_device_ssp3;
25extern struct platform_device pxa3xx_device_ssp4; 27extern struct platform_device pxa3xx_device_ssp4;
26 28
29extern struct platform_device pxa25x_device_pwm0;
30extern struct platform_device pxa25x_device_pwm1;
31extern struct platform_device pxa27x_device_pwm0;
32extern struct platform_device pxa27x_device_pwm1;
33
27void __init pxa_register_device(struct platform_device *dev, void *data); 34void __init pxa_register_device(struct platform_device *dev, void *data);
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index edc4f07a230d..1bf680749928 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -24,6 +24,8 @@
24 24
25#include <asm/arch/pxa-regs.h> 25#include <asm/arch/pxa-regs.h>
26#include <asm/arch/pxa2xx-gpio.h> 26#include <asm/arch/pxa2xx-gpio.h>
27#include <asm/arch/pxa27x-udc.h>
28#include <asm/arch/audio.h>
27#include <asm/arch/pxafb.h> 29#include <asm/arch/pxafb.h>
28#include <asm/arch/ohci.h> 30#include <asm/arch/ohci.h>
29#include <asm/arch/mmc.h> 31#include <asm/arch/mmc.h>
@@ -50,7 +52,7 @@ static struct resource em_x270_dm9k_resource[] = {
50 [2] = { 52 [2] = {
51 .start = EM_X270_ETHIRQ, 53 .start = EM_X270_ETHIRQ,
52 .end = EM_X270_ETHIRQ, 54 .end = EM_X270_ETHIRQ,
53 .flags = IORESOURCE_IRQ, 55 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
54 } 56 }
55}; 57};
56 58
@@ -72,12 +74,6 @@ static struct platform_device em_x270_dm9k = {
72 } 74 }
73}; 75};
74 76
75/* audio device */
76static struct platform_device em_x270_audio = {
77 .name = "pxa2xx-ac97",
78 .id = -1,
79};
80
81/* WM9712 touchscreen controller. Hopefully the driver will make it to 77/* WM9712 touchscreen controller. Hopefully the driver will make it to
82 * the mainstream sometime */ 78 * the mainstream sometime */
83static struct platform_device em_x270_ts = { 79static struct platform_device em_x270_ts = {
@@ -217,7 +213,6 @@ static struct platform_device em_x270_nand = {
217/* platform devices */ 213/* platform devices */
218static struct platform_device *platform_devices[] __initdata = { 214static struct platform_device *platform_devices[] __initdata = {
219 &em_x270_dm9k, 215 &em_x270_dm9k,
220 &em_x270_audio,
221 &em_x270_ts, 216 &em_x270_ts,
222 &em_x270_rtc, 217 &em_x270_rtc,
223 &em_x270_nand, 218 &em_x270_nand,
@@ -325,6 +320,7 @@ static void __init em_x270_init(void)
325 320
326 /* register EM-X270 platform devices */ 321 /* register EM-X270 platform devices */
327 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 322 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
323 pxa_set_ac97_info(NULL);
328 324
329 /* set MCI and OHCI platform parameters */ 325 /* set MCI and OHCI platform parameters */
330 pxa_set_mci_info(&em_x270_mci_platform_data); 326 pxa_set_mci_info(&em_x270_mci_platform_data);
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 44617938f3f1..ca053226fba0 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -60,23 +60,6 @@ unsigned int get_memclk_frequency_10khz(void)
60EXPORT_SYMBOL(get_memclk_frequency_10khz); 60EXPORT_SYMBOL(get_memclk_frequency_10khz);
61 61
62/* 62/*
63 * Routine to safely enable or disable a clock in the CKEN
64 */
65void __pxa_set_cken(int clock, int enable)
66{
67 unsigned long flags;
68 local_irq_save(flags);
69
70 if (enable)
71 CKEN |= (1 << clock);
72 else
73 CKEN &= ~(1 << clock);
74
75 local_irq_restore(flags);
76}
77EXPORT_SYMBOL(__pxa_set_cken);
78
79/*
80 * Intel PXA2xx internal register mapping. 63 * Intel PXA2xx internal register mapping.
81 * 64 *
82 * Note 1: not all PXA2xx variants implement all those addresses. 65 * Note 1: not all PXA2xx variants implement all those addresses.
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index a9a0c3fab159..fbff557bb225 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -21,7 +21,6 @@
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
23#include <asm/arch/pxa-regs.h> 23#include <asm/arch/pxa-regs.h>
24#include <asm/arch/pxa2xx-gpio.h>
25 24
26#include "generic.h" 25#include "generic.h"
27 26
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index a20e4b1649d6..cc1c4fa06145 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -23,6 +23,7 @@
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/pwm_backlight.h>
26 27
27#include <asm/types.h> 28#include <asm/types.h>
28#include <asm/setup.h> 29#include <asm/setup.h>
@@ -134,9 +135,12 @@ static struct sys_device lpd270_irq_device = {
134 135
135static int __init lpd270_irq_device_init(void) 136static int __init lpd270_irq_device_init(void)
136{ 137{
137 int ret = sysdev_class_register(&lpd270_irq_sysclass); 138 int ret = -ENODEV;
138 if (ret == 0) 139 if (machine_is_logicpd_pxa270()) {
139 ret = sysdev_register(&lpd270_irq_device); 140 ret = sysdev_class_register(&lpd270_irq_sysclass);
141 if (ret == 0)
142 ret = sysdev_register(&lpd270_irq_device);
143 }
140 return ret; 144 return ret;
141} 145}
142 146
@@ -164,11 +168,6 @@ static struct platform_device smc91x_device = {
164 .resource = smc91x_resources, 168 .resource = smc91x_resources,
165}; 169};
166 170
167static struct platform_device lpd270_audio_device = {
168 .name = "pxa2xx-ac97",
169 .id = -1,
170};
171
172static struct resource lpd270_flash_resources[] = { 171static struct resource lpd270_flash_resources[] = {
173 [0] = { 172 [0] = {
174 .start = PXA_CS0_PHYS, 173 .start = PXA_CS0_PHYS,
@@ -233,21 +232,20 @@ static struct platform_device lpd270_flash_device[2] = {
233 }, 232 },
234}; 233};
235 234
236static void lpd270_backlight_power(int on) 235static struct platform_pwm_backlight_data lpd270_backlight_data = {
237{ 236 .pwm_id = 0,
238 if (on) { 237 .max_brightness = 1,
239 pxa_gpio_mode(GPIO16_PWM0_MD); 238 .dft_brightness = 1,
240 pxa_set_cken(CKEN_PWM0, 1); 239 .pwm_period_ns = 78770,
241 PWM_CTRL0 = 0; 240};
242 PWM_PWDUTY0 = 0x3ff; 241
243 PWM_PERVAL0 = 0x3ff; 242static struct platform_device lpd270_backlight_device = {
244 } else { 243 .name = "pwm-backlight",
245 PWM_CTRL0 = 0; 244 .dev = {
246 PWM_PWDUTY0 = 0x0; 245 .parent = &pxa27x_device_pwm0.dev,
247 PWM_PERVAL0 = 0x3FF; 246 .platform_data = &lpd270_backlight_data,
248 pxa_set_cken(CKEN_PWM0, 0); 247 },
249 } 248};
250}
251 249
252/* 5.7" TFT QVGA (LoLo display number 1) */ 250/* 5.7" TFT QVGA (LoLo display number 1) */
253static struct pxafb_mode_info sharp_lq057q3dc02_mode = { 251static struct pxafb_mode_info sharp_lq057q3dc02_mode = {
@@ -269,7 +267,6 @@ static struct pxafb_mach_info sharp_lq057q3dc02 = {
269 .num_modes = 1, 267 .num_modes = 1,
270 .lccr0 = 0x07800080, 268 .lccr0 = 0x07800080,
271 .lccr3 = 0x00400000, 269 .lccr3 = 0x00400000,
272 .pxafb_backlight_power = lpd270_backlight_power,
273}; 270};
274 271
275/* 12.1" TFT SVGA (LoLo display number 2) */ 272/* 12.1" TFT SVGA (LoLo display number 2) */
@@ -292,7 +289,6 @@ static struct pxafb_mach_info sharp_lq121s1dg31 = {
292 .num_modes = 1, 289 .num_modes = 1,
293 .lccr0 = 0x07800080, 290 .lccr0 = 0x07800080,
294 .lccr3 = 0x00400000, 291 .lccr3 = 0x00400000,
295 .pxafb_backlight_power = lpd270_backlight_power,
296}; 292};
297 293
298/* 3.6" TFT QVGA (LoLo display number 3) */ 294/* 3.6" TFT QVGA (LoLo display number 3) */
@@ -315,7 +311,6 @@ static struct pxafb_mach_info sharp_lq036q1da01 = {
315 .num_modes = 1, 311 .num_modes = 1,
316 .lccr0 = 0x07800080, 312 .lccr0 = 0x07800080,
317 .lccr3 = 0x00400000, 313 .lccr3 = 0x00400000,
318 .pxafb_backlight_power = lpd270_backlight_power,
319}; 314};
320 315
321/* 6.4" TFT VGA (LoLo display number 5) */ 316/* 6.4" TFT VGA (LoLo display number 5) */
@@ -338,7 +333,6 @@ static struct pxafb_mach_info sharp_lq64d343 = {
338 .num_modes = 1, 333 .num_modes = 1,
339 .lccr0 = 0x07800080, 334 .lccr0 = 0x07800080,
340 .lccr3 = 0x00400000, 335 .lccr3 = 0x00400000,
341 .pxafb_backlight_power = lpd270_backlight_power,
342}; 336};
343 337
344/* 10.4" TFT VGA (LoLo display number 7) */ 338/* 10.4" TFT VGA (LoLo display number 7) */
@@ -361,7 +355,6 @@ static struct pxafb_mach_info sharp_lq10d368 = {
361 .num_modes = 1, 355 .num_modes = 1,
362 .lccr0 = 0x07800080, 356 .lccr0 = 0x07800080,
363 .lccr3 = 0x00400000, 357 .lccr3 = 0x00400000,
364 .pxafb_backlight_power = lpd270_backlight_power,
365}; 358};
366 359
367/* 3.5" TFT QVGA (LoLo display number 8) */ 360/* 3.5" TFT QVGA (LoLo display number 8) */
@@ -384,7 +377,6 @@ static struct pxafb_mach_info sharp_lq035q7db02_20 = {
384 .num_modes = 1, 377 .num_modes = 1,
385 .lccr0 = 0x07800080, 378 .lccr0 = 0x07800080,
386 .lccr3 = 0x00400000, 379 .lccr3 = 0x00400000,
387 .pxafb_backlight_power = lpd270_backlight_power,
388}; 380};
389 381
390static struct pxafb_mach_info *lpd270_lcd_to_use; 382static struct pxafb_mach_info *lpd270_lcd_to_use;
@@ -414,7 +406,7 @@ __setup("lcd=", lpd270_set_lcd);
414 406
415static struct platform_device *platform_devices[] __initdata = { 407static struct platform_device *platform_devices[] __initdata = {
416 &smc91x_device, 408 &smc91x_device,
417 &lpd270_audio_device, 409 &lpd270_backlight_device,
418 &lpd270_flash_device[0], 410 &lpd270_flash_device[0],
419 &lpd270_flash_device[1], 411 &lpd270_flash_device[1],
420}; 412};
@@ -454,9 +446,12 @@ static void __init lpd270_init(void)
454 * On LogicPD PXA270, we route AC97_SYSCLK via GPIO45. 446 * On LogicPD PXA270, we route AC97_SYSCLK via GPIO45.
455 */ 447 */
456 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD); 448 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);
449 pxa_gpio_mode(GPIO16_PWM0_MD);
457 450
458 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 451 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
459 452
453 pxa_set_ac97_info(NULL);
454
460 if (lpd270_lcd_to_use != NULL) 455 if (lpd270_lcd_to_use != NULL)
461 set_pxa_fb_info(lpd270_lcd_to_use); 456 set_pxa_fb_info(lpd270_lcd_to_use);
462 457
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 7b9bdd0c6665..a3fae4139203 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -43,6 +43,7 @@
43#include <asm/arch/pxa-regs.h> 43#include <asm/arch/pxa-regs.h>
44#include <asm/arch/pxa2xx-regs.h> 44#include <asm/arch/pxa2xx-regs.h>
45#include <asm/arch/mfp-pxa25x.h> 45#include <asm/arch/mfp-pxa25x.h>
46#include <asm/arch/audio.h>
46#include <asm/arch/lubbock.h> 47#include <asm/arch/lubbock.h>
47#include <asm/arch/udc.h> 48#include <asm/arch/udc.h>
48#include <asm/arch/irda.h> 49#include <asm/arch/irda.h>
@@ -196,11 +197,6 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
196 // no D+ pullup; lubbock can't connect/disconnect in software 197 // no D+ pullup; lubbock can't connect/disconnect in software
197}; 198};
198 199
199static struct platform_device lub_audio_device = {
200 .name = "pxa2xx-ac97",
201 .id = -1,
202};
203
204static struct resource sa1111_resources[] = { 200static struct resource sa1111_resources[] = {
205 [0] = { 201 [0] = {
206 .start = 0x10000000, 202 .start = 0x10000000,
@@ -368,7 +364,6 @@ static struct platform_device lubbock_flash_device[2] = {
368 364
369static struct platform_device *devices[] __initdata = { 365static struct platform_device *devices[] __initdata = {
370 &sa1111_device, 366 &sa1111_device,
371 &lub_audio_device,
372 &smc91x_device, 367 &smc91x_device,
373 &lubbock_flash_device[0], 368 &lubbock_flash_device[0],
374 &lubbock_flash_device[1], 369 &lubbock_flash_device[1],
@@ -494,6 +489,7 @@ static void __init lubbock_init(void)
494 set_pxa_fb_info(&sharp_lm8v31); 489 set_pxa_fb_info(&sharp_lm8v31);
495 pxa_set_mci_info(&lubbock_mci_platform_data); 490 pxa_set_mci_info(&lubbock_mci_platform_data);
496 pxa_set_ficp_info(&lubbock_ficp_platform_data); 491 pxa_set_ficp_info(&lubbock_ficp_platform_data);
492 pxa_set_ac97_info(NULL);
497 493
498 lubbock_flash_data[0].width = lubbock_flash_data[1].width = 494 lubbock_flash_data[0].width = lubbock_flash_data[1].width =
499 (BOOT_DEF & 1) ? 2 : 4; 495 (BOOT_DEF & 1) ? 2 : 4;
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index badba064dc04..01b2fa790217 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -25,6 +25,7 @@
25#include <linux/mtd/map.h> 25#include <linux/mtd/map.h>
26#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27#include <linux/pda_power.h> 27#include <linux/pda_power.h>
28#include <linux/pwm_backlight.h>
28 29
29#include <asm/gpio.h> 30#include <asm/gpio.h>
30#include <asm/hardware.h> 31#include <asm/hardware.h>
@@ -33,12 +34,14 @@
33#include <asm/arch/magician.h> 34#include <asm/arch/magician.h>
34#include <asm/arch/mfp-pxa27x.h> 35#include <asm/arch/mfp-pxa27x.h>
35#include <asm/arch/pxa-regs.h> 36#include <asm/arch/pxa-regs.h>
37#include <asm/arch/pxa2xx-regs.h>
36#include <asm/arch/pxafb.h> 38#include <asm/arch/pxafb.h>
37#include <asm/arch/i2c.h> 39#include <asm/arch/i2c.h>
38#include <asm/arch/mmc.h> 40#include <asm/arch/mmc.h>
39#include <asm/arch/irda.h> 41#include <asm/arch/irda.h>
40#include <asm/arch/ohci.h> 42#include <asm/arch/ohci.h>
41 43
44#include "devices.h"
42#include "generic.h" 45#include "generic.h"
43 46
44static unsigned long magician_pin_config[] = { 47static unsigned long magician_pin_config[] = {
@@ -348,40 +351,58 @@ static struct pxafb_mach_info samsung_info = {
348 * Backlight 351 * Backlight
349 */ 352 */
350 353
351static void magician_set_bl_intensity(int intensity) 354static int magician_backlight_init(struct device *dev)
352{ 355{
353 if (intensity) { 356 int ret;
354 PWM_CTRL0 = 1; 357
355 PWM_PERVAL0 = 0xc8; 358 ret = gpio_request(EGPIO_MAGICIAN_BL_POWER, "BL_POWER");
356 if (intensity > 0xc7) { 359 if (ret)
357 PWM_PWDUTY0 = intensity - 0x48; 360 goto err;
358 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); 361 ret = gpio_request(EGPIO_MAGICIAN_BL_POWER2, "BL_POWER2");
359 } else { 362 if (ret)
360 PWM_PWDUTY0 = intensity; 363 goto err2;
361 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); 364 return 0;
362 } 365
363 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 1); 366err2:
364 pxa_set_cken(CKEN_PWM0, 1); 367 gpio_free(EGPIO_MAGICIAN_BL_POWER);
368err:
369 return ret;
370}
371
372static int magician_backlight_notify(int brightness)
373{
374 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
375 if (brightness >= 200) {
376 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
377 return brightness - 72;
365 } else { 378 } else {
366 /* PWM_PWDUTY0 = intensity; */ 379 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0);
367 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 0); 380 return brightness;
368 pxa_set_cken(CKEN_PWM0, 0);
369 } 381 }
370} 382}
371 383
372static struct generic_bl_info backlight_info = { 384static void magician_backlight_exit(struct device *dev)
373 .default_intensity = 0x64, 385{
374 .limit_mask = 0x0b, 386 gpio_free(EGPIO_MAGICIAN_BL_POWER);
375 .max_intensity = 0xc7+0x48, 387 gpio_free(EGPIO_MAGICIAN_BL_POWER2);
376 .set_bl_intensity = magician_set_bl_intensity, 388}
389
390static struct platform_pwm_backlight_data backlight_data = {
391 .pwm_id = 0,
392 .max_brightness = 272,
393 .dft_brightness = 100,
394 .pwm_period_ns = 30923,
395 .init = magician_backlight_init,
396 .notify = magician_backlight_notify,
397 .exit = magician_backlight_exit,
377}; 398};
378 399
379static struct platform_device backlight = { 400static struct platform_device backlight = {
380 .name = "generic-bl", 401 .name = "pwm-backlight",
381 .dev = { 402 .dev = {
382 .platform_data = &backlight_info, 403 .parent = &pxa27x_device_pwm0.dev,
404 .platform_data = &backlight_data,
383 }, 405 },
384 .id = -1,
385}; 406};
386 407
387/* 408/*
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 7399fb34da4e..f2e9e7c4da8e 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -23,9 +23,9 @@
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/backlight.h>
27#include <linux/input.h> 26#include <linux/input.h>
28#include <linux/gpio_keys.h> 27#include <linux/gpio_keys.h>
28#include <linux/pwm_backlight.h>
29 29
30#include <asm/types.h> 30#include <asm/types.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
@@ -280,12 +280,6 @@ static pxa2xx_audio_ops_t mst_audio_ops = {
280 .resume = mst_audio_resume, 280 .resume = mst_audio_resume,
281}; 281};
282 282
283static struct platform_device mst_audio_device = {
284 .name = "pxa2xx-ac97",
285 .id = -1,
286 .dev = { .platform_data = &mst_audio_ops },
287};
288
289static struct resource flash_resources[] = { 283static struct resource flash_resources[] = {
290 [0] = { 284 [0] = {
291 .start = PXA_CS0_PHYS, 285 .start = PXA_CS0_PHYS,
@@ -349,56 +343,27 @@ static struct platform_device mst_flash_device[2] = {
349 }, 343 },
350}; 344};
351 345
352#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE 346#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
353static int mainstone_backlight_update_status(struct backlight_device *bl) 347static struct platform_pwm_backlight_data mainstone_backlight_data = {
354{ 348 .pwm_id = 0,
355 int brightness = bl->props.brightness; 349 .max_brightness = 1023,
356 350 .dft_brightness = 1023,
357 if (bl->props.power != FB_BLANK_UNBLANK || 351 .pwm_period_ns = 78770,
358 bl->props.fb_blank != FB_BLANK_UNBLANK) 352};
359 brightness = 0;
360
361 if (brightness != 0)
362 pxa_set_cken(CKEN_PWM0, 1);
363
364 PWM_CTRL0 = 0;
365 PWM_PWDUTY0 = brightness;
366 PWM_PERVAL0 = bl->props.max_brightness;
367
368 if (brightness == 0)
369 pxa_set_cken(CKEN_PWM0, 0);
370 return 0; /* pointless return value */
371}
372
373static int mainstone_backlight_get_brightness(struct backlight_device *bl)
374{
375 return PWM_PWDUTY0;
376}
377 353
378static /*const*/ struct backlight_ops mainstone_backlight_ops = { 354static struct platform_device mainstone_backlight_device = {
379 .update_status = mainstone_backlight_update_status, 355 .name = "pwm-backlight",
380 .get_brightness = mainstone_backlight_get_brightness, 356 .dev = {
357 .parent = &pxa27x_device_pwm0.dev,
358 .platform_data = &mainstone_backlight_data,
359 },
381}; 360};
382 361
383static void __init mainstone_backlight_register(void) 362static void __init mainstone_backlight_register(void)
384{ 363{
385 struct backlight_device *bl; 364 int ret = platform_device_register(&mainstone_backlight_device);
386 365 if (ret)
387 bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev, 366 printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret);
388 NULL, &mainstone_backlight_ops);
389 if (IS_ERR(bl)) {
390 printk(KERN_ERR "mainstone: unable to register backlight: %ld\n",
391 PTR_ERR(bl));
392 return;
393 }
394
395 /*
396 * broken design - register-then-setup interfaces are
397 * utterly broken by definition.
398 */
399 bl->props.max_brightness = 1023;
400 bl->props.brightness = 1023;
401 backlight_update_status(bl);
402} 367}
403#else 368#else
404#define mainstone_backlight_register() do { } while (0) 369#define mainstone_backlight_register() do { } while (0)
@@ -528,7 +493,6 @@ static struct platform_device mst_gpio_keys_device = {
528 493
529static struct platform_device *platform_devices[] __initdata = { 494static struct platform_device *platform_devices[] __initdata = {
530 &smc91x_device, 495 &smc91x_device,
531 &mst_audio_device,
532 &mst_flash_device[0], 496 &mst_flash_device[0],
533 &mst_flash_device[1], 497 &mst_flash_device[1],
534 &mst_gpio_keys_device, 498 &mst_gpio_keys_device,
@@ -638,6 +602,7 @@ static void __init mainstone_init(void)
638 pxa_set_ficp_info(&mainstone_ficp_platform_data); 602 pxa_set_ficp_info(&mainstone_ficp_platform_data);
639 pxa_set_ohci_info(&mainstone_ohci_platform_data); 603 pxa_set_ohci_info(&mainstone_ohci_platform_data);
640 pxa_set_i2c_info(NULL); 604 pxa_set_i2c_info(NULL);
605 pxa_set_ac97_info(&mst_audio_ops);
641 606
642 mainstone_init_keypad(); 607 mainstone_init_keypad();
643} 608}
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 22097a1707cc..d1cdb4ecb0b8 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/arch/hardware.h> 21#include <asm/arch/hardware.h>
22#include <asm/arch/pxa-regs.h> 22#include <asm/arch/pxa-regs.h>
23#include <asm/arch/pxa2xx-regs.h>
23#include <asm/arch/mfp-pxa2xx.h> 24#include <asm/arch/mfp-pxa2xx.h>
24 25
25#include "generic.h" 26#include "generic.h"
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 49d951db0f3d..5d87c7c866e4 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -24,6 +24,7 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/ide.h> 25#include <linux/ide.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/pwm_backlight.h>
27 28
28#include <media/soc_camera.h> 29#include <media/soc_camera.h>
29 30
@@ -33,12 +34,103 @@
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
34#include <asm/arch/pxa-regs.h> 35#include <asm/arch/pxa-regs.h>
35#include <asm/arch/pxa2xx-gpio.h> 36#include <asm/arch/pxa2xx-gpio.h>
37#include <asm/arch/audio.h>
36#include <asm/arch/mmc.h> 38#include <asm/arch/mmc.h>
37#include <asm/arch/ohci.h> 39#include <asm/arch/ohci.h>
38#include <asm/arch/pcm990_baseboard.h> 40#include <asm/arch/pcm990_baseboard.h>
41#include <asm/arch/pxafb.h>
42
43#include "devices.h"
39 44
40/* 45/*
41 * The PCM-990 development baseboard uses PCM-027's hardeware in the 46 * pcm990_lcd_power - control power supply to the LCD
47 * @on: 0 = switch off, 1 = switch on
48 *
49 * Called by the pxafb driver
50 */
51#ifndef CONFIG_PCM990_DISPLAY_NONE
52static void pcm990_lcd_power(int on, struct fb_var_screeninfo *var)
53{
54 if (on) {
55 /* enable LCD-Latches
56 * power on LCD
57 */
58 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) =
59 PCM990_CTRL_LCDPWR + PCM990_CTRL_LCDON;
60 } else {
61 /* disable LCD-Latches
62 * power off LCD
63 */
64 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = 0x00;
65 }
66}
67#endif
68
69#if defined(CONFIG_PCM990_DISPLAY_SHARP)
70static struct pxafb_mode_info fb_info_sharp_lq084v1dg21 = {
71 .pixclock = 28000,
72 .xres = 640,
73 .yres = 480,
74 .bpp = 16,
75 .hsync_len = 20,
76 .left_margin = 103,
77 .right_margin = 47,
78 .vsync_len = 6,
79 .upper_margin = 28,
80 .lower_margin = 5,
81 .sync = 0,
82 .cmap_greyscale = 0,
83};
84
85static struct pxafb_mach_info pcm990_fbinfo __initdata = {
86 .modes = &fb_info_sharp_lq084v1dg21,
87 .num_modes = 1,
88 .lccr0 = LCCR0_PAS,
89 .lccr3 = LCCR3_PCP,
90 .pxafb_lcd_power = pcm990_lcd_power,
91};
92#elif defined(CONFIG_PCM990_DISPLAY_NEC)
93struct pxafb_mode_info fb_info_nec_nl6448bc20_18d = {
94 .pixclock = 39720,
95 .xres = 640,
96 .yres = 480,
97 .bpp = 16,
98 .hsync_len = 32,
99 .left_margin = 16,
100 .right_margin = 48,
101 .vsync_len = 2,
102 .upper_margin = 12,
103 .lower_margin = 17,
104 .sync = 0,
105 .cmap_greyscale = 0,
106};
107
108static struct pxafb_mach_info pcm990_fbinfo __initdata = {
109 .modes = &fb_info_nec_nl6448bc20_18d,
110 .num_modes = 1,
111 .lccr0 = LCCR0_Act,
112 .lccr3 = LCCR3_PixFlEdg,
113 .pxafb_lcd_power = pcm990_lcd_power,
114};
115#endif
116
117static struct platform_pwm_backlight_data pcm990_backlight_data = {
118 .pwm_id = 0,
119 .max_brightness = 1023,
120 .dft_brightness = 1023,
121 .pwm_period_ns = 78770,
122};
123
124static struct platform_device pcm990_backlight_device = {
125 .name = "pwm-backlight",
126 .dev = {
127 .parent = &pxa27x_device_pwm0.dev,
128 .platform_data = &pcm990_backlight_data,
129 },
130};
131
132/*
133 * The PCM-990 development baseboard uses PCM-027's hardware in the
42 * following way: 134 * following way:
43 * 135 *
44 * - LCD support is in use 136 * - LCD support is in use
@@ -333,36 +425,6 @@ static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
333#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ 425#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */
334 426
335/* 427/*
336 * AC97 support
337 * Note: The connected AC97 mixer also reports interrupts at PCM990_AC97_IRQ
338 */
339static struct resource pxa27x_ac97_resources[] = {
340 [0] = {
341 .start = 0x40500000,
342 .end = 0x40500000 + 0xfff,
343 .flags = IORESOURCE_MEM,
344 },
345 [1] = {
346 .start = IRQ_AC97,
347 .end = IRQ_AC97,
348 .flags = IORESOURCE_IRQ,
349 },
350};
351
352static u64 pxa_ac97_dmamask = 0xffffffffUL;
353
354static struct platform_device pxa27x_device_ac97 = {
355 .name = "pxa2xx-ac97",
356 .id = -1,
357 .dev = {
358 .dma_mask = &pxa_ac97_dmamask,
359 .coherent_dma_mask = 0xffffffff,
360 },
361 .num_resources = ARRAY_SIZE(pxa27x_ac97_resources),
362 .resource = pxa27x_ac97_resources,
363};
364
365/*
366 * enable generic access to the base board control CPLDs U6 and U7 428 * enable generic access to the base board control CPLDs U6 and U7
367 */ 429 */
368static struct map_desc pcm990_io_desc[] __initdata = { 430static struct map_desc pcm990_io_desc[] __initdata = {
@@ -393,7 +455,11 @@ void __init pcm990_baseboard_init(void)
393 /* register CPLD's IRQ controller */ 455 /* register CPLD's IRQ controller */
394 pcm990_init_irq(); 456 pcm990_init_irq();
395 457
396 platform_device_register(&pxa27x_device_ac97); 458#ifndef CONFIG_PCM990_DISPLAY_NONE
459 set_pxa_fb_info(&pcm990_fbinfo);
460#endif
461 pxa_gpio_mode(GPIO16_PWM0_MD);
462 platform_device_register(&pcm990_backlight_device);
397 463
398 /* MMC */ 464 /* MMC */
399 pxa_set_mci_info(&pcm990_mci_platform_data); 465 pxa_set_mci_info(&pcm990_mci_platform_data);
@@ -402,6 +468,7 @@ void __init pcm990_baseboard_init(void)
402 pxa_set_ohci_info(&pcm990_ohci_platform_data); 468 pxa_set_ohci_info(&pcm990_ohci_platform_data);
403 469
404 pxa_set_i2c_info(NULL); 470 pxa_set_i2c_info(NULL);
471 pxa_set_ac97_info(NULL);
405 472
406#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) 473#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
407 pxa_set_camera_info(&pcm990_pxacamera_platform_data); 474 pxa_set_camera_info(&pcm990_pxacamera_platform_data);
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 0b30f25cff3c..f81c10cafd48 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -32,6 +32,7 @@
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34#include <asm/arch/pxa-regs.h> 34#include <asm/arch/pxa-regs.h>
35#include <asm/arch/pxa2xx-regs.h>
35#include <asm/arch/pxa2xx-gpio.h> 36#include <asm/arch/pxa2xx-gpio.h>
36#include <asm/arch/mmc.h> 37#include <asm/arch/mmc.h>
37#include <asm/arch/udc.h> 38#include <asm/arch/udc.h>
diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c
new file mode 100644
index 000000000000..ce28cd9fed16
--- /dev/null
+++ b/arch/arm/mach-pxa/pwm.c
@@ -0,0 +1,319 @@
1/*
2 * linux/arch/arm/mach-pxa/pwm.c
3 *
4 * simple driver for PWM (Pulse Width Modulator) controller
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * 2008-02-13 initial version
11 * eric miao <eric.miao@marvell.com>
12 */
13
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/platform_device.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20#include <linux/pwm.h>
21
22#include <asm/div64.h>
23#include <asm/arch/pxa-regs.h>
24
25/* PWM registers and bits definitions */
26#define PWMCR (0x00)
27#define PWMDCR (0x04)
28#define PWMPCR (0x08)
29
30#define PWMCR_SD (1 << 6)
31#define PWMDCR_FD (1 << 10)
32
33struct pwm_device {
34 struct list_head node;
35 struct platform_device *pdev;
36
37 const char *label;
38 struct clk *clk;
39 int clk_enabled;
40 void __iomem *mmio_base;
41
42 unsigned int use_count;
43 unsigned int pwm_id;
44};
45
46/*
47 * period_ns = 10^9 * (PRESCALE + 1) * (PV + 1) / PWM_CLK_RATE
48 * duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE
49 */
50int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
51{
52 unsigned long long c;
53 unsigned long period_cycles, prescale, pv, dc;
54
55 if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
56 return -EINVAL;
57
58 c = clk_get_rate(pwm->clk);
59 c = c * period_ns;
60 do_div(c, 1000000000);
61 period_cycles = c;
62
63 if (period_cycles < 0)
64 period_cycles = 1;
65 prescale = (period_cycles - 1) / 1024;
66 pv = period_cycles / (prescale + 1) - 1;
67
68 if (prescale > 63)
69 return -EINVAL;
70
71 if (duty_ns == period_ns)
72 dc = PWMDCR_FD;
73 else
74 dc = (pv + 1) * duty_ns / period_ns;
75
76 /* NOTE: the clock to PWM has to be enabled first
77 * before writing to the registers
78 */
79 clk_enable(pwm->clk);
80 __raw_writel(prescale, pwm->mmio_base + PWMCR);
81 __raw_writel(dc, pwm->mmio_base + PWMDCR);
82 __raw_writel(pv, pwm->mmio_base + PWMPCR);
83 clk_disable(pwm->clk);
84
85 return 0;
86}
87EXPORT_SYMBOL(pwm_config);
88
89int pwm_enable(struct pwm_device *pwm)
90{
91 int rc = 0;
92
93 if (!pwm->clk_enabled) {
94 rc = clk_enable(pwm->clk);
95 if (!rc)
96 pwm->clk_enabled = 1;
97 }
98 return rc;
99}
100EXPORT_SYMBOL(pwm_enable);
101
102void pwm_disable(struct pwm_device *pwm)
103{
104 if (pwm->clk_enabled) {
105 clk_disable(pwm->clk);
106 pwm->clk_enabled = 0;
107 }
108}
109EXPORT_SYMBOL(pwm_disable);
110
111static DEFINE_MUTEX(pwm_lock);
112static LIST_HEAD(pwm_list);
113
114struct pwm_device *pwm_request(int pwm_id, const char *label)
115{
116 struct pwm_device *pwm;
117 int found = 0;
118
119 mutex_lock(&pwm_lock);
120
121 list_for_each_entry(pwm, &pwm_list, node) {
122 if (pwm->pwm_id == pwm_id) {
123 found = 1;
124 break;
125 }
126 }
127
128 if (found) {
129 if (pwm->use_count == 0) {
130 pwm->use_count++;
131 pwm->label = label;
132 } else
133 pwm = ERR_PTR(-EBUSY);
134 } else
135 pwm = ERR_PTR(-ENOENT);
136
137 mutex_unlock(&pwm_lock);
138 return pwm;
139}
140EXPORT_SYMBOL(pwm_request);
141
142void pwm_free(struct pwm_device *pwm)
143{
144 mutex_lock(&pwm_lock);
145
146 if (pwm->use_count) {
147 pwm->use_count--;
148 pwm->label = NULL;
149 } else
150 pr_warning("PWM device already freed\n");
151
152 mutex_unlock(&pwm_lock);
153}
154EXPORT_SYMBOL(pwm_free);
155
156static inline void __add_pwm(struct pwm_device *pwm)
157{
158 mutex_lock(&pwm_lock);
159 list_add_tail(&pwm->node, &pwm_list);
160 mutex_unlock(&pwm_lock);
161}
162
163static struct pwm_device *pwm_probe(struct platform_device *pdev,
164 unsigned int pwm_id, struct pwm_device *parent_pwm)
165{
166 struct pwm_device *pwm;
167 struct resource *r;
168 int ret = 0;
169
170 pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL);
171 if (pwm == NULL) {
172 dev_err(&pdev->dev, "failed to allocate memory\n");
173 return ERR_PTR(-ENOMEM);
174 }
175
176 pwm->clk = clk_get(&pdev->dev, "PWMCLK");
177 if (IS_ERR(pwm->clk)) {
178 ret = PTR_ERR(pwm->clk);
179 goto err_free;
180 }
181 pwm->clk_enabled = 0;
182
183 pwm->use_count = 0;
184 pwm->pwm_id = pwm_id;
185 pwm->pdev = pdev;
186
187 if (parent_pwm != NULL) {
188 /* registers for the second PWM has offset of 0x10 */
189 pwm->mmio_base = parent_pwm->mmio_base + 0x10;
190 __add_pwm(pwm);
191 return pwm;
192 }
193
194 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
195 if (r == NULL) {
196 dev_err(&pdev->dev, "no memory resource defined\n");
197 ret = -ENODEV;
198 goto err_free_clk;
199 }
200
201 r = request_mem_region(r->start, r->end - r->start + 1, pdev->name);
202 if (r == NULL) {
203 dev_err(&pdev->dev, "failed to request memory resource\n");
204 ret = -EBUSY;
205 goto err_free_clk;
206 }
207
208 pwm->mmio_base = ioremap(r->start, r->end - r->start + 1);
209 if (pwm->mmio_base == NULL) {
210 dev_err(&pdev->dev, "failed to ioremap() registers\n");
211 ret = -ENODEV;
212 goto err_free_mem;
213 }
214
215 __add_pwm(pwm);
216 platform_set_drvdata(pdev, pwm);
217 return pwm;
218
219err_free_mem:
220 release_mem_region(r->start, r->end - r->start + 1);
221err_free_clk:
222 clk_put(pwm->clk);
223err_free:
224 kfree(pwm);
225 return ERR_PTR(ret);
226}
227
228static int __devinit pxa25x_pwm_probe(struct platform_device *pdev)
229{
230 struct pwm_device *pwm = pwm_probe(pdev, pdev->id, NULL);
231
232 if (IS_ERR(pwm))
233 return PTR_ERR(pwm);
234
235 return 0;
236}
237
238static int __devinit pxa27x_pwm_probe(struct platform_device *pdev)
239{
240 struct pwm_device *pwm;
241
242 pwm = pwm_probe(pdev, pdev->id, NULL);
243 if (IS_ERR(pwm))
244 return PTR_ERR(pwm);
245
246 pwm = pwm_probe(pdev, pdev->id + 2, pwm);
247 if (IS_ERR(pwm))
248 return PTR_ERR(pwm);
249
250 return 0;
251}
252
253static int __devexit pwm_remove(struct platform_device *pdev)
254{
255 struct pwm_device *pwm;
256 struct resource *r;
257
258 pwm = platform_get_drvdata(pdev);
259 if (pwm == NULL)
260 return -ENODEV;
261
262 mutex_lock(&pwm_lock);
263 list_del(&pwm->node);
264 mutex_unlock(&pwm_lock);
265
266 iounmap(pwm->mmio_base);
267
268 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
269 release_mem_region(r->start, r->end - r->start + 1);
270
271 clk_put(pwm->clk);
272 kfree(pwm);
273 return 0;
274}
275
276static struct platform_driver pxa25x_pwm_driver = {
277 .driver = {
278 .name = "pxa25x-pwm",
279 },
280 .probe = pxa25x_pwm_probe,
281 .remove = __devexit_p(pwm_remove),
282};
283
284static struct platform_driver pxa27x_pwm_driver = {
285 .driver = {
286 .name = "pxa27x-pwm",
287 },
288 .probe = pxa27x_pwm_probe,
289 .remove = __devexit_p(pwm_remove),
290};
291
292static int __init pwm_init(void)
293{
294 int ret = 0;
295
296 ret = platform_driver_register(&pxa25x_pwm_driver);
297 if (ret) {
298 printk(KERN_ERR "failed to register pxa25x_pwm_driver\n");
299 return ret;
300 }
301
302 ret = platform_driver_register(&pxa27x_pwm_driver);
303 if (ret) {
304 printk(KERN_ERR "failed to register pxa27x_pwm_driver\n");
305 return ret;
306 }
307
308 return ret;
309}
310arch_initcall(pwm_init);
311
312static void __exit pwm_exit(void)
313{
314 platform_driver_unregister(&pxa25x_pwm_driver);
315 platform_driver_unregister(&pxa27x_pwm_driver);
316}
317module_exit(pwm_exit);
318
319MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index e5b417d14bb0..4cd50e3005e9 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -26,6 +26,7 @@
26#include <asm/hardware.h> 26#include <asm/hardware.h>
27#include <asm/arch/irqs.h> 27#include <asm/arch/irqs.h>
28#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h>
29#include <asm/arch/mfp-pxa25x.h> 30#include <asm/arch/mfp-pxa25x.h>
30#include <asm/arch/pm.h> 31#include <asm/arch/pm.h>
31#include <asm/arch/dma.h> 32#include <asm/arch/dma.h>
@@ -117,29 +118,35 @@ static struct clk pxa25x_hwuart_clk =
117 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev) 118 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev)
118; 119;
119 120
121/*
122 * PXA 2xx clock declarations. Order is important (see aliases below)
123 * Please be careful not to disrupt the ordering.
124 */
120static struct clk pxa25x_clks[] = { 125static struct clk pxa25x_clks[] = {
121 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev), 126 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
122 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev), 127 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
123 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev), 128 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
124 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL), 129 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
125 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev), 130 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev),
126 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev), 131 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
127 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev), 132 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
128 133
129 INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev), 134 INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev),
130 INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev), 135 INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev),
131 INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev), 136 INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev),
137 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, &pxa25x_device_pwm0.dev),
138 INIT_CKEN("PWMCLK", PWM1, 3686400, 0, &pxa25x_device_pwm1.dev),
132 139
133 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 140 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL),
134 141
135 /* 142 /*
136 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
137 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
138 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL), 143 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL),
139 */ 144 */
140 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), 145 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
141}; 146};
142 147
148static struct clk gpio7_clk = INIT_CKOTHER("GPIO7_CK", &pxa25x_clks[4], NULL);
149
143#ifdef CONFIG_PM 150#ifdef CONFIG_PM
144 151
145#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x 152#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
@@ -260,7 +267,7 @@ void __init pxa25x_init_irq(void)
260} 267}
261 268
262static struct platform_device *pxa25x_devices[] __initdata = { 269static struct platform_device *pxa25x_devices[] __initdata = {
263 &pxa_device_udc, 270 &pxa25x_device_udc,
264 &pxa_device_ffuart, 271 &pxa_device_ffuart,
265 &pxa_device_btuart, 272 &pxa_device_btuart,
266 &pxa_device_stuart, 273 &pxa_device_stuart,
@@ -269,6 +276,8 @@ static struct platform_device *pxa25x_devices[] __initdata = {
269 &pxa25x_device_ssp, 276 &pxa25x_device_ssp,
270 &pxa25x_device_nssp, 277 &pxa25x_device_nssp,
271 &pxa25x_device_assp, 278 &pxa25x_device_assp,
279 &pxa25x_device_pwm0,
280 &pxa25x_device_pwm1,
272}; 281};
273 282
274static struct sys_device pxa25x_sysdev[] = { 283static struct sys_device pxa25x_sysdev[] = {
@@ -311,6 +320,8 @@ static int __init pxa25x_init(void)
311 if (cpu_is_pxa25x()) 320 if (cpu_is_pxa25x())
312 ret = platform_device_register(&pxa_device_hwuart); 321 ret = platform_device_register(&pxa_device_hwuart);
313 322
323 clks_register(&gpio7_clk, 1);
324
314 return ret; 325 return ret;
315} 326}
316 327
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 7e945836e129..d5d14ea33f27 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -146,7 +146,7 @@ static struct clk pxa27x_clks[] = {
146 146
147 INIT_CKEN("I2SCLK", I2S, 14682000, 0, &pxa_device_i2s.dev), 147 INIT_CKEN("I2SCLK", I2S, 14682000, 0, &pxa_device_i2s.dev),
148 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 148 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
149 INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa_device_udc.dev), 149 INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa27x_device_udc.dev),
150 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev), 150 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev),
151 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev), 151 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev),
152 152
@@ -157,12 +157,13 @@ static struct clk pxa27x_clks[] = {
157 INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), 157 INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev),
158 INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 158 INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
159 INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 159 INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev),
160 INIT_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
161 INIT_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
160 162
161 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 163 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL),
162 INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL), 164 INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL),
163 165
164 /* 166 /*
165 INIT_CKEN("PWMCLK", PWM0, 13000000, 0, NULL),
166 INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL), 167 INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL),
167 INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL), 168 INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL),
168 INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL), 169 INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL),
@@ -349,11 +350,14 @@ struct platform_device pxa27x_device_i2c_power = {
349 350
350void __init pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info) 351void __init pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info)
351{ 352{
353 local_irq_disable();
354 PCFR |= PCFR_PI2CEN;
355 local_irq_enable();
352 pxa27x_device_i2c_power.dev.platform_data = info; 356 pxa27x_device_i2c_power.dev.platform_data = info;
353} 357}
354 358
355static struct platform_device *devices[] __initdata = { 359static struct platform_device *devices[] __initdata = {
356 &pxa_device_udc, 360 &pxa27x_device_udc,
357 &pxa_device_ffuart, 361 &pxa_device_ffuart,
358 &pxa_device_btuart, 362 &pxa_device_btuart,
359 &pxa_device_stuart, 363 &pxa_device_stuart,
@@ -363,6 +367,8 @@ static struct platform_device *devices[] __initdata = {
363 &pxa27x_device_ssp1, 367 &pxa27x_device_ssp1,
364 &pxa27x_device_ssp2, 368 &pxa27x_device_ssp2,
365 &pxa27x_device_ssp3, 369 &pxa27x_device_ssp3,
370 &pxa27x_device_pwm0,
371 &pxa27x_device_pwm1,
366}; 372};
367 373
368static struct sys_device pxa27x_sysdev[] = { 374static struct sys_device pxa27x_sysdev[] = {
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
new file mode 100644
index 000000000000..d4f6415e8413
--- /dev/null
+++ b/arch/arm/mach-pxa/pxa2xx.c
@@ -0,0 +1,46 @@
1/*
2 * linux/arch/arm/mach-pxa/pxa2xx.c
3 *
4 * code specific to pxa2xx
5 *
6 * Copyright (C) 2008 Dmitry Baryshkov
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/device.h>
16
17#include <asm/arch/mfp-pxa2xx.h>
18#include <asm/arch/mfp-pxa25x.h>
19#include <asm/arch/irda.h>
20
21static unsigned long pxa2xx_mfp_fir[] = {
22 GPIO46_FICP_RXD,
23 GPIO47_FICP_TXD,
24};
25
26static unsigned long pxa2xx_mfp_sir[] = {
27 GPIO46_STUART_RXD,
28 GPIO47_STUART_TXD,
29};
30
31static unsigned long pxa2xx_mfp_off[] = {
32 GPIO46_GPIO | MFP_LPM_DRIVE_LOW,
33 GPIO47_GPIO | MFP_LPM_DRIVE_LOW,
34};
35
36void pxa2xx_transceiver_mode(struct device *dev, int mode)
37{
38 if (mode & IR_OFF) {
39 pxa2xx_mfp_config(pxa2xx_mfp_off, ARRAY_SIZE(pxa2xx_mfp_off));
40 } else if (mode & IR_SIRMODE) {
41 pxa2xx_mfp_config(pxa2xx_mfp_sir, ARRAY_SIZE(pxa2xx_mfp_sir));
42 } else if (mode & IR_FIRMODE) {
43 pxa2xx_mfp_config(pxa2xx_mfp_fir, ARRAY_SIZE(pxa2xx_mfp_fir));
44 } else
45 BUG();
46}
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 644550bfa330..15685d2b8f8c 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -231,7 +231,7 @@ static struct clk pxa3xx_clks[] = {
231 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL), 231 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
232 232
233 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 233 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
234 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), 234 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa27x_device_udc.dev),
235 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev), 235 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev),
236 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), 236 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
237 237
@@ -239,6 +239,8 @@ static struct clk pxa3xx_clks[] = {
239 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 239 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
240 PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 240 PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev),
241 PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev), 241 PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev),
242 PXA3xx_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
243 PXA3xx_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
242 244
243 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev), 245 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev),
244 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev), 246 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev),
@@ -520,7 +522,7 @@ void __init pxa3xx_init_irq(void)
520 */ 522 */
521 523
522static struct platform_device *devices[] __initdata = { 524static struct platform_device *devices[] __initdata = {
523 &pxa_device_udc, 525/* &pxa_device_udc, The UDC driver is PXA25x only */
524 &pxa_device_ffuart, 526 &pxa_device_ffuart,
525 &pxa_device_btuart, 527 &pxa_device_btuart,
526 &pxa_device_stuart, 528 &pxa_device_stuart,
@@ -530,6 +532,8 @@ static struct platform_device *devices[] __initdata = {
530 &pxa27x_device_ssp2, 532 &pxa27x_device_ssp2,
531 &pxa27x_device_ssp3, 533 &pxa27x_device_ssp3,
532 &pxa3xx_device_ssp4, 534 &pxa3xx_device_ssp4,
535 &pxa27x_device_pwm0,
536 &pxa27x_device_pwm1,
533}; 537};
534 538
535static struct sys_device pxa3xx_sysdev[] = { 539static struct sys_device pxa3xx_sysdev[] = {
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 23f050feb208..360354084ae4 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -26,6 +26,7 @@
26#include <asm/arch/sharpsl.h> 26#include <asm/arch/sharpsl.h>
27#include <asm/arch/spitz.h> 27#include <asm/arch/spitz.h>
28#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h>
29#include <asm/arch/pxa2xx-gpio.h> 30#include <asm/arch/pxa2xx-gpio.h>
30#include "sharpsl.h" 31#include "sharpsl.h"
31 32
@@ -207,7 +208,9 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = {
207 .read_devdata = spitzpm_read_devdata, 208 .read_devdata = spitzpm_read_devdata,
208 .charger_wakeup = spitz_charger_wakeup, 209 .charger_wakeup = spitz_charger_wakeup,
209 .should_wakeup = spitz_should_wakeup, 210 .should_wakeup = spitz_should_wakeup,
211#ifdef CONFIG_BACKLIGHT_CORGI
210 .backlight_limit = corgibl_limit_intensity, 212 .backlight_limit = corgibl_limit_intensity,
213#endif
211 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, 214 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
212 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, 215 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP,
213 .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH, 216 .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH,
@@ -229,6 +232,10 @@ static int __devinit spitzpm_init(void)
229{ 232{
230 int ret; 233 int ret;
231 234
235 if (!machine_is_spitz() && !machine_is_akita()
236 && !machine_is_borzoi())
237 return -ENODEV;
238
232 spitzpm_device = platform_device_alloc("sharpsl-pm", -1); 239 spitzpm_device = platform_device_alloc("sharpsl-pm", -1);
233 if (!spitzpm_device) 240 if (!spitzpm_device)
234 return -ENOMEM; 241 return -ENOMEM;
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 00af7f2fed66..0bb31982fb6f 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -330,7 +330,7 @@ struct ssp_device *ssp_request(int port, const char *label)
330 330
331 mutex_unlock(&ssp_lock); 331 mutex_unlock(&ssp_lock);
332 332
333 if (ssp->port_id != port) 333 if (&ssp->node == &ssp_list)
334 return NULL; 334 return NULL;
335 335
336 return ssp; 336 return ssp;
diff --git a/arch/arm/mach-pxa/standby.S b/arch/arm/mach-pxa/standby.S
index 167412e6bec8..40bb70eff3fe 100644
--- a/arch/arm/mach-pxa/standby.S
+++ b/arch/arm/mach-pxa/standby.S
@@ -14,6 +14,7 @@
14#include <asm/hardware.h> 14#include <asm/hardware.h>
15 15
16#include <asm/arch/pxa-regs.h> 16#include <asm/arch/pxa-regs.h>
17#include <asm/arch/pxa2xx-regs.h>
17 18
18 .text 19 .text
19 20
@@ -35,20 +36,20 @@ ENTRY(pxa_cpu_standby)
35 36
36#ifdef CONFIG_PXA3xx 37#ifdef CONFIG_PXA3xx
37 38
38#define MDCNFG 0x0000 39#define PXA3_MDCNFG 0x0000
39#define MDCNFG_DMCEN (1 << 30) 40#define PXA3_MDCNFG_DMCEN (1 << 30)
40#define DDR_HCAL 0x0060 41#define PXA3_DDR_HCAL 0x0060
41#define DDR_HCAL_HCRNG 0x1f 42#define PXA3_DDR_HCAL_HCRNG 0x1f
42#define DDR_HCAL_HCPROG (1 << 28) 43#define PXA3_DDR_HCAL_HCPROG (1 << 28)
43#define DDR_HCAL_HCEN (1 << 31) 44#define PXA3_DDR_HCAL_HCEN (1 << 31)
44#define DMCIER 0x0070 45#define PXA3_DMCIER 0x0070
45#define DMCIER_EDLP (1 << 29) 46#define PXA3_DMCIER_EDLP (1 << 29)
46#define DMCISR 0x0078 47#define PXA3_DMCISR 0x0078
47#define RCOMP 0x0100 48#define PXA3_RCOMP 0x0100
48#define RCOMP_SWEVAL (1 << 31) 49#define PXA3_RCOMP_SWEVAL (1 << 31)
49 50
50ENTRY(pm_enter_standby_start) 51ENTRY(pm_enter_standby_start)
51 mov r1, #0xf6000000 @ DMEMC_REG_BASE (MDCNFG) 52 mov r1, #0xf6000000 @ DMEMC_REG_BASE (PXA3_MDCNFG)
52 add r1, r1, #0x00100000 53 add r1, r1, #0x00100000
53 54
54 /* 55 /*
@@ -59,54 +60,54 @@ ENTRY(pm_enter_standby_start)
59 * This also means that only the dynamic memory controller 60 * This also means that only the dynamic memory controller
60 * can be reliably accessed in the code following standby. 61 * can be reliably accessed in the code following standby.
61 */ 62 */
62 ldr r2, [r1] @ Dummy read MDCNFG 63 ldr r2, [r1] @ Dummy read PXA3_MDCNFG
63 64
64 mcr p14, 0, r0, c7, c0, 0 65 mcr p14, 0, r0, c7, c0, 0
65 .rept 8 66 .rept 8
66 nop 67 nop
67 .endr 68 .endr
68 69
69 ldr r0, [r1, #DDR_HCAL] @ Clear (and wait for) HCEN 70 ldr r0, [r1, #PXA3_DDR_HCAL] @ Clear (and wait for) HCEN
70 bic r0, r0, #DDR_HCAL_HCEN 71 bic r0, r0, #PXA3_DDR_HCAL_HCEN
71 str r0, [r1, #DDR_HCAL] 72 str r0, [r1, #PXA3_DDR_HCAL]
721: ldr r0, [r1, #DDR_HCAL] 731: ldr r0, [r1, #PXA3_DDR_HCAL]
73 tst r0, #DDR_HCAL_HCEN 74 tst r0, #PXA3_DDR_HCAL_HCEN
74 bne 1b 75 bne 1b
75 76
76 ldr r0, [r1, #RCOMP] @ Initiate RCOMP 77 ldr r0, [r1, #PXA3_RCOMP] @ Initiate RCOMP
77 orr r0, r0, #RCOMP_SWEVAL 78 orr r0, r0, #PXA3_RCOMP_SWEVAL
78 str r0, [r1, #RCOMP] 79 str r0, [r1, #PXA3_RCOMP]
79 80
80 mov r0, #~0 @ Clear interrupts 81 mov r0, #~0 @ Clear interrupts
81 str r0, [r1, #DMCISR] 82 str r0, [r1, #PXA3_DMCISR]
82 83
83 ldr r0, [r1, #DMCIER] @ set DMIER[EDLP] 84 ldr r0, [r1, #PXA3_DMCIER] @ set DMIER[EDLP]
84 orr r0, r0, #DMCIER_EDLP 85 orr r0, r0, #PXA3_DMCIER_EDLP
85 str r0, [r1, #DMCIER] 86 str r0, [r1, #PXA3_DMCIER]
86 87
87 ldr r0, [r1, #DDR_HCAL] @ clear HCRNG, set HCPROG, HCEN 88 ldr r0, [r1, #PXA3_DDR_HCAL] @ clear HCRNG, set HCPROG, HCEN
88 bic r0, r0, #DDR_HCAL_HCRNG 89 bic r0, r0, #PXA3_DDR_HCAL_HCRNG
89 orr r0, r0, #DDR_HCAL_HCEN | DDR_HCAL_HCPROG 90 orr r0, r0, #PXA3_DDR_HCAL_HCEN | PXA3_DDR_HCAL_HCPROG
90 str r0, [r1, #DDR_HCAL] 91 str r0, [r1, #PXA3_DDR_HCAL]
91 92
921: ldr r0, [r1, #DMCISR] 931: ldr r0, [r1, #PXA3_DMCISR]
93 tst r0, #DMCIER_EDLP 94 tst r0, #PXA3_DMCIER_EDLP
94 beq 1b 95 beq 1b
95 96
96 ldr r0, [r1, #MDCNFG] @ set MDCNFG[DMCEN] 97 ldr r0, [r1, #PXA3_MDCNFG] @ set PXA3_MDCNFG[DMCEN]
97 orr r0, r0, #MDCNFG_DMCEN 98 orr r0, r0, #PXA3_MDCNFG_DMCEN
98 str r0, [r1, #MDCNFG] 99 str r0, [r1, #PXA3_MDCNFG]
991: ldr r0, [r1, #MDCNFG] 1001: ldr r0, [r1, #PXA3_MDCNFG]
100 tst r0, #MDCNFG_DMCEN 101 tst r0, #PXA3_MDCNFG_DMCEN
101 beq 1b 102 beq 1b
102 103
103 ldr r0, [r1, #DDR_HCAL] @ set DDR_HCAL[HCRNG] 104 ldr r0, [r1, #PXA3_DDR_HCAL] @ set PXA3_DDR_HCAL[HCRNG]
104 orr r0, r0, #2 @ HCRNG 105 orr r0, r0, #2 @ HCRNG
105 str r0, [r1, #DDR_HCAL] 106 str r0, [r1, #PXA3_DDR_HCAL]
106 107
107 ldr r0, [r1, #DMCIER] @ Clear the interrupt 108 ldr r0, [r1, #PXA3_DMCIER] @ Clear the interrupt
108 bic r0, r0, #0x20000000 109 bic r0, r0, #0x20000000
109 str r0, [r1, #DMCIER] 110 str r0, [r1, #PXA3_DMCIER]
110 111
111 mov pc, lr 112 mov pc, lr
112ENTRY(pm_enter_standby_end) 113ENTRY(pm_enter_standby_end)
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index c2cbd66db814..ab4a9f579913 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -467,8 +467,8 @@ static struct platform_device *devices[] __initdata = {
467 467
468static void tosa_poweroff(void) 468static void tosa_poweroff(void)
469{ 469{
470 pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_OUT); 470 gpio_direction_output(TOSA_GPIO_ON_RESET, 0);
471 GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET); 471 gpio_set_value(TOSA_GPIO_ON_RESET, 1);
472 472
473 mdelay(1000); 473 mdelay(1000);
474 arm_machine_restart('h'); 474 arm_machine_restart('h');
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 931885d86b91..61e244023089 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -41,6 +41,7 @@
41#include <asm/mach/flash.h> 41#include <asm/mach/flash.h>
42 42
43#include <asm/arch/pxa-regs.h> 43#include <asm/arch/pxa-regs.h>
44#include <asm/arch/pxa2xx-regs.h>
44#include <asm/arch/pxa2xx-gpio.h> 45#include <asm/arch/pxa2xx-gpio.h>
45#include <asm/arch/trizeps4.h> 46#include <asm/arch/trizeps4.h>
46#include <asm/arch/audio.h> 47#include <asm/arch/audio.h>
@@ -175,19 +176,10 @@ static struct platform_device uart_devices = {
175 .resource = NULL, 176 .resource = NULL,
176}; 177};
177 178
178/********************************************************************************************
179 * PXA270 ac97 sound codec
180 ********************************************************************************************/
181static struct platform_device ac97_audio_device = {
182 .name = "pxa2xx-ac97",
183 .id = -1,
184};
185
186static struct platform_device * trizeps4_devices[] __initdata = { 179static struct platform_device * trizeps4_devices[] __initdata = {
187 &flash_device, 180 &flash_device,
188 &uart_devices, 181 &uart_devices,
189 &dm9000_device, 182 &dm9000_device,
190 &ac97_audio_device,
191}; 183};
192 184
193#ifdef CONFIG_MACH_TRIZEPS4_CONXS 185#ifdef CONFIG_MACH_TRIZEPS4_CONXS
@@ -438,6 +430,7 @@ static void __init trizeps4_init(void)
438 pxa_set_mci_info(&trizeps4_mci_platform_data); 430 pxa_set_mci_info(&trizeps4_mci_platform_data);
439 pxa_set_ficp_info(&trizeps4_ficp_platform_data); 431 pxa_set_ficp_info(&trizeps4_ficp_platform_data);
440 pxa_set_ohci_info(&trizeps4_ohci_platform_data); 432 pxa_set_ohci_info(&trizeps4_ohci_platform_data);
433 pxa_set_ac97_info(NULL);
441} 434}
442 435
443static void __init trizeps4_map_io(void) 436static void __init trizeps4_map_io(void)
@@ -487,6 +480,7 @@ static void __init trizeps4_map_io(void)
487 ConXS_BCR = trizeps_conxs_bcr; 480 ConXS_BCR = trizeps_conxs_bcr;
488#endif 481#endif
489 482
483#warning FIXME - accessing PM registers directly is deprecated
490 PWER = 0x00000002; 484 PWER = 0x00000002;
491 PFER = 0x00000000; 485 PFER = 0x00000000;
492 PRER = 0x00000002; 486 PRER = 0x00000002;
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 4a0028087ea6..66b446ca273d 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -18,22 +18,24 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/pwm_backlight.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/hardware.h> 25#include <asm/hardware.h>
26#include <asm/arch/audio.h>
25#include <asm/arch/gpio.h> 27#include <asm/arch/gpio.h>
26#include <asm/arch/pxafb.h> 28#include <asm/arch/pxafb.h>
27#include <asm/arch/zylonite.h> 29#include <asm/arch/zylonite.h>
28#include <asm/arch/mmc.h> 30#include <asm/arch/mmc.h>
29#include <asm/arch/pxa27x_keypad.h> 31#include <asm/arch/pxa27x_keypad.h>
30 32
33#include "devices.h"
31#include "generic.h" 34#include "generic.h"
32 35
33#define MAX_SLOTS 3 36#define MAX_SLOTS 3
34struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; 37struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
35 38
36int gpio_backlight;
37int gpio_eth_irq; 39int gpio_eth_irq;
38 40
39int wm9713_irq; 41int wm9713_irq;
@@ -62,10 +64,20 @@ static struct platform_device smc91x_device = {
62}; 64};
63 65
64#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) 66#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
65static void zylonite_backlight_power(int on) 67static struct platform_pwm_backlight_data zylonite_backlight_data = {
66{ 68 .pwm_id = 3,
67 gpio_set_value(gpio_backlight, on); 69 .max_brightness = 100,
68} 70 .dft_brightness = 100,
71 .pwm_period_ns = 10000,
72};
73
74static struct platform_device zylonite_backlight_device = {
75 .name = "pwm-backlight",
76 .dev = {
77 .parent = &pxa27x_device_pwm1.dev,
78 .platform_data = &zylonite_backlight_data,
79 },
80};
69 81
70static struct pxafb_mode_info toshiba_ltm035a776c_mode = { 82static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
71 .pixclock = 110000, 83 .pixclock = 110000,
@@ -98,7 +110,6 @@ static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
98static struct pxafb_mach_info zylonite_toshiba_lcd_info = { 110static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
99 .num_modes = 1, 111 .num_modes = 1,
100 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 112 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
101 .pxafb_backlight_power = zylonite_backlight_power,
102}; 113};
103 114
104static struct pxafb_mode_info sharp_ls037_modes[] = { 115static struct pxafb_mode_info sharp_ls037_modes[] = {
@@ -134,13 +145,11 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = {
134 .modes = sharp_ls037_modes, 145 .modes = sharp_ls037_modes,
135 .num_modes = 2, 146 .num_modes = 2,
136 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 147 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
137 .pxafb_backlight_power = zylonite_backlight_power,
138}; 148};
139 149
140static void __init zylonite_init_lcd(void) 150static void __init zylonite_init_lcd(void)
141{ 151{
142 /* backlight GPIO: output, default on */ 152 platform_device_register(&zylonite_backlight_device);
143 gpio_direction_output(gpio_backlight, 1);
144 153
145 if (lcd_id & 0x20) { 154 if (lcd_id & 0x20) {
146 set_pxa_fb_info(&zylonite_sharp_lcd_info); 155 set_pxa_fb_info(&zylonite_sharp_lcd_info);
@@ -329,6 +338,7 @@ static void __init zylonite_init(void)
329 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq); 338 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq);
330 platform_device_register(&smc91x_device); 339 platform_device_register(&smc91x_device);
331 340
341 pxa_set_ac97_info(NULL);
332 zylonite_init_lcd(); 342 zylonite_init_lcd();
333 zylonite_init_mmc(); 343 zylonite_init_mmc();
334 zylonite_init_keypad(); 344 zylonite_init_keypad();
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index 324fb9daae28..6f7ae972b8db 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -50,6 +50,7 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
50 GPIO75_LCD_BIAS, 50 GPIO75_LCD_BIAS,
51 GPIO76_LCD_VSYNC, 51 GPIO76_LCD_VSYNC,
52 GPIO127_LCD_CS_N, 52 GPIO127_LCD_CS_N,
53 GPIO20_PWM3_OUT, /* backlight */
53 54
54 /* BTUART */ 55 /* BTUART */
55 GPIO111_UART2_RTS, 56 GPIO111_UART2_RTS,
@@ -200,9 +201,6 @@ void __init zylonite_pxa300_init(void)
200 /* detect LCD panel */ 201 /* detect LCD panel */
201 zylonite_detect_lcd_panel(); 202 zylonite_detect_lcd_panel();
202 203
203 /* GPIO pin assignment */
204 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20);
205
206 /* MMC card detect & write protect for controller 0 */ 204 /* MMC card detect & write protect for controller 0 */
207 zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0); 205 zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0);
208 zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2); 206 zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2);
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 193d07903b06..2b4fc34919ac 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -49,6 +49,7 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
49 GPIO15_2_LCD_LCLK, 49 GPIO15_2_LCD_LCLK,
50 GPIO16_2_LCD_PCLK, 50 GPIO16_2_LCD_PCLK,
51 GPIO17_2_LCD_BIAS, 51 GPIO17_2_LCD_BIAS,
52 GPIO14_PWM3_OUT, /* backlight */
52 53
53 /* FFUART */ 54 /* FFUART */
54 GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL, 55 GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL,
@@ -187,7 +188,6 @@ void __init zylonite_pxa320_init(void)
187 zylonite_detect_lcd_panel(); 188 zylonite_detect_lcd_panel();
188 189
189 /* GPIO pin assignment */ 190 /* GPIO pin assignment */
190 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14);
191 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9); 191 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);
192 192
193 /* MMC card detect & write protect for controller 0 */ 193 /* MMC card detect & write protect for controller 0 */