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/Kconfig58
-rw-r--r--arch/arm/mach-pxa/Makefile14
-rw-r--r--arch/arm/mach-pxa/am200epd.c2
-rw-r--r--arch/arm/mach-pxa/am300epd.c295
-rw-r--r--arch/arm/mach-pxa/clock.c4
-rw-r--r--arch/arm/mach-pxa/clock.h2
-rw-r--r--arch/arm/mach-pxa/cm-x255.c4
-rw-r--r--arch/arm/mach-pxa/cm-x270.c2
-rw-r--r--arch/arm/mach-pxa/cm-x2xx-pci.c1
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c4
-rw-r--r--arch/arm/mach-pxa/cm-x300.c6
-rw-r--r--arch/arm/mach-pxa/colibri-pxa270.c (renamed from arch/arm/mach-pxa/colibri.c)54
-rw-r--r--arch/arm/mach-pxa/colibri-pxa300.c190
-rw-r--r--arch/arm/mach-pxa/colibri-pxa320.c187
-rw-r--r--arch/arm/mach-pxa/colibri-pxa3xx.c121
-rw-r--r--arch/arm/mach-pxa/corgi.c10
-rw-r--r--arch/arm/mach-pxa/corgi_lcd.c1
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c1
-rw-r--r--arch/arm/mach-pxa/corgi_ssp.c1
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa2xx.c2
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa3xx.c2
-rw-r--r--arch/arm/mach-pxa/csb701.c61
-rw-r--r--arch/arm/mach-pxa/csb726.c318
-rw-r--r--arch/arm/mach-pxa/devices.c1
-rw-r--r--arch/arm/mach-pxa/dma.c146
-rw-r--r--arch/arm/mach-pxa/e330.c4
-rw-r--r--arch/arm/mach-pxa/e350.c4
-rw-r--r--arch/arm/mach-pxa/e400.c4
-rw-r--r--arch/arm/mach-pxa/e740.c6
-rw-r--r--arch/arm/mach-pxa/e750.c6
-rw-r--r--arch/arm/mach-pxa/e800.c6
-rw-r--r--arch/arm/mach-pxa/em-x270.c607
-rw-r--r--arch/arm/mach-pxa/eseries.c3
-rw-r--r--arch/arm/mach-pxa/ezx.c10
-rw-r--r--arch/arm/mach-pxa/generic.c33
-rw-r--r--arch/arm/mach-pxa/generic.h7
-rw-r--r--arch/arm/mach-pxa/gpio.c453
-rw-r--r--arch/arm/mach-pxa/gumstix.c12
-rw-r--r--arch/arm/mach-pxa/h5000.c7
-rw-r--r--arch/arm/mach-pxa/himalaya.c166
-rw-r--r--arch/arm/mach-pxa/idp.c3
-rw-r--r--arch/arm/mach-pxa/imote2.c5
-rw-r--r--arch/arm/mach-pxa/include/mach/colibri.h32
-rw-r--r--arch/arm/mach-pxa/include/mach/csb726.h26
-rw-r--r--arch/arm/mach-pxa/include/mach/dma.h33
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h126
-rw-r--r--arch/arm/mach-pxa/include/mach/gumstix.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/lubbock.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/magician.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa25x.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa27x.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa300.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa320.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h130
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa930.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/mtd-xip.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/palmld.h109
-rw-r--r--arch/arm/mach-pxa/include/mach/palmt5.h84
-rw-r--r--arch/arm/mach-pxa/include/mach/pm.h10
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa-regs.h263
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa25x.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa27x.h19
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa2xx-regs.h31
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa300.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa320.h9
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa3xx-regs.h11
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa930.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-intc.h23
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-ost.h34
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-rtc.h23
-rw-r--r--arch/arm/mach-pxa/include/mach/regs-ssp.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/system.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/uncompress.h3
-rw-r--r--arch/arm/mach-pxa/irq.c70
-rw-r--r--arch/arm/mach-pxa/leds-idp.c2
-rw-r--r--arch/arm/mach-pxa/leds-lubbock.c2
-rw-r--r--arch/arm/mach-pxa/leds-mainstone.c2
-rw-r--r--arch/arm/mach-pxa/littleton.c3
-rw-r--r--arch/arm/mach-pxa/lpd270.c5
-rw-r--r--arch/arm/mach-pxa/lubbock.c12
-rw-r--r--arch/arm/mach-pxa/magician.c101
-rw-r--r--arch/arm/mach-pxa/mainstone.c5
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c5
-rw-r--r--arch/arm/mach-pxa/mfp-pxa3xx.c189
-rw-r--r--arch/arm/mach-pxa/mioa701.c53
-rw-r--r--arch/arm/mach-pxa/mp900.c4
-rw-r--r--arch/arm/mach-pxa/palmld.c565
-rw-r--r--arch/arm/mach-pxa/palmt5.c496
-rw-r--r--arch/arm/mach-pxa/palmtx.c3
-rw-r--r--arch/arm/mach-pxa/palmz72.c4
-rw-r--r--arch/arm/mach-pxa/pcm027.c5
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c3
-rw-r--r--arch/arm/mach-pxa/pm.c13
-rw-r--r--arch/arm/mach-pxa/poodle.c10
-rw-r--r--arch/arm/mach-pxa/pwm.c1
-rw-r--r--arch/arm/mach-pxa/pxa25x.c11
-rw-r--r--arch/arm/mach-pxa/pxa27x.c9
-rw-r--r--arch/arm/mach-pxa/pxa2xx.c1
-rw-r--r--arch/arm/mach-pxa/pxa300.c14
-rw-r--r--arch/arm/mach-pxa/pxa320.c11
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c5
-rw-r--r--arch/arm/mach-pxa/pxa930.c9
-rw-r--r--arch/arm/mach-pxa/reset.c4
-rw-r--r--arch/arm/mach-pxa/saar.c6
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c1
-rw-r--r--arch/arm/mach-pxa/sleep.S1
-rw-r--r--arch/arm/mach-pxa/spitz.c8
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c1
-rw-r--r--arch/arm/mach-pxa/ssp.c1
-rw-r--r--arch/arm/mach-pxa/standby.S1
-rw-r--r--arch/arm/mach-pxa/tavorevb.c5
-rw-r--r--arch/arm/mach-pxa/time.c3
-rw-r--r--arch/arm/mach-pxa/tosa.c10
-rw-r--r--arch/arm/mach-pxa/trizeps4.c5
-rw-r--r--arch/arm/mach-pxa/viper.c7
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c4
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c2
119 files changed, 3906 insertions, 1602 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 8eea7306f29b..96a2006cb597 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -40,6 +40,9 @@ choice
40config GUMSTIX_AM200EPD 40config GUMSTIX_AM200EPD
41 bool "Enable AM200EPD board support" 41 bool "Enable AM200EPD board support"
42 42
43config GUMSTIX_AM300EPD
44 bool "Enable AM300EPD board support"
45
43endchoice 46endchoice
44 47
45config MACH_INTELMOTE2 48config MACH_INTELMOTE2
@@ -254,10 +257,24 @@ config MACH_EM_X270
254 bool "CompuLab EM-x270 platform" 257 bool "CompuLab EM-x270 platform"
255 select PXA27x 258 select PXA27x
256 259
260config MACH_EXEDA
261 bool "CompuLab eXeda platform"
262 select PXA27x
263
257config MACH_COLIBRI 264config MACH_COLIBRI
258 bool "Toradex Colibri PX27x" 265 bool "Toradex Colibri PXA270"
259 select PXA27x 266 select PXA27x
260 267
268config MACH_COLIBRI300
269 bool "Toradex Colibri PXA300/310"
270 select PXA3xx
271 select CPU_PXA300
272
273config MACH_COLIBRI320
274 bool "Toradex Colibri PXA320"
275 select PXA3xx
276 select CPU_PXA320
277
261config MACH_ZYLONITE 278config MACH_ZYLONITE
262 bool "PXA3xx Development Platform (aka Zylonite)" 279 bool "PXA3xx Development Platform (aka Zylonite)"
263 select PXA3xx 280 select PXA3xx
@@ -295,8 +312,15 @@ config MACH_MAGICIAN
295 bool "Enable HTC Magician Support" 312 bool "Enable HTC Magician Support"
296 select PXA27x 313 select PXA27x
297 select IWMMXT 314 select IWMMXT
315 select PXA_SSP
316 select HAVE_PWM
298 select PXA_HAVE_BOARD_IRQS 317 select PXA_HAVE_BOARD_IRQS
299 318
319config MACH_HIMALAYA
320 bool "HTC Himalaya Support"
321 select CPU_PXA26x
322 select FB_W100
323
300config MACH_MIOA701 324config MACH_MIOA701
301 bool "Mitac Mio A701 Support" 325 bool "Mitac Mio A701 Support"
302 select PXA27x 326 select PXA27x
@@ -319,6 +343,16 @@ config ARCH_PXA_PALM
319 bool "PXA based Palm PDAs" 343 bool "PXA based Palm PDAs"
320 select HAVE_PWM 344 select HAVE_PWM
321 345
346config MACH_PALMT5
347 bool "Palm Tungsten|T5"
348 default y
349 depends on ARCH_PXA_PALM
350 select PXA27x
351 select IWMMXT
352 help
353 Say Y here if you intend to run this kernel on a Palm Tungsten|T5
354 handheld computer.
355
322config MACH_PALMTX 356config MACH_PALMTX
323 bool "Palm T|X" 357 bool "Palm T|X"
324 default y 358 default y
@@ -339,6 +373,16 @@ config MACH_PALMZ72
339 Say Y here if you intend to run this kernel on Palm Zire 72 373 Say Y here if you intend to run this kernel on Palm Zire 72
340 handheld computer. 374 handheld computer.
341 375
376config MACH_PALMLD
377 bool "Palm LifeDrive"
378 default y
379 depends on ARCH_PXA_PALM
380 select PXA27x
381 select IWMMXT
382 help
383 Say Y here if you intend to run this kernel on a Palm LifeDrive
384 handheld computer.
385
342config MACH_PCM990_BASEBOARD 386config MACH_PCM990_BASEBOARD
343 bool "PHYTEC PCM-990 development board" 387 bool "PHYTEC PCM-990 development board"
344 select HAVE_PWM 388 select HAVE_PWM
@@ -359,6 +403,18 @@ config PCM990_DISPLAY_NONE
359 403
360endchoice 404endchoice
361 405
406config MACH_CSB726
407 bool "Enable Cogent CSB726 System On a Module"
408 select PXA27x
409 select IWMMXT
410 help
411 Say Y here if you intend to run this kernel on a Cogent
412 CSB726 System On Module.
413
414config CSB726_CSB701
415 bool "Enable supprot for CSB701 baseboard"
416 depends on MACH_CSB726
417
362config PXA_EZX 418config PXA_EZX
363 bool "Motorola EZX Platform" 419 bool "Motorola EZX Platform"
364 select PXA27x 420 select PXA27x
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 7b28bb561d63..c80e1bac4945 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -3,8 +3,8 @@
3# 3#
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 \
7 time.o gpio.o reset.o 7 time.o reset.o
8obj-$(CONFIG_PM) += pm.o sleep.o standby.o 8obj-$(CONFIG_PM) += pm.o sleep.o standby.o
9 9
10ifeq ($(CONFIG_CPU_FREQ),y) 10ifeq ($(CONFIG_CPU_FREQ),y)
@@ -28,13 +28,16 @@ obj-$(CONFIG_CPU_PXA930) += pxa930.o
28# Specific board support 28# Specific board support
29obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o 29obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
30obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o 30obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o
31obj-$(CONFIG_GUMSTIX_AM300EPD) += am300epd.o
31obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 32obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
32obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o 33obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o
33obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 34obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
34obj-$(CONFIG_MACH_MP900C) += mp900.o 35obj-$(CONFIG_MACH_MP900C) += mp900.o
35obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 36obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
36obj-$(CONFIG_MACH_TRIZEPS4) += trizeps4.o 37obj-$(CONFIG_MACH_TRIZEPS4) += trizeps4.o
37obj-$(CONFIG_MACH_COLIBRI) += colibri.o 38obj-$(CONFIG_MACH_COLIBRI) += colibri-pxa270.o
39obj-$(CONFIG_MACH_COLIBRI300) += colibri-pxa3xx.o colibri-pxa300.o
40obj-$(CONFIG_MACH_COLIBRI320) += colibri-pxa3xx.o colibri-pxa320.o
38obj-$(CONFIG_MACH_H5000) += h5000.o 41obj-$(CONFIG_MACH_H5000) += h5000.o
39obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o sharpsl_pm.o corgi_pm.o 42obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o sharpsl_pm.o corgi_pm.o
40obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o sharpsl_pm.o spitz_pm.o 43obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o sharpsl_pm.o spitz_pm.o
@@ -45,6 +48,7 @@ obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o
45obj-$(CONFIG_MACH_TOSA) += tosa.o 48obj-$(CONFIG_MACH_TOSA) += tosa.o
46obj-$(CONFIG_MACH_EM_X270) += em-x270.o 49obj-$(CONFIG_MACH_EM_X270) += em-x270.o
47obj-$(CONFIG_MACH_MAGICIAN) += magician.o 50obj-$(CONFIG_MACH_MAGICIAN) += magician.o
51obj-$(CONFIG_MACH_HIMALAYA) += himalaya.o
48obj-$(CONFIG_MACH_MIOA701) += mioa701.o mioa701_bootresume.o 52obj-$(CONFIG_MACH_MIOA701) += mioa701.o mioa701_bootresume.o
49obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o 53obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o
50obj-$(CONFIG_MACH_E330) += e330.o 54obj-$(CONFIG_MACH_E330) += e330.o
@@ -53,7 +57,9 @@ obj-$(CONFIG_MACH_E740) += e740.o
53obj-$(CONFIG_MACH_E750) += e750.o 57obj-$(CONFIG_MACH_E750) += e750.o
54obj-$(CONFIG_MACH_E400) += e400.o 58obj-$(CONFIG_MACH_E400) += e400.o
55obj-$(CONFIG_MACH_E800) += e800.o 59obj-$(CONFIG_MACH_E800) += e800.o
60obj-$(CONFIG_MACH_PALMT5) += palmt5.o
56obj-$(CONFIG_MACH_PALMTX) += palmtx.o 61obj-$(CONFIG_MACH_PALMTX) += palmtx.o
62obj-$(CONFIG_MACH_PALMLD) += palmld.o
57obj-$(CONFIG_MACH_PALMZ72) += palmz72.o 63obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
58obj-$(CONFIG_ARCH_VIPER) += viper.o 64obj-$(CONFIG_ARCH_VIPER) += viper.o
59 65
@@ -71,6 +77,8 @@ obj-$(CONFIG_MACH_CM_X300) += cm-x300.o
71obj-$(CONFIG_PXA_EZX) += ezx.o 77obj-$(CONFIG_PXA_EZX) += ezx.o
72 78
73obj-$(CONFIG_MACH_INTELMOTE2) += imote2.o 79obj-$(CONFIG_MACH_INTELMOTE2) += imote2.o
80obj-$(CONFIG_MACH_CSB726) += csb726.o
81obj-$(CONFIG_CSB726_CSB701) += csb701.o
74 82
75# Support for blinky lights 83# Support for blinky lights
76led-y := leds.o 84led-y := leds.o
diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
index 77ee80e5e47b..3499fada73ae 100644
--- a/arch/arm/mach-pxa/am200epd.c
+++ b/arch/arm/mach-pxa/am200epd.c
@@ -30,8 +30,8 @@
30#include <linux/irq.h> 30#include <linux/irq.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32 32
33#include <mach/pxa25x.h>
33#include <mach/gumstix.h> 34#include <mach/gumstix.h>
34#include <mach/mfp-pxa25x.h>
35#include <mach/pxafb.h> 35#include <mach/pxafb.h>
36 36
37#include "generic.h" 37#include "generic.h"
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
new file mode 100644
index 000000000000..4bd10a17332e
--- /dev/null
+++ b/arch/arm/mach-pxa/am300epd.c
@@ -0,0 +1,295 @@
1/*
2 * am300epd.c -- Platform device for AM300 EPD kit
3 *
4 * Copyright (C) 2008, Jaya Kumar
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
9 *
10 * This work was made possible by help and equipment support from E-Ink
11 * Corporation. http://support.eink.com/community
12 *
13 * This driver is written to be used with the Broadsheet display controller.
14 * on the AM300 EPD prototype kit/development kit with an E-Ink 800x600
15 * Vizplex EPD on a Gumstix board using the Broadsheet interface board.
16 *
17 */
18
19#include <linux/module.h>
20#include <linux/kernel.h>
21#include <linux/errno.h>
22#include <linux/string.h>
23#include <linux/delay.h>
24#include <linux/interrupt.h>
25#include <linux/fb.h>
26#include <linux/init.h>
27#include <linux/platform_device.h>
28#include <linux/irq.h>
29#include <linux/gpio.h>
30
31#include <mach/gumstix.h>
32#include <mach/mfp-pxa25x.h>
33#include <mach/pxafb.h>
34
35#include "generic.h"
36
37#include <video/broadsheetfb.h>
38
39static unsigned int panel_type = 6;
40static struct platform_device *am300_device;
41static struct broadsheet_board am300_board;
42
43static unsigned long am300_pin_config[] __initdata = {
44 GPIO16_GPIO,
45 GPIO17_GPIO,
46 GPIO32_GPIO,
47 GPIO48_GPIO,
48 GPIO49_GPIO,
49 GPIO51_GPIO,
50 GPIO74_GPIO,
51 GPIO75_GPIO,
52 GPIO76_GPIO,
53 GPIO77_GPIO,
54
55 /* this is the 16-bit hdb bus 58-73 */
56 GPIO58_GPIO,
57 GPIO59_GPIO,
58 GPIO60_GPIO,
59 GPIO61_GPIO,
60
61 GPIO62_GPIO,
62 GPIO63_GPIO,
63 GPIO64_GPIO,
64 GPIO65_GPIO,
65
66 GPIO66_GPIO,
67 GPIO67_GPIO,
68 GPIO68_GPIO,
69 GPIO69_GPIO,
70
71 GPIO70_GPIO,
72 GPIO71_GPIO,
73 GPIO72_GPIO,
74 GPIO73_GPIO,
75};
76
77/* register offsets for gpio control */
78#define PWR_GPIO_PIN 16
79#define CFG_GPIO_PIN 17
80#define RDY_GPIO_PIN 32
81#define DC_GPIO_PIN 48
82#define RST_GPIO_PIN 49
83#define LED_GPIO_PIN 51
84#define RD_GPIO_PIN 74
85#define WR_GPIO_PIN 75
86#define CS_GPIO_PIN 76
87#define IRQ_GPIO_PIN 77
88
89/* hdb bus */
90#define DB0_GPIO_PIN 58
91#define DB15_GPIO_PIN 73
92
93static int gpios[] = { PWR_GPIO_PIN, CFG_GPIO_PIN, RDY_GPIO_PIN, DC_GPIO_PIN,
94 RST_GPIO_PIN, RD_GPIO_PIN, WR_GPIO_PIN, CS_GPIO_PIN,
95 IRQ_GPIO_PIN, LED_GPIO_PIN };
96static char *gpio_names[] = { "PWR", "CFG", "RDY", "DC", "RST", "RD", "WR",
97 "CS", "IRQ", "LED" };
98
99static int am300_wait_event(struct broadsheetfb_par *par)
100{
101 /* todo: improve err recovery */
102 wait_event(par->waitq, gpio_get_value(RDY_GPIO_PIN));
103 return 0;
104}
105
106static int am300_init_gpio_regs(struct broadsheetfb_par *par)
107{
108 int i;
109 int err;
110 char dbname[8];
111
112 for (i = 0; i < ARRAY_SIZE(gpios); i++) {
113 err = gpio_request(gpios[i], gpio_names[i]);
114 if (err) {
115 dev_err(&am300_device->dev, "failed requesting "
116 "gpio %s, err=%d\n", gpio_names[i], err);
117 goto err_req_gpio;
118 }
119 }
120
121 /* we also need to take care of the hdb bus */
122 for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++) {
123 sprintf(dbname, "DB%d", i);
124 err = gpio_request(i, dbname);
125 if (err) {
126 dev_err(&am300_device->dev, "failed requesting "
127 "gpio %d, err=%d\n", i, err);
128 while (i >= DB0_GPIO_PIN)
129 gpio_free(i--);
130 i = ARRAY_SIZE(gpios) - 1;
131 goto err_req_gpio;
132 }
133 }
134
135 /* setup the outputs and init values */
136 gpio_direction_output(PWR_GPIO_PIN, 0);
137 gpio_direction_output(CFG_GPIO_PIN, 1);
138 gpio_direction_output(DC_GPIO_PIN, 0);
139 gpio_direction_output(RD_GPIO_PIN, 1);
140 gpio_direction_output(WR_GPIO_PIN, 1);
141 gpio_direction_output(CS_GPIO_PIN, 1);
142 gpio_direction_output(RST_GPIO_PIN, 0);
143
144 /* setup the inputs */
145 gpio_direction_input(RDY_GPIO_PIN);
146 gpio_direction_input(IRQ_GPIO_PIN);
147
148 /* start the hdb bus as an input */
149 for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++)
150 gpio_direction_output(i, 0);
151
152 /* go into command mode */
153 gpio_set_value(CFG_GPIO_PIN, 1);
154 gpio_set_value(RST_GPIO_PIN, 0);
155 msleep(10);
156 gpio_set_value(RST_GPIO_PIN, 1);
157 msleep(10);
158 am300_wait_event(par);
159
160 return 0;
161
162err_req_gpio:
163 while (i > 0)
164 gpio_free(gpios[i--]);
165
166 return err;
167}
168
169static int am300_init_board(struct broadsheetfb_par *par)
170{
171 return am300_init_gpio_regs(par);
172}
173
174static void am300_cleanup(struct broadsheetfb_par *par)
175{
176 int i;
177
178 free_irq(IRQ_GPIO(RDY_GPIO_PIN), par);
179
180 for (i = 0; i < ARRAY_SIZE(gpios); i++)
181 gpio_free(gpios[i]);
182
183 for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++)
184 gpio_free(i);
185
186}
187
188static u16 am300_get_hdb(struct broadsheetfb_par *par)
189{
190 u16 res = 0;
191 int i;
192
193 for (i = 0; i <= (DB15_GPIO_PIN - DB0_GPIO_PIN) ; i++)
194 res |= (gpio_get_value(DB0_GPIO_PIN + i)) ? (1 << i) : 0;
195
196 return res;
197}
198
199static void am300_set_hdb(struct broadsheetfb_par *par, u16 data)
200{
201 int i;
202
203 for (i = 0; i <= (DB15_GPIO_PIN - DB0_GPIO_PIN) ; i++)
204 gpio_set_value(DB0_GPIO_PIN + i, (data >> i) & 0x01);
205}
206
207
208static void am300_set_ctl(struct broadsheetfb_par *par, unsigned char bit,
209 u8 state)
210{
211 switch (bit) {
212 case BS_CS:
213 gpio_set_value(CS_GPIO_PIN, state);
214 break;
215 case BS_DC:
216 gpio_set_value(DC_GPIO_PIN, state);
217 break;
218 case BS_WR:
219 gpio_set_value(WR_GPIO_PIN, state);
220 break;
221 }
222}
223
224static int am300_get_panel_type(void)
225{
226 return panel_type;
227}
228
229static irqreturn_t am300_handle_irq(int irq, void *dev_id)
230{
231 struct broadsheetfb_par *par = dev_id;
232
233 wake_up(&par->waitq);
234 return IRQ_HANDLED;
235}
236
237static int am300_setup_irq(struct fb_info *info)
238{
239 int ret;
240 struct broadsheetfb_par *par = info->par;
241
242 ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am300_handle_irq,
243 IRQF_DISABLED|IRQF_TRIGGER_RISING,
244 "AM300", par);
245 if (ret)
246 dev_err(&am300_device->dev, "request_irq failed: %d\n", ret);
247
248 return ret;
249}
250
251static struct broadsheet_board am300_board = {
252 .owner = THIS_MODULE,
253 .init = am300_init_board,
254 .cleanup = am300_cleanup,
255 .set_hdb = am300_set_hdb,
256 .get_hdb = am300_get_hdb,
257 .set_ctl = am300_set_ctl,
258 .wait_for_rdy = am300_wait_event,
259 .get_panel_type = am300_get_panel_type,
260 .setup_irq = am300_setup_irq,
261};
262
263int __init am300_init(void)
264{
265 int ret;
266
267 pxa2xx_mfp_config(ARRAY_AND_SIZE(am300_pin_config));
268
269 /* request our platform independent driver */
270 request_module("broadsheetfb");
271
272 am300_device = platform_device_alloc("broadsheetfb", -1);
273 if (!am300_device)
274 return -ENOMEM;
275
276 /* the am300_board that will be seen by broadsheetfb is a copy */
277 platform_device_add_data(am300_device, &am300_board,
278 sizeof(am300_board));
279
280 ret = platform_device_add(am300_device);
281
282 if (ret) {
283 platform_device_put(am300_device);
284 return ret;
285 }
286
287 return 0;
288}
289
290module_param(panel_type, uint, 0);
291MODULE_PARM_DESC(panel_type, "Select the panel type: 6, 8, 97");
292
293MODULE_DESCRIPTION("board driver for am300 epd kit");
294MODULE_AUTHOR("Jaya Kumar");
295MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index 40b774084514..db52d2c4791d 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -87,7 +87,7 @@ void clks_register(struct clk_lookup *clks, size_t num)
87 clkdev_add(&clks[i]); 87 clkdev_add(&clks[i]);
88} 88}
89 89
90int clk_add_alias(char *alias, struct device *alias_dev, char *id, 90int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
91 struct device *dev) 91 struct device *dev)
92{ 92{
93 struct clk *r = clk_get(dev, id); 93 struct clk *r = clk_get(dev, id);
@@ -96,7 +96,7 @@ int clk_add_alias(char *alias, struct device *alias_dev, char *id,
96 if (!r) 96 if (!r)
97 return -ENODEV; 97 return -ENODEV;
98 98
99 l = clkdev_alloc(r, alias, alias_dev ? dev_name(alias_dev) : NULL); 99 l = clkdev_alloc(r, alias, alias_dev_name);
100 clk_put(r); 100 clk_put(r);
101 if (!l) 101 if (!l)
102 return -ENODEV; 102 return -ENODEV;
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 4e9c613c6767..5599bceff738 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -69,6 +69,6 @@ extern void clk_pxa3xx_cken_disable(struct clk *);
69#endif 69#endif
70 70
71void clks_register(struct clk_lookup *clks, size_t num); 71void clks_register(struct clk_lookup *clks, size_t num);
72int clk_add_alias(char *alias, struct device *alias_dev, char *id, 72int clk_add_alias(const char *alias, const char *alias_name, char *id,
73 struct device *dev); 73 struct device *dev);
74 74
diff --git a/arch/arm/mach-pxa/cm-x255.c b/arch/arm/mach-pxa/cm-x255.c
index 83a4cdf08176..253fd76142d6 100644
--- a/arch/arm/mach-pxa/cm-x255.c
+++ b/arch/arm/mach-pxa/cm-x255.c
@@ -22,10 +22,8 @@
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <mach/pxa2xx-regs.h> 25#include <mach/pxa25x.h>
26#include <mach/mfp-pxa25x.h>
27#include <mach/pxa2xx_spi.h> 26#include <mach/pxa2xx_spi.h>
28#include <mach/bitfield.h>
29 27
30#include "generic.h" 28#include "generic.h"
31 29
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index df83b97f303f..34576ba5f5fd 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -17,7 +17,7 @@
17#include <linux/rtc-v3020.h> 17#include <linux/rtc-v3020.h>
18#include <video/mbxfb.h> 18#include <video/mbxfb.h>
19 19
20#include <mach/mfp-pxa27x.h> 20#include <mach/pxa27x.h>
21#include <mach/ohci.h> 21#include <mach/ohci.h>
22#include <mach/mmc.h> 22#include <mach/mmc.h>
23 23
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
index 3156b25f6e9d..7873fa3d8fa4 100644
--- a/arch/arm/mach-pxa/cm-x2xx-pci.c
+++ b/arch/arm/mach-pxa/cm-x2xx-pci.c
@@ -22,7 +22,6 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23 23
24#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
25#include <mach/pxa-regs.h>
26#include <asm/mach-types.h> 25#include <asm/mach-types.h>
27 26
28#include <asm/hardware/it8152.h> 27#include <asm/hardware/it8152.h>
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index d99fd9e4d888..117b5435f8d5 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -22,8 +22,6 @@
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23 23
24#include <mach/pxa2xx-regs.h> 24#include <mach/pxa2xx-regs.h>
25#include <mach/mfp-pxa27x.h>
26#include <mach/pxa-regs.h>
27#include <mach/audio.h> 25#include <mach/audio.h>
28#include <mach/pxafb.h> 26#include <mach/pxafb.h>
29 27
@@ -96,7 +94,7 @@ static struct resource cmx270_dm9000_resource[] = {
96}; 94};
97 95
98static struct dm9000_plat_data cmx270_dm9000_platdata = { 96static struct dm9000_plat_data cmx270_dm9000_platdata = {
99 .flags = DM9000_PLATF_32BITONLY, 97 .flags = DM9000_PLATF_32BITONLY | DM9000_PLATF_NO_EEPROM,
100}; 98};
101 99
102static struct platform_device cmx2xx_dm9000_device = { 100static struct platform_device cmx2xx_dm9000_device = {
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index ff0c577cd1ac..a9f48b1cb54a 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -28,9 +28,7 @@
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30 30
31#include <mach/mfp-pxa300.h> 31#include <mach/pxa300.h>
32
33#include <mach/hardware.h>
34#include <mach/pxafb.h> 32#include <mach/pxafb.h>
35#include <mach/mmc.h> 33#include <mach/mmc.h>
36#include <mach/ohci.h> 34#include <mach/ohci.h>
@@ -162,7 +160,7 @@ static struct resource dm9000_resources[] = {
162}; 160};
163 161
164static struct dm9000_plat_data cm_x300_dm9000_platdata = { 162static struct dm9000_plat_data cm_x300_dm9000_platdata = {
165 .flags = DM9000_PLATF_16BITONLY, 163 .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
166}; 164};
167 165
168static struct platform_device dm9000_device = { 166static struct platform_device dm9000_device = {
diff --git a/arch/arm/mach-pxa/colibri.c b/arch/arm/mach-pxa/colibri-pxa270.c
index e8473624427e..01bcfaae75bc 100644
--- a/arch/arm/mach-pxa/colibri.c
+++ b/arch/arm/mach-pxa/colibri-pxa270.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-pxa/colibri.c 2 * linux/arch/arm/mach-pxa/colibri-pxa270.c
3 * 3 *
4 * Support for Toradex PXA27x based Colibri module 4 * Support for Toradex PXA270 based Colibri module
5 * Daniel Mack <daniel@caiaq.de> 5 * Daniel Mack <daniel@caiaq.de>
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
@@ -20,6 +20,7 @@
20#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
21#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
22#include <linux/mtd/physmap.h> 22#include <linux/mtd/physmap.h>
23#include <linux/gpio.h>
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <mach/hardware.h> 25#include <mach/hardware.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
@@ -28,20 +29,23 @@
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
29#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
30#include <asm/mach/flash.h> 31#include <asm/mach/flash.h>
31#include <mach/pxa-regs.h> 32
32#include <mach/mfp-pxa27x.h> 33#include <mach/pxa27x.h>
33#include <mach/colibri.h> 34#include <mach/colibri.h>
34 35
35#include "generic.h" 36#include "generic.h"
36#include "devices.h" 37#include "devices.h"
37 38
38static unsigned long colibri_pin_config[] __initdata = { 39/*
40 * GPIO configuration
41 */
42static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
39 GPIO78_nCS_2, /* Ethernet CS */ 43 GPIO78_nCS_2, /* Ethernet CS */
40 GPIO114_GPIO, /* Ethernet IRQ */ 44 GPIO114_GPIO, /* Ethernet IRQ */
41}; 45};
42 46
43/* 47/*
44 * Flash 48 * NOR flash
45 */ 49 */
46static struct mtd_partition colibri_partitions[] = { 50static struct mtd_partition colibri_partitions[] = {
47 { 51 {
@@ -70,39 +74,40 @@ static struct physmap_flash_data colibri_flash_data[] = {
70 } 74 }
71}; 75};
72 76
73static struct resource flash_resource = { 77static struct resource colibri_pxa270_flash_resource = {
74 .start = PXA_CS0_PHYS, 78 .start = PXA_CS0_PHYS,
75 .end = PXA_CS0_PHYS + SZ_32M - 1, 79 .end = PXA_CS0_PHYS + SZ_32M - 1,
76 .flags = IORESOURCE_MEM, 80 .flags = IORESOURCE_MEM,
77}; 81};
78 82
79static struct platform_device flash_device = { 83static struct platform_device colibri_pxa270_flash_device = {
80 .name = "physmap-flash", 84 .name = "physmap-flash",
81 .id = 0, 85 .id = 0,
82 .dev = { 86 .dev = {
83 .platform_data = colibri_flash_data, 87 .platform_data = colibri_flash_data,
84 }, 88 },
85 .resource = &flash_resource, 89 .resource = &colibri_pxa270_flash_resource,
86 .num_resources = 1, 90 .num_resources = 1,
87}; 91};
88 92
89/* 93/*
90 * DM9000 Ethernet 94 * DM9000 Ethernet
91 */ 95 */
96#if defined(CONFIG_DM9000)
92static struct resource dm9000_resources[] = { 97static struct resource dm9000_resources[] = {
93 [0] = { 98 [0] = {
94 .start = COLIBRI_ETH_PHYS, 99 .start = COLIBRI_PXA270_ETH_PHYS,
95 .end = COLIBRI_ETH_PHYS + 3, 100 .end = COLIBRI_PXA270_ETH_PHYS + 3,
96 .flags = IORESOURCE_MEM, 101 .flags = IORESOURCE_MEM,
97 }, 102 },
98 [1] = { 103 [1] = {
99 .start = COLIBRI_ETH_PHYS + 4, 104 .start = COLIBRI_PXA270_ETH_PHYS + 4,
100 .end = COLIBRI_ETH_PHYS + 4 + 500, 105 .end = COLIBRI_PXA270_ETH_PHYS + 4 + 500,
101 .flags = IORESOURCE_MEM, 106 .flags = IORESOURCE_MEM,
102 }, 107 },
103 [2] = { 108 [2] = {
104 .start = COLIBRI_ETH_IRQ, 109 .start = COLIBRI_PXA270_ETH_IRQ,
105 .end = COLIBRI_ETH_IRQ, 110 .end = COLIBRI_PXA270_ETH_IRQ,
106 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, 111 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
107 }, 112 },
108}; 113};
@@ -113,25 +118,28 @@ static struct platform_device dm9000_device = {
113 .num_resources = ARRAY_SIZE(dm9000_resources), 118 .num_resources = ARRAY_SIZE(dm9000_resources),
114 .resource = dm9000_resources, 119 .resource = dm9000_resources,
115}; 120};
121#endif /* CONFIG_DM9000 */
116 122
117static struct platform_device *colibri_devices[] __initdata = { 123static struct platform_device *colibri_pxa270_devices[] __initdata = {
118 &flash_device, 124 &colibri_pxa270_flash_device,
125#if defined(CONFIG_DM9000)
119 &dm9000_device, 126 &dm9000_device,
127#endif
120}; 128};
121 129
122static void __init colibri_init(void) 130static void __init colibri_pxa270_init(void)
123{ 131{
124 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pin_config)); 132 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
125 133 platform_add_devices(ARRAY_AND_SIZE(colibri_pxa270_devices));
126 platform_add_devices(colibri_devices, ARRAY_SIZE(colibri_devices));
127} 134}
128 135
129MACHINE_START(COLIBRI, "Toradex Colibri PXA27x") 136MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
130 .phys_io = 0x40000000, 137 .phys_io = 0x40000000,
131 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 138 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
132 .boot_params = COLIBRI_SDRAM_BASE + 0x100, 139 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
133 .init_machine = colibri_init, 140 .init_machine = colibri_pxa270_init,
134 .map_io = pxa_map_io, 141 .map_io = pxa_map_io,
135 .init_irq = pxa27x_init_irq, 142 .init_irq = pxa27x_init_irq,
136 .timer = &pxa_timer, 143 .timer = &pxa_timer,
137MACHINE_END 144MACHINE_END
145
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
new file mode 100644
index 000000000000..10c2eaf93230
--- /dev/null
+++ b/arch/arm/mach-pxa/colibri-pxa300.c
@@ -0,0 +1,190 @@
1/*
2 * arch/arm/mach-pxa/colibri-pxa300.c
3 *
4 * Support for Toradex PXA300/310 based Colibri module
5 *
6 * Daniel Mack <daniel@caiaq.de>
7 * Matthias Meier <matthias.j.meier@gmx.net>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/platform_device.h>
17#include <linux/gpio.h>
18#include <net/ax88796.h>
19
20#include <asm/mach-types.h>
21#include <asm/sizes.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/irq.h>
24
25#include <mach/pxa300.h>
26#include <mach/colibri.h>
27#include <mach/ohci.h>
28#include <mach/pxafb.h>
29
30#include "generic.h"
31#include "devices.h"
32
33#if defined(CONFIG_AX88796)
34#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
35/*
36 * Asix AX88796 Ethernet
37 */
38static struct ax_plat_data colibri_asix_platdata = {
39 .flags = AXFLG_MAC_FROMDEV,
40 .wordlength = 2
41};
42
43static struct resource colibri_asix_resource[] = {
44 [0] = {
45 .start = PXA3xx_CS2_PHYS,
46 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
47 .flags = IORESOURCE_MEM,
48 },
49 [1] = {
50 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
51 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
52 .flags = IORESOURCE_IRQ
53 }
54};
55
56static struct platform_device asix_device = {
57 .name = "ax88796",
58 .id = 0,
59 .num_resources = ARRAY_SIZE(colibri_asix_resource),
60 .resource = colibri_asix_resource,
61 .dev = {
62 .platform_data = &colibri_asix_platdata
63 }
64};
65
66static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
67 GPIO1_nCS2, /* AX88796 chip select */
68 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
69};
70
71static void __init colibri_pxa300_init_eth(void)
72{
73 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
74 set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING);
75 platform_device_register(&asix_device);
76}
77#else
78static inline void __init colibri_pxa300_init_eth(void) {}
79#endif /* CONFIG_AX88796 */
80
81#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
82static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
83 GPIO0_2_USBH_PEN,
84 GPIO1_2_USBH_PWR,
85};
86
87static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
88 .port_mode = PMM_GLOBAL_MODE,
89 .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
90};
91
92void __init colibri_pxa300_init_ohci(void)
93{
94 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
95 pxa_set_ohci_info(&colibri_pxa300_ohci_info);
96}
97#else
98static inline void colibri_pxa300_init_ohci(void) {}
99#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
100
101static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
102 GPIO7_MMC1_CLK,
103 GPIO14_MMC1_CMD,
104 GPIO3_MMC1_DAT0,
105 GPIO4_MMC1_DAT1,
106 GPIO5_MMC1_DAT2,
107 GPIO6_MMC1_DAT3,
108};
109
110#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
111static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
112 GPIO54_LCD_LDD_0,
113 GPIO55_LCD_LDD_1,
114 GPIO56_LCD_LDD_2,
115 GPIO57_LCD_LDD_3,
116 GPIO58_LCD_LDD_4,
117 GPIO59_LCD_LDD_5,
118 GPIO60_LCD_LDD_6,
119 GPIO61_LCD_LDD_7,
120 GPIO62_LCD_LDD_8,
121 GPIO63_LCD_LDD_9,
122 GPIO64_LCD_LDD_10,
123 GPIO65_LCD_LDD_11,
124 GPIO66_LCD_LDD_12,
125 GPIO67_LCD_LDD_13,
126 GPIO68_LCD_LDD_14,
127 GPIO69_LCD_LDD_15,
128 GPIO70_LCD_LDD_16,
129 GPIO71_LCD_LDD_17,
130 GPIO62_LCD_CS_N,
131 GPIO72_LCD_FCLK,
132 GPIO73_LCD_LCLK,
133 GPIO74_LCD_PCLK,
134 GPIO75_LCD_BIAS,
135 GPIO76_LCD_VSYNC,
136};
137
138static void __init colibri_pxa300_init_lcd(void)
139{
140 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
141}
142
143#else
144static inline void colibri_pxa300_init_lcd(void) {}
145#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
146
147#if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
148static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
149 GPIO24_AC97_SYSCLK,
150 GPIO23_AC97_nACRESET,
151 GPIO25_AC97_SDATA_IN_0,
152 GPIO27_AC97_SDATA_OUT,
153 GPIO28_AC97_SYNC,
154 GPIO29_AC97_BITCLK
155};
156
157static inline void __init colibri_pxa310_init_ac97(void)
158{
159 /* no AC97 codec on Colibri PXA300 */
160 if (!cpu_is_pxa310())
161 return;
162
163 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
164 pxa_set_ac97_info(NULL);
165}
166#else
167static inline void colibri_pxa310_init_ac97(void) {}
168#endif
169
170void __init colibri_pxa300_init(void)
171{
172 colibri_pxa300_init_eth();
173 colibri_pxa300_init_ohci();
174 colibri_pxa300_init_lcd();
175 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
176 colibri_pxa310_init_ac97();
177 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
178 mfp_to_gpio(MFP_PIN_GPIO13));
179}
180
181MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
182 .phys_io = 0x40000000,
183 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
184 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
185 .init_machine = colibri_pxa300_init,
186 .map_io = pxa_map_io,
187 .init_irq = pxa3xx_init_irq,
188 .timer = &pxa_timer,
189MACHINE_END
190
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
new file mode 100644
index 000000000000..55b74a7a6151
--- /dev/null
+++ b/arch/arm/mach-pxa/colibri-pxa320.c
@@ -0,0 +1,187 @@
1/*
2 * arch/arm/mach-pxa/colibri-pxa320.c
3 *
4 * Support for Toradex PXA320/310 based Colibri module
5 *
6 * Daniel Mack <daniel@caiaq.de>
7 * Matthias Meier <matthias.j.meier@gmx.net>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/platform_device.h>
17#include <linux/gpio.h>
18#include <net/ax88796.h>
19
20#include <asm/mach-types.h>
21#include <asm/sizes.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/irq.h>
24
25#include <mach/pxa3xx-regs.h>
26#include <mach/mfp-pxa320.h>
27#include <mach/colibri.h>
28#include <mach/pxafb.h>
29#include <mach/ohci.h>
30
31#include "generic.h"
32#include "devices.h"
33
34#if defined(CONFIG_AX88796)
35#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO)
36
37/*
38 * Asix AX88796 Ethernet
39 */
40static struct ax_plat_data colibri_asix_platdata = {
41 .flags = AXFLG_MAC_FROMDEV,
42 .wordlength = 2
43};
44
45static struct resource colibri_asix_resource[] = {
46 [0] = {
47 .start = PXA3xx_CS2_PHYS,
48 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
49 .flags = IORESOURCE_MEM,
50 },
51 [1] = {
52 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
53 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
54 .flags = IORESOURCE_IRQ
55 }
56};
57
58static struct platform_device asix_device = {
59 .name = "ax88796",
60 .id = 0,
61 .num_resources = ARRAY_SIZE(colibri_asix_resource),
62 .resource = colibri_asix_resource,
63 .dev = {
64 .platform_data = &colibri_asix_platdata
65 }
66};
67
68static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = {
69 GPIO3_nCS2, /* AX88796 chip select */
70 GPIO36_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
71};
72
73static void __init colibri_pxa320_init_eth(void)
74{
75 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config));
76 set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING);
77 platform_device_register(&asix_device);
78}
79#else
80static inline void __init colibri_pxa320_init_eth(void) {}
81#endif /* CONFIG_AX88796 */
82
83#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
84static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
85 GPIO2_2_USBH_PEN,
86 GPIO3_2_USBH_PWR,
87};
88
89static struct pxaohci_platform_data colibri_pxa320_ohci_info = {
90 .port_mode = PMM_GLOBAL_MODE,
91 .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
92};
93
94void __init colibri_pxa320_init_ohci(void)
95{
96 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
97 pxa_set_ohci_info(&colibri_pxa320_ohci_info);
98}
99#else
100static inline void colibri_pxa320_init_ohci(void) {}
101#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
102
103static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = {
104 GPIO22_MMC1_CLK,
105 GPIO23_MMC1_CMD,
106 GPIO18_MMC1_DAT0,
107 GPIO19_MMC1_DAT1,
108 GPIO20_MMC1_DAT2,
109 GPIO21_MMC1_DAT3
110};
111
112#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
113static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = {
114 GPIO6_2_LCD_LDD_0,
115 GPIO7_2_LCD_LDD_1,
116 GPIO8_2_LCD_LDD_2,
117 GPIO9_2_LCD_LDD_3,
118 GPIO10_2_LCD_LDD_4,
119 GPIO11_2_LCD_LDD_5,
120 GPIO12_2_LCD_LDD_6,
121 GPIO13_2_LCD_LDD_7,
122 GPIO63_LCD_LDD_8,
123 GPIO64_LCD_LDD_9,
124 GPIO65_LCD_LDD_10,
125 GPIO66_LCD_LDD_11,
126 GPIO67_LCD_LDD_12,
127 GPIO68_LCD_LDD_13,
128 GPIO69_LCD_LDD_14,
129 GPIO70_LCD_LDD_15,
130 GPIO71_LCD_LDD_16,
131 GPIO72_LCD_LDD_17,
132 GPIO73_LCD_CS_N,
133 GPIO74_LCD_VSYNC,
134 GPIO14_2_LCD_FCLK,
135 GPIO15_2_LCD_LCLK,
136 GPIO16_2_LCD_PCLK,
137 GPIO17_2_LCD_BIAS,
138};
139
140static void __init colibri_pxa320_init_lcd(void)
141{
142 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config));
143}
144#else
145static inline void colibri_pxa320_init_lcd(void) {}
146#endif
147
148#if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
149static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
150 GPIO34_AC97_SYSCLK,
151 GPIO35_AC97_SDATA_IN_0,
152 GPIO37_AC97_SDATA_OUT,
153 GPIO38_AC97_SYNC,
154 GPIO39_AC97_BITCLK,
155 GPIO40_AC97_nACRESET
156};
157
158static inline void __init colibri_pxa320_init_ac97(void)
159{
160 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config));
161 pxa_set_ac97_info(NULL);
162}
163#else
164static inline void colibri_pxa320_init_ac97(void) {}
165#endif
166
167void __init colibri_pxa320_init(void)
168{
169 colibri_pxa320_init_eth();
170 colibri_pxa320_init_ohci();
171 colibri_pxa320_init_lcd();
172 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
173 colibri_pxa320_init_ac97();
174 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
175 mfp_to_gpio(MFP_PIN_GPIO28));
176}
177
178MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
179 .phys_io = 0x40000000,
180 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
181 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
182 .init_machine = colibri_pxa320_init,
183 .map_io = pxa_map_io,
184 .init_irq = pxa3xx_init_irq,
185 .timer = &pxa_timer,
186MACHINE_END
187
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c
new file mode 100644
index 000000000000..12d0afc54aa5
--- /dev/null
+++ b/arch/arm/mach-pxa/colibri-pxa3xx.c
@@ -0,0 +1,121 @@
1/*
2 * arch/arm/mach-pxa/colibri-pxa3xx.c
3 *
4 * Common functions for all Toradex PXA3xx modules
5 *
6 * Daniel Mack <daniel@caiaq.de>
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/init.h>
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/gpio.h>
17#include <asm/mach-types.h>
18#include <mach/hardware.h>
19#include <asm/sizes.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/irq.h>
22#include <mach/pxa3xx-regs.h>
23#include <mach/mfp-pxa300.h>
24#include <mach/colibri.h>
25#include <mach/mmc.h>
26#include <mach/pxafb.h>
27
28#include "generic.h"
29#include "devices.h"
30
31#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
32static int mmc_detect_pin;
33
34static int colibri_pxa3xx_mci_init(struct device *dev,
35 irq_handler_t colibri_mmc_detect_int,
36 void *data)
37{
38 int ret;
39
40 ret = gpio_request(mmc_detect_pin, "mmc card detect");
41 if (ret)
42 return ret;
43
44 gpio_direction_input(mmc_detect_pin);
45 ret = request_irq(gpio_to_irq(mmc_detect_pin), colibri_mmc_detect_int,
46 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
47 "MMC card detect", data);
48 if (ret) {
49 gpio_free(mmc_detect_pin);
50 return ret;
51 }
52
53 return 0;
54}
55
56static void colibri_pxa3xx_mci_exit(struct device *dev, void *data)
57{
58 free_irq(mmc_detect_pin, data);
59 gpio_free(gpio_to_irq(mmc_detect_pin));
60}
61
62static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = {
63 .detect_delay = 20,
64 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
65 .init = colibri_pxa3xx_mci_init,
66 .exit = colibri_pxa3xx_mci_exit,
67};
68
69void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin)
70{
71 pxa3xx_mfp_config(pins, len);
72 mmc_detect_pin = detect_pin;
73 pxa_set_mci_info(&colibri_pxa3xx_mci_platform_data);
74}
75#endif /* CONFIG_MMC_PXA || CONFIG_MMC_PXA_MODULE */
76
77#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
78static int lcd_bl_pin;
79
80/*
81 * LCD panel (Sharp LQ043T3DX02)
82 */
83static void colibri_lcd_backlight(int on)
84{
85 gpio_set_value(lcd_bl_pin, !!on);
86}
87
88static struct pxafb_mode_info sharp_lq43_mode = {
89 .pixclock = 101936,
90 .xres = 480,
91 .yres = 272,
92 .bpp = 32,
93 .depth = 18,
94 .hsync_len = 41,
95 .left_margin = 2,
96 .right_margin = 2,
97 .vsync_len = 10,
98 .upper_margin = 2,
99 .lower_margin = 2,
100 .sync = 0,
101 .cmap_greyscale = 0,
102};
103
104static struct pxafb_mach_info sharp_lq43_info = {
105 .modes = &sharp_lq43_mode,
106 .num_modes = 1,
107 .cmap_inverse = 0,
108 .cmap_static = 0,
109 .lcd_conn = LCD_COLOR_TFT_18BPP,
110 .pxafb_backlight_power = colibri_lcd_backlight,
111};
112
113void __init colibri_pxa3xx_init_lcd(int bl_pin)
114{
115 lcd_bl_pin = bl_pin;
116 gpio_request(bl_pin, "lcd backlight");
117 gpio_direction_output(bl_pin, 0);
118 set_pxa_fb_info(&sharp_lq43_info);
119}
120#endif
121
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index a8d91b6c136b..cdf21dd135b4 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -41,9 +41,7 @@
41#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
43 43
44#include <mach/pxa-regs.h> 44#include <mach/pxa25x.h>
45#include <mach/pxa2xx-regs.h>
46#include <mach/mfp-pxa25x.h>
47#include <mach/i2c.h> 45#include <mach/i2c.h>
48#include <mach/irda.h> 46#include <mach/irda.h>
49#include <mach/mmc.h> 47#include <mach/mmc.h>
@@ -637,16 +635,16 @@ static void corgi_poweroff(void)
637 /* Green LED off tells the bootloader to halt */ 635 /* Green LED off tells the bootloader to halt */
638 gpio_set_value(CORGI_GPIO_LED_GREEN, 0); 636 gpio_set_value(CORGI_GPIO_LED_GREEN, 0);
639 637
640 arm_machine_restart('h'); 638 arm_machine_restart('h', NULL);
641} 639}
642 640
643static void corgi_restart(char mode) 641static void corgi_restart(char mode, const char *cmd)
644{ 642{
645 if (!machine_is_corgi()) 643 if (!machine_is_corgi())
646 /* Green LED on tells the bootloader to reboot */ 644 /* Green LED on tells the bootloader to reboot */
647 gpio_set_value(CORGI_GPIO_LED_GREEN, 1); 645 gpio_set_value(CORGI_GPIO_LED_GREEN, 1);
648 646
649 arm_machine_restart('h'); 647 arm_machine_restart('h', cmd);
650} 648}
651 649
652static void __init corgi_init(void) 650static void __init corgi_init(void)
diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c
index 411607bc1fc2..d9b96319d498 100644
--- a/arch/arm/mach-pxa/corgi_lcd.c
+++ b/arch/arm/mach-pxa/corgi_lcd.c
@@ -22,7 +22,6 @@
22#include <linux/string.h> 22#include <linux/string.h>
23#include <mach/corgi.h> 23#include <mach/corgi.h>
24#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <mach/pxa-regs.h>
26#include <mach/sharpsl.h> 25#include <mach/sharpsl.h>
27#include <mach/spitz.h> 26#include <mach/spitz.h>
28#include <asm/hardware/scoop.h> 27#include <asm/hardware/scoop.h>
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index e35259032813..7f04b3a761d1 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -24,7 +24,6 @@
24 24
25#include <mach/sharpsl.h> 25#include <mach/sharpsl.h>
26#include <mach/corgi.h> 26#include <mach/corgi.h>
27#include <mach/pxa-regs.h>
28#include <mach/pxa2xx-regs.h> 27#include <mach/pxa2xx-regs.h>
29#include <mach/pxa2xx-gpio.h> 28#include <mach/pxa2xx-gpio.h>
30#include "sharpsl.h" 29#include "sharpsl.h"
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c
index 8e2f2215c4ba..a5ee70735e04 100644
--- a/arch/arm/mach-pxa/corgi_ssp.c
+++ b/arch/arm/mach-pxa/corgi_ssp.c
@@ -20,7 +20,6 @@
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21 21
22#include <mach/ssp.h> 22#include <mach/ssp.h>
23#include <mach/pxa-regs.h>
24#include <mach/pxa2xx-gpio.h> 23#include <mach/pxa2xx-gpio.h>
25#include <mach/regs-ssp.h> 24#include <mach/regs-ssp.h>
26#include "sharpsl.h" 25#include "sharpsl.h"
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
index 771dd4eac935..083a1d851d49 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
@@ -37,8 +37,6 @@
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/cpufreq.h> 38#include <linux/cpufreq.h>
39 39
40#include <mach/hardware.h>
41#include <mach/pxa-regs.h>
42#include <mach/pxa2xx-regs.h> 40#include <mach/pxa2xx-regs.h>
43 41
44#ifdef DEBUG 42#ifdef DEBUG
diff --git a/arch/arm/mach-pxa/cpufreq-pxa3xx.c b/arch/arm/mach-pxa/cpufreq-pxa3xx.c
index 968c8309ec37..67f34a8d8e60 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa3xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa3xx.c
@@ -15,8 +15,6 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/cpufreq.h> 16#include <linux/cpufreq.h>
17 17
18#include <mach/hardware.h>
19#include <mach/pxa-regs.h>
20#include <mach/pxa3xx-regs.h> 18#include <mach/pxa3xx-regs.h>
21 19
22#include "generic.h" 20#include "generic.h"
diff --git a/arch/arm/mach-pxa/csb701.c b/arch/arm/mach-pxa/csb701.c
new file mode 100644
index 000000000000..4a2a2952c374
--- /dev/null
+++ b/arch/arm/mach-pxa/csb701.c
@@ -0,0 +1,61 @@
1#include <linux/kernel.h>
2#include <linux/module.h>
3#include <linux/platform_device.h>
4#include <linux/gpio_keys.h>
5#include <linux/input.h>
6#include <linux/leds.h>
7
8static struct gpio_keys_button csb701_buttons[] = {
9 {
10 .code = 0x7,
11 .gpio = 1,
12 .active_low = 1,
13 .desc = "SW2",
14 .type = EV_SW,
15 .wakeup = 1,
16 },
17};
18
19static struct gpio_keys_platform_data csb701_gpio_keys_data = {
20 .buttons = csb701_buttons,
21 .nbuttons = ARRAY_SIZE(csb701_buttons),
22};
23
24static struct gpio_led csb701_leds[] = {
25 {
26 .name = "csb701:yellow:heartbeat",
27 .default_trigger = "heartbeat",
28 .gpio = 11,
29 .active_low = 1,
30 },
31};
32
33static struct platform_device csb701_gpio_keys = {
34 .name = "gpio-keys",
35 .id = -1,
36 .dev.platform_data = &csb701_gpio_keys_data,
37};
38
39static struct gpio_led_platform_data csb701_leds_gpio_data = {
40 .leds = csb701_leds,
41 .num_leds = ARRAY_SIZE(csb701_leds),
42};
43
44static struct platform_device csb701_leds_gpio = {
45 .name = "leds-gpio",
46 .id = -1,
47 .dev.platform_data = &csb701_leds_gpio_data,
48};
49
50static struct platform_device *devices[] __initdata = {
51 &csb701_gpio_keys,
52 &csb701_leds_gpio,
53};
54
55static int __init csb701_init(void)
56{
57 return platform_add_devices(devices, ARRAY_SIZE(devices));
58}
59
60module_init(csb701_init);
61
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c
new file mode 100644
index 000000000000..2b289f83a61a
--- /dev/null
+++ b/arch/arm/mach-pxa/csb726.c
@@ -0,0 +1,318 @@
1/*
2 * Support for Cogent CSB726
3 *
4 * Copyright (c) 2008 Dmitry Eremin-Solenikov
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#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/io.h>
14#include <linux/gpio.h>
15#include <linux/platform_device.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/partitions.h>
18#include <linux/sm501.h>
19
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <mach/csb726.h>
23#include <mach/mfp-pxa27x.h>
24#include <mach/i2c.h>
25#include <mach/mmc.h>
26#include <mach/ohci.h>
27#include <mach/pxa2xx-regs.h>
28
29#include "generic.h"
30#include "devices.h"
31
32/*
33 * n/a: 2, 5, 6, 7, 8, 23, 24, 25, 26, 27, 87, 88, 89,
34 * nu: 58 -- 77, 90, 91, 93, 102, 105-108, 114-116,
35 * XXX: 21,
36 * XXX: 79 CS_3 for LAN9215 or PSKTSEL on R2, R3
37 * XXX: 33 CS_5 for LAN9215 on R1
38 */
39
40static unsigned long csb726_pin_config[] = {
41 GPIO78_nCS_2, /* EXP_CS */
42 GPIO79_nCS_3, /* SMSC9215 */
43 GPIO80_nCS_4, /* SM501 */
44
45 GPIO52_GPIO, /* #SMSC9251 int */
46 GPIO53_GPIO, /* SM501 int */
47
48 GPIO1_GPIO, /* GPIO0 */
49 GPIO11_GPIO, /* GPIO1 */
50 GPIO9_GPIO, /* GPIO2 */
51 GPIO10_GPIO, /* GPIO3 */
52 GPIO16_PWM0_OUT, /* or GPIO4 */
53 GPIO17_PWM1_OUT, /* or GPIO5 */
54 GPIO94_GPIO, /* GPIO6 */
55 GPIO95_GPIO, /* GPIO7 */
56 GPIO96_GPIO, /* GPIO8 */
57 GPIO97_GPIO, /* GPIO9 */
58 GPIO15_GPIO, /* EXP_IRQ */
59 GPIO18_RDY, /* EXP_WAIT */
60
61 GPIO0_GPIO, /* PWR_INT */
62 GPIO104_GPIO, /* PWR_OFF */
63
64 GPIO12_GPIO, /* touch irq */
65
66 GPIO13_SSP2_TXD,
67 GPIO14_SSP2_SFRM,
68 MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */
69 GPIO22_SSP2_SCLK,
70
71 GPIO81_SSP3_TXD,
72 GPIO82_SSP3_RXD,
73 GPIO83_SSP3_SFRM,
74 GPIO84_SSP3_SCLK,
75
76 GPIO20_GPIO, /* SDIO int */
77 GPIO32_MMC_CLK,
78 GPIO92_MMC_DAT_0,
79 GPIO109_MMC_DAT_1,
80 GPIO110_MMC_DAT_2,
81 GPIO111_MMC_DAT_3,
82 GPIO112_MMC_CMD,
83 GPIO100_GPIO, /* SD CD */
84 GPIO101_GPIO, /* SD WP */
85
86 GPIO28_AC97_BITCLK,
87 GPIO29_AC97_SDATA_IN_0,
88 GPIO30_AC97_SDATA_OUT,
89 GPIO31_AC97_SYNC,
90 GPIO113_AC97_nRESET,
91
92 GPIO34_FFUART_RXD,
93 GPIO35_FFUART_CTS,
94 GPIO36_FFUART_DCD,
95 GPIO37_FFUART_DSR,
96 GPIO38_FFUART_RI,
97 GPIO39_FFUART_TXD,
98 GPIO40_FFUART_DTR,
99 GPIO41_FFUART_RTS,
100
101 GPIO42_BTUART_RXD,
102 GPIO43_BTUART_TXD,
103 GPIO44_BTUART_CTS,
104 GPIO45_BTUART_RTS,
105
106 GPIO46_STUART_RXD,
107 GPIO47_STUART_TXD,
108
109 GPIO48_nPOE,
110 GPIO49_nPWE,
111 GPIO50_nPIOR,
112 GPIO51_nPIOW,
113 GPIO54_nPCE_2,
114 GPIO55_nPREG,
115 GPIO56_nPWAIT,
116 GPIO57_nIOIS16, /* maybe unused */
117 GPIO85_nPCE_1,
118 GPIO98_GPIO, /* CF IRQ */
119 GPIO99_GPIO, /* CF CD */
120 GPIO103_GPIO, /* Reset */
121
122 GPIO117_I2C_SCL,
123 GPIO118_I2C_SDA,
124};
125
126static struct pxamci_platform_data csb726_mci_data;
127
128static int csb726_mci_init(struct device *dev,
129 irq_handler_t detect, void *data)
130{
131 int err;
132
133 csb726_mci_data.detect_delay = msecs_to_jiffies(500);
134
135 err = gpio_request(CSB726_GPIO_MMC_DETECT, "MMC detect");
136 if (err)
137 goto err_det_req;
138
139 err = gpio_direction_input(CSB726_GPIO_MMC_DETECT);
140 if (err)
141 goto err_det_dir;
142
143 err = gpio_request(CSB726_GPIO_MMC_RO, "MMC ro");
144 if (err)
145 goto err_ro_req;
146
147 err = gpio_direction_input(CSB726_GPIO_MMC_RO);
148 if (err)
149 goto err_ro_dir;
150
151 err = request_irq(gpio_to_irq(CSB726_GPIO_MMC_DETECT), detect,
152 IRQF_DISABLED, "MMC card detect", data);
153 if (err)
154 goto err_irq;
155
156 return 0;
157
158err_irq:
159err_ro_dir:
160 gpio_free(CSB726_GPIO_MMC_RO);
161err_ro_req:
162err_det_dir:
163 gpio_free(CSB726_GPIO_MMC_DETECT);
164err_det_req:
165 return err;
166}
167
168static int csb726_mci_get_ro(struct device *dev)
169{
170 return gpio_get_value(CSB726_GPIO_MMC_RO);
171}
172
173static void csb726_mci_exit(struct device *dev, void *data)
174{
175 free_irq(gpio_to_irq(CSB726_GPIO_MMC_DETECT), data);
176 gpio_free(CSB726_GPIO_MMC_RO);
177 gpio_free(CSB726_GPIO_MMC_DETECT);
178}
179
180static struct pxamci_platform_data csb726_mci = {
181 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
182 .init = csb726_mci_init,
183 .get_ro = csb726_mci_get_ro,
184 /* FIXME setpower */
185 .exit = csb726_mci_exit,
186};
187
188static struct pxaohci_platform_data csb726_ohci_platform_data = {
189 .port_mode = PMM_NPS_MODE,
190 .flags = ENABLE_PORT1 | NO_OC_PROTECTION,
191};
192
193static struct mtd_partition csb726_flash_partitions[] = {
194 {
195 .name = "Bootloader",
196 .offset = 0,
197 .size = CSB726_FLASH_uMON,
198 .mask_flags = MTD_WRITEABLE /* force read-only */
199 },
200 {
201 .name = "root",
202 .offset = MTDPART_OFS_APPEND,
203 .size = MTDPART_SIZ_FULL,
204 }
205};
206
207static struct physmap_flash_data csb726_flash_data = {
208 .width = 2,
209 .parts = csb726_flash_partitions,
210 .nr_parts = ARRAY_SIZE(csb726_flash_partitions),
211};
212
213static struct resource csb726_flash_resources[] = {
214 {
215 .start = PXA_CS0_PHYS,
216 .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 ,
217 .flags = IORESOURCE_MEM,
218 }
219};
220
221static struct platform_device csb726_flash = {
222 .name = "physmap-flash",
223 .dev = {
224 .platform_data = &csb726_flash_data,
225 },
226 .resource = csb726_flash_resources,
227 .num_resources = ARRAY_SIZE(csb726_flash_resources),
228};
229
230static struct resource csb726_sm501_resources[] = {
231 {
232 .start = PXA_CS4_PHYS,
233 .end = PXA_CS4_PHYS + SZ_8M - 1,
234 .flags = IORESOURCE_MEM,
235 .name = "sm501-localmem",
236 },
237 {
238 .start = PXA_CS4_PHYS + SZ_64M - SZ_2M,
239 .end = PXA_CS4_PHYS + SZ_64M - 1,
240 .flags = IORESOURCE_MEM,
241 .name = "sm501-regs",
242 },
243 {
244 .start = CSB726_IRQ_SM501,
245 .end = CSB726_IRQ_SM501,
246 .flags = IORESOURCE_IRQ,
247 },
248};
249
250static struct sm501_initdata csb726_sm501_initdata = {
251/* .devices = SM501_USE_USB_HOST, */
252 .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1,
253};
254
255static struct sm501_platdata csb726_sm501_platdata = {
256 .init = &csb726_sm501_initdata,
257};
258
259static struct platform_device csb726_sm501 = {
260 .name = "sm501",
261 .id = 0,
262 .num_resources = ARRAY_SIZE(csb726_sm501_resources),
263 .resource = csb726_sm501_resources,
264 .dev = {
265 .platform_data = &csb726_sm501_platdata,
266 },
267};
268
269static struct resource csb726_lan_resources[] = {
270 {
271 .start = PXA_CS3_PHYS,
272 .end = PXA_CS3_PHYS + SZ_64K - 1,
273 .flags = IORESOURCE_MEM,
274 },
275 {
276 .start = CSB726_IRQ_LAN,
277 .end = CSB726_IRQ_LAN,
278 .flags = IORESOURCE_IRQ,
279 },
280};
281
282static struct platform_device csb726_lan = {
283 .name = "smc911x",
284 .id = -1,
285 .num_resources = ARRAY_SIZE(csb726_lan_resources),
286 .resource = csb726_lan_resources,
287};
288
289static struct platform_device *devices[] __initdata = {
290 &csb726_flash,
291 &csb726_sm501,
292 &csb726_lan,
293};
294
295static void __init csb726_init(void)
296{
297 pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config));
298/* MSC1 = 0x7ffc3ffc; *//* LAN9215/EXP_CS */
299/* MSC2 = 0x06697ff4; *//* none/SM501 */
300 MSC2 = (MSC2 & ~0xffff) | 0x7ff4; /* SM501 */
301
302 pxa_set_i2c_info(NULL);
303 pxa27x_set_i2c_power_info(NULL);
304 pxa_set_mci_info(&csb726_mci);
305 pxa_set_ohci_info(&csb726_ohci_platform_data);
306
307 platform_add_devices(devices, ARRAY_SIZE(devices));
308}
309
310MACHINE_START(CSB726, "Cogent CSB726")
311 .phys_io = 0x40000000,
312 .boot_params = 0xa0000100,
313 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
314 .map_io = pxa_map_io,
315 .init_irq = pxa27x_init_irq,
316 .init_machine = csb726_init,
317 .timer = &pxa_timer,
318MACHINE_END
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index e16f8e3d58d3..d245e59c51b1 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -4,7 +4,6 @@
4#include <linux/platform_device.h> 4#include <linux/platform_device.h>
5#include <linux/dma-mapping.h> 5#include <linux/dma-mapping.h>
6 6
7#include <mach/pxa-regs.h>
8#include <mach/udc.h> 7#include <mach/udc.h>
9#include <mach/pxafb.h> 8#include <mach/pxafb.h>
10#include <mach/mmc.h> 9#include <mach/mmc.h>
diff --git a/arch/arm/mach-pxa/dma.c b/arch/arm/mach-pxa/dma.c
deleted file mode 100644
index 7de17fc5d54b..000000000000
--- a/arch/arm/mach-pxa/dma.c
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/dma.c
3 *
4 * PXA DMA registration and IRQ dispatching
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 15, 2001
8 * Copyright: MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/interrupt.h>
19#include <linux/errno.h>
20
21#include <asm/system.h>
22#include <asm/irq.h>
23#include <mach/hardware.h>
24#include <mach/dma.h>
25
26#include <mach/pxa-regs.h>
27
28struct dma_channel {
29 char *name;
30 pxa_dma_prio prio;
31 void (*irq_handler)(int, void *);
32 void *data;
33};
34
35static struct dma_channel *dma_channels;
36static int num_dma_channels;
37
38int pxa_request_dma (char *name, pxa_dma_prio prio,
39 void (*irq_handler)(int, void *),
40 void *data)
41{
42 unsigned long flags;
43 int i, found = 0;
44
45 /* basic sanity checks */
46 if (!name || !irq_handler)
47 return -EINVAL;
48
49 local_irq_save(flags);
50
51 do {
52 /* try grabbing a DMA channel with the requested priority */
53 for (i = 0; i < num_dma_channels; i++) {
54 if ((dma_channels[i].prio == prio) &&
55 !dma_channels[i].name) {
56 found = 1;
57 break;
58 }
59 }
60 /* if requested prio group is full, try a hier priority */
61 } while (!found && prio--);
62
63 if (found) {
64 DCSR(i) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR;
65 dma_channels[i].name = name;
66 dma_channels[i].irq_handler = irq_handler;
67 dma_channels[i].data = data;
68 } else {
69 printk (KERN_WARNING "No more available DMA channels for %s\n", name);
70 i = -ENODEV;
71 }
72
73 local_irq_restore(flags);
74 return i;
75}
76
77void pxa_free_dma (int dma_ch)
78{
79 unsigned long flags;
80
81 if (!dma_channels[dma_ch].name) {
82 printk (KERN_CRIT
83 "%s: trying to free channel %d which is already freed\n",
84 __func__, dma_ch);
85 return;
86 }
87
88 local_irq_save(flags);
89 DCSR(dma_ch) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR;
90 dma_channels[dma_ch].name = NULL;
91 local_irq_restore(flags);
92}
93
94static irqreturn_t dma_irq_handler(int irq, void *dev_id)
95{
96 int i, dint = DINT;
97
98 for (i = 0; i < num_dma_channels; i++) {
99 if (dint & (1 << i)) {
100 struct dma_channel *channel = &dma_channels[i];
101 if (channel->name && channel->irq_handler) {
102 channel->irq_handler(i, channel->data);
103 } else {
104 /*
105 * IRQ for an unregistered DMA channel:
106 * let's clear the interrupts and disable it.
107 */
108 printk (KERN_WARNING "spurious IRQ for DMA channel %d\n", i);
109 DCSR(i) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR;
110 }
111 }
112 }
113 return IRQ_HANDLED;
114}
115
116int __init pxa_init_dma(int num_ch)
117{
118 int i, ret;
119
120 dma_channels = kzalloc(sizeof(struct dma_channel) * num_ch, GFP_KERNEL);
121 if (dma_channels == NULL)
122 return -ENOMEM;
123
124 /* dma channel priorities on pxa2xx processors:
125 * ch 0 - 3, 16 - 19 <--> (0) DMA_PRIO_HIGH
126 * ch 4 - 7, 20 - 23 <--> (1) DMA_PRIO_MEDIUM
127 * ch 8 - 15, 24 - 31 <--> (2) DMA_PRIO_LOW
128 */
129 for (i = 0; i < num_ch; i++) {
130 DCSR(i) = 0;
131 dma_channels[i].prio = min((i & 0xf) >> 2, DMA_PRIO_LOW);
132 }
133
134 ret = request_irq(IRQ_DMA, dma_irq_handler, IRQF_DISABLED, "DMA", NULL);
135 if (ret) {
136 printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n");
137 kfree(dma_channels);
138 return ret;
139 }
140
141 num_dma_channels = num_ch;
142 return 0;
143}
144
145EXPORT_SYMBOL(pxa_request_dma);
146EXPORT_SYMBOL(pxa_free_dma);
diff --git a/arch/arm/mach-pxa/e330.c b/arch/arm/mach-pxa/e330.c
index 1bd7f740427c..74d3f8987c5c 100644
--- a/arch/arm/mach-pxa/e330.c
+++ b/arch/arm/mach-pxa/e330.c
@@ -20,9 +20,7 @@
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22 22
23#include <mach/mfp-pxa25x.h> 23#include <mach/pxa25x.h>
24#include <mach/hardware.h>
25#include <mach/pxa-regs.h>
26#include <mach/eseries-gpio.h> 24#include <mach/eseries-gpio.h>
27#include <mach/udc.h> 25#include <mach/udc.h>
28 26
diff --git a/arch/arm/mach-pxa/e350.c b/arch/arm/mach-pxa/e350.c
index edcd9d5ce545..080036272131 100644
--- a/arch/arm/mach-pxa/e350.c
+++ b/arch/arm/mach-pxa/e350.c
@@ -21,9 +21,7 @@
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22 22
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24#include <mach/mfp-pxa25x.h> 24#include <mach/pxa25x.h>
25#include <mach/pxa-regs.h>
26#include <mach/hardware.h>
27#include <mach/eseries-gpio.h> 25#include <mach/eseries-gpio.h>
28#include <mach/udc.h> 26#include <mach/udc.h>
29 27
diff --git a/arch/arm/mach-pxa/e400.c b/arch/arm/mach-pxa/e400.c
index 77bb8e2c48c0..ed9c0c3f64a2 100644
--- a/arch/arm/mach-pxa/e400.c
+++ b/arch/arm/mach-pxa/e400.c
@@ -22,9 +22,7 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24 24
25#include <mach/mfp-pxa25x.h> 25#include <mach/pxa25x.h>
26#include <mach/pxa-regs.h>
27#include <mach/hardware.h>
28#include <mach/eseries-gpio.h> 26#include <mach/eseries-gpio.h>
29#include <mach/pxafb.h> 27#include <mach/pxafb.h>
30#include <mach/udc.h> 28#include <mach/udc.h>
diff --git a/arch/arm/mach-pxa/e740.c b/arch/arm/mach-pxa/e740.c
index a6fff782e7a8..07500a04fd8c 100644
--- a/arch/arm/mach-pxa/e740.c
+++ b/arch/arm/mach-pxa/e740.c
@@ -24,9 +24,7 @@
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26 26
27#include <mach/mfp-pxa25x.h> 27#include <mach/pxa25x.h>
28#include <mach/pxa-regs.h>
29#include <mach/hardware.h>
30#include <mach/eseries-gpio.h> 28#include <mach/eseries-gpio.h>
31#include <mach/udc.h> 29#include <mach/udc.h>
32#include <mach/irda.h> 30#include <mach/irda.h>
@@ -194,7 +192,7 @@ static void __init e740_init(void)
194{ 192{
195 pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config)); 193 pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
196 eseries_register_clks(); 194 eseries_register_clks();
197 clk_add_alias("CLK_CK48M", &e740_t7l66xb_device.dev, 195 clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name,
198 "UDCCLK", &pxa25x_device_udc.dev), 196 "UDCCLK", &pxa25x_device_udc.dev),
199 eseries_get_tmio_gpios(); 197 eseries_get_tmio_gpios();
200 platform_add_devices(devices, ARRAY_SIZE(devices)); 198 platform_add_devices(devices, ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-pxa/e750.c b/arch/arm/mach-pxa/e750.c
index 665066fd280e..6126c04e02bc 100644
--- a/arch/arm/mach-pxa/e750.c
+++ b/arch/arm/mach-pxa/e750.c
@@ -23,9 +23,7 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25 25
26#include <mach/mfp-pxa25x.h> 26#include <mach/pxa25x.h>
27#include <mach/pxa-regs.h>
28#include <mach/hardware.h>
29#include <mach/eseries-gpio.h> 27#include <mach/eseries-gpio.h>
30#include <mach/udc.h> 28#include <mach/udc.h>
31#include <mach/irda.h> 29#include <mach/irda.h>
@@ -195,7 +193,7 @@ static struct platform_device *devices[] __initdata = {
195static void __init e750_init(void) 193static void __init e750_init(void)
196{ 194{
197 pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config)); 195 pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config));
198 clk_add_alias("CLK_CK3P6MI", &e750_tc6393xb_device.dev, 196 clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name,
199 "GPIO11_CLK", NULL), 197 "GPIO11_CLK", NULL),
200 eseries_get_tmio_gpios(); 198 eseries_get_tmio_gpios();
201 platform_add_devices(devices, ARRAY_SIZE(devices)); 199 platform_add_devices(devices, ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-pxa/e800.c b/arch/arm/mach-pxa/e800.c
index cc9b1293e866..74ab09812a72 100644
--- a/arch/arm/mach-pxa/e800.c
+++ b/arch/arm/mach-pxa/e800.c
@@ -23,9 +23,7 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25 25
26#include <mach/mfp-pxa25x.h> 26#include <mach/pxa25x.h>
27#include <mach/pxa-regs.h>
28#include <mach/hardware.h>
29#include <mach/eseries-gpio.h> 27#include <mach/eseries-gpio.h>
30#include <mach/udc.h> 28#include <mach/udc.h>
31#include <mach/irqs.h> 29#include <mach/irqs.h>
@@ -196,7 +194,7 @@ static struct platform_device *devices[] __initdata = {
196 194
197static void __init e800_init(void) 195static void __init e800_init(void)
198{ 196{
199 clk_add_alias("CLK_CK3P6MI", &e800_tc6393xb_device.dev, 197 clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
200 "GPIO11_CLK", NULL), 198 "GPIO11_CLK", NULL),
201 eseries_get_tmio_gpios(); 199 eseries_get_tmio_gpios();
202 platform_add_devices(devices, ARRAY_SIZE(devices)); 200 platform_add_devices(devices, ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index f5ed8038ede5..920dfb8d36da 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -11,40 +11,63 @@
11 11
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/delay.h>
14 15
15#include <linux/dm9000.h> 16#include <linux/dm9000.h>
16#include <linux/rtc-v3020.h> 17#include <linux/rtc-v3020.h>
17#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
18#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/mtd/physmap.h>
19#include <linux/input.h> 21#include <linux/input.h>
20#include <linux/gpio_keys.h> 22#include <linux/gpio_keys.h>
21#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/mfd/da903x.h>
25#include <linux/regulator/machine.h>
26#include <linux/spi/spi.h>
27#include <linux/spi/tdo24m.h>
28#include <linux/power_supply.h>
29#include <linux/apm-emulation.h>
30
31#include <media/soc_camera.h>
22 32
23#include <asm/mach-types.h> 33#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
25 35
26#include <mach/mfp-pxa27x.h> 36#include <mach/pxa27x.h>
27#include <mach/pxa-regs.h>
28#include <mach/pxa27x-udc.h> 37#include <mach/pxa27x-udc.h>
29#include <mach/audio.h> 38#include <mach/audio.h>
30#include <mach/pxafb.h> 39#include <mach/pxafb.h>
31#include <mach/ohci.h> 40#include <mach/ohci.h>
32#include <mach/mmc.h> 41#include <mach/mmc.h>
33#include <mach/pxa27x_keypad.h> 42#include <mach/pxa27x_keypad.h>
43#include <mach/i2c.h>
44#include <mach/camera.h>
45#include <mach/pxa2xx_spi.h>
34 46
35#include "generic.h" 47#include "generic.h"
48#include "devices.h"
36 49
37/* GPIO IRQ usage */ 50/* EM-X270 specific GPIOs */
38#define GPIO41_ETHIRQ (41)
39#define GPIO13_MMC_CD (13) 51#define GPIO13_MMC_CD (13)
52#define GPIO95_MMC_WP (95)
53#define GPIO56_NAND_RB (56)
54
55/* eXeda specific GPIOs */
56#define GPIO114_MMC_CD (114)
57#define GPIO20_NAND_RB (20)
58#define GPIO38_SD_PWEN (38)
59
60/* common GPIOs */
61#define GPIO11_NAND_CS (11)
62#define GPIO93_CAM_RESET (93)
63#define GPIO41_ETHIRQ (41)
40#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) 64#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
41#define EM_X270_MMC_CD IRQ_GPIO(GPIO13_MMC_CD)
42 65
43/* NAND control GPIOs */ 66static int mmc_cd;
44#define GPIO11_NAND_CS (11) 67static int nand_rb;
45#define GPIO56_NAND_RB (56) 68static int dm9000_flags;
46 69
47static unsigned long em_x270_pin_config[] = { 70static unsigned long common_pin_config[] = {
48 /* AC'97 */ 71 /* AC'97 */
49 GPIO28_AC97_BITCLK, 72 GPIO28_AC97_BITCLK,
50 GPIO29_AC97_SDATA_IN_0, 73 GPIO29_AC97_SDATA_IN_0,
@@ -150,21 +173,32 @@ static unsigned long em_x270_pin_config[] = {
150 GPIO18_RDY, 173 GPIO18_RDY,
151 174
152 /* GPIO */ 175 /* GPIO */
153 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, 176 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */
154 177
155 /* power controls */ 178 /* power controls */
156 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */ 179 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
180 GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */
157 GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */ 181 GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */
158 182
159 /* NAND controls */ 183 /* NAND controls */
160 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */ 184 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
161 GPIO56_GPIO, /* NAND Ready/Busy */
162 185
163 /* interrupts */ 186 /* interrupts */
164 GPIO13_GPIO, /* MMC card detect */
165 GPIO41_GPIO, /* DM9000 interrupt */ 187 GPIO41_GPIO, /* DM9000 interrupt */
166}; 188};
167 189
190static unsigned long em_x270_pin_config[] = {
191 GPIO13_GPIO, /* MMC card detect */
192 GPIO56_GPIO, /* NAND Ready/Busy */
193 GPIO95_GPIO, /* MMC Write protect */
194};
195
196static unsigned long exeda_pin_config[] = {
197 GPIO20_GPIO, /* NAND Ready/Busy */
198 GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */
199 GPIO114_GPIO, /* MMC card detect */
200};
201
168#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) 202#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
169static struct resource em_x270_dm9000_resource[] = { 203static struct resource em_x270_dm9000_resource[] = {
170 [0] = { 204 [0] = {
@@ -185,7 +219,7 @@ static struct resource em_x270_dm9000_resource[] = {
185}; 219};
186 220
187static struct dm9000_plat_data em_x270_dm9000_platdata = { 221static struct dm9000_plat_data em_x270_dm9000_platdata = {
188 .flags = DM9000_PLATF_32BITONLY, 222 .flags = DM9000_PLATF_NO_EEPROM,
189}; 223};
190 224
191static struct platform_device em_x270_dm9000 = { 225static struct platform_device em_x270_dm9000 = {
@@ -200,6 +234,7 @@ static struct platform_device em_x270_dm9000 = {
200 234
201static void __init em_x270_init_dm9000(void) 235static void __init em_x270_init_dm9000(void)
202{ 236{
237 em_x270_dm9000_platdata.flags |= dm9000_flags;
203 platform_device_register(&em_x270_dm9000); 238 platform_device_register(&em_x270_dm9000);
204} 239}
205#else 240#else
@@ -289,7 +324,7 @@ static int em_x270_nand_device_ready(struct mtd_info *mtd)
289{ 324{
290 dsb(); 325 dsb();
291 326
292 return gpio_get_value(GPIO56_NAND_RB); 327 return gpio_get_value(nand_rb);
293} 328}
294 329
295static struct mtd_partition em_x270_partition_info[] = { 330static struct mtd_partition em_x270_partition_info[] = {
@@ -354,14 +389,14 @@ static void __init em_x270_init_nand(void)
354 389
355 gpio_direction_output(GPIO11_NAND_CS, 1); 390 gpio_direction_output(GPIO11_NAND_CS, 1);
356 391
357 err = gpio_request(GPIO56_NAND_RB, "NAND R/B"); 392 err = gpio_request(nand_rb, "NAND R/B");
358 if (err) { 393 if (err) {
359 pr_warning("EM-X270: failed to request NAND R/B gpio\n"); 394 pr_warning("EM-X270: failed to request NAND R/B gpio\n");
360 gpio_free(GPIO11_NAND_CS); 395 gpio_free(GPIO11_NAND_CS);
361 return; 396 return;
362 } 397 }
363 398
364 gpio_direction_input(GPIO56_NAND_RB); 399 gpio_direction_input(nand_rb);
365 400
366 platform_device_register(&em_x270_nand); 401 platform_device_register(&em_x270_nand);
367} 402}
@@ -369,6 +404,61 @@ static void __init em_x270_init_nand(void)
369static inline void em_x270_init_nand(void) {} 404static inline void em_x270_init_nand(void) {}
370#endif 405#endif
371 406
407#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
408static struct mtd_partition em_x270_nor_parts[] = {
409 {
410 .name = "Bootloader",
411 .offset = 0x00000000,
412 .size = 0x00050000,
413 .mask_flags = MTD_WRITEABLE /* force read-only */
414 }, {
415 .name = "Environment",
416 .offset = 0x00050000,
417 .size = 0x00010000,
418 }, {
419 .name = "Reserved",
420 .offset = 0x00060000,
421 .size = 0x00050000,
422 .mask_flags = MTD_WRITEABLE /* force read-only */
423 }, {
424 .name = "Splashscreen",
425 .offset = 0x000b0000,
426 .size = 0x00050000,
427 }
428};
429
430static struct physmap_flash_data em_x270_nor_data[] = {
431 [0] = {
432 .width = 2,
433 .parts = em_x270_nor_parts,
434 .nr_parts = ARRAY_SIZE(em_x270_nor_parts),
435 },
436};
437
438static struct resource em_x270_nor_flash_resource = {
439 .start = PXA_CS0_PHYS,
440 .end = PXA_CS0_PHYS + SZ_1M - 1,
441 .flags = IORESOURCE_MEM,
442};
443
444static struct platform_device em_x270_physmap_flash = {
445 .name = "physmap-flash",
446 .id = 0,
447 .num_resources = 1,
448 .resource = &em_x270_nor_flash_resource,
449 .dev = {
450 .platform_data = &em_x270_nor_data,
451 },
452};
453
454static void __init em_x270_init_nor(void)
455{
456 platform_device_register(&em_x270_physmap_flash);
457}
458#else
459static inline void em_x270_init_nor(void) {}
460#endif
461
372/* PXA27x OHCI controller setup */ 462/* PXA27x OHCI controller setup */
373#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 463#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
374static int em_x270_ohci_init(struct device *dev) 464static int em_x270_ohci_init(struct device *dev)
@@ -395,40 +485,93 @@ static inline void em_x270_init_ohci(void) {}
395 485
396/* MCI controller setup */ 486/* MCI controller setup */
397#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) 487#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
488static struct regulator *em_x270_sdio_ldo;
489
398static int em_x270_mci_init(struct device *dev, 490static int em_x270_mci_init(struct device *dev,
399 irq_handler_t em_x270_detect_int, 491 irq_handler_t em_x270_detect_int,
400 void *data) 492 void *data)
401{ 493{
402 int err = request_irq(EM_X270_MMC_CD, em_x270_detect_int, 494 int err;
403 IRQF_DISABLED | IRQF_TRIGGER_FALLING, 495
496 em_x270_sdio_ldo = regulator_get(dev, "vcc sdio");
497 if (IS_ERR(em_x270_sdio_ldo)) {
498 dev_err(dev, "can't request SDIO power supply: %ld\n",
499 PTR_ERR(em_x270_sdio_ldo));
500 return PTR_ERR(em_x270_sdio_ldo);
501 }
502
503 err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
504 IRQF_DISABLED | IRQF_TRIGGER_RISING |
505 IRQF_TRIGGER_FALLING,
404 "MMC card detect", data); 506 "MMC card detect", data);
405 if (err) { 507 if (err) {
406 printk(KERN_ERR "%s: can't request MMC card detect IRQ: %d\n", 508 dev_err(dev, "can't request MMC card detect IRQ: %d\n", err);
407 __func__, err); 509 goto err_irq;
408 return err; 510 }
511
512 if (machine_is_em_x270()) {
513 err = gpio_request(GPIO95_MMC_WP, "MMC WP");
514 if (err) {
515 dev_err(dev, "can't request MMC write protect: %d\n",
516 err);
517 goto err_gpio_wp;
518 }
519 gpio_direction_input(GPIO95_MMC_WP);
520 } else {
521 err = gpio_request(GPIO38_SD_PWEN, "sdio power");
522 if (err) {
523 dev_err(dev, "can't request MMC power control : %d\n",
524 err);
525 goto err_gpio_wp;
526 }
527 gpio_direction_output(GPIO38_SD_PWEN, 1);
409 } 528 }
410 529
411 return 0; 530 return 0;
531
532err_gpio_wp:
533 free_irq(gpio_to_irq(mmc_cd), data);
534err_irq:
535 regulator_put(em_x270_sdio_ldo);
536
537 return err;
412} 538}
413 539
414static void em_x270_mci_setpower(struct device *dev, unsigned int vdd) 540static void em_x270_mci_setpower(struct device *dev, unsigned int vdd)
415{ 541{
416 /* 542 struct pxamci_platform_data* p_d = dev->platform_data;
417 FIXME: current hardware implementation does not allow to 543
418 enable/disable MMC power. This will be fixed in next HW releases, 544 if ((1 << vdd) & p_d->ocr_mask) {
419 and we'll need to add implmentation here. 545 int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000;
420 */ 546
421 return; 547 regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV);
548 regulator_enable(em_x270_sdio_ldo);
549 } else {
550 regulator_disable(em_x270_sdio_ldo);
551 }
422} 552}
423 553
424static void em_x270_mci_exit(struct device *dev, void *data) 554static void em_x270_mci_exit(struct device *dev, void *data)
425{ 555{
426 int irq = gpio_to_irq(GPIO13_MMC_CD); 556 free_irq(gpio_to_irq(mmc_cd), data);
427 free_irq(irq, data); 557 regulator_put(em_x270_sdio_ldo);
558
559 if (machine_is_em_x270())
560 gpio_free(GPIO95_MMC_WP);
561 else
562 gpio_free(GPIO38_SD_PWEN);
563}
564
565static int em_x270_mci_get_ro(struct device *dev)
566{
567 return gpio_get_value(GPIO95_MMC_WP);
428} 568}
429 569
430static struct pxamci_platform_data em_x270_mci_platform_data = { 570static struct pxamci_platform_data em_x270_mci_platform_data = {
431 .ocr_mask = MMC_VDD_28_29|MMC_VDD_29_30|MMC_VDD_30_31, 571 .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23|
572 MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27|
573 MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
574 MMC_VDD_30_31|MMC_VDD_31_32,
432 .init = em_x270_mci_init, 575 .init = em_x270_mci_init,
433 .setpower = em_x270_mci_setpower, 576 .setpower = em_x270_mci_setpower,
434 .exit = em_x270_mci_exit, 577 .exit = em_x270_mci_exit,
@@ -436,33 +579,53 @@ static struct pxamci_platform_data em_x270_mci_platform_data = {
436 579
437static void __init em_x270_init_mmc(void) 580static void __init em_x270_init_mmc(void)
438{ 581{
582 if (machine_is_em_x270())
583 em_x270_mci_platform_data.get_ro = em_x270_mci_get_ro;
584
585 em_x270_mci_platform_data.detect_delay = msecs_to_jiffies(250);
439 pxa_set_mci_info(&em_x270_mci_platform_data); 586 pxa_set_mci_info(&em_x270_mci_platform_data);
440} 587}
441#else 588#else
442static inline void em_x270_init_mmc(void) {} 589static inline void em_x270_init_mmc(void) {}
443#endif 590#endif
444 591
445/* LCD 480x640 */ 592/* LCD */
446#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) 593#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
447static struct pxafb_mode_info em_x270_lcd_mode = { 594static struct pxafb_mode_info em_x270_lcd_modes[] = {
448 .pixclock = 50000, 595 [0] = {
449 .bpp = 16, 596 .pixclock = 38250,
450 .xres = 480, 597 .bpp = 16,
451 .yres = 640, 598 .xres = 480,
452 .hsync_len = 8, 599 .yres = 640,
453 .vsync_len = 2, 600 .hsync_len = 8,
454 .left_margin = 8, 601 .vsync_len = 2,
455 .upper_margin = 0, 602 .left_margin = 8,
456 .right_margin = 24, 603 .upper_margin = 2,
457 .lower_margin = 4, 604 .right_margin = 24,
458 .cmap_greyscale = 0, 605 .lower_margin = 4,
606 .sync = 0,
607 },
608 [1] = {
609 .pixclock = 153800,
610 .bpp = 16,
611 .xres = 240,
612 .yres = 320,
613 .hsync_len = 8,
614 .vsync_len = 2,
615 .left_margin = 8,
616 .upper_margin = 2,
617 .right_margin = 88,
618 .lower_margin = 2,
619 .sync = 0,
620 },
459}; 621};
460 622
461static struct pxafb_mach_info em_x270_lcd = { 623static struct pxafb_mach_info em_x270_lcd = {
462 .modes = &em_x270_lcd_mode, 624 .modes = em_x270_lcd_modes,
463 .num_modes = 1, 625 .num_modes = 2,
464 .lcd_conn = LCD_COLOR_TFT_16BPP, 626 .lcd_conn = LCD_COLOR_TFT_16BPP,
465}; 627};
628
466static void __init em_x270_init_lcd(void) 629static void __init em_x270_init_lcd(void)
467{ 630{
468 set_pxa_fb_info(&em_x270_lcd); 631 set_pxa_fb_info(&em_x270_lcd);
@@ -471,6 +634,40 @@ static void __init em_x270_init_lcd(void)
471static inline void em_x270_init_lcd(void) {} 634static inline void em_x270_init_lcd(void) {}
472#endif 635#endif
473 636
637#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
638static struct pxa2xx_spi_master em_x270_spi_info = {
639 .num_chipselect = 1,
640};
641
642static struct pxa2xx_spi_chip em_x270_tdo24m_chip = {
643 .rx_threshold = 1,
644 .tx_threshold = 1,
645};
646
647static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
648 .model = TDO35S,
649};
650
651static struct spi_board_info em_x270_spi_devices[] __initdata = {
652 {
653 .modalias = "tdo24m",
654 .max_speed_hz = 1000000,
655 .bus_num = 1,
656 .chip_select = 0,
657 .controller_data = &em_x270_tdo24m_chip,
658 .platform_data = &em_x270_tdo24m_pdata,
659 },
660};
661
662static void __init em_x270_init_spi(void)
663{
664 pxa2xx_set_spi_info(1, &em_x270_spi_info);
665 spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
666}
667#else
668static inline void em_x270_init_spi(void) {}
669#endif
670
474#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE) 671#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
475static void __init em_x270_init_ac97(void) 672static void __init em_x270_init_ac97(void)
476{ 673{
@@ -481,23 +678,76 @@ static inline void em_x270_init_ac97(void) {}
481#endif 678#endif
482 679
483#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 680#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
484static unsigned int em_x270_matrix_keys[] = { 681static unsigned int em_x270_module_matrix_keys[] = {
485 KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B), 682 KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
486 KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT), 683 KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
487 KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D), 684 KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
488}; 685};
489 686
490struct pxa27x_keypad_platform_data em_x270_keypad_info = { 687struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
491 /* code map for the matrix keys */ 688 /* code map for the matrix keys */
492 .matrix_key_rows = 3, 689 .matrix_key_rows = 3,
493 .matrix_key_cols = 3, 690 .matrix_key_cols = 3,
494 .matrix_key_map = em_x270_matrix_keys, 691 .matrix_key_map = em_x270_module_matrix_keys,
495 .matrix_key_map_size = ARRAY_SIZE(em_x270_matrix_keys), 692 .matrix_key_map_size = ARRAY_SIZE(em_x270_module_matrix_keys),
693};
694
695static unsigned int em_x270_exeda_matrix_keys[] = {
696 KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
697 KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
698 KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
699 KEY(0, 6, KEY_ENTER), KEY(0, 7, KEY_SLASH),
700
701 KEY(1, 0, KEY_DOT), KEY(1, 1, KEY_M),
702 KEY(1, 2, KEY_N), KEY(1, 3, KEY_B),
703 KEY(1, 4, KEY_V), KEY(1, 5, KEY_C),
704 KEY(1, 6, KEY_X), KEY(1, 7, KEY_Z),
705
706 KEY(2, 0, KEY_LEFTSHIFT), KEY(2, 1, KEY_SEMICOLON),
707 KEY(2, 2, KEY_L), KEY(2, 3, KEY_K),
708 KEY(2, 4, KEY_J), KEY(2, 5, KEY_H),
709 KEY(2, 6, KEY_G), KEY(2, 7, KEY_F),
710
711 KEY(3, 0, KEY_D), KEY(3, 1, KEY_S),
712 KEY(3, 2, KEY_A), KEY(3, 3, KEY_TAB),
713 KEY(3, 4, KEY_BACKSPACE), KEY(3, 5, KEY_P),
714 KEY(3, 6, KEY_O), KEY(3, 7, KEY_I),
715
716 KEY(4, 0, KEY_U), KEY(4, 1, KEY_Y),
717 KEY(4, 2, KEY_T), KEY(4, 3, KEY_R),
718 KEY(4, 4, KEY_E), KEY(4, 5, KEY_W),
719 KEY(4, 6, KEY_Q), KEY(4, 7, KEY_MINUS),
720
721 KEY(5, 0, KEY_0), KEY(5, 1, KEY_9),
722 KEY(5, 2, KEY_8), KEY(5, 3, KEY_7),
723 KEY(5, 4, KEY_6), KEY(5, 5, KEY_5),
724 KEY(5, 6, KEY_4), KEY(5, 7, KEY_3),
725
726 KEY(6, 0, KEY_2), KEY(6, 1, KEY_1),
727 KEY(6, 2, KEY_ENTER), KEY(6, 3, KEY_END),
728 KEY(6, 4, KEY_DOWN), KEY(6, 5, KEY_UP),
729 KEY(6, 6, KEY_MENU), KEY(6, 7, KEY_F1),
730
731 KEY(7, 0, KEY_LEFT), KEY(7, 1, KEY_RIGHT),
732 KEY(7, 2, KEY_BACK), KEY(7, 3, KEY_HOME),
733 KEY(7, 4, 0), KEY(7, 5, 0),
734 KEY(7, 6, 0), KEY(7, 7, 0),
735};
736
737struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
738 /* code map for the matrix keys */
739 .matrix_key_rows = 8,
740 .matrix_key_cols = 8,
741 .matrix_key_map = em_x270_exeda_matrix_keys,
742 .matrix_key_map_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
496}; 743};
497 744
498static void __init em_x270_init_keypad(void) 745static void __init em_x270_init_keypad(void)
499{ 746{
500 pxa_set_keypad_info(&em_x270_keypad_info); 747 if (machine_is_em_x270())
748 pxa_set_keypad_info(&em_x270_module_keypad_info);
749 else
750 pxa_set_keypad_info(&em_x270_exeda_keypad_info);
501} 751}
502#else 752#else
503static inline void em_x270_init_keypad(void) {} 753static inline void em_x270_init_keypad(void) {}
@@ -535,19 +785,264 @@ static void __init em_x270_init_gpio_keys(void)
535static inline void em_x270_init_gpio_keys(void) {} 785static inline void em_x270_init_gpio_keys(void) {}
536#endif 786#endif
537 787
538static void __init em_x270_init(void) 788/* Quick Capture Interface and sensor setup */
789#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
790static struct regulator *em_x270_camera_ldo;
791
792static int em_x270_sensor_init(struct device *dev)
539{ 793{
794 int ret;
795
796 ret = gpio_request(GPIO93_CAM_RESET, "camera reset");
797 if (ret)
798 return ret;
799
800 gpio_direction_output(GPIO93_CAM_RESET, 0);
801
802 em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
803 if (em_x270_camera_ldo == NULL) {
804 gpio_free(GPIO93_CAM_RESET);
805 return -ENODEV;
806 }
807
808 ret = regulator_enable(em_x270_camera_ldo);
809 if (ret) {
810 regulator_put(em_x270_camera_ldo);
811 gpio_free(GPIO93_CAM_RESET);
812 return ret;
813 }
814
815 gpio_set_value(GPIO93_CAM_RESET, 1);
816
817 return 0;
818}
819
820struct pxacamera_platform_data em_x270_camera_platform_data = {
821 .init = em_x270_sensor_init,
822 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
823 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
824 .mclk_10khz = 2600,
825};
826
827static int em_x270_sensor_power(struct device *dev, int on)
828{
829 int ret;
830 int is_on = regulator_is_enabled(em_x270_camera_ldo);
831
832 if (on == is_on)
833 return 0;
834
835 gpio_set_value(GPIO93_CAM_RESET, !on);
836
837 if (on)
838 ret = regulator_enable(em_x270_camera_ldo);
839 else
840 ret = regulator_disable(em_x270_camera_ldo);
841
842 if (ret)
843 return ret;
844
845 gpio_set_value(GPIO93_CAM_RESET, on);
846
847 return 0;
848}
849
850static struct soc_camera_link iclink = {
851 .bus_id = 0,
852 .power = em_x270_sensor_power,
853};
854
855static struct i2c_board_info em_x270_i2c_cam_info[] = {
856 {
857 I2C_BOARD_INFO("mt9m111", 0x48),
858 .platform_data = &iclink,
859 },
860};
861
862static struct i2c_pxa_platform_data em_x270_i2c_info = {
863 .fast_mode = 1,
864};
865
866static void __init em_x270_init_camera(void)
867{
868 pxa_set_i2c_info(&em_x270_i2c_info);
869 i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info));
870 pxa_set_camera_info(&em_x270_camera_platform_data);
871}
872#else
873static inline void em_x270_init_camera(void) {}
874#endif
875
876/* DA9030 related initializations */
877#define REGULATOR_CONSUMER(_name, _dev, _supply) \
878 static struct regulator_consumer_supply _name##_consumers[] = { \
879 { \
880 .dev = _dev, \
881 .supply = _supply, \
882 }, \
883 }
884
885REGULATOR_CONSUMER(ldo3, NULL, "vcc gps");
886REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
887REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
888REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
889REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs");
890
891#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
892 static struct regulator_init_data _ldo##_data = { \
893 .constraints = { \
894 .min_uV = _min_uV, \
895 .max_uV = _max_uV, \
896 .state_mem = { \
897 .enabled = 0, \
898 }, \
899 .valid_ops_mask = _ops_mask, \
900 }, \
901 .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \
902 .consumer_supplies = _ldo##_consumers, \
903 };
904
905REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
906REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
907REGULATOR_INIT(ldo10, 2000000, 3200000,
908 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE);
909REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
910REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
911
912struct led_info em_x270_led_info = {
913 .name = "em-x270:orange",
914 .default_trigger = "battery-charging-or-full",
915};
916
917struct power_supply_info em_x270_psy_info = {
918 .name = "LP555597P6H-FPS",
919 .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
920 .voltage_max_design = 4200000,
921 .voltage_min_design = 3000000,
922 .use_for_apm = 1,
923};
924
925static void em_x270_battery_low(void)
926{
927 apm_queue_event(APM_LOW_BATTERY);
928}
929
930static void em_x270_battery_critical(void)
931{
932 apm_queue_event(APM_CRITICAL_SUSPEND);
933}
934
935struct da9030_battery_info em_x270_batterty_info = {
936 .battery_info = &em_x270_psy_info,
937
938 .charge_milliamp = 1000,
939 .charge_millivolt = 4200,
940
941 .vbat_low = 3600,
942 .vbat_crit = 3400,
943 .vbat_charge_start = 4100,
944 .vbat_charge_stop = 4200,
945 .vbat_charge_restart = 4000,
946
947 .vcharge_min = 3200,
948 .vcharge_max = 5500,
949
950 .tbat_low = 197,
951 .tbat_high = 78,
952 .tbat_restart = 100,
953
954 .batmon_interval = 0,
955
956 .battery_low = em_x270_battery_low,
957 .battery_critical = em_x270_battery_critical,
958};
959
960#define DA9030_SUBDEV(_name, _id, _pdata) \
961 { \
962 .name = "da903x-" #_name, \
963 .id = DA9030_ID_##_id, \
964 .platform_data = _pdata, \
965 }
966
967#define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data)
968
969struct da903x_subdev_info em_x270_da9030_subdevs[] = {
970 DA9030_LDO(3),
971 DA9030_LDO(5),
972 DA9030_LDO(10),
973 DA9030_LDO(12),
974 DA9030_LDO(19),
975
976 DA9030_SUBDEV(led, LED_PC, &em_x270_led_info),
977 DA9030_SUBDEV(backlight, WLED, &em_x270_led_info),
978 DA9030_SUBDEV(battery, BAT, &em_x270_batterty_info),
979};
980
981static struct da903x_platform_data em_x270_da9030_info = {
982 .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs),
983 .subdevs = em_x270_da9030_subdevs,
984};
985
986static struct i2c_board_info em_x270_i2c_pmic_info = {
987 I2C_BOARD_INFO("da9030", 0x49),
988 .irq = IRQ_GPIO(0),
989 .platform_data = &em_x270_da9030_info,
990};
991
992static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = {
993 .use_pio = 1,
994};
995
996static void __init em_x270_init_da9030(void)
997{
998 pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info);
999 i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
1000}
1001
1002static void __init em_x270_module_init(void)
1003{
1004 pr_info("%s\n", __func__);
540 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config)); 1005 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
541 1006
1007 mmc_cd = GPIO13_MMC_CD;
1008 nand_rb = GPIO56_NAND_RB;
1009 dm9000_flags = DM9000_PLATF_32BITONLY;
1010}
1011
1012static void __init em_x270_exeda_init(void)
1013{
1014 pr_info("%s\n", __func__);
1015 pxa2xx_mfp_config(ARRAY_AND_SIZE(exeda_pin_config));
1016
1017 mmc_cd = GPIO114_MMC_CD;
1018 nand_rb = GPIO20_NAND_RB;
1019 dm9000_flags = DM9000_PLATF_16BITONLY;
1020}
1021
1022static void __init em_x270_init(void)
1023{
1024 pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config));
1025
1026 if (machine_is_em_x270())
1027 em_x270_module_init();
1028 else if (machine_is_exeda())
1029 em_x270_exeda_init();
1030 else
1031 panic("Unsupported machine: %d\n", machine_arch_type);
1032
1033 em_x270_init_da9030();
542 em_x270_init_dm9000(); 1034 em_x270_init_dm9000();
543 em_x270_init_rtc(); 1035 em_x270_init_rtc();
544 em_x270_init_nand(); 1036 em_x270_init_nand();
1037 em_x270_init_nor();
545 em_x270_init_lcd(); 1038 em_x270_init_lcd();
546 em_x270_init_mmc(); 1039 em_x270_init_mmc();
547 em_x270_init_ohci(); 1040 em_x270_init_ohci();
548 em_x270_init_keypad(); 1041 em_x270_init_keypad();
549 em_x270_init_gpio_keys(); 1042 em_x270_init_gpio_keys();
550 em_x270_init_ac97(); 1043 em_x270_init_ac97();
1044 em_x270_init_camera();
1045 em_x270_init_spi();
551} 1046}
552 1047
553MACHINE_START(EM_X270, "Compulab EM-X270") 1048MACHINE_START(EM_X270, "Compulab EM-X270")
@@ -559,3 +1054,13 @@ MACHINE_START(EM_X270, "Compulab EM-X270")
559 .timer = &pxa_timer, 1054 .timer = &pxa_timer,
560 .init_machine = em_x270_init, 1055 .init_machine = em_x270_init,
561MACHINE_END 1056MACHINE_END
1057
1058MACHINE_START(EXEDA, "Compulab eXeda")
1059 .boot_params = 0xa0000100,
1060 .phys_io = 0x40000000,
1061 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1062 .map_io = pxa_map_io,
1063 .init_irq = pxa27x_init_irq,
1064 .timer = &pxa_timer,
1065 .init_machine = em_x270_init,
1066MACHINE_END
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index dfce7d5b659e..c60dadf847a6 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -20,8 +20,7 @@
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22 22
23#include <mach/mfp-pxa25x.h> 23#include <mach/pxa25x.h>
24#include <mach/hardware.h>
25#include <mach/eseries-gpio.h> 24#include <mach/eseries-gpio.h>
26#include <mach/udc.h> 25#include <mach/udc.h>
27#include <mach/irda.h> 26#include <mach/irda.h>
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index df5f822f3b6c..92ba16e1b6fc 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -19,18 +19,16 @@
19#include <linux/input.h> 19#include <linux/input.h>
20 20
21#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24
25#include <mach/pxa27x.h>
22#include <mach/pxafb.h> 26#include <mach/pxafb.h>
23#include <mach/ohci.h> 27#include <mach/ohci.h>
24#include <mach/i2c.h> 28#include <mach/i2c.h>
25#include <mach/hardware.h> 29#include <mach/hardware.h>
26#include <mach/pxa27x_keypad.h> 30#include <mach/pxa27x_keypad.h>
27 31
28#include <mach/mfp-pxa27x.h>
29#include <mach/pxa-regs.h>
30#include <mach/pxa2xx-regs.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33
34#include "devices.h" 32#include "devices.h"
35#include "generic.h" 33#include "generic.h"
36 34
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 0ccc91c92c44..3126a35aa002 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -26,8 +26,9 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28 28
29#include <mach/pxa-regs.h>
30#include <mach/reset.h> 29#include <mach/reset.h>
30#include <mach/gpio.h>
31#include <mach/pxa2xx-gpio.h>
31 32
32#include "generic.h" 33#include "generic.h"
33 34
@@ -127,3 +128,33 @@ void __init pxa_map_io(void)
127 iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); 128 iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));
128 get_clk_frequency_khz(1); 129 get_clk_frequency_khz(1);
129} 130}
131
132/*
133 * Configure pins for GPIO or other functions
134 */
135int pxa_gpio_mode(int gpio_mode)
136{
137 unsigned long flags;
138 int gpio = gpio_mode & GPIO_MD_MASK_NR;
139 int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
140 int gafr;
141
142 if (gpio > pxa_last_gpio)
143 return -EINVAL;
144
145 local_irq_save(flags);
146 if (gpio_mode & GPIO_DFLT_LOW)
147 GPCR(gpio) = GPIO_bit(gpio);
148 else if (gpio_mode & GPIO_DFLT_HIGH)
149 GPSR(gpio) = GPIO_bit(gpio);
150 if (gpio_mode & GPIO_MD_MASK_DIR)
151 GPDR(gpio) |= GPIO_bit(gpio);
152 else
153 GPDR(gpio) &= ~GPIO_bit(gpio);
154 gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
155 GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2));
156 local_irq_restore(flags);
157
158 return 0;
159}
160EXPORT_SYMBOL(pxa_gpio_mode);
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index dc876a8e6668..3465268ca716 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -9,20 +9,17 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12typedef int (*set_wake_t)(unsigned int, unsigned int);
13
14struct sys_timer; 12struct sys_timer;
15 13
16extern struct sys_timer pxa_timer; 14extern struct sys_timer pxa_timer;
17extern void __init pxa_init_irq(int irq_nr, set_wake_t fn); 15extern void __init pxa_init_irq(int irq_nr,
18extern void __init pxa_init_gpio(int gpio_nr, set_wake_t fn); 16 int (*set_wake)(unsigned int, unsigned int));
19extern void __init pxa25x_init_irq(void); 17extern void __init pxa25x_init_irq(void);
20extern void __init pxa27x_init_irq(void); 18extern void __init pxa27x_init_irq(void);
21extern void __init pxa3xx_init_irq(void); 19extern void __init pxa3xx_init_irq(void);
22extern void __init pxa_map_io(void); 20extern void __init pxa_map_io(void);
23 21
24extern unsigned int get_clk_frequency_khz(int info); 22extern unsigned int get_clk_frequency_khz(int info);
25extern int pxa_last_gpio;
26 23
27#define SET_BANK(__nr,__start,__size) \ 24#define SET_BANK(__nr,__start,__size) \
28 mi->bank[__nr].start = (__start), \ 25 mi->bank[__nr].start = (__start), \
diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c
deleted file mode 100644
index 5fec1e479cb3..000000000000
--- a/arch/arm/mach-pxa/gpio.c
+++ /dev/null
@@ -1,453 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/gpio.c
3 *
4 * Generic PXA GPIO handling
5 *
6 * Author: Nicolas Pitre
7 * Created: Jun 15, 2001
8 * Copyright: MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/irq.h>
18#include <linux/sysdev.h>
19#include <linux/io.h>
20
21#include <asm/gpio.h>
22#include <mach/hardware.h>
23#include <mach/pxa-regs.h>
24#include <mach/pxa2xx-gpio.h>
25
26#include "generic.h"
27
28#define GPIO0_BASE ((void __iomem *)io_p2v(0x40E00000))
29#define GPIO1_BASE ((void __iomem *)io_p2v(0x40E00004))
30#define GPIO2_BASE ((void __iomem *)io_p2v(0x40E00008))
31#define GPIO3_BASE ((void __iomem *)io_p2v(0x40E00100))
32
33#define GPLR_OFFSET 0x00
34#define GPDR_OFFSET 0x0C
35#define GPSR_OFFSET 0x18
36#define GPCR_OFFSET 0x24
37#define GRER_OFFSET 0x30
38#define GFER_OFFSET 0x3C
39#define GEDR_OFFSET 0x48
40
41struct pxa_gpio_chip {
42 struct gpio_chip chip;
43 void __iomem *regbase;
44};
45
46int pxa_last_gpio;
47
48#ifdef CONFIG_CPU_PXA26x
49/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
50 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
51 */
52static int __gpio_is_inverted(unsigned gpio)
53{
54 return cpu_is_pxa25x() && gpio > 85;
55}
56#else
57#define __gpio_is_inverted(gpio) (0)
58#endif
59
60/*
61 * Configure pins for GPIO or other functions
62 */
63int pxa_gpio_mode(int gpio_mode)
64{
65 unsigned long flags;
66 int gpio = gpio_mode & GPIO_MD_MASK_NR;
67 int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
68 int gafr;
69
70 if (gpio > pxa_last_gpio)
71 return -EINVAL;
72
73 local_irq_save(flags);
74 if (gpio_mode & GPIO_DFLT_LOW)
75 GPCR(gpio) = GPIO_bit(gpio);
76 else if (gpio_mode & GPIO_DFLT_HIGH)
77 GPSR(gpio) = GPIO_bit(gpio);
78 if (gpio_mode & GPIO_MD_MASK_DIR)
79 GPDR(gpio) |= GPIO_bit(gpio);
80 else
81 GPDR(gpio) &= ~GPIO_bit(gpio);
82 gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
83 GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2));
84 local_irq_restore(flags);
85
86 return 0;
87}
88EXPORT_SYMBOL(pxa_gpio_mode);
89
90static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
91{
92 unsigned long flags;
93 u32 mask = 1 << offset;
94 u32 value;
95 struct pxa_gpio_chip *pxa;
96 void __iomem *gpdr;
97
98 pxa = container_of(chip, struct pxa_gpio_chip, chip);
99 gpdr = pxa->regbase + GPDR_OFFSET;
100 local_irq_save(flags);
101 value = __raw_readl(gpdr);
102 if (__gpio_is_inverted(chip->base + offset))
103 value |= mask;
104 else
105 value &= ~mask;
106 __raw_writel(value, gpdr);
107 local_irq_restore(flags);
108
109 return 0;
110}
111
112static int pxa_gpio_direction_output(struct gpio_chip *chip,
113 unsigned offset, int value)
114{
115 unsigned long flags;
116 u32 mask = 1 << offset;
117 u32 tmp;
118 struct pxa_gpio_chip *pxa;
119 void __iomem *gpdr;
120
121 pxa = container_of(chip, struct pxa_gpio_chip, chip);
122 __raw_writel(mask,
123 pxa->regbase + (value ? GPSR_OFFSET : GPCR_OFFSET));
124 gpdr = pxa->regbase + GPDR_OFFSET;
125 local_irq_save(flags);
126 tmp = __raw_readl(gpdr);
127 if (__gpio_is_inverted(chip->base + offset))
128 tmp &= ~mask;
129 else
130 tmp |= mask;
131 __raw_writel(tmp, gpdr);
132 local_irq_restore(flags);
133
134 return 0;
135}
136
137/*
138 * Return GPIO level
139 */
140static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset)
141{
142 u32 mask = 1 << offset;
143 struct pxa_gpio_chip *pxa;
144
145 pxa = container_of(chip, struct pxa_gpio_chip, chip);
146 return __raw_readl(pxa->regbase + GPLR_OFFSET) & mask;
147}
148
149/*
150 * Set output GPIO level
151 */
152static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
153{
154 u32 mask = 1 << offset;
155 struct pxa_gpio_chip *pxa;
156
157 pxa = container_of(chip, struct pxa_gpio_chip, chip);
158
159 if (value)
160 __raw_writel(mask, pxa->regbase + GPSR_OFFSET);
161 else
162 __raw_writel(mask, pxa->regbase + GPCR_OFFSET);
163}
164
165#define GPIO_CHIP(_n) \
166 [_n] = { \
167 .regbase = GPIO##_n##_BASE, \
168 .chip = { \
169 .label = "gpio-" #_n, \
170 .direction_input = pxa_gpio_direction_input, \
171 .direction_output = pxa_gpio_direction_output, \
172 .get = pxa_gpio_get, \
173 .set = pxa_gpio_set, \
174 .base = (_n) * 32, \
175 .ngpio = 32, \
176 }, \
177 }
178
179static struct pxa_gpio_chip pxa_gpio_chip[] = {
180 GPIO_CHIP(0),
181 GPIO_CHIP(1),
182 GPIO_CHIP(2),
183#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
184 GPIO_CHIP(3),
185#endif
186};
187
188/*
189 * PXA GPIO edge detection for IRQs:
190 * IRQs are generated on Falling-Edge, Rising-Edge, or both.
191 * Use this instead of directly setting GRER/GFER.
192 */
193
194static unsigned long GPIO_IRQ_rising_edge[4];
195static unsigned long GPIO_IRQ_falling_edge[4];
196static unsigned long GPIO_IRQ_mask[4];
197
198/*
199 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
200 * function of a GPIO, and GPDRx cannot be altered once configured. It
201 * is attributed as "occupied" here (I know this terminology isn't
202 * accurate, you are welcome to propose a better one :-)
203 */
204static int __gpio_is_occupied(unsigned gpio)
205{
206 if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
207 int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
208 int dir = GPDR(gpio) & GPIO_bit(gpio);
209
210 if (__gpio_is_inverted(gpio))
211 return af != 1 || dir == 0;
212 else
213 return af != 0 || dir != 0;
214 }
215
216 return 0;
217}
218
219static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
220{
221 int gpio, idx;
222
223 gpio = IRQ_TO_GPIO(irq);
224 idx = gpio >> 5;
225
226 if (type == IRQ_TYPE_PROBE) {
227 /* Don't mess with enabled GPIOs using preconfigured edges or
228 * GPIOs set to alternate function or to output during probe
229 */
230 if ((GPIO_IRQ_rising_edge[idx] & GPIO_bit(gpio)) ||
231 (GPIO_IRQ_falling_edge[idx] & GPIO_bit(gpio)))
232 return 0;
233
234 if (__gpio_is_occupied(gpio))
235 return 0;
236
237 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
238 }
239
240 if (__gpio_is_inverted(gpio))
241 GPDR(gpio) |= GPIO_bit(gpio);
242 else
243 GPDR(gpio) &= ~GPIO_bit(gpio);
244
245 if (type & IRQ_TYPE_EDGE_RISING)
246 __set_bit(gpio, GPIO_IRQ_rising_edge);
247 else
248 __clear_bit(gpio, GPIO_IRQ_rising_edge);
249
250 if (type & IRQ_TYPE_EDGE_FALLING)
251 __set_bit(gpio, GPIO_IRQ_falling_edge);
252 else
253 __clear_bit(gpio, GPIO_IRQ_falling_edge);
254
255 GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx];
256 GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx];
257
258 pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, irq, gpio,
259 ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""),
260 ((type & IRQ_TYPE_EDGE_FALLING) ? " falling" : ""));
261 return 0;
262}
263
264/*
265 * GPIO IRQs must be acknowledged. This is for GPIO 0 and 1.
266 */
267
268static void pxa_ack_low_gpio(unsigned int irq)
269{
270 GEDR0 = (1 << (irq - IRQ_GPIO0));
271}
272
273static void pxa_mask_low_gpio(unsigned int irq)
274{
275 ICMR &= ~(1 << (irq - PXA_IRQ(0)));
276}
277
278static void pxa_unmask_low_gpio(unsigned int irq)
279{
280 ICMR |= 1 << (irq - PXA_IRQ(0));
281}
282
283static struct irq_chip pxa_low_gpio_chip = {
284 .name = "GPIO-l",
285 .ack = pxa_ack_low_gpio,
286 .mask = pxa_mask_low_gpio,
287 .unmask = pxa_unmask_low_gpio,
288 .set_type = pxa_gpio_irq_type,
289};
290
291/*
292 * Demux handler for GPIO>=2 edge detect interrupts
293 */
294
295#define GEDR_BITS (sizeof(gedr) * BITS_PER_BYTE)
296
297static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
298{
299 int loop, bit, n;
300 unsigned long gedr[4];
301
302 do {
303 gedr[0] = GEDR0 & GPIO_IRQ_mask[0] & ~3;
304 gedr[1] = GEDR1 & GPIO_IRQ_mask[1];
305 gedr[2] = GEDR2 & GPIO_IRQ_mask[2];
306 gedr[3] = GEDR3 & GPIO_IRQ_mask[3];
307
308 GEDR0 = gedr[0]; GEDR1 = gedr[1];
309 GEDR2 = gedr[2]; GEDR3 = gedr[3];
310
311 loop = 0;
312 bit = find_first_bit(gedr, GEDR_BITS);
313 while (bit < GEDR_BITS) {
314 loop = 1;
315
316 n = PXA_GPIO_IRQ_BASE + bit;
317 generic_handle_irq(n);
318
319 bit = find_next_bit(gedr, GEDR_BITS, bit + 1);
320 }
321 } while (loop);
322}
323
324static void pxa_ack_muxed_gpio(unsigned int irq)
325{
326 int gpio = irq - IRQ_GPIO(2) + 2;
327 GEDR(gpio) = GPIO_bit(gpio);
328}
329
330static void pxa_mask_muxed_gpio(unsigned int irq)
331{
332 int gpio = irq - IRQ_GPIO(2) + 2;
333 __clear_bit(gpio, GPIO_IRQ_mask);
334 GRER(gpio) &= ~GPIO_bit(gpio);
335 GFER(gpio) &= ~GPIO_bit(gpio);
336}
337
338static void pxa_unmask_muxed_gpio(unsigned int irq)
339{
340 int gpio = irq - IRQ_GPIO(2) + 2;
341 int idx = gpio >> 5;
342 __set_bit(gpio, GPIO_IRQ_mask);
343 GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx];
344 GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx];
345}
346
347static struct irq_chip pxa_muxed_gpio_chip = {
348 .name = "GPIO",
349 .ack = pxa_ack_muxed_gpio,
350 .mask = pxa_mask_muxed_gpio,
351 .unmask = pxa_unmask_muxed_gpio,
352 .set_type = pxa_gpio_irq_type,
353};
354
355void __init pxa_init_gpio(int gpio_nr, set_wake_t fn)
356{
357 int irq, i, gpio;
358
359 pxa_last_gpio = gpio_nr - 1;
360
361 /* clear all GPIO edge detects */
362 for (i = 0; i < gpio_nr; i += 32) {
363 GFER(i) = 0;
364 GRER(i) = 0;
365 GEDR(i) = GEDR(i);
366 }
367
368 /* GPIO 0 and 1 must have their mask bit always set */
369 GPIO_IRQ_mask[0] = 3;
370
371 for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) {
372 set_irq_chip(irq, &pxa_low_gpio_chip);
373 set_irq_handler(irq, handle_edge_irq);
374 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
375 }
376
377 for (irq = IRQ_GPIO(2); irq < IRQ_GPIO(gpio_nr); irq++) {
378 set_irq_chip(irq, &pxa_muxed_gpio_chip);
379 set_irq_handler(irq, handle_edge_irq);
380 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
381 }
382
383 /* Install handler for GPIO>=2 edge detect interrupts */
384 set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler);
385
386 pxa_low_gpio_chip.set_wake = fn;
387 pxa_muxed_gpio_chip.set_wake = fn;
388
389 /* add a GPIO chip for each register bank.
390 * the last PXA25x register only contains 21 GPIOs
391 */
392 for (gpio = 0, i = 0; gpio < gpio_nr; gpio += 32, i++) {
393 if (gpio + 32 > gpio_nr)
394 pxa_gpio_chip[i].chip.ngpio = gpio_nr - gpio;
395 gpiochip_add(&pxa_gpio_chip[i].chip);
396 }
397}
398
399#ifdef CONFIG_PM
400
401static unsigned long saved_gplr[4];
402static unsigned long saved_gpdr[4];
403static unsigned long saved_grer[4];
404static unsigned long saved_gfer[4];
405
406static int pxa_gpio_suspend(struct sys_device *dev, pm_message_t state)
407{
408 int i, gpio;
409
410 for (gpio = 0, i = 0; gpio < pxa_last_gpio; gpio += 32, i++) {
411 saved_gplr[i] = GPLR(gpio);
412 saved_gpdr[i] = GPDR(gpio);
413 saved_grer[i] = GRER(gpio);
414 saved_gfer[i] = GFER(gpio);
415
416 /* Clear GPIO transition detect bits */
417 GEDR(gpio) = GEDR(gpio);
418 }
419 return 0;
420}
421
422static int pxa_gpio_resume(struct sys_device *dev)
423{
424 int i, gpio;
425
426 for (gpio = 0, i = 0; gpio < pxa_last_gpio; gpio += 32, i++) {
427 /* restore level with set/clear */
428 GPSR(gpio) = saved_gplr[i];
429 GPCR(gpio) = ~saved_gplr[i];
430
431 GRER(gpio) = saved_grer[i];
432 GFER(gpio) = saved_gfer[i];
433 GPDR(gpio) = saved_gpdr[i];
434 }
435 return 0;
436}
437#else
438#define pxa_gpio_suspend NULL
439#define pxa_gpio_resume NULL
440#endif
441
442struct sysdev_class pxa_gpio_sysclass = {
443 .name = "gpio",
444 .suspend = pxa_gpio_suspend,
445 .resume = pxa_gpio_resume,
446};
447
448static int __init pxa_gpio_init(void)
449{
450 return sysdev_class_register(&pxa_gpio_sysclass);
451}
452
453core_initcall(pxa_gpio_init);
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index e296ce11658c..ca9912ea78d9 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -38,14 +38,12 @@
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41
42#include <mach/pxa25x.h>
41#include <mach/mmc.h> 43#include <mach/mmc.h>
42#include <mach/udc.h> 44#include <mach/udc.h>
43#include <mach/gumstix.h> 45#include <mach/gumstix.h>
44 46
45#include <mach/pxa-regs.h>
46#include <mach/pxa2xx-regs.h>
47#include <mach/mfp-pxa25x.h>
48
49#include "generic.h" 47#include "generic.h"
50 48
51static struct resource flash_resource = { 49static struct resource flash_resource = {
@@ -191,6 +189,11 @@ int __attribute__((weak)) am200_init(void)
191 return 0; 189 return 0;
192} 190}
193 191
192int __attribute__((weak)) am300_init(void)
193{
194 return 0;
195}
196
194static void __init carrier_board_init(void) 197static void __init carrier_board_init(void)
195{ 198{
196 /* 199 /*
@@ -198,6 +201,7 @@ static void __init carrier_board_init(void)
198 * they cannot be detected programatically 201 * they cannot be detected programatically
199 */ 202 */
200 am200_init(); 203 am200_init();
204 am300_init();
201} 205}
202 206
203static void __init gumstix_init(void) 207static void __init gumstix_init(void)
diff --git a/arch/arm/mach-pxa/h5000.c b/arch/arm/mach-pxa/h5000.c
index 295ec413d804..f3d220c32e07 100644
--- a/arch/arm/mach-pxa/h5000.c
+++ b/arch/arm/mach-pxa/h5000.c
@@ -24,14 +24,15 @@
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/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27
27#include <asm/mach-types.h> 28#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
29#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31
32#include <mach/pxa25x.h>
30#include <mach/h5000.h> 33#include <mach/h5000.h>
31#include <mach/pxa-regs.h>
32#include <mach/pxa2xx-regs.h>
33#include <mach/mfp-pxa25x.h>
34#include <mach/udc.h> 34#include <mach/udc.h>
35
35#include "generic.h" 36#include "generic.h"
36 37
37/* 38/*
diff --git a/arch/arm/mach-pxa/himalaya.c b/arch/arm/mach-pxa/himalaya.c
new file mode 100644
index 000000000000..cea99fe65b97
--- /dev/null
+++ b/arch/arm/mach-pxa/himalaya.c
@@ -0,0 +1,166 @@
1/*
2 * linux/arch/arm/mach-pxa/himalaya.c
3 *
4 * Hardware definitions for the HTC Himalaya
5 *
6 * Based on 2.6.21-hh20's himalaya.c and himalaya_lcd.c
7 *
8 * Copyright (c) 2008 Zbynek Michl <Zbynek.Michl@seznam.cz>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/fb.h>
19#include <linux/platform_device.h>
20
21#include <video/w100fb.h>
22
23#include <asm/setup.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27#include <mach/mfp-pxa25x.h>
28#include <mach/hardware.h>
29
30#include "generic.h"
31
32/* ---------------------- Himalaya LCD definitions -------------------- */
33
34static struct w100_gen_regs himalaya_lcd_regs = {
35 .lcd_format = 0x00000003,
36 .lcdd_cntl1 = 0x00000000,
37 .lcdd_cntl2 = 0x0003ffff,
38 .genlcd_cntl1 = 0x00fff003,
39 .genlcd_cntl2 = 0x00000003,
40 .genlcd_cntl3 = 0x000102aa,
41};
42
43static struct w100_mode himalaya4_lcd_mode = {
44 .xres = 240,
45 .yres = 320,
46 .left_margin = 0,
47 .right_margin = 31,
48 .upper_margin = 15,
49 .lower_margin = 0,
50 .crtc_ss = 0x80150014,
51 .crtc_ls = 0xa0fb00f7,
52 .crtc_gs = 0xc0080007,
53 .crtc_vpos_gs = 0x00080007,
54 .crtc_rev = 0x0000000a,
55 .crtc_dclk = 0x81700030,
56 .crtc_gclk = 0x8015010f,
57 .crtc_goe = 0x00000000,
58 .pll_freq = 80,
59 .pixclk_divider = 15,
60 .pixclk_divider_rotated = 15,
61 .pixclk_src = CLK_SRC_PLL,
62 .sysclk_divider = 0,
63 .sysclk_src = CLK_SRC_PLL,
64};
65
66static struct w100_mode himalaya6_lcd_mode = {
67 .xres = 240,
68 .yres = 320,
69 .left_margin = 9,
70 .right_margin = 8,
71 .upper_margin = 5,
72 .lower_margin = 4,
73 .crtc_ss = 0x80150014,
74 .crtc_ls = 0xa0fb00f7,
75 .crtc_gs = 0xc0080007,
76 .crtc_vpos_gs = 0x00080007,
77 .crtc_rev = 0x0000000a,
78 .crtc_dclk = 0xa1700030,
79 .crtc_gclk = 0x8015010f,
80 .crtc_goe = 0x00000000,
81 .pll_freq = 95,
82 .pixclk_divider = 0xb,
83 .pixclk_divider_rotated = 4,
84 .pixclk_src = CLK_SRC_PLL,
85 .sysclk_divider = 1,
86 .sysclk_src = CLK_SRC_PLL,
87};
88
89static struct w100_gpio_regs himalaya_w100_gpio_info = {
90 .init_data1 = 0xffff0000, /* GPIO_DATA */
91 .gpio_dir1 = 0x00000000, /* GPIO_CNTL1 */
92 .gpio_oe1 = 0x003c0000, /* GPIO_CNTL2 */
93 .init_data2 = 0x00000000, /* GPIO_DATA2 */
94 .gpio_dir2 = 0x00000000, /* GPIO_CNTL3 */
95 .gpio_oe2 = 0x00000000, /* GPIO_CNTL4 */
96};
97
98static struct w100fb_mach_info himalaya_fb_info = {
99 .num_modes = 1,
100 .regs = &himalaya_lcd_regs,
101 .gpio = &himalaya_w100_gpio_info,
102 .xtal_freq = 16000000,
103};
104
105static struct resource himalaya_fb_resources[] = {
106 [0] = {
107 .start = 0x08000000,
108 .end = 0x08ffffff,
109 .flags = IORESOURCE_MEM,
110 },
111};
112
113static struct platform_device himalaya_fb_device = {
114 .name = "w100fb",
115 .id = -1,
116 .dev = {
117 .platform_data = &himalaya_fb_info,
118 },
119 .num_resources = ARRAY_SIZE(himalaya_fb_resources),
120 .resource = himalaya_fb_resources,
121};
122
123/* ----------------------------------------------------------------------- */
124
125static struct platform_device *devices[] __initdata = {
126 &himalaya_fb_device,
127};
128
129static void __init himalaya_lcd_init(void)
130{
131 int himalaya_boardid;
132
133 himalaya_boardid = 0x4; /* hardcoded (detection needs ASIC3 functions) */
134 printk(KERN_INFO "himalaya LCD Driver init. boardid=%d\n",
135 himalaya_boardid);
136
137 switch (himalaya_boardid) {
138 case 0x4:
139 himalaya_fb_info.modelist = &himalaya4_lcd_mode;
140 break;
141 case 0x6:
142 himalaya_fb_info.modelist = &himalaya6_lcd_mode;
143 break;
144 default:
145 printk(KERN_INFO "himalaya lcd_init: unknown boardid=%d. Using 0x4\n",
146 himalaya_boardid);
147 himalaya_fb_info.modelist = &himalaya4_lcd_mode;
148 }
149}
150
151static void __init himalaya_init(void)
152{
153 himalaya_lcd_init();
154 platform_add_devices(devices, ARRAY_SIZE(devices));
155}
156
157
158MACHINE_START(HIMALAYA, "HTC Himalaya")
159 .phys_io = 0x40000000,
160 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
161 .boot_params = 0xa0000100,
162 .map_io = pxa_map_io,
163 .init_irq = pxa25x_init_irq,
164 .init_machine = himalaya_init,
165 .timer = &pxa_timer,
166MACHINE_END
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
index 013b15baa034..b6243b59d9be 100644
--- a/arch/arm/mach-pxa/idp.c
+++ b/arch/arm/mach-pxa/idp.c
@@ -31,8 +31,7 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <mach/pxa-regs.h> 34#include <mach/pxa25x.h>
35#include <mach/mfp-pxa25x.h>
36#include <mach/idp.h> 35#include <mach/idp.h>
37#include <mach/pxafb.h> 36#include <mach/pxafb.h>
38#include <mach/bitfield.h> 37#include <mach/bitfield.h>
diff --git a/arch/arm/mach-pxa/imote2.c b/arch/arm/mach-pxa/imote2.c
index 364c5e271330..2121309b2474 100644
--- a/arch/arm/mach-pxa/imote2.c
+++ b/arch/arm/mach-pxa/imote2.c
@@ -28,11 +28,8 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30 30
31#include <mach/pxa27x.h>
31#include <mach/i2c.h> 32#include <mach/i2c.h>
32#include <mach/pxa-regs.h>
33#include <mach/pxa2xx-regs.h>
34#include <mach/mfp-pxa27x.h>
35#include <mach/regs-ssp.h>
36#include <mach/udc.h> 33#include <mach/udc.h>
37#include <mach/mmc.h> 34#include <mach/mmc.h>
38#include <mach/pxa2xx_spi.h> 35#include <mach/pxa2xx_spi.h>
diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h
index 2ae373fb5675..3f2a01d6a03c 100644
--- a/arch/arm/mach-pxa/include/mach/colibri.h
+++ b/arch/arm/mach-pxa/include/mach/colibri.h
@@ -1,19 +1,31 @@
1#ifndef _COLIBRI_H_ 1#ifndef _COLIBRI_H_
2#define _COLIBRI_H_ 2#define _COLIBRI_H_
3/*
4 * common settings for all modules
5 */
6
7#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
8extern void colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin);
9#else
10static inline void colibri_pxa3xx_init_mmc(mfp_cfg_t *, int, int) {}
11#endif
12
13#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
14extern void colibri_pxa3xx_init_lcd(int bl_pin);
15#else
16static inline void colibri_pxa3xx_init_lcd(int) {}
17#endif
3 18
4/* physical memory regions */ 19/* physical memory regions */
5#define COLIBRI_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */
6#define COLIBRI_ETH_PHYS (PXA_CS2_PHYS) /* Ethernet DM9000 region */
7#define COLIBRI_SDRAM_BASE 0xa0000000 /* SDRAM region */ 20#define COLIBRI_SDRAM_BASE 0xa0000000 /* SDRAM region */
8 21
9/* virtual memory regions */ 22/* definitions for Colibri PXA270 */
10#define COLIBRI_DISK_VIRT 0xF0000000 /* Disk On Chip region */
11 23
12/* size of flash */ 24#define COLIBRI_PXA270_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */
13#define COLIBRI_FLASH_SIZE 0x02000000 /* Flash size 32 MB */ 25#define COLIBRI_PXA270_ETH_PHYS (PXA_CS2_PHYS) /* Ethernet */
14 26#define COLIBRI_PXA270_ETH_IRQ_GPIO 114
15/* Ethernet Controller Davicom DM9000 */ 27#define COLIBRI_PXA270_ETH_IRQ \
16#define GPIO_DM9000 114 28 gpio_to_irq(mfp_to_gpio(COLIBRI_PXA270_ETH_IRQ_GPIO))
17#define COLIBRI_ETH_IRQ IRQ_GPIO(GPIO_DM9000)
18 29
19#endif /* _COLIBRI_H_ */ 30#endif /* _COLIBRI_H_ */
31
diff --git a/arch/arm/mach-pxa/include/mach/csb726.h b/arch/arm/mach-pxa/include/mach/csb726.h
new file mode 100644
index 000000000000..747ab1a71f2f
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/csb726.h
@@ -0,0 +1,26 @@
1/*
2 * Support for Cogent CSB726
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#ifndef CSB726_H
12#define CSB726_H
13
14#define CSB726_GPIO_IRQ_LAN 52
15#define CSB726_GPIO_IRQ_SM501 53
16#define CSB726_GPIO_MMC_DETECT 100
17#define CSB726_GPIO_MMC_RO 101
18
19#define CSB726_FLASH_SIZE (64 * 1024 * 1024)
20#define CSB726_FLASH_uMON (8 * 1024 * 1024)
21
22#define CSB726_IRQ_LAN gpio_to_irq(CSB726_GPIO_IRQ_LAN)
23#define CSB726_IRQ_SM501 gpio_to_irq(CSB726_GPIO_IRQ_SM501)
24
25#endif
26
diff --git a/arch/arm/mach-pxa/include/mach/dma.h b/arch/arm/mach-pxa/include/mach/dma.h
index 7804637a6df3..5bd55894a48d 100644
--- a/arch/arm/mach-pxa/include/mach/dma.h
+++ b/arch/arm/mach-pxa/include/mach/dma.h
@@ -12,35 +12,10 @@
12#ifndef __ASM_ARCH_DMA_H 12#ifndef __ASM_ARCH_DMA_H
13#define __ASM_ARCH_DMA_H 13#define __ASM_ARCH_DMA_H
14 14
15/* 15#include <mach/hardware.h>
16 * Descriptor structure for PXA's DMA engine
17 * Note: this structure must always be aligned to a 16-byte boundary.
18 */
19
20typedef struct pxa_dma_desc {
21 volatile u32 ddadr; /* Points to the next descriptor + flags */
22 volatile u32 dsadr; /* DSADR value for the current transfer */
23 volatile u32 dtadr; /* DTADR value for the current transfer */
24 volatile u32 dcmd; /* DCMD value for the current transfer */
25} pxa_dma_desc;
26
27typedef enum {
28 DMA_PRIO_HIGH = 0,
29 DMA_PRIO_MEDIUM = 1,
30 DMA_PRIO_LOW = 2
31} pxa_dma_prio;
32
33/*
34 * DMA registration
35 */
36
37int __init pxa_init_dma(int num_ch);
38
39int pxa_request_dma (char *name,
40 pxa_dma_prio prio,
41 void (*irq_handler)(int, void *),
42 void *data);
43 16
44void pxa_free_dma (int dma_ch); 17/* DMA Controller Registers Definitions */
18#define DMAC_REGS_VIRT io_p2v(0x40000000)
45 19
20#include <plat/dma.h>
46#endif /* _ASM_ARCH_DMA_H */ 21#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index 2c538d8c362d..b024a8b37439 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -24,42 +24,118 @@
24#ifndef __ASM_ARCH_PXA_GPIO_H 24#ifndef __ASM_ARCH_PXA_GPIO_H
25#define __ASM_ARCH_PXA_GPIO_H 25#define __ASM_ARCH_PXA_GPIO_H
26 26
27#include <mach/pxa-regs.h> 27#include <mach/irqs.h>
28#include <asm/irq.h>
29#include <mach/hardware.h> 28#include <mach/hardware.h>
30
31#include <asm-generic/gpio.h> 29#include <asm-generic/gpio.h>
32 30
31#define GPIO_REGS_VIRT io_p2v(0x40E00000)
32
33#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
34#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
35
36/* GPIO Pin Level Registers */
37#define GPLR0 GPIO_REG(BANK_OFF(0) + 0x00)
38#define GPLR1 GPIO_REG(BANK_OFF(1) + 0x00)
39#define GPLR2 GPIO_REG(BANK_OFF(2) + 0x00)
40#define GPLR3 GPIO_REG(BANK_OFF(3) + 0x00)
41
42/* GPIO Pin Direction Registers */
43#define GPDR0 GPIO_REG(BANK_OFF(0) + 0x0c)
44#define GPDR1 GPIO_REG(BANK_OFF(1) + 0x0c)
45#define GPDR2 GPIO_REG(BANK_OFF(2) + 0x0c)
46#define GPDR3 GPIO_REG(BANK_OFF(3) + 0x0c)
47
48/* GPIO Pin Output Set Registers */
49#define GPSR0 GPIO_REG(BANK_OFF(0) + 0x18)
50#define GPSR1 GPIO_REG(BANK_OFF(1) + 0x18)
51#define GPSR2 GPIO_REG(BANK_OFF(2) + 0x18)
52#define GPSR3 GPIO_REG(BANK_OFF(3) + 0x18)
53
54/* GPIO Pin Output Clear Registers */
55#define GPCR0 GPIO_REG(BANK_OFF(0) + 0x24)
56#define GPCR1 GPIO_REG(BANK_OFF(1) + 0x24)
57#define GPCR2 GPIO_REG(BANK_OFF(2) + 0x24)
58#define GPCR3 GPIO_REG(BANK_OFF(3) + 0x24)
59
60/* GPIO Rising Edge Detect Registers */
61#define GRER0 GPIO_REG(BANK_OFF(0) + 0x30)
62#define GRER1 GPIO_REG(BANK_OFF(1) + 0x30)
63#define GRER2 GPIO_REG(BANK_OFF(2) + 0x30)
64#define GRER3 GPIO_REG(BANK_OFF(3) + 0x30)
65
66/* GPIO Falling Edge Detect Registers */
67#define GFER0 GPIO_REG(BANK_OFF(0) + 0x3c)
68#define GFER1 GPIO_REG(BANK_OFF(1) + 0x3c)
69#define GFER2 GPIO_REG(BANK_OFF(2) + 0x3c)
70#define GFER3 GPIO_REG(BANK_OFF(3) + 0x3c)
71
72/* GPIO Edge Detect Status Registers */
73#define GEDR0 GPIO_REG(BANK_OFF(0) + 0x48)
74#define GEDR1 GPIO_REG(BANK_OFF(1) + 0x48)
75#define GEDR2 GPIO_REG(BANK_OFF(2) + 0x48)
76#define GEDR3 GPIO_REG(BANK_OFF(3) + 0x48)
77
78/* GPIO Alternate Function Select Registers */
79#define GAFR0_L GPIO_REG(0x0054)
80#define GAFR0_U GPIO_REG(0x0058)
81#define GAFR1_L GPIO_REG(0x005C)
82#define GAFR1_U GPIO_REG(0x0060)
83#define GAFR2_L GPIO_REG(0x0064)
84#define GAFR2_U GPIO_REG(0x0068)
85#define GAFR3_L GPIO_REG(0x006C)
86#define GAFR3_U GPIO_REG(0x0070)
87
88/* More handy macros. The argument is a literal GPIO number. */
89
90#define GPIO_bit(x) (1 << ((x) & 0x1f))
91
92#define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
93#define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
94#define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
95#define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
96#define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
97#define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
98#define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
99#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
100
33 101
34/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
35 * Those cases currently cause holes in the GPIO number space.
36 */
37#define NR_BUILTIN_GPIO 128 102#define NR_BUILTIN_GPIO 128
38 103
39static inline int gpio_get_value(unsigned gpio) 104#define gpio_to_bank(gpio) ((gpio) >> 5)
105#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
106#define irq_to_gpio(irq) IRQ_TO_GPIO(irq)
107
108#ifdef CONFIG_CPU_PXA26x
109/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
110 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
111 */
112static inline int __gpio_is_inverted(unsigned gpio)
40{ 113{
41 if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) 114 return cpu_is_pxa25x() && gpio > 85;
42 return GPLR(gpio) & GPIO_bit(gpio);
43 else
44 return __gpio_get_value(gpio);
45} 115}
116#else
117static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
118#endif
46 119
47static inline void gpio_set_value(unsigned gpio, int value) 120/*
121 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
122 * function of a GPIO, and GPDRx cannot be altered once configured. It
123 * is attributed as "occupied" here (I know this terminology isn't
124 * accurate, you are welcome to propose a better one :-)
125 */
126static inline int __gpio_is_occupied(unsigned gpio)
48{ 127{
49 if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) { 128 if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
50 if (value) 129 int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
51 GPSR(gpio) = GPIO_bit(gpio); 130 int dir = GPDR(gpio) & GPIO_bit(gpio);
131
132 if (__gpio_is_inverted(gpio))
133 return af != 1 || dir == 0;
52 else 134 else
53 GPCR(gpio) = GPIO_bit(gpio); 135 return af != 0 || dir != 0;
54 } else { 136 } else
55 __gpio_set_value(gpio, value); 137 return GPDR(gpio) & GPIO_bit(gpio);
56 }
57} 138}
58 139
59#define gpio_cansleep __gpio_cansleep 140#include <plat/gpio.h>
60
61#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
62#define irq_to_gpio(irq) IRQ_TO_GPIO(irq)
63
64
65#endif 141#endif
diff --git a/arch/arm/mach-pxa/include/mach/gumstix.h b/arch/arm/mach-pxa/include/mach/gumstix.h
index 099f54a41de4..06abd4160607 100644
--- a/arch/arm/mach-pxa/include/mach/gumstix.h
+++ b/arch/arm/mach-pxa/include/mach/gumstix.h
@@ -97,4 +97,5 @@ has detected a cable insertion; driven low otherwise. */
97 97
98/* for expansion boards that can't be programatically detected */ 98/* for expansion boards that can't be programatically detected */
99extern int am200_init(void); 99extern int am200_init(void);
100extern int am300_init(void);
100 101
diff --git a/arch/arm/mach-pxa/include/mach/lubbock.h b/arch/arm/mach-pxa/include/mach/lubbock.h
index 4cb24154a5a8..751b74811d0f 100644
--- a/arch/arm/mach-pxa/include/mach/lubbock.h
+++ b/arch/arm/mach-pxa/include/mach/lubbock.h
@@ -25,7 +25,6 @@
25 25
26/* FPGA register virtual addresses */ 26/* FPGA register virtual addresses */
27#define LUB_WHOAMI __LUB_REG(LUBBOCK_FPGA_PHYS + 0x000) 27#define LUB_WHOAMI __LUB_REG(LUBBOCK_FPGA_PHYS + 0x000)
28#define LUB_HEXLED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010)
29#define LUB_DISC_BLNK_LED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x040) 28#define LUB_DISC_BLNK_LED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x040)
30#define LUB_CONF_SWITCHES __LUB_REG(LUBBOCK_FPGA_PHYS + 0x050) 29#define LUB_CONF_SWITCHES __LUB_REG(LUBBOCK_FPGA_PHYS + 0x050)
31#define LUB_USER_SWITCHES __LUB_REG(LUBBOCK_FPGA_PHYS + 0x060) 30#define LUB_USER_SWITCHES __LUB_REG(LUBBOCK_FPGA_PHYS + 0x060)
diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index 38d68d99f585..82a399f3f9f2 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -69,7 +69,7 @@
69#define IRQ_MAGICIAN_SD (IRQ_BOARD_START + 0) 69#define IRQ_MAGICIAN_SD (IRQ_BOARD_START + 0)
70#define IRQ_MAGICIAN_EP (IRQ_BOARD_START + 1) 70#define IRQ_MAGICIAN_EP (IRQ_BOARD_START + 1)
71#define IRQ_MAGICIAN_BT (IRQ_BOARD_START + 2) 71#define IRQ_MAGICIAN_BT (IRQ_BOARD_START + 2)
72#define IRQ_MAGICIAN_AC (IRQ_BOARD_START + 3) 72#define IRQ_MAGICIAN_VBUS (IRQ_BOARD_START + 3)
73 73
74/* 74/*
75 * CPLD EGPIOs 75 * CPLD EGPIOs
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
index a72869b73ee3..b13dc0269a6d 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa25x.h
@@ -1,7 +1,6 @@
1#ifndef __ASM_ARCH_MFP_PXA25X_H 1#ifndef __ASM_ARCH_MFP_PXA25X_H
2#define __ASM_ARCH_MFP_PXA25X_H 2#define __ASM_ARCH_MFP_PXA25X_H
3 3
4#include <mach/mfp.h>
5#include <mach/mfp-pxa2xx.h> 4#include <mach/mfp-pxa2xx.h>
6 5
7/* GPIO */ 6/* GPIO */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
index da4f85a4f990..6543c05f47ed 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
@@ -8,7 +8,6 @@
8 * specific controller, and this should work in most cases. 8 * specific controller, and this should work in most cases.
9 */ 9 */
10 10
11#include <mach/mfp.h>
12#include <mach/mfp-pxa2xx.h> 11#include <mach/mfp-pxa2xx.h>
13 12
14/* Note: GPIO3/GPIO4 will be driven by Power I2C when PCFR/PI2C_EN 13/* Note: GPIO3/GPIO4 will be driven by Power I2C when PCFR/PI2C_EN
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
index 3e9211591e20..658b28ed129b 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
@@ -1,7 +1,7 @@
1#ifndef __ASM_ARCH_MFP_PXA2XX_H 1#ifndef __ASM_ARCH_MFP_PXA2XX_H
2#define __ASM_ARCH_MFP_PXA2XX_H 2#define __ASM_ARCH_MFP_PXA2XX_H
3 3
4#include <mach/mfp.h> 4#include <plat/mfp.h>
5 5
6/* 6/*
7 * the following MFP_xxx bit definitions in mfp.h are re-used for pxa2xx: 7 * the following MFP_xxx bit definitions in mfp.h are re-used for pxa2xx:
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa300.h b/arch/arm/mach-pxa/include/mach/mfp-pxa300.h
index bc1fb33a6e70..ae8441192ef0 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa300.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa300.h
@@ -15,7 +15,6 @@
15#ifndef __ASM_ARCH_MFP_PXA300_H 15#ifndef __ASM_ARCH_MFP_PXA300_H
16#define __ASM_ARCH_MFP_PXA300_H 16#define __ASM_ARCH_MFP_PXA300_H
17 17
18#include <mach/mfp.h>
19#include <mach/mfp-pxa3xx.h> 18#include <mach/mfp-pxa3xx.h>
20 19
21/* GPIO */ 20/* GPIO */
@@ -41,6 +40,7 @@
41#endif 40#endif
42 41
43/* Chip Select */ 42/* Chip Select */
43#define GPIO1_nCS2 MFP_CFG(GPIO1, AF1)
44#define GPIO2_nCS3 MFP_CFG(GPIO2, AF1) 44#define GPIO2_nCS3 MFP_CFG(GPIO2, AF1)
45 45
46/* AC97 */ 46/* AC97 */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa320.h b/arch/arm/mach-pxa/include/mach/mfp-pxa320.h
index 67f8385ea548..07897e61d05a 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa320.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa320.h
@@ -15,7 +15,6 @@
15#ifndef __ASM_ARCH_MFP_PXA320_H 15#ifndef __ASM_ARCH_MFP_PXA320_H
16#define __ASM_ARCH_MFP_PXA320_H 16#define __ASM_ARCH_MFP_PXA320_H
17 17
18#include <mach/mfp.h>
19#include <mach/mfp-pxa3xx.h> 18#include <mach/mfp-pxa3xx.h>
20 19
21/* GPIO */ 20/* GPIO */
@@ -38,6 +37,7 @@
38#define GPIO17_2_GPIO MFP_CFG(GPIO17_2, AF0) 37#define GPIO17_2_GPIO MFP_CFG(GPIO17_2, AF0)
39 38
40/* Chip Select */ 39/* Chip Select */
40#define GPIO3_nCS2 MFP_CFG(GPIO3, AF1)
41#define GPIO4_nCS3 MFP_CFG(GPIO4, AF1) 41#define GPIO4_nCS3 MFP_CFG(GPIO4, AF1)
42 42
43/* AC97 */ 43/* AC97 */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h b/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h
index 1f6b35c015d0..d375195d982b 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h
@@ -1,68 +1,9 @@
1#ifndef __ASM_ARCH_MFP_PXA3XX_H 1#ifndef __ASM_ARCH_MFP_PXA3XX_H
2#define __ASM_ARCH_MFP_PXA3XX_H 2#define __ASM_ARCH_MFP_PXA3XX_H
3 3
4#define MFPR_BASE (0x40e10000) 4#include <plat/mfp.h>
5#define MFPR_SIZE (PAGE_SIZE)
6
7/* MFPR register bit definitions */
8#define MFPR_PULL_SEL (0x1 << 15)
9#define MFPR_PULLUP_EN (0x1 << 14)
10#define MFPR_PULLDOWN_EN (0x1 << 13)
11#define MFPR_SLEEP_SEL (0x1 << 9)
12#define MFPR_SLEEP_OE_N (0x1 << 7)
13#define MFPR_EDGE_CLEAR (0x1 << 6)
14#define MFPR_EDGE_FALL_EN (0x1 << 5)
15#define MFPR_EDGE_RISE_EN (0x1 << 4)
16
17#define MFPR_SLEEP_DATA(x) ((x) << 8)
18#define MFPR_DRIVE(x) (((x) & 0x7) << 10)
19#define MFPR_AF_SEL(x) (((x) & 0x7) << 0)
20 5
21#define MFPR_EDGE_NONE (0) 6#define MFPR_BASE (0x40e10000)
22#define MFPR_EDGE_RISE (MFPR_EDGE_RISE_EN)
23#define MFPR_EDGE_FALL (MFPR_EDGE_FALL_EN)
24#define MFPR_EDGE_BOTH (MFPR_EDGE_RISE | MFPR_EDGE_FALL)
25
26/*
27 * Table that determines the low power modes outputs, with actual settings
28 * used in parentheses for don't-care values. Except for the float output,
29 * the configured driven and pulled levels match, so if there is a need for
30 * non-LPM pulled output, the same configuration could probably be used.
31 *
32 * Output value sleep_oe_n sleep_data pullup_en pulldown_en pull_sel
33 * (bit 7) (bit 8) (bit 14) (bit 13) (bit 15)
34 *
35 * Input 0 X(0) X(0) X(0) 0
36 * Drive 0 0 0 0 X(1) 0
37 * Drive 1 0 1 X(1) 0 0
38 * Pull hi (1) 1 X(1) 1 0 0
39 * Pull lo (0) 1 X(0) 0 1 0
40 * Z (float) 1 X(0) 0 0 0
41 */
42#define MFPR_LPM_INPUT (0)
43#define MFPR_LPM_DRIVE_LOW (MFPR_SLEEP_DATA(0) | MFPR_PULLDOWN_EN)
44#define MFPR_LPM_DRIVE_HIGH (MFPR_SLEEP_DATA(1) | MFPR_PULLUP_EN)
45#define MFPR_LPM_PULL_LOW (MFPR_LPM_DRIVE_LOW | MFPR_SLEEP_OE_N)
46#define MFPR_LPM_PULL_HIGH (MFPR_LPM_DRIVE_HIGH | MFPR_SLEEP_OE_N)
47#define MFPR_LPM_FLOAT (MFPR_SLEEP_OE_N)
48#define MFPR_LPM_MASK (0xe080)
49
50/*
51 * The pullup and pulldown state of the MFP pin at run mode is by default
52 * determined by the selected alternate function. In case that some buggy
53 * devices need to override this default behavior, the definitions below
54 * indicates the setting of corresponding MFPR bits
55 *
56 * Definition pull_sel pullup_en pulldown_en
57 * MFPR_PULL_NONE 0 0 0
58 * MFPR_PULL_LOW 1 0 1
59 * MFPR_PULL_HIGH 1 1 0
60 * MFPR_PULL_BOTH 1 1 1
61 */
62#define MFPR_PULL_NONE (0)
63#define MFPR_PULL_LOW (MFPR_PULL_SEL | MFPR_PULLDOWN_EN)
64#define MFPR_PULL_BOTH (MFPR_PULL_LOW | MFPR_PULLUP_EN)
65#define MFPR_PULL_HIGH (MFPR_PULL_SEL | MFPR_PULLUP_EN)
66 7
67/* PXA3xx common MFP configurations - processor specific ones defined 8/* PXA3xx common MFP configurations - processor specific ones defined
68 * in mfp-pxa300.h and mfp-pxa320.h 9 * in mfp-pxa300.h and mfp-pxa320.h
@@ -197,56 +138,21 @@
197#define GPIO5_2_GPIO MFP_CFG(GPIO5_2, AF0) 138#define GPIO5_2_GPIO MFP_CFG(GPIO5_2, AF0)
198#define GPIO6_2_GPIO MFP_CFG(GPIO6_2, AF0) 139#define GPIO6_2_GPIO MFP_CFG(GPIO6_2, AF0)
199 140
200/* 141/* NOTE: usage of these two functions is not recommended,
201 * each MFP pin will have a MFPR register, since the offset of the 142 * use pxa3xx_mfp_config() instead.
202 * register varies between processors, the processor specific code
203 * should initialize the pin offsets by pxa3xx_mfp_init_addr()
204 *
205 * pxa3xx_mfp_init_addr - accepts a table of "pxa3xx_mfp_addr_map"
206 * structure, which represents a range of MFP pins from "start" to
207 * "end", with the offset begining at "offset", to define a single
208 * pin, let "end" = -1
209 *
210 * use
211 *
212 * MFP_ADDR_X() to define a range of pins
213 * MFP_ADDR() to define a single pin
214 * MFP_ADDR_END to signal the end of pin offset definitions
215 */
216struct pxa3xx_mfp_addr_map {
217 unsigned int start;
218 unsigned int end;
219 unsigned long offset;
220};
221
222#define MFP_ADDR_X(start, end, offset) \
223 { MFP_PIN_##start, MFP_PIN_##end, offset }
224
225#define MFP_ADDR(pin, offset) \
226 { MFP_PIN_##pin, -1, offset }
227
228#define MFP_ADDR_END { MFP_PIN_INVALID, 0 }
229
230/*
231 * pxa3xx_mfp_read()/pxa3xx_mfp_write() - for direct read/write access
232 * to the MFPR register
233 */
234unsigned long pxa3xx_mfp_read(int mfp);
235void pxa3xx_mfp_write(int mfp, unsigned long mfpr_val);
236
237/*
238 * pxa3xx_mfp_config - configure the MFPR registers
239 *
240 * used by board specific initialization code
241 */
242void pxa3xx_mfp_config(unsigned long *mfp_cfgs, int num);
243
244/*
245 * pxa3xx_mfp_init_addr() - initialize the mapping between mfp pin
246 * index and MFPR register offset
247 *
248 * used by processor specific code
249 */ 143 */
250void __init pxa3xx_mfp_init_addr(struct pxa3xx_mfp_addr_map *); 144static inline unsigned long pxa3xx_mfp_read(int mfp)
251void __init pxa3xx_init_mfp(void); 145{
146 return mfp_read(mfp);
147}
148
149static inline void pxa3xx_mfp_write(int mfp, unsigned long val)
150{
151 mfp_write(mfp, val);
152}
153
154static inline void pxa3xx_mfp_config(unsigned long *mfp_cfg, int num)
155{
156 mfp_config(mfp_cfg, num);
157}
252#endif /* __ASM_ARCH_MFP_PXA3XX_H */ 158#endif /* __ASM_ARCH_MFP_PXA3XX_H */
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
index fa73f56a1372..0d119d3b9221 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa930.h
@@ -13,7 +13,6 @@
13#ifndef __ASM_ARCH_MFP_PXA9xx_H 13#ifndef __ASM_ARCH_MFP_PXA9xx_H
14#define __ASM_ARCH_MFP_PXA9xx_H 14#define __ASM_ARCH_MFP_PXA9xx_H
15 15
16#include <mach/mfp.h>
17#include <mach/mfp-pxa3xx.h> 16#include <mach/mfp-pxa3xx.h>
18 17
19/* GPIO */ 18/* GPIO */
diff --git a/arch/arm/mach-pxa/include/mach/mtd-xip.h b/arch/arm/mach-pxa/include/mach/mtd-xip.h
index cfca8155be72..297387ec3618 100644
--- a/arch/arm/mach-pxa/include/mach/mtd-xip.h
+++ b/arch/arm/mach-pxa/include/mach/mtd-xip.h
@@ -15,8 +15,8 @@
15#ifndef __ARCH_PXA_MTD_XIP_H__ 15#ifndef __ARCH_PXA_MTD_XIP_H__
16#define __ARCH_PXA_MTD_XIP_H__ 16#define __ARCH_PXA_MTD_XIP_H__
17 17
18#include <mach/hardware.h> 18#include <mach/regs-ost.h>
19#include <mach/pxa-regs.h> 19#include <mach/regs-intc.h>
20 20
21#define xip_irqpending() (ICIP & ICMR) 21#define xip_irqpending() (ICIP & ICMR)
22 22
diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h
new file mode 100644
index 000000000000..7c295a48d784
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/palmld.h
@@ -0,0 +1,109 @@
1/*
2 * GPIOs and interrupts for Palm LifeDrive Handheld Computer
3 *
4 * Authors: Alex Osborne <ato@meshy.org>
5 * Marek Vasut <marek.vasut@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#ifndef _INCLUDE_PALMLD_H_
14#define _INCLUDE_PALMLD_H_
15
16/** HERE ARE GPIOs **/
17
18/* GPIOs */
19#define GPIO_NR_PALMLD_GPIO_RESET 1
20#define GPIO_NR_PALMLD_POWER_DETECT 4
21#define GPIO_NR_PALMLD_HOTSYNC_BUTTON_N 10
22#define GPIO_NR_PALMLD_POWER_SWITCH 12
23#define GPIO_NR_PALMLD_EARPHONE_DETECT 13
24#define GPIO_NR_PALMLD_LOCK_SWITCH 15
25
26/* SD/MMC */
27#define GPIO_NR_PALMLD_SD_DETECT_N 14
28#define GPIO_NR_PALMLD_SD_POWER 114
29#define GPIO_NR_PALMLD_SD_READONLY 116
30
31/* TOUCHSCREEN */
32#define GPIO_NR_PALMLD_WM9712_IRQ 27
33
34/* IRDA */
35#define GPIO_NR_PALMLD_IR_DISABLE 108
36
37/* LCD/BACKLIGHT */
38#define GPIO_NR_PALMLD_BL_POWER 19
39#define GPIO_NR_PALMLD_LCD_POWER 96
40
41/* LCD BORDER */
42#define GPIO_NR_PALMLD_BORDER_SWITCH 21
43#define GPIO_NR_PALMLD_BORDER_SELECT 22
44
45/* BLUETOOTH */
46#define GPIO_NR_PALMLD_BT_POWER 17
47#define GPIO_NR_PALMLD_BT_RESET 83
48
49/* PCMCIA (WiFi) */
50#define GPIO_NR_PALMLD_PCMCIA_READY 38
51#define GPIO_NR_PALMLD_PCMCIA_POWER 36
52#define GPIO_NR_PALMLD_PCMCIA_RESET 81
53
54/* LEDs */
55#define GPIO_NR_PALMLD_LED_GREEN 52
56#define GPIO_NR_PALMLD_LED_AMBER 94
57
58/* IDE */
59#define GPIO_NR_PALMLD_IDE_IRQ 95
60#define GPIO_NR_PALMLD_IDE_RESET 98
61#define GPIO_NR_PALMLD_IDE_PWEN 115
62
63/* USB */
64#define GPIO_NR_PALMLD_USB_DETECT_N 3
65#define GPIO_NR_PALMLD_USB_READY 86
66#define GPIO_NR_PALMLD_USB_RESET 88
67#define GPIO_NR_PALMLD_USB_INT 106
68#define GPIO_NR_PALMLD_USB_POWER 118
69/* 20, 53 and 86 are usb related too */
70
71/* INTERRUPTS */
72#define IRQ_GPIO_PALMLD_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMLD_GPIO_RESET)
73#define IRQ_GPIO_PALMLD_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMLD_SD_DETECT_N)
74#define IRQ_GPIO_PALMLD_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMLD_WM9712_IRQ)
75#define IRQ_GPIO_PALMLD_IDE_IRQ IRQ_GPIO(GPIO_NR_PALMLD_IDE_IRQ)
76
77
78/** HERE ARE INIT VALUES **/
79
80/* IO mappings */
81#define PALMLD_USB_PHYS PXA_CS2_PHYS
82#define PALMLD_USB_VIRT 0xf0000000
83#define PALMLD_USB_SIZE 0x00100000
84
85#define PALMLD_IDE_PHYS 0x20000000
86#define PALMLD_IDE_VIRT 0xf1000000
87#define PALMLD_IDE_SIZE 0x00100000
88
89#define PALMLD_PHYS_IO_START 0x40000000
90
91/* BATTERY */
92#define PALMLD_BAT_MAX_VOLTAGE 4000 /* 4.00V maximum voltage */
93#define PALMLD_BAT_MIN_VOLTAGE 3550 /* 3.55V critical voltage */
94#define PALMLD_BAT_MAX_CURRENT 0 /* unknokn */
95#define PALMLD_BAT_MIN_CURRENT 0 /* unknown */
96#define PALMLD_BAT_MAX_CHARGE 1 /* unknown */
97#define PALMLD_BAT_MIN_CHARGE 1 /* unknown */
98#define PALMLD_MAX_LIFE_MINS 240 /* on-life in minutes */
99
100#define PALMLD_BAT_MEASURE_DELAY (HZ * 1)
101
102/* BACKLIGHT */
103#define PALMLD_MAX_INTENSITY 0xFE
104#define PALMLD_DEFAULT_INTENSITY 0x7E
105#define PALMLD_LIMIT_MASK 0x7F
106#define PALMLD_PRESCALER 0x3F
107#define PALMLD_PERIOD_NS 3500
108
109#endif
diff --git a/arch/arm/mach-pxa/include/mach/palmt5.h b/arch/arm/mach-pxa/include/mach/palmt5.h
new file mode 100644
index 000000000000..94db2881f048
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/palmt5.h
@@ -0,0 +1,84 @@
1/*
2 * GPIOs and interrupts for Palm Tungsten|T5 Handheld Computer
3 *
4 * Authors: Ales Snuparek <snuparek@atlas.cz>
5 * Marek Vasut <marek.vasut@gmail.com>
6 * Justin Kendrick <twilightsentry@gmail.com>
7 * RichardT5 <richard_t5@users.sourceforge.net>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#ifndef _INCLUDE_PALMT5_H_
16#define _INCLUDE_PALMT5_H_
17
18/** HERE ARE GPIOs **/
19
20/* GPIOs */
21#define GPIO_NR_PALMT5_GPIO_RESET 1
22
23#define GPIO_NR_PALMT5_POWER_DETECT 90
24#define GPIO_NR_PALMT5_HOTSYNC_BUTTON_N 10
25#define GPIO_NR_PALMT5_EARPHONE_DETECT 107
26
27/* SD/MMC */
28#define GPIO_NR_PALMT5_SD_DETECT_N 14
29#define GPIO_NR_PALMT5_SD_POWER 114
30#define GPIO_NR_PALMT5_SD_READONLY 115
31
32/* TOUCHSCREEN */
33#define GPIO_NR_PALMT5_WM9712_IRQ 27
34
35/* IRDA - disable GPIO connected to SD pin of tranceiver (TFBS4710?) ? */
36#define GPIO_NR_PALMT5_IR_DISABLE 40
37
38/* USB */
39#define GPIO_NR_PALMT5_USB_DETECT_N 15
40#define GPIO_NR_PALMT5_USB_POWER 95
41#define GPIO_NR_PALMT5_USB_PULLUP 93
42
43/* LCD/BACKLIGHT */
44#define GPIO_NR_PALMT5_BL_POWER 84
45#define GPIO_NR_PALMT5_LCD_POWER 96
46
47/* BLUETOOTH */
48#define GPIO_NR_PALMT5_BT_POWER 17
49#define GPIO_NR_PALMT5_BT_RESET 83
50
51/* INTERRUPTS */
52#define IRQ_GPIO_PALMT5_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMT5_SD_DETECT_N)
53#define IRQ_GPIO_PALMT5_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMT5_WM9712_IRQ)
54#define IRQ_GPIO_PALMT5_USB_DETECT IRQ_GPIO(GPIO_NR_PALMT5_USB_DETECT)
55#define IRQ_GPIO_PALMT5_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMT5_GPIO_RESET)
56
57/** HERE ARE INIT VALUES **/
58
59/* Various addresses */
60#define PALMT5_PHYS_RAM_START 0xa0000000
61#define PALMT5_PHYS_IO_START 0x40000000
62
63/* TOUCHSCREEN */
64#define AC97_LINK_FRAME 21
65
66/* BATTERY */
67#define PALMT5_BAT_MAX_VOLTAGE 4000 /* 4.00v current voltage */
68#define PALMT5_BAT_MIN_VOLTAGE 3550 /* 3.55v critical voltage */
69#define PALMT5_BAT_MAX_CURRENT 0 /* unknokn */
70#define PALMT5_BAT_MIN_CURRENT 0 /* unknown */
71#define PALMT5_BAT_MAX_CHARGE 1 /* unknown */
72#define PALMT5_BAT_MIN_CHARGE 1 /* unknown */
73#define PALMT5_MAX_LIFE_MINS 360 /* on-life in minutes */
74
75#define PALMT5_BAT_MEASURE_DELAY (HZ * 1)
76
77/* BACKLIGHT */
78#define PALMT5_MAX_INTENSITY 0xFE
79#define PALMT5_DEFAULT_INTENSITY 0x7E
80#define PALMT5_LIMIT_MASK 0x7F
81#define PALMT5_PRESCALER 0x3F
82#define PALMT5_PERIOD_NS 3500
83
84#endif
diff --git a/arch/arm/mach-pxa/include/mach/pm.h b/arch/arm/mach-pxa/include/mach/pm.h
index 83342469acac..a6eeef8a075f 100644
--- a/arch/arm/mach-pxa/include/mach/pm.h
+++ b/arch/arm/mach-pxa/include/mach/pm.h
@@ -27,3 +27,13 @@ extern void pxa27x_cpu_suspend(unsigned int);
27extern void pxa_cpu_resume(void); 27extern void pxa_cpu_resume(void);
28 28
29extern int pxa_pm_enter(suspend_state_t state); 29extern int pxa_pm_enter(suspend_state_t state);
30
31/* NOTE: this is for PM debugging on Lubbock, it's really a big
32 * ugly, but let's keep the crap minimum here, instead of direct
33 * accessing the LUBBOCK CPLD registers in arch/arm/mach-pxa/pm.c
34 */
35#ifdef CONFIG_ARCH_LUBBOCK
36extern void lubbock_set_hexled(uint32_t value);
37#else
38#define lubbock_set_hexled(x)
39#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa-regs.h b/arch/arm/mach-pxa/include/mach/pxa-regs.h
deleted file mode 100644
index 31d615aa7723..000000000000
--- a/arch/arm/mach-pxa/include/mach/pxa-regs.h
+++ /dev/null
@@ -1,263 +0,0 @@
1/*
2 * arch/arm/mach-pxa/include/mach/pxa-regs.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
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#ifndef __PXA_REGS_H
14#define __PXA_REGS_H
15
16#include <mach/hardware.h>
17
18/*
19 * PXA Chip selects
20 */
21
22#define PXA_CS0_PHYS 0x00000000
23#define PXA_CS1_PHYS 0x04000000
24#define PXA_CS2_PHYS 0x08000000
25#define PXA_CS3_PHYS 0x0C000000
26#define PXA_CS4_PHYS 0x10000000
27#define PXA_CS5_PHYS 0x14000000
28
29
30/*
31 * Personal Computer Memory Card International Association (PCMCIA) sockets
32 */
33
34#define PCMCIAPrtSp 0x04000000 /* PCMCIA Partition Space [byte] */
35#define PCMCIASp (4*PCMCIAPrtSp) /* PCMCIA Space [byte] */
36#define PCMCIAIOSp PCMCIAPrtSp /* PCMCIA I/O Space [byte] */
37#define PCMCIAAttrSp PCMCIAPrtSp /* PCMCIA Attribute Space [byte] */
38#define PCMCIAMemSp PCMCIAPrtSp /* PCMCIA Memory Space [byte] */
39
40#define PCMCIA0Sp PCMCIASp /* PCMCIA 0 Space [byte] */
41#define PCMCIA0IOSp PCMCIAIOSp /* PCMCIA 0 I/O Space [byte] */
42#define PCMCIA0AttrSp PCMCIAAttrSp /* PCMCIA 0 Attribute Space [byte] */
43#define PCMCIA0MemSp PCMCIAMemSp /* PCMCIA 0 Memory Space [byte] */
44
45#define PCMCIA1Sp PCMCIASp /* PCMCIA 1 Space [byte] */
46#define PCMCIA1IOSp PCMCIAIOSp /* PCMCIA 1 I/O Space [byte] */
47#define PCMCIA1AttrSp PCMCIAAttrSp /* PCMCIA 1 Attribute Space [byte] */
48#define PCMCIA1MemSp PCMCIAMemSp /* PCMCIA 1 Memory Space [byte] */
49
50#define _PCMCIA(Nb) /* PCMCIA [0..1] */ \
51 (0x20000000 + (Nb)*PCMCIASp)
52#define _PCMCIAIO(Nb) _PCMCIA (Nb) /* PCMCIA I/O [0..1] */
53#define _PCMCIAAttr(Nb) /* PCMCIA Attribute [0..1] */ \
54 (_PCMCIA (Nb) + 2*PCMCIAPrtSp)
55#define _PCMCIAMem(Nb) /* PCMCIA Memory [0..1] */ \
56 (_PCMCIA (Nb) + 3*PCMCIAPrtSp)
57
58#define _PCMCIA0 _PCMCIA (0) /* PCMCIA 0 */
59#define _PCMCIA0IO _PCMCIAIO (0) /* PCMCIA 0 I/O */
60#define _PCMCIA0Attr _PCMCIAAttr (0) /* PCMCIA 0 Attribute */
61#define _PCMCIA0Mem _PCMCIAMem (0) /* PCMCIA 0 Memory */
62
63#define _PCMCIA1 _PCMCIA (1) /* PCMCIA 1 */
64#define _PCMCIA1IO _PCMCIAIO (1) /* PCMCIA 1 I/O */
65#define _PCMCIA1Attr _PCMCIAAttr (1) /* PCMCIA 1 Attribute */
66#define _PCMCIA1Mem _PCMCIAMem (1) /* PCMCIA 1 Memory */
67
68
69
70/*
71 * DMA Controller
72 */
73#define DCSR(x) __REG2(0x40000000, (x) << 2)
74
75#define DCSR_RUN (1 << 31) /* Run Bit (read / write) */
76#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch (read / write) */
77#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable (read / write) */
78#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */
79#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */
80#define DCSR_ENDINTR (1 << 2) /* End Interrupt (read / write) */
81#define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */
82#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */
83
84#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
85#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable (R/W) */
86#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */
87#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */
88#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */
89#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */
90#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */
91#define DCSR_EORINTR (1 << 9) /* The end of Receive */
92#endif
93
94#define DALGN __REG(0x400000a0) /* DMA Alignment Register */
95#define DINT __REG(0x400000f0) /* DMA Interrupt Register */
96
97#define DRCMR(n) (*(((n) < 64) ? \
98 &__REG2(0x40000100, ((n) & 0x3f) << 2) : \
99 &__REG2(0x40001100, ((n) & 0x3f) << 2)))
100
101#define DRCMR_MAPVLD (1 << 7) /* Map Valid (read / write) */
102#define DRCMR_CHLNUM 0x1f /* mask for Channel Number (read / write) */
103
104#define DDADR(x) __REG2(0x40000200, (x) << 4)
105#define DSADR(x) __REG2(0x40000204, (x) << 4)
106#define DTADR(x) __REG2(0x40000208, (x) << 4)
107#define DCMD(x) __REG2(0x4000020c, (x) << 4)
108
109#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor (mask) */
110#define DDADR_STOP (1 << 0) /* Stop (read / write) */
111
112#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */
113#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */
114#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */
115#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */
116#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */
117#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */
118#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */
119#define DCMD_BURST8 (1 << 16) /* 8 byte burst */
120#define DCMD_BURST16 (2 << 16) /* 16 byte burst */
121#define DCMD_BURST32 (3 << 16) /* 32 byte burst */
122#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */
123#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */
124#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */
125#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
126
127/*
128 * Real Time Clock
129 */
130
131#define RCNR __REG(0x40900000) /* RTC Count Register */
132#define RTAR __REG(0x40900004) /* RTC Alarm Register */
133#define RTSR __REG(0x40900008) /* RTC Status Register */
134#define RTTR __REG(0x4090000C) /* RTC Timer Trim Register */
135#define PIAR __REG(0x40900038) /* Periodic Interrupt Alarm Register */
136
137#define RTSR_PICE (1 << 15) /* Periodic interrupt count enable */
138#define RTSR_PIALE (1 << 14) /* Periodic interrupt Alarm enable */
139#define RTSR_HZE (1 << 3) /* HZ interrupt enable */
140#define RTSR_ALE (1 << 2) /* RTC alarm interrupt enable */
141#define RTSR_HZ (1 << 1) /* HZ rising-edge detected */
142#define RTSR_AL (1 << 0) /* RTC alarm detected */
143
144
145/*
146 * OS Timer & Match Registers
147 */
148
149#define OSMR0 __REG(0x40A00000) /* */
150#define OSMR1 __REG(0x40A00004) /* */
151#define OSMR2 __REG(0x40A00008) /* */
152#define OSMR3 __REG(0x40A0000C) /* */
153#define OSMR4 __REG(0x40A00080) /* */
154#define OSCR __REG(0x40A00010) /* OS Timer Counter Register */
155#define OSCR4 __REG(0x40A00040) /* OS Timer Counter Register */
156#define OMCR4 __REG(0x40A000C0) /* */
157#define OSSR __REG(0x40A00014) /* OS Timer Status Register */
158#define OWER __REG(0x40A00018) /* OS Timer Watchdog Enable Register */
159#define OIER __REG(0x40A0001C) /* OS Timer Interrupt Enable Register */
160
161#define OSSR_M3 (1 << 3) /* Match status channel 3 */
162#define OSSR_M2 (1 << 2) /* Match status channel 2 */
163#define OSSR_M1 (1 << 1) /* Match status channel 1 */
164#define OSSR_M0 (1 << 0) /* Match status channel 0 */
165
166#define OWER_WME (1 << 0) /* Watchdog Match Enable */
167
168#define OIER_E3 (1 << 3) /* Interrupt enable channel 3 */
169#define OIER_E2 (1 << 2) /* Interrupt enable channel 2 */
170#define OIER_E1 (1 << 1) /* Interrupt enable channel 1 */
171#define OIER_E0 (1 << 0) /* Interrupt enable channel 0 */
172
173
174/*
175 * Interrupt Controller
176 */
177
178#define ICIP __REG(0x40D00000) /* Interrupt Controller IRQ Pending Register */
179#define ICMR __REG(0x40D00004) /* Interrupt Controller Mask Register */
180#define ICLR __REG(0x40D00008) /* Interrupt Controller Level Register */
181#define ICFP __REG(0x40D0000C) /* Interrupt Controller FIQ Pending Register */
182#define ICPR __REG(0x40D00010) /* Interrupt Controller Pending Register */
183#define ICCR __REG(0x40D00014) /* Interrupt Controller Control Register */
184
185#define ICIP2 __REG(0x40D0009C) /* Interrupt Controller IRQ Pending Register 2 */
186#define ICMR2 __REG(0x40D000A0) /* Interrupt Controller Mask Register 2 */
187#define ICLR2 __REG(0x40D000A4) /* Interrupt Controller Level Register 2 */
188#define ICFP2 __REG(0x40D000A8) /* Interrupt Controller FIQ Pending Register 2 */
189#define ICPR2 __REG(0x40D000AC) /* Interrupt Controller Pending Register 2 */
190
191/*
192 * General Purpose I/O
193 */
194
195#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */
196#define GPLR1 __REG(0x40E00004) /* GPIO Pin-Level Register GPIO<63:32> */
197#define GPLR2 __REG(0x40E00008) /* GPIO Pin-Level Register GPIO<80:64> */
198
199#define GPDR0 __REG(0x40E0000C) /* GPIO Pin Direction Register GPIO<31:0> */
200#define GPDR1 __REG(0x40E00010) /* GPIO Pin Direction Register GPIO<63:32> */
201#define GPDR2 __REG(0x40E00014) /* GPIO Pin Direction Register GPIO<80:64> */
202
203#define GPSR0 __REG(0x40E00018) /* GPIO Pin Output Set Register GPIO<31:0> */
204#define GPSR1 __REG(0x40E0001C) /* GPIO Pin Output Set Register GPIO<63:32> */
205#define GPSR2 __REG(0x40E00020) /* GPIO Pin Output Set Register GPIO<80:64> */
206
207#define GPCR0 __REG(0x40E00024) /* GPIO Pin Output Clear Register GPIO<31:0> */
208#define GPCR1 __REG(0x40E00028) /* GPIO Pin Output Clear Register GPIO <63:32> */
209#define GPCR2 __REG(0x40E0002C) /* GPIO Pin Output Clear Register GPIO <80:64> */
210
211#define GRER0 __REG(0x40E00030) /* GPIO Rising-Edge Detect Register GPIO<31:0> */
212#define GRER1 __REG(0x40E00034) /* GPIO Rising-Edge Detect Register GPIO<63:32> */
213#define GRER2 __REG(0x40E00038) /* GPIO Rising-Edge Detect Register GPIO<80:64> */
214
215#define GFER0 __REG(0x40E0003C) /* GPIO Falling-Edge Detect Register GPIO<31:0> */
216#define GFER1 __REG(0x40E00040) /* GPIO Falling-Edge Detect Register GPIO<63:32> */
217#define GFER2 __REG(0x40E00044) /* GPIO Falling-Edge Detect Register GPIO<80:64> */
218
219#define GEDR0 __REG(0x40E00048) /* GPIO Edge Detect Status Register GPIO<31:0> */
220#define GEDR1 __REG(0x40E0004C) /* GPIO Edge Detect Status Register GPIO<63:32> */
221#define GEDR2 __REG(0x40E00050) /* GPIO Edge Detect Status Register GPIO<80:64> */
222
223#define GAFR0_L __REG(0x40E00054) /* GPIO Alternate Function Select Register GPIO<15:0> */
224#define GAFR0_U __REG(0x40E00058) /* GPIO Alternate Function Select Register GPIO<31:16> */
225#define GAFR1_L __REG(0x40E0005C) /* GPIO Alternate Function Select Register GPIO<47:32> */
226#define GAFR1_U __REG(0x40E00060) /* GPIO Alternate Function Select Register GPIO<63:48> */
227#define GAFR2_L __REG(0x40E00064) /* GPIO Alternate Function Select Register GPIO<79:64> */
228#define GAFR2_U __REG(0x40E00068) /* GPIO Alternate Function Select Register GPIO<95-80> */
229#define GAFR3_L __REG(0x40E0006C) /* GPIO Alternate Function Select Register GPIO<111:96> */
230#define GAFR3_U __REG(0x40E00070) /* GPIO Alternate Function Select Register GPIO<127:112> */
231
232#define GPLR3 __REG(0x40E00100) /* GPIO Pin-Level Register GPIO<127:96> */
233#define GPDR3 __REG(0x40E0010C) /* GPIO Pin Direction Register GPIO<127:96> */
234#define GPSR3 __REG(0x40E00118) /* GPIO Pin Output Set Register GPIO<127:96> */
235#define GPCR3 __REG(0x40E00124) /* GPIO Pin Output Clear Register GPIO<127:96> */
236#define GRER3 __REG(0x40E00130) /* GPIO Rising-Edge Detect Register GPIO<127:96> */
237#define GFER3 __REG(0x40E0013C) /* GPIO Falling-Edge Detect Register GPIO<127:96> */
238#define GEDR3 __REG(0x40E00148) /* GPIO Edge Detect Status Register GPIO<127:96> */
239
240/* More handy macros. The argument is a literal GPIO number. */
241
242#define GPIO_bit(x) (1 << ((x) & 0x1f))
243
244#define _GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3)
245#define _GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3)
246#define _GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3)
247#define _GPCR(x) __REG2(0x40E00024, ((x) & 0x60) >> 3)
248#define _GRER(x) __REG2(0x40E00030, ((x) & 0x60) >> 3)
249#define _GFER(x) __REG2(0x40E0003C, ((x) & 0x60) >> 3)
250#define _GEDR(x) __REG2(0x40E00048, ((x) & 0x60) >> 3)
251#define _GAFR(x) __REG2(0x40E00054, ((x) & 0x70) >> 2)
252
253#define GPLR(x) (*((((x) & 0x7f) < 96) ? &_GPLR(x) : &GPLR3))
254#define GPDR(x) (*((((x) & 0x7f) < 96) ? &_GPDR(x) : &GPDR3))
255#define GPSR(x) (*((((x) & 0x7f) < 96) ? &_GPSR(x) : &GPSR3))
256#define GPCR(x) (*((((x) & 0x7f) < 96) ? &_GPCR(x) : &GPCR3))
257#define GRER(x) (*((((x) & 0x7f) < 96) ? &_GRER(x) : &GRER3))
258#define GFER(x) (*((((x) & 0x7f) < 96) ? &_GFER(x) : &GFER3))
259#define GEDR(x) (*((((x) & 0x7f) < 96) ? &_GEDR(x) : &GEDR3))
260#define GAFR(x) (*((((x) & 0x7f) < 96) ? &_GAFR(x) : \
261 ((((x) & 0x7f) < 112) ? &GAFR3_L : &GAFR3_U)))
262
263#endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa25x.h b/arch/arm/mach-pxa/include/mach/pxa25x.h
new file mode 100644
index 000000000000..508c3ba1f4d0
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa25x.h
@@ -0,0 +1,8 @@
1#ifndef __MACH_PXA25x_H
2#define __MACH_PXA25x_H
3
4#include <mach/hardware.h>
5#include <mach/pxa2xx-regs.h>
6#include <mach/mfp-pxa25x.h>
7
8#endif /* __MACH_PXA25x_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h
new file mode 100644
index 000000000000..6876e16c2970
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa27x.h
@@ -0,0 +1,19 @@
1#ifndef __MACH_PXA27x_H
2#define __MACH_PXA27x_H
3
4#include <mach/hardware.h>
5#include <mach/pxa2xx-regs.h>
6#include <mach/mfp-pxa27x.h>
7
8#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */
9
10#define ARB_DMA_SLV_PARK (1<<31) /* Be parked with DMA slave when idle */
11#define ARB_CI_PARK (1<<30) /* Be parked with Camera Interface when idle */
12#define ARB_EX_MEM_PARK (1<<29) /* Be parked with external MEMC when idle */
13#define ARB_INT_MEM_PARK (1<<28) /* Be parked with internal MEMC when idle */
14#define ARB_USB_PARK (1<<27) /* Be parked with USB when idle */
15#define ARB_LCD_PARK (1<<26) /* Be parked with LCD when idle */
16#define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */
17#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
18#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
19#endif /* __MACH_PXA27x_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h b/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h
index d83393e25273..1209c44aa6f1 100644
--- a/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h
+++ b/arch/arm/mach-pxa/include/mach/pxa2xx-gpio.h
@@ -3,6 +3,8 @@
3 3
4#warning Please use mfp-pxa2[57]x.h instead of pxa2xx-gpio.h 4#warning Please use mfp-pxa2[57]x.h instead of pxa2xx-gpio.h
5 5
6#include <mach/gpio.h>
7
6/* GPIO alternate function assignments */ 8/* GPIO alternate function assignments */
7 9
8#define GPIO1_RST 1 /* reset */ 10#define GPIO1_RST 1 /* reset */
diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
index 77102d695cc7..4fcddd9cab76 100644
--- a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
+++ b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
@@ -14,6 +14,19 @@
14#ifndef __PXA2XX_REGS_H 14#ifndef __PXA2XX_REGS_H
15#define __PXA2XX_REGS_H 15#define __PXA2XX_REGS_H
16 16
17#include <mach/hardware.h>
18
19/*
20 * PXA Chip selects
21 */
22
23#define PXA_CS0_PHYS 0x00000000
24#define PXA_CS1_PHYS 0x04000000
25#define PXA_CS2_PHYS 0x08000000
26#define PXA_CS3_PHYS 0x0C000000
27#define PXA_CS4_PHYS 0x10000000
28#define PXA_CS5_PHYS 0x14000000
29
17/* 30/*
18 * Memory controller 31 * Memory controller
19 */ 32 */
@@ -69,24 +82,6 @@
69#define MDREFR_K0RUN (1 << 13) /* SDCLK0 Run Control/Status */ 82#define MDREFR_K0RUN (1 << 13) /* SDCLK0 Run Control/Status */
70#define MDREFR_E0PIN (1 << 12) /* SDCKE0 Level Control/Status */ 83#define MDREFR_E0PIN (1 << 12) /* SDCKE0 Level Control/Status */
71 84
72
73#ifdef CONFIG_PXA27x
74
75#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */
76
77#define ARB_DMA_SLV_PARK (1<<31) /* Be parked with DMA slave when idle */
78#define ARB_CI_PARK (1<<30) /* Be parked with Camera Interface when idle */
79#define ARB_EX_MEM_PARK (1<<29) /* Be parked with external MEMC when idle */
80#define ARB_INT_MEM_PARK (1<<28) /* Be parked with internal MEMC when idle */
81#define ARB_USB_PARK (1<<27) /* Be parked with USB when idle */
82#define ARB_LCD_PARK (1<<26) /* Be parked with LCD when idle */
83#define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */
84#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
85#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
86
87#endif
88
89
90/* 85/*
91 * Power Manager 86 * Power Manager
92 */ 87 */
diff --git a/arch/arm/mach-pxa/include/mach/pxa300.h b/arch/arm/mach-pxa/include/mach/pxa300.h
new file mode 100644
index 000000000000..2f33076c9e48
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa300.h
@@ -0,0 +1,8 @@
1#ifndef __MACH_PXA300_H
2#define __MACH_PXA300_H
3
4#include <mach/hardware.h>
5#include <mach/pxa3xx-regs.h>
6#include <mach/mfp-pxa300.h>
7
8#endif /* __MACH_PXA300_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa320.h b/arch/arm/mach-pxa/include/mach/pxa320.h
new file mode 100644
index 000000000000..cab78e903273
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa320.h
@@ -0,0 +1,9 @@
1#ifndef __MACH_PXA320_H
2#define __MACH_PXA320_H
3
4#include <mach/hardware.h>
5#include <mach/pxa3xx-regs.h>
6#include <mach/mfp-pxa320.h>
7
8#endif /* __MACH_PXA320_H */
9
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
index bcf3fb2c4b3a..7d1a059b3d43 100644
--- a/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
@@ -13,6 +13,17 @@
13#ifndef __ASM_ARCH_PXA3XX_REGS_H 13#ifndef __ASM_ARCH_PXA3XX_REGS_H
14#define __ASM_ARCH_PXA3XX_REGS_H 14#define __ASM_ARCH_PXA3XX_REGS_H
15 15
16#include <mach/hardware.h>
17
18/*
19 * Static Chip Selects
20 */
21
22#define PXA300_CS0_PHYS (0x00000000) /* PXA300/PXA310 _only_ */
23#define PXA300_CS1_PHYS (0x30000000) /* PXA300/PXA310 _only_ */
24#define PXA3xx_CS2_PHYS (0x10000000)
25#define PXA3xx_CS3_PHYS (0x14000000)
26
16/* 27/*
17 * Oscillator Configuration Register (OSCC) 28 * Oscillator Configuration Register (OSCC)
18 */ 29 */
diff --git a/arch/arm/mach-pxa/include/mach/pxa930.h b/arch/arm/mach-pxa/include/mach/pxa930.h
new file mode 100644
index 000000000000..d45f76a9b54d
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/pxa930.h
@@ -0,0 +1,8 @@
1#ifndef __MACH_PXA930_H
2#define __MACH_PXA930_H
3
4#include <mach/hardware.h>
5#include <mach/pxa3xx-regs.h>
6#include <mach/mfp-pxa930.h>
7
8#endif /* __MACH_PXA930_H */
diff --git a/arch/arm/mach-pxa/include/mach/regs-intc.h b/arch/arm/mach-pxa/include/mach/regs-intc.h
new file mode 100644
index 000000000000..ad23e74b762f
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/regs-intc.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_MACH_REGS_INTC_H
2#define __ASM_MACH_REGS_INTC_H
3
4#include <mach/hardware.h>
5
6/*
7 * Interrupt Controller
8 */
9
10#define ICIP __REG(0x40D00000) /* Interrupt Controller IRQ Pending Register */
11#define ICMR __REG(0x40D00004) /* Interrupt Controller Mask Register */
12#define ICLR __REG(0x40D00008) /* Interrupt Controller Level Register */
13#define ICFP __REG(0x40D0000C) /* Interrupt Controller FIQ Pending Register */
14#define ICPR __REG(0x40D00010) /* Interrupt Controller Pending Register */
15#define ICCR __REG(0x40D00014) /* Interrupt Controller Control Register */
16
17#define ICIP2 __REG(0x40D0009C) /* Interrupt Controller IRQ Pending Register 2 */
18#define ICMR2 __REG(0x40D000A0) /* Interrupt Controller Mask Register 2 */
19#define ICLR2 __REG(0x40D000A4) /* Interrupt Controller Level Register 2 */
20#define ICFP2 __REG(0x40D000A8) /* Interrupt Controller FIQ Pending Register 2 */
21#define ICPR2 __REG(0x40D000AC) /* Interrupt Controller Pending Register 2 */
22
23#endif /* __ASM_MACH_REGS_INTC_H */
diff --git a/arch/arm/mach-pxa/include/mach/regs-ost.h b/arch/arm/mach-pxa/include/mach/regs-ost.h
new file mode 100644
index 000000000000..a3e5f86ef67e
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/regs-ost.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_MACH_REGS_OST_H
2#define __ASM_MACH_REGS_OST_H
3
4#include <mach/hardware.h>
5
6/*
7 * OS Timer & Match Registers
8 */
9
10#define OSMR0 __REG(0x40A00000) /* */
11#define OSMR1 __REG(0x40A00004) /* */
12#define OSMR2 __REG(0x40A00008) /* */
13#define OSMR3 __REG(0x40A0000C) /* */
14#define OSMR4 __REG(0x40A00080) /* */
15#define OSCR __REG(0x40A00010) /* OS Timer Counter Register */
16#define OSCR4 __REG(0x40A00040) /* OS Timer Counter Register */
17#define OMCR4 __REG(0x40A000C0) /* */
18#define OSSR __REG(0x40A00014) /* OS Timer Status Register */
19#define OWER __REG(0x40A00018) /* OS Timer Watchdog Enable Register */
20#define OIER __REG(0x40A0001C) /* OS Timer Interrupt Enable Register */
21
22#define OSSR_M3 (1 << 3) /* Match status channel 3 */
23#define OSSR_M2 (1 << 2) /* Match status channel 2 */
24#define OSSR_M1 (1 << 1) /* Match status channel 1 */
25#define OSSR_M0 (1 << 0) /* Match status channel 0 */
26
27#define OWER_WME (1 << 0) /* Watchdog Match Enable */
28
29#define OIER_E3 (1 << 3) /* Interrupt enable channel 3 */
30#define OIER_E2 (1 << 2) /* Interrupt enable channel 2 */
31#define OIER_E1 (1 << 1) /* Interrupt enable channel 1 */
32#define OIER_E0 (1 << 0) /* Interrupt enable channel 0 */
33
34#endif /* __ASM_MACH_REGS_OST_H */
diff --git a/arch/arm/mach-pxa/include/mach/regs-rtc.h b/arch/arm/mach-pxa/include/mach/regs-rtc.h
new file mode 100644
index 000000000000..f0e4a589bbe1
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/regs-rtc.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_MACH_REGS_RTC_H
2#define __ASM_MACH_REGS_RTC_H
3
4#include <mach/hardware.h>
5
6/*
7 * Real Time Clock
8 */
9
10#define RCNR __REG(0x40900000) /* RTC Count Register */
11#define RTAR __REG(0x40900004) /* RTC Alarm Register */
12#define RTSR __REG(0x40900008) /* RTC Status Register */
13#define RTTR __REG(0x4090000C) /* RTC Timer Trim Register */
14#define PIAR __REG(0x40900038) /* Periodic Interrupt Alarm Register */
15
16#define RTSR_PICE (1 << 15) /* Periodic interrupt count enable */
17#define RTSR_PIALE (1 << 14) /* Periodic interrupt Alarm enable */
18#define RTSR_HZE (1 << 3) /* HZ interrupt enable */
19#define RTSR_ALE (1 << 2) /* RTC alarm interrupt enable */
20#define RTSR_HZ (1 << 1) /* HZ rising-edge detected */
21#define RTSR_AL (1 << 0) /* RTC alarm detected */
22
23#endif /* __ASM_MACH_REGS_RTC_H */
diff --git a/arch/arm/mach-pxa/include/mach/regs-ssp.h b/arch/arm/mach-pxa/include/mach/regs-ssp.h
index 018f6d65b57b..6a2ed35acd59 100644
--- a/arch/arm/mach-pxa/include/mach/regs-ssp.h
+++ b/arch/arm/mach-pxa/include/mach/regs-ssp.h
@@ -37,7 +37,6 @@
37#if defined(CONFIG_PXA25x) 37#if defined(CONFIG_PXA25x)
38#define SSCR0_SCR (0x0000ff00) /* Serial Clock Rate (mask) */ 38#define SSCR0_SCR (0x0000ff00) /* Serial Clock Rate (mask) */
39#define SSCR0_SerClkDiv(x) ((((x) - 2)/2) << 8) /* Divisor [2..512] */ 39#define SSCR0_SerClkDiv(x) ((((x) - 2)/2) << 8) /* Divisor [2..512] */
40
41#elif defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) 40#elif defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
42#define SSCR0_SCR (0x000fff00) /* Serial Clock Rate (mask) */ 41#define SSCR0_SCR (0x000fff00) /* Serial Clock Rate (mask) */
43#define SSCR0_SerClkDiv(x) (((x) - 1) << 8) /* Divisor [1..4096] */ 42#define SSCR0_SerClkDiv(x) (((x) - 1) << 8) /* Divisor [1..4096] */
diff --git a/arch/arm/mach-pxa/include/mach/system.h b/arch/arm/mach-pxa/include/mach/system.h
index 0f381e692999..d1fce8b6d105 100644
--- a/arch/arm/mach-pxa/include/mach/system.h
+++ b/arch/arm/mach-pxa/include/mach/system.h
@@ -13,7 +13,6 @@
13#include <asm/proc-fns.h> 13#include <asm/proc-fns.h>
14#include "hardware.h" 14#include "hardware.h"
15#include "pxa2xx-regs.h" 15#include "pxa2xx-regs.h"
16#include "pxa-regs.h"
17 16
18static inline void arch_idle(void) 17static inline void arch_idle(void)
19{ 18{
@@ -21,4 +20,4 @@ static inline void arch_idle(void)
21} 20}
22 21
23 22
24void arch_reset(char mode); 23void arch_reset(char mode, const char *cmd);
diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
index f4b029c03957..5706cea95d11 100644
--- a/arch/arm/mach-pxa/include/mach/uncompress.h
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -35,7 +35,8 @@ static inline void flush(void)
35 35
36static inline void arch_decomp_setup(void) 36static inline void arch_decomp_setup(void)
37{ 37{
38 if (machine_is_littleton() || machine_is_intelmote2()) 38 if (machine_is_littleton() || machine_is_intelmote2()
39 || machine_is_csb726())
39 UART = STUART; 40 UART = STUART;
40} 41}
41 42
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index fa69c3a6a38e..f6e0300e4f64 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -20,7 +20,8 @@
20#include <mach/hardware.h> 20#include <mach/hardware.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
23#include <mach/pxa-regs.h> 23#include <mach/gpio.h>
24#include <mach/regs-intc.h>
24 25
25#include "generic.h" 26#include "generic.h"
26 27
@@ -51,6 +52,72 @@ static struct irq_chip pxa_internal_irq_chip = {
51 .unmask = pxa_unmask_irq, 52 .unmask = pxa_unmask_irq,
52}; 53};
53 54
55/*
56 * GPIO IRQs for GPIO 0 and 1
57 */
58static int pxa_set_low_gpio_type(unsigned int irq, unsigned int type)
59{
60 int gpio = irq - IRQ_GPIO0;
61
62 if (__gpio_is_occupied(gpio)) {
63 pr_err("%s failed: GPIO is configured\n", __func__);
64 return -EINVAL;
65 }
66
67 if (type & IRQ_TYPE_EDGE_RISING)
68 GRER0 |= GPIO_bit(gpio);
69 else
70 GRER0 &= ~GPIO_bit(gpio);
71
72 if (type & IRQ_TYPE_EDGE_FALLING)
73 GFER0 |= GPIO_bit(gpio);
74 else
75 GFER0 &= ~GPIO_bit(gpio);
76
77 return 0;
78}
79
80static void pxa_ack_low_gpio(unsigned int irq)
81{
82 GEDR0 = (1 << (irq - IRQ_GPIO0));
83}
84
85static void pxa_mask_low_gpio(unsigned int irq)
86{
87 ICMR &= ~(1 << (irq - PXA_IRQ(0)));
88}
89
90static void pxa_unmask_low_gpio(unsigned int irq)
91{
92 ICMR |= 1 << (irq - PXA_IRQ(0));
93}
94
95static struct irq_chip pxa_low_gpio_chip = {
96 .name = "GPIO-l",
97 .ack = pxa_ack_low_gpio,
98 .mask = pxa_mask_low_gpio,
99 .unmask = pxa_unmask_low_gpio,
100 .set_type = pxa_set_low_gpio_type,
101};
102
103static void __init pxa_init_low_gpio_irq(set_wake_t fn)
104{
105 int irq;
106
107 /* clear edge detection on GPIO 0 and 1 */
108 GFER0 &= ~0x3;
109 GRER0 &= ~0x3;
110 GEDR0 = 0x3;
111
112 for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) {
113 set_irq_chip(irq, &pxa_low_gpio_chip);
114 set_irq_handler(irq, handle_edge_irq);
115 set_irq_flags(irq, IRQF_VALID);
116 }
117
118 pxa_low_gpio_chip.set_wake = fn;
119}
120
54void __init pxa_init_irq(int irq_nr, set_wake_t fn) 121void __init pxa_init_irq(int irq_nr, set_wake_t fn)
55{ 122{
56 int irq; 123 int irq;
@@ -72,6 +139,7 @@ void __init pxa_init_irq(int irq_nr, set_wake_t fn)
72 } 139 }
73 140
74 pxa_internal_irq_chip.set_wake = fn; 141 pxa_internal_irq_chip.set_wake = fn;
142 pxa_init_low_gpio_irq(fn);
75} 143}
76 144
77#ifdef CONFIG_PM 145#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c
index 18b20d469410..8b9c17142d5a 100644
--- a/arch/arm/mach-pxa/leds-idp.c
+++ b/arch/arm/mach-pxa/leds-idp.c
@@ -18,7 +18,7 @@
18#include <asm/leds.h> 18#include <asm/leds.h>
19#include <asm/system.h> 19#include <asm/system.h>
20 20
21#include <mach/pxa-regs.h> 21#include <mach/pxa25x.h>
22#include <mach/idp.h> 22#include <mach/idp.h>
23 23
24#include "leds.h" 24#include "leds.h"
diff --git a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c
index 1a258029c33c..e26d5efe1969 100644
--- a/arch/arm/mach-pxa/leds-lubbock.c
+++ b/arch/arm/mach-pxa/leds-lubbock.c
@@ -16,7 +16,7 @@
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <asm/leds.h> 17#include <asm/leds.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <mach/pxa-regs.h> 19#include <mach/pxa25x.h>
20#include <mach/lubbock.h> 20#include <mach/lubbock.h>
21 21
22#include "leds.h" 22#include "leds.h"
diff --git a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c
index 95e06b849634..db4af5eee8b2 100644
--- a/arch/arm/mach-pxa/leds-mainstone.c
+++ b/arch/arm/mach-pxa/leds-mainstone.c
@@ -16,7 +16,7 @@
16#include <asm/leds.h> 16#include <asm/leds.h>
17#include <asm/system.h> 17#include <asm/system.h>
18 18
19#include <mach/pxa-regs.h> 19#include <mach/pxa27x.h>
20#include <mach/mainstone.h> 20#include <mach/mainstone.h>
21 21
22#include "leds.h" 22#include "leds.h"
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index 31da7f3c06f6..e13f6a81c223 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -39,8 +39,7 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41 41
42#include <mach/pxa-regs.h> 42#include <mach/pxa300.h>
43#include <mach/mfp-pxa300.h>
44#include <mach/pxafb.h> 43#include <mach/pxafb.h>
45#include <mach/ssp.h> 44#include <mach/ssp.h>
46#include <mach/pxa2xx_spi.h> 45#include <mach/pxa2xx_spi.h>
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index de3f67daaacf..d64395f26a3e 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -38,9 +38,8 @@
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40 40
41#include <mach/pxa-regs.h> 41#include <mach/pxa27x.h>
42#include <mach/pxa2xx-regs.h> 42#include <mach/gpio.h>
43#include <mach/mfp-pxa27x.h>
44#include <mach/lpd270.h> 43#include <mach/lpd270.h>
45#include <mach/audio.h> 44#include <mach/audio.h>
46#include <mach/pxafb.h> 45#include <mach/pxafb.h>
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index bff704354c1a..f04c8333dff7 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -41,15 +41,15 @@
41 41
42#include <asm/hardware/sa1111.h> 42#include <asm/hardware/sa1111.h>
43 43
44#include <mach/pxa-regs.h> 44#include <mach/pxa25x.h>
45#include <mach/pxa2xx-regs.h> 45#include <mach/gpio.h>
46#include <mach/mfp-pxa25x.h>
47#include <mach/audio.h> 46#include <mach/audio.h>
48#include <mach/lubbock.h> 47#include <mach/lubbock.h>
49#include <mach/udc.h> 48#include <mach/udc.h>
50#include <mach/irda.h> 49#include <mach/irda.h>
51#include <mach/pxafb.h> 50#include <mach/pxafb.h>
52#include <mach/mmc.h> 51#include <mach/mmc.h>
52#include <mach/pm.h>
53 53
54#include "generic.h" 54#include "generic.h"
55#include "clock.h" 55#include "clock.h"
@@ -113,8 +113,14 @@ static unsigned long lubbock_pin_config[] __initdata = {
113 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, 113 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
114}; 114};
115 115
116#define LUB_HEXLED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010)
116#define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080) 117#define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
117 118
119void lubbock_set_hexled(uint32_t value)
120{
121 LUB_HEXLED = value;
122}
123
118void lubbock_set_misc_wr(unsigned int mask, unsigned int set) 124void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
119{ 125{
120 unsigned long flags; 126 unsigned long flags;
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 21b821e1a60d..d46b36746be2 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -25,14 +25,14 @@
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/pda_power.h> 26#include <linux/pda_power.h>
27#include <linux/pwm_backlight.h> 27#include <linux/pwm_backlight.h>
28#include <linux/usb/gpio_vbus.h>
28 29
29#include <mach/hardware.h> 30#include <mach/hardware.h>
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33
34#include <mach/pxa27x.h>
32#include <mach/magician.h> 35#include <mach/magician.h>
33#include <mach/mfp-pxa27x.h>
34#include <mach/pxa-regs.h>
35#include <mach/pxa2xx-regs.h>
36#include <mach/pxafb.h> 36#include <mach/pxafb.h>
37#include <mach/i2c.h> 37#include <mach/i2c.h>
38#include <mach/mmc.h> 38#include <mach/mmc.h>
@@ -66,6 +66,11 @@ static unsigned long magician_pin_config[] __initdata = {
66 GPIO31_I2S_SYNC, 66 GPIO31_I2S_SYNC,
67 GPIO113_I2S_SYSCLK, 67 GPIO113_I2S_SYSCLK,
68 68
69 /* SSP 1 */
70 GPIO23_SSP1_SCLK,
71 GPIO24_SSP1_SFRM,
72 GPIO25_SSP1_TXD,
73
69 /* SSP 2 */ 74 /* SSP 2 */
70 GPIO19_SSP2_SCLK, 75 GPIO19_SSP2_SCLK,
71 GPIO14_SSP2_SFRM, 76 GPIO14_SSP2_SFRM,
@@ -148,22 +153,31 @@ static struct pxaficp_platform_data magician_ficp_info = {
148 * GPIO Keys 153 * GPIO Keys
149 */ 154 */
150 155
156#define INIT_KEY(_code, _gpio, _desc) \
157 { \
158 .code = KEY_##_code, \
159 .gpio = _gpio, \
160 .desc = _desc, \
161 .type = EV_KEY, \
162 .wakeup = 1, \
163 }
164
151static struct gpio_keys_button magician_button_table[] = { 165static struct gpio_keys_button magician_button_table[] = {
152 {KEY_POWER, GPIO0_MAGICIAN_KEY_POWER, 0, "Power button"}, 166 INIT_KEY(POWER, GPIO0_MAGICIAN_KEY_POWER, "Power button"),
153 {KEY_ESC, GPIO37_MAGICIAN_KEY_HANGUP, 0, "Hangup button"}, 167 INIT_KEY(ESC, GPIO37_MAGICIAN_KEY_HANGUP, "Hangup button"),
154 {KEY_F10, GPIO38_MAGICIAN_KEY_CONTACTS, 0, "Contacts button"}, 168 INIT_KEY(F10, GPIO38_MAGICIAN_KEY_CONTACTS, "Contacts button"),
155 {KEY_CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, 0, "Calendar button"}, 169 INIT_KEY(CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, "Calendar button"),
156 {KEY_CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, 0, "Camera button"}, 170 INIT_KEY(CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, "Camera button"),
157 {KEY_UP, GPIO93_MAGICIAN_KEY_UP, 0, "Up button"}, 171 INIT_KEY(UP, GPIO93_MAGICIAN_KEY_UP, "Up button"),
158 {KEY_DOWN, GPIO94_MAGICIAN_KEY_DOWN, 0, "Down button"}, 172 INIT_KEY(DOWN, GPIO94_MAGICIAN_KEY_DOWN, "Down button"),
159 {KEY_LEFT, GPIO95_MAGICIAN_KEY_LEFT, 0, "Left button"}, 173 INIT_KEY(LEFT, GPIO95_MAGICIAN_KEY_LEFT, "Left button"),
160 {KEY_RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, 0, "Right button"}, 174 INIT_KEY(RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, "Right button"),
161 {KEY_KPENTER, GPIO97_MAGICIAN_KEY_ENTER, 0, "Action button"}, 175 INIT_KEY(KPENTER, GPIO97_MAGICIAN_KEY_ENTER, "Action button"),
162 {KEY_RECORD, GPIO98_MAGICIAN_KEY_RECORD, 0, "Record button"}, 176 INIT_KEY(RECORD, GPIO98_MAGICIAN_KEY_RECORD, "Record button"),
163 {KEY_VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, 0, "Volume up"}, 177 INIT_KEY(VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, "Volume up"),
164 {KEY_VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, 0, "Volume down"}, 178 INIT_KEY(VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, "Volume down"),
165 {KEY_PHONE, GPIO102_MAGICIAN_KEY_PHONE, 0, "Phone button"}, 179 INIT_KEY(PHONE, GPIO102_MAGICIAN_KEY_PHONE, "Phone button"),
166 {KEY_PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, 0, "Headset button"}, 180 INIT_KEY(PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, "Headset button"),
167}; 181};
168 182
169static struct gpio_keys_platform_data gpio_keys_data = { 183static struct gpio_keys_platform_data gpio_keys_data = {
@@ -189,7 +203,7 @@ static struct platform_device gpio_keys = {
189static struct resource egpio_resources[] = { 203static struct resource egpio_resources[] = {
190 [0] = { 204 [0] = {
191 .start = PXA_CS3_PHYS, 205 .start = PXA_CS3_PHYS,
192 .end = PXA_CS3_PHYS + 0x20, 206 .end = PXA_CS3_PHYS + 0x20 - 1,
193 .flags = IORESOURCE_MEM, 207 .flags = IORESOURCE_MEM,
194 }, 208 },
195 [1] = { 209 [1] = {
@@ -420,7 +434,7 @@ static struct gpio_led gpio_leds[] = {
420 }, 434 },
421 { 435 {
422 .name = "magician::phone_bl", 436 .name = "magician::phone_bl",
423 .default_trigger = "none", 437 .default_trigger = "backlight",
424 .gpio = GPIO103_MAGICIAN_LED_KP, 438 .gpio = GPIO103_MAGICIAN_LED_KP,
425 }, 439 },
426}; 440};
@@ -468,8 +482,6 @@ static struct pasic3_led pasic3_leds[] = {
468 }, 482 },
469}; 483};
470 484
471static struct platform_device pasic3;
472
473static struct pasic3_leds_machinfo pasic3_leds_info = { 485static struct pasic3_leds_machinfo pasic3_leds_info = {
474 .num_leds = ARRAY_SIZE(pasic3_leds), 486 .num_leds = ARRAY_SIZE(pasic3_leds),
475 .power_gpio = EGPIO_MAGICIAN_LED_POWER, 487 .power_gpio = EGPIO_MAGICIAN_LED_POWER,
@@ -511,6 +523,31 @@ static struct platform_device pasic3 = {
511}; 523};
512 524
513/* 525/*
526 * USB "Transceiver"
527 */
528
529static struct resource gpio_vbus_resource = {
530 .flags = IORESOURCE_IRQ,
531 .start = IRQ_MAGICIAN_VBUS,
532 .end = IRQ_MAGICIAN_VBUS,
533};
534
535static struct gpio_vbus_mach_info gpio_vbus_info = {
536 .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN,
537 .gpio_vbus = EGPIO_MAGICIAN_CABLE_STATE_USB,
538};
539
540static struct platform_device gpio_vbus = {
541 .name = "gpio-vbus",
542 .id = -1,
543 .num_resources = 1,
544 .resource = &gpio_vbus_resource,
545 .dev = {
546 .platform_data = &gpio_vbus_info,
547 },
548};
549
550/*
514 * External power 551 * External power
515 */ 552 */
516 553
@@ -586,15 +623,17 @@ static struct pda_power_pdata power_supply_info = {
586static struct resource power_supply_resources[] = { 623static struct resource power_supply_resources[] = {
587 [0] = { 624 [0] = {
588 .name = "ac", 625 .name = "ac",
589 .flags = IORESOURCE_IRQ, 626 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
590 .start = IRQ_MAGICIAN_AC, 627 IORESOURCE_IRQ_LOWEDGE,
591 .end = IRQ_MAGICIAN_AC, 628 .start = IRQ_MAGICIAN_VBUS,
629 .end = IRQ_MAGICIAN_VBUS,
592 }, 630 },
593 [1] = { 631 [1] = {
594 .name = "usb", 632 .name = "usb",
595 .flags = IORESOURCE_IRQ, 633 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
596 .start = IRQ_MAGICIAN_AC, 634 IORESOURCE_IRQ_LOWEDGE,
597 .end = IRQ_MAGICIAN_AC, 635 .start = IRQ_MAGICIAN_VBUS,
636 .end = IRQ_MAGICIAN_VBUS,
598 }, 637 },
599}; 638};
600 639
@@ -688,11 +727,9 @@ static void magician_set_vpp(struct map_info *map, int vpp)
688 gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); 727 gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp);
689} 728}
690 729
691#define PXA_CS_SIZE 0x04000000
692
693static struct resource strataflash_resource = { 730static struct resource strataflash_resource = {
694 .start = PXA_CS0_PHYS, 731 .start = PXA_CS0_PHYS,
695 .end = PXA_CS0_PHYS + PXA_CS_SIZE - 1, 732 .end = PXA_CS0_PHYS + SZ_64M - 1,
696 .flags = IORESOURCE_MEM, 733 .flags = IORESOURCE_MEM,
697}; 734};
698 735
@@ -720,6 +757,7 @@ static struct platform_device *devices[] __initdata = {
720 &egpio, 757 &egpio,
721 &backlight, 758 &backlight,
722 &pasic3, 759 &pasic3,
760 &gpio_vbus,
723 &power_supply, 761 &power_supply,
724 &strataflash, 762 &strataflash,
725 &leds_gpio, 763 &leds_gpio,
@@ -743,6 +781,7 @@ static void __init magician_init(void)
743 gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1); 781 gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1);
744 pxa_set_ficp_info(&magician_ficp_info); 782 pxa_set_ficp_info(&magician_ficp_info);
745 } 783 }
784 pxa27x_set_i2c_power_info(NULL);
746 pxa_set_i2c_info(NULL); 785 pxa_set_i2c_info(NULL);
747 pxa_set_mci_info(&magician_mci_info); 786 pxa_set_mci_info(&magician_mci_info);
748 pxa_set_ohci_info(&magician_ohci_info); 787 pxa_set_ohci_info(&magician_ohci_info);
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 5f224968043c..a6c8429e975f 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -41,9 +41,8 @@
41#include <asm/mach/irq.h> 41#include <asm/mach/irq.h>
42#include <asm/mach/flash.h> 42#include <asm/mach/flash.h>
43 43
44#include <mach/pxa-regs.h> 44#include <mach/pxa27x.h>
45#include <mach/pxa2xx-regs.h> 45#include <mach/gpio.h>
46#include <mach/mfp-pxa27x.h>
47#include <mach/mainstone.h> 46#include <mach/mainstone.h>
48#include <mach/audio.h> 47#include <mach/audio.h>
49#include <mach/pxafb.h> 48#include <mach/pxafb.h>
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 33626de8cbf6..7ffb91d64c39 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -18,15 +18,12 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20 20
21#include <mach/hardware.h> 21#include <mach/gpio.h>
22#include <mach/pxa-regs.h>
23#include <mach/pxa2xx-regs.h> 22#include <mach/pxa2xx-regs.h>
24#include <mach/mfp-pxa2xx.h> 23#include <mach/mfp-pxa2xx.h>
25 24
26#include "generic.h" 25#include "generic.h"
27 26
28#define gpio_to_bank(gpio) ((gpio) >> 5)
29
30#define PGSR(x) __REG2(0x40F00020, (x) << 2) 27#define PGSR(x) __REG2(0x40F00020, (x) << 2)
31#define __GAFR(u, x) __REG2((u) ? 0x40E00058 : 0x40E00054, (x) << 3) 28#define __GAFR(u, x) __REG2((u) ? 0x40E00058 : 0x40E00054, (x) << 3)
32#define GAFR_L(x) __GAFR(0, x) 29#define GAFR_L(x) __GAFR(0, x)
diff --git a/arch/arm/mach-pxa/mfp-pxa3xx.c b/arch/arm/mach-pxa/mfp-pxa3xx.c
index eb197a6e8e94..7a270eecd480 100644
--- a/arch/arm/mach-pxa/mfp-pxa3xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa3xx.c
@@ -20,183 +20,9 @@
20#include <linux/sysdev.h> 20#include <linux/sysdev.h>
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/mfp.h>
24#include <mach/mfp-pxa3xx.h> 23#include <mach/mfp-pxa3xx.h>
25#include <mach/pxa3xx-regs.h> 24#include <mach/pxa3xx-regs.h>
26 25
27/* mfp_spin_lock is used to ensure that MFP register configuration
28 * (most likely a read-modify-write operation) is atomic, and that
29 * mfp_table[] is consistent
30 */
31static DEFINE_SPINLOCK(mfp_spin_lock);
32
33static void __iomem *mfpr_mmio_base = (void __iomem *)&__REG(MFPR_BASE);
34
35struct pxa3xx_mfp_pin {
36 unsigned long config; /* -1 for not configured */
37 unsigned long mfpr_off; /* MFPRxx Register offset */
38 unsigned long mfpr_run; /* Run-Mode Register Value */
39 unsigned long mfpr_lpm; /* Low Power Mode Register Value */
40};
41
42static struct pxa3xx_mfp_pin mfp_table[MFP_PIN_MAX];
43
44/* mapping of MFP_LPM_* definitions to MFPR_LPM_* register bits */
45static const unsigned long mfpr_lpm[] = {
46 MFPR_LPM_INPUT,
47 MFPR_LPM_DRIVE_LOW,
48 MFPR_LPM_DRIVE_HIGH,
49 MFPR_LPM_PULL_LOW,
50 MFPR_LPM_PULL_HIGH,
51 MFPR_LPM_FLOAT,
52};
53
54/* mapping of MFP_PULL_* definitions to MFPR_PULL_* register bits */
55static const unsigned long mfpr_pull[] = {
56 MFPR_PULL_NONE,
57 MFPR_PULL_LOW,
58 MFPR_PULL_HIGH,
59 MFPR_PULL_BOTH,
60};
61
62/* mapping of MFP_LPM_EDGE_* definitions to MFPR_EDGE_* register bits */
63static const unsigned long mfpr_edge[] = {
64 MFPR_EDGE_NONE,
65 MFPR_EDGE_RISE,
66 MFPR_EDGE_FALL,
67 MFPR_EDGE_BOTH,
68};
69
70#define mfpr_readl(off) \
71 __raw_readl(mfpr_mmio_base + (off))
72
73#define mfpr_writel(off, val) \
74 __raw_writel(val, mfpr_mmio_base + (off))
75
76#define mfp_configured(p) ((p)->config != -1)
77
78/*
79 * perform a read-back of any MFPR register to make sure the
80 * previous writings are finished
81 */
82#define mfpr_sync() (void)__raw_readl(mfpr_mmio_base + 0)
83
84static inline void __mfp_config_run(struct pxa3xx_mfp_pin *p)
85{
86 if (mfp_configured(p))
87 mfpr_writel(p->mfpr_off, p->mfpr_run);
88}
89
90static inline void __mfp_config_lpm(struct pxa3xx_mfp_pin *p)
91{
92 if (mfp_configured(p)) {
93 unsigned long mfpr_clr = (p->mfpr_run & ~MFPR_EDGE_BOTH) | MFPR_EDGE_CLEAR;
94 if (mfpr_clr != p->mfpr_run)
95 mfpr_writel(p->mfpr_off, mfpr_clr);
96 if (p->mfpr_lpm != mfpr_clr)
97 mfpr_writel(p->mfpr_off, p->mfpr_lpm);
98 }
99}
100
101void pxa3xx_mfp_config(unsigned long *mfp_cfgs, int num)
102{
103 unsigned long flags;
104 int i;
105
106 spin_lock_irqsave(&mfp_spin_lock, flags);
107
108 for (i = 0; i < num; i++, mfp_cfgs++) {
109 unsigned long tmp, c = *mfp_cfgs;
110 struct pxa3xx_mfp_pin *p;
111 int pin, af, drv, lpm, edge, pull;
112
113 pin = MFP_PIN(c);
114 BUG_ON(pin >= MFP_PIN_MAX);
115 p = &mfp_table[pin];
116
117 af = MFP_AF(c);
118 drv = MFP_DS(c);
119 lpm = MFP_LPM_STATE(c);
120 edge = MFP_LPM_EDGE(c);
121 pull = MFP_PULL(c);
122
123 /* run-mode pull settings will conflict with MFPR bits of
124 * low power mode state, calculate mfpr_run and mfpr_lpm
125 * individually if pull != MFP_PULL_NONE
126 */
127 tmp = MFPR_AF_SEL(af) | MFPR_DRIVE(drv);
128
129 if (likely(pull == MFP_PULL_NONE)) {
130 p->mfpr_run = tmp | mfpr_lpm[lpm] | mfpr_edge[edge];
131 p->mfpr_lpm = p->mfpr_run;
132 } else {
133 p->mfpr_lpm = tmp | mfpr_lpm[lpm] | mfpr_edge[edge];
134 p->mfpr_run = tmp | mfpr_pull[pull];
135 }
136
137 p->config = c; __mfp_config_run(p);
138 }
139
140 mfpr_sync();
141 spin_unlock_irqrestore(&mfp_spin_lock, flags);
142}
143
144unsigned long pxa3xx_mfp_read(int mfp)
145{
146 unsigned long val, flags;
147
148 BUG_ON(mfp >= MFP_PIN_MAX);
149
150 spin_lock_irqsave(&mfp_spin_lock, flags);
151 val = mfpr_readl(mfp_table[mfp].mfpr_off);
152 spin_unlock_irqrestore(&mfp_spin_lock, flags);
153
154 return val;
155}
156
157void pxa3xx_mfp_write(int mfp, unsigned long val)
158{
159 unsigned long flags;
160
161 BUG_ON(mfp >= MFP_PIN_MAX);
162
163 spin_lock_irqsave(&mfp_spin_lock, flags);
164 mfpr_writel(mfp_table[mfp].mfpr_off, val);
165 mfpr_sync();
166 spin_unlock_irqrestore(&mfp_spin_lock, flags);
167}
168
169void __init pxa3xx_mfp_init_addr(struct pxa3xx_mfp_addr_map *map)
170{
171 struct pxa3xx_mfp_addr_map *p;
172 unsigned long offset, flags;
173 int i;
174
175 spin_lock_irqsave(&mfp_spin_lock, flags);
176
177 for (p = map; p->start != MFP_PIN_INVALID; p++) {
178 offset = p->offset;
179 i = p->start;
180
181 do {
182 mfp_table[i].mfpr_off = offset;
183 mfp_table[i].mfpr_run = 0;
184 mfp_table[i].mfpr_lpm = 0;
185 offset += 4; i++;
186 } while ((i <= p->end) && (p->end != -1));
187 }
188
189 spin_unlock_irqrestore(&mfp_spin_lock, flags);
190}
191
192void __init pxa3xx_init_mfp(void)
193{
194 int i;
195
196 for (i = 0; i < ARRAY_SIZE(mfp_table); i++)
197 mfp_table[i].config = -1;
198}
199
200#ifdef CONFIG_PM 26#ifdef CONFIG_PM
201/* 27/*
202 * Configure the MFPs appropriately for suspend/resume. 28 * Configure the MFPs appropriately for suspend/resume.
@@ -207,23 +33,13 @@ void __init pxa3xx_init_mfp(void)
207 */ 33 */
208static int pxa3xx_mfp_suspend(struct sys_device *d, pm_message_t state) 34static int pxa3xx_mfp_suspend(struct sys_device *d, pm_message_t state)
209{ 35{
210 int pin; 36 mfp_config_lpm();
211
212 for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++) {
213 struct pxa3xx_mfp_pin *p = &mfp_table[pin];
214 __mfp_config_lpm(p);
215 }
216 return 0; 37 return 0;
217} 38}
218 39
219static int pxa3xx_mfp_resume(struct sys_device *d) 40static int pxa3xx_mfp_resume(struct sys_device *d)
220{ 41{
221 int pin; 42 mfp_config_run();
222
223 for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++) {
224 struct pxa3xx_mfp_pin *p = &mfp_table[pin];
225 __mfp_config_run(p);
226 }
227 43
228 /* clear RDH bit when MFP settings are restored 44 /* clear RDH bit when MFP settings are restored
229 * 45 *
@@ -231,7 +47,6 @@ static int pxa3xx_mfp_resume(struct sys_device *d)
231 * preserve them here in case they will be referenced later 47 * preserve them here in case they will be referenced later
232 */ 48 */
233 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); 49 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S);
234
235 return 0; 50 return 0;
236} 51}
237#else 52#else
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 2b427e015b6f..97c93a7a285c 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -36,13 +36,15 @@
36#include <linux/power_supply.h> 36#include <linux/power_supply.h>
37#include <linux/wm97xx_batt.h> 37#include <linux/wm97xx_batt.h>
38#include <linux/mtd/physmap.h> 38#include <linux/mtd/physmap.h>
39#include <linux/usb/gpio_vbus.h>
39 40
40#include <asm/mach-types.h> 41#include <asm/mach-types.h>
41#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
42#include <mach/mfp-pxa27x.h> 43
44#include <mach/pxa27x.h>
45#include <mach/regs-rtc.h>
43#include <mach/pxa27x_keypad.h> 46#include <mach/pxa27x_keypad.h>
44#include <mach/pxafb.h> 47#include <mach/pxafb.h>
45#include <mach/pxa2xx-regs.h>
46#include <mach/mmc.h> 48#include <mach/mmc.h>
47#include <mach/udc.h> 49#include <mach/udc.h>
48#include <mach/pxa27x-udc.h> 50#include <mach/pxa27x-udc.h>
@@ -411,21 +413,6 @@ static void gsm_exit(void)
411/* 413/*
412 * USB UDC 414 * USB UDC
413 */ 415 */
414static void udc_power_command(int cmd)
415{
416 switch (cmd) {
417 case PXA2XX_UDC_CMD_DISCONNECT:
418 gpio_set_value(GPIO22_USB_ENABLE, 0);
419 break;
420 case PXA2XX_UDC_CMD_CONNECT:
421 gpio_set_value(GPIO22_USB_ENABLE, 1);
422 break;
423 default:
424 printk(KERN_INFO "udc_control: unknown command (0x%x)!\n", cmd);
425 break;
426 }
427}
428
429static int is_usb_connected(void) 416static int is_usb_connected(void)
430{ 417{
431 return !gpio_get_value(GPIO13_nUSB_DETECT); 418 return !gpio_get_value(GPIO13_nUSB_DETECT);
@@ -433,24 +420,15 @@ static int is_usb_connected(void)
433 420
434static struct pxa2xx_udc_mach_info mioa701_udc_info = { 421static struct pxa2xx_udc_mach_info mioa701_udc_info = {
435 .udc_is_connected = is_usb_connected, 422 .udc_is_connected = is_usb_connected,
436 .udc_command = udc_power_command, 423 .gpio_pullup = GPIO22_USB_ENABLE,
437}; 424};
438 425
439struct gpio_ress udc_gpios[] = { 426struct gpio_vbus_mach_info gpio_vbus_data = {
440 MIO_GPIO_OUT(GPIO22_USB_ENABLE, 0, "USB Vbus enable") 427 .gpio_vbus = GPIO13_nUSB_DETECT,
428 .gpio_vbus_inverted = 1,
429 .gpio_pullup = -1,
441}; 430};
442 431
443static int __init udc_init(void)
444{
445 pxa_set_udc_info(&mioa701_udc_info);
446 return mio_gpio_request(ARRAY_AND_SIZE(udc_gpios));
447}
448
449static void udc_exit(void)
450{
451 mio_gpio_free(ARRAY_AND_SIZE(udc_gpios));
452}
453
454/* 432/*
455 * SDIO/MMC Card controller 433 * SDIO/MMC Card controller
456 */ 434 */
@@ -789,6 +767,7 @@ MIO_SIMPLE_DEV(pxa2xx_ac97, "pxa2xx-ac97", NULL)
789MIO_PARENT_DEV(mio_wm9713_codec, "wm9713-codec", &pxa2xx_ac97.dev, NULL) 767MIO_PARENT_DEV(mio_wm9713_codec, "wm9713-codec", &pxa2xx_ac97.dev, NULL)
790MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) 768MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL)
791MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) 769MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL)
770MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data);
792 771
793static struct platform_device *devices[] __initdata = { 772static struct platform_device *devices[] __initdata = {
794 &mioa701_gpio_keys, 773 &mioa701_gpio_keys,
@@ -800,7 +779,8 @@ static struct platform_device *devices[] __initdata = {
800 &mioa701_sound, 779 &mioa701_sound,
801 &power_dev, 780 &power_dev,
802 &strataflash, 781 &strataflash,
803 &mioa701_board 782 &gpio_vbus,
783 &mioa701_board,
804}; 784};
805 785
806static void mioa701_machine_exit(void); 786static void mioa701_machine_exit(void);
@@ -808,13 +788,13 @@ static void mioa701_machine_exit(void);
808static void mioa701_poweroff(void) 788static void mioa701_poweroff(void)
809{ 789{
810 mioa701_machine_exit(); 790 mioa701_machine_exit();
811 arm_machine_restart('s'); 791 arm_machine_restart('s', NULL);
812} 792}
813 793
814static void mioa701_restart(char c) 794static void mioa701_restart(char c, const char *cmd)
815{ 795{
816 mioa701_machine_exit(); 796 mioa701_machine_exit();
817 arm_machine_restart('s'); 797 arm_machine_restart('s', cmd);
818} 798}
819 799
820struct gpio_ress global_gpios[] = { 800struct gpio_ress global_gpios[] = {
@@ -837,7 +817,7 @@ static void __init mioa701_machine_init(void)
837 pxa_set_mci_info(&mioa701_mci_info); 817 pxa_set_mci_info(&mioa701_mci_info);
838 pxa_set_keypad_info(&mioa701_keypad_info); 818 pxa_set_keypad_info(&mioa701_keypad_info);
839 wm97xx_bat_set_pdata(&mioa701_battery_data); 819 wm97xx_bat_set_pdata(&mioa701_battery_data);
840 udc_init(); 820 pxa_set_udc_info(&mioa701_udc_info);
841 pm_power_off = mioa701_poweroff; 821 pm_power_off = mioa701_poweroff;
842 arm_pm_restart = mioa701_restart; 822 arm_pm_restart = mioa701_restart;
843 platform_add_devices(devices, ARRAY_SIZE(devices)); 823 platform_add_devices(devices, ARRAY_SIZE(devices));
@@ -850,7 +830,6 @@ static void __init mioa701_machine_init(void)
850 830
851static void mioa701_machine_exit(void) 831static void mioa701_machine_exit(void)
852{ 832{
853 udc_exit();
854 bootstrap_exit(); 833 bootstrap_exit();
855 gsm_exit(); 834 gsm_exit();
856} 835}
diff --git a/arch/arm/mach-pxa/mp900.c b/arch/arm/mach-pxa/mp900.c
index 8a73814126b1..a65713ce019e 100644
--- a/arch/arm/mach-pxa/mp900.c
+++ b/arch/arm/mach-pxa/mp900.c
@@ -19,10 +19,10 @@
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/usb/isp116x.h> 20#include <linux/usb/isp116x.h>
21 21
22#include <mach/hardware.h>
23#include <mach/pxa-regs.h>
24#include <asm/mach-types.h> 22#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24
25#include <mach/pxa25x.h>
26#include "generic.h" 26#include "generic.h"
27 27
28static void isp116x_pfm_delay(struct device *dev, int delay) 28static void isp116x_pfm_delay(struct device *dev, int delay)
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
new file mode 100644
index 000000000000..8587477a9bb7
--- /dev/null
+++ b/arch/arm/mach-pxa/palmld.c
@@ -0,0 +1,565 @@
1/*
2 * Hardware definitions for Palm LifeDrive
3 *
4 * Author: Marek Vasut <marek.vasut@gmail.com>
5 *
6 * Based on work of:
7 * Alex Osborne <ato@meshy.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * (find more info at www.hackndev.com)
14 *
15 */
16
17#include <linux/platform_device.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/gpio_keys.h>
21#include <linux/input.h>
22#include <linux/pda_power.h>
23#include <linux/pwm_backlight.h>
24#include <linux/gpio.h>
25#include <linux/wm97xx_batt.h>
26#include <linux/power_supply.h>
27
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31
32#include <mach/pxa27x.h>
33#include <mach/audio.h>
34#include <mach/palmld.h>
35#include <mach/mmc.h>
36#include <mach/pxafb.h>
37#include <mach/irda.h>
38#include <mach/pxa27x_keypad.h>
39#include <mach/palmasoc.h>
40
41#include "generic.h"
42#include "devices.h"
43
44/******************************************************************************
45 * Pin configuration
46 ******************************************************************************/
47static unsigned long palmld_pin_config[] __initdata = {
48 /* MMC */
49 GPIO32_MMC_CLK,
50 GPIO92_MMC_DAT_0,
51 GPIO109_MMC_DAT_1,
52 GPIO110_MMC_DAT_2,
53 GPIO111_MMC_DAT_3,
54 GPIO112_MMC_CMD,
55 GPIO14_GPIO, /* SD detect */
56 GPIO114_GPIO, /* SD power */
57 GPIO116_GPIO, /* SD r/o switch */
58
59 /* AC97 */
60 GPIO28_AC97_BITCLK,
61 GPIO29_AC97_SDATA_IN_0,
62 GPIO30_AC97_SDATA_OUT,
63 GPIO31_AC97_SYNC,
64
65 /* IrDA */
66 GPIO108_GPIO, /* ir disable */
67 GPIO46_FICP_RXD,
68 GPIO47_FICP_TXD,
69
70 /* MATRIX KEYPAD */
71 GPIO100_KP_MKIN_0,
72 GPIO101_KP_MKIN_1,
73 GPIO102_KP_MKIN_2,
74 GPIO97_KP_MKIN_3,
75 GPIO103_KP_MKOUT_0,
76 GPIO104_KP_MKOUT_1,
77 GPIO105_KP_MKOUT_2,
78
79 /* LCD */
80 GPIO58_LCD_LDD_0,
81 GPIO59_LCD_LDD_1,
82 GPIO60_LCD_LDD_2,
83 GPIO61_LCD_LDD_3,
84 GPIO62_LCD_LDD_4,
85 GPIO63_LCD_LDD_5,
86 GPIO64_LCD_LDD_6,
87 GPIO65_LCD_LDD_7,
88 GPIO66_LCD_LDD_8,
89 GPIO67_LCD_LDD_9,
90 GPIO68_LCD_LDD_10,
91 GPIO69_LCD_LDD_11,
92 GPIO70_LCD_LDD_12,
93 GPIO71_LCD_LDD_13,
94 GPIO72_LCD_LDD_14,
95 GPIO73_LCD_LDD_15,
96 GPIO74_LCD_FCLK,
97 GPIO75_LCD_LCLK,
98 GPIO76_LCD_PCLK,
99 GPIO77_LCD_BIAS,
100
101 /* PWM */
102 GPIO16_PWM0_OUT,
103
104 /* GPIO KEYS */
105 GPIO10_GPIO, /* hotsync button */
106 GPIO12_GPIO, /* power switch */
107 GPIO15_GPIO, /* lock switch */
108
109 /* LEDs */
110 GPIO52_GPIO, /* green led */
111 GPIO94_GPIO, /* orange led */
112
113 /* PCMCIA */
114 GPIO48_nPOE,
115 GPIO49_nPWE,
116 GPIO50_nPIOR,
117 GPIO51_nPIOW,
118 GPIO85_nPCE_1,
119 GPIO54_nPCE_2,
120 GPIO79_PSKTSEL,
121 GPIO55_nPREG,
122 GPIO56_nPWAIT,
123 GPIO57_nIOIS16,
124 GPIO36_GPIO, /* wifi power */
125 GPIO38_GPIO, /* wifi ready */
126 GPIO81_GPIO, /* wifi reset */
127
128 /* HDD */
129 GPIO95_GPIO, /* HDD irq */
130 GPIO115_GPIO, /* HDD power */
131
132 /* MISC */
133 GPIO13_GPIO, /* earphone detect */
134};
135
136/******************************************************************************
137 * SD/MMC card controller
138 ******************************************************************************/
139static int palmld_mci_init(struct device *dev, irq_handler_t palmld_detect_int,
140 void *data)
141{
142 int err = 0;
143
144 /* Setup an interrupt for detecting card insert/remove events */
145 err = gpio_request(GPIO_NR_PALMLD_SD_DETECT_N, "SD IRQ");
146 if (err)
147 goto err;
148 err = gpio_direction_input(GPIO_NR_PALMLD_SD_DETECT_N);
149 if (err)
150 goto err2;
151 err = request_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N),
152 palmld_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
153 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
154 "SD/MMC card detect", data);
155 if (err) {
156 printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n",
157 __func__);
158 goto err2;
159 }
160
161 err = gpio_request(GPIO_NR_PALMLD_SD_POWER, "SD_POWER");
162 if (err)
163 goto err3;
164 err = gpio_direction_output(GPIO_NR_PALMLD_SD_POWER, 0);
165 if (err)
166 goto err4;
167
168 err = gpio_request(GPIO_NR_PALMLD_SD_READONLY, "SD_READONLY");
169 if (err)
170 goto err4;
171 err = gpio_direction_input(GPIO_NR_PALMLD_SD_READONLY);
172 if (err)
173 goto err5;
174
175 printk(KERN_DEBUG "%s: irq registered\n", __func__);
176
177 return 0;
178
179err5:
180 gpio_free(GPIO_NR_PALMLD_SD_READONLY);
181err4:
182 gpio_free(GPIO_NR_PALMLD_SD_POWER);
183err3:
184 free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data);
185err2:
186 gpio_free(GPIO_NR_PALMLD_SD_DETECT_N);
187err:
188 return err;
189}
190
191static void palmld_mci_exit(struct device *dev, void *data)
192{
193 gpio_free(GPIO_NR_PALMLD_SD_READONLY);
194 gpio_free(GPIO_NR_PALMLD_SD_POWER);
195 free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data);
196 gpio_free(GPIO_NR_PALMLD_SD_DETECT_N);
197}
198
199static void palmld_mci_power(struct device *dev, unsigned int vdd)
200{
201 struct pxamci_platform_data *p_d = dev->platform_data;
202 gpio_set_value(GPIO_NR_PALMLD_SD_POWER, p_d->ocr_mask & (1 << vdd));
203}
204
205static int palmld_mci_get_ro(struct device *dev)
206{
207 return gpio_get_value(GPIO_NR_PALMLD_SD_READONLY);
208}
209
210static struct pxamci_platform_data palmld_mci_platform_data = {
211 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
212 .setpower = palmld_mci_power,
213 .get_ro = palmld_mci_get_ro,
214 .init = palmld_mci_init,
215 .exit = palmld_mci_exit,
216};
217
218/******************************************************************************
219 * GPIO keyboard
220 ******************************************************************************/
221static unsigned int palmld_matrix_keys[] = {
222 KEY(0, 1, KEY_F2),
223 KEY(0, 2, KEY_UP),
224
225 KEY(1, 0, KEY_F3),
226 KEY(1, 1, KEY_F4),
227 KEY(1, 2, KEY_RIGHT),
228
229 KEY(2, 0, KEY_F1),
230 KEY(2, 1, KEY_F5),
231 KEY(2, 2, KEY_DOWN),
232
233 KEY(3, 0, KEY_F6),
234 KEY(3, 1, KEY_ENTER),
235 KEY(3, 2, KEY_LEFT),
236};
237
238static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
239 .matrix_key_rows = 4,
240 .matrix_key_cols = 3,
241 .matrix_key_map = palmld_matrix_keys,
242 .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys),
243
244 .debounce_interval = 30,
245};
246
247/******************************************************************************
248 * GPIO keys
249 ******************************************************************************/
250static struct gpio_keys_button palmld_pxa_buttons[] = {
251 {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
252 {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
253 {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
254};
255
256static struct gpio_keys_platform_data palmld_pxa_keys_data = {
257 .buttons = palmld_pxa_buttons,
258 .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
259};
260
261static struct platform_device palmld_pxa_keys = {
262 .name = "gpio-keys",
263 .id = -1,
264 .dev = {
265 .platform_data = &palmld_pxa_keys_data,
266 },
267};
268
269/******************************************************************************
270 * Backlight
271 ******************************************************************************/
272static int palmld_backlight_init(struct device *dev)
273{
274 int ret;
275
276 ret = gpio_request(GPIO_NR_PALMLD_BL_POWER, "BL POWER");
277 if (ret)
278 goto err;
279 ret = gpio_direction_output(GPIO_NR_PALMLD_BL_POWER, 0);
280 if (ret)
281 goto err2;
282 ret = gpio_request(GPIO_NR_PALMLD_LCD_POWER, "LCD POWER");
283 if (ret)
284 goto err2;
285 ret = gpio_direction_output(GPIO_NR_PALMLD_LCD_POWER, 0);
286 if (ret)
287 goto err3;
288
289 return 0;
290err3:
291 gpio_free(GPIO_NR_PALMLD_LCD_POWER);
292err2:
293 gpio_free(GPIO_NR_PALMLD_BL_POWER);
294err:
295 return ret;
296}
297
298static int palmld_backlight_notify(int brightness)
299{
300 gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness);
301 gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness);
302 return brightness;
303}
304
305static void palmld_backlight_exit(struct device *dev)
306{
307 gpio_free(GPIO_NR_PALMLD_BL_POWER);
308 gpio_free(GPIO_NR_PALMLD_LCD_POWER);
309}
310
311static struct platform_pwm_backlight_data palmld_backlight_data = {
312 .pwm_id = 0,
313 .max_brightness = PALMLD_MAX_INTENSITY,
314 .dft_brightness = PALMLD_MAX_INTENSITY,
315 .pwm_period_ns = PALMLD_PERIOD_NS,
316 .init = palmld_backlight_init,
317 .notify = palmld_backlight_notify,
318 .exit = palmld_backlight_exit,
319};
320
321static struct platform_device palmld_backlight = {
322 .name = "pwm-backlight",
323 .dev = {
324 .parent = &pxa27x_device_pwm0.dev,
325 .platform_data = &palmld_backlight_data,
326 },
327};
328
329/******************************************************************************
330 * IrDA
331 ******************************************************************************/
332static int palmld_irda_startup(struct device *dev)
333{
334 int err;
335 err = gpio_request(GPIO_NR_PALMLD_IR_DISABLE, "IR DISABLE");
336 if (err)
337 goto err;
338 err = gpio_direction_output(GPIO_NR_PALMLD_IR_DISABLE, 1);
339 if (err)
340 gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
341err:
342 return err;
343}
344
345static void palmld_irda_shutdown(struct device *dev)
346{
347 gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
348}
349
350static void palmld_irda_transceiver_mode(struct device *dev, int mode)
351{
352 gpio_set_value(GPIO_NR_PALMLD_IR_DISABLE, mode & IR_OFF);
353 pxa2xx_transceiver_mode(dev, mode);
354}
355
356static struct pxaficp_platform_data palmld_ficp_platform_data = {
357 .startup = palmld_irda_startup,
358 .shutdown = palmld_irda_shutdown,
359 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
360 .transceiver_mode = palmld_irda_transceiver_mode,
361};
362
363/******************************************************************************
364 * LEDs
365 ******************************************************************************/
366struct gpio_led gpio_leds[] = {
367{
368 .name = "palmld:green:led",
369 .default_trigger = "none",
370 .gpio = GPIO_NR_PALMLD_LED_GREEN,
371}, {
372 .name = "palmld:amber:led",
373 .default_trigger = "none",
374 .gpio = GPIO_NR_PALMLD_LED_AMBER,
375},
376};
377
378static struct gpio_led_platform_data gpio_led_info = {
379 .leds = gpio_leds,
380 .num_leds = ARRAY_SIZE(gpio_leds),
381};
382
383static struct platform_device palmld_leds = {
384 .name = "leds-gpio",
385 .id = -1,
386 .dev = {
387 .platform_data = &gpio_led_info,
388 }
389};
390
391/******************************************************************************
392 * Power supply
393 ******************************************************************************/
394static int power_supply_init(struct device *dev)
395{
396 int ret;
397
398 ret = gpio_request(GPIO_NR_PALMLD_POWER_DETECT, "CABLE_STATE_AC");
399 if (ret)
400 goto err1;
401 ret = gpio_direction_input(GPIO_NR_PALMLD_POWER_DETECT);
402 if (ret)
403 goto err2;
404
405 ret = gpio_request(GPIO_NR_PALMLD_USB_DETECT_N, "CABLE_STATE_USB");
406 if (ret)
407 goto err2;
408 ret = gpio_direction_input(GPIO_NR_PALMLD_USB_DETECT_N);
409 if (ret)
410 goto err3;
411
412 return 0;
413
414err3:
415 gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
416err2:
417 gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
418err1:
419 return ret;
420}
421
422static int palmld_is_ac_online(void)
423{
424 return gpio_get_value(GPIO_NR_PALMLD_POWER_DETECT);
425}
426
427static int palmld_is_usb_online(void)
428{
429 return !gpio_get_value(GPIO_NR_PALMLD_USB_DETECT_N);
430}
431
432static void power_supply_exit(struct device *dev)
433{
434 gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
435 gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
436}
437
438static char *palmld_supplicants[] = {
439 "main-battery",
440};
441
442static struct pda_power_pdata power_supply_info = {
443 .init = power_supply_init,
444 .is_ac_online = palmld_is_ac_online,
445 .is_usb_online = palmld_is_usb_online,
446 .exit = power_supply_exit,
447 .supplied_to = palmld_supplicants,
448 .num_supplicants = ARRAY_SIZE(palmld_supplicants),
449};
450
451static struct platform_device power_supply = {
452 .name = "pda-power",
453 .id = -1,
454 .dev = {
455 .platform_data = &power_supply_info,
456 },
457};
458
459/******************************************************************************
460 * WM97xx battery
461 ******************************************************************************/
462static struct wm97xx_batt_info wm97xx_batt_pdata = {
463 .batt_aux = WM97XX_AUX_ID3,
464 .temp_aux = WM97XX_AUX_ID2,
465 .charge_gpio = -1,
466 .max_voltage = PALMLD_BAT_MAX_VOLTAGE,
467 .min_voltage = PALMLD_BAT_MIN_VOLTAGE,
468 .batt_mult = 1000,
469 .batt_div = 414,
470 .temp_mult = 1,
471 .temp_div = 1,
472 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
473 .batt_name = "main-batt",
474};
475
476/******************************************************************************
477 * aSoC audio
478 ******************************************************************************/
479static struct palm27x_asoc_info palm27x_asoc_pdata = {
480 .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT,
481};
482
483/******************************************************************************
484 * Framebuffer
485 ******************************************************************************/
486static struct pxafb_mode_info palmld_lcd_modes[] = {
487{
488 .pixclock = 57692,
489 .xres = 320,
490 .yres = 480,
491 .bpp = 16,
492
493 .left_margin = 32,
494 .right_margin = 1,
495 .upper_margin = 7,
496 .lower_margin = 1,
497
498 .hsync_len = 4,
499 .vsync_len = 1,
500},
501};
502
503static struct pxafb_mach_info palmld_lcd_screen = {
504 .modes = palmld_lcd_modes,
505 .num_modes = ARRAY_SIZE(palmld_lcd_modes),
506 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
507};
508
509/******************************************************************************
510 * Machine init
511 ******************************************************************************/
512static struct platform_device *devices[] __initdata = {
513#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
514 &palmld_pxa_keys,
515#endif
516 &palmld_backlight,
517 &palmld_leds,
518 &power_supply,
519};
520
521static struct map_desc palmld_io_desc[] __initdata = {
522{
523 .virtual = PALMLD_IDE_VIRT,
524 .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
525 .length = PALMLD_IDE_SIZE,
526 .type = MT_DEVICE
527},
528{
529 .virtual = PALMLD_USB_VIRT,
530 .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
531 .length = PALMLD_USB_SIZE,
532 .type = MT_DEVICE
533},
534};
535
536static void __init palmld_map_io(void)
537{
538 pxa_map_io();
539 iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
540}
541
542static void __init palmld_init(void)
543{
544 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
545
546 set_pxa_fb_info(&palmld_lcd_screen);
547 pxa_set_mci_info(&palmld_mci_platform_data);
548 pxa_set_ac97_info(NULL);
549 pxa_set_ficp_info(&palmld_ficp_platform_data);
550 pxa_set_keypad_info(&palmld_keypad_platform_data);
551 wm97xx_bat_set_pdata(&wm97xx_batt_pdata);
552 palm27x_asoc_set_pdata(&palm27x_asoc_pdata);
553
554 platform_add_devices(devices, ARRAY_SIZE(devices));
555}
556
557MACHINE_START(PALMLD, "Palm LifeDrive")
558 .phys_io = PALMLD_PHYS_IO_START,
559 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
560 .boot_params = 0xa0000100,
561 .map_io = palmld_map_io,
562 .init_irq = pxa27x_init_irq,
563 .timer = &pxa_timer,
564 .init_machine = palmld_init
565MACHINE_END
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
new file mode 100644
index 000000000000..9521c7b33492
--- /dev/null
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -0,0 +1,496 @@
1/*
2 * Hardware definitions for Palm Tungsten|T5
3 *
4 * Author: Marek Vasut <marek.vasut@gmail.com>
5 *
6 * Based on work of:
7 * Ales Snuparek <snuparek@atlas.cz>
8 * Justin Kendrick <twilightsentry@gmail.com>
9 * RichardT5 <richard_t5@users.sourceforge.net>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * (find more info at www.hackndev.com)
16 *
17 */
18
19#include <linux/platform_device.h>
20#include <linux/delay.h>
21#include <linux/irq.h>
22#include <linux/gpio_keys.h>
23#include <linux/input.h>
24#include <linux/pda_power.h>
25#include <linux/pwm_backlight.h>
26#include <linux/gpio.h>
27#include <linux/wm97xx_batt.h>
28#include <linux/power_supply.h>
29
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33
34#include <mach/pxa27x.h>
35#include <mach/audio.h>
36#include <mach/palmt5.h>
37#include <mach/mmc.h>
38#include <mach/pxafb.h>
39#include <mach/irda.h>
40#include <mach/pxa27x_keypad.h>
41#include <mach/udc.h>
42#include <mach/palmasoc.h>
43
44#include "generic.h"
45#include "devices.h"
46
47/******************************************************************************
48 * Pin configuration
49 ******************************************************************************/
50static unsigned long palmt5_pin_config[] __initdata = {
51 /* MMC */
52 GPIO32_MMC_CLK,
53 GPIO92_MMC_DAT_0,
54 GPIO109_MMC_DAT_1,
55 GPIO110_MMC_DAT_2,
56 GPIO111_MMC_DAT_3,
57 GPIO112_MMC_CMD,
58 GPIO14_GPIO, /* SD detect */
59 GPIO114_GPIO, /* SD power */
60 GPIO115_GPIO, /* SD r/o switch */
61
62 /* AC97 */
63 GPIO28_AC97_BITCLK,
64 GPIO29_AC97_SDATA_IN_0,
65 GPIO30_AC97_SDATA_OUT,
66 GPIO31_AC97_SYNC,
67
68 /* IrDA */
69 GPIO40_GPIO, /* ir disable */
70 GPIO46_FICP_RXD,
71 GPIO47_FICP_TXD,
72
73 /* USB */
74 GPIO15_GPIO, /* usb detect */
75 GPIO95_GPIO, /* usb power */
76
77 /* MATRIX KEYPAD */
78 GPIO100_KP_MKIN_0,
79 GPIO101_KP_MKIN_1,
80 GPIO102_KP_MKIN_2,
81 GPIO97_KP_MKIN_3,
82 GPIO103_KP_MKOUT_0,
83 GPIO104_KP_MKOUT_1,
84 GPIO105_KP_MKOUT_2,
85
86 /* LCD */
87 GPIO58_LCD_LDD_0,
88 GPIO59_LCD_LDD_1,
89 GPIO60_LCD_LDD_2,
90 GPIO61_LCD_LDD_3,
91 GPIO62_LCD_LDD_4,
92 GPIO63_LCD_LDD_5,
93 GPIO64_LCD_LDD_6,
94 GPIO65_LCD_LDD_7,
95 GPIO66_LCD_LDD_8,
96 GPIO67_LCD_LDD_9,
97 GPIO68_LCD_LDD_10,
98 GPIO69_LCD_LDD_11,
99 GPIO70_LCD_LDD_12,
100 GPIO71_LCD_LDD_13,
101 GPIO72_LCD_LDD_14,
102 GPIO73_LCD_LDD_15,
103 GPIO74_LCD_FCLK,
104 GPIO75_LCD_LCLK,
105 GPIO76_LCD_PCLK,
106 GPIO77_LCD_BIAS,
107
108 /* PWM */
109 GPIO16_PWM0_OUT,
110
111 /* MISC */
112 GPIO10_GPIO, /* hotsync button */
113 GPIO90_GPIO, /* power detect */
114 GPIO107_GPIO, /* earphone detect */
115};
116
117/******************************************************************************
118 * SD/MMC card controller
119 ******************************************************************************/
120static int palmt5_mci_init(struct device *dev, irq_handler_t palmt5_detect_int,
121 void *data)
122{
123 int err = 0;
124
125 /* Setup an interrupt for detecting card insert/remove events */
126 err = gpio_request(GPIO_NR_PALMT5_SD_DETECT_N, "SD IRQ");
127 if (err)
128 goto err;
129 err = gpio_direction_input(GPIO_NR_PALMT5_SD_DETECT_N);
130 if (err)
131 goto err2;
132 err = request_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N),
133 palmt5_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
134 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
135 "SD/MMC card detect", data);
136 if (err) {
137 printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n",
138 __func__);
139 goto err2;
140 }
141
142 err = gpio_request(GPIO_NR_PALMT5_SD_POWER, "SD_POWER");
143 if (err)
144 goto err3;
145 err = gpio_direction_output(GPIO_NR_PALMT5_SD_POWER, 0);
146 if (err)
147 goto err4;
148
149 err = gpio_request(GPIO_NR_PALMT5_SD_READONLY, "SD_READONLY");
150 if (err)
151 goto err4;
152 err = gpio_direction_input(GPIO_NR_PALMT5_SD_READONLY);
153 if (err)
154 goto err5;
155
156 printk(KERN_DEBUG "%s: irq registered\n", __func__);
157
158 return 0;
159
160err5:
161 gpio_free(GPIO_NR_PALMT5_SD_READONLY);
162err4:
163 gpio_free(GPIO_NR_PALMT5_SD_POWER);
164err3:
165 free_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), data);
166err2:
167 gpio_free(GPIO_NR_PALMT5_SD_DETECT_N);
168err:
169 return err;
170}
171
172static void palmt5_mci_exit(struct device *dev, void *data)
173{
174 gpio_free(GPIO_NR_PALMT5_SD_READONLY);
175 gpio_free(GPIO_NR_PALMT5_SD_POWER);
176 free_irq(IRQ_GPIO_PALMT5_SD_DETECT_N, data);
177 gpio_free(GPIO_NR_PALMT5_SD_DETECT_N);
178}
179
180static void palmt5_mci_power(struct device *dev, unsigned int vdd)
181{
182 struct pxamci_platform_data *p_d = dev->platform_data;
183 gpio_set_value(GPIO_NR_PALMT5_SD_POWER, p_d->ocr_mask & (1 << vdd));
184}
185
186static int palmt5_mci_get_ro(struct device *dev)
187{
188 return gpio_get_value(GPIO_NR_PALMT5_SD_READONLY);
189}
190
191static struct pxamci_platform_data palmt5_mci_platform_data = {
192 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
193 .setpower = palmt5_mci_power,
194 .get_ro = palmt5_mci_get_ro,
195 .init = palmt5_mci_init,
196 .exit = palmt5_mci_exit,
197};
198
199/******************************************************************************
200 * GPIO keyboard
201 ******************************************************************************/
202static unsigned int palmt5_matrix_keys[] = {
203 KEY(0, 0, KEY_POWER),
204 KEY(0, 1, KEY_F1),
205 KEY(0, 2, KEY_ENTER),
206
207 KEY(1, 0, KEY_F2),
208 KEY(1, 1, KEY_F3),
209 KEY(1, 2, KEY_F4),
210
211 KEY(2, 0, KEY_UP),
212 KEY(2, 2, KEY_DOWN),
213
214 KEY(3, 0, KEY_RIGHT),
215 KEY(3, 2, KEY_LEFT),
216};
217
218static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
219 .matrix_key_rows = 4,
220 .matrix_key_cols = 3,
221 .matrix_key_map = palmt5_matrix_keys,
222 .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys),
223
224 .debounce_interval = 30,
225};
226
227/******************************************************************************
228 * GPIO keys
229 ******************************************************************************/
230static struct gpio_keys_button palmt5_pxa_buttons[] = {
231 {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
232};
233
234static struct gpio_keys_platform_data palmt5_pxa_keys_data = {
235 .buttons = palmt5_pxa_buttons,
236 .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons),
237};
238
239static struct platform_device palmt5_pxa_keys = {
240 .name = "gpio-keys",
241 .id = -1,
242 .dev = {
243 .platform_data = &palmt5_pxa_keys_data,
244 },
245};
246
247/******************************************************************************
248 * Backlight
249 ******************************************************************************/
250static int palmt5_backlight_init(struct device *dev)
251{
252 int ret;
253
254 ret = gpio_request(GPIO_NR_PALMT5_BL_POWER, "BL POWER");
255 if (ret)
256 goto err;
257 ret = gpio_direction_output(GPIO_NR_PALMT5_BL_POWER, 0);
258 if (ret)
259 goto err2;
260 ret = gpio_request(GPIO_NR_PALMT5_LCD_POWER, "LCD POWER");
261 if (ret)
262 goto err2;
263 ret = gpio_direction_output(GPIO_NR_PALMT5_LCD_POWER, 0);
264 if (ret)
265 goto err3;
266
267 return 0;
268err3:
269 gpio_free(GPIO_NR_PALMT5_LCD_POWER);
270err2:
271 gpio_free(GPIO_NR_PALMT5_BL_POWER);
272err:
273 return ret;
274}
275
276static int palmt5_backlight_notify(int brightness)
277{
278 gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness);
279 gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness);
280 return brightness;
281}
282
283static void palmt5_backlight_exit(struct device *dev)
284{
285 gpio_free(GPIO_NR_PALMT5_BL_POWER);
286 gpio_free(GPIO_NR_PALMT5_LCD_POWER);
287}
288
289static struct platform_pwm_backlight_data palmt5_backlight_data = {
290 .pwm_id = 0,
291 .max_brightness = PALMT5_MAX_INTENSITY,
292 .dft_brightness = PALMT5_MAX_INTENSITY,
293 .pwm_period_ns = PALMT5_PERIOD_NS,
294 .init = palmt5_backlight_init,
295 .notify = palmt5_backlight_notify,
296 .exit = palmt5_backlight_exit,
297};
298
299static struct platform_device palmt5_backlight = {
300 .name = "pwm-backlight",
301 .dev = {
302 .parent = &pxa27x_device_pwm0.dev,
303 .platform_data = &palmt5_backlight_data,
304 },
305};
306
307/******************************************************************************
308 * IrDA
309 ******************************************************************************/
310static int palmt5_irda_startup(struct device *dev)
311{
312 int err;
313 err = gpio_request(GPIO_NR_PALMT5_IR_DISABLE, "IR DISABLE");
314 if (err)
315 goto err;
316 err = gpio_direction_output(GPIO_NR_PALMT5_IR_DISABLE, 1);
317 if (err)
318 gpio_free(GPIO_NR_PALMT5_IR_DISABLE);
319err:
320 return err;
321}
322
323static void palmt5_irda_shutdown(struct device *dev)
324{
325 gpio_free(GPIO_NR_PALMT5_IR_DISABLE);
326}
327
328static void palmt5_irda_transceiver_mode(struct device *dev, int mode)
329{
330 gpio_set_value(GPIO_NR_PALMT5_IR_DISABLE, mode & IR_OFF);
331 pxa2xx_transceiver_mode(dev, mode);
332}
333
334static struct pxaficp_platform_data palmt5_ficp_platform_data = {
335 .startup = palmt5_irda_startup,
336 .shutdown = palmt5_irda_shutdown,
337 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
338 .transceiver_mode = palmt5_irda_transceiver_mode,
339};
340
341/******************************************************************************
342 * UDC
343 ******************************************************************************/
344static struct pxa2xx_udc_mach_info palmt5_udc_info __initdata = {
345 .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N,
346 .gpio_vbus_inverted = 1,
347 .gpio_pullup = GPIO_NR_PALMT5_USB_POWER,
348 .gpio_pullup_inverted = 0,
349};
350
351/******************************************************************************
352 * Power supply
353 ******************************************************************************/
354static int power_supply_init(struct device *dev)
355{
356 int ret;
357
358 ret = gpio_request(GPIO_NR_PALMT5_POWER_DETECT, "CABLE_STATE_AC");
359 if (ret)
360 goto err1;
361 ret = gpio_direction_input(GPIO_NR_PALMT5_POWER_DETECT);
362 if (ret)
363 goto err2;
364
365 return 0;
366err2:
367 gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
368err1:
369 return ret;
370}
371
372static int palmt5_is_ac_online(void)
373{
374 return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT);
375}
376
377static void power_supply_exit(struct device *dev)
378{
379 gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
380}
381
382static char *palmt5_supplicants[] = {
383 "main-battery",
384};
385
386static struct pda_power_pdata power_supply_info = {
387 .init = power_supply_init,
388 .is_ac_online = palmt5_is_ac_online,
389 .exit = power_supply_exit,
390 .supplied_to = palmt5_supplicants,
391 .num_supplicants = ARRAY_SIZE(palmt5_supplicants),
392};
393
394static struct platform_device power_supply = {
395 .name = "pda-power",
396 .id = -1,
397 .dev = {
398 .platform_data = &power_supply_info,
399 },
400};
401
402/******************************************************************************
403 * WM97xx battery
404 ******************************************************************************/
405static struct wm97xx_batt_info wm97xx_batt_pdata = {
406 .batt_aux = WM97XX_AUX_ID3,
407 .temp_aux = WM97XX_AUX_ID2,
408 .charge_gpio = -1,
409 .max_voltage = PALMT5_BAT_MAX_VOLTAGE,
410 .min_voltage = PALMT5_BAT_MIN_VOLTAGE,
411 .batt_mult = 1000,
412 .batt_div = 414,
413 .temp_mult = 1,
414 .temp_div = 1,
415 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
416 .batt_name = "main-batt",
417};
418
419/******************************************************************************
420 * aSoC audio
421 ******************************************************************************/
422static struct palm27x_asoc_info palm27x_asoc_pdata = {
423 .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT,
424};
425
426/******************************************************************************
427 * Framebuffer
428 ******************************************************************************/
429static struct pxafb_mode_info palmt5_lcd_modes[] = {
430{
431 .pixclock = 57692,
432 .xres = 320,
433 .yres = 480,
434 .bpp = 16,
435
436 .left_margin = 32,
437 .right_margin = 1,
438 .upper_margin = 7,
439 .lower_margin = 1,
440
441 .hsync_len = 4,
442 .vsync_len = 1,
443},
444};
445
446static struct pxafb_mach_info palmt5_lcd_screen = {
447 .modes = palmt5_lcd_modes,
448 .num_modes = ARRAY_SIZE(palmt5_lcd_modes),
449 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
450};
451
452/******************************************************************************
453 * Machine init
454 ******************************************************************************/
455static struct platform_device *devices[] __initdata = {
456#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
457 &palmt5_pxa_keys,
458#endif
459 &palmt5_backlight,
460 &power_supply,
461};
462
463/* setup udc GPIOs initial state */
464static void __init palmt5_udc_init(void)
465{
466 if (!gpio_request(GPIO_NR_PALMT5_USB_POWER, "UDC Vbus")) {
467 gpio_direction_output(GPIO_NR_PALMT5_USB_POWER, 1);
468 gpio_free(GPIO_NR_PALMT5_USB_POWER);
469 }
470}
471
472static void __init palmt5_init(void)
473{
474 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
475
476 set_pxa_fb_info(&palmt5_lcd_screen);
477 pxa_set_mci_info(&palmt5_mci_platform_data);
478 palmt5_udc_init();
479 pxa_set_udc_info(&palmt5_udc_info);
480 pxa_set_ac97_info(NULL);
481 pxa_set_ficp_info(&palmt5_ficp_platform_data);
482 pxa_set_keypad_info(&palmt5_keypad_platform_data);
483 wm97xx_bat_set_pdata(&wm97xx_batt_pdata);
484 palm27x_asoc_set_pdata(&palm27x_asoc_pdata);
485 platform_add_devices(devices, ARRAY_SIZE(devices));
486}
487
488MACHINE_START(PALMT5, "Palm Tungsten|T5")
489 .phys_io = PALMT5_PHYS_IO_START,
490 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
491 .boot_params = 0xa0000100,
492 .map_io = pxa_map_io,
493 .init_irq = pxa27x_init_irq,
494 .timer = &pxa_timer,
495 .init_machine = palmt5_init
496MACHINE_END
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index a9d94f5dbec4..b490c0924619 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -32,12 +32,11 @@
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34 34
35#include <mach/pxa27x.h>
35#include <mach/audio.h> 36#include <mach/audio.h>
36#include <mach/palmtx.h> 37#include <mach/palmtx.h>
37#include <mach/mmc.h> 38#include <mach/mmc.h>
38#include <mach/pxafb.h> 39#include <mach/pxafb.h>
39#include <mach/pxa-regs.h>
40#include <mach/mfp-pxa27x.h>
41#include <mach/irda.h> 40#include <mach/irda.h>
42#include <mach/pxa27x_keypad.h> 41#include <mach/pxa27x_keypad.h>
43#include <mach/udc.h> 42#include <mach/udc.h>
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 2f730da3bba8..b88eb4dd2c84 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -33,13 +33,11 @@
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <mach/pxa27x.h>
36#include <mach/audio.h> 37#include <mach/audio.h>
37#include <mach/palmz72.h> 38#include <mach/palmz72.h>
38#include <mach/mmc.h> 39#include <mach/mmc.h>
39#include <mach/pxafb.h> 40#include <mach/pxafb.h>
40#include <mach/pxa-regs.h>
41#include <mach/pxa2xx-regs.h>
42#include <mach/mfp-pxa27x.h>
43#include <mach/irda.h> 41#include <mach/irda.h>
44#include <mach/pxa27x_keypad.h> 42#include <mach/pxa27x_keypad.h>
45#include <mach/udc.h> 43#include <mach/udc.h>
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c
index 36135a02fdc7..6abfa2979c61 100644
--- a/arch/arm/mach-pxa/pcm027.c
+++ b/arch/arm/mach-pxa/pcm027.c
@@ -29,10 +29,7 @@
29 29
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <mach/hardware.h> 32#include <mach/pxa27x.h>
33#include <mach/pxa-regs.h>
34#include <mach/mfp-pxa27x.h>
35#include <mach/pxa2xx-regs.h>
36#include <mach/pxa2xx_spi.h> 33#include <mach/pxa2xx_spi.h>
37#include <mach/pcm027.h> 34#include <mach/pcm027.h>
38#include "generic.h" 35#include "generic.h"
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 34841c72815f..f46698e20c1f 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -31,13 +31,12 @@
31#include <mach/i2c.h> 31#include <mach/i2c.h>
32#include <mach/camera.h> 32#include <mach/camera.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34#include <mach/pxa-regs.h> 34#include <mach/pxa27x.h>
35#include <mach/audio.h> 35#include <mach/audio.h>
36#include <mach/mmc.h> 36#include <mach/mmc.h>
37#include <mach/ohci.h> 37#include <mach/ohci.h>
38#include <mach/pcm990_baseboard.h> 38#include <mach/pcm990_baseboard.h>
39#include <mach/pxafb.h> 39#include <mach/pxafb.h>
40#include <mach/mfp-pxa27x.h>
41 40
42#include "devices.h" 41#include "devices.h"
43#include "generic.h" 42#include "generic.h"
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index 164eb0bb6321..884b174c8ead 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -14,15 +14,8 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/suspend.h> 15#include <linux/suspend.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/time.h>
18 17
19#include <mach/hardware.h>
20#include <asm/memory.h>
21#include <asm/system.h>
22#include <mach/pm.h> 18#include <mach/pm.h>
23#include <mach/pxa-regs.h>
24#include <mach/lubbock.h>
25#include <asm/mach/time.h>
26 19
27struct pxa_cpu_pm_fns *pxa_cpu_pm_fns; 20struct pxa_cpu_pm_fns *pxa_cpu_pm_fns;
28static unsigned long *sleep_save; 21static unsigned long *sleep_save;
@@ -57,9 +50,9 @@ int pxa_pm_enter(suspend_state_t state)
57 50
58 /* if invalid, display message and wait for a hardware reset */ 51 /* if invalid, display message and wait for a hardware reset */
59 if (checksum != sleep_save_checksum) { 52 if (checksum != sleep_save_checksum) {
60#ifdef CONFIG_ARCH_LUBBOCK 53
61 LUB_HEXLED = 0xbadbadc5; 54 lubbock_set_hexled(0xbadbadc5);
62#endif 55
63 while (1) 56 while (1)
64 pxa_cpu_pm_fns->enter(state); 57 pxa_cpu_pm_fns->enter(state);
65 } 58 }
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index f9093beba752..036bbde4d221 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -36,9 +36,7 @@
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
38 38
39#include <mach/pxa-regs.h> 39#include <mach/pxa25x.h>
40#include <mach/pxa2xx-regs.h>
41#include <mach/mfp-pxa25x.h>
42#include <mach/mmc.h> 40#include <mach/mmc.h>
43#include <mach/udc.h> 41#include <mach/udc.h>
44#include <mach/i2c.h> 42#include <mach/i2c.h>
@@ -503,12 +501,12 @@ static struct platform_device *devices[] __initdata = {
503 501
504static void poodle_poweroff(void) 502static void poodle_poweroff(void)
505{ 503{
506 arm_machine_restart('h'); 504 arm_machine_restart('h', NULL);
507} 505}
508 506
509static void poodle_restart(char mode) 507static void poodle_restart(char mode, const char *cmd)
510{ 508{
511 arm_machine_restart('h'); 509 arm_machine_restart('h', cmd);
512} 510}
513 511
514static void __init poodle_init(void) 512static void __init poodle_init(void)
diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c
index 3ca7ffc6904b..fcdd374437a8 100644
--- a/arch/arm/mach-pxa/pwm.c
+++ b/arch/arm/mach-pxa/pwm.c
@@ -20,7 +20,6 @@
20#include <linux/pwm.h> 20#include <linux/pwm.h>
21 21
22#include <asm/div64.h> 22#include <asm/div64.h>
23#include <mach/pxa-regs.h>
24 23
25/* PWM registers and bits definitions */ 24/* PWM registers and bits definitions */
26#define PWMCR (0x00) 25#define PWMCR (0x00)
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 6c57522e2469..77c2693cfeef 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -25,9 +25,8 @@
25 25
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28#include <mach/pxa-regs.h> 28#include <mach/gpio.h>
29#include <mach/pxa2xx-regs.h> 29#include <mach/pxa25x.h>
30#include <mach/mfp-pxa25x.h>
31#include <mach/reset.h> 30#include <mach/reset.h>
32#include <mach/pm.h> 31#include <mach/pm.h>
33#include <mach/dma.h> 32#include <mach/dma.h>
@@ -310,14 +309,14 @@ set_pwer:
310void __init pxa25x_init_irq(void) 309void __init pxa25x_init_irq(void)
311{ 310{
312 pxa_init_irq(32, pxa25x_set_wake); 311 pxa_init_irq(32, pxa25x_set_wake);
313 pxa_init_gpio(85, pxa25x_set_wake); 312 pxa_init_gpio(IRQ_GPIO_2_x, 2, 84, pxa25x_set_wake);
314} 313}
315 314
316#ifdef CONFIG_CPU_PXA26x 315#ifdef CONFIG_CPU_PXA26x
317void __init pxa26x_init_irq(void) 316void __init pxa26x_init_irq(void)
318{ 317{
319 pxa_init_irq(32, pxa25x_set_wake); 318 pxa_init_irq(32, pxa25x_set_wake);
320 pxa_init_gpio(90, pxa25x_set_wake); 319 pxa_init_gpio(IRQ_GPIO_2_x, 2, 89, pxa25x_set_wake);
321} 320}
322#endif 321#endif
323 322
@@ -355,7 +354,7 @@ static int __init pxa25x_init(void)
355 354
356 clks_register(pxa25x_clkregs, ARRAY_SIZE(pxa25x_clkregs)); 355 clks_register(pxa25x_clkregs, ARRAY_SIZE(pxa25x_clkregs));
357 356
358 if ((ret = pxa_init_dma(16))) 357 if ((ret = pxa_init_dma(IRQ_DMA, 16)))
359 return ret; 358 return ret;
360 359
361 pxa25x_init_pm(); 360 pxa25x_init_pm();
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 411bec54fdc4..a425ec71e657 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -21,9 +21,8 @@
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24#include <mach/pxa-regs.h> 24#include <mach/gpio.h>
25#include <mach/pxa2xx-regs.h> 25#include <mach/pxa27x.h>
26#include <mach/mfp-pxa27x.h>
27#include <mach/reset.h> 26#include <mach/reset.h>
28#include <mach/ohci.h> 27#include <mach/ohci.h>
29#include <mach/pm.h> 28#include <mach/pm.h>
@@ -332,7 +331,7 @@ static int pxa27x_set_wake(unsigned int irq, unsigned int on)
332void __init pxa27x_init_irq(void) 331void __init pxa27x_init_irq(void)
333{ 332{
334 pxa_init_irq(34, pxa27x_set_wake); 333 pxa_init_irq(34, pxa27x_set_wake);
335 pxa_init_gpio(121, pxa27x_set_wake); 334 pxa_init_gpio(IRQ_GPIO_2_x, 2, 120, pxa27x_set_wake);
336} 335}
337 336
338/* 337/*
@@ -381,7 +380,7 @@ static int __init pxa27x_init(void)
381 380
382 clks_register(pxa27x_clkregs, ARRAY_SIZE(pxa27x_clkregs)); 381 clks_register(pxa27x_clkregs, ARRAY_SIZE(pxa27x_clkregs));
383 382
384 if ((ret = pxa_init_dma(32))) 383 if ((ret = pxa_init_dma(IRQ_DMA, 32)))
385 return ret; 384 return ret;
386 385
387 pxa27x_init_pm(); 386 pxa27x_init_pm();
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
index 73d04d81c75a..2f3394f85917 100644
--- a/arch/arm/mach-pxa/pxa2xx.c
+++ b/arch/arm/mach-pxa/pxa2xx.c
@@ -16,7 +16,6 @@
16 16
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <mach/pxa2xx-regs.h> 18#include <mach/pxa2xx-regs.h>
19#include <mach/mfp-pxa2xx.h>
20#include <mach/mfp-pxa25x.h> 19#include <mach/mfp-pxa25x.h>
21#include <mach/reset.h> 20#include <mach/reset.h>
22#include <mach/irda.h> 21#include <mach/irda.h>
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index 83fb609b6eb7..4ba6d21f851c 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -17,15 +17,13 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <mach/hardware.h> 20#include <mach/pxa300.h>
21#include <mach/pxa3xx-regs.h>
22#include <mach/mfp-pxa300.h>
23 21
24#include "generic.h" 22#include "generic.h"
25#include "devices.h" 23#include "devices.h"
26#include "clock.h" 24#include "clock.h"
27 25
28static struct pxa3xx_mfp_addr_map pxa300_mfp_addr_map[] __initdata = { 26static struct mfp_addr_map pxa300_mfp_addr_map[] __initdata = {
29 27
30 MFP_ADDR_X(GPIO0, GPIO2, 0x00b4), 28 MFP_ADDR_X(GPIO0, GPIO2, 0x00b4),
31 MFP_ADDR_X(GPIO3, GPIO26, 0x027c), 29 MFP_ADDR_X(GPIO3, GPIO26, 0x027c),
@@ -74,7 +72,7 @@ static struct pxa3xx_mfp_addr_map pxa300_mfp_addr_map[] __initdata = {
74}; 72};
75 73
76/* override pxa300 MFP register addresses */ 74/* override pxa300 MFP register addresses */
77static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = { 75static struct mfp_addr_map pxa310_mfp_addr_map[] __initdata = {
78 MFP_ADDR_X(GPIO30, GPIO98, 0x0418), 76 MFP_ADDR_X(GPIO30, GPIO98, 0x0418),
79 MFP_ADDR_X(GPIO7_2, GPIO12_2, 0x052C), 77 MFP_ADDR_X(GPIO7_2, GPIO12_2, 0x052C),
80 78
@@ -100,13 +98,13 @@ static struct clk_lookup pxa310_clkregs[] = {
100static int __init pxa300_init(void) 98static int __init pxa300_init(void)
101{ 99{
102 if (cpu_is_pxa300() || cpu_is_pxa310()) { 100 if (cpu_is_pxa300() || cpu_is_pxa310()) {
103 pxa3xx_init_mfp(); 101 mfp_init_base(io_p2v(MFPR_BASE));
104 pxa3xx_mfp_init_addr(pxa300_mfp_addr_map); 102 mfp_init_addr(pxa300_mfp_addr_map);
105 clks_register(ARRAY_AND_SIZE(common_clkregs)); 103 clks_register(ARRAY_AND_SIZE(common_clkregs));
106 } 104 }
107 105
108 if (cpu_is_pxa310()) { 106 if (cpu_is_pxa310()) {
109 pxa3xx_mfp_init_addr(pxa310_mfp_addr_map); 107 mfp_init_addr(pxa310_mfp_addr_map);
110 clks_register(ARRAY_AND_SIZE(pxa310_clkregs)); 108 clks_register(ARRAY_AND_SIZE(pxa310_clkregs));
111 } 109 }
112 110
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 36f066196fa2..8b3d97efadab 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -17,16 +17,13 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <mach/hardware.h> 20#include <mach/pxa320.h>
21#include <mach/mfp.h>
22#include <mach/pxa3xx-regs.h>
23#include <mach/mfp-pxa320.h>
24 21
25#include "generic.h" 22#include "generic.h"
26#include "devices.h" 23#include "devices.h"
27#include "clock.h" 24#include "clock.h"
28 25
29static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = { 26static struct mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
30 27
31 MFP_ADDR_X(GPIO0, GPIO4, 0x0124), 28 MFP_ADDR_X(GPIO0, GPIO4, 0x0124),
32 MFP_ADDR_X(GPIO5, GPIO9, 0x028C), 29 MFP_ADDR_X(GPIO5, GPIO9, 0x028C),
@@ -89,8 +86,8 @@ static struct clk_lookup pxa320_clkregs[] = {
89static int __init pxa320_init(void) 86static int __init pxa320_init(void)
90{ 87{
91 if (cpu_is_pxa320()) { 88 if (cpu_is_pxa320()) {
92 pxa3xx_init_mfp(); 89 mfp_init_base(io_p2v(MFPR_BASE));
93 pxa3xx_mfp_init_addr(pxa320_mfp_addr_map); 90 mfp_init_addr(pxa320_mfp_addr_map);
94 clks_register(ARRAY_AND_SIZE(pxa320_clkregs)); 91 clks_register(ARRAY_AND_SIZE(pxa320_clkregs));
95 } 92 }
96 93
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 490893824e78..b02d4544dc95 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -23,6 +23,7 @@
23#include <linux/sysdev.h> 23#include <linux/sysdev.h>
24 24
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/gpio.h>
26#include <mach/pxa3xx-regs.h> 27#include <mach/pxa3xx-regs.h>
27#include <mach/reset.h> 28#include <mach/reset.h>
28#include <mach/ohci.h> 29#include <mach/ohci.h>
@@ -538,7 +539,7 @@ void __init pxa3xx_init_irq(void)
538 __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); 539 __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value));
539 540
540 pxa_init_irq(56, pxa3xx_set_wake); 541 pxa_init_irq(56, pxa3xx_set_wake);
541 pxa_init_gpio(128, NULL); 542 pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
542} 543}
543 544
544/* 545/*
@@ -594,7 +595,7 @@ static int __init pxa3xx_init(void)
594 595
595 clks_register(pxa3xx_clkregs, ARRAY_SIZE(pxa3xx_clkregs)); 596 clks_register(pxa3xx_clkregs, ARRAY_SIZE(pxa3xx_clkregs));
596 597
597 if ((ret = pxa_init_dma(32))) 598 if ((ret = pxa_init_dma(IRQ_DMA, 32)))
598 return ret; 599 return ret;
599 600
600 pxa3xx_init_pm(); 601 pxa3xx_init_pm();
diff --git a/arch/arm/mach-pxa/pxa930.c b/arch/arm/mach-pxa/pxa930.c
index 13e6bfdfff60..71131742fffd 100644
--- a/arch/arm/mach-pxa/pxa930.c
+++ b/arch/arm/mach-pxa/pxa930.c
@@ -16,10 +16,9 @@
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18 18
19#include <mach/hardware.h> 19#include <mach/pxa930.h>
20#include <mach/mfp-pxa930.h>
21 20
22static struct pxa3xx_mfp_addr_map pxa930_mfp_addr_map[] __initdata = { 21static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = {
23 22
24 MFP_ADDR(GPIO0, 0x02e0), 23 MFP_ADDR(GPIO0, 0x02e0),
25 MFP_ADDR(GPIO1, 0x02dc), 24 MFP_ADDR(GPIO1, 0x02dc),
@@ -180,8 +179,8 @@ static struct pxa3xx_mfp_addr_map pxa930_mfp_addr_map[] __initdata = {
180static int __init pxa930_init(void) 179static int __init pxa930_init(void)
181{ 180{
182 if (cpu_is_pxa930()) { 181 if (cpu_is_pxa930()) {
183 pxa3xx_init_mfp(); 182 mfp_init_base(io_p2v(MFPR_BASE));
184 pxa3xx_mfp_init_addr(pxa930_mfp_addr_map); 183 mfp_init_addr(pxa930_mfp_addr_map);
185 } 184 }
186 185
187 return 0; 186 return 0;
diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
index 00b2dc2a1074..df29d45fb4e7 100644
--- a/arch/arm/mach-pxa/reset.c
+++ b/arch/arm/mach-pxa/reset.c
@@ -10,7 +10,7 @@
10#include <linux/io.h> 10#include <linux/io.h>
11#include <asm/proc-fns.h> 11#include <asm/proc-fns.h>
12 12
13#include <mach/pxa-regs.h> 13#include <mach/regs-ost.h>
14#include <mach/reset.h> 14#include <mach/reset.h>
15 15
16unsigned int reset_status; 16unsigned int reset_status;
@@ -81,7 +81,7 @@ static void do_hw_reset(void)
81 OSMR3 = OSCR + 368640; /* ... in 100 ms */ 81 OSMR3 = OSCR + 368640; /* ... in 100 ms */
82} 82}
83 83
84void arch_reset(char mode) 84void arch_reset(char mode, const char *cmd)
85{ 85{
86 clear_reset_status(RESET_STATUS_ALL); 86 clear_reset_status(RESET_STATUS_ALL);
87 87
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index 5d02a7325586..ff8239991430 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -25,11 +25,9 @@
25 25
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <mach/hardware.h> 28
29#include <mach/pxa3xx-regs.h> 29#include <mach/pxa930.h>
30#include <mach/mfp-pxa930.h>
31#include <mach/i2c.h> 30#include <mach/i2c.h>
32#include <mach/regs-lcd.h>
33#include <mach/pxafb.h> 31#include <mach/pxafb.h>
34 32
35#include "devices.h" 33#include "devices.h"
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index f0845c1b001c..16b4ec67e3b6 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -25,7 +25,6 @@
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <mach/pm.h> 27#include <mach/pm.h>
28#include <mach/pxa-regs.h>
29#include <mach/pxa2xx-gpio.h> 28#include <mach/pxa2xx-gpio.h>
30#include <mach/sharpsl.h> 29#include <mach/sharpsl.h>
31#include "sharpsl.h" 30#include "sharpsl.h"
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index a62c8375eb53..2ed95f369cfc 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -15,7 +15,6 @@
15#include <asm/assembler.h> 15#include <asm/assembler.h>
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17 17
18#include <mach/pxa-regs.h>
19#include <mach/pxa2xx-regs.h> 18#include <mach/pxa2xx-regs.h>
20 19
21#define MDREFR_KDIV 0x200a4000 // all banks 20#define MDREFR_KDIV 0x200a4000 // all banks
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 0d62d311d41a..8c61ddac119e 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -44,9 +44,7 @@
44#include <asm/mach/map.h> 44#include <asm/mach/map.h>
45#include <asm/mach/irq.h> 45#include <asm/mach/irq.h>
46 46
47#include <mach/pxa-regs.h> 47#include <mach/pxa27x.h>
48#include <mach/pxa2xx-regs.h>
49#include <mach/mfp-pxa27x.h>
50#include <mach/pxa27x-udc.h> 48#include <mach/pxa27x-udc.h>
51#include <mach/reset.h> 49#include <mach/reset.h>
52#include <mach/i2c.h> 50#include <mach/i2c.h>
@@ -709,10 +707,10 @@ static struct platform_device *devices[] __initdata = {
709 707
710static void spitz_poweroff(void) 708static void spitz_poweroff(void)
711{ 709{
712 arm_machine_restart('g'); 710 arm_machine_restart('g', NULL);
713} 711}
714 712
715static void spitz_restart(char mode) 713static void spitz_restart(char mode, const char *cmd)
716{ 714{
717 /* Bootloader magic for a reboot */ 715 /* Bootloader magic for a reboot */
718 if((MSC0 & 0xffff0000) == 0x7ff00000) 716 if((MSC0 & 0xffff0000) == 0x7ff00000)
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 072e77cfe5a3..2e4490562c9e 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -24,7 +24,6 @@
24 24
25#include <mach/sharpsl.h> 25#include <mach/sharpsl.h>
26#include <mach/spitz.h> 26#include <mach/spitz.h>
27#include <mach/pxa-regs.h>
28#include <mach/pxa2xx-regs.h> 27#include <mach/pxa2xx-regs.h>
29#include <mach/pxa2xx-gpio.h> 28#include <mach/pxa2xx-gpio.h>
30#include "sharpsl.h" 29#include "sharpsl.h"
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 6f42004db3ed..965e38c6bafe 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -33,7 +33,6 @@
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/ssp.h> 35#include <mach/ssp.h>
36#include <mach/pxa-regs.h>
37#include <mach/regs-ssp.h> 36#include <mach/regs-ssp.h>
38 37
39#define TIMEOUT 100000 38#define TIMEOUT 100000
diff --git a/arch/arm/mach-pxa/standby.S b/arch/arm/mach-pxa/standby.S
index f3821cfda72f..29f5f5c180b7 100644
--- a/arch/arm/mach-pxa/standby.S
+++ b/arch/arm/mach-pxa/standby.S
@@ -13,7 +13,6 @@
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15 15
16#include <mach/pxa-regs.h>
17#include <mach/pxa2xx-regs.h> 16#include <mach/pxa2xx-regs.h>
18 17
19 .text 18 .text
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index 58ef08a5224b..b75353a2ec75 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -22,9 +22,8 @@
22 22
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <mach/hardware.h> 25
26#include <mach/pxa3xx-regs.h> 26#include <mach/pxa930.h>
27#include <mach/mfp-pxa930.h>
28#include <mach/pxafb.h> 27#include <mach/pxafb.h>
29#include <mach/pxa27x_keypad.h> 28#include <mach/pxa27x_keypad.h>
30 29
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 95656a72268d..8eb3830fbb0b 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -22,8 +22,7 @@
22#include <asm/div64.h> 22#include <asm/div64.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <mach/hardware.h> 25#include <mach/regs-ost.h>
26#include <mach/pxa-regs.h>
27 26
28/* 27/*
29 * This is PXA's sched_clock implementation. This has a resolution 28 * This is PXA's sched_clock implementation. This has a resolution
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 3332e5d0356c..6e8ade6ae339 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -36,8 +36,8 @@
36 36
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <mach/pxa2xx-regs.h> 39
40#include <mach/mfp-pxa25x.h> 40#include <mach/pxa25x.h>
41#include <mach/reset.h> 41#include <mach/reset.h>
42#include <mach/irda.h> 42#include <mach/irda.h>
43#include <mach/i2c.h> 43#include <mach/i2c.h>
@@ -876,10 +876,10 @@ static struct platform_device *devices[] __initdata = {
876 876
877static void tosa_poweroff(void) 877static void tosa_poweroff(void)
878{ 878{
879 arm_machine_restart('g'); 879 arm_machine_restart('g', NULL);
880} 880}
881 881
882static void tosa_restart(char mode) 882static void tosa_restart(char mode, const char *cmd)
883{ 883{
884 /* Bootloader magic for a reboot */ 884 /* Bootloader magic for a reboot */
885 if((MSC0 & 0xffff0000) == 0x7ff00000) 885 if((MSC0 & 0xffff0000) == 0x7ff00000)
@@ -919,7 +919,7 @@ static void __init tosa_init(void)
919 pxa2xx_set_spi_info(2, &pxa_ssp_master_info); 919 pxa2xx_set_spi_info(2, &pxa_ssp_master_info);
920 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); 920 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
921 921
922 clk_add_alias("CLK_CK3P6MI", &tc6393xb_device.dev, "GPIO11_CLK", NULL); 922 clk_add_alias("CLK_CK3P6MI", tc6393xb_device.name, "GPIO11_CLK", NULL);
923 923
924 platform_add_devices(devices, ARRAY_SIZE(devices)); 924 platform_add_devices(devices, ARRAY_SIZE(devices));
925} 925}
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index a72e3add743c..f79c9cb70ae4 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -39,10 +39,7 @@
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41 41
42#include <mach/hardware.h> 42#include <mach/pxa27x.h>
43#include <mach/pxa-regs.h>
44#include <mach/pxa2xx-regs.h>
45#include <mach/mfp-pxa27x.h>
46#include <mach/pxa2xx_spi.h> 43#include <mach/pxa2xx_spi.h>
47#include <mach/trizeps4.h> 44#include <mach/trizeps4.h>
48#include <mach/audio.h> 45#include <mach/audio.h>
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 4b3120dbc049..0e65344e9f53 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -42,12 +42,9 @@
42#include <linux/mtd/partitions.h> 42#include <linux/mtd/partitions.h>
43#include <linux/mtd/physmap.h> 43#include <linux/mtd/physmap.h>
44 44
45#include <mach/pxa-regs.h> 45#include <mach/pxa25x.h>
46#include <mach/pxa2xx-regs.h>
47#include <mach/bitfield.h>
48#include <mach/audio.h> 46#include <mach/audio.h>
49#include <mach/pxafb.h> 47#include <mach/pxafb.h>
50#include <mach/mfp-pxa25x.h>
51#include <mach/i2c.h> 48#include <mach/i2c.h>
52#include <mach/viper.h> 49#include <mach/viper.h>
53 50
@@ -956,7 +953,7 @@ static struct map_desc viper_io_desc[] __initdata = {
956 }, 953 },
957 { 954 {
958 .virtual = VIPER_PC104IO_BASE, 955 .virtual = VIPER_PC104IO_BASE,
959 .pfn = __phys_to_pfn(_PCMCIA1IO), 956 .pfn = __phys_to_pfn(0x30000000),
960 .length = 0x00800000, 957 .length = 0x00800000,
961 .type = MT_DEVICE, 958 .type = MT_DEVICE,
962 }, 959 },
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index 46538885a58a..c1f73205d078 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -18,9 +18,9 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/i2c/pca953x.h> 20#include <linux/i2c/pca953x.h>
21#include <linux/gpio.h>
21 22
22#include <asm/gpio.h> 23#include <mach/pxa300.h>
23#include <mach/mfp-pxa300.h>
24#include <mach/i2c.h> 24#include <mach/i2c.h>
25#include <mach/zylonite.h> 25#include <mach/zylonite.h>
26 26
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 28e4e623780b..4e1c488c6906 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20 20
21#include <mach/mfp-pxa320.h> 21#include <mach/pxa320.h>
22#include <mach/zylonite.h> 22#include <mach/zylonite.h>
23 23
24#include "generic.h" 24#include "generic.h"