aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig7
-rw-r--r--arch/arm/Makefile15
-rw-r--r--arch/arm/boot/Makefile2
-rw-r--r--arch/arm/common/Kconfig3
-rw-r--r--arch/arm/common/Makefile2
-rw-r--r--arch/arm/common/scoop.c2
-rw-r--r--arch/arm/common/sharpsl_pm.c839
-rw-r--r--arch/arm/configs/ixp4xx_defconfig84
-rw-r--r--arch/arm/kernel/Makefile5
-rw-r--r--arch/arm/kernel/apm.c19
-rw-r--r--arch/arm/kernel/dma-isa.c22
-rw-r--r--arch/arm/kernel/dma.c73
-rw-r--r--arch/arm/kernel/entry-armv.S2
-rw-r--r--arch/arm/kernel/head.S2
-rw-r--r--arch/arm/kernel/irq.c2
-rw-r--r--arch/arm/kernel/process.c3
-rw-r--r--arch/arm/kernel/setup.c2
-rw-r--r--arch/arm/kernel/time.c3
-rw-r--r--arch/arm/kernel/traps.c1
-rw-r--r--arch/arm/kernel/vmlinux.lds.S12
-rw-r--r--arch/arm/mach-aaec2000/clock.c13
-rw-r--r--arch/arm/mach-aaec2000/core.c2
-rw-r--r--arch/arm/mach-aaec2000/core.h2
-rw-r--r--arch/arm/mach-clps711x/dma.c27
-rw-r--r--arch/arm/mach-epxa10db/dma.c28
-rw-r--r--arch/arm/mach-footbridge/dma.c1
-rw-r--r--arch/arm/mach-imx/mx1ads.c55
-rw-r--r--arch/arm/mach-integrator/clock.c13
-rw-r--r--arch/arm/mach-integrator/core.c2
-rw-r--r--arch/arm/mach-integrator/dma.c35
-rw-r--r--arch/arm/mach-integrator/impd1.c4
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c4
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c6
-rw-r--r--arch/arm/mach-integrator/time.c2
-rw-r--r--arch/arm/mach-iop3xx/iop331-setup.c94
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig8
-rw-r--r--arch/arm/mach-ixp4xx/Makefile1
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c23
-rw-r--r--arch/arm/mach-ixp4xx/common.c20
-rw-r--r--arch/arm/mach-ixp4xx/coyote-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c10
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c15
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-pci.c5
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c13
-rw-r--r--arch/arm/mach-ixp4xx/ixdpg425-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-pci.c71
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-power.c67
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c135
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-pci.c8
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-power.c3
-rw-r--r--arch/arm/mach-omap1/board-palmte.c2
-rw-r--r--arch/arm/mach-omap1/clock.c2
-rw-r--r--arch/arm/mach-omap1/serial.c2
-rw-r--r--arch/arm/mach-omap2/clock.c2
-rw-r--r--arch/arm/mach-omap2/serial.c2
-rw-r--r--arch/arm/mach-omap2/timer-gp.c3
-rw-r--r--arch/arm/mach-pxa/Kconfig2
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c44
-rw-r--r--arch/arm/mach-pxa/mainstone.c6
-rw-r--r--arch/arm/mach-pxa/sharpsl.h101
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c824
-rw-r--r--arch/arm/mach-pxa/spitz.c35
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c46
-rw-r--r--arch/arm/mach-realview/clock.c13
-rw-r--r--arch/arm/mach-realview/core.c4
-rw-r--r--arch/arm/mach-realview/core.h3
-rw-r--r--arch/arm/mach-realview/realview_eb.c2
-rw-r--r--arch/arm/mach-rpc/dma.c19
-rw-r--r--arch/arm/mach-s3c2410/clock.c18
-rw-r--r--arch/arm/mach-s3c2410/clock.h1
-rw-r--r--arch/arm/mach-s3c2410/s3c2440-clock.c3
-rw-r--r--arch/arm/mach-s3c2410/s3c2440.c2
-rw-r--r--arch/arm/mach-s3c2410/time.c3
-rw-r--r--arch/arm/mach-sa1100/pm.c18
-rw-r--r--arch/arm/mach-versatile/clock.c13
-rw-r--r--arch/arm/mach-versatile/core.c4
-rw-r--r--arch/arm/mach-versatile/core.h2
-rw-r--r--arch/arm/mach-versatile/versatile_ab.c2
-rw-r--r--arch/arm/mach-versatile/versatile_pb.c2
-rw-r--r--arch/arm/mm/consistent.c1
-rw-r--r--arch/arm/mm/discontig.c4
-rw-r--r--arch/arm/mm/mm-armv.c1
-rw-r--r--arch/arm/plat-omap/clock.c2
-rw-r--r--arch/arm/plat-omap/common.c2
-rw-r--r--arch/arm/plat-omap/cpu-omap.c3
-rw-r--r--arch/arm/plat-omap/gpio.c2
-rw-r--r--arch/arm/plat-omap/mcbsp.c3
-rw-r--r--arch/arm/plat-omap/ocpi.c2
-rw-r--r--drivers/Makefile1
-rw-r--r--drivers/amba/Makefile2
-rw-r--r--drivers/amba/bus.c (renamed from arch/arm/common/amba.c)2
-rw-r--r--drivers/char/s3c2410-rtc.c2
-rw-r--r--drivers/char/watchdog/s3c2410_wdt.c4
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c4
-rw-r--r--drivers/input/serio/ambakmi.c15
-rw-r--r--drivers/mmc/mmci.c13
-rw-r--r--drivers/mtd/nand/s3c2410.c4
-rw-r--r--drivers/pcmcia/pxa2xx_sharpsl.c24
-rw-r--r--drivers/serial/amba-pl010.c4
-rw-r--r--drivers/serial/amba-pl011.c13
-rw-r--r--drivers/serial/s3c2410.c7
-rw-r--r--drivers/usb/host/ohci-omap.c2
-rw-r--r--drivers/usb/host/ohci-s3c2410.c4
-rw-r--r--drivers/video/amba-clcd.c16
-rw-r--r--drivers/video/backlight/corgi_bl.c1
-rw-r--r--drivers/video/imxfb.c6
-rw-r--r--drivers/video/s3c2410fb.c5
-rw-r--r--include/asm-arm/arch-aaec2000/dma.h8
-rw-r--r--include/asm-arm/arch-cl7500/dma.h1
-rw-r--r--include/asm-arm/arch-cl7500/entry-macro.S2
-rw-r--r--include/asm-arm/arch-clps711x/dma.h9
-rw-r--r--include/asm-arm/arch-clps711x/entry-macro.S1
-rw-r--r--include/asm-arm/arch-clps711x/system.h2
-rw-r--r--include/asm-arm/arch-ebsa110/dma.h8
-rw-r--r--include/asm-arm/arch-ebsa285/dma.h5
-rw-r--r--include/asm-arm/arch-ebsa285/entry-macro.S2
-rw-r--r--include/asm-arm/arch-epxa10db/dma.h9
-rw-r--r--include/asm-arm/arch-imx/dma.h4
-rw-r--r--include/asm-arm/arch-imx/entry-macro.S2
-rw-r--r--include/asm-arm/arch-integrator/debug-macro.S2
-rw-r--r--include/asm-arm/arch-integrator/dma.h9
-rw-r--r--include/asm-arm/arch-integrator/entry-macro.S2
-rw-r--r--include/asm-arm/arch-iop3xx/dma.h7
-rw-r--r--include/asm-arm/arch-iop3xx/entry-macro.S1
-rw-r--r--include/asm-arm/arch-ixp2000/dma.h9
-rw-r--r--include/asm-arm/arch-ixp2000/enp2611.h6
-rw-r--r--include/asm-arm/arch-ixp2000/entry-macro.S1
-rw-r--r--include/asm-arm/arch-ixp2000/io.h98
-rw-r--r--include/asm-arm/arch-ixp2000/ixp2000-regs.h8
-rw-r--r--include/asm-arm/arch-ixp4xx/coyote.h5
-rw-r--r--include/asm-arm/arch-ixp4xx/dma.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/entry-macro.S1
-rw-r--r--include/asm-arm/arch-ixp4xx/gtwx5715.h4
-rw-r--r--include/asm-arm/arch-ixp4xx/hardware.h1
-rw-r--r--include/asm-arm/arch-ixp4xx/irqs.h9
-rw-r--r--include/asm-arm/arch-ixp4xx/ixdp425.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/memory.h25
-rw-r--r--include/asm-arm/arch-ixp4xx/nas100d.h72
-rw-r--r--include/asm-arm/arch-ixp4xx/nslu2.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h24
-rw-r--r--include/asm-arm/arch-l7200/dma.h1
-rw-r--r--include/asm-arm/arch-l7200/system.h2
-rw-r--r--include/asm-arm/arch-lh7a40x/dma.h8
-rw-r--r--include/asm-arm/arch-lh7a40x/entry-macro.S2
-rw-r--r--include/asm-arm/arch-omap/dma.h3
-rw-r--r--include/asm-arm/arch-omap/entry-macro.S2
-rw-r--r--include/asm-arm/arch-omap/system.h3
-rw-r--r--include/asm-arm/arch-pxa/dma.h5
-rw-r--r--include/asm-arm/arch-pxa/entry-macro.S2
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h12
-rw-r--r--include/asm-arm/arch-realview/debug-macro.S2
-rw-r--r--include/asm-arm/arch-realview/dma.h7
-rw-r--r--include/asm-arm/arch-realview/entry-macro.S2
-rw-r--r--include/asm-arm/arch-rpc/entry-macro.S2
-rw-r--r--include/asm-arm/arch-s3c2410/dma.h8
-rw-r--r--include/asm-arm/arch-s3c2410/entry-macro.S2
-rw-r--r--include/asm-arm/arch-sa1100/dma.h14
-rw-r--r--include/asm-arm/arch-versatile/debug-macro.S2
-rw-r--r--include/asm-arm/arch-versatile/dma.h7
-rw-r--r--include/asm-arm/arch-versatile/entry-macro.S4
-rw-r--r--include/asm-arm/byteorder.h16
-rw-r--r--include/asm-arm/cacheflush.h1
-rw-r--r--include/asm-arm/dma.h11
-rw-r--r--include/asm-arm/hardware/sharpsl_pm.h94
-rw-r--r--include/asm-arm/mach/dma.h4
-rw-r--r--include/asm-arm/scatterlist.h1
-rw-r--r--include/linux/amba/bus.h (renamed from include/asm-arm/hardware/amba.h)0
-rw-r--r--include/linux/amba/clcd.h (renamed from include/asm-arm/hardware/amba_clcd.h)0
-rw-r--r--include/linux/amba/kmi.h (renamed from include/asm-arm/hardware/amba_kmi.h)0
-rw-r--r--include/linux/amba/serial.h (renamed from include/asm-arm/hardware/amba_serial.h)0
-rw-r--r--include/linux/clk.h (renamed from include/asm-arm/hardware/clock.h)30
-rw-r--r--sound/arm/aaci.c2
172 files changed, 1906 insertions, 1791 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4b15f5f1e254..16a5d522b2f2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -154,6 +154,7 @@ config ARCH_RPC
154 select FIQ 154 select FIQ
155 select TIMER_ACORN 155 select TIMER_ACORN
156 select ARCH_MAY_HAVE_PC_FDC 156 select ARCH_MAY_HAVE_PC_FDC
157 select ISA_DMA_API
157 help 158 help
158 On the Acorn Risc-PC, Linux can support the internal IDE disk and 159 On the Acorn Risc-PC, Linux can support the internal IDE disk and
159 CD-ROM interface, serial and parallel port, and the floppy drive. 160 CD-ROM interface, serial and parallel port, and the floppy drive.
@@ -206,6 +207,7 @@ config ARCH_IMX
206 207
207config ARCH_H720X 208config ARCH_H720X
208 bool "Hynix-HMS720x-based" 209 bool "Hynix-HMS720x-based"
210 select ISA_DMA_API
209 help 211 help
210 This enables support for systems based on the Hynix HMS720x 212 This enables support for systems based on the Hynix HMS720x
211 213
@@ -290,12 +292,14 @@ config ISA
290 (MCA) or VESA. ISA is an older system, now being displaced by PCI; 292 (MCA) or VESA. ISA is an older system, now being displaced by PCI;
291 newer boards don't support it. If you have ISA, say Y, otherwise N. 293 newer boards don't support it. If you have ISA, say Y, otherwise N.
292 294
295# Select ISA DMA controller support
293config ISA_DMA 296config ISA_DMA
294 bool 297 bool
298 select ISA_DMA_API
295 299
300# Select ISA DMA interface
296config ISA_DMA_API 301config ISA_DMA_API
297 bool 302 bool
298 default y
299 303
300config PCI 304config PCI
301 bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB 305 bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB
@@ -656,7 +660,6 @@ source "kernel/power/Kconfig"
656 660
657config APM 661config APM
658 tristate "Advanced Power Management Emulation" 662 tristate "Advanced Power Management Emulation"
659 depends on PM_LEGACY
660 ---help--- 663 ---help---
661 APM is a BIOS specification for saving power using several different 664 APM is a BIOS specification for saving power using several different
662 techniques. This is mostly useful for battery powered laptops with 665 techniques. This is mostly useful for battery powered laptops with
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 81bd2193fe6d..afaf3a1e903c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -8,7 +8,7 @@
8# Copyright (C) 1995-2001 by Russell King 8# Copyright (C) 1995-2001 by Russell King
9 9
10LDFLAGS_vmlinux :=-p --no-undefined -X 10LDFLAGS_vmlinux :=-p --no-undefined -X
11CPPFLAGS_vmlinux.lds = -DKERNEL_RAM_ADDR=$(TEXTADDR) 11CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
12OBJCOPYFLAGS :=-O binary -R .note -R .comment -S 12OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
13GZFLAGS :=-9 13GZFLAGS :=-9
14#CFLAGS +=-pipe 14#CFLAGS +=-pipe
@@ -65,7 +65,7 @@ CHECKFLAGS += -D__arm__
65 65
66#Default value 66#Default value
67head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o 67head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o
68textaddr-y := 0xC0008000 68textofs-y := 0x00008000
69 69
70 machine-$(CONFIG_ARCH_RPC) := rpc 70 machine-$(CONFIG_ARCH_RPC) := rpc
71 machine-$(CONFIG_ARCH_EBSA110) := ebsa110 71 machine-$(CONFIG_ARCH_EBSA110) := ebsa110
@@ -73,22 +73,20 @@ textaddr-y := 0xC0008000
73 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500 73 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500
74 machine-$(CONFIG_FOOTBRIDGE) := footbridge 74 machine-$(CONFIG_FOOTBRIDGE) := footbridge
75 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285 75 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285
76textaddr-$(CONFIG_ARCH_CO285) := 0x60008000
77 machine-$(CONFIG_ARCH_CO285) := footbridge 76 machine-$(CONFIG_ARCH_CO285) := footbridge
78 incdir-$(CONFIG_ARCH_CO285) := ebsa285 77 incdir-$(CONFIG_ARCH_CO285) := ebsa285
79 machine-$(CONFIG_ARCH_SHARK) := shark 78 machine-$(CONFIG_ARCH_SHARK) := shark
80 machine-$(CONFIG_ARCH_SA1100) := sa1100 79 machine-$(CONFIG_ARCH_SA1100) := sa1100
81ifeq ($(CONFIG_ARCH_SA1100),y) 80ifeq ($(CONFIG_ARCH_SA1100),y)
82# SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory 81# SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
83textaddr-$(CONFIG_SA1111) := 0xc0208000 82 textofs-$(CONFIG_SA1111) := 0x00208000
84endif 83endif
85 machine-$(CONFIG_ARCH_PXA) := pxa 84 machine-$(CONFIG_ARCH_PXA) := pxa
86 machine-$(CONFIG_ARCH_L7200) := l7200 85 machine-$(CONFIG_ARCH_L7200) := l7200
87 machine-$(CONFIG_ARCH_INTEGRATOR) := integrator 86 machine-$(CONFIG_ARCH_INTEGRATOR) := integrator
88 machine-$(CONFIG_ARCH_CAMELOT) := epxa10db 87 machine-$(CONFIG_ARCH_CAMELOT) := epxa10db
89textaddr-$(CONFIG_ARCH_CLPS711X) := 0xc0028000 88 textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
90 machine-$(CONFIG_ARCH_CLPS711X) := clps711x 89 machine-$(CONFIG_ARCH_CLPS711X) := clps711x
91textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000
92 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx 90 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx
93 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 91 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
94 machine-$(CONFIG_ARCH_IXP2000) := ixp2000 92 machine-$(CONFIG_ARCH_IXP2000) := ixp2000
@@ -110,7 +108,8 @@ CFLAGS_3c589_cs.o :=-DISA_SIXTEEN_BIT_PERIPHERAL
110export CFLAGS_3c589_cs.o 108export CFLAGS_3c589_cs.o
111endif 109endif
112 110
113TEXTADDR := $(textaddr-y) 111# The byte offset of the kernel image in RAM from the start of RAM.
112TEXT_OFFSET := $(textofs-y)
114 113
115ifeq ($(incdir-y),) 114ifeq ($(incdir-y),)
116incdir-y := $(machine-y) 115incdir-y := $(machine-y)
@@ -123,7 +122,7 @@ else
123MACHINE := 122MACHINE :=
124endif 123endif
125 124
126export TEXTADDR GZFLAGS 125export TEXT_OFFSET GZFLAGS
127 126
128# Do we have FASTFPE? 127# Do we have FASTFPE?
129FASTFPE :=arch/arm/fastfpe 128FASTFPE :=arch/arm/fastfpe
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 937a353bc37c..a174d63395ea 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -15,7 +15,7 @@ include $(srctree)/$(MACHINE)/Makefile.boot
15endif 15endif
16 16
17# Note: the following conditions must always be true: 17# Note: the following conditions must always be true:
18# ZRELADDR == virt_to_phys(TEXTADDR) 18# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
19# PARAMS_PHYS must be within 4MB of ZRELADDR 19# PARAMS_PHYS must be within 4MB of ZRELADDR
20# INITRD_PHYS must be in RAM 20# INITRD_PHYS must be in RAM
21ZRELADDR := $(zreladdr-y) 21ZRELADDR := $(zreladdr-y)
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 666ba393575b..d7509c7a3c5e 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -23,5 +23,8 @@ config SHARP_LOCOMO
23config SHARP_PARAM 23config SHARP_PARAM
24 bool 24 bool
25 25
26config SHARPSL_PM
27 bool
28
26config SHARP_SCOOP 29config SHARP_SCOOP
27 bool 30 bool
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index a87886564b19..ec8d17c96906 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -3,7 +3,6 @@
3# 3#
4 4
5obj-y += rtctime.o 5obj-y += rtctime.o
6obj-$(CONFIG_ARM_AMBA) += amba.o
7obj-$(CONFIG_ARM_GIC) += gic.o 6obj-$(CONFIG_ARM_GIC) += gic.o
8obj-$(CONFIG_ICST525) += icst525.o 7obj-$(CONFIG_ICST525) += icst525.o
9obj-$(CONFIG_ICST307) += icst307.o 8obj-$(CONFIG_ICST307) += icst307.o
@@ -13,4 +12,5 @@ obj-$(CONFIG_DMABOUNCE) += dmabounce.o
13obj-$(CONFIG_TIMER_ACORN) += time-acorn.o 12obj-$(CONFIG_TIMER_ACORN) += time-acorn.o
14obj-$(CONFIG_SHARP_LOCOMO) += locomo.o 13obj-$(CONFIG_SHARP_LOCOMO) += locomo.o
15obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o 14obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
15obj-$(CONFIG_SHARPSL_PM) += sharpsl_pm.o
16obj-$(CONFIG_SHARP_SCOOP) += scoop.o 16obj-$(CONFIG_SHARP_SCOOP) += scoop.o
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 0c3cbd9a388b..b6de43e73699 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -33,7 +33,6 @@ void reset_scoop(struct device *dev)
33 33
34 SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100; // 00 34 SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100; // 00
35 SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000; // 04 35 SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000; // 04
36 SCOOP_REG(sdev->base,SCOOP_CPR) = 0x0000; // 0C
37 SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000; // 10 36 SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000; // 10
38 SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000; // 18 37 SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000; // 18
39 SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF; // 14 38 SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF; // 14
@@ -154,6 +153,7 @@ int __init scoop_probe(struct platform_device *pdev)
154 153
155 SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140; 154 SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
156 reset_scoop(&pdev->dev); 155 reset_scoop(&pdev->dev);
156 SCOOP_REG(devptr->base, SCOOP_CPR) = 0x0000;
157 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff; 157 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
158 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff; 158 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
159 159
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
new file mode 100644
index 000000000000..978d32e82d39
--- /dev/null
+++ b/arch/arm/common/sharpsl_pm.c
@@ -0,0 +1,839 @@
1/*
2 * Battery and Power Management code for the Sharp SL-C7xx and SL-Cxx00
3 * series of PDAs
4 *
5 * Copyright (c) 2004-2005 Richard Purdie
6 *
7 * Based on code written by Sharp for 2.4 kernels
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#undef DEBUG
16
17#include <linux/module.h>
18#include <linux/timer.h>
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/apm_bios.h>
22#include <linux/delay.h>
23#include <linux/interrupt.h>
24#include <linux/platform_device.h>
25
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/irq.h>
29#include <asm/apm.h>
30#include <asm/arch/pm.h>
31#include <asm/arch/pxa-regs.h>
32#include <asm/arch/sharpsl.h>
33#include <asm/hardware/sharpsl_pm.h>
34
35/*
36 * Constants
37 */
38#define SHARPSL_CHARGE_ON_TIME_INTERVAL (msecs_to_jiffies(1*60*1000)) /* 1 min */
39#define SHARPSL_CHARGE_FINISH_TIME (msecs_to_jiffies(10*60*1000)) /* 10 min */
40#define SHARPSL_BATCHK_TIME (msecs_to_jiffies(15*1000)) /* 15 sec */
41#define SHARPSL_BATCHK_TIME_SUSPEND (60*10) /* 10 min */
42#define SHARPSL_WAIT_CO_TIME 15 /* 15 sec */
43#define SHARPSL_WAIT_DISCHARGE_ON 100 /* 100 msec */
44#define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */
45#define SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT 10 /* 10 msec */
46#define SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN 10 /* 10 msec */
47#define SHARPSL_CHARGE_WAIT_TIME 15 /* 15 msec */
48#define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */
49#define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */
50
51#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
52#define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */
53#define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */
54#define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */
55#define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */
56#define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */
57
58/*
59 * Prototypes
60 */
61static int sharpsl_off_charge_battery(void);
62static int sharpsl_check_battery_temp(void);
63static int sharpsl_check_battery_voltage(void);
64static int sharpsl_ac_check(void);
65static int sharpsl_fatal_check(void);
66static int sharpsl_average_value(int ad);
67static void sharpsl_average_clear(void);
68static void sharpsl_charge_toggle(void *private_);
69static void sharpsl_battery_thread(void *private_);
70
71
72/*
73 * Variables
74 */
75struct sharpsl_pm_status sharpsl_pm;
76DECLARE_WORK(toggle_charger, sharpsl_charge_toggle, NULL);
77DECLARE_WORK(sharpsl_bat, sharpsl_battery_thread, NULL);
78
79
80static int get_percentage(int voltage)
81{
82 int i = sharpsl_pm.machinfo->bat_levels - 1;
83 struct battery_thresh *thresh;
84
85 if (sharpsl_pm.charge_mode == CHRG_ON)
86 thresh=sharpsl_pm.machinfo->bat_levels_acin;
87 else
88 thresh=sharpsl_pm.machinfo->bat_levels_noac;
89
90 while (i > 0 && (voltage > thresh[i].voltage))
91 i--;
92
93 return thresh[i].percentage;
94}
95
96static int get_apm_status(int voltage)
97{
98 int low_thresh, high_thresh;
99
100 if (sharpsl_pm.charge_mode == CHRG_ON) {
101 high_thresh = sharpsl_pm.machinfo->status_high_acin;
102 low_thresh = sharpsl_pm.machinfo->status_low_acin;
103 } else {
104 high_thresh = sharpsl_pm.machinfo->status_high_noac;
105 low_thresh = sharpsl_pm.machinfo->status_low_noac;
106 }
107
108 if (voltage >= high_thresh)
109 return APM_BATTERY_STATUS_HIGH;
110 if (voltage >= low_thresh)
111 return APM_BATTERY_STATUS_LOW;
112 return APM_BATTERY_STATUS_CRITICAL;
113}
114
115void sharpsl_battery_kick(void)
116{
117 schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(125));
118}
119EXPORT_SYMBOL(sharpsl_battery_kick);
120
121
122static void sharpsl_battery_thread(void *private_)
123{
124 int voltage, percent, apm_status, i = 0;
125
126 if (!sharpsl_pm.machinfo)
127 return;
128
129 sharpsl_pm.battstat.ac_status = (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN) ? APM_AC_ONLINE : APM_AC_OFFLINE);
130
131 /* Corgi cannot confirm when battery fully charged so periodically kick! */
132 if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON)
133 && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL))
134 schedule_work(&toggle_charger);
135
136 while(1) {
137 voltage = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
138
139 if (voltage > 0) break;
140 if (i++ > 5) {
141 voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
142 dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");
143 break;
144 }
145 }
146
147 voltage = sharpsl_average_value(voltage);
148 apm_status = get_apm_status(voltage);
149 percent = get_percentage(voltage);
150
151 /* At low battery voltages, the voltage has a tendency to start
152 creeping back up so we try to avoid this here */
153 if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE) || (apm_status == APM_BATTERY_STATUS_HIGH) || percent <= sharpsl_pm.battstat.mainbat_percent) {
154 sharpsl_pm.battstat.mainbat_voltage = voltage;
155 sharpsl_pm.battstat.mainbat_status = apm_status;
156 sharpsl_pm.battstat.mainbat_percent = percent;
157 }
158
159 dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %d\n", voltage,
160 sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies);
161
162 /* If battery is low. limit backlight intensity to save power. */
163 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
164 && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) ||
165 (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) {
166 if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) {
167 corgibl_limit_intensity(1);
168 sharpsl_pm.flags |= SHARPSL_BL_LIMIT;
169 }
170 } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) {
171 corgibl_limit_intensity(0);
172 sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT;
173 }
174
175 /* Suspend if critical battery level */
176 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
177 && (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL)
178 && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
179 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
180 dev_err(sharpsl_pm.dev, "Fatal Off\n");
181 apm_queue_event(APM_CRITICAL_SUSPEND);
182 }
183
184 schedule_delayed_work(&sharpsl_bat, SHARPSL_BATCHK_TIME);
185}
186
187void sharpsl_pm_led(int val)
188{
189 if (val == SHARPSL_LED_ERROR) {
190 dev_err(sharpsl_pm.dev, "Charging Error!\n");
191 } else if (val == SHARPSL_LED_ON) {
192 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
193
194 } else {
195 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
196
197 }
198}
199
200static void sharpsl_charge_on(void)
201{
202 dev_dbg(sharpsl_pm.dev, "Turning Charger On\n");
203
204 sharpsl_pm.full_count = 0;
205 sharpsl_pm.charge_mode = CHRG_ON;
206 schedule_delayed_work(&toggle_charger, msecs_to_jiffies(250));
207 schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(500));
208}
209
210static void sharpsl_charge_off(void)
211{
212 dev_dbg(sharpsl_pm.dev, "Turning Charger Off\n");
213
214 sharpsl_pm.machinfo->charge(0);
215 sharpsl_pm_led(SHARPSL_LED_OFF);
216 sharpsl_pm.charge_mode = CHRG_OFF;
217
218 schedule_work(&sharpsl_bat);
219}
220
221static void sharpsl_charge_error(void)
222{
223 sharpsl_pm_led(SHARPSL_LED_ERROR);
224 sharpsl_pm.machinfo->charge(0);
225 sharpsl_pm.charge_mode = CHRG_ERROR;
226}
227
228static void sharpsl_charge_toggle(void *private_)
229{
230 dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies);
231
232 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
233 sharpsl_charge_off();
234 return;
235 } else if ((sharpsl_check_battery_temp() < 0) || (sharpsl_ac_check() < 0)) {
236 sharpsl_charge_error();
237 return;
238 }
239
240 sharpsl_pm_led(SHARPSL_LED_ON);
241 sharpsl_pm.machinfo->charge(0);
242 mdelay(SHARPSL_CHARGE_WAIT_TIME);
243 sharpsl_pm.machinfo->charge(1);
244
245 sharpsl_pm.charge_start_time = jiffies;
246}
247
248static void sharpsl_ac_timer(unsigned long data)
249{
250 int acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
251
252 dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin);
253
254 sharpsl_average_clear();
255 if (acin && (sharpsl_pm.charge_mode != CHRG_ON))
256 sharpsl_charge_on();
257 else if (sharpsl_pm.charge_mode == CHRG_ON)
258 sharpsl_charge_off();
259
260 schedule_work(&sharpsl_bat);
261}
262
263
264irqreturn_t sharpsl_ac_isr(int irq, void *dev_id, struct pt_regs *fp)
265{
266 /* Delay the event slightly to debounce */
267 /* Must be a smaller delay than the chrg_full_isr below */
268 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
269
270 return IRQ_HANDLED;
271}
272
273static void sharpsl_chrg_full_timer(unsigned long data)
274{
275 dev_dbg(sharpsl_pm.dev, "Charge Full at time: %lx\n", jiffies);
276
277 sharpsl_pm.full_count++;
278
279 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
280 dev_dbg(sharpsl_pm.dev, "Charge Full: AC removed - stop charging!\n");
281 if (sharpsl_pm.charge_mode == CHRG_ON)
282 sharpsl_charge_off();
283 } else if (sharpsl_pm.full_count < 2) {
284 dev_dbg(sharpsl_pm.dev, "Charge Full: Count too low\n");
285 schedule_work(&toggle_charger);
286 } else if (time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_FINISH_TIME)) {
287 dev_dbg(sharpsl_pm.dev, "Charge Full: Interrupt generated too slowly - retry.\n");
288 schedule_work(&toggle_charger);
289 } else {
290 sharpsl_charge_off();
291 sharpsl_pm.charge_mode = CHRG_DONE;
292 dev_dbg(sharpsl_pm.dev, "Charge Full: Charging Finished\n");
293 }
294}
295
296/* Charging Finished Interrupt (Not present on Corgi) */
297/* Can trigger at the same time as an AC staus change so
298 delay until after that has been processed */
299irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id, struct pt_regs *fp)
300{
301 if (sharpsl_pm.flags & SHARPSL_SUSPENDED)
302 return IRQ_HANDLED;
303
304 /* delay until after any ac interrupt */
305 mod_timer(&sharpsl_pm.chrg_full_timer, jiffies + msecs_to_jiffies(500));
306
307 return IRQ_HANDLED;
308}
309
310irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp)
311{
312 int is_fatal = 0;
313
314 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_LOCK)) {
315 dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n");
316 is_fatal = 1;
317 }
318
319 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_FATAL)) {
320 dev_err(sharpsl_pm.dev, "Fatal Batt Error! Suspending.\n");
321 is_fatal = 1;
322 }
323
324 if (!(sharpsl_pm.flags & SHARPSL_APM_QUEUED) && is_fatal) {
325 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
326 apm_queue_event(APM_CRITICAL_SUSPEND);
327 }
328
329 return IRQ_HANDLED;
330}
331
332/*
333 * Maintain an average of the last 10 readings
334 */
335#define SHARPSL_CNV_VALUE_NUM 10
336static int sharpsl_ad_index;
337
338static void sharpsl_average_clear(void)
339{
340 sharpsl_ad_index = 0;
341}
342
343static int sharpsl_average_value(int ad)
344{
345 int i, ad_val = 0;
346 static int sharpsl_ad[SHARPSL_CNV_VALUE_NUM+1];
347
348 if (sharpsl_pm.battstat.mainbat_status != APM_BATTERY_STATUS_HIGH) {
349 sharpsl_ad_index = 0;
350 return ad;
351 }
352
353 sharpsl_ad[sharpsl_ad_index] = ad;
354 sharpsl_ad_index++;
355 if (sharpsl_ad_index >= SHARPSL_CNV_VALUE_NUM) {
356 for (i=0; i < (SHARPSL_CNV_VALUE_NUM-1); i++)
357 sharpsl_ad[i] = sharpsl_ad[i+1];
358 sharpsl_ad_index = SHARPSL_CNV_VALUE_NUM - 1;
359 }
360 for (i=0; i < sharpsl_ad_index; i++)
361 ad_val += sharpsl_ad[i];
362
363 return (ad_val / sharpsl_ad_index);
364}
365
366/*
367 * Take an array of 5 integers, remove the maximum and minimum values
368 * and return the average.
369 */
370static int get_select_val(int *val)
371{
372 int i, j, k, temp, sum = 0;
373
374 /* Find MAX val */
375 temp = val[0];
376 j=0;
377 for (i=1; i<5; i++) {
378 if (temp < val[i]) {
379 temp = val[i];
380 j = i;
381 }
382 }
383
384 /* Find MIN val */
385 temp = val[4];
386 k=4;
387 for (i=3; i>=0; i--) {
388 if (temp > val[i]) {
389 temp = val[i];
390 k = i;
391 }
392 }
393
394 for (i=0; i<5; i++)
395 if (i != j && i != k )
396 sum += val[i];
397
398 dev_dbg(sharpsl_pm.dev, "Average: %d from values: %d, %d, %d, %d, %d\n", sum/3, val[0], val[1], val[2], val[3], val[4]);
399
400 return (sum/3);
401}
402
403static int sharpsl_check_battery_temp(void)
404{
405 int val, i, buff[5];
406
407 /* Check battery temperature */
408 for (i=0; i<5; i++) {
409 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
410 sharpsl_pm.machinfo->measure_temp(1);
411 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
412 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_TEMP);
413 sharpsl_pm.machinfo->measure_temp(0);
414 }
415
416 val = get_select_val(buff);
417
418 dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
419 if (val > SHARPSL_CHARGE_ON_TEMP)
420 return -1;
421
422 return 0;
423}
424
425static int sharpsl_check_battery_voltage(void)
426{
427 int val, i, buff[5];
428
429 /* disable charge, enable discharge */
430 sharpsl_pm.machinfo->charge(0);
431 sharpsl_pm.machinfo->discharge(1);
432 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
433
434 if (sharpsl_pm.machinfo->discharge1)
435 sharpsl_pm.machinfo->discharge1(1);
436
437 /* Check battery voltage */
438 for (i=0; i<5; i++) {
439 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
440 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
441 }
442
443 if (sharpsl_pm.machinfo->discharge1)
444 sharpsl_pm.machinfo->discharge1(0);
445
446 sharpsl_pm.machinfo->discharge(0);
447
448 val = get_select_val(buff);
449 dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val);
450
451 if (val < SHARPSL_CHARGE_ON_VOLT)
452 return -1;
453
454 return 0;
455}
456
457static int sharpsl_ac_check(void)
458{
459 int temp, i, buff[5];
460
461 for (i=0; i<5; i++) {
462 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_ACIN_VOLT);
463 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
464 }
465
466 temp = get_select_val(buff);
467 dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp);
468
469 if ((temp > SHARPSL_CHARGE_ON_ACIN_HIGH) || (temp < SHARPSL_CHARGE_ON_ACIN_LOW)) {
470 dev_err(sharpsl_pm.dev, "Error: AC check failed.\n");
471 return -1;
472 }
473
474 return 0;
475}
476
477#ifdef CONFIG_PM
478static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state)
479{
480 sharpsl_pm.flags |= SHARPSL_SUSPENDED;
481 flush_scheduled_work();
482
483 if (sharpsl_pm.charge_mode == CHRG_ON)
484 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
485 else
486 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
487
488 return 0;
489}
490
491static int sharpsl_pm_resume(struct platform_device *pdev)
492{
493 /* Clear the reset source indicators as they break the bootloader upon reboot */
494 RCSR = 0x0f;
495 sharpsl_average_clear();
496 sharpsl_pm.flags &= ~SHARPSL_APM_QUEUED;
497 sharpsl_pm.flags &= ~SHARPSL_SUSPENDED;
498
499 return 0;
500}
501
502static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
503{
504 dev_dbg(sharpsl_pm.dev, "Time is: %08x\n",RCNR);
505
506 dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
507 /* not charging and AC-IN! */
508
509 if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN))) {
510 dev_dbg(sharpsl_pm.dev, "Activating Offline Charger...\n");
511 sharpsl_pm.charge_mode = CHRG_OFF;
512 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
513 sharpsl_off_charge_battery();
514 }
515
516 sharpsl_pm.machinfo->presuspend();
517
518 PEDR = 0xffffffff; /* clear it */
519
520 sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
521 if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
522 RTSR &= RTSR_ALE;
523 RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
524 dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n",RTAR);
525 sharpsl_pm.flags |= SHARPSL_ALARM_ACTIVE;
526 } else if (alarm_enable) {
527 RTSR &= RTSR_ALE;
528 RTAR = alarm_time;
529 dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n",RTAR);
530 } else {
531 dev_dbg(sharpsl_pm.dev, "No alarms set.\n");
532 }
533
534 pxa_pm_enter(state);
535
536 sharpsl_pm.machinfo->postsuspend();
537
538 dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",PEDR);
539}
540
541static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
542{
543 if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable) )
544 {
545 if (!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE)) {
546 dev_dbg(sharpsl_pm.dev, "No user triggered wakeup events and not charging. Strange. Suspend.\n");
547 corgi_goto_sleep(alarm_time, alarm_enable, state);
548 return 1;
549 }
550 if(sharpsl_off_charge_battery()) {
551 dev_dbg(sharpsl_pm.dev, "Charging. Suspend...\n");
552 corgi_goto_sleep(alarm_time, alarm_enable, state);
553 return 1;
554 }
555 dev_dbg(sharpsl_pm.dev, "User triggered wakeup in offline charger.\n");
556 }
557
558 if ((!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_LOCK)) || (sharpsl_fatal_check() < 0) )
559 {
560 dev_err(sharpsl_pm.dev, "Fatal condition. Suspend.\n");
561 corgi_goto_sleep(alarm_time, alarm_enable, state);
562 return 1;
563 }
564
565 return 0;
566}
567
568static int corgi_pxa_pm_enter(suspend_state_t state)
569{
570 unsigned long alarm_time = RTAR;
571 unsigned int alarm_status = ((RTSR & RTSR_ALE) != 0);
572
573 dev_dbg(sharpsl_pm.dev, "SharpSL suspending for first time.\n");
574
575 corgi_goto_sleep(alarm_time, alarm_status, state);
576
577 while (corgi_enter_suspend(alarm_time,alarm_status,state))
578 {}
579
580 dev_dbg(sharpsl_pm.dev, "SharpSL resuming...\n");
581
582 return 0;
583}
584#endif
585
586
587/*
588 * Check for fatal battery errors
589 * Fatal returns -1
590 */
591static int sharpsl_fatal_check(void)
592{
593 int buff[5], temp, i, acin;
594
595 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n");
596
597 /* Check AC-Adapter */
598 acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
599
600 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
601 sharpsl_pm.machinfo->charge(0);
602 udelay(100);
603 sharpsl_pm.machinfo->discharge(1); /* enable discharge */
604 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
605 }
606
607 if (sharpsl_pm.machinfo->discharge1)
608 sharpsl_pm.machinfo->discharge1(1);
609
610 /* Check battery : check inserting battery ? */
611 for (i=0; i<5; i++) {
612 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
613 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
614 }
615
616 if (sharpsl_pm.machinfo->discharge1)
617 sharpsl_pm.machinfo->discharge1(0);
618
619 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
620 udelay(100);
621 sharpsl_pm.machinfo->charge(1);
622 sharpsl_pm.machinfo->discharge(0);
623 }
624
625 temp = get_select_val(buff);
626 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT));
627
628 if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) ||
629 (!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT)))
630 return -1;
631 return 0;
632}
633
634static int sharpsl_off_charge_error(void)
635{
636 dev_err(sharpsl_pm.dev, "Offline Charger: Error occured.\n");
637 sharpsl_pm.machinfo->charge(0);
638 sharpsl_pm_led(SHARPSL_LED_ERROR);
639 sharpsl_pm.charge_mode = CHRG_ERROR;
640 return 1;
641}
642
643/*
644 * Charging Control while suspended
645 * Return 1 - go straight to sleep
646 * Return 0 - sleep or wakeup depending on other factors
647 */
648static int sharpsl_off_charge_battery(void)
649{
650 int time;
651
652 dev_dbg(sharpsl_pm.dev, "Charge Mode: %d\n", sharpsl_pm.charge_mode);
653
654 if (sharpsl_pm.charge_mode == CHRG_OFF) {
655 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 1\n");
656
657 /* AC Check */
658 if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery_temp() < 0))
659 return sharpsl_off_charge_error();
660
661 /* Start Charging */
662 sharpsl_pm_led(SHARPSL_LED_ON);
663 sharpsl_pm.machinfo->charge(0);
664 mdelay(SHARPSL_CHARGE_WAIT_TIME);
665 sharpsl_pm.machinfo->charge(1);
666
667 sharpsl_pm.charge_mode = CHRG_ON;
668 sharpsl_pm.full_count = 0;
669
670 return 1;
671 } else if (sharpsl_pm.charge_mode != CHRG_ON) {
672 return 1;
673 }
674
675 if (sharpsl_pm.full_count == 0) {
676 int time;
677
678 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 2\n");
679
680 if ((sharpsl_check_battery_temp() < 0) || (sharpsl_check_battery_voltage() < 0))
681 return sharpsl_off_charge_error();
682
683 sharpsl_pm.machinfo->charge(0);
684 mdelay(SHARPSL_CHARGE_WAIT_TIME);
685 sharpsl_pm.machinfo->charge(1);
686 sharpsl_pm.charge_mode = CHRG_ON;
687
688 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
689
690 time = RCNR;
691 while(1) {
692 /* Check if any wakeup event had occured */
693 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
694 return 0;
695 /* Check for timeout */
696 if ((RCNR - time) > SHARPSL_WAIT_CO_TIME)
697 return 1;
698 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_CHRGFULL)) {
699 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occured. Retrying to check\n");
700 sharpsl_pm.full_count++;
701 sharpsl_pm.machinfo->charge(0);
702 mdelay(SHARPSL_CHARGE_WAIT_TIME);
703 sharpsl_pm.machinfo->charge(1);
704 return 1;
705 }
706 }
707 }
708
709 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 3\n");
710
711 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
712
713 time = RCNR;
714 while(1) {
715 /* Check if any wakeup event had occured */
716 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
717 return 0;
718 /* Check for timeout */
719 if ((RCNR-time) > SHARPSL_WAIT_CO_TIME) {
720 if (sharpsl_pm.full_count > SHARPSL_CHARGE_RETRY_CNT) {
721 dev_dbg(sharpsl_pm.dev, "Offline Charger: Not charged sufficiently. Retrying.\n");
722 sharpsl_pm.full_count = 0;
723 }
724 sharpsl_pm.full_count++;
725 return 1;
726 }
727 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_CHRGFULL)) {
728 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charging complete.\n");
729 sharpsl_pm_led(SHARPSL_LED_OFF);
730 sharpsl_pm.machinfo->charge(0);
731 sharpsl_pm.charge_mode = CHRG_DONE;
732 return 1;
733 }
734 }
735}
736
737
738static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf)
739{
740 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_percent);
741}
742
743static ssize_t battery_voltage_show(struct device *dev, struct device_attribute *attr, char *buf)
744{
745 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_voltage);
746}
747
748static DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL);
749static DEVICE_ATTR(battery_voltage, 0444, battery_voltage_show, NULL);
750
751extern void (*apm_get_power_status)(struct apm_power_info *);
752
753static void sharpsl_apm_get_power_status(struct apm_power_info *info)
754{
755 info->ac_line_status = sharpsl_pm.battstat.ac_status;
756
757 if (sharpsl_pm.charge_mode == CHRG_ON)
758 info->battery_status = APM_BATTERY_STATUS_CHARGING;
759 else
760 info->battery_status = sharpsl_pm.battstat.mainbat_status;
761
762 info->battery_flag = (1 << info->battery_status);
763 info->battery_life = sharpsl_pm.battstat.mainbat_percent;
764}
765
766static struct pm_ops sharpsl_pm_ops = {
767 .pm_disk_mode = PM_DISK_FIRMWARE,
768 .prepare = pxa_pm_prepare,
769 .enter = corgi_pxa_pm_enter,
770 .finish = pxa_pm_finish,
771};
772
773static int __init sharpsl_pm_probe(struct platform_device *pdev)
774{
775 if (!pdev->dev.platform_data)
776 return -EINVAL;
777
778 sharpsl_pm.dev = &pdev->dev;
779 sharpsl_pm.machinfo = pdev->dev.platform_data;
780 sharpsl_pm.charge_mode = CHRG_OFF;
781 sharpsl_pm.flags = 0;
782
783 init_timer(&sharpsl_pm.ac_timer);
784 sharpsl_pm.ac_timer.function = sharpsl_ac_timer;
785
786 init_timer(&sharpsl_pm.chrg_full_timer);
787 sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer;
788
789 sharpsl_pm.machinfo->init();
790
791 device_create_file(&pdev->dev, &dev_attr_battery_percentage);
792 device_create_file(&pdev->dev, &dev_attr_battery_voltage);
793
794 apm_get_power_status = sharpsl_apm_get_power_status;
795
796 pm_set_ops(&sharpsl_pm_ops);
797
798 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
799
800 return 0;
801}
802
803static int sharpsl_pm_remove(struct platform_device *pdev)
804{
805 pm_set_ops(NULL);
806
807 device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
808 device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
809
810 sharpsl_pm.machinfo->exit();
811
812 del_timer_sync(&sharpsl_pm.chrg_full_timer);
813 del_timer_sync(&sharpsl_pm.ac_timer);
814
815 return 0;
816}
817
818static struct platform_driver sharpsl_pm_driver = {
819 .probe = sharpsl_pm_probe,
820 .remove = sharpsl_pm_remove,
821 .suspend = sharpsl_pm_suspend,
822 .resume = sharpsl_pm_resume,
823 .driver = {
824 .name = "sharpsl-pm",
825 },
826};
827
828static int __devinit sharpsl_pm_init(void)
829{
830 return platform_driver_register(&sharpsl_pm_driver);
831}
832
833static void sharpsl_pm_exit(void)
834{
835 platform_driver_unregister(&sharpsl_pm_driver);
836}
837
838late_initcall(sharpsl_pm_init);
839module_exit(sharpsl_pm_exit);
diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
index f74c926beb42..613afab62720 100644
--- a/arch/arm/configs/ixp4xx_defconfig
+++ b/arch/arm/configs/ixp4xx_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc1-git5 3# Linux kernel version: 2.6.15
4# Tue Sep 20 17:26:28 2005 4# Tue Jan 3 03:20:40 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -33,6 +33,7 @@ CONFIG_SYSCTL=y
33CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
34# CONFIG_IKCONFIG is not set 34# CONFIG_IKCONFIG is not set
35CONFIG_INITRAMFS_SOURCE="" 35CONFIG_INITRAMFS_SOURCE=""
36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
36CONFIG_EMBEDDED=y 37CONFIG_EMBEDDED=y
37CONFIG_KALLSYMS=y 38CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set 39# CONFIG_KALLSYMS_ALL is not set
@@ -42,7 +43,6 @@ CONFIG_BUG=y
42CONFIG_BASE_FULL=y 43CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y 44CONFIG_FUTEX=y
44CONFIG_EPOLL=y 45CONFIG_EPOLL=y
45CONFIG_CC_OPTIMIZE_FOR_SIZE=y
46CONFIG_SHMEM=y 46CONFIG_SHMEM=y
47CONFIG_CC_ALIGN_FUNCTIONS=0 47CONFIG_CC_ALIGN_FUNCTIONS=0
48CONFIG_CC_ALIGN_LABELS=0 48CONFIG_CC_ALIGN_LABELS=0
@@ -62,6 +62,23 @@ CONFIG_MODVERSIONS=y
62CONFIG_KMOD=y 62CONFIG_KMOD=y
63 63
64# 64#
65# Block layer
66#
67
68#
69# IO Schedulers
70#
71CONFIG_IOSCHED_NOOP=y
72CONFIG_IOSCHED_AS=y
73CONFIG_IOSCHED_DEADLINE=y
74CONFIG_IOSCHED_CFQ=y
75CONFIG_DEFAULT_AS=y
76# CONFIG_DEFAULT_DEADLINE is not set
77# CONFIG_DEFAULT_CFQ is not set
78# CONFIG_DEFAULT_NOOP is not set
79CONFIG_DEFAULT_IOSCHED="anticipatory"
80
81#
65# System Type 82# System Type
66# 83#
67# CONFIG_ARCH_CLPS7500 is not set 84# CONFIG_ARCH_CLPS7500 is not set
@@ -83,6 +100,7 @@ CONFIG_ARCH_IXP4XX=y
83# CONFIG_ARCH_LH7A40X is not set 100# CONFIG_ARCH_LH7A40X is not set
84# CONFIG_ARCH_OMAP is not set 101# CONFIG_ARCH_OMAP is not set
85# CONFIG_ARCH_VERSATILE is not set 102# CONFIG_ARCH_VERSATILE is not set
103# CONFIG_ARCH_REALVIEW is not set
86# CONFIG_ARCH_IMX is not set 104# CONFIG_ARCH_IMX is not set
87# CONFIG_ARCH_H720X is not set 105# CONFIG_ARCH_H720X is not set
88# CONFIG_ARCH_AAEC2000 is not set 106# CONFIG_ARCH_AAEC2000 is not set
@@ -102,6 +120,7 @@ CONFIG_MACH_IXDPG425=y
102CONFIG_MACH_IXDP465=y 120CONFIG_MACH_IXDP465=y
103CONFIG_ARCH_IXCDP1100=y 121CONFIG_ARCH_IXCDP1100=y
104CONFIG_ARCH_PRPMC1100=y 122CONFIG_ARCH_PRPMC1100=y
123CONFIG_MACH_NAS100D=y
105CONFIG_ARCH_IXDP4XX=y 124CONFIG_ARCH_IXDP4XX=y
106CONFIG_CPU_IXP46X=y 125CONFIG_CPU_IXP46X=y
107# CONFIG_MACH_GTWX5715 is not set 126# CONFIG_MACH_GTWX5715 is not set
@@ -155,6 +174,7 @@ CONFIG_FLATMEM_MANUAL=y
155CONFIG_FLATMEM=y 174CONFIG_FLATMEM=y
156CONFIG_FLAT_NODE_MEM_MAP=y 175CONFIG_FLAT_NODE_MEM_MAP=y
157# CONFIG_SPARSEMEM_STATIC is not set 176# CONFIG_SPARSEMEM_STATIC is not set
177CONFIG_SPLIT_PTLOCK_CPUS=4096
158CONFIG_ALIGNMENT_TRAP=y 178CONFIG_ALIGNMENT_TRAP=y
159 179
160# 180#
@@ -173,6 +193,7 @@ CONFIG_CMDLINE="console=ttyS0,115200 ip=bootp root=/dev/nfs"
173# At least one emulation must be selected 193# At least one emulation must be selected
174# 194#
175CONFIG_FPE_NWFPE=y 195CONFIG_FPE_NWFPE=y
196# CONFIG_FPE_NWFPE_XP is not set
176# CONFIG_FPE_FASTFPE is not set 197# CONFIG_FPE_FASTFPE is not set
177 198
178# 199#
@@ -187,6 +208,8 @@ CONFIG_BINFMT_ELF=y
187# Power management options 208# Power management options
188# 209#
189CONFIG_PM=y 210CONFIG_PM=y
211CONFIG_PM_LEGACY=y
212# CONFIG_PM_DEBUG is not set
190CONFIG_APM=y 213CONFIG_APM=y
191 214
192# 215#
@@ -271,6 +294,10 @@ CONFIG_IP_VS_SH=m
271CONFIG_NETFILTER=y 294CONFIG_NETFILTER=y
272# CONFIG_NETFILTER_DEBUG is not set 295# CONFIG_NETFILTER_DEBUG is not set
273CONFIG_BRIDGE_NETFILTER=y 296CONFIG_BRIDGE_NETFILTER=y
297
298#
299# Core Netfilter Configuration
300#
274# CONFIG_NETFILTER_NETLINK is not set 301# CONFIG_NETFILTER_NETLINK is not set
275 302
276# 303#
@@ -286,6 +313,7 @@ CONFIG_IP_NF_IRC=m
286# CONFIG_IP_NF_NETBIOS_NS is not set 313# CONFIG_IP_NF_NETBIOS_NS is not set
287# CONFIG_IP_NF_TFTP is not set 314# CONFIG_IP_NF_TFTP is not set
288# CONFIG_IP_NF_AMANDA is not set 315# CONFIG_IP_NF_AMANDA is not set
316# CONFIG_IP_NF_PPTP is not set
289CONFIG_IP_NF_QUEUE=m 317CONFIG_IP_NF_QUEUE=m
290CONFIG_IP_NF_IPTABLES=m 318CONFIG_IP_NF_IPTABLES=m
291CONFIG_IP_NF_MATCH_LIMIT=m 319CONFIG_IP_NF_MATCH_LIMIT=m
@@ -319,6 +347,7 @@ CONFIG_IP_NF_TARGET_REJECT=m
319CONFIG_IP_NF_TARGET_LOG=m 347CONFIG_IP_NF_TARGET_LOG=m
320CONFIG_IP_NF_TARGET_ULOG=m 348CONFIG_IP_NF_TARGET_ULOG=m
321CONFIG_IP_NF_TARGET_TCPMSS=m 349CONFIG_IP_NF_TARGET_TCPMSS=m
350# CONFIG_IP_NF_TARGET_NFQUEUE is not set
322CONFIG_IP_NF_NAT=m 351CONFIG_IP_NF_NAT=m
323CONFIG_IP_NF_NAT_NEEDED=y 352CONFIG_IP_NF_NAT_NEEDED=y
324CONFIG_IP_NF_TARGET_MASQUERADE=m 353CONFIG_IP_NF_TARGET_MASQUERADE=m
@@ -380,10 +409,18 @@ CONFIG_ECONET=m
380CONFIG_ECONET_AUNUDP=y 409CONFIG_ECONET_AUNUDP=y
381CONFIG_ECONET_NATIVE=y 410CONFIG_ECONET_NATIVE=y
382CONFIG_WAN_ROUTER=m 411CONFIG_WAN_ROUTER=m
412
413#
414# QoS and/or fair queueing
415#
383CONFIG_NET_SCHED=y 416CONFIG_NET_SCHED=y
384CONFIG_NET_SCH_CLK_JIFFIES=y 417CONFIG_NET_SCH_CLK_JIFFIES=y
385# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set 418# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
386# CONFIG_NET_SCH_CLK_CPU is not set 419# CONFIG_NET_SCH_CLK_CPU is not set
420
421#
422# Queueing/Scheduling
423#
387CONFIG_NET_SCH_CBQ=m 424CONFIG_NET_SCH_CBQ=m
388CONFIG_NET_SCH_HTB=m 425CONFIG_NET_SCH_HTB=m
389# CONFIG_NET_SCH_HFSC is not set 426# CONFIG_NET_SCH_HFSC is not set
@@ -397,8 +434,10 @@ CONFIG_NET_SCH_GRED=m
397CONFIG_NET_SCH_DSMARK=m 434CONFIG_NET_SCH_DSMARK=m
398# CONFIG_NET_SCH_NETEM is not set 435# CONFIG_NET_SCH_NETEM is not set
399CONFIG_NET_SCH_INGRESS=m 436CONFIG_NET_SCH_INGRESS=m
400CONFIG_NET_QOS=y 437
401CONFIG_NET_ESTIMATOR=y 438#
439# Classification
440#
402CONFIG_NET_CLS=y 441CONFIG_NET_CLS=y
403# CONFIG_NET_CLS_BASIC is not set 442# CONFIG_NET_CLS_BASIC is not set
404CONFIG_NET_CLS_TCINDEX=m 443CONFIG_NET_CLS_TCINDEX=m
@@ -407,13 +446,14 @@ CONFIG_NET_CLS_ROUTE=y
407CONFIG_NET_CLS_FW=m 446CONFIG_NET_CLS_FW=m
408CONFIG_NET_CLS_U32=m 447CONFIG_NET_CLS_U32=m
409# CONFIG_CLS_U32_PERF is not set 448# CONFIG_CLS_U32_PERF is not set
410# CONFIG_NET_CLS_IND is not set
411# CONFIG_CLS_U32_MARK is not set 449# CONFIG_CLS_U32_MARK is not set
412CONFIG_NET_CLS_RSVP=m 450CONFIG_NET_CLS_RSVP=m
413CONFIG_NET_CLS_RSVP6=m 451CONFIG_NET_CLS_RSVP6=m
414# CONFIG_NET_EMATCH is not set 452# CONFIG_NET_EMATCH is not set
415# CONFIG_NET_CLS_ACT is not set 453# CONFIG_NET_CLS_ACT is not set
416CONFIG_NET_CLS_POLICE=y 454CONFIG_NET_CLS_POLICE=y
455# CONFIG_NET_CLS_IND is not set
456CONFIG_NET_ESTIMATOR=y
417 457
418# 458#
419# Network testing 459# Network testing
@@ -437,6 +477,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
437# CONFIG_DEBUG_DRIVER is not set 477# CONFIG_DEBUG_DRIVER is not set
438 478
439# 479#
480# Connector - unified userspace <-> kernelspace linker
481#
482# CONFIG_CONNECTOR is not set
483
484#
440# Memory Technology Devices (MTD) 485# Memory Technology Devices (MTD)
441# 486#
442CONFIG_MTD=y 487CONFIG_MTD=y
@@ -458,6 +503,7 @@ CONFIG_MTD_BLOCK=y
458# CONFIG_FTL is not set 503# CONFIG_FTL is not set
459# CONFIG_NFTL is not set 504# CONFIG_NFTL is not set
460# CONFIG_INFTL is not set 505# CONFIG_INFTL is not set
506# CONFIG_RFD_FTL is not set
461 507
462# 508#
463# RAM/ROM/Flash chip drivers 509# RAM/ROM/Flash chip drivers
@@ -492,7 +538,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
492# CONFIG_MTD_PHYSMAP is not set 538# CONFIG_MTD_PHYSMAP is not set
493# CONFIG_MTD_ARM_INTEGRATOR is not set 539# CONFIG_MTD_ARM_INTEGRATOR is not set
494CONFIG_MTD_IXP4XX=y 540CONFIG_MTD_IXP4XX=y
495# CONFIG_MTD_EDB7312 is not set
496# CONFIG_MTD_PCI is not set 541# CONFIG_MTD_PCI is not set
497# CONFIG_MTD_PLATRAM is not set 542# CONFIG_MTD_PLATRAM is not set
498 543
@@ -523,6 +568,11 @@ CONFIG_MTD_NAND_IDS=m
523# CONFIG_MTD_NAND_NANDSIM is not set 568# CONFIG_MTD_NAND_NANDSIM is not set
524 569
525# 570#
571# OneNAND Flash Device Drivers
572#
573# CONFIG_MTD_ONENAND is not set
574
575#
526# Parallel port support 576# Parallel port support
527# 577#
528# CONFIG_PARPORT is not set 578# CONFIG_PARPORT is not set
@@ -548,14 +598,6 @@ CONFIG_BLK_DEV_RAM_COUNT=16
548CONFIG_BLK_DEV_RAM_SIZE=8192 598CONFIG_BLK_DEV_RAM_SIZE=8192
549CONFIG_BLK_DEV_INITRD=y 599CONFIG_BLK_DEV_INITRD=y
550# CONFIG_CDROM_PKTCDVD is not set 600# CONFIG_CDROM_PKTCDVD is not set
551
552#
553# IO Schedulers
554#
555CONFIG_IOSCHED_NOOP=y
556CONFIG_IOSCHED_AS=y
557CONFIG_IOSCHED_DEADLINE=y
558CONFIG_IOSCHED_CFQ=y
559# CONFIG_ATA_OVER_ETH is not set 601# CONFIG_ATA_OVER_ETH is not set
560 602
561# 603#
@@ -668,6 +710,7 @@ CONFIG_NET_ETHERNET=y
668CONFIG_MII=y 710CONFIG_MII=y
669# CONFIG_HAPPYMEAL is not set 711# CONFIG_HAPPYMEAL is not set
670# CONFIG_SUNGEM is not set 712# CONFIG_SUNGEM is not set
713# CONFIG_CASSINI is not set
671# CONFIG_NET_VENDOR_3COM is not set 714# CONFIG_NET_VENDOR_3COM is not set
672# CONFIG_SMC91X is not set 715# CONFIG_SMC91X is not set
673# CONFIG_DM9000 is not set 716# CONFIG_DM9000 is not set
@@ -739,6 +782,7 @@ CONFIG_NET_RADIO=y
739# 782#
740# Wireless 802.11b ISA/PCI cards support 783# Wireless 802.11b ISA/PCI cards support
741# 784#
785# CONFIG_AIRO is not set
742CONFIG_HERMES=y 786CONFIG_HERMES=y
743# CONFIG_PLX_HERMES is not set 787# CONFIG_PLX_HERMES is not set
744# CONFIG_TMD_HERMES is not set 788# CONFIG_TMD_HERMES is not set
@@ -782,6 +826,7 @@ CONFIG_WAN_ROUTER_DRIVERS=y
782# 826#
783# ATM drivers 827# ATM drivers
784# 828#
829# CONFIG_ATM_DUMMY is not set
785CONFIG_ATM_TCP=m 830CONFIG_ATM_TCP=m
786# CONFIG_ATM_LANAI is not set 831# CONFIG_ATM_LANAI is not set
787# CONFIG_ATM_ENI is not set 832# CONFIG_ATM_ENI is not set
@@ -902,6 +947,7 @@ CONFIG_IXP4XX_WATCHDOG=y
902# TPM devices 947# TPM devices
903# 948#
904# CONFIG_TCG_TPM is not set 949# CONFIG_TCG_TPM is not set
950# CONFIG_TELCLOCK is not set
905 951
906# 952#
907# I2C support 953# I2C support
@@ -954,6 +1000,7 @@ CONFIG_SENSORS_EEPROM=y
954# CONFIG_SENSORS_PCF8591 is not set 1000# CONFIG_SENSORS_PCF8591 is not set
955# CONFIG_SENSORS_RTC8564 is not set 1001# CONFIG_SENSORS_RTC8564 is not set
956# CONFIG_SENSORS_MAX6875 is not set 1002# CONFIG_SENSORS_MAX6875 is not set
1003# CONFIG_RTC_X1205_I2C is not set
957# CONFIG_I2C_DEBUG_CORE is not set 1004# CONFIG_I2C_DEBUG_CORE is not set
958# CONFIG_I2C_DEBUG_ALGO is not set 1005# CONFIG_I2C_DEBUG_ALGO is not set
959# CONFIG_I2C_DEBUG_BUS is not set 1006# CONFIG_I2C_DEBUG_BUS is not set
@@ -1036,6 +1083,10 @@ CONFIG_USB_ARCH_HAS_OHCI=y
1036# CONFIG_USB is not set 1083# CONFIG_USB is not set
1037 1084
1038# 1085#
1086# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1087#
1088
1089#
1039# USB Gadget Support 1090# USB Gadget Support
1040# 1091#
1041# CONFIG_USB_GADGET is not set 1092# CONFIG_USB_GADGET is not set
@@ -1110,6 +1161,7 @@ CONFIG_RAMFS=y
1110CONFIG_JFFS2_FS=y 1161CONFIG_JFFS2_FS=y
1111CONFIG_JFFS2_FS_DEBUG=0 1162CONFIG_JFFS2_FS_DEBUG=0
1112CONFIG_JFFS2_FS_WRITEBUFFER=y 1163CONFIG_JFFS2_FS_WRITEBUFFER=y
1164# CONFIG_JFFS2_SUMMARY is not set
1113# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1165# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1114CONFIG_JFFS2_ZLIB=y 1166CONFIG_JFFS2_ZLIB=y
1115CONFIG_JFFS2_RTIME=y 1167CONFIG_JFFS2_RTIME=y
@@ -1190,7 +1242,9 @@ CONFIG_DETECT_SOFTLOCKUP=y
1190CONFIG_DEBUG_BUGVERBOSE=y 1242CONFIG_DEBUG_BUGVERBOSE=y
1191# CONFIG_DEBUG_INFO is not set 1243# CONFIG_DEBUG_INFO is not set
1192# CONFIG_DEBUG_FS is not set 1244# CONFIG_DEBUG_FS is not set
1245# CONFIG_DEBUG_VM is not set
1193CONFIG_FRAME_POINTER=y 1246CONFIG_FRAME_POINTER=y
1247# CONFIG_RCU_TORTURE_TEST is not set
1194# CONFIG_DEBUG_USER is not set 1248# CONFIG_DEBUG_USER is not set
1195# CONFIG_DEBUG_WAITQ is not set 1249# CONFIG_DEBUG_WAITQ is not set
1196CONFIG_DEBUG_ERRORS=y 1250CONFIG_DEBUG_ERRORS=y
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index c11169b5ed9a..de94b0f3ee2a 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -2,15 +2,16 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5AFLAGS_head.o := -DKERNEL_RAM_ADDR=$(TEXTADDR) 5AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
6 6
7# Object file lists. 7# Object file lists.
8 8
9obj-y := compat.o dma.o entry-armv.o entry-common.o irq.o \ 9obj-y := compat.o entry-armv.o entry-common.o irq.o \
10 process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \ 10 process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \
11 time.o traps.o 11 time.o traps.o
12 12
13obj-$(CONFIG_APM) += apm.o 13obj-$(CONFIG_APM) += apm.o
14obj-$(CONFIG_ISA_DMA_API) += dma.o
14obj-$(CONFIG_ARCH_ACORN) += ecard.o 15obj-$(CONFIG_ARCH_ACORN) += ecard.o
15obj-$(CONFIG_FOOTBRIDGE) += isa.o 16obj-$(CONFIG_FOOTBRIDGE) += isa.o
16obj-$(CONFIG_FIQ) += fiq.o 17obj-$(CONFIG_FIQ) += fiq.o
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c
index a2843be05557..b9df1b782bb1 100644
--- a/arch/arm/kernel/apm.c
+++ b/arch/arm/kernel/apm.c
@@ -20,7 +20,6 @@
20#include <linux/apm_bios.h> 20#include <linux/apm_bios.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/pm.h> 22#include <linux/pm.h>
23#include <linux/pm_legacy.h>
24#include <linux/device.h> 23#include <linux/device.h>
25#include <linux/kernel.h> 24#include <linux/kernel.h>
26#include <linux/list.h> 25#include <linux/list.h>
@@ -81,6 +80,7 @@ struct apm_user {
81 */ 80 */
82static int suspends_pending; 81static int suspends_pending;
83static int apm_disabled; 82static int apm_disabled;
83static int arm_apm_active;
84 84
85static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); 85static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
86static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); 86static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
@@ -477,9 +477,9 @@ static int kapmd(void *arg)
477 apm_event_t event; 477 apm_event_t event;
478 478
479 wait_event_interruptible(kapmd_wait, 479 wait_event_interruptible(kapmd_wait,
480 !queue_empty(&kapmd_queue) || !pm_active); 480 !queue_empty(&kapmd_queue) || !arm_apm_active);
481 481
482 if (!pm_active) 482 if (!arm_apm_active)
483 break; 483 break;
484 484
485 spin_lock_irq(&kapmd_queue_lock); 485 spin_lock_irq(&kapmd_queue_lock);
@@ -522,16 +522,11 @@ static int __init apm_init(void)
522 return -ENODEV; 522 return -ENODEV;
523 } 523 }
524 524
525 if (PM_IS_ACTIVE()) { 525 arm_apm_active = 1;
526 printk(KERN_NOTICE "apm: overridden by ACPI.\n");
527 return -EINVAL;
528 }
529
530 pm_active = 1;
531 526
532 ret = kernel_thread(kapmd, NULL, CLONE_KERNEL); 527 ret = kernel_thread(kapmd, NULL, CLONE_KERNEL);
533 if (ret < 0) { 528 if (ret < 0) {
534 pm_active = 0; 529 arm_apm_active = 0;
535 return ret; 530 return ret;
536 } 531 }
537 532
@@ -543,7 +538,7 @@ static int __init apm_init(void)
543 if (ret != 0) { 538 if (ret != 0) {
544 remove_proc_entry("apm", NULL); 539 remove_proc_entry("apm", NULL);
545 540
546 pm_active = 0; 541 arm_apm_active = 0;
547 wake_up(&kapmd_wait); 542 wake_up(&kapmd_wait);
548 wait_for_completion(&kapmd_exit); 543 wait_for_completion(&kapmd_exit);
549 } 544 }
@@ -556,7 +551,7 @@ static void __exit apm_exit(void)
556 misc_deregister(&apm_device); 551 misc_deregister(&apm_device);
557 remove_proc_entry("apm", NULL); 552 remove_proc_entry("apm", NULL);
558 553
559 pm_active = 0; 554 arm_apm_active = 0;
560 wake_up(&kapmd_wait); 555 wake_up(&kapmd_wait);
561 wait_for_completion(&kapmd_exit); 556 wait_for_completion(&kapmd_exit);
562} 557}
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c
index e9a36304ec3e..03532769a97f 100644
--- a/arch/arm/kernel/dma-isa.c
+++ b/arch/arm/kernel/dma-isa.c
@@ -18,7 +18,7 @@
18 */ 18 */
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/pci.h> 21#include <linux/dma-mapping.h>
22 22
23#include <asm/dma.h> 23#include <asm/dma.h>
24#include <asm/io.h> 24#include <asm/io.h>
@@ -65,37 +65,41 @@ static void isa_enable_dma(dmach_t channel, dma_t *dma)
65{ 65{
66 if (dma->invalid) { 66 if (dma->invalid) {
67 unsigned long address, length; 67 unsigned long address, length;
68 unsigned int mode, direction; 68 unsigned int mode;
69 enum dma_data_direction direction;
69 70
70 mode = channel & 3; 71 mode = channel & 3;
71 switch (dma->dma_mode & DMA_MODE_MASK) { 72 switch (dma->dma_mode & DMA_MODE_MASK) {
72 case DMA_MODE_READ: 73 case DMA_MODE_READ:
73 mode |= ISA_DMA_MODE_READ; 74 mode |= ISA_DMA_MODE_READ;
74 direction = PCI_DMA_FROMDEVICE; 75 direction = DMA_FROM_DEVICE;
75 break; 76 break;
76 77
77 case DMA_MODE_WRITE: 78 case DMA_MODE_WRITE:
78 mode |= ISA_DMA_MODE_WRITE; 79 mode |= ISA_DMA_MODE_WRITE;
79 direction = PCI_DMA_TODEVICE; 80 direction = DMA_TO_DEVICE;
80 break; 81 break;
81 82
82 case DMA_MODE_CASCADE: 83 case DMA_MODE_CASCADE:
83 mode |= ISA_DMA_MODE_CASCADE; 84 mode |= ISA_DMA_MODE_CASCADE;
84 direction = PCI_DMA_BIDIRECTIONAL; 85 direction = DMA_BIDIRECTIONAL;
85 break; 86 break;
86 87
87 default: 88 default:
88 direction = PCI_DMA_NONE; 89 direction = DMA_NONE;
89 break; 90 break;
90 } 91 }
91 92
92 if (!dma->using_sg) { 93 if (!dma->sg) {
93 /* 94 /*
94 * Cope with ISA-style drivers which expect cache 95 * Cope with ISA-style drivers which expect cache
95 * coherence. 96 * coherence.
96 */ 97 */
97 dma->buf.dma_address = pci_map_single(NULL, 98 dma->sg = &dma->buf;
98 dma->buf.__address, dma->buf.length, 99 dma->sgcount = 1;
100 dma->buf.length = dma->count;
101 dma->buf.dma_address = dma_map_single(NULL,
102 dma->addr, dma->count,
99 direction); 103 direction);
100 } 104 }
101 105
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index 2b7883884234..5a0f4bc5da95 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -12,8 +12,6 @@
12 * DMA facilities. 12 * DMA facilities.
13 */ 13 */
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/slab.h>
16#include <linux/mman.h>
17#include <linux/init.h> 15#include <linux/init.h>
18#include <linux/spinlock.h> 16#include <linux/spinlock.h>
19#include <linux/errno.h> 17#include <linux/errno.h>
@@ -23,8 +21,7 @@
23#include <asm/mach/dma.h> 21#include <asm/mach/dma.h>
24 22
25DEFINE_SPINLOCK(dma_spin_lock); 23DEFINE_SPINLOCK(dma_spin_lock);
26 24EXPORT_SYMBOL(dma_spin_lock);
27#if MAX_DMA_CHANNELS > 0
28 25
29static dma_t dma_chan[MAX_DMA_CHANNELS]; 26static dma_t dma_chan[MAX_DMA_CHANNELS];
30 27
@@ -81,6 +78,7 @@ bad_dma:
81busy: 78busy:
82 return -EBUSY; 79 return -EBUSY;
83} 80}
81EXPORT_SYMBOL(request_dma);
84 82
85/* 83/*
86 * Free DMA channel 84 * Free DMA channel
@@ -112,6 +110,7 @@ void free_dma(dmach_t channel)
112bad_dma: 110bad_dma:
113 printk(KERN_ERR "dma: trying to free DMA%d\n", channel); 111 printk(KERN_ERR "dma: trying to free DMA%d\n", channel);
114} 112}
113EXPORT_SYMBOL(free_dma);
115 114
116/* Set DMA Scatter-Gather list 115/* Set DMA Scatter-Gather list
117 */ 116 */
@@ -125,15 +124,15 @@ void set_dma_sg (dmach_t channel, struct scatterlist *sg, int nr_sg)
125 124
126 dma->sg = sg; 125 dma->sg = sg;
127 dma->sgcount = nr_sg; 126 dma->sgcount = nr_sg;
128 dma->using_sg = 1;
129 dma->invalid = 1; 127 dma->invalid = 1;
130} 128}
129EXPORT_SYMBOL(set_dma_sg);
131 130
132/* Set DMA address 131/* Set DMA address
133 * 132 *
134 * Copy address to the structure, and set the invalid bit 133 * Copy address to the structure, and set the invalid bit
135 */ 134 */
136void set_dma_addr (dmach_t channel, unsigned long physaddr) 135void __set_dma_addr (dmach_t channel, void *addr)
137{ 136{
138 dma_t *dma = dma_chan + channel; 137 dma_t *dma = dma_chan + channel;
139 138
@@ -141,12 +140,11 @@ void set_dma_addr (dmach_t channel, unsigned long physaddr)
141 printk(KERN_ERR "dma%d: altering DMA address while " 140 printk(KERN_ERR "dma%d: altering DMA address while "
142 "DMA active\n", channel); 141 "DMA active\n", channel);
143 142
144 dma->sg = &dma->buf; 143 dma->sg = NULL;
145 dma->sgcount = 1; 144 dma->addr = addr;
146 dma->buf.__address = bus_to_virt(physaddr);
147 dma->using_sg = 0;
148 dma->invalid = 1; 145 dma->invalid = 1;
149} 146}
147EXPORT_SYMBOL(__set_dma_addr);
150 148
151/* Set DMA byte count 149/* Set DMA byte count
152 * 150 *
@@ -160,12 +158,11 @@ void set_dma_count (dmach_t channel, unsigned long count)
160 printk(KERN_ERR "dma%d: altering DMA count while " 158 printk(KERN_ERR "dma%d: altering DMA count while "
161 "DMA active\n", channel); 159 "DMA active\n", channel);
162 160
163 dma->sg = &dma->buf; 161 dma->sg = NULL;
164 dma->sgcount = 1; 162 dma->count = count;
165 dma->buf.length = count;
166 dma->using_sg = 0;
167 dma->invalid = 1; 163 dma->invalid = 1;
168} 164}
165EXPORT_SYMBOL(set_dma_count);
169 166
170/* Set DMA direction mode 167/* Set DMA direction mode
171 */ 168 */
@@ -180,6 +177,7 @@ void set_dma_mode (dmach_t channel, dmamode_t mode)
180 dma->dma_mode = mode; 177 dma->dma_mode = mode;
181 dma->invalid = 1; 178 dma->invalid = 1;
182} 179}
180EXPORT_SYMBOL(set_dma_mode);
183 181
184/* Enable DMA channel 182/* Enable DMA channel
185 */ 183 */
@@ -200,6 +198,7 @@ free_dma:
200 printk(KERN_ERR "dma%d: trying to enable free DMA\n", channel); 198 printk(KERN_ERR "dma%d: trying to enable free DMA\n", channel);
201 BUG(); 199 BUG();
202} 200}
201EXPORT_SYMBOL(enable_dma);
203 202
204/* Disable DMA channel 203/* Disable DMA channel
205 */ 204 */
@@ -220,6 +219,7 @@ free_dma:
220 printk(KERN_ERR "dma%d: trying to disable free DMA\n", channel); 219 printk(KERN_ERR "dma%d: trying to disable free DMA\n", channel);
221 BUG(); 220 BUG();
222} 221}
222EXPORT_SYMBOL(disable_dma);
223 223
224/* 224/*
225 * Is the specified DMA channel active? 225 * Is the specified DMA channel active?
@@ -233,6 +233,7 @@ void set_dma_page(dmach_t channel, char pagenr)
233{ 233{
234 printk(KERN_ERR "dma%d: trying to set_dma_page\n", channel); 234 printk(KERN_ERR "dma%d: trying to set_dma_page\n", channel);
235} 235}
236EXPORT_SYMBOL(set_dma_page);
236 237
237void set_dma_speed(dmach_t channel, int cycle_ns) 238void set_dma_speed(dmach_t channel, int cycle_ns)
238{ 239{
@@ -243,6 +244,7 @@ void set_dma_speed(dmach_t channel, int cycle_ns)
243 ret = dma->d_ops->setspeed(channel, dma, cycle_ns); 244 ret = dma->d_ops->setspeed(channel, dma, cycle_ns);
244 dma->speed = ret; 245 dma->speed = ret;
245} 246}
247EXPORT_SYMBOL(set_dma_speed);
246 248
247int get_dma_residue(dmach_t channel) 249int get_dma_residue(dmach_t channel)
248{ 250{
@@ -254,49 +256,12 @@ int get_dma_residue(dmach_t channel)
254 256
255 return ret; 257 return ret;
256} 258}
259EXPORT_SYMBOL(get_dma_residue);
257 260
258void __init init_dma(void) 261static int __init init_dma(void)
259{ 262{
260 arch_dma_init(dma_chan); 263 arch_dma_init(dma_chan);
261}
262
263#else
264
265int request_dma(dmach_t channel, const char *device_id)
266{
267 return -EINVAL;
268}
269
270int get_dma_residue(dmach_t channel)
271{
272 return 0; 264 return 0;
273} 265}
274 266
275#define GLOBAL_ALIAS(_a,_b) asm (".set " #_a "," #_b "; .globl " #_a) 267core_initcall(init_dma);
276GLOBAL_ALIAS(disable_dma, get_dma_residue);
277GLOBAL_ALIAS(enable_dma, get_dma_residue);
278GLOBAL_ALIAS(free_dma, get_dma_residue);
279GLOBAL_ALIAS(get_dma_list, get_dma_residue);
280GLOBAL_ALIAS(set_dma_mode, get_dma_residue);
281GLOBAL_ALIAS(set_dma_page, get_dma_residue);
282GLOBAL_ALIAS(set_dma_count, get_dma_residue);
283GLOBAL_ALIAS(set_dma_addr, get_dma_residue);
284GLOBAL_ALIAS(set_dma_sg, get_dma_residue);
285GLOBAL_ALIAS(set_dma_speed, get_dma_residue);
286GLOBAL_ALIAS(init_dma, get_dma_residue);
287
288#endif
289
290EXPORT_SYMBOL(request_dma);
291EXPORT_SYMBOL(free_dma);
292EXPORT_SYMBOL(enable_dma);
293EXPORT_SYMBOL(disable_dma);
294EXPORT_SYMBOL(set_dma_addr);
295EXPORT_SYMBOL(set_dma_count);
296EXPORT_SYMBOL(set_dma_mode);
297EXPORT_SYMBOL(set_dma_page);
298EXPORT_SYMBOL(get_dma_residue);
299EXPORT_SYMBOL(set_dma_sg);
300EXPORT_SYMBOL(set_dma_speed);
301
302EXPORT_SYMBOL(dma_spin_lock);
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 2a8d27e18fa7..a52baedf6262 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -18,8 +18,6 @@
18#include <asm/memory.h> 18#include <asm/memory.h>
19#include <asm/glue.h> 19#include <asm/glue.h>
20#include <asm/vfpmacros.h> 20#include <asm/vfpmacros.h>
21#include <asm/hardware.h> /* should be moved into entry-macro.S */
22#include <asm/arch/irqs.h> /* should be moved into entry-macro.S */
23#include <asm/arch/entry-macro.S> 21#include <asm/arch/entry-macro.S>
24 22
25#include "entry-header.S" 23#include "entry-header.S"
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index d7d69fd7039f..1e985f2cd70f 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -33,6 +33,8 @@
33#define MACHINFO_PGOFFIO 12 33#define MACHINFO_PGOFFIO 12
34#define MACHINFO_NAME 16 34#define MACHINFO_NAME 16
35 35
36#define KERNEL_RAM_ADDR (PAGE_OFFSET + TEXT_OFFSET)
37
36/* 38/*
37 * swapper_pg_dir is the virtual address of the initial page table. 39 * swapper_pg_dir is the virtual address of the initial page table.
38 * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must 40 * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index d7099dbbb879..869c466e6258 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -1027,7 +1027,6 @@ void __init init_irq_proc(void)
1027void __init init_IRQ(void) 1027void __init init_IRQ(void)
1028{ 1028{
1029 struct irqdesc *desc; 1029 struct irqdesc *desc;
1030 extern void init_dma(void);
1031 int irq; 1030 int irq;
1032 1031
1033#ifdef CONFIG_SMP 1032#ifdef CONFIG_SMP
@@ -1041,7 +1040,6 @@ void __init init_IRQ(void)
1041 } 1040 }
1042 1041
1043 init_arch_irq(); 1042 init_arch_irq();
1044 init_dma();
1045} 1043}
1046 1044
1047static int __init noirqdebug_setup(char *str) 1045static int __init noirqdebug_setup(char *str)
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 30494aab829a..54a21bdcba5c 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -28,10 +28,9 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30 30
31#include <asm/system.h>
32#include <asm/io.h>
33#include <asm/leds.h> 31#include <asm/leds.h>
34#include <asm/processor.h> 32#include <asm/processor.h>
33#include <asm/system.h>
35#include <asm/uaccess.h> 34#include <asm/uaccess.h>
36#include <asm/mach/time.h> 35#include <asm/mach/time.h>
37 36
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 85774165e9fd..2cab741ad0f8 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -26,8 +26,6 @@
26 26
27#include <asm/cpu.h> 27#include <asm/cpu.h>
28#include <asm/elf.h> 28#include <asm/elf.h>
29#include <asm/hardware.h>
30#include <asm/io.h>
31#include <asm/procinfo.h> 29#include <asm/procinfo.h>
32#include <asm/setup.h> 30#include <asm/setup.h>
33#include <asm/mach-types.h> 31#include <asm/mach-types.h>
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index fc4729106a32..d7d932c02866 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -29,9 +29,6 @@
29#include <linux/sysdev.h> 29#include <linux/sysdev.h>
30#include <linux/timer.h> 30#include <linux/timer.h>
31 31
32#include <asm/hardware.h>
33#include <asm/io.h>
34#include <asm/irq.h>
35#include <asm/leds.h> 32#include <asm/leds.h>
36#include <asm/thread_info.h> 33#include <asm/thread_info.h>
37#include <asm/mach/time.h> 34#include <asm/mach/time.h>
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 45e9ea6cd2a5..c9fe6f5f7ee3 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -23,7 +23,6 @@
23 23
24#include <asm/atomic.h> 24#include <asm/atomic.h>
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <asm/io.h>
27#include <asm/system.h> 26#include <asm/system.h>
28#include <asm/uaccess.h> 27#include <asm/uaccess.h>
29#include <asm/unistd.h> 28#include <asm/unistd.h>
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 9a47770114d4..2b254e88595c 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -17,15 +17,13 @@ jiffies = jiffies_64;
17jiffies = jiffies_64 + 4; 17jiffies = jiffies_64 + 4;
18#endif 18#endif
19 19
20SECTIONS
21{
20#ifdef CONFIG_XIP_KERNEL 22#ifdef CONFIG_XIP_KERNEL
21#define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) 23 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
22#else 24#else
23#define TEXTADDR KERNEL_RAM_ADDR 25 . = PAGE_OFFSET + TEXT_OFFSET;
24#endif 26#endif
25
26SECTIONS
27{
28 . = TEXTADDR;
29 .init : { /* Init code and data */ 27 .init : { /* Init code and data */
30 _stext = .; 28 _stext = .;
31 _sinittext = .; 29 _sinittext = .;
@@ -104,7 +102,7 @@ SECTIONS
104 102
105#ifdef CONFIG_XIP_KERNEL 103#ifdef CONFIG_XIP_KERNEL
106 __data_loc = ALIGN(4); /* location in binary */ 104 __data_loc = ALIGN(4); /* location in binary */
107 . = KERNEL_RAM_ADDR; 105 . = PAGE_OFFSET + TEXT_OFFSET;
108#else 106#else
109 . = ALIGN(THREAD_SIZE); 107 . = ALIGN(THREAD_SIZE);
110 __data_loc = .; 108 __data_loc = .;
diff --git a/arch/arm/mach-aaec2000/clock.c b/arch/arm/mach-aaec2000/clock.c
index 0340ddc4824e..1c84c60941e1 100644
--- a/arch/arm/mach-aaec2000/clock.c
+++ b/arch/arm/mach-aaec2000/clock.c
@@ -15,9 +15,9 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/clk.h>
18 19
19#include <asm/semaphore.h> 20#include <asm/semaphore.h>
20#include <asm/hardware/clock.h>
21 21
22#include "clock.h" 22#include "clock.h"
23 23
@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
58} 58}
59EXPORT_SYMBOL(clk_disable); 59EXPORT_SYMBOL(clk_disable);
60 60
61int clk_use(struct clk *clk)
62{
63 return 0;
64}
65EXPORT_SYMBOL(clk_use);
66
67void clk_unuse(struct clk *clk)
68{
69}
70EXPORT_SYMBOL(clk_unuse);
71
72unsigned long clk_get_rate(struct clk *clk) 61unsigned long clk_get_rate(struct clk *clk)
73{ 62{
74 return clk->rate; 63 return clk->rate;
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index 4e706d9ad368..dce4815cf53c 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -20,11 +20,11 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/timex.h> 21#include <linux/timex.h>
22#include <linux/signal.h> 22#include <linux/signal.h>
23#include <linux/amba/bus.h>
23 24
24#include <asm/hardware.h> 25#include <asm/hardware.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/sizes.h> 27#include <asm/sizes.h>
27#include <asm/hardware/amba.h>
28 28
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-aaec2000/core.h b/arch/arm/mach-aaec2000/core.h
index daefc0ea14a1..b6029a95f19c 100644
--- a/arch/arm/mach-aaec2000/core.h
+++ b/arch/arm/mach-aaec2000/core.h
@@ -9,7 +9,7 @@
9 * 9 *
10 */ 10 */
11 11
12#include <asm/hardware/amba_clcd.h> 12#include <linux/amba/clcd.h>
13 13
14struct sys_timer; 14struct sys_timer;
15 15
diff --git a/arch/arm/mach-clps711x/dma.c b/arch/arm/mach-clps711x/dma.c
deleted file mode 100644
index af5a4de38eac..000000000000
--- a/arch/arm/mach-clps711x/dma.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/dma.c
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd
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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21
22#include <asm/dma.h>
23#include <asm/mach/dma.h>
24
25void __init arch_dma_init(dma_t *dma)
26{
27}
diff --git a/arch/arm/mach-epxa10db/dma.c b/arch/arm/mach-epxa10db/dma.c
deleted file mode 100644
index 0151e9f1c066..000000000000
--- a/arch/arm/mach-epxa10db/dma.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * linux/arch/arm/mach-epxa10db/dma.c
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/init.h>
22
23#include <asm/dma.h>
24#include <asm/mach/dma.h>
25
26void __init arch_dma_init(dma_t *dma)
27{
28}
diff --git a/arch/arm/mach-footbridge/dma.c b/arch/arm/mach-footbridge/dma.c
index a6b1396b0951..7a54578b51af 100644
--- a/arch/arm/mach-footbridge/dma.c
+++ b/arch/arm/mach-footbridge/dma.c
@@ -15,6 +15,7 @@
15 15
16#include <asm/dma.h> 16#include <asm/dma.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/scatterlist.h>
18 19
19#include <asm/mach/dma.h> 20#include <asm/mach/dma.h>
20#include <asm/hardware/dec21285.h> 21#include <asm/hardware/dec21285.h>
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index 708e1b3faa14..c9e0cd8ed016 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -29,27 +29,27 @@
29#include "generic.h" 29#include "generic.h"
30#include <asm/serial.h> 30#include <asm/serial.h>
31 31
32static struct resource mx1ads_resources[] = { 32static struct resource cs89x0_resources[] = {
33 [0] = { 33 [0] = {
34 .start = IMX_CS4_VIRT, 34 .start = IMX_CS4_PHYS + 0x300,
35 .end = IMX_CS4_VIRT + 16, 35 .end = IMX_CS4_PHYS + 0x300 + 16,
36 .flags = IORESOURCE_MEM, 36 .flags = IORESOURCE_MEM,
37 }, 37 },
38 [1] = { 38 [1] = {
39 .start = 13, 39 .start = IRQ_GPIOC(17),
40 .end = 13, 40 .end = IRQ_GPIOC(17),
41 .flags = IORESOURCE_IRQ, 41 .flags = IORESOURCE_IRQ,
42 }, 42 },
43}; 43};
44 44
45static struct platform_device mx1ads_device = { 45static struct platform_device cs89x0_device = {
46 .name = "mx1ads", 46 .name = "cirrus-cs89x0",
47 .num_resources = ARRAY_SIZE(mx1ads_resources), 47 .num_resources = ARRAY_SIZE(cs89x0_resources),
48 .resource = mx1ads_resources, 48 .resource = cs89x0_resources,
49}; 49};
50 50
51static struct platform_device *devices[] __initdata = { 51static struct platform_device *devices[] __initdata = {
52 &mx1ads_device, 52 &cs89x0_device,
53}; 53};
54 54
55static void __init 55static void __init
@@ -61,45 +61,10 @@ mx1ads_init(void)
61 platform_add_devices(devices, ARRAY_SIZE(devices)); 61 platform_add_devices(devices, ARRAY_SIZE(devices));
62} 62}
63 63
64static struct map_desc mx1ads_io_desc[] __initdata = {
65 {
66 .virtual = IMX_CS0_VIRT,
67 .pfn = __phys_to_pfn(IMX_CS0_PHYS),
68 .length = IMX_CS0_SIZE,
69 .type = MT_DEVICE
70 }, {
71 .virtual = IMX_CS1_VIRT,
72 .pfn = __phys_to_pfn(IMX_CS1_PHYS),
73 .length = IMX_CS1_SIZE,
74 .type = MT_DEVICE
75 }, {
76 .virtual = IMX_CS2_VIRT,
77 .pfn = __phys_to_pfn(IMX_CS2_PHYS),
78 .length = IMX_CS2_SIZE,
79 .type = MT_DEVICE
80 }, {
81 .virtual = IMX_CS3_VIRT,
82 .pfn = __phys_to_pfn(IMX_CS3_PHYS),
83 .length = IMX_CS3_SIZE,
84 .type = MT_DEVICE
85 }, {
86 .virtual = IMX_CS4_VIRT,
87 .pfn = __phys_to_pfn(IMX_CS4_PHYS),
88 .length = IMX_CS4_SIZE,
89 .type = MT_DEVICE
90 }, {
91 .virtual = IMX_CS5_VIRT,
92 .pfn = __phys_to_pfn(IMX_CS5_PHYS),
93 .length = IMX_CS5_SIZE,
94 .type = MT_DEVICE
95 }
96};
97
98static void __init 64static void __init
99mx1ads_map_io(void) 65mx1ads_map_io(void)
100{ 66{
101 imx_map_io(); 67 imx_map_io();
102 iotable_init(mx1ads_io_desc, ARRAY_SIZE(mx1ads_io_desc));
103} 68}
104 69
105MACHINE_START(MX1ADS, "Motorola MX1ADS") 70MACHINE_START(MX1ADS, "Motorola MX1ADS")
diff --git a/arch/arm/mach-integrator/clock.c b/arch/arm/mach-integrator/clock.c
index 73c360685cad..40684e01e865 100644
--- a/arch/arm/mach-integrator/clock.c
+++ b/arch/arm/mach-integrator/clock.c
@@ -14,9 +14,9 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/clk.h>
17 18
18#include <asm/semaphore.h> 19#include <asm/semaphore.h>
19#include <asm/hardware/clock.h>
20#include <asm/hardware/icst525.h> 20#include <asm/hardware/icst525.h>
21 21
22#include "clock.h" 22#include "clock.h"
@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
58} 58}
59EXPORT_SYMBOL(clk_disable); 59EXPORT_SYMBOL(clk_disable);
60 60
61int clk_use(struct clk *clk)
62{
63 return 0;
64}
65EXPORT_SYMBOL(clk_use);
66
67void clk_unuse(struct clk *clk)
68{
69}
70EXPORT_SYMBOL(clk_unuse);
71
72unsigned long clk_get_rate(struct clk *clk) 61unsigned long clk_get_rate(struct clk *clk)
73{ 62{
74 return clk->rate; 63 return clk->rate;
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index dacbf504dae2..20071a2767cc 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -15,11 +15,11 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/amba/bus.h>
18 19
19#include <asm/hardware.h> 20#include <asm/hardware.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/hardware/amba.h>
23#include <asm/hardware/arm_timer.h> 23#include <asm/hardware/arm_timer.h>
24#include <asm/arch/cm.h> 24#include <asm/arch/cm.h>
25#include <asm/system.h> 25#include <asm/system.h>
diff --git a/arch/arm/mach-integrator/dma.c b/arch/arm/mach-integrator/dma.c
deleted file mode 100644
index aae6f23cd72b..000000000000
--- a/arch/arm/mach-integrator/dma.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * linux/arch/arm/mach-integrator/dma.c
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/slab.h>
22#include <linux/mman.h>
23#include <linux/init.h>
24
25#include <asm/page.h>
26#include <asm/pgtable.h>
27#include <asm/dma.h>
28#include <asm/io.h>
29#include <asm/hardware.h>
30
31#include <asm/mach/dma.h>
32
33void __init arch_dma_init(dma_t *dma)
34{
35}
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index a4bafee77a06..a85d471c5bfa 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -18,11 +18,11 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/mm.h> 20#include <linux/mm.h>
21#include <linux/amba/bus.h>
22#include <linux/amba/clcd.h>
21 23
22#include <asm/io.h> 24#include <asm/io.h>
23#include <asm/hardware/icst525.h> 25#include <asm/hardware/icst525.h>
24#include <asm/hardware/amba.h>
25#include <asm/hardware/amba_clcd.h>
26#include <asm/arch/lm.h> 26#include <asm/arch/lm.h>
27#include <asm/arch/impd1.h> 27#include <asm/arch/impd1.h>
28#include <asm/sizes.h> 28#include <asm/sizes.h>
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 4c0f7c65facf..3afedeb56a6e 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -25,6 +25,8 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/string.h> 26#include <linux/string.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/amba/bus.h>
29#include <linux/amba/kmi.h>
28 30
29#include <asm/hardware.h> 31#include <asm/hardware.h>
30#include <asm/io.h> 32#include <asm/io.h>
@@ -32,8 +34,6 @@
32#include <asm/setup.h> 34#include <asm/setup.h>
33#include <asm/param.h> /* HZ */ 35#include <asm/param.h> /* HZ */
34#include <asm/mach-types.h> 36#include <asm/mach-types.h>
35#include <asm/hardware/amba.h>
36#include <asm/hardware/amba_kmi.h>
37 37
38#include <asm/arch/lm.h> 38#include <asm/arch/lm.h>
39 39
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 93f7ccb22c27..16cf2482a3e9 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -16,15 +16,15 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/sysdev.h> 18#include <linux/sysdev.h>
19#include <linux/amba/bus.h>
20#include <linux/amba/kmi.h>
21#include <linux/amba/clcd.h>
19 22
20#include <asm/hardware.h> 23#include <asm/hardware.h>
21#include <asm/io.h> 24#include <asm/io.h>
22#include <asm/irq.h> 25#include <asm/irq.h>
23#include <asm/setup.h> 26#include <asm/setup.h>
24#include <asm/mach-types.h> 27#include <asm/mach-types.h>
25#include <asm/hardware/amba.h>
26#include <asm/hardware/amba_kmi.h>
27#include <asm/hardware/amba_clcd.h>
28#include <asm/hardware/icst525.h> 28#include <asm/hardware/icst525.h>
29 29
30#include <asm/arch/cm.h> 30#include <asm/arch/cm.h>
diff --git a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c
index 1a844ca139e0..9f46aaef8968 100644
--- a/arch/arm/mach-integrator/time.c
+++ b/arch/arm/mach-integrator/time.c
@@ -14,8 +14,8 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/amba/bus.h>
17 18
18#include <asm/hardware/amba.h>
19#include <asm/hardware.h> 19#include <asm/hardware.h>
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
diff --git a/arch/arm/mach-iop3xx/iop331-setup.c b/arch/arm/mach-iop3xx/iop331-setup.c
index 53f60614498b..e6ea1cba6a17 100644
--- a/arch/arm/mach-iop3xx/iop331-setup.c
+++ b/arch/arm/mach-iop3xx/iop331-setup.c
@@ -18,7 +18,7 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/serial.h> 19#include <linux/serial.h>
20#include <linux/tty.h> 20#include <linux/tty.h>
21#include <linux/serial_core.h> 21#include <linux/serial_8250.h>
22 22
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
@@ -50,32 +50,74 @@ static struct map_desc iop331_std_desc[] __initdata = {
50 } 50 }
51}; 51};
52 52
53static struct uart_port iop331_serial_ports[] = { 53static struct resource iop33x_uart0_resources[] = {
54 { 54 [0] = {
55 .membase = (char*)(IOP331_UART0_VIRT), 55 .start = IOP331_UART0_PHYS,
56 .mapbase = (IOP331_UART0_PHYS), 56 .end = IOP331_UART0_PHYS + 0x3f,
57 .irq = IRQ_IOP331_UART0, 57 .flags = IORESOURCE_MEM,
58 .flags = UPF_SKIP_TEST, 58 },
59 .iotype = UPIO_MEM, 59 [1] = {
60 .regshift = 2, 60 .start = IRQ_IOP331_UART0,
61 .uartclk = IOP331_UART_XTAL, 61 .end = IRQ_IOP331_UART0,
62 .line = 0, 62 .flags = IORESOURCE_IRQ
63 .type = PORT_XSCALE, 63 }
64 .fifosize = 32 64};
65 } , { 65
66 .membase = (char*)(IOP331_UART1_VIRT), 66static struct resource iop33x_uart1_resources[] = {
67 .mapbase = (IOP331_UART1_PHYS), 67 [0] = {
68 .irq = IRQ_IOP331_UART1, 68 .start = IOP331_UART1_PHYS,
69 .flags = UPF_SKIP_TEST, 69 .end = IOP331_UART1_PHYS + 0x3f,
70 .iotype = UPIO_MEM, 70 .flags = IORESOURCE_MEM,
71 .regshift = 2, 71 },
72 .uartclk = IOP331_UART_XTAL, 72 [1] = {
73 .line = 1, 73 .start = IRQ_IOP331_UART1,
74 .type = PORT_XSCALE, 74 .end = IRQ_IOP331_UART1,
75 .fifosize = 32 75 .flags = IORESOURCE_IRQ
76 } 76 }
77}; 77};
78 78
79static struct plat_serial8250_port iop33x_uart0_data[] = {
80 {
81 .membase = (char*)(IOP331_UART0_VIRT),
82 .mapbase = (IOP331_UART0_PHYS),
83 .irq = IRQ_IOP331_UART0,
84 .uartclk = IOP331_UART_XTAL,
85 .regshift = 2,
86 .iotype = UPIO_MEM,
87 .flags = UPF_SKIP_TEST,
88 },
89 { },
90};
91
92static struct plat_serial8250_port iop33x_uart1_data[] = {
93 {
94 .membase = (char*)(IOP331_UART1_VIRT),
95 .mapbase = (IOP331_UART1_PHYS),
96 .irq = IRQ_IOP331_UART1,
97 .uartclk = IOP331_UART_XTAL,
98 .regshift = 2,
99 .iotype = UPIO_MEM,
100 .flags = UPF_SKIP_TEST,
101 },
102 { },
103};
104
105static struct platform_device iop33x_uart0 = {
106 .name = "serial8250",
107 .id = 0,
108 .dev.platform_data = iop33x_uart0_data,
109 .num_resources = 2,
110 .resource = iop33x_uart0_resources,
111};
112
113static struct platform_device iop33x_uart1 = {
114 .name = "serial8250",
115 .id = 1,
116 .dev.platform_data = iop33x_uart1_data,
117 .num_resources = 2,
118 .resource = iop33x_uart1_resources,
119};
120
79static struct resource iop33x_i2c_0_resources[] = { 121static struct resource iop33x_i2c_0_resources[] = {
80 [0] = { 122 [0] = {
81 .start = 0xfffff680, 123 .start = 0xfffff680,
@@ -117,6 +159,8 @@ static struct platform_device iop33x_i2c_1_controller = {
117}; 159};
118 160
119static struct platform_device *iop33x_devices[] __initdata = { 161static struct platform_device *iop33x_devices[] __initdata = {
162 &iop33x_uart0,
163 &iop33x_uart1,
120 &iop33x_i2c_0_controller, 164 &iop33x_i2c_0_controller,
121 &iop33x_i2c_1_controller 165 &iop33x_i2c_1_controller
122}; 166};
@@ -133,8 +177,6 @@ void __init iop33x_init(void)
133void __init iop331_map_io(void) 177void __init iop331_map_io(void)
134{ 178{
135 iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc)); 179 iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
136 early_serial_setup(&iop331_serial_ports[0]);
137 early_serial_setup(&iop331_serial_ports[1]);
138} 180}
139 181
140#ifdef CONFIG_ARCH_IOP331 182#ifdef CONFIG_ARCH_IOP331
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index 385285851cb5..daadc78e271b 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -71,6 +71,14 @@ config ARCH_PRPMC1100
71 PrPCM1100 Processor Mezanine Module. For more information on 71 PrPCM1100 Processor Mezanine Module. For more information on
72 this platform, see <file:Documentation/arm/IXP4xx>. 72 this platform, see <file:Documentation/arm/IXP4xx>.
73 73
74config MACH_NAS100D
75 bool
76 prompt "NAS100D"
77 help
78 Say 'Y' here if you want your kernel to support Iomega's
79 NAS 100d device. For more information on this platform,
80 see http://www.nslu2-linux.org/wiki/NAS100d/HomePage
81
74# 82#
75# Avila and IXDP share the same source for now. Will change in future 83# Avila and IXDP share the same source for now. Will change in future
76# 84#
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
index 7a15629c18d0..0471044fa179 100644
--- a/arch/arm/mach-ixp4xx/Makefile
+++ b/arch/arm/mach-ixp4xx/Makefile
@@ -9,4 +9,5 @@ obj-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o coyote-setup.o
9obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o 9obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o
10obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o 10obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o
11obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o 11obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o
12obj-$(CONFIG_MACH_NAS100D) += nas100d-pci.o nas100d-setup.o nas100d-power.o
12 13
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 9795da270e3a..6e3462ed5306 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -341,6 +341,29 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
341 return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M); 341 return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M);
342} 342}
343 343
344/*
345 * Only first 64MB of memory can be accessed via PCI.
346 * We use GFP_DMA to allocate safe buffers to do map/unmap.
347 * This is really ugly and we need a better way of specifying
348 * DMA-capable regions of memory.
349 */
350void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size,
351 unsigned long *zhole_size)
352{
353 unsigned int sz = SZ_64M >> PAGE_SHIFT;
354
355 /*
356 * Only adjust if > 64M on current system
357 */
358 if (node || (zone_size[0] <= sz))
359 return;
360
361 zone_size[1] = zone_size[0] - sz;
362 zone_size[0] = sz;
363 zhole_size[1] = zhole_size[0];
364 zhole_size[0] = 0;
365}
366
344void __init ixp4xx_pci_preinit(void) 367void __init ixp4xx_pci_preinit(void)
345{ 368{
346 unsigned long processor_id; 369 unsigned long processor_id;
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index f3c687cf0071..6b393691d0e8 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -142,6 +142,8 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
142 *int_reg &= ~(IXP4XX_GPIO_STYLE_CLEAR << 142 *int_reg &= ~(IXP4XX_GPIO_STYLE_CLEAR <<
143 (line * IXP4XX_GPIO_STYLE_SIZE)); 143 (line * IXP4XX_GPIO_STYLE_SIZE));
144 144
145 *IXP4XX_GPIO_GPISR = (1 << line);
146
145 /* Set the new style */ 147 /* Set the new style */
146 *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE)); 148 *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));
147 149
@@ -169,7 +171,7 @@ static void ixp4xx_irq_ack(unsigned int irq)
169 int line = (irq < 32) ? irq2gpio[irq] : -1; 171 int line = (irq < 32) ? irq2gpio[irq] : -1;
170 172
171 if (line >= 0) 173 if (line >= 0)
172 gpio_line_isr_clear(line); 174 *IXP4XX_GPIO_GPISR = (1 << line);
173} 175}
174 176
175/* 177/*
@@ -330,11 +332,27 @@ static struct platform_device *ixp46x_devices[] __initdata = {
330 &ixp46x_i2c_controller 332 &ixp46x_i2c_controller
331}; 333};
332 334
335unsigned long ixp4xx_exp_bus_size;
336
333void __init ixp4xx_sys_init(void) 337void __init ixp4xx_sys_init(void)
334{ 338{
339 ixp4xx_exp_bus_size = SZ_16M;
340
335 if (cpu_is_ixp46x()) { 341 if (cpu_is_ixp46x()) {
342 int region;
343
336 platform_add_devices(ixp46x_devices, 344 platform_add_devices(ixp46x_devices,
337 ARRAY_SIZE(ixp46x_devices)); 345 ARRAY_SIZE(ixp46x_devices));
346
347 for (region = 0; region < 7; region++) {
348 if((*(IXP4XX_EXP_REG(0x4 * region)) & 0x200)) {
349 ixp4xx_exp_bus_size = SZ_32M;
350 break;
351 }
352 }
338 } 353 }
354
355 printk("IXP4xx: Using %uMiB expansion bus window size\n",
356 ixp4xx_exp_bus_size >> 20);
339} 357}
340 358
diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c
index 60de8a94cff5..e6b7fcd923fa 100644
--- a/arch/arm/mach-ixp4xx/coyote-pci.c
+++ b/arch/arm/mach-ixp4xx/coyote-pci.c
@@ -33,9 +33,6 @@ void __init coyote_pci_preinit(void)
33 set_irq_type(IRQ_COYOTE_PCI_SLOT0, IRQT_LOW); 33 set_irq_type(IRQ_COYOTE_PCI_SLOT0, IRQT_LOW);
34 set_irq_type(IRQ_COYOTE_PCI_SLOT1, IRQT_LOW); 34 set_irq_type(IRQ_COYOTE_PCI_SLOT1, IRQT_LOW);
35 35
36 gpio_line_isr_clear(COYOTE_PCI_SLOT0_PIN);
37 gpio_line_isr_clear(COYOTE_PCI_SLOT1_PIN);
38
39 ixp4xx_pci_preinit(); 36 ixp4xx_pci_preinit();
40} 37}
41 38
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 050c92768913..679594a73981 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -14,6 +14,7 @@
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/slab.h>
17 18
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/setup.h> 20#include <asm/setup.h>
@@ -30,8 +31,6 @@ static struct flash_platform_data coyote_flash_data = {
30}; 31};
31 32
32static struct resource coyote_flash_resource = { 33static struct resource coyote_flash_resource = {
33 .start = COYOTE_FLASH_BASE,
34 .end = COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE - 1,
35 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
36}; 35};
37 36
@@ -81,6 +80,11 @@ static struct platform_device *coyote_devices[] __initdata = {
81 80
82static void __init coyote_init(void) 81static void __init coyote_init(void)
83{ 82{
83 ixp4xx_sys_init();
84
85 coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
86 coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
87
84 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; 88 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
85 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; 89 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
86 90
@@ -91,8 +95,6 @@ static void __init coyote_init(void)
91 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1; 95 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
92 } 96 }
93 97
94
95 ixp4xx_sys_init();
96 platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices)); 98 platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
97} 99}
98 100
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 29a6d02fa851..038670489970 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -27,6 +27,7 @@
27#include <linux/serial.h> 27#include <linux/serial.h>
28#include <linux/tty.h> 28#include <linux/tty.h>
29#include <linux/serial_8250.h> 29#include <linux/serial_8250.h>
30#include <linux/slab.h>
30 31
31#include <asm/types.h> 32#include <asm/types.h>
32#include <asm/setup.h> 33#include <asm/setup.h>
@@ -106,11 +107,9 @@ static struct flash_platform_data gtwx5715_flash_data = {
106 .width = 2, 107 .width = 2,
107}; 108};
108 109
109static struct resource gtwx5715_flash_resource = { 110static struct gtw5715_flash_resource = {
110 .start = GTWX5715_FLASH_BASE,
111 .end = GTWX5715_FLASH_BASE + GTWX5715_FLASH_SIZE - 1,
112 .flags = IORESOURCE_MEM, 111 .flags = IORESOURCE_MEM,
113}; 112}
114 113
115static struct platform_device gtwx5715_flash = { 114static struct platform_device gtwx5715_flash = {
116 .name = "IXP4XX-Flash", 115 .name = "IXP4XX-Flash",
@@ -129,6 +128,14 @@ static struct platform_device *gtwx5715_devices[] __initdata = {
129 128
130static void __init gtwx5715_init(void) 129static void __init gtwx5715_init(void)
131{ 130{
131 ixp4xx_sys_init();
132
133 if (!flash_resource)
134 printk(KERN_ERR "Could not allocate flash resource\n");
135
136 gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
137 gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;
138
132 platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices)); 139 platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
133} 140}
134 141
diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c
index f9a1d3e7d692..da415d5d7f37 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
@@ -32,11 +32,6 @@ void __init ixdp425_pci_preinit(void)
32 set_irq_type(IRQ_IXDP425_PCI_INTC, IRQT_LOW); 32 set_irq_type(IRQ_IXDP425_PCI_INTC, IRQT_LOW);
33 set_irq_type(IRQ_IXDP425_PCI_INTD, IRQT_LOW); 33 set_irq_type(IRQ_IXDP425_PCI_INTD, IRQT_LOW);
34 34
35 gpio_line_isr_clear(IXDP425_PCI_INTA_PIN);
36 gpio_line_isr_clear(IXDP425_PCI_INTB_PIN);
37 gpio_line_isr_clear(IXDP425_PCI_INTC_PIN);
38 gpio_line_isr_clear(IXDP425_PCI_INTD_PIN);
39
40 ixp4xx_pci_preinit(); 35 ixp4xx_pci_preinit();
41} 36}
42 37
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 3a22d84e1047..c2e105c89c95 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -14,6 +14,7 @@
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/slab.h>
17 18
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/setup.h> 20#include <asm/setup.h>
@@ -30,8 +31,6 @@ static struct flash_platform_data ixdp425_flash_data = {
30}; 31};
31 32
32static struct resource ixdp425_flash_resource = { 33static struct resource ixdp425_flash_resource = {
33 .start = IXDP425_FLASH_BASE,
34 .end = IXDP425_FLASH_BASE + IXDP425_FLASH_SIZE - 1,
35 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
36}; 35};
37 36
@@ -108,17 +107,13 @@ static struct platform_device *ixdp425_devices[] __initdata = {
108 &ixdp425_uart 107 &ixdp425_uart
109}; 108};
110 109
111
112static void __init ixdp425_init(void) 110static void __init ixdp425_init(void)
113{ 111{
114 ixp4xx_sys_init(); 112 ixp4xx_sys_init();
115 113
116 /* 114 ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
117 * IXP465 has 32MB window 115 ixdp425_flash_resource.end =
118 */ 116 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
119 if (machine_is_ixdp465()) {
120 ixdp425_flash_resource.end += IXDP425_FLASH_SIZE;
121 }
122 117
123 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices)); 118 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
124} 119}
diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
index fe5e7660de1d..526fb6175bc3 100644
--- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
@@ -32,9 +32,6 @@ void __init ixdpg425_pci_preinit(void)
32 set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW); 32 set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW);
33 set_irq_type(IRQ_IXP4XX_GPIO7, IRQT_LOW); 33 set_irq_type(IRQ_IXP4XX_GPIO7, IRQT_LOW);
34 34
35 gpio_line_isr_clear(6);
36 gpio_line_isr_clear(7);
37
38 ixp4xx_pci_preinit(); 35 ixp4xx_pci_preinit();
39} 36}
40 37
diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c
new file mode 100644
index 000000000000..26b7c001ff64
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/nas100d-pci.c
@@ -0,0 +1,71 @@
1/*
2 * arch/arm/mach-ixp4xx/nas100d-pci.c
3 *
4 * NAS 100d board-level PCI initialization
5 *
6 * based on ixdp425-pci.c:
7 * Copyright (C) 2002 Intel Corporation.
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 *
10 * Maintainer: http://www.nslu2-linux.org/
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 */
17
18#include <linux/config.h>
19#include <linux/pci.h>
20#include <linux/init.h>
21
22#include <asm/mach/pci.h>
23#include <asm/mach-types.h>
24
25void __init nas100d_pci_preinit(void)
26{
27 set_irq_type(IRQ_NAS100D_PCI_INTA, IRQT_LOW);
28 set_irq_type(IRQ_NAS100D_PCI_INTB, IRQT_LOW);
29 set_irq_type(IRQ_NAS100D_PCI_INTC, IRQT_LOW);
30 set_irq_type(IRQ_NAS100D_PCI_INTD, IRQT_LOW);
31 set_irq_type(IRQ_NAS100D_PCI_INTE, IRQT_LOW);
32
33 ixp4xx_pci_preinit();
34}
35
36static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
37{
38 static int pci_irq_table[NAS100D_PCI_MAX_DEV][NAS100D_PCI_IRQ_LINES] =
39 {
40 { IRQ_NAS100D_PCI_INTA, -1, -1 },
41 { IRQ_NAS100D_PCI_INTB, -1, -1 },
42 { IRQ_NAS100D_PCI_INTC, IRQ_NAS100D_PCI_INTD, IRQ_NAS100D_PCI_INTE },
43 };
44
45 int irq = -1;
46
47 if (slot >= 1 && slot <= NAS100D_PCI_MAX_DEV &&
48 pin >= 1 && pin <= NAS100D_PCI_IRQ_LINES)
49 irq = pci_irq_table[slot-1][pin-1];
50
51 return irq;
52}
53
54struct hw_pci __initdata nas100d_pci = {
55 .nr_controllers = 1,
56 .preinit = nas100d_pci_preinit,
57 .swizzle = pci_std_swizzle,
58 .setup = ixp4xx_setup,
59 .scan = ixp4xx_scan_bus,
60 .map_irq = nas100d_map_irq,
61};
62
63int __init nas100d_pci_init(void)
64{
65 if (machine_is_nas100d())
66 pci_common_init(&nas100d_pci);
67
68 return 0;
69}
70
71subsys_initcall(nas100d_pci_init);
diff --git a/arch/arm/mach-ixp4xx/nas100d-power.c b/arch/arm/mach-ixp4xx/nas100d-power.c
new file mode 100644
index 000000000000..2bec69bfa715
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/nas100d-power.c
@@ -0,0 +1,67 @@
1/*
2 * arch/arm/mach-ixp4xx/nas100d-power.c
3 *
4 * NAS 100d Power/Reset driver
5 *
6 * Copyright (C) 2005 Tower Technologies
7 *
8 * based on nas100d-io.c
9 * Copyright (C) 2004 Karen Spearel
10 *
11 * Author: Alessandro Zummo <a.zummo@towertech.it>
12 * Maintainers: http://www.nslu2-linux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 *
18 */
19
20#include <linux/module.h>
21#include <linux/reboot.h>
22#include <linux/interrupt.h>
23
24#include <asm/mach-types.h>
25
26extern void ctrl_alt_del(void);
27
28static irqreturn_t nas100d_reset_handler(int irq, void *dev_id, struct pt_regs *regs)
29{
30 /* Signal init to do the ctrlaltdel action, this will bypass init if
31 * it hasn't started and do a kernel_restart.
32 */
33 ctrl_alt_del();
34
35 return IRQ_HANDLED;
36}
37
38static int __init nas100d_power_init(void)
39{
40 if (!(machine_is_nas100d()))
41 return 0;
42
43 set_irq_type(NAS100D_RB_IRQ, IRQT_LOW);
44
45 if (request_irq(NAS100D_RB_IRQ, &nas100d_reset_handler,
46 SA_INTERRUPT, "NAS100D reset button", NULL) < 0) {
47
48 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
49 NAS100D_RB_IRQ);
50
51 return -EIO;
52 }
53
54 return 0;
55}
56
57static void __exit nas100d_power_exit(void)
58{
59 free_irq(NAS100D_RB_IRQ, NULL);
60}
61
62module_init(nas100d_power_init);
63module_exit(nas100d_power_exit);
64
65MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
66MODULE_DESCRIPTION("NAS100D Power/Reset driver");
67MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
new file mode 100644
index 000000000000..49998a8bd4e8
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -0,0 +1,135 @@
1/*
2 * arch/arm/mach-ixp4xx/nas100d-setup.c
3 *
4 * NAS 100d board-setup
5 *
6 * based ixdp425-setup.c:
7 * Copyright (C) 2003-2004 MontaVista Software, Inc.
8 *
9 * Author: Alessandro Zummo <a.zummo@towertech.it>
10 * Author: Rod Whitby <rod@whitby.id.au>
11 * Maintainers: http://www.nslu2-linux.org/
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/serial.h>
17#include <linux/serial_8250.h>
18
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/flash.h>
22
23static struct flash_platform_data nas100d_flash_data = {
24 .map_name = "cfi_probe",
25 .width = 2,
26};
27
28static struct resource nas100d_flash_resource = {
29 .flags = IORESOURCE_MEM,
30};
31
32static struct platform_device nas100d_flash = {
33 .name = "IXP4XX-Flash",
34 .id = 0,
35 .dev.platform_data = &nas100d_flash_data,
36 .num_resources = 1,
37 .resource = &nas100d_flash_resource,
38};
39
40static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
41 .sda_pin = NAS100D_SDA_PIN,
42 .scl_pin = NAS100D_SCL_PIN,
43};
44
45static struct platform_device nas100d_i2c_controller = {
46 .name = "IXP4XX-I2C",
47 .id = 0,
48 .dev.platform_data = &nas100d_i2c_gpio_pins,
49 .num_resources = 0,
50};
51
52static struct resource nas100d_uart_resources[] = {
53 {
54 .start = IXP4XX_UART1_BASE_PHYS,
55 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
56 .flags = IORESOURCE_MEM,
57 },
58 {
59 .start = IXP4XX_UART2_BASE_PHYS,
60 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
61 .flags = IORESOURCE_MEM,
62 }
63};
64
65static struct plat_serial8250_port nas100d_uart_data[] = {
66 {
67 .mapbase = IXP4XX_UART1_BASE_PHYS,
68 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
69 .irq = IRQ_IXP4XX_UART1,
70 .flags = UPF_BOOT_AUTOCONF,
71 .iotype = UPIO_MEM,
72 .regshift = 2,
73 .uartclk = IXP4XX_UART_XTAL,
74 },
75 {
76 .mapbase = IXP4XX_UART2_BASE_PHYS,
77 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
78 .irq = IRQ_IXP4XX_UART2,
79 .flags = UPF_BOOT_AUTOCONF,
80 .iotype = UPIO_MEM,
81 .regshift = 2,
82 .uartclk = IXP4XX_UART_XTAL,
83 },
84 { }
85};
86
87static struct platform_device nas100d_uart = {
88 .name = "serial8250",
89 .id = PLAT8250_DEV_PLATFORM,
90 .dev.platform_data = nas100d_uart_data,
91 .num_resources = 2,
92 .resource = nas100d_uart_resources,
93};
94
95static struct platform_device *nas100d_devices[] __initdata = {
96 &nas100d_i2c_controller,
97 &nas100d_flash,
98 &nas100d_uart,
99};
100
101static void nas100d_power_off(void)
102{
103 /* This causes the box to drop the power and go dead. */
104
105 /* enable the pwr cntl gpio */
106 gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
107
108 /* do the deed */
109 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
110}
111
112static void __init nas100d_init(void)
113{
114 ixp4xx_sys_init();
115
116 nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
117 nas100d_flash_resource.end =
118 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
119
120 pm_power_off = nas100d_power_off;
121
122 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
123}
124
125MACHINE_START(NAS100D, "Iomega NAS 100d")
126 /* Maintainer: www.nslu2-linux.org */
127 .phys_ram = PHYS_OFFSET,
128 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
129 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
130 .boot_params = 0x00000100,
131 .map_io = ixp4xx_map_io,
132 .init_irq = ixp4xx_init_irq,
133 .timer = &ixp4xx_timer,
134 .init_machine = nas100d_init,
135MACHINE_END
diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c
index a575f2e0b2c8..ece860444d5b 100644
--- a/arch/arm/mach-ixp4xx/nslu2-pci.c
+++ b/arch/arm/mach-ixp4xx/nslu2-pci.c
@@ -28,14 +28,6 @@ void __init nslu2_pci_preinit(void)
28 set_irq_type(IRQ_NSLU2_PCI_INTB, IRQT_LOW); 28 set_irq_type(IRQ_NSLU2_PCI_INTB, IRQT_LOW);
29 set_irq_type(IRQ_NSLU2_PCI_INTC, IRQT_LOW); 29 set_irq_type(IRQ_NSLU2_PCI_INTC, IRQT_LOW);
30 30
31 gpio_line_isr_clear(NSLU2_PCI_INTA_PIN);
32 gpio_line_isr_clear(NSLU2_PCI_INTB_PIN);
33 gpio_line_isr_clear(NSLU2_PCI_INTC_PIN);
34
35 /* INTD is not configured as GPIO is used
36 * for the power input button.
37 */
38
39 ixp4xx_pci_preinit(); 31 ixp4xx_pci_preinit();
40} 32}
41 33
diff --git a/arch/arm/mach-ixp4xx/nslu2-power.c b/arch/arm/mach-ixp4xx/nslu2-power.c
index 18fbc8c0fb30..b0ad9e901f6e 100644
--- a/arch/arm/mach-ixp4xx/nslu2-power.c
+++ b/arch/arm/mach-ixp4xx/nslu2-power.c
@@ -54,9 +54,6 @@ static int __init nslu2_power_init(void)
54 set_irq_type(NSLU2_RB_IRQ, IRQT_LOW); 54 set_irq_type(NSLU2_RB_IRQ, IRQT_LOW);
55 set_irq_type(NSLU2_PB_IRQ, IRQT_HIGH); 55 set_irq_type(NSLU2_PB_IRQ, IRQT_HIGH);
56 56
57 gpio_line_isr_clear(NSLU2_RB_GPIO);
58 gpio_line_isr_clear(NSLU2_PB_GPIO);
59
60 if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler, 57 if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler,
61 SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) { 58 SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) {
62 59
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 540b20d78cca..5c975eb5c34b 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/notifier.h> 21#include <linux/notifier.h>
22#include <linux/clk.h>
22 23
23#include <asm/hardware.h> 24#include <asm/hardware.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -30,7 +31,6 @@
30#include <asm/arch/usb.h> 31#include <asm/arch/usb.h>
31#include <asm/arch/board.h> 32#include <asm/arch/board.h>
32#include <asm/arch/common.h> 33#include <asm/arch/common.h>
33#include <asm/hardware/clock.h>
34 34
35static void __init omap_generic_init_irq(void) 35static void __init omap_generic_init_irq(void)
36{ 36{
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 4277eee44ed5..9d862f86bba6 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -16,9 +16,9 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h>
19 20
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/hardware/clock.h>
22 22
23#include <asm/arch/usb.h> 23#include <asm/arch/usb.h>
24#include <asm/arch/clock.h> 24#include <asm/arch/clock.h>
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 6810cfb84462..fcfb81d13cfe 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -17,10 +17,10 @@
17#include <linux/tty.h> 17#include <linux/tty.h>
18#include <linux/serial_8250.h> 18#include <linux/serial_8250.h>
19#include <linux/serial_reg.h> 19#include <linux/serial_reg.h>
20#include <linux/clk.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/hardware/clock.h>
24 24
25#include <asm/arch/board.h> 25#include <asm/arch/board.h>
26#include <asm/arch/mux.h> 26#include <asm/arch/mux.h>
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 85818d9f2635..5407b9549150 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -22,10 +22,10 @@
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/clk.h>
25 26
26#include <asm/io.h> 27#include <asm/io.h>
27 28
28#include <asm/hardware/clock.h>
29#include <asm/arch/clock.h> 29#include <asm/arch/clock.h>
30#include <asm/arch/sram.h> 30#include <asm/arch/sram.h>
31#include <asm/arch/prcm.h> 31#include <asm/arch/prcm.h>
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index f4df04fe1dd8..e1bd46a96e11 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -16,9 +16,9 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
18#include <linux/serial_reg.h> 18#include <linux/serial_reg.h>
19#include <linux/clk.h>
19 20
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/hardware/clock.h>
22 22
23#include <asm/arch/common.h> 23#include <asm/arch/common.h>
24#include <asm/arch/board.h> 24#include <asm/arch/board.h>
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 9ec11443200f..23d36b1c40fe 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -21,10 +21,11 @@
21#include <linux/time.h> 21#include <linux/time.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/clk.h>
25
24#include <asm/mach/time.h> 26#include <asm/mach/time.h>
25#include <asm/delay.h> 27#include <asm/delay.h>
26#include <asm/io.h> 28#include <asm/io.h>
27#include <asm/hardware/clock.h>
28 29
29#define OMAP2_GP_TIMER1_BASE 0x48028000 30#define OMAP2_GP_TIMER1_BASE 0x48028000
30#define OMAP2_GP_TIMER2_BASE 0x4802a000 31#define OMAP2_GP_TIMER2_BASE 0x4802a000
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 2a58499c0968..c1d77f5b3823 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -112,12 +112,14 @@ config IWMMXT
112config PXA_SHARP_C7xx 112config PXA_SHARP_C7xx
113 bool 113 bool
114 select PXA_SSP 114 select PXA_SSP
115 select SHARPSL_PM
115 help 116 help
116 Enable support for all Sharp C7xx models 117 Enable support for all Sharp C7xx models
117 118
118config PXA_SHARP_Cxx00 119config PXA_SHARP_Cxx00
119 bool 120 bool
120 select PXA_SSP 121 select PXA_SSP
122 select SHARPSL_PM
121 help 123 help
122 Enable common support for Sharp Cxx00 models 124 Enable common support for Sharp Cxx00 models
123 125
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 599be14754f9..7a1ab73e9e10 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -33,19 +33,7 @@ static void corgi_charger_init(void)
33 pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT); 33 pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT);
34 pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT); 34 pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT);
35 pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN); 35 pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN);
36} 36 sharpsl_pm_pxa_init();
37
38static void corgi_charge_led(int val)
39{
40 if (val == SHARPSL_LED_ERROR) {
41 dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
42 } else if (val == SHARPSL_LED_ON) {
43 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
44 GPSR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
45 } else {
46 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
47 GPCR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
48 }
49} 37}
50 38
51static void corgi_measure_temp(int on) 39static void corgi_measure_temp(int on)
@@ -138,15 +126,15 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
138 dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR); 126 dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR);
139 127
140 if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) { 128 if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) {
141 if (STATUS_AC_IN()) { 129 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
142 /* charge on */ 130 /* charge on */
143 dev_dbg(sharpsl_pm.dev, "ac insert\n"); 131 dev_dbg(sharpsl_pm.dev, "ac insert\n");
144 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG; 132 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
145 } else { 133 } else {
146 /* charge off */ 134 /* charge off */
147 dev_dbg(sharpsl_pm.dev, "ac remove\n"); 135 dev_dbg(sharpsl_pm.dev, "ac remove\n");
148 CHARGE_LED_OFF(); 136 sharpsl_pm_led(SHARPSL_LED_OFF);
149 CHARGE_OFF(); 137 sharpsl_pm.machinfo->charge(0);
150 sharpsl_pm.charge_mode = CHRG_OFF; 138 sharpsl_pm.charge_mode = CHRG_OFF;
151 } 139 }
152 } 140 }
@@ -172,23 +160,39 @@ static unsigned long corgi_charger_wakeup(void)
172 return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) ); 160 return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) );
173} 161}
174 162
175static int corgi_acin_status(void) 163unsigned long corgipm_read_devdata(int type)
176{ 164{
177 return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0); 165 switch(type) {
166 case SHARPSL_STATUS_ACIN:
167 return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0);
168 case SHARPSL_STATUS_LOCK:
169 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock);
170 case SHARPSL_STATUS_CHRGFULL:
171 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull);
172 case SHARPSL_STATUS_FATAL:
173 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal);
174 case SHARPSL_ACIN_VOLT:
175 return sharpsl_pm_pxa_read_max1111(MAX1111_ACIN_VOLT);
176 case SHARPSL_BATT_TEMP:
177 return sharpsl_pm_pxa_read_max1111(MAX1111_BATT_TEMP);
178 case SHARPSL_BATT_VOLT:
179 default:
180 return sharpsl_pm_pxa_read_max1111(MAX1111_BATT_VOLT);
181 }
178} 182}
179 183
180static struct sharpsl_charger_machinfo corgi_pm_machinfo = { 184static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
181 .init = corgi_charger_init, 185 .init = corgi_charger_init,
186 .exit = sharpsl_pm_pxa_remove,
182 .gpio_batlock = CORGI_GPIO_BAT_COVER, 187 .gpio_batlock = CORGI_GPIO_BAT_COVER,
183 .gpio_acin = CORGI_GPIO_AC_IN, 188 .gpio_acin = CORGI_GPIO_AC_IN,
184 .gpio_batfull = CORGI_GPIO_CHRG_FULL, 189 .gpio_batfull = CORGI_GPIO_CHRG_FULL,
185 .status_acin = corgi_acin_status,
186 .discharge = corgi_discharge, 190 .discharge = corgi_discharge,
187 .charge = corgi_charge, 191 .charge = corgi_charge,
188 .chargeled = corgi_charge_led,
189 .measure_temp = corgi_measure_temp, 192 .measure_temp = corgi_measure_temp,
190 .presuspend = corgi_presuspend, 193 .presuspend = corgi_presuspend,
191 .postsuspend = corgi_postsuspend, 194 .postsuspend = corgi_postsuspend,
195 .read_devdata = corgipm_read_devdata,
192 .charger_wakeup = corgi_charger_wakeup, 196 .charger_wakeup = corgi_charger_wakeup,
193 .should_wakeup = corgi_should_wakeup, 197 .should_wakeup = corgi_should_wakeup,
194 .bat_levels = 40, 198 .bat_levels = 40,
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 277498ae5b6c..8da9d3efe9a0 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -427,6 +427,12 @@ static void __init mainstone_init(void)
427 printk(KERN_NOTICE "Mainstone configured to boot from %s\n", 427 printk(KERN_NOTICE "Mainstone configured to boot from %s\n",
428 mst_flash_data[0].name); 428 mst_flash_data[0].name);
429 429
430 /* system bus arbiter setting
431 * - Core_Park
432 * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
433 */
434 ARB_CNTRL = ARB_CORE_PARK | 0x234;
435
430 /* 436 /*
431 * On Mainstone, we route AC97_SYSCLK via GPIO45 to 437 * On Mainstone, we route AC97_SYSCLK via GPIO45 to
432 * the audio daughter card 438 * the audio daughter card
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h
index b0c40a1d6671..da4769caaf72 100644
--- a/arch/arm/mach-pxa/sharpsl.h
+++ b/arch/arm/mach-pxa/sharpsl.h
@@ -1,7 +1,17 @@
1/* 1/*
2 * SharpSL SSP Driver 2 * Copyright (c) 2004-2005 Richard Purdie
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
3 */ 8 */
4 9
10#include <asm/hardware/sharpsl_pm.h>
11
12/*
13 * SharpSL SSP Driver
14 */
5struct corgissp_machinfo { 15struct corgissp_machinfo {
6 int port; 16 int port;
7 int cs_lcdcon; 17 int cs_lcdcon;
@@ -14,18 +24,18 @@ struct corgissp_machinfo {
14 24
15void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo); 25void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo);
16 26
27
17/* 28/*
18 * SharpSL Backlight 29 * SharpSL Backlight
19 */ 30 */
20
21void corgi_bl_set_intensity(int intensity); 31void corgi_bl_set_intensity(int intensity);
22void spitz_bl_set_intensity(int intensity); 32void spitz_bl_set_intensity(int intensity);
23void akita_bl_set_intensity(int intensity); 33void akita_bl_set_intensity(int intensity);
24 34
35
25/* 36/*
26 * SharpSL Touchscreen Driver 37 * SharpSL Touchscreen Driver
27 */ 38 */
28
29unsigned long corgi_get_hsync_len(void); 39unsigned long corgi_get_hsync_len(void);
30unsigned long spitz_get_hsync_len(void); 40unsigned long spitz_get_hsync_len(void);
31void corgi_put_hsync(void); 41void corgi_put_hsync(void);
@@ -33,89 +43,22 @@ void spitz_put_hsync(void);
33void corgi_wait_hsync(void); 43void corgi_wait_hsync(void);
34void spitz_wait_hsync(void); 44void spitz_wait_hsync(void);
35 45
46
36/* 47/*
37 * SharpSL Battery/PM Driver 48 * SharpSL Battery/PM Driver
38 */ 49 */
39 50
40struct sharpsl_charger_machinfo { 51#define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x))
41 void (*init)(void);
42 int gpio_acin;
43 int gpio_batfull;
44 int gpio_batlock;
45 int gpio_fatal;
46 int (*status_acin)(void);
47 void (*discharge)(int);
48 void (*discharge1)(int);
49 void (*charge)(int);
50 void (*chargeled)(int);
51 void (*measure_temp)(int);
52 void (*presuspend)(void);
53 void (*postsuspend)(void);
54 unsigned long (*charger_wakeup)(void);
55 int (*should_wakeup)(unsigned int resume_on_alarm);
56 int bat_levels;
57 struct battery_thresh *bat_levels_noac;
58 struct battery_thresh *bat_levels_acin;
59 int status_high_acin;
60 int status_low_acin;
61 int status_high_noac;
62 int status_low_noac;
63};
64
65struct battery_thresh {
66 int voltage;
67 int percentage;
68};
69
70struct battery_stat {
71 int ac_status; /* APM AC Present/Not Present */
72 int mainbat_status; /* APM Main Battery Status */
73 int mainbat_percent; /* Main Battery Percentage Charge */
74 int mainbat_voltage; /* Main Battery Voltage */
75};
76
77struct sharpsl_pm_status {
78 struct device *dev;
79 struct timer_list ac_timer;
80 struct timer_list chrg_full_timer;
81
82 int charge_mode;
83#define CHRG_ERROR (-1)
84#define CHRG_OFF (0)
85#define CHRG_ON (1)
86#define CHRG_DONE (2)
87
88 unsigned int flags;
89#define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */
90#define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */
91#define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */
92#define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */
93#define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */
94 52
95 int full_count; 53/* MAX1111 Channel Definitions */
96 unsigned long charge_start_time; 54#define MAX1111_BATT_VOLT 4u
97 struct sharpsl_charger_machinfo *machinfo; 55#define MAX1111_BATT_TEMP 2u
98 struct battery_stat battstat; 56#define MAX1111_ACIN_VOLT 6u
99};
100 57
101extern struct sharpsl_pm_status sharpsl_pm;
102extern struct battery_thresh spitz_battery_levels_acin[]; 58extern struct battery_thresh spitz_battery_levels_acin[];
103extern struct battery_thresh spitz_battery_levels_noac[]; 59extern struct battery_thresh spitz_battery_levels_noac[];
60void sharpsl_pm_pxa_init(void);
61void sharpsl_pm_pxa_remove(void);
62int sharpsl_pm_pxa_read_max1111(int channel);
104 63
105#define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x))
106
107#define SHARPSL_LED_ERROR 2
108#define SHARPSL_LED_ON 1
109#define SHARPSL_LED_OFF 0
110 64
111#define CHARGE_ON() sharpsl_pm.machinfo->charge(1)
112#define CHARGE_OFF() sharpsl_pm.machinfo->charge(0)
113#define CHARGE_LED_ON() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ON)
114#define CHARGE_LED_OFF() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_OFF)
115#define CHARGE_LED_ERR() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ERROR)
116#define DISCHARGE_ON() sharpsl_pm.machinfo->discharge(1)
117#define DISCHARGE_OFF() sharpsl_pm.machinfo->discharge(0)
118#define STATUS_AC_IN() sharpsl_pm.machinfo->status_acin()
119#define STATUS_BATT_LOCKED() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock)
120#define STATUS_CHRG_FULL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull)
121#define STATUS_FATAL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal)
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index c10be00fb526..6d402b262d8a 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -15,48 +15,20 @@
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/timer.h>
19#include <linux/init.h> 18#include <linux/init.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/apm_bios.h>
22#include <linux/delay.h>
23#include <linux/interrupt.h> 20#include <linux/interrupt.h>
24#include <linux/platform_device.h> 21#include <linux/platform_device.h>
25 22
26#include <asm/hardware.h> 23#include <asm/hardware.h>
27#include <asm/hardware/scoop.h>
28#include <asm/mach-types.h> 24#include <asm/mach-types.h>
29#include <asm/irq.h> 25#include <asm/irq.h>
30#include <asm/apm.h> 26#include <asm/apm.h>
31
32#include <asm/arch/pm.h> 27#include <asm/arch/pm.h>
33#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
34#include <asm/arch/sharpsl.h> 29#include <asm/arch/sharpsl.h>
35#include "sharpsl.h" 30#include "sharpsl.h"
36 31
37/*
38 * Constants
39 */
40#define SHARPSL_CHARGE_ON_TIME_INTERVAL (msecs_to_jiffies(1*60*1000)) /* 1 min */
41#define SHARPSL_CHARGE_FINISH_TIME (msecs_to_jiffies(10*60*1000)) /* 10 min */
42#define SHARPSL_BATCHK_TIME (msecs_to_jiffies(15*1000)) /* 15 sec */
43#define SHARPSL_BATCHK_TIME_SUSPEND (60*10) /* 10 min */
44#define SHARPSL_WAIT_CO_TIME 15 /* 15 sec */
45#define SHARPSL_WAIT_DISCHARGE_ON 100 /* 100 msec */
46#define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */
47#define SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT 10 /* 10 msec */
48#define SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN 10 /* 10 msec */
49#define SHARPSL_CHARGE_WAIT_TIME 15 /* 15 msec */
50#define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */
51#define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */
52
53#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
54#define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */
55#define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */
56#define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */
57#define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */
58#define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */
59
60struct battery_thresh spitz_battery_levels_acin[] = { 32struct battery_thresh spitz_battery_levels_acin[] = {
61 { 213, 100}, 33 { 213, 100},
62 { 212, 98}, 34 { 212, 98},
@@ -151,763 +123,17 @@ struct battery_thresh spitz_battery_levels_noac[] = {
151#define MAXCTRL_SEL_SH 4 123#define MAXCTRL_SEL_SH 4
152#define MAXCTRL_STR 1u << 7 124#define MAXCTRL_STR 1u << 7
153 125
154/* MAX1111 Channel Definitions */
155#define BATT_AD 4u
156#define BATT_THM 2u
157#define JK_VAD 6u
158
159
160/*
161 * Prototypes
162 */
163static int sharpsl_read_main_battery(void);
164static int sharpsl_off_charge_battery(void);
165static int sharpsl_check_battery_temp(void);
166static int sharpsl_check_battery_voltage(void);
167static int sharpsl_ac_check(void);
168static int sharpsl_fatal_check(void);
169static int sharpsl_average_value(int ad);
170static void sharpsl_average_clear(void);
171static void sharpsl_charge_toggle(void *private_);
172static void sharpsl_battery_thread(void *private_);
173
174
175/*
176 * Variables
177 */
178struct sharpsl_pm_status sharpsl_pm;
179DECLARE_WORK(toggle_charger, sharpsl_charge_toggle, NULL);
180DECLARE_WORK(sharpsl_bat, sharpsl_battery_thread, NULL);
181
182
183static int get_percentage(int voltage)
184{
185 int i = sharpsl_pm.machinfo->bat_levels - 1;
186 struct battery_thresh *thresh;
187
188 if (sharpsl_pm.charge_mode == CHRG_ON)
189 thresh=sharpsl_pm.machinfo->bat_levels_acin;
190 else
191 thresh=sharpsl_pm.machinfo->bat_levels_noac;
192
193 while (i > 0 && (voltage > thresh[i].voltage))
194 i--;
195
196 return thresh[i].percentage;
197}
198
199static int get_apm_status(int voltage)
200{
201 int low_thresh, high_thresh;
202
203 if (sharpsl_pm.charge_mode == CHRG_ON) {
204 high_thresh = sharpsl_pm.machinfo->status_high_acin;
205 low_thresh = sharpsl_pm.machinfo->status_low_acin;
206 } else {
207 high_thresh = sharpsl_pm.machinfo->status_high_noac;
208 low_thresh = sharpsl_pm.machinfo->status_low_noac;
209 }
210
211 if (voltage >= high_thresh)
212 return APM_BATTERY_STATUS_HIGH;
213 if (voltage >= low_thresh)
214 return APM_BATTERY_STATUS_LOW;
215 return APM_BATTERY_STATUS_CRITICAL;
216}
217
218void sharpsl_battery_kick(void)
219{
220 schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(125));
221}
222EXPORT_SYMBOL(sharpsl_battery_kick);
223
224
225static void sharpsl_battery_thread(void *private_)
226{
227 int voltage, percent, apm_status, i = 0;
228
229 if (!sharpsl_pm.machinfo)
230 return;
231
232 sharpsl_pm.battstat.ac_status = (STATUS_AC_IN() ? APM_AC_ONLINE : APM_AC_OFFLINE);
233
234 /* Corgi cannot confirm when battery fully charged so periodically kick! */
235 if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON)
236 && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL))
237 schedule_work(&toggle_charger);
238
239 while(1) {
240 voltage = sharpsl_read_main_battery();
241 if (voltage > 0) break;
242 if (i++ > 5) {
243 voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
244 dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");
245 break;
246 }
247 }
248
249 voltage = sharpsl_average_value(voltage);
250 apm_status = get_apm_status(voltage);
251 percent = get_percentage(voltage);
252
253 /* At low battery voltages, the voltage has a tendency to start
254 creeping back up so we try to avoid this here */
255 if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE) || (apm_status == APM_BATTERY_STATUS_HIGH) || percent <= sharpsl_pm.battstat.mainbat_percent) {
256 sharpsl_pm.battstat.mainbat_voltage = voltage;
257 sharpsl_pm.battstat.mainbat_status = apm_status;
258 sharpsl_pm.battstat.mainbat_percent = percent;
259 }
260
261 dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %d\n", voltage,
262 sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies);
263
264 /* If battery is low. limit backlight intensity to save power. */
265 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
266 && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) ||
267 (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) {
268 if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) {
269 corgibl_limit_intensity(1);
270 sharpsl_pm.flags |= SHARPSL_BL_LIMIT;
271 }
272 } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) {
273 corgibl_limit_intensity(0);
274 sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT;
275 }
276
277 /* Suspend if critical battery level */
278 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
279 && (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL)
280 && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
281 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
282 dev_err(sharpsl_pm.dev, "Fatal Off\n");
283 apm_queue_event(APM_CRITICAL_SUSPEND);
284 }
285
286 schedule_delayed_work(&sharpsl_bat, SHARPSL_BATCHK_TIME);
287}
288
289static void sharpsl_charge_on(void)
290{
291 dev_dbg(sharpsl_pm.dev, "Turning Charger On\n");
292
293 sharpsl_pm.full_count = 0;
294 sharpsl_pm.charge_mode = CHRG_ON;
295 schedule_delayed_work(&toggle_charger, msecs_to_jiffies(250));
296 schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(500));
297}
298
299static void sharpsl_charge_off(void)
300{
301 dev_dbg(sharpsl_pm.dev, "Turning Charger Off\n");
302
303 CHARGE_OFF();
304 CHARGE_LED_OFF();
305 sharpsl_pm.charge_mode = CHRG_OFF;
306
307 schedule_work(&sharpsl_bat);
308}
309
310static void sharpsl_charge_error(void)
311{
312 CHARGE_LED_ERR();
313 CHARGE_OFF();
314 sharpsl_pm.charge_mode = CHRG_ERROR;
315}
316
317static void sharpsl_charge_toggle(void *private_)
318{
319 dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies);
320
321 if (STATUS_AC_IN() == 0) {
322 sharpsl_charge_off();
323 return;
324 } else if ((sharpsl_check_battery_temp() < 0) || (sharpsl_ac_check() < 0)) {
325 sharpsl_charge_error();
326 return;
327 }
328
329 CHARGE_LED_ON();
330 CHARGE_OFF();
331 mdelay(SHARPSL_CHARGE_WAIT_TIME);
332 CHARGE_ON();
333
334 sharpsl_pm.charge_start_time = jiffies;
335}
336
337static void sharpsl_ac_timer(unsigned long data)
338{
339 int acin = STATUS_AC_IN();
340
341 dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin);
342
343 sharpsl_average_clear();
344 if (acin && (sharpsl_pm.charge_mode != CHRG_ON))
345 sharpsl_charge_on();
346 else if (sharpsl_pm.charge_mode == CHRG_ON)
347 sharpsl_charge_off();
348
349 schedule_work(&sharpsl_bat);
350}
351
352
353static irqreturn_t sharpsl_ac_isr(int irq, void *dev_id, struct pt_regs *fp)
354{
355 /* Delay the event slightly to debounce */
356 /* Must be a smaller delay than the chrg_full_isr below */
357 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
358
359 return IRQ_HANDLED;
360}
361
362static void sharpsl_chrg_full_timer(unsigned long data)
363{
364 dev_dbg(sharpsl_pm.dev, "Charge Full at time: %lx\n", jiffies);
365
366 sharpsl_pm.full_count++;
367
368 if (STATUS_AC_IN() == 0) {
369 dev_dbg(sharpsl_pm.dev, "Charge Full: AC removed - stop charging!\n");
370 if (sharpsl_pm.charge_mode == CHRG_ON)
371 sharpsl_charge_off();
372 } else if (sharpsl_pm.full_count < 2) {
373 dev_dbg(sharpsl_pm.dev, "Charge Full: Count too low\n");
374 schedule_work(&toggle_charger);
375 } else if (time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_FINISH_TIME)) {
376 dev_dbg(sharpsl_pm.dev, "Charge Full: Interrupt generated too slowly - retry.\n");
377 schedule_work(&toggle_charger);
378 } else {
379 sharpsl_charge_off();
380 sharpsl_pm.charge_mode = CHRG_DONE;
381 dev_dbg(sharpsl_pm.dev, "Charge Full: Charging Finished\n");
382 }
383}
384
385/* Charging Finished Interrupt (Not present on Corgi) */
386/* Can trigger at the same time as an AC staus change so
387 delay until after that has been processed */
388static irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id, struct pt_regs *fp)
389{
390 if (sharpsl_pm.flags & SHARPSL_SUSPENDED)
391 return IRQ_HANDLED;
392
393 /* delay until after any ac interrupt */
394 mod_timer(&sharpsl_pm.chrg_full_timer, jiffies + msecs_to_jiffies(500));
395
396 return IRQ_HANDLED;
397}
398
399static irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp)
400{
401 int is_fatal = 0;
402
403 if (STATUS_BATT_LOCKED() == 0) {
404 dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n");
405 is_fatal = 1;
406 }
407
408 if (sharpsl_pm.machinfo->gpio_fatal && (STATUS_FATAL() == 0)) {
409 dev_err(sharpsl_pm.dev, "Fatal Batt Error! Suspending.\n");
410 is_fatal = 1;
411 }
412
413 if (!(sharpsl_pm.flags & SHARPSL_APM_QUEUED) && is_fatal) {
414 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
415 apm_queue_event(APM_CRITICAL_SUSPEND);
416 }
417
418 return IRQ_HANDLED;
419}
420
421/*
422 * Maintain an average of the last 10 readings
423 */
424#define SHARPSL_CNV_VALUE_NUM 10
425static int sharpsl_ad_index;
426
427static void sharpsl_average_clear(void)
428{
429 sharpsl_ad_index = 0;
430}
431
432static int sharpsl_average_value(int ad)
433{
434 int i, ad_val = 0;
435 static int sharpsl_ad[SHARPSL_CNV_VALUE_NUM+1];
436
437 if (sharpsl_pm.battstat.mainbat_status != APM_BATTERY_STATUS_HIGH) {
438 sharpsl_ad_index = 0;
439 return ad;
440 }
441
442 sharpsl_ad[sharpsl_ad_index] = ad;
443 sharpsl_ad_index++;
444 if (sharpsl_ad_index >= SHARPSL_CNV_VALUE_NUM) {
445 for (i=0; i < (SHARPSL_CNV_VALUE_NUM-1); i++)
446 sharpsl_ad[i] = sharpsl_ad[i+1];
447 sharpsl_ad_index = SHARPSL_CNV_VALUE_NUM - 1;
448 }
449 for (i=0; i < sharpsl_ad_index; i++)
450 ad_val += sharpsl_ad[i];
451
452 return (ad_val / sharpsl_ad_index);
453}
454
455
456/* 126/*
457 * Read MAX1111 ADC 127 * Read MAX1111 ADC
458 */ 128 */
459static int read_max1111(int channel) 129int sharpsl_pm_pxa_read_max1111(int channel)
460{ 130{
461 return corgi_ssp_max1111_get((channel << MAXCTRL_SEL_SH) | MAXCTRL_PD0 | MAXCTRL_PD1 131 return corgi_ssp_max1111_get((channel << MAXCTRL_SEL_SH) | MAXCTRL_PD0 | MAXCTRL_PD1
462 | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR); 132 | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR);
463} 133}
464 134
465static int sharpsl_read_main_battery(void) 135void sharpsl_pm_pxa_init(void)
466{
467 return read_max1111(BATT_AD);
468}
469
470static int sharpsl_read_temp(void)
471{ 136{
472 int temp;
473
474 sharpsl_pm.machinfo->measure_temp(1);
475
476 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
477 temp = read_max1111(BATT_THM);
478
479 sharpsl_pm.machinfo->measure_temp(0);
480
481 return temp;
482}
483
484static int sharpsl_read_acin(void)
485{
486 return read_max1111(JK_VAD);
487}
488
489/*
490 * Take an array of 5 integers, remove the maximum and minimum values
491 * and return the average.
492 */
493static int get_select_val(int *val)
494{
495 int i, j, k, temp, sum = 0;
496
497 /* Find MAX val */
498 temp = val[0];
499 j=0;
500 for (i=1; i<5; i++) {
501 if (temp < val[i]) {
502 temp = val[i];
503 j = i;
504 }
505 }
506
507 /* Find MIN val */
508 temp = val[4];
509 k=4;
510 for (i=3; i>=0; i--) {
511 if (temp > val[i]) {
512 temp = val[i];
513 k = i;
514 }
515 }
516
517 for (i=0; i<5; i++)
518 if (i != j && i != k )
519 sum += val[i];
520
521 dev_dbg(sharpsl_pm.dev, "Average: %d from values: %d, %d, %d, %d, %d\n", sum/3, val[0], val[1], val[2], val[3], val[4]);
522
523 return (sum/3);
524}
525
526static int sharpsl_check_battery_temp(void)
527{
528 int val, i, buff[5];
529
530 /* Check battery temperature */
531 for (i=0; i<5; i++) {
532 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
533 buff[i] = sharpsl_read_temp();
534 }
535
536 val = get_select_val(buff);
537
538 dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
539 if (val > SHARPSL_CHARGE_ON_TEMP)
540 return -1;
541
542 return 0;
543}
544
545static int sharpsl_check_battery_voltage(void)
546{
547 int val, i, buff[5];
548
549 /* disable charge, enable discharge */
550 CHARGE_OFF();
551 DISCHARGE_ON();
552 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
553
554 if (sharpsl_pm.machinfo->discharge1)
555 sharpsl_pm.machinfo->discharge1(1);
556
557 /* Check battery voltage */
558 for (i=0; i<5; i++) {
559 buff[i] = sharpsl_read_main_battery();
560 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
561 }
562
563 if (sharpsl_pm.machinfo->discharge1)
564 sharpsl_pm.machinfo->discharge1(0);
565
566 DISCHARGE_OFF();
567
568 val = get_select_val(buff);
569 dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val);
570
571 if (val < SHARPSL_CHARGE_ON_VOLT)
572 return -1;
573
574 return 0;
575}
576
577static int sharpsl_ac_check(void)
578{
579 int temp, i, buff[5];
580
581 for (i=0; i<5; i++) {
582 buff[i] = sharpsl_read_acin();
583 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
584 }
585
586 temp = get_select_val(buff);
587 dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp);
588
589 if ((temp > SHARPSL_CHARGE_ON_ACIN_HIGH) || (temp < SHARPSL_CHARGE_ON_ACIN_LOW)) {
590 dev_err(sharpsl_pm.dev, "Error: AC check failed.\n");
591 return -1;
592 }
593
594 return 0;
595}
596
597#ifdef CONFIG_PM
598static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state)
599{
600 sharpsl_pm.flags |= SHARPSL_SUSPENDED;
601 flush_scheduled_work();
602
603 if (sharpsl_pm.charge_mode == CHRG_ON)
604 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
605 else
606 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
607
608 return 0;
609}
610
611static int sharpsl_pm_resume(struct platform_device *pdev)
612{
613 /* Clear the reset source indicators as they break the bootloader upon reboot */
614 RCSR = 0x0f;
615 sharpsl_average_clear();
616 sharpsl_pm.flags &= ~SHARPSL_APM_QUEUED;
617 sharpsl_pm.flags &= ~SHARPSL_SUSPENDED;
618
619 return 0;
620}
621
622static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
623{
624 dev_dbg(sharpsl_pm.dev, "Time is: %08x\n",RCNR);
625
626 dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
627 /* not charging and AC-IN! */
628
629 if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (STATUS_AC_IN() != 0)) {
630 dev_dbg(sharpsl_pm.dev, "Activating Offline Charger...\n");
631 sharpsl_pm.charge_mode = CHRG_OFF;
632 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
633 sharpsl_off_charge_battery();
634 }
635
636 sharpsl_pm.machinfo->presuspend();
637
638 PEDR = 0xffffffff; /* clear it */
639
640 sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
641 if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
642 RTSR &= RTSR_ALE;
643 RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
644 dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n",RTAR);
645 sharpsl_pm.flags |= SHARPSL_ALARM_ACTIVE;
646 } else if (alarm_enable) {
647 RTSR &= RTSR_ALE;
648 RTAR = alarm_time;
649 dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n",RTAR);
650 } else {
651 dev_dbg(sharpsl_pm.dev, "No alarms set.\n");
652 }
653
654 pxa_pm_enter(state);
655
656 sharpsl_pm.machinfo->postsuspend();
657
658 dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",PEDR);
659}
660
661static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
662{
663 if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable) )
664 {
665 if (!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE)) {
666 dev_dbg(sharpsl_pm.dev, "No user triggered wakeup events and not charging. Strange. Suspend.\n");
667 corgi_goto_sleep(alarm_time, alarm_enable, state);
668 return 1;
669 }
670 if(sharpsl_off_charge_battery()) {
671 dev_dbg(sharpsl_pm.dev, "Charging. Suspend...\n");
672 corgi_goto_sleep(alarm_time, alarm_enable, state);
673 return 1;
674 }
675 dev_dbg(sharpsl_pm.dev, "User triggered wakeup in offline charger.\n");
676 }
677
678 if ((STATUS_BATT_LOCKED() == 0) || (sharpsl_fatal_check() < 0) )
679 {
680 dev_err(sharpsl_pm.dev, "Fatal condition. Suspend.\n");
681 corgi_goto_sleep(alarm_time, alarm_enable, state);
682 return 1;
683 }
684
685 return 0;
686}
687
688static int corgi_pxa_pm_enter(suspend_state_t state)
689{
690 unsigned long alarm_time = RTAR;
691 unsigned int alarm_status = ((RTSR & RTSR_ALE) != 0);
692
693 dev_dbg(sharpsl_pm.dev, "SharpSL suspending for first time.\n");
694
695 corgi_goto_sleep(alarm_time, alarm_status, state);
696
697 while (corgi_enter_suspend(alarm_time,alarm_status,state))
698 {}
699
700 dev_dbg(sharpsl_pm.dev, "SharpSL resuming...\n");
701
702 return 0;
703}
704#endif
705
706
707/*
708 * Check for fatal battery errors
709 * Fatal returns -1
710 */
711static int sharpsl_fatal_check(void)
712{
713 int buff[5], temp, i, acin;
714
715 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n");
716
717 /* Check AC-Adapter */
718 acin = STATUS_AC_IN();
719
720 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
721 CHARGE_OFF();
722 udelay(100);
723 DISCHARGE_ON(); /* enable discharge */
724 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
725 }
726
727 if (sharpsl_pm.machinfo->discharge1)
728 sharpsl_pm.machinfo->discharge1(1);
729
730 /* Check battery : check inserting battery ? */
731 for (i=0; i<5; i++) {
732 buff[i] = sharpsl_read_main_battery();
733 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
734 }
735
736 if (sharpsl_pm.machinfo->discharge1)
737 sharpsl_pm.machinfo->discharge1(0);
738
739 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
740 udelay(100);
741 CHARGE_ON();
742 DISCHARGE_OFF();
743 }
744
745 temp = get_select_val(buff);
746 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_read_main_battery());
747
748 if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) ||
749 (!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT)))
750 return -1;
751 return 0;
752}
753
754static int sharpsl_off_charge_error(void)
755{
756 dev_err(sharpsl_pm.dev, "Offline Charger: Error occured.\n");
757 CHARGE_OFF();
758 CHARGE_LED_ERR();
759 sharpsl_pm.charge_mode = CHRG_ERROR;
760 return 1;
761}
762
763/*
764 * Charging Control while suspended
765 * Return 1 - go straight to sleep
766 * Return 0 - sleep or wakeup depending on other factors
767 */
768static int sharpsl_off_charge_battery(void)
769{
770 int time;
771
772 dev_dbg(sharpsl_pm.dev, "Charge Mode: %d\n", sharpsl_pm.charge_mode);
773
774 if (sharpsl_pm.charge_mode == CHRG_OFF) {
775 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 1\n");
776
777 /* AC Check */
778 if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery_temp() < 0))
779 return sharpsl_off_charge_error();
780
781 /* Start Charging */
782 CHARGE_LED_ON();
783 CHARGE_OFF();
784 mdelay(SHARPSL_CHARGE_WAIT_TIME);
785 CHARGE_ON();
786
787 sharpsl_pm.charge_mode = CHRG_ON;
788 sharpsl_pm.full_count = 0;
789
790 return 1;
791 } else if (sharpsl_pm.charge_mode != CHRG_ON) {
792 return 1;
793 }
794
795 if (sharpsl_pm.full_count == 0) {
796 int time;
797
798 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 2\n");
799
800 if ((sharpsl_check_battery_temp() < 0) || (sharpsl_check_battery_voltage() < 0))
801 return sharpsl_off_charge_error();
802
803 CHARGE_OFF();
804 mdelay(SHARPSL_CHARGE_WAIT_TIME);
805 CHARGE_ON();
806 sharpsl_pm.charge_mode = CHRG_ON;
807
808 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
809
810 time = RCNR;
811 while(1) {
812 /* Check if any wakeup event had occured */
813 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
814 return 0;
815 /* Check for timeout */
816 if ((RCNR - time) > SHARPSL_WAIT_CO_TIME)
817 return 1;
818 if (STATUS_CHRG_FULL()) {
819 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occured. Retrying to check\n");
820 sharpsl_pm.full_count++;
821 CHARGE_OFF();
822 mdelay(SHARPSL_CHARGE_WAIT_TIME);
823 CHARGE_ON();
824 return 1;
825 }
826 }
827 }
828
829 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 3\n");
830
831 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
832
833 time = RCNR;
834 while(1) {
835 /* Check if any wakeup event had occured */
836 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
837 return 0;
838 /* Check for timeout */
839 if ((RCNR-time) > SHARPSL_WAIT_CO_TIME) {
840 if (sharpsl_pm.full_count > SHARPSL_CHARGE_RETRY_CNT) {
841 dev_dbg(sharpsl_pm.dev, "Offline Charger: Not charged sufficiently. Retrying.\n");
842 sharpsl_pm.full_count = 0;
843 }
844 sharpsl_pm.full_count++;
845 return 1;
846 }
847 if (STATUS_CHRG_FULL()) {
848 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charging complete.\n");
849 CHARGE_LED_OFF();
850 CHARGE_OFF();
851 sharpsl_pm.charge_mode = CHRG_DONE;
852 return 1;
853 }
854 }
855}
856
857
858static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf)
859{
860 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_percent);
861}
862
863static ssize_t battery_voltage_show(struct device *dev, struct device_attribute *attr, char *buf)
864{
865 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_voltage);
866}
867
868static DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL);
869static DEVICE_ATTR(battery_voltage, 0444, battery_voltage_show, NULL);
870
871extern void (*apm_get_power_status)(struct apm_power_info *);
872
873static void sharpsl_apm_get_power_status(struct apm_power_info *info)
874{
875 info->ac_line_status = sharpsl_pm.battstat.ac_status;
876
877 if (sharpsl_pm.charge_mode == CHRG_ON)
878 info->battery_status = APM_BATTERY_STATUS_CHARGING;
879 else
880 info->battery_status = sharpsl_pm.battstat.mainbat_status;
881
882 info->battery_flag = (1 << info->battery_status);
883 info->battery_life = sharpsl_pm.battstat.mainbat_percent;
884}
885
886static struct pm_ops sharpsl_pm_ops = {
887 .pm_disk_mode = PM_DISK_FIRMWARE,
888 .prepare = pxa_pm_prepare,
889 .enter = corgi_pxa_pm_enter,
890 .finish = pxa_pm_finish,
891};
892
893static int __init sharpsl_pm_probe(struct platform_device *pdev)
894{
895 if (!pdev->dev.platform_data)
896 return -EINVAL;
897
898 sharpsl_pm.dev = &pdev->dev;
899 sharpsl_pm.machinfo = pdev->dev.platform_data;
900 sharpsl_pm.charge_mode = CHRG_OFF;
901 sharpsl_pm.flags = 0;
902
903 sharpsl_pm.machinfo->init();
904
905 init_timer(&sharpsl_pm.ac_timer);
906 sharpsl_pm.ac_timer.function = sharpsl_ac_timer;
907
908 init_timer(&sharpsl_pm.chrg_full_timer);
909 sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer;
910
911 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_acin | GPIO_IN); 137 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_acin | GPIO_IN);
912 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batfull | GPIO_IN); 138 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batfull | GPIO_IN);
913 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batlock | GPIO_IN); 139 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batlock | GPIO_IN);
@@ -938,26 +164,10 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
938 } 164 }
939 else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull),IRQT_RISING); 165 else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull),IRQT_RISING);
940 } 166 }
941
942 device_create_file(&pdev->dev, &dev_attr_battery_percentage);
943 device_create_file(&pdev->dev, &dev_attr_battery_voltage);
944
945 apm_get_power_status = sharpsl_apm_get_power_status;
946
947 pm_set_ops(&sharpsl_pm_ops);
948
949 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
950
951 return 0;
952} 167}
953 168
954static int sharpsl_pm_remove(struct platform_device *pdev) 169void sharpsl_pm_pxa_remove(void)
955{ 170{
956 pm_set_ops(NULL);
957
958 device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
959 device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
960
961 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr); 171 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
962 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr); 172 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
963 173
@@ -966,32 +176,4 @@ static int sharpsl_pm_remove(struct platform_device *pdev)
966 176
967 if (!machine_is_corgi()) 177 if (!machine_is_corgi())
968 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr); 178 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr);
969
970 del_timer_sync(&sharpsl_pm.chrg_full_timer);
971 del_timer_sync(&sharpsl_pm.ac_timer);
972
973 return 0;
974} 179}
975
976static struct platform_driver sharpsl_pm_driver = {
977 .probe = sharpsl_pm_probe,
978 .remove = sharpsl_pm_remove,
979 .suspend = sharpsl_pm_suspend,
980 .resume = sharpsl_pm_resume,
981 .driver = {
982 .name = "sharpsl-pm",
983 },
984};
985
986static int __devinit sharpsl_pm_init(void)
987{
988 return platform_driver_register(&sharpsl_pm_driver);
989}
990
991static void sharpsl_pm_exit(void)
992{
993 platform_driver_unregister(&sharpsl_pm_driver);
994}
995
996late_initcall(sharpsl_pm_init);
997module_exit(sharpsl_pm_exit);
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 2df1b56615b1..f2007db0cda5 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -36,6 +36,7 @@
36#include <asm/arch/irq.h> 36#include <asm/arch/irq.h>
37#include <asm/arch/irda.h> 37#include <asm/arch/irda.h>
38#include <asm/arch/mmc.h> 38#include <asm/arch/mmc.h>
39#include <asm/arch/ohci.h>
39#include <asm/arch/udc.h> 40#include <asm/arch/udc.h>
40#include <asm/arch/pxafb.h> 41#include <asm/arch/pxafb.h>
41#include <asm/arch/akita.h> 42#include <asm/arch/akita.h>
@@ -126,10 +127,12 @@ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
126 cpr &= ~0x0002; 127 cpr &= ~0x0002;
127 if (device == SPITZ_PWR_SD) 128 if (device == SPITZ_PWR_SD)
128 cpr &= ~0x0004; 129 cpr &= ~0x0004;
129 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
130 if (!(cpr & 0x0002) && !(cpr & 0x0004)) { 130 if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
131 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
131 mdelay(1); 132 mdelay(1);
132 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); 133 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
134 } else {
135 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
133 } 136 }
134 } 137 }
135} 138}
@@ -335,6 +338,35 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
335 338
336 339
337/* 340/*
341 * USB Host (OHCI)
342 */
343static int spitz_ohci_init(struct device *dev)
344{
345 /* Only Port 2 is connected */
346 pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN);
347 pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT);
348 pxa_gpio_mode(SPITZ_GPIO_USB_DEVICE | GPIO_IN);
349
350 /* Setup USB Port 2 Output Control Register */
351 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
352
353 GPSR(SPITZ_GPIO_USB_HOST) = GPIO_bit(SPITZ_GPIO_USB_HOST);
354
355 UHCHR = (UHCHR) &
356 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
357
358 UHCRHDA |= UHCRHDA_NOCP;
359
360 return 0;
361}
362
363static struct pxaohci_platform_data spitz_ohci_platform_data = {
364 .port_mode = PMM_NPS_MODE,
365 .init = spitz_ohci_init,
366};
367
368
369/*
338 * Irda 370 * Irda
339 */ 371 */
340static void spitz_irda_transceiver_mode(struct device *dev, int mode) 372static void spitz_irda_transceiver_mode(struct device *dev, int mode)
@@ -411,6 +443,7 @@ static void __init common_init(void)
411 443
412 platform_add_devices(devices, ARRAY_SIZE(devices)); 444 platform_add_devices(devices, ARRAY_SIZE(devices));
413 pxa_set_mci_info(&spitz_mci_platform_data); 445 pxa_set_mci_info(&spitz_mci_platform_data);
446 pxa_set_ohci_info(&spitz_ohci_platform_data);
414 pxa_set_ficp_info(&spitz_ficp_platform_data); 447 pxa_set_ficp_info(&spitz_ficp_platform_data);
415 set_pxa_fb_parent(&spitzssp_device.dev); 448 set_pxa_fb_parent(&spitzssp_device.dev);
416 set_pxa_fb_info(&spitz_pxafb_info); 449 set_pxa_fb_info(&spitz_pxafb_info);
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 3ce7486daa51..5e5bdc898482 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -33,19 +33,7 @@ static void spitz_charger_init(void)
33{ 33{
34 pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN); 34 pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN);
35 pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN); 35 pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN);
36} 36 sharpsl_pm_pxa_init();
37
38static void spitz_charge_led(int val)
39{
40 if (val == SHARPSL_LED_ERROR) {
41 dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
42 } else if (val == SHARPSL_LED_ON) {
43 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
44 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
45 } else {
46 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
47 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
48 }
49} 37}
50 38
51static void spitz_measure_temp(int on) 39static void spitz_measure_temp(int on)
@@ -92,7 +80,7 @@ static void spitz_discharge1(int on)
92 80
93static void spitz_presuspend(void) 81static void spitz_presuspend(void)
94{ 82{
95 spitz_last_ac_status = STATUS_AC_IN(); 83 spitz_last_ac_status = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
96 84
97 /* GPIO Sleep Register */ 85 /* GPIO Sleep Register */
98 PGSR0 = 0x00144018; 86 PGSR0 = 0x00144018;
@@ -138,7 +126,7 @@ static void spitz_postsuspend(void)
138static int spitz_should_wakeup(unsigned int resume_on_alarm) 126static int spitz_should_wakeup(unsigned int resume_on_alarm)
139{ 127{
140 int is_resume = 0; 128 int is_resume = 0;
141 int acin = STATUS_AC_IN(); 129 int acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
142 130
143 if (spitz_last_ac_status != acin) { 131 if (spitz_last_ac_status != acin) {
144 if (acin) { 132 if (acin) {
@@ -148,8 +136,8 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
148 } else { 136 } else {
149 /* charge off */ 137 /* charge off */
150 dev_dbg(sharpsl_pm.dev, "AC Removed\n"); 138 dev_dbg(sharpsl_pm.dev, "AC Removed\n");
151 CHARGE_LED_OFF(); 139 sharpsl_pm_led(SHARPSL_LED_OFF);
152 CHARGE_OFF(); 140 sharpsl_pm.machinfo->charge(0);
153 sharpsl_pm.charge_mode = CHRG_OFF; 141 sharpsl_pm.charge_mode = CHRG_OFF;
154 } 142 }
155 spitz_last_ac_status = acin; 143 spitz_last_ac_status = acin;
@@ -175,25 +163,41 @@ static unsigned long spitz_charger_wakeup(void)
175 return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC)); 163 return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC));
176} 164}
177 165
178static int spitz_acin_status(void) 166unsigned long spitzpm_read_devdata(int type)
179{ 167{
180 return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0); 168 switch(type) {
169 case SHARPSL_STATUS_ACIN:
170 return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0);
171 case SHARPSL_STATUS_LOCK:
172 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock);
173 case SHARPSL_STATUS_CHRGFULL:
174 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull);
175 case SHARPSL_STATUS_FATAL:
176 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal);
177 case SHARPSL_ACIN_VOLT:
178 return sharpsl_pm_pxa_read_max1111(MAX1111_ACIN_VOLT);
179 case SHARPSL_BATT_TEMP:
180 return sharpsl_pm_pxa_read_max1111(MAX1111_BATT_TEMP);
181 case SHARPSL_BATT_VOLT:
182 default:
183 return sharpsl_pm_pxa_read_max1111(MAX1111_BATT_VOLT);
184 }
181} 185}
182 186
183struct sharpsl_charger_machinfo spitz_pm_machinfo = { 187struct sharpsl_charger_machinfo spitz_pm_machinfo = {
184 .init = spitz_charger_init, 188 .init = spitz_charger_init,
189 .exit = sharpsl_pm_pxa_remove,
185 .gpio_batlock = SPITZ_GPIO_BAT_COVER, 190 .gpio_batlock = SPITZ_GPIO_BAT_COVER,
186 .gpio_acin = SPITZ_GPIO_AC_IN, 191 .gpio_acin = SPITZ_GPIO_AC_IN,
187 .gpio_batfull = SPITZ_GPIO_CHRG_FULL, 192 .gpio_batfull = SPITZ_GPIO_CHRG_FULL,
188 .gpio_fatal = SPITZ_GPIO_FATAL_BAT, 193 .gpio_fatal = SPITZ_GPIO_FATAL_BAT,
189 .status_acin = spitz_acin_status,
190 .discharge = spitz_discharge, 194 .discharge = spitz_discharge,
191 .discharge1 = spitz_discharge1, 195 .discharge1 = spitz_discharge1,
192 .charge = spitz_charge, 196 .charge = spitz_charge,
193 .chargeled = spitz_charge_led,
194 .measure_temp = spitz_measure_temp, 197 .measure_temp = spitz_measure_temp,
195 .presuspend = spitz_presuspend, 198 .presuspend = spitz_presuspend,
196 .postsuspend = spitz_postsuspend, 199 .postsuspend = spitz_postsuspend,
200 .read_devdata = spitzpm_read_devdata,
197 .charger_wakeup = spitz_charger_wakeup, 201 .charger_wakeup = spitz_charger_wakeup,
198 .should_wakeup = spitz_should_wakeup, 202 .should_wakeup = spitz_should_wakeup,
199 .bat_levels = 40, 203 .bat_levels = 40,
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c
index 002635c97bb6..ec3f7e798623 100644
--- a/arch/arm/mach-realview/clock.c
+++ b/arch/arm/mach-realview/clock.c
@@ -13,9 +13,9 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/clk.h>
16 17
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18#include <asm/hardware/clock.h>
19#include <asm/hardware/icst307.h> 19#include <asm/hardware/icst307.h>
20 20
21#include "clock.h" 21#include "clock.h"
@@ -57,17 +57,6 @@ void clk_disable(struct clk *clk)
57} 57}
58EXPORT_SYMBOL(clk_disable); 58EXPORT_SYMBOL(clk_disable);
59 59
60int clk_use(struct clk *clk)
61{
62 return 0;
63}
64EXPORT_SYMBOL(clk_use);
65
66void clk_unuse(struct clk *clk)
67{
68}
69EXPORT_SYMBOL(clk_unuse);
70
71unsigned long clk_get_rate(struct clk *clk) 60unsigned long clk_get_rate(struct clk *clk)
72{ 61{
73 return clk->rate; 62 return clk->rate;
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index af6580f1ceb8..4a222f59f2cf 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -24,14 +24,14 @@
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/amba/bus.h>
28#include <linux/amba/clcd.h>
27 29
28#include <asm/system.h> 30#include <asm/system.h>
29#include <asm/hardware.h> 31#include <asm/hardware.h>
30#include <asm/io.h> 32#include <asm/io.h>
31#include <asm/irq.h> 33#include <asm/irq.h>
32#include <asm/leds.h> 34#include <asm/leds.h>
33#include <asm/hardware/amba.h>
34#include <asm/hardware/amba_clcd.h>
35#include <asm/hardware/arm_timer.h> 35#include <asm/hardware/arm_timer.h>
36#include <asm/hardware/icst307.h> 36#include <asm/hardware/icst307.h>
37 37
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index c06e6041df41..93e86d9f439c 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -22,7 +22,8 @@
22#ifndef __ASM_ARCH_REALVIEW_H 22#ifndef __ASM_ARCH_REALVIEW_H
23#define __ASM_ARCH_REALVIEW_H 23#define __ASM_ARCH_REALVIEW_H
24 24
25#include <asm/hardware/amba.h> 25#include <linux/amba/bus.h>
26
26#include <asm/leds.h> 27#include <asm/leds.h>
27#include <asm/io.h> 28#include <asm/io.h>
28 29
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 7dc32503fdf2..112f7592aca9 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/amba/bus.h>
26 27
27#include <asm/hardware.h> 28#include <asm/hardware.h>
28#include <asm/io.h> 29#include <asm/io.h>
@@ -30,7 +31,6 @@
30#include <asm/leds.h> 31#include <asm/leds.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
32#include <asm/hardware/gic.h> 33#include <asm/hardware/gic.h>
33#include <asm/hardware/amba.h>
34#include <asm/hardware/icst307.h> 34#include <asm/hardware/icst307.h>
35 35
36#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c
index bc0747439fb3..bd86ffba8810 100644
--- a/arch/arm/mach-rpc/dma.c
+++ b/arch/arm/mach-rpc/dma.c
@@ -13,7 +13,7 @@
13#include <linux/mman.h> 13#include <linux/mman.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/pci.h> 16#include <linux/dma-mapping.h>
17 17
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/dma.h> 19#include <asm/dma.h>
@@ -148,11 +148,14 @@ static void iomd_enable_dma(dmach_t channel, dma_t *dma)
148 * Cope with ISA-style drivers which expect cache 148 * Cope with ISA-style drivers which expect cache
149 * coherence. 149 * coherence.
150 */ 150 */
151 if (!dma->using_sg) { 151 if (!dma->sg) {
152 dma->buf.dma_address = pci_map_single(NULL, 152 dma->sg = &dma->buf;
153 dma->buf.__address, dma->buf.length, 153 dma->sgcount = 1;
154 dma->buf.length = dma->count;
155 dma->buf.dma_address = dma_map_single(NULL,
156 dma->addr, dma->count,
154 dma->dma_mode == DMA_MODE_READ ? 157 dma->dma_mode == DMA_MODE_READ ?
155 PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); 158 DMA_FROM_DEVICE : DMA_TO_DEVICE);
156 } 159 }
157 160
158 iomd_writeb(DMA_CR_C, dma_base + CR); 161 iomd_writeb(DMA_CR_C, dma_base + CR);
@@ -239,7 +242,7 @@ static void floppy_enable_dma(dmach_t channel, dma_t *dma)
239 unsigned int fiqhandler_length; 242 unsigned int fiqhandler_length;
240 struct pt_regs regs; 243 struct pt_regs regs;
241 244
242 if (dma->using_sg) 245 if (dma->sg)
243 BUG(); 246 BUG();
244 247
245 if (dma->dma_mode == DMA_MODE_READ) { 248 if (dma->dma_mode == DMA_MODE_READ) {
@@ -252,8 +255,8 @@ static void floppy_enable_dma(dmach_t channel, dma_t *dma)
252 fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start; 255 fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start;
253 } 256 }
254 257
255 regs.ARM_r9 = dma->buf.length; 258 regs.ARM_r9 = dma->count;
256 regs.ARM_r10 = (unsigned long)dma->buf.__address; 259 regs.ARM_r10 = (unsigned long)dma->addr;
257 regs.ARM_fp = (unsigned long)FLOPPYDMA_BASE; 260 regs.ARM_fp = (unsigned long)FLOPPYDMA_BASE;
258 261
259 if (claim_fiq(&fh)) { 262 if (claim_fiq(&fh)) {
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index 82e8253b1fa0..5830ae3ddd19 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -34,16 +34,15 @@
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/sysdev.h> 36#include <linux/sysdev.h>
37
38#include <linux/interrupt.h> 37#include <linux/interrupt.h>
39#include <linux/ioport.h> 38#include <linux/ioport.h>
39#include <linux/clk.h>
40 40
41#include <asm/hardware.h> 41#include <asm/hardware.h>
42#include <asm/atomic.h> 42#include <asm/atomic.h>
43#include <asm/irq.h> 43#include <asm/irq.h>
44#include <asm/io.h> 44#include <asm/io.h>
45 45
46#include <asm/hardware/clock.h>
47#include <asm/arch/regs-clock.h> 46#include <asm/arch/regs-clock.h>
48 47
49#include "clock.h" 48#include "clock.h"
@@ -151,18 +150,6 @@ void clk_disable(struct clk *clk)
151} 150}
152 151
153 152
154int clk_use(struct clk *clk)
155{
156 atomic_inc(&clk->used);
157 return 0;
158}
159
160
161void clk_unuse(struct clk *clk)
162{
163 atomic_dec(&clk->used);
164}
165
166unsigned long clk_get_rate(struct clk *clk) 153unsigned long clk_get_rate(struct clk *clk)
167{ 154{
168 if (IS_ERR(clk)) 155 if (IS_ERR(clk))
@@ -196,8 +183,6 @@ EXPORT_SYMBOL(clk_get);
196EXPORT_SYMBOL(clk_put); 183EXPORT_SYMBOL(clk_put);
197EXPORT_SYMBOL(clk_enable); 184EXPORT_SYMBOL(clk_enable);
198EXPORT_SYMBOL(clk_disable); 185EXPORT_SYMBOL(clk_disable);
199EXPORT_SYMBOL(clk_use);
200EXPORT_SYMBOL(clk_unuse);
201EXPORT_SYMBOL(clk_get_rate); 186EXPORT_SYMBOL(clk_get_rate);
202EXPORT_SYMBOL(clk_round_rate); 187EXPORT_SYMBOL(clk_round_rate);
203EXPORT_SYMBOL(clk_set_rate); 188EXPORT_SYMBOL(clk_set_rate);
@@ -370,7 +355,6 @@ static struct clk init_clocks[] = {
370int s3c24xx_register_clock(struct clk *clk) 355int s3c24xx_register_clock(struct clk *clk)
371{ 356{
372 clk->owner = THIS_MODULE; 357 clk->owner = THIS_MODULE;
373 atomic_set(&clk->used, 0);
374 358
375 if (clk->enable == NULL) 359 if (clk->enable == NULL)
376 clk->enable = clk_null_enable; 360 clk->enable = clk_null_enable;
diff --git a/arch/arm/mach-s3c2410/clock.h b/arch/arm/mach-s3c2410/clock.h
index 7953b6f397b9..177d5c8decf7 100644
--- a/arch/arm/mach-s3c2410/clock.h
+++ b/arch/arm/mach-s3c2410/clock.h
@@ -16,7 +16,6 @@ struct clk {
16 struct clk *parent; 16 struct clk *parent;
17 const char *name; 17 const char *name;
18 int id; 18 int id;
19 atomic_t used;
20 unsigned long rate; 19 unsigned long rate;
21 unsigned long ctrlbit; 20 unsigned long ctrlbit;
22 int (*enable)(struct clk *, int enable); 21 int (*enable)(struct clk *, int enable);
diff --git a/arch/arm/mach-s3c2410/s3c2440-clock.c b/arch/arm/mach-s3c2410/s3c2440-clock.c
index c67e0979aec3..b557a2be8a01 100644
--- a/arch/arm/mach-s3c2410/s3c2440-clock.c
+++ b/arch/arm/mach-s3c2410/s3c2440-clock.c
@@ -29,16 +29,15 @@
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/sysdev.h> 31#include <linux/sysdev.h>
32
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
34#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/clk.h>
35 35
36#include <asm/hardware.h> 36#include <asm/hardware.h>
37#include <asm/atomic.h> 37#include <asm/atomic.h>
38#include <asm/irq.h> 38#include <asm/irq.h>
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#include <asm/hardware/clock.h>
42#include <asm/arch/regs-clock.h> 41#include <asm/arch/regs-clock.h>
43 42
44#include "clock.h" 43#include "clock.h"
diff --git a/arch/arm/mach-s3c2410/s3c2440.c b/arch/arm/mach-s3c2410/s3c2440.c
index 4d63e7133b48..b7fe6d9453fb 100644
--- a/arch/arm/mach-s3c2410/s3c2440.c
+++ b/arch/arm/mach-s3c2410/s3c2440.c
@@ -28,6 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/sysdev.h> 30#include <linux/sysdev.h>
31#include <linux/clk.h>
31 32
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
@@ -36,7 +37,6 @@
36#include <asm/hardware.h> 37#include <asm/hardware.h>
37#include <asm/io.h> 38#include <asm/io.h>
38#include <asm/irq.h> 39#include <asm/irq.h>
39#include <asm/hardware/clock.h>
40 40
41#include <asm/arch/regs-clock.h> 41#include <asm/arch/regs-clock.h>
42#include <asm/arch/regs-serial.h> 42#include <asm/arch/regs-serial.h>
diff --git a/arch/arm/mach-s3c2410/time.c b/arch/arm/mach-s3c2410/time.c
index 8a00e3c3cd08..10a2976aefdd 100644
--- a/arch/arm/mach-s3c2410/time.c
+++ b/arch/arm/mach-s3c2410/time.c
@@ -24,6 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/clk.h>
27 28
28#include <asm/system.h> 29#include <asm/system.h>
29#include <asm/leds.h> 30#include <asm/leds.h>
@@ -35,7 +36,6 @@
35#include <asm/arch/regs-timer.h> 36#include <asm/arch/regs-timer.h>
36#include <asm/arch/regs-irq.h> 37#include <asm/arch/regs-irq.h>
37#include <asm/mach/time.h> 38#include <asm/mach/time.h>
38#include <asm/hardware/clock.h>
39 39
40#include "clock.h" 40#include "clock.h"
41#include "cpu.h" 41#include "cpu.h"
@@ -191,7 +191,6 @@ static void s3c2410_timer_setup (void)
191 if (IS_ERR(clk)) 191 if (IS_ERR(clk))
192 panic("failed to get clock for system timer"); 192 panic("failed to get clock for system timer");
193 193
194 clk_use(clk);
195 clk_enable(clk); 194 clk_enable(clk);
196 195
197 pclk = clk_get_rate(clk); 196 pclk = clk_get_rate(clk);
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index 59c7964cfe11..786c8534231f 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -135,29 +135,11 @@ unsigned long sleep_phys_sp(void *sp)
135} 135}
136 136
137/* 137/*
138 * Called after processes are frozen, but before we shut down devices.
139 */
140static int sa11x0_pm_prepare(suspend_state_t state)
141{
142 return 0;
143}
144
145/*
146 * Called after devices are re-setup, but before processes are thawed.
147 */
148static int sa11x0_pm_finish(suspend_state_t state)
149{
150 return 0;
151}
152
153/*
154 * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk. 138 * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
155 */ 139 */
156static struct pm_ops sa11x0_pm_ops = { 140static struct pm_ops sa11x0_pm_ops = {
157 .pm_disk_mode = PM_DISK_FIRMWARE, 141 .pm_disk_mode = PM_DISK_FIRMWARE,
158 .prepare = sa11x0_pm_prepare,
159 .enter = sa11x0_pm_enter, 142 .enter = sa11x0_pm_enter,
160 .finish = sa11x0_pm_finish,
161}; 143};
162 144
163static int __init sa11x0_pm_init(void) 145static int __init sa11x0_pm_init(void)
diff --git a/arch/arm/mach-versatile/clock.c b/arch/arm/mach-versatile/clock.c
index b96a2ea15d41..dcf10014f5cd 100644
--- a/arch/arm/mach-versatile/clock.c
+++ b/arch/arm/mach-versatile/clock.c
@@ -14,9 +14,9 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/clk.h>
17 18
18#include <asm/semaphore.h> 19#include <asm/semaphore.h>
19#include <asm/hardware/clock.h>
20#include <asm/hardware/icst307.h> 20#include <asm/hardware/icst307.h>
21 21
22#include "clock.h" 22#include "clock.h"
@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
58} 58}
59EXPORT_SYMBOL(clk_disable); 59EXPORT_SYMBOL(clk_disable);
60 60
61int clk_use(struct clk *clk)
62{
63 return 0;
64}
65EXPORT_SYMBOL(clk_use);
66
67void clk_unuse(struct clk *clk)
68{
69}
70EXPORT_SYMBOL(clk_unuse);
71
72unsigned long clk_get_rate(struct clk *clk) 61unsigned long clk_get_rate(struct clk *clk)
73{ 62{
74 return clk->rate; 63 return clk->rate;
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index a1ca46630dda..90023745b23a 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -25,14 +25,14 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/sysdev.h> 26#include <linux/sysdev.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/amba/bus.h>
29#include <linux/amba/clcd.h>
28 30
29#include <asm/system.h> 31#include <asm/system.h>
30#include <asm/hardware.h> 32#include <asm/hardware.h>
31#include <asm/io.h> 33#include <asm/io.h>
32#include <asm/irq.h> 34#include <asm/irq.h>
33#include <asm/leds.h> 35#include <asm/leds.h>
34#include <asm/hardware/amba.h>
35#include <asm/hardware/amba_clcd.h>
36#include <asm/hardware/arm_timer.h> 36#include <asm/hardware/arm_timer.h>
37#include <asm/hardware/icst307.h> 37#include <asm/hardware/icst307.h>
38 38
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index 588c20669d5d..afcaa858eb1f 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -22,7 +22,7 @@
22#ifndef __ASM_ARCH_VERSATILE_H 22#ifndef __ASM_ARCH_VERSATILE_H
23#define __ASM_ARCH_VERSATILE_H 23#define __ASM_ARCH_VERSATILE_H
24 24
25#include <asm/hardware/amba.h> 25#include <linux/amba/bus.h>
26 26
27extern void __init versatile_init(void); 27extern void __init versatile_init(void);
28extern void __init versatile_init_irq(void); 28extern void __init versatile_init_irq(void);
diff --git a/arch/arm/mach-versatile/versatile_ab.c b/arch/arm/mach-versatile/versatile_ab.c
index 8b0b3bef24ae..e74c8a2fbb95 100644
--- a/arch/arm/mach-versatile/versatile_ab.c
+++ b/arch/arm/mach-versatile/versatile_ab.c
@@ -23,12 +23,12 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/amba/bus.h>
26 27
27#include <asm/hardware.h> 28#include <asm/hardware.h>
28#include <asm/io.h> 29#include <asm/io.h>
29#include <asm/irq.h> 30#include <asm/irq.h>
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/hardware/amba.h>
32 32
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34 34
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c
index 7c3078c38916..22d5ca07f75d 100644
--- a/arch/arm/mach-versatile/versatile_pb.c
+++ b/arch/arm/mach-versatile/versatile_pb.c
@@ -23,12 +23,12 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/amba/bus.h>
26 27
27#include <asm/hardware.h> 28#include <asm/hardware.h>
28#include <asm/io.h> 29#include <asm/io.h>
29#include <asm/irq.h> 30#include <asm/irq.h>
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/hardware/amba.h>
32 32
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/mmc.h> 34#include <asm/mach/mmc.h>
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
index dbfe9e891f01..0513ed1b2fcf 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -19,7 +19,6 @@
19#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
20 20
21#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
22#include <asm/io.h>
23#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
24 23
25#define CONSISTENT_BASE (0xffc00000) 24#define CONSISTENT_BASE (0xffc00000)
diff --git a/arch/arm/mm/discontig.c b/arch/arm/mm/discontig.c
index 0d097bb1bc4d..1e5602189507 100644
--- a/arch/arm/mm/discontig.c
+++ b/arch/arm/mm/discontig.c
@@ -9,10 +9,8 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12
13#include <linux/module.h> 12#include <linux/module.h>
14#include <linux/mm.h> 13#include <linux/mmzone.h>
15#include <linux/init.h>
16#include <linux/bootmem.h> 14#include <linux/bootmem.h>
17 15
18#if MAX_NUMNODES != 4 && MAX_NUMNODES != 16 16#if MAX_NUMNODES != 4 && MAX_NUMNODES != 16
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index 9e50127be635..d0245a31d4dd 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -19,7 +19,6 @@
19 19
20#include <asm/pgalloc.h> 20#include <asm/pgalloc.h>
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/io.h>
23#include <asm/setup.h> 22#include <asm/setup.h>
24#include <asm/tlbflush.h> 23#include <asm/tlbflush.h>
25 24
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 7ce39b986e23..84fd65656fcf 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -19,10 +19,10 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/clk.h>
22 23
23#include <asm/io.h> 24#include <asm/io.h>
24#include <asm/semaphore.h> 25#include <asm/semaphore.h>
25#include <asm/hardware/clock.h>
26 26
27#include <asm/arch/clock.h> 27#include <asm/arch/clock.h>
28 28
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index ccdb452630cf..adffc5a859ee 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -18,12 +18,12 @@
18#include <linux/tty.h> 18#include <linux/tty.h>
19#include <linux/serial_8250.h> 19#include <linux/serial_8250.h>
20#include <linux/serial_reg.h> 20#include <linux/serial_reg.h>
21#include <linux/clk.h>
21 22
22#include <asm/hardware.h> 23#include <asm/hardware.h>
23#include <asm/system.h> 24#include <asm/system.h>
24#include <asm/pgtable.h> 25#include <asm/pgtable.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26#include <asm/hardware/clock.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
29 29
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index fd894bb00107..98edc9fdd6d1 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -19,13 +19,12 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h>
22 23
23#include <asm/hardware.h> 24#include <asm/hardware.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/system.h> 26#include <asm/system.h>
26 27
27#include <asm/hardware/clock.h>
28
29/* TODO: Add support for SDRAM timing changes */ 28/* TODO: Add support for SDRAM timing changes */
30 29
31int omap_verify_speed(struct cpufreq_policy *policy) 30int omap_verify_speed(struct cpufreq_policy *policy)
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 76f721d85137..ca3681a824ac 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -19,9 +19,9 @@
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/sysdev.h> 20#include <linux/sysdev.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h>
22 23
23#include <asm/hardware.h> 24#include <asm/hardware.h>
24#include <asm/hardware/clock.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/arch/irqs.h> 26#include <asm/arch/irqs.h>
27#include <asm/arch/gpio.h> 27#include <asm/arch/gpio.h>
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index ea9475c86656..be0e0f32a598 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -19,6 +19,7 @@
19#include <linux/completion.h> 19#include <linux/completion.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h>
22 23
23#include <asm/delay.h> 24#include <asm/delay.h>
24#include <asm/io.h> 25#include <asm/io.h>
@@ -30,8 +31,6 @@
30#include <asm/arch/dsp_common.h> 31#include <asm/arch/dsp_common.h>
31#include <asm/arch/mcbsp.h> 32#include <asm/arch/mcbsp.h>
32 33
33#include <asm/hardware/clock.h>
34
35#ifdef CONFIG_MCBSP_DEBUG 34#ifdef CONFIG_MCBSP_DEBUG
36#define DBG(x...) printk(x) 35#define DBG(x...) printk(x)
37#else 36#else
diff --git a/arch/arm/plat-omap/ocpi.c b/arch/arm/plat-omap/ocpi.c
index b86148227480..e40fcc8b43d4 100644
--- a/arch/arm/plat-omap/ocpi.c
+++ b/arch/arm/plat-omap/ocpi.c
@@ -31,9 +31,9 @@
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/err.h> 33#include <linux/err.h>
34#include <linux/clk.h>
34 35
35#include <asm/io.h> 36#include <asm/io.h>
36#include <asm/hardware/clock.h>
37#include <asm/hardware.h> 37#include <asm/hardware.h>
38 38
39#define OCPI_BASE 0xfffec320 39#define OCPI_BASE 0xfffec320
diff --git a/drivers/Makefile b/drivers/Makefile
index ea410b6b7644..7fc3f0f08b29 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_ACPI) += acpi/
13# PnP must come after ACPI since it will eventually need to check if acpi 13# PnP must come after ACPI since it will eventually need to check if acpi
14# was used and do nothing if so 14# was used and do nothing if so
15obj-$(CONFIG_PNP) += pnp/ 15obj-$(CONFIG_PNP) += pnp/
16obj-$(CONFIG_ARM_AMBA) += amba/
16 17
17# char/ comes before serial/ etc so that the VT console is the boot-time 18# char/ comes before serial/ etc so that the VT console is the boot-time
18# default. 19# default.
diff --git a/drivers/amba/Makefile b/drivers/amba/Makefile
new file mode 100644
index 000000000000..40fe74097be2
--- /dev/null
+++ b/drivers/amba/Makefile
@@ -0,0 +1,2 @@
1obj-y += bus.o
2
diff --git a/arch/arm/common/amba.c b/drivers/amba/bus.c
index c95ec9eab996..1bbdd1693d57 100644
--- a/arch/arm/common/amba.c
+++ b/drivers/amba/bus.c
@@ -12,10 +12,10 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/amba/bus.h>
15 16
16#include <asm/io.h> 17#include <asm/io.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <asm/hardware/amba.h>
19#include <asm/sizes.h> 19#include <asm/sizes.h>
20 20
21#define to_amba_device(d) container_of(d, struct amba_device, dev) 21#define to_amba_device(d) container_of(d, struct amba_device, dev)
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c
index 3df7a574267b..2e308657f6f6 100644
--- a/drivers/char/s3c2410-rtc.c
+++ b/drivers/char/s3c2410-rtc.c
@@ -24,6 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/rtc.h> 25#include <linux/rtc.h>
26#include <linux/bcd.h> 26#include <linux/bcd.h>
27#include <linux/clk.h>
27 28
28#include <asm/hardware.h> 29#include <asm/hardware.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
@@ -33,7 +34,6 @@
33 34
34#include <asm/mach/time.h> 35#include <asm/mach/time.h>
35 36
36#include <asm/hardware/clock.h>
37#include <asm/arch/regs-rtc.h> 37#include <asm/arch/regs-rtc.h>
38 38
39/* need this for the RTC_AF definitions */ 39/* need this for the RTC_AF definitions */
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c
index eb667daee19b..9dc54736e4eb 100644
--- a/drivers/char/watchdog/s3c2410_wdt.c
+++ b/drivers/char/watchdog/s3c2410_wdt.c
@@ -46,12 +46,12 @@
46#include <linux/init.h> 46#include <linux/init.h>
47#include <linux/platform_device.h> 47#include <linux/platform_device.h>
48#include <linux/interrupt.h> 48#include <linux/interrupt.h>
49#include <linux/clk.h>
49 50
50#include <asm/uaccess.h> 51#include <asm/uaccess.h>
51#include <asm/io.h> 52#include <asm/io.h>
52 53
53#include <asm/arch/map.h> 54#include <asm/arch/map.h>
54#include <asm/hardware/clock.h>
55 55
56#undef S3C24XX_VA_WATCHDOG 56#undef S3C24XX_VA_WATCHDOG
57#define S3C24XX_VA_WATCHDOG (0) 57#define S3C24XX_VA_WATCHDOG (0)
@@ -397,7 +397,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
397 return -ENOENT; 397 return -ENOENT;
398 } 398 }
399 399
400 clk_use(wdt_clock);
401 clk_enable(wdt_clock); 400 clk_enable(wdt_clock);
402 401
403 /* see if we can actually set the requested timer margin, and if 402 /* see if we can actually set the requested timer margin, and if
@@ -444,7 +443,6 @@ static int s3c2410wdt_remove(struct platform_device *dev)
444 443
445 if (wdt_clock != NULL) { 444 if (wdt_clock != NULL) {
446 clk_disable(wdt_clock); 445 clk_disable(wdt_clock);
447 clk_unuse(wdt_clock);
448 clk_put(wdt_clock); 446 clk_put(wdt_clock);
449 wdt_clock = NULL; 447 wdt_clock = NULL;
450 } 448 }
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 58cfd3111ef6..f7d40f8e5f5c 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -34,12 +34,12 @@
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/err.h> 35#include <linux/err.h>
36#include <linux/platform_device.h> 36#include <linux/platform_device.h>
37#include <linux/clk.h>
37 38
38#include <asm/hardware.h> 39#include <asm/hardware.h>
39#include <asm/irq.h> 40#include <asm/irq.h>
40#include <asm/io.h> 41#include <asm/io.h>
41 42
42#include <asm/hardware/clock.h>
43#include <asm/arch/regs-gpio.h> 43#include <asm/arch/regs-gpio.h>
44#include <asm/arch/regs-iic.h> 44#include <asm/arch/regs-iic.h>
45#include <asm/arch/iic.h> 45#include <asm/arch/iic.h>
@@ -738,7 +738,6 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c)
738{ 738{
739 if (i2c->clk != NULL && !IS_ERR(i2c->clk)) { 739 if (i2c->clk != NULL && !IS_ERR(i2c->clk)) {
740 clk_disable(i2c->clk); 740 clk_disable(i2c->clk);
741 clk_unuse(i2c->clk);
742 clk_put(i2c->clk); 741 clk_put(i2c->clk);
743 i2c->clk = NULL; 742 i2c->clk = NULL;
744 } 743 }
@@ -778,7 +777,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
778 777
779 dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk); 778 dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);
780 779
781 clk_use(i2c->clk);
782 clk_enable(i2c->clk); 780 clk_enable(i2c->clk);
783 781
784 /* map the registers */ 782 /* map the registers */
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c
index 9b1ab5e7a98d..3df5eedf8f31 100644
--- a/drivers/input/serio/ambakmi.c
+++ b/drivers/input/serio/ambakmi.c
@@ -19,12 +19,12 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/amba/bus.h>
23#include <linux/amba/kmi.h>
24#include <linux/clk.h>
22 25
23#include <asm/io.h> 26#include <asm/io.h>
24#include <asm/irq.h> 27#include <asm/irq.h>
25#include <asm/hardware/amba.h>
26#include <asm/hardware/amba_kmi.h>
27#include <asm/hardware/clock.h>
28 28
29#define KMI_BASE (kmi->base) 29#define KMI_BASE (kmi->base)
30 30
@@ -72,13 +72,9 @@ static int amba_kmi_open(struct serio *io)
72 unsigned int divisor; 72 unsigned int divisor;
73 int ret; 73 int ret;
74 74
75 ret = clk_use(kmi->clk);
76 if (ret)
77 goto out;
78
79 ret = clk_enable(kmi->clk); 75 ret = clk_enable(kmi->clk);
80 if (ret) 76 if (ret)
81 goto clk_unuse; 77 goto out;
82 78
83 divisor = clk_get_rate(kmi->clk) / 8000000 - 1; 79 divisor = clk_get_rate(kmi->clk) / 8000000 - 1;
84 writeb(divisor, KMICLKDIV); 80 writeb(divisor, KMICLKDIV);
@@ -97,8 +93,6 @@ static int amba_kmi_open(struct serio *io)
97 93
98 clk_disable: 94 clk_disable:
99 clk_disable(kmi->clk); 95 clk_disable(kmi->clk);
100 clk_unuse:
101 clk_unuse(kmi->clk);
102 out: 96 out:
103 return ret; 97 return ret;
104} 98}
@@ -111,7 +105,6 @@ static void amba_kmi_close(struct serio *io)
111 105
112 free_irq(kmi->irq, kmi); 106 free_irq(kmi->irq, kmi);
113 clk_disable(kmi->clk); 107 clk_disable(kmi->clk);
114 clk_unuse(kmi->clk);
115} 108}
116 109
117static int amba_kmi_probe(struct amba_device *dev, void *id) 110static int amba_kmi_probe(struct amba_device *dev, void *id)
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index 2b10a2d4ae09..634ef53e85a5 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -19,14 +19,14 @@
19#include <linux/highmem.h> 19#include <linux/highmem.h>
20#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
21#include <linux/mmc/protocol.h> 21#include <linux/mmc/protocol.h>
22#include <linux/amba/bus.h>
23#include <linux/clk.h>
22 24
23#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
24#include <asm/div64.h> 26#include <asm/div64.h>
25#include <asm/io.h> 27#include <asm/io.h>
26#include <asm/scatterlist.h> 28#include <asm/scatterlist.h>
27#include <asm/sizes.h> 29#include <asm/sizes.h>
28#include <asm/hardware/amba.h>
29#include <asm/hardware/clock.h>
30#include <asm/mach/mmc.h> 30#include <asm/mach/mmc.h>
31 31
32#include "mmci.h" 32#include "mmci.h"
@@ -494,13 +494,9 @@ static int mmci_probe(struct amba_device *dev, void *id)
494 goto host_free; 494 goto host_free;
495 } 495 }
496 496
497 ret = clk_use(host->clk);
498 if (ret)
499 goto clk_free;
500
501 ret = clk_enable(host->clk); 497 ret = clk_enable(host->clk);
502 if (ret) 498 if (ret)
503 goto clk_unuse; 499 goto clk_free;
504 500
505 host->plat = plat; 501 host->plat = plat;
506 host->mclk = clk_get_rate(host->clk); 502 host->mclk = clk_get_rate(host->clk);
@@ -573,8 +569,6 @@ static int mmci_probe(struct amba_device *dev, void *id)
573 iounmap(host->base); 569 iounmap(host->base);
574 clk_disable: 570 clk_disable:
575 clk_disable(host->clk); 571 clk_disable(host->clk);
576 clk_unuse:
577 clk_unuse(host->clk);
578 clk_free: 572 clk_free:
579 clk_put(host->clk); 573 clk_put(host->clk);
580 host_free: 574 host_free:
@@ -609,7 +603,6 @@ static int mmci_remove(struct amba_device *dev)
609 603
610 iounmap(host->base); 604 iounmap(host->base);
611 clk_disable(host->clk); 605 clk_disable(host->clk);
612 clk_unuse(host->clk);
613 clk_put(host->clk); 606 clk_put(host->clk);
614 607
615 mmc_free_host(mmc); 608 mmc_free_host(mmc);
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index d209214b1318..5b55599739f3 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -53,6 +53,7 @@
53#include <linux/delay.h> 53#include <linux/delay.h>
54#include <linux/err.h> 54#include <linux/err.h>
55#include <linux/slab.h> 55#include <linux/slab.h>
56#include <linux/clk.h>
56 57
57#include <linux/mtd/mtd.h> 58#include <linux/mtd/mtd.h>
58#include <linux/mtd/nand.h> 59#include <linux/mtd/nand.h>
@@ -60,7 +61,6 @@
60#include <linux/mtd/partitions.h> 61#include <linux/mtd/partitions.h>
61 62
62#include <asm/io.h> 63#include <asm/io.h>
63#include <asm/hardware/clock.h>
64 64
65#include <asm/arch/regs-nand.h> 65#include <asm/arch/regs-nand.h>
66#include <asm/arch/nand.h> 66#include <asm/arch/nand.h>
@@ -460,7 +460,6 @@ static int s3c2410_nand_remove(struct platform_device *pdev)
460 460
461 if (info->clk != NULL && !IS_ERR(info->clk)) { 461 if (info->clk != NULL && !IS_ERR(info->clk)) {
462 clk_disable(info->clk); 462 clk_disable(info->clk);
463 clk_unuse(info->clk);
464 clk_put(info->clk); 463 clk_put(info->clk);
465 } 464 }
466 465
@@ -598,7 +597,6 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440)
598 goto exit_error; 597 goto exit_error;
599 } 598 }
600 599
601 clk_use(info->clk);
602 clk_enable(info->clk); 600 clk_enable(info->clk);
603 601
604 /* allocate and map the resource */ 602 /* allocate and map the resource */
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index b5fdeec20b15..12a7244a5ec8 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -36,9 +36,18 @@
36struct scoop_pcmcia_config *platform_scoop_config; 36struct scoop_pcmcia_config *platform_scoop_config;
37#define SCOOP_DEV platform_scoop_config->devs 37#define SCOOP_DEV platform_scoop_config->devs
38 38
39static void sharpsl_pcmcia_init_reset(struct scoop_pcmcia_dev *scoopdev) 39static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt)
40{ 40{
41 struct scoop_pcmcia_dev *scoopdev = &SCOOP_DEV[skt->nr];
42
41 reset_scoop(scoopdev->dev); 43 reset_scoop(scoopdev->dev);
44
45 /* Shared power controls need to be handled carefully */
46 if (platform_scoop_config->power_ctrl)
47 platform_scoop_config->power_ctrl(scoopdev->dev, 0x0000, skt->nr);
48 else
49 write_scoop_reg(scoopdev->dev, SCOOP_CPR, 0x0000);
50
42 scoopdev->keep_vs = NO_KEEP_VS; 51 scoopdev->keep_vs = NO_KEEP_VS;
43 scoopdev->keep_rd = 0; 52 scoopdev->keep_rd = 0;
44} 53}
@@ -208,26 +217,17 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
208 217
209static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt) 218static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
210{ 219{
211 sharpsl_pcmcia_init_reset(&SCOOP_DEV[skt->nr]); 220 sharpsl_pcmcia_init_reset(skt);
212 221
213 /* Enable interrupt */ 222 /* Enable interrupt */
214 write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_IMR, 0x00C0); 223 write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_IMR, 0x00C0);
215 write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_MCR, 0x0101); 224 write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_MCR, 0x0101);
216 SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS; 225 SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS;
217
218 if (machine_is_collie())
219 /* We need to disable SS_OUTPUT_ENA here. */
220 write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR, read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR) & ~0x0080);
221} 226}
222 227
223static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) 228static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
224{ 229{
225 /* CF_BUS_OFF */ 230 sharpsl_pcmcia_init_reset(skt);
226 sharpsl_pcmcia_init_reset(&SCOOP_DEV[skt->nr]);
227
228 if (machine_is_collie())
229 /* We need to disable SS_OUTPUT_ENA here. */
230 write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR, read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR) & ~0x0080);
231} 231}
232 232
233static struct pcmcia_low_level sharpsl_pcmcia_ops = { 233static struct pcmcia_low_level sharpsl_pcmcia_ops = {
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index ddd0307fece2..48f6e872314b 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -47,12 +47,12 @@
47#include <linux/tty_flip.h> 47#include <linux/tty_flip.h>
48#include <linux/serial_core.h> 48#include <linux/serial_core.h>
49#include <linux/serial.h> 49#include <linux/serial.h>
50#include <linux/amba/bus.h>
51#include <linux/amba/serial.h>
50 52
51#include <asm/io.h> 53#include <asm/io.h>
52#include <asm/irq.h> 54#include <asm/irq.h>
53#include <asm/hardware.h> 55#include <asm/hardware.h>
54#include <asm/hardware/amba.h>
55#include <asm/hardware/amba_serial.h>
56 56
57#define UART_NR 2 57#define UART_NR 2
58 58
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index d84476ee6592..129670556162 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -47,12 +47,12 @@
47#include <linux/tty_flip.h> 47#include <linux/tty_flip.h>
48#include <linux/serial_core.h> 48#include <linux/serial_core.h>
49#include <linux/serial.h> 49#include <linux/serial.h>
50#include <linux/amba/bus.h>
51#include <linux/amba/serial.h>
52#include <linux/clk.h>
50 53
51#include <asm/io.h> 54#include <asm/io.h>
52#include <asm/sizes.h> 55#include <asm/sizes.h>
53#include <asm/hardware/amba.h>
54#include <asm/hardware/clock.h>
55#include <asm/hardware/amba_serial.h>
56 56
57#define UART_NR 14 57#define UART_NR 14
58 58
@@ -761,10 +761,6 @@ static int pl011_probe(struct amba_device *dev, void *id)
761 goto unmap; 761 goto unmap;
762 } 762 }
763 763
764 ret = clk_use(uap->clk);
765 if (ret)
766 goto putclk;
767
768 uap->port.dev = &dev->dev; 764 uap->port.dev = &dev->dev;
769 uap->port.mapbase = dev->res.start; 765 uap->port.mapbase = dev->res.start;
770 uap->port.membase = base; 766 uap->port.membase = base;
@@ -782,8 +778,6 @@ static int pl011_probe(struct amba_device *dev, void *id)
782 if (ret) { 778 if (ret) {
783 amba_set_drvdata(dev, NULL); 779 amba_set_drvdata(dev, NULL);
784 amba_ports[i] = NULL; 780 amba_ports[i] = NULL;
785 clk_unuse(uap->clk);
786 putclk:
787 clk_put(uap->clk); 781 clk_put(uap->clk);
788 unmap: 782 unmap:
789 iounmap(base); 783 iounmap(base);
@@ -808,7 +802,6 @@ static int pl011_remove(struct amba_device *dev)
808 amba_ports[i] = NULL; 802 amba_ports[i] = NULL;
809 803
810 iounmap(uap->port.membase); 804 iounmap(uap->port.membase);
811 clk_unuse(uap->clk);
812 clk_put(uap->clk); 805 clk_put(uap->clk);
813 kfree(uap); 806 kfree(uap);
814 return 0; 807 return 0;
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 47681c4654e4..fe83ce6fef52 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -72,12 +72,12 @@
72#include <linux/serial_core.h> 72#include <linux/serial_core.h>
73#include <linux/serial.h> 73#include <linux/serial.h>
74#include <linux/delay.h> 74#include <linux/delay.h>
75#include <linux/clk.h>
75 76
76#include <asm/io.h> 77#include <asm/io.h>
77#include <asm/irq.h> 78#include <asm/irq.h>
78 79
79#include <asm/hardware.h> 80#include <asm/hardware.h>
80#include <asm/hardware/clock.h>
81 81
82#include <asm/arch/regs-serial.h> 82#include <asm/arch/regs-serial.h>
83#include <asm/arch/regs-gpio.h> 83#include <asm/arch/regs-gpio.h>
@@ -782,11 +782,9 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
782 782
783 if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) { 783 if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) {
784 clk_disable(ourport->baudclk); 784 clk_disable(ourport->baudclk);
785 clk_unuse(ourport->baudclk);
786 ourport->baudclk = NULL; 785 ourport->baudclk = NULL;
787 } 786 }
788 787
789 clk_use(clk);
790 clk_enable(clk); 788 clk_enable(clk);
791 789
792 ourport->clksrc = clksrc; 790 ourport->clksrc = clksrc;
@@ -1077,9 +1075,6 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1077 1075
1078 ourport->clk = clk_get(&platdev->dev, "uart"); 1076 ourport->clk = clk_get(&platdev->dev, "uart");
1079 1077
1080 if (ourport->clk != NULL && !IS_ERR(ourport->clk))
1081 clk_use(ourport->clk);
1082
1083 dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n", 1078 dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n",
1084 port->mapbase, port->membase, port->irq, port->uartclk); 1079 port->mapbase, port->membase, port->irq, port->uartclk);
1085 1080
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index c9e29d808711..3785b3f7df1b 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -17,6 +17,7 @@
17#include <linux/signal.h> /* SA_INTERRUPT */ 17#include <linux/signal.h> /* SA_INTERRUPT */
18#include <linux/jiffies.h> 18#include <linux/jiffies.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/clk.h>
20 21
21#include <asm/hardware.h> 22#include <asm/hardware.h>
22#include <asm/io.h> 23#include <asm/io.h>
@@ -27,7 +28,6 @@
27#include <asm/arch/gpio.h> 28#include <asm/arch/gpio.h>
28#include <asm/arch/fpga.h> 29#include <asm/arch/fpga.h>
29#include <asm/arch/usb.h> 30#include <asm/arch/usb.h>
30#include <asm/hardware/clock.h>
31 31
32 32
33/* OMAP-1510 OHCI has its own MMU for DMA */ 33/* OMAP-1510 OHCI has its own MMU for DMA */
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 35cc9402adc0..372527a83593 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -20,9 +20,9 @@
20*/ 20*/
21 21
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/clk.h>
23 24
24#include <asm/hardware.h> 25#include <asm/hardware.h>
25#include <asm/hardware/clock.h>
26#include <asm/arch/usb-control.h> 26#include <asm/arch/usb-control.h>
27 27
28#define valid_port(idx) ((idx) == 1 || (idx) == 2) 28#define valid_port(idx) ((idx) == 1 || (idx) == 2)
@@ -363,7 +363,6 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
363 goto err1; 363 goto err1;
364 } 364 }
365 365
366 clk_use(clk);
367 s3c2410_start_hc(dev, hcd); 366 s3c2410_start_hc(dev, hcd);
368 367
369 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); 368 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
@@ -384,7 +383,6 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
384 err2: 383 err2:
385 s3c2410_stop_hc(dev); 384 s3c2410_stop_hc(dev);
386 iounmap(hcd->regs); 385 iounmap(hcd->regs);
387 clk_unuse(clk);
388 clk_put(clk); 386 clk_put(clk);
389 387
390 err1: 388 err1:
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index a3c2c45e29e0..0da4083ba908 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -21,12 +21,11 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/amba/bus.h>
25#include <linux/amba/clcd.h>
26#include <linux/clk.h>
24 27
25#include <asm/sizes.h> 28#include <asm/sizes.h>
26#include <asm/hardware/amba.h>
27#include <asm/hardware/clock.h>
28
29#include <asm/hardware/amba_clcd.h>
30 29
31#define to_clcd(info) container_of(info, struct clcd_fb, fb) 30#define to_clcd(info) container_of(info, struct clcd_fb, fb)
32 31
@@ -346,10 +345,6 @@ static int clcdfb_register(struct clcd_fb *fb)
346 goto out; 345 goto out;
347 } 346 }
348 347
349 ret = clk_use(fb->clk);
350 if (ret)
351 goto free_clk;
352
353 fb->fb.fix.mmio_start = fb->dev->res.start; 348 fb->fb.fix.mmio_start = fb->dev->res.start;
354 fb->fb.fix.mmio_len = SZ_4K; 349 fb->fb.fix.mmio_len = SZ_4K;
355 350
@@ -357,7 +352,7 @@ static int clcdfb_register(struct clcd_fb *fb)
357 if (!fb->regs) { 352 if (!fb->regs) {
358 printk(KERN_ERR "CLCD: unable to remap registers\n"); 353 printk(KERN_ERR "CLCD: unable to remap registers\n");
359 ret = -ENOMEM; 354 ret = -ENOMEM;
360 goto unuse_clk; 355 goto free_clk;
361 } 356 }
362 357
363 fb->fb.fbops = &clcdfb_ops; 358 fb->fb.fbops = &clcdfb_ops;
@@ -427,8 +422,6 @@ static int clcdfb_register(struct clcd_fb *fb)
427 printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret); 422 printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret);
428 423
429 iounmap(fb->regs); 424 iounmap(fb->regs);
430 unuse_clk:
431 clk_unuse(fb->clk);
432 free_clk: 425 free_clk:
433 clk_put(fb->clk); 426 clk_put(fb->clk);
434 out: 427 out:
@@ -489,7 +482,6 @@ static int clcdfb_remove(struct amba_device *dev)
489 clcdfb_disable(fb); 482 clcdfb_disable(fb);
490 unregister_framebuffer(&fb->fb); 483 unregister_framebuffer(&fb->fb);
491 iounmap(fb->regs); 484 iounmap(fb->regs);
492 clk_unuse(fb->clk);
493 clk_put(fb->clk); 485 clk_put(fb->clk);
494 486
495 fb->board->remove(fb); 487 fb->board->remove(fb);
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
index 6a219b2c77e3..d0aaf450e8c7 100644
--- a/drivers/video/backlight/corgi_bl.c
+++ b/drivers/video/backlight/corgi_bl.c
@@ -20,6 +20,7 @@
20#include <linux/backlight.h> 20#include <linux/backlight.h>
21 21
22#include <asm/arch/sharpsl.h> 22#include <asm/arch/sharpsl.h>
23#include <asm/hardware/sharpsl_pm.h>
23 24
24#define CORGI_DEFAULT_INTENSITY 0x1f 25#define CORGI_DEFAULT_INTENSITY 0x1f
25#define CORGI_LIMIT_MASK 0x0b 26#define CORGI_LIMIT_MASK 0x0b
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 5924cc225c95..1718baaeed2a 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -554,7 +554,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
554 554
555 inf = pdev->dev.platform_data; 555 inf = pdev->dev.platform_data;
556 if(!inf) { 556 if(!inf) {
557 dev_err(dev,"No platform_data available\n"); 557 dev_err(&pdev->dev,"No platform_data available\n");
558 return -ENOMEM; 558 return -ENOMEM;
559 } 559 }
560 560
@@ -579,7 +579,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
579 if (!inf->fixed_screen_cpu) { 579 if (!inf->fixed_screen_cpu) {
580 ret = imxfb_map_video_memory(info); 580 ret = imxfb_map_video_memory(info);
581 if (ret) { 581 if (ret) {
582 dev_err(dev, "Failed to allocate video RAM: %d\n", ret); 582 dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret);
583 ret = -ENOMEM; 583 ret = -ENOMEM;
584 goto failed_map; 584 goto failed_map;
585 } 585 }
@@ -608,7 +608,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
608 imxfb_set_par(info); 608 imxfb_set_par(info);
609 ret = register_framebuffer(info); 609 ret = register_framebuffer(info);
610 if (ret < 0) { 610 if (ret < 0) {
611 dev_err(dev, "failed to register framebuffer\n"); 611 dev_err(&pdev->dev, "failed to register framebuffer\n");
612 goto failed_register; 612 goto failed_register;
613 } 613 }
614 614
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index ce6e749db3a7..fe99d17a21d7 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -87,6 +87,7 @@
87#include <linux/workqueue.h> 87#include <linux/workqueue.h>
88#include <linux/wait.h> 88#include <linux/wait.h>
89#include <linux/platform_device.h> 89#include <linux/platform_device.h>
90#include <linux/clk.h>
90 91
91#include <asm/io.h> 92#include <asm/io.h>
92#include <asm/uaccess.h> 93#include <asm/uaccess.h>
@@ -96,7 +97,6 @@
96#include <asm/arch/regs-lcd.h> 97#include <asm/arch/regs-lcd.h>
97#include <asm/arch/regs-gpio.h> 98#include <asm/arch/regs-gpio.h>
98#include <asm/arch/fb.h> 99#include <asm/arch/fb.h>
99#include <asm/hardware/clock.h>
100 100
101#ifdef CONFIG_PM 101#ifdef CONFIG_PM
102#include <linux/pm.h> 102#include <linux/pm.h>
@@ -746,7 +746,6 @@ int __init s3c2410fb_probe(struct platform_device *pdev)
746 goto release_irq; 746 goto release_irq;
747 } 747 }
748 748
749 clk_use(info->clk);
750 clk_enable(info->clk); 749 clk_enable(info->clk);
751 dprintk("got and enabled clock\n"); 750 dprintk("got and enabled clock\n");
752 751
@@ -783,7 +782,6 @@ free_video_memory:
783 s3c2410fb_unmap_video_memory(info); 782 s3c2410fb_unmap_video_memory(info);
784release_clock: 783release_clock:
785 clk_disable(info->clk); 784 clk_disable(info->clk);
786 clk_unuse(info->clk);
787 clk_put(info->clk); 785 clk_put(info->clk);
788release_irq: 786release_irq:
789 free_irq(irq,info); 787 free_irq(irq,info);
@@ -828,7 +826,6 @@ static int s3c2410fb_remove(struct platform_device *pdev)
828 826
829 if (info->clk) { 827 if (info->clk) {
830 clk_disable(info->clk); 828 clk_disable(info->clk);
831 clk_unuse(info->clk);
832 clk_put(info->clk); 829 clk_put(info->clk);
833 info->clk = NULL; 830 info->clk = NULL;
834 } 831 }
diff --git a/include/asm-arm/arch-aaec2000/dma.h b/include/asm-arm/arch-aaec2000/dma.h
index 28c890b4a1d3..e100b1e526fe 100644
--- a/include/asm-arm/arch-aaec2000/dma.h
+++ b/include/asm-arm/arch-aaec2000/dma.h
@@ -7,11 +7,3 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#define MAX_DMA_ADDRESS 0xffffffff
15#define MAX_DMA_CHANNELS 0
16
17#endif
diff --git a/include/asm-arm/arch-cl7500/dma.h b/include/asm-arm/arch-cl7500/dma.h
index 1d6a8829d327..591ed2551892 100644
--- a/include/asm-arm/arch-cl7500/dma.h
+++ b/include/asm-arm/arch-cl7500/dma.h
@@ -15,7 +15,6 @@
15 * bytes of RAM. 15 * bytes of RAM.
16 */ 16 */
17#define MAX_DMA_ADDRESS 0xd0000000 17#define MAX_DMA_ADDRESS 0xd0000000
18#define MAX_DMA_CHANNELS 0
19 18
20#define DMA_S0 0 19#define DMA_S0 0
21 20
diff --git a/include/asm-arm/arch-cl7500/entry-macro.S b/include/asm-arm/arch-cl7500/entry-macro.S
index 686f413f82d6..c9e5395e5106 100644
--- a/include/asm-arm/arch-cl7500/entry-macro.S
+++ b/include/asm-arm/arch-cl7500/entry-macro.S
@@ -1,3 +1,3 @@
1 1#include <asm/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S> 2#include <asm/hardware/entry-macro-iomd.S>
3 3
diff --git a/include/asm-arm/arch-clps711x/dma.h b/include/asm-arm/arch-clps711x/dma.h
index 3c4c5c843252..610997938423 100644
--- a/include/asm-arm/arch-clps711x/dma.h
+++ b/include/asm-arm/arch-clps711x/dma.h
@@ -17,12 +17,3 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#ifndef __ASM_ARCH_DMA_H
21#define __ASM_ARCH_DMA_H
22
23#define MAX_DMA_ADDRESS 0xffffffff
24
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
28
diff --git a/include/asm-arm/arch-clps711x/entry-macro.S b/include/asm-arm/arch-clps711x/entry-macro.S
index b31079a1d4a9..21f6ee485819 100644
--- a/include/asm-arm/arch-clps711x/entry-macro.S
+++ b/include/asm-arm/arch-clps711x/entry-macro.S
@@ -7,6 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
10#include <asm/hardware/clps7111.h> 11#include <asm/hardware/clps7111.h>
11 12
12 .macro disable_fiq 13 .macro disable_fiq
diff --git a/include/asm-arm/arch-clps711x/system.h b/include/asm-arm/arch-clps711x/system.h
index 2ab981fee37f..11e1491535a8 100644
--- a/include/asm-arm/arch-clps711x/system.h
+++ b/include/asm-arm/arch-clps711x/system.h
@@ -20,7 +20,9 @@
20#ifndef __ASM_ARCH_SYSTEM_H 20#ifndef __ASM_ARCH_SYSTEM_H
21#define __ASM_ARCH_SYSTEM_H 21#define __ASM_ARCH_SYSTEM_H
22 22
23#include <asm/hardware.h>
23#include <asm/hardware/clps7111.h> 24#include <asm/hardware/clps7111.h>
25#include <asm/io.h>
24 26
25static inline void arch_idle(void) 27static inline void arch_idle(void)
26{ 28{
diff --git a/include/asm-arm/arch-ebsa110/dma.h b/include/asm-arm/arch-ebsa110/dma.h
index d491776ac1cc..c52f9e2ab0bb 100644
--- a/include/asm-arm/arch-ebsa110/dma.h
+++ b/include/asm-arm/arch-ebsa110/dma.h
@@ -9,11 +9,3 @@
9 * 9 *
10 * EBSA110 DMA definitions 10 * EBSA110 DMA definitions
11 */ 11 */
12#ifndef __ASM_ARCH_DMA_H
13#define __ASM_ARCH_DMA_H
14
15#define MAX_DMA_ADDRESS 0xffffffff
16#define MAX_DMA_CHANNELS 0
17
18#endif /* _ASM_ARCH_DMA_H */
19
diff --git a/include/asm-arm/arch-ebsa285/dma.h b/include/asm-arm/arch-ebsa285/dma.h
index c43046eb8bc7..0259ad45d33c 100644
--- a/include/asm-arm/arch-ebsa285/dma.h
+++ b/include/asm-arm/arch-ebsa285/dma.h
@@ -10,11 +10,6 @@
10#define __ASM_ARCH_DMA_H 10#define __ASM_ARCH_DMA_H
11 11
12/* 12/*
13 * This is the maximum DMA address that can be DMAd to.
14 */
15#define MAX_DMA_ADDRESS 0xffffffff
16
17/*
18 * The 21285 has two internal DMA channels; we call these 8 and 9. 13 * The 21285 has two internal DMA channels; we call these 8 and 9.
19 * On CATS hardware we have an additional eight ISA dma channels 14 * On CATS hardware we have an additional eight ISA dma channels
20 * numbered 0..7. 15 * numbered 0..7.
diff --git a/include/asm-arm/arch-ebsa285/entry-macro.S b/include/asm-arm/arch-ebsa285/entry-macro.S
index db5729ff6349..cf10ac96fdde 100644
--- a/include/asm-arm/arch-ebsa285/entry-macro.S
+++ b/include/asm-arm/arch-ebsa285/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10#include <asm/hardware/dec21285.h> 12#include <asm/hardware/dec21285.h>
11 13
12 .macro disable_fiq 14 .macro disable_fiq
diff --git a/include/asm-arm/arch-epxa10db/dma.h b/include/asm-arm/arch-epxa10db/dma.h
index 5d97734d1077..de20ec8e74b1 100644
--- a/include/asm-arm/arch-epxa10db/dma.h
+++ b/include/asm-arm/arch-epxa10db/dma.h
@@ -17,12 +17,3 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#ifndef __ASM_ARCH_DMA_H
21#define __ASM_ARCH_DMA_H
22
23#define MAX_DMA_ADDRESS 0xffffffff
24
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
28
diff --git a/include/asm-arm/arch-imx/dma.h b/include/asm-arm/arch-imx/dma.h
index dbdc01780413..b45fa367d71e 100644
--- a/include/asm-arm/arch-imx/dma.h
+++ b/include/asm-arm/arch-imx/dma.h
@@ -20,10 +20,6 @@
20#ifndef __ASM_ARCH_DMA_H 20#ifndef __ASM_ARCH_DMA_H
21#define __ASM_ARCH_DMA_H 21#define __ASM_ARCH_DMA_H
22 22
23#define MAX_DMA_ADDRESS 0xffffffff
24
25#define MAX_DMA_CHANNELS 0
26
27/* 23/*
28 * DMA registration 24 * DMA registration
29 */ 25 */
diff --git a/include/asm-arm/arch-imx/entry-macro.S b/include/asm-arm/arch-imx/entry-macro.S
index b40ea7cf88ec..3b9ef6914627 100644
--- a/include/asm-arm/arch-imx/entry-macro.S
+++ b/include/asm-arm/arch-imx/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11
10 .macro disable_fiq 12 .macro disable_fiq
11 .endm 13 .endm
12#define AITC_NIVECSR 0x40 14#define AITC_NIVECSR 0x40
diff --git a/include/asm-arm/arch-integrator/debug-macro.S b/include/asm-arm/arch-integrator/debug-macro.S
index 484a1aa47098..031d30941791 100644
--- a/include/asm-arm/arch-integrator/debug-macro.S
+++ b/include/asm-arm/arch-integrator/debug-macro.S
@@ -11,7 +11,7 @@
11 * 11 *
12*/ 12*/
13 13
14#include <asm/hardware/amba_serial.h> 14#include <linux/amba/serial.h>
15 15
16 .macro addruart,rx 16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 17 mrc p15, 0, \rx, c1, c0
diff --git a/include/asm-arm/arch-integrator/dma.h b/include/asm-arm/arch-integrator/dma.h
index 7171792290bd..83fd6bbaf9d3 100644
--- a/include/asm-arm/arch-integrator/dma.h
+++ b/include/asm-arm/arch-integrator/dma.h
@@ -17,12 +17,3 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#ifndef __ASM_ARCH_DMA_H
21#define __ASM_ARCH_DMA_H
22
23#define MAX_DMA_ADDRESS 0xffffffff
24
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
28
diff --git a/include/asm-arm/arch-integrator/entry-macro.S b/include/asm-arm/arch-integrator/entry-macro.S
index 44f7ee613194..69838d04f90b 100644
--- a/include/asm-arm/arch-integrator/entry-macro.S
+++ b/include/asm-arm/arch-integrator/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10 12
11 .macro disable_fiq 13 .macro disable_fiq
12 .endm 14 .endm
diff --git a/include/asm-arm/arch-iop3xx/dma.h b/include/asm-arm/arch-iop3xx/dma.h
index 797f9e6fc745..1e808db8af2a 100644
--- a/include/asm-arm/arch-iop3xx/dma.h
+++ b/include/asm-arm/arch-iop3xx/dma.h
@@ -7,10 +7,3 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#ifndef _IOP3XX_DMA_H_P
12#define _IOP3XX_DMA_H_P
13
14#define MAX_DMA_ADDRESS 0xffffffff
15
16#endif /* _ASM_ARCH_DMA_H_P */
diff --git a/include/asm-arm/arch-iop3xx/entry-macro.S b/include/asm-arm/arch-iop3xx/entry-macro.S
index e2ce7f5467c8..926668c098a5 100644
--- a/include/asm-arm/arch-iop3xx/entry-macro.S
+++ b/include/asm-arm/arch-iop3xx/entry-macro.S
@@ -7,6 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/arch/irqs.h>
10 11
11#if defined(CONFIG_ARCH_IOP321) 12#if defined(CONFIG_ARCH_IOP321)
12 .macro disable_fiq 13 .macro disable_fiq
diff --git a/include/asm-arm/arch-ixp2000/dma.h b/include/asm-arm/arch-ixp2000/dma.h
index 0fb3568a98dd..548d8dc507eb 100644
--- a/include/asm-arm/arch-ixp2000/dma.h
+++ b/include/asm-arm/arch-ixp2000/dma.h
@@ -7,12 +7,3 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#ifndef __ASM_ARCH_DMA_H
11#define __ASM_ARCH_DMA_H
12
13#define MAX_DMA_ADDRESS 0xffffffff
14
15/* No DMA */
16#define MAX_DMA_CHANNELS 0
17
18#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-ixp2000/enp2611.h b/include/asm-arm/arch-ixp2000/enp2611.h
index 95128d9f5026..42f3c28dc5c4 100644
--- a/include/asm-arm/arch-ixp2000/enp2611.h
+++ b/include/asm-arm/arch-ixp2000/enp2611.h
@@ -36,5 +36,11 @@
36#define ENP2611_GPIO_SCL 7 36#define ENP2611_GPIO_SCL 7
37#define ENP2611_GPIO_SDA 6 37#define ENP2611_GPIO_SDA 6
38 38
39#define IRQ_ENP2611_THERMAL IRQ_IXP2000_GPIO4
40#define IRQ_ENP2611_OPTION_BOARD IRQ_IXP2000_GPIO3
41#define IRQ_ENP2611_CALEB IRQ_IXP2000_GPIO2
42#define IRQ_ENP2611_PM3386_1 IRQ_IXP2000_GPIO1
43#define IRQ_ENP2611_PM3386_0 IRQ_IXP2000_GPIO0
44
39 45
40#endif 46#endif
diff --git a/include/asm-arm/arch-ixp2000/entry-macro.S b/include/asm-arm/arch-ixp2000/entry-macro.S
index e3a4e4121298..16e1e6124b31 100644
--- a/include/asm-arm/arch-ixp2000/entry-macro.S
+++ b/include/asm-arm/arch-ixp2000/entry-macro.S
@@ -7,6 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/arch/irqs.h>
10 11
11 .macro disable_fiq 12 .macro disable_fiq
12 .endm 13 .endm
diff --git a/include/asm-arm/arch-ixp2000/io.h b/include/asm-arm/arch-ixp2000/io.h
index 7fbcdf9931ee..c0ff2c6c66e7 100644
--- a/include/asm-arm/arch-ixp2000/io.h
+++ b/include/asm-arm/arch-ixp2000/io.h
@@ -131,102 +131,4 @@
131#endif 131#endif
132 132
133 133
134#ifdef CONFIG_ARCH_IXDP2X01
135/*
136 * This is an ugly hack but the CS8900 on the 2x01's does not sit in any sort
137 * of "I/O space" and is just direct mapped into a 32-bit-only addressable
138 * bus. The address space for this bus is such that we can't really easily
139 * make it contiguous to the PCI I/O address range, and it also does not
140 * need swapping like PCI addresses do (IXDP2x01 is a BE platform).
141 * B/C of this we can't use the standard in/out functions and need to
142 * runtime check if the incoming address is a PCI address or for
143 * the CS89x0.
144 */
145#undef inw
146#undef outw
147#undef insw
148#undef outsw
149
150#include <asm/mach-types.h>
151
152static inline void insw(u32 ptr, void *buf, int length)
153{
154 register volatile u32 *port = (volatile u32 *)ptr;
155
156 /*
157 * Is this cycle meant for the CS8900?
158 */
159 if ((machine_is_ixdp2401() || machine_is_ixdp2801()) &&
160 (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) &&
161 ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) {
162 u8 *buf8 = (u8*)buf;
163 register u32 tmp32;
164
165 do {
166 tmp32 = *port;
167 *buf8++ = (u8)tmp32;
168 *buf8++ = (u8)(tmp32 >> 8);
169 } while(--length);
170
171 return;
172 }
173
174 __raw_readsw(alignw(___io(ptr)),buf,length);
175}
176
177static inline void outsw(u32 ptr, void *buf, int length)
178{
179 register volatile u32 *port = (volatile u32 *)ptr;
180
181 /*
182 * Is this cycle meant for the CS8900?
183 */
184 if ((machine_is_ixdp2401() || machine_is_ixdp2801()) &&
185 (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) &&
186 ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) {
187 register u32 tmp32;
188 u8 *buf8 = (u8*)buf;
189 do {
190 tmp32 = *buf8++;
191 tmp32 |= (*buf8++) << 8;
192 *port = tmp32;
193 } while(--length);
194 return;
195 }
196
197 __raw_writesw(alignw(___io(ptr)),buf,length);
198}
199
200
201static inline u16 inw(u32 ptr)
202{
203 register volatile u32 *port = (volatile u32 *)ptr;
204
205 /*
206 * Is this cycle meant for the CS8900?
207 */
208 if ((machine_is_ixdp2401() || machine_is_ixdp2801()) &&
209 (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) &&
210 ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) {
211 return (u16)(*port);
212 }
213
214 return __raw_readw(alignw(___io(ptr)));
215}
216
217static inline void outw(u16 value, u32 ptr)
218{
219 register volatile u32 *port = (volatile u32 *)ptr;
220
221 if ((machine_is_ixdp2401() || machine_is_ixdp2801()) &&
222 (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) &&
223 ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) {
224 *port = value;
225 return;
226 }
227
228 __raw_writew((value),alignw(___io(ptr)));
229}
230#endif /* IXDP2x01 */
231
232#endif 134#endif
diff --git a/include/asm-arm/arch-ixp2000/ixp2000-regs.h b/include/asm-arm/arch-ixp2000/ixp2000-regs.h
index fc5ac6aec4f2..8cf70ff160af 100644
--- a/include/asm-arm/arch-ixp2000/ixp2000-regs.h
+++ b/include/asm-arm/arch-ixp2000/ixp2000-regs.h
@@ -156,6 +156,14 @@
156#define IXP2000_IRQ_THD_RAW_STATUS_B_1 IXP2000_INTCTL_REG(0x84) 156#define IXP2000_IRQ_THD_RAW_STATUS_B_1 IXP2000_INTCTL_REG(0x84)
157#define IXP2000_IRQ_THD_RAW_STATUS_B_2 IXP2000_INTCTL_REG(0x88) 157#define IXP2000_IRQ_THD_RAW_STATUS_B_2 IXP2000_INTCTL_REG(0x88)
158#define IXP2000_IRQ_THD_RAW_STATUS_B_3 IXP2000_INTCTL_REG(0x8c) 158#define IXP2000_IRQ_THD_RAW_STATUS_B_3 IXP2000_INTCTL_REG(0x8c)
159#define IXP2000_IRQ_THD_STATUS_A_0 IXP2000_INTCTL_REG(0xe0)
160#define IXP2000_IRQ_THD_STATUS_A_1 IXP2000_INTCTL_REG(0xe4)
161#define IXP2000_IRQ_THD_STATUS_A_2 IXP2000_INTCTL_REG(0xe8)
162#define IXP2000_IRQ_THD_STATUS_A_3 IXP2000_INTCTL_REG(0xec)
163#define IXP2000_IRQ_THD_STATUS_B_0 IXP2000_INTCTL_REG(0x100)
164#define IXP2000_IRQ_THD_STATUS_B_1 IXP2000_INTCTL_REG(0x104)
165#define IXP2000_IRQ_THD_STATUS_B_2 IXP2000_INTCTL_REG(0x108)
166#define IXP2000_IRQ_THD_STATUS_B_3 IXP2000_INTCTL_REG(0x10c)
159#define IXP2000_IRQ_THD_ENABLE_SET_A_0 IXP2000_INTCTL_REG(0x160) 167#define IXP2000_IRQ_THD_ENABLE_SET_A_0 IXP2000_INTCTL_REG(0x160)
160#define IXP2000_IRQ_THD_ENABLE_SET_A_1 IXP2000_INTCTL_REG(0x164) 168#define IXP2000_IRQ_THD_ENABLE_SET_A_1 IXP2000_INTCTL_REG(0x164)
161#define IXP2000_IRQ_THD_ENABLE_SET_A_2 IXP2000_INTCTL_REG(0x168) 169#define IXP2000_IRQ_THD_ENABLE_SET_A_2 IXP2000_INTCTL_REG(0x168)
diff --git a/include/asm-arm/arch-ixp4xx/coyote.h b/include/asm-arm/arch-ixp4xx/coyote.h
index dd0c2d2d8503..7ac9ba2c035c 100644
--- a/include/asm-arm/arch-ixp4xx/coyote.h
+++ b/include/asm-arm/arch-ixp4xx/coyote.h
@@ -16,9 +16,6 @@
16#error "Do not include this directly, instead #include <asm/hardware.h>" 16#error "Do not include this directly, instead #include <asm/hardware.h>"
17#endif 17#endif
18 18
19#define COYOTE_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
20#define COYOTE_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE * 2
21
22/* PCI controller GPIO to IRQ pin mappings */ 19/* PCI controller GPIO to IRQ pin mappings */
23#define COYOTE_PCI_SLOT0_PIN 6 20#define COYOTE_PCI_SLOT0_PIN 6
24#define COYOTE_PCI_SLOT1_PIN 11 21#define COYOTE_PCI_SLOT1_PIN 11
@@ -26,7 +23,7 @@
26#define COYOTE_PCI_SLOT0_DEVID 14 23#define COYOTE_PCI_SLOT0_DEVID 14
27#define COYOTE_PCI_SLOT1_DEVID 15 24#define COYOTE_PCI_SLOT1_DEVID 15
28 25
29#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_CS3_BASE_PHYS 26#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
30#define COYOTE_IDE_BASE_VIRT 0xFFFE1000 27#define COYOTE_IDE_BASE_VIRT 0xFFFE1000
31#define COYOTE_IDE_REGION_SIZE 0x1000 28#define COYOTE_IDE_REGION_SIZE 0x1000
32 29
diff --git a/include/asm-arm/arch-ixp4xx/dma.h b/include/asm-arm/arch-ixp4xx/dma.h
index 312065dc0e7a..b1a071ecebc8 100644
--- a/include/asm-arm/arch-ixp4xx/dma.h
+++ b/include/asm-arm/arch-ixp4xx/dma.h
@@ -20,7 +20,4 @@
20 20
21#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M) 21#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
22 22
23/* No DMA */
24#define MAX_DMA_CHANNELS 0
25
26#endif /* _ASM_ARCH_DMA_H */ 23#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-ixp4xx/entry-macro.S b/include/asm-arm/arch-ixp4xx/entry-macro.S
index 323b0bc4a39c..27e124132e4c 100644
--- a/include/asm-arm/arch-ixp4xx/entry-macro.S
+++ b/include/asm-arm/arch-ixp4xx/entry-macro.S
@@ -7,6 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
10 11
11 .macro disable_fiq 12 .macro disable_fiq
12 .endm 13 .endm
diff --git a/include/asm-arm/arch-ixp4xx/gtwx5715.h b/include/asm-arm/arch-ixp4xx/gtwx5715.h
index fc460af70627..c3069d67c00e 100644
--- a/include/asm-arm/arch-ixp4xx/gtwx5715.h
+++ b/include/asm-arm/arch-ixp4xx/gtwx5715.h
@@ -57,10 +57,6 @@
57#define GTWX5715_GPIO13_IRQ IRQ_IXP4XX_SW_INT1 57#define GTWX5715_GPIO13_IRQ IRQ_IXP4XX_SW_INT1
58#define GTWX5715_GPIO14_IRQ IRQ_IXP4XX_SW_INT2 58#define GTWX5715_GPIO14_IRQ IRQ_IXP4XX_SW_INT2
59 59
60
61#define GTWX5715_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
62#define GTWX5715_FLASH_SIZE (0x00800000)
63
64/* PCI controller GPIO to IRQ pin mappings 60/* PCI controller GPIO to IRQ pin mappings
65 61
66 INTA INTB 62 INTA INTB
diff --git a/include/asm-arm/arch-ixp4xx/hardware.h b/include/asm-arm/arch-ixp4xx/hardware.h
index cfb413c845f7..6acb69c95ef9 100644
--- a/include/asm-arm/arch-ixp4xx/hardware.h
+++ b/include/asm-arm/arch-ixp4xx/hardware.h
@@ -45,5 +45,6 @@ extern unsigned int processor_id;
45#include "coyote.h" 45#include "coyote.h"
46#include "prpmc1100.h" 46#include "prpmc1100.h"
47#include "nslu2.h" 47#include "nslu2.h"
48#include "nas100d.h"
48 49
49#endif /* _ASM_ARCH_HARDWARE_H */ 50#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/include/asm-arm/arch-ixp4xx/irqs.h b/include/asm-arm/arch-ixp4xx/irqs.h
index 2cf4930372bc..f24b763ca18e 100644
--- a/include/asm-arm/arch-ixp4xx/irqs.h
+++ b/include/asm-arm/arch-ixp4xx/irqs.h
@@ -100,4 +100,13 @@
100#define IRQ_NSLU2_PCI_INTB IRQ_IXP4XX_GPIO10 100#define IRQ_NSLU2_PCI_INTB IRQ_IXP4XX_GPIO10
101#define IRQ_NSLU2_PCI_INTC IRQ_IXP4XX_GPIO9 101#define IRQ_NSLU2_PCI_INTC IRQ_IXP4XX_GPIO9
102 102
103/*
104 * NAS100D board IRQs
105 */
106#define IRQ_NAS100D_PCI_INTA IRQ_IXP4XX_GPIO11
107#define IRQ_NAS100D_PCI_INTB IRQ_IXP4XX_GPIO10
108#define IRQ_NAS100D_PCI_INTC IRQ_IXP4XX_GPIO9
109#define IRQ_NAS100D_PCI_INTD IRQ_IXP4XX_GPIO8
110#define IRQ_NAS100D_PCI_INTE IRQ_IXP4XX_GPIO7
111
103#endif 112#endif
diff --git a/include/asm-arm/arch-ixp4xx/ixdp425.h b/include/asm-arm/arch-ixp4xx/ixdp425.h
index 7d21bf941379..3d3820d7ba09 100644
--- a/include/asm-arm/arch-ixp4xx/ixdp425.h
+++ b/include/asm-arm/arch-ixp4xx/ixdp425.h
@@ -16,9 +16,6 @@
16#error "Do not include this directly, instead #include <asm/hardware.h>" 16#error "Do not include this directly, instead #include <asm/hardware.h>"
17#endif 17#endif
18 18
19#define IXDP425_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
20#define IXDP425_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
21
22#define IXDP425_SDA_PIN 7 19#define IXDP425_SDA_PIN 7
23#define IXDP425_SCL_PIN 6 20#define IXDP425_SCL_PIN 6
24 21
diff --git a/include/asm-arm/arch-ixp4xx/memory.h b/include/asm-arm/arch-ixp4xx/memory.h
index e024d0a1a669..ee211d28a3ef 100644
--- a/include/asm-arm/arch-ixp4xx/memory.h
+++ b/include/asm-arm/arch-ixp4xx/memory.h
@@ -16,31 +16,10 @@
16 16
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18 18
19/* 19void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes);
20 * Only first 64MB of memory can be accessed via PCI.
21 * We use GFP_DMA to allocate safe buffers to do map/unmap.
22 * This is really ugly and we need a better way of specifying
23 * DMA-capable regions of memory.
24 */
25static inline void __arch_adjust_zones(int node, unsigned long *zone_size,
26 unsigned long *zhole_size)
27{
28 unsigned int sz = SZ_64M >> PAGE_SHIFT;
29
30 /*
31 * Only adjust if > 64M on current system
32 */
33 if (node || (zone_size[0] <= sz))
34 return;
35
36 zone_size[1] = zone_size[0] - sz;
37 zone_size[0] = sz;
38 zhole_size[1] = zhole_size[0];
39 zhole_size[0] = 0;
40}
41 20
42#define arch_adjust_zones(node, size, holes) \ 21#define arch_adjust_zones(node, size, holes) \
43 __arch_adjust_zones(node, size, holes) 22 ixp4xx_adjust_zones(node, size, holes)
44 23
45#define ISA_DMA_THRESHOLD (SZ_64M - 1) 24#define ISA_DMA_THRESHOLD (SZ_64M - 1)
46 25
diff --git a/include/asm-arm/arch-ixp4xx/nas100d.h b/include/asm-arm/arch-ixp4xx/nas100d.h
new file mode 100644
index 000000000000..51ac0180427c
--- /dev/null
+++ b/include/asm-arm/arch-ixp4xx/nas100d.h
@@ -0,0 +1,72 @@
1/*
2 * include/asm-arm/arch-ixp4xx/nas100d.h
3 *
4 * NAS100D platform specific definitions
5 *
6 * Copyright (c) 2005 Tower Technologies
7 *
8 * Author: Alessandro Zummo <a.zummo@towertech.it>
9 *
10 * based on ixdp425.h:
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <asm/hardware.h>"
20#endif
21
22#define NAS100D_SDA_PIN 6
23#define NAS100D_SCL_PIN 5
24
25/*
26 * NAS100D PCI IRQs
27 */
28#define NAS100D_PCI_MAX_DEV 3
29#define NAS100D_PCI_IRQ_LINES 3
30
31
32/* PCI controller GPIO to IRQ pin mappings */
33#define NAS100D_PCI_INTA_PIN 11
34#define NAS100D_PCI_INTB_PIN 10
35#define NAS100D_PCI_INTC_PIN 9
36#define NAS100D_PCI_INTD_PIN 8
37#define NAS100D_PCI_INTE_PIN 7
38
39/* GPIO */
40
41#define NAS100D_GPIO0 0
42#define NAS100D_GPIO1 1
43#define NAS100D_GPIO2 2
44#define NAS100D_GPIO3 3
45#define NAS100D_GPIO4 4
46#define NAS100D_GPIO5 5
47#define NAS100D_GPIO6 6
48#define NAS100D_GPIO7 7
49#define NAS100D_GPIO8 8
50#define NAS100D_GPIO9 9
51#define NAS100D_GPIO10 10
52#define NAS100D_GPIO11 11
53#define NAS100D_GPIO12 12
54#define NAS100D_GPIO13 13
55#define NAS100D_GPIO14 14
56#define NAS100D_GPIO15 15
57
58
59/* Buttons */
60
61#define NAS100D_PB_GPIO NAS100D_GPIO14
62#define NAS100D_RB_GPIO NAS100D_GPIO4
63#define NAS100D_PO_GPIO NAS100D_GPIO12 /* power off */
64
65#define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14
66#define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4
67
68/*
69#define NAS100D_PB_BM (1L << NAS100D_PB_GPIO)
70#define NAS100D_PO_BM (1L << NAS100D_PO_GPIO)
71#define NAS100D_RB_BM (1L << NAS100D_RB_GPIO)
72*/
diff --git a/include/asm-arm/arch-ixp4xx/nslu2.h b/include/asm-arm/arch-ixp4xx/nslu2.h
index b8b347a559c7..4281838873ef 100644
--- a/include/asm-arm/arch-ixp4xx/nslu2.h
+++ b/include/asm-arm/arch-ixp4xx/nslu2.h
@@ -18,9 +18,6 @@
18#error "Do not include this directly, instead #include <asm/hardware.h>" 18#error "Do not include this directly, instead #include <asm/hardware.h>"
19#endif 19#endif
20 20
21#define NSLU2_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
22#define NSLU2_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
23
24#define NSLU2_SDA_PIN 7 21#define NSLU2_SDA_PIN 7
25#define NSLU2_SCL_PIN 6 22#define NSLU2_SCL_PIN 6
26 23
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index f14ed63590c3..daf9790645ca 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -26,16 +26,17 @@
26 */ 26 */
27#define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000) 27#define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000)
28 28
29#define IXP4XX_EXP_BUS_CSX_REGION_SIZE (0x01000000) 29/*
30 * The expansion bus on the IXP4xx can be configured for either 16 or
31 * 32MB windows and the CS offset for each region changes based on the
32 * current configuration. This means that we cannot simply hardcode
33 * each offset. ixp4xx_sys_init() looks at the expansion bus configuration
34 * as setup by the bootloader to determine our window size.
35 */
36extern unsigned long ixp4xx_exp_bus_size;
30 37
31#define IXP4XX_EXP_BUS_CS0_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x00000000) 38#define IXP4XX_EXP_BUS_BASE(region)\
32#define IXP4XX_EXP_BUS_CS1_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x01000000) 39 (IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))
33#define IXP4XX_EXP_BUS_CS2_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x02000000)
34#define IXP4XX_EXP_BUS_CS3_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x03000000)
35#define IXP4XX_EXP_BUS_CS4_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x04000000)
36#define IXP4XX_EXP_BUS_CS5_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x05000000)
37#define IXP4XX_EXP_BUS_CS6_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x06000000)
38#define IXP4XX_EXP_BUS_CS7_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x07000000)
39 40
40#define IXP4XX_FLASH_WRITABLE (0x2) 41#define IXP4XX_FLASH_WRITABLE (0x2)
41#define IXP4XX_FLASH_DEFAULT (0xbcd23c40) 42#define IXP4XX_FLASH_DEFAULT (0xbcd23c40)
@@ -112,10 +113,5 @@ static inline void gpio_line_set(u8 line, int value)
112 *IXP4XX_GPIO_GPOUTR &= ~(1 << line); 113 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
113} 114}
114 115
115static inline void gpio_line_isr_clear(u8 line)
116{
117 *IXP4XX_GPIO_GPISR = (1 << line);
118}
119
120#endif // __ASSEMBLY__ 116#endif // __ASSEMBLY__
121 117
diff --git a/include/asm-arm/arch-l7200/dma.h b/include/asm-arm/arch-l7200/dma.h
index 6595b386cfc9..4c7eca63f035 100644
--- a/include/asm-arm/arch-l7200/dma.h
+++ b/include/asm-arm/arch-l7200/dma.h
@@ -17,7 +17,6 @@
17 * bytes of RAM. 17 * bytes of RAM.
18 */ 18 */
19#define MAX_DMA_ADDRESS 0xd0000000 19#define MAX_DMA_ADDRESS 0xd0000000
20#define MAX_DMA_CHANNELS 0
21 20
22#define DMA_S0 0 21#define DMA_S0 0
23 22
diff --git a/include/asm-arm/arch-l7200/system.h b/include/asm-arm/arch-l7200/system.h
index cb4ff29059b8..18825cf071ba 100644
--- a/include/asm-arm/arch-l7200/system.h
+++ b/include/asm-arm/arch-l7200/system.h
@@ -12,6 +12,8 @@
12#ifndef __ASM_ARCH_SYSTEM_H 12#ifndef __ASM_ARCH_SYSTEM_H
13#define __ASM_ARCH_SYSTEM_H 13#define __ASM_ARCH_SYSTEM_H
14 14
15#include <asm/hardware.h>
16
15static inline void arch_idle(void) 17static inline void arch_idle(void)
16{ 18{
17 *(unsigned long *)(IO_BASE + 0x50004) = 1; /* idle mode */ 19 *(unsigned long *)(IO_BASE + 0x50004) = 1; /* idle mode */
diff --git a/include/asm-arm/arch-lh7a40x/dma.h b/include/asm-arm/arch-lh7a40x/dma.h
index 5797f01e1844..15492e3253f6 100644
--- a/include/asm-arm/arch-lh7a40x/dma.h
+++ b/include/asm-arm/arch-lh7a40x/dma.h
@@ -7,11 +7,3 @@
7 * version 2 as published by the Free Software Foundation. 7 * version 2 as published by the Free Software Foundation.
8 * 8 *
9 */ 9 */
10
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#define MAX_DMA_ADDRESS 0xffffffff
15#define MAX_DMA_CHANNELS 0 /* All DMA is internal to CPU */
16
17#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-lh7a40x/entry-macro.S b/include/asm-arm/arch-lh7a40x/entry-macro.S
index 865f396aa63c..a2f67c06d9c9 100644
--- a/include/asm-arm/arch-lh7a40x/entry-macro.S
+++ b/include/asm-arm/arch-lh7a40x/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10 12
11# if defined (CONFIG_ARCH_LH7A400) && defined (CONFIG_ARCH_LH7A404) 13# if defined (CONFIG_ARCH_LH7A400) && defined (CONFIG_ARCH_LH7A404)
12# error "LH7A400 and LH7A404 are mutually exclusive" 14# error "LH7A400 and LH7A404 are mutually exclusive"
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
index ccbcb580a5c1..d4e73efcb816 100644
--- a/include/asm-arm/arch-omap/dma.h
+++ b/include/asm-arm/arch-omap/dma.h
@@ -21,9 +21,6 @@
21#ifndef __ASM_ARCH_DMA_H 21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H 22#define __ASM_ARCH_DMA_H
23 23
24#define MAX_DMA_ADDRESS 0xffffffff
25#define MAX_DMA_CHANNELS 0
26
27/* Hardware registers for omap1 */ 24/* Hardware registers for omap1 */
28#define OMAP_DMA_BASE (0xfffed800) 25#define OMAP_DMA_BASE (0xfffed800)
29#define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400) 26#define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400)
diff --git a/include/asm-arm/arch-omap/entry-macro.S b/include/asm-arm/arch-omap/entry-macro.S
index f8814a84910e..0ffb1185f1ac 100644
--- a/include/asm-arm/arch-omap/entry-macro.S
+++ b/include/asm-arm/arch-omap/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10 12
11#if defined(CONFIG_ARCH_OMAP1) 13#if defined(CONFIG_ARCH_OMAP1)
12 14
diff --git a/include/asm-arm/arch-omap/system.h b/include/asm-arm/arch-omap/system.h
index 9af415d2944a..6724a81bd10b 100644
--- a/include/asm-arm/arch-omap/system.h
+++ b/include/asm-arm/arch-omap/system.h
@@ -5,8 +5,9 @@
5#ifndef __ASM_ARCH_SYSTEM_H 5#ifndef __ASM_ARCH_SYSTEM_H
6#define __ASM_ARCH_SYSTEM_H 6#define __ASM_ARCH_SYSTEM_H
7#include <linux/config.h> 7#include <linux/config.h>
8#include <linux/clk.h>
9
8#include <asm/mach-types.h> 10#include <asm/mach-types.h>
9#include <asm/hardware/clock.h>
10#include <asm/hardware.h> 11#include <asm/hardware.h>
11#include <asm/arch/prcm.h> 12#include <asm/arch/prcm.h>
12 13
diff --git a/include/asm-arm/arch-pxa/dma.h b/include/asm-arm/arch-pxa/dma.h
index 56db3d49bfc8..3e88a2a02a0f 100644
--- a/include/asm-arm/arch-pxa/dma.h
+++ b/include/asm-arm/arch-pxa/dma.h
@@ -12,11 +12,6 @@
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#define MAX_DMA_ADDRESS 0xffffffff
16
17/* No DMA as the rest of the world see it */
18#define MAX_DMA_CHANNELS 0
19
20/* 15/*
21 * Descriptor structure for PXA's DMA engine 16 * Descriptor structure for PXA's DMA engine
22 * Note: this structure must always be aligned to a 16-byte boundary. 17 * Note: this structure must always be aligned to a 16-byte boundary.
diff --git a/include/asm-arm/arch-pxa/entry-macro.S b/include/asm-arm/arch-pxa/entry-macro.S
index 2abfc8bb3ee5..4985e33afc12 100644
--- a/include/asm-arm/arch-pxa/entry-macro.S
+++ b/include/asm-arm/arch-pxa/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10 12
11 .macro disable_fiq 13 .macro disable_fiq
12 .endm 14 .endm
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index a75a2470f4f5..dae138b9cac5 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -2042,6 +2042,18 @@
2042 2042
2043#ifdef CONFIG_PXA27x 2043#ifdef CONFIG_PXA27x
2044 2044
2045#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */
2046
2047#define ARB_DMA_SLV_PARK (1<<31) /* Be parked with DMA slave when idle */
2048#define ARB_CI_PARK (1<<30) /* Be parked with Camera Interface when idle */
2049#define ARB_EX_MEM_PARK (1<<29) /* Be parked with external MEMC when idle */
2050#define ARB_INT_MEM_PARK (1<<28) /* Be parked with internal MEMC when idle */
2051#define ARB_USB_PARK (1<<27) /* Be parked with USB when idle */
2052#define ARB_LCD_PARK (1<<26) /* Be parked with LCD when idle */
2053#define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */
2054#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
2055#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
2056
2045/* 2057/*
2046 * Keypad 2058 * Keypad
2047 */ 2059 */
diff --git a/include/asm-arm/arch-realview/debug-macro.S b/include/asm-arm/arch-realview/debug-macro.S
index ed28bd012236..017ad996848d 100644
--- a/include/asm-arm/arch-realview/debug-macro.S
+++ b/include/asm-arm/arch-realview/debug-macro.S
@@ -11,7 +11,7 @@
11 * 11 *
12*/ 12*/
13 13
14#include <asm/hardware/amba_serial.h> 14#include <linux/amba/serial.h>
15 15
16 .macro addruart,rx 16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 17 mrc p15, 0, \rx, c1, c0
diff --git a/include/asm-arm/arch-realview/dma.h b/include/asm-arm/arch-realview/dma.h
index 744491a74bd9..8342e3f9d6ec 100644
--- a/include/asm-arm/arch-realview/dma.h
+++ b/include/asm-arm/arch-realview/dma.h
@@ -18,10 +18,3 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H
23
24#define MAX_DMA_ADDRESS 0xffffffff
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-realview/entry-macro.S b/include/asm-arm/arch-realview/entry-macro.S
index 6288fad0dc41..1a6eec86bd47 100644
--- a/include/asm-arm/arch-realview/entry-macro.S
+++ b/include/asm-arm/arch-realview/entry-macro.S
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <asm/hardware.h>
11#include <asm/hardware/gic.h> 11#include <asm/hardware/gic.h>
12 12
13 .macro disable_fiq 13 .macro disable_fiq
diff --git a/include/asm-arm/arch-rpc/entry-macro.S b/include/asm-arm/arch-rpc/entry-macro.S
index 686f413f82d6..c9e5395e5106 100644
--- a/include/asm-arm/arch-rpc/entry-macro.S
+++ b/include/asm-arm/arch-rpc/entry-macro.S
@@ -1,3 +1,3 @@
1 1#include <asm/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S> 2#include <asm/hardware/entry-macro-iomd.S>
3 3
diff --git a/include/asm-arm/arch-s3c2410/dma.h b/include/asm-arm/arch-s3c2410/dma.h
index e830a40e573a..b011e14f3bc6 100644
--- a/include/asm-arm/arch-s3c2410/dma.h
+++ b/include/asm-arm/arch-s3c2410/dma.h
@@ -31,14 +31,6 @@
31#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ 31#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */
32 32
33 33
34/* according to the samsung port, we cannot use the regular
35 * dma channels... we must therefore provide our own interface
36 * for DMA, and allow our drivers to use that.
37 */
38
39#define MAX_DMA_CHANNELS 0
40
41
42/* we have 4 dma channels */ 34/* we have 4 dma channels */
43#define S3C2410_DMA_CHANNELS (4) 35#define S3C2410_DMA_CHANNELS (4)
44 36
diff --git a/include/asm-arm/arch-s3c2410/entry-macro.S b/include/asm-arm/arch-s3c2410/entry-macro.S
index b7d4d7f4422d..cc06b1bd37b2 100644
--- a/include/asm-arm/arch-s3c2410/entry-macro.S
+++ b/include/asm-arm/arch-s3c2410/entry-macro.S
@@ -10,6 +10,8 @@
10 * Modifications: 10 * Modifications:
11 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA 11 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
12 */ 12 */
13#include <asm/hardware.h>
14#include <asm/arch/irqs.h>
13 15
14 16
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
diff --git a/include/asm-arm/arch-sa1100/dma.h b/include/asm-arm/arch-sa1100/dma.h
index 3d60ed9f8c34..02575d72ac6b 100644
--- a/include/asm-arm/arch-sa1100/dma.h
+++ b/include/asm-arm/arch-sa1100/dma.h
@@ -15,20 +15,6 @@
15 15
16 16
17/* 17/*
18 * This is the maximum DMA address that can be DMAd to.
19 */
20#define MAX_DMA_ADDRESS 0xffffffff
21
22
23/*
24 * The regular generic DMA interface is inappropriate for the
25 * SA1100 DMA model. None of the SA1100 specific drivers using
26 * DMA are portable anyway so it's pointless to try to twist the
27 * regular DMA API to accommodate them.
28 */
29#define MAX_DMA_CHANNELS 0
30
31/*
32 * The SA1100 has six internal DMA channels. 18 * The SA1100 has six internal DMA channels.
33 */ 19 */
34#define SA1100_DMA_CHANNELS 6 20#define SA1100_DMA_CHANNELS 6
diff --git a/include/asm-arm/arch-versatile/debug-macro.S b/include/asm-arm/arch-versatile/debug-macro.S
index 89e38ac1444e..ef6167116dbb 100644
--- a/include/asm-arm/arch-versatile/debug-macro.S
+++ b/include/asm-arm/arch-versatile/debug-macro.S
@@ -11,7 +11,7 @@
11 * 11 *
12*/ 12*/
13 13
14#include <asm/hardware/amba_serial.h> 14#include <linux/amba/serial.h>
15 15
16 .macro addruart,rx 16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 17 mrc p15, 0, \rx, c1, c0
diff --git a/include/asm-arm/arch-versatile/dma.h b/include/asm-arm/arch-versatile/dma.h
index dcc8ac26eac0..642577348623 100644
--- a/include/asm-arm/arch-versatile/dma.h
+++ b/include/asm-arm/arch-versatile/dma.h
@@ -18,10 +18,3 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H
23
24#define MAX_DMA_ADDRESS 0xffffffff
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-versatile/entry-macro.S b/include/asm-arm/arch-versatile/entry-macro.S
index 90e4e970d253..58f0d71759f6 100644
--- a/include/asm-arm/arch-versatile/entry-macro.S
+++ b/include/asm-arm/arch-versatile/entry-macro.S
@@ -7,7 +7,9 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 .macro disable_fiq 10#include <asm/hardware.h>
11
12 .macro disable_fiq
11 .endm 13 .endm
12 14
13 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
diff --git a/include/asm-arm/byteorder.h b/include/asm-arm/byteorder.h
index d648a1915c33..741f5bc5d016 100644
--- a/include/asm-arm/byteorder.h
+++ b/include/asm-arm/byteorder.h
@@ -15,9 +15,23 @@
15#ifndef __ASM_ARM_BYTEORDER_H 15#ifndef __ASM_ARM_BYTEORDER_H
16#define __ASM_ARM_BYTEORDER_H 16#define __ASM_ARM_BYTEORDER_H
17 17
18 18#include <linux/compiler.h>
19#include <asm/types.h> 19#include <asm/types.h>
20 20
21static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
22{
23 __u32 t;
24
25 t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */
26 x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */
27 t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */
28 x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */
29
30 return x;
31}
32
33#define __arch__swab32(x) ___arch__swab32(x)
34
21#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) 35#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
22# define __BYTEORDER_HAS_U64__ 36# define __BYTEORDER_HAS_U64__
23# define __SWAB_64_THRU_32__ 37# define __SWAB_64_THRU_32__
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index e81baff4f54b..09e19a783a51 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -14,7 +14,6 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16 16
17#include <asm/mman.h>
18#include <asm/glue.h> 17#include <asm/glue.h>
19#include <asm/shmparam.h> 18#include <asm/shmparam.h>
20 19
diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h
index ef41df43a584..49c01e2bf7c8 100644
--- a/include/asm-arm/dma.h
+++ b/include/asm-arm/dma.h
@@ -10,6 +10,13 @@ typedef unsigned int dmach_t;
10#include <asm/arch/dma.h> 10#include <asm/arch/dma.h>
11 11
12/* 12/*
13 * This is the maximum virtual address which can be DMA'd from.
14 */
15#ifndef MAX_DMA_ADDRESS
16#define MAX_DMA_ADDRESS 0xffffffff
17#endif
18
19/*
13 * DMA modes 20 * DMA modes
14 */ 21 */
15typedef unsigned int dmamode_t; 22typedef unsigned int dmamode_t;
@@ -91,7 +98,9 @@ extern void set_dma_sg(dmach_t channel, struct scatterlist *sg, int nr_sg);
91 * especially since some DMA architectures don't update the 98 * especially since some DMA architectures don't update the
92 * DMA address immediately, but defer it to the enable_dma(). 99 * DMA address immediately, but defer it to the enable_dma().
93 */ 100 */
94extern void set_dma_addr(dmach_t channel, unsigned long physaddr); 101extern void __set_dma_addr(dmach_t channel, void *addr);
102#define set_dma_addr(channel, addr) \
103 __set_dma_addr(channel, bus_to_virt(addr))
95 104
96/* Set the DMA byte count for this channel 105/* Set the DMA byte count for this channel
97 * 106 *
diff --git a/include/asm-arm/hardware/sharpsl_pm.h b/include/asm-arm/hardware/sharpsl_pm.h
new file mode 100644
index 000000000000..36983e5f3665
--- /dev/null
+++ b/include/asm-arm/hardware/sharpsl_pm.h
@@ -0,0 +1,94 @@
1/*
2 * SharpSL Battery/PM Driver
3 *
4 * Copyright (c) 2004-2005 Richard Purdie
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <linux/interrupt.h>
13
14struct sharpsl_charger_machinfo {
15 void (*init)(void);
16 void (*exit)(void);
17 int gpio_acin;
18 int gpio_batfull;
19 int gpio_batlock;
20 int gpio_fatal;
21 void (*discharge)(int);
22 void (*discharge1)(int);
23 void (*charge)(int);
24 void (*measure_temp)(int);
25 void (*presuspend)(void);
26 void (*postsuspend)(void);
27 unsigned long (*read_devdata)(int);
28#define SHARPSL_BATT_VOLT 1
29#define SHARPSL_BATT_TEMP 2
30#define SHARPSL_ACIN_VOLT 3
31#define SHARPSL_STATUS_ACIN 4
32#define SHARPSL_STATUS_LOCK 5
33#define SHARPSL_STATUS_CHRGFULL 6
34#define SHARPSL_STATUS_FATAL 7
35 unsigned long (*charger_wakeup)(void);
36 int (*should_wakeup)(unsigned int resume_on_alarm);
37 int bat_levels;
38 struct battery_thresh *bat_levels_noac;
39 struct battery_thresh *bat_levels_acin;
40 int status_high_acin;
41 int status_low_acin;
42 int status_high_noac;
43 int status_low_noac;
44};
45
46struct battery_thresh {
47 int voltage;
48 int percentage;
49};
50
51struct battery_stat {
52 int ac_status; /* APM AC Present/Not Present */
53 int mainbat_status; /* APM Main Battery Status */
54 int mainbat_percent; /* Main Battery Percentage Charge */
55 int mainbat_voltage; /* Main Battery Voltage */
56};
57
58struct sharpsl_pm_status {
59 struct device *dev;
60 struct timer_list ac_timer;
61 struct timer_list chrg_full_timer;
62
63 int charge_mode;
64#define CHRG_ERROR (-1)
65#define CHRG_OFF (0)
66#define CHRG_ON (1)
67#define CHRG_DONE (2)
68
69 unsigned int flags;
70#define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */
71#define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */
72#define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */
73#define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */
74#define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */
75
76 int full_count;
77 unsigned long charge_start_time;
78 struct sharpsl_charger_machinfo *machinfo;
79 struct battery_stat battstat;
80};
81
82extern struct sharpsl_pm_status sharpsl_pm;
83
84
85#define SHARPSL_LED_ERROR 2
86#define SHARPSL_LED_ON 1
87#define SHARPSL_LED_OFF 0
88
89void sharpsl_battery_kick(void);
90void sharpsl_pm_led(int val);
91irqreturn_t sharpsl_ac_isr(int irq, void *dev_id, struct pt_regs *fp);
92irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id, struct pt_regs *fp);
93irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp);
94
diff --git a/include/asm-arm/mach/dma.h b/include/asm-arm/mach/dma.h
index 31bf716106ee..e7c4a20aad53 100644
--- a/include/asm-arm/mach/dma.h
+++ b/include/asm-arm/mach/dma.h
@@ -25,13 +25,15 @@ struct dma_ops {
25}; 25};
26 26
27struct dma_struct { 27struct dma_struct {
28 void *addr; /* single DMA address */
29 unsigned long count; /* single DMA size */
28 struct scatterlist buf; /* single DMA */ 30 struct scatterlist buf; /* single DMA */
29 int sgcount; /* number of DMA SG */ 31 int sgcount; /* number of DMA SG */
30 struct scatterlist *sg; /* DMA Scatter-Gather List */ 32 struct scatterlist *sg; /* DMA Scatter-Gather List */
31 33
32 unsigned int active:1; /* Transfer active */ 34 unsigned int active:1; /* Transfer active */
33 unsigned int invalid:1; /* Address/Count changed */ 35 unsigned int invalid:1; /* Address/Count changed */
34 unsigned int using_sg:1; /* using scatter list? */ 36
35 dmamode_t dma_mode; /* DMA mode */ 37 dmamode_t dma_mode; /* DMA mode */
36 int speed; /* DMA speed */ 38 int speed; /* DMA speed */
37 39
diff --git a/include/asm-arm/scatterlist.h b/include/asm-arm/scatterlist.h
index 83b876fb04cc..de2f65eb42ed 100644
--- a/include/asm-arm/scatterlist.h
+++ b/include/asm-arm/scatterlist.h
@@ -9,7 +9,6 @@ struct scatterlist {
9 unsigned int offset; /* buffer offset */ 9 unsigned int offset; /* buffer offset */
10 dma_addr_t dma_address; /* dma address */ 10 dma_addr_t dma_address; /* dma address */
11 unsigned int length; /* length */ 11 unsigned int length; /* length */
12 char *__address; /* for set_dma_addr */
13}; 12};
14 13
15/* 14/*
diff --git a/include/asm-arm/hardware/amba.h b/include/linux/amba/bus.h
index 51e6e54b2aa1..51e6e54b2aa1 100644
--- a/include/asm-arm/hardware/amba.h
+++ b/include/linux/amba/bus.h
diff --git a/include/asm-arm/hardware/amba_clcd.h b/include/linux/amba/clcd.h
index 6b8d73dc1ab0..6b8d73dc1ab0 100644
--- a/include/asm-arm/hardware/amba_clcd.h
+++ b/include/linux/amba/clcd.h
diff --git a/include/asm-arm/hardware/amba_kmi.h b/include/linux/amba/kmi.h
index a39e5be751b3..a39e5be751b3 100644
--- a/include/asm-arm/hardware/amba_kmi.h
+++ b/include/linux/amba/kmi.h
diff --git a/include/asm-arm/hardware/amba_serial.h b/include/linux/amba/serial.h
index dc726ffccebd..dc726ffccebd 100644
--- a/include/asm-arm/hardware/amba_serial.h
+++ b/include/linux/amba/serial.h
diff --git a/include/asm-arm/hardware/clock.h b/include/linux/clk.h
index 19da861e523d..12848f81bb37 100644
--- a/include/asm-arm/hardware/clock.h
+++ b/include/linux/clk.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/hardware/clock.h 2 * linux/include/linux/clk.h
3 * 3 *
4 * Copyright (C) 2004 ARM Limited. 4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited. 5 * Written by Deep Blue Solutions Limited.
@@ -33,6 +33,8 @@ struct clk;
33 * uses @dev and @id to determine the clock consumer, and thereby 33 * uses @dev and @id to determine the clock consumer, and thereby
34 * the clock producer. (IOW, @id may be identical strings, but 34 * the clock producer. (IOW, @id may be identical strings, but
35 * clk_get may return different clock producers depending on @dev.) 35 * clk_get may return different clock producers depending on @dev.)
36 *
37 * Drivers must assume that the clock source is not enabled.
36 */ 38 */
37struct clk *clk_get(struct device *dev, const char *id); 39struct clk *clk_get(struct device *dev, const char *id);
38 40
@@ -49,22 +51,16 @@ int clk_enable(struct clk *clk);
49/** 51/**
50 * clk_disable - inform the system when the clock source is no longer required. 52 * clk_disable - inform the system when the clock source is no longer required.
51 * @clk: clock source 53 * @clk: clock source
52 */
53void clk_disable(struct clk *clk);
54
55/**
56 * clk_use - increment the use count
57 * @clk: clock source
58 * 54 *
59 * Returns success (0) or negative errno. 55 * Inform the system that a clock source is no longer required by
60 */ 56 * a driver and may be shut down.
61int clk_use(struct clk *clk); 57 *
62 58 * Implementation detail: if the clock source is shared between
63/** 59 * multiple drivers, clk_enable() calls must be balanced by the
64 * clk_unuse - decrement the use count 60 * same number of clk_disable() calls for the clock source to be
65 * @clk: clock source 61 * disabled.
66 */ 62 */
67void clk_unuse(struct clk *clk); 63void clk_disable(struct clk *clk);
68 64
69/** 65/**
70 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. 66 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
@@ -76,6 +72,10 @@ unsigned long clk_get_rate(struct clk *clk);
76/** 72/**
77 * clk_put - "free" the clock source 73 * clk_put - "free" the clock source
78 * @clk: clock source 74 * @clk: clock source
75 *
76 * Note: drivers must ensure that all clk_enable calls made on this
77 * clock source are balanced by clk_disable calls prior to calling
78 * this function.
79 */ 79 */
80void clk_put(struct clk *clk); 80void clk_put(struct clk *clk);
81 81
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 5e9a81ab990b..54147c1f6361 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -17,11 +17,11 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/amba/bus.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/sizes.h> 24#include <asm/sizes.h>
24#include <asm/hardware/amba.h>
25 25
26#include <sound/driver.h> 26#include <sound/driver.h>
27#include <sound/core.h> 27#include <sound/core.h>