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/Kconfig240
-rw-r--r--arch/arm/mach-pxa/Makefile20
-rw-r--r--arch/arm/mach-pxa/clock.c35
-rw-r--r--arch/arm/mach-pxa/clock.h45
-rw-r--r--arch/arm/mach-pxa/cm-x270-pci.c49
-rw-r--r--arch/arm/mach-pxa/cm-x270-pci.h14
-rw-r--r--arch/arm/mach-pxa/cm-x270.c408
-rw-r--r--arch/arm/mach-pxa/corgi.c2
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c7
-rw-r--r--arch/arm/mach-pxa/devices.c177
-rw-r--r--arch/arm/mach-pxa/devices.h11
-rw-r--r--arch/arm/mach-pxa/e400_lcd.c56
-rw-r--r--arch/arm/mach-pxa/e740_lcd.c123
-rw-r--r--arch/arm/mach-pxa/e750_lcd.c109
-rw-r--r--arch/arm/mach-pxa/e800_lcd.c159
-rw-r--r--arch/arm/mach-pxa/em-x270.c381
-rw-r--r--arch/arm/mach-pxa/eseries.c15
-rw-r--r--arch/arm/mach-pxa/eseries_udc.c57
-rw-r--r--arch/arm/mach-pxa/ezx.c220
-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/littleton.c70
-rw-r--r--arch/arm/mach-pxa/lpd270.c55
-rw-r--r--arch/arm/mach-pxa/lubbock.c27
-rw-r--r--arch/arm/mach-pxa/magician.c118
-rw-r--r--arch/arm/mach-pxa/mainstone.c89
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c72
-rw-r--r--arch/arm/mach-pxa/palmtx.c416
-rw-r--r--arch/arm/mach-pxa/pcm027.c31
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c203
-rw-r--r--arch/arm/mach-pxa/poodle.c2
-rw-r--r--arch/arm/mach-pxa/pwm.c319
-rw-r--r--arch/arm/mach-pxa/pxa25x.c74
-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/pxa300.c19
-rw-r--r--arch/arm/mach-pxa/pxa320.c21
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c33
-rw-r--r--arch/arm/mach-pxa/pxa930.c190
-rw-r--r--arch/arm/mach-pxa/reset.c96
-rw-r--r--arch/arm/mach-pxa/saar.c84
-rw-r--r--arch/arm/mach-pxa/spitz.c10
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c7
-rw-r--r--arch/arm/mach-pxa/ssp.c13
-rw-r--r--arch/arm/mach-pxa/standby.S83
-rw-r--r--arch/arm/mach-pxa/tavorevb.c84
-rw-r--r--arch/arm/mach-pxa/tosa-bt.c150
-rw-r--r--arch/arm/mach-pxa/tosa.c382
-rw-r--r--arch/arm/mach-pxa/trizeps4.c13
-rw-r--r--arch/arm/mach-pxa/zylonite.c129
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c50
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c8
52 files changed, 4288 insertions, 764 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 5da7a6820492..e8ee7ec9ff6d 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -16,19 +16,24 @@ config CPU_PXA310
16config CPU_PXA320 16config CPU_PXA320
17 bool "PXA320 (codename Monahans-P)" 17 bool "PXA320 (codename Monahans-P)"
18 18
19config CPU_PXA930
20 bool "PXA930 (codename Tavor-P)"
21
19endmenu 22endmenu
20 23
21endif 24endif
22 25
23choice
24 prompt "Select target board"
25
26config ARCH_GUMSTIX 26config ARCH_GUMSTIX
27 bool "Gumstix XScale boards" 27 bool "Gumstix XScale boards"
28 help 28 help
29 Say Y here if you intend to run this kernel on a 29 Say Y here if you intend to run this kernel on a
30 Gumstix Full Function Minature Computer. 30 Gumstix Full Function Minature Computer.
31 31
32config MACH_GUMSTIX_F
33 bool "Basix, Connex, ws-200ax, ws-400ax systems"
34 depends on ARCH_GUMSTIX
35 select PXA25x
36
32config ARCH_LUBBOCK 37config ARCH_LUBBOCK
33 bool "Intel DBPXA250 Development Platform" 38 bool "Intel DBPXA250 Development Platform"
34 select PXA25x 39 select PXA25x
@@ -37,10 +42,12 @@ config ARCH_LUBBOCK
37config MACH_LOGICPD_PXA270 42config MACH_LOGICPD_PXA270
38 bool "LogicPD PXA270 Card Engine Development Platform" 43 bool "LogicPD PXA270 Card Engine Development Platform"
39 select PXA27x 44 select PXA27x
45 select HAVE_PWM
40 46
41config MACH_MAINSTONE 47config MACH_MAINSTONE
42 bool "Intel HCDDBBVA0 Development Platform" 48 bool "Intel HCDDBBVA0 Development Platform"
43 select PXA27x 49 select PXA27x
50 select HAVE_PWM
44 51
45config ARCH_PXA_IDP 52config ARCH_PXA_IDP
46 bool "Accelent Xscale IDP" 53 bool "Accelent Xscale IDP"
@@ -57,6 +64,57 @@ config PXA_SHARPSL
57 SL-C3000 (Spitz), SL-C3100 (Borzoi) or SL-C6000x (Tosa) 64 SL-C3000 (Spitz), SL-C3100 (Borzoi) or SL-C6000x (Tosa)
58 handheld computer. 65 handheld computer.
59 66
67config MACH_POODLE
68 bool "Enable Sharp SL-5600 (Poodle) Support"
69 depends on PXA_SHARPSL
70 select PXA25x
71 select SHARP_LOCOMO
72 select PXA_SSP
73
74config MACH_CORGI
75 bool "Enable Sharp SL-C700 (Corgi) Support"
76 depends on PXA_SHARPSL
77 select PXA25x
78 select PXA_SHARP_C7xx
79
80config MACH_SHEPHERD
81 bool "Enable Sharp SL-C750 (Shepherd) Support"
82 depends on PXA_SHARPSL
83 select PXA25x
84 select PXA_SHARP_C7xx
85
86config MACH_HUSKY
87 bool "Enable Sharp SL-C760 (Husky) Support"
88 depends on PXA_SHARPSL
89 select PXA25x
90 select PXA_SHARP_C7xx
91
92config MACH_AKITA
93 bool "Enable Sharp SL-1000 (Akita) Support"
94 depends on PXA_SHARPSL
95 select PXA27x
96 select PXA_SHARP_Cxx00
97 select MACH_SPITZ
98 select I2C
99 select I2C_PXA
100
101config MACH_SPITZ
102 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
103 depends on PXA_SHARPSL
104 select PXA27x
105 select PXA_SHARP_Cxx00
106
107config MACH_BORZOI
108 bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support"
109 depends on PXA_SHARPSL
110 select PXA27x
111 select PXA_SHARP_Cxx00
112
113config MACH_TOSA
114 bool "Enable Sharp SL-6000x (Tosa) Support"
115 depends on PXA_SHARPSL
116 select PXA25x
117
60config ARCH_PXA_ESERIES 118config ARCH_PXA_ESERIES
61 bool "PXA based Toshiba e-series PDAs" 119 bool "PXA based Toshiba e-series PDAs"
62 select PXA25x 120 select PXA25x
@@ -69,10 +127,19 @@ config MACH_E330
69 Say Y here if you intend to run this kernel on a Toshiba 127 Say Y here if you intend to run this kernel on a Toshiba
70 e330 family PDA. 128 e330 family PDA.
71 129
130config MACH_E350
131 bool "Toshiba e350"
132 default y
133 depends on ARCH_PXA_ESERIES
134 help
135 Say Y here if you intend to run this kernel on a Toshiba
136 e350 family PDA.
137
72config MACH_E740 138config MACH_E740
73 bool "Toshiba e740" 139 bool "Toshiba e740"
74 default y 140 default y
75 depends on ARCH_PXA_ESERIES 141 depends on ARCH_PXA_ESERIES
142 select FB_W100
76 help 143 help
77 Say Y here if you intend to run this kernel on a Toshiba 144 Say Y here if you intend to run this kernel on a Toshiba
78 e740 family PDA. 145 e740 family PDA.
@@ -81,6 +148,7 @@ config MACH_E750
81 bool "Toshiba e750" 148 bool "Toshiba e750"
82 default y 149 default y
83 depends on ARCH_PXA_ESERIES 150 depends on ARCH_PXA_ESERIES
151 select FB_W100
84 help 152 help
85 Say Y here if you intend to run this kernel on a Toshiba 153 Say Y here if you intend to run this kernel on a Toshiba
86 e750 family PDA. 154 e750 family PDA.
@@ -97,6 +165,7 @@ config MACH_E800
97 bool "Toshiba e800" 165 bool "Toshiba e800"
98 default y 166 default y
99 depends on ARCH_PXA_ESERIES 167 depends on ARCH_PXA_ESERIES
168 select FB_W100
100 help 169 help
101 Say Y here if you intend to run this kernel on a Toshiba 170 Say Y here if you intend to run this kernel on a Toshiba
102 e800 family PDA. 171 e800 family PDA.
@@ -105,6 +174,10 @@ config MACH_TRIZEPS4
105 bool "Keith und Koep Trizeps4 DIMM-Module" 174 bool "Keith und Koep Trizeps4 DIMM-Module"
106 select PXA27x 175 select PXA27x
107 176
177config MACH_TRIZEPS4_CONXS
178 bool "ConXS Eval Board"
179 depends on MACH_TRIZEPS4
180
108config MACH_EM_X270 181config MACH_EM_X270
109 bool "CompuLab EM-x270 platform" 182 bool "CompuLab EM-x270 platform"
110 select PXA27x 183 select PXA27x
@@ -114,14 +187,25 @@ config MACH_COLIBRI
114 select PXA27x 187 select PXA27x
115 188
116config MACH_ZYLONITE 189config MACH_ZYLONITE
117 bool "PXA3xx Development Platform" 190 bool "PXA3xx Development Platform (aka Zylonite)"
118 select PXA3xx 191 select PXA3xx
192 select HAVE_PWM
119 193
120config MACH_LITTLETON 194config MACH_LITTLETON
121 bool "PXA3xx Form Factor Platform (aka Littleton)" 195 bool "PXA3xx Form Factor Platform (aka Littleton)"
122 select PXA3xx 196 select PXA3xx
123 select PXA_SSP 197 select PXA_SSP
124 198
199config MACH_TAVOREVB
200 bool "PXA930 Evaluation Board (aka TavorEVB)"
201 select PXA3xx
202 select PXA930
203
204config MACH_SAAR
205 bool "PXA930 Handheld Platform (aka SAAR)"
206 select PXA3xx
207 select PXA930
208
125config MACH_ARMCORE 209config MACH_ARMCORE
126 bool "CompuLab CM-X270 modules" 210 bool "CompuLab CM-X270 modules"
127 select PXA27x 211 select PXA27x
@@ -129,7 +213,6 @@ config MACH_ARMCORE
129 213
130config MACH_MAGICIAN 214config MACH_MAGICIAN
131 bool "Enable HTC Magician Support" 215 bool "Enable HTC Magician Support"
132 depends on ARCH_PXA
133 select PXA27x 216 select PXA27x
134 select IWMMXT 217 select IWMMXT
135 218
@@ -137,109 +220,81 @@ config MACH_PCM027
137 bool "Phytec phyCORE-PXA270 CPU module (PCM-027)" 220 bool "Phytec phyCORE-PXA270 CPU module (PCM-027)"
138 select PXA27x 221 select PXA27x
139 select IWMMXT 222 select IWMMXT
223 select PXA_SSP
140 224
141endchoice 225config ARCH_PXA_PALM
226 bool "PXA based Palm PDAs"
227 select HAVE_PWM
142 228
143choice 229config MACH_PALMTX
144 prompt "Used baseboard" 230 bool "Palm T|X"
145 depends on MACH_PCM027 231 default y
232 depends on ARCH_PXA_PALM
233 select PXA27x
234 select IWMMXT
235 help
236 Say Y here if you intend to run this kernel on a Palm T|X
237 handheld computer.
146 238
147config MACH_PCM990_BASEBOARD 239config MACH_PCM990_BASEBOARD
148 bool "PHYTEC PCM-990 development board" 240 bool "PHYTEC PCM-990 development board"
149 241 select HAVE_PWM
150endchoice 242 depends on MACH_PCM027
151
152if PXA_SHARPSL
153 243
154choice 244choice
155 prompt "Select target Sharp Zaurus device range" 245 prompt "display on pcm990"
156 246 depends on MACH_PCM990_BASEBOARD
157config PXA_SHARPSL_25x
158 bool "Sharp PXA25x models (SL-5600, SL-C7xx and SL-C6000x)"
159 select PXA25x
160
161config PXA_SHARPSL_27x
162 bool "Sharp PXA270 models (SL-Cxx00)"
163 select PXA27x
164
165endchoice
166 247
167endif 248config PCM990_DISPLAY_SHARP
249 bool "sharp lq084v1dg21 stn display"
168 250
169if ARCH_GUMSTIX 251config PCM990_DISPLAY_NEC
252 bool "nec nl6448bc20_18d tft display"
170 253
171choice 254config PCM990_DISPLAY_NONE
172 prompt "Select target Gumstix board" 255 bool "no display"
173
174config MACH_GUMSTIX_F
175 bool "Basix, Connex, ws-200ax, ws-400ax systems"
176 select PXA25x
177 256
178endchoice 257endchoice
179 258
180endif
181 259
260config PXA_EZX
261 bool "Motorola EZX Platform"
262 select PXA27x
263 select IWMMXT
264 select HAVE_PWM
182 265
183if MACH_TRIZEPS4 266config MACH_EZX_A780
267 bool "Motorola EZX A780"
268 default y
269 depends on PXA_EZX
184 270
185choice 271config MACH_EZX_E680
186 prompt "Select base board for Trizeps 4 module" 272 bool "Motorola EZX E680"
273 default y
274 depends on PXA_EZX
187 275
188config MACH_TRIZEPS4_CONXS 276config MACH_EZX_A1200
189 bool "ConXS Eval Board" 277 bool "Motorola EZX A1200"
278 default y
279 depends on PXA_EZX
190 280
191config MACH_TRIZEPS4_ANY 281config MACH_EZX_A910
192 bool "another Board" 282 bool "Motorola EZX A910"
283 default y
284 depends on PXA_EZX
193 285
194endchoice 286config MACH_EZX_E6
287 bool "Motorola EZX E6"
288 default y
289 depends on PXA_EZX
195 290
196endif 291config MACH_EZX_E2
292 bool "Motorola EZX E2"
293 default y
294 depends on PXA_EZX
197 295
198endmenu 296endmenu
199 297
200config MACH_POODLE
201 bool "Enable Sharp SL-5600 (Poodle) Support"
202 depends on PXA_SHARPSL_25x
203 select SHARP_LOCOMO
204 select PXA_SSP
205
206config MACH_CORGI
207 bool "Enable Sharp SL-C700 (Corgi) Support"
208 depends on PXA_SHARPSL_25x
209 select PXA_SHARP_C7xx
210
211config MACH_SHEPHERD
212 bool "Enable Sharp SL-C750 (Shepherd) Support"
213 depends on PXA_SHARPSL_25x
214 select PXA_SHARP_C7xx
215
216config MACH_HUSKY
217 bool "Enable Sharp SL-C760 (Husky) Support"
218 depends on PXA_SHARPSL_25x
219 select PXA_SHARP_C7xx
220
221config MACH_AKITA
222 bool "Enable Sharp SL-1000 (Akita) Support"
223 depends on PXA_SHARPSL_27x
224 select PXA_SHARP_Cxx00
225 select MACH_SPITZ
226 select I2C
227 select I2C_PXA
228
229config MACH_SPITZ
230 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
231 depends on PXA_SHARPSL_27x
232 select PXA_SHARP_Cxx00
233
234config MACH_BORZOI
235 bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support"
236 depends on PXA_SHARPSL_27x
237 select PXA_SHARP_Cxx00
238
239config MACH_TOSA
240 bool "Enable Sharp SL-6000x (Tosa) Support"
241 depends on PXA_SHARPSL_25x
242
243config PXA25x 298config PXA25x
244 bool 299 bool
245 help 300 help
@@ -273,4 +328,19 @@ config PXA_SSP
273 tristate 328 tristate
274 help 329 help
275 Enable support for PXA2xx SSP ports 330 Enable support for PXA2xx SSP ports
331
332config PXA_PWM
333 tristate
334 default BACKLIGHT_PWM
335 help
336 Enable support for PXA2xx/PXA3xx PWM controllers
337
338config TOSA_BT
339 tristate "Control the state of built-in bluetooth chip on Sharp SL-6000"
340 depends on MACH_TOSA
341 select RFKILL
342 help
343 This is a simple driver that is able to control
344 the state of built in bluetooth chip on tosa.
345
276endif 346endif
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 0e6d05bb81aa..99ecbe7f8506 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -4,19 +4,21 @@
4 4
5# Common support (must be linked before board specific support) 5# Common support (must be linked before board specific support)
6obj-y += clock.o devices.o generic.o irq.o dma.o \ 6obj-y += clock.o devices.o generic.o irq.o dma.o \
7 time.o gpio.o 7 time.o gpio.o reset.o
8obj-$(CONFIG_PM) += pm.o sleep.o standby.o 8obj-$(CONFIG_PM) += pm.o sleep.o standby.o
9obj-$(CONFIG_CPU_FREQ) += cpu-pxa.o 9obj-$(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
21obj-$(CONFIG_CPU_PXA930) += pxa930.o
20 22
21# Specific board support 23# Specific board support
22obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o 24obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
@@ -35,7 +37,12 @@ obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o
35obj-$(CONFIG_MACH_TOSA) += tosa.o 37obj-$(CONFIG_MACH_TOSA) += tosa.o
36obj-$(CONFIG_MACH_EM_X270) += em-x270.o 38obj-$(CONFIG_MACH_EM_X270) += em-x270.o
37obj-$(CONFIG_MACH_MAGICIAN) += magician.o 39obj-$(CONFIG_MACH_MAGICIAN) += magician.o
38obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o 40obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o eseries_udc.o
41obj-$(CONFIG_MACH_E740) += e740_lcd.o
42obj-$(CONFIG_MACH_E750) += e750_lcd.o
43obj-$(CONFIG_MACH_E400) += e400_lcd.o
44obj-$(CONFIG_MACH_E800) += e800_lcd.o
45obj-$(CONFIG_MACH_PALMTX) += palmtx.o
39 46
40ifeq ($(CONFIG_MACH_ZYLONITE),y) 47ifeq ($(CONFIG_MACH_ZYLONITE),y)
41 obj-y += zylonite.o 48 obj-y += zylonite.o
@@ -43,8 +50,11 @@ ifeq ($(CONFIG_MACH_ZYLONITE),y)
43 obj-$(CONFIG_CPU_PXA320) += zylonite_pxa320.o 50 obj-$(CONFIG_CPU_PXA320) += zylonite_pxa320.o
44endif 51endif
45obj-$(CONFIG_MACH_LITTLETON) += littleton.o 52obj-$(CONFIG_MACH_LITTLETON) += littleton.o
53obj-$(CONFIG_MACH_TAVOREVB) += tavorevb.o
54obj-$(CONFIG_MACH_SAAR) += saar.o
46 55
47obj-$(CONFIG_MACH_ARMCORE) += cm-x270.o 56obj-$(CONFIG_MACH_ARMCORE) += cm-x270.o
57obj-$(CONFIG_PXA_EZX) += ezx.o
48 58
49# Support for blinky lights 59# Support for blinky lights
50led-y := leds.o 60led-y := leds.o
@@ -58,3 +68,5 @@ obj-$(CONFIG_LEDS) += $(led-y)
58ifeq ($(CONFIG_PCI),y) 68ifeq ($(CONFIG_PCI),y)
59obj-$(CONFIG_MACH_ARMCORE) += cm-x270-pci.o 69obj-$(CONFIG_MACH_ARMCORE) += cm-x270-pci.o
60endif 70endif
71
72obj-$(CONFIG_TOSA_BT) += tosa-bt.o
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index e97dc59813c8..630063ffa6fc 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);
@@ -98,21 +101,6 @@ unsigned long clk_get_rate(struct clk *clk)
98EXPORT_SYMBOL(clk_get_rate); 101EXPORT_SYMBOL(clk_get_rate);
99 102
100 103
101static void clk_gpio27_enable(struct clk *clk)
102{
103 pxa_gpio_mode(GPIO11_3_6MHz_MD);
104}
105
106static void clk_gpio27_disable(struct clk *clk)
107{
108}
109
110static const struct clkops clk_gpio27_ops = {
111 .enable = clk_gpio27_enable,
112 .disable = clk_gpio27_disable,
113};
114
115
116void clk_cken_enable(struct clk *clk) 104void clk_cken_enable(struct clk *clk)
117{ 105{
118 CKEN |= 1 << clk->cken; 106 CKEN |= 1 << clk->cken;
@@ -128,14 +116,6 @@ const struct clkops clk_cken_ops = {
128 .disable = clk_cken_disable, 116 .disable = clk_cken_disable,
129}; 117};
130 118
131static struct clk common_clks[] = {
132 {
133 .name = "GPIO27_CLK",
134 .ops = &clk_gpio27_ops,
135 .rate = 3686400,
136 },
137};
138
139void clks_register(struct clk *clks, size_t num) 119void clks_register(struct clk *clks, size_t num)
140{ 120{
141 int i; 121 int i;
@@ -145,10 +125,3 @@ void clks_register(struct clk *clks, size_t num)
145 list_add(&clks[i].node, &clocks); 125 list_add(&clks[i].node, &clocks);
146 mutex_unlock(&clocks_mutex); 126 mutex_unlock(&clocks_mutex);
147} 127}
148
149static int __init clk_init(void)
150{
151 clks_register(common_clks, ARRAY_SIZE(common_clks));
152 return 0;
153}
154arch_initcall(clk_init);
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index bc6b77e1592e..1ec8f9178aaf 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,9 +36,53 @@ 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
50#define INIT_CLK(_name, _ops, _rate, _delay, _dev) \
51 { \
52 .name = _name, \
53 .dev = _dev, \
54 .ops = _ops, \
55 .rate = _rate, \
56 .delay = _delay, \
57 }
58
38extern const struct clkops clk_cken_ops; 59extern const struct clkops clk_cken_ops;
39 60
40void clk_cken_enable(struct clk *clk); 61void clk_cken_enable(struct clk *clk);
41void clk_cken_disable(struct clk *clk); 62void clk_cken_disable(struct clk *clk);
42 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
43void clks_register(struct clk *clks, size_t num); 88void clks_register(struct clk *clks, size_t num);
diff --git a/arch/arm/mach-pxa/cm-x270-pci.c b/arch/arm/mach-pxa/cm-x270-pci.c
index ac7f05f9f3eb..bcf0cde6ccc9 100644
--- a/arch/arm/mach-pxa/cm-x270-pci.c
+++ b/arch/arm/mach-pxa/cm-x270-pci.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Bits taken from various places. 6 * Bits taken from various places.
7 * 7 *
8 * Copyright (C) 2007 Compulab, Ltd. 8 * Copyright (C) 2007, 2008 Compulab, Ltd.
9 * Mike Rapoport <mike@compulab.co.il> 9 * Mike Rapoport <mike@compulab.co.il>
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
@@ -19,16 +19,16 @@
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/gpio.h>
22 23
23#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
24#include <asm/arch/cm-x270.h>
25#include <asm/arch/pxa-regs.h> 25#include <asm/arch/pxa-regs.h>
26#include <asm/arch/pxa2xx-gpio.h>
27#include <asm/mach-types.h> 26#include <asm/mach-types.h>
28 27
29#include <asm/hardware/it8152.h> 28#include <asm/hardware/it8152.h>
30 29
31unsigned long it8152_base_address = CMX270_IT8152_VIRT; 30unsigned long it8152_base_address;
31static int cmx270_it8152_irq_gpio;
32 32
33/* 33/*
34 * Only first 64MB of memory can be accessed via PCI. 34 * Only first 64MB of memory can be accessed via PCI.
@@ -41,36 +41,39 @@ 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 pr_info("Adjusting zones for CM-X270\n");
45 46
46 /* 47 /*
47 * Only adjust if > 64M on current system 48 * Only adjust if > 64M on current system
48 */ 49 */
49 if (node || (zone_size[0] <= sz)) 50 if (node || (zone_size[0] <= sz))
50 return; 51 return;
51 52
52 zone_size[1] = zone_size[0] - sz; 53 zone_size[1] = zone_size[0] - sz;
53 zone_size[0] = sz; 54 zone_size[0] = sz;
54 zhole_size[1] = zhole_size[0]; 55 zhole_size[1] = zhole_size[0];
55 zhole_size[0] = 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)
59{ 61{
60 /* clear our parent irq */ 62 /* clear our parent irq */
61 GEDR(GPIO_IT8152_IRQ) = GPIO_bit(GPIO_IT8152_IRQ); 63 GEDR(cmx270_it8152_irq_gpio) = GPIO_bit(cmx270_it8152_irq_gpio);
62 64
63 it8152_irq_demux(irq, desc); 65 it8152_irq_demux(irq, desc);
64} 66}
65 67
66void __cmx270_pci_init_irq(void) 68void __cmx270_pci_init_irq(int irq_gpio)
67{ 69{
68 it8152_init_irq(); 70 it8152_init_irq();
69 pxa_gpio_mode(IRQ_TO_GPIO(GPIO_IT8152_IRQ));
70 set_irq_type(IRQ_GPIO(GPIO_IT8152_IRQ), IRQT_RISING);
71 71
72 set_irq_chained_handler(IRQ_GPIO(GPIO_IT8152_IRQ), 72 cmx270_it8152_irq_gpio = irq_gpio;
73 cmx270_it8152_irq_demux); 73
74 set_irq_type(gpio_to_irq(irq_gpio), IRQT_RISING);
75
76 set_irq_chained_handler(gpio_to_irq(irq_gpio), cmx270_it8152_irq_demux);
74} 77}
75 78
76#ifdef CONFIG_PM 79#ifdef CONFIG_PM
@@ -113,8 +116,8 @@ static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
113 116
114 /* 117 /*
115 Here comes the ugly part. The routing is baseboard specific, 118 Here comes the ugly part. The routing is baseboard specific,
116 but defining a platform for each possible base of CM-x270 is 119 but defining a platform for each possible base of CM-X270 is
117 unrealistic. Here we keep mapping for ATXBase and SB-x270. 120 unrealistic. Here we keep mapping for ATXBase and SB-X270.
118 */ 121 */
119 /* ATXBASE PCI slot */ 122 /* ATXBASE PCI slot */
120 if (slot == 7) 123 if (slot == 7)
diff --git a/arch/arm/mach-pxa/cm-x270-pci.h b/arch/arm/mach-pxa/cm-x270-pci.h
index ffe37b66f9a0..48f532f4cb51 100644
--- a/arch/arm/mach-pxa/cm-x270-pci.h
+++ b/arch/arm/mach-pxa/cm-x270-pci.h
@@ -1,13 +1,13 @@
1extern void __cmx270_pci_init_irq(void); 1extern void __cmx270_pci_init_irq(int irq_gpio);
2extern void __cmx270_pci_suspend(void); 2extern void __cmx270_pci_suspend(void);
3extern void __cmx270_pci_resume(void); 3extern void __cmx270_pci_resume(void);
4 4
5#ifdef CONFIG_PCI 5#ifdef CONFIG_PCI
6#define cmx270_pci_init_irq __cmx270_pci_init_irq 6#define cmx270_pci_init_irq(x) __cmx270_pci_init_irq(x)
7#define cmx270_pci_suspend __cmx270_pci_suspend 7#define cmx270_pci_suspend(x) __cmx270_pci_suspend(x)
8#define cmx270_pci_resume __cmx270_pci_resume 8#define cmx270_pci_resume(x) __cmx270_pci_resume(x)
9#else 9#else
10#define cmx270_pci_init_irq() do {} while (0) 10#define cmx270_pci_init_irq(x) do {} while (0)
11#define cmx270_pci_suspend() do {} while (0) 11#define cmx270_pci_suspend(x) do {} while (0)
12#define cmx270_pci_resume() do {} while (0) 12#define cmx270_pci_resume(x) do {} while (0)
13#endif 13#endif
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index f5851d1adc25..402e807eae54 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-pxa/cm-x270.c 2 * linux/arch/arm/mach-pxa/cm-x270.c
3 * 3 *
4 * Copyright (C) 2007 CompuLab, Ltd. 4 * Copyright (C) 2007, 2008 CompuLab, Ltd.
5 * Mike Rapoport <mike@compulab.co.il> 5 * Mike Rapoport <mike@compulab.co.il>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -9,43 +9,156 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/types.h>
13#include <linux/pm.h>
14#include <linux/fb.h>
15#include <linux/platform_device.h> 12#include <linux/platform_device.h>
16#include <linux/irq.h>
17#include <linux/sysdev.h> 13#include <linux/sysdev.h>
18#include <linux/io.h> 14#include <linux/irq.h>
19#include <linux/delay.h> 15#include <linux/gpio.h>
20 16
21#include <linux/dm9000.h> 17#include <linux/dm9000.h>
22#include <linux/rtc-v3020.h> 18#include <linux/rtc-v3020.h>
23#include <linux/serial_8250.h>
24
25#include <video/mbxfb.h> 19#include <video/mbxfb.h>
20#include <linux/leds.h>
26 21
27#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
28#include <asm/mach-types.h> 23#include <asm/mach-types.h>
29#include <asm/mach/map.h> 24#include <asm/mach/map.h>
30 25
31#include <asm/arch/pxa-regs.h>
32#include <asm/arch/pxa2xx-regs.h> 26#include <asm/arch/pxa2xx-regs.h>
33#include <asm/arch/pxa2xx-gpio.h> 27#include <asm/arch/mfp-pxa27x.h>
28#include <asm/arch/pxa-regs.h>
29#include <asm/arch/audio.h>
34#include <asm/arch/pxafb.h> 30#include <asm/arch/pxafb.h>
35#include <asm/arch/ohci.h> 31#include <asm/arch/ohci.h>
36#include <asm/arch/mmc.h> 32#include <asm/arch/mmc.h>
37#include <asm/arch/bitfield.h> 33#include <asm/arch/bitfield.h>
38#include <asm/arch/cm-x270.h>
39 34
40#include <asm/hardware/it8152.h> 35#include <asm/hardware/it8152.h>
41 36
42#include "generic.h" 37#include "generic.h"
43#include "cm-x270-pci.h" 38#include "cm-x270-pci.h"
44 39
40/* virtual addresses for statically mapped regions */
41#define CMX270_VIRT_BASE (0xe8000000)
42#define CMX270_IT8152_VIRT (CMX270_VIRT_BASE)
43
45#define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22)) 44#define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22))
46#define DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22)) 45#define DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22))
47 46
48static struct resource cmx270_dm9k_resource[] = { 47/* GPIO IRQ usage */
48#define GPIO10_ETHIRQ (10)
49#define GPIO22_IT8152_IRQ (22)
50#define GPIO83_MMC_IRQ (83)
51#define GPIO95_GFXIRQ (95)
52
53#define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ)
54#define CMX270_IT8152_IRQ IRQ_GPIO(GPIO22_IT8152_IRQ)
55#define CMX270_MMC_IRQ IRQ_GPIO(GPIO83_MMC_IRQ)
56#define CMX270_GFXIRQ IRQ_GPIO(GPIO95_GFXIRQ)
57
58/* MMC power enable */
59#define GPIO105_MMC_POWER (105)
60
61static unsigned long cmx270_pin_config[] = {
62 /* AC'97 */
63 GPIO28_AC97_BITCLK,
64 GPIO29_AC97_SDATA_IN_0,
65 GPIO30_AC97_SDATA_OUT,
66 GPIO31_AC97_SYNC,
67 GPIO98_AC97_SYSCLK,
68 GPIO113_AC97_nRESET,
69
70 /* BTUART */
71 GPIO42_BTUART_RXD,
72 GPIO43_BTUART_TXD,
73 GPIO44_BTUART_CTS,
74 GPIO45_BTUART_RTS,
75
76 /* STUART */
77 GPIO46_STUART_RXD,
78 GPIO47_STUART_TXD,
79
80 /* MCI controller */
81 GPIO32_MMC_CLK,
82 GPIO112_MMC_CMD,
83 GPIO92_MMC_DAT_0,
84 GPIO109_MMC_DAT_1,
85 GPIO110_MMC_DAT_2,
86 GPIO111_MMC_DAT_3,
87
88 /* LCD */
89 GPIO58_LCD_LDD_0,
90 GPIO59_LCD_LDD_1,
91 GPIO60_LCD_LDD_2,
92 GPIO61_LCD_LDD_3,
93 GPIO62_LCD_LDD_4,
94 GPIO63_LCD_LDD_5,
95 GPIO64_LCD_LDD_6,
96 GPIO65_LCD_LDD_7,
97 GPIO66_LCD_LDD_8,
98 GPIO67_LCD_LDD_9,
99 GPIO68_LCD_LDD_10,
100 GPIO69_LCD_LDD_11,
101 GPIO70_LCD_LDD_12,
102 GPIO71_LCD_LDD_13,
103 GPIO72_LCD_LDD_14,
104 GPIO73_LCD_LDD_15,
105 GPIO74_LCD_FCLK,
106 GPIO75_LCD_LCLK,
107 GPIO76_LCD_PCLK,
108 GPIO77_LCD_BIAS,
109
110 /* I2C */
111 GPIO117_I2C_SCL,
112 GPIO118_I2C_SDA,
113
114 /* SSP1 */
115 GPIO23_SSP1_SCLK,
116 GPIO24_SSP1_SFRM,
117 GPIO25_SSP1_TXD,
118 GPIO26_SSP1_RXD,
119
120 /* SSP2 */
121 GPIO19_SSP2_SCLK,
122 GPIO14_SSP2_SFRM,
123 GPIO87_SSP2_TXD,
124 GPIO88_SSP2_RXD,
125
126 /* PC Card */
127 GPIO48_nPOE,
128 GPIO49_nPWE,
129 GPIO50_nPIOR,
130 GPIO51_nPIOW,
131 GPIO85_nPCE_1,
132 GPIO54_nPCE_2,
133 GPIO55_nPREG,
134 GPIO56_nPWAIT,
135 GPIO57_nIOIS16,
136
137 /* SDRAM and local bus */
138 GPIO15_nCS_1,
139 GPIO78_nCS_2,
140 GPIO79_nCS_3,
141 GPIO80_nCS_4,
142 GPIO33_nCS_5,
143 GPIO49_nPWE,
144 GPIO18_RDY,
145
146 /* GPIO */
147 GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH,
148 GPIO105_GPIO | MFP_LPM_DRIVE_HIGH, /* MMC/SD power */
149 GPIO53_GPIO, /* PC card reset */
150
151 /* NAND controls */
152 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
153 GPIO89_GPIO, /* NAND Ready/Busy */
154
155 /* interrupts */
156 GPIO10_GPIO, /* DM9000 interrupt */
157 GPIO83_GPIO, /* MMC card detect */
158};
159
160#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
161static struct resource cmx270_dm9000_resource[] = {
49 [0] = { 162 [0] = {
50 .start = DM9000_PHYS_BASE, 163 .start = DM9000_PHYS_BASE,
51 .end = DM9000_PHYS_BASE + 4, 164 .end = DM9000_PHYS_BASE + 4,
@@ -63,37 +176,45 @@ static struct resource cmx270_dm9k_resource[] = {
63 } 176 }
64}; 177};
65 178
66/* for the moment we limit ourselves to 32bit IO until some 179static struct dm9000_plat_data cmx270_dm9000_platdata = {
67 * better IO routines can be written and tested
68 */
69static struct dm9000_plat_data cmx270_dm9k_platdata = {
70 .flags = DM9000_PLATF_32BITONLY, 180 .flags = DM9000_PLATF_32BITONLY,
71}; 181};
72 182
73/* Ethernet device */ 183static struct platform_device cmx270_dm9000_device = {
74static struct platform_device cmx270_device_dm9k = {
75 .name = "dm9000", 184 .name = "dm9000",
76 .id = 0, 185 .id = 0,
77 .num_resources = ARRAY_SIZE(cmx270_dm9k_resource), 186 .num_resources = ARRAY_SIZE(cmx270_dm9000_resource),
78 .resource = cmx270_dm9k_resource, 187 .resource = cmx270_dm9000_resource,
79 .dev = { 188 .dev = {
80 .platform_data = &cmx270_dm9k_platdata, 189 .platform_data = &cmx270_dm9000_platdata,
81 } 190 }
82}; 191};
83 192
84/* audio device */ 193static void __init cmx270_init_dm9000(void)
85static struct platform_device cmx270_audio_device = { 194{
86 .name = "pxa2xx-ac97", 195 platform_device_register(&cmx270_dm9000_device);
87 .id = -1, 196}
88}; 197#else
198static inline void cmx270_init_dm9000(void) {}
199#endif
89 200
90/* touchscreen controller */ 201/* UCB1400 touchscreen controller */
202#if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
91static struct platform_device cmx270_ts_device = { 203static struct platform_device cmx270_ts_device = {
92 .name = "ucb1400_ts", 204 .name = "ucb1400_ts",
93 .id = -1, 205 .id = -1,
94}; 206};
95 207
96/* RTC */ 208static void __init cmx270_init_touchscreen(void)
209{
210 platform_device_register(&cmx270_ts_device);
211}
212#else
213static inline void cmx270_init_touchscreen(void) {}
214#endif
215
216/* V3020 RTC */
217#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
97static struct resource cmx270_v3020_resource[] = { 218static struct resource cmx270_v3020_resource[] = {
98 [0] = { 219 [0] = {
99 .start = RTC_PHYS_BASE, 220 .start = RTC_PHYS_BASE,
@@ -116,28 +237,67 @@ static struct platform_device cmx270_rtc_device = {
116 } 237 }
117}; 238};
118 239
119/* 240static void __init cmx270_init_rtc(void)
120 * CM-X270 LEDs 241{
121 */ 242 platform_device_register(&cmx270_rtc_device);
243}
244#else
245static inline void cmx270_init_rtc(void) {}
246#endif
247
248/* CM-X270 LEDs */
249#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
250static struct gpio_led cmx270_leds[] = {
251 [0] = {
252 .name = "cm-x270:red",
253 .default_trigger = "nand-disk",
254 .gpio = 93,
255 .active_low = 1,
256 },
257 [1] = {
258 .name = "cm-x270:green",
259 .default_trigger = "heartbeat",
260 .gpio = 94,
261 .active_low = 1,
262 },
263};
264
265static struct gpio_led_platform_data cmx270_gpio_led_pdata = {
266 .num_leds = ARRAY_SIZE(cmx270_leds),
267 .leds = cmx270_leds,
268};
269
122static struct platform_device cmx270_led_device = { 270static struct platform_device cmx270_led_device = {
123 .name = "cm-x270-led", 271 .name = "leds-gpio",
124 .id = -1, 272 .id = -1,
273 .dev = {
274 .platform_data = &cmx270_gpio_led_pdata,
275 },
125}; 276};
126 277
278static void __init cmx270_init_leds(void)
279{
280 platform_device_register(&cmx270_led_device);
281}
282#else
283static inline void cmx270_init_leds(void) {}
284#endif
285
127/* 2700G graphics */ 286/* 2700G graphics */
287#if defined(CONFIG_FB_MBX) || defined(CONFIG_FB_MBX_MODULE)
128static u64 fb_dma_mask = ~(u64)0; 288static u64 fb_dma_mask = ~(u64)0;
129 289
130static struct resource cmx270_2700G_resource[] = { 290static struct resource cmx270_2700G_resource[] = {
131 /* frame buffer memory including ODFB and External SDRAM */ 291 /* frame buffer memory including ODFB and External SDRAM */
132 [0] = { 292 [0] = {
133 .start = MARATHON_PHYS, 293 .start = PXA_CS2_PHYS,
134 .end = MARATHON_PHYS + 0x02000000, 294 .end = PXA_CS2_PHYS + 0x01ffffff,
135 .flags = IORESOURCE_MEM, 295 .flags = IORESOURCE_MEM,
136 }, 296 },
137 /* Marathon registers */ 297 /* Marathon registers */
138 [1] = { 298 [1] = {
139 .start = MARATHON_PHYS + 0x03fe0000, 299 .start = PXA_CS2_PHYS + 0x03fe0000,
140 .end = MARATHON_PHYS + 0x03ffffff, 300 .end = PXA_CS2_PHYS + 0x03ffffff,
141 .flags = IORESOURCE_MEM, 301 .flags = IORESOURCE_MEM,
142 }, 302 },
143}; 303};
@@ -205,44 +365,15 @@ static struct platform_device cmx270_2700G = {
205 .id = -1, 365 .id = -1,
206}; 366};
207 367
208static u64 ata_dma_mask = ~(u64)0; 368static void __init cmx270_init_2700G(void)
209 369{
210static struct platform_device cmx270_ata = { 370 platform_device_register(&cmx270_2700G);
211 .name = "pata_cm_x270", 371}
212 .id = -1, 372#else
213 .dev = { 373static inline void cmx270_init_2700G(void) {}
214 .dma_mask = &ata_dma_mask, 374#endif
215 .coherent_dma_mask = 0xffffffff,
216 },
217};
218
219/* platform devices */
220static struct platform_device *platform_devices[] __initdata = {
221 &cmx270_device_dm9k,
222 &cmx270_audio_device,
223 &cmx270_rtc_device,
224 &cmx270_2700G,
225 &cmx270_led_device,
226 &cmx270_ts_device,
227 &cmx270_ata,
228};
229
230/* Map PCI companion and IDE/General Purpose CS statically */
231static struct map_desc cmx270_io_desc[] __initdata = {
232 [0] = { /* IDE/general purpose space */
233 .virtual = CMX270_IDE104_VIRT,
234 .pfn = __phys_to_pfn(CMX270_IDE104_PHYS),
235 .length = SZ_64M - SZ_8M,
236 .type = MT_DEVICE
237 },
238 [1] = { /* PCI bridge */
239 .virtual = CMX270_IT8152_VIRT,
240 .pfn = __phys_to_pfn(CMX270_IT8152_PHYS),
241 .length = SZ_64M,
242 .type = MT_DEVICE
243 },
244};
245 375
376#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
246/* 377/*
247 Display definitions 378 Display definitions
248 keep these for backwards compatibility, although symbolic names (as 379 keep these for backwards compatibility, although symbolic names (as
@@ -452,7 +583,16 @@ static int __init cmx270_set_display(char *str)
452*/ 583*/
453__setup("monitor=", cmx270_set_display); 584__setup("monitor=", cmx270_set_display);
454 585
586static void __init cmx270_init_display(void)
587{
588 set_pxa_fb_info(cmx270_display);
589}
590#else
591static inline void cmx270_init_display(void) {}
592#endif
593
455/* PXA27x OHCI controller setup */ 594/* PXA27x OHCI controller setup */
595#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
456static int cmx270_ohci_init(struct device *dev) 596static int cmx270_ohci_init(struct device *dev)
457{ 597{
458 /* Set the Power Control Polarity Low */ 598 /* Set the Power Control Polarity Low */
@@ -467,35 +607,37 @@ static struct pxaohci_platform_data cmx270_ohci_platform_data = {
467 .init = cmx270_ohci_init, 607 .init = cmx270_ohci_init,
468}; 608};
469 609
610static void __init cmx270_init_ohci(void)
611{
612 pxa_set_ohci_info(&cmx270_ohci_platform_data);
613}
614#else
615static inline void cmx270_init_ohci(void) {}
616#endif
470 617
618#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
471static int cmx270_mci_init(struct device *dev, 619static int cmx270_mci_init(struct device *dev,
472 irq_handler_t cmx270_detect_int, 620 irq_handler_t cmx270_detect_int,
473 void *data) 621 void *data)
474{ 622{
475 int err; 623 int err;
476 624
477 /* 625 err = gpio_request(GPIO105_MMC_POWER, "MMC/SD power");
478 * setup GPIO for PXA27x MMC controller 626 if (err) {
479 */ 627 dev_warn(dev, "power gpio unavailable\n");
480 pxa_gpio_mode(GPIO32_MMCCLK_MD); 628 return err;
481 pxa_gpio_mode(GPIO112_MMCCMD_MD); 629 }
482 pxa_gpio_mode(GPIO92_MMCDAT0_MD);
483 pxa_gpio_mode(GPIO109_MMCDAT1_MD);
484 pxa_gpio_mode(GPIO110_MMCDAT2_MD);
485 pxa_gpio_mode(GPIO111_MMCDAT3_MD);
486
487 /* SB-X270 uses GPIO105 as SD power enable */
488 pxa_gpio_mode(105 | GPIO_OUT);
489 630
490 /* card detect IRQ on GPIO 83 */ 631 gpio_direction_output(GPIO105_MMC_POWER, 0);
491 pxa_gpio_mode(IRQ_TO_GPIO(CMX270_MMC_IRQ));
492 632
493 err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int, 633 err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int,
494 IRQF_DISABLED | IRQF_TRIGGER_FALLING, 634 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
495 "MMC card detect", data); 635 "MMC card detect", data);
496 if (err) 636 if (err) {
497 printk(KERN_ERR "cmx270_mci_init: MMC/SD: can't" 637 gpio_free(GPIO105_MMC_POWER);
498 " request MMC card detect IRQ\n"); 638 dev_err(dev, "cmx270_mci_init: MMC/SD: can't"
639 " request MMC card detect IRQ\n");
640 }
499 641
500 return err; 642 return err;
501} 643}
@@ -505,17 +647,18 @@ static void cmx270_mci_setpower(struct device *dev, unsigned int vdd)
505 struct pxamci_platform_data *p_d = dev->platform_data; 647 struct pxamci_platform_data *p_d = dev->platform_data;
506 648
507 if ((1 << vdd) & p_d->ocr_mask) { 649 if ((1 << vdd) & p_d->ocr_mask) {
508 printk(KERN_DEBUG "%s: on\n", __func__); 650 dev_dbg(dev, "power on\n");
509 GPCR(105) = GPIO_bit(105); 651 gpio_set_value(GPIO105_MMC_POWER, 0);
510 } else { 652 } else {
511 GPSR(105) = GPIO_bit(105); 653 gpio_set_value(GPIO105_MMC_POWER, 1);
512 printk(KERN_DEBUG "%s: off\n", __func__); 654 dev_dbg(dev, "power off\n");
513 } 655 }
514} 656}
515 657
516static void cmx270_mci_exit(struct device *dev, void *data) 658static void cmx270_mci_exit(struct device *dev, void *data)
517{ 659{
518 free_irq(CMX270_MMC_IRQ, data); 660 free_irq(CMX270_MMC_IRQ, data);
661 gpio_free(GPIO105_MMC_POWER);
519} 662}
520 663
521static struct pxamci_platform_data cmx270_mci_platform_data = { 664static struct pxamci_platform_data cmx270_mci_platform_data = {
@@ -525,6 +668,14 @@ static struct pxamci_platform_data cmx270_mci_platform_data = {
525 .exit = cmx270_mci_exit, 668 .exit = cmx270_mci_exit,
526}; 669};
527 670
671static void __init cmx270_init_mmc(void)
672{
673 pxa_set_mci_info(&cmx270_mci_platform_data);
674}
675#else
676static inline void cmx270_init_mmc(void) {}
677#endif
678
528#ifdef CONFIG_PM 679#ifdef CONFIG_PM
529static unsigned long sleep_save_msc[10]; 680static unsigned long sleep_save_msc[10];
530 681
@@ -586,52 +737,63 @@ static int __init cmx270_pm_init(void)
586static int __init cmx270_pm_init(void) { return 0; } 737static int __init cmx270_pm_init(void) { return 0; }
587#endif 738#endif
588 739
740#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
741static void __init cmx270_init_ac97(void)
742{
743 pxa_set_ac97_info(NULL);
744}
745#else
746static inline void cmx270_init_ac97(void) {}
747#endif
748
589static void __init cmx270_init(void) 749static void __init cmx270_init(void)
590{ 750{
591 cmx270_pm_init(); 751 cmx270_pm_init();
592 752
593 set_pxa_fb_info(cmx270_display); 753 pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config));
594 754
595 /* register CM-X270 platform devices */ 755 cmx270_init_dm9000();
596 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 756 cmx270_init_rtc();
597 757 cmx270_init_display();
598 /* set MCI and OHCI platform parameters */ 758 cmx270_init_mmc();
599 pxa_set_mci_info(&cmx270_mci_platform_data); 759 cmx270_init_ohci();
600 pxa_set_ohci_info(&cmx270_ohci_platform_data); 760 cmx270_init_ac97();
601 761 cmx270_init_touchscreen();
602 /* This enables the STUART */ 762 cmx270_init_leds();
603 pxa_gpio_mode(GPIO46_STRXD_MD); 763 cmx270_init_2700G();
604 pxa_gpio_mode(GPIO47_STTXD_MD);
605
606 /* This enables the BTUART */
607 pxa_gpio_mode(GPIO42_BTRXD_MD);
608 pxa_gpio_mode(GPIO43_BTTXD_MD);
609 pxa_gpio_mode(GPIO44_BTCTS_MD);
610 pxa_gpio_mode(GPIO45_BTRTS_MD);
611} 764}
612 765
613static void __init cmx270_init_irq(void) 766static void __init cmx270_init_irq(void)
614{ 767{
615 pxa27x_init_irq(); 768 pxa27x_init_irq();
616 769
770 cmx270_pci_init_irq(GPIO22_IT8152_IRQ);
771}
617 772
618 cmx270_pci_init_irq(); 773#ifdef CONFIG_PCI
774/* Map PCI companion statically */
775static struct map_desc cmx270_io_desc[] __initdata = {
776 [0] = { /* PCI bridge */
777 .virtual = CMX270_IT8152_VIRT,
778 .pfn = __phys_to_pfn(PXA_CS4_PHYS),
779 .length = SZ_64M,
780 .type = MT_DEVICE
781 },
782};
619 783
620 /* Setup interrupt for dm9000 */ 784static void __init cmx270_map_io(void)
621 pxa_gpio_mode(IRQ_TO_GPIO(CMX270_ETHIRQ)); 785{
622 set_irq_type(CMX270_ETHIRQ, IRQT_RISING); 786 pxa_map_io();
787 iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc));
623 788
624 /* Setup interrupt for 2700G */ 789 it8152_base_address = CMX270_IT8152_VIRT;
625 pxa_gpio_mode(IRQ_TO_GPIO(CMX270_GFXIRQ));
626 set_irq_type(CMX270_GFXIRQ, IRQT_FALLING);
627} 790}
628 791#else
629static void __init cmx270_map_io(void) 792static void __init cmx270_map_io(void)
630{ 793{
631 pxa_map_io(); 794 pxa_map_io();
632 iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc));
633} 795}
634 796#endif
635 797
636MACHINE_START(ARMCORE, "Compulab CM-x270") 798MACHINE_START(ARMCORE, "Compulab CM-x270")
637 .boot_params = 0xa0000100, 799 .boot_params = 0xa0000100,
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index b757dd756655..e58504edb140 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>
@@ -464,6 +465,7 @@ static void corgi_irda_transceiver_mode(struct device *dev, int mode)
464 GPSR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON); 465 GPSR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON);
465 else 466 else
466 GPCR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON); 467 GPCR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON);
468 pxa2xx_transceiver_mode(dev, mode);
467} 469}
468 470
469static struct pxaficp_platform_data corgi_ficp_platform_data = { 471static struct pxaficp_platform_data corgi_ficp_platform_data = {
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..84489dc51d81 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -10,11 +10,16 @@
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>
16#include <asm/arch/pxa2xx_spi.h>
15#include <asm/arch/camera.h> 17#include <asm/arch/camera.h>
18#include <asm/arch/audio.h>
19#include <asm/arch/pxa3xx_nand.h>
16 20
17#include "devices.h" 21#include "devices.h"
22#include "generic.h"
18 23
19void __init pxa_register_device(struct platform_device *dev, void *data) 24void __init pxa_register_device(struct platform_device *dev, void *data)
20{ 25{
@@ -91,8 +96,19 @@ static struct resource pxa2xx_udc_resources[] = {
91 96
92static u64 udc_dma_mask = ~(u32)0; 97static u64 udc_dma_mask = ~(u32)0;
93 98
94struct platform_device pxa_device_udc = { 99struct platform_device pxa25x_device_udc = {
95 .name = "pxa2xx-udc", 100 .name = "pxa25x-udc",
101 .id = -1,
102 .resource = pxa2xx_udc_resources,
103 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
104 .dev = {
105 .platform_data = &pxa_udc_info,
106 .dma_mask = &udc_dma_mask,
107 }
108};
109
110struct platform_device pxa27x_device_udc = {
111 .name = "pxa27x-udc",
96 .id = -1, 112 .id = -1,
97 .resource = pxa2xx_udc_resources, 113 .resource = pxa2xx_udc_resources,
98 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources), 114 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
@@ -233,8 +249,15 @@ struct platform_device pxa_device_i2c = {
233 .num_resources = ARRAY_SIZE(pxai2c_resources), 249 .num_resources = ARRAY_SIZE(pxai2c_resources),
234}; 250};
235 251
252static unsigned long pxa27x_i2c_mfp_cfg[] = {
253 GPIO117_I2C_SCL,
254 GPIO118_I2C_SDA,
255};
256
236void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) 257void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
237{ 258{
259 if (cpu_is_pxa27x())
260 pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
238 pxa_register_device(&pxa_device_i2c, info); 261 pxa_register_device(&pxa_device_i2c, info);
239} 262}
240 263
@@ -278,8 +301,69 @@ struct platform_device pxa_device_rtc = {
278 .id = -1, 301 .id = -1,
279}; 302};
280 303
304static struct resource pxa_ac97_resources[] = {
305 [0] = {
306 .start = 0x40500000,
307 .end = 0x40500000 + 0xfff,
308 .flags = IORESOURCE_MEM,
309 },
310 [1] = {
311 .start = IRQ_AC97,
312 .end = IRQ_AC97,
313 .flags = IORESOURCE_IRQ,
314 },
315};
316
317static u64 pxa_ac97_dmamask = 0xffffffffUL;
318
319struct platform_device pxa_device_ac97 = {
320 .name = "pxa2xx-ac97",
321 .id = -1,
322 .dev = {
323 .dma_mask = &pxa_ac97_dmamask,
324 .coherent_dma_mask = 0xffffffff,
325 },
326 .num_resources = ARRAY_SIZE(pxa_ac97_resources),
327 .resource = pxa_ac97_resources,
328};
329
330void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
331{
332 pxa_register_device(&pxa_device_ac97, ops);
333}
334
281#ifdef CONFIG_PXA25x 335#ifdef CONFIG_PXA25x
282 336
337static struct resource pxa25x_resource_pwm0[] = {
338 [0] = {
339 .start = 0x40b00000,
340 .end = 0x40b0000f,
341 .flags = IORESOURCE_MEM,
342 },
343};
344
345struct platform_device pxa25x_device_pwm0 = {
346 .name = "pxa25x-pwm",
347 .id = 0,
348 .resource = pxa25x_resource_pwm0,
349 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
350};
351
352static struct resource pxa25x_resource_pwm1[] = {
353 [0] = {
354 .start = 0x40c00000,
355 .end = 0x40c0000f,
356 .flags = IORESOURCE_MEM,
357 },
358};
359
360struct platform_device pxa25x_device_pwm1 = {
361 .name = "pxa25x-pwm",
362 .id = 1,
363 .resource = pxa25x_resource_pwm1,
364 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
365};
366
283static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32); 367static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
284 368
285static struct resource pxa25x_resource_ssp[] = { 369static struct resource pxa25x_resource_ssp[] = {
@@ -568,6 +652,36 @@ struct platform_device pxa27x_device_ssp3 = {
568 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), 652 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
569}; 653};
570 654
655static struct resource pxa27x_resource_pwm0[] = {
656 [0] = {
657 .start = 0x40b00000,
658 .end = 0x40b0001f,
659 .flags = IORESOURCE_MEM,
660 },
661};
662
663struct platform_device pxa27x_device_pwm0 = {
664 .name = "pxa27x-pwm",
665 .id = 0,
666 .resource = pxa27x_resource_pwm0,
667 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
668};
669
670static struct resource pxa27x_resource_pwm1[] = {
671 [0] = {
672 .start = 0x40c00000,
673 .end = 0x40c0001f,
674 .flags = IORESOURCE_MEM,
675 },
676};
677
678struct platform_device pxa27x_device_pwm1 = {
679 .name = "pxa27x-pwm",
680 .id = 1,
681 .resource = pxa27x_resource_pwm1,
682 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
683};
684
571static struct resource pxa27x_resource_camera[] = { 685static struct resource pxa27x_resource_camera[] = {
572 [0] = { 686 [0] = {
573 .start = 0x50000000, 687 .start = 0x50000000,
@@ -718,4 +832,63 @@ void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
718 pxa_register_device(&pxa3xx_device_mci3, info); 832 pxa_register_device(&pxa3xx_device_mci3, info);
719} 833}
720 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}
721#endif /* CONFIG_PXA3xx */ 877#endif /* CONFIG_PXA3xx */
878
879/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
880 * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
881void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
882{
883 struct platform_device *pd;
884
885 pd = platform_device_alloc("pxa2xx-spi", id);
886 if (pd == NULL) {
887 printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n",
888 id);
889 return;
890 }
891
892 pd->dev.platform_data = info;
893 platform_device_add(pd);
894}
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index fcab017f27ee..887c738f5911 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,11 @@ 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
34extern struct platform_device pxa3xx_device_nand;
35
27void __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/e400_lcd.c b/arch/arm/mach-pxa/e400_lcd.c
new file mode 100644
index 000000000000..16c023630626
--- /dev/null
+++ b/arch/arm/mach-pxa/e400_lcd.c
@@ -0,0 +1,56 @@
1/*
2 * e400_lcd.c
3 *
4 * (c) 2005 Ian Molton <spyro@f2s.com>
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 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/module.h>
15
16#include <asm/mach-types.h>
17#include <asm/arch/pxa-regs.h>
18#include <asm/arch/pxafb.h>
19
20static struct pxafb_mode_info e400_pxafb_mode_info = {
21 .pixclock = 140703,
22 .xres = 240,
23 .yres = 320,
24 .bpp = 16,
25 .hsync_len = 4,
26 .left_margin = 28,
27 .right_margin = 8,
28 .vsync_len = 3,
29 .upper_margin = 5,
30 .lower_margin = 6,
31 .sync = 0,
32};
33
34static struct pxafb_mach_info e400_pxafb_mach_info = {
35 .modes = &e400_pxafb_mode_info,
36 .num_modes = 1,
37 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
38 .lccr3 = 0,
39 .pxafb_backlight_power = NULL,
40};
41
42static int __init e400_lcd_init(void)
43{
44 if (!machine_is_e400())
45 return -ENODEV;
46
47 set_pxa_fb_info(&e400_pxafb_mach_info);
48 return 0;
49}
50
51module_init(e400_lcd_init);
52
53MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
54MODULE_DESCRIPTION("e400 lcd driver");
55MODULE_LICENSE("GPLv2");
56
diff --git a/arch/arm/mach-pxa/e740_lcd.c b/arch/arm/mach-pxa/e740_lcd.c
new file mode 100644
index 000000000000..26bd599af178
--- /dev/null
+++ b/arch/arm/mach-pxa/e740_lcd.c
@@ -0,0 +1,123 @@
1/* e740_lcd.c
2 *
3 * This file contains the definitions for the LCD timings and functions
4 * to control the LCD power / frontlighting via the w100fb driver.
5 *
6 * (c) 2005 Ian Molton <spyro@f2s.com>
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
14#include <linux/module.h>
15#include <linux/device.h>
16#include <linux/fb.h>
17#include <linux/err.h>
18#include <linux/platform_device.h>
19
20#include <asm/mach-types.h>
21
22#include <video/w100fb.h>
23
24/*
25**potential** shutdown routine - to be investigated
26devmem2 0x0c010528 w 0xff3fff00
27devmem2 0x0c010190 w 0x7FFF8000
28devmem2 0x0c0101b0 w 0x00FF0000
29devmem2 0x0c01008c w 0x00000000
30devmem2 0x0c010080 w 0x000000bf
31devmem2 0x0c010098 w 0x00000015
32devmem2 0x0c010088 w 0x4b000204
33devmem2 0x0c010098 w 0x0000001d
34*/
35
36static struct w100_gen_regs e740_lcd_regs = {
37 .lcd_format = 0x00008023,
38 .lcdd_cntl1 = 0x0f000000,
39 .lcdd_cntl2 = 0x0003ffff,
40 .genlcd_cntl1 = 0x00ffff03,
41 .genlcd_cntl2 = 0x003c0f03,
42 .genlcd_cntl3 = 0x000143aa,
43};
44
45static struct w100_mode e740_lcd_mode = {
46 .xres = 240,
47 .yres = 320,
48 .left_margin = 20,
49 .right_margin = 28,
50 .upper_margin = 9,
51 .lower_margin = 8,
52 .crtc_ss = 0x80140013,
53 .crtc_ls = 0x81150110,
54 .crtc_gs = 0x80050005,
55 .crtc_vpos_gs = 0x000a0009,
56 .crtc_rev = 0x0040010a,
57 .crtc_dclk = 0xa906000a,
58 .crtc_gclk = 0x80050108,
59 .crtc_goe = 0x80050108,
60 .pll_freq = 57,
61 .pixclk_divider = 4,
62 .pixclk_divider_rotated = 4,
63 .pixclk_src = CLK_SRC_XTAL,
64 .sysclk_divider = 1,
65 .sysclk_src = CLK_SRC_PLL,
66 .crtc_ps1_active = 0x41060010,
67};
68
69
70static struct w100_gpio_regs e740_w100_gpio_info = {
71 .init_data1 = 0x21002103,
72 .gpio_dir1 = 0xffffdeff,
73 .gpio_oe1 = 0x03c00643,
74 .init_data2 = 0x003f003f,
75 .gpio_dir2 = 0xffffffff,
76 .gpio_oe2 = 0x000000ff,
77};
78
79static struct w100fb_mach_info e740_fb_info = {
80 .modelist = &e740_lcd_mode,
81 .num_modes = 1,
82 .regs = &e740_lcd_regs,
83 .gpio = &e740_w100_gpio_info,
84 .xtal_freq = 14318000,
85 .xtal_dbl = 1,
86};
87
88static struct resource e740_fb_resources[] = {
89 [0] = {
90 .start = 0x0c000000,
91 .end = 0x0cffffff,
92 .flags = IORESOURCE_MEM,
93 },
94};
95
96/* ----------------------- device declarations -------------------------- */
97
98
99static struct platform_device e740_fb_device = {
100 .name = "w100fb",
101 .id = -1,
102 .dev = {
103 .platform_data = &e740_fb_info,
104 },
105 .num_resources = ARRAY_SIZE(e740_fb_resources),
106 .resource = e740_fb_resources,
107};
108
109static int e740_lcd_init(void)
110{
111 int ret;
112
113 if (!machine_is_e740())
114 return -ENODEV;
115
116 return platform_device_register(&e740_fb_device);
117}
118
119module_init(e740_lcd_init);
120
121MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
122MODULE_DESCRIPTION("e740 lcd driver");
123MODULE_LICENSE("GPLv2");
diff --git a/arch/arm/mach-pxa/e750_lcd.c b/arch/arm/mach-pxa/e750_lcd.c
new file mode 100644
index 000000000000..75edc3b5390f
--- /dev/null
+++ b/arch/arm/mach-pxa/e750_lcd.c
@@ -0,0 +1,109 @@
1/* e750_lcd.c
2 *
3 * This file contains the definitions for the LCD timings and functions
4 * to control the LCD power / frontlighting via the w100fb driver.
5 *
6 * (c) 2005 Ian Molton <spyro@f2s.com>
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
14#include <linux/module.h>
15#include <linux/device.h>
16#include <linux/fb.h>
17#include <linux/err.h>
18#include <linux/platform_device.h>
19
20#include <asm/mach-types.h>
21
22#include <video/w100fb.h>
23
24static struct w100_gen_regs e750_lcd_regs = {
25 .lcd_format = 0x00008003,
26 .lcdd_cntl1 = 0x00000000,
27 .lcdd_cntl2 = 0x0003ffff,
28 .genlcd_cntl1 = 0x00fff003,
29 .genlcd_cntl2 = 0x003c0f03,
30 .genlcd_cntl3 = 0x000143aa,
31};
32
33static struct w100_mode e750_lcd_mode = {
34 .xres = 240,
35 .yres = 320,
36 .left_margin = 21,
37 .right_margin = 22,
38 .upper_margin = 5,
39 .lower_margin = 4,
40 .crtc_ss = 0x80150014,
41 .crtc_ls = 0x8014000d,
42 .crtc_gs = 0xc1000005,
43 .crtc_vpos_gs = 0x00020147,
44 .crtc_rev = 0x0040010a,
45 .crtc_dclk = 0xa1700030,
46 .crtc_gclk = 0x80cc0015,
47 .crtc_goe = 0x80cc0015,
48 .crtc_ps1_active = 0x61060017,
49 .pll_freq = 57,
50 .pixclk_divider = 4,
51 .pixclk_divider_rotated = 4,
52 .pixclk_src = CLK_SRC_XTAL,
53 .sysclk_divider = 1,
54 .sysclk_src = CLK_SRC_PLL,
55};
56
57
58static struct w100_gpio_regs e750_w100_gpio_info = {
59 .init_data1 = 0x01192f1b,
60 .gpio_dir1 = 0xd5ffdeff,
61 .gpio_oe1 = 0x000020bf,
62 .init_data2 = 0x010f010f,
63 .gpio_dir2 = 0xffffffff,
64 .gpio_oe2 = 0x000001cf,
65};
66
67static struct w100fb_mach_info e750_fb_info = {
68 .modelist = &e750_lcd_mode,
69 .num_modes = 1,
70 .regs = &e750_lcd_regs,
71 .gpio = &e750_w100_gpio_info,
72 .xtal_freq = 14318000,
73 .xtal_dbl = 1,
74};
75
76static struct resource e750_fb_resources[] = {
77 [0] = {
78 .start = 0x0c000000,
79 .end = 0x0cffffff,
80 .flags = IORESOURCE_MEM,
81 },
82};
83
84/* ----------------------- device declarations -------------------------- */
85
86
87static struct platform_device e750_fb_device = {
88 .name = "w100fb",
89 .id = -1,
90 .dev = {
91 .platform_data = &e750_fb_info,
92 },
93 .num_resources = ARRAY_SIZE(e750_fb_resources),
94 .resource = e750_fb_resources,
95};
96
97static int e750_lcd_init(void)
98{
99 if (!machine_is_e750())
100 return -ENODEV;
101
102 return platform_device_register(&e750_fb_device);
103}
104
105module_init(e750_lcd_init);
106
107MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
108MODULE_DESCRIPTION("e750 lcd driver");
109MODULE_LICENSE("GPLv2");
diff --git a/arch/arm/mach-pxa/e800_lcd.c b/arch/arm/mach-pxa/e800_lcd.c
new file mode 100644
index 000000000000..e6aeab0ebc22
--- /dev/null
+++ b/arch/arm/mach-pxa/e800_lcd.c
@@ -0,0 +1,159 @@
1/* e800_lcd.c
2 *
3 * This file contains the definitions for the LCD timings and functions
4 * to control the LCD power / frontlighting via the w100fb driver.
5 *
6 * (c) 2005 Ian Molton <spyro@f2s.com>
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
14#include <linux/module.h>
15#include <linux/device.h>
16#include <linux/fb.h>
17#include <linux/err.h>
18#include <linux/platform_device.h>
19
20#include <asm/mach-types.h>
21
22#include <video/w100fb.h>
23
24static struct w100_gen_regs e800_lcd_regs = {
25 .lcd_format = 0x00008003,
26 .lcdd_cntl1 = 0x02a00000,
27 .lcdd_cntl2 = 0x0003ffff,
28 .genlcd_cntl1 = 0x000ff2a3,
29 .genlcd_cntl2 = 0x000002a3,
30 .genlcd_cntl3 = 0x000102aa,
31};
32
33static struct w100_mode e800_lcd_mode[2] = {
34 [0] = {
35 .xres = 480,
36 .yres = 640,
37 .left_margin = 52,
38 .right_margin = 148,
39 .upper_margin = 2,
40 .lower_margin = 6,
41 .crtc_ss = 0x80350034,
42 .crtc_ls = 0x802b0026,
43 .crtc_gs = 0x80160016,
44 .crtc_vpos_gs = 0x00020003,
45 .crtc_rev = 0x0040001d,
46 .crtc_dclk = 0xe0000000,
47 .crtc_gclk = 0x82a50049,
48 .crtc_goe = 0x80ee001c,
49 .crtc_ps1_active = 0x00000000,
50 .pll_freq = 128,
51 .pixclk_divider = 4,
52 .pixclk_divider_rotated = 6,
53 .pixclk_src = CLK_SRC_PLL,
54 .sysclk_divider = 0,
55 .sysclk_src = CLK_SRC_PLL,
56 },
57 [1] = {
58 .xres = 240,
59 .yres = 320,
60 .left_margin = 15,
61 .right_margin = 88,
62 .upper_margin = 0,
63 .lower_margin = 7,
64 .crtc_ss = 0xd010000f,
65 .crtc_ls = 0x80070003,
66 .crtc_gs = 0x80000000,
67 .crtc_vpos_gs = 0x01460147,
68 .crtc_rev = 0x00400003,
69 .crtc_dclk = 0xa1700030,
70 .crtc_gclk = 0x814b0008,
71 .crtc_goe = 0x80cc0015,
72 .crtc_ps1_active = 0x00000000,
73 .pll_freq = 100,
74 .pixclk_divider = 6, /* Wince uses 14 which gives a 7MHz pclk. */
75 .pixclk_divider_rotated = 6, /* we want a 14MHz one (much nicer to look at) */
76 .pixclk_src = CLK_SRC_PLL,
77 .sysclk_divider = 0,
78 .sysclk_src = CLK_SRC_PLL,
79 }
80};
81
82
83static struct w100_gpio_regs e800_w100_gpio_info = {
84 .init_data1 = 0xc13fc019,
85 .gpio_dir1 = 0x3e40df7f,
86 .gpio_oe1 = 0x003c3000,
87 .init_data2 = 0x00000000,
88 .gpio_dir2 = 0x00000000,
89 .gpio_oe2 = 0x00000000,
90};
91
92static struct w100_mem_info e800_w100_mem_info = {
93 .ext_cntl = 0x09640011,
94 .sdram_mode_reg = 0x00600021,
95 .ext_timing_cntl = 0x10001545,
96 .io_cntl = 0x7ddd7333,
97 .size = 0x1fffff,
98};
99
100static void e800_tg_change(struct w100fb_par *par)
101{
102 unsigned long tmp;
103
104 tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
105 if (par->mode->xres == 480)
106 tmp |= 0x100;
107 else
108 tmp &= ~0x100;
109 w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
110}
111
112static struct w100_tg_info e800_tg_info = {
113 .change = e800_tg_change,
114};
115
116static struct w100fb_mach_info e800_fb_info = {
117 .modelist = e800_lcd_mode,
118 .num_modes = 2,
119 .regs = &e800_lcd_regs,
120 .gpio = &e800_w100_gpio_info,
121 .mem = &e800_w100_mem_info,
122 .tg = &e800_tg_info,
123 .xtal_freq = 16000000,
124};
125
126static struct resource e800_fb_resources[] = {
127 [0] = {
128 .start = 0x0c000000,
129 .end = 0x0cffffff,
130 .flags = IORESOURCE_MEM,
131 },
132};
133
134/* ----------------------- device declarations -------------------------- */
135
136
137static struct platform_device e800_fb_device = {
138 .name = "w100fb",
139 .id = -1,
140 .dev = {
141 .platform_data = &e800_fb_info,
142 },
143 .num_resources = ARRAY_SIZE(e800_fb_resources),
144 .resource = e800_fb_resources,
145};
146
147static int e800_lcd_init(void)
148{
149 if (!machine_is_e800())
150 return -ENODEV;
151
152 return platform_device_register(&e800_fb_device);
153}
154
155module_init(e800_lcd_init);
156
157MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
158MODULE_DESCRIPTION("e800 lcd driver");
159MODULE_LICENSE("GPLv2");
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 9c57700ee5c2..e5cc6ca63c75 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Support for CompuLab EM-x270 platform 2 * Support for CompuLab EM-X270 platform
3 * 3 *
4 * Copyright (C) 2007 CompuLab, Ltd. 4 * Copyright (C) 2007, 2008 CompuLab, Ltd.
5 * Author: Mike Rapoport <mike@compulab.co.il> 5 * Author: Mike Rapoport <mike@compulab.co.il>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -14,29 +14,159 @@
14 14
15#include <linux/dm9000.h> 15#include <linux/dm9000.h>
16#include <linux/rtc-v3020.h> 16#include <linux/rtc-v3020.h>
17
18#include <linux/mtd/nand.h> 17#include <linux/mtd/nand.h>
19#include <linux/mtd/partitions.h> 18#include <linux/mtd/partitions.h>
19#include <linux/input.h>
20#include <linux/gpio_keys.h>
21#include <linux/gpio.h>
20 22
21#include <asm/mach-types.h> 23#include <asm/mach-types.h>
22
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24 25
26#include <asm/arch/mfp-pxa27x.h>
25#include <asm/arch/pxa-regs.h> 27#include <asm/arch/pxa-regs.h>
26#include <asm/arch/pxa2xx-gpio.h> 28#include <asm/arch/pxa27x-udc.h>
29#include <asm/arch/audio.h>
27#include <asm/arch/pxafb.h> 30#include <asm/arch/pxafb.h>
28#include <asm/arch/ohci.h> 31#include <asm/arch/ohci.h>
29#include <asm/arch/mmc.h> 32#include <asm/arch/mmc.h>
30#include <asm/arch/bitfield.h> 33#include <asm/arch/pxa27x_keypad.h>
31 34
32#include "generic.h" 35#include "generic.h"
33 36
34/* GPIO IRQ usage */ 37/* GPIO IRQ usage */
35#define EM_X270_MMC_PD (105) 38#define GPIO41_ETHIRQ (41)
36#define EM_X270_ETHIRQ IRQ_GPIO(41) 39#define GPIO13_MMC_CD (13)
37#define EM_X270_MMC_IRQ IRQ_GPIO(13) 40#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
41#define EM_X270_MMC_CD IRQ_GPIO(GPIO13_MMC_CD)
42
43/* NAND control GPIOs */
44#define GPIO11_NAND_CS (11)
45#define GPIO56_NAND_RB (56)
46
47static unsigned long em_x270_pin_config[] = {
48 /* AC'97 */
49 GPIO28_AC97_BITCLK,
50 GPIO29_AC97_SDATA_IN_0,
51 GPIO30_AC97_SDATA_OUT,
52 GPIO31_AC97_SYNC,
53 GPIO98_AC97_SYSCLK,
54 GPIO113_AC97_nRESET,
55
56 /* BTUART */
57 GPIO42_BTUART_RXD,
58 GPIO43_BTUART_TXD,
59 GPIO44_BTUART_CTS,
60 GPIO45_BTUART_RTS,
61
62 /* STUART */
63 GPIO46_STUART_RXD,
64 GPIO47_STUART_TXD,
65
66 /* MCI controller */
67 GPIO32_MMC_CLK,
68 GPIO112_MMC_CMD,
69 GPIO92_MMC_DAT_0,
70 GPIO109_MMC_DAT_1,
71 GPIO110_MMC_DAT_2,
72 GPIO111_MMC_DAT_3,
73
74 /* LCD */
75 GPIO58_LCD_LDD_0,
76 GPIO59_LCD_LDD_1,
77 GPIO60_LCD_LDD_2,
78 GPIO61_LCD_LDD_3,
79 GPIO62_LCD_LDD_4,
80 GPIO63_LCD_LDD_5,
81 GPIO64_LCD_LDD_6,
82 GPIO65_LCD_LDD_7,
83 GPIO66_LCD_LDD_8,
84 GPIO67_LCD_LDD_9,
85 GPIO68_LCD_LDD_10,
86 GPIO69_LCD_LDD_11,
87 GPIO70_LCD_LDD_12,
88 GPIO71_LCD_LDD_13,
89 GPIO72_LCD_LDD_14,
90 GPIO73_LCD_LDD_15,
91 GPIO74_LCD_FCLK,
92 GPIO75_LCD_LCLK,
93 GPIO76_LCD_PCLK,
94 GPIO77_LCD_BIAS,
95
96 /* QCI */
97 GPIO84_CIF_FV,
98 GPIO25_CIF_LV,
99 GPIO53_CIF_MCLK,
100 GPIO54_CIF_PCLK,
101 GPIO81_CIF_DD_0,
102 GPIO55_CIF_DD_1,
103 GPIO51_CIF_DD_2,
104 GPIO50_CIF_DD_3,
105 GPIO52_CIF_DD_4,
106 GPIO48_CIF_DD_5,
107 GPIO17_CIF_DD_6,
108 GPIO12_CIF_DD_7,
109
110 /* I2C */
111 GPIO117_I2C_SCL,
112 GPIO118_I2C_SDA,
113
114 /* Keypad */
115 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
116 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
117 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
118 GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
119 GPIO39_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
120 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
121 GPIO91_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH,
122 GPIO36_KP_MKIN_7 | WAKEUP_ON_LEVEL_HIGH,
123 GPIO103_KP_MKOUT_0,
124 GPIO104_KP_MKOUT_1,
125 GPIO105_KP_MKOUT_2,
126 GPIO106_KP_MKOUT_3,
127 GPIO107_KP_MKOUT_4,
128 GPIO108_KP_MKOUT_5,
129 GPIO96_KP_MKOUT_6,
130 GPIO22_KP_MKOUT_7,
131
132 /* SSP1 */
133 GPIO26_SSP1_RXD,
134 GPIO23_SSP1_SCLK,
135 GPIO24_SSP1_SFRM,
136 GPIO57_SSP1_TXD,
137
138 /* SSP2 */
139 GPIO19_SSP2_SCLK,
140 GPIO14_SSP2_SFRM,
141 GPIO89_SSP2_TXD,
142 GPIO88_SSP2_RXD,
143
144 /* SDRAM and local bus */
145 GPIO15_nCS_1,
146 GPIO78_nCS_2,
147 GPIO79_nCS_3,
148 GPIO80_nCS_4,
149 GPIO49_nPWE,
150 GPIO18_RDY,
151
152 /* GPIO */
153 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
154
155 /* power controls */
156 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
157 GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */
158
159 /* NAND controls */
160 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
161 GPIO56_GPIO, /* NAND Ready/Busy */
162
163 /* interrupts */
164 GPIO13_GPIO, /* MMC card detect */
165 GPIO41_GPIO, /* DM9000 interrupt */
166};
38 167
39static struct resource em_x270_dm9k_resource[] = { 168#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
169static struct resource em_x270_dm9000_resource[] = {
40 [0] = { 170 [0] = {
41 .start = PXA_CS2_PHYS, 171 .start = PXA_CS2_PHYS,
42 .end = PXA_CS2_PHYS + 3, 172 .end = PXA_CS2_PHYS + 3,
@@ -54,38 +184,30 @@ static struct resource em_x270_dm9k_resource[] = {
54 } 184 }
55}; 185};
56 186
57/* for the moment we limit ourselves to 32bit IO until some 187static struct dm9000_plat_data em_x270_dm9000_platdata = {
58 * better IO routines can be written and tested
59 */
60static struct dm9000_plat_data em_x270_dm9k_platdata = {
61 .flags = DM9000_PLATF_32BITONLY, 188 .flags = DM9000_PLATF_32BITONLY,
62}; 189};
63 190
64/* Ethernet device */ 191static struct platform_device em_x270_dm9000 = {
65static struct platform_device em_x270_dm9k = {
66 .name = "dm9000", 192 .name = "dm9000",
67 .id = 0, 193 .id = 0,
68 .num_resources = ARRAY_SIZE(em_x270_dm9k_resource), 194 .num_resources = ARRAY_SIZE(em_x270_dm9000_resource),
69 .resource = em_x270_dm9k_resource, 195 .resource = em_x270_dm9000_resource,
70 .dev = { 196 .dev = {
71 .platform_data = &em_x270_dm9k_platdata, 197 .platform_data = &em_x270_dm9000_platdata,
72 } 198 }
73}; 199};
74 200
75/* audio device */ 201static void __init em_x270_init_dm9000(void)
76static struct platform_device em_x270_audio = { 202{
77 .name = "pxa2xx-ac97", 203 platform_device_register(&em_x270_dm9000);
78 .id = -1, 204}
79}; 205#else
80 206static inline void em_x270_init_dm9000(void) {}
81/* WM9712 touchscreen controller. Hopefully the driver will make it to 207#endif
82 * the mainstream sometime */
83static struct platform_device em_x270_ts = {
84 .name = "wm97xx-ts",
85 .id = -1,
86};
87 208
88/* RTC */ 209/* V3020 RTC */
210#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
89static struct resource em_x270_v3020_resource[] = { 211static struct resource em_x270_v3020_resource[] = {
90 [0] = { 212 [0] = {
91 .start = PXA_CS4_PHYS, 213 .start = PXA_CS4_PHYS,
@@ -108,20 +230,26 @@ static struct platform_device em_x270_rtc = {
108 } 230 }
109}; 231};
110 232
111/* NAND flash */ 233static void __init em_x270_init_rtc(void)
112#define GPIO_NAND_CS (11) 234{
113#define GPIO_NAND_RB (56) 235 platform_device_register(&em_x270_rtc);
236}
237#else
238static inline void em_x270_init_rtc(void) {}
239#endif
114 240
241/* NAND flash */
242#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
115static inline void nand_cs_on(void) 243static inline void nand_cs_on(void)
116{ 244{
117 GPCR(GPIO_NAND_CS) = GPIO_bit(GPIO_NAND_CS); 245 gpio_set_value(GPIO11_NAND_CS, 0);
118} 246}
119 247
120static void nand_cs_off(void) 248static void nand_cs_off(void)
121{ 249{
122 dsb(); 250 dsb();
123 251
124 GPSR(GPIO_NAND_CS) = GPIO_bit(GPIO_NAND_CS); 252 gpio_set_value(GPIO11_NAND_CS, 1);
125} 253}
126 254
127/* hardware specific access to control-lines */ 255/* hardware specific access to control-lines */
@@ -161,7 +289,7 @@ static int em_x270_nand_device_ready(struct mtd_info *mtd)
161{ 289{
162 dsb(); 290 dsb();
163 291
164 return GPLR(GPIO_NAND_RB) & GPIO_bit(GPIO_NAND_RB); 292 return gpio_get_value(GPIO56_NAND_RB);
165} 293}
166 294
167static struct mtd_partition em_x270_partition_info[] = { 295static struct mtd_partition em_x270_partition_info[] = {
@@ -214,17 +342,35 @@ static struct platform_device em_x270_nand = {
214 } 342 }
215}; 343};
216 344
217/* platform devices */ 345static void __init em_x270_init_nand(void)
218static struct platform_device *platform_devices[] __initdata = { 346{
219 &em_x270_dm9k, 347 int err;
220 &em_x270_audio, 348
221 &em_x270_ts, 349 err = gpio_request(GPIO11_NAND_CS, "NAND CS");
222 &em_x270_rtc, 350 if (err) {
223 &em_x270_nand, 351 pr_warning("EM-X270: failed to request NAND CS gpio\n");
224}; 352 return;
353 }
354
355 gpio_direction_output(GPIO11_NAND_CS, 1);
356
357 err = gpio_request(GPIO56_NAND_RB, "NAND R/B");
358 if (err) {
359 pr_warning("EM-X270: failed to request NAND R/B gpio\n");
360 gpio_free(GPIO11_NAND_CS);
361 return;
362 }
363
364 gpio_direction_input(GPIO56_NAND_RB);
225 365
366 platform_device_register(&em_x270_nand);
367}
368#else
369static inline void em_x270_init_nand(void) {}
370#endif
226 371
227/* PXA27x OHCI controller setup */ 372/* PXA27x OHCI controller setup */
373#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
228static int em_x270_ohci_init(struct device *dev) 374static int em_x270_ohci_init(struct device *dev)
229{ 375{
230 /* Set the Power Control Polarity Low */ 376 /* Set the Power Control Polarity Low */
@@ -242,27 +388,23 @@ static struct pxaohci_platform_data em_x270_ohci_platform_data = {
242 .init = em_x270_ohci_init, 388 .init = em_x270_ohci_init,
243}; 389};
244 390
391static void __init em_x270_init_ohci(void)
392{
393 pxa_set_ohci_info(&em_x270_ohci_platform_data);
394}
395#else
396static inline void em_x270_init_ohci(void) {}
397#endif
245 398
399/* MCI controller setup */
400#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
246static int em_x270_mci_init(struct device *dev, 401static int em_x270_mci_init(struct device *dev,
247 irq_handler_t em_x270_detect_int, 402 irq_handler_t em_x270_detect_int,
248 void *data) 403 void *data)
249{ 404{
250 int err; 405 int err = request_irq(EM_X270_MMC_CD, em_x270_detect_int,
251 406 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
252 /* setup GPIO for PXA27x MMC controller */ 407 "MMC card detect", data);
253 pxa_gpio_mode(GPIO32_MMCCLK_MD);
254 pxa_gpio_mode(GPIO112_MMCCMD_MD);
255 pxa_gpio_mode(GPIO92_MMCDAT0_MD);
256 pxa_gpio_mode(GPIO109_MMCDAT1_MD);
257 pxa_gpio_mode(GPIO110_MMCDAT2_MD);
258 pxa_gpio_mode(GPIO111_MMCDAT3_MD);
259
260 /* EM-X270 uses GPIO13 as SD power enable */
261 pxa_gpio_mode(EM_X270_MMC_PD | GPIO_OUT);
262
263 err = request_irq(EM_X270_MMC_IRQ, em_x270_detect_int,
264 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
265 "MMC card detect", data);
266 if (err) { 408 if (err) {
267 printk(KERN_ERR "%s: can't request MMC card detect IRQ: %d\n", 409 printk(KERN_ERR "%s: can't request MMC card detect IRQ: %d\n",
268 __func__, err); 410 __func__, err);
@@ -284,7 +426,8 @@ static void em_x270_mci_setpower(struct device *dev, unsigned int vdd)
284 426
285static void em_x270_mci_exit(struct device *dev, void *data) 427static void em_x270_mci_exit(struct device *dev, void *data)
286{ 428{
287 free_irq(EM_X270_MMC_IRQ, data); 429 int irq = gpio_to_irq(GPIO13_MMC_CD);
430 free_irq(irq, data);
288} 431}
289 432
290static struct pxamci_platform_data em_x270_mci_platform_data = { 433static struct pxamci_platform_data em_x270_mci_platform_data = {
@@ -294,7 +437,16 @@ static struct pxamci_platform_data em_x270_mci_platform_data = {
294 .exit = em_x270_mci_exit, 437 .exit = em_x270_mci_exit,
295}; 438};
296 439
440static void __init em_x270_init_mmc(void)
441{
442 pxa_set_mci_info(&em_x270_mci_platform_data);
443}
444#else
445static inline void em_x270_init_mmc(void) {}
446#endif
447
297/* LCD 480x640 */ 448/* LCD 480x640 */
449#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
298static struct pxafb_mode_info em_x270_lcd_mode = { 450static struct pxafb_mode_info em_x270_lcd_mode = {
299 .pixclock = 50000, 451 .pixclock = 50000,
300 .bpp = 16, 452 .bpp = 16,
@@ -312,39 +464,96 @@ static struct pxafb_mode_info em_x270_lcd_mode = {
312static struct pxafb_mach_info em_x270_lcd = { 464static struct pxafb_mach_info em_x270_lcd = {
313 .modes = &em_x270_lcd_mode, 465 .modes = &em_x270_lcd_mode,
314 .num_modes = 1, 466 .num_modes = 1,
315 .cmap_inverse = 0, 467 .lcd_conn = LCD_COLOR_TFT_16BPP,
316 .cmap_static = 0,
317 .lccr0 = LCCR0_PAS,
318 .lccr3 = LCCR3_PixClkDiv(0x01) | LCCR3_Acb(0xff),
319}; 468};
320 469static void __init em_x270_init_lcd(void)
321static void __init em_x270_init(void)
322{ 470{
323 /* setup LCD */
324 set_pxa_fb_info(&em_x270_lcd); 471 set_pxa_fb_info(&em_x270_lcd);
472}
473#else
474static inline void em_x270_init_lcd(void) {}
475#endif
476
477#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
478static void __init em_x270_init_ac97(void)
479{
480 pxa_set_ac97_info(NULL);
481}
482#else
483static inline void em_x270_init_ac97(void) {}
484#endif
485
486#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
487static unsigned int em_x270_matrix_keys[] = {
488 KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
489 KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
490 KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
491};
325 492
326 /* register EM-X270 platform devices */ 493struct pxa27x_keypad_platform_data em_x270_keypad_info = {
327 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 494 /* code map for the matrix keys */
495 .matrix_key_rows = 3,
496 .matrix_key_cols = 3,
497 .matrix_key_map = em_x270_matrix_keys,
498 .matrix_key_map_size = ARRAY_SIZE(em_x270_matrix_keys),
499};
328 500
329 /* set MCI and OHCI platform parameters */ 501static void __init em_x270_init_keypad(void)
330 pxa_set_mci_info(&em_x270_mci_platform_data); 502{
331 pxa_set_ohci_info(&em_x270_ohci_platform_data); 503 pxa_set_keypad_info(&em_x270_keypad_info);
504}
505#else
506static inline void em_x270_init_keypad(void) {}
507#endif
508
509#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
510static struct gpio_keys_button gpio_keys_button[] = {
511 [0] = {
512 .desc = "sleep/wakeup",
513 .code = KEY_SUSPEND,
514 .type = EV_PWR,
515 .gpio = 1,
516 .wakeup = 1,
517 },
518};
519
520static struct gpio_keys_platform_data em_x270_gpio_keys_data = {
521 .buttons = gpio_keys_button,
522 .nbuttons = 1,
523};
332 524
333 /* setup STUART GPIOs */ 525static struct platform_device em_x270_gpio_keys = {
334 pxa_gpio_mode(GPIO46_STRXD_MD); 526 .name = "gpio-keys",
335 pxa_gpio_mode(GPIO47_STTXD_MD); 527 .id = -1,
528 .dev = {
529 .platform_data = &em_x270_gpio_keys_data,
530 },
531};
336 532
337 /* setup BTUART GPIOs */ 533static void __init em_x270_init_gpio_keys(void)
338 pxa_gpio_mode(GPIO42_BTRXD_MD); 534{
339 pxa_gpio_mode(GPIO43_BTTXD_MD); 535 platform_device_register(&em_x270_gpio_keys);
340 pxa_gpio_mode(GPIO44_BTCTS_MD); 536}
341 pxa_gpio_mode(GPIO45_BTRTS_MD); 537#else
538static inline void em_x270_init_gpio_keys(void) {}
539#endif
342 540
343 /* Setup interrupt for dm9000 */ 541static void __init em_x270_init(void)
344 set_irq_type(EM_X270_ETHIRQ, IRQT_RISING); 542{
543 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
544
545 em_x270_init_dm9000();
546 em_x270_init_rtc();
547 em_x270_init_nand();
548 em_x270_init_lcd();
549 em_x270_init_mmc();
550 em_x270_init_ohci();
551 em_x270_init_keypad();
552 em_x270_init_gpio_keys();
553 em_x270_init_ac97();
345} 554}
346 555
347MACHINE_START(EM_X270, "Compulab EM-x270") 556MACHINE_START(EM_X270, "Compulab EM-X270")
348 .boot_params = 0xa0000100, 557 .boot_params = 0xa0000100,
349 .phys_io = 0x40000000, 558 .phys_io = 0x40000000,
350 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 559 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index ee0ae93c876a..c29b7b21c11b 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -17,7 +17,7 @@
17#include <asm/arch/hardware.h> 17#include <asm/arch/hardware.h>
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19 19
20#include <generic.h> 20#include "generic.h"
21 21
22/* Only e800 has 128MB RAM */ 22/* Only e800 has 128MB RAM */
23static void __init eseries_fixup(struct machine_desc *desc, 23static void __init eseries_fixup(struct machine_desc *desc,
@@ -47,6 +47,19 @@ MACHINE_START(E330, "Toshiba e330")
47MACHINE_END 47MACHINE_END
48#endif 48#endif
49 49
50#ifdef CONFIG_MACH_E350
51MACHINE_START(E350, "Toshiba e350")
52 /* Maintainer: Ian Molton (spyro@f2s.com) */
53 .phys_io = 0x40000000,
54 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
55 .boot_params = 0xa0000100,
56 .map_io = pxa_map_io,
57 .init_irq = pxa25x_init_irq,
58 .fixup = eseries_fixup,
59 .timer = &pxa_timer,
60MACHINE_END
61#endif
62
50#ifdef CONFIG_MACH_E740 63#ifdef CONFIG_MACH_E740
51MACHINE_START(E740, "Toshiba e740") 64MACHINE_START(E740, "Toshiba e740")
52 /* Maintainer: Ian Molton (spyro@f2s.com) */ 65 /* Maintainer: Ian Molton (spyro@f2s.com) */
diff --git a/arch/arm/mach-pxa/eseries_udc.c b/arch/arm/mach-pxa/eseries_udc.c
new file mode 100644
index 000000000000..362847a10998
--- /dev/null
+++ b/arch/arm/mach-pxa/eseries_udc.c
@@ -0,0 +1,57 @@
1/*
2 * UDC functions for the Toshiba e-series PDAs
3 *
4 * Copyright (c) Ian Molton 2003
5 *
6 * This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/device.h>
16
17#include <asm/arch/udc.h>
18#include <asm/arch/eseries-gpio.h>
19#include <asm/arch/hardware.h>
20#include <asm/arch/pxa-regs.h>
21#include <asm/mach/arch.h>
22#include <asm/mach-types.h>
23#include <asm/mach/map.h>
24#include <asm/domain.h>
25
26/* local PXA generic code */
27#include "generic.h"
28
29static struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
30 .gpio_vbus = GPIO_E7XX_USB_DISC,
31 .gpio_pullup = GPIO_E7XX_USB_PULLUP,
32 .gpio_pullup_inverted = 1
33};
34
35static struct pxa2xx_udc_mach_info e800_udc_mach_info = {
36 .gpio_vbus = GPIO_E800_USB_DISC,
37 .gpio_pullup = GPIO_E800_USB_PULLUP,
38 .gpio_pullup_inverted = 1
39};
40
41static int __init eseries_udc_init(void)
42{
43 if (machine_is_e330() || machine_is_e350() ||
44 machine_is_e740() || machine_is_e750() ||
45 machine_is_e400())
46 pxa_set_udc_info(&e7xx_udc_mach_info);
47 else if (machine_is_e800())
48 pxa_set_udc_info(&e800_udc_mach_info);
49
50 return 0;
51}
52
53module_init(eseries_udc_init);
54
55MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
56MODULE_DESCRIPTION("eseries UDC support");
57MODULE_LICENSE("GPLv2");
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
new file mode 100644
index 000000000000..0143eed65398
--- /dev/null
+++ b/arch/arm/mach-pxa/ezx.c
@@ -0,0 +1,220 @@
1/*
2 * ezx.c - Common code for the EZX platform.
3 *
4 * Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
5 * 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
6 * 2007-2008 Stefan Schmidt <stefan@datenfreihafen.org>
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
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/delay.h>
18#include <linux/pwm_backlight.h>
19
20#include <asm/setup.h>
21#include <asm/arch/pxafb.h>
22#include <asm/arch/ohci.h>
23#include <asm/arch/i2c.h>
24
25#include <asm/arch/mfp-pxa27x.h>
26#include <asm/arch/pxa-regs.h>
27#include <asm/arch/pxa2xx-regs.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30
31#include "devices.h"
32#include "generic.h"
33
34static struct platform_pwm_backlight_data ezx_backlight_data = {
35 .pwm_id = 0,
36 .max_brightness = 1023,
37 .dft_brightness = 1023,
38 .pwm_period_ns = 78770,
39};
40
41static struct platform_device ezx_backlight_device = {
42 .name = "pwm-backlight",
43 .dev = {
44 .parent = &pxa27x_device_pwm0.dev,
45 .platform_data = &ezx_backlight_data,
46 },
47};
48
49static struct pxafb_mode_info mode_ezx_old = {
50 .pixclock = 150000,
51 .xres = 240,
52 .yres = 320,
53 .bpp = 16,
54 .hsync_len = 10,
55 .left_margin = 20,
56 .right_margin = 10,
57 .vsync_len = 2,
58 .upper_margin = 3,
59 .lower_margin = 2,
60 .sync = 0,
61};
62
63static struct pxafb_mach_info ezx_fb_info_1 = {
64 .modes = &mode_ezx_old,
65 .num_modes = 1,
66 .lcd_conn = LCD_COLOR_TFT_16BPP,
67};
68
69static struct pxafb_mode_info mode_72r89803y01 = {
70 .pixclock = 192308,
71 .xres = 240,
72 .yres = 320,
73 .bpp = 32,
74 .depth = 18,
75 .hsync_len = 10,
76 .left_margin = 20,
77 .right_margin = 10,
78 .vsync_len = 2,
79 .upper_margin = 3,
80 .lower_margin = 2,
81 .sync = 0,
82};
83
84static struct pxafb_mach_info ezx_fb_info_2 = {
85 .modes = &mode_72r89803y01,
86 .num_modes = 1,
87 .lcd_conn = LCD_COLOR_TFT_18BPP,
88};
89
90static struct platform_device *devices[] __initdata = {
91 &ezx_backlight_device,
92};
93
94static unsigned long ezx_pin_config[] __initdata = {
95 /* PWM backlight */
96 GPIO16_PWM0_OUT,
97
98 /* BTUART */
99 GPIO42_BTUART_RXD,
100 GPIO43_BTUART_TXD,
101 GPIO44_BTUART_CTS,
102 GPIO45_BTUART_RTS,
103
104 /* STUART */
105 GPIO46_STUART_RXD,
106 GPIO47_STUART_TXD,
107
108 /* For A780 support (connected with Neptune GSM chip) */
109 GPIO30_USB_P3_2, /* ICL_TXENB */
110 GPIO31_USB_P3_6, /* ICL_VPOUT */
111 GPIO90_USB_P3_5, /* ICL_VPIN */
112 GPIO91_USB_P3_1, /* ICL_XRXD */
113 GPIO56_USB_P3_4, /* ICL_VMOUT */
114 GPIO113_USB_P3_3, /* /ICL_VMIN */
115};
116
117static void __init ezx_init(void)
118{
119 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
120 pxa_set_i2c_info(NULL);
121 if (machine_is_ezx_a780() || machine_is_ezx_e680())
122 set_pxa_fb_info(&ezx_fb_info_1);
123 else
124 set_pxa_fb_info(&ezx_fb_info_2);
125
126 platform_add_devices(devices, ARRAY_SIZE(devices));
127}
128
129static void __init ezx_fixup(struct machine_desc *desc, struct tag *tags,
130 char **cmdline, struct meminfo *mi)
131{
132 /* We have two ram chips. First one with 32MB at 0xA0000000 and a second
133 * 16MB one at 0xAC000000
134 */
135 mi->nr_banks = 2;
136 mi->bank[0].start = 0xa0000000;
137 mi->bank[0].node = 0;
138 mi->bank[0].size = (32*1024*1024);
139 mi->bank[1].start = 0xac000000;
140 mi->bank[1].node = 1;
141 mi->bank[1].size = (16*1024*1024);
142}
143
144#ifdef CONFIG_MACH_EZX_A780
145MACHINE_START(EZX_A780, "Motorola EZX A780")
146 .phys_io = 0x40000000,
147 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
148 .fixup = ezx_fixup,
149 .boot_params = 0xa0000100,
150 .map_io = pxa_map_io,
151 .init_irq = pxa27x_init_irq,
152 .timer = &pxa_timer,
153 .init_machine = &ezx_init,
154MACHINE_END
155#endif
156
157#ifdef CONFIG_MACH_EZX_E680
158MACHINE_START(EZX_E680, "Motorola EZX E680")
159 .phys_io = 0x40000000,
160 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
161 .fixup = ezx_fixup,
162 .boot_params = 0xa0000100,
163 .map_io = pxa_map_io,
164 .init_irq = pxa27x_init_irq,
165 .timer = &pxa_timer,
166 .init_machine = &ezx_init,
167MACHINE_END
168#endif
169
170#ifdef CONFIG_MACH_EZX_A1200
171MACHINE_START(EZX_A1200, "Motorola EZX A1200")
172 .phys_io = 0x40000000,
173 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
174 .fixup = ezx_fixup,
175 .boot_params = 0xa0000100,
176 .map_io = pxa_map_io,
177 .init_irq = pxa27x_init_irq,
178 .timer = &pxa_timer,
179 .init_machine = &ezx_init,
180MACHINE_END
181#endif
182
183#ifdef CONFIG_MACH_EZX_A910
184MACHINE_START(EZX_A910, "Motorola EZX A910")
185 .phys_io = 0x40000000,
186 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
187 .fixup = ezx_fixup,
188 .boot_params = 0xa0000100,
189 .map_io = pxa_map_io,
190 .init_irq = pxa27x_init_irq,
191 .timer = &pxa_timer,
192 .init_machine = &ezx_init,
193MACHINE_END
194#endif
195
196#ifdef CONFIG_MACH_EZX_E6
197MACHINE_START(EZX_E6, "Motorola EZX E6")
198 .phys_io = 0x40000000,
199 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
200 .fixup = ezx_fixup,
201 .boot_params = 0xa0000100,
202 .map_io = pxa_map_io,
203 .init_irq = pxa27x_init_irq,
204 .timer = &pxa_timer,
205 .init_machine = &ezx_init,
206MACHINE_END
207#endif
208
209#ifdef CONFIG_MACH_EZX_E2
210MACHINE_START(EZX_E2, "Motorola EZX E2")
211 .phys_io = 0x40000000,
212 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
213 .fixup = ezx_fixup,
214 .boot_params = 0xa0000100,
215 .map_io = pxa_map_io,
216 .init_irq = pxa27x_init_irq,
217 .timer = &pxa_timer,
218 .init_machine = &ezx_init,
219MACHINE_END
220#endif
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/littleton.c b/arch/arm/mach-pxa/littleton.c
index 530654474bb2..dd759d03a9fd 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -20,6 +20,7 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/smc91x.h>
23 24
24#include <asm/types.h> 25#include <asm/types.h>
25#include <asm/setup.h> 26#include <asm/setup.h>
@@ -38,6 +39,7 @@
38#include <asm/arch/pxafb.h> 39#include <asm/arch/pxafb.h>
39#include <asm/arch/ssp.h> 40#include <asm/arch/ssp.h>
40#include <asm/arch/pxa27x_keypad.h> 41#include <asm/arch/pxa27x_keypad.h>
42#include <asm/arch/pxa3xx_nand.h>
41#include <asm/arch/littleton.h> 43#include <asm/arch/littleton.h>
42 44
43#include "generic.h" 45#include "generic.h"
@@ -101,18 +103,26 @@ static struct resource smc91x_resources[] = {
101 [1] = { 103 [1] = {
102 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)), 104 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
103 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)), 105 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
104 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, 106 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
105 } 107 }
106}; 108};
107 109
110static struct smc91x_platdata littleton_smc91x_info = {
111 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
112 SMC91X_NOWAIT | SMC91X_USE_DMA,
113};
114
108static struct platform_device smc91x_device = { 115static struct platform_device smc91x_device = {
109 .name = "smc91x", 116 .name = "smc91x",
110 .id = 0, 117 .id = 0,
111 .num_resources = ARRAY_SIZE(smc91x_resources), 118 .num_resources = ARRAY_SIZE(smc91x_resources),
112 .resource = smc91x_resources, 119 .resource = smc91x_resources,
120 .dev = {
121 .platform_data = &littleton_smc91x_info,
122 },
113}; 123};
114 124
115#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULES) 125#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
116/* use bit 30, 31 as the indicator of command parameter number */ 126/* use bit 30, 31 as the indicator of command parameter number */
117#define CMD0(x) ((0x00000000) | ((x) << 9)) 127#define CMD0(x) ((0x00000000) | ((x) << 9))
118#define CMD1(x, x1) ((0x40000000) | ((x) << 9) | 0x100 | (x1)) 128#define CMD1(x, x1) ((0x40000000) | ((x) << 9) | 0x100 | (x1))
@@ -311,9 +321,9 @@ static void littleton_init_lcd(void)
311} 321}
312#else 322#else
313static inline void littleton_init_lcd(void) {}; 323static inline void littleton_init_lcd(void) {};
314#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULES */ 324#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
315 325
316#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) 326#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
317static unsigned int littleton_matrix_key_map[] = { 327static unsigned int littleton_matrix_key_map[] = {
318 /* KEY(row, col, key_code) */ 328 /* 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), 329 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
@@ -361,6 +371,57 @@ static void __init littleton_init_keypad(void)
361static inline void littleton_init_keypad(void) {} 371static inline void littleton_init_keypad(void) {}
362#endif 372#endif
363 373
374#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
375static struct mtd_partition littleton_nand_partitions[] = {
376 [0] = {
377 .name = "Bootloader",
378 .offset = 0,
379 .size = 0x060000,
380 .mask_flags = MTD_WRITEABLE, /* force read-only */
381 },
382 [1] = {
383 .name = "Kernel",
384 .offset = 0x060000,
385 .size = 0x200000,
386 .mask_flags = MTD_WRITEABLE, /* force read-only */
387 },
388 [2] = {
389 .name = "Filesystem",
390 .offset = 0x0260000,
391 .size = 0x3000000, /* 48M - rootfs */
392 },
393 [3] = {
394 .name = "MassStorage",
395 .offset = 0x3260000,
396 .size = 0x3d40000,
397 },
398 [4] = {
399 .name = "BBT",
400 .offset = 0x6FA0000,
401 .size = 0x80000,
402 .mask_flags = MTD_WRITEABLE, /* force read-only */
403 },
404 /* NOTE: we reserve some blocks at the end of the NAND flash for
405 * bad block management, and the max number of relocation blocks
406 * differs on different platforms. Please take care with it when
407 * defining the partition table.
408 */
409};
410
411static struct pxa3xx_nand_platform_data littleton_nand_info = {
412 .enable_arbiter = 1,
413 .parts = littleton_nand_partitions,
414 .nr_parts = ARRAY_SIZE(littleton_nand_partitions),
415};
416
417static void __init littleton_init_nand(void)
418{
419 pxa3xx_set_nand_info(&littleton_nand_info);
420}
421#else
422static inline void littleton_init_nand(void) {}
423#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
424
364static void __init littleton_init(void) 425static void __init littleton_init(void)
365{ 426{
366 /* initialize MFP configurations */ 427 /* initialize MFP configurations */
@@ -374,6 +435,7 @@ static void __init littleton_init(void)
374 435
375 littleton_init_lcd(); 436 littleton_init_lcd();
376 littleton_init_keypad(); 437 littleton_init_keypad();
438 littleton_init_nand();
377} 439}
378 440
379MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)") 441MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
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..ac26423cd20c 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -21,6 +21,7 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/smc91x.h>
24 25
25#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
26#include <linux/spi/ads7846.h> 27#include <linux/spi/ads7846.h>
@@ -43,6 +44,7 @@
43#include <asm/arch/pxa-regs.h> 44#include <asm/arch/pxa-regs.h>
44#include <asm/arch/pxa2xx-regs.h> 45#include <asm/arch/pxa2xx-regs.h>
45#include <asm/arch/mfp-pxa25x.h> 46#include <asm/arch/mfp-pxa25x.h>
47#include <asm/arch/audio.h>
46#include <asm/arch/lubbock.h> 48#include <asm/arch/lubbock.h>
47#include <asm/arch/udc.h> 49#include <asm/arch/udc.h>
48#include <asm/arch/irda.h> 50#include <asm/arch/irda.h>
@@ -196,11 +198,6 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
196 // no D+ pullup; lubbock can't connect/disconnect in software 198 // no D+ pullup; lubbock can't connect/disconnect in software
197}; 199};
198 200
199static struct platform_device lub_audio_device = {
200 .name = "pxa2xx-ac97",
201 .id = -1,
202};
203
204static struct resource sa1111_resources[] = { 201static struct resource sa1111_resources[] = {
205 [0] = { 202 [0] = {
206 .start = 0x10000000, 203 .start = 0x10000000,
@@ -230,14 +227,6 @@ static struct pxa2xx_spi_master pxa_ssp_master_info = {
230 .num_chipselect = 0, 227 .num_chipselect = 0,
231}; 228};
232 229
233static struct platform_device pxa_ssp = {
234 .name = "pxa2xx-spi",
235 .id = 1,
236 .dev = {
237 .platform_data = &pxa_ssp_master_info,
238 },
239};
240
241static int lubbock_ads7846_pendown_state(void) 230static int lubbock_ads7846_pendown_state(void)
242{ 231{
243 /* TS_BUSY is bit 8 in LUB_MISC_RD, but pendown is irq-only */ 232 /* TS_BUSY is bit 8 in LUB_MISC_RD, but pendown is irq-only */
@@ -296,11 +285,18 @@ static struct resource smc91x_resources[] = {
296 }, 285 },
297}; 286};
298 287
288static struct smc91x_platdata lubbock_smc91x_info = {
289 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_IO_SHIFT_2,
290};
291
299static struct platform_device smc91x_device = { 292static struct platform_device smc91x_device = {
300 .name = "smc91x", 293 .name = "smc91x",
301 .id = -1, 294 .id = -1,
302 .num_resources = ARRAY_SIZE(smc91x_resources), 295 .num_resources = ARRAY_SIZE(smc91x_resources),
303 .resource = smc91x_resources, 296 .resource = smc91x_resources,
297 .dev = {
298 .platform_data = &lubbock_smc91x_info,
299 },
304}; 300};
305 301
306static struct resource flash_resources[] = { 302static struct resource flash_resources[] = {
@@ -368,11 +364,9 @@ 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],
375 &pxa_ssp,
376}; 370};
377 371
378static struct pxafb_mode_info sharp_lm8v31_mode = { 372static struct pxafb_mode_info sharp_lm8v31_mode = {
@@ -476,6 +470,7 @@ static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
476 } else if (mode & IR_FIRMODE) { 470 } else if (mode & IR_FIRMODE) {
477 LUB_MISC_WR |= 1 << 4; 471 LUB_MISC_WR |= 1 << 4;
478 } 472 }
473 pxa2xx_transceiver_mode(dev, mode);
479 local_irq_restore(flags); 474 local_irq_restore(flags);
480} 475}
481 476
@@ -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;
@@ -505,6 +501,7 @@ static void __init lubbock_init(void)
505 lubbock_flash_data[flashboot].name = "boot-rom"; 501 lubbock_flash_data[flashboot].name = "boot-rom";
506 (void) platform_add_devices(devices, ARRAY_SIZE(devices)); 502 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
507 503
504 pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
508 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); 505 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
509} 506}
510 507
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index badba064dc04..c9d274f0048f 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -17,31 +17,32 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/gpio.h>
20#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
21#include <linux/input.h> 22#include <linux/input.h>
22#include <linux/mfd/htc-egpio.h> 23#include <linux/mfd/htc-egpio.h>
23#include <linux/mfd/htc-pasic3.h> 24#include <linux/mfd/htc-pasic3.h>
24#include <linux/mtd/mtd.h>
25#include <linux/mtd/map.h>
26#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
27#include <linux/pda_power.h> 26#include <linux/pda_power.h>
27#include <linux/pwm_backlight.h>
28 28
29#include <asm/gpio.h>
30#include <asm/hardware.h> 29#include <asm/hardware.h>
31#include <asm/mach-types.h> 30#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
33#include <asm/arch/magician.h> 32#include <asm/arch/magician.h>
34#include <asm/arch/mfp-pxa27x.h> 33#include <asm/arch/mfp-pxa27x.h>
35#include <asm/arch/pxa-regs.h> 34#include <asm/arch/pxa-regs.h>
35#include <asm/arch/pxa2xx-regs.h>
36#include <asm/arch/pxafb.h> 36#include <asm/arch/pxafb.h>
37#include <asm/arch/i2c.h> 37#include <asm/arch/i2c.h>
38#include <asm/arch/mmc.h> 38#include <asm/arch/mmc.h>
39#include <asm/arch/irda.h> 39#include <asm/arch/irda.h>
40#include <asm/arch/ohci.h> 40#include <asm/arch/ohci.h>
41 41
42#include "devices.h"
42#include "generic.h" 43#include "generic.h"
43 44
44static unsigned long magician_pin_config[] = { 45static unsigned long magician_pin_config[] __initdata = {
45 46
46 /* SDRAM and Static Memory I/O Signals */ 47 /* SDRAM and Static Memory I/O Signals */
47 GPIO20_nSDCS_2, 48 GPIO20_nSDCS_2,
@@ -131,6 +132,7 @@ static unsigned long magician_pin_config[] = {
131static void magician_irda_transceiver_mode(struct device *dev, int mode) 132static void magician_irda_transceiver_mode(struct device *dev, int mode)
132{ 133{
133 gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF); 134 gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF);
135 pxa2xx_transceiver_mode(dev, mode);
134} 136}
135 137
136static struct pxaficp_platform_data magician_ficp_info = { 138static struct pxaficp_platform_data magician_ficp_info = {
@@ -348,40 +350,59 @@ static struct pxafb_mach_info samsung_info = {
348 * Backlight 350 * Backlight
349 */ 351 */
350 352
351static void magician_set_bl_intensity(int intensity) 353static int magician_backlight_init(struct device *dev)
352{ 354{
353 if (intensity) { 355 int ret;
354 PWM_CTRL0 = 1; 356
355 PWM_PERVAL0 = 0xc8; 357 ret = gpio_request(EGPIO_MAGICIAN_BL_POWER, "BL_POWER");
356 if (intensity > 0xc7) { 358 if (ret)
357 PWM_PWDUTY0 = intensity - 0x48; 359 goto err;
358 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); 360 ret = gpio_request(EGPIO_MAGICIAN_BL_POWER2, "BL_POWER2");
359 } else { 361 if (ret)
360 PWM_PWDUTY0 = intensity; 362 goto err2;
361 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); 363 return 0;
362 } 364
363 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 1); 365err2:
364 pxa_set_cken(CKEN_PWM0, 1); 366 gpio_free(EGPIO_MAGICIAN_BL_POWER);
367err:
368 return ret;
369}
370
371static int magician_backlight_notify(int brightness)
372{
373 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
374 if (brightness >= 200) {
375 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
376 return brightness - 72;
365 } else { 377 } else {
366 /* PWM_PWDUTY0 = intensity; */ 378 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0);
367 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 0); 379 return brightness;
368 pxa_set_cken(CKEN_PWM0, 0);
369 } 380 }
370} 381}
371 382
372static struct generic_bl_info backlight_info = { 383static void magician_backlight_exit(struct device *dev)
373 .default_intensity = 0x64, 384{
374 .limit_mask = 0x0b, 385 gpio_free(EGPIO_MAGICIAN_BL_POWER);
375 .max_intensity = 0xc7+0x48, 386 gpio_free(EGPIO_MAGICIAN_BL_POWER2);
376 .set_bl_intensity = magician_set_bl_intensity, 387}
388
389static struct platform_pwm_backlight_data backlight_data = {
390 .pwm_id = 0,
391 .max_brightness = 272,
392 .dft_brightness = 100,
393 .pwm_period_ns = 30923,
394 .init = magician_backlight_init,
395 .notify = magician_backlight_notify,
396 .exit = magician_backlight_exit,
377}; 397};
378 398
379static struct platform_device backlight = { 399static struct platform_device backlight = {
380 .name = "generic-bl", 400 .name = "pwm-backlight",
401 .id = -1,
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/*
@@ -490,6 +511,37 @@ static struct platform_device pasic3 = {
490 * External power 511 * External power
491 */ 512 */
492 513
514static int power_supply_init(struct device *dev)
515{
516 int ret;
517
518 ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC");
519 if (ret)
520 goto err_cs_ac;
521 ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_USB, "CABLE_STATE_USB");
522 if (ret)
523 goto err_cs_usb;
524 ret = gpio_request(EGPIO_MAGICIAN_CHARGE_EN, "CHARGE_EN");
525 if (ret)
526 goto err_chg_en;
527 ret = gpio_request(GPIO30_MAGICIAN_nCHARGE_EN, "nCHARGE_EN");
528 if (!ret)
529 ret = gpio_direction_output(GPIO30_MAGICIAN_nCHARGE_EN, 0);
530 if (ret)
531 goto err_nchg_en;
532
533 return 0;
534
535err_nchg_en:
536 gpio_free(EGPIO_MAGICIAN_CHARGE_EN);
537err_chg_en:
538 gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB);
539err_cs_usb:
540 gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC);
541err_cs_ac:
542 return ret;
543}
544
493static int magician_is_ac_online(void) 545static int magician_is_ac_online(void)
494{ 546{
495 return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); 547 return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC);
@@ -506,14 +558,24 @@ static void magician_set_charge(int flags)
506 gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); 558 gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags);
507} 559}
508 560
561static void power_supply_exit(struct device *dev)
562{
563 gpio_free(GPIO30_MAGICIAN_nCHARGE_EN);
564 gpio_free(EGPIO_MAGICIAN_CHARGE_EN);
565 gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB);
566 gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC);
567}
568
509static char *magician_supplicants[] = { 569static char *magician_supplicants[] = {
510 "ds2760-battery.0", "backup-battery" 570 "ds2760-battery.0", "backup-battery"
511}; 571};
512 572
513static struct pda_power_pdata power_supply_info = { 573static struct pda_power_pdata power_supply_info = {
574 .init = power_supply_init,
514 .is_ac_online = magician_is_ac_online, 575 .is_ac_online = magician_is_ac_online,
515 .is_usb_online = magician_is_usb_online, 576 .is_usb_online = magician_is_usb_online,
516 .set_charge = magician_set_charge, 577 .set_charge = magician_set_charge,
578 .exit = power_supply_exit,
517 .supplied_to = magician_supplicants, 579 .supplied_to = magician_supplicants,
518 .num_supplicants = ARRAY_SIZE(magician_supplicants), 580 .num_supplicants = ARRAY_SIZE(magician_supplicants),
519}; 581};
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 7399fb34da4e..851ec2d9b699 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -23,9 +23,10 @@
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#include <linux/smc91x.h>
29 30
30#include <asm/types.h> 31#include <asm/types.h>
31#include <asm/setup.h> 32#include <asm/setup.h>
@@ -110,9 +111,9 @@ static unsigned long mainstone_pin_config[] = {
110 GPIO45_AC97_SYSCLK, 111 GPIO45_AC97_SYSCLK,
111 112
112 /* Keypad */ 113 /* Keypad */
113 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, 114 GPIO93_KP_DKIN_0,
114 GPIO94_KP_DKIN_1 | WAKEUP_ON_LEVEL_HIGH, 115 GPIO94_KP_DKIN_1,
115 GPIO95_KP_DKIN_2 | WAKEUP_ON_LEVEL_HIGH, 116 GPIO95_KP_DKIN_2,
116 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, 117 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
117 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, 118 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
118 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, 119 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
@@ -240,11 +241,19 @@ static struct resource smc91x_resources[] = {
240 } 241 }
241}; 242};
242 243
244static struct smc91x_platdata mainstone_smc91x_info = {
245 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT |
246 SMC91X_NOWAIT | SMC91X_USE_DMA,
247};
248
243static struct platform_device smc91x_device = { 249static struct platform_device smc91x_device = {
244 .name = "smc91x", 250 .name = "smc91x",
245 .id = 0, 251 .id = 0,
246 .num_resources = ARRAY_SIZE(smc91x_resources), 252 .num_resources = ARRAY_SIZE(smc91x_resources),
247 .resource = smc91x_resources, 253 .resource = smc91x_resources,
254 .dev = {
255 .platform_data = &mainstone_smc91x_info,
256 },
248}; 257};
249 258
250static int mst_audio_startup(struct snd_pcm_substream *substream, void *priv) 259static int mst_audio_startup(struct snd_pcm_substream *substream, void *priv)
@@ -280,12 +289,6 @@ static pxa2xx_audio_ops_t mst_audio_ops = {
280 .resume = mst_audio_resume, 289 .resume = mst_audio_resume,
281}; 290};
282 291
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[] = { 292static struct resource flash_resources[] = {
290 [0] = { 293 [0] = {
291 .start = PXA_CS0_PHYS, 294 .start = PXA_CS0_PHYS,
@@ -349,56 +352,27 @@ static struct platform_device mst_flash_device[2] = {
349 }, 352 },
350}; 353};
351 354
352#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE 355#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
353static int mainstone_backlight_update_status(struct backlight_device *bl) 356static struct platform_pwm_backlight_data mainstone_backlight_data = {
354{ 357 .pwm_id = 0,
355 int brightness = bl->props.brightness; 358 .max_brightness = 1023,
356 359 .dft_brightness = 1023,
357 if (bl->props.power != FB_BLANK_UNBLANK || 360 .pwm_period_ns = 78770,
358 bl->props.fb_blank != FB_BLANK_UNBLANK) 361};
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 362
378static /*const*/ struct backlight_ops mainstone_backlight_ops = { 363static struct platform_device mainstone_backlight_device = {
379 .update_status = mainstone_backlight_update_status, 364 .name = "pwm-backlight",
380 .get_brightness = mainstone_backlight_get_brightness, 365 .dev = {
366 .parent = &pxa27x_device_pwm0.dev,
367 .platform_data = &mainstone_backlight_data,
368 },
381}; 369};
382 370
383static void __init mainstone_backlight_register(void) 371static void __init mainstone_backlight_register(void)
384{ 372{
385 struct backlight_device *bl; 373 int ret = platform_device_register(&mainstone_backlight_device);
386 374 if (ret)
387 bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev, 375 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} 376}
403#else 377#else
404#define mainstone_backlight_register() do { } while (0) 378#define mainstone_backlight_register() do { } while (0)
@@ -490,6 +464,7 @@ static void mainstone_irda_transceiver_mode(struct device *dev, int mode)
490 } else if (mode & IR_FIRMODE) { 464 } else if (mode & IR_FIRMODE) {
491 MST_MSCWR1 |= MST_MSCWR1_IRDA_FIR; 465 MST_MSCWR1 |= MST_MSCWR1_IRDA_FIR;
492 } 466 }
467 pxa2xx_transceiver_mode(dev, mode);
493 if (mode & IR_OFF) { 468 if (mode & IR_OFF) {
494 MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_OFF; 469 MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_OFF;
495 } else { 470 } else {
@@ -528,7 +503,6 @@ static struct platform_device mst_gpio_keys_device = {
528 503
529static struct platform_device *platform_devices[] __initdata = { 504static struct platform_device *platform_devices[] __initdata = {
530 &smc91x_device, 505 &smc91x_device,
531 &mst_audio_device,
532 &mst_flash_device[0], 506 &mst_flash_device[0],
533 &mst_flash_device[1], 507 &mst_flash_device[1],
534 &mst_gpio_keys_device, 508 &mst_gpio_keys_device,
@@ -549,7 +523,7 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = {
549 .init = mainstone_ohci_init, 523 .init = mainstone_ohci_init,
550}; 524};
551 525
552#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) 526#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
553static unsigned int mainstone_matrix_keys[] = { 527static unsigned int mainstone_matrix_keys[] = {
554 KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C), 528 KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C),
555 KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F), 529 KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F),
@@ -638,6 +612,7 @@ static void __init mainstone_init(void)
638 pxa_set_ficp_info(&mainstone_ficp_platform_data); 612 pxa_set_ficp_info(&mainstone_ficp_platform_data);
639 pxa_set_ohci_info(&mainstone_ohci_platform_data); 613 pxa_set_ohci_info(&mainstone_ohci_platform_data);
640 pxa_set_i2c_info(NULL); 614 pxa_set_i2c_info(NULL);
615 pxa_set_ac97_info(&mst_audio_ops);
641 616
642 mainstone_init_keypad(); 617 mainstone_init_keypad();
643} 618}
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 22097a1707cc..fd4545eab803 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"
@@ -38,6 +39,28 @@ struct gpio_desc {
38 39
39static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1]; 40static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
40 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
41static int __mfp_config_gpio(unsigned gpio, unsigned long c) 64static int __mfp_config_gpio(unsigned gpio, unsigned long c)
42{ 65{
43 unsigned long gafr, mask = GPIO_bit(gpio); 66 unsigned long gafr, mask = GPIO_bit(gpio);
@@ -56,21 +79,8 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
56 else 79 else
57 GPDR(gpio) &= ~mask; 80 GPDR(gpio) &= ~mask;
58 81
59 /* low power state */ 82 if (__mfp_config_lpm(gpio, c & MFP_LPM_STATE_MASK))
60 switch (c & MFP_LPM_STATE_MASK) {
61 case MFP_LPM_DRIVE_HIGH:
62 PGSR(gpio) |= mask;
63 break;
64 case MFP_LPM_DRIVE_LOW:
65 PGSR(gpio) &= ~mask;
66 break;
67 case MFP_LPM_INPUT:
68 break;
69 default:
70 pr_warning("%s: invalid low power state for GPIO%d\n",
71 __func__, gpio);
72 return -EINVAL; 83 return -EINVAL;
73 }
74 84
75 /* 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
76 * configurations of those pins not able to wakeup 86 * configurations of those pins not able to wakeup
@@ -90,6 +100,18 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
90 return 0; 100 return 0;
91} 101}
92 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
93void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num) 115void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
94{ 116{
95 unsigned long flags; 117 unsigned long flags;
@@ -98,13 +120,9 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
98 120
99 for (i = 0, c = mfp_cfgs; i < num; i++, c++) { 121 for (i = 0, c = mfp_cfgs; i < num; i++, c++) {
100 122
101 gpio = mfp_to_gpio(MFP_PIN(*c)); 123 gpio = __mfp_validate(MFP_PIN(*c));
102 124 if (gpio < 0)
103 if (!gpio_desc[gpio].valid) {
104 pr_warning("%s: GPIO%d is invalid pin\n",
105 __func__, gpio);
106 continue; 125 continue;
107 }
108 126
109 local_irq_save(flags); 127 local_irq_save(flags);
110 128
@@ -115,6 +133,20 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
115 } 133 }
116} 134}
117 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
118int gpio_set_wake(unsigned int gpio, unsigned int on) 150int gpio_set_wake(unsigned int gpio, unsigned int on)
119{ 151{
120 struct gpio_desc *d; 152 struct gpio_desc *d;
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
new file mode 100644
index 000000000000..408657a24f8c
--- /dev/null
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -0,0 +1,416 @@
1/*
2 * Hardware definitions for PalmTX
3 *
4 * Author: Marek Vasut <marek.vasut@gmail.com>
5 *
6 * Based on work of:
7 * Alex Osborne <ato@meshy.org>
8 * Cristiano P. <cristianop@users.sourceforge.net>
9 * Jan Herman <2hp@seznam.cz>
10 * Michal Hrusecky
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * (find more info at www.hackndev.com)
17 *
18 */
19
20#include <linux/platform_device.h>
21#include <linux/delay.h>
22#include <linux/irq.h>
23#include <linux/gpio_keys.h>
24#include <linux/input.h>
25#include <linux/pda_power.h>
26#include <linux/pwm_backlight.h>
27#include <linux/gpio.h>
28
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32
33#include <asm/arch/audio.h>
34#include <asm/arch/palmtx.h>
35#include <asm/arch/mmc.h>
36#include <asm/arch/pxafb.h>
37#include <asm/arch/pxa-regs.h>
38#include <asm/arch/mfp-pxa27x.h>
39#include <asm/arch/irda.h>
40#include <asm/arch/pxa27x_keypad.h>
41#include <asm/arch/udc.h>
42
43#include "generic.h"
44#include "devices.h"
45
46/******************************************************************************
47 * Pin configuration
48 ******************************************************************************/
49static unsigned long palmtx_pin_config[] __initdata = {
50 /* MMC */
51 GPIO32_MMC_CLK,
52 GPIO92_MMC_DAT_0,
53 GPIO109_MMC_DAT_1,
54 GPIO110_MMC_DAT_2,
55 GPIO111_MMC_DAT_3,
56 GPIO112_MMC_CMD,
57
58 /* AC97 */
59 GPIO28_AC97_BITCLK,
60 GPIO29_AC97_SDATA_IN_0,
61 GPIO30_AC97_SDATA_OUT,
62 GPIO31_AC97_SYNC,
63
64 /* IrDA */
65 GPIO46_FICP_RXD,
66 GPIO47_FICP_TXD,
67
68 /* PWM */
69 GPIO16_PWM0_OUT,
70
71 /* USB */
72 GPIO13_GPIO,
73
74 /* PCMCIA */
75 GPIO48_nPOE,
76 GPIO49_nPWE,
77 GPIO50_nPIOR,
78 GPIO51_nPIOW,
79 GPIO85_nPCE_1,
80 GPIO54_nPCE_2,
81 GPIO79_PSKTSEL,
82 GPIO55_nPREG,
83 GPIO56_nPWAIT,
84 GPIO57_nIOIS16,
85};
86
87/******************************************************************************
88 * SD/MMC card controller
89 ******************************************************************************/
90static int palmtx_mci_init(struct device *dev, irq_handler_t palmtx_detect_int,
91 void *data)
92{
93 int err = 0;
94
95 /* Setup an interrupt for detecting card insert/remove events */
96 err = request_irq(IRQ_GPIO_PALMTX_SD_DETECT_N, palmtx_detect_int,
97 IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
98 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
99 "SD/MMC card detect", data);
100 if (err) {
101 printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n",
102 __func__);
103 return err;
104 }
105
106 err = gpio_request(GPIO_NR_PALMTX_SD_POWER, "SD_POWER");
107 if (err)
108 goto pwr_err;
109
110 err = gpio_request(GPIO_NR_PALMTX_SD_READONLY, "SD_READONLY");
111 if (err)
112 goto ro_err;
113
114 printk(KERN_DEBUG "%s: irq registered\n", __func__);
115
116 return 0;
117
118ro_err:
119 gpio_free(GPIO_NR_PALMTX_SD_POWER);
120pwr_err:
121 free_irq(IRQ_GPIO_PALMTX_SD_DETECT_N, data);
122 return err;
123}
124
125static void palmtx_mci_exit(struct device *dev, void *data)
126{
127 gpio_free(GPIO_NR_PALMTX_SD_READONLY);
128 gpio_free(GPIO_NR_PALMTX_SD_POWER);
129 free_irq(IRQ_GPIO_PALMTX_SD_DETECT_N, data);
130}
131
132static void palmtx_mci_power(struct device *dev, unsigned int vdd)
133{
134 struct pxamci_platform_data *p_d = dev->platform_data;
135 gpio_set_value(GPIO_NR_PALMTX_SD_POWER, p_d->ocr_mask & (1 << vdd));
136}
137
138static int palmtx_mci_get_ro(struct device *dev)
139{
140 return gpio_get_value(GPIO_NR_PALMTX_SD_READONLY);
141}
142
143static struct pxamci_platform_data palmtx_mci_platform_data = {
144 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
145 .setpower = palmtx_mci_power,
146 .get_ro = palmtx_mci_get_ro,
147 .init = palmtx_mci_init,
148 .exit = palmtx_mci_exit,
149};
150
151/******************************************************************************
152 * GPIO keyboard
153 ******************************************************************************/
154static unsigned int palmtx_matrix_keys[] = {
155 KEY(0, 0, KEY_POWER),
156 KEY(0, 1, KEY_F1),
157 KEY(0, 2, KEY_ENTER),
158
159 KEY(1, 0, KEY_F2),
160 KEY(1, 1, KEY_F3),
161 KEY(1, 2, KEY_F4),
162
163 KEY(2, 0, KEY_UP),
164 KEY(2, 2, KEY_DOWN),
165
166 KEY(3, 0, KEY_RIGHT),
167 KEY(3, 2, KEY_LEFT),
168
169};
170
171static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = {
172 .matrix_key_rows = 4,
173 .matrix_key_cols = 3,
174 .matrix_key_map = palmtx_matrix_keys,
175 .matrix_key_map_size = ARRAY_SIZE(palmtx_matrix_keys),
176
177 .debounce_interval = 30,
178};
179
180/******************************************************************************
181 * GPIO keys
182 ******************************************************************************/
183static struct gpio_keys_button palmtx_pxa_buttons[] = {
184 {KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
185};
186
187static struct gpio_keys_platform_data palmtx_pxa_keys_data = {
188 .buttons = palmtx_pxa_buttons,
189 .nbuttons = ARRAY_SIZE(palmtx_pxa_buttons),
190};
191
192static struct platform_device palmtx_pxa_keys = {
193 .name = "gpio-keys",
194 .id = -1,
195 .dev = {
196 .platform_data = &palmtx_pxa_keys_data,
197 },
198};
199
200/******************************************************************************
201 * Backlight
202 ******************************************************************************/
203static int palmtx_backlight_init(struct device *dev)
204{
205 int ret;
206
207 ret = gpio_request(GPIO_NR_PALMTX_BL_POWER, "BL POWER");
208 if (ret)
209 goto err;
210 ret = gpio_request(GPIO_NR_PALMTX_LCD_POWER, "LCD POWER");
211 if (ret)
212 goto err2;
213
214 return 0;
215err2:
216 gpio_free(GPIO_NR_PALMTX_BL_POWER);
217err:
218 return ret;
219}
220
221static int palmtx_backlight_notify(int brightness)
222{
223 gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness);
224 gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness);
225 return brightness;
226}
227
228static void palmtx_backlight_exit(struct device *dev)
229{
230 gpio_free(GPIO_NR_PALMTX_BL_POWER);
231 gpio_free(GPIO_NR_PALMTX_LCD_POWER);
232}
233
234static struct platform_pwm_backlight_data palmtx_backlight_data = {
235 .pwm_id = 0,
236 .max_brightness = PALMTX_MAX_INTENSITY,
237 .dft_brightness = PALMTX_MAX_INTENSITY,
238 .pwm_period_ns = PALMTX_PERIOD_NS,
239 .init = palmtx_backlight_init,
240 .notify = palmtx_backlight_notify,
241 .exit = palmtx_backlight_exit,
242};
243
244static struct platform_device palmtx_backlight = {
245 .name = "pwm-backlight",
246 .dev = {
247 .parent = &pxa27x_device_pwm0.dev,
248 .platform_data = &palmtx_backlight_data,
249 },
250};
251
252/******************************************************************************
253 * IrDA
254 ******************************************************************************/
255static void palmtx_irda_transceiver_mode(struct device *dev, int mode)
256{
257 gpio_set_value(GPIO_NR_PALMTX_IR_DISABLE, mode & IR_OFF);
258 pxa2xx_transceiver_mode(dev, mode);
259}
260
261static struct pxaficp_platform_data palmtx_ficp_platform_data = {
262 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
263 .transceiver_mode = palmtx_irda_transceiver_mode,
264};
265
266/******************************************************************************
267 * UDC
268 ******************************************************************************/
269static void palmtx_udc_command(int cmd)
270{
271 gpio_set_value(GPIO_NR_PALMTX_USB_POWER, !cmd);
272 udelay(50);
273 gpio_set_value(GPIO_NR_PALMTX_USB_PULLUP, !cmd);
274}
275
276static struct pxa2xx_udc_mach_info palmtx_udc_info __initdata = {
277 .gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N,
278 .gpio_vbus_inverted = 1,
279 .udc_command = palmtx_udc_command,
280};
281
282/******************************************************************************
283 * Power supply
284 ******************************************************************************/
285static int power_supply_init(struct device *dev)
286{
287 int ret;
288
289 ret = gpio_request(GPIO_NR_PALMTX_POWER_DETECT, "CABLE_STATE_AC");
290 if (ret)
291 goto err_cs_ac;
292
293 ret = gpio_request(GPIO_NR_PALMTX_USB_DETECT_N, "CABLE_STATE_USB");
294 if (ret)
295 goto err_cs_usb;
296
297 return 0;
298
299err_cs_usb:
300 gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
301err_cs_ac:
302 return ret;
303}
304
305static int palmtx_is_ac_online(void)
306{
307 return gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT);
308}
309
310static int palmtx_is_usb_online(void)
311{
312 return !gpio_get_value(GPIO_NR_PALMTX_USB_DETECT_N);
313}
314
315static void power_supply_exit(struct device *dev)
316{
317 gpio_free(GPIO_NR_PALMTX_USB_DETECT_N);
318 gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
319}
320
321static char *palmtx_supplicants[] = {
322 "main-battery",
323};
324
325static struct pda_power_pdata power_supply_info = {
326 .init = power_supply_init,
327 .is_ac_online = palmtx_is_ac_online,
328 .is_usb_online = palmtx_is_usb_online,
329 .exit = power_supply_exit,
330 .supplied_to = palmtx_supplicants,
331 .num_supplicants = ARRAY_SIZE(palmtx_supplicants),
332};
333
334static struct platform_device power_supply = {
335 .name = "pda-power",
336 .id = -1,
337 .dev = {
338 .platform_data = &power_supply_info,
339 },
340};
341
342/******************************************************************************
343 * Framebuffer
344 ******************************************************************************/
345static struct pxafb_mode_info palmtx_lcd_modes[] = {
346{
347 .pixclock = 57692,
348 .xres = 320,
349 .yres = 480,
350 .bpp = 16,
351
352 .left_margin = 32,
353 .right_margin = 1,
354 .upper_margin = 7,
355 .lower_margin = 1,
356
357 .hsync_len = 4,
358 .vsync_len = 1,
359},
360};
361
362static struct pxafb_mach_info palmtx_lcd_screen = {
363 .modes = palmtx_lcd_modes,
364 .num_modes = ARRAY_SIZE(palmtx_lcd_modes),
365 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
366};
367
368/******************************************************************************
369 * Machine init
370 ******************************************************************************/
371static struct platform_device *devices[] __initdata = {
372#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
373 &palmtx_pxa_keys,
374#endif
375 &palmtx_backlight,
376 &power_supply,
377};
378
379static struct map_desc palmtx_io_desc[] __initdata = {
380{
381 .virtual = PALMTX_PCMCIA_VIRT,
382 .pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS),
383 .length = PALMTX_PCMCIA_SIZE,
384 .type = MT_DEVICE
385},
386};
387
388static void __init palmtx_map_io(void)
389{
390 pxa_map_io();
391 iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
392}
393
394static void __init palmtx_init(void)
395{
396 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
397
398 set_pxa_fb_info(&palmtx_lcd_screen);
399 pxa_set_mci_info(&palmtx_mci_platform_data);
400 pxa_set_udc_info(&palmtx_udc_info);
401 pxa_set_ac97_info(NULL);
402 pxa_set_ficp_info(&palmtx_ficp_platform_data);
403 pxa_set_keypad_info(&palmtx_keypad_platform_data);
404
405 platform_add_devices(devices, ARRAY_SIZE(devices));
406}
407
408MACHINE_START(PALMTX, "Palm T|X")
409 .phys_io = PALMTX_PHYS_IO_START,
410 .io_pg_offst = io_p2v(0x40000000),
411 .boot_params = 0xa0000100,
412 .map_io = palmtx_map_io,
413 .init_irq = pxa27x_init_irq,
414 .timer = &pxa_timer,
415 .init_machine = palmtx_init
416MACHINE_END
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c
index 3b945eb0aee3..377f3be8ce57 100644
--- a/arch/arm/mach-pxa/pcm027.c
+++ b/arch/arm/mach-pxa/pcm027.c
@@ -24,7 +24,9 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/spi/max7301.h>
27#include <linux/leds.h> 28#include <linux/leds.h>
29
28#include <asm/mach-types.h> 30#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
30#include <asm/arch/hardware.h> 32#include <asm/arch/hardware.h>
@@ -108,6 +110,32 @@ static struct platform_device smc91x_device = {
108 .resource = smc91x_resources, 110 .resource = smc91x_resources,
109}; 111};
110 112
113/*
114 * SPI host and devices
115 */
116static struct pxa2xx_spi_master pxa_ssp_master_info = {
117 .num_chipselect = 1,
118};
119
120static struct max7301_platform_data max7301_info = {
121 .base = -1,
122};
123
124/* bus_num must match id in pxa2xx_set_spi_info() call */
125static struct spi_board_info spi_board_info[] __initdata = {
126 {
127 .modalias = "max7301",
128 .platform_data = &max7301_info,
129 .max_speed_hz = 13000000,
130 .bus_num = 1,
131 .chip_select = 0,
132 .mode = SPI_MODE_0,
133 },
134};
135
136/*
137 * NOR flash
138 */
111static struct physmap_flash_data pcm027_flash_data = { 139static struct physmap_flash_data pcm027_flash_data = {
112 .width = 4, 140 .width = 4,
113}; 141};
@@ -190,6 +218,9 @@ static void __init pcm027_init(void)
190#ifdef CONFIG_MACH_PCM990_BASEBOARD 218#ifdef CONFIG_MACH_PCM990_BASEBOARD
191 pcm990_baseboard_init(); 219 pcm990_baseboard_init();
192#endif 220#endif
221
222 pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
223 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
193} 224}
194 225
195static void __init pcm027_map_io(void) 226static void __init pcm027_map_io(void)
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 49d951db0f3d..30023b00e476 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
@@ -32,13 +33,120 @@
32#include <asm/arch/camera.h> 33#include <asm/arch/camera.h>
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/audio.h>
36#include <asm/arch/mmc.h> 37#include <asm/arch/mmc.h>
37#include <asm/arch/ohci.h> 38#include <asm/arch/ohci.h>
38#include <asm/arch/pcm990_baseboard.h> 39#include <asm/arch/pcm990_baseboard.h>
40#include <asm/arch/pxafb.h>
41#include <asm/arch/mfp-pxa27x.h>
42
43#include "devices.h"
44#include "generic.h"
45
46static unsigned long pcm990_pin_config[] __initdata = {
47 /* MMC */
48 GPIO32_MMC_CLK,
49 GPIO112_MMC_CMD,
50 GPIO92_MMC_DAT_0,
51 GPIO109_MMC_DAT_1,
52 GPIO110_MMC_DAT_2,
53 GPIO111_MMC_DAT_3,
54 /* USB */
55 GPIO88_USBH1_PWR,
56 GPIO89_USBH1_PEN,
57 /* PWM0 */
58 GPIO16_PWM0_OUT,
59};
39 60
40/* 61/*
41 * The PCM-990 development baseboard uses PCM-027's hardeware in the 62 * pcm990_lcd_power - control power supply to the LCD
63 * @on: 0 = switch off, 1 = switch on
64 *
65 * Called by the pxafb driver
66 */
67#ifndef CONFIG_PCM990_DISPLAY_NONE
68static void pcm990_lcd_power(int on, struct fb_var_screeninfo *var)
69{
70 if (on) {
71 /* enable LCD-Latches
72 * power on LCD
73 */
74 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) =
75 PCM990_CTRL_LCDPWR + PCM990_CTRL_LCDON;
76 } else {
77 /* disable LCD-Latches
78 * power off LCD
79 */
80 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = 0x00;
81 }
82}
83#endif
84
85#if defined(CONFIG_PCM990_DISPLAY_SHARP)
86static struct pxafb_mode_info fb_info_sharp_lq084v1dg21 = {
87 .pixclock = 28000,
88 .xres = 640,
89 .yres = 480,
90 .bpp = 16,
91 .hsync_len = 20,
92 .left_margin = 103,
93 .right_margin = 47,
94 .vsync_len = 6,
95 .upper_margin = 28,
96 .lower_margin = 5,
97 .sync = 0,
98 .cmap_greyscale = 0,
99};
100
101static struct pxafb_mach_info pcm990_fbinfo __initdata = {
102 .modes = &fb_info_sharp_lq084v1dg21,
103 .num_modes = 1,
104 .lccr0 = LCCR0_PAS,
105 .lccr3 = LCCR3_PCP,
106 .pxafb_lcd_power = pcm990_lcd_power,
107};
108#elif defined(CONFIG_PCM990_DISPLAY_NEC)
109struct pxafb_mode_info fb_info_nec_nl6448bc20_18d = {
110 .pixclock = 39720,
111 .xres = 640,
112 .yres = 480,
113 .bpp = 16,
114 .hsync_len = 32,
115 .left_margin = 16,
116 .right_margin = 48,
117 .vsync_len = 2,
118 .upper_margin = 12,
119 .lower_margin = 17,
120 .sync = 0,
121 .cmap_greyscale = 0,
122};
123
124static struct pxafb_mach_info pcm990_fbinfo __initdata = {
125 .modes = &fb_info_nec_nl6448bc20_18d,
126 .num_modes = 1,
127 .lccr0 = LCCR0_Act,
128 .lccr3 = LCCR3_PixFlEdg,
129 .pxafb_lcd_power = pcm990_lcd_power,
130};
131#endif
132
133static struct platform_pwm_backlight_data pcm990_backlight_data = {
134 .pwm_id = 0,
135 .max_brightness = 1023,
136 .dft_brightness = 1023,
137 .pwm_period_ns = 78770,
138};
139
140static struct platform_device pcm990_backlight_device = {
141 .name = "pwm-backlight",
142 .dev = {
143 .parent = &pxa27x_device_pwm0.dev,
144 .platform_data = &pcm990_backlight_data,
145 },
146};
147
148/*
149 * The PCM-990 development baseboard uses PCM-027's hardware in the
42 * following way: 150 * following way:
43 * 151 *
44 * - LCD support is in use 152 * - LCD support is in use
@@ -185,16 +293,6 @@ static int pcm990_mci_init(struct device *dev, irq_handler_t mci_detect_int,
185{ 293{
186 int err; 294 int err;
187 295
188 /*
189 * enable GPIO for PXA27x MMC controller
190 */
191 pxa_gpio_mode(GPIO32_MMCCLK_MD);
192 pxa_gpio_mode(GPIO112_MMCCMD_MD);
193 pxa_gpio_mode(GPIO92_MMCDAT0_MD);
194 pxa_gpio_mode(GPIO109_MMCDAT1_MD);
195 pxa_gpio_mode(GPIO110_MMCDAT2_MD);
196 pxa_gpio_mode(GPIO111_MMCDAT3_MD);
197
198 err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, IRQF_DISABLED, 296 err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, IRQF_DISABLED,
199 "MMC card detect", data); 297 "MMC card detect", data);
200 if (err) 298 if (err)
@@ -241,8 +339,6 @@ static struct pxamci_platform_data pcm990_mci_platform_data = {
241 */ 339 */
242static int pcm990_ohci_init(struct device *dev) 340static int pcm990_ohci_init(struct device *dev)
243{ 341{
244 pxa_gpio_mode(PCM990_USB_OVERCURRENT);
245 pxa_gpio_mode(PCM990_USB_PWR_EN);
246 /* 342 /*
247 * disable USB port 2 and 3 343 * disable USB port 2 and 3
248 * power sense is active low 344 * power sense is active low
@@ -269,23 +365,27 @@ static struct pxaohci_platform_data pcm990_ohci_platform_data = {
269 * PXA27x Camera specific stuff 365 * PXA27x Camera specific stuff
270 */ 366 */
271#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) 367#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
368static unsigned long pcm990_camera_pin_config[] = {
369 /* CIF */
370 GPIO98_CIF_DD_0,
371 GPIO105_CIF_DD_1,
372 GPIO104_CIF_DD_2,
373 GPIO103_CIF_DD_3,
374 GPIO95_CIF_DD_4,
375 GPIO94_CIF_DD_5,
376 GPIO93_CIF_DD_6,
377 GPIO108_CIF_DD_7,
378 GPIO107_CIF_DD_8,
379 GPIO106_CIF_DD_9,
380 GPIO42_CIF_MCLK,
381 GPIO45_CIF_PCLK,
382 GPIO43_CIF_FV,
383 GPIO44_CIF_LV,
384};
385
272static int pcm990_pxacamera_init(struct device *dev) 386static int pcm990_pxacamera_init(struct device *dev)
273{ 387{
274 pxa_gpio_mode(GPIO98_CIF_DD_0_MD); 388 pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_camera_pin_config));
275 pxa_gpio_mode(GPIO105_CIF_DD_1_MD);
276 pxa_gpio_mode(GPIO104_CIF_DD_2_MD);
277 pxa_gpio_mode(GPIO103_CIF_DD_3_MD);
278 pxa_gpio_mode(GPIO95_CIF_DD_4_MD);
279 pxa_gpio_mode(GPIO94_CIF_DD_5_MD);
280 pxa_gpio_mode(GPIO93_CIF_DD_6_MD);
281 pxa_gpio_mode(GPIO108_CIF_DD_7_MD);
282 pxa_gpio_mode(GPIO107_CIF_DD_8_MD);
283 pxa_gpio_mode(GPIO106_CIF_DD_9_MD);
284 pxa_gpio_mode(GPIO42_CIF_MCLK_MD);
285 pxa_gpio_mode(GPIO45_CIF_PCLK_MD);
286 pxa_gpio_mode(GPIO43_CIF_FV_MD);
287 pxa_gpio_mode(GPIO44_CIF_LV_MD);
288
289 return 0; 389 return 0;
290} 390}
291 391
@@ -333,36 +433,6 @@ static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
333#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ 433#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */
334 434
335/* 435/*
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 436 * enable generic access to the base board control CPLDs U6 and U7
367 */ 437 */
368static struct map_desc pcm990_io_desc[] __initdata = { 438static struct map_desc pcm990_io_desc[] __initdata = {
@@ -387,13 +457,18 @@ static struct map_desc pcm990_io_desc[] __initdata = {
387 */ 457 */
388void __init pcm990_baseboard_init(void) 458void __init pcm990_baseboard_init(void)
389{ 459{
460 pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_pin_config));
461
390 /* register CPLD access */ 462 /* register CPLD access */
391 iotable_init(pcm990_io_desc, ARRAY_SIZE(pcm990_io_desc)); 463 iotable_init(ARRAY_AND_SIZE(pcm990_io_desc));
392 464
393 /* register CPLD's IRQ controller */ 465 /* register CPLD's IRQ controller */
394 pcm990_init_irq(); 466 pcm990_init_irq();
395 467
396 platform_device_register(&pxa27x_device_ac97); 468#ifndef CONFIG_PCM990_DISPLAY_NONE
469 set_pxa_fb_info(&pcm990_fbinfo);
470#endif
471 platform_device_register(&pcm990_backlight_device);
397 472
398 /* MMC */ 473 /* MMC */
399 pxa_set_mci_info(&pcm990_mci_platform_data); 474 pxa_set_mci_info(&pcm990_mci_platform_data);
@@ -402,13 +477,13 @@ void __init pcm990_baseboard_init(void)
402 pxa_set_ohci_info(&pcm990_ohci_platform_data); 477 pxa_set_ohci_info(&pcm990_ohci_platform_data);
403 478
404 pxa_set_i2c_info(NULL); 479 pxa_set_i2c_info(NULL);
480 pxa_set_ac97_info(NULL);
405 481
406#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) 482#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
407 pxa_set_camera_info(&pcm990_pxacamera_platform_data); 483 pxa_set_camera_info(&pcm990_pxacamera_platform_data);
408 484
409 i2c_register_board_info(0, pcm990_i2c_devices, 485 i2c_register_board_info(0, ARRAY_AND_SIZE(pcm990_i2c_devices));
410 ARRAY_SIZE(pcm990_i2c_devices));
411#endif 486#endif
412 487
413 printk(KERN_INFO"PCM-990 Evaluation baseboard initialized\n"); 488 printk(KERN_INFO "PCM-990 Evaluation baseboard initialized\n");
414} 489}
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 0b30f25cff3c..39612cfa0b4d 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>
@@ -266,6 +267,7 @@ static void poodle_irda_transceiver_mode(struct device *dev, int mode)
266 } else { 267 } else {
267 GPCR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON); 268 GPCR(POODLE_GPIO_IR_ON) = GPIO_bit(POODLE_GPIO_IR_ON);
268 } 269 }
270 pxa2xx_transceiver_mode(dev, mode);
269} 271}
270 272
271static struct pxaficp_platform_data poodle_ficp_platform_data = { 273static struct pxaficp_platform_data poodle_ficp_platform_data = {
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..c5b845b935bb 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>
@@ -108,6 +109,52 @@ static const struct clkops clk_pxa25x_lcd_ops = {
108 .getrate = clk_pxa25x_lcd_getrate, 109 .getrate = clk_pxa25x_lcd_getrate,
109}; 110};
110 111
112static unsigned long gpio12_config_32k[] = {
113 GPIO12_32KHz,
114};
115
116static unsigned long gpio12_config_gpio[] = {
117 GPIO12_GPIO,
118};
119
120static void clk_gpio12_enable(struct clk *clk)
121{
122 pxa2xx_mfp_config(gpio12_config_32k, 1);
123}
124
125static void clk_gpio12_disable(struct clk *clk)
126{
127 pxa2xx_mfp_config(gpio12_config_gpio, 1);
128}
129
130static const struct clkops clk_pxa25x_gpio12_ops = {
131 .enable = clk_gpio12_enable,
132 .disable = clk_gpio12_disable,
133};
134
135static unsigned long gpio11_config_3m6[] = {
136 GPIO11_3_6MHz,
137};
138
139static unsigned long gpio11_config_gpio[] = {
140 GPIO11_GPIO,
141};
142
143static void clk_gpio11_enable(struct clk *clk)
144{
145 pxa2xx_mfp_config(gpio11_config_3m6, 1);
146}
147
148static void clk_gpio11_disable(struct clk *clk)
149{
150 pxa2xx_mfp_config(gpio11_config_gpio, 1);
151}
152
153static const struct clkops clk_pxa25x_gpio11_ops = {
154 .enable = clk_gpio11_enable,
155 .disable = clk_gpio11_disable,
156};
157
111/* 158/*
112 * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz) 159 * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz)
113 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz 160 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
@@ -117,29 +164,40 @@ static struct clk pxa25x_hwuart_clk =
117 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev) 164 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev)
118; 165;
119 166
167/*
168 * PXA 2xx clock declarations. Order is important (see aliases below)
169 * Please be careful not to disrupt the ordering.
170 */
120static struct clk pxa25x_clks[] = { 171static struct clk pxa25x_clks[] = {
121 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev), 172 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
122 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev), 173 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
123 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev), 174 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
124 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL), 175 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
125 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev), 176 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev),
177 INIT_CLK("GPIO11_CLK", &clk_pxa25x_gpio11_ops, 3686400, 0, NULL),
178 INIT_CLK("GPIO12_CLK", &clk_pxa25x_gpio12_ops, 32768, 0, NULL),
126 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev), 179 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
127 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev), 180 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
128 181
129 INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev), 182 INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev),
130 INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev), 183 INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev),
131 INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev), 184 INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev),
185 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, &pxa25x_device_pwm0.dev),
186 INIT_CKEN("PWMCLK", PWM1, 3686400, 0, &pxa25x_device_pwm1.dev),
132 187
133 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 188 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL),
134 189
135 /* 190 /*
136 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
137 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
138 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL), 191 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL),
139 */ 192 */
140 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), 193 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
141}; 194};
142 195
196static struct clk pxa2xx_clk_aliases[] = {
197 INIT_CKOTHER("GPIO7_CLK", &pxa25x_clks[4], NULL),
198 INIT_CKOTHER("SA1111_CLK", &pxa25x_clks[5], NULL),
199};
200
143#ifdef CONFIG_PM 201#ifdef CONFIG_PM
144 202
145#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x 203#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
@@ -260,7 +318,7 @@ void __init pxa25x_init_irq(void)
260} 318}
261 319
262static struct platform_device *pxa25x_devices[] __initdata = { 320static struct platform_device *pxa25x_devices[] __initdata = {
263 &pxa_device_udc, 321 &pxa25x_device_udc,
264 &pxa_device_ffuart, 322 &pxa_device_ffuart,
265 &pxa_device_btuart, 323 &pxa_device_btuart,
266 &pxa_device_stuart, 324 &pxa_device_stuart,
@@ -269,6 +327,8 @@ static struct platform_device *pxa25x_devices[] __initdata = {
269 &pxa25x_device_ssp, 327 &pxa25x_device_ssp,
270 &pxa25x_device_nssp, 328 &pxa25x_device_nssp,
271 &pxa25x_device_assp, 329 &pxa25x_device_assp,
330 &pxa25x_device_pwm0,
331 &pxa25x_device_pwm1,
272}; 332};
273 333
274static struct sys_device pxa25x_sysdev[] = { 334static struct sys_device pxa25x_sysdev[] = {
@@ -284,7 +344,7 @@ static int __init pxa25x_init(void)
284 int i, ret = 0; 344 int i, ret = 0;
285 345
286 /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */ 346 /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
287 if (cpu_is_pxa25x()) 347 if (cpu_is_pxa255())
288 clks_register(&pxa25x_hwuart_clk, 1); 348 clks_register(&pxa25x_hwuart_clk, 1);
289 349
290 if (cpu_is_pxa21x() || cpu_is_pxa25x()) { 350 if (cpu_is_pxa21x() || cpu_is_pxa25x()) {
@@ -308,9 +368,11 @@ static int __init pxa25x_init(void)
308 } 368 }
309 369
310 /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */ 370 /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
311 if (cpu_is_pxa25x()) 371 if (cpu_is_pxa255())
312 ret = platform_device_register(&pxa_device_hwuart); 372 ret = platform_device_register(&pxa_device_hwuart);
313 373
374 clks_register(pxa2xx_clk_aliases, ARRAY_SIZE(pxa2xx_clk_aliases));
375
314 return ret; 376 return ret;
315} 377}
316 378
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/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 644550bfa330..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",
@@ -231,7 +213,7 @@ static struct clk pxa3xx_clks[] = {
231 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL), 213 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
232 214
233 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 215 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
234 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), 216 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa27x_device_udc.dev),
235 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev), 217 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev),
236 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), 218 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
237 219
@@ -239,10 +221,11 @@ static struct clk pxa3xx_clks[] = {
239 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 221 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
240 PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 222 PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev),
241 PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev), 223 PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev),
224 PXA3xx_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
225 PXA3xx_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
242 226
243 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev), 227 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev),
244 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev), 228 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev),
245 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev),
246}; 229};
247 230
248#ifdef CONFIG_PM 231#ifdef CONFIG_PM
@@ -520,7 +503,7 @@ void __init pxa3xx_init_irq(void)
520 */ 503 */
521 504
522static struct platform_device *devices[] __initdata = { 505static struct platform_device *devices[] __initdata = {
523 &pxa_device_udc, 506/* &pxa_device_udc, The UDC driver is PXA25x only */
524 &pxa_device_ffuart, 507 &pxa_device_ffuart,
525 &pxa_device_btuart, 508 &pxa_device_btuart,
526 &pxa_device_stuart, 509 &pxa_device_stuart,
@@ -530,6 +513,8 @@ static struct platform_device *devices[] __initdata = {
530 &pxa27x_device_ssp2, 513 &pxa27x_device_ssp2,
531 &pxa27x_device_ssp3, 514 &pxa27x_device_ssp3,
532 &pxa3xx_device_ssp4, 515 &pxa3xx_device_ssp4,
516 &pxa27x_device_pwm0,
517 &pxa27x_device_pwm1,
533}; 518};
534 519
535static struct sys_device pxa3xx_sysdev[] = { 520static struct sys_device pxa3xx_sysdev[] = {
diff --git a/arch/arm/mach-pxa/pxa930.c b/arch/arm/mach-pxa/pxa930.c
new file mode 100644
index 000000000000..9503897d049c
--- /dev/null
+++ b/arch/arm/mach-pxa/pxa930.c
@@ -0,0 +1,190 @@
1/*
2 * linux/arch/arm/mach-pxa/pxa930.c
3 *
4 * Code specific to PXA930
5 *
6 * Copyright (C) 2007-2008 Marvell Internation Ltd.
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/platform_device.h>
16#include <linux/irq.h>
17#include <linux/dma-mapping.h>
18
19#include <asm/hardware.h>
20#include <asm/arch/mfp-pxa930.h>
21
22static struct pxa3xx_mfp_addr_map pxa930_mfp_addr_map[] __initdata = {
23
24 MFP_ADDR(GPIO0, 0x02e0),
25 MFP_ADDR(GPIO1, 0x02dc),
26 MFP_ADDR(GPIO2, 0x02e8),
27 MFP_ADDR(GPIO3, 0x02d8),
28 MFP_ADDR(GPIO4, 0x02e4),
29 MFP_ADDR(GPIO5, 0x02ec),
30 MFP_ADDR(GPIO6, 0x02f8),
31 MFP_ADDR(GPIO7, 0x02fc),
32 MFP_ADDR(GPIO8, 0x0300),
33 MFP_ADDR(GPIO9, 0x02d4),
34 MFP_ADDR(GPIO10, 0x02f4),
35 MFP_ADDR(GPIO11, 0x02f0),
36 MFP_ADDR(GPIO12, 0x0304),
37 MFP_ADDR(GPIO13, 0x0310),
38 MFP_ADDR(GPIO14, 0x0308),
39 MFP_ADDR(GPIO15, 0x030c),
40 MFP_ADDR(GPIO16, 0x04e8),
41 MFP_ADDR(GPIO17, 0x04f4),
42 MFP_ADDR(GPIO18, 0x04f8),
43 MFP_ADDR(GPIO19, 0x04fc),
44 MFP_ADDR(GPIO20, 0x0518),
45 MFP_ADDR(GPIO21, 0x051c),
46 MFP_ADDR(GPIO22, 0x04ec),
47 MFP_ADDR(GPIO23, 0x0500),
48 MFP_ADDR(GPIO24, 0x04f0),
49 MFP_ADDR(GPIO25, 0x0504),
50 MFP_ADDR(GPIO26, 0x0510),
51 MFP_ADDR(GPIO27, 0x0514),
52 MFP_ADDR(GPIO28, 0x0520),
53 MFP_ADDR(GPIO29, 0x0600),
54 MFP_ADDR(GPIO30, 0x0618),
55 MFP_ADDR(GPIO31, 0x0610),
56 MFP_ADDR(GPIO32, 0x060c),
57 MFP_ADDR(GPIO33, 0x061c),
58 MFP_ADDR(GPIO34, 0x0620),
59 MFP_ADDR(GPIO35, 0x0628),
60 MFP_ADDR(GPIO36, 0x062c),
61 MFP_ADDR(GPIO37, 0x0630),
62 MFP_ADDR(GPIO38, 0x0634),
63 MFP_ADDR(GPIO39, 0x0638),
64 MFP_ADDR(GPIO40, 0x063c),
65 MFP_ADDR(GPIO41, 0x0614),
66 MFP_ADDR(GPIO42, 0x0624),
67 MFP_ADDR(GPIO43, 0x0608),
68 MFP_ADDR(GPIO44, 0x0604),
69 MFP_ADDR(GPIO45, 0x050c),
70 MFP_ADDR(GPIO46, 0x0508),
71 MFP_ADDR(GPIO47, 0x02bc),
72 MFP_ADDR(GPIO48, 0x02b4),
73 MFP_ADDR(GPIO49, 0x02b8),
74 MFP_ADDR(GPIO50, 0x02c8),
75 MFP_ADDR(GPIO51, 0x02c0),
76 MFP_ADDR(GPIO52, 0x02c4),
77 MFP_ADDR(GPIO53, 0x02d0),
78 MFP_ADDR(GPIO54, 0x02cc),
79 MFP_ADDR(GPIO55, 0x029c),
80 MFP_ADDR(GPIO56, 0x02a0),
81 MFP_ADDR(GPIO57, 0x0294),
82 MFP_ADDR(GPIO58, 0x0298),
83 MFP_ADDR(GPIO59, 0x02a4),
84 MFP_ADDR(GPIO60, 0x02a8),
85 MFP_ADDR(GPIO61, 0x02b0),
86 MFP_ADDR(GPIO62, 0x02ac),
87 MFP_ADDR(GPIO63, 0x0640),
88 MFP_ADDR(GPIO64, 0x065c),
89 MFP_ADDR(GPIO65, 0x0648),
90 MFP_ADDR(GPIO66, 0x0644),
91 MFP_ADDR(GPIO67, 0x0674),
92 MFP_ADDR(GPIO68, 0x0658),
93 MFP_ADDR(GPIO69, 0x0654),
94 MFP_ADDR(GPIO70, 0x0660),
95 MFP_ADDR(GPIO71, 0x0668),
96 MFP_ADDR(GPIO72, 0x0664),
97 MFP_ADDR(GPIO73, 0x0650),
98 MFP_ADDR(GPIO74, 0x066c),
99 MFP_ADDR(GPIO75, 0x064c),
100 MFP_ADDR(GPIO76, 0x0670),
101 MFP_ADDR(GPIO77, 0x0678),
102 MFP_ADDR(GPIO78, 0x067c),
103 MFP_ADDR(GPIO79, 0x0694),
104 MFP_ADDR(GPIO80, 0x069c),
105 MFP_ADDR(GPIO81, 0x06a0),
106 MFP_ADDR(GPIO82, 0x06a4),
107 MFP_ADDR(GPIO83, 0x0698),
108 MFP_ADDR(GPIO84, 0x06bc),
109 MFP_ADDR(GPIO85, 0x06b4),
110 MFP_ADDR(GPIO86, 0x06b0),
111 MFP_ADDR(GPIO87, 0x06c0),
112 MFP_ADDR(GPIO88, 0x06c4),
113 MFP_ADDR(GPIO89, 0x06ac),
114 MFP_ADDR(GPIO90, 0x0680),
115 MFP_ADDR(GPIO91, 0x0684),
116 MFP_ADDR(GPIO92, 0x0688),
117 MFP_ADDR(GPIO93, 0x0690),
118 MFP_ADDR(GPIO94, 0x068c),
119 MFP_ADDR(GPIO95, 0x06a8),
120 MFP_ADDR(GPIO96, 0x06b8),
121 MFP_ADDR(GPIO97, 0x0410),
122 MFP_ADDR(GPIO98, 0x0418),
123 MFP_ADDR(GPIO99, 0x041c),
124 MFP_ADDR(GPIO100, 0x0414),
125 MFP_ADDR(GPIO101, 0x0408),
126 MFP_ADDR(GPIO102, 0x0324),
127 MFP_ADDR(GPIO103, 0x040c),
128 MFP_ADDR(GPIO104, 0x0400),
129 MFP_ADDR(GPIO105, 0x0328),
130 MFP_ADDR(GPIO106, 0x0404),
131
132 MFP_ADDR(nXCVREN, 0x0204),
133 MFP_ADDR(DF_CLE_nOE, 0x020c),
134 MFP_ADDR(DF_nADV1_ALE, 0x0218),
135 MFP_ADDR(DF_SCLK_E, 0x0214),
136 MFP_ADDR(DF_SCLK_S, 0x0210),
137 MFP_ADDR(nBE0, 0x021c),
138 MFP_ADDR(nBE1, 0x0220),
139 MFP_ADDR(DF_nADV2_ALE, 0x0224),
140 MFP_ADDR(DF_INT_RnB, 0x0228),
141 MFP_ADDR(DF_nCS0, 0x022c),
142 MFP_ADDR(DF_nCS1, 0x0230),
143 MFP_ADDR(nLUA, 0x0254),
144 MFP_ADDR(nLLA, 0x0258),
145 MFP_ADDR(DF_nWE, 0x0234),
146 MFP_ADDR(DF_nRE_nOE, 0x0238),
147 MFP_ADDR(DF_ADDR0, 0x024c),
148 MFP_ADDR(DF_ADDR1, 0x0250),
149 MFP_ADDR(DF_ADDR2, 0x025c),
150 MFP_ADDR(DF_ADDR3, 0x0260),
151 MFP_ADDR(DF_IO0, 0x023c),
152 MFP_ADDR(DF_IO1, 0x0240),
153 MFP_ADDR(DF_IO2, 0x0244),
154 MFP_ADDR(DF_IO3, 0x0248),
155 MFP_ADDR(DF_IO4, 0x0264),
156 MFP_ADDR(DF_IO5, 0x0268),
157 MFP_ADDR(DF_IO6, 0x026c),
158 MFP_ADDR(DF_IO7, 0x0270),
159 MFP_ADDR(DF_IO8, 0x0274),
160 MFP_ADDR(DF_IO9, 0x0278),
161 MFP_ADDR(DF_IO10, 0x027c),
162 MFP_ADDR(DF_IO11, 0x0280),
163 MFP_ADDR(DF_IO12, 0x0284),
164 MFP_ADDR(DF_IO13, 0x0288),
165 MFP_ADDR(DF_IO14, 0x028c),
166 MFP_ADDR(DF_IO15, 0x0290),
167
168 MFP_ADDR(GSIM_UIO, 0x0314),
169 MFP_ADDR(GSIM_UCLK, 0x0318),
170 MFP_ADDR(GSIM_UDET, 0x031c),
171 MFP_ADDR(GSIM_nURST, 0x0320),
172
173 MFP_ADDR(PMIC_INT, 0x06c8),
174
175 MFP_ADDR(RDY, 0x0200),
176
177 MFP_ADDR_END,
178};
179
180static int __init pxa930_init(void)
181{
182 if (cpu_is_pxa930()) {
183 pxa3xx_init_mfp();
184 pxa3xx_mfp_init_addr(pxa930_mfp_addr_map);
185 }
186
187 return 0;
188}
189
190core_initcall(pxa930_init);
diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
new file mode 100644
index 000000000000..9d39dea57ce2
--- /dev/null
+++ b/arch/arm/mach-pxa/reset.c
@@ -0,0 +1,96 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 */
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/delay.h>
9#include <linux/gpio.h>
10#include <asm/io.h>
11#include <asm/proc-fns.h>
12
13#include <asm/arch/pxa-regs.h>
14#include <asm/arch/pxa2xx-regs.h>
15
16static void do_hw_reset(void);
17
18static int reset_gpio = -1;
19
20int init_gpio_reset(int gpio)
21{
22 int rc;
23
24 rc = gpio_request(gpio, "reset generator");
25 if (rc) {
26 printk(KERN_ERR "Can't request reset_gpio\n");
27 goto out;
28 }
29
30 rc = gpio_direction_input(gpio);
31 if (rc) {
32 printk(KERN_ERR "Can't configure reset_gpio for input\n");
33 gpio_free(gpio);
34 goto out;
35 }
36
37out:
38 if (!rc)
39 reset_gpio = gpio;
40
41 return rc;
42}
43
44/*
45 * Trigger GPIO reset.
46 * This covers various types of logic connecting gpio pin
47 * to RESET pins (nRESET or GPIO_RESET):
48 */
49static void do_gpio_reset(void)
50{
51 BUG_ON(reset_gpio == -1);
52
53 /* drive it low */
54 gpio_direction_output(reset_gpio, 0);
55 mdelay(2);
56 /* rising edge or drive high */
57 gpio_set_value(reset_gpio, 1);
58 mdelay(2);
59 /* falling edge */
60 gpio_set_value(reset_gpio, 0);
61
62 /* give it some time */
63 mdelay(10);
64
65 WARN_ON(1);
66 /* fallback */
67 do_hw_reset();
68}
69
70static void do_hw_reset(void)
71{
72 /* Initialize the watchdog and let it fire */
73 OWER = OWER_WME;
74 OSSR = OSSR_M3;
75 OSMR3 = OSCR + 368640; /* ... in 100 ms */
76}
77
78void arch_reset(char mode)
79{
80 if (cpu_is_pxa2xx())
81 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
82
83 switch (mode) {
84 case 's':
85 /* Jump into ROM at address 0 */
86 cpu_reset(0);
87 break;
88 case 'h':
89 do_hw_reset();
90 break;
91 case 'g':
92 do_gpio_reset();
93 break;
94 }
95}
96
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
new file mode 100644
index 000000000000..d02bc6f8bb93
--- /dev/null
+++ b/arch/arm/mach-pxa/saar.c
@@ -0,0 +1,84 @@
1/*
2 * linux/arch/arm/mach-pxa/saar.c
3 *
4 * Support for the Marvell PXA930 Handheld Platform (aka SAAR)
5 *
6 * Copyright (C) 2007-2008 Marvell International Ltd.
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 * publishhed by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/interrupt.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/clk.h>
19#include <linux/gpio.h>
20#include <linux/smc91x.h>
21
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/hardware.h>
25#include <asm/arch/pxa3xx-regs.h>
26#include <asm/arch/mfp-pxa930.h>
27
28#include "devices.h"
29#include "generic.h"
30
31/* SAAR MFP configurations */
32static mfp_cfg_t saar_mfp_cfg[] __initdata = {
33 /* Ethernet */
34 DF_nCS1_nCS3,
35 GPIO97_GPIO,
36};
37
38#define SAAR_ETH_PHYS (0x14000000)
39
40static struct resource smc91x_resources[] = {
41 [0] = {
42 .start = (SAAR_ETH_PHYS + 0x300),
43 .end = (SAAR_ETH_PHYS + 0xfffff),
44 .flags = IORESOURCE_MEM,
45 },
46 [1] = {
47 .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
48 .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
49 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
50 }
51};
52
53static struct smc91x_platdata saar_smc91x_info = {
54 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
55};
56
57static struct platform_device smc91x_device = {
58 .name = "smc91x",
59 .id = 0,
60 .num_resources = ARRAY_SIZE(smc91x_resources),
61 .resource = smc91x_resources,
62 .dev = {
63 .platform_data = &saar_smc91x_info,
64 },
65};
66
67static void __init saar_init(void)
68{
69 /* initialize MFP configurations */
70 pxa3xx_mfp_config(ARRAY_AND_SIZE(saar_mfp_cfg));
71
72 platform_device_register(&smc91x_device);
73}
74
75MACHINE_START(SAAR, "PXA930 Handheld Platform (aka SAAR)")
76 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
77 .phys_io = 0x40000000,
78 .boot_params = 0xa0000100,
79 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
80 .map_io = pxa_map_io,
81 .init_irq = pxa3xx_init_irq,
82 .timer = &pxa_timer,
83 .init_machine = saar_init,
84MACHINE_END
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index e7d0fcd9b43f..762249c03ded 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -38,6 +38,7 @@
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-regs.h>
40#include <asm/arch/pxa2xx-gpio.h> 40#include <asm/arch/pxa2xx-gpio.h>
41#include <asm/arch/pxa27x-udc.h>
41#include <asm/arch/irda.h> 42#include <asm/arch/irda.h>
42#include <asm/arch/mmc.h> 43#include <asm/arch/mmc.h>
43#include <asm/arch/ohci.h> 44#include <asm/arch/ohci.h>
@@ -450,6 +451,7 @@ static void spitz_irda_transceiver_mode(struct device *dev, int mode)
450 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); 451 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
451 else 452 else
452 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); 453 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
454 pxa2xx_transceiver_mode(dev, mode);
453} 455}
454 456
455#ifdef CONFIG_MACH_AKITA 457#ifdef CONFIG_MACH_AKITA
@@ -459,6 +461,7 @@ static void akita_irda_transceiver_mode(struct device *dev, int mode)
459 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON); 461 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
460 else 462 else
461 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON); 463 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
464 pxa2xx_transceiver_mode(dev, mode);
462} 465}
463#endif 466#endif
464 467
@@ -529,11 +532,7 @@ static struct platform_device *devices[] __initdata = {
529 532
530static void spitz_poweroff(void) 533static void spitz_poweroff(void)
531{ 534{
532 pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT); 535 arm_machine_restart('g');
533 GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET);
534
535 mdelay(1000);
536 arm_machine_restart('h');
537} 536}
538 537
539static void spitz_restart(char mode) 538static void spitz_restart(char mode)
@@ -547,6 +546,7 @@ static void spitz_restart(char mode)
547 546
548static void __init common_init(void) 547static void __init common_init(void)
549{ 548{
549 init_gpio_reset(SPITZ_GPIO_ON_RESET);
550 pm_power_off = spitz_poweroff; 550 pm_power_off = spitz_poweroff;
551 arm_pm_restart = spitz_restart; 551 arm_pm_restart = spitz_restart;
552 552
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 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/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/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
new file mode 100644
index 000000000000..ac283507e423
--- /dev/null
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -0,0 +1,84 @@
1/*
2 * linux/arch/arm/mach-pxa/tavorevb.c
3 *
4 * Support for the Marvell PXA930 Evaluation Board
5 *
6 * Copyright (C) 2007-2008 Marvell International Ltd.
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 * publishhed by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/interrupt.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/clk.h>
19#include <linux/gpio.h>
20#include <linux/smc91x.h>
21
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/hardware.h>
25#include <asm/arch/pxa3xx-regs.h>
26#include <asm/arch/mfp-pxa930.h>
27
28#include "devices.h"
29#include "generic.h"
30
31/* Tavor EVB MFP configurations */
32static mfp_cfg_t tavorevb_mfp_cfg[] __initdata = {
33 /* Ethernet */
34 DF_nCS1_nCS3,
35 GPIO47_GPIO,
36};
37
38#define TAVOREVB_ETH_PHYS (0x14000000)
39
40static struct resource smc91x_resources[] = {
41 [0] = {
42 .start = (TAVOREVB_ETH_PHYS + 0x300),
43 .end = (TAVOREVB_ETH_PHYS + 0xfffff),
44 .flags = IORESOURCE_MEM,
45 },
46 [1] = {
47 .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
48 .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
49 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
50 }
51};
52
53static struct smc91x_platdata tavorevb_smc91x_info = {
54 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
55};
56
57static struct platform_device smc91x_device = {
58 .name = "smc91x",
59 .id = 0,
60 .num_resources = ARRAY_SIZE(smc91x_resources),
61 .resource = smc91x_resources,
62 .dev = {
63 .platform_data = &tavorevb_smc91x_info,
64 },
65};
66
67static void __init tavorevb_init(void)
68{
69 /* initialize MFP configurations */
70 pxa3xx_mfp_config(ARRAY_AND_SIZE(tavorevb_mfp_cfg));
71
72 platform_device_register(&smc91x_device);
73}
74
75MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)")
76 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
77 .phys_io = 0x40000000,
78 .boot_params = 0xa0000100,
79 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
80 .map_io = pxa_map_io,
81 .init_irq = pxa3xx_init_irq,
82 .timer = &pxa_timer,
83 .init_machine = tavorevb_init,
84MACHINE_END
diff --git a/arch/arm/mach-pxa/tosa-bt.c b/arch/arm/mach-pxa/tosa-bt.c
new file mode 100644
index 000000000000..7d8505466e54
--- /dev/null
+++ b/arch/arm/mach-pxa/tosa-bt.c
@@ -0,0 +1,150 @@
1/*
2 * Bluetooth built-in chip control
3 *
4 * Copyright (c) 2008 Dmitry Baryshkov
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 */
11
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/platform_device.h>
15#include <linux/gpio.h>
16#include <linux/delay.h>
17#include <linux/rfkill.h>
18
19#include <asm/arch/tosa_bt.h>
20
21static void tosa_bt_on(struct tosa_bt_data *data)
22{
23 gpio_set_value(data->gpio_reset, 0);
24 gpio_set_value(data->gpio_pwr, 1);
25 gpio_set_value(data->gpio_reset, 1);
26 mdelay(20);
27 gpio_set_value(data->gpio_reset, 0);
28}
29
30static void tosa_bt_off(struct tosa_bt_data *data)
31{
32 gpio_set_value(data->gpio_reset, 1);
33 mdelay(10);
34 gpio_set_value(data->gpio_pwr, 0);
35 gpio_set_value(data->gpio_reset, 0);
36}
37
38static int tosa_bt_toggle_radio(void *data, enum rfkill_state state)
39{
40 pr_info("BT_RADIO going: %s\n",
41 state == RFKILL_STATE_ON ? "on" : "off");
42
43 if (state == RFKILL_STATE_ON) {
44 pr_info("TOSA_BT: going ON\n");
45 tosa_bt_on(data);
46 } else {
47 pr_info("TOSA_BT: going OFF\n");
48 tosa_bt_off(data);
49 }
50 return 0;
51}
52
53static int tosa_bt_probe(struct platform_device *dev)
54{
55 int rc;
56 struct rfkill *rfk;
57
58 struct tosa_bt_data *data = dev->dev.platform_data;
59
60 rc = gpio_request(data->gpio_reset, "Bluetooth reset");
61 if (rc)
62 goto err_reset;
63 rc = gpio_direction_output(data->gpio_reset, 0);
64 if (rc)
65 goto err_reset_dir;
66 rc = gpio_request(data->gpio_pwr, "Bluetooth power");
67 if (rc)
68 goto err_pwr;
69 rc = gpio_direction_output(data->gpio_pwr, 0);
70 if (rc)
71 goto err_pwr_dir;
72
73 rfk = rfkill_allocate(&dev->dev, RFKILL_TYPE_BLUETOOTH);
74 if (!rfk) {
75 rc = -ENOMEM;
76 goto err_rfk_alloc;
77 }
78
79 rfk->name = "tosa-bt";
80 rfk->toggle_radio = tosa_bt_toggle_radio;
81 rfk->data = data;
82#ifdef CONFIG_RFKILL_LEDS
83 rfk->led_trigger.name = "tosa-bt";
84#endif
85
86 rc = rfkill_register(rfk);
87 if (rc)
88 goto err_rfkill;
89
90 platform_set_drvdata(dev, rfk);
91
92 return 0;
93
94err_rfkill:
95 if (rfk)
96 rfkill_free(rfk);
97 rfk = NULL;
98err_rfk_alloc:
99 tosa_bt_off(data);
100err_pwr_dir:
101 gpio_free(data->gpio_pwr);
102err_pwr:
103err_reset_dir:
104 gpio_free(data->gpio_reset);
105err_reset:
106 return rc;
107}
108
109static int __devexit tosa_bt_remove(struct platform_device *dev)
110{
111 struct tosa_bt_data *data = dev->dev.platform_data;
112 struct rfkill *rfk = platform_get_drvdata(dev);
113
114 platform_set_drvdata(dev, NULL);
115
116 if (rfk)
117 rfkill_unregister(rfk);
118 rfk = NULL;
119
120 tosa_bt_off(data);
121
122 gpio_free(data->gpio_pwr);
123 gpio_free(data->gpio_reset);
124
125 return 0;
126}
127
128static struct platform_driver tosa_bt_driver = {
129 .probe = tosa_bt_probe,
130 .remove = __devexit_p(tosa_bt_remove),
131
132 .driver = {
133 .name = "tosa-bt",
134 .owner = THIS_MODULE,
135 },
136};
137
138
139static int __init tosa_bt_init(void)
140{
141 return platform_driver_register(&tosa_bt_driver);
142}
143
144static void __exit tosa_bt_exit(void)
145{
146 platform_driver_unregister(&tosa_bt_driver);
147}
148
149module_init(tosa_bt_init);
150module_exit(tosa_bt_exit);
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index ab4a9f579913..fea17ce6b55f 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -18,30 +18,31 @@
18#include <linux/major.h> 18#include <linux/major.h>
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/delay.h>
22#include <linux/fb.h>
21#include <linux/mmc/host.h> 23#include <linux/mmc/host.h>
24#include <linux/mfd/tc6393xb.h>
25#include <linux/mfd/tmio.h>
26#include <linux/mtd/nand.h>
27#include <linux/mtd/partitions.h>
22#include <linux/pm.h> 28#include <linux/pm.h>
23#include <linux/delay.h>
24#include <linux/gpio_keys.h> 29#include <linux/gpio_keys.h>
25#include <linux/input.h> 30#include <linux/input.h>
26#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/pda_power.h>
33#include <linux/rfkill.h>
27 34
28#include <asm/setup.h> 35#include <asm/setup.h>
29#include <asm/memory.h>
30#include <asm/mach-types.h> 36#include <asm/mach-types.h>
31#include <asm/hardware.h>
32#include <asm/irq.h>
33#include <asm/system.h>
34#include <asm/arch/pxa-regs.h>
35#include <asm/arch/pxa2xx-regs.h> 37#include <asm/arch/pxa2xx-regs.h>
36#include <asm/arch/mfp-pxa25x.h> 38#include <asm/arch/mfp-pxa25x.h>
37#include <asm/arch/irda.h> 39#include <asm/arch/irda.h>
38#include <asm/arch/i2c.h> 40#include <asm/arch/i2c.h>
39#include <asm/arch/mmc.h> 41#include <asm/arch/mmc.h>
40#include <asm/arch/udc.h> 42#include <asm/arch/udc.h>
43#include <asm/arch/tosa_bt.h>
41 44
42#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
43#include <asm/mach/map.h>
44#include <asm/mach/irq.h>
45#include <asm/arch/tosa.h> 46#include <asm/arch/tosa.h>
46 47
47#include <asm/hardware/scoop.h> 48#include <asm/hardware/scoop.h>
@@ -86,7 +87,7 @@ static unsigned long tosa_pin_config[] = {
86 GPIO6_MMC_CLK, 87 GPIO6_MMC_CLK,
87 GPIO8_MMC_CS0, 88 GPIO8_MMC_CS0,
88 GPIO9_GPIO, /* Detect */ 89 GPIO9_GPIO, /* Detect */
89 // GPIO10 nSD_INT 90 GPIO10_GPIO, /* nSD_INT */
90 91
91 /* CF */ 92 /* CF */
92 GPIO13_GPIO, /* CD_IRQ */ 93 GPIO13_GPIO, /* CD_IRQ */
@@ -124,34 +125,34 @@ static unsigned long tosa_pin_config[] = {
124 GPIO44_BTUART_CTS, 125 GPIO44_BTUART_CTS,
125 GPIO45_BTUART_RTS, 126 GPIO45_BTUART_RTS,
126 127
127 /* IrDA */
128 GPIO46_STUART_RXD,
129 GPIO47_STUART_TXD,
130
131 /* Keybd */ 128 /* Keybd */
132 GPIO58_GPIO, 129 GPIO58_GPIO | MFP_LPM_DRIVE_LOW,
133 GPIO59_GPIO, 130 GPIO59_GPIO | MFP_LPM_DRIVE_LOW,
134 GPIO60_GPIO, 131 GPIO60_GPIO | MFP_LPM_DRIVE_LOW,
135 GPIO61_GPIO, 132 GPIO61_GPIO | MFP_LPM_DRIVE_LOW,
136 GPIO62_GPIO, 133 GPIO62_GPIO | MFP_LPM_DRIVE_LOW,
137 GPIO63_GPIO, 134 GPIO63_GPIO | MFP_LPM_DRIVE_LOW,
138 GPIO64_GPIO, 135 GPIO64_GPIO | MFP_LPM_DRIVE_LOW,
139 GPIO65_GPIO, 136 GPIO65_GPIO | MFP_LPM_DRIVE_LOW,
140 GPIO66_GPIO, 137 GPIO66_GPIO | MFP_LPM_DRIVE_LOW,
141 GPIO67_GPIO, 138 GPIO67_GPIO | MFP_LPM_DRIVE_LOW,
142 GPIO68_GPIO, 139 GPIO68_GPIO | MFP_LPM_DRIVE_LOW,
143 GPIO69_GPIO, 140 GPIO69_GPIO | MFP_LPM_DRIVE_LOW,
144 GPIO70_GPIO, 141 GPIO70_GPIO | MFP_LPM_DRIVE_LOW,
145 GPIO71_GPIO, 142 GPIO71_GPIO | MFP_LPM_DRIVE_LOW,
146 GPIO72_GPIO, 143 GPIO72_GPIO | MFP_LPM_DRIVE_LOW,
147 GPIO73_GPIO, 144 GPIO73_GPIO | MFP_LPM_DRIVE_LOW,
148 GPIO74_GPIO, 145 GPIO74_GPIO | MFP_LPM_DRIVE_LOW,
149 GPIO75_GPIO, 146 GPIO75_GPIO | MFP_LPM_DRIVE_LOW,
150 147
151 /* SPI */ 148 /* SPI */
152 GPIO81_SSP2_CLK_OUT, 149 GPIO81_SSP2_CLK_OUT,
153 GPIO82_SSP2_FRM_OUT, 150 GPIO82_SSP2_FRM_OUT,
154 GPIO83_SSP2_TXD, 151 GPIO83_SSP2_TXD,
152
153 /* IrDA is managed in other way */
154 GPIO46_GPIO,
155 GPIO47_GPIO,
155}; 156};
156 157
157/* 158/*
@@ -249,6 +250,15 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
249 250
250 tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); 251 tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250);
251 252
253 err = gpio_request(TOSA_GPIO_nSD_DETECT, "MMC/SD card detect");
254 if (err) {
255 printk(KERN_ERR "tosa_mci_init: can't request nSD_DETECT gpio\n");
256 goto err_gpio_detect;
257 }
258 err = gpio_direction_input(TOSA_GPIO_nSD_DETECT);
259 if (err)
260 goto err_gpio_detect_dir;
261
252 err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, 262 err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int,
253 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 263 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
254 "MMC/SD card detect", data); 264 "MMC/SD card detect", data);
@@ -257,7 +267,7 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
257 goto err_irq; 267 goto err_irq;
258 } 268 }
259 269
260 err = gpio_request(TOSA_GPIO_SD_WP, "sd_wp"); 270 err = gpio_request(TOSA_GPIO_SD_WP, "SD Write Protect");
261 if (err) { 271 if (err) {
262 printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n"); 272 printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n");
263 goto err_gpio_wp; 273 goto err_gpio_wp;
@@ -266,7 +276,7 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
266 if (err) 276 if (err)
267 goto err_gpio_wp_dir; 277 goto err_gpio_wp_dir;
268 278
269 err = gpio_request(TOSA_GPIO_PWR_ON, "sd_pwr"); 279 err = gpio_request(TOSA_GPIO_PWR_ON, "SD Power");
270 if (err) { 280 if (err) {
271 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); 281 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
272 goto err_gpio_pwr; 282 goto err_gpio_pwr;
@@ -275,8 +285,20 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
275 if (err) 285 if (err)
276 goto err_gpio_pwr_dir; 286 goto err_gpio_pwr_dir;
277 287
288 err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int");
289 if (err) {
290 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
291 goto err_gpio_int;
292 }
293 err = gpio_direction_input(TOSA_GPIO_nSD_INT);
294 if (err)
295 goto err_gpio_int_dir;
296
278 return 0; 297 return 0;
279 298
299err_gpio_int_dir:
300 gpio_free(TOSA_GPIO_nSD_INT);
301err_gpio_int:
280err_gpio_pwr_dir: 302err_gpio_pwr_dir:
281 gpio_free(TOSA_GPIO_PWR_ON); 303 gpio_free(TOSA_GPIO_PWR_ON);
282err_gpio_pwr: 304err_gpio_pwr:
@@ -285,6 +307,9 @@ err_gpio_wp_dir:
285err_gpio_wp: 307err_gpio_wp:
286 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); 308 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
287err_irq: 309err_irq:
310err_gpio_detect_dir:
311 gpio_free(TOSA_GPIO_nSD_DETECT);
312err_gpio_detect:
288 return err; 313 return err;
289} 314}
290 315
@@ -306,9 +331,11 @@ static int tosa_mci_get_ro(struct device *dev)
306 331
307static void tosa_mci_exit(struct device *dev, void *data) 332static void tosa_mci_exit(struct device *dev, void *data)
308{ 333{
334 gpio_free(TOSA_GPIO_nSD_INT);
309 gpio_free(TOSA_GPIO_PWR_ON); 335 gpio_free(TOSA_GPIO_PWR_ON);
310 gpio_free(TOSA_GPIO_SD_WP); 336 gpio_free(TOSA_GPIO_SD_WP);
311 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); 337 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
338 gpio_free(TOSA_GPIO_nSD_DETECT);
312} 339}
313 340
314static struct pxamci_platform_data tosa_mci_platform_data = { 341static struct pxamci_platform_data tosa_mci_platform_data = {
@@ -322,29 +349,55 @@ static struct pxamci_platform_data tosa_mci_platform_data = {
322/* 349/*
323 * Irda 350 * Irda
324 */ 351 */
352static void tosa_irda_transceiver_mode(struct device *dev, int mode)
353{
354 if (mode & IR_OFF) {
355 gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0);
356 pxa2xx_transceiver_mode(dev, mode);
357 gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
358 } else {
359 pxa2xx_transceiver_mode(dev, mode);
360 gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1);
361 }
362}
363
325static int tosa_irda_startup(struct device *dev) 364static int tosa_irda_startup(struct device *dev)
326{ 365{
327 int ret; 366 int ret;
328 367
368 ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX");
369 if (ret)
370 goto err_tx;
371 ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
372 if (ret)
373 goto err_tx_dir;
374
329 ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); 375 ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
330 if (ret) 376 if (ret)
331 return ret; 377 goto err_pwr;
332 378
333 ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); 379 ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
334 if (ret) 380 if (ret)
335 gpio_free(TOSA_GPIO_IR_POWERDWN); 381 goto err_pwr_dir;
336 382
337 return ret; 383 tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
338 }
339 384
340static void tosa_irda_shutdown(struct device *dev) 385 return 0;
341{ 386
387err_pwr_dir:
342 gpio_free(TOSA_GPIO_IR_POWERDWN); 388 gpio_free(TOSA_GPIO_IR_POWERDWN);
389err_pwr:
390err_tx_dir:
391 gpio_free(TOSA_GPIO_IRDA_TX);
392err_tx:
393 return ret;
343} 394}
344 395
345static void tosa_irda_transceiver_mode(struct device *dev, int mode) 396static void tosa_irda_shutdown(struct device *dev)
346{ 397{
347 gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF)); 398 tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
399 gpio_free(TOSA_GPIO_IR_POWERDWN);
400 gpio_free(TOSA_GPIO_IRDA_TX);
348} 401}
349 402
350static struct pxaficp_platform_data tosa_ficp_platform_data = { 403static struct pxaficp_platform_data tosa_ficp_platform_data = {
@@ -355,6 +408,70 @@ static struct pxaficp_platform_data tosa_ficp_platform_data = {
355}; 408};
356 409
357/* 410/*
411 * Tosa AC IN
412 */
413static int tosa_power_init(struct device *dev)
414{
415 int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in");
416 if (ret)
417 goto err_gpio_req;
418
419 ret = gpio_direction_input(TOSA_GPIO_AC_IN);
420 if (ret)
421 goto err_gpio_in;
422
423 return 0;
424
425err_gpio_in:
426 gpio_free(TOSA_GPIO_AC_IN);
427err_gpio_req:
428 return ret;
429}
430
431static void tosa_power_exit(struct device *dev)
432{
433 gpio_free(TOSA_GPIO_AC_IN);
434}
435
436static int tosa_power_ac_online(void)
437{
438 return gpio_get_value(TOSA_GPIO_AC_IN) == 0;
439}
440
441static char *tosa_ac_supplied_to[] = {
442 "main-battery",
443 "backup-battery",
444 "jacket-battery",
445};
446
447static struct pda_power_pdata tosa_power_data = {
448 .init = tosa_power_init,
449 .is_ac_online = tosa_power_ac_online,
450 .exit = tosa_power_exit,
451 .supplied_to = tosa_ac_supplied_to,
452 .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to),
453};
454
455static struct resource tosa_power_resource[] = {
456 {
457 .name = "ac",
458 .start = gpio_to_irq(TOSA_GPIO_AC_IN),
459 .end = gpio_to_irq(TOSA_GPIO_AC_IN),
460 .flags = IORESOURCE_IRQ |
461 IORESOURCE_IRQ_HIGHEDGE |
462 IORESOURCE_IRQ_LOWEDGE,
463 },
464};
465
466static struct platform_device tosa_power_device = {
467 .name = "pda-power",
468 .id = -1,
469 .dev.platform_data = &tosa_power_data,
470 .resource = tosa_power_resource,
471 .num_resources = ARRAY_SIZE(tosa_power_resource),
472};
473
474/*
358 * Tosa Keyboard 475 * Tosa Keyboard
359 */ 476 */
360static struct platform_device tosakbd_device = { 477static struct platform_device tosakbd_device = {
@@ -439,7 +556,7 @@ static struct gpio_led tosa_gpio_leds[] = {
439 }, 556 },
440 { 557 {
441 .name = "tosa:blue:bluetooth", 558 .name = "tosa:blue:bluetooth",
442 .default_trigger = "none", 559 .default_trigger = "tosa-bt",
443 .gpio = TOSA_GPIO_BT_LED, 560 .gpio = TOSA_GPIO_BT_LED,
444 }, 561 },
445}; 562};
@@ -457,21 +574,184 @@ static struct platform_device tosaled_device = {
457 }, 574 },
458}; 575};
459 576
577/*
578 * Toshiba Mobile IO Controller
579 */
580static struct resource tc6393xb_resources[] = {
581 [0] = {
582 .start = TOSA_LCDC_PHYS,
583 .end = TOSA_LCDC_PHYS + 0x3ffffff,
584 .flags = IORESOURCE_MEM,
585 },
586
587 [1] = {
588 .start = TOSA_IRQ_GPIO_TC6393XB_INT,
589 .end = TOSA_IRQ_GPIO_TC6393XB_INT,
590 .flags = IORESOURCE_IRQ,
591 },
592};
593
594
595static int tosa_tc6393xb_enable(struct platform_device *dev)
596{
597 int rc;
598
599 rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr");
600 if (rc)
601 goto err_req_pclr;
602 rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend");
603 if (rc)
604 goto err_req_suspend;
605 rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "l3v");
606 if (rc)
607 goto err_req_l3v;
608 rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0);
609 if (rc)
610 goto err_dir_l3v;
611 rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0);
612 if (rc)
613 goto err_dir_suspend;
614 rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0);
615 if (rc)
616 goto err_dir_pclr;
617
618 mdelay(1);
619
620 gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
621
622 mdelay(10);
623
624 gpio_set_value(TOSA_GPIO_TC6393XB_REST_IN, 1);
625 gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
626
627 return 0;
628err_dir_pclr:
629err_dir_suspend:
630err_dir_l3v:
631 gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
632err_req_l3v:
633 gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
634err_req_suspend:
635 gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
636err_req_pclr:
637 return rc;
638}
639
640static int tosa_tc6393xb_disable(struct platform_device *dev)
641{
642 gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
643 gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
644 gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
645
646 return 0;
647}
648
649static int tosa_tc6393xb_resume(struct platform_device *dev)
650{
651 gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
652 mdelay(10);
653 gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
654 mdelay(10);
655
656 return 0;
657}
658
659static int tosa_tc6393xb_suspend(struct platform_device *dev)
660{
661 gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 0);
662 gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 0);
663 return 0;
664}
665
666static struct mtd_partition tosa_nand_partition[] = {
667 {
668 .name = "smf",
669 .offset = 0,
670 .size = 7 * 1024 * 1024,
671 },
672 {
673 .name = "root",
674 .offset = MTDPART_OFS_APPEND,
675 .size = 28 * 1024 * 1024,
676 },
677 {
678 .name = "home",
679 .offset = MTDPART_OFS_APPEND,
680 .size = MTDPART_SIZ_FULL,
681 },
682};
683
684static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
685
686static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = {
687 .options = 0,
688 .offs = 4,
689 .len = 2,
690 .pattern = scan_ff_pattern
691};
692
693static struct tmio_nand_data tosa_tc6393xb_nand_config = {
694 .num_partitions = ARRAY_SIZE(tosa_nand_partition),
695 .partition = tosa_nand_partition,
696 .badblock_pattern = &tosa_tc6393xb_nand_bbt,
697};
698
699static struct tc6393xb_platform_data tosa_tc6393xb_setup = {
700 .scr_pll2cr = 0x0cc1,
701 .scr_gper = 0x3300,
702 .scr_gpo_dsr =
703 TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON),
704 .scr_gpo_doecr =
705 TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON),
706
707 .irq_base = IRQ_BOARD_START,
708 .gpio_base = TOSA_TC6393XB_GPIO_BASE,
709
710 .enable = tosa_tc6393xb_enable,
711 .disable = tosa_tc6393xb_disable,
712 .suspend = tosa_tc6393xb_suspend,
713 .resume = tosa_tc6393xb_resume,
714
715 .nand_data = &tosa_tc6393xb_nand_config,
716};
717
718
719static struct platform_device tc6393xb_device = {
720 .name = "tc6393xb",
721 .id = -1,
722 .dev = {
723 .platform_data = &tosa_tc6393xb_setup,
724 },
725 .num_resources = ARRAY_SIZE(tc6393xb_resources),
726 .resource = tc6393xb_resources,
727};
728
729static struct tosa_bt_data tosa_bt_data = {
730 .gpio_pwr = TOSA_GPIO_BT_PWR_EN,
731 .gpio_reset = TOSA_GPIO_BT_RESET,
732};
733
734static struct platform_device tosa_bt_device = {
735 .name = "tosa-bt",
736 .id = -1,
737 .dev.platform_data = &tosa_bt_data,
738};
739
740
460static struct platform_device *devices[] __initdata = { 741static struct platform_device *devices[] __initdata = {
461 &tosascoop_device, 742 &tosascoop_device,
462 &tosascoop_jc_device, 743 &tosascoop_jc_device,
744 &tc6393xb_device,
745 &tosa_power_device,
463 &tosakbd_device, 746 &tosakbd_device,
464 &tosa_gpio_keys_device, 747 &tosa_gpio_keys_device,
465 &tosaled_device, 748 &tosaled_device,
749 &tosa_bt_device,
466}; 750};
467 751
468static void tosa_poweroff(void) 752static void tosa_poweroff(void)
469{ 753{
470 gpio_direction_output(TOSA_GPIO_ON_RESET, 0); 754 arm_machine_restart('g');
471 gpio_set_value(TOSA_GPIO_ON_RESET, 1);
472
473 mdelay(1000);
474 arm_machine_restart('h');
475} 755}
476 756
477static void tosa_restart(char mode) 757static void tosa_restart(char mode)
@@ -485,10 +765,14 @@ static void tosa_restart(char mode)
485 765
486static void __init tosa_init(void) 766static void __init tosa_init(void)
487{ 767{
768 int dummy;
769
488 pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); 770 pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config));
489 gpio_set_wake(MFP_PIN_GPIO1, 1); 771 gpio_set_wake(MFP_PIN_GPIO1, 1);
490 /* We can't pass to gpio-keys since it will drop the Reset altfunc */ 772 /* We can't pass to gpio-keys since it will drop the Reset altfunc */
491 773
774 init_gpio_reset(TOSA_GPIO_ON_RESET);
775
492 pm_power_off = tosa_poweroff; 776 pm_power_off = tosa_poweroff;
493 arm_pm_restart = tosa_restart; 777 arm_pm_restart = tosa_restart;
494 778
@@ -497,6 +781,10 @@ static void __init tosa_init(void)
497 /* enable batt_fault */ 781 /* enable batt_fault */
498 PMCR = 0x01; 782 PMCR = 0x01;
499 783
784 dummy = gpiochip_reserve(TOSA_SCOOP_GPIO_BASE, 12);
785 dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12);
786 dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16);
787
500 pxa_set_mci_info(&tosa_mci_platform_data); 788 pxa_set_mci_info(&tosa_mci_platform_data);
501 pxa_set_udc_info(&udc_info); 789 pxa_set_udc_info(&udc_info);
502 pxa_set_ficp_info(&tosa_ficp_platform_data); 790 pxa_set_ficp_info(&tosa_ficp_platform_data);
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 931885d86b91..dee7bf36f013 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
@@ -262,6 +254,7 @@ static void board_irda_mode(struct device *dev, int mode)
262 /* Fast mode */ 254 /* Fast mode */
263 trizeps_conxs_ircr |= ConXS_IRCR_MODE; 255 trizeps_conxs_ircr |= ConXS_IRCR_MODE;
264 } 256 }
257 pxa2xx_transceiver_mode(dev, mode);
265 if (mode & IR_OFF) { 258 if (mode & IR_OFF) {
266 trizeps_conxs_ircr |= ConXS_IRCR_SD; 259 trizeps_conxs_ircr |= ConXS_IRCR_SD;
267 } else { 260 } else {
@@ -438,6 +431,7 @@ static void __init trizeps4_init(void)
438 pxa_set_mci_info(&trizeps4_mci_platform_data); 431 pxa_set_mci_info(&trizeps4_mci_platform_data);
439 pxa_set_ficp_info(&trizeps4_ficp_platform_data); 432 pxa_set_ficp_info(&trizeps4_ficp_platform_data);
440 pxa_set_ohci_info(&trizeps4_ohci_platform_data); 433 pxa_set_ohci_info(&trizeps4_ohci_platform_data);
434 pxa_set_ac97_info(NULL);
441} 435}
442 436
443static void __init trizeps4_map_io(void) 437static void __init trizeps4_map_io(void)
@@ -487,6 +481,7 @@ static void __init trizeps4_map_io(void)
487 ConXS_BCR = trizeps_conxs_bcr; 481 ConXS_BCR = trizeps_conxs_bcr;
488#endif 482#endif
489 483
484#warning FIXME - accessing PM registers directly is deprecated
490 PWER = 0x00000002; 485 PWER = 0x00000002;
491 PFER = 0x00000000; 486 PFER = 0x00000000;
492 PRER = 0x00000002; 487 PRER = 0x00000002;
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 4a0028087ea6..8fca6d890b7d 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -18,23 +18,29 @@
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>
22#include <linux/smc91x.h>
21 23
22#include <asm/mach-types.h> 24#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
24#include <asm/hardware.h> 26#include <asm/hardware.h>
27#include <asm/arch/audio.h>
25#include <asm/arch/gpio.h> 28#include <asm/arch/gpio.h>
26#include <asm/arch/pxafb.h> 29#include <asm/arch/pxafb.h>
27#include <asm/arch/zylonite.h> 30#include <asm/arch/zylonite.h>
28#include <asm/arch/mmc.h> 31#include <asm/arch/mmc.h>
29#include <asm/arch/pxa27x_keypad.h> 32#include <asm/arch/pxa27x_keypad.h>
33#include <asm/arch/pxa3xx_nand.h>
30 34
35#include "devices.h"
31#include "generic.h" 36#include "generic.h"
32 37
33#define MAX_SLOTS 3 38#define MAX_SLOTS 3
34struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; 39struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
35 40
36int gpio_backlight;
37int gpio_eth_irq; 41int gpio_eth_irq;
42int gpio_debug_led1;
43int gpio_debug_led2;
38 44
39int wm9713_irq; 45int wm9713_irq;
40 46
@@ -54,18 +60,72 @@ static struct resource smc91x_resources[] = {
54 } 60 }
55}; 61};
56 62
63static struct smc91x_platdata zylonite_smc91x_info = {
64 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
65 SMC91X_NOWAIT | SMC91X_USE_DMA,
66};
67
57static struct platform_device smc91x_device = { 68static struct platform_device smc91x_device = {
58 .name = "smc91x", 69 .name = "smc91x",
59 .id = 0, 70 .id = 0,
60 .num_resources = ARRAY_SIZE(smc91x_resources), 71 .num_resources = ARRAY_SIZE(smc91x_resources),
61 .resource = smc91x_resources, 72 .resource = smc91x_resources,
73 .dev = {
74 .platform_data = &zylonite_smc91x_info,
75 },
62}; 76};
63 77
64#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) 78#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
65static void zylonite_backlight_power(int on) 79static struct gpio_led zylonite_debug_leds[] = {
80 [0] = {
81 .name = "zylonite:yellow:1",
82 .default_trigger = "heartbeat",
83 },
84 [1] = {
85 .name = "zylonite:yellow:2",
86 .default_trigger = "default-on",
87 },
88};
89
90static struct gpio_led_platform_data zylonite_debug_leds_info = {
91 .leds = zylonite_debug_leds,
92 .num_leds = ARRAY_SIZE(zylonite_debug_leds),
93};
94
95static struct platform_device zylonite_device_leds = {
96 .name = "leds-gpio",
97 .id = -1,
98 .dev = {
99 .platform_data = &zylonite_debug_leds_info,
100 }
101};
102
103static void __init zylonite_init_leds(void)
66{ 104{
67 gpio_set_value(gpio_backlight, on); 105 zylonite_debug_leds[0].gpio = gpio_debug_led1;
106 zylonite_debug_leds[1].gpio = gpio_debug_led2;
107
108 platform_device_register(&zylonite_device_leds);
68} 109}
110#else
111static inline void zylonite_init_leds(void) {}
112#endif
113
114#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
115static struct platform_pwm_backlight_data zylonite_backlight_data = {
116 .pwm_id = 3,
117 .max_brightness = 100,
118 .dft_brightness = 100,
119 .pwm_period_ns = 10000,
120};
121
122static struct platform_device zylonite_backlight_device = {
123 .name = "pwm-backlight",
124 .dev = {
125 .parent = &pxa27x_device_pwm1.dev,
126 .platform_data = &zylonite_backlight_data,
127 },
128};
69 129
70static struct pxafb_mode_info toshiba_ltm035a776c_mode = { 130static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
71 .pixclock = 110000, 131 .pixclock = 110000,
@@ -98,7 +158,6 @@ static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
98static struct pxafb_mach_info zylonite_toshiba_lcd_info = { 158static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
99 .num_modes = 1, 159 .num_modes = 1,
100 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 160 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
101 .pxafb_backlight_power = zylonite_backlight_power,
102}; 161};
103 162
104static struct pxafb_mode_info sharp_ls037_modes[] = { 163static struct pxafb_mode_info sharp_ls037_modes[] = {
@@ -134,13 +193,11 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = {
134 .modes = sharp_ls037_modes, 193 .modes = sharp_ls037_modes,
135 .num_modes = 2, 194 .num_modes = 2,
136 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 195 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
137 .pxafb_backlight_power = zylonite_backlight_power,
138}; 196};
139 197
140static void __init zylonite_init_lcd(void) 198static void __init zylonite_init_lcd(void)
141{ 199{
142 /* backlight GPIO: output, default on */ 200 platform_device_register(&zylonite_backlight_device);
143 gpio_direction_output(gpio_backlight, 1);
144 201
145 if (lcd_id & 0x20) { 202 if (lcd_id & 0x20) {
146 set_pxa_fb_info(&zylonite_sharp_lcd_info); 203 set_pxa_fb_info(&zylonite_sharp_lcd_info);
@@ -250,7 +307,7 @@ static void __init zylonite_init_mmc(void)
250static inline void zylonite_init_mmc(void) {} 307static inline void zylonite_init_mmc(void) {}
251#endif 308#endif
252 309
253#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) 310#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
254static unsigned int zylonite_matrix_key_map[] = { 311static unsigned int zylonite_matrix_key_map[] = {
255 /* KEY(row, col, key_code) */ 312 /* KEY(row, col, key_code) */
256 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D), 313 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
@@ -315,6 +372,57 @@ static void __init zylonite_init_keypad(void)
315static inline void zylonite_init_keypad(void) {} 372static inline void zylonite_init_keypad(void) {}
316#endif 373#endif
317 374
375#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
376static struct mtd_partition zylonite_nand_partitions[] = {
377 [0] = {
378 .name = "Bootloader",
379 .offset = 0,
380 .size = 0x060000,
381 .mask_flags = MTD_WRITEABLE, /* force read-only */
382 },
383 [1] = {
384 .name = "Kernel",
385 .offset = 0x060000,
386 .size = 0x200000,
387 .mask_flags = MTD_WRITEABLE, /* force read-only */
388 },
389 [2] = {
390 .name = "Filesystem",
391 .offset = 0x0260000,
392 .size = 0x3000000, /* 48M - rootfs */
393 },
394 [3] = {
395 .name = "MassStorage",
396 .offset = 0x3260000,
397 .size = 0x3d40000,
398 },
399 [4] = {
400 .name = "BBT",
401 .offset = 0x6FA0000,
402 .size = 0x80000,
403 .mask_flags = MTD_WRITEABLE, /* force read-only */
404 },
405 /* NOTE: we reserve some blocks at the end of the NAND flash for
406 * bad block management, and the max number of relocation blocks
407 * differs on different platforms. Please take care with it when
408 * defining the partition table.
409 */
410};
411
412static struct pxa3xx_nand_platform_data zylonite_nand_info = {
413 .enable_arbiter = 1,
414 .parts = zylonite_nand_partitions,
415 .nr_parts = ARRAY_SIZE(zylonite_nand_partitions),
416};
417
418static void __init zylonite_init_nand(void)
419{
420 pxa3xx_set_nand_info(&zylonite_nand_info);
421}
422#else
423static inline void zylonite_init_nand(void) {}
424#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
425
318static void __init zylonite_init(void) 426static void __init zylonite_init(void)
319{ 427{
320 /* board-processor specific initialization */ 428 /* board-processor specific initialization */
@@ -329,9 +437,12 @@ static void __init zylonite_init(void)
329 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq); 437 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq);
330 platform_device_register(&smc91x_device); 438 platform_device_register(&smc91x_device);
331 439
440 pxa_set_ac97_info(NULL);
332 zylonite_init_lcd(); 441 zylonite_init_lcd();
333 zylonite_init_mmc(); 442 zylonite_init_mmc();
334 zylonite_init_keypad(); 443 zylonite_init_keypad();
444 zylonite_init_nand();
445 zylonite_init_leds();
335} 446}
336 447
337MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") 448MACHINE_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 324fb9daae28..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"
@@ -50,6 +53,7 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
50 GPIO75_LCD_BIAS, 53 GPIO75_LCD_BIAS,
51 GPIO76_LCD_VSYNC, 54 GPIO76_LCD_VSYNC,
52 GPIO127_LCD_CS_N, 55 GPIO127_LCD_CS_N,
56 GPIO20_PWM3_OUT, /* backlight */
53 57
54 /* BTUART */ 58 /* BTUART */
55 GPIO111_UART2_RTS, 59 GPIO111_UART2_RTS,
@@ -108,6 +112,10 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
108 GPIO12_MMC2_DAT3, 112 GPIO12_MMC2_DAT3,
109 GPIO13_MMC2_CLK, 113 GPIO13_MMC2_CLK,
110 GPIO14_MMC2_CMD, 114 GPIO14_MMC2_CMD,
115
116 /* Standard I2C */
117 GPIO21_I2C_SCL,
118 GPIO22_I2C_SDA,
111}; 119};
112 120
113static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { 121static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
@@ -191,6 +199,39 @@ static void __init zylonite_detect_lcd_panel(void)
191 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]); 199 pxa3xx_mfp_write(lcd_detect_pins[i], mfpr_save[i]);
192} 200}
193 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
194void __init zylonite_pxa300_init(void) 235void __init zylonite_pxa300_init(void)
195{ 236{
196 if (cpu_is_pxa300() || cpu_is_pxa310()) { 237 if (cpu_is_pxa300() || cpu_is_pxa310()) {
@@ -200,15 +241,14 @@ void __init zylonite_pxa300_init(void)
200 /* detect LCD panel */ 241 /* detect LCD panel */
201 zylonite_detect_lcd_panel(); 242 zylonite_detect_lcd_panel();
202 243
203 /* GPIO pin assignment */
204 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20);
205
206 /* MMC card detect & write protect for controller 0 */ 244 /* MMC card detect & write protect for controller 0 */
207 zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0); 245 zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0);
208 zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2); 246 zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2);
209 247
210 /* WM9713 IRQ */ 248 /* WM9713 IRQ */
211 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26); 249 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26);
250
251 zylonite_init_i2c();
212 } 252 }
213 253
214 if (cpu_is_pxa300()) { 254 if (cpu_is_pxa300()) {
@@ -224,4 +264,8 @@ void __init zylonite_pxa300_init(void)
224 zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30); 264 zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
225 zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31); 265 zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31);
226 } 266 }
267
268 /* GPIOs for Debug LEDs */
269 gpio_debug_led1 = EXT_GPIO(25);
270 gpio_debug_led2 = EXT_GPIO(26);
227} 271}
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 193d07903b06..2b7fba7a2921 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,
@@ -115,6 +116,10 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
115 GPIO27_MMC2_DAT3, 116 GPIO27_MMC2_DAT3,
116 GPIO28_MMC2_CLK, 117 GPIO28_MMC2_CLK,
117 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,
118}; 123};
119 124
120#define NUM_LCD_DETECT_PINS 7 125#define NUM_LCD_DETECT_PINS 7
@@ -187,8 +192,9 @@ void __init zylonite_pxa320_init(void)
187 zylonite_detect_lcd_panel(); 192 zylonite_detect_lcd_panel();
188 193
189 /* GPIO pin assignment */ 194 /* GPIO pin assignment */
190 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14);
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);