aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-04-10 14:30:45 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-10 14:30:45 -0400
commit06eb4eafbdc0796d741d139a44f1253278da8611 (patch)
treefbdb44317130c371928154c9e6903e699fe2b995 /include
parent32ed53b83ea5ec26a4dba90e18f5e0ff6c71eb48 (diff)
parentf68e556e23d1a4176b563bcb25d8baf2c5313f91 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h248
-rw-r--r--include/acpi/acexcep.h7
-rw-r--r--include/acpi/acnames.h12
-rw-r--r--include/acpi/acpi_bus.h7
-rw-r--r--include/acpi/acpiosxf.h13
-rw-r--r--include/acpi/acpixf.h229
-rw-r--r--include/acpi/actbl.h7
-rw-r--r--include/acpi/actypes.h22
-rw-r--r--include/acpi/platform/aclinux.h1
-rw-r--r--include/asm-generic/atomic.h3
-rw-r--r--include/asm-generic/barrier.h50
-rw-r--r--include/asm-generic/bitops/atomic.h2
-rw-r--r--include/asm-generic/cmpxchg.h88
-rw-r--r--include/asm-generic/exec.h19
-rw-r--r--include/asm-generic/gpio.h4
-rw-r--r--include/asm-generic/posix_types.h109
-rw-r--r--include/asm-generic/switch_to.h30
-rw-r--r--include/asm-generic/system.h141
-rw-r--r--include/asm-generic/unistd.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h35
-rw-r--r--include/crypto/internal/aead.h2
-rw-r--r--include/crypto/internal/skcipher.h2
-rw-r--r--include/drm/drm.h14
-rw-r--r--include/drm/drmP.h62
-rw-r--r--include/drm/intel-gtt.h4
-rw-r--r--include/linux/Kbuild3
-rw-r--r--include/linux/acpi.h11
-rw-r--r--include/linux/aio_abi.h2
-rw-r--r--include/linux/amba/pl08x.h10
-rw-r--r--include/linux/amba/pl330.h1
-rw-r--r--include/linux/apple_bl.h26
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/ceph/messenger.h5
-rw-r--r--include/linux/clk-private.h196
-rw-r--r--include/linux/clk-provider.h300
-rw-r--r--include/linux/clk.h68
-rw-r--r--include/linux/cnt32_to_63.h1
-rw-r--r--include/linux/compat.h32
-rw-r--r--include/linux/cpuidle.h22
-rw-r--r--include/linux/cpumask.h9
-rw-r--r--include/linux/cpuset.h6
-rw-r--r--include/linux/cryptouser.h3
-rw-r--r--include/linux/debug_locks.h1
-rw-r--r--include/linux/dma-attrs.h2
-rw-r--r--include/linux/dma-buf.h97
-rw-r--r--include/linux/dma-mapping.h15
-rw-r--r--include/linux/dmaengine.h35
-rw-r--r--include/linux/dw_dmac.h38
-rw-r--r--include/linux/edac.h179
-rw-r--r--include/linux/efi.h1
-rw-r--r--include/linux/ethtool.h3
-rw-r--r--include/linux/ext2_fs.h569
-rw-r--r--include/linux/ext2_fs_sb.h126
-rw-r--r--include/linux/ext3_fs.h980
-rw-r--r--include/linux/ext3_fs_i.h151
-rw-r--r--include/linux/ext3_fs_sb.h91
-rw-r--r--include/linux/ext3_jbd.h229
-rw-r--r--include/linux/fdtable.h46
-rw-r--r--include/linux/firewire.h3
-rw-r--r--include/linux/fs.h23
-rw-r--r--include/linux/fsl/mxs-dma.h28
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/gpio.h6
-rw-r--r--include/linux/gpio_keys.h3
-rw-r--r--include/linux/hsi/Kbuild1
-rw-r--r--include/linux/hsi/hsi.h410
-rw-r--r--include/linux/hsi/hsi_char.h63
-rw-r--r--include/linux/i2c-algo-bit.h3
-rw-r--r--include/linux/i2c-algo-pcf.h3
-rw-r--r--include/linux/i2c-dev.h3
-rw-r--r--include/linux/i2c-mux.h3
-rw-r--r--include/linux/i2c-smbus.h3
-rw-r--r--include/linux/i2c.h3
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/interrupt.h1
-rw-r--r--include/linux/jbd2.h12
-rw-r--r--include/linux/journal-head.h2
-rw-r--r--include/linux/kernel.h36
-rw-r--r--include/linux/kgdb.h7
-rw-r--r--include/linux/kmod.h27
-rw-r--r--include/linux/kvm.h98
-rw-r--r--include/linux/kvm_host.h69
-rw-r--r--include/linux/llist.h3
-rw-r--r--include/linux/lp8727.h18
-rw-r--r--include/linux/lsm_audit.h97
-rw-r--r--include/linux/mfd/88pm860x.h23
-rw-r--r--include/linux/mfd/abx500.h280
-rw-r--r--include/linux/mfd/abx500/ab8500-bm.h474
-rw-r--r--include/linux/mfd/abx500/ab8500-gpio.h4
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h43
-rw-r--r--include/linux/mfd/abx500/ab8500.h208
-rw-r--r--include/linux/mfd/abx500/ux500_chargalg.h38
-rw-r--r--include/linux/mfd/anatop.h40
-rw-r--r--include/linux/mfd/da9052/da9052.h2
-rw-r--r--include/linux/mfd/db8500-prcmu.h183
-rw-r--r--include/linux/mfd/dbx500-prcmu.h414
-rw-r--r--include/linux/mfd/mc13xxx.h16
-rw-r--r--include/linux/mfd/mcp.h14
-rw-r--r--include/linux/mfd/rc5t583.h295
-rw-r--r--include/linux/mfd/stmpe.h1
-rw-r--r--include/linux/mfd/tmio.h26
-rw-r--r--include/linux/mfd/tps65090.h46
-rw-r--r--include/linux/mfd/tps65217.h283
-rw-r--r--include/linux/mfd/tps65910.h11
-rw-r--r--include/linux/mfd/ucb1x00.h38
-rw-r--r--include/linux/mfd/wm8994/pdata.h1
-rw-r--r--include/linux/mm.h4
-rw-r--r--include/linux/mmc/card.h2
-rw-r--r--include/linux/mmc/cd-gpio.h3
-rw-r--r--include/linux/mmc/core.h1
-rw-r--r--include/linux/mmc/dw_mmc.h8
-rw-r--r--include/linux/mmc/host.h48
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmc/sdhci.h2
-rw-r--r--include/linux/mmc/sh_mmcif.h21
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h14
-rw-r--r--include/linux/module.h32
-rw-r--r--include/linux/moduleparam.h58
-rw-r--r--include/linux/mtd/bbm.h5
-rw-r--r--include/linux/mtd/blktrans.h1
-rw-r--r--include/linux/mtd/fsmc.h169
-rw-r--r--include/linux/mtd/map.h2
-rw-r--r--include/linux/mtd/mtd.h304
-rw-r--r--include/linux/mtd/nand.h7
-rw-r--r--include/linux/mtd/pmc551.h78
-rw-r--r--include/linux/mtd/sh_flctl.h40
-rw-r--r--include/linux/mtd/spear_smi.h65
-rw-r--r--include/linux/mtio.h1
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/netfilter/xt_set.h4
-rw-r--r--include/linux/nfs4.h15
-rw-r--r--include/linux/nfsd/cld.h56
-rw-r--r--include/linux/of.h26
-rw-r--r--include/linux/of_gpio.h27
-rw-r--r--include/linux/of_mtd.h19
-rw-r--r--include/linux/parport.h1
-rw-r--r--include/linux/perf_event.h90
-rw-r--r--include/linux/pid_namespace.h8
-rw-r--r--include/linux/platform_data/atmel.h27
-rw-r--r--include/linux/platform_data/spear_thermal.h26
-rw-r--r--include/linux/pm_qos.h4
-rw-r--r--include/linux/power/max17042_battery.h93
-rw-r--r--include/linux/power/smb347-charger.h117
-rw-r--r--include/linux/radix-tree.h196
-rw-r--r--include/linux/regulator/ab8500.h70
-rw-r--r--include/linux/regulator/machine.h8
-rw-r--r--include/linux/ring_buffer.h3
-rw-r--r--include/linux/rtc.h3
-rw-r--r--include/linux/rwsem.h1
-rw-r--r--include/linux/sa11x0-dma.h24
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/sh_intc.h17
-rw-r--r--include/linux/skbuff.h1
-rw-r--r--include/linux/slab.h17
-rw-r--r--include/linux/slub_def.h6
-rw-r--r--include/linux/smp.h46
-rw-r--r--include/linux/socket.h2
-rw-r--r--include/linux/spi/orion_spi.h1
-rw-r--r--include/linux/spinlock.h2
-rw-r--r--include/linux/spinlock_api_smp.h2
-rw-r--r--include/linux/stop_machine.h1
-rw-r--r--include/linux/sunrpc/svc_rdma.h4
-rw-r--r--include/linux/swap.h17
-rw-r--r--include/linux/sysinfo.h24
-rw-r--r--include/linux/tboot.h1
-rw-r--r--include/linux/time.h2
-rw-r--r--include/linux/timex.h2
-rw-r--r--include/linux/tty.h1
-rw-r--r--include/linux/virtio.h1
-rw-r--r--include/linux/wait.h1
-rw-r--r--include/linux/watchdog.h4
-rw-r--r--include/net/netfilter/xt_log.h2
-rw-r--r--include/scsi/iscsi_if.h19
-rw-r--r--include/scsi/libfcoe.h4
-rw-r--r--include/trace/events/btrfs.h44
-rw-r--r--include/trace/events/jbd2.h29
-rw-r--r--include/trace/events/sched.h2
-rw-r--r--include/video/sa1100fb.h63
-rw-r--r--include/xen/swiotlb-xen.h6
-rw-r--r--include/xen/xen-ops.h1
181 files changed, 6203 insertions, 3551 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
new file mode 100644
index 000000000000..03f14856bd09
--- /dev/null
+++ b/include/acpi/acconfig.h
@@ -0,0 +1,248 @@
1/******************************************************************************
2 *
3 * Name: acconfig.h - Global configuration constants
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef _ACCONFIG_H
45#define _ACCONFIG_H
46
47/******************************************************************************
48 *
49 * Configuration options
50 *
51 *****************************************************************************/
52
53/*
54 * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the
55 * ACPI subsystem. This includes the DEBUG_PRINT output
56 * statements. When disabled, all DEBUG_PRINT
57 * statements are compiled out.
58 *
59 * ACPI_APPLICATION - Use this switch if the subsystem is going to be run
60 * at the application level.
61 *
62 */
63
64/*
65 * OS name, used for the _OS object. The _OS object is essentially obsolete,
66 * but there is a large base of ASL/AML code in existing machines that check
67 * for the string below. The use of this string usually guarantees that
68 * the ASL will execute down the most tested code path. Also, there is some
69 * code that will not execute the _OSI method unless _OS matches the string
70 * below. Therefore, change this string at your own risk.
71 */
72#define ACPI_OS_NAME "Microsoft Windows NT"
73
74/* Maximum objects in the various object caches */
75
76#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */
77#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
78#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
79#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
80#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
81
82/*
83 * Should the subsystem abort the loading of an ACPI table if the
84 * table checksum is incorrect?
85 */
86#define ACPI_CHECKSUM_ABORT FALSE
87
88/*
89 * Generate a version of ACPICA that only supports "reduced hardware"
90 * platforms (as defined in ACPI 5.0). Set to TRUE to generate a specialized
91 * version of ACPICA that ONLY supports the ACPI 5.0 "reduced hardware"
92 * model. In other words, no ACPI hardware is supported.
93 *
94 * If TRUE, this means no support for the following:
95 * PM Event and Control registers
96 * SCI interrupt (and handler)
97 * Fixed Events
98 * General Purpose Events (GPEs)
99 * Global Lock
100 * ACPI PM timer
101 * FACS table (Waking vectors and Global Lock)
102 */
103#define ACPI_REDUCED_HARDWARE FALSE
104
105/******************************************************************************
106 *
107 * Subsystem Constants
108 *
109 *****************************************************************************/
110
111/* Version of ACPI supported */
112
113#define ACPI_CA_SUPPORT_LEVEL 5
114
115/* Maximum count for a semaphore object */
116
117#define ACPI_MAX_SEMAPHORE_COUNT 256
118
119/* Maximum object reference count (detects object deletion issues) */
120
121#define ACPI_MAX_REFERENCE_COUNT 0x1000
122
123/* Default page size for use in mapping memory for operation regions */
124
125#define ACPI_DEFAULT_PAGE_SIZE 4096 /* Must be power of 2 */
126
127/* owner_id tracking. 8 entries allows for 255 owner_ids */
128
129#define ACPI_NUM_OWNERID_MASKS 8
130
131/* Size of the root table array is increased by this increment */
132
133#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4
134
135/* Maximum number of While() loop iterations before forced abort */
136
137#define ACPI_MAX_LOOP_ITERATIONS 0xFFFF
138
139/* Maximum sleep allowed via Sleep() operator */
140
141#define ACPI_MAX_SLEEP 2000 /* Two seconds */
142
143/* Address Range lists are per-space_id (Memory and I/O only) */
144
145#define ACPI_ADDRESS_RANGE_MAX 2
146
147/******************************************************************************
148 *
149 * ACPI Specification constants (Do not change unless the specification changes)
150 *
151 *****************************************************************************/
152
153/* Number of distinct GPE register blocks and register width */
154
155#define ACPI_MAX_GPE_BLOCKS 2
156#define ACPI_GPE_REGISTER_WIDTH 8
157
158/* Method info (in WALK_STATE), containing local variables and argumetns */
159
160#define ACPI_METHOD_NUM_LOCALS 8
161#define ACPI_METHOD_MAX_LOCAL 7
162
163#define ACPI_METHOD_NUM_ARGS 7
164#define ACPI_METHOD_MAX_ARG 6
165
166/* Length of _HID, _UID, _CID, and UUID values */
167
168#define ACPI_DEVICE_ID_LENGTH 0x09
169#define ACPI_MAX_CID_LENGTH 48
170#define ACPI_UUID_LENGTH 16
171
172/*
173 * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
174 */
175#define ACPI_OBJ_NUM_OPERANDS 8
176#define ACPI_OBJ_MAX_OPERAND 7
177
178/* Number of elements in the Result Stack frame, can be an arbitrary value */
179
180#define ACPI_RESULTS_FRAME_OBJ_NUM 8
181
182/*
183 * Maximal number of elements the Result Stack can contain,
184 * it may be an arbitray value not exceeding the types of
185 * result_size and result_count (now u8).
186 */
187#define ACPI_RESULTS_OBJ_NUM_MAX 255
188
189/* Names within the namespace are 4 bytes long */
190
191#define ACPI_NAME_SIZE 4
192#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
193#define ACPI_PATH_SEPARATOR '.'
194
195/* Sizes for ACPI table headers */
196
197#define ACPI_OEM_ID_SIZE 6
198#define ACPI_OEM_TABLE_ID_SIZE 8
199
200/* Constants used in searching for the RSDP in low memory */
201
202#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
203#define ACPI_EBDA_PTR_LENGTH 2
204#define ACPI_EBDA_WINDOW_SIZE 1024
205#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */
206#define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000
207#define ACPI_RSDP_SCAN_STEP 16
208
209/* Operation regions */
210
211#define ACPI_USER_REGION_BEGIN 0x80
212
213/* Maximum space_ids for Operation Regions */
214
215#define ACPI_MAX_ADDRESS_SPACE 255
216
217/* Array sizes. Used for range checking also */
218
219#define ACPI_MAX_MATCH_OPCODE 5
220
221/* RSDP checksums */
222
223#define ACPI_RSDP_CHECKSUM_LENGTH 20
224#define ACPI_RSDP_XCHECKSUM_LENGTH 36
225
226/* SMBus, GSBus and IPMI bidirectional buffer size */
227
228#define ACPI_SMBUS_BUFFER_SIZE 34
229#define ACPI_GSBUS_BUFFER_SIZE 34
230#define ACPI_IPMI_BUFFER_SIZE 66
231
232/* _sx_d and _sx_w control methods */
233
234#define ACPI_NUM_sx_d_METHODS 4
235#define ACPI_NUM_sx_w_METHODS 5
236
237/******************************************************************************
238 *
239 * ACPI AML Debugger
240 *
241 *****************************************************************************/
242
243#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
244
245#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
246#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
247
248#endif /* _ACCONFIG_H */
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 5b6c391efc8e..92d6e1d701ff 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -57,6 +57,7 @@
57#define ACPI_SUCCESS(a) (!(a)) 57#define ACPI_SUCCESS(a) (!(a))
58#define ACPI_FAILURE(a) (a) 58#define ACPI_FAILURE(a) (a)
59 59
60#define ACPI_SKIP(a) (a == AE_CTRL_SKIP)
60#define AE_OK (acpi_status) 0x0000 61#define AE_OK (acpi_status) 0x0000
61 62
62/* 63/*
@@ -89,8 +90,9 @@
89#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) 90#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
90#define AE_NO_HANDLER (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) 91#define AE_NO_HANDLER (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
91#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) 92#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
93#define AE_NOT_CONFIGURED (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
92 94
93#define AE_CODE_ENV_MAX 0x001B 95#define AE_CODE_ENV_MAX 0x001C
94 96
95/* 97/*
96 * Programmer exceptions 98 * Programmer exceptions
@@ -213,7 +215,8 @@ char const *acpi_gbl_exception_names_env[] = {
213 "AE_ABORT_METHOD", 215 "AE_ABORT_METHOD",
214 "AE_SAME_HANDLER", 216 "AE_SAME_HANDLER",
215 "AE_NO_HANDLER", 217 "AE_NO_HANDLER",
216 "AE_OWNER_ID_LIMIT" 218 "AE_OWNER_ID_LIMIT",
219 "AE_NOT_CONFIGURED"
217}; 220};
218 221
219char const *acpi_gbl_exception_names_pgm[] = { 222char const *acpi_gbl_exception_names_pgm[] = {
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index 5b5af0d30a97..38f508816e4a 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -46,6 +46,7 @@
46 46
47/* Method names - these methods can appear anywhere in the namespace */ 47/* Method names - these methods can appear anywhere in the namespace */
48 48
49#define METHOD_NAME__SB_ "_SB_"
49#define METHOD_NAME__HID "_HID" 50#define METHOD_NAME__HID "_HID"
50#define METHOD_NAME__CID "_CID" 51#define METHOD_NAME__CID "_CID"
51#define METHOD_NAME__UID "_UID" 52#define METHOD_NAME__UID "_UID"
@@ -64,11 +65,11 @@
64 65
65/* Method names - these methods must appear at the namespace root */ 66/* Method names - these methods must appear at the namespace root */
66 67
67#define METHOD_NAME__BFS "\\_BFS" 68#define METHOD_PATHNAME__BFS "\\_BFS"
68#define METHOD_NAME__GTS "\\_GTS" 69#define METHOD_PATHNAME__GTS "\\_GTS"
69#define METHOD_NAME__PTS "\\_PTS" 70#define METHOD_PATHNAME__PTS "\\_PTS"
70#define METHOD_NAME__SST "\\_SI._SST" 71#define METHOD_PATHNAME__SST "\\_SI._SST"
71#define METHOD_NAME__WAK "\\_WAK" 72#define METHOD_PATHNAME__WAK "\\_WAK"
72 73
73/* Definitions of the predefined namespace names */ 74/* Definitions of the predefined namespace names */
74 75
@@ -79,6 +80,5 @@
79#define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */ 80#define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */
80 81
81#define ACPI_NS_ROOT_PATH "\\" 82#define ACPI_NS_ROOT_PATH "\\"
82#define ACPI_NS_SYSTEM_BUS "_SB_"
83 83
84#endif /* __ACNAMES_H__ */ 84#endif /* __ACNAMES_H__ */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 6cd5b6403a7b..f1c8ca60e824 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -323,6 +323,8 @@ int acpi_bus_set_power(acpi_handle handle, int state);
323int acpi_bus_update_power(acpi_handle handle, int *state_p); 323int acpi_bus_update_power(acpi_handle handle, int *state_p);
324bool acpi_bus_power_manageable(acpi_handle handle); 324bool acpi_bus_power_manageable(acpi_handle handle);
325bool acpi_bus_can_wakeup(acpi_handle handle); 325bool acpi_bus_can_wakeup(acpi_handle handle);
326int acpi_power_resource_register_device(struct device *dev, acpi_handle handle);
327void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handle);
326#ifdef CONFIG_ACPI_PROC_EVENT 328#ifdef CONFIG_ACPI_PROC_EVENT
327int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); 329int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
328int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data); 330int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);
@@ -392,8 +394,13 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p)
392#endif 394#endif
393 395
394#ifdef CONFIG_PM_SLEEP 396#ifdef CONFIG_PM_SLEEP
397int acpi_pm_device_run_wake(struct device *, bool);
395int acpi_pm_device_sleep_wake(struct device *, bool); 398int acpi_pm_device_sleep_wake(struct device *, bool);
396#else 399#else
400static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
401{
402 return -ENODEV;
403}
397static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) 404static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
398{ 405{
399 return -ENODEV; 406 return -ENODEV;
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 7c9aebe8a7aa..21a5548c6686 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -95,6 +95,11 @@ acpi_status
95acpi_os_table_override(struct acpi_table_header *existing_table, 95acpi_os_table_override(struct acpi_table_header *existing_table,
96 struct acpi_table_header **new_table); 96 struct acpi_table_header **new_table);
97 97
98acpi_status
99acpi_os_physical_table_override(struct acpi_table_header *existing_table,
100 acpi_physical_address * new_address,
101 u32 *new_table_length);
102
98/* 103/*
99 * Spinlock primitives 104 * Spinlock primitives
100 */ 105 */
@@ -217,14 +222,10 @@ acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);
217 * Platform and hardware-independent physical memory interfaces 222 * Platform and hardware-independent physical memory interfaces
218 */ 223 */
219acpi_status 224acpi_status
220acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width); 225acpi_os_read_memory(acpi_physical_address address, u64 *value, u32 width);
221acpi_status
222acpi_os_read_memory64(acpi_physical_address address, u64 *value, u32 width);
223 226
224acpi_status 227acpi_status
225acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); 228acpi_os_write_memory(acpi_physical_address address, u64 value, u32 width);
226acpi_status
227acpi_os_write_memory64(acpi_physical_address address, u64 value, u32 width);
228 229
229/* 230/*
230 * Platform and hardware-independent PCI configuration space access 231 * Platform and hardware-independent PCI configuration space access
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index a28da35ba45e..982110134672 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,8 +47,9 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20120111 50#define ACPI_CA_VERSION 0x20120320
51 51
52#include "acconfig.h"
52#include "actypes.h" 53#include "actypes.h"
53#include "actbl.h" 54#include "actbl.h"
54 55
@@ -71,6 +72,33 @@ extern u8 acpi_gbl_copy_dsdt_locally;
71extern u8 acpi_gbl_truncate_io_addresses; 72extern u8 acpi_gbl_truncate_io_addresses;
72extern u8 acpi_gbl_disable_auto_repair; 73extern u8 acpi_gbl_disable_auto_repair;
73 74
75/*
76 * Hardware-reduced prototypes. All interfaces that use these macros will
77 * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
78 * is set to TRUE.
79 */
80#if (!ACPI_REDUCED_HARDWARE)
81#define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
82 prototype;
83
84#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
85 prototype;
86
87#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
88 prototype;
89
90#else
91#define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
92 static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
93
94#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
95 static ACPI_INLINE prototype {return(AE_OK);}
96
97#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
98 static ACPI_INLINE prototype {}
99
100#endif /* !ACPI_REDUCED_HARDWARE */
101
74extern u32 acpi_current_gpe_count; 102extern u32 acpi_current_gpe_count;
75extern struct acpi_table_fadt acpi_gbl_FADT; 103extern struct acpi_table_fadt acpi_gbl_FADT;
76extern u8 acpi_gbl_system_awake_and_running; 104extern u8 acpi_gbl_system_awake_and_running;
@@ -96,9 +124,8 @@ acpi_status acpi_terminate(void);
96acpi_status acpi_subsystem_status(void); 124acpi_status acpi_subsystem_status(void);
97#endif 125#endif
98 126
99acpi_status acpi_enable(void); 127ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
100 128ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
101acpi_status acpi_disable(void);
102 129
103#ifdef ACPI_FUTURE_USAGE 130#ifdef ACPI_FUTURE_USAGE
104acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); 131acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
@@ -235,17 +262,34 @@ acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle);
235acpi_status 262acpi_status
236acpi_install_initialization_handler(acpi_init_handler handler, u32 function); 263acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
237 264
238acpi_status 265ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
239acpi_install_global_event_handler(ACPI_GBL_EVENT_HANDLER handler, 266 acpi_install_global_event_handler
240 void *context); 267 (ACPI_GBL_EVENT_HANDLER handler, void *context))
241 268
242acpi_status 269ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
243acpi_install_fixed_event_handler(u32 acpi_event, 270 acpi_install_fixed_event_handler(u32
244 acpi_event_handler handler, void *context); 271 acpi_event,
245 272 acpi_event_handler
246acpi_status 273 handler,
247acpi_remove_fixed_event_handler(u32 acpi_event, acpi_event_handler handler); 274 void
248 275 *context))
276ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
277 acpi_remove_fixed_event_handler(u32 acpi_event,
278 acpi_event_handler
279 handler))
280ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
281 acpi_install_gpe_handler(acpi_handle
282 gpe_device,
283 u32 gpe_number,
284 u32 type,
285 acpi_gpe_handler
286 address,
287 void *context))
288ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
289 acpi_remove_gpe_handler(acpi_handle gpe_device,
290 u32 gpe_number,
291 acpi_gpe_handler
292 address))
249acpi_status 293acpi_status
250acpi_install_notify_handler(acpi_handle device, 294acpi_install_notify_handler(acpi_handle device,
251 u32 handler_type, 295 u32 handler_type,
@@ -266,15 +310,6 @@ acpi_remove_address_space_handler(acpi_handle device,
266 acpi_adr_space_type space_id, 310 acpi_adr_space_type space_id,
267 acpi_adr_space_handler handler); 311 acpi_adr_space_handler handler);
268 312
269acpi_status
270acpi_install_gpe_handler(acpi_handle gpe_device,
271 u32 gpe_number,
272 u32 type, acpi_gpe_handler address, void *context);
273
274acpi_status
275acpi_remove_gpe_handler(acpi_handle gpe_device,
276 u32 gpe_number, acpi_gpe_handler address);
277
278#ifdef ACPI_FUTURE_USAGE 313#ifdef ACPI_FUTURE_USAGE
279acpi_status acpi_install_exception_handler(acpi_exception_handler handler); 314acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
280#endif 315#endif
@@ -284,9 +319,11 @@ acpi_status acpi_install_interface_handler(acpi_interface_handler handler);
284/* 319/*
285 * Global Lock interfaces 320 * Global Lock interfaces
286 */ 321 */
287acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle); 322ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
288 323 acpi_acquire_global_lock(u16 timeout,
289acpi_status acpi_release_global_lock(u32 handle); 324 u32 *handle))
325ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
326 acpi_release_global_lock(u32 handle))
290 327
291/* 328/*
292 * Interfaces to AML mutex objects 329 * Interfaces to AML mutex objects
@@ -299,47 +336,75 @@ acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname);
299/* 336/*
300 * Fixed Event interfaces 337 * Fixed Event interfaces
301 */ 338 */
302acpi_status acpi_enable_event(u32 event, u32 flags); 339ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
303 340 acpi_enable_event(u32 event, u32 flags))
304acpi_status acpi_disable_event(u32 event, u32 flags);
305 341
306acpi_status acpi_clear_event(u32 event); 342ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
343 acpi_disable_event(u32 event, u32 flags))
307 344
308acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); 345ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_clear_event(u32 event))
309 346
347ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
348 acpi_get_event_status(u32 event,
349 acpi_event_status
350 *event_status))
310/* 351/*
311 * General Purpose Event (GPE) Interfaces 352 * General Purpose Event (GPE) Interfaces
312 */ 353 */
313acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); 354ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_update_all_gpes(void))
314 355
315acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number); 356ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
316 357 acpi_enable_gpe(acpi_handle gpe_device,
317acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number); 358 u32 gpe_number))
318 359
319acpi_status 360ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
320acpi_setup_gpe_for_wake(acpi_handle parent_device, 361 acpi_disable_gpe(acpi_handle gpe_device,
321 acpi_handle gpe_device, u32 gpe_number); 362 u32 gpe_number))
322 363
323acpi_status acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action); 364ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
324 365 acpi_clear_gpe(acpi_handle gpe_device,
325acpi_status 366 u32 gpe_number))
326acpi_get_gpe_status(acpi_handle gpe_device, 367
327 u32 gpe_number, acpi_event_status *event_status); 368ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
328 369 acpi_set_gpe(acpi_handle gpe_device,
329acpi_status acpi_disable_all_gpes(void); 370 u32 gpe_number, u8 action))
330 371
331acpi_status acpi_enable_all_runtime_gpes(void); 372ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
332 373 acpi_finish_gpe(acpi_handle gpe_device,
333acpi_status acpi_get_gpe_device(u32 gpe_index, acpi_handle *gpe_device); 374 u32 gpe_number))
334 375
335acpi_status 376ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
336acpi_install_gpe_block(acpi_handle gpe_device, 377 acpi_setup_gpe_for_wake(acpi_handle
337 struct acpi_generic_address *gpe_block_address, 378 parent_device,
338 u32 register_count, u32 interrupt_number); 379 acpi_handle gpe_device,
339 380 u32 gpe_number))
340acpi_status acpi_remove_gpe_block(acpi_handle gpe_device); 381ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
341 382 acpi_set_gpe_wake_mask(acpi_handle gpe_device,
342acpi_status acpi_update_all_gpes(void); 383 u32 gpe_number,
384 u8 action))
385ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
386 acpi_get_gpe_status(acpi_handle gpe_device,
387 u32 gpe_number,
388 acpi_event_status
389 *event_status))
390
391ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void))
392
393ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void))
394
395ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
396 acpi_get_gpe_device(u32 gpe_index,
397 acpi_handle * gpe_device))
398
399ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
400 acpi_install_gpe_block(acpi_handle gpe_device,
401 struct
402 acpi_generic_address
403 *gpe_block_address,
404 u32 register_count,
405 u32 interrupt_number))
406ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
407 acpi_remove_gpe_block(acpi_handle gpe_device))
343 408
344/* 409/*
345 * Resource interfaces 410 * Resource interfaces
@@ -391,34 +456,60 @@ acpi_buffer_to_resource(u8 *aml_buffer,
391 */ 456 */
392acpi_status acpi_reset(void); 457acpi_status acpi_reset(void);
393 458
394acpi_status acpi_read_bit_register(u32 register_id, u32 *return_value); 459ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
460 acpi_read_bit_register(u32 register_id,
461 u32 *return_value))
395 462
396acpi_status acpi_write_bit_register(u32 register_id, u32 value); 463ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
464 acpi_write_bit_register(u32 register_id,
465 u32 value))
397 466
398acpi_status acpi_set_firmware_waking_vector(u32 physical_address); 467ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
468 acpi_set_firmware_waking_vector(u32
469 physical_address))
399 470
400#if ACPI_MACHINE_WIDTH == 64 471#if ACPI_MACHINE_WIDTH == 64
401acpi_status acpi_set_firmware_waking_vector64(u64 physical_address); 472ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
473 acpi_set_firmware_waking_vector64(u64
474 physical_address))
402#endif 475#endif
403 476
404acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg); 477acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
405 478
406acpi_status acpi_write(u64 value, struct acpi_generic_address *reg); 479acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
407 480
481/*
482 * Sleep/Wake interfaces
483 */
408acpi_status 484acpi_status
409acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); 485acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
410 486
411acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); 487acpi_status acpi_enter_sleep_state_prep(u8 sleep_state);
412 488
413acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state); 489acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state, u8 flags);
414 490
415acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void); 491ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void))
416 492
417acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); 493acpi_status acpi_leave_sleep_state_prep(u8 sleep_state, u8 flags);
418 494
419acpi_status acpi_leave_sleep_state(u8 sleep_state); 495acpi_status acpi_leave_sleep_state(u8 sleep_state);
420 496
421/* 497/*
498 * ACPI Timer interfaces
499 */
500#ifdef ACPI_FUTURE_USAGE
501ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
502 acpi_get_timer_resolution(u32 *resolution))
503
504ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_get_timer(u32 *ticks))
505
506ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
507 acpi_get_timer_duration(u32 start_ticks,
508 u32 end_ticks,
509 u32 *time_elapsed))
510#endif /* ACPI_FUTURE_USAGE */
511
512/*
422 * Error/Warning output 513 * Error/Warning output
423 */ 514 */
424void ACPI_INTERNAL_VAR_XFACE 515void ACPI_INTERNAL_VAR_XFACE
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 8e1b92f6f650..8dea54665dcf 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -309,6 +309,13 @@ enum acpi_prefered_pm_profiles {
309 PM_TABLET = 8 309 PM_TABLET = 8
310}; 310};
311 311
312/* Values for sleep_status and sleep_control registers (V5 FADT) */
313
314#define ACPI_X_WAKE_STATUS 0x80
315#define ACPI_X_SLEEP_TYPE_MASK 0x1C
316#define ACPI_X_SLEEP_TYPE_POSITION 0x02
317#define ACPI_X_SLEEP_ENABLE 0x20
318
312/* Reset to default packing */ 319/* Reset to default packing */
313 320
314#pragma pack() 321#pragma pack()
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index d5dee7ce9474..eba66043cf1b 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -518,6 +518,13 @@ typedef u64 acpi_integer;
518#define ACPI_SLEEP_TYPE_INVALID 0xFF 518#define ACPI_SLEEP_TYPE_INVALID 0xFF
519 519
520/* 520/*
521 * Sleep/Wake flags
522 */
523#define ACPI_NO_OPTIONAL_METHODS 0x00 /* Do not execute any optional methods */
524#define ACPI_EXECUTE_GTS 0x01 /* For enter sleep interface */
525#define ACPI_EXECUTE_BFS 0x02 /* For leave sleep prep interface */
526
527/*
521 * Standard notify values 528 * Standard notify values
522 */ 529 */
523#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 530#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00
@@ -532,8 +539,9 @@ typedef u64 acpi_integer;
532#define ACPI_NOTIFY_DEVICE_PLD_CHECK (u8) 0x09 539#define ACPI_NOTIFY_DEVICE_PLD_CHECK (u8) 0x09
533#define ACPI_NOTIFY_RESERVED (u8) 0x0A 540#define ACPI_NOTIFY_RESERVED (u8) 0x0A
534#define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B 541#define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B
542#define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C
535 543
536#define ACPI_NOTIFY_MAX 0x0B 544#define ACPI_NOTIFY_MAX 0x0C
537 545
538/* 546/*
539 * Types associated with ACPI names and objects. The first group of 547 * Types associated with ACPI names and objects. The first group of
@@ -698,7 +706,8 @@ typedef u32 acpi_event_status;
698#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) 706#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
699#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 707#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
700 708
701#define ACPI_MAX_SYS_NOTIFY 0x7f 709#define ACPI_MAX_SYS_NOTIFY 0x7F
710#define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF
702 711
703/* Address Space (Operation Region) Types */ 712/* Address Space (Operation Region) Types */
704 713
@@ -786,6 +795,15 @@ typedef u8 acpi_adr_space_type;
786#define ACPI_ENABLE_EVENT 1 795#define ACPI_ENABLE_EVENT 1
787#define ACPI_DISABLE_EVENT 0 796#define ACPI_DISABLE_EVENT 0
788 797
798/* Sleep function dispatch */
799
800typedef acpi_status(*ACPI_SLEEP_FUNCTION) (u8 sleep_state, u8 flags);
801
802struct acpi_sleep_functions {
803 ACPI_SLEEP_FUNCTION legacy_function;
804 ACPI_SLEEP_FUNCTION extended_function;
805};
806
789/* 807/*
790 * External ACPI object definition 808 * External ACPI object definition
791 */ 809 */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f4b2effe0333..6fbc4cab5834 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -57,7 +57,6 @@
57#include <linux/kernel.h> 57#include <linux/kernel.h>
58#include <linux/ctype.h> 58#include <linux/ctype.h>
59#include <linux/sched.h> 59#include <linux/sched.h>
60#include <asm/system.h>
61#include <linux/atomic.h> 60#include <linux/atomic.h>
62#include <asm/div64.h> 61#include <asm/div64.h>
63#include <asm/acpi.h> 62#include <asm/acpi.h>
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index e37963c1df4d..1ced6413ea03 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -15,6 +15,8 @@
15#ifndef __ASM_GENERIC_ATOMIC_H 15#ifndef __ASM_GENERIC_ATOMIC_H
16#define __ASM_GENERIC_ATOMIC_H 16#define __ASM_GENERIC_ATOMIC_H
17 17
18#include <asm/cmpxchg.h>
19
18#ifdef CONFIG_SMP 20#ifdef CONFIG_SMP
19/* Force people to define core atomics */ 21/* Force people to define core atomics */
20# if !defined(atomic_add_return) || !defined(atomic_sub_return) || \ 22# if !defined(atomic_add_return) || !defined(atomic_sub_return) || \
@@ -52,7 +54,6 @@
52#define atomic_set(v, i) (((v)->counter) = (i)) 54#define atomic_set(v, i) (((v)->counter) = (i))
53 55
54#include <linux/irqflags.h> 56#include <linux/irqflags.h>
55#include <asm/system.h>
56 57
57/** 58/**
58 * atomic_add_return - add integer to atomic variable 59 * atomic_add_return - add integer to atomic variable
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
new file mode 100644
index 000000000000..639d7a4d033b
--- /dev/null
+++ b/include/asm-generic/barrier.h
@@ -0,0 +1,50 @@
1/* Generic barrier definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_BARRIER_H
15#define __ASM_GENERIC_BARRIER_H
16
17#ifndef __ASSEMBLY__
18
19#define nop() asm volatile ("nop")
20
21/*
22 * Force strict CPU ordering.
23 * And yes, this is required on UP too when we're talking
24 * to devices.
25 *
26 * This implementation only contains a compiler barrier.
27 */
28
29#define mb() asm volatile ("": : :"memory")
30#define rmb() mb()
31#define wmb() asm volatile ("": : :"memory")
32
33#ifdef CONFIG_SMP
34#define smp_mb() mb()
35#define smp_rmb() rmb()
36#define smp_wmb() wmb()
37#else
38#define smp_mb() barrier()
39#define smp_rmb() barrier()
40#define smp_wmb() barrier()
41#endif
42
43#define set_mb(var, value) do { var = value; mb(); } while (0)
44#define set_wmb(var, value) do { var = value; wmb(); } while (0)
45
46#define read_barrier_depends() do {} while (0)
47#define smp_read_barrier_depends() do {} while (0)
48
49#endif /* !__ASSEMBLY__ */
50#endif /* __ASM_GENERIC_BARRIER_H */
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index ecc44a8e2b44..9ae6c34dc191 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -2,7 +2,7 @@
2#define _ASM_GENERIC_BITOPS_ATOMIC_H_ 2#define _ASM_GENERIC_BITOPS_ATOMIC_H_
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/system.h> 5#include <linux/irqflags.h>
6 6
7#ifdef CONFIG_SMP 7#ifdef CONFIG_SMP
8#include <asm/spinlock.h> 8#include <asm/spinlock.h>
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h
index 213ac6e8fe39..14883026015d 100644
--- a/include/asm-generic/cmpxchg.h
+++ b/include/asm-generic/cmpxchg.h
@@ -1,22 +1,98 @@
1/*
2 * Generic UP xchg and cmpxchg using interrupt disablement. Does not
3 * support SMP.
4 */
5
1#ifndef __ASM_GENERIC_CMPXCHG_H 6#ifndef __ASM_GENERIC_CMPXCHG_H
2#define __ASM_GENERIC_CMPXCHG_H 7#define __ASM_GENERIC_CMPXCHG_H
3 8
4/*
5 * Generic cmpxchg
6 *
7 * Uses the local cmpxchg. Does not support SMP.
8 */
9#ifdef CONFIG_SMP 9#ifdef CONFIG_SMP
10#error "Cannot use generic cmpxchg on SMP" 10#error "Cannot use generic cmpxchg on SMP"
11#endif 11#endif
12 12
13#include <linux/types.h>
14#include <linux/irqflags.h>
15
16#ifndef xchg
17
18/*
19 * This function doesn't exist, so you'll get a linker error if
20 * something tries to do an invalidly-sized xchg().
21 */
22extern void __xchg_called_with_bad_pointer(void);
23
24static inline
25unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
26{
27 unsigned long ret, flags;
28
29 switch (size) {
30 case 1:
31#ifdef __xchg_u8
32 return __xchg_u8(x, ptr);
33#else
34 local_irq_save(flags);
35 ret = *(volatile u8 *)ptr;
36 *(volatile u8 *)ptr = x;
37 local_irq_restore(flags);
38 return ret;
39#endif /* __xchg_u8 */
40
41 case 2:
42#ifdef __xchg_u16
43 return __xchg_u16(x, ptr);
44#else
45 local_irq_save(flags);
46 ret = *(volatile u16 *)ptr;
47 *(volatile u16 *)ptr = x;
48 local_irq_restore(flags);
49 return ret;
50#endif /* __xchg_u16 */
51
52 case 4:
53#ifdef __xchg_u32
54 return __xchg_u32(x, ptr);
55#else
56 local_irq_save(flags);
57 ret = *(volatile u32 *)ptr;
58 *(volatile u32 *)ptr = x;
59 local_irq_restore(flags);
60 return ret;
61#endif /* __xchg_u32 */
62
63#ifdef CONFIG_64BIT
64 case 8:
65#ifdef __xchg_u64
66 return __xchg_u64(x, ptr);
67#else
68 local_irq_save(flags);
69 ret = *(volatile u64 *)ptr;
70 *(volatile u64 *)ptr = x;
71 local_irq_restore(flags);
72 return ret;
73#endif /* __xchg_u64 */
74#endif /* CONFIG_64BIT */
75
76 default:
77 __xchg_called_with_bad_pointer();
78 return x;
79 }
80}
81
82#define xchg(ptr, x) \
83 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
84
85#endif /* xchg */
86
13/* 87/*
14 * Atomic compare and exchange. 88 * Atomic compare and exchange.
15 * 89 *
16 * Do not define __HAVE_ARCH_CMPXCHG because we want to use it to check whether 90 * Do not define __HAVE_ARCH_CMPXCHG because we want to use it to check whether
17 * a cmpxchg primitive faster than repeated local irq save/restore exists. 91 * a cmpxchg primitive faster than repeated local irq save/restore exists.
18 */ 92 */
93#include <asm-generic/cmpxchg-local.h>
94
19#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) 95#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
20#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) 96#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
21 97
22#endif 98#endif /* __ASM_GENERIC_CMPXCHG_H */
diff --git a/include/asm-generic/exec.h b/include/asm-generic/exec.h
new file mode 100644
index 000000000000..567766b0074a
--- /dev/null
+++ b/include/asm-generic/exec.h
@@ -0,0 +1,19 @@
1/* Generic process execution definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_EXEC_H
15#define __ASM_GENERIC_EXEC_H
16
17#define arch_align_stack(x) (x)
18
19#endif /* __ASM_GENERIC_EXEC_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 1ff4e221cb4d..5f52690c3c8f 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -142,9 +142,9 @@ extern int __must_check gpiochip_reserve(int start, int ngpio);
142/* add/remove chips */ 142/* add/remove chips */
143extern int gpiochip_add(struct gpio_chip *chip); 143extern int gpiochip_add(struct gpio_chip *chip);
144extern int __must_check gpiochip_remove(struct gpio_chip *chip); 144extern int __must_check gpiochip_remove(struct gpio_chip *chip);
145extern struct gpio_chip *gpiochip_find(void *data, 145extern struct gpio_chip *gpiochip_find(const void *data,
146 int (*match)(struct gpio_chip *chip, 146 int (*match)(struct gpio_chip *chip,
147 void *data)); 147 const void *data));
148 148
149 149
150/* Always use the library code for GPIO management calls, 150/* Always use the library code for GPIO management calls,
diff --git a/include/asm-generic/posix_types.h b/include/asm-generic/posix_types.h
index 3dab00860e71..91d44bd4dde3 100644
--- a/include/asm-generic/posix_types.h
+++ b/include/asm-generic/posix_types.h
@@ -10,8 +10,13 @@
10 * architectures, so that you can override them. 10 * architectures, so that you can override them.
11 */ 11 */
12 12
13#ifndef __kernel_long_t
14typedef long __kernel_long_t;
15typedef unsigned long __kernel_ulong_t;
16#endif
17
13#ifndef __kernel_ino_t 18#ifndef __kernel_ino_t
14typedef unsigned long __kernel_ino_t; 19typedef __kernel_ulong_t __kernel_ino_t;
15#endif 20#endif
16 21
17#ifndef __kernel_mode_t 22#ifndef __kernel_mode_t
@@ -19,7 +24,7 @@ typedef unsigned int __kernel_mode_t;
19#endif 24#endif
20 25
21#ifndef __kernel_nlink_t 26#ifndef __kernel_nlink_t
22typedef unsigned long __kernel_nlink_t; 27typedef __kernel_ulong_t __kernel_nlink_t;
23#endif 28#endif
24 29
25#ifndef __kernel_pid_t 30#ifndef __kernel_pid_t
@@ -36,7 +41,7 @@ typedef unsigned int __kernel_gid_t;
36#endif 41#endif
37 42
38#ifndef __kernel_suseconds_t 43#ifndef __kernel_suseconds_t
39typedef long __kernel_suseconds_t; 44typedef __kernel_long_t __kernel_suseconds_t;
40#endif 45#endif
41 46
42#ifndef __kernel_daddr_t 47#ifndef __kernel_daddr_t
@@ -44,8 +49,8 @@ typedef int __kernel_daddr_t;
44#endif 49#endif
45 50
46#ifndef __kernel_uid32_t 51#ifndef __kernel_uid32_t
47typedef __kernel_uid_t __kernel_uid32_t; 52typedef unsigned int __kernel_uid32_t;
48typedef __kernel_gid_t __kernel_gid32_t; 53typedef unsigned int __kernel_gid32_t;
49#endif 54#endif
50 55
51#ifndef __kernel_old_uid_t 56#ifndef __kernel_old_uid_t
@@ -67,99 +72,29 @@ typedef unsigned int __kernel_size_t;
67typedef int __kernel_ssize_t; 72typedef int __kernel_ssize_t;
68typedef int __kernel_ptrdiff_t; 73typedef int __kernel_ptrdiff_t;
69#else 74#else
70typedef unsigned long __kernel_size_t; 75typedef __kernel_ulong_t __kernel_size_t;
71typedef long __kernel_ssize_t; 76typedef __kernel_long_t __kernel_ssize_t;
72typedef long __kernel_ptrdiff_t; 77typedef __kernel_long_t __kernel_ptrdiff_t;
73#endif 78#endif
74#endif 79#endif
75 80
81#ifndef __kernel_fsid_t
82typedef struct {
83 int val[2];
84} __kernel_fsid_t;
85#endif
86
76/* 87/*
77 * anything below here should be completely generic 88 * anything below here should be completely generic
78 */ 89 */
79typedef long __kernel_off_t; 90typedef __kernel_long_t __kernel_off_t;
80typedef long long __kernel_loff_t; 91typedef long long __kernel_loff_t;
81typedef long __kernel_time_t; 92typedef __kernel_long_t __kernel_time_t;
82typedef long __kernel_clock_t; 93typedef __kernel_long_t __kernel_clock_t;
83typedef int __kernel_timer_t; 94typedef int __kernel_timer_t;
84typedef int __kernel_clockid_t; 95typedef int __kernel_clockid_t;
85typedef char * __kernel_caddr_t; 96typedef char * __kernel_caddr_t;
86typedef unsigned short __kernel_uid16_t; 97typedef unsigned short __kernel_uid16_t;
87typedef unsigned short __kernel_gid16_t; 98typedef unsigned short __kernel_gid16_t;
88 99
89typedef struct {
90 int val[2];
91} __kernel_fsid_t;
92
93#ifdef __KERNEL__
94
95#undef __FD_SET
96static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
97{
98 unsigned long __tmp = __fd / __NFDBITS;
99 unsigned long __rem = __fd % __NFDBITS;
100 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
101}
102
103#undef __FD_CLR
104static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
105{
106 unsigned long __tmp = __fd / __NFDBITS;
107 unsigned long __rem = __fd % __NFDBITS;
108 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
109}
110
111#undef __FD_ISSET
112static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
113{
114 unsigned long __tmp = __fd / __NFDBITS;
115 unsigned long __rem = __fd % __NFDBITS;
116 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
117}
118
119/*
120 * This will unroll the loop for the normal constant case (8 ints,
121 * for a 256-bit fd_set)
122 */
123#undef __FD_ZERO
124static inline void __FD_ZERO(__kernel_fd_set *__p)
125{
126 unsigned long *__tmp = __p->fds_bits;
127 int __i;
128
129 if (__builtin_constant_p(__FDSET_LONGS)) {
130 switch (__FDSET_LONGS) {
131 case 16:
132 __tmp[ 0] = 0; __tmp[ 1] = 0;
133 __tmp[ 2] = 0; __tmp[ 3] = 0;
134 __tmp[ 4] = 0; __tmp[ 5] = 0;
135 __tmp[ 6] = 0; __tmp[ 7] = 0;
136 __tmp[ 8] = 0; __tmp[ 9] = 0;
137 __tmp[10] = 0; __tmp[11] = 0;
138 __tmp[12] = 0; __tmp[13] = 0;
139 __tmp[14] = 0; __tmp[15] = 0;
140 return;
141
142 case 8:
143 __tmp[ 0] = 0; __tmp[ 1] = 0;
144 __tmp[ 2] = 0; __tmp[ 3] = 0;
145 __tmp[ 4] = 0; __tmp[ 5] = 0;
146 __tmp[ 6] = 0; __tmp[ 7] = 0;
147 return;
148
149 case 4:
150 __tmp[ 0] = 0; __tmp[ 1] = 0;
151 __tmp[ 2] = 0; __tmp[ 3] = 0;
152 return;
153 }
154 }
155 __i = __FDSET_LONGS;
156 while (__i) {
157 __i--;
158 *__tmp = 0;
159 __tmp++;
160 }
161}
162
163#endif /* __KERNEL__ */
164
165#endif /* __ASM_GENERIC_POSIX_TYPES_H */ 100#endif /* __ASM_GENERIC_POSIX_TYPES_H */
diff --git a/include/asm-generic/switch_to.h b/include/asm-generic/switch_to.h
new file mode 100644
index 000000000000..052c4ac04fd5
--- /dev/null
+++ b/include/asm-generic/switch_to.h
@@ -0,0 +1,30 @@
1/* Generic task switch macro wrapper, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_SWITCH_TO_H
15#define __ASM_GENERIC_SWITCH_TO_H
16
17#include <linux/thread_info.h>
18
19/*
20 * Context switching is now performed out-of-line in switch_to.S
21 */
22extern struct task_struct *__switch_to(struct task_struct *,
23 struct task_struct *);
24
25#define switch_to(prev, next, last) \
26 do { \
27 ((last) = __switch_to((prev), (next))); \
28 } while (0)
29
30#endif /* __ASM_GENERIC_SWITCH_TO_H */
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
deleted file mode 100644
index 215efa74f5a2..000000000000
--- a/include/asm-generic/system.h
+++ /dev/null
@@ -1,141 +0,0 @@
1/* Generic system definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_SYSTEM_H
15#define __ASM_GENERIC_SYSTEM_H
16
17#ifndef __ASSEMBLY__
18
19#include <linux/types.h>
20#include <linux/irqflags.h>
21
22#include <asm/cmpxchg-local.h>
23#include <asm/cmpxchg.h>
24
25struct task_struct;
26
27/* context switching is now performed out-of-line in switch_to.S */
28extern struct task_struct *__switch_to(struct task_struct *,
29 struct task_struct *);
30#define switch_to(prev, next, last) \
31 do { \
32 ((last) = __switch_to((prev), (next))); \
33 } while (0)
34
35#define arch_align_stack(x) (x)
36
37#define nop() asm volatile ("nop")
38
39#endif /* !__ASSEMBLY__ */
40
41/*
42 * Force strict CPU ordering.
43 * And yes, this is required on UP too when we're talking
44 * to devices.
45 *
46 * This implementation only contains a compiler barrier.
47 */
48
49#define mb() asm volatile ("": : :"memory")
50#define rmb() mb()
51#define wmb() asm volatile ("": : :"memory")
52
53#ifdef CONFIG_SMP
54#define smp_mb() mb()
55#define smp_rmb() rmb()
56#define smp_wmb() wmb()
57#else
58#define smp_mb() barrier()
59#define smp_rmb() barrier()
60#define smp_wmb() barrier()
61#endif
62
63#define set_mb(var, value) do { var = value; mb(); } while (0)
64#define set_wmb(var, value) do { var = value; wmb(); } while (0)
65
66#define read_barrier_depends() do {} while (0)
67#define smp_read_barrier_depends() do {} while (0)
68
69/*
70 * we make sure local_irq_enable() doesn't cause priority inversion
71 */
72#ifndef __ASSEMBLY__
73
74/* This function doesn't exist, so you'll get a linker error
75 * if something tries to do an invalid xchg(). */
76extern void __xchg_called_with_bad_pointer(void);
77
78static inline
79unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
80{
81 unsigned long ret, flags;
82
83 switch (size) {
84 case 1:
85#ifdef __xchg_u8
86 return __xchg_u8(x, ptr);
87#else
88 local_irq_save(flags);
89 ret = *(volatile u8 *)ptr;
90 *(volatile u8 *)ptr = x;
91 local_irq_restore(flags);
92 return ret;
93#endif /* __xchg_u8 */
94
95 case 2:
96#ifdef __xchg_u16
97 return __xchg_u16(x, ptr);
98#else
99 local_irq_save(flags);
100 ret = *(volatile u16 *)ptr;
101 *(volatile u16 *)ptr = x;
102 local_irq_restore(flags);
103 return ret;
104#endif /* __xchg_u16 */
105
106 case 4:
107#ifdef __xchg_u32
108 return __xchg_u32(x, ptr);
109#else
110 local_irq_save(flags);
111 ret = *(volatile u32 *)ptr;
112 *(volatile u32 *)ptr = x;
113 local_irq_restore(flags);
114 return ret;
115#endif /* __xchg_u32 */
116
117#ifdef CONFIG_64BIT
118 case 8:
119#ifdef __xchg_u64
120 return __xchg_u64(x, ptr);
121#else
122 local_irq_save(flags);
123 ret = *(volatile u64 *)ptr;
124 *(volatile u64 *)ptr = x;
125 local_irq_restore(flags);
126 return ret;
127#endif /* __xchg_u64 */
128#endif /* CONFIG_64BIT */
129
130 default:
131 __xchg_called_with_bad_pointer();
132 return x;
133 }
134}
135
136#define xchg(ptr, x) \
137 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
138
139#endif /* !__ASSEMBLY__ */
140
141#endif /* __ASM_GENERIC_SYSTEM_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 2292d1af9d70..991ef01cd77e 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -218,7 +218,7 @@ __SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
218 218
219/* fs/sendfile.c */ 219/* fs/sendfile.c */
220#define __NR3264_sendfile 71 220#define __NR3264_sendfile 71
221__SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile) 221__SYSCALL(__NR3264_sendfile, sys_sendfile64)
222 222
223/* fs/select.c */ 223/* fs/select.c */
224#define __NR_pselect6 72 224#define __NR_pselect6 72
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 798603e8ec38..8aeadf6b553a 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -616,30 +616,23 @@
616 *(.init.setup) \ 616 *(.init.setup) \
617 VMLINUX_SYMBOL(__setup_end) = .; 617 VMLINUX_SYMBOL(__setup_end) = .;
618 618
619#define INITCALLS \ 619#define INIT_CALLS_LEVEL(level) \
620 *(.initcallearly.init) \ 620 VMLINUX_SYMBOL(__initcall##level##_start) = .; \
621 VMLINUX_SYMBOL(__early_initcall_end) = .; \ 621 *(.initcall##level##.init) \
622 *(.initcall0.init) \ 622 *(.initcall##level##s.init) \
623 *(.initcall0s.init) \
624 *(.initcall1.init) \
625 *(.initcall1s.init) \
626 *(.initcall2.init) \
627 *(.initcall2s.init) \
628 *(.initcall3.init) \
629 *(.initcall3s.init) \
630 *(.initcall4.init) \
631 *(.initcall4s.init) \
632 *(.initcall5.init) \
633 *(.initcall5s.init) \
634 *(.initcallrootfs.init) \
635 *(.initcall6.init) \
636 *(.initcall6s.init) \
637 *(.initcall7.init) \
638 *(.initcall7s.init)
639 623
640#define INIT_CALLS \ 624#define INIT_CALLS \
641 VMLINUX_SYMBOL(__initcall_start) = .; \ 625 VMLINUX_SYMBOL(__initcall_start) = .; \
642 INITCALLS \ 626 *(.initcallearly.init) \
627 INIT_CALLS_LEVEL(0) \
628 INIT_CALLS_LEVEL(1) \
629 INIT_CALLS_LEVEL(2) \
630 INIT_CALLS_LEVEL(3) \
631 INIT_CALLS_LEVEL(4) \
632 INIT_CALLS_LEVEL(5) \
633 INIT_CALLS_LEVEL(rootfs) \
634 INIT_CALLS_LEVEL(6) \
635 INIT_CALLS_LEVEL(7) \
643 VMLINUX_SYMBOL(__initcall_end) = .; 636 VMLINUX_SYMBOL(__initcall_end) = .;
644 637
645#define CON_INITCALL \ 638#define CON_INITCALL \
diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h
index d838c945575a..2eba340230a7 100644
--- a/include/crypto/internal/aead.h
+++ b/include/crypto/internal/aead.h
@@ -31,6 +31,8 @@ static inline void crypto_set_aead_spawn(
31 crypto_set_spawn(&spawn->base, inst); 31 crypto_set_spawn(&spawn->base, inst);
32} 32}
33 33
34struct crypto_alg *crypto_lookup_aead(const char *name, u32 type, u32 mask);
35
34int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name, 36int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name,
35 u32 type, u32 mask); 37 u32 type, u32 mask);
36 38
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index 3a748a6bf772..06e8b32d541c 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -34,6 +34,8 @@ static inline void crypto_set_skcipher_spawn(
34int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, 34int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name,
35 u32 type, u32 mask); 35 u32 type, u32 mask);
36 36
37struct crypto_alg *crypto_lookup_skcipher(const char *name, u32 type, u32 mask);
38
37static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn) 39static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn)
38{ 40{
39 crypto_drop_spawn(&spawn->base); 41 crypto_drop_spawn(&spawn->base);
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 34a7b89fd006..64ff02d5b730 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -617,6 +617,17 @@ struct drm_get_cap {
617 __u64 value; 617 __u64 value;
618}; 618};
619 619
620#define DRM_CLOEXEC O_CLOEXEC
621struct drm_prime_handle {
622 __u32 handle;
623
624 /** Flags.. only applicable for handle->fd */
625 __u32 flags;
626
627 /** Returned dmabuf file descriptor */
628 __s32 fd;
629};
630
620#include "drm_mode.h" 631#include "drm_mode.h"
621 632
622#define DRM_IOCTL_BASE 'd' 633#define DRM_IOCTL_BASE 'd'
@@ -673,7 +684,8 @@ struct drm_get_cap {
673#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 684#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)
674#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 685#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)
675 686
676#define DRM_IOCTL_GEM_PRIME_OPEN DRM_IOWR(0x2e, struct drm_gem_open) 687#define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle)
688#define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle)
677 689
678#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 690#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
679#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 691#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 574bd1c81ebd..dd731043fecd 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -91,6 +91,7 @@ struct drm_device;
91#define DRM_UT_CORE 0x01 91#define DRM_UT_CORE 0x01
92#define DRM_UT_DRIVER 0x02 92#define DRM_UT_DRIVER 0x02
93#define DRM_UT_KMS 0x04 93#define DRM_UT_KMS 0x04
94#define DRM_UT_PRIME 0x08
94/* 95/*
95 * Three debug levels are defined. 96 * Three debug levels are defined.
96 * drm_core, drm_driver, drm_kms 97 * drm_core, drm_driver, drm_kms
@@ -150,6 +151,7 @@ int drm_err(const char *func, const char *format, ...);
150#define DRIVER_IRQ_VBL2 0x800 151#define DRIVER_IRQ_VBL2 0x800
151#define DRIVER_GEM 0x1000 152#define DRIVER_GEM 0x1000
152#define DRIVER_MODESET 0x2000 153#define DRIVER_MODESET 0x2000
154#define DRIVER_PRIME 0x4000
153 155
154#define DRIVER_BUS_PCI 0x1 156#define DRIVER_BUS_PCI 0x1
155#define DRIVER_BUS_PLATFORM 0x2 157#define DRIVER_BUS_PLATFORM 0x2
@@ -215,6 +217,11 @@ int drm_err(const char *func, const char *format, ...);
215 drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \ 217 drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \
216 __func__, fmt, ##args); \ 218 __func__, fmt, ##args); \
217 } while (0) 219 } while (0)
220#define DRM_DEBUG_PRIME(fmt, args...) \
221 do { \
222 drm_ut_debug_printk(DRM_UT_PRIME, DRM_NAME, \
223 __func__, fmt, ##args); \
224 } while (0)
218#define DRM_LOG(fmt, args...) \ 225#define DRM_LOG(fmt, args...) \
219 do { \ 226 do { \
220 drm_ut_debug_printk(DRM_UT_CORE, NULL, \ 227 drm_ut_debug_printk(DRM_UT_CORE, NULL, \
@@ -238,6 +245,7 @@ int drm_err(const char *func, const char *format, ...);
238#else 245#else
239#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) 246#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0)
240#define DRM_DEBUG_KMS(fmt, args...) do { } while (0) 247#define DRM_DEBUG_KMS(fmt, args...) do { } while (0)
248#define DRM_DEBUG_PRIME(fmt, args...) do { } while (0)
241#define DRM_DEBUG(fmt, arg...) do { } while (0) 249#define DRM_DEBUG(fmt, arg...) do { } while (0)
242#define DRM_LOG(fmt, arg...) do { } while (0) 250#define DRM_LOG(fmt, arg...) do { } while (0)
243#define DRM_LOG_KMS(fmt, args...) do { } while (0) 251#define DRM_LOG_KMS(fmt, args...) do { } while (0)
@@ -410,6 +418,12 @@ struct drm_pending_event {
410 void (*destroy)(struct drm_pending_event *event); 418 void (*destroy)(struct drm_pending_event *event);
411}; 419};
412 420
421/* initial implementaton using a linked list - todo hashtab */
422struct drm_prime_file_private {
423 struct list_head head;
424 struct mutex lock;
425};
426
413/** File private data */ 427/** File private data */
414struct drm_file { 428struct drm_file {
415 int authenticated; 429 int authenticated;
@@ -437,6 +451,8 @@ struct drm_file {
437 wait_queue_head_t event_wait; 451 wait_queue_head_t event_wait;
438 struct list_head event_list; 452 struct list_head event_list;
439 int event_space; 453 int event_space;
454
455 struct drm_prime_file_private prime;
440}; 456};
441 457
442/** Wait queue */ 458/** Wait queue */
@@ -652,6 +668,12 @@ struct drm_gem_object {
652 uint32_t pending_write_domain; 668 uint32_t pending_write_domain;
653 669
654 void *driver_private; 670 void *driver_private;
671
672 /* dma buf exported from this GEM object */
673 struct dma_buf *export_dma_buf;
674
675 /* dma buf attachment backing this object */
676 struct dma_buf_attachment *import_attach;
655}; 677};
656 678
657#include "drm_crtc.h" 679#include "drm_crtc.h"
@@ -890,6 +912,20 @@ struct drm_driver {
890 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); 912 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *);
891 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); 913 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
892 914
915 /* prime: */
916 /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */
917 int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv,
918 uint32_t handle, uint32_t flags, int *prime_fd);
919 /* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */
920 int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv,
921 int prime_fd, uint32_t *handle);
922 /* export GEM -> dmabuf */
923 struct dma_buf * (*gem_prime_export)(struct drm_device *dev,
924 struct drm_gem_object *obj, int flags);
925 /* import dmabuf -> GEM */
926 struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
927 struct dma_buf *dma_buf);
928
893 /* vga arb irq handler */ 929 /* vga arb irq handler */
894 void (*vgaarb_irq)(struct drm_device *dev, bool state); 930 void (*vgaarb_irq)(struct drm_device *dev, bool state);
895 931
@@ -1509,6 +1545,32 @@ extern int drm_vblank_info(struct seq_file *m, void *data);
1509extern int drm_clients_info(struct seq_file *m, void* data); 1545extern int drm_clients_info(struct seq_file *m, void* data);
1510extern int drm_gem_name_info(struct seq_file *m, void *data); 1546extern int drm_gem_name_info(struct seq_file *m, void *data);
1511 1547
1548
1549extern int drm_gem_prime_handle_to_fd(struct drm_device *dev,
1550 struct drm_file *file_priv, uint32_t handle, uint32_t flags,
1551 int *prime_fd);
1552extern int drm_gem_prime_fd_to_handle(struct drm_device *dev,
1553 struct drm_file *file_priv, int prime_fd, uint32_t *handle);
1554
1555extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
1556 struct drm_file *file_priv);
1557extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
1558 struct drm_file *file_priv);
1559
1560extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages);
1561extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg);
1562
1563
1564void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv);
1565void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv);
1566int drm_prime_add_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle);
1567int drm_prime_lookup_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle);
1568void drm_prime_remove_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf);
1569
1570int drm_prime_add_dma_buf(struct drm_device *dev, struct drm_gem_object *obj);
1571int drm_prime_lookup_obj(struct drm_device *dev, struct dma_buf *buf,
1572 struct drm_gem_object **obj);
1573
1512#if DRM_DEBUG_CODE 1574#if DRM_DEBUG_CODE
1513extern int drm_vma_info(struct seq_file *m, void *data); 1575extern int drm_vma_info(struct seq_file *m, void *data);
1514#endif 1576#endif
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index 0a0001b9dc78..923afb5dcf0c 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -44,4 +44,8 @@ void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries,
44/* flag for GFDT type */ 44/* flag for GFDT type */
45#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) 45#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3)
46 46
47#ifdef CONFIG_INTEL_IOMMU
48extern int intel_iommu_gfx_mapped;
49#endif
50
47#endif 51#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index a25555381097..3c9b616c834a 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -3,6 +3,7 @@ header-y += can/
3header-y += caif/ 3header-y += caif/
4header-y += dvb/ 4header-y += dvb/
5header-y += hdlc/ 5header-y += hdlc/
6header-y += hsi/
6header-y += isdn/ 7header-y += isdn/
7header-y += mmc/ 8header-y += mmc/
8header-y += nfsd/ 9header-y += nfsd/
@@ -120,7 +121,6 @@ header-y += errno.h
120header-y += errqueue.h 121header-y += errqueue.h
121header-y += ethtool.h 122header-y += ethtool.h
122header-y += eventpoll.h 123header-y += eventpoll.h
123header-y += ext2_fs.h
124header-y += fadvise.h 124header-y += fadvise.h
125header-y += falloc.h 125header-y += falloc.h
126header-y += fanotify.h 126header-y += fanotify.h
@@ -357,6 +357,7 @@ header-y += suspend_ioctls.h
357header-y += swab.h 357header-y += swab.h
358header-y += synclink.h 358header-y += synclink.h
359header-y += sysctl.h 359header-y += sysctl.h
360header-y += sysinfo.h
360header-y += taskstats.h 361header-y += taskstats.h
361header-y += tcp.h 362header-y += tcp.h
362header-y += telephony.h 363header-y += telephony.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 3f968665899b..f421dd84f29d 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -151,6 +151,7 @@ extern int ec_write(u8 addr, u8 val);
151extern int ec_transaction(u8 command, 151extern int ec_transaction(u8 command,
152 const u8 *wdata, unsigned wdata_len, 152 const u8 *wdata, unsigned wdata_len,
153 u8 *rdata, unsigned rdata_len); 153 u8 *rdata, unsigned rdata_len);
154extern acpi_handle ec_get_handle(void);
154 155
155#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) 156#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
156 157
@@ -371,4 +372,14 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
371 372
372#endif /* !CONFIG_ACPI */ 373#endif /* !CONFIG_ACPI */
373 374
375#ifdef CONFIG_ACPI
376void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
377 u32 pm1a_ctrl, u32 pm1b_ctrl));
378
379acpi_status acpi_os_prepare_sleep(u8 sleep_state,
380 u32 pm1a_control, u32 pm1b_control);
381#else
382#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
383#endif
384
374#endif /*_LINUX_ACPI_H*/ 385#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/aio_abi.h b/include/linux/aio_abi.h
index 2c8731664180..86fa7a71336a 100644
--- a/include/linux/aio_abi.h
+++ b/include/linux/aio_abi.h
@@ -30,7 +30,7 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <asm/byteorder.h> 31#include <asm/byteorder.h>
32 32
33typedef unsigned long aio_context_t; 33typedef __kernel_ulong_t aio_context_t;
34 34
35enum { 35enum {
36 IOCB_CMD_PREAD = 0, 36 IOCB_CMD_PREAD = 0,
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 033f6aa670de..e64ce2cfee99 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -47,9 +47,6 @@ enum {
47 * @muxval: a number usually used to poke into some mux regiser to 47 * @muxval: a number usually used to poke into some mux regiser to
48 * mux in the signal to this channel 48 * mux in the signal to this channel
49 * @cctl_opt: default options for the channel control register 49 * @cctl_opt: default options for the channel control register
50 * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
51 * channels. Fill with 'true' if peripheral should be flow controller. Direction
52 * will be selected at Runtime.
53 * @addr: source/target address in physical memory for this DMA channel, 50 * @addr: source/target address in physical memory for this DMA channel,
54 * can be the address of a FIFO register for burst requests for example. 51 * can be the address of a FIFO register for burst requests for example.
55 * This can be left undefined if the PrimeCell API is used for configuring 52 * This can be left undefined if the PrimeCell API is used for configuring
@@ -68,7 +65,6 @@ struct pl08x_channel_data {
68 int max_signal; 65 int max_signal;
69 u32 muxval; 66 u32 muxval;
70 u32 cctl; 67 u32 cctl;
71 bool device_fc;
72 dma_addr_t addr; 68 dma_addr_t addr;
73 bool circular_buffer; 69 bool circular_buffer;
74 bool single; 70 bool single;
@@ -176,13 +172,15 @@ enum pl08x_dma_chan_state {
176 * @runtime_addr: address for RX/TX according to the runtime config 172 * @runtime_addr: address for RX/TX according to the runtime config
177 * @runtime_direction: current direction of this channel according to 173 * @runtime_direction: current direction of this channel according to
178 * runtime config 174 * runtime config
179 * @lc: last completed transaction on this channel
180 * @pend_list: queued transactions pending on this channel 175 * @pend_list: queued transactions pending on this channel
181 * @at: active transaction on this channel 176 * @at: active transaction on this channel
182 * @lock: a lock for this channel data 177 * @lock: a lock for this channel data
183 * @host: a pointer to the host (internal use) 178 * @host: a pointer to the host (internal use)
184 * @state: whether the channel is idle, paused, running etc 179 * @state: whether the channel is idle, paused, running etc
185 * @slave: whether this channel is a device (slave) or for memcpy 180 * @slave: whether this channel is a device (slave) or for memcpy
181 * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
182 * channels. Fill with 'true' if peripheral should be flow controller. Direction
183 * will be selected at Runtime.
186 * @waiting: a TX descriptor on this channel which is waiting for a physical 184 * @waiting: a TX descriptor on this channel which is waiting for a physical
187 * channel to become available 185 * channel to become available
188 */ 186 */
@@ -198,13 +196,13 @@ struct pl08x_dma_chan {
198 u32 src_cctl; 196 u32 src_cctl;
199 u32 dst_cctl; 197 u32 dst_cctl;
200 enum dma_transfer_direction runtime_direction; 198 enum dma_transfer_direction runtime_direction;
201 dma_cookie_t lc;
202 struct list_head pend_list; 199 struct list_head pend_list;
203 struct pl08x_txd *at; 200 struct pl08x_txd *at;
204 spinlock_t lock; 201 spinlock_t lock;
205 struct pl08x_driver_data *host; 202 struct pl08x_driver_data *host;
206 enum pl08x_dma_chan_state state; 203 enum pl08x_dma_chan_state state;
207 bool slave; 204 bool slave;
205 bool device_fc;
208 struct pl08x_txd *waiting; 206 struct pl08x_txd *waiting;
209}; 207};
210 208
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h
index 12e023c19ac1..fe93758e8403 100644
--- a/include/linux/amba/pl330.h
+++ b/include/linux/amba/pl330.h
@@ -13,7 +13,6 @@
13#define __AMBA_PL330_H_ 13#define __AMBA_PL330_H_
14 14
15#include <linux/dmaengine.h> 15#include <linux/dmaengine.h>
16#include <asm/hardware/pl330.h>
17 16
18struct dma_pl330_platdata { 17struct dma_pl330_platdata {
19 /* 18 /*
diff --git a/include/linux/apple_bl.h b/include/linux/apple_bl.h
new file mode 100644
index 000000000000..47bedc0eee69
--- /dev/null
+++ b/include/linux/apple_bl.h
@@ -0,0 +1,26 @@
1/*
2 * apple_bl exported symbols
3 */
4
5#ifndef _LINUX_APPLE_BL_H
6#define _LINUX_APPLE_BL_H
7
8#ifdef CONFIG_BACKLIGHT_APPLE
9
10extern int apple_bl_register(void);
11extern void apple_bl_unregister(void);
12
13#else /* !CONFIG_BACKLIGHT_APPLE */
14
15static inline int apple_bl_register(void)
16{
17 return 0;
18}
19
20static inline void apple_bl_unregister(void)
21{
22}
23
24#endif /* !CONFIG_BACKLIGHT_APPLE */
25
26#endif /* _LINUX_APPLE_BL_H */
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index e8cf0ccd1a8d..e71d683982a6 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -208,7 +208,7 @@ extern struct kmem_cache *ceph_cap_cachep;
208extern struct kmem_cache *ceph_dentry_cachep; 208extern struct kmem_cache *ceph_dentry_cachep;
209extern struct kmem_cache *ceph_file_cachep; 209extern struct kmem_cache *ceph_file_cachep;
210 210
211extern int ceph_parse_options(struct ceph_options **popt, char *options, 211extern struct ceph_options *ceph_parse_options(char *options,
212 const char *dev_name, const char *dev_name_end, 212 const char *dev_name, const char *dev_name_end,
213 int (*parse_extra_token)(char *c, void *private), 213 int (*parse_extra_token)(char *c, void *private),
214 void *private); 214 void *private);
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index ffbeb2c217b4..3bff047f6b0f 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -14,8 +14,6 @@
14struct ceph_msg; 14struct ceph_msg;
15struct ceph_connection; 15struct ceph_connection;
16 16
17extern struct workqueue_struct *ceph_msgr_wq; /* receive work queue */
18
19/* 17/*
20 * Ceph defines these callbacks for handling connection events. 18 * Ceph defines these callbacks for handling connection events.
21 */ 19 */
@@ -54,7 +52,6 @@ struct ceph_connection_operations {
54struct ceph_messenger { 52struct ceph_messenger {
55 struct ceph_entity_inst inst; /* my name+address */ 53 struct ceph_entity_inst inst; /* my name+address */
56 struct ceph_entity_addr my_enc_addr; 54 struct ceph_entity_addr my_enc_addr;
57 struct page *zero_page; /* used in certain error cases */
58 55
59 bool nocrc; 56 bool nocrc;
60 57
@@ -101,7 +98,7 @@ struct ceph_msg {
101struct ceph_msg_pos { 98struct ceph_msg_pos {
102 int page, page_pos; /* which page; offset in page */ 99 int page, page_pos; /* which page; offset in page */
103 int data_pos; /* offset in data payload */ 100 int data_pos; /* offset in data payload */
104 int did_page_crc; /* true if we've calculated crc for current page */ 101 bool did_page_crc; /* true if we've calculated crc for current page */
105}; 102};
106 103
107/* ceph connection fault delay defaults, for exponential backoff */ 104/* ceph connection fault delay defaults, for exponential backoff */
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
new file mode 100644
index 000000000000..5e4312b6f5cc
--- /dev/null
+++ b/include/linux/clk-private.h
@@ -0,0 +1,196 @@
1/*
2 * linux/include/linux/clk-private.h
3 *
4 * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
5 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __LINUX_CLK_PRIVATE_H
12#define __LINUX_CLK_PRIVATE_H
13
14#include <linux/clk-provider.h>
15#include <linux/list.h>
16
17/*
18 * WARNING: Do not include clk-private.h from any file that implements struct
19 * clk_ops. Doing so is a layering violation!
20 *
21 * This header exists only to allow for statically initialized clock data. Any
22 * static clock data must be defined in a separate file from the logic that
23 * implements the clock operations for that same data.
24 */
25
26#ifdef CONFIG_COMMON_CLK
27
28struct clk {
29 const char *name;
30 const struct clk_ops *ops;
31 struct clk_hw *hw;
32 struct clk *parent;
33 char **parent_names;
34 struct clk **parents;
35 u8 num_parents;
36 unsigned long rate;
37 unsigned long new_rate;
38 unsigned long flags;
39 unsigned int enable_count;
40 unsigned int prepare_count;
41 struct hlist_head children;
42 struct hlist_node child_node;
43 unsigned int notifier_count;
44#ifdef CONFIG_COMMON_CLK_DEBUG
45 struct dentry *dentry;
46#endif
47};
48
49/*
50 * DOC: Basic clock implementations common to many platforms
51 *
52 * Each basic clock hardware type is comprised of a structure describing the
53 * clock hardware, implementations of the relevant callbacks in struct clk_ops,
54 * unique flags for that hardware type, a registration function and an
55 * alternative macro for static initialization
56 */
57
58extern struct clk_ops clk_fixed_rate_ops;
59
60#define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \
61 _fixed_rate_flags) \
62 static struct clk _name; \
63 static char *_name##_parent_names[] = {}; \
64 static struct clk_fixed_rate _name##_hw = { \
65 .hw = { \
66 .clk = &_name, \
67 }, \
68 .fixed_rate = _rate, \
69 .flags = _fixed_rate_flags, \
70 }; \
71 static struct clk _name = { \
72 .name = #_name, \
73 .ops = &clk_fixed_rate_ops, \
74 .hw = &_name##_hw.hw, \
75 .parent_names = _name##_parent_names, \
76 .num_parents = \
77 ARRAY_SIZE(_name##_parent_names), \
78 .flags = _flags, \
79 };
80
81extern struct clk_ops clk_gate_ops;
82
83#define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \
84 _flags, _reg, _bit_idx, \
85 _gate_flags, _lock) \
86 static struct clk _name; \
87 static char *_name##_parent_names[] = { \
88 _parent_name, \
89 }; \
90 static struct clk *_name##_parents[] = { \
91 _parent_ptr, \
92 }; \
93 static struct clk_gate _name##_hw = { \
94 .hw = { \
95 .clk = &_name, \
96 }, \
97 .reg = _reg, \
98 .bit_idx = _bit_idx, \
99 .flags = _gate_flags, \
100 .lock = _lock, \
101 }; \
102 static struct clk _name = { \
103 .name = #_name, \
104 .ops = &clk_gate_ops, \
105 .hw = &_name##_hw.hw, \
106 .parent_names = _name##_parent_names, \
107 .num_parents = \
108 ARRAY_SIZE(_name##_parent_names), \
109 .parents = _name##_parents, \
110 .flags = _flags, \
111 };
112
113extern struct clk_ops clk_divider_ops;
114
115#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
116 _flags, _reg, _shift, _width, \
117 _divider_flags, _lock) \
118 static struct clk _name; \
119 static char *_name##_parent_names[] = { \
120 _parent_name, \
121 }; \
122 static struct clk *_name##_parents[] = { \
123 _parent_ptr, \
124 }; \
125 static struct clk_divider _name##_hw = { \
126 .hw = { \
127 .clk = &_name, \
128 }, \
129 .reg = _reg, \
130 .shift = _shift, \
131 .width = _width, \
132 .flags = _divider_flags, \
133 .lock = _lock, \
134 }; \
135 static struct clk _name = { \
136 .name = #_name, \
137 .ops = &clk_divider_ops, \
138 .hw = &_name##_hw.hw, \
139 .parent_names = _name##_parent_names, \
140 .num_parents = \
141 ARRAY_SIZE(_name##_parent_names), \
142 .parents = _name##_parents, \
143 .flags = _flags, \
144 };
145
146extern struct clk_ops clk_mux_ops;
147
148#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \
149 _reg, _shift, _width, \
150 _mux_flags, _lock) \
151 static struct clk _name; \
152 static struct clk_mux _name##_hw = { \
153 .hw = { \
154 .clk = &_name, \
155 }, \
156 .reg = _reg, \
157 .shift = _shift, \
158 .width = _width, \
159 .flags = _mux_flags, \
160 .lock = _lock, \
161 }; \
162 static struct clk _name = { \
163 .name = #_name, \
164 .ops = &clk_mux_ops, \
165 .hw = &_name##_hw.hw, \
166 .parent_names = _parent_names, \
167 .num_parents = \
168 ARRAY_SIZE(_parent_names), \
169 .parents = _parents, \
170 .flags = _flags, \
171 };
172
173/**
174 * __clk_init - initialize the data structures in a struct clk
175 * @dev: device initializing this clk, placeholder for now
176 * @clk: clk being initialized
177 *
178 * Initializes the lists in struct clk, queries the hardware for the
179 * parent and rate and sets them both.
180 *
181 * Any struct clk passed into __clk_init must have the following members
182 * populated:
183 * .name
184 * .ops
185 * .hw
186 * .parent_names
187 * .num_parents
188 * .flags
189 *
190 * It is not necessary to call clk_register if __clk_init is used directly with
191 * statically initialized clock data.
192 */
193void __clk_init(struct device *dev, struct clk *clk);
194
195#endif /* CONFIG_COMMON_CLK */
196#endif /* CLK_PRIVATE_H */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
new file mode 100644
index 000000000000..5508897ad376
--- /dev/null
+++ b/include/linux/clk-provider.h
@@ -0,0 +1,300 @@
1/*
2 * linux/include/linux/clk-provider.h
3 *
4 * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
5 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __LINUX_CLK_PROVIDER_H
12#define __LINUX_CLK_PROVIDER_H
13
14#include <linux/clk.h>
15
16#ifdef CONFIG_COMMON_CLK
17
18/**
19 * struct clk_hw - handle for traversing from a struct clk to its corresponding
20 * hardware-specific structure. struct clk_hw should be declared within struct
21 * clk_foo and then referenced by the struct clk instance that uses struct
22 * clk_foo's clk_ops
23 *
24 * clk: pointer to the struct clk instance that points back to this struct
25 * clk_hw instance
26 */
27struct clk_hw {
28 struct clk *clk;
29};
30
31/*
32 * flags used across common struct clk. these flags should only affect the
33 * top-level framework. custom flags for dealing with hardware specifics
34 * belong in struct clk_foo
35 */
36#define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */
37#define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */
38#define CLK_SET_RATE_PARENT BIT(2) /* propagate rate change up one level */
39#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */
40#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
41
42/**
43 * struct clk_ops - Callback operations for hardware clocks; these are to
44 * be provided by the clock implementation, and will be called by drivers
45 * through the clk_* api.
46 *
47 * @prepare: Prepare the clock for enabling. This must not return until
48 * the clock is fully prepared, and it's safe to call clk_enable.
49 * This callback is intended to allow clock implementations to
50 * do any initialisation that may sleep. Called with
51 * prepare_lock held.
52 *
53 * @unprepare: Release the clock from its prepared state. This will typically
54 * undo any work done in the @prepare callback. Called with
55 * prepare_lock held.
56 *
57 * @enable: Enable the clock atomically. This must not return until the
58 * clock is generating a valid clock signal, usable by consumer
59 * devices. Called with enable_lock held. This function must not
60 * sleep.
61 *
62 * @disable: Disable the clock atomically. Called with enable_lock held.
63 * This function must not sleep.
64 *
65 * @recalc_rate Recalculate the rate of this clock, by quering hardware. The
66 * parent rate is an input parameter. It is up to the caller to
67 * insure that the prepare_mutex is held across this call.
68 * Returns the calculated rate. Optional, but recommended - if
69 * this op is not set then clock rate will be initialized to 0.
70 *
71 * @round_rate: Given a target rate as input, returns the closest rate actually
72 * supported by the clock.
73 *
74 * @get_parent: Queries the hardware to determine the parent of a clock. The
75 * return value is a u8 which specifies the index corresponding to
76 * the parent clock. This index can be applied to either the
77 * .parent_names or .parents arrays. In short, this function
78 * translates the parent value read from hardware into an array
79 * index. Currently only called when the clock is initialized by
80 * __clk_init. This callback is mandatory for clocks with
81 * multiple parents. It is optional (and unnecessary) for clocks
82 * with 0 or 1 parents.
83 *
84 * @set_parent: Change the input source of this clock; for clocks with multiple
85 * possible parents specify a new parent by passing in the index
86 * as a u8 corresponding to the parent in either the .parent_names
87 * or .parents arrays. This function in affect translates an
88 * array index into the value programmed into the hardware.
89 * Returns 0 on success, -EERROR otherwise.
90 *
91 * @set_rate: Change the rate of this clock. If this callback returns
92 * CLK_SET_RATE_PARENT, the rate change will be propagated to the
93 * parent clock (which may propagate again if the parent clock
94 * also sets this flag). The requested rate of the parent is
95 * passed back from the callback in the second 'unsigned long *'
96 * argument. Note that it is up to the hardware clock's set_rate
97 * implementation to insure that clocks do not run out of spec
98 * when propgating the call to set_rate up to the parent. One way
99 * to do this is to gate the clock (via clk_disable and/or
100 * clk_unprepare) before calling clk_set_rate, then ungating it
101 * afterward. If your clock also has the CLK_GATE_SET_RATE flag
102 * set then this will insure safety. Returns 0 on success,
103 * -EERROR otherwise.
104 *
105 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
106 * implementations to split any work between atomic (enable) and sleepable
107 * (prepare) contexts. If enabling a clock requires code that might sleep,
108 * this must be done in clk_prepare. Clock enable code that will never be
109 * called in a sleepable context may be implement in clk_enable.
110 *
111 * Typically, drivers will call clk_prepare when a clock may be needed later
112 * (eg. when a device is opened), and clk_enable when the clock is actually
113 * required (eg. from an interrupt). Note that clk_prepare MUST have been
114 * called before clk_enable.
115 */
116struct clk_ops {
117 int (*prepare)(struct clk_hw *hw);
118 void (*unprepare)(struct clk_hw *hw);
119 int (*enable)(struct clk_hw *hw);
120 void (*disable)(struct clk_hw *hw);
121 int (*is_enabled)(struct clk_hw *hw);
122 unsigned long (*recalc_rate)(struct clk_hw *hw,
123 unsigned long parent_rate);
124 long (*round_rate)(struct clk_hw *hw, unsigned long,
125 unsigned long *);
126 int (*set_parent)(struct clk_hw *hw, u8 index);
127 u8 (*get_parent)(struct clk_hw *hw);
128 int (*set_rate)(struct clk_hw *hw, unsigned long);
129 void (*init)(struct clk_hw *hw);
130};
131
132/*
133 * DOC: Basic clock implementations common to many platforms
134 *
135 * Each basic clock hardware type is comprised of a structure describing the
136 * clock hardware, implementations of the relevant callbacks in struct clk_ops,
137 * unique flags for that hardware type, a registration function and an
138 * alternative macro for static initialization
139 */
140
141/**
142 * struct clk_fixed_rate - fixed-rate clock
143 * @hw: handle between common and hardware-specific interfaces
144 * @fixed_rate: constant frequency of clock
145 */
146struct clk_fixed_rate {
147 struct clk_hw hw;
148 unsigned long fixed_rate;
149 u8 flags;
150};
151
152struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
153 const char *parent_name, unsigned long flags,
154 unsigned long fixed_rate);
155
156/**
157 * struct clk_gate - gating clock
158 *
159 * @hw: handle between common and hardware-specific interfaces
160 * @reg: register controlling gate
161 * @bit_idx: single bit controlling gate
162 * @flags: hardware-specific flags
163 * @lock: register lock
164 *
165 * Clock which can gate its output. Implements .enable & .disable
166 *
167 * Flags:
168 * CLK_GATE_SET_DISABLE - by default this clock sets the bit at bit_idx to
169 * enable the clock. Setting this flag does the opposite: setting the bit
170 * disable the clock and clearing it enables the clock
171 */
172struct clk_gate {
173 struct clk_hw hw;
174 void __iomem *reg;
175 u8 bit_idx;
176 u8 flags;
177 spinlock_t *lock;
178 char *parent[1];
179};
180
181#define CLK_GATE_SET_TO_DISABLE BIT(0)
182
183struct clk *clk_register_gate(struct device *dev, const char *name,
184 const char *parent_name, unsigned long flags,
185 void __iomem *reg, u8 bit_idx,
186 u8 clk_gate_flags, spinlock_t *lock);
187
188/**
189 * struct clk_divider - adjustable divider clock
190 *
191 * @hw: handle between common and hardware-specific interfaces
192 * @reg: register containing the divider
193 * @shift: shift to the divider bit field
194 * @width: width of the divider bit field
195 * @lock: register lock
196 *
197 * Clock with an adjustable divider affecting its output frequency. Implements
198 * .recalc_rate, .set_rate and .round_rate
199 *
200 * Flags:
201 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the
202 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is
203 * the raw value read from the register, with the value of zero considered
204 * invalid
205 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from
206 * the hardware register
207 */
208struct clk_divider {
209 struct clk_hw hw;
210 void __iomem *reg;
211 u8 shift;
212 u8 width;
213 u8 flags;
214 spinlock_t *lock;
215 char *parent[1];
216};
217
218#define CLK_DIVIDER_ONE_BASED BIT(0)
219#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
220
221struct clk *clk_register_divider(struct device *dev, const char *name,
222 const char *parent_name, unsigned long flags,
223 void __iomem *reg, u8 shift, u8 width,
224 u8 clk_divider_flags, spinlock_t *lock);
225
226/**
227 * struct clk_mux - multiplexer clock
228 *
229 * @hw: handle between common and hardware-specific interfaces
230 * @reg: register controlling multiplexer
231 * @shift: shift to multiplexer bit field
232 * @width: width of mutliplexer bit field
233 * @num_clks: number of parent clocks
234 * @lock: register lock
235 *
236 * Clock with multiple selectable parents. Implements .get_parent, .set_parent
237 * and .recalc_rate
238 *
239 * Flags:
240 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
241 * CLK_MUX_INDEX_BITWISE - register index is a single bit (power of two)
242 */
243struct clk_mux {
244 struct clk_hw hw;
245 void __iomem *reg;
246 u8 shift;
247 u8 width;
248 u8 flags;
249 spinlock_t *lock;
250};
251
252#define CLK_MUX_INDEX_ONE BIT(0)
253#define CLK_MUX_INDEX_BIT BIT(1)
254
255struct clk *clk_register_mux(struct device *dev, const char *name,
256 char **parent_names, u8 num_parents, unsigned long flags,
257 void __iomem *reg, u8 shift, u8 width,
258 u8 clk_mux_flags, spinlock_t *lock);
259
260/**
261 * clk_register - allocate a new clock, register it and return an opaque cookie
262 * @dev: device that is registering this clock
263 * @name: clock name
264 * @ops: operations this clock supports
265 * @hw: link to hardware-specific clock data
266 * @parent_names: array of string names for all possible parents
267 * @num_parents: number of possible parents
268 * @flags: framework-level hints and quirks
269 *
270 * clk_register is the primary interface for populating the clock tree with new
271 * clock nodes. It returns a pointer to the newly allocated struct clk which
272 * cannot be dereferenced by driver code but may be used in conjuction with the
273 * rest of the clock API.
274 */
275struct clk *clk_register(struct device *dev, const char *name,
276 const struct clk_ops *ops, struct clk_hw *hw,
277 char **parent_names, u8 num_parents, unsigned long flags);
278
279/* helper functions */
280const char *__clk_get_name(struct clk *clk);
281struct clk_hw *__clk_get_hw(struct clk *clk);
282u8 __clk_get_num_parents(struct clk *clk);
283struct clk *__clk_get_parent(struct clk *clk);
284inline int __clk_get_enable_count(struct clk *clk);
285inline int __clk_get_prepare_count(struct clk *clk);
286unsigned long __clk_get_rate(struct clk *clk);
287unsigned long __clk_get_flags(struct clk *clk);
288int __clk_is_enabled(struct clk *clk);
289struct clk *__clk_lookup(const char *name);
290
291/*
292 * FIXME clock api without lock protection
293 */
294int __clk_prepare(struct clk *clk);
295void __clk_unprepare(struct clk *clk);
296void __clk_reparent(struct clk *clk, struct clk *new_parent);
297unsigned long __clk_round_rate(struct clk *clk, unsigned long rate);
298
299#endif /* CONFIG_COMMON_CLK */
300#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b9d46fa154b4..b0252726df61 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -3,6 +3,7 @@
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.
6 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -12,18 +13,75 @@
12#define __LINUX_CLK_H 13#define __LINUX_CLK_H
13 14
14#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/notifier.h>
15 17
16struct device; 18struct device;
17 19
18/* 20struct clk;
19 * The base API. 21
22#ifdef CONFIG_COMMON_CLK
23
24/**
25 * DOC: clk notifier callback types
26 *
27 * PRE_RATE_CHANGE - called immediately before the clk rate is changed,
28 * to indicate that the rate change will proceed. Drivers must
29 * immediately terminate any operations that will be affected by the
30 * rate change. Callbacks may either return NOTIFY_DONE or
31 * NOTIFY_STOP.
32 *
33 * ABORT_RATE_CHANGE: called if the rate change failed for some reason
34 * after PRE_RATE_CHANGE. In this case, all registered notifiers on
35 * the clk will be called with ABORT_RATE_CHANGE. Callbacks must
36 * always return NOTIFY_DONE.
37 *
38 * POST_RATE_CHANGE - called after the clk rate change has successfully
39 * completed. Callbacks must always return NOTIFY_DONE.
40 *
20 */ 41 */
42#define PRE_RATE_CHANGE BIT(0)
43#define POST_RATE_CHANGE BIT(1)
44#define ABORT_RATE_CHANGE BIT(2)
21 45
46/**
47 * struct clk_notifier - associate a clk with a notifier
48 * @clk: struct clk * to associate the notifier with
49 * @notifier_head: a blocking_notifier_head for this clk
50 * @node: linked list pointers
51 *
52 * A list of struct clk_notifier is maintained by the notifier code.
53 * An entry is created whenever code registers the first notifier on a
54 * particular @clk. Future notifiers on that @clk are added to the
55 * @notifier_head.
56 */
57struct clk_notifier {
58 struct clk *clk;
59 struct srcu_notifier_head notifier_head;
60 struct list_head node;
61};
22 62
23/* 63/**
24 * struct clk - an machine class defined object / cookie. 64 * struct clk_notifier_data - rate data to pass to the notifier callback
65 * @clk: struct clk * being changed
66 * @old_rate: previous rate of this clk
67 * @new_rate: new rate of this clk
68 *
69 * For a pre-notifier, old_rate is the clk's rate before this rate
70 * change, and new_rate is what the rate will be in the future. For a
71 * post-notifier, old_rate and new_rate are both set to the clk's
72 * current rate (this was done to optimize the implementation).
25 */ 73 */
26struct clk; 74struct clk_notifier_data {
75 struct clk *clk;
76 unsigned long old_rate;
77 unsigned long new_rate;
78};
79
80int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
81
82int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
83
84#endif /* !CONFIG_COMMON_CLK */
27 85
28/** 86/**
29 * clk_get - lookup and obtain a reference to a clock producer. 87 * clk_get - lookup and obtain a reference to a clock producer.
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h
index e3d8bf26e5eb..aa629bce9033 100644
--- a/include/linux/cnt32_to_63.h
+++ b/include/linux/cnt32_to_63.h
@@ -16,7 +16,6 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/byteorder.h> 18#include <asm/byteorder.h>
19#include <asm/system.h>
20 19
21/* this is used only to give gcc a clue about good code generation */ 20/* this is used only to give gcc a clue about good code generation */
22union cnt32_to_63 { 21union cnt32_to_63 {
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 7e05fcee75a1..5d46217f84ad 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -19,6 +19,10 @@
19#include <asm/siginfo.h> 19#include <asm/siginfo.h>
20#include <asm/signal.h> 20#include <asm/signal.h>
21 21
22#ifndef COMPAT_USE_64BIT_TIME
23#define COMPAT_USE_64BIT_TIME 0
24#endif
25
22#define compat_jiffies_to_clock_t(x) \ 26#define compat_jiffies_to_clock_t(x) \
23 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 27 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
24 28
@@ -83,10 +87,26 @@ typedef struct {
83 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 87 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
84} compat_sigset_t; 88} compat_sigset_t;
85 89
90/*
91 * These functions operate strictly on struct compat_time*
92 */
86extern int get_compat_timespec(struct timespec *, 93extern int get_compat_timespec(struct timespec *,
87 const struct compat_timespec __user *); 94 const struct compat_timespec __user *);
88extern int put_compat_timespec(const struct timespec *, 95extern int put_compat_timespec(const struct timespec *,
89 struct compat_timespec __user *); 96 struct compat_timespec __user *);
97extern int get_compat_timeval(struct timeval *,
98 const struct compat_timeval __user *);
99extern int put_compat_timeval(const struct timeval *,
100 struct compat_timeval __user *);
101/*
102 * These functions operate on 32- or 64-bit specs depending on
103 * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the
104 * naming as compat_get/put_ rather than get/put_compat_.
105 */
106extern int compat_get_timespec(struct timespec *, const void __user *);
107extern int compat_put_timespec(const struct timespec *, void __user *);
108extern int compat_get_timeval(struct timeval *, const void __user *);
109extern int compat_put_timeval(const struct timeval *, void __user *);
90 110
91struct compat_iovec { 111struct compat_iovec {
92 compat_uptr_t iov_base; 112 compat_uptr_t iov_base;
@@ -224,6 +244,7 @@ struct compat_sysinfo;
224struct compat_sysctl_args; 244struct compat_sysctl_args;
225struct compat_kexec_segment; 245struct compat_kexec_segment;
226struct compat_mq_attr; 246struct compat_mq_attr;
247struct compat_msgbuf;
227 248
228extern void compat_exit_robust_list(struct task_struct *curr); 249extern void compat_exit_robust_list(struct task_struct *curr);
229 250
@@ -234,13 +255,22 @@ asmlinkage long
234compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, 255compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
235 compat_size_t __user *len_ptr); 256 compat_size_t __user *len_ptr);
236 257
258#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
237long compat_sys_semctl(int first, int second, int third, void __user *uptr); 259long compat_sys_semctl(int first, int second, int third, void __user *uptr);
238long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); 260long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
239long compat_sys_msgrcv(int first, int second, int msgtyp, int third, 261long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
240 int version, void __user *uptr); 262 int version, void __user *uptr);
241long compat_sys_msgctl(int first, int second, void __user *uptr);
242long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, 263long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
243 void __user *uptr); 264 void __user *uptr);
265#else
266long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
267long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
268 size_t msgsz, int msgflg);
269long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp,
270 size_t msgsz, long msgtyp, int msgflg);
271long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
272#endif
273long compat_sys_msgctl(int first, int second, void __user *uptr);
244long compat_sys_shmctl(int first, int second, void __user *uptr); 274long compat_sys_shmctl(int first, int second, void __user *uptr);
245long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, 275long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
246 unsigned nsems, const struct compat_timespec __user *timeout); 276 unsigned nsems, const struct compat_timespec __user *timeout);
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 712abcc205ae..6c26a3da0e03 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -15,6 +15,7 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/completion.h> 17#include <linux/completion.h>
18#include <linux/hrtimer.h>
18 19
19#define CPUIDLE_STATE_MAX 8 20#define CPUIDLE_STATE_MAX 8
20#define CPUIDLE_NAME_LEN 16 21#define CPUIDLE_NAME_LEN 16
@@ -43,12 +44,15 @@ struct cpuidle_state {
43 44
44 unsigned int flags; 45 unsigned int flags;
45 unsigned int exit_latency; /* in US */ 46 unsigned int exit_latency; /* in US */
46 unsigned int power_usage; /* in mW */ 47 int power_usage; /* in mW */
47 unsigned int target_residency; /* in US */ 48 unsigned int target_residency; /* in US */
49 unsigned int disable;
48 50
49 int (*enter) (struct cpuidle_device *dev, 51 int (*enter) (struct cpuidle_device *dev,
50 struct cpuidle_driver *drv, 52 struct cpuidle_driver *drv,
51 int index); 53 int index);
54
55 int (*enter_dead) (struct cpuidle_device *dev, int index);
52}; 56};
53 57
54/* Idle State Flags */ 58/* Idle State Flags */
@@ -96,7 +100,6 @@ struct cpuidle_device {
96 struct list_head device_list; 100 struct list_head device_list;
97 struct kobject kobj; 101 struct kobject kobj;
98 struct completion kobj_unregister; 102 struct completion kobj_unregister;
99 void *governor_data;
100}; 103};
101 104
102DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 105DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
@@ -118,10 +121,12 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
118 ****************************/ 121 ****************************/
119 122
120struct cpuidle_driver { 123struct cpuidle_driver {
121 char name[CPUIDLE_NAME_LEN]; 124 const char *name;
122 struct module *owner; 125 struct module *owner;
123 126
124 unsigned int power_specified:1; 127 unsigned int power_specified:1;
128 /* set to 1 to use the core cpuidle time keeping (for all states). */
129 unsigned int en_core_tk_irqen:1;
125 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 130 struct cpuidle_state states[CPUIDLE_STATE_MAX];
126 int state_count; 131 int state_count;
127 int safe_state_index; 132 int safe_state_index;
@@ -140,6 +145,11 @@ extern void cpuidle_pause_and_lock(void);
140extern void cpuidle_resume_and_unlock(void); 145extern void cpuidle_resume_and_unlock(void);
141extern int cpuidle_enable_device(struct cpuidle_device *dev); 146extern int cpuidle_enable_device(struct cpuidle_device *dev);
142extern void cpuidle_disable_device(struct cpuidle_device *dev); 147extern void cpuidle_disable_device(struct cpuidle_device *dev);
148extern int cpuidle_wrap_enter(struct cpuidle_device *dev,
149 struct cpuidle_driver *drv, int index,
150 int (*enter)(struct cpuidle_device *dev,
151 struct cpuidle_driver *drv, int index));
152extern int cpuidle_play_dead(void);
143 153
144#else 154#else
145static inline void disable_cpuidle(void) { } 155static inline void disable_cpuidle(void) { }
@@ -157,6 +167,12 @@ static inline void cpuidle_resume_and_unlock(void) { }
157static inline int cpuidle_enable_device(struct cpuidle_device *dev) 167static inline int cpuidle_enable_device(struct cpuidle_device *dev)
158{return -ENODEV; } 168{return -ENODEV; }
159static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 169static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
170static inline int cpuidle_wrap_enter(struct cpuidle_device *dev,
171 struct cpuidle_driver *drv, int index,
172 int (*enter)(struct cpuidle_device *dev,
173 struct cpuidle_driver *drv, int index))
174{ return -ENODEV; }
175static inline int cpuidle_play_dead(void) {return -ENODEV; }
160 176
161#endif 177#endif
162 178
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 7b9b75a529be..a2c819d3c96e 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -764,12 +764,6 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
764 * 764 *
765 */ 765 */
766#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS 766#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
767/* These strip const, as traditionally they weren't const. */
768#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
769#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
770#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
771#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
772
773#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu)) 767#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
774 768
775#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) 769#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
@@ -810,11 +804,10 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
810#else /* NR_CPUS > 1 */ 804#else /* NR_CPUS > 1 */
811int __first_cpu(const cpumask_t *srcp); 805int __first_cpu(const cpumask_t *srcp);
812int __next_cpu(int n, const cpumask_t *srcp); 806int __next_cpu(int n, const cpumask_t *srcp);
813int __any_online_cpu(const cpumask_t *mask);
814 807
815#define first_cpu(src) __first_cpu(&(src)) 808#define first_cpu(src) __first_cpu(&(src))
816#define next_cpu(n, src) __next_cpu((n), &(src)) 809#define next_cpu(n, src) __next_cpu((n), &(src))
817#define any_online_cpu(mask) __any_online_cpu(&(mask)) 810#define any_online_cpu(mask) cpumask_any_and(&mask, cpu_online_mask)
818#define for_each_cpu_mask(cpu, mask) \ 811#define for_each_cpu_mask(cpu, mask) \
819 for ((cpu) = -1; \ 812 for ((cpu) = -1; \
820 (cpu) = next_cpu((cpu), (mask)), \ 813 (cpu) = next_cpu((cpu), (mask)), \
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 7a7e5fd2a277..668f66baac7b 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -22,7 +22,7 @@ extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern void cpuset_update_active_cpus(void); 23extern void cpuset_update_active_cpus(void);
24extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 24extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
25extern int cpuset_cpus_allowed_fallback(struct task_struct *p); 25extern void cpuset_cpus_allowed_fallback(struct task_struct *p);
26extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
27#define cpuset_current_mems_allowed (current->mems_allowed) 27#define cpuset_current_mems_allowed (current->mems_allowed)
28void cpuset_init_current_mems_allowed(void); 28void cpuset_init_current_mems_allowed(void);
@@ -135,10 +135,8 @@ static inline void cpuset_cpus_allowed(struct task_struct *p,
135 cpumask_copy(mask, cpu_possible_mask); 135 cpumask_copy(mask, cpu_possible_mask);
136} 136}
137 137
138static inline int cpuset_cpus_allowed_fallback(struct task_struct *p) 138static inline void cpuset_cpus_allowed_fallback(struct task_struct *p)
139{ 139{
140 do_set_cpus_allowed(p, cpu_possible_mask);
141 return cpumask_any(cpu_active_mask);
142} 140}
143 141
144static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) 142static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
diff --git a/include/linux/cryptouser.h b/include/linux/cryptouser.h
index 532fb58f16bf..4abf2ea6a887 100644
--- a/include/linux/cryptouser.h
+++ b/include/linux/cryptouser.h
@@ -100,3 +100,6 @@ struct crypto_report_rng {
100 char type[CRYPTO_MAX_NAME]; 100 char type[CRYPTO_MAX_NAME];
101 unsigned int seedsize; 101 unsigned int seedsize;
102}; 102};
103
104#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
105 sizeof(struct crypto_report_blkcipher))
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 94f20c1488a1..3bd46f766751 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -4,7 +4,6 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/atomic.h> 5#include <linux/atomic.h>
6#include <linux/bug.h> 6#include <linux/bug.h>
7#include <asm/system.h>
8 7
9struct task_struct; 8struct task_struct;
10 9
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index 71ad34eca6e3..547ab568d3ae 100644
--- a/include/linux/dma-attrs.h
+++ b/include/linux/dma-attrs.h
@@ -13,6 +13,8 @@
13enum dma_attr { 13enum dma_attr {
14 DMA_ATTR_WRITE_BARRIER, 14 DMA_ATTR_WRITE_BARRIER,
15 DMA_ATTR_WEAK_ORDERING, 15 DMA_ATTR_WEAK_ORDERING,
16 DMA_ATTR_WRITE_COMBINE,
17 DMA_ATTR_NON_CONSISTENT,
16 DMA_ATTR_MAX, 18 DMA_ATTR_MAX,
17}; 19};
18 20
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 887dcd487062..3efbfc2145c3 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -29,6 +29,7 @@
29#include <linux/scatterlist.h> 29#include <linux/scatterlist.h>
30#include <linux/list.h> 30#include <linux/list.h>
31#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
32#include <linux/fs.h>
32 33
33struct device; 34struct device;
34struct dma_buf; 35struct dma_buf;
@@ -49,6 +50,17 @@ struct dma_buf_attachment;
49 * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter 50 * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
50 * pages. 51 * pages.
51 * @release: release this buffer; to be called after the last dma_buf_put. 52 * @release: release this buffer; to be called after the last dma_buf_put.
53 * @begin_cpu_access: [optional] called before cpu access to invalidate cpu
54 * caches and allocate backing storage (if not yet done)
55 * respectively pin the objet into memory.
56 * @end_cpu_access: [optional] called after cpu access to flush cashes.
57 * @kmap_atomic: maps a page from the buffer into kernel address
58 * space, users may not block until the subsequent unmap call.
59 * This callback must not sleep.
60 * @kunmap_atomic: [optional] unmaps a atomically mapped page from the buffer.
61 * This Callback must not sleep.
62 * @kmap: maps a page from the buffer into kernel address space.
63 * @kunmap: [optional] unmaps a page from the buffer.
52 */ 64 */
53struct dma_buf_ops { 65struct dma_buf_ops {
54 int (*attach)(struct dma_buf *, struct device *, 66 int (*attach)(struct dma_buf *, struct device *,
@@ -63,7 +75,8 @@ struct dma_buf_ops {
63 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *, 75 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
64 enum dma_data_direction); 76 enum dma_data_direction);
65 void (*unmap_dma_buf)(struct dma_buf_attachment *, 77 void (*unmap_dma_buf)(struct dma_buf_attachment *,
66 struct sg_table *); 78 struct sg_table *,
79 enum dma_data_direction);
67 /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY 80 /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
68 * if the call would block. 81 * if the call would block.
69 */ 82 */
@@ -71,6 +84,14 @@ struct dma_buf_ops {
71 /* after final dma_buf_put() */ 84 /* after final dma_buf_put() */
72 void (*release)(struct dma_buf *); 85 void (*release)(struct dma_buf *);
73 86
87 int (*begin_cpu_access)(struct dma_buf *, size_t, size_t,
88 enum dma_data_direction);
89 void (*end_cpu_access)(struct dma_buf *, size_t, size_t,
90 enum dma_data_direction);
91 void *(*kmap_atomic)(struct dma_buf *, unsigned long);
92 void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *);
93 void *(*kmap)(struct dma_buf *, unsigned long);
94 void (*kunmap)(struct dma_buf *, unsigned long, void *);
74}; 95};
75 96
76/** 97/**
@@ -86,7 +107,7 @@ struct dma_buf {
86 struct file *file; 107 struct file *file;
87 struct list_head attachments; 108 struct list_head attachments;
88 const struct dma_buf_ops *ops; 109 const struct dma_buf_ops *ops;
89 /* mutex to serialize list manipulation and other ops */ 110 /* mutex to serialize list manipulation and attach/detach */
90 struct mutex lock; 111 struct mutex lock;
91 void *priv; 112 void *priv;
92}; 113};
@@ -109,20 +130,43 @@ struct dma_buf_attachment {
109 void *priv; 130 void *priv;
110}; 131};
111 132
133/**
134 * get_dma_buf - convenience wrapper for get_file.
135 * @dmabuf: [in] pointer to dma_buf
136 *
137 * Increments the reference count on the dma-buf, needed in case of drivers
138 * that either need to create additional references to the dmabuf on the
139 * kernel side. For example, an exporter that needs to keep a dmabuf ptr
140 * so that subsequent exports don't create a new dmabuf.
141 */
142static inline void get_dma_buf(struct dma_buf *dmabuf)
143{
144 get_file(dmabuf->file);
145}
146
112#ifdef CONFIG_DMA_SHARED_BUFFER 147#ifdef CONFIG_DMA_SHARED_BUFFER
113struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, 148struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
114 struct device *dev); 149 struct device *dev);
115void dma_buf_detach(struct dma_buf *dmabuf, 150void dma_buf_detach(struct dma_buf *dmabuf,
116 struct dma_buf_attachment *dmabuf_attach); 151 struct dma_buf_attachment *dmabuf_attach);
117struct dma_buf *dma_buf_export(void *priv, struct dma_buf_ops *ops, 152struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops,
118 size_t size, int flags); 153 size_t size, int flags);
119int dma_buf_fd(struct dma_buf *dmabuf); 154int dma_buf_fd(struct dma_buf *dmabuf, int flags);
120struct dma_buf *dma_buf_get(int fd); 155struct dma_buf *dma_buf_get(int fd);
121void dma_buf_put(struct dma_buf *dmabuf); 156void dma_buf_put(struct dma_buf *dmabuf);
122 157
123struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *, 158struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
124 enum dma_data_direction); 159 enum dma_data_direction);
125void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *); 160void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *,
161 enum dma_data_direction);
162int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, size_t start, size_t len,
163 enum dma_data_direction dir);
164void dma_buf_end_cpu_access(struct dma_buf *dma_buf, size_t start, size_t len,
165 enum dma_data_direction dir);
166void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long);
167void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);
168void *dma_buf_kmap(struct dma_buf *, unsigned long);
169void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);
126#else 170#else
127 171
128static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, 172static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
@@ -138,13 +182,13 @@ static inline void dma_buf_detach(struct dma_buf *dmabuf,
138} 182}
139 183
140static inline struct dma_buf *dma_buf_export(void *priv, 184static inline struct dma_buf *dma_buf_export(void *priv,
141 struct dma_buf_ops *ops, 185 const struct dma_buf_ops *ops,
142 size_t size, int flags) 186 size_t size, int flags)
143{ 187{
144 return ERR_PTR(-ENODEV); 188 return ERR_PTR(-ENODEV);
145} 189}
146 190
147static inline int dma_buf_fd(struct dma_buf *dmabuf) 191static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags)
148{ 192{
149 return -ENODEV; 193 return -ENODEV;
150} 194}
@@ -166,11 +210,44 @@ static inline struct sg_table *dma_buf_map_attachment(
166} 210}
167 211
168static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, 212static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
169 struct sg_table *sg) 213 struct sg_table *sg, enum dma_data_direction dir)
170{ 214{
171 return; 215 return;
172} 216}
173 217
218static inline int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
219 size_t start, size_t len,
220 enum dma_data_direction dir)
221{
222 return -ENODEV;
223}
224
225static inline void dma_buf_end_cpu_access(struct dma_buf *dmabuf,
226 size_t start, size_t len,
227 enum dma_data_direction dir)
228{
229}
230
231static inline void *dma_buf_kmap_atomic(struct dma_buf *dmabuf,
232 unsigned long pnum)
233{
234 return NULL;
235}
236
237static inline void dma_buf_kunmap_atomic(struct dma_buf *dmabuf,
238 unsigned long pnum, void *vaddr)
239{
240}
241
242static inline void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long pnum)
243{
244 return NULL;
245}
246
247static inline void dma_buf_kunmap(struct dma_buf *dmabuf,
248 unsigned long pnum, void *vaddr)
249{
250}
174#endif /* CONFIG_DMA_SHARED_BUFFER */ 251#endif /* CONFIG_DMA_SHARED_BUFFER */
175 252
176#endif /* __DMA_BUF_H__ */ 253#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index e13117cbd2f7..dfc099e56a66 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -9,10 +9,15 @@
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10 10
11struct dma_map_ops { 11struct dma_map_ops {
12 void* (*alloc_coherent)(struct device *dev, size_t size, 12 void* (*alloc)(struct device *dev, size_t size,
13 dma_addr_t *dma_handle, gfp_t gfp); 13 dma_addr_t *dma_handle, gfp_t gfp,
14 void (*free_coherent)(struct device *dev, size_t size, 14 struct dma_attrs *attrs);
15 void *vaddr, dma_addr_t dma_handle); 15 void (*free)(struct device *dev, size_t size,
16 void *vaddr, dma_addr_t dma_handle,
17 struct dma_attrs *attrs);
18 int (*mmap)(struct device *, struct vm_area_struct *,
19 void *, dma_addr_t, size_t, struct dma_attrs *attrs);
20
16 dma_addr_t (*map_page)(struct device *dev, struct page *page, 21 dma_addr_t (*map_page)(struct device *dev, struct page *page,
17 unsigned long offset, size_t size, 22 unsigned long offset, size_t size,
18 enum dma_data_direction dir, 23 enum dma_data_direction dir,
@@ -77,7 +82,7 @@ static inline u64 dma_get_mask(struct device *dev)
77 return DMA_BIT_MASK(32); 82 return DMA_BIT_MASK(32);
78} 83}
79 84
80#ifdef ARCH_HAS_DMA_SET_COHERENT_MASK 85#ifdef CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK
81int dma_set_coherent_mask(struct device *dev, u64 mask); 86int dma_set_coherent_mask(struct device *dev, u64 mask);
82#else 87#else
83static inline int dma_set_coherent_mask(struct device *dev, u64 mask) 88static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index a5966f691ef8..676f967390ae 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -18,14 +18,15 @@
18 * The full GNU General Public License is included in this distribution in the 18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING. 19 * file called COPYING.
20 */ 20 */
21#ifndef DMAENGINE_H 21#ifndef LINUX_DMAENGINE_H
22#define DMAENGINE_H 22#define LINUX_DMAENGINE_H
23 23
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/bug.h> 26#include <linux/bug.h>
27#include <linux/scatterlist.h> 27#include <linux/scatterlist.h>
28#include <linux/bitmap.h> 28#include <linux/bitmap.h>
29#include <linux/types.h>
29#include <asm/page.h> 30#include <asm/page.h>
30 31
31/** 32/**
@@ -258,6 +259,7 @@ struct dma_chan_percpu {
258 * struct dma_chan - devices supply DMA channels, clients use them 259 * struct dma_chan - devices supply DMA channels, clients use them
259 * @device: ptr to the dma device who supplies this channel, always !%NULL 260 * @device: ptr to the dma device who supplies this channel, always !%NULL
260 * @cookie: last cookie value returned to client 261 * @cookie: last cookie value returned to client
262 * @completed_cookie: last completed cookie for this channel
261 * @chan_id: channel ID for sysfs 263 * @chan_id: channel ID for sysfs
262 * @dev: class device for sysfs 264 * @dev: class device for sysfs
263 * @device_node: used to add this to the device chan list 265 * @device_node: used to add this to the device chan list
@@ -269,6 +271,7 @@ struct dma_chan_percpu {
269struct dma_chan { 271struct dma_chan {
270 struct dma_device *device; 272 struct dma_device *device;
271 dma_cookie_t cookie; 273 dma_cookie_t cookie;
274 dma_cookie_t completed_cookie;
272 275
273 /* sysfs */ 276 /* sysfs */
274 int chan_id; 277 int chan_id;
@@ -332,6 +335,9 @@ enum dma_slave_buswidth {
332 * may or may not be applicable on memory sources. 335 * may or may not be applicable on memory sources.
333 * @dst_maxburst: same as src_maxburst but for destination target 336 * @dst_maxburst: same as src_maxburst but for destination target
334 * mutatis mutandis. 337 * mutatis mutandis.
338 * @device_fc: Flow Controller Settings. Only valid for slave channels. Fill
339 * with 'true' if peripheral should be flow controller. Direction will be
340 * selected at Runtime.
335 * 341 *
336 * This struct is passed in as configuration data to a DMA engine 342 * This struct is passed in as configuration data to a DMA engine
337 * in order to set up a certain channel for DMA transport at runtime. 343 * in order to set up a certain channel for DMA transport at runtime.
@@ -358,6 +364,7 @@ struct dma_slave_config {
358 enum dma_slave_buswidth dst_addr_width; 364 enum dma_slave_buswidth dst_addr_width;
359 u32 src_maxburst; 365 u32 src_maxburst;
360 u32 dst_maxburst; 366 u32 dst_maxburst;
367 bool device_fc;
361}; 368};
362 369
363static inline const char *dma_chan_name(struct dma_chan *chan) 370static inline const char *dma_chan_name(struct dma_chan *chan)
@@ -576,10 +583,11 @@ struct dma_device {
576 struct dma_async_tx_descriptor *(*device_prep_slave_sg)( 583 struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
577 struct dma_chan *chan, struct scatterlist *sgl, 584 struct dma_chan *chan, struct scatterlist *sgl,
578 unsigned int sg_len, enum dma_transfer_direction direction, 585 unsigned int sg_len, enum dma_transfer_direction direction,
579 unsigned long flags); 586 unsigned long flags, void *context);
580 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 587 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
581 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 588 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
582 size_t period_len, enum dma_transfer_direction direction); 589 size_t period_len, enum dma_transfer_direction direction,
590 void *context);
583 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( 591 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
584 struct dma_chan *chan, struct dma_interleaved_template *xt, 592 struct dma_chan *chan, struct dma_interleaved_template *xt,
585 unsigned long flags); 593 unsigned long flags);
@@ -613,7 +621,24 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
613 struct scatterlist sg; 621 struct scatterlist sg;
614 sg_init_one(&sg, buf, len); 622 sg_init_one(&sg, buf, len);
615 623
616 return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags); 624 return chan->device->device_prep_slave_sg(chan, &sg, 1,
625 dir, flags, NULL);
626}
627
628static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
629 struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
630 enum dma_transfer_direction dir, unsigned long flags)
631{
632 return chan->device->device_prep_slave_sg(chan, sgl, sg_len,
633 dir, flags, NULL);
634}
635
636static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
637 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
638 size_t period_len, enum dma_transfer_direction dir)
639{
640 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
641 period_len, dir, NULL);
617} 642}
618 643
619static inline int dmaengine_terminate_all(struct dma_chan *chan) 644static inline int dmaengine_terminate_all(struct dma_chan *chan)
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index f2c64f92c4a0..2412e02d7c0f 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -31,18 +31,6 @@ struct dw_dma_platform_data {
31 unsigned char chan_priority; 31 unsigned char chan_priority;
32}; 32};
33 33
34/**
35 * enum dw_dma_slave_width - DMA slave register access width.
36 * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
37 * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
38 * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
39 */
40enum dw_dma_slave_width {
41 DW_DMA_SLAVE_WIDTH_8BIT,
42 DW_DMA_SLAVE_WIDTH_16BIT,
43 DW_DMA_SLAVE_WIDTH_32BIT,
44};
45
46/* bursts size */ 34/* bursts size */
47enum dw_dma_msize { 35enum dw_dma_msize {
48 DW_DMA_MSIZE_1, 36 DW_DMA_MSIZE_1,
@@ -55,47 +43,21 @@ enum dw_dma_msize {
55 DW_DMA_MSIZE_256, 43 DW_DMA_MSIZE_256,
56}; 44};
57 45
58/* flow controller */
59enum dw_dma_fc {
60 DW_DMA_FC_D_M2M,
61 DW_DMA_FC_D_M2P,
62 DW_DMA_FC_D_P2M,
63 DW_DMA_FC_D_P2P,
64 DW_DMA_FC_P_P2M,
65 DW_DMA_FC_SP_P2P,
66 DW_DMA_FC_P_M2P,
67 DW_DMA_FC_DP_P2P,
68};
69
70/** 46/**
71 * struct dw_dma_slave - Controller-specific information about a slave 47 * struct dw_dma_slave - Controller-specific information about a slave
72 * 48 *
73 * @dma_dev: required DMA master device 49 * @dma_dev: required DMA master device
74 * @tx_reg: physical address of data register used for
75 * memory-to-peripheral transfers
76 * @rx_reg: physical address of data register used for
77 * peripheral-to-memory transfers
78 * @reg_width: peripheral register width
79 * @cfg_hi: Platform-specific initializer for the CFG_HI register 50 * @cfg_hi: Platform-specific initializer for the CFG_HI register
80 * @cfg_lo: Platform-specific initializer for the CFG_LO register 51 * @cfg_lo: Platform-specific initializer for the CFG_LO register
81 * @src_master: src master for transfers on allocated channel. 52 * @src_master: src master for transfers on allocated channel.
82 * @dst_master: dest master for transfers on allocated channel. 53 * @dst_master: dest master for transfers on allocated channel.
83 * @src_msize: src burst size.
84 * @dst_msize: dest burst size.
85 * @fc: flow controller for DMA transfer
86 */ 54 */
87struct dw_dma_slave { 55struct dw_dma_slave {
88 struct device *dma_dev; 56 struct device *dma_dev;
89 dma_addr_t tx_reg;
90 dma_addr_t rx_reg;
91 enum dw_dma_slave_width reg_width;
92 u32 cfg_hi; 57 u32 cfg_hi;
93 u32 cfg_lo; 58 u32 cfg_lo;
94 u8 src_master; 59 u8 src_master;
95 u8 dst_master; 60 u8 dst_master;
96 u8 src_msize;
97 u8 dst_msize;
98 u8 fc;
99}; 61};
100 62
101/* Platform-configurable bits in CFG_HI */ 63/* Platform-configurable bits in CFG_HI */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index ba317e2930a1..c621d762bb2c 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -70,25 +70,64 @@ enum dev_type {
70#define DEV_FLAG_X32 BIT(DEV_X32) 70#define DEV_FLAG_X32 BIT(DEV_X32)
71#define DEV_FLAG_X64 BIT(DEV_X64) 71#define DEV_FLAG_X64 BIT(DEV_X64)
72 72
73/* memory types */ 73/**
74 * enum mem_type - memory types. For a more detailed reference, please see
75 * http://en.wikipedia.org/wiki/DRAM
76 *
77 * @MEM_EMPTY Empty csrow
78 * @MEM_RESERVED: Reserved csrow type
79 * @MEM_UNKNOWN: Unknown csrow type
80 * @MEM_FPM: FPM - Fast Page Mode, used on systems up to 1995.
81 * @MEM_EDO: EDO - Extended data out, used on systems up to 1998.
82 * @MEM_BEDO: BEDO - Burst Extended data out, an EDO variant.
83 * @MEM_SDR: SDR - Single data rate SDRAM
84 * http://en.wikipedia.org/wiki/Synchronous_dynamic_random-access_memory
85 * They use 3 pins for chip select: Pins 0 and 2 are
86 * for rank 0; pins 1 and 3 are for rank 1, if the memory
87 * is dual-rank.
88 * @MEM_RDR: Registered SDR SDRAM
89 * @MEM_DDR: Double data rate SDRAM
90 * http://en.wikipedia.org/wiki/DDR_SDRAM
91 * @MEM_RDDR: Registered Double data rate SDRAM
92 * This is a variant of the DDR memories.
93 * A registered memory has a buffer inside it, hiding
94 * part of the memory details to the memory controller.
95 * @MEM_RMBS: Rambus DRAM, used on a few Pentium III/IV controllers.
96 * @MEM_DDR2: DDR2 RAM, as described at JEDEC JESD79-2F.
97 * Those memories are labed as "PC2-" instead of "PC" to
98 * differenciate from DDR.
99 * @MEM_FB_DDR2: Fully-Buffered DDR2, as described at JEDEC Std No. 205
100 * and JESD206.
101 * Those memories are accessed per DIMM slot, and not by
102 * a chip select signal.
103 * @MEM_RDDR2: Registered DDR2 RAM
104 * This is a variant of the DDR2 memories.
105 * @MEM_XDR: Rambus XDR
106 * It is an evolution of the original RAMBUS memories,
107 * created to compete with DDR2. Weren't used on any
108 * x86 arch, but cell_edac PPC memory controller uses it.
109 * @MEM_DDR3: DDR3 RAM
110 * @MEM_RDDR3: Registered DDR3 RAM
111 * This is a variant of the DDR3 memories.
112 */
74enum mem_type { 113enum mem_type {
75 MEM_EMPTY = 0, /* Empty csrow */ 114 MEM_EMPTY = 0,
76 MEM_RESERVED, /* Reserved csrow type */ 115 MEM_RESERVED,
77 MEM_UNKNOWN, /* Unknown csrow type */ 116 MEM_UNKNOWN,
78 MEM_FPM, /* Fast page mode */ 117 MEM_FPM,
79 MEM_EDO, /* Extended data out */ 118 MEM_EDO,
80 MEM_BEDO, /* Burst Extended data out */ 119 MEM_BEDO,
81 MEM_SDR, /* Single data rate SDRAM */ 120 MEM_SDR,
82 MEM_RDR, /* Registered single data rate SDRAM */ 121 MEM_RDR,
83 MEM_DDR, /* Double data rate SDRAM */ 122 MEM_DDR,
84 MEM_RDDR, /* Registered Double data rate SDRAM */ 123 MEM_RDDR,
85 MEM_RMBS, /* Rambus DRAM */ 124 MEM_RMBS,
86 MEM_DDR2, /* DDR2 RAM */ 125 MEM_DDR2,
87 MEM_FB_DDR2, /* fully buffered DDR2 */ 126 MEM_FB_DDR2,
88 MEM_RDDR2, /* Registered DDR2 RAM */ 127 MEM_RDDR2,
89 MEM_XDR, /* Rambus XDR */ 128 MEM_XDR,
90 MEM_DDR3, /* DDR3 RAM */ 129 MEM_DDR3,
91 MEM_RDDR3, /* Registered DDR3 RAM */ 130 MEM_RDDR3,
92}; 131};
93 132
94#define MEM_FLAG_EMPTY BIT(MEM_EMPTY) 133#define MEM_FLAG_EMPTY BIT(MEM_EMPTY)
@@ -166,8 +205,9 @@ enum scrub_type {
166#define OP_OFFLINE 0x300 205#define OP_OFFLINE 0x300
167 206
168/* 207/*
169 * There are several things to be aware of that aren't at all obvious: 208 * Concepts used at the EDAC subsystem
170 * 209 *
210 * There are several things to be aware of that aren't at all obvious:
171 * 211 *
172 * SOCKETS, SOCKET SETS, BANKS, ROWS, CHIP-SELECT ROWS, CHANNELS, etc.. 212 * SOCKETS, SOCKET SETS, BANKS, ROWS, CHIP-SELECT ROWS, CHANNELS, etc..
173 * 213 *
@@ -176,36 +216,61 @@ enum scrub_type {
176 * creating a common ground for discussion, terms and their definitions 216 * creating a common ground for discussion, terms and their definitions
177 * will be established. 217 * will be established.
178 * 218 *
179 * Memory devices: The individual chip on a memory stick. These devices 219 * Memory devices: The individual DRAM chips on a memory stick. These
180 * commonly output 4 and 8 bits each. Grouping several 220 * devices commonly output 4 and 8 bits each (x4, x8).
181 * of these in parallel provides 64 bits which is common 221 * Grouping several of these in parallel provides the
182 * for a memory stick. 222 * number of bits that the memory controller expects:
223 * typically 72 bits, in order to provide 64 bits +
224 * 8 bits of ECC data.
183 * 225 *
184 * Memory Stick: A printed circuit board that aggregates multiple 226 * Memory Stick: A printed circuit board that aggregates multiple
185 * memory devices in parallel. This is the atomic 227 * memory devices in parallel. In general, this is the
186 * memory component that is purchaseable by Joe consumer 228 * Field Replaceable Unit (FRU) which gets replaced, in
187 * and loaded into a memory socket. 229 * the case of excessive errors. Most often it is also
230 * called DIMM (Dual Inline Memory Module).
231 *
232 * Memory Socket: A physical connector on the motherboard that accepts
233 * a single memory stick. Also called as "slot" on several
234 * datasheets.
188 * 235 *
189 * Socket: A physical connector on the motherboard that accepts 236 * Channel: A memory controller channel, responsible to communicate
190 * a single memory stick. 237 * with a group of DIMMs. Each channel has its own
238 * independent control (command) and data bus, and can
239 * be used independently or grouped with other channels.
191 * 240 *
192 * Channel: Set of memory devices on a memory stick that must be 241 * Branch: It is typically the highest hierarchy on a
193 * grouped in parallel with one or more additional 242 * Fully-Buffered DIMM memory controller.
194 * channels from other memory sticks. This parallel 243 * Typically, it contains two channels.
195 * grouping of the output from multiple channels are 244 * Two channels at the same branch can be used in single
196 * necessary for the smallest granularity of memory access. 245 * mode or in lockstep mode.
197 * Some memory controllers are capable of single channel - 246 * When lockstep is enabled, the cacheline is doubled,
198 * which means that memory sticks can be loaded 247 * but it generally brings some performance penalty.
199 * individually. Other memory controllers are only 248 * Also, it is generally not possible to point to just one
200 * capable of dual channel - which means that memory 249 * memory stick when an error occurs, as the error
201 * sticks must be loaded as pairs (see "socket set"). 250 * correction code is calculated using two DIMMs instead
251 * of one. Due to that, it is capable of correcting more
252 * errors than on single mode.
202 * 253 *
203 * Chip-select row: All of the memory devices that are selected together. 254 * Single-channel: The data accessed by the memory controller is contained
204 * for a single, minimum grain of memory access. 255 * into one dimm only. E. g. if the data is 64 bits-wide,
205 * This selects all of the parallel memory devices across 256 * the data flows to the CPU using one 64 bits parallel
206 * all of the parallel channels. Common chip-select rows 257 * access.
207 * for single channel are 64 bits, for dual channel 128 258 * Typically used with SDR, DDR, DDR2 and DDR3 memories.
208 * bits. 259 * FB-DIMM and RAMBUS use a different concept for channel,
260 * so this concept doesn't apply there.
261 *
262 * Double-channel: The data size accessed by the memory controller is
263 * interlaced into two dimms, accessed at the same time.
264 * E. g. if the DIMM is 64 bits-wide (72 bits with ECC),
265 * the data flows to the CPU using a 128 bits parallel
266 * access.
267 *
268 * Chip-select row: This is the name of the DRAM signal used to select the
269 * DRAM ranks to be accessed. Common chip-select rows for
270 * single channel are 64 bits, for dual channel 128 bits.
271 * It may not be visible by the memory controller, as some
272 * DIMM types have a memory buffer that can hide direct
273 * access to it from the Memory Controller.
209 * 274 *
210 * Single-Ranked stick: A Single-ranked stick has 1 chip-select row of memory. 275 * Single-Ranked stick: A Single-ranked stick has 1 chip-select row of memory.
211 * Motherboards commonly drive two chip-select pins to 276 * Motherboards commonly drive two chip-select pins to
@@ -218,8 +283,8 @@ enum scrub_type {
218 * 283 *
219 * Double-sided stick: DEPRECATED TERM, see Double-Ranked stick. 284 * Double-sided stick: DEPRECATED TERM, see Double-Ranked stick.
220 * A double-sided stick has two chip-select rows which 285 * A double-sided stick has two chip-select rows which
221 * access different sets of memory devices. The two 286 * access different sets of memory devices. The two
222 * rows cannot be accessed concurrently. "Double-sided" 287 * rows cannot be accessed concurrently. "Double-sided"
223 * is irrespective of the memory devices being mounted 288 * is irrespective of the memory devices being mounted
224 * on both sides of the memory stick. 289 * on both sides of the memory stick.
225 * 290 *
@@ -247,10 +312,22 @@ enum scrub_type {
247 * PS - I enjoyed writing all that about as much as you enjoyed reading it. 312 * PS - I enjoyed writing all that about as much as you enjoyed reading it.
248 */ 313 */
249 314
250struct channel_info { 315/**
251 int chan_idx; /* channel index */ 316 * struct rank_info - contains the information for one DIMM rank
252 u32 ce_count; /* Correctable Errors for this CHANNEL */ 317 *
253 char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */ 318 * @chan_idx: channel number where the rank is (typically, 0 or 1)
319 * @ce_count: number of correctable errors for this rank
320 * @label: DIMM label. Different ranks for the same DIMM should be
321 * filled, on userspace, with the same label.
322 * FIXME: The core currently won't enforce it.
323 * @csrow: A pointer to the chip select row structure (the parent
324 * structure). The location of the rank is given by
325 * the (csrow->csrow_idx, chan_idx) vector.
326 */
327struct rank_info {
328 int chan_idx;
329 u32 ce_count;
330 char label[EDAC_MC_LABEL_LEN + 1];
254 struct csrow_info *csrow; /* the parent */ 331 struct csrow_info *csrow; /* the parent */
255}; 332};
256 333
@@ -274,7 +351,7 @@ struct csrow_info {
274 351
275 /* channel information for this csrow */ 352 /* channel information for this csrow */
276 u32 nr_channels; 353 u32 nr_channels;
277 struct channel_info *channels; 354 struct rank_info *channels;
278}; 355};
279 356
280struct mcidev_sysfs_group { 357struct mcidev_sysfs_group {
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 47fbf6b3dc77..88ec80670d5f 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -22,7 +22,6 @@
22#include <linux/pstore.h> 22#include <linux/pstore.h>
23 23
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/system.h>
26 25
27#define EFI_SUCCESS 0 26#define EFI_SUCCESS 0
28#define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1))) 27#define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1)))
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 560a247bde2a..89d68d837b6e 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -923,8 +923,7 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
923 * 923 *
924 * All operations are optional (i.e. the function pointer may be set 924 * All operations are optional (i.e. the function pointer may be set
925 * to %NULL) and callers must take this into account. Callers must 925 * to %NULL) and callers must take this into account. Callers must
926 * hold the RTNL, except that for @get_drvinfo the caller may or may 926 * hold the RTNL lock.
927 * not hold the RTNL.
928 * 927 *
929 * See the structures used by these operations for further documentation. 928 * See the structures used by these operations for further documentation.
930 * 929 *
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index ce1b719e8bd4..2723e715f67a 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -18,574 +18,25 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/magic.h> 20#include <linux/magic.h>
21#include <linux/fs.h>
22 21
23/* 22#define EXT2_NAME_LEN 255
24 * The second extended filesystem constants/structures
25 */
26
27/*
28 * Define EXT2FS_DEBUG to produce debug messages
29 */
30#undef EXT2FS_DEBUG
31
32/*
33 * Define EXT2_RESERVATION to reserve data blocks for expanding files
34 */
35#define EXT2_DEFAULT_RESERVE_BLOCKS 8
36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
37#define EXT2_MAX_RESERVE_BLOCKS 1027
38#define EXT2_RESERVE_WINDOW_NOT_ALLOCATED 0
39/*
40 * The second extended file system version
41 */
42#define EXT2FS_DATE "95/08/09"
43#define EXT2FS_VERSION "0.5b"
44
45/*
46 * Debug code
47 */
48#ifdef EXT2FS_DEBUG
49# define ext2_debug(f, a...) { \
50 printk ("EXT2-fs DEBUG (%s, %d): %s:", \
51 __FILE__, __LINE__, __func__); \
52 printk (f, ## a); \
53 }
54#else
55# define ext2_debug(f, a...) /**/
56#endif
57
58/*
59 * Special inode numbers
60 */
61#define EXT2_BAD_INO 1 /* Bad blocks inode */
62#define EXT2_ROOT_INO 2 /* Root inode */
63#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
64#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
65
66/* First non-reserved inode for old ext2 filesystems */
67#define EXT2_GOOD_OLD_FIRST_INO 11
68
69#ifdef __KERNEL__
70#include <linux/ext2_fs_sb.h>
71static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
72{
73 return sb->s_fs_info;
74}
75#else
76/* Assume that user mode programs are passing in an ext2fs superblock, not
77 * a kernel struct super_block. This will allow us to call the feature-test
78 * macros from user land. */
79#define EXT2_SB(sb) (sb)
80#endif
81 23
82/* 24/*
83 * Maximal count of links to a file 25 * Maximal count of links to a file
84 */ 26 */
85#define EXT2_LINK_MAX 32000 27#define EXT2_LINK_MAX 32000
86 28
87/* 29#define EXT2_SB_MAGIC_OFFSET 0x38
88 * Macro-instructions used to manage several block sizes 30#define EXT2_SB_BLOCKS_OFFSET 0x04
89 */ 31#define EXT2_SB_BSIZE_OFFSET 0x18
90#define EXT2_MIN_BLOCK_SIZE 1024
91#define EXT2_MAX_BLOCK_SIZE 4096
92#define EXT2_MIN_BLOCK_LOG_SIZE 10
93#ifdef __KERNEL__
94# define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
95#else
96# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
97#endif
98#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
99#ifdef __KERNEL__
100# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
101#else
102# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
103#endif
104#ifdef __KERNEL__
105#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits)
106#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
107#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino)
108#else
109#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
110 EXT2_GOOD_OLD_INODE_SIZE : \
111 (s)->s_inode_size)
112#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
113 EXT2_GOOD_OLD_FIRST_INO : \
114 (s)->s_first_ino)
115#endif
116 32
117/* 33static inline u64 ext2_image_size(void *ext2_sb)
118 * Macro-instructions used to manage fragments
119 */
120#define EXT2_MIN_FRAG_SIZE 1024
121#define EXT2_MAX_FRAG_SIZE 4096
122#define EXT2_MIN_FRAG_LOG_SIZE 10
123#ifdef __KERNEL__
124# define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->s_frag_size)
125# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->s_frags_per_block)
126#else
127# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
128# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
129#endif
130
131/*
132 * Structure of a blocks group descriptor
133 */
134struct ext2_group_desc
135{ 34{
136 __le32 bg_block_bitmap; /* Blocks bitmap block */ 35 __u8 *p = ext2_sb;
137 __le32 bg_inode_bitmap; /* Inodes bitmap block */ 36 if (*(__le16 *)(p + EXT2_SB_MAGIC_OFFSET) != cpu_to_le16(EXT2_SUPER_MAGIC))
138 __le32 bg_inode_table; /* Inodes table block */ 37 return 0;
139 __le16 bg_free_blocks_count; /* Free blocks count */ 38 return (u64)le32_to_cpup((__le32 *)(p + EXT2_SB_BLOCKS_OFFSET)) <<
140 __le16 bg_free_inodes_count; /* Free inodes count */ 39 le32_to_cpup((__le32 *)(p + EXT2_SB_BSIZE_OFFSET));
141 __le16 bg_used_dirs_count; /* Directories count */
142 __le16 bg_pad;
143 __le32 bg_reserved[3];
144};
145
146/*
147 * Macro-instructions used to manage group descriptors
148 */
149#ifdef __KERNEL__
150# define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
151# define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block)
152# define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
153# define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
154#else
155# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
156# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
157# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
158#endif
159
160/*
161 * Constants relative to the data blocks
162 */
163#define EXT2_NDIR_BLOCKS 12
164#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
165#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
166#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
167#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
168
169/*
170 * Inode flags (GETFLAGS/SETFLAGS)
171 */
172#define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */
173#define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */
174#define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */
175#define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
176#define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
177#define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
178#define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
179#define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
180/* Reserved for compression usage... */
181#define EXT2_DIRTY_FL FS_DIRTY_FL
182#define EXT2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */
183#define EXT2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */
184#define EXT2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */
185/* End compression flags --- maybe not all used */
186#define EXT2_BTREE_FL FS_BTREE_FL /* btree format dir */
187#define EXT2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */
188#define EXT2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */
189#define EXT2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */
190#define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
191#define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
192#define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
193#define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
194
195#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
196#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
197
198/* Flags that should be inherited by new inodes from their parent. */
199#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
200 EXT2_SYNC_FL | EXT2_NODUMP_FL |\
201 EXT2_NOATIME_FL | EXT2_COMPRBLK_FL |\
202 EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\
203 EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
204
205/* Flags that are appropriate for regular files (all but dir-specific ones). */
206#define EXT2_REG_FLMASK (~(EXT2_DIRSYNC_FL | EXT2_TOPDIR_FL))
207
208/* Flags that are appropriate for non-directories/regular files. */
209#define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL)
210
211/* Mask out flags that are inappropriate for the given type of inode. */
212static inline __u32 ext2_mask_flags(umode_t mode, __u32 flags)
213{
214 if (S_ISDIR(mode))
215 return flags;
216 else if (S_ISREG(mode))
217 return flags & EXT2_REG_FLMASK;
218 else
219 return flags & EXT2_OTHER_FLMASK;
220} 40}
221 41
222/*
223 * ioctl commands
224 */
225#define EXT2_IOC_GETFLAGS FS_IOC_GETFLAGS
226#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS
227#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION
228#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION
229#define EXT2_IOC_GETRSVSZ _IOR('f', 5, long)
230#define EXT2_IOC_SETRSVSZ _IOW('f', 6, long)
231
232/*
233 * ioctl commands in 32 bit emulation
234 */
235#define EXT2_IOC32_GETFLAGS FS_IOC32_GETFLAGS
236#define EXT2_IOC32_SETFLAGS FS_IOC32_SETFLAGS
237#define EXT2_IOC32_GETVERSION FS_IOC32_GETVERSION
238#define EXT2_IOC32_SETVERSION FS_IOC32_SETVERSION
239
240/*
241 * Structure of an inode on the disk
242 */
243struct ext2_inode {
244 __le16 i_mode; /* File mode */
245 __le16 i_uid; /* Low 16 bits of Owner Uid */
246 __le32 i_size; /* Size in bytes */
247 __le32 i_atime; /* Access time */
248 __le32 i_ctime; /* Creation time */
249 __le32 i_mtime; /* Modification time */
250 __le32 i_dtime; /* Deletion Time */
251 __le16 i_gid; /* Low 16 bits of Group Id */
252 __le16 i_links_count; /* Links count */
253 __le32 i_blocks; /* Blocks count */
254 __le32 i_flags; /* File flags */
255 union {
256 struct {
257 __le32 l_i_reserved1;
258 } linux1;
259 struct {
260 __le32 h_i_translator;
261 } hurd1;
262 struct {
263 __le32 m_i_reserved1;
264 } masix1;
265 } osd1; /* OS dependent 1 */
266 __le32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
267 __le32 i_generation; /* File version (for NFS) */
268 __le32 i_file_acl; /* File ACL */
269 __le32 i_dir_acl; /* Directory ACL */
270 __le32 i_faddr; /* Fragment address */
271 union {
272 struct {
273 __u8 l_i_frag; /* Fragment number */
274 __u8 l_i_fsize; /* Fragment size */
275 __u16 i_pad1;
276 __le16 l_i_uid_high; /* these 2 fields */
277 __le16 l_i_gid_high; /* were reserved2[0] */
278 __u32 l_i_reserved2;
279 } linux2;
280 struct {
281 __u8 h_i_frag; /* Fragment number */
282 __u8 h_i_fsize; /* Fragment size */
283 __le16 h_i_mode_high;
284 __le16 h_i_uid_high;
285 __le16 h_i_gid_high;
286 __le32 h_i_author;
287 } hurd2;
288 struct {
289 __u8 m_i_frag; /* Fragment number */
290 __u8 m_i_fsize; /* Fragment size */
291 __u16 m_pad1;
292 __u32 m_i_reserved2[2];
293 } masix2;
294 } osd2; /* OS dependent 2 */
295};
296
297#define i_size_high i_dir_acl
298
299#if defined(__KERNEL__) || defined(__linux__)
300#define i_reserved1 osd1.linux1.l_i_reserved1
301#define i_frag osd2.linux2.l_i_frag
302#define i_fsize osd2.linux2.l_i_fsize
303#define i_uid_low i_uid
304#define i_gid_low i_gid
305#define i_uid_high osd2.linux2.l_i_uid_high
306#define i_gid_high osd2.linux2.l_i_gid_high
307#define i_reserved2 osd2.linux2.l_i_reserved2
308#endif
309
310#ifdef __hurd__
311#define i_translator osd1.hurd1.h_i_translator
312#define i_frag osd2.hurd2.h_i_frag
313#define i_fsize osd2.hurd2.h_i_fsize
314#define i_uid_high osd2.hurd2.h_i_uid_high
315#define i_gid_high osd2.hurd2.h_i_gid_high
316#define i_author osd2.hurd2.h_i_author
317#endif
318
319#ifdef __masix__
320#define i_reserved1 osd1.masix1.m_i_reserved1
321#define i_frag osd2.masix2.m_i_frag
322#define i_fsize osd2.masix2.m_i_fsize
323#define i_reserved2 osd2.masix2.m_i_reserved2
324#endif
325
326/*
327 * File system states
328 */
329#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
330#define EXT2_ERROR_FS 0x0002 /* Errors detected */
331
332/*
333 * Mount flags
334 */
335#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */
336#define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */
337#define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */
338#define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */
339#define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */
340#define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */
341#define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */
342#define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */
343#define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */
344#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */
345#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
346#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
347#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */
348#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
349#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
350#define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
351
352
353#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
354#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
355#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
356 EXT2_MOUNT_##opt)
357/*
358 * Maximal mount counts between two filesystem checks
359 */
360#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
361#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
362
363/*
364 * Behaviour when detecting errors
365 */
366#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
367#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
368#define EXT2_ERRORS_PANIC 3 /* Panic */
369#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
370
371/*
372 * Structure of the super block
373 */
374struct ext2_super_block {
375 __le32 s_inodes_count; /* Inodes count */
376 __le32 s_blocks_count; /* Blocks count */
377 __le32 s_r_blocks_count; /* Reserved blocks count */
378 __le32 s_free_blocks_count; /* Free blocks count */
379 __le32 s_free_inodes_count; /* Free inodes count */
380 __le32 s_first_data_block; /* First Data Block */
381 __le32 s_log_block_size; /* Block size */
382 __le32 s_log_frag_size; /* Fragment size */
383 __le32 s_blocks_per_group; /* # Blocks per group */
384 __le32 s_frags_per_group; /* # Fragments per group */
385 __le32 s_inodes_per_group; /* # Inodes per group */
386 __le32 s_mtime; /* Mount time */
387 __le32 s_wtime; /* Write time */
388 __le16 s_mnt_count; /* Mount count */
389 __le16 s_max_mnt_count; /* Maximal mount count */
390 __le16 s_magic; /* Magic signature */
391 __le16 s_state; /* File system state */
392 __le16 s_errors; /* Behaviour when detecting errors */
393 __le16 s_minor_rev_level; /* minor revision level */
394 __le32 s_lastcheck; /* time of last check */
395 __le32 s_checkinterval; /* max. time between checks */
396 __le32 s_creator_os; /* OS */
397 __le32 s_rev_level; /* Revision level */
398 __le16 s_def_resuid; /* Default uid for reserved blocks */
399 __le16 s_def_resgid; /* Default gid for reserved blocks */
400 /*
401 * These fields are for EXT2_DYNAMIC_REV superblocks only.
402 *
403 * Note: the difference between the compatible feature set and
404 * the incompatible feature set is that if there is a bit set
405 * in the incompatible feature set that the kernel doesn't
406 * know about, it should refuse to mount the filesystem.
407 *
408 * e2fsck's requirements are more strict; if it doesn't know
409 * about a feature in either the compatible or incompatible
410 * feature set, it must abort and not try to meddle with
411 * things it doesn't understand...
412 */
413 __le32 s_first_ino; /* First non-reserved inode */
414 __le16 s_inode_size; /* size of inode structure */
415 __le16 s_block_group_nr; /* block group # of this superblock */
416 __le32 s_feature_compat; /* compatible feature set */
417 __le32 s_feature_incompat; /* incompatible feature set */
418 __le32 s_feature_ro_compat; /* readonly-compatible feature set */
419 __u8 s_uuid[16]; /* 128-bit uuid for volume */
420 char s_volume_name[16]; /* volume name */
421 char s_last_mounted[64]; /* directory where last mounted */
422 __le32 s_algorithm_usage_bitmap; /* For compression */
423 /*
424 * Performance hints. Directory preallocation should only
425 * happen if the EXT2_COMPAT_PREALLOC flag is on.
426 */
427 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
428 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
429 __u16 s_padding1;
430 /*
431 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
432 */
433 __u8 s_journal_uuid[16]; /* uuid of journal superblock */
434 __u32 s_journal_inum; /* inode number of journal file */
435 __u32 s_journal_dev; /* device number of journal file */
436 __u32 s_last_orphan; /* start of list of inodes to delete */
437 __u32 s_hash_seed[4]; /* HTREE hash seed */
438 __u8 s_def_hash_version; /* Default hash version to use */
439 __u8 s_reserved_char_pad;
440 __u16 s_reserved_word_pad;
441 __le32 s_default_mount_opts;
442 __le32 s_first_meta_bg; /* First metablock block group */
443 __u32 s_reserved[190]; /* Padding to the end of the block */
444};
445
446/*
447 * Codes for operating systems
448 */
449#define EXT2_OS_LINUX 0
450#define EXT2_OS_HURD 1
451#define EXT2_OS_MASIX 2
452#define EXT2_OS_FREEBSD 3
453#define EXT2_OS_LITES 4
454
455/*
456 * Revision levels
457 */
458#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
459#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
460
461#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
462#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
463
464#define EXT2_GOOD_OLD_INODE_SIZE 128
465
466/*
467 * Feature set definitions
468 */
469
470#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
471 ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
472#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
473 ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
474#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
475 ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
476#define EXT2_SET_COMPAT_FEATURE(sb,mask) \
477 EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
478#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \
479 EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
480#define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \
481 EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
482#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \
483 EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
484#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
485 EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
486#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
487 EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
488
489#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
490#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
491#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
492#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
493#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
494#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
495#define EXT2_FEATURE_COMPAT_ANY 0xffffffff
496
497#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
498#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
499#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
500#define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff
501
502#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
503#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
504#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
505#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
506#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
507#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff
508
509#define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
510#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
511 EXT2_FEATURE_INCOMPAT_META_BG)
512#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
513 EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
514 EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
515#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP
516#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP
517
518/*
519 * Default values for user and/or group using reserved blocks
520 */
521#define EXT2_DEF_RESUID 0
522#define EXT2_DEF_RESGID 0
523
524/*
525 * Default mount options
526 */
527#define EXT2_DEFM_DEBUG 0x0001
528#define EXT2_DEFM_BSDGROUPS 0x0002
529#define EXT2_DEFM_XATTR_USER 0x0004
530#define EXT2_DEFM_ACL 0x0008
531#define EXT2_DEFM_UID16 0x0010
532 /* Not used by ext2, but reserved for use by ext3 */
533#define EXT3_DEFM_JMODE 0x0060
534#define EXT3_DEFM_JMODE_DATA 0x0020
535#define EXT3_DEFM_JMODE_ORDERED 0x0040
536#define EXT3_DEFM_JMODE_WBACK 0x0060
537
538/*
539 * Structure of a directory entry
540 */
541#define EXT2_NAME_LEN 255
542
543struct ext2_dir_entry {
544 __le32 inode; /* Inode number */
545 __le16 rec_len; /* Directory entry length */
546 __le16 name_len; /* Name length */
547 char name[EXT2_NAME_LEN]; /* File name */
548};
549
550/*
551 * The new version of the directory entry. Since EXT2 structures are
552 * stored in intel byte order, and the name_len field could never be
553 * bigger than 255 chars, it's safe to reclaim the extra byte for the
554 * file_type field.
555 */
556struct ext2_dir_entry_2 {
557 __le32 inode; /* Inode number */
558 __le16 rec_len; /* Directory entry length */
559 __u8 name_len; /* Name length */
560 __u8 file_type;
561 char name[EXT2_NAME_LEN]; /* File name */
562};
563
564/*
565 * Ext2 directory file types. Only the low 3 bits are used. The
566 * other bits are reserved for now.
567 */
568enum {
569 EXT2_FT_UNKNOWN = 0,
570 EXT2_FT_REG_FILE = 1,
571 EXT2_FT_DIR = 2,
572 EXT2_FT_CHRDEV = 3,
573 EXT2_FT_BLKDEV = 4,
574 EXT2_FT_FIFO = 5,
575 EXT2_FT_SOCK = 6,
576 EXT2_FT_SYMLINK = 7,
577 EXT2_FT_MAX
578};
579
580/*
581 * EXT2_DIR_PAD defines the directory entries boundaries
582 *
583 * NOTE: It must be a multiple of 4
584 */
585#define EXT2_DIR_PAD 4
586#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
587#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
588 ~EXT2_DIR_ROUND)
589#define EXT2_MAX_REC_LEN ((1<<16)-1)
590
591#endif /* _LINUX_EXT2_FS_H */ 42#endif /* _LINUX_EXT2_FS_H */
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
deleted file mode 100644
index db4d9f586bb6..000000000000
--- a/include/linux/ext2_fs_sb.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * linux/include/linux/ext2_fs_sb.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs_sb.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT2_FS_SB
17#define _LINUX_EXT2_FS_SB
18
19#include <linux/blockgroup_lock.h>
20#include <linux/percpu_counter.h>
21#include <linux/rbtree.h>
22
23/* XXX Here for now... not interested in restructing headers JUST now */
24
25/* data type for block offset of block group */
26typedef int ext2_grpblk_t;
27
28/* data type for filesystem-wide blocks number */
29typedef unsigned long ext2_fsblk_t;
30
31#define E2FSBLK "%lu"
32
33struct ext2_reserve_window {
34 ext2_fsblk_t _rsv_start; /* First byte reserved */
35 ext2_fsblk_t _rsv_end; /* Last byte reserved or 0 */
36};
37
38struct ext2_reserve_window_node {
39 struct rb_node rsv_node;
40 __u32 rsv_goal_size;
41 __u32 rsv_alloc_hit;
42 struct ext2_reserve_window rsv_window;
43};
44
45struct ext2_block_alloc_info {
46 /* information about reservation window */
47 struct ext2_reserve_window_node rsv_window_node;
48 /*
49 * was i_next_alloc_block in ext2_inode_info
50 * is the logical (file-relative) number of the
51 * most-recently-allocated block in this file.
52 * We use this for detecting linearly ascending allocation requests.
53 */
54 __u32 last_alloc_logical_block;
55 /*
56 * Was i_next_alloc_goal in ext2_inode_info
57 * is the *physical* companion to i_next_alloc_block.
58 * it the the physical block number of the block which was most-recentl
59 * allocated to this file. This give us the goal (target) for the next
60 * allocation when we detect linearly ascending requests.
61 */
62 ext2_fsblk_t last_alloc_physical_block;
63};
64
65#define rsv_start rsv_window._rsv_start
66#define rsv_end rsv_window._rsv_end
67
68/*
69 * second extended-fs super-block data in memory
70 */
71struct ext2_sb_info {
72 unsigned long s_frag_size; /* Size of a fragment in bytes */
73 unsigned long s_frags_per_block;/* Number of fragments per block */
74 unsigned long s_inodes_per_block;/* Number of inodes per block */
75 unsigned long s_frags_per_group;/* Number of fragments in a group */
76 unsigned long s_blocks_per_group;/* Number of blocks in a group */
77 unsigned long s_inodes_per_group;/* Number of inodes in a group */
78 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
79 unsigned long s_gdb_count; /* Number of group descriptor blocks */
80 unsigned long s_desc_per_block; /* Number of group descriptors per block */
81 unsigned long s_groups_count; /* Number of groups in the fs */
82 unsigned long s_overhead_last; /* Last calculated overhead */
83 unsigned long s_blocks_last; /* Last seen block count */
84 struct buffer_head * s_sbh; /* Buffer containing the super block */
85 struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
86 struct buffer_head ** s_group_desc;
87 unsigned long s_mount_opt;
88 unsigned long s_sb_block;
89 uid_t s_resuid;
90 gid_t s_resgid;
91 unsigned short s_mount_state;
92 unsigned short s_pad;
93 int s_addr_per_block_bits;
94 int s_desc_per_block_bits;
95 int s_inode_size;
96 int s_first_ino;
97 spinlock_t s_next_gen_lock;
98 u32 s_next_generation;
99 unsigned long s_dir_count;
100 u8 *s_debts;
101 struct percpu_counter s_freeblocks_counter;
102 struct percpu_counter s_freeinodes_counter;
103 struct percpu_counter s_dirs_counter;
104 struct blockgroup_lock *s_blockgroup_lock;
105 /* root of the per fs reservation window tree */
106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root;
108 struct ext2_reserve_window_node s_rsv_window_head;
109 /*
110 * s_lock protects against concurrent modifications of s_mount_state,
111 * s_blocks_last, s_overhead_last and the content of superblock's
112 * buffer pointed to by sbi->s_es.
113 *
114 * Note: It is used in ext2_show_options() to provide a consistent view
115 * of the mount options.
116 */
117 spinlock_t s_lock;
118};
119
120static inline spinlock_t *
121sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group)
122{
123 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
124}
125
126#endif /* _LINUX_EXT2_FS_SB */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
deleted file mode 100644
index f5a84eef6ed2..000000000000
--- a/include/linux/ext3_fs.h
+++ /dev/null
@@ -1,980 +0,0 @@
1/*
2 * linux/include/linux/ext3_fs.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT3_FS_H
17#define _LINUX_EXT3_FS_H
18
19#include <linux/types.h>
20#include <linux/magic.h>
21#include <linux/bug.h>
22
23/*
24 * The second extended filesystem constants/structures
25 */
26
27/*
28 * Define EXT3FS_DEBUG to produce debug messages
29 */
30#undef EXT3FS_DEBUG
31
32/*
33 * Define EXT3_RESERVATION to reserve data blocks for expanding files
34 */
35#define EXT3_DEFAULT_RESERVE_BLOCKS 8
36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
37#define EXT3_MAX_RESERVE_BLOCKS 1027
38#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
39
40/*
41 * Debug code
42 */
43#ifdef EXT3FS_DEBUG
44#define ext3_debug(f, a...) \
45 do { \
46 printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \
47 __FILE__, __LINE__, __func__); \
48 printk (KERN_DEBUG f, ## a); \
49 } while (0)
50#else
51#define ext3_debug(f, a...) do {} while (0)
52#endif
53
54/*
55 * Special inodes numbers
56 */
57#define EXT3_BAD_INO 1 /* Bad blocks inode */
58#define EXT3_ROOT_INO 2 /* Root inode */
59#define EXT3_BOOT_LOADER_INO 5 /* Boot loader inode */
60#define EXT3_UNDEL_DIR_INO 6 /* Undelete directory inode */
61#define EXT3_RESIZE_INO 7 /* Reserved group descriptors inode */
62#define EXT3_JOURNAL_INO 8 /* Journal inode */
63
64/* First non-reserved inode for old ext3 filesystems */
65#define EXT3_GOOD_OLD_FIRST_INO 11
66
67/*
68 * Maximal count of links to a file
69 */
70#define EXT3_LINK_MAX 32000
71
72/*
73 * Macro-instructions used to manage several block sizes
74 */
75#define EXT3_MIN_BLOCK_SIZE 1024
76#define EXT3_MAX_BLOCK_SIZE 65536
77#define EXT3_MIN_BLOCK_LOG_SIZE 10
78#ifdef __KERNEL__
79# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
80#else
81# define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
82#endif
83#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
84#ifdef __KERNEL__
85# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
86#else
87# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
88#endif
89#ifdef __KERNEL__
90#define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits)
91#define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size)
92#define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino)
93#else
94#define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
95 EXT3_GOOD_OLD_INODE_SIZE : \
96 (s)->s_inode_size)
97#define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
98 EXT3_GOOD_OLD_FIRST_INO : \
99 (s)->s_first_ino)
100#endif
101
102/*
103 * Macro-instructions used to manage fragments
104 */
105#define EXT3_MIN_FRAG_SIZE 1024
106#define EXT3_MAX_FRAG_SIZE 4096
107#define EXT3_MIN_FRAG_LOG_SIZE 10
108#ifdef __KERNEL__
109# define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size)
110# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block)
111#else
112# define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
113# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
114#endif
115
116/*
117 * Structure of a blocks group descriptor
118 */
119struct ext3_group_desc
120{
121 __le32 bg_block_bitmap; /* Blocks bitmap block */
122 __le32 bg_inode_bitmap; /* Inodes bitmap block */
123 __le32 bg_inode_table; /* Inodes table block */
124 __le16 bg_free_blocks_count; /* Free blocks count */
125 __le16 bg_free_inodes_count; /* Free inodes count */
126 __le16 bg_used_dirs_count; /* Directories count */
127 __u16 bg_pad;
128 __le32 bg_reserved[3];
129};
130
131/*
132 * Macro-instructions used to manage group descriptors
133 */
134#ifdef __KERNEL__
135# define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group)
136# define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block)
137# define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group)
138# define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits)
139#else
140# define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
141# define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
142# define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
143#endif
144
145/*
146 * Constants relative to the data blocks
147 */
148#define EXT3_NDIR_BLOCKS 12
149#define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS
150#define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1)
151#define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1)
152#define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1)
153
154/*
155 * Inode flags
156 */
157#define EXT3_SECRM_FL 0x00000001 /* Secure deletion */
158#define EXT3_UNRM_FL 0x00000002 /* Undelete */
159#define EXT3_COMPR_FL 0x00000004 /* Compress file */
160#define EXT3_SYNC_FL 0x00000008 /* Synchronous updates */
161#define EXT3_IMMUTABLE_FL 0x00000010 /* Immutable file */
162#define EXT3_APPEND_FL 0x00000020 /* writes to file may only append */
163#define EXT3_NODUMP_FL 0x00000040 /* do not dump file */
164#define EXT3_NOATIME_FL 0x00000080 /* do not update atime */
165/* Reserved for compression usage... */
166#define EXT3_DIRTY_FL 0x00000100
167#define EXT3_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
168#define EXT3_NOCOMPR_FL 0x00000400 /* Don't compress */
169#define EXT3_ECOMPR_FL 0x00000800 /* Compression error */
170/* End compression flags --- maybe not all used */
171#define EXT3_INDEX_FL 0x00001000 /* hash-indexed directory */
172#define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */
173#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
174#define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
175#define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
176#define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
177#define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */
178
179#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
180#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
181
182/* Flags that should be inherited by new inodes from their parent. */
183#define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
184 EXT3_SYNC_FL | EXT3_NODUMP_FL |\
185 EXT3_NOATIME_FL | EXT3_COMPRBLK_FL |\
186 EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\
187 EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL)
188
189/* Flags that are appropriate for regular files (all but dir-specific ones). */
190#define EXT3_REG_FLMASK (~(EXT3_DIRSYNC_FL | EXT3_TOPDIR_FL))
191
192/* Flags that are appropriate for non-directories/regular files. */
193#define EXT3_OTHER_FLMASK (EXT3_NODUMP_FL | EXT3_NOATIME_FL)
194
195/* Mask out flags that are inappropriate for the given type of inode. */
196static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
197{
198 if (S_ISDIR(mode))
199 return flags;
200 else if (S_ISREG(mode))
201 return flags & EXT3_REG_FLMASK;
202 else
203 return flags & EXT3_OTHER_FLMASK;
204}
205
206/* Used to pass group descriptor data when online resize is done */
207struct ext3_new_group_input {
208 __u32 group; /* Group number for this data */
209 __u32 block_bitmap; /* Absolute block number of block bitmap */
210 __u32 inode_bitmap; /* Absolute block number of inode bitmap */
211 __u32 inode_table; /* Absolute block number of inode table start */
212 __u32 blocks_count; /* Total number of blocks in this group */
213 __u16 reserved_blocks; /* Number of reserved blocks in this group */
214 __u16 unused;
215};
216
217/* The struct ext3_new_group_input in kernel space, with free_blocks_count */
218struct ext3_new_group_data {
219 __u32 group;
220 __u32 block_bitmap;
221 __u32 inode_bitmap;
222 __u32 inode_table;
223 __u32 blocks_count;
224 __u16 reserved_blocks;
225 __u16 unused;
226 __u32 free_blocks_count;
227};
228
229
230/*
231 * ioctl commands
232 */
233#define EXT3_IOC_GETFLAGS FS_IOC_GETFLAGS
234#define EXT3_IOC_SETFLAGS FS_IOC_SETFLAGS
235#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
236#define EXT3_IOC_SETVERSION _IOW('f', 4, long)
237#define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
238#define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input)
239#define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION
240#define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION
241#ifdef CONFIG_JBD_DEBUG
242#define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
243#endif
244#define EXT3_IOC_GETRSVSZ _IOR('f', 5, long)
245#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long)
246
247/*
248 * ioctl commands in 32 bit emulation
249 */
250#define EXT3_IOC32_GETFLAGS FS_IOC32_GETFLAGS
251#define EXT3_IOC32_SETFLAGS FS_IOC32_SETFLAGS
252#define EXT3_IOC32_GETVERSION _IOR('f', 3, int)
253#define EXT3_IOC32_SETVERSION _IOW('f', 4, int)
254#define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int)
255#define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int)
256#define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
257#ifdef CONFIG_JBD_DEBUG
258#define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
259#endif
260#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
261#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
262
263
264/*
265 * Mount options
266 */
267struct ext3_mount_options {
268 unsigned long s_mount_opt;
269 uid_t s_resuid;
270 gid_t s_resgid;
271 unsigned long s_commit_interval;
272#ifdef CONFIG_QUOTA
273 int s_jquota_fmt;
274 char *s_qf_names[MAXQUOTAS];
275#endif
276};
277
278/*
279 * Structure of an inode on the disk
280 */
281struct ext3_inode {
282 __le16 i_mode; /* File mode */
283 __le16 i_uid; /* Low 16 bits of Owner Uid */
284 __le32 i_size; /* Size in bytes */
285 __le32 i_atime; /* Access time */
286 __le32 i_ctime; /* Creation time */
287 __le32 i_mtime; /* Modification time */
288 __le32 i_dtime; /* Deletion Time */
289 __le16 i_gid; /* Low 16 bits of Group Id */
290 __le16 i_links_count; /* Links count */
291 __le32 i_blocks; /* Blocks count */
292 __le32 i_flags; /* File flags */
293 union {
294 struct {
295 __u32 l_i_reserved1;
296 } linux1;
297 struct {
298 __u32 h_i_translator;
299 } hurd1;
300 struct {
301 __u32 m_i_reserved1;
302 } masix1;
303 } osd1; /* OS dependent 1 */
304 __le32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
305 __le32 i_generation; /* File version (for NFS) */
306 __le32 i_file_acl; /* File ACL */
307 __le32 i_dir_acl; /* Directory ACL */
308 __le32 i_faddr; /* Fragment address */
309 union {
310 struct {
311 __u8 l_i_frag; /* Fragment number */
312 __u8 l_i_fsize; /* Fragment size */
313 __u16 i_pad1;
314 __le16 l_i_uid_high; /* these 2 fields */
315 __le16 l_i_gid_high; /* were reserved2[0] */
316 __u32 l_i_reserved2;
317 } linux2;
318 struct {
319 __u8 h_i_frag; /* Fragment number */
320 __u8 h_i_fsize; /* Fragment size */
321 __u16 h_i_mode_high;
322 __u16 h_i_uid_high;
323 __u16 h_i_gid_high;
324 __u32 h_i_author;
325 } hurd2;
326 struct {
327 __u8 m_i_frag; /* Fragment number */
328 __u8 m_i_fsize; /* Fragment size */
329 __u16 m_pad1;
330 __u32 m_i_reserved2[2];
331 } masix2;
332 } osd2; /* OS dependent 2 */
333 __le16 i_extra_isize;
334 __le16 i_pad1;
335};
336
337#define i_size_high i_dir_acl
338
339#if defined(__KERNEL__) || defined(__linux__)
340#define i_reserved1 osd1.linux1.l_i_reserved1
341#define i_frag osd2.linux2.l_i_frag
342#define i_fsize osd2.linux2.l_i_fsize
343#define i_uid_low i_uid
344#define i_gid_low i_gid
345#define i_uid_high osd2.linux2.l_i_uid_high
346#define i_gid_high osd2.linux2.l_i_gid_high
347#define i_reserved2 osd2.linux2.l_i_reserved2
348
349#elif defined(__GNU__)
350
351#define i_translator osd1.hurd1.h_i_translator
352#define i_frag osd2.hurd2.h_i_frag;
353#define i_fsize osd2.hurd2.h_i_fsize;
354#define i_uid_high osd2.hurd2.h_i_uid_high
355#define i_gid_high osd2.hurd2.h_i_gid_high
356#define i_author osd2.hurd2.h_i_author
357
358#elif defined(__masix__)
359
360#define i_reserved1 osd1.masix1.m_i_reserved1
361#define i_frag osd2.masix2.m_i_frag
362#define i_fsize osd2.masix2.m_i_fsize
363#define i_reserved2 osd2.masix2.m_i_reserved2
364
365#endif /* defined(__KERNEL__) || defined(__linux__) */
366
367/*
368 * File system states
369 */
370#define EXT3_VALID_FS 0x0001 /* Unmounted cleanly */
371#define EXT3_ERROR_FS 0x0002 /* Errors detected */
372#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
373
374/*
375 * Misc. filesystem flags
376 */
377#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
378#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
379#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */
380
381/*
382 * Mount flags
383 */
384#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */
385/* EXT3_MOUNT_OLDALLOC was there */
386#define EXT3_MOUNT_GRPID 0x00004 /* Create files with directory's group */
387#define EXT3_MOUNT_DEBUG 0x00008 /* Some debugging messages */
388#define EXT3_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
389#define EXT3_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */
390#define EXT3_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
391#define EXT3_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
392#define EXT3_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
393#define EXT3_MOUNT_ABORT 0x00200 /* Fatal error detected */
394#define EXT3_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
395#define EXT3_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
396#define EXT3_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
397#define EXT3_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */
398#define EXT3_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */
399#define EXT3_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */
400#define EXT3_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */
401#define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
402#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
403#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
404#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
405#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
406#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
407#define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write
408 * error in ordered mode */
409
410/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
411#ifndef _LINUX_EXT2_FS_H
412#define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
413#define set_opt(o, opt) o |= EXT3_MOUNT_##opt
414#define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \
415 EXT3_MOUNT_##opt)
416#else
417#define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
418#define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT
419#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
420#endif
421
422#define ext3_set_bit __set_bit_le
423#define ext3_set_bit_atomic ext2_set_bit_atomic
424#define ext3_clear_bit __clear_bit_le
425#define ext3_clear_bit_atomic ext2_clear_bit_atomic
426#define ext3_test_bit test_bit_le
427#define ext3_find_next_zero_bit find_next_zero_bit_le
428
429/*
430 * Maximal mount counts between two filesystem checks
431 */
432#define EXT3_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
433#define EXT3_DFL_CHECKINTERVAL 0 /* Don't use interval check */
434
435/*
436 * Behaviour when detecting errors
437 */
438#define EXT3_ERRORS_CONTINUE 1 /* Continue execution */
439#define EXT3_ERRORS_RO 2 /* Remount fs read-only */
440#define EXT3_ERRORS_PANIC 3 /* Panic */
441#define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE
442
443/*
444 * Structure of the super block
445 */
446struct ext3_super_block {
447/*00*/ __le32 s_inodes_count; /* Inodes count */
448 __le32 s_blocks_count; /* Blocks count */
449 __le32 s_r_blocks_count; /* Reserved blocks count */
450 __le32 s_free_blocks_count; /* Free blocks count */
451/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
452 __le32 s_first_data_block; /* First Data Block */
453 __le32 s_log_block_size; /* Block size */
454 __le32 s_log_frag_size; /* Fragment size */
455/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
456 __le32 s_frags_per_group; /* # Fragments per group */
457 __le32 s_inodes_per_group; /* # Inodes per group */
458 __le32 s_mtime; /* Mount time */
459/*30*/ __le32 s_wtime; /* Write time */
460 __le16 s_mnt_count; /* Mount count */
461 __le16 s_max_mnt_count; /* Maximal mount count */
462 __le16 s_magic; /* Magic signature */
463 __le16 s_state; /* File system state */
464 __le16 s_errors; /* Behaviour when detecting errors */
465 __le16 s_minor_rev_level; /* minor revision level */
466/*40*/ __le32 s_lastcheck; /* time of last check */
467 __le32 s_checkinterval; /* max. time between checks */
468 __le32 s_creator_os; /* OS */
469 __le32 s_rev_level; /* Revision level */
470/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
471 __le16 s_def_resgid; /* Default gid for reserved blocks */
472 /*
473 * These fields are for EXT3_DYNAMIC_REV superblocks only.
474 *
475 * Note: the difference between the compatible feature set and
476 * the incompatible feature set is that if there is a bit set
477 * in the incompatible feature set that the kernel doesn't
478 * know about, it should refuse to mount the filesystem.
479 *
480 * e2fsck's requirements are more strict; if it doesn't know
481 * about a feature in either the compatible or incompatible
482 * feature set, it must abort and not try to meddle with
483 * things it doesn't understand...
484 */
485 __le32 s_first_ino; /* First non-reserved inode */
486 __le16 s_inode_size; /* size of inode structure */
487 __le16 s_block_group_nr; /* block group # of this superblock */
488 __le32 s_feature_compat; /* compatible feature set */
489/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
490 __le32 s_feature_ro_compat; /* readonly-compatible feature set */
491/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
492/*78*/ char s_volume_name[16]; /* volume name */
493/*88*/ char s_last_mounted[64]; /* directory where last mounted */
494/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
495 /*
496 * Performance hints. Directory preallocation should only
497 * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on.
498 */
499 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
500 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
501 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
502 /*
503 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
504 */
505/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
506/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
507 __le32 s_journal_dev; /* device number of journal file */
508 __le32 s_last_orphan; /* start of list of inodes to delete */
509 __le32 s_hash_seed[4]; /* HTREE hash seed */
510 __u8 s_def_hash_version; /* Default hash version to use */
511 __u8 s_reserved_char_pad;
512 __u16 s_reserved_word_pad;
513 __le32 s_default_mount_opts;
514 __le32 s_first_meta_bg; /* First metablock block group */
515 __le32 s_mkfs_time; /* When the filesystem was created */
516 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
517 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
518/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
519 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
520 __le32 s_free_blocks_count_hi; /* Free blocks count */
521 __le16 s_min_extra_isize; /* All inodes have at least # bytes */
522 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
523 __le32 s_flags; /* Miscellaneous flags */
524 __le16 s_raid_stride; /* RAID stride */
525 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
526 __le64 s_mmp_block; /* Block for multi-mount protection */
527 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
528 __u8 s_log_groups_per_flex; /* FLEX_BG group size */
529 __u8 s_reserved_char_pad2;
530 __le16 s_reserved_pad;
531 __u32 s_reserved[162]; /* Padding to the end of the block */
532};
533
534#ifdef __KERNEL__
535#include <linux/ext3_fs_i.h>
536#include <linux/ext3_fs_sb.h>
537static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb)
538{
539 return sb->s_fs_info;
540}
541static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
542{
543 return container_of(inode, struct ext3_inode_info, vfs_inode);
544}
545
546static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
547{
548 return ino == EXT3_ROOT_INO ||
549 ino == EXT3_JOURNAL_INO ||
550 ino == EXT3_RESIZE_INO ||
551 (ino >= EXT3_FIRST_INO(sb) &&
552 ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
553}
554
555/*
556 * Inode dynamic state flags
557 */
558enum {
559 EXT3_STATE_JDATA, /* journaled data exists */
560 EXT3_STATE_NEW, /* inode is newly created */
561 EXT3_STATE_XATTR, /* has in-inode xattrs */
562 EXT3_STATE_FLUSH_ON_CLOSE, /* flush dirty pages on close */
563};
564
565static inline int ext3_test_inode_state(struct inode *inode, int bit)
566{
567 return test_bit(bit, &EXT3_I(inode)->i_state_flags);
568}
569
570static inline void ext3_set_inode_state(struct inode *inode, int bit)
571{
572 set_bit(bit, &EXT3_I(inode)->i_state_flags);
573}
574
575static inline void ext3_clear_inode_state(struct inode *inode, int bit)
576{
577 clear_bit(bit, &EXT3_I(inode)->i_state_flags);
578}
579#else
580/* Assume that user mode programs are passing in an ext3fs superblock, not
581 * a kernel struct super_block. This will allow us to call the feature-test
582 * macros from user land. */
583#define EXT3_SB(sb) (sb)
584#endif
585
586#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
587
588/*
589 * Codes for operating systems
590 */
591#define EXT3_OS_LINUX 0
592#define EXT3_OS_HURD 1
593#define EXT3_OS_MASIX 2
594#define EXT3_OS_FREEBSD 3
595#define EXT3_OS_LITES 4
596
597/*
598 * Revision levels
599 */
600#define EXT3_GOOD_OLD_REV 0 /* The good old (original) format */
601#define EXT3_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
602
603#define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV
604#define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV
605
606#define EXT3_GOOD_OLD_INODE_SIZE 128
607
608/*
609 * Feature set definitions
610 */
611
612#define EXT3_HAS_COMPAT_FEATURE(sb,mask) \
613 ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
614#define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) \
615 ( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
616#define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) \
617 ( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
618#define EXT3_SET_COMPAT_FEATURE(sb,mask) \
619 EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
620#define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) \
621 EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
622#define EXT3_SET_INCOMPAT_FEATURE(sb,mask) \
623 EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
624#define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) \
625 EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
626#define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
627 EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
628#define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) \
629 EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
630
631#define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001
632#define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002
633#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
634#define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008
635#define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010
636#define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020
637
638#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
639#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
640#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
641
642#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
643#define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
644#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
645#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
646#define EXT3_FEATURE_INCOMPAT_META_BG 0x0010
647
648#define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
649#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \
650 EXT3_FEATURE_INCOMPAT_RECOVER| \
651 EXT3_FEATURE_INCOMPAT_META_BG)
652#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
653 EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
654 EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
655
656/*
657 * Default values for user and/or group using reserved blocks
658 */
659#define EXT3_DEF_RESUID 0
660#define EXT3_DEF_RESGID 0
661
662/*
663 * Default mount options
664 */
665#define EXT3_DEFM_DEBUG 0x0001
666#define EXT3_DEFM_BSDGROUPS 0x0002
667#define EXT3_DEFM_XATTR_USER 0x0004
668#define EXT3_DEFM_ACL 0x0008
669#define EXT3_DEFM_UID16 0x0010
670#define EXT3_DEFM_JMODE 0x0060
671#define EXT3_DEFM_JMODE_DATA 0x0020
672#define EXT3_DEFM_JMODE_ORDERED 0x0040
673#define EXT3_DEFM_JMODE_WBACK 0x0060
674
675/*
676 * Structure of a directory entry
677 */
678#define EXT3_NAME_LEN 255
679
680struct ext3_dir_entry {
681 __le32 inode; /* Inode number */
682 __le16 rec_len; /* Directory entry length */
683 __le16 name_len; /* Name length */
684 char name[EXT3_NAME_LEN]; /* File name */
685};
686
687/*
688 * The new version of the directory entry. Since EXT3 structures are
689 * stored in intel byte order, and the name_len field could never be
690 * bigger than 255 chars, it's safe to reclaim the extra byte for the
691 * file_type field.
692 */
693struct ext3_dir_entry_2 {
694 __le32 inode; /* Inode number */
695 __le16 rec_len; /* Directory entry length */
696 __u8 name_len; /* Name length */
697 __u8 file_type;
698 char name[EXT3_NAME_LEN]; /* File name */
699};
700
701/*
702 * Ext3 directory file types. Only the low 3 bits are used. The
703 * other bits are reserved for now.
704 */
705#define EXT3_FT_UNKNOWN 0
706#define EXT3_FT_REG_FILE 1
707#define EXT3_FT_DIR 2
708#define EXT3_FT_CHRDEV 3
709#define EXT3_FT_BLKDEV 4
710#define EXT3_FT_FIFO 5
711#define EXT3_FT_SOCK 6
712#define EXT3_FT_SYMLINK 7
713
714#define EXT3_FT_MAX 8
715
716/*
717 * EXT3_DIR_PAD defines the directory entries boundaries
718 *
719 * NOTE: It must be a multiple of 4
720 */
721#define EXT3_DIR_PAD 4
722#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1)
723#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \
724 ~EXT3_DIR_ROUND)
725#define EXT3_MAX_REC_LEN ((1<<16)-1)
726
727/*
728 * Tests against MAX_REC_LEN etc were put in place for 64k block
729 * sizes; if that is not possible on this arch, we can skip
730 * those tests and speed things up.
731 */
732static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
733{
734 unsigned len = le16_to_cpu(dlen);
735
736#if (PAGE_CACHE_SIZE >= 65536)
737 if (len == EXT3_MAX_REC_LEN)
738 return 1 << 16;
739#endif
740 return len;
741}
742
743static inline __le16 ext3_rec_len_to_disk(unsigned len)
744{
745#if (PAGE_CACHE_SIZE >= 65536)
746 if (len == (1 << 16))
747 return cpu_to_le16(EXT3_MAX_REC_LEN);
748 else if (len > (1 << 16))
749 BUG();
750#endif
751 return cpu_to_le16(len);
752}
753
754/*
755 * Hash Tree Directory indexing
756 * (c) Daniel Phillips, 2001
757 */
758
759#define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
760 EXT3_FEATURE_COMPAT_DIR_INDEX) && \
761 (EXT3_I(dir)->i_flags & EXT3_INDEX_FL))
762#define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX)
763#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
764
765/* Legal values for the dx_root hash_version field: */
766
767#define DX_HASH_LEGACY 0
768#define DX_HASH_HALF_MD4 1
769#define DX_HASH_TEA 2
770#define DX_HASH_LEGACY_UNSIGNED 3
771#define DX_HASH_HALF_MD4_UNSIGNED 4
772#define DX_HASH_TEA_UNSIGNED 5
773
774#ifdef __KERNEL__
775
776/* hash info structure used by the directory hash */
777struct dx_hash_info
778{
779 u32 hash;
780 u32 minor_hash;
781 int hash_version;
782 u32 *seed;
783};
784
785#define EXT3_HTREE_EOF 0x7fffffff
786
787/*
788 * Control parameters used by ext3_htree_next_block
789 */
790#define HASH_NB_ALWAYS 1
791
792
793/*
794 * Describe an inode's exact location on disk and in memory
795 */
796struct ext3_iloc
797{
798 struct buffer_head *bh;
799 unsigned long offset;
800 unsigned long block_group;
801};
802
803static inline struct ext3_inode *ext3_raw_inode(struct ext3_iloc *iloc)
804{
805 return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset);
806}
807
808/*
809 * This structure is stuffed into the struct file's private_data field
810 * for directories. It is where we put information so that we can do
811 * readdir operations in hash tree order.
812 */
813struct dir_private_info {
814 struct rb_root root;
815 struct rb_node *curr_node;
816 struct fname *extra_fname;
817 loff_t last_pos;
818 __u32 curr_hash;
819 __u32 curr_minor_hash;
820 __u32 next_hash;
821};
822
823/* calculate the first block number of the group */
824static inline ext3_fsblk_t
825ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
826{
827 return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
828 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
829}
830
831/*
832 * Special error return code only used by dx_probe() and its callers.
833 */
834#define ERR_BAD_DX_DIR -75000
835
836/*
837 * Function prototypes
838 */
839
840/*
841 * Ok, these declarations are also in <linux/kernel.h> but none of the
842 * ext3 source programs needs to include it so they are duplicated here.
843 */
844# define NORET_TYPE /**/
845# define ATTRIB_NORET __attribute__((noreturn))
846# define NORET_AND noreturn,
847
848/* balloc.c */
849extern int ext3_bg_has_super(struct super_block *sb, int group);
850extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
851extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode,
852 ext3_fsblk_t goal, int *errp);
853extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode,
854 ext3_fsblk_t goal, unsigned long *count, int *errp);
855extern void ext3_free_blocks (handle_t *handle, struct inode *inode,
856 ext3_fsblk_t block, unsigned long count);
857extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
858 ext3_fsblk_t block, unsigned long count,
859 unsigned long *pdquot_freed_blocks);
860extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);
861extern void ext3_check_blocks_bitmap (struct super_block *);
862extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
863 unsigned int block_group,
864 struct buffer_head ** bh);
865extern int ext3_should_retry_alloc(struct super_block *sb, int *retries);
866extern void ext3_init_block_alloc_info(struct inode *);
867extern void ext3_rsv_window_add(struct super_block *sb, struct ext3_reserve_window_node *rsv);
868extern int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range);
869
870/* dir.c */
871extern int ext3_check_dir_entry(const char *, struct inode *,
872 struct ext3_dir_entry_2 *,
873 struct buffer_head *, unsigned long);
874extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
875 __u32 minor_hash,
876 struct ext3_dir_entry_2 *dirent);
877extern void ext3_htree_free_dir_info(struct dir_private_info *p);
878
879/* fsync.c */
880extern int ext3_sync_file(struct file *, loff_t, loff_t, int);
881
882/* hash.c */
883extern int ext3fs_dirhash(const char *name, int len, struct
884 dx_hash_info *hinfo);
885
886/* ialloc.c */
887extern struct inode * ext3_new_inode (handle_t *, struct inode *,
888 const struct qstr *, umode_t);
889extern void ext3_free_inode (handle_t *, struct inode *);
890extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
891extern unsigned long ext3_count_free_inodes (struct super_block *);
892extern unsigned long ext3_count_dirs (struct super_block *);
893extern void ext3_check_inodes_bitmap (struct super_block *);
894extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
895
896
897/* inode.c */
898int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
899 struct buffer_head *bh, ext3_fsblk_t blocknr);
900struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
901struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
902int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
903 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
904 int create);
905
906extern struct inode *ext3_iget(struct super_block *, unsigned long);
907extern int ext3_write_inode (struct inode *, struct writeback_control *);
908extern int ext3_setattr (struct dentry *, struct iattr *);
909extern void ext3_evict_inode (struct inode *);
910extern int ext3_sync_inode (handle_t *, struct inode *);
911extern void ext3_discard_reservation (struct inode *);
912extern void ext3_dirty_inode(struct inode *, int);
913extern int ext3_change_inode_journal_flag(struct inode *, int);
914extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *);
915extern int ext3_can_truncate(struct inode *inode);
916extern void ext3_truncate(struct inode *inode);
917extern void ext3_set_inode_flags(struct inode *);
918extern void ext3_get_inode_flags(struct ext3_inode_info *);
919extern void ext3_set_aops(struct inode *inode);
920extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
921 u64 start, u64 len);
922
923/* ioctl.c */
924extern long ext3_ioctl(struct file *, unsigned int, unsigned long);
925extern long ext3_compat_ioctl(struct file *, unsigned int, unsigned long);
926
927/* namei.c */
928extern int ext3_orphan_add(handle_t *, struct inode *);
929extern int ext3_orphan_del(handle_t *, struct inode *);
930extern int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
931 __u32 start_minor_hash, __u32 *next_hash);
932
933/* resize.c */
934extern int ext3_group_add(struct super_block *sb,
935 struct ext3_new_group_data *input);
936extern int ext3_group_extend(struct super_block *sb,
937 struct ext3_super_block *es,
938 ext3_fsblk_t n_blocks_count);
939
940/* super.c */
941extern __printf(3, 4)
942void ext3_error(struct super_block *, const char *, const char *, ...);
943extern void __ext3_std_error (struct super_block *, const char *, int);
944extern __printf(3, 4)
945void ext3_abort(struct super_block *, const char *, const char *, ...);
946extern __printf(3, 4)
947void ext3_warning(struct super_block *, const char *, const char *, ...);
948extern __printf(3, 4)
949void ext3_msg(struct super_block *, const char *, const char *, ...);
950extern void ext3_update_dynamic_rev (struct super_block *sb);
951
952#define ext3_std_error(sb, errno) \
953do { \
954 if ((errno)) \
955 __ext3_std_error((sb), __func__, (errno)); \
956} while (0)
957
958/*
959 * Inodes and files operations
960 */
961
962/* dir.c */
963extern const struct file_operations ext3_dir_operations;
964
965/* file.c */
966extern const struct inode_operations ext3_file_inode_operations;
967extern const struct file_operations ext3_file_operations;
968
969/* namei.c */
970extern const struct inode_operations ext3_dir_inode_operations;
971extern const struct inode_operations ext3_special_inode_operations;
972
973/* symlink.c */
974extern const struct inode_operations ext3_symlink_inode_operations;
975extern const struct inode_operations ext3_fast_symlink_inode_operations;
976
977
978#endif /* __KERNEL__ */
979
980#endif /* _LINUX_EXT3_FS_H */
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
deleted file mode 100644
index f42c098aed8d..000000000000
--- a/include/linux/ext3_fs_i.h
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * linux/include/linux/ext3_fs_i.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs_i.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT3_FS_I
17#define _LINUX_EXT3_FS_I
18
19#include <linux/rwsem.h>
20#include <linux/rbtree.h>
21#include <linux/seqlock.h>
22#include <linux/mutex.h>
23
24/* data type for block offset of block group */
25typedef int ext3_grpblk_t;
26
27/* data type for filesystem-wide blocks number */
28typedef unsigned long ext3_fsblk_t;
29
30#define E3FSBLK "%lu"
31
32struct ext3_reserve_window {
33 ext3_fsblk_t _rsv_start; /* First byte reserved */
34 ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */
35};
36
37struct ext3_reserve_window_node {
38 struct rb_node rsv_node;
39 __u32 rsv_goal_size;
40 __u32 rsv_alloc_hit;
41 struct ext3_reserve_window rsv_window;
42};
43
44struct ext3_block_alloc_info {
45 /* information about reservation window */
46 struct ext3_reserve_window_node rsv_window_node;
47 /*
48 * was i_next_alloc_block in ext3_inode_info
49 * is the logical (file-relative) number of the
50 * most-recently-allocated block in this file.
51 * We use this for detecting linearly ascending allocation requests.
52 */
53 __u32 last_alloc_logical_block;
54 /*
55 * Was i_next_alloc_goal in ext3_inode_info
56 * is the *physical* companion to i_next_alloc_block.
57 * it the physical block number of the block which was most-recentl
58 * allocated to this file. This give us the goal (target) for the next
59 * allocation when we detect linearly ascending requests.
60 */
61 ext3_fsblk_t last_alloc_physical_block;
62};
63
64#define rsv_start rsv_window._rsv_start
65#define rsv_end rsv_window._rsv_end
66
67/*
68 * third extended file system inode data in memory
69 */
70struct ext3_inode_info {
71 __le32 i_data[15]; /* unconverted */
72 __u32 i_flags;
73#ifdef EXT3_FRAGMENTS
74 __u32 i_faddr;
75 __u8 i_frag_no;
76 __u8 i_frag_size;
77#endif
78 ext3_fsblk_t i_file_acl;
79 __u32 i_dir_acl;
80 __u32 i_dtime;
81
82 /*
83 * i_block_group is the number of the block group which contains
84 * this file's inode. Constant across the lifetime of the inode,
85 * it is ued for making block allocation decisions - we try to
86 * place a file's data blocks near its inode block, and new inodes
87 * near to their parent directory's inode.
88 */
89 __u32 i_block_group;
90 unsigned long i_state_flags; /* Dynamic state flags for ext3 */
91
92 /* block reservation info */
93 struct ext3_block_alloc_info *i_block_alloc_info;
94
95 __u32 i_dir_start_lookup;
96#ifdef CONFIG_EXT3_FS_XATTR
97 /*
98 * Extended attributes can be read independently of the main file
99 * data. Taking i_mutex even when reading would cause contention
100 * between readers of EAs and writers of regular file data, so
101 * instead we synchronize on xattr_sem when reading or changing
102 * EAs.
103 */
104 struct rw_semaphore xattr_sem;
105#endif
106
107 struct list_head i_orphan; /* unlinked but open inodes */
108
109 /*
110 * i_disksize keeps track of what the inode size is ON DISK, not
111 * in memory. During truncate, i_size is set to the new size by
112 * the VFS prior to calling ext3_truncate(), but the filesystem won't
113 * set i_disksize to 0 until the truncate is actually under way.
114 *
115 * The intent is that i_disksize always represents the blocks which
116 * are used by this file. This allows recovery to restart truncate
117 * on orphans if we crash during truncate. We actually write i_disksize
118 * into the on-disk inode when writing inodes out, instead of i_size.
119 *
120 * The only time when i_disksize and i_size may be different is when
121 * a truncate is in progress. The only things which change i_disksize
122 * are ext3_get_block (growth) and ext3_truncate (shrinkth).
123 */
124 loff_t i_disksize;
125
126 /* on-disk additional length */
127 __u16 i_extra_isize;
128
129 /*
130 * truncate_mutex is for serialising ext3_truncate() against
131 * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's
132 * data tree are chopped off during truncate. We can't do that in
133 * ext3 because whenever we perform intermediate commits during
134 * truncate, the inode and all the metadata blocks *must* be in a
135 * consistent state which allows truncation of the orphans to restart
136 * during recovery. Hence we must fix the get_block-vs-truncate race
137 * by other means, so we have truncate_mutex.
138 */
139 struct mutex truncate_mutex;
140
141 /*
142 * Transactions that contain inode's metadata needed to complete
143 * fsync and fdatasync, respectively.
144 */
145 atomic_t i_sync_tid;
146 atomic_t i_datasync_tid;
147
148 struct inode vfs_inode;
149};
150
151#endif /* _LINUX_EXT3_FS_I */
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h
deleted file mode 100644
index 64365252f1b0..000000000000
--- a/include/linux/ext3_fs_sb.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * linux/include/linux/ext3_fs_sb.h
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *
9 * from
10 *
11 * linux/include/linux/minix_fs_sb.h
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 */
15
16#ifndef _LINUX_EXT3_FS_SB
17#define _LINUX_EXT3_FS_SB
18
19#ifdef __KERNEL__
20#include <linux/timer.h>
21#include <linux/wait.h>
22#include <linux/blockgroup_lock.h>
23#include <linux/percpu_counter.h>
24#endif
25#include <linux/rbtree.h>
26
27/*
28 * third extended-fs super-block data in memory
29 */
30struct ext3_sb_info {
31 unsigned long s_frag_size; /* Size of a fragment in bytes */
32 unsigned long s_frags_per_block;/* Number of fragments per block */
33 unsigned long s_inodes_per_block;/* Number of inodes per block */
34 unsigned long s_frags_per_group;/* Number of fragments in a group */
35 unsigned long s_blocks_per_group;/* Number of blocks in a group */
36 unsigned long s_inodes_per_group;/* Number of inodes in a group */
37 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
38 unsigned long s_gdb_count; /* Number of group descriptor blocks */
39 unsigned long s_desc_per_block; /* Number of group descriptors per block */
40 unsigned long s_groups_count; /* Number of groups in the fs */
41 unsigned long s_overhead_last; /* Last calculated overhead */
42 unsigned long s_blocks_last; /* Last seen block count */
43 struct buffer_head * s_sbh; /* Buffer containing the super block */
44 struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */
45 struct buffer_head ** s_group_desc;
46 unsigned long s_mount_opt;
47 ext3_fsblk_t s_sb_block;
48 uid_t s_resuid;
49 gid_t s_resgid;
50 unsigned short s_mount_state;
51 unsigned short s_pad;
52 int s_addr_per_block_bits;
53 int s_desc_per_block_bits;
54 int s_inode_size;
55 int s_first_ino;
56 spinlock_t s_next_gen_lock;
57 u32 s_next_generation;
58 u32 s_hash_seed[4];
59 int s_def_hash_version;
60 int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
61 struct percpu_counter s_freeblocks_counter;
62 struct percpu_counter s_freeinodes_counter;
63 struct percpu_counter s_dirs_counter;
64 struct blockgroup_lock *s_blockgroup_lock;
65
66 /* root of the per fs reservation window tree */
67 spinlock_t s_rsv_window_lock;
68 struct rb_root s_rsv_window_root;
69 struct ext3_reserve_window_node s_rsv_window_head;
70
71 /* Journaling */
72 struct inode * s_journal_inode;
73 struct journal_s * s_journal;
74 struct list_head s_orphan;
75 struct mutex s_orphan_lock;
76 struct mutex s_resize_lock;
77 unsigned long s_commit_interval;
78 struct block_device *journal_bdev;
79#ifdef CONFIG_QUOTA
80 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
81 int s_jquota_fmt; /* Format of quota to use */
82#endif
83};
84
85static inline spinlock_t *
86sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group)
87{
88 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
89}
90
91#endif /* _LINUX_EXT3_FS_SB */
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
deleted file mode 100644
index d7b5ddca99c2..000000000000
--- a/include/linux/ext3_jbd.h
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * linux/include/linux/ext3_jbd.h
3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999
5 *
6 * Copyright 1998--1999 Red Hat corp --- All Rights Reserved
7 *
8 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference.
11 *
12 * Ext3-specific journaling extensions.
13 */
14
15#ifndef _LINUX_EXT3_JBD_H
16#define _LINUX_EXT3_JBD_H
17
18#include <linux/fs.h>
19#include <linux/jbd.h>
20#include <linux/ext3_fs.h>
21
22#define EXT3_JOURNAL(inode) (EXT3_SB((inode)->i_sb)->s_journal)
23
24/* Define the number of blocks we need to account to a transaction to
25 * modify one block of data.
26 *
27 * We may have to touch one inode, one bitmap buffer, up to three
28 * indirection blocks, the group and superblock summaries, and the data
29 * block to complete the transaction. */
30
31#define EXT3_SINGLEDATA_TRANS_BLOCKS 8U
32
33/* Extended attribute operations touch at most two data buffers,
34 * two bitmap buffers, and two group summaries, in addition to the inode
35 * and the superblock, which are already accounted for. */
36
37#define EXT3_XATTR_TRANS_BLOCKS 6U
38
39/* Define the minimum size for a transaction which modifies data. This
40 * needs to take into account the fact that we may end up modifying two
41 * quota files too (one for the group, one for the user quota). The
42 * superblock only gets updated once, of course, so don't bother
43 * counting that again for the quota updates. */
44
45#define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \
46 EXT3_XATTR_TRANS_BLOCKS - 2 + \
47 EXT3_MAXQUOTAS_TRANS_BLOCKS(sb))
48
49/* Delete operations potentially hit one directory's namespace plus an
50 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
51 * generous. We can grow the delete transaction later if necessary. */
52
53#define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64)
54
55/* Define an arbitrary limit for the amount of data we will anticipate
56 * writing to any given transaction. For unbounded transactions such as
57 * write(2) and truncate(2) we can write more than this, but we always
58 * start off at the maximum transaction size and grow the transaction
59 * optimistically as we go. */
60
61#define EXT3_MAX_TRANS_DATA 64U
62
63/* We break up a large truncate or write transaction once the handle's
64 * buffer credits gets this low, we need either to extend the
65 * transaction or to start a new one. Reserve enough space here for
66 * inode, bitmap, superblock, group and indirection updates for at least
67 * one block, plus two quota updates. Quota allocations are not
68 * needed. */
69
70#define EXT3_RESERVE_TRANS_BLOCKS 12U
71
72#define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8
73
74#ifdef CONFIG_QUOTA
75/* Amount of blocks needed for quota update - we know that the structure was
76 * allocated so we need to update only inode+data */
77#define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0)
78/* Amount of blocks needed for quota insert/delete - we do some block writes
79 * but inode, sb and group updates are done only once */
80#define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
81 (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0)
82#define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
83 (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0)
84#else
85#define EXT3_QUOTA_TRANS_BLOCKS(sb) 0
86#define EXT3_QUOTA_INIT_BLOCKS(sb) 0
87#define EXT3_QUOTA_DEL_BLOCKS(sb) 0
88#endif
89#define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb))
90#define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb))
91#define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb))
92
93int
94ext3_mark_iloc_dirty(handle_t *handle,
95 struct inode *inode,
96 struct ext3_iloc *iloc);
97
98/*
99 * On success, We end up with an outstanding reference count against
100 * iloc->bh. This _must_ be cleaned up later.
101 */
102
103int ext3_reserve_inode_write(handle_t *handle, struct inode *inode,
104 struct ext3_iloc *iloc);
105
106int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode);
107
108/*
109 * Wrapper functions with which ext3 calls into JBD. The intent here is
110 * to allow these to be turned into appropriate stubs so ext3 can control
111 * ext2 filesystems, so ext2+ext3 systems only nee one fs. This work hasn't
112 * been done yet.
113 */
114
115static inline void ext3_journal_release_buffer(handle_t *handle,
116 struct buffer_head *bh)
117{
118 journal_release_buffer(handle, bh);
119}
120
121void ext3_journal_abort_handle(const char *caller, const char *err_fn,
122 struct buffer_head *bh, handle_t *handle, int err);
123
124int __ext3_journal_get_undo_access(const char *where, handle_t *handle,
125 struct buffer_head *bh);
126
127int __ext3_journal_get_write_access(const char *where, handle_t *handle,
128 struct buffer_head *bh);
129
130int __ext3_journal_forget(const char *where, handle_t *handle,
131 struct buffer_head *bh);
132
133int __ext3_journal_revoke(const char *where, handle_t *handle,
134 unsigned long blocknr, struct buffer_head *bh);
135
136int __ext3_journal_get_create_access(const char *where,
137 handle_t *handle, struct buffer_head *bh);
138
139int __ext3_journal_dirty_metadata(const char *where,
140 handle_t *handle, struct buffer_head *bh);
141
142#define ext3_journal_get_undo_access(handle, bh) \
143 __ext3_journal_get_undo_access(__func__, (handle), (bh))
144#define ext3_journal_get_write_access(handle, bh) \
145 __ext3_journal_get_write_access(__func__, (handle), (bh))
146#define ext3_journal_revoke(handle, blocknr, bh) \
147 __ext3_journal_revoke(__func__, (handle), (blocknr), (bh))
148#define ext3_journal_get_create_access(handle, bh) \
149 __ext3_journal_get_create_access(__func__, (handle), (bh))
150#define ext3_journal_dirty_metadata(handle, bh) \
151 __ext3_journal_dirty_metadata(__func__, (handle), (bh))
152#define ext3_journal_forget(handle, bh) \
153 __ext3_journal_forget(__func__, (handle), (bh))
154
155int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh);
156
157handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks);
158int __ext3_journal_stop(const char *where, handle_t *handle);
159
160static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks)
161{
162 return ext3_journal_start_sb(inode->i_sb, nblocks);
163}
164
165#define ext3_journal_stop(handle) \
166 __ext3_journal_stop(__func__, (handle))
167
168static inline handle_t *ext3_journal_current_handle(void)
169{
170 return journal_current_handle();
171}
172
173static inline int ext3_journal_extend(handle_t *handle, int nblocks)
174{
175 return journal_extend(handle, nblocks);
176}
177
178static inline int ext3_journal_restart(handle_t *handle, int nblocks)
179{
180 return journal_restart(handle, nblocks);
181}
182
183static inline int ext3_journal_blocks_per_page(struct inode *inode)
184{
185 return journal_blocks_per_page(inode);
186}
187
188static inline int ext3_journal_force_commit(journal_t *journal)
189{
190 return journal_force_commit(journal);
191}
192
193/* super.c */
194int ext3_force_commit(struct super_block *sb);
195
196static inline int ext3_should_journal_data(struct inode *inode)
197{
198 if (!S_ISREG(inode->i_mode))
199 return 1;
200 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
201 return 1;
202 if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
203 return 1;
204 return 0;
205}
206
207static inline int ext3_should_order_data(struct inode *inode)
208{
209 if (!S_ISREG(inode->i_mode))
210 return 0;
211 if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
212 return 0;
213 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA)
214 return 1;
215 return 0;
216}
217
218static inline int ext3_should_writeback_data(struct inode *inode)
219{
220 if (!S_ISREG(inode->i_mode))
221 return 0;
222 if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
223 return 0;
224 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)
225 return 1;
226 return 0;
227}
228
229#endif /* _LINUX_EXT3_JBD_H */
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 82163c4b32c9..158a41eed314 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -21,23 +21,45 @@
21 */ 21 */
22#define NR_OPEN_DEFAULT BITS_PER_LONG 22#define NR_OPEN_DEFAULT BITS_PER_LONG
23 23
24/*
25 * The embedded_fd_set is a small fd_set,
26 * suitable for most tasks (which open <= BITS_PER_LONG files)
27 */
28struct embedded_fd_set {
29 unsigned long fds_bits[1];
30};
31
32struct fdtable { 24struct fdtable {
33 unsigned int max_fds; 25 unsigned int max_fds;
34 struct file __rcu **fd; /* current fd array */ 26 struct file __rcu **fd; /* current fd array */
35 fd_set *close_on_exec; 27 unsigned long *close_on_exec;
36 fd_set *open_fds; 28 unsigned long *open_fds;
37 struct rcu_head rcu; 29 struct rcu_head rcu;
38 struct fdtable *next; 30 struct fdtable *next;
39}; 31};
40 32
33static inline void __set_close_on_exec(int fd, struct fdtable *fdt)
34{
35 __set_bit(fd, fdt->close_on_exec);
36}
37
38static inline void __clear_close_on_exec(int fd, struct fdtable *fdt)
39{
40 __clear_bit(fd, fdt->close_on_exec);
41}
42
43static inline bool close_on_exec(int fd, const struct fdtable *fdt)
44{
45 return test_bit(fd, fdt->close_on_exec);
46}
47
48static inline void __set_open_fd(int fd, struct fdtable *fdt)
49{
50 __set_bit(fd, fdt->open_fds);
51}
52
53static inline void __clear_open_fd(int fd, struct fdtable *fdt)
54{
55 __clear_bit(fd, fdt->open_fds);
56}
57
58static inline bool fd_is_open(int fd, const struct fdtable *fdt)
59{
60 return test_bit(fd, fdt->open_fds);
61}
62
41/* 63/*
42 * Open file table structure 64 * Open file table structure
43 */ 65 */
@@ -53,8 +75,8 @@ struct files_struct {
53 */ 75 */
54 spinlock_t file_lock ____cacheline_aligned_in_smp; 76 spinlock_t file_lock ____cacheline_aligned_in_smp;
55 int next_fd; 77 int next_fd;
56 struct embedded_fd_set close_on_exec_init; 78 unsigned long close_on_exec_init[1];
57 struct embedded_fd_set open_fds_init; 79 unsigned long open_fds_init[1];
58 struct file __rcu * fd_array[NR_OPEN_DEFAULT]; 80 struct file __rcu * fd_array[NR_OPEN_DEFAULT];
59}; 81};
60 82
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 4db7b68f0582..cdc9b719e9c7 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -2,6 +2,7 @@
2#define _LINUX_FIREWIRE_H 2#define _LINUX_FIREWIRE_H
3 3
4#include <linux/completion.h> 4#include <linux/completion.h>
5#include <linux/device.h>
5#include <linux/dma-mapping.h> 6#include <linux/dma-mapping.h>
6#include <linux/kernel.h> 7#include <linux/kernel.h>
7#include <linux/kref.h> 8#include <linux/kref.h>
@@ -64,8 +65,6 @@
64#define CSR_MODEL 0x17 65#define CSR_MODEL 0x17
65#define CSR_DIRECTORY_ID 0x20 66#define CSR_DIRECTORY_ID 0x20
66 67
67struct device;
68
69struct fw_csr_iterator { 68struct fw_csr_iterator {
70 const u32 *p; 69 const u32 *p;
71 const u32 *end; 70 const u32 *end;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index fa63f1b46103..8de675523e46 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -92,6 +92,10 @@ struct inodes_stat_t {
92/* File is opened using open(.., 3, ..) and is writeable only for ioctls 92/* File is opened using open(.., 3, ..) and is writeable only for ioctls
93 (specialy hack for floppy.c) */ 93 (specialy hack for floppy.c) */
94#define FMODE_WRITE_IOCTL ((__force fmode_t)0x100) 94#define FMODE_WRITE_IOCTL ((__force fmode_t)0x100)
95/* 32bit hashes as llseek() offset (for directories) */
96#define FMODE_32BITHASH ((__force fmode_t)0x200)
97/* 64bit hashes as llseek() offset (for directories) */
98#define FMODE_64BITHASH ((__force fmode_t)0x400)
95 99
96/* 100/*
97 * Don't update ctime and mtime. 101 * Don't update ctime and mtime.
@@ -1211,6 +1215,7 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
1211extern int lease_modify(struct file_lock **, int); 1215extern int lease_modify(struct file_lock **, int);
1212extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1216extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1213extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1217extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1218extern void locks_delete_block(struct file_lock *waiter);
1214extern void lock_flocks(void); 1219extern void lock_flocks(void);
1215extern void unlock_flocks(void); 1220extern void unlock_flocks(void);
1216#else /* !CONFIG_FILE_LOCKING */ 1221#else /* !CONFIG_FILE_LOCKING */
@@ -1355,6 +1360,10 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1355 return 1; 1360 return 1;
1356} 1361}
1357 1362
1363static inline void locks_delete_block(struct file_lock *waiter)
1364{
1365}
1366
1358static inline void lock_flocks(void) 1367static inline void lock_flocks(void)
1359{ 1368{
1360} 1369}
@@ -1872,19 +1881,6 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1872 const struct dentry_operations *dops, 1881 const struct dentry_operations *dops,
1873 unsigned long); 1882 unsigned long);
1874 1883
1875static inline void sb_mark_dirty(struct super_block *sb)
1876{
1877 sb->s_dirt = 1;
1878}
1879static inline void sb_mark_clean(struct super_block *sb)
1880{
1881 sb->s_dirt = 0;
1882}
1883static inline int sb_is_dirty(struct super_block *sb)
1884{
1885 return sb->s_dirt;
1886}
1887
1888/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1884/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1889#define fops_get(fops) \ 1885#define fops_get(fops) \
1890 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) 1886 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
@@ -2515,6 +2511,7 @@ extern int dcache_readdir(struct file *, void *, filldir_t);
2515extern int simple_setattr(struct dentry *, struct iattr *); 2511extern int simple_setattr(struct dentry *, struct iattr *);
2516extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2512extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2517extern int simple_statfs(struct dentry *, struct kstatfs *); 2513extern int simple_statfs(struct dentry *, struct kstatfs *);
2514extern int simple_open(struct inode *inode, struct file *file);
2518extern int simple_link(struct dentry *, struct inode *, struct dentry *); 2515extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2519extern int simple_unlink(struct inode *, struct dentry *); 2516extern int simple_unlink(struct inode *, struct dentry *);
2520extern int simple_rmdir(struct inode *, struct dentry *); 2517extern int simple_rmdir(struct inode *, struct dentry *);
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
new file mode 100644
index 000000000000..203d7c4a3e11
--- /dev/null
+++ b/include/linux/fsl/mxs-dma.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
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 */
8
9#ifndef __MACH_MXS_DMA_H__
10#define __MACH_MXS_DMA_H__
11
12#include <linux/dmaengine.h>
13
14struct mxs_dma_data {
15 int chan_irq;
16};
17
18static inline int mxs_dma_is_apbh(struct dma_chan *chan)
19{
20 return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
21}
22
23static inline int mxs_dma_is_apbx(struct dma_chan *chan)
24{
25 return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
26}
27
28#endif /* __MACH_MXS_DMA_H__ */
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index dd478fc8f9f5..5f3f3be5af09 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -144,12 +144,14 @@ struct event_filter;
144enum trace_reg { 144enum trace_reg {
145 TRACE_REG_REGISTER, 145 TRACE_REG_REGISTER,
146 TRACE_REG_UNREGISTER, 146 TRACE_REG_UNREGISTER,
147#ifdef CONFIG_PERF_EVENTS
147 TRACE_REG_PERF_REGISTER, 148 TRACE_REG_PERF_REGISTER,
148 TRACE_REG_PERF_UNREGISTER, 149 TRACE_REG_PERF_UNREGISTER,
149 TRACE_REG_PERF_OPEN, 150 TRACE_REG_PERF_OPEN,
150 TRACE_REG_PERF_CLOSE, 151 TRACE_REG_PERF_CLOSE,
151 TRACE_REG_PERF_ADD, 152 TRACE_REG_PERF_ADD,
152 TRACE_REG_PERF_DEL, 153 TRACE_REG_PERF_DEL,
154#endif
153}; 155};
154 156
155struct ftrace_event_call; 157struct ftrace_event_call;
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index ed5a46707ad0..6155ecf192b0 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -14,6 +14,12 @@
14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) 14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) 15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
16 16
17/* Gpio pin is open drain */
18#define GPIOF_OPEN_DRAIN (1 << 2)
19
20/* Gpio pin is open source */
21#define GPIOF_OPEN_SOURCE (1 << 3)
22
17/** 23/**
18 * struct gpio - a structure describing a GPIO with configuration 24 * struct gpio - a structure describing a GPIO with configuration
19 * @gpio: the GPIO number 25 * @gpio: the GPIO number
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 004ff33ab38e..a7e977ff4abf 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -6,7 +6,7 @@ struct device;
6struct gpio_keys_button { 6struct gpio_keys_button {
7 /* Configuration parameters */ 7 /* Configuration parameters */
8 unsigned int code; /* input event code (KEY_*, SW_*) */ 8 unsigned int code; /* input event code (KEY_*, SW_*) */
9 int gpio; 9 int gpio; /* -1 if this key does not support gpio */
10 int active_low; 10 int active_low;
11 const char *desc; 11 const char *desc;
12 unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */ 12 unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */
@@ -14,6 +14,7 @@ struct gpio_keys_button {
14 int debounce_interval; /* debounce ticks interval in msecs */ 14 int debounce_interval; /* debounce ticks interval in msecs */
15 bool can_disable; 15 bool can_disable;
16 int value; /* axis value for EV_ABS */ 16 int value; /* axis value for EV_ABS */
17 unsigned int irq; /* Irq number in case of interrupt keys */
17}; 18};
18 19
19struct gpio_keys_platform_data { 20struct gpio_keys_platform_data {
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild
new file mode 100644
index 000000000000..271a770b4784
--- /dev/null
+++ b/include/linux/hsi/Kbuild
@@ -0,0 +1 @@
header-y += hsi_char.h
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
new file mode 100644
index 000000000000..4b178067f405
--- /dev/null
+++ b/include/linux/hsi/hsi.h
@@ -0,0 +1,410 @@
1/*
2 * HSI core header file.
3 *
4 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
5 *
6 * Contact: Carlos Chinea <carlos.chinea@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * 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., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_HSI_H__
24#define __LINUX_HSI_H__
25
26#include <linux/device.h>
27#include <linux/mutex.h>
28#include <linux/scatterlist.h>
29#include <linux/spinlock.h>
30#include <linux/list.h>
31#include <linux/module.h>
32
33/* HSI message ttype */
34#define HSI_MSG_READ 0
35#define HSI_MSG_WRITE 1
36
37/* HSI configuration values */
38enum {
39 HSI_MODE_STREAM = 1,
40 HSI_MODE_FRAME,
41};
42
43enum {
44 HSI_FLOW_SYNC, /* Synchronized flow */
45 HSI_FLOW_PIPE, /* Pipelined flow */
46};
47
48enum {
49 HSI_ARB_RR, /* Round-robin arbitration */
50 HSI_ARB_PRIO, /* Channel priority arbitration */
51};
52
53#define HSI_MAX_CHANNELS 16
54
55/* HSI message status codes */
56enum {
57 HSI_STATUS_COMPLETED, /* Message transfer is completed */
58 HSI_STATUS_PENDING, /* Message pending to be read/write (POLL) */
59 HSI_STATUS_PROCEEDING, /* Message transfer is ongoing */
60 HSI_STATUS_QUEUED, /* Message waiting to be served */
61 HSI_STATUS_ERROR, /* Error when message transfer was ongoing */
62};
63
64/* HSI port event codes */
65enum {
66 HSI_EVENT_START_RX,
67 HSI_EVENT_STOP_RX,
68};
69
70/**
71 * struct hsi_config - Configuration for RX/TX HSI modules
72 * @mode: Bit transmission mode (STREAM or FRAME)
73 * @channels: Number of channels to use [1..16]
74 * @speed: Max bit transmission speed (Kbit/s)
75 * @flow: RX flow type (SYNCHRONIZED or PIPELINE)
76 * @arb_mode: Arbitration mode for TX frame (Round robin, priority)
77 */
78struct hsi_config {
79 unsigned int mode;
80 unsigned int channels;
81 unsigned int speed;
82 union {
83 unsigned int flow; /* RX only */
84 unsigned int arb_mode; /* TX only */
85 };
86};
87
88/**
89 * struct hsi_board_info - HSI client board info
90 * @name: Name for the HSI device
91 * @hsi_id: HSI controller id where the client sits
92 * @port: Port number in the controller where the client sits
93 * @tx_cfg: HSI TX configuration
94 * @rx_cfg: HSI RX configuration
95 * @platform_data: Platform related data
96 * @archdata: Architecture-dependent device data
97 */
98struct hsi_board_info {
99 const char *name;
100 unsigned int hsi_id;
101 unsigned int port;
102 struct hsi_config tx_cfg;
103 struct hsi_config rx_cfg;
104 void *platform_data;
105 struct dev_archdata *archdata;
106};
107
108#ifdef CONFIG_HSI_BOARDINFO
109extern int hsi_register_board_info(struct hsi_board_info const *info,
110 unsigned int len);
111#else
112static inline int hsi_register_board_info(struct hsi_board_info const *info,
113 unsigned int len)
114{
115 return 0;
116}
117#endif /* CONFIG_HSI_BOARDINFO */
118
119/**
120 * struct hsi_client - HSI client attached to an HSI port
121 * @device: Driver model representation of the device
122 * @tx_cfg: HSI TX configuration
123 * @rx_cfg: HSI RX configuration
124 * @hsi_start_rx: Called after incoming wake line goes high
125 * @hsi_stop_rx: Called after incoming wake line goes low
126 */
127struct hsi_client {
128 struct device device;
129 struct hsi_config tx_cfg;
130 struct hsi_config rx_cfg;
131 void (*hsi_start_rx)(struct hsi_client *cl);
132 void (*hsi_stop_rx)(struct hsi_client *cl);
133 /* private: */
134 unsigned int pclaimed:1;
135 struct list_head link;
136};
137
138#define to_hsi_client(dev) container_of(dev, struct hsi_client, device)
139
140static inline void hsi_client_set_drvdata(struct hsi_client *cl, void *data)
141{
142 dev_set_drvdata(&cl->device, data);
143}
144
145static inline void *hsi_client_drvdata(struct hsi_client *cl)
146{
147 return dev_get_drvdata(&cl->device);
148}
149
150/**
151 * struct hsi_client_driver - Driver associated to an HSI client
152 * @driver: Driver model representation of the driver
153 */
154struct hsi_client_driver {
155 struct device_driver driver;
156};
157
158#define to_hsi_client_driver(drv) container_of(drv, struct hsi_client_driver,\
159 driver)
160
161int hsi_register_client_driver(struct hsi_client_driver *drv);
162
163static inline void hsi_unregister_client_driver(struct hsi_client_driver *drv)
164{
165 driver_unregister(&drv->driver);
166}
167
168/**
169 * struct hsi_msg - HSI message descriptor
170 * @link: Free to use by the current descriptor owner
171 * @cl: HSI device client that issues the transfer
172 * @sgt: Head of the scatterlist array
173 * @context: Client context data associated to the transfer
174 * @complete: Transfer completion callback
175 * @destructor: Destructor to free resources when flushing
176 * @status: Status of the transfer when completed
177 * @actual_len: Actual length of data transfered on completion
178 * @channel: Channel were to TX/RX the message
179 * @ttype: Transfer type (TX if set, RX otherwise)
180 * @break_frame: if true HSI will send/receive a break frame. Data buffers are
181 * ignored in the request.
182 */
183struct hsi_msg {
184 struct list_head link;
185 struct hsi_client *cl;
186 struct sg_table sgt;
187 void *context;
188
189 void (*complete)(struct hsi_msg *msg);
190 void (*destructor)(struct hsi_msg *msg);
191
192 int status;
193 unsigned int actual_len;
194 unsigned int channel;
195 unsigned int ttype:1;
196 unsigned int break_frame:1;
197};
198
199struct hsi_msg *hsi_alloc_msg(unsigned int n_frag, gfp_t flags);
200void hsi_free_msg(struct hsi_msg *msg);
201
202/**
203 * struct hsi_port - HSI port device
204 * @device: Driver model representation of the device
205 * @tx_cfg: Current TX path configuration
206 * @rx_cfg: Current RX path configuration
207 * @num: Port number
208 * @shared: Set when port can be shared by different clients
209 * @claimed: Reference count of clients which claimed the port
210 * @lock: Serialize port claim
211 * @async: Asynchronous transfer callback
212 * @setup: Callback to set the HSI client configuration
213 * @flush: Callback to clean the HW state and destroy all pending transfers
214 * @start_tx: Callback to inform that a client wants to TX data
215 * @stop_tx: Callback to inform that a client no longer wishes to TX data
216 * @release: Callback to inform that a client no longer uses the port
217 * @clients: List of hsi_clients using the port.
218 * @clock: Lock to serialize access to the clients list.
219 */
220struct hsi_port {
221 struct device device;
222 struct hsi_config tx_cfg;
223 struct hsi_config rx_cfg;
224 unsigned int num;
225 unsigned int shared:1;
226 int claimed;
227 struct mutex lock;
228 int (*async)(struct hsi_msg *msg);
229 int (*setup)(struct hsi_client *cl);
230 int (*flush)(struct hsi_client *cl);
231 int (*start_tx)(struct hsi_client *cl);
232 int (*stop_tx)(struct hsi_client *cl);
233 int (*release)(struct hsi_client *cl);
234 struct list_head clients;
235 spinlock_t clock;
236};
237
238#define to_hsi_port(dev) container_of(dev, struct hsi_port, device)
239#define hsi_get_port(cl) to_hsi_port((cl)->device.parent)
240
241void hsi_event(struct hsi_port *port, unsigned int event);
242int hsi_claim_port(struct hsi_client *cl, unsigned int share);
243void hsi_release_port(struct hsi_client *cl);
244
245static inline int hsi_port_claimed(struct hsi_client *cl)
246{
247 return cl->pclaimed;
248}
249
250static inline void hsi_port_set_drvdata(struct hsi_port *port, void *data)
251{
252 dev_set_drvdata(&port->device, data);
253}
254
255static inline void *hsi_port_drvdata(struct hsi_port *port)
256{
257 return dev_get_drvdata(&port->device);
258}
259
260/**
261 * struct hsi_controller - HSI controller device
262 * @device: Driver model representation of the device
263 * @owner: Pointer to the module owning the controller
264 * @id: HSI controller ID
265 * @num_ports: Number of ports in the HSI controller
266 * @port: Array of HSI ports
267 */
268struct hsi_controller {
269 struct device device;
270 struct module *owner;
271 unsigned int id;
272 unsigned int num_ports;
273 struct hsi_port *port;
274};
275
276#define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device)
277
278struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
279void hsi_free_controller(struct hsi_controller *hsi);
280int hsi_register_controller(struct hsi_controller *hsi);
281void hsi_unregister_controller(struct hsi_controller *hsi);
282
283static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,
284 void *data)
285{
286 dev_set_drvdata(&hsi->device, data);
287}
288
289static inline void *hsi_controller_drvdata(struct hsi_controller *hsi)
290{
291 return dev_get_drvdata(&hsi->device);
292}
293
294static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi,
295 unsigned int num)
296{
297 return (num < hsi->num_ports) ? &hsi->port[num] : NULL;
298}
299
300/*
301 * API for HSI clients
302 */
303int hsi_async(struct hsi_client *cl, struct hsi_msg *msg);
304
305/**
306 * hsi_id - Get HSI controller ID associated to a client
307 * @cl: Pointer to a HSI client
308 *
309 * Return the controller id where the client is attached to
310 */
311static inline unsigned int hsi_id(struct hsi_client *cl)
312{
313 return to_hsi_controller(cl->device.parent->parent)->id;
314}
315
316/**
317 * hsi_port_id - Gets the port number a client is attached to
318 * @cl: Pointer to HSI client
319 *
320 * Return the port number associated to the client
321 */
322static inline unsigned int hsi_port_id(struct hsi_client *cl)
323{
324 return to_hsi_port(cl->device.parent)->num;
325}
326
327/**
328 * hsi_setup - Configure the client's port
329 * @cl: Pointer to the HSI client
330 *
331 * When sharing ports, clients should either relay on a single
332 * client setup or have the same setup for all of them.
333 *
334 * Return -errno on failure, 0 on success
335 */
336static inline int hsi_setup(struct hsi_client *cl)
337{
338 if (!hsi_port_claimed(cl))
339 return -EACCES;
340 return hsi_get_port(cl)->setup(cl);
341}
342
343/**
344 * hsi_flush - Flush all pending transactions on the client's port
345 * @cl: Pointer to the HSI client
346 *
347 * This function will destroy all pending hsi_msg in the port and reset
348 * the HW port so it is ready to receive and transmit from a clean state.
349 *
350 * Return -errno on failure, 0 on success
351 */
352static inline int hsi_flush(struct hsi_client *cl)
353{
354 if (!hsi_port_claimed(cl))
355 return -EACCES;
356 return hsi_get_port(cl)->flush(cl);
357}
358
359/**
360 * hsi_async_read - Submit a read transfer
361 * @cl: Pointer to the HSI client
362 * @msg: HSI message descriptor of the transfer
363 *
364 * Return -errno on failure, 0 on success
365 */
366static inline int hsi_async_read(struct hsi_client *cl, struct hsi_msg *msg)
367{
368 msg->ttype = HSI_MSG_READ;
369 return hsi_async(cl, msg);
370}
371
372/**
373 * hsi_async_write - Submit a write transfer
374 * @cl: Pointer to the HSI client
375 * @msg: HSI message descriptor of the transfer
376 *
377 * Return -errno on failure, 0 on success
378 */
379static inline int hsi_async_write(struct hsi_client *cl, struct hsi_msg *msg)
380{
381 msg->ttype = HSI_MSG_WRITE;
382 return hsi_async(cl, msg);
383}
384
385/**
386 * hsi_start_tx - Signal the port that the client wants to start a TX
387 * @cl: Pointer to the HSI client
388 *
389 * Return -errno on failure, 0 on success
390 */
391static inline int hsi_start_tx(struct hsi_client *cl)
392{
393 if (!hsi_port_claimed(cl))
394 return -EACCES;
395 return hsi_get_port(cl)->start_tx(cl);
396}
397
398/**
399 * hsi_stop_tx - Signal the port that the client no longer wants to transmit
400 * @cl: Pointer to the HSI client
401 *
402 * Return -errno on failure, 0 on success
403 */
404static inline int hsi_stop_tx(struct hsi_client *cl)
405{
406 if (!hsi_port_claimed(cl))
407 return -EACCES;
408 return hsi_get_port(cl)->stop_tx(cl);
409}
410#endif /* __LINUX_HSI_H__ */
diff --git a/include/linux/hsi/hsi_char.h b/include/linux/hsi/hsi_char.h
new file mode 100644
index 000000000000..76160b4f455d
--- /dev/null
+++ b/include/linux/hsi/hsi_char.h
@@ -0,0 +1,63 @@
1/*
2 * Part of the HSI character device driver.
3 *
4 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
5 *
6 * Contact: Andras Domokos <andras.domokos at nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * 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., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23
24#ifndef __HSI_CHAR_H
25#define __HSI_CHAR_H
26
27#define HSI_CHAR_MAGIC 'k'
28#define HSC_IOW(num, dtype) _IOW(HSI_CHAR_MAGIC, num, dtype)
29#define HSC_IOR(num, dtype) _IOR(HSI_CHAR_MAGIC, num, dtype)
30#define HSC_IOWR(num, dtype) _IOWR(HSI_CHAR_MAGIC, num, dtype)
31#define HSC_IO(num) _IO(HSI_CHAR_MAGIC, num)
32
33#define HSC_RESET HSC_IO(16)
34#define HSC_SET_PM HSC_IO(17)
35#define HSC_SEND_BREAK HSC_IO(18)
36#define HSC_SET_RX HSC_IOW(19, struct hsc_rx_config)
37#define HSC_GET_RX HSC_IOW(20, struct hsc_rx_config)
38#define HSC_SET_TX HSC_IOW(21, struct hsc_tx_config)
39#define HSC_GET_TX HSC_IOW(22, struct hsc_tx_config)
40
41#define HSC_PM_DISABLE 0
42#define HSC_PM_ENABLE 1
43
44#define HSC_MODE_STREAM 1
45#define HSC_MODE_FRAME 2
46#define HSC_FLOW_SYNC 0
47#define HSC_ARB_RR 0
48#define HSC_ARB_PRIO 1
49
50struct hsc_rx_config {
51 uint32_t mode;
52 uint32_t flow;
53 uint32_t channels;
54};
55
56struct hsc_tx_config {
57 uint32_t mode;
58 uint32_t channels;
59 uint32_t speed;
60 uint32_t arb_mode;
61};
62
63#endif /* __HSI_CHAR_H */
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index 584ffa0f3282..63904ba6887e 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -15,7 +15,8 @@
15 15
16 You should have received a copy of the GNU General Public License 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 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 MA 02110-1301 USA. */
19/* ------------------------------------------------------------------------- */ 20/* ------------------------------------------------------------------------- */
20 21
21/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even 22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 0f91a957a690..538e8f41a319 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -16,7 +16,8 @@
16 16
17 You should have received a copy of the GNU General Public License 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 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA. */
20/* ------------------------------------------------------------------------- */ 21/* ------------------------------------------------------------------------- */
21 22
22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even 23/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h
index fd53bfd26470..8a7406b2114d 100644
--- a/include/linux/i2c-dev.h
+++ b/include/linux/i2c-dev.h
@@ -16,7 +16,8 @@
16 16
17 You should have received a copy of the GNU General Public License 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 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA.
20*/ 21*/
21 22
22#ifndef _LINUX_I2C_DEV_H 23#ifndef _LINUX_I2C_DEV_H
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index 34536effd652..747f0cde4164 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -18,7 +18,8 @@
18 * 18 *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301 USA.
22 */ 23 */
23 24
24#ifndef _LINUX_I2C_MUX_H 25#ifndef _LINUX_I2C_MUX_H
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h
index 63f57a8c8b31..017fb40f702a 100644
--- a/include/linux/i2c-smbus.h
+++ b/include/linux/i2c-smbus.h
@@ -15,7 +15,8 @@
15 * 15 *
16 * You should have received a copy of the GNU General Public License 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 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301 USA.
19 */ 20 */
20 21
21#ifndef _LINUX_I2C_SMBUS_H 22#ifndef _LINUX_I2C_SMBUS_H
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 8e25a9167f13..195d8b3d9cfb 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -17,7 +17,8 @@
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 MA 02110-1301 USA. */
21/* ------------------------------------------------------------------------- */ 22/* ------------------------------------------------------------------------- */
22 23
23/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and 24/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 7fcab23c59ce..2463b6100333 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -761,7 +761,7 @@ struct twl_regulator_driver_data {
761 761
762/*----------------------------------------------------------------------*/ 762/*----------------------------------------------------------------------*/
763 763
764int twl4030_sih_setup(int module); 764int twl4030_sih_setup(struct device *dev, int module, int irq_base);
765 765
766/* Offsets to Power Registers */ 766/* Offsets to Power Registers */
767#define TWL4030_VDAC_DEV_GRP 0x3B 767#define TWL4030_VDAC_DEV_GRP 0x3B
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 7afe15f916da..b17974917dbf 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -22,7 +22,6 @@
22#include <acpi/acpi.h> 22#include <acpi/acpi.h>
23#endif 23#endif
24#include <asm/byteorder.h> 24#include <asm/byteorder.h>
25#include <asm/system.h>
26#include <asm/io.h> 25#include <asm/io.h>
27 26
28/* for request_sense */ 27/* for request_sense */
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 3f830e005118..2aea5d22db07 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -19,7 +19,6 @@
19 19
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/system.h>
23 22
24/* 23/*
25 * These correspond to the IORESOURCE_IRQ_* defines in 24 * These correspond to the IORESOURCE_IRQ_* defines in
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 5557baefed60..912c30a8ddb1 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -971,6 +971,10 @@ extern void __journal_clean_data_list(transaction_t *transaction);
971/* Log buffer allocation */ 971/* Log buffer allocation */
972extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); 972extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *);
973int jbd2_journal_next_log_block(journal_t *, unsigned long long *); 973int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
974int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
975 unsigned long *block);
976void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
977void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
974 978
975/* Commit management */ 979/* Commit management */
976extern void jbd2_journal_commit_transaction(journal_t *); 980extern void jbd2_journal_commit_transaction(journal_t *);
@@ -1020,6 +1024,11 @@ jbd2_journal_write_metadata_buffer(transaction_t *transaction,
1020/* Transaction locking */ 1024/* Transaction locking */
1021extern void __wait_on_journal (journal_t *); 1025extern void __wait_on_journal (journal_t *);
1022 1026
1027/* Transaction cache support */
1028extern void jbd2_journal_destroy_transaction_cache(void);
1029extern int jbd2_journal_init_transaction_cache(void);
1030extern void jbd2_journal_free_transaction(transaction_t *);
1031
1023/* 1032/*
1024 * Journal locking. 1033 * Journal locking.
1025 * 1034 *
@@ -1082,7 +1091,8 @@ extern int jbd2_journal_destroy (journal_t *);
1082extern int jbd2_journal_recover (journal_t *journal); 1091extern int jbd2_journal_recover (journal_t *journal);
1083extern int jbd2_journal_wipe (journal_t *, int); 1092extern int jbd2_journal_wipe (journal_t *, int);
1084extern int jbd2_journal_skip_recovery (journal_t *); 1093extern int jbd2_journal_skip_recovery (journal_t *);
1085extern void jbd2_journal_update_superblock (journal_t *, int); 1094extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t,
1095 unsigned long, int);
1086extern void __jbd2_journal_abort_hard (journal_t *); 1096extern void __jbd2_journal_abort_hard (journal_t *);
1087extern void jbd2_journal_abort (journal_t *, int); 1097extern void jbd2_journal_abort (journal_t *, int);
1088extern int jbd2_journal_errno (journal_t *); 1098extern int jbd2_journal_errno (journal_t *);
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 423cb6d78ee0..c18b46f8aeeb 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -66,6 +66,8 @@ struct journal_head {
66 * transaction (if there is one). Only applies to buffers on a 66 * transaction (if there is one). Only applies to buffers on a
67 * transaction's data or metadata journaling list. 67 * transaction's data or metadata journaling list.
68 * [j_list_lock] [jbd_lock_bh_state()] 68 * [j_list_lock] [jbd_lock_bh_state()]
69 * Either of these locks is enough for reading, both are needed for
70 * changes.
69 */ 71 */
70 transaction_t *b_transaction; 72 transaction_t *b_transaction;
71 73
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 5db52d0ff1d4..645231c373c8 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_KERNEL_H 1#ifndef _LINUX_KERNEL_H
2#define _LINUX_KERNEL_H 2#define _LINUX_KERNEL_H
3 3
4#include <linux/sysinfo.h>
5
4/* 6/*
5 * 'kernel.h' contains some often-used function prototypes etc 7 * 'kernel.h' contains some often-used function prototypes etc
6 */ 8 */
@@ -428,16 +430,10 @@ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
428 * Most likely, you want to use tracing_on/tracing_off. 430 * Most likely, you want to use tracing_on/tracing_off.
429 */ 431 */
430#ifdef CONFIG_RING_BUFFER 432#ifdef CONFIG_RING_BUFFER
431void tracing_on(void);
432void tracing_off(void);
433/* trace_off_permanent stops recording with no way to bring it back */ 433/* trace_off_permanent stops recording with no way to bring it back */
434void tracing_off_permanent(void); 434void tracing_off_permanent(void);
435int tracing_is_on(void);
436#else 435#else
437static inline void tracing_on(void) { }
438static inline void tracing_off(void) { }
439static inline void tracing_off_permanent(void) { } 436static inline void tracing_off_permanent(void) { }
440static inline int tracing_is_on(void) { return 0; }
441#endif 437#endif
442 438
443enum ftrace_dump_mode { 439enum ftrace_dump_mode {
@@ -447,6 +443,10 @@ enum ftrace_dump_mode {
447}; 443};
448 444
449#ifdef CONFIG_TRACING 445#ifdef CONFIG_TRACING
446void tracing_on(void);
447void tracing_off(void);
448int tracing_is_on(void);
449
450extern void tracing_start(void); 450extern void tracing_start(void);
451extern void tracing_stop(void); 451extern void tracing_stop(void);
452extern void ftrace_off_permanent(void); 452extern void ftrace_off_permanent(void);
@@ -531,6 +531,11 @@ static inline void tracing_start(void) { }
531static inline void tracing_stop(void) { } 531static inline void tracing_stop(void) { }
532static inline void ftrace_off_permanent(void) { } 532static inline void ftrace_off_permanent(void) { }
533static inline void trace_dump_stack(void) { } 533static inline void trace_dump_stack(void) { }
534
535static inline void tracing_on(void) { }
536static inline void tracing_off(void) { }
537static inline int tracing_is_on(void) { return 0; }
538
534static inline int 539static inline int
535trace_printk(const char *fmt, ...) 540trace_printk(const char *fmt, ...)
536{ 541{
@@ -698,27 +703,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
698# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 703# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
699#endif 704#endif
700 705
701struct sysinfo;
702extern int do_sysinfo(struct sysinfo *info); 706extern int do_sysinfo(struct sysinfo *info);
703 707
704#endif /* __KERNEL__ */ 708#endif /* __KERNEL__ */
705 709
706#define SI_LOAD_SHIFT 16
707struct sysinfo {
708 long uptime; /* Seconds since boot */
709 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
710 unsigned long totalram; /* Total usable main memory size */
711 unsigned long freeram; /* Available memory size */
712 unsigned long sharedram; /* Amount of shared memory */
713 unsigned long bufferram; /* Memory used by buffers */
714 unsigned long totalswap; /* Total swap space size */
715 unsigned long freeswap; /* swap space still available */
716 unsigned short procs; /* Number of current processes */
717 unsigned short pad; /* explicit padding for m68k */
718 unsigned long totalhigh; /* Total high memory size */
719 unsigned long freehigh; /* Available high memory size */
720 unsigned int mem_unit; /* Memory unit size in bytes */
721 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
722};
723
724#endif 710#endif
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index fa391835508d..c4d2fc194ede 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -63,7 +63,8 @@ enum kgdb_bptype {
63 BP_HARDWARE_BREAKPOINT, 63 BP_HARDWARE_BREAKPOINT,
64 BP_WRITE_WATCHPOINT, 64 BP_WRITE_WATCHPOINT,
65 BP_READ_WATCHPOINT, 65 BP_READ_WATCHPOINT,
66 BP_ACCESS_WATCHPOINT 66 BP_ACCESS_WATCHPOINT,
67 BP_POKE_BREAKPOINT,
67}; 68};
68 69
69enum kgdb_bpstate { 70enum kgdb_bpstate {
@@ -207,8 +208,8 @@ extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
207 208
208/* Optional functions. */ 209/* Optional functions. */
209extern int kgdb_validate_break_address(unsigned long addr); 210extern int kgdb_validate_break_address(unsigned long addr);
210extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); 211extern int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt);
211extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); 212extern int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt);
212 213
213/** 214/**
214 * kgdb_arch_late - Perform any architecture specific initalization. 215 * kgdb_arch_late - Perform any architecture specific initalization.
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 9efeae679106..dd99c329e161 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -110,12 +110,29 @@ call_usermodehelper(char *path, char **argv, char **envp, int wait)
110 110
111extern struct ctl_table usermodehelper_table[]; 111extern struct ctl_table usermodehelper_table[];
112 112
113enum umh_disable_depth {
114 UMH_ENABLED = 0,
115 UMH_FREEZING,
116 UMH_DISABLED,
117};
118
113extern void usermodehelper_init(void); 119extern void usermodehelper_init(void);
114 120
115extern int usermodehelper_disable(void); 121extern int __usermodehelper_disable(enum umh_disable_depth depth);
116extern void usermodehelper_enable(void); 122extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth);
117extern bool usermodehelper_is_disabled(void); 123
118extern void read_lock_usermodehelper(void); 124static inline int usermodehelper_disable(void)
119extern void read_unlock_usermodehelper(void); 125{
126 return __usermodehelper_disable(UMH_DISABLED);
127}
128
129static inline void usermodehelper_enable(void)
130{
131 __usermodehelper_set_disable_depth(UMH_ENABLED);
132}
133
134extern int usermodehelper_read_trylock(void);
135extern long usermodehelper_read_lock_wait(long timeout);
136extern void usermodehelper_read_unlock(void);
120 137
121#endif /* __LINUX_KMOD_H__ */ 138#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 68e67e50d028..6c322a90b92f 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -162,6 +162,7 @@ struct kvm_pit_config {
162#define KVM_EXIT_INTERNAL_ERROR 17 162#define KVM_EXIT_INTERNAL_ERROR 17
163#define KVM_EXIT_OSI 18 163#define KVM_EXIT_OSI 18
164#define KVM_EXIT_PAPR_HCALL 19 164#define KVM_EXIT_PAPR_HCALL 19
165#define KVM_EXIT_S390_UCONTROL 20
165 166
166/* For KVM_EXIT_INTERNAL_ERROR */ 167/* For KVM_EXIT_INTERNAL_ERROR */
167#define KVM_INTERNAL_ERROR_EMULATION 1 168#define KVM_INTERNAL_ERROR_EMULATION 1
@@ -249,6 +250,11 @@ struct kvm_run {
249#define KVM_S390_RESET_CPU_INIT 8 250#define KVM_S390_RESET_CPU_INIT 8
250#define KVM_S390_RESET_IPL 16 251#define KVM_S390_RESET_IPL 16
251 __u64 s390_reset_flags; 252 __u64 s390_reset_flags;
253 /* KVM_EXIT_S390_UCONTROL */
254 struct {
255 __u64 trans_exc_code;
256 __u32 pgm_code;
257 } s390_ucontrol;
252 /* KVM_EXIT_DCR */ 258 /* KVM_EXIT_DCR */
253 struct { 259 struct {
254 __u32 dcrn; 260 __u32 dcrn;
@@ -273,6 +279,20 @@ struct kvm_run {
273 /* Fix the size of the union. */ 279 /* Fix the size of the union. */
274 char padding[256]; 280 char padding[256];
275 }; 281 };
282
283 /*
284 * shared registers between kvm and userspace.
285 * kvm_valid_regs specifies the register classes set by the host
286 * kvm_dirty_regs specified the register classes dirtied by userspace
287 * struct kvm_sync_regs is architecture specific, as well as the
288 * bits for kvm_valid_regs and kvm_dirty_regs
289 */
290 __u64 kvm_valid_regs;
291 __u64 kvm_dirty_regs;
292 union {
293 struct kvm_sync_regs regs;
294 char padding[1024];
295 } s;
276}; 296};
277 297
278/* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ 298/* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */
@@ -431,6 +451,11 @@ struct kvm_ppc_pvinfo {
431 451
432#define KVMIO 0xAE 452#define KVMIO 0xAE
433 453
454/* machine type bits, to be used as argument to KVM_CREATE_VM */
455#define KVM_VM_S390_UCONTROL 1
456
457#define KVM_S390_SIE_PAGE_OFFSET 1
458
434/* 459/*
435 * ioctls for /dev/kvm fds: 460 * ioctls for /dev/kvm fds:
436 */ 461 */
@@ -555,9 +580,15 @@ struct kvm_ppc_pvinfo {
555#define KVM_CAP_PPC_SMT 64 580#define KVM_CAP_PPC_SMT 64
556#define KVM_CAP_PPC_RMA 65 581#define KVM_CAP_PPC_RMA 65
557#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ 582#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */
583#define KVM_CAP_PPC_HIOR 67
558#define KVM_CAP_PPC_PAPR 68 584#define KVM_CAP_PPC_PAPR 68
585#define KVM_CAP_SW_TLB 69
586#define KVM_CAP_ONE_REG 70
559#define KVM_CAP_S390_GMAP 71 587#define KVM_CAP_S390_GMAP 71
560#define KVM_CAP_TSC_DEADLINE_TIMER 72 588#define KVM_CAP_TSC_DEADLINE_TIMER 72
589#define KVM_CAP_S390_UCONTROL 73
590#define KVM_CAP_SYNC_REGS 74
591#define KVM_CAP_PCI_2_3 75
561 592
562#ifdef KVM_CAP_IRQ_ROUTING 593#ifdef KVM_CAP_IRQ_ROUTING
563 594
@@ -637,6 +668,52 @@ struct kvm_clock_data {
637 __u32 pad[9]; 668 __u32 pad[9];
638}; 669};
639 670
671#define KVM_MMU_FSL_BOOKE_NOHV 0
672#define KVM_MMU_FSL_BOOKE_HV 1
673
674struct kvm_config_tlb {
675 __u64 params;
676 __u64 array;
677 __u32 mmu_type;
678 __u32 array_len;
679};
680
681struct kvm_dirty_tlb {
682 __u64 bitmap;
683 __u32 num_dirty;
684};
685
686/* Available with KVM_CAP_ONE_REG */
687
688#define KVM_REG_ARCH_MASK 0xff00000000000000ULL
689#define KVM_REG_GENERIC 0x0000000000000000ULL
690
691/*
692 * Architecture specific registers are to be defined in arch headers and
693 * ORed with the arch identifier.
694 */
695#define KVM_REG_PPC 0x1000000000000000ULL
696#define KVM_REG_X86 0x2000000000000000ULL
697#define KVM_REG_IA64 0x3000000000000000ULL
698#define KVM_REG_ARM 0x4000000000000000ULL
699#define KVM_REG_S390 0x5000000000000000ULL
700
701#define KVM_REG_SIZE_SHIFT 52
702#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
703#define KVM_REG_SIZE_U8 0x0000000000000000ULL
704#define KVM_REG_SIZE_U16 0x0010000000000000ULL
705#define KVM_REG_SIZE_U32 0x0020000000000000ULL
706#define KVM_REG_SIZE_U64 0x0030000000000000ULL
707#define KVM_REG_SIZE_U128 0x0040000000000000ULL
708#define KVM_REG_SIZE_U256 0x0050000000000000ULL
709#define KVM_REG_SIZE_U512 0x0060000000000000ULL
710#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
711
712struct kvm_one_reg {
713 __u64 id;
714 __u64 addr;
715};
716
640/* 717/*
641 * ioctls for VM fds 718 * ioctls for VM fds
642 */ 719 */
@@ -655,6 +732,17 @@ struct kvm_clock_data {
655 struct kvm_userspace_memory_region) 732 struct kvm_userspace_memory_region)
656#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) 733#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
657#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) 734#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
735
736/* enable ucontrol for s390 */
737struct kvm_s390_ucas_mapping {
738 __u64 user_addr;
739 __u64 vcpu_addr;
740 __u64 length;
741};
742#define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
743#define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
744#define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
745
658/* Device model IOC */ 746/* Device model IOC */
659#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) 747#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
660#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 748#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
@@ -697,6 +785,9 @@ struct kvm_clock_data {
697/* Available with KVM_CAP_TSC_CONTROL */ 785/* Available with KVM_CAP_TSC_CONTROL */
698#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) 786#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
699#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) 787#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
788/* Available with KVM_CAP_PCI_2_3 */
789#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \
790 struct kvm_assigned_pci_dev)
700 791
701/* 792/*
702 * ioctls for vcpu fds 793 * ioctls for vcpu fds
@@ -763,8 +854,15 @@ struct kvm_clock_data {
763#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) 854#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
764/* Available with KVM_CAP_RMA */ 855/* Available with KVM_CAP_RMA */
765#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) 856#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
857/* Available with KVM_CAP_SW_TLB */
858#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
859/* Available with KVM_CAP_ONE_REG */
860#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg)
861#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
766 862
767#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 863#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
864#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
865#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)
768 866
769struct kvm_assigned_pci_dev { 867struct kvm_assigned_pci_dev {
770 __u32 assigned_dev_id; 868 __u32 assigned_dev_id;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ca1b153585d3..665a260c7e09 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -172,11 +172,6 @@ static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
172 */ 172 */
173#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1) 173#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1)
174 174
175struct kvm_lpage_info {
176 unsigned long rmap_pde;
177 int write_count;
178};
179
180struct kvm_memory_slot { 175struct kvm_memory_slot {
181 gfn_t base_gfn; 176 gfn_t base_gfn;
182 unsigned long npages; 177 unsigned long npages;
@@ -185,7 +180,7 @@ struct kvm_memory_slot {
185 unsigned long *dirty_bitmap; 180 unsigned long *dirty_bitmap;
186 unsigned long *dirty_bitmap_head; 181 unsigned long *dirty_bitmap_head;
187 unsigned long nr_dirty_pages; 182 unsigned long nr_dirty_pages;
188 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; 183 struct kvm_arch_memory_slot arch;
189 unsigned long userspace_addr; 184 unsigned long userspace_addr;
190 int user_alloc; 185 int user_alloc;
191 int id; 186 int id;
@@ -377,6 +372,9 @@ int kvm_set_memory_region(struct kvm *kvm,
377int __kvm_set_memory_region(struct kvm *kvm, 372int __kvm_set_memory_region(struct kvm *kvm,
378 struct kvm_userspace_memory_region *mem, 373 struct kvm_userspace_memory_region *mem,
379 int user_alloc); 374 int user_alloc);
375void kvm_arch_free_memslot(struct kvm_memory_slot *free,
376 struct kvm_memory_slot *dont);
377int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
380int kvm_arch_prepare_memory_region(struct kvm *kvm, 378int kvm_arch_prepare_memory_region(struct kvm *kvm,
381 struct kvm_memory_slot *memslot, 379 struct kvm_memory_slot *memslot,
382 struct kvm_memory_slot old, 380 struct kvm_memory_slot old,
@@ -386,6 +384,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
386 struct kvm_userspace_memory_region *mem, 384 struct kvm_userspace_memory_region *mem,
387 struct kvm_memory_slot old, 385 struct kvm_memory_slot old,
388 int user_alloc); 386 int user_alloc);
387bool kvm_largepages_enabled(void);
389void kvm_disable_largepages(void); 388void kvm_disable_largepages(void);
390void kvm_arch_flush_shadow(struct kvm *kvm); 389void kvm_arch_flush_shadow(struct kvm *kvm);
391 390
@@ -451,6 +450,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
451 unsigned int ioctl, unsigned long arg); 450 unsigned int ioctl, unsigned long arg);
452long kvm_arch_vcpu_ioctl(struct file *filp, 451long kvm_arch_vcpu_ioctl(struct file *filp,
453 unsigned int ioctl, unsigned long arg); 452 unsigned int ioctl, unsigned long arg);
453int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf);
454 454
455int kvm_dev_ioctl_check_extension(long ext); 455int kvm_dev_ioctl_check_extension(long ext);
456 456
@@ -521,7 +521,7 @@ static inline void kvm_arch_free_vm(struct kvm *kvm)
521} 521}
522#endif 522#endif
523 523
524int kvm_arch_init_vm(struct kvm *kvm); 524int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
525void kvm_arch_destroy_vm(struct kvm *kvm); 525void kvm_arch_destroy_vm(struct kvm *kvm);
526void kvm_free_all_assigned_devices(struct kvm *kvm); 526void kvm_free_all_assigned_devices(struct kvm *kvm);
527void kvm_arch_sync_events(struct kvm *kvm); 527void kvm_arch_sync_events(struct kvm *kvm);
@@ -547,6 +547,7 @@ struct kvm_assigned_dev_kernel {
547 unsigned int entries_nr; 547 unsigned int entries_nr;
548 int host_irq; 548 int host_irq;
549 bool host_irq_disabled; 549 bool host_irq_disabled;
550 bool pci_2_3;
550 struct msix_entry *host_msix_entries; 551 struct msix_entry *host_msix_entries;
551 int guest_irq; 552 int guest_irq;
552 struct msix_entry *guest_msix_entries; 553 struct msix_entry *guest_msix_entries;
@@ -556,6 +557,7 @@ struct kvm_assigned_dev_kernel {
556 struct pci_dev *dev; 557 struct pci_dev *dev;
557 struct kvm *kvm; 558 struct kvm *kvm;
558 spinlock_t intx_lock; 559 spinlock_t intx_lock;
560 spinlock_t intx_mask_lock;
559 char irq_name[32]; 561 char irq_name[32];
560 struct pci_saved_state *pci_saved_state; 562 struct pci_saved_state *pci_saved_state;
561}; 563};
@@ -651,11 +653,43 @@ static inline void kvm_guest_exit(void)
651 current->flags &= ~PF_VCPU; 653 current->flags &= ~PF_VCPU;
652} 654}
653 655
656/*
657 * search_memslots() and __gfn_to_memslot() are here because they are
658 * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c.
659 * gfn_to_memslot() itself isn't here as an inline because that would
660 * bloat other code too much.
661 */
662static inline struct kvm_memory_slot *
663search_memslots(struct kvm_memslots *slots, gfn_t gfn)
664{
665 struct kvm_memory_slot *memslot;
666
667 kvm_for_each_memslot(memslot, slots)
668 if (gfn >= memslot->base_gfn &&
669 gfn < memslot->base_gfn + memslot->npages)
670 return memslot;
671
672 return NULL;
673}
674
675static inline struct kvm_memory_slot *
676__gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn)
677{
678 return search_memslots(slots, gfn);
679}
680
654static inline int memslot_id(struct kvm *kvm, gfn_t gfn) 681static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
655{ 682{
656 return gfn_to_memslot(kvm, gfn)->id; 683 return gfn_to_memslot(kvm, gfn)->id;
657} 684}
658 685
686static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
687{
688 /* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */
689 return (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
690 (base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
691}
692
659static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, 693static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot,
660 gfn_t gfn) 694 gfn_t gfn)
661{ 695{
@@ -702,12 +736,16 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
702 if (unlikely(vcpu->kvm->mmu_notifier_count)) 736 if (unlikely(vcpu->kvm->mmu_notifier_count))
703 return 1; 737 return 1;
704 /* 738 /*
705 * Both reads happen under the mmu_lock and both values are 739 * Ensure the read of mmu_notifier_count happens before the read
706 * modified under mmu_lock, so there's no need of smb_rmb() 740 * of mmu_notifier_seq. This interacts with the smp_wmb() in
707 * here in between, otherwise mmu_notifier_count should be 741 * mmu_notifier_invalidate_range_end to make sure that the caller
708 * read before mmu_notifier_seq, see 742 * either sees the old (non-zero) value of mmu_notifier_count or
709 * mmu_notifier_invalidate_range_end write side. 743 * the new (incremented) value of mmu_notifier_seq.
744 * PowerPC Book3s HV KVM calls this under a per-page lock
745 * rather than under kvm->mmu_lock, for scalability, so
746 * can't rely on kvm->mmu_lock to keep things ordered.
710 */ 747 */
748 smp_rmb();
711 if (vcpu->kvm->mmu_notifier_seq != mmu_seq) 749 if (vcpu->kvm->mmu_notifier_seq != mmu_seq)
712 return 1; 750 return 1;
713 return 0; 751 return 0;
@@ -770,6 +808,13 @@ static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
770{ 808{
771 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; 809 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
772} 810}
811
812bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu);
813
814#else
815
816static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; }
817
773#endif 818#endif
774 819
775#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT 820#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 801b44b07aac..a5199f6d0e82 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -56,8 +56,7 @@
56 */ 56 */
57 57
58#include <linux/kernel.h> 58#include <linux/kernel.h>
59#include <asm/system.h> 59#include <asm/cmpxchg.h>
60#include <asm/processor.h>
61 60
62struct llist_head { 61struct llist_head {
63 struct llist_node *first; 62 struct llist_node *first;
diff --git a/include/linux/lp8727.h b/include/linux/lp8727.h
index d21fa2865bf4..ea98c6133d32 100644
--- a/include/linux/lp8727.h
+++ b/include/linux/lp8727.h
@@ -1,4 +1,7 @@
1/* 1/*
2 * LP8727 Micro/Mini USB IC with integrated charger
3 *
4 * Copyright (C) 2011 Texas Instruments
2 * Copyright (C) 2011 National Semiconductor 5 * Copyright (C) 2011 National Semiconductor
3 * 6 *
4 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -32,13 +35,24 @@ enum lp8727_ichg {
32 ICHG_1000mA, 35 ICHG_1000mA,
33}; 36};
34 37
38/**
39 * struct lp8727_chg_param
40 * @eoc_level : end of charge level setting
41 * @ichg : charging current
42 */
35struct lp8727_chg_param { 43struct lp8727_chg_param {
36 /* end of charge level setting */
37 enum lp8727_eoc_level eoc_level; 44 enum lp8727_eoc_level eoc_level;
38 /* charging current */
39 enum lp8727_ichg ichg; 45 enum lp8727_ichg ichg;
40}; 46};
41 47
48/**
49 * struct lp8727_platform_data
50 * @get_batt_present : check battery status - exists or not
51 * @get_batt_level : get battery voltage (mV)
52 * @get_batt_capacity : get battery capacity (%)
53 * @get_batt_temp : get battery temperature
54 * @ac, @usb : charging parameters each charger type
55 */
42struct lp8727_platform_data { 56struct lp8727_platform_data {
43 u8 (*get_batt_present)(void); 57 u8 (*get_batt_present)(void);
44 u16 (*get_batt_level)(void); 58 u16 (*get_batt_level)(void);
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index 88e78dedc2e8..fad48aab893b 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -21,8 +21,24 @@
21#include <linux/path.h> 21#include <linux/path.h>
22#include <linux/key.h> 22#include <linux/key.h>
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <asm/system.h>
25 24
25struct lsm_network_audit {
26 int netif;
27 struct sock *sk;
28 u16 family;
29 __be16 dport;
30 __be16 sport;
31 union {
32 struct {
33 __be32 daddr;
34 __be32 saddr;
35 } v4;
36 struct {
37 struct in6_addr daddr;
38 struct in6_addr saddr;
39 } v6;
40 } fam;
41};
26 42
27/* Auxiliary data to use in generating the audit record. */ 43/* Auxiliary data to use in generating the audit record. */
28struct common_audit_data { 44struct common_audit_data {
@@ -42,23 +58,7 @@ struct common_audit_data {
42 struct path path; 58 struct path path;
43 struct dentry *dentry; 59 struct dentry *dentry;
44 struct inode *inode; 60 struct inode *inode;
45 struct { 61 struct lsm_network_audit *net;
46 int netif;
47 struct sock *sk;
48 u16 family;
49 __be16 dport;
50 __be16 sport;
51 union {
52 struct {
53 __be32 daddr;
54 __be32 saddr;
55 } v4;
56 struct {
57 struct in6_addr daddr;
58 struct in6_addr saddr;
59 } v6;
60 } fam;
61 } net;
62 int cap; 62 int cap;
63 int ipc_id; 63 int ipc_id;
64 struct task_struct *tsk; 64 struct task_struct *tsk;
@@ -73,64 +73,15 @@ struct common_audit_data {
73 /* this union contains LSM specific data */ 73 /* this union contains LSM specific data */
74 union { 74 union {
75#ifdef CONFIG_SECURITY_SMACK 75#ifdef CONFIG_SECURITY_SMACK
76 /* SMACK data */ 76 struct smack_audit_data *smack_audit_data;
77 struct smack_audit_data {
78 const char *function;
79 char *subject;
80 char *object;
81 char *request;
82 int result;
83 } smack_audit_data;
84#endif 77#endif
85#ifdef CONFIG_SECURITY_SELINUX 78#ifdef CONFIG_SECURITY_SELINUX
86 /* SELinux data */ 79 struct selinux_audit_data *selinux_audit_data;
87 struct {
88 u32 ssid;
89 u32 tsid;
90 u16 tclass;
91 u32 requested;
92 u32 audited;
93 u32 denied;
94 /*
95 * auditdeny is a bit tricky and unintuitive. See the
96 * comments in avc.c for it's meaning and usage.
97 */
98 u32 auditdeny;
99 struct av_decision *avd;
100 int result;
101 } selinux_audit_data;
102#endif 80#endif
103#ifdef CONFIG_SECURITY_APPARMOR 81#ifdef CONFIG_SECURITY_APPARMOR
104 struct { 82 struct apparmor_audit_data *apparmor_audit_data;
105 int error;
106 int op;
107 int type;
108 void *profile;
109 const char *name;
110 const char *info;
111 union {
112 void *target;
113 struct {
114 long pos;
115 void *target;
116 } iface;
117 struct {
118 int rlim;
119 unsigned long max;
120 } rlim;
121 struct {
122 const char *target;
123 u32 request;
124 u32 denied;
125 uid_t ouid;
126 } fs;
127 };
128 } apparmor_audit_data;
129#endif 83#endif
130 }; 84 }; /* per LSM data pointer union */
131 /* these callback will be implemented by a specific LSM */
132 void (*lsm_pre_audit)(struct audit_buffer *, void *);
133 void (*lsm_post_audit)(struct audit_buffer *, void *);
134}; 85};
135 86
136#define v4info fam.v4 87#define v4info fam.v4
@@ -147,6 +98,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb,
147 { memset((_d), 0, sizeof(struct common_audit_data)); \ 98 { memset((_d), 0, sizeof(struct common_audit_data)); \
148 (_d)->type = LSM_AUDIT_DATA_##_t; } 99 (_d)->type = LSM_AUDIT_DATA_##_t; }
149 100
150void common_lsm_audit(struct common_audit_data *a); 101void common_lsm_audit(struct common_audit_data *a,
102 void (*pre_audit)(struct audit_buffer *, void *),
103 void (*post_audit)(struct audit_buffer *, void *));
151 104
152#endif 105#endif
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 92be3476c9f5..84d071ade1d8 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -263,6 +263,22 @@ enum {
263#define PM8607_PD_PREBIAS_MASK (0x1F << 0) 263#define PM8607_PD_PREBIAS_MASK (0x1F << 0)
264#define PM8607_PD_PRECHG_MASK (7 << 5) 264#define PM8607_PD_PRECHG_MASK (7 << 5)
265 265
266#define PM8606_REF_GP_OSC_OFF 0
267#define PM8606_REF_GP_OSC_ON 1
268#define PM8606_REF_GP_OSC_UNKNOWN 2
269
270/* Clients of reference group and 8MHz oscillator in 88PM8606 */
271enum pm8606_ref_gp_and_osc_clients {
272 REF_GP_NO_CLIENTS = 0,
273 WLED1_DUTY = (1<<0), /*PF 0x02.7:0*/
274 WLED2_DUTY = (1<<1), /*PF 0x04.7:0*/
275 WLED3_DUTY = (1<<2), /*PF 0x06.7:0*/
276 RGB1_ENABLE = (1<<3), /*PF 0x07.1*/
277 RGB2_ENABLE = (1<<4), /*PF 0x07.2*/
278 LDO_VBR_EN = (1<<5), /*PF 0x12.0*/
279 REF_GP_MAX_CLIENT = 0xFFFF
280};
281
266/* Interrupt Number in 88PM8607 */ 282/* Interrupt Number in 88PM8607 */
267enum { 283enum {
268 PM8607_IRQ_ONKEY, 284 PM8607_IRQ_ONKEY,
@@ -298,6 +314,7 @@ enum {
298struct pm860x_chip { 314struct pm860x_chip {
299 struct device *dev; 315 struct device *dev;
300 struct mutex irq_lock; 316 struct mutex irq_lock;
317 struct mutex osc_lock;
301 struct i2c_client *client; 318 struct i2c_client *client;
302 struct i2c_client *companion; /* companion chip client */ 319 struct i2c_client *companion; /* companion chip client */
303 struct regmap *regmap; 320 struct regmap *regmap;
@@ -305,12 +322,15 @@ struct pm860x_chip {
305 322
306 int buck3_double; /* DVC ramp slope double */ 323 int buck3_double; /* DVC ramp slope double */
307 unsigned short companion_addr; 324 unsigned short companion_addr;
325 unsigned short osc_vote;
308 int id; 326 int id;
309 int irq_mode; 327 int irq_mode;
310 int irq_base; 328 int irq_base;
311 int core_irq; 329 int core_irq;
312 unsigned char chip_version; 330 unsigned char chip_version;
331 unsigned char osc_status;
313 332
333 unsigned int wakeup_flag;
314}; 334};
315 335
316enum { 336enum {
@@ -369,6 +389,9 @@ struct pm860x_platform_data {
369 int num_regulators; 389 int num_regulators;
370}; 390};
371 391
392extern int pm8606_osc_enable(struct pm860x_chip *, unsigned short);
393extern int pm8606_osc_disable(struct pm860x_chip *, unsigned short);
394
372extern int pm860x_reg_read(struct i2c_client *, int); 395extern int pm860x_reg_read(struct i2c_client *, int);
373extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); 396extern int pm860x_reg_write(struct i2c_client *, int, unsigned char);
374extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); 397extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *);
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index e20dd6ead1d0..ee96cd51d8b2 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -34,13 +34,6 @@ struct device;
34#define AB5500_1_1 0x21 34#define AB5500_1_1 0x21
35#define AB5500_2_0 0x24 35#define AB5500_2_0 0x24
36 36
37/* AB8500 CIDs*/
38#define AB8500_CUT1P0 0x10
39#define AB8500_CUT1P1 0x11
40#define AB8500_CUT2P0 0x20
41#define AB8500_CUT3P0 0x30
42#define AB8500_CUT3P3 0x33
43
44/* 37/*
45 * AB3100, EVENTA1, A2 and A3 event register flags 38 * AB3100, EVENTA1, A2 and A3 event register flags
46 * these are catenated into a single 32-bit flag in the code 39 * these are catenated into a single 32-bit flag in the code
@@ -153,6 +146,279 @@ struct abx500_init_settings {
153 u8 setting; 146 u8 setting;
154}; 147};
155 148
149/* Battery driver related data */
150/*
151 * ADC for the battery thermistor.
152 * When using the ABx500_ADC_THERM_BATCTRL the battery ID resistor is combined
153 * with a NTC resistor to both identify the battery and to measure its
154 * temperature. Different phone manufactures uses different techniques to both
155 * identify the battery and to read its temperature.
156 */
157enum abx500_adc_therm {
158 ABx500_ADC_THERM_BATCTRL,
159 ABx500_ADC_THERM_BATTEMP,
160};
161
162/**
163 * struct abx500_res_to_temp - defines one point in a temp to res curve. To
164 * be used in battery packs that combines the identification resistor with a
165 * NTC resistor.
166 * @temp: battery pack temperature in Celcius
167 * @resist: NTC resistor net total resistance
168 */
169struct abx500_res_to_temp {
170 int temp;
171 int resist;
172};
173
174/**
175 * struct abx500_v_to_cap - Table for translating voltage to capacity
176 * @voltage: Voltage in mV
177 * @capacity: Capacity in percent
178 */
179struct abx500_v_to_cap {
180 int voltage;
181 int capacity;
182};
183
184/* Forward declaration */
185struct abx500_fg;
186
187/**
188 * struct abx500_fg_parameters - Fuel gauge algorithm parameters, in seconds
189 * if not specified
190 * @recovery_sleep_timer: Time between measurements while recovering
191 * @recovery_total_time: Total recovery time
192 * @init_timer: Measurement interval during startup
193 * @init_discard_time: Time we discard voltage measurement at startup
194 * @init_total_time: Total init time during startup
195 * @high_curr_time: Time current has to be high to go to recovery
196 * @accu_charging: FG accumulation time while charging
197 * @accu_high_curr: FG accumulation time in high current mode
198 * @high_curr_threshold: High current threshold, in mA
199 * @lowbat_threshold: Low battery threshold, in mV
200 * @overbat_threshold: Over battery threshold, in mV
201 * @battok_falling_th_sel0 Threshold in mV for battOk signal sel0
202 * Resolution in 50 mV step.
203 * @battok_raising_th_sel1 Threshold in mV for battOk signal sel1
204 * Resolution in 50 mV step.
205 * @user_cap_limit Capacity reported from user must be within this
206 * limit to be considered as sane, in percentage
207 * points.
208 * @maint_thres This is the threshold where we stop reporting
209 * battery full while in maintenance, in per cent
210 */
211struct abx500_fg_parameters {
212 int recovery_sleep_timer;
213 int recovery_total_time;
214 int init_timer;
215 int init_discard_time;
216 int init_total_time;
217 int high_curr_time;
218 int accu_charging;
219 int accu_high_curr;
220 int high_curr_threshold;
221 int lowbat_threshold;
222 int overbat_threshold;
223 int battok_falling_th_sel0;
224 int battok_raising_th_sel1;
225 int user_cap_limit;
226 int maint_thres;
227};
228
229/**
230 * struct abx500_charger_maximization - struct used by the board config.
231 * @use_maxi: Enable maximization for this battery type
232 * @maxi_chg_curr: Maximum charger current allowed
233 * @maxi_wait_cycles: cycles to wait before setting charger current
234 * @charger_curr_step delta between two charger current settings (mA)
235 */
236struct abx500_maxim_parameters {
237 bool ena_maxi;
238 int chg_curr;
239 int wait_cycles;
240 int charger_curr_step;
241};
242
243/**
244 * struct abx500_battery_type - different batteries supported
245 * @name: battery technology
246 * @resis_high: battery upper resistance limit
247 * @resis_low: battery lower resistance limit
248 * @charge_full_design: Maximum battery capacity in mAh
249 * @nominal_voltage: Nominal voltage of the battery in mV
250 * @termination_vol: max voltage upto which battery can be charged
251 * @termination_curr battery charging termination current in mA
252 * @recharge_vol battery voltage limit that will trigger a new
253 * full charging cycle in the case where maintenan-
254 * -ce charging has been disabled
255 * @normal_cur_lvl: charger current in normal state in mA
256 * @normal_vol_lvl: charger voltage in normal state in mV
257 * @maint_a_cur_lvl: charger current in maintenance A state in mA
258 * @maint_a_vol_lvl: charger voltage in maintenance A state in mV
259 * @maint_a_chg_timer_h: charge time in maintenance A state
260 * @maint_b_cur_lvl: charger current in maintenance B state in mA
261 * @maint_b_vol_lvl: charger voltage in maintenance B state in mV
262 * @maint_b_chg_timer_h: charge time in maintenance B state
263 * @low_high_cur_lvl: charger current in temp low/high state in mA
264 * @low_high_vol_lvl: charger voltage in temp low/high state in mV'
265 * @battery_resistance: battery inner resistance in mOhm.
266 * @n_r_t_tbl_elements: number of elements in r_to_t_tbl
267 * @r_to_t_tbl: table containing resistance to temp points
268 * @n_v_cap_tbl_elements: number of elements in v_to_cap_tbl
269 * @v_to_cap_tbl: Voltage to capacity (in %) table
270 * @n_batres_tbl_elements number of elements in the batres_tbl
271 * @batres_tbl battery internal resistance vs temperature table
272 */
273struct abx500_battery_type {
274 int name;
275 int resis_high;
276 int resis_low;
277 int charge_full_design;
278 int nominal_voltage;
279 int termination_vol;
280 int termination_curr;
281 int recharge_vol;
282 int normal_cur_lvl;
283 int normal_vol_lvl;
284 int maint_a_cur_lvl;
285 int maint_a_vol_lvl;
286 int maint_a_chg_timer_h;
287 int maint_b_cur_lvl;
288 int maint_b_vol_lvl;
289 int maint_b_chg_timer_h;
290 int low_high_cur_lvl;
291 int low_high_vol_lvl;
292 int battery_resistance;
293 int n_temp_tbl_elements;
294 struct abx500_res_to_temp *r_to_t_tbl;
295 int n_v_cap_tbl_elements;
296 struct abx500_v_to_cap *v_to_cap_tbl;
297 int n_batres_tbl_elements;
298 struct batres_vs_temp *batres_tbl;
299};
300
301/**
302 * struct abx500_bm_capacity_levels - abx500 capacity level data
303 * @critical: critical capacity level in percent
304 * @low: low capacity level in percent
305 * @normal: normal capacity level in percent
306 * @high: high capacity level in percent
307 * @full: full capacity level in percent
308 */
309struct abx500_bm_capacity_levels {
310 int critical;
311 int low;
312 int normal;
313 int high;
314 int full;
315};
316
317/**
318 * struct abx500_bm_charger_parameters - Charger specific parameters
319 * @usb_volt_max: maximum allowed USB charger voltage in mV
320 * @usb_curr_max: maximum allowed USB charger current in mA
321 * @ac_volt_max: maximum allowed AC charger voltage in mV
322 * @ac_curr_max: maximum allowed AC charger current in mA
323 */
324struct abx500_bm_charger_parameters {
325 int usb_volt_max;
326 int usb_curr_max;
327 int ac_volt_max;
328 int ac_curr_max;
329};
330
331/**
332 * struct abx500_bm_data - abx500 battery management data
333 * @temp_under under this temp, charging is stopped
334 * @temp_low between this temp and temp_under charging is reduced
335 * @temp_high between this temp and temp_over charging is reduced
336 * @temp_over over this temp, charging is stopped
337 * @temp_now present battery temperature
338 * @temp_interval_chg temperature measurement interval in s when charging
339 * @temp_interval_nochg temperature measurement interval in s when not charging
340 * @main_safety_tmr_h safety timer for main charger
341 * @usb_safety_tmr_h safety timer for usb charger
342 * @bkup_bat_v voltage which we charge the backup battery with
343 * @bkup_bat_i current which we charge the backup battery with
344 * @no_maintenance indicates that maintenance charging is disabled
345 * @abx500_adc_therm placement of thermistor, batctrl or battemp adc
346 * @chg_unknown_bat flag to enable charging of unknown batteries
347 * @enable_overshoot flag to enable VBAT overshoot control
348 * @auto_trig flag to enable auto adc trigger
349 * @fg_res resistance of FG resistor in 0.1mOhm
350 * @n_btypes number of elements in array bat_type
351 * @batt_id index of the identified battery in array bat_type
352 * @interval_charging charge alg cycle period time when charging (sec)
353 * @interval_not_charging charge alg cycle period time when not charging (sec)
354 * @temp_hysteresis temperature hysteresis
355 * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm)
356 * @maxi: maximization parameters
357 * @cap_levels capacity in percent for the different capacity levels
358 * @bat_type table of supported battery types
359 * @chg_params charger parameters
360 * @fg_params fuel gauge parameters
361 */
362struct abx500_bm_data {
363 int temp_under;
364 int temp_low;
365 int temp_high;
366 int temp_over;
367 int temp_now;
368 int temp_interval_chg;
369 int temp_interval_nochg;
370 int main_safety_tmr_h;
371 int usb_safety_tmr_h;
372 int bkup_bat_v;
373 int bkup_bat_i;
374 bool no_maintenance;
375 bool chg_unknown_bat;
376 bool enable_overshoot;
377 bool auto_trig;
378 enum abx500_adc_therm adc_therm;
379 int fg_res;
380 int n_btypes;
381 int batt_id;
382 int interval_charging;
383 int interval_not_charging;
384 int temp_hysteresis;
385 int gnd_lift_resistance;
386 const struct abx500_maxim_parameters *maxi;
387 const struct abx500_bm_capacity_levels *cap_levels;
388 const struct abx500_battery_type *bat_type;
389 const struct abx500_bm_charger_parameters *chg_params;
390 const struct abx500_fg_parameters *fg_params;
391};
392
393struct abx500_chargalg_platform_data {
394 char **supplied_to;
395 size_t num_supplicants;
396};
397
398struct abx500_charger_platform_data {
399 char **supplied_to;
400 size_t num_supplicants;
401 bool autopower_cfg;
402};
403
404struct abx500_btemp_platform_data {
405 char **supplied_to;
406 size_t num_supplicants;
407};
408
409struct abx500_fg_platform_data {
410 char **supplied_to;
411 size_t num_supplicants;
412};
413
414struct abx500_bm_plat_data {
415 struct abx500_bm_data *battery;
416 struct abx500_charger_platform_data *charger;
417 struct abx500_btemp_platform_data *btemp;
418 struct abx500_fg_platform_data *fg;
419 struct abx500_chargalg_platform_data *chargalg;
420};
421
156int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, 422int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
157 u8 value); 423 u8 value);
158int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg, 424int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
new file mode 100644
index 000000000000..44310c98ee6e
--- /dev/null
+++ b/include/linux/mfd/abx500/ab8500-bm.h
@@ -0,0 +1,474 @@
1/*
2 * Copyright ST-Ericsson 2012.
3 *
4 * Author: Arun Murthy <arun.murthy@stericsson.com>
5 * Licensed under GPLv2.
6 */
7
8#ifndef _AB8500_BM_H
9#define _AB8500_BM_H
10
11#include <linux/kernel.h>
12#include <linux/mfd/abx500.h>
13
14/*
15 * System control 2 register offsets.
16 * bank = 0x02
17 */
18#define AB8500_MAIN_WDOG_CTRL_REG 0x01
19#define AB8500_LOW_BAT_REG 0x03
20#define AB8500_BATT_OK_REG 0x04
21/*
22 * USB/ULPI register offsets
23 * Bank : 0x5
24 */
25#define AB8500_USB_LINE_STAT_REG 0x80
26
27/*
28 * Charger / status register offfsets
29 * Bank : 0x0B
30 */
31#define AB8500_CH_STATUS1_REG 0x00
32#define AB8500_CH_STATUS2_REG 0x01
33#define AB8500_CH_USBCH_STAT1_REG 0x02
34#define AB8500_CH_USBCH_STAT2_REG 0x03
35#define AB8500_CH_FSM_STAT_REG 0x04
36#define AB8500_CH_STAT_REG 0x05
37
38/*
39 * Charger / control register offfsets
40 * Bank : 0x0B
41 */
42#define AB8500_CH_VOLT_LVL_REG 0x40
43#define AB8500_CH_VOLT_LVL_MAX_REG 0x41 /*Only in Cut2.0*/
44#define AB8500_CH_OPT_CRNTLVL_REG 0x42
45#define AB8500_CH_OPT_CRNTLVL_MAX_REG 0x43 /*Only in Cut2.0*/
46#define AB8500_CH_WD_TIMER_REG 0x50
47#define AB8500_CHARG_WD_CTRL 0x51
48#define AB8500_BTEMP_HIGH_TH 0x52
49#define AB8500_LED_INDICATOR_PWM_CTRL 0x53
50#define AB8500_LED_INDICATOR_PWM_DUTY 0x54
51#define AB8500_BATT_OVV 0x55
52#define AB8500_CHARGER_CTRL 0x56
53#define AB8500_BAT_CTRL_CURRENT_SOURCE 0x60 /*Only in Cut2.0*/
54
55/*
56 * Charger / main control register offsets
57 * Bank : 0x0B
58 */
59#define AB8500_MCH_CTRL1 0x80
60#define AB8500_MCH_CTRL2 0x81
61#define AB8500_MCH_IPT_CURLVL_REG 0x82
62#define AB8500_CH_WD_REG 0x83
63
64/*
65 * Charger / USB control register offsets
66 * Bank : 0x0B
67 */
68#define AB8500_USBCH_CTRL1_REG 0xC0
69#define AB8500_USBCH_CTRL2_REG 0xC1
70#define AB8500_USBCH_IPT_CRNTLVL_REG 0xC2
71
72/*
73 * Gas Gauge register offsets
74 * Bank : 0x0C
75 */
76#define AB8500_GASG_CC_CTRL_REG 0x00
77#define AB8500_GASG_CC_ACCU1_REG 0x01
78#define AB8500_GASG_CC_ACCU2_REG 0x02
79#define AB8500_GASG_CC_ACCU3_REG 0x03
80#define AB8500_GASG_CC_ACCU4_REG 0x04
81#define AB8500_GASG_CC_SMPL_CNTRL_REG 0x05
82#define AB8500_GASG_CC_SMPL_CNTRH_REG 0x06
83#define AB8500_GASG_CC_SMPL_CNVL_REG 0x07
84#define AB8500_GASG_CC_SMPL_CNVH_REG 0x08
85#define AB8500_GASG_CC_CNTR_AVGOFF_REG 0x09
86#define AB8500_GASG_CC_OFFSET_REG 0x0A
87#define AB8500_GASG_CC_NCOV_ACCU 0x10
88#define AB8500_GASG_CC_NCOV_ACCU_CTRL 0x11
89#define AB8500_GASG_CC_NCOV_ACCU_LOW 0x12
90#define AB8500_GASG_CC_NCOV_ACCU_MED 0x13
91#define AB8500_GASG_CC_NCOV_ACCU_HIGH 0x14
92
93/*
94 * Interrupt register offsets
95 * Bank : 0x0E
96 */
97#define AB8500_IT_SOURCE2_REG 0x01
98#define AB8500_IT_SOURCE21_REG 0x14
99
100/*
101 * RTC register offsets
102 * Bank: 0x0F
103 */
104#define AB8500_RTC_BACKUP_CHG_REG 0x0C
105#define AB8500_RTC_CC_CONF_REG 0x01
106#define AB8500_RTC_CTRL_REG 0x0B
107
108/*
109 * OTP register offsets
110 * Bank : 0x15
111 */
112#define AB8500_OTP_CONF_15 0x0E
113
114/* GPADC constants from AB8500 spec, UM0836 */
115#define ADC_RESOLUTION 1024
116#define ADC_CH_MAIN_MIN 0
117#define ADC_CH_MAIN_MAX 20030
118#define ADC_CH_VBUS_MIN 0
119#define ADC_CH_VBUS_MAX 20030
120#define ADC_CH_VBAT_MIN 2300
121#define ADC_CH_VBAT_MAX 4800
122#define ADC_CH_BKBAT_MIN 0
123#define ADC_CH_BKBAT_MAX 3200
124
125/* Main charge i/p current */
126#define MAIN_CH_IP_CUR_0P9A 0x80
127#define MAIN_CH_IP_CUR_1P0A 0x90
128#define MAIN_CH_IP_CUR_1P1A 0xA0
129#define MAIN_CH_IP_CUR_1P2A 0xB0
130#define MAIN_CH_IP_CUR_1P3A 0xC0
131#define MAIN_CH_IP_CUR_1P4A 0xD0
132#define MAIN_CH_IP_CUR_1P5A 0xE0
133
134/* ChVoltLevel */
135#define CH_VOL_LVL_3P5 0x00
136#define CH_VOL_LVL_4P0 0x14
137#define CH_VOL_LVL_4P05 0x16
138#define CH_VOL_LVL_4P1 0x1B
139#define CH_VOL_LVL_4P15 0x20
140#define CH_VOL_LVL_4P2 0x25
141#define CH_VOL_LVL_4P6 0x4D
142
143/* ChOutputCurrentLevel */
144#define CH_OP_CUR_LVL_0P1 0x00
145#define CH_OP_CUR_LVL_0P2 0x01
146#define CH_OP_CUR_LVL_0P3 0x02
147#define CH_OP_CUR_LVL_0P4 0x03
148#define CH_OP_CUR_LVL_0P5 0x04
149#define CH_OP_CUR_LVL_0P6 0x05
150#define CH_OP_CUR_LVL_0P7 0x06
151#define CH_OP_CUR_LVL_0P8 0x07
152#define CH_OP_CUR_LVL_0P9 0x08
153#define CH_OP_CUR_LVL_1P4 0x0D
154#define CH_OP_CUR_LVL_1P5 0x0E
155#define CH_OP_CUR_LVL_1P6 0x0F
156
157/* BTEMP High thermal limits */
158#define BTEMP_HIGH_TH_57_0 0x00
159#define BTEMP_HIGH_TH_52 0x01
160#define BTEMP_HIGH_TH_57_1 0x02
161#define BTEMP_HIGH_TH_62 0x03
162
163/* current is mA */
164#define USB_0P1A 100
165#define USB_0P2A 200
166#define USB_0P3A 300
167#define USB_0P4A 400
168#define USB_0P5A 500
169
170#define LOW_BAT_3P1V 0x20
171#define LOW_BAT_2P3V 0x00
172#define LOW_BAT_RESET 0x01
173#define LOW_BAT_ENABLE 0x01
174
175/* Backup battery constants */
176#define BUP_ICH_SEL_50UA 0x00
177#define BUP_ICH_SEL_150UA 0x04
178#define BUP_ICH_SEL_300UA 0x08
179#define BUP_ICH_SEL_700UA 0x0C
180
181#define BUP_VCH_SEL_2P5V 0x00
182#define BUP_VCH_SEL_2P6V 0x01
183#define BUP_VCH_SEL_2P8V 0x02
184#define BUP_VCH_SEL_3P1V 0x03
185
186/* Battery OVV constants */
187#define BATT_OVV_ENA 0x02
188#define BATT_OVV_TH_3P7 0x00
189#define BATT_OVV_TH_4P75 0x01
190
191/* A value to indicate over voltage */
192#define BATT_OVV_VALUE 4750
193
194/* VBUS OVV constants */
195#define VBUS_OVV_SELECT_MASK 0x78
196#define VBUS_OVV_SELECT_5P6V 0x00
197#define VBUS_OVV_SELECT_5P7V 0x08
198#define VBUS_OVV_SELECT_5P8V 0x10
199#define VBUS_OVV_SELECT_5P9V 0x18
200#define VBUS_OVV_SELECT_6P0V 0x20
201#define VBUS_OVV_SELECT_6P1V 0x28
202#define VBUS_OVV_SELECT_6P2V 0x30
203#define VBUS_OVV_SELECT_6P3V 0x38
204
205#define VBUS_AUTO_IN_CURR_LIM_ENA 0x04
206
207/* Fuel Gauge constants */
208#define RESET_ACCU 0x02
209#define READ_REQ 0x01
210#define CC_DEEP_SLEEP_ENA 0x02
211#define CC_PWR_UP_ENA 0x01
212#define CC_SAMPLES_40 0x28
213#define RD_NCONV_ACCU_REQ 0x01
214#define CC_CALIB 0x08
215#define CC_INTAVGOFFSET_ENA 0x10
216#define CC_MUXOFFSET 0x80
217#define CC_INT_CAL_N_AVG_MASK 0x60
218#define CC_INT_CAL_SAMPLES_16 0x40
219#define CC_INT_CAL_SAMPLES_8 0x20
220#define CC_INT_CAL_SAMPLES_4 0x00
221
222/* RTC constants */
223#define RTC_BUP_CH_ENA 0x10
224
225/* BatCtrl Current Source Constants */
226#define BAT_CTRL_7U_ENA 0x01
227#define BAT_CTRL_20U_ENA 0x02
228#define BAT_CTRL_CMP_ENA 0x04
229#define FORCE_BAT_CTRL_CMP_HIGH 0x08
230#define BAT_CTRL_PULL_UP_ENA 0x10
231
232/* Battery type */
233#define BATTERY_UNKNOWN 00
234
235/**
236 * struct res_to_temp - defines one point in a temp to res curve. To
237 * be used in battery packs that combines the identification resistor with a
238 * NTC resistor.
239 * @temp: battery pack temperature in Celcius
240 * @resist: NTC resistor net total resistance
241 */
242struct res_to_temp {
243 int temp;
244 int resist;
245};
246
247/**
248 * struct batres_vs_temp - defines one point in a temp vs battery internal
249 * resistance curve.
250 * @temp: battery pack temperature in Celcius
251 * @resist: battery internal reistance in mOhm
252 */
253struct batres_vs_temp {
254 int temp;
255 int resist;
256};
257
258/* Forward declaration */
259struct ab8500_fg;
260
261/**
262 * struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds
263 * if not specified
264 * @recovery_sleep_timer: Time between measurements while recovering
265 * @recovery_total_time: Total recovery time
266 * @init_timer: Measurement interval during startup
267 * @init_discard_time: Time we discard voltage measurement at startup
268 * @init_total_time: Total init time during startup
269 * @high_curr_time: Time current has to be high to go to recovery
270 * @accu_charging: FG accumulation time while charging
271 * @accu_high_curr: FG accumulation time in high current mode
272 * @high_curr_threshold: High current threshold, in mA
273 * @lowbat_threshold: Low battery threshold, in mV
274 * @battok_falling_th_sel0 Threshold in mV for battOk signal sel0
275 * Resolution in 50 mV step.
276 * @battok_raising_th_sel1 Threshold in mV for battOk signal sel1
277 * Resolution in 50 mV step.
278 * @user_cap_limit Capacity reported from user must be within this
279 * limit to be considered as sane, in percentage
280 * points.
281 * @maint_thres This is the threshold where we stop reporting
282 * battery full while in maintenance, in per cent
283 */
284struct ab8500_fg_parameters {
285 int recovery_sleep_timer;
286 int recovery_total_time;
287 int init_timer;
288 int init_discard_time;
289 int init_total_time;
290 int high_curr_time;
291 int accu_charging;
292 int accu_high_curr;
293 int high_curr_threshold;
294 int lowbat_threshold;
295 int battok_falling_th_sel0;
296 int battok_raising_th_sel1;
297 int user_cap_limit;
298 int maint_thres;
299};
300
301/**
302 * struct ab8500_charger_maximization - struct used by the board config.
303 * @use_maxi: Enable maximization for this battery type
304 * @maxi_chg_curr: Maximum charger current allowed
305 * @maxi_wait_cycles: cycles to wait before setting charger current
306 * @charger_curr_step delta between two charger current settings (mA)
307 */
308struct ab8500_maxim_parameters {
309 bool ena_maxi;
310 int chg_curr;
311 int wait_cycles;
312 int charger_curr_step;
313};
314
315/**
316 * struct ab8500_bm_capacity_levels - ab8500 capacity level data
317 * @critical: critical capacity level in percent
318 * @low: low capacity level in percent
319 * @normal: normal capacity level in percent
320 * @high: high capacity level in percent
321 * @full: full capacity level in percent
322 */
323struct ab8500_bm_capacity_levels {
324 int critical;
325 int low;
326 int normal;
327 int high;
328 int full;
329};
330
331/**
332 * struct ab8500_bm_charger_parameters - Charger specific parameters
333 * @usb_volt_max: maximum allowed USB charger voltage in mV
334 * @usb_curr_max: maximum allowed USB charger current in mA
335 * @ac_volt_max: maximum allowed AC charger voltage in mV
336 * @ac_curr_max: maximum allowed AC charger current in mA
337 */
338struct ab8500_bm_charger_parameters {
339 int usb_volt_max;
340 int usb_curr_max;
341 int ac_volt_max;
342 int ac_curr_max;
343};
344
345/**
346 * struct ab8500_bm_data - ab8500 battery management data
347 * @temp_under under this temp, charging is stopped
348 * @temp_low between this temp and temp_under charging is reduced
349 * @temp_high between this temp and temp_over charging is reduced
350 * @temp_over over this temp, charging is stopped
351 * @temp_interval_chg temperature measurement interval in s when charging
352 * @temp_interval_nochg temperature measurement interval in s when not charging
353 * @main_safety_tmr_h safety timer for main charger
354 * @usb_safety_tmr_h safety timer for usb charger
355 * @bkup_bat_v voltage which we charge the backup battery with
356 * @bkup_bat_i current which we charge the backup battery with
357 * @no_maintenance indicates that maintenance charging is disabled
358 * @adc_therm placement of thermistor, batctrl or battemp adc
359 * @chg_unknown_bat flag to enable charging of unknown batteries
360 * @enable_overshoot flag to enable VBAT overshoot control
361 * @fg_res resistance of FG resistor in 0.1mOhm
362 * @n_btypes number of elements in array bat_type
363 * @batt_id index of the identified battery in array bat_type
364 * @interval_charging charge alg cycle period time when charging (sec)
365 * @interval_not_charging charge alg cycle period time when not charging (sec)
366 * @temp_hysteresis temperature hysteresis
367 * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm)
368 * @maxi: maximization parameters
369 * @cap_levels capacity in percent for the different capacity levels
370 * @bat_type table of supported battery types
371 * @chg_params charger parameters
372 * @fg_params fuel gauge parameters
373 */
374struct ab8500_bm_data {
375 int temp_under;
376 int temp_low;
377 int temp_high;
378 int temp_over;
379 int temp_interval_chg;
380 int temp_interval_nochg;
381 int main_safety_tmr_h;
382 int usb_safety_tmr_h;
383 int bkup_bat_v;
384 int bkup_bat_i;
385 bool no_maintenance;
386 bool chg_unknown_bat;
387 bool enable_overshoot;
388 enum abx500_adc_therm adc_therm;
389 int fg_res;
390 int n_btypes;
391 int batt_id;
392 int interval_charging;
393 int interval_not_charging;
394 int temp_hysteresis;
395 int gnd_lift_resistance;
396 const struct ab8500_maxim_parameters *maxi;
397 const struct ab8500_bm_capacity_levels *cap_levels;
398 const struct ab8500_bm_charger_parameters *chg_params;
399 const struct ab8500_fg_parameters *fg_params;
400};
401
402struct ab8500_charger_platform_data {
403 char **supplied_to;
404 size_t num_supplicants;
405 bool autopower_cfg;
406};
407
408struct ab8500_btemp_platform_data {
409 char **supplied_to;
410 size_t num_supplicants;
411};
412
413struct ab8500_fg_platform_data {
414 char **supplied_to;
415 size_t num_supplicants;
416};
417
418struct ab8500_chargalg_platform_data {
419 char **supplied_to;
420 size_t num_supplicants;
421};
422struct ab8500_btemp;
423struct ab8500_gpadc;
424struct ab8500_fg;
425#ifdef CONFIG_AB8500_BM
426void ab8500_fg_reinit(void);
427void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
428struct ab8500_btemp *ab8500_btemp_get(void);
429int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp);
430struct ab8500_fg *ab8500_fg_get(void);
431int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);
432int ab8500_fg_inst_curr_start(struct ab8500_fg *di);
433int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res);
434int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
435
436#else
437int ab8500_fg_inst_curr_done(struct ab8500_fg *di)
438{
439}
440static void ab8500_fg_reinit(void)
441{
442}
443static void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA)
444{
445}
446static struct ab8500_btemp *ab8500_btemp_get(void)
447{
448 return NULL;
449}
450static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp)
451{
452 return 0;
453}
454struct ab8500_fg *ab8500_fg_get(void)
455{
456 return NULL;
457}
458static int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev)
459{
460 return -ENODEV;
461}
462
463static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di)
464{
465 return -ENODEV;
466}
467
468static inline int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res)
469{
470 return -ENODEV;
471}
472
473#endif
474#endif /* _AB8500_BM_H */
diff --git a/include/linux/mfd/abx500/ab8500-gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 488a8c920a29..2387c207ea86 100644
--- a/include/linux/mfd/abx500/ab8500-gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
@@ -10,12 +10,14 @@
10 10
11/* 11/*
12 * Platform data to register a block: only the initial gpio/irq number. 12 * Platform data to register a block: only the initial gpio/irq number.
13 * Array sizes are large enough to contain all AB8500 and AB9540 GPIO
14 * registers.
13 */ 15 */
14 16
15struct ab8500_gpio_platform_data { 17struct ab8500_gpio_platform_data {
16 int gpio_base; 18 int gpio_base;
17 u32 irq_base; 19 u32 irq_base;
18 u8 config_reg[7]; 20 u8 config_reg[8];
19}; 21};
20 22
21#endif /* _AB8500_GPIO_H */ 23#endif /* _AB8500_GPIO_H */
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 10da0291f8f8..10eb50973c39 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -71,6 +71,13 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
71#define AB8500_SWATCTRL 0x230 71#define AB8500_SWATCTRL 0x230
72#define AB8500_HIQCLKCTRL 0x232 72#define AB8500_HIQCLKCTRL 0x232
73#define AB8500_VSIMSYSCLKCTRL 0x233 73#define AB8500_VSIMSYSCLKCTRL 0x233
74#define AB9540_SYSCLK12BUFCTRL 0x234
75#define AB9540_SYSCLK12CONFCTRL 0x235
76#define AB9540_SYSCLK12BUFCTRL2 0x236
77#define AB9540_SYSCLK12BUF1VALID 0x237
78#define AB9540_SYSCLK12BUF2VALID 0x238
79#define AB9540_SYSCLK12BUF3VALID 0x239
80#define AB9540_SYSCLK12BUF4VALID 0x23A
74 81
75/* Bits */ 82/* Bits */
76#define AB8500_TURNONSTATUS_PORNVBAT BIT(0) 83#define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
@@ -251,4 +258,40 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
251#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6) 258#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
252#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7) 259#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
253 260
261#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1ENA BIT(0)
262#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2ENA BIT(1)
263#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3ENA BIT(2)
264#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4ENA BIT(3)
265#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFENA_MASK 0x0F
266#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1STRE BIT(4)
267#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2STRE BIT(5)
268#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3STRE BIT(6)
269#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4STRE BIT(7)
270#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFSTRE_MASK 0xF0
271
272#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0)
273#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1)
274#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_MASK 0x0C
275#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_SHIFT 2
276#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4)
277#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5)
278#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6)
279
280#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF1PDENA BIT(0)
281#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF2PDENA BIT(1)
282#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF3PDENA BIT(2)
283#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF4PDENA BIT(3)
284
285#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_MASK 0xFF
286#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_SHIFT 0
287
288#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_MASK 0xFF
289#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_SHIFT 0
290
291#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_MASK 0xFF
292#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_SHIFT 0
293
294#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF
295#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0
296
254#endif /* __AB8500_SYSCTRL_H */ 297#endif /* __AB8500_SYSCTRL_H */
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index dca94396190d..fccc3002f271 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -12,6 +12,29 @@
12struct device; 12struct device;
13 13
14/* 14/*
15 * AB IC versions
16 *
17 * AB8500_VERSION_AB8500 should be 0xFF but will never be read as need a
18 * non-supported multi-byte I2C access via PRCMU. Set to 0x00 to ease the
19 * print of version string.
20 */
21enum ab8500_version {
22 AB8500_VERSION_AB8500 = 0x0,
23 AB8500_VERSION_AB8505 = 0x1,
24 AB8500_VERSION_AB9540 = 0x2,
25 AB8500_VERSION_AB8540 = 0x3,
26 AB8500_VERSION_UNDEFINED,
27};
28
29/* AB8500 CIDs*/
30#define AB8500_CUTEARLY 0x00
31#define AB8500_CUT1P0 0x10
32#define AB8500_CUT1P1 0x11
33#define AB8500_CUT2P0 0x20
34#define AB8500_CUT3P0 0x30
35#define AB8500_CUT3P3 0x33
36
37/*
15 * AB8500 bank addresses 38 * AB8500 bank addresses
16 */ 39 */
17#define AB8500_SYS_CTRL1_BLOCK 0x1 40#define AB8500_SYS_CTRL1_BLOCK 0x1
@@ -37,30 +60,34 @@ struct device;
37 60
38/* 61/*
39 * Interrupts 62 * Interrupts
63 * Values used to index into array ab8500_irq_regoffset[] defined in
64 * drivers/mdf/ab8500-core.c
40 */ 65 */
41 66/* Definitions for AB8500 and AB9540 */
42#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 67/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */
43#define AB8500_INT_UN_PLUG_TV_DET 1 68#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */
44#define AB8500_INT_PLUG_TV_DET 2 69#define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540 */
70#define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540 */
45#define AB8500_INT_TEMP_WARM 3 71#define AB8500_INT_TEMP_WARM 3
46#define AB8500_INT_PON_KEY2DB_F 4 72#define AB8500_INT_PON_KEY2DB_F 4
47#define AB8500_INT_PON_KEY2DB_R 5 73#define AB8500_INT_PON_KEY2DB_R 5
48#define AB8500_INT_PON_KEY1DB_F 6 74#define AB8500_INT_PON_KEY1DB_F 6
49#define AB8500_INT_PON_KEY1DB_R 7 75#define AB8500_INT_PON_KEY1DB_R 7
76/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */
50#define AB8500_INT_BATT_OVV 8 77#define AB8500_INT_BATT_OVV 8
51#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 78#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505 */
52#define AB8500_INT_MAIN_CH_PLUG_DET 11 79#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505 */
53#define AB8500_INT_USB_ID_DET_F 12
54#define AB8500_INT_USB_ID_DET_R 13
55#define AB8500_INT_VBUS_DET_F 14 80#define AB8500_INT_VBUS_DET_F 14
56#define AB8500_INT_VBUS_DET_R 15 81#define AB8500_INT_VBUS_DET_R 15
82/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */
57#define AB8500_INT_VBUS_CH_DROP_END 16 83#define AB8500_INT_VBUS_CH_DROP_END 16
58#define AB8500_INT_RTC_60S 17 84#define AB8500_INT_RTC_60S 17
59#define AB8500_INT_RTC_ALARM 18 85#define AB8500_INT_RTC_ALARM 18
60#define AB8500_INT_BAT_CTRL_INDB 20 86#define AB8500_INT_BAT_CTRL_INDB 20
61#define AB8500_INT_CH_WD_EXP 21 87#define AB8500_INT_CH_WD_EXP 21
62#define AB8500_INT_VBUS_OVV 22 88#define AB8500_INT_VBUS_OVV 22
63#define AB8500_INT_MAIN_CH_DROP_END 23 89#define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540 */
90/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */
64#define AB8500_INT_CCN_CONV_ACC 24 91#define AB8500_INT_CCN_CONV_ACC 24
65#define AB8500_INT_INT_AUD 25 92#define AB8500_INT_INT_AUD 25
66#define AB8500_INT_CCEOC 26 93#define AB8500_INT_CCEOC 26
@@ -69,7 +96,8 @@ struct device;
69#define AB8500_INT_LOW_BAT_R 29 96#define AB8500_INT_LOW_BAT_R 29
70#define AB8500_INT_BUP_CHG_NOT_OK 30 97#define AB8500_INT_BUP_CHG_NOT_OK 30
71#define AB8500_INT_BUP_CHG_OK 31 98#define AB8500_INT_BUP_CHG_OK 31
72#define AB8500_INT_GP_HW_ADC_CONV_END 32 99/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */
100#define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505 */
73#define AB8500_INT_ACC_DETECT_1DB_F 33 101#define AB8500_INT_ACC_DETECT_1DB_F 33
74#define AB8500_INT_ACC_DETECT_1DB_R 34 102#define AB8500_INT_ACC_DETECT_1DB_R 34
75#define AB8500_INT_ACC_DETECT_22DB_F 35 103#define AB8500_INT_ACC_DETECT_22DB_F 35
@@ -77,38 +105,43 @@ struct device;
77#define AB8500_INT_ACC_DETECT_21DB_F 37 105#define AB8500_INT_ACC_DETECT_21DB_F 37
78#define AB8500_INT_ACC_DETECT_21DB_R 38 106#define AB8500_INT_ACC_DETECT_21DB_R 38
79#define AB8500_INT_GP_SW_ADC_CONV_END 39 107#define AB8500_INT_GP_SW_ADC_CONV_END 39
80#define AB8500_INT_GPIO6R 40 108/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */
81#define AB8500_INT_GPIO7R 41 109#define AB8500_INT_GPIO6R 40 /* not 8505/9540 */
82#define AB8500_INT_GPIO8R 42 110#define AB8500_INT_GPIO7R 41 /* not 8505/9540 */
83#define AB8500_INT_GPIO9R 43 111#define AB8500_INT_GPIO8R 42 /* not 8505/9540 */
112#define AB8500_INT_GPIO9R 43 /* not 8505/9540 */
84#define AB8500_INT_GPIO10R 44 113#define AB8500_INT_GPIO10R 44
85#define AB8500_INT_GPIO11R 45 114#define AB8500_INT_GPIO11R 45
86#define AB8500_INT_GPIO12R 46 115#define AB8500_INT_GPIO12R 46 /* not 8505 */
87#define AB8500_INT_GPIO13R 47 116#define AB8500_INT_GPIO13R 47
88#define AB8500_INT_GPIO24R 48 117/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */
89#define AB8500_INT_GPIO25R 49 118#define AB8500_INT_GPIO24R 48 /* not 8505 */
90#define AB8500_INT_GPIO36R 50 119#define AB8500_INT_GPIO25R 49 /* not 8505 */
91#define AB8500_INT_GPIO37R 51 120#define AB8500_INT_GPIO36R 50 /* not 8505/9540 */
92#define AB8500_INT_GPIO38R 52 121#define AB8500_INT_GPIO37R 51 /* not 8505/9540 */
93#define AB8500_INT_GPIO39R 53 122#define AB8500_INT_GPIO38R 52 /* not 8505/9540 */
123#define AB8500_INT_GPIO39R 53 /* not 8505/9540 */
94#define AB8500_INT_GPIO40R 54 124#define AB8500_INT_GPIO40R 54
95#define AB8500_INT_GPIO41R 55 125#define AB8500_INT_GPIO41R 55
96#define AB8500_INT_GPIO6F 56 126/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */
97#define AB8500_INT_GPIO7F 57 127#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */
98#define AB8500_INT_GPIO8F 58 128#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */
99#define AB8500_INT_GPIO9F 59 129#define AB8500_INT_GPIO8F 58 /* not 8505/9540 */
130#define AB8500_INT_GPIO9F 59 /* not 8505/9540 */
100#define AB8500_INT_GPIO10F 60 131#define AB8500_INT_GPIO10F 60
101#define AB8500_INT_GPIO11F 61 132#define AB8500_INT_GPIO11F 61
102#define AB8500_INT_GPIO12F 62 133#define AB8500_INT_GPIO12F 62 /* not 8505 */
103#define AB8500_INT_GPIO13F 63 134#define AB8500_INT_GPIO13F 63
104#define AB8500_INT_GPIO24F 64 135/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */
105#define AB8500_INT_GPIO25F 65 136#define AB8500_INT_GPIO24F 64 /* not 8505 */
106#define AB8500_INT_GPIO36F 66 137#define AB8500_INT_GPIO25F 65 /* not 8505 */
107#define AB8500_INT_GPIO37F 67 138#define AB8500_INT_GPIO36F 66 /* not 8505/9540 */
108#define AB8500_INT_GPIO38F 68 139#define AB8500_INT_GPIO37F 67 /* not 8505/9540 */
109#define AB8500_INT_GPIO39F 69 140#define AB8500_INT_GPIO38F 68 /* not 8505/9540 */
141#define AB8500_INT_GPIO39F 69 /* not 8505/9540 */
110#define AB8500_INT_GPIO40F 70 142#define AB8500_INT_GPIO40F 70
111#define AB8500_INT_GPIO41F 71 143#define AB8500_INT_GPIO41F 71
144/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */
112#define AB8500_INT_ADP_SOURCE_ERROR 72 145#define AB8500_INT_ADP_SOURCE_ERROR 72
113#define AB8500_INT_ADP_SINK_ERROR 73 146#define AB8500_INT_ADP_SINK_ERROR 73
114#define AB8500_INT_ADP_PROBE_PLUG 74 147#define AB8500_INT_ADP_PROBE_PLUG 74
@@ -116,30 +149,67 @@ struct device;
116#define AB8500_INT_ADP_SENSE_OFF 76 149#define AB8500_INT_ADP_SENSE_OFF 76
117#define AB8500_INT_USB_PHY_POWER_ERR 78 150#define AB8500_INT_USB_PHY_POWER_ERR 78
118#define AB8500_INT_USB_LINK_STATUS 79 151#define AB8500_INT_USB_LINK_STATUS 79
152/* ab8500_irq_regoffset[10] -> IT[Source|Latch|Mask]19 */
119#define AB8500_INT_BTEMP_LOW 80 153#define AB8500_INT_BTEMP_LOW 80
120#define AB8500_INT_BTEMP_LOW_MEDIUM 81 154#define AB8500_INT_BTEMP_LOW_MEDIUM 81
121#define AB8500_INT_BTEMP_MEDIUM_HIGH 82 155#define AB8500_INT_BTEMP_MEDIUM_HIGH 82
122#define AB8500_INT_BTEMP_HIGH 83 156#define AB8500_INT_BTEMP_HIGH 83
123#define AB8500_INT_USB_CHARGER_NOT_OK 89 157/* ab8500_irq_regoffset[11] -> IT[Source|Latch|Mask]20 */
158#define AB8500_INT_SRP_DETECT 88
159#define AB8500_INT_USB_CHARGER_NOT_OKR 89
124#define AB8500_INT_ID_WAKEUP_R 90 160#define AB8500_INT_ID_WAKEUP_R 90
125#define AB8500_INT_ID_DET_R1R 92 161#define AB8500_INT_ID_DET_R1R 92
126#define AB8500_INT_ID_DET_R2R 93 162#define AB8500_INT_ID_DET_R2R 93
127#define AB8500_INT_ID_DET_R3R 94 163#define AB8500_INT_ID_DET_R3R 94
128#define AB8500_INT_ID_DET_R4R 95 164#define AB8500_INT_ID_DET_R4R 95
165/* ab8500_irq_regoffset[12] -> IT[Source|Latch|Mask]21 */
129#define AB8500_INT_ID_WAKEUP_F 96 166#define AB8500_INT_ID_WAKEUP_F 96
130#define AB8500_INT_ID_DET_R1F 98 167#define AB8500_INT_ID_DET_R1F 98
131#define AB8500_INT_ID_DET_R2F 99 168#define AB8500_INT_ID_DET_R2F 99
132#define AB8500_INT_ID_DET_R3F 100 169#define AB8500_INT_ID_DET_R3F 100
133#define AB8500_INT_ID_DET_R4F 101 170#define AB8500_INT_ID_DET_R4F 101
134#define AB8500_INT_USB_CHG_DET_DONE 102 171#define AB8500_INT_CHAUTORESTARTAFTSEC 102
172#define AB8500_INT_CHSTOPBYSEC 103
173/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */
135#define AB8500_INT_USB_CH_TH_PROT_F 104 174#define AB8500_INT_USB_CH_TH_PROT_F 104
136#define AB8500_INT_USB_CH_TH_PROT_R 105 175#define AB8500_INT_USB_CH_TH_PROT_R 105
137#define AB8500_INT_MAIN_CH_TH_PROT_F 106 176#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */
138#define AB8500_INT_MAIN_CH_TH_PROT_R 107 177#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */
139#define AB8500_INT_USB_CHARGER_NOT_OKF 111 178#define AB8500_INT_CHCURLIMNOHSCHIRP 109
179#define AB8500_INT_CHCURLIMHSCHIRP 110
180#define AB8500_INT_XTAL32K_KO 111
181
182/* Definitions for AB9540 */
183/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */
184#define AB9540_INT_GPIO50R 113
185#define AB9540_INT_GPIO51R 114 /* not 8505 */
186#define AB9540_INT_GPIO52R 115
187#define AB9540_INT_GPIO53R 116
188#define AB9540_INT_GPIO54R 117 /* not 8505 */
189#define AB9540_INT_IEXT_CH_RF_BFN_R 118
190#define AB9540_INT_IEXT_CH_RF_BFN_F 119
191/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */
192#define AB9540_INT_GPIO50F 121
193#define AB9540_INT_GPIO51F 122 /* not 8505 */
194#define AB9540_INT_GPIO52F 123
195#define AB9540_INT_GPIO53F 124
196#define AB9540_INT_GPIO54F 125 /* not 8505 */
140 197
198/*
199 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
200 * entire platform. This is a "compile time" constant so this must be set to
201 * the largest possible value that may be encountered with different AB SOCs.
202 * Of the currently supported AB devices, AB8500 and AB9540, it is the AB9540
203 * which is larger.
204 */
141#define AB8500_NR_IRQS 112 205#define AB8500_NR_IRQS 112
206#define AB8505_NR_IRQS 128
207#define AB9540_NR_IRQS 128
208/* This is set to the roof of any AB8500 chip variant IRQ counts */
209#define AB8500_MAX_NR_IRQS AB9540_NR_IRQS
210
142#define AB8500_NUM_IRQ_REGS 14 211#define AB8500_NUM_IRQ_REGS 14
212#define AB9540_NUM_IRQ_REGS 17
143 213
144/** 214/**
145 * struct ab8500 - ab8500 internal structure 215 * struct ab8500 - ab8500 internal structure
@@ -147,13 +217,18 @@ struct device;
147 * @lock: read/write operations lock 217 * @lock: read/write operations lock
148 * @irq_lock: genirq bus lock 218 * @irq_lock: genirq bus lock
149 * @irq: irq line 219 * @irq: irq line
220 * @version: chip version id (e.g. ab8500 or ab9540)
150 * @chip_id: chip revision id 221 * @chip_id: chip revision id
151 * @write: register write 222 * @write: register write
223 * @write_masked: masked register write
152 * @read: register read 224 * @read: register read
153 * @rx_buf: rx buf for SPI 225 * @rx_buf: rx buf for SPI
154 * @tx_buf: tx buf for SPI 226 * @tx_buf: tx buf for SPI
155 * @mask: cache of IRQ regs for bus lock 227 * @mask: cache of IRQ regs for bus lock
156 * @oldmask: cache of previous IRQ regs for bus lock 228 * @oldmask: cache of previous IRQ regs for bus lock
229 * @mask_size: Actual number of valid entries in mask[], oldmask[] and
230 * irq_reg_offset
231 * @irq_reg_offset: Array of offsets into IRQ registers
157 */ 232 */
158struct ab8500 { 233struct ab8500 {
159 struct device *dev; 234 struct device *dev;
@@ -162,16 +237,20 @@ struct ab8500 {
162 237
163 int irq_base; 238 int irq_base;
164 int irq; 239 int irq;
240 enum ab8500_version version;
165 u8 chip_id; 241 u8 chip_id;
166 242
167 int (*write) (struct ab8500 *a8500, u16 addr, u8 data); 243 int (*write)(struct ab8500 *ab8500, u16 addr, u8 data);
168 int (*read) (struct ab8500 *a8500, u16 addr); 244 int (*write_masked)(struct ab8500 *ab8500, u16 addr, u8 mask, u8 data);
245 int (*read)(struct ab8500 *ab8500, u16 addr);
169 246
170 unsigned long tx_buf[4]; 247 unsigned long tx_buf[4];
171 unsigned long rx_buf[4]; 248 unsigned long rx_buf[4];
172 249
173 u8 mask[AB8500_NUM_IRQ_REGS]; 250 u8 *mask;
174 u8 oldmask[AB8500_NUM_IRQ_REGS]; 251 u8 *oldmask;
252 int mask_size;
253 const int *irq_reg_offset;
175}; 254};
176 255
177struct regulator_reg_init; 256struct regulator_reg_init;
@@ -197,7 +276,52 @@ struct ab8500_platform_data {
197 struct ab8500_gpio_platform_data *gpio; 276 struct ab8500_gpio_platform_data *gpio;
198}; 277};
199 278
200extern int __devinit ab8500_init(struct ab8500 *ab8500); 279extern int __devinit ab8500_init(struct ab8500 *ab8500,
280 enum ab8500_version version);
201extern int __devexit ab8500_exit(struct ab8500 *ab8500); 281extern int __devexit ab8500_exit(struct ab8500 *ab8500);
202 282
283static inline int is_ab8500(struct ab8500 *ab)
284{
285 return ab->version == AB8500_VERSION_AB8500;
286}
287
288static inline int is_ab8505(struct ab8500 *ab)
289{
290 return ab->version == AB8500_VERSION_AB8505;
291}
292
293static inline int is_ab9540(struct ab8500 *ab)
294{
295 return ab->version == AB8500_VERSION_AB9540;
296}
297
298static inline int is_ab8540(struct ab8500 *ab)
299{
300 return ab->version == AB8500_VERSION_AB8540;
301}
302
303/* exclude also ab8505, ab9540... */
304static inline int is_ab8500_1p0_or_earlier(struct ab8500 *ab)
305{
306 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P0));
307}
308
309/* exclude also ab8505, ab9540... */
310static inline int is_ab8500_1p1_or_earlier(struct ab8500 *ab)
311{
312 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P1));
313}
314
315/* exclude also ab8505, ab9540... */
316static inline int is_ab8500_2p0_or_earlier(struct ab8500 *ab)
317{
318 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0));
319}
320
321/* exclude also ab8505, ab9540... */
322static inline int is_ab8500_2p0(struct ab8500 *ab)
323{
324 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
325}
326
203#endif /* MFD_AB8500_H */ 327#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h
new file mode 100644
index 000000000000..9b07725750c9
--- /dev/null
+++ b/include/linux/mfd/abx500/ux500_chargalg.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2012
3 * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
4 * License terms: GNU General Public License (GPL), version 2
5 */
6
7#ifndef _UX500_CHARGALG_H
8#define _UX500_CHARGALG_H
9
10#include <linux/power_supply.h>
11
12#define psy_to_ux500_charger(x) container_of((x), \
13 struct ux500_charger, psy)
14
15/* Forward declaration */
16struct ux500_charger;
17
18struct ux500_charger_ops {
19 int (*enable) (struct ux500_charger *, int, int, int);
20 int (*kick_wd) (struct ux500_charger *);
21 int (*update_curr) (struct ux500_charger *, int);
22};
23
24/**
25 * struct ux500_charger - power supply ux500 charger sub class
26 * @psy power supply base class
27 * @ops ux500 charger operations
28 * @max_out_volt maximum output charger voltage in mV
29 * @max_out_curr maximum output charger current in mA
30 */
31struct ux500_charger {
32 struct power_supply psy;
33 struct ux500_charger_ops ops;
34 int max_out_volt;
35 int max_out_curr;
36};
37
38#endif
diff --git a/include/linux/mfd/anatop.h b/include/linux/mfd/anatop.h
new file mode 100644
index 000000000000..22c1007d3ec5
--- /dev/null
+++ b/include/linux/mfd/anatop.h
@@ -0,0 +1,40 @@
1/*
2 * anatop.h - Anatop MFD driver
3 *
4 * Copyright (C) 2012 Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
5 * Copyright (C) 2012 Linaro
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
22#ifndef __LINUX_MFD_ANATOP_H
23#define __LINUX_MFD_ANATOP_H
24
25#include <linux/spinlock.h>
26
27/**
28 * anatop - MFD data
29 * @ioreg: ioremap register
30 * @reglock: spinlock for register read/write
31 */
32struct anatop {
33 void *ioreg;
34 spinlock_t reglock;
35};
36
37extern u32 anatop_get_bits(struct anatop *, u32, int, int);
38extern void anatop_set_bits(struct anatop *, u32, int, int, u32);
39
40#endif /* __LINUX_MFD_ANATOP_H */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 5702d1be13b4..7ffbd6e9e7fc 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -76,8 +76,6 @@ enum da9052_chip_id {
76struct da9052_pdata; 76struct da9052_pdata;
77 77
78struct da9052 { 78struct da9052 {
79 struct mutex io_lock;
80
81 struct device *dev; 79 struct device *dev;
82 struct regmap *regmap; 80 struct regmap *regmap;
83 81
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index 60d27f7bfc1f..b3a43b1263fe 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -11,6 +11,24 @@
11#define __MFD_DB8500_PRCMU_H 11#define __MFD_DB8500_PRCMU_H
12 12
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/bitops.h>
15
16/*
17 * Registers
18 */
19#define DB8500_PRCM_GPIOCR 0x138
20#define DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0 BIT(0)
21#define DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD BIT(9)
22#define DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 BIT(11)
23#define DB8500_PRCM_GPIOCR_SPI2_SELECT BIT(23)
24
25#define DB8500_PRCM_LINE_VALUE 0x170
26#define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3)
27
28#define DB8500_PRCM_DSI_SW_RESET 0x324
29#define DB8500_PRCM_DSI_SW_RESET_DSI0_SW_RESETN BIT(0)
30#define DB8500_PRCM_DSI_SW_RESET_DSI1_SW_RESETN BIT(1)
31#define DB8500_PRCM_DSI_SW_RESET_DSI2_SW_RESETN BIT(2)
14 32
15/* This portion previously known as <mach/prcmu-fw-defs_v1.h> */ 33/* This portion previously known as <mach/prcmu-fw-defs_v1.h> */
16 34
@@ -421,40 +439,22 @@ enum auto_enable {
421/* End of file previously known as prcmu-fw-defs_v1.h */ 439/* End of file previously known as prcmu-fw-defs_v1.h */
422 440
423/** 441/**
424 * enum hw_acc_dev - enum for hw accelerators 442 * enum prcmu_power_status - results from set_power_state
425 * @HW_ACC_SVAMMDSP: for SVAMMDSP 443 * @PRCMU_SLEEP_OK: Sleep went ok
426 * @HW_ACC_SVAPIPE: for SVAPIPE 444 * @PRCMU_DEEP_SLEEP_OK: DeepSleep went ok
427 * @HW_ACC_SIAMMDSP: for SIAMMDSP 445 * @PRCMU_IDLE_OK: Idle went ok
428 * @HW_ACC_SIAPIPE: for SIAPIPE 446 * @PRCMU_DEEPIDLE_OK: DeepIdle went ok
429 * @HW_ACC_SGA: for SGA 447 * @PRCMU_PRCMU2ARMPENDINGIT_ER: Pending interrupt detected
430 * @HW_ACC_B2R2: for B2R2 448 * @PRCMU_ARMPENDINGIT_ER: Pending interrupt detected
431 * @HW_ACC_MCDE: for MCDE
432 * @HW_ACC_ESRAM1: for ESRAM1
433 * @HW_ACC_ESRAM2: for ESRAM2
434 * @HW_ACC_ESRAM3: for ESRAM3
435 * @HW_ACC_ESRAM4: for ESRAM4
436 * @NUM_HW_ACC: number of hardware accelerators
437 *
438 * Different hw accelerators which can be turned ON/
439 * OFF or put into retention (MMDSPs and ESRAMs).
440 * Used with EPOD API.
441 * 449 *
442 * NOTE! Deprecated, to be removed when all users switched over to use the
443 * regulator API.
444 */ 450 */
445enum hw_acc_dev { 451enum prcmu_power_status {
446 HW_ACC_SVAMMDSP, 452 PRCMU_SLEEP_OK = 0xf3,
447 HW_ACC_SVAPIPE, 453 PRCMU_DEEP_SLEEP_OK = 0xf6,
448 HW_ACC_SIAMMDSP, 454 PRCMU_IDLE_OK = 0xf0,
449 HW_ACC_SIAPIPE, 455 PRCMU_DEEPIDLE_OK = 0xe3,
450 HW_ACC_SGA, 456 PRCMU_PRCMU2ARMPENDINGIT_ER = 0x91,
451 HW_ACC_B2R2, 457 PRCMU_ARMPENDINGIT_ER = 0x93,
452 HW_ACC_MCDE,
453 HW_ACC_ESRAM1,
454 HW_ACC_ESRAM2,
455 HW_ACC_ESRAM3,
456 HW_ACC_ESRAM4,
457 NUM_HW_ACC
458}; 458};
459 459
460/* 460/*
@@ -493,6 +493,20 @@ struct prcmu_auto_pm_config {
493 u8 sva_policy; 493 u8 sva_policy;
494}; 494};
495 495
496#define PRCMU_FW_PROJECT_U8500 2
497#define PRCMU_FW_PROJECT_U9500 4
498#define PRCMU_FW_PROJECT_U8500_C2 7
499#define PRCMU_FW_PROJECT_U9500_C2 11
500#define PRCMU_FW_PROJECT_U8520 13
501#define PRCMU_FW_PROJECT_U8420 14
502
503struct prcmu_fw_version {
504 u8 project;
505 u8 api_version;
506 u8 func_version;
507 u8 errata;
508};
509
496#ifdef CONFIG_MFD_DB8500_PRCMU 510#ifdef CONFIG_MFD_DB8500_PRCMU
497 511
498void db8500_prcmu_early_init(void); 512void db8500_prcmu_early_init(void);
@@ -500,42 +514,41 @@ int prcmu_set_rc_a2p(enum romcode_write);
500enum romcode_read prcmu_get_rc_p2a(void); 514enum romcode_read prcmu_get_rc_p2a(void);
501enum ap_pwrst prcmu_get_xp70_current_state(void); 515enum ap_pwrst prcmu_get_xp70_current_state(void);
502bool prcmu_has_arm_maxopp(void); 516bool prcmu_has_arm_maxopp(void);
503bool prcmu_is_u8400(void); 517struct prcmu_fw_version *prcmu_get_fw_version(void);
504int prcmu_set_ape_opp(u8 opp);
505int prcmu_get_ape_opp(void);
506int prcmu_request_ape_opp_100_voltage(bool enable); 518int prcmu_request_ape_opp_100_voltage(bool enable);
507int prcmu_release_usb_wakeup_state(void); 519int prcmu_release_usb_wakeup_state(void);
508int prcmu_set_ddr_opp(u8 opp);
509int prcmu_get_ddr_opp(void);
510/* NOTE! Use regulator framework instead */
511int prcmu_set_hwacc(u16 hw_acc_dev, u8 state);
512void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, 520void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
513 struct prcmu_auto_pm_config *idle); 521 struct prcmu_auto_pm_config *idle);
514bool prcmu_is_auto_pm_enabled(void); 522bool prcmu_is_auto_pm_enabled(void);
515 523
516int prcmu_config_clkout(u8 clkout, u8 source, u8 div); 524int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
517int prcmu_set_clock_divider(u8 clock, u8 divider); 525int prcmu_set_clock_divider(u8 clock, u8 divider);
518int prcmu_config_hotdog(u8 threshold); 526int db8500_prcmu_config_hotdog(u8 threshold);
519int prcmu_config_hotmon(u8 low, u8 high); 527int db8500_prcmu_config_hotmon(u8 low, u8 high);
520int prcmu_start_temp_sense(u16 cycles32k); 528int db8500_prcmu_start_temp_sense(u16 cycles32k);
521int prcmu_stop_temp_sense(void); 529int db8500_prcmu_stop_temp_sense(void);
522int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 530int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
523int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); 531int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
524 532
525void prcmu_ac_wake_req(void); 533void prcmu_ac_wake_req(void);
526void prcmu_ac_sleep_req(void); 534void prcmu_ac_sleep_req(void);
527void prcmu_modem_reset(void); 535void db8500_prcmu_modem_reset(void);
528void prcmu_enable_spi2(void);
529void prcmu_disable_spi2(void);
530 536
531int prcmu_config_a9wdog(u8 num, bool sleep_auto_off); 537int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off);
532int prcmu_enable_a9wdog(u8 id); 538int db8500_prcmu_enable_a9wdog(u8 id);
533int prcmu_disable_a9wdog(u8 id); 539int db8500_prcmu_disable_a9wdog(u8 id);
534int prcmu_kick_a9wdog(u8 id); 540int db8500_prcmu_kick_a9wdog(u8 id);
535int prcmu_load_a9wdog(u8 id, u32 val); 541int db8500_prcmu_load_a9wdog(u8 id, u32 val);
536 542
537void db8500_prcmu_system_reset(u16 reset_code); 543void db8500_prcmu_system_reset(u16 reset_code);
538int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); 544int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
545u8 db8500_prcmu_get_power_state_result(void);
546int db8500_prcmu_gic_decouple(void);
547int db8500_prcmu_gic_recouple(void);
548int db8500_prcmu_copy_gic_settings(void);
549bool db8500_prcmu_gic_pending_irq(void);
550bool db8500_prcmu_pending_irq(void);
551bool db8500_prcmu_is_cpu_in_wfi(int cpu);
539void db8500_prcmu_enable_wakeups(u32 wakeups); 552void db8500_prcmu_enable_wakeups(u32 wakeups);
540int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); 553int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
541int db8500_prcmu_request_clock(u8 clock, bool enable); 554int db8500_prcmu_request_clock(u8 clock, bool enable);
@@ -549,6 +562,14 @@ u16 db8500_prcmu_get_reset_code(void);
549bool db8500_prcmu_is_ac_wake_requested(void); 562bool db8500_prcmu_is_ac_wake_requested(void);
550int db8500_prcmu_set_arm_opp(u8 opp); 563int db8500_prcmu_set_arm_opp(u8 opp);
551int db8500_prcmu_get_arm_opp(void); 564int db8500_prcmu_get_arm_opp(void);
565int db8500_prcmu_set_ape_opp(u8 opp);
566int db8500_prcmu_get_ape_opp(void);
567int db8500_prcmu_set_ddr_opp(u8 opp);
568int db8500_prcmu_get_ddr_opp(void);
569
570u32 db8500_prcmu_read(unsigned int reg);
571void db8500_prcmu_write(unsigned int reg, u32 value);
572void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value);
552 573
553#else /* !CONFIG_MFD_DB8500_PRCMU */ 574#else /* !CONFIG_MFD_DB8500_PRCMU */
554 575
@@ -574,17 +595,17 @@ static inline bool prcmu_has_arm_maxopp(void)
574 return false; 595 return false;
575} 596}
576 597
577static inline bool prcmu_is_u8400(void) 598static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
578{ 599{
579 return false; 600 return NULL;
580} 601}
581 602
582static inline int prcmu_set_ape_opp(u8 opp) 603static inline int db8500_prcmu_set_ape_opp(u8 opp)
583{ 604{
584 return 0; 605 return 0;
585} 606}
586 607
587static inline int prcmu_get_ape_opp(void) 608static inline int db8500_prcmu_get_ape_opp(void)
588{ 609{
589 return APE_100_OPP; 610 return APE_100_OPP;
590} 611}
@@ -599,21 +620,16 @@ static inline int prcmu_release_usb_wakeup_state(void)
599 return 0; 620 return 0;
600} 621}
601 622
602static inline int prcmu_set_ddr_opp(u8 opp) 623static inline int db8500_prcmu_set_ddr_opp(u8 opp)
603{ 624{
604 return 0; 625 return 0;
605} 626}
606 627
607static inline int prcmu_get_ddr_opp(void) 628static inline int db8500_prcmu_get_ddr_opp(void)
608{ 629{
609 return DDR_100_OPP; 630 return DDR_100_OPP;
610} 631}
611 632
612static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state)
613{
614 return 0;
615}
616
617static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, 633static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
618 struct prcmu_auto_pm_config *idle) 634 struct prcmu_auto_pm_config *idle)
619{ 635{
@@ -634,22 +650,22 @@ static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
634 return 0; 650 return 0;
635} 651}
636 652
637static inline int prcmu_config_hotdog(u8 threshold) 653static inline int db8500_prcmu_config_hotdog(u8 threshold)
638{ 654{
639 return 0; 655 return 0;
640} 656}
641 657
642static inline int prcmu_config_hotmon(u8 low, u8 high) 658static inline int db8500_prcmu_config_hotmon(u8 low, u8 high)
643{ 659{
644 return 0; 660 return 0;
645} 661}
646 662
647static inline int prcmu_start_temp_sense(u16 cycles32k) 663static inline int db8500_prcmu_start_temp_sense(u16 cycles32k)
648{ 664{
649 return 0; 665 return 0;
650} 666}
651 667
652static inline int prcmu_stop_temp_sense(void) 668static inline int db8500_prcmu_stop_temp_sense(void)
653{ 669{
654 return 0; 670 return 0;
655} 671}
@@ -668,22 +684,17 @@ static inline void prcmu_ac_wake_req(void) {}
668 684
669static inline void prcmu_ac_sleep_req(void) {} 685static inline void prcmu_ac_sleep_req(void) {}
670 686
671static inline void prcmu_modem_reset(void) {} 687static inline void db8500_prcmu_modem_reset(void) {}
672 688
673static inline int prcmu_enable_spi2(void) 689static inline void db8500_prcmu_system_reset(u16 reset_code) {}
674{
675 return 0;
676}
677 690
678static inline int prcmu_disable_spi2(void) 691static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
692 bool keep_ap_pll)
679{ 693{
680 return 0; 694 return 0;
681} 695}
682 696
683static inline void db8500_prcmu_system_reset(u16 reset_code) {} 697static inline u8 db8500_prcmu_get_power_state_result(void)
684
685static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
686 bool keep_ap_pll)
687{ 698{
688 return 0; 699 return 0;
689} 700}
@@ -729,27 +740,27 @@ static inline u16 db8500_prcmu_get_reset_code(void)
729 return 0; 740 return 0;
730} 741}
731 742
732static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) 743static inline int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
733{ 744{
734 return 0; 745 return 0;
735} 746}
736 747
737static inline int prcmu_enable_a9wdog(u8 id) 748static inline int db8500_prcmu_enable_a9wdog(u8 id)
738{ 749{
739 return 0; 750 return 0;
740} 751}
741 752
742static inline int prcmu_disable_a9wdog(u8 id) 753static inline int db8500_prcmu_disable_a9wdog(u8 id)
743{ 754{
744 return 0; 755 return 0;
745} 756}
746 757
747static inline int prcmu_kick_a9wdog(u8 id) 758static inline int db8500_prcmu_kick_a9wdog(u8 id)
748{ 759{
749 return 0; 760 return 0;
750} 761}
751 762
752static inline int prcmu_load_a9wdog(u8 id, u32 val) 763static inline int db8500_prcmu_load_a9wdog(u8 id, u32 val)
753{ 764{
754 return 0; 765 return 0;
755} 766}
@@ -769,6 +780,16 @@ static inline int db8500_prcmu_get_arm_opp(void)
769 return 0; 780 return 0;
770} 781}
771 782
783static inline u32 db8500_prcmu_read(unsigned int reg)
784{
785 return 0;
786}
787
788static inline void db8500_prcmu_write(unsigned int reg, u32 value) {}
789
790static inline void db8500_prcmu_write_masked(unsigned int reg, u32 mask,
791 u32 value) {}
792
772#endif /* !CONFIG_MFD_DB8500_PRCMU */ 793#endif /* !CONFIG_MFD_DB8500_PRCMU */
773 794
774#endif /* __MFD_DB8500_PRCMU_H */ 795#endif /* __MFD_DB8500_PRCMU_H */
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index bac942f959c1..d7674eb7305f 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -10,7 +10,7 @@
10 10
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <asm/mach-types.h> 13#include <linux/err.h>
14 14
15/* PRCMU Wakeup defines */ 15/* PRCMU Wakeup defines */
16enum prcmu_wakeup_index { 16enum prcmu_wakeup_index {
@@ -80,6 +80,29 @@ enum prcmu_wakeup_index {
80#define EPOD_STATE_ON_CLK_OFF 0x03 80#define EPOD_STATE_ON_CLK_OFF 0x03
81#define EPOD_STATE_ON 0x04 81#define EPOD_STATE_ON 0x04
82 82
83/* DB5500 CLKOUT IDs */
84enum {
85 DB5500_CLKOUT0 = 0,
86 DB5500_CLKOUT1,
87};
88
89/* DB5500 CLKOUTx sources */
90enum {
91 DB5500_CLKOUT_REF_CLK_SEL0,
92 DB5500_CLKOUT_RTC_CLK0_SEL0,
93 DB5500_CLKOUT_ULP_CLK_SEL0,
94 DB5500_CLKOUT_STATIC0,
95 DB5500_CLKOUT_REFCLK,
96 DB5500_CLKOUT_ULPCLK,
97 DB5500_CLKOUT_ARMCLK,
98 DB5500_CLKOUT_SYSACC0CLK,
99 DB5500_CLKOUT_SOC0PLLCLK,
100 DB5500_CLKOUT_SOC1PLLCLK,
101 DB5500_CLKOUT_DDRPLLCLK,
102 DB5500_CLKOUT_TVCLK,
103 DB5500_CLKOUT_IRDACLK,
104};
105
83/* 106/*
84 * CLKOUT sources 107 * CLKOUT sources
85 */ 108 */
@@ -111,6 +134,7 @@ enum prcmu_clock {
111 PRCMU_MSP1CLK, 134 PRCMU_MSP1CLK,
112 PRCMU_I2CCLK, 135 PRCMU_I2CCLK,
113 PRCMU_SDMMCCLK, 136 PRCMU_SDMMCCLK,
137 PRCMU_SPARE1CLK,
114 PRCMU_SLIMCLK, 138 PRCMU_SLIMCLK,
115 PRCMU_PER1CLK, 139 PRCMU_PER1CLK,
116 PRCMU_PER2CLK, 140 PRCMU_PER2CLK,
@@ -139,12 +163,20 @@ enum prcmu_clock {
139 PRCMU_IRRCCLK, 163 PRCMU_IRRCCLK,
140 PRCMU_SIACLK, 164 PRCMU_SIACLK,
141 PRCMU_SVACLK, 165 PRCMU_SVACLK,
166 PRCMU_ACLK,
142 PRCMU_NUM_REG_CLOCKS, 167 PRCMU_NUM_REG_CLOCKS,
143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS, 168 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
169 PRCMU_CDCLK,
144 PRCMU_TIMCLK, 170 PRCMU_TIMCLK,
145 PRCMU_PLLSOC0, 171 PRCMU_PLLSOC0,
146 PRCMU_PLLSOC1, 172 PRCMU_PLLSOC1,
147 PRCMU_PLLDDR, 173 PRCMU_PLLDDR,
174 PRCMU_PLLDSI,
175 PRCMU_DSI0CLK,
176 PRCMU_DSI1CLK,
177 PRCMU_DSI0ESCCLK,
178 PRCMU_DSI1ESCCLK,
179 PRCMU_DSI2ESCCLK,
148}; 180};
149 181
150/** 182/**
@@ -153,12 +185,14 @@ enum prcmu_clock {
153 * @APE_NO_CHANGE: The APE operating point is unchanged 185 * @APE_NO_CHANGE: The APE operating point is unchanged
154 * @APE_100_OPP: The new APE operating point is ape100opp 186 * @APE_100_OPP: The new APE operating point is ape100opp
155 * @APE_50_OPP: 50% 187 * @APE_50_OPP: 50%
188 * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%.
156 */ 189 */
157enum ape_opp { 190enum ape_opp {
158 APE_OPP_INIT = 0x00, 191 APE_OPP_INIT = 0x00,
159 APE_NO_CHANGE = 0x01, 192 APE_NO_CHANGE = 0x01,
160 APE_100_OPP = 0x02, 193 APE_100_OPP = 0x02,
161 APE_50_OPP = 0x03 194 APE_50_OPP = 0x03,
195 APE_50_PARTLY_25_OPP = 0xFF,
162}; 196};
163 197
164/** 198/**
@@ -218,9 +252,11 @@ enum ddr_pwrst {
218 252
219#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) 253#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500)
220 254
255#include <mach/id.h>
256
221static inline void __init prcmu_early_init(void) 257static inline void __init prcmu_early_init(void)
222{ 258{
223 if (machine_is_u5500()) 259 if (cpu_is_u5500())
224 return db5500_prcmu_early_init(); 260 return db5500_prcmu_early_init();
225 else 261 else
226 return db8500_prcmu_early_init(); 262 return db8500_prcmu_early_init();
@@ -229,7 +265,7 @@ static inline void __init prcmu_early_init(void)
229static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, 265static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
230 bool keep_ap_pll) 266 bool keep_ap_pll)
231{ 267{
232 if (machine_is_u5500()) 268 if (cpu_is_u5500())
233 return db5500_prcmu_set_power_state(state, keep_ulp_clk, 269 return db5500_prcmu_set_power_state(state, keep_ulp_clk,
234 keep_ap_pll); 270 keep_ap_pll);
235 else 271 else
@@ -237,9 +273,65 @@ static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
237 keep_ap_pll); 273 keep_ap_pll);
238} 274}
239 275
276static inline u8 prcmu_get_power_state_result(void)
277{
278 if (cpu_is_u5500())
279 return -EINVAL;
280 else
281 return db8500_prcmu_get_power_state_result();
282}
283
284static inline int prcmu_gic_decouple(void)
285{
286 if (cpu_is_u5500())
287 return -EINVAL;
288 else
289 return db8500_prcmu_gic_decouple();
290}
291
292static inline int prcmu_gic_recouple(void)
293{
294 if (cpu_is_u5500())
295 return -EINVAL;
296 else
297 return db8500_prcmu_gic_recouple();
298}
299
300static inline bool prcmu_gic_pending_irq(void)
301{
302 if (cpu_is_u5500())
303 return -EINVAL;
304 else
305 return db8500_prcmu_gic_pending_irq();
306}
307
308static inline bool prcmu_is_cpu_in_wfi(int cpu)
309{
310 if (cpu_is_u5500())
311 return -EINVAL;
312 else
313 return db8500_prcmu_is_cpu_in_wfi(cpu);
314}
315
316static inline int prcmu_copy_gic_settings(void)
317{
318 if (cpu_is_u5500())
319 return -EINVAL;
320 else
321 return db8500_prcmu_copy_gic_settings();
322}
323
324static inline bool prcmu_pending_irq(void)
325{
326 if (cpu_is_u5500())
327 return -EINVAL;
328 else
329 return db8500_prcmu_pending_irq();
330}
331
240static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) 332static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
241{ 333{
242 if (machine_is_u5500()) 334 if (cpu_is_u5500())
243 return -EINVAL; 335 return -EINVAL;
244 else 336 else
245 return db8500_prcmu_set_epod(epod_id, epod_state); 337 return db8500_prcmu_set_epod(epod_id, epod_state);
@@ -247,7 +339,7 @@ static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
247 339
248static inline void prcmu_enable_wakeups(u32 wakeups) 340static inline void prcmu_enable_wakeups(u32 wakeups)
249{ 341{
250 if (machine_is_u5500()) 342 if (cpu_is_u5500())
251 db5500_prcmu_enable_wakeups(wakeups); 343 db5500_prcmu_enable_wakeups(wakeups);
252 else 344 else
253 db8500_prcmu_enable_wakeups(wakeups); 345 db8500_prcmu_enable_wakeups(wakeups);
@@ -260,7 +352,7 @@ static inline void prcmu_disable_wakeups(void)
260 352
261static inline void prcmu_config_abb_event_readout(u32 abb_events) 353static inline void prcmu_config_abb_event_readout(u32 abb_events)
262{ 354{
263 if (machine_is_u5500()) 355 if (cpu_is_u5500())
264 db5500_prcmu_config_abb_event_readout(abb_events); 356 db5500_prcmu_config_abb_event_readout(abb_events);
265 else 357 else
266 db8500_prcmu_config_abb_event_readout(abb_events); 358 db8500_prcmu_config_abb_event_readout(abb_events);
@@ -268,7 +360,7 @@ static inline void prcmu_config_abb_event_readout(u32 abb_events)
268 360
269static inline void prcmu_get_abb_event_buffer(void __iomem **buf) 361static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
270{ 362{
271 if (machine_is_u5500()) 363 if (cpu_is_u5500())
272 db5500_prcmu_get_abb_event_buffer(buf); 364 db5500_prcmu_get_abb_event_buffer(buf);
273 else 365 else
274 db8500_prcmu_get_abb_event_buffer(buf); 366 db8500_prcmu_get_abb_event_buffer(buf);
@@ -276,25 +368,40 @@ static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
276 368
277int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 369int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
278int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); 370int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
371int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, u8 size);
279 372
280int prcmu_config_clkout(u8 clkout, u8 source, u8 div); 373int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
281 374
282static inline int prcmu_request_clock(u8 clock, bool enable) 375static inline int prcmu_request_clock(u8 clock, bool enable)
283{ 376{
284 if (machine_is_u5500()) 377 if (cpu_is_u5500())
285 return db5500_prcmu_request_clock(clock, enable); 378 return db5500_prcmu_request_clock(clock, enable);
286 else 379 else
287 return db8500_prcmu_request_clock(clock, enable); 380 return db8500_prcmu_request_clock(clock, enable);
288} 381}
289 382
290int prcmu_set_ape_opp(u8 opp); 383unsigned long prcmu_clock_rate(u8 clock);
291int prcmu_get_ape_opp(void); 384long prcmu_round_clock_rate(u8 clock, unsigned long rate);
292int prcmu_set_ddr_opp(u8 opp); 385int prcmu_set_clock_rate(u8 clock, unsigned long rate);
293int prcmu_get_ddr_opp(void); 386
387static inline int prcmu_set_ddr_opp(u8 opp)
388{
389 if (cpu_is_u5500())
390 return -EINVAL;
391 else
392 return db8500_prcmu_set_ddr_opp(opp);
393}
394static inline int prcmu_get_ddr_opp(void)
395{
396 if (cpu_is_u5500())
397 return -EINVAL;
398 else
399 return db8500_prcmu_get_ddr_opp();
400}
294 401
295static inline int prcmu_set_arm_opp(u8 opp) 402static inline int prcmu_set_arm_opp(u8 opp)
296{ 403{
297 if (machine_is_u5500()) 404 if (cpu_is_u5500())
298 return -EINVAL; 405 return -EINVAL;
299 else 406 else
300 return db8500_prcmu_set_arm_opp(opp); 407 return db8500_prcmu_set_arm_opp(opp);
@@ -302,15 +409,31 @@ static inline int prcmu_set_arm_opp(u8 opp)
302 409
303static inline int prcmu_get_arm_opp(void) 410static inline int prcmu_get_arm_opp(void)
304{ 411{
305 if (machine_is_u5500()) 412 if (cpu_is_u5500())
306 return -EINVAL; 413 return -EINVAL;
307 else 414 else
308 return db8500_prcmu_get_arm_opp(); 415 return db8500_prcmu_get_arm_opp();
309} 416}
310 417
418static inline int prcmu_set_ape_opp(u8 opp)
419{
420 if (cpu_is_u5500())
421 return -EINVAL;
422 else
423 return db8500_prcmu_set_ape_opp(opp);
424}
425
426static inline int prcmu_get_ape_opp(void)
427{
428 if (cpu_is_u5500())
429 return -EINVAL;
430 else
431 return db8500_prcmu_get_ape_opp();
432}
433
311static inline void prcmu_system_reset(u16 reset_code) 434static inline void prcmu_system_reset(u16 reset_code)
312{ 435{
313 if (machine_is_u5500()) 436 if (cpu_is_u5500())
314 return db5500_prcmu_system_reset(reset_code); 437 return db5500_prcmu_system_reset(reset_code);
315 else 438 else
316 return db8500_prcmu_system_reset(reset_code); 439 return db8500_prcmu_system_reset(reset_code);
@@ -318,7 +441,7 @@ static inline void prcmu_system_reset(u16 reset_code)
318 441
319static inline u16 prcmu_get_reset_code(void) 442static inline u16 prcmu_get_reset_code(void)
320{ 443{
321 if (machine_is_u5500()) 444 if (cpu_is_u5500())
322 return db5500_prcmu_get_reset_code(); 445 return db5500_prcmu_get_reset_code();
323 else 446 else
324 return db8500_prcmu_get_reset_code(); 447 return db8500_prcmu_get_reset_code();
@@ -326,10 +449,17 @@ static inline u16 prcmu_get_reset_code(void)
326 449
327void prcmu_ac_wake_req(void); 450void prcmu_ac_wake_req(void);
328void prcmu_ac_sleep_req(void); 451void prcmu_ac_sleep_req(void);
329void prcmu_modem_reset(void); 452static inline void prcmu_modem_reset(void)
453{
454 if (cpu_is_u5500())
455 return;
456 else
457 return db8500_prcmu_modem_reset();
458}
459
330static inline bool prcmu_is_ac_wake_requested(void) 460static inline bool prcmu_is_ac_wake_requested(void)
331{ 461{
332 if (machine_is_u5500()) 462 if (cpu_is_u5500())
333 return db5500_prcmu_is_ac_wake_requested(); 463 return db5500_prcmu_is_ac_wake_requested();
334 else 464 else
335 return db8500_prcmu_is_ac_wake_requested(); 465 return db8500_prcmu_is_ac_wake_requested();
@@ -337,7 +467,7 @@ static inline bool prcmu_is_ac_wake_requested(void)
337 467
338static inline int prcmu_set_display_clocks(void) 468static inline int prcmu_set_display_clocks(void)
339{ 469{
340 if (machine_is_u5500()) 470 if (cpu_is_u5500())
341 return db5500_prcmu_set_display_clocks(); 471 return db5500_prcmu_set_display_clocks();
342 else 472 else
343 return db8500_prcmu_set_display_clocks(); 473 return db8500_prcmu_set_display_clocks();
@@ -345,7 +475,7 @@ static inline int prcmu_set_display_clocks(void)
345 475
346static inline int prcmu_disable_dsipll(void) 476static inline int prcmu_disable_dsipll(void)
347{ 477{
348 if (machine_is_u5500()) 478 if (cpu_is_u5500())
349 return db5500_prcmu_disable_dsipll(); 479 return db5500_prcmu_disable_dsipll();
350 else 480 else
351 return db8500_prcmu_disable_dsipll(); 481 return db8500_prcmu_disable_dsipll();
@@ -353,7 +483,7 @@ static inline int prcmu_disable_dsipll(void)
353 483
354static inline int prcmu_enable_dsipll(void) 484static inline int prcmu_enable_dsipll(void)
355{ 485{
356 if (machine_is_u5500()) 486 if (cpu_is_u5500())
357 return db5500_prcmu_enable_dsipll(); 487 return db5500_prcmu_enable_dsipll();
358 else 488 else
359 return db8500_prcmu_enable_dsipll(); 489 return db8500_prcmu_enable_dsipll();
@@ -361,11 +491,107 @@ static inline int prcmu_enable_dsipll(void)
361 491
362static inline int prcmu_config_esram0_deep_sleep(u8 state) 492static inline int prcmu_config_esram0_deep_sleep(u8 state)
363{ 493{
364 if (machine_is_u5500()) 494 if (cpu_is_u5500())
365 return -EINVAL; 495 return -EINVAL;
366 else 496 else
367 return db8500_prcmu_config_esram0_deep_sleep(state); 497 return db8500_prcmu_config_esram0_deep_sleep(state);
368} 498}
499
500static inline int prcmu_config_hotdog(u8 threshold)
501{
502 if (cpu_is_u5500())
503 return -EINVAL;
504 else
505 return db8500_prcmu_config_hotdog(threshold);
506}
507
508static inline int prcmu_config_hotmon(u8 low, u8 high)
509{
510 if (cpu_is_u5500())
511 return -EINVAL;
512 else
513 return db8500_prcmu_config_hotmon(low, high);
514}
515
516static inline int prcmu_start_temp_sense(u16 cycles32k)
517{
518 if (cpu_is_u5500())
519 return -EINVAL;
520 else
521 return db8500_prcmu_start_temp_sense(cycles32k);
522}
523
524static inline int prcmu_stop_temp_sense(void)
525{
526 if (cpu_is_u5500())
527 return -EINVAL;
528 else
529 return db8500_prcmu_stop_temp_sense();
530}
531
532static inline u32 prcmu_read(unsigned int reg)
533{
534 if (cpu_is_u5500())
535 return -EINVAL;
536 else
537 return db8500_prcmu_read(reg);
538}
539
540static inline void prcmu_write(unsigned int reg, u32 value)
541{
542 if (cpu_is_u5500())
543 return;
544 else
545 db8500_prcmu_write(reg, value);
546}
547
548static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
549{
550 if (cpu_is_u5500())
551 return;
552 else
553 db8500_prcmu_write_masked(reg, mask, value);
554}
555
556static inline int prcmu_enable_a9wdog(u8 id)
557{
558 if (cpu_is_u5500())
559 return -EINVAL;
560 else
561 return db8500_prcmu_enable_a9wdog(id);
562}
563
564static inline int prcmu_disable_a9wdog(u8 id)
565{
566 if (cpu_is_u5500())
567 return -EINVAL;
568 else
569 return db8500_prcmu_disable_a9wdog(id);
570}
571
572static inline int prcmu_kick_a9wdog(u8 id)
573{
574 if (cpu_is_u5500())
575 return -EINVAL;
576 else
577 return db8500_prcmu_kick_a9wdog(id);
578}
579
580static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
581{
582 if (cpu_is_u5500())
583 return -EINVAL;
584 else
585 return db8500_prcmu_load_a9wdog(id, timeout);
586}
587
588static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
589{
590 if (cpu_is_u5500())
591 return -EINVAL;
592 else
593 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
594}
369#else 595#else
370 596
371static inline void __init prcmu_early_init(void) {} 597static inline void __init prcmu_early_init(void) {}
@@ -395,6 +621,12 @@ static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
395 return -ENOSYS; 621 return -ENOSYS;
396} 622}
397 623
624static inline int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask,
625 u8 size)
626{
627 return -ENOSYS;
628}
629
398static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div) 630static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
399{ 631{
400 return 0; 632 return 0;
@@ -405,6 +637,21 @@ static inline int prcmu_request_clock(u8 clock, bool enable)
405 return 0; 637 return 0;
406} 638}
407 639
640static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate)
641{
642 return 0;
643}
644
645static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate)
646{
647 return 0;
648}
649
650static inline unsigned long prcmu_clock_rate(u8 clock)
651{
652 return 0;
653}
654
408static inline int prcmu_set_ape_opp(u8 opp) 655static inline int prcmu_set_ape_opp(u8 opp)
409{ 656{
410 return 0; 657 return 0;
@@ -480,14 +727,133 @@ static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
480 *buf = NULL; 727 *buf = NULL;
481} 728}
482 729
730static inline int prcmu_config_hotdog(u8 threshold)
731{
732 return 0;
733}
734
735static inline int prcmu_config_hotmon(u8 low, u8 high)
736{
737 return 0;
738}
739
740static inline int prcmu_start_temp_sense(u16 cycles32k)
741{
742 return 0;
743}
744
745static inline int prcmu_stop_temp_sense(void)
746{
747 return 0;
748}
749
750static inline u32 prcmu_read(unsigned int reg)
751{
752 return 0;
753}
754
755static inline void prcmu_write(unsigned int reg, u32 value) {}
756
757static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {}
758
759#endif
760
761static inline void prcmu_set(unsigned int reg, u32 bits)
762{
763 prcmu_write_masked(reg, bits, bits);
764}
765
766static inline void prcmu_clear(unsigned int reg, u32 bits)
767{
768 prcmu_write_masked(reg, bits, 0);
769}
770
771#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500)
772
773/**
774 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
775 */
776static inline void prcmu_enable_spi2(void)
777{
778 if (cpu_is_u8500())
779 prcmu_set(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
780}
781
782/**
783 * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1.
784 */
785static inline void prcmu_disable_spi2(void)
786{
787 if (cpu_is_u8500())
788 prcmu_clear(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
789}
790
791/**
792 * prcmu_enable_stm_mod_uart - Enables pin muxing for STMMOD
793 * and UARTMOD on OtherAlternateC3.
794 */
795static inline void prcmu_enable_stm_mod_uart(void)
796{
797 if (cpu_is_u8500()) {
798 prcmu_set(DB8500_PRCM_GPIOCR,
799 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
800 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
801 }
802}
803
804/**
805 * prcmu_disable_stm_mod_uart - Disables pin muxing for STMMOD
806 * and UARTMOD on OtherAlternateC3.
807 */
808static inline void prcmu_disable_stm_mod_uart(void)
809{
810 if (cpu_is_u8500()) {
811 prcmu_clear(DB8500_PRCM_GPIOCR,
812 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
813 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
814 }
815}
816
817/**
818 * prcmu_enable_stm_ape - Enables pin muxing for STM APE on OtherAlternateC1.
819 */
820static inline void prcmu_enable_stm_ape(void)
821{
822 if (cpu_is_u8500()) {
823 prcmu_set(DB8500_PRCM_GPIOCR,
824 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
825 }
826}
827
828/**
829 * prcmu_disable_stm_ape - Disables pin muxing for STM APE on OtherAlternateC1.
830 */
831static inline void prcmu_disable_stm_ape(void)
832{
833 if (cpu_is_u8500()) {
834 prcmu_clear(DB8500_PRCM_GPIOCR,
835 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
836 }
837}
838
839#else
840
841static inline void prcmu_enable_spi2(void) {}
842static inline void prcmu_disable_spi2(void) {}
843static inline void prcmu_enable_stm_mod_uart(void) {}
844static inline void prcmu_disable_stm_mod_uart(void) {}
845static inline void prcmu_enable_stm_ape(void) {}
846static inline void prcmu_disable_stm_ape(void) {}
847
483#endif 848#endif
484 849
485/* PRCMU QoS APE OPP class */ 850/* PRCMU QoS APE OPP class */
486#define PRCMU_QOS_APE_OPP 1 851#define PRCMU_QOS_APE_OPP 1
487#define PRCMU_QOS_DDR_OPP 2 852#define PRCMU_QOS_DDR_OPP 2
853#define PRCMU_QOS_ARM_OPP 3
488#define PRCMU_QOS_DEFAULT_VALUE -1 854#define PRCMU_QOS_DEFAULT_VALUE -1
489 855
490#ifdef CONFIG_UX500_PRCMU_QOS_POWER 856#ifdef CONFIG_DBX500_PRCMU_QOS_POWER
491 857
492unsigned long prcmu_qos_get_cpufreq_opp_delay(void); 858unsigned long prcmu_qos_get_cpufreq_opp_delay(void);
493void prcmu_qos_set_cpufreq_opp_delay(unsigned long); 859void prcmu_qos_set_cpufreq_opp_delay(unsigned long);
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index b86ee45c8b03..10e038bac8dd 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -38,7 +38,8 @@ int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq);
38int mc13xxx_get_flags(struct mc13xxx *mc13xxx); 38int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
39 39
40int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, 40int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
41 unsigned int mode, unsigned int channel, unsigned int *sample); 41 unsigned int mode, unsigned int channel,
42 u8 ato, bool atox, unsigned int *sample);
42 43
43#define MC13XXX_IRQ_ADCDONE 0 44#define MC13XXX_IRQ_ADCDONE 0
44#define MC13XXX_IRQ_ADCBISDONE 1 45#define MC13XXX_IRQ_ADCBISDONE 1
@@ -157,6 +158,18 @@ struct mc13xxx_buttons_platform_data {
157 unsigned short b3on_key; 158 unsigned short b3on_key;
158}; 159};
159 160
161struct mc13xxx_ts_platform_data {
162 /* Delay between Touchscreen polarization and ADC Conversion.
163 * Given in clock ticks of a 32 kHz clock which gives a granularity of
164 * about 30.5ms */
165 u8 ato;
166
167#define MC13783_TS_ATO_FIRST false
168#define MC13783_TS_ATO_EACH true
169 /* Use the ATO delay only for the first conversion or for each one */
170 bool atox;
171};
172
160struct mc13xxx_platform_data { 173struct mc13xxx_platform_data {
161#define MC13XXX_USE_TOUCHSCREEN (1 << 0) 174#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
162#define MC13XXX_USE_CODEC (1 << 1) 175#define MC13XXX_USE_CODEC (1 << 1)
@@ -167,6 +180,7 @@ struct mc13xxx_platform_data {
167 struct mc13xxx_regulator_platform_data regulators; 180 struct mc13xxx_regulator_platform_data regulators;
168 struct mc13xxx_leds_platform_data *leds; 181 struct mc13xxx_leds_platform_data *leds;
169 struct mc13xxx_buttons_platform_data *buttons; 182 struct mc13xxx_buttons_platform_data *buttons;
183 struct mc13xxx_ts_platform_data touch;
170}; 184};
171 185
172#define MC13XXX_ADC_MODE_TS 1 186#define MC13XXX_ADC_MODE_TS 1
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index f88c1cc0cb0f..a9e8bd157673 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -10,8 +10,6 @@
10#ifndef MCP_H 10#ifndef MCP_H
11#define MCP_H 11#define MCP_H
12 12
13#include <mach/dma.h>
14
15struct mcp_ops; 13struct mcp_ops;
16 14
17struct mcp { 15struct mcp {
@@ -21,12 +19,7 @@ struct mcp {
21 int use_count; 19 int use_count;
22 unsigned int sclk_rate; 20 unsigned int sclk_rate;
23 unsigned int rw_timeout; 21 unsigned int rw_timeout;
24 dma_device_t dma_audio_rd;
25 dma_device_t dma_audio_wr;
26 dma_device_t dma_telco_rd;
27 dma_device_t dma_telco_wr;
28 struct device attached_device; 22 struct device attached_device;
29 int gpio_base;
30}; 23};
31 24
32struct mcp_ops { 25struct mcp_ops {
@@ -47,15 +40,14 @@ void mcp_disable(struct mcp *);
47#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) 40#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate)
48 41
49struct mcp *mcp_host_alloc(struct device *, size_t); 42struct mcp *mcp_host_alloc(struct device *, size_t);
50int mcp_host_register(struct mcp *); 43int mcp_host_add(struct mcp *, void *);
51void mcp_host_unregister(struct mcp *); 44void mcp_host_del(struct mcp *);
45void mcp_host_free(struct mcp *);
52 46
53struct mcp_driver { 47struct mcp_driver {
54 struct device_driver drv; 48 struct device_driver drv;
55 int (*probe)(struct mcp *); 49 int (*probe)(struct mcp *);
56 void (*remove)(struct mcp *); 50 void (*remove)(struct mcp *);
57 int (*suspend)(struct mcp *, pm_message_t);
58 int (*resume)(struct mcp *);
59}; 51};
60 52
61int mcp_driver_register(struct mcp_driver *); 53int mcp_driver_register(struct mcp_driver *);
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
new file mode 100644
index 000000000000..a2c61609d21d
--- /dev/null
+++ b/include/linux/mfd/rc5t583.h
@@ -0,0 +1,295 @@
1/*
2 * Core driver interface to access RICOH_RC5T583 power management chip.
3 *
4 * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved.
5 * Author: Laxman dewangan <ldewangan@nvidia.com>
6 *
7 * Based on code
8 * Copyright (C) 2011 RICOH COMPANY,LTD
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#ifndef __LINUX_MFD_RC5T583_H
25#define __LINUX_MFD_RC5T583_H
26
27#include <linux/mutex.h>
28#include <linux/types.h>
29
30#define RC5T583_MAX_REGS 0xF8
31
32/* Maximum number of main interrupts */
33#define MAX_MAIN_INTERRUPT 5
34#define RC5T583_MAX_GPEDGE_REG 2
35#define RC5T583_MAX_INTERRUPT_MASK_REGS 9
36
37/* Interrupt enable register */
38#define RC5T583_INT_EN_SYS1 0x19
39#define RC5T583_INT_EN_SYS2 0x1D
40#define RC5T583_INT_EN_DCDC 0x41
41#define RC5T583_INT_EN_RTC 0xED
42#define RC5T583_INT_EN_ADC1 0x90
43#define RC5T583_INT_EN_ADC2 0x91
44#define RC5T583_INT_EN_ADC3 0x92
45
46/* Interrupt status registers (monitor regs in Ricoh)*/
47#define RC5T583_INTC_INTPOL 0xAD
48#define RC5T583_INTC_INTEN 0xAE
49#define RC5T583_INTC_INTMON 0xAF
50
51#define RC5T583_INT_MON_GRP 0xAF
52#define RC5T583_INT_MON_SYS1 0x1B
53#define RC5T583_INT_MON_SYS2 0x1F
54#define RC5T583_INT_MON_DCDC 0x43
55#define RC5T583_INT_MON_RTC 0xEE
56
57/* Interrupt clearing registers */
58#define RC5T583_INT_IR_SYS1 0x1A
59#define RC5T583_INT_IR_SYS2 0x1E
60#define RC5T583_INT_IR_DCDC 0x42
61#define RC5T583_INT_IR_RTC 0xEE
62#define RC5T583_INT_IR_ADCL 0x94
63#define RC5T583_INT_IR_ADCH 0x95
64#define RC5T583_INT_IR_ADCEND 0x96
65#define RC5T583_INT_IR_GPIOR 0xA9
66#define RC5T583_INT_IR_GPIOF 0xAA
67
68/* Sleep sequence registers */
69#define RC5T583_SLPSEQ1 0x21
70#define RC5T583_SLPSEQ2 0x22
71#define RC5T583_SLPSEQ3 0x23
72#define RC5T583_SLPSEQ4 0x24
73#define RC5T583_SLPSEQ5 0x25
74#define RC5T583_SLPSEQ6 0x26
75#define RC5T583_SLPSEQ7 0x27
76#define RC5T583_SLPSEQ8 0x28
77#define RC5T583_SLPSEQ9 0x29
78#define RC5T583_SLPSEQ10 0x2A
79#define RC5T583_SLPSEQ11 0x2B
80
81/* Regulator registers */
82#define RC5T583_REG_DC0CTL 0x30
83#define RC5T583_REG_DC0DAC 0x31
84#define RC5T583_REG_DC0LATCTL 0x32
85#define RC5T583_REG_SR0CTL 0x33
86
87#define RC5T583_REG_DC1CTL 0x34
88#define RC5T583_REG_DC1DAC 0x35
89#define RC5T583_REG_DC1LATCTL 0x36
90#define RC5T583_REG_SR1CTL 0x37
91
92#define RC5T583_REG_DC2CTL 0x38
93#define RC5T583_REG_DC2DAC 0x39
94#define RC5T583_REG_DC2LATCTL 0x3A
95#define RC5T583_REG_SR2CTL 0x3B
96
97#define RC5T583_REG_DC3CTL 0x3C
98#define RC5T583_REG_DC3DAC 0x3D
99#define RC5T583_REG_DC3LATCTL 0x3E
100#define RC5T583_REG_SR3CTL 0x3F
101
102
103#define RC5T583_REG_LDOEN1 0x50
104#define RC5T583_REG_LDOEN2 0x51
105#define RC5T583_REG_LDODIS1 0x52
106#define RC5T583_REG_LDODIS2 0x53
107
108#define RC5T583_REG_LDO0DAC 0x54
109#define RC5T583_REG_LDO1DAC 0x55
110#define RC5T583_REG_LDO2DAC 0x56
111#define RC5T583_REG_LDO3DAC 0x57
112#define RC5T583_REG_LDO4DAC 0x58
113#define RC5T583_REG_LDO5DAC 0x59
114#define RC5T583_REG_LDO6DAC 0x5A
115#define RC5T583_REG_LDO7DAC 0x5B
116#define RC5T583_REG_LDO8DAC 0x5C
117#define RC5T583_REG_LDO9DAC 0x5D
118
119#define RC5T583_REG_DC0DAC_DS 0x60
120#define RC5T583_REG_DC1DAC_DS 0x61
121#define RC5T583_REG_DC2DAC_DS 0x62
122#define RC5T583_REG_DC3DAC_DS 0x63
123
124#define RC5T583_REG_LDO0DAC_DS 0x64
125#define RC5T583_REG_LDO1DAC_DS 0x65
126#define RC5T583_REG_LDO2DAC_DS 0x66
127#define RC5T583_REG_LDO3DAC_DS 0x67
128#define RC5T583_REG_LDO4DAC_DS 0x68
129#define RC5T583_REG_LDO5DAC_DS 0x69
130#define RC5T583_REG_LDO6DAC_DS 0x6A
131#define RC5T583_REG_LDO7DAC_DS 0x6B
132#define RC5T583_REG_LDO8DAC_DS 0x6C
133#define RC5T583_REG_LDO9DAC_DS 0x6D
134
135/* GPIO register base address */
136#define RC5T583_GPIO_IOSEL 0xA0
137#define RC5T583_GPIO_PDEN 0xA1
138#define RC5T583_GPIO_IOOUT 0xA2
139#define RC5T583_GPIO_PGSEL 0xA3
140#define RC5T583_GPIO_GPINV 0xA4
141#define RC5T583_GPIO_GPDEB 0xA5
142#define RC5T583_GPIO_GPEDGE1 0xA6
143#define RC5T583_GPIO_GPEDGE2 0xA7
144#define RC5T583_GPIO_EN_INT 0xA8
145#define RC5T583_GPIO_MON_IOIN 0xAB
146#define RC5T583_GPIO_GPOFUNC 0xAC
147
148/* RICOH_RC5T583 IRQ definitions */
149enum {
150 RC5T583_IRQ_ONKEY,
151 RC5T583_IRQ_ACOK,
152 RC5T583_IRQ_LIDOPEN,
153 RC5T583_IRQ_PREOT,
154 RC5T583_IRQ_CLKSTP,
155 RC5T583_IRQ_ONKEY_OFF,
156 RC5T583_IRQ_WD,
157 RC5T583_IRQ_EN_PWRREQ1,
158 RC5T583_IRQ_EN_PWRREQ2,
159 RC5T583_IRQ_PRE_VINDET,
160
161 RC5T583_IRQ_DC0LIM,
162 RC5T583_IRQ_DC1LIM,
163 RC5T583_IRQ_DC2LIM,
164 RC5T583_IRQ_DC3LIM,
165
166 RC5T583_IRQ_CTC,
167 RC5T583_IRQ_YALE,
168 RC5T583_IRQ_DALE,
169 RC5T583_IRQ_WALE,
170
171 RC5T583_IRQ_AIN1L,
172 RC5T583_IRQ_AIN2L,
173 RC5T583_IRQ_AIN3L,
174 RC5T583_IRQ_VBATL,
175 RC5T583_IRQ_VIN3L,
176 RC5T583_IRQ_VIN8L,
177 RC5T583_IRQ_AIN1H,
178 RC5T583_IRQ_AIN2H,
179 RC5T583_IRQ_AIN3H,
180 RC5T583_IRQ_VBATH,
181 RC5T583_IRQ_VIN3H,
182 RC5T583_IRQ_VIN8H,
183 RC5T583_IRQ_ADCEND,
184
185 RC5T583_IRQ_GPIO0,
186 RC5T583_IRQ_GPIO1,
187 RC5T583_IRQ_GPIO2,
188 RC5T583_IRQ_GPIO3,
189 RC5T583_IRQ_GPIO4,
190 RC5T583_IRQ_GPIO5,
191 RC5T583_IRQ_GPIO6,
192 RC5T583_IRQ_GPIO7,
193
194 /* Should be last entry */
195 RC5T583_MAX_IRQS,
196};
197
198/* Ricoh583 gpio definitions */
199enum {
200 RC5T583_GPIO0,
201 RC5T583_GPIO1,
202 RC5T583_GPIO2,
203 RC5T583_GPIO3,
204 RC5T583_GPIO4,
205 RC5T583_GPIO5,
206 RC5T583_GPIO6,
207 RC5T583_GPIO7,
208
209 /* Should be last entry */
210 RC5T583_MAX_GPIO,
211};
212
213enum {
214 RC5T583_DS_NONE,
215 RC5T583_DS_DC0,
216 RC5T583_DS_DC1,
217 RC5T583_DS_DC2,
218 RC5T583_DS_DC3,
219 RC5T583_DS_LDO0,
220 RC5T583_DS_LDO1,
221 RC5T583_DS_LDO2,
222 RC5T583_DS_LDO3,
223 RC5T583_DS_LDO4,
224 RC5T583_DS_LDO5,
225 RC5T583_DS_LDO6,
226 RC5T583_DS_LDO7,
227 RC5T583_DS_LDO8,
228 RC5T583_DS_LDO9,
229 RC5T583_DS_PSO0,
230 RC5T583_DS_PSO1,
231 RC5T583_DS_PSO2,
232 RC5T583_DS_PSO3,
233 RC5T583_DS_PSO4,
234 RC5T583_DS_PSO5,
235 RC5T583_DS_PSO6,
236 RC5T583_DS_PSO7,
237
238 /* Should be last entry */
239 RC5T583_DS_MAX,
240};
241
242/*
243 * Ricoh pmic RC5T583 supports sleep through two external controls.
244 * The output of gpios and regulator can be enable/disable through
245 * this external signals.
246 */
247enum {
248 RC5T583_EXT_PWRREQ1_CONTROL = 0x1,
249 RC5T583_EXT_PWRREQ2_CONTROL = 0x2,
250};
251
252struct rc5t583 {
253 struct device *dev;
254 struct regmap *regmap;
255 int chip_irq;
256 int irq_base;
257 struct mutex irq_lock;
258 unsigned long group_irq_en[MAX_MAIN_INTERRUPT];
259
260 /* For main interrupt bits in INTC */
261 uint8_t intc_inten_reg;
262
263 /* For group interrupt bits and address */
264 uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_MASK_REGS];
265
266 /* For gpio edge */
267 uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG];
268};
269
270/*
271 * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu.
272 * The board specific data is provided through this structure.
273 * @irq_base: Irq base number on which this device registers their interrupts.
274 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
275 */
276
277struct rc5t583_platform_data {
278 int irq_base;
279 bool enable_shutdown;
280};
281
282int rc5t583_write(struct device *dev, u8 reg, uint8_t val);
283int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val);
284int rc5t583_set_bits(struct device *dev, unsigned int reg,
285 unsigned int bit_mask);
286int rc5t583_clear_bits(struct device *dev, unsigned int reg,
287 unsigned int bit_mask);
288int rc5t583_update(struct device *dev, unsigned int reg,
289 unsigned int val, unsigned int mask);
290int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id,
291 int ext_pwr_req, int deepsleep_slot_nr);
292int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);
293int rc5t583_irq_exit(struct rc5t583 *rc5t583);
294
295#endif
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 8c54de674b4b..8516fd1eaabc 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -28,6 +28,7 @@ enum stmpe_partnum {
28 STMPE1601, 28 STMPE1601,
29 STMPE2401, 29 STMPE2401,
30 STMPE2403, 30 STMPE2403,
31 STMPE_NBR_PARTS
31}; 32};
32 33
33/* 34/*
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 0dc98044d8b7..f5171dbf8850 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -1,8 +1,10 @@
1#ifndef MFD_TMIO_H 1#ifndef MFD_TMIO_H
2#define MFD_TMIO_H 2#define MFD_TMIO_H
3 3
4#include <linux/device.h>
4#include <linux/fb.h> 5#include <linux/fb.h>
5#include <linux/io.h> 6#include <linux/io.h>
7#include <linux/jiffies.h>
6#include <linux/platform_device.h> 8#include <linux/platform_device.h>
7#include <linux/pm_runtime.h> 9#include <linux/pm_runtime.h>
8 10
@@ -64,8 +66,8 @@
64#define TMIO_MMC_SDIO_IRQ (1 << 2) 66#define TMIO_MMC_SDIO_IRQ (1 << 2)
65/* 67/*
66 * Some platforms can detect card insertion events with controller powered 68 * Some platforms can detect card insertion events with controller powered
67 * down, in which case they have to call tmio_mmc_cd_wakeup() to power up the 69 * down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio,
68 * controller and report the event to the driver. 70 * and cd_flags fields of struct tmio_mmc_data.
69 */ 71 */
70#define TMIO_MMC_HAS_COLD_CD (1 << 3) 72#define TMIO_MMC_HAS_COLD_CD (1 << 3)
71/* 73/*
@@ -73,6 +75,12 @@
73 * idle before writing to some registers. 75 * idle before writing to some registers.
74 */ 76 */
75#define TMIO_MMC_HAS_IDLE_WAIT (1 << 4) 77#define TMIO_MMC_HAS_IDLE_WAIT (1 << 4)
78/*
79 * A GPIO is used for card hotplug detection. We need an extra flag for this,
80 * because 0 is a valid GPIO number too, and requiring users to specify
81 * cd_gpio < 0 to disable GPIO hotplug would break backwards compatibility.
82 */
83#define TMIO_MMC_USE_GPIO_CD (1 << 5)
76 84
77int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 85int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
78int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 86int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
@@ -97,19 +105,23 @@ struct tmio_mmc_data {
97 u32 ocr_mask; /* available voltages */ 105 u32 ocr_mask; /* available voltages */
98 struct tmio_mmc_dma *dma; 106 struct tmio_mmc_dma *dma;
99 struct device *dev; 107 struct device *dev;
100 bool power; 108 unsigned int cd_gpio;
101 void (*set_pwr)(struct platform_device *host, int state); 109 void (*set_pwr)(struct platform_device *host, int state);
102 void (*set_clk_div)(struct platform_device *host, int state); 110 void (*set_clk_div)(struct platform_device *host, int state);
103 int (*get_cd)(struct platform_device *host); 111 int (*get_cd)(struct platform_device *host);
104 int (*write16_hook)(struct tmio_mmc_host *host, int addr); 112 int (*write16_hook)(struct tmio_mmc_host *host, int addr);
105}; 113};
106 114
115/*
116 * This function is deprecated and will be removed soon. Please, convert your
117 * platform to use drivers/mmc/core/cd-gpio.c
118 */
119#include <linux/mmc/host.h>
107static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) 120static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
108{ 121{
109 if (pdata && !pdata->power) { 122 if (pdata)
110 pdata->power = true; 123 mmc_detect_change(dev_get_drvdata(pdata->dev),
111 pm_runtime_get(pdata->dev); 124 msecs_to_jiffies(100));
112 }
113} 125}
114 126
115/* 127/*
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
new file mode 100644
index 000000000000..38e31c55adbb
--- /dev/null
+++ b/include/linux/mfd/tps65090.h
@@ -0,0 +1,46 @@
1/*
2 * Core driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (C) 2012 NVIDIA Corporation
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, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 */
21
22#ifndef __LINUX_MFD_TPS65090_H
23#define __LINUX_MFD_TPS65090_H
24
25struct tps65090_subdev_info {
26 int id;
27 const char *name;
28 void *platform_data;
29};
30
31struct tps65090_platform_data {
32 int irq_base;
33 int num_subdevs;
34 struct tps65090_subdev_info *subdevs;
35};
36
37/*
38 * NOTE: the functions below are not intended for use outside
39 * of the TPS65090 sub-device drivers
40 */
41extern int tps65090_write(struct device *dev, int reg, uint8_t val);
42extern int tps65090_read(struct device *dev, int reg, uint8_t *val);
43extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num);
44extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num);
45
46#endif /*__LINUX_MFD_TPS65090_H */
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
new file mode 100644
index 000000000000..e030ef9a64ee
--- /dev/null
+++ b/include/linux/mfd/tps65217.h
@@ -0,0 +1,283 @@
1/*
2 * linux/mfd/tps65217.h
3 *
4 * Functions to access TPS65217 power management chip.
5 *
6 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_MFD_TPS65217_H
19#define __LINUX_MFD_TPS65217_H
20
21#include <linux/i2c.h>
22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h>
24
25/* I2C ID for TPS65217 part */
26#define TPS65217_I2C_ID 0x24
27
28/* All register addresses */
29#define TPS65217_REG_CHIPID 0X00
30#define TPS65217_REG_PPATH 0X01
31#define TPS65217_REG_INT 0X02
32#define TPS65217_REG_CHGCONFIG0 0X03
33#define TPS65217_REG_CHGCONFIG1 0X04
34#define TPS65217_REG_CHGCONFIG2 0X05
35#define TPS65217_REG_CHGCONFIG3 0X06
36#define TPS65217_REG_WLEDCTRL1 0X07
37#define TPS65217_REG_WLEDCTRL2 0X08
38#define TPS65217_REG_MUXCTRL 0X09
39#define TPS65217_REG_STATUS 0X0A
40#define TPS65217_REG_PASSWORD 0X0B
41#define TPS65217_REG_PGOOD 0X0C
42#define TPS65217_REG_DEFPG 0X0D
43#define TPS65217_REG_DEFDCDC1 0X0E
44#define TPS65217_REG_DEFDCDC2 0X0F
45#define TPS65217_REG_DEFDCDC3 0X10
46#define TPS65217_REG_DEFSLEW 0X11
47#define TPS65217_REG_DEFLDO1 0X12
48#define TPS65217_REG_DEFLDO2 0X13
49#define TPS65217_REG_DEFLS1 0X14
50#define TPS65217_REG_DEFLS2 0X15
51#define TPS65217_REG_ENABLE 0X16
52#define TPS65217_REG_DEFUVLO 0X18
53#define TPS65217_REG_SEQ1 0X19
54#define TPS65217_REG_SEQ2 0X1A
55#define TPS65217_REG_SEQ3 0X1B
56#define TPS65217_REG_SEQ4 0X1C
57#define TPS65217_REG_SEQ5 0X1D
58#define TPS65217_REG_SEQ6 0X1E
59
60/* Register field definitions */
61#define TPS65217_CHIPID_CHIP_MASK 0xF0
62#define TPS65217_CHIPID_REV_MASK 0x0F
63
64#define TPS65217_PPATH_ACSINK_ENABLE BIT(7)
65#define TPS65217_PPATH_USBSINK_ENABLE BIT(6)
66#define TPS65217_PPATH_AC_PW_ENABLE BIT(5)
67#define TPS65217_PPATH_USB_PW_ENABLE BIT(4)
68#define TPS65217_PPATH_AC_CURRENT_MASK 0x0C
69#define TPS65217_PPATH_USB_CURRENT_MASK 0x03
70
71#define TPS65217_INT_PBM BIT(6)
72#define TPS65217_INT_ACM BIT(5)
73#define TPS65217_INT_USBM BIT(4)
74#define TPS65217_INT_PBI BIT(2)
75#define TPS65217_INT_ACI BIT(1)
76#define TPS65217_INT_USBI BIT(0)
77
78#define TPS65217_CHGCONFIG0_TREG BIT(7)
79#define TPS65217_CHGCONFIG0_DPPM BIT(6)
80#define TPS65217_CHGCONFIG0_TSUSP BIT(5)
81#define TPS65217_CHGCONFIG0_TERMI BIT(4)
82#define TPS65217_CHGCONFIG0_ACTIVE BIT(3)
83#define TPS65217_CHGCONFIG0_CHGTOUT BIT(2)
84#define TPS65217_CHGCONFIG0_PCHGTOUT BIT(1)
85#define TPS65217_CHGCONFIG0_BATTEMP BIT(0)
86
87#define TPS65217_CHGCONFIG1_TMR_MASK 0xC0
88#define TPS65217_CHGCONFIG1_TMR_ENABLE BIT(5)
89#define TPS65217_CHGCONFIG1_NTC_TYPE BIT(4)
90#define TPS65217_CHGCONFIG1_RESET BIT(3)
91#define TPS65217_CHGCONFIG1_TERM BIT(2)
92#define TPS65217_CHGCONFIG1_SUSP BIT(1)
93#define TPS65217_CHGCONFIG1_CHG_EN BIT(0)
94
95#define TPS65217_CHGCONFIG2_DYNTMR BIT(7)
96#define TPS65217_CHGCONFIG2_VPREGHG BIT(6)
97#define TPS65217_CHGCONFIG2_VOREG_MASK 0x30
98
99#define TPS65217_CHGCONFIG3_ICHRG_MASK 0xC0
100#define TPS65217_CHGCONFIG3_DPPMTH_MASK 0x30
101#define TPS65217_CHGCONFIG2_PCHRGT BIT(3)
102#define TPS65217_CHGCONFIG2_TERMIF 0x06
103#define TPS65217_CHGCONFIG2_TRANGE BIT(0)
104
105#define TPS65217_WLEDCTRL1_ISINK_ENABLE BIT(3)
106#define TPS65217_WLEDCTRL1_ISEL BIT(2)
107#define TPS65217_WLEDCTRL1_FDIM_MASK 0x03
108
109#define TPS65217_WLEDCTRL2_DUTY_MASK 0x7F
110
111#define TPS65217_MUXCTRL_MUX_MASK 0x07
112
113#define TPS65217_STATUS_OFF BIT(7)
114#define TPS65217_STATUS_ACPWR BIT(3)
115#define TPS65217_STATUS_USBPWR BIT(2)
116#define TPS65217_STATUS_PB BIT(0)
117
118#define TPS65217_PASSWORD_REGS_UNLOCK 0x7D
119
120#define TPS65217_PGOOD_LDO3_PG BIT(6)
121#define TPS65217_PGOOD_LDO4_PG BIT(5)
122#define TPS65217_PGOOD_DC1_PG BIT(4)
123#define TPS65217_PGOOD_DC2_PG BIT(3)
124#define TPS65217_PGOOD_DC3_PG BIT(2)
125#define TPS65217_PGOOD_LDO1_PG BIT(1)
126#define TPS65217_PGOOD_LDO2_PG BIT(0)
127
128#define TPS65217_DEFPG_LDO1PGM BIT(3)
129#define TPS65217_DEFPG_LDO2PGM BIT(2)
130#define TPS65217_DEFPG_PGDLY_MASK 0x03
131
132#define TPS65217_DEFDCDCX_XADJX BIT(7)
133#define TPS65217_DEFDCDCX_DCDC_MASK 0x3F
134
135#define TPS65217_DEFSLEW_GO BIT(7)
136#define TPS65217_DEFSLEW_GODSBL BIT(6)
137#define TPS65217_DEFSLEW_PFM_EN1 BIT(5)
138#define TPS65217_DEFSLEW_PFM_EN2 BIT(4)
139#define TPS65217_DEFSLEW_PFM_EN3 BIT(3)
140#define TPS65217_DEFSLEW_SLEW_MASK 0x07
141
142#define TPS65217_DEFLDO1_LDO1_MASK 0x0F
143
144#define TPS65217_DEFLDO2_TRACK BIT(6)
145#define TPS65217_DEFLDO2_LDO2_MASK 0x3F
146
147#define TPS65217_DEFLDO3_LDO3_EN BIT(5)
148#define TPS65217_DEFLDO3_LDO3_MASK 0x1F
149
150#define TPS65217_DEFLDO4_LDO4_EN BIT(5)
151#define TPS65217_DEFLDO4_LDO4_MASK 0x1F
152
153#define TPS65217_ENABLE_LS1_EN BIT(6)
154#define TPS65217_ENABLE_LS2_EN BIT(5)
155#define TPS65217_ENABLE_DC1_EN BIT(4)
156#define TPS65217_ENABLE_DC2_EN BIT(3)
157#define TPS65217_ENABLE_DC3_EN BIT(2)
158#define TPS65217_ENABLE_LDO1_EN BIT(1)
159#define TPS65217_ENABLE_LDO2_EN BIT(0)
160
161#define TPS65217_DEFUVLO_UVLOHYS BIT(2)
162#define TPS65217_DEFUVLO_UVLO_MASK 0x03
163
164#define TPS65217_SEQ1_DC1_SEQ_MASK 0xF0
165#define TPS65217_SEQ1_DC2_SEQ_MASK 0x0F
166
167#define TPS65217_SEQ2_DC3_SEQ_MASK 0xF0
168#define TPS65217_SEQ2_LDO1_SEQ_MASK 0x0F
169
170#define TPS65217_SEQ3_LDO2_SEQ_MASK 0xF0
171#define TPS65217_SEQ3_LDO3_SEQ_MASK 0x0F
172
173#define TPS65217_SEQ4_LDO4_SEQ_MASK 0xF0
174
175#define TPS65217_SEQ5_DLY1_MASK 0xC0
176#define TPS65217_SEQ5_DLY2_MASK 0x30
177#define TPS65217_SEQ5_DLY3_MASK 0x0C
178#define TPS65217_SEQ5_DLY4_MASK 0x03
179
180#define TPS65217_SEQ6_DLY5_MASK 0xC0
181#define TPS65217_SEQ6_DLY6_MASK 0x30
182#define TPS65217_SEQ6_SEQUP BIT(2)
183#define TPS65217_SEQ6_SEQDWN BIT(1)
184#define TPS65217_SEQ6_INSTDWN BIT(0)
185
186#define TPS65217_MAX_REGISTER 0x1E
187#define TPS65217_PROTECT_NONE 0
188#define TPS65217_PROTECT_L1 1
189#define TPS65217_PROTECT_L2 2
190
191
192enum tps65217_regulator_id {
193 /* DCDC's */
194 TPS65217_DCDC_1,
195 TPS65217_DCDC_2,
196 TPS65217_DCDC_3,
197 /* LDOs */
198 TPS65217_LDO_1,
199 TPS65217_LDO_2,
200 TPS65217_LDO_3,
201 TPS65217_LDO_4,
202};
203
204#define TPS65217_MAX_REG_ID TPS65217_LDO_4
205
206/* Number of step-down converters available */
207#define TPS65217_NUM_DCDC 3
208/* Number of LDO voltage regulators available */
209#define TPS65217_NUM_LDO 4
210/* Number of total regulators available */
211#define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO)
212
213/**
214 * struct tps65217_board - packages regulator init data
215 * @tps65217_regulator_data: regulator initialization values
216 *
217 * Board data may be used to initialize regulator.
218 */
219struct tps65217_board {
220 struct regulator_init_data *tps65217_init_data;
221};
222
223/**
224 * struct tps_info - packages regulator constraints
225 * @name: Voltage regulator name
226 * @min_uV: minimum micro volts
227 * @max_uV: minimum micro volts
228 * @vsel_to_uv: Function pointer to get voltage from selector
229 * @uv_to_vsel: Function pointer to get selector from voltage
230 * @table: Table for non-uniform voltage step-size
231 * @table_len: Length of the voltage table
232 * @enable_mask: Regulator enable mask bits
233 * @set_vout_reg: Regulator output voltage set register
234 * @set_vout_mask: Regulator output voltage set mask
235 *
236 * This data is used to check the regualtor voltage limits while setting.
237 */
238struct tps_info {
239 const char *name;
240 int min_uV;
241 int max_uV;
242 int (*vsel_to_uv)(unsigned int vsel);
243 int (*uv_to_vsel)(int uV, unsigned int *vsel);
244 const int *table;
245 unsigned int table_len;
246 unsigned int enable_mask;
247 unsigned int set_vout_reg;
248 unsigned int set_vout_mask;
249};
250
251/**
252 * struct tps65217 - tps65217 sub-driver chip access routines
253 *
254 * Device data may be used to access the TPS65217 chip
255 */
256
257struct tps65217 {
258 struct device *dev;
259 struct tps65217_board *pdata;
260 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
261 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
262 struct tps_info *info[TPS65217_NUM_REGULATOR];
263 struct regmap *regmap;
264
265 /* Client devices */
266 struct platform_device *regulator_pdev[TPS65217_NUM_REGULATOR];
267};
268
269static inline struct tps65217 *dev_to_tps65217(struct device *dev)
270{
271 return dev_get_drvdata(dev);
272}
273
274int tps65217_reg_read(struct tps65217 *tps, unsigned int reg,
275 unsigned int *val);
276int tps65217_reg_write(struct tps65217 *tps, unsigned int reg,
277 unsigned int val, unsigned int level);
278int tps65217_set_bits(struct tps65217 *tps, unsigned int reg,
279 unsigned int mask, unsigned int val, unsigned int level);
280int tps65217_clear_bits(struct tps65217 *tps, unsigned int reg,
281 unsigned int mask, unsigned int level);
282
283#endif /* __LINUX_MFD_TPS65217_H */
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 76700b5eee92..1c6c2860d1a6 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -17,6 +17,8 @@
17#ifndef __LINUX_MFD_TPS65910_H 17#ifndef __LINUX_MFD_TPS65910_H
18#define __LINUX_MFD_TPS65910_H 18#define __LINUX_MFD_TPS65910_H
19 19
20#include <linux/gpio.h>
21
20/* TPS chip id list */ 22/* TPS chip id list */
21#define TPS65910 0 23#define TPS65910 0
22#define TPS65911 1 24#define TPS65911 1
@@ -657,6 +659,8 @@
657 659
658 660
659/*Register GPIO (0x80) register.RegisterDescription */ 661/*Register GPIO (0x80) register.RegisterDescription */
662#define GPIO_SLEEP_MASK 0x80
663#define GPIO_SLEEP_SHIFT 7
660#define GPIO_DEB_MASK 0x10 664#define GPIO_DEB_MASK 0x10
661#define GPIO_DEB_SHIFT 4 665#define GPIO_DEB_SHIFT 4
662#define GPIO_PUEN_MASK 0x08 666#define GPIO_PUEN_MASK 0x08
@@ -740,6 +744,11 @@
740#define TPS65910_GPIO_STS BIT(1) 744#define TPS65910_GPIO_STS BIT(1)
741#define TPS65910_GPIO_SET BIT(0) 745#define TPS65910_GPIO_SET BIT(0)
742 746
747/* Max number of TPS65910/11 GPIOs */
748#define TPS65910_NUM_GPIO 6
749#define TPS65911_NUM_GPIO 9
750#define TPS6591X_MAX_NUM_GPIO 9
751
743/* Regulator Index Definitions */ 752/* Regulator Index Definitions */
744#define TPS65910_REG_VRTC 0 753#define TPS65910_REG_VRTC 0
745#define TPS65910_REG_VIO 1 754#define TPS65910_REG_VIO 1
@@ -785,6 +794,7 @@ struct tps65910_board {
785 int irq_base; 794 int irq_base;
786 int vmbch_threshold; 795 int vmbch_threshold;
787 int vmbch2_threshold; 796 int vmbch2_threshold;
797 bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
788 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; 798 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
789 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; 799 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
790}; 800};
@@ -796,6 +806,7 @@ struct tps65910_board {
796struct tps65910 { 806struct tps65910 {
797 struct device *dev; 807 struct device *dev;
798 struct i2c_client *i2c_client; 808 struct i2c_client *i2c_client;
809 struct regmap *regmap;
799 struct mutex io_mutex; 810 struct mutex io_mutex;
800 unsigned int id; 811 unsigned int id;
801 int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest); 812 int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest);
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index 4321f044d1e4..28af41756360 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -12,7 +12,7 @@
12 12
13#include <linux/mfd/mcp.h> 13#include <linux/mfd/mcp.h>
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/semaphore.h> 15#include <linux/mutex.h>
16 16
17#define UCB_IO_DATA 0x00 17#define UCB_IO_DATA 0x00
18#define UCB_IO_DIR 0x01 18#define UCB_IO_DIR 0x01
@@ -104,17 +104,27 @@
104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12) 104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12)
105#define UCB_MODE_AUD_OFF_CAN (1 << 13) 105#define UCB_MODE_AUD_OFF_CAN (1 << 13)
106 106
107enum ucb1x00_reset {
108 UCB_RST_PROBE,
109 UCB_RST_RESUME,
110 UCB_RST_SUSPEND,
111 UCB_RST_REMOVE,
112 UCB_RST_PROBE_FAIL,
113};
107 114
108struct ucb1x00_irq { 115struct ucb1x00_plat_data {
109 void *devid; 116 void (*reset)(enum ucb1x00_reset);
110 void (*fn)(int, void *); 117 unsigned irq_base;
118 int gpio_base;
119 unsigned can_wakeup;
111}; 120};
112 121
113struct ucb1x00 { 122struct ucb1x00 {
114 spinlock_t lock; 123 raw_spinlock_t irq_lock;
115 struct mcp *mcp; 124 struct mcp *mcp;
116 unsigned int irq; 125 unsigned int irq;
117 struct semaphore adc_sem; 126 int irq_base;
127 struct mutex adc_mutex;
118 spinlock_t io_lock; 128 spinlock_t io_lock;
119 u16 id; 129 u16 id;
120 u16 io_dir; 130 u16 io_dir;
@@ -122,7 +132,8 @@ struct ucb1x00 {
122 u16 adc_cr; 132 u16 adc_cr;
123 u16 irq_fal_enbl; 133 u16 irq_fal_enbl;
124 u16 irq_ris_enbl; 134 u16 irq_ris_enbl;
125 struct ucb1x00_irq irq_handler[16]; 135 u16 irq_mask;
136 u16 irq_wake;
126 struct device dev; 137 struct device dev;
127 struct list_head node; 138 struct list_head node;
128 struct list_head devs; 139 struct list_head devs;
@@ -144,7 +155,7 @@ struct ucb1x00_driver {
144 struct list_head devs; 155 struct list_head devs;
145 int (*add)(struct ucb1x00_dev *dev); 156 int (*add)(struct ucb1x00_dev *dev);
146 void (*remove)(struct ucb1x00_dev *dev); 157 void (*remove)(struct ucb1x00_dev *dev);
147 int (*suspend)(struct ucb1x00_dev *dev, pm_message_t state); 158 int (*suspend)(struct ucb1x00_dev *dev);
148 int (*resume)(struct ucb1x00_dev *dev); 159 int (*resume)(struct ucb1x00_dev *dev);
149}; 160};
150 161
@@ -245,15 +256,4 @@ unsigned int ucb1x00_adc_read(struct ucb1x00 *ucb, int adc_channel, int sync);
245void ucb1x00_adc_enable(struct ucb1x00 *ucb); 256void ucb1x00_adc_enable(struct ucb1x00 *ucb);
246void ucb1x00_adc_disable(struct ucb1x00 *ucb); 257void ucb1x00_adc_disable(struct ucb1x00 *ucb);
247 258
248/*
249 * Which edges of the IRQ do you want to control today?
250 */
251#define UCB_RISING (1 << 0)
252#define UCB_FALLING (1 << 1)
253
254int ucb1x00_hook_irq(struct ucb1x00 *ucb, unsigned int idx, void (*fn)(int, void *), void *devid);
255void ucb1x00_enable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges);
256void ucb1x00_disable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges);
257int ucb1x00_free_irq(struct ucb1x00 *ucb, unsigned int idx, void *devid);
258
259#endif 259#endif
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index dc3e05011689..893267bb6229 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -22,7 +22,6 @@ struct wm8994_ldo_pdata {
22 /** GPIOs to enable regulator, 0 or less if not available */ 22 /** GPIOs to enable regulator, 0 or less if not available */
23 int enable; 23 int enable;
24 24
25 const char *supply;
26 const struct regulator_init_data *init_data; 25 const struct regulator_init_data *init_data;
27}; 26};
28 27
diff --git a/include/linux/mm.h b/include/linux/mm.h
index cf7982336103..d8738a464b94 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -954,7 +954,7 @@ extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
954extern void truncate_setsize(struct inode *inode, loff_t newsize); 954extern void truncate_setsize(struct inode *inode, loff_t newsize);
955extern int vmtruncate(struct inode *inode, loff_t offset); 955extern int vmtruncate(struct inode *inode, loff_t offset);
956extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); 956extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
957 957void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
958int truncate_inode_page(struct address_space *mapping, struct page *page); 958int truncate_inode_page(struct address_space *mapping, struct page *page);
959int generic_error_remove_page(struct address_space *mapping, struct page *page); 959int generic_error_remove_page(struct address_space *mapping, struct page *page);
960 960
@@ -1258,6 +1258,8 @@ static inline void pgtable_page_dtor(struct page *page)
1258extern void free_area_init(unsigned long * zones_size); 1258extern void free_area_init(unsigned long * zones_size);
1259extern void free_area_init_node(int nid, unsigned long * zones_size, 1259extern void free_area_init_node(int nid, unsigned long * zones_size,
1260 unsigned long zone_start_pfn, unsigned long *zholes_size); 1260 unsigned long zone_start_pfn, unsigned long *zholes_size);
1261extern void free_initmem(void);
1262
1261#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 1263#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
1262/* 1264/*
1263 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its 1265 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 6faa145c81e3..01beae78f079 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -72,6 +72,8 @@ struct mmc_ext_csd {
72 bool hpi_en; /* HPI enablebit */ 72 bool hpi_en; /* HPI enablebit */
73 bool hpi; /* HPI support bit */ 73 bool hpi; /* HPI support bit */
74 unsigned int hpi_cmd; /* cmd used as HPI */ 74 unsigned int hpi_cmd; /* cmd used as HPI */
75 unsigned int data_sector_size; /* 512 bytes or 4KB */
76 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */
75 unsigned int boot_ro_lock; /* ro lock support */ 77 unsigned int boot_ro_lock; /* ro lock support */
76 bool boot_ro_lockable; 78 bool boot_ro_lockable;
77 u8 raw_partition_support; /* 160 */ 79 u8 raw_partition_support; /* 160 */
diff --git a/include/linux/mmc/cd-gpio.h b/include/linux/mmc/cd-gpio.h
index a8e469783318..cefaba038ccb 100644
--- a/include/linux/mmc/cd-gpio.h
+++ b/include/linux/mmc/cd-gpio.h
@@ -12,8 +12,7 @@
12#define MMC_CD_GPIO_H 12#define MMC_CD_GPIO_H
13 13
14struct mmc_host; 14struct mmc_host;
15int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio, 15int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio);
16 unsigned int irq, unsigned long flags);
17void mmc_cd_gpio_free(struct mmc_host *host); 16void mmc_cd_gpio_free(struct mmc_host *host);
18 17
19#endif 18#endif
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 2e6a681fceb2..1b431c728b9a 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -175,7 +175,6 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
175 175
176extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 176extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
177extern void mmc_release_host(struct mmc_host *host); 177extern void mmc_release_host(struct mmc_host *host);
178extern void mmc_do_release_host(struct mmc_host *host);
179extern int mmc_try_claim_host(struct mmc_host *host); 178extern int mmc_try_claim_host(struct mmc_host *host);
180 179
181extern int mmc_flush_cache(struct mmc_card *); 180extern int mmc_flush_cache(struct mmc_card *);
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index aae5d1f1bb39..8f66e28f5a0f 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -76,7 +76,7 @@ struct mmc_data;
76 * @num_slots: Number of slots available. 76 * @num_slots: Number of slots available.
77 * @verid: Denote Version ID. 77 * @verid: Denote Version ID.
78 * @data_offset: Set the offset of DATA register according to VERID. 78 * @data_offset: Set the offset of DATA register according to VERID.
79 * @pdev: Platform device associated with the MMC controller. 79 * @dev: Device associated with the MMC controller.
80 * @pdata: Platform data associated with the MMC controller. 80 * @pdata: Platform data associated with the MMC controller.
81 * @slot: Slots sharing this MMC controller. 81 * @slot: Slots sharing this MMC controller.
82 * @fifo_depth: depth of FIFO. 82 * @fifo_depth: depth of FIFO.
@@ -87,6 +87,8 @@ struct mmc_data;
87 * @push_data: Pointer to FIFO push function. 87 * @push_data: Pointer to FIFO push function.
88 * @pull_data: Pointer to FIFO pull function. 88 * @pull_data: Pointer to FIFO pull function.
89 * @quirks: Set of quirks that apply to specific versions of the IP. 89 * @quirks: Set of quirks that apply to specific versions of the IP.
90 * @irq_flags: The flags to be passed to request_irq.
91 * @irq: The irq value to be passed to request_irq.
90 * 92 *
91 * Locking 93 * Locking
92 * ======= 94 * =======
@@ -153,7 +155,7 @@ struct dw_mci {
153 u32 fifoth_val; 155 u32 fifoth_val;
154 u16 verid; 156 u16 verid;
155 u16 data_offset; 157 u16 data_offset;
156 struct platform_device *pdev; 158 struct device dev;
157 struct dw_mci_board *pdata; 159 struct dw_mci_board *pdata;
158 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 160 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
159 161
@@ -174,6 +176,8 @@ struct dw_mci {
174 u32 quirks; 176 u32 quirks;
175 177
176 struct regulator *vmmc; /* Power regulator */ 178 struct regulator *vmmc; /* Power regulator */
179 unsigned long irq_flags; /* IRQ flags */
180 unsigned int irq;
177}; 181};
178 182
179/* DMA ops for Internal/External DMAC interface */ 183/* DMA ops for Internal/External DMAC interface */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 91924e8c642b..cbde4b7e675e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -81,34 +81,11 @@ struct mmc_ios {
81 81
82struct mmc_host_ops { 82struct mmc_host_ops {
83 /* 83 /*
84 * Hosts that support power saving can use the 'enable' and 'disable' 84 * 'enable' is called when the host is claimed and 'disable' is called
85 * methods to exit and enter power saving states. 'enable' is called 85 * when the host is released. 'enable' and 'disable' are deprecated.
86 * when the host is claimed and 'disable' is called (or scheduled with
87 * a delay) when the host is released. The 'disable' is scheduled if
88 * the disable delay set by 'mmc_set_disable_delay()' is non-zero,
89 * otherwise 'disable' is called immediately. 'disable' may be
90 * scheduled repeatedly, to permit ever greater power saving at the
91 * expense of ever greater latency to re-enable. Rescheduling is
92 * determined by the return value of the 'disable' method. A positive
93 * value gives the delay in milliseconds.
94 *
95 * In the case where a host function (like set_ios) may be called
96 * with or without the host claimed, enabling and disabling can be
97 * done directly and will nest correctly. Call 'mmc_host_enable()' and
98 * 'mmc_host_lazy_disable()' for this purpose, but note that these
99 * functions must be paired.
100 *
101 * Alternatively, 'mmc_host_enable()' may be paired with
102 * 'mmc_host_disable()' which calls 'disable' immediately. In this
103 * case the 'disable' method will be called with 'lazy' set to 0.
104 * This is mainly useful for error paths.
105 *
106 * Because lazy disable may be called from a work queue, the 'disable'
107 * method must claim the host when 'lazy' != 0, which will work
108 * correctly because recursion is detected and handled.
109 */ 86 */
110 int (*enable)(struct mmc_host *host); 87 int (*enable)(struct mmc_host *host);
111 int (*disable)(struct mmc_host *host, int lazy); 88 int (*disable)(struct mmc_host *host);
112 /* 89 /*
113 * It is optional for the host to implement pre_req and post_req in 90 * It is optional for the host to implement pre_req and post_req in
114 * order to support double buffering of requests (prepare one 91 * order to support double buffering of requests (prepare one
@@ -219,7 +196,7 @@ struct mmc_host {
219#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 196#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
220#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 197#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
221#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 198#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
222#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ 199
223#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 200#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
224#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 201#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
225#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 202#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
@@ -259,6 +236,8 @@ struct mmc_host {
259#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 236#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
260 MMC_CAP2_HS200_1_2V_SDR) 237 MMC_CAP2_HS200_1_2V_SDR)
261#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ 238#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
239#define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */
240#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
262 241
263 mmc_pm_flag_t pm_caps; /* supported pm features */ 242 mmc_pm_flag_t pm_caps; /* supported pm features */
264 unsigned int power_notify_type; 243 unsigned int power_notify_type;
@@ -301,13 +280,7 @@ struct mmc_host {
301 unsigned int removed:1; /* host is being removed */ 280 unsigned int removed:1; /* host is being removed */
302#endif 281#endif
303 282
304 /* Only used with MMC_CAP_DISABLE */
305 int enabled; /* host is enabled */
306 int rescan_disable; /* disable card detection */ 283 int rescan_disable; /* disable card detection */
307 int nesting_cnt; /* "enable" nesting count */
308 int en_dis_recurs; /* detect recursion */
309 unsigned int disable_delay; /* disable delay in msecs */
310 struct delayed_work disable; /* disabling work */
311 284
312 struct mmc_card *card; /* device attached to this host */ 285 struct mmc_card *card; /* device attached to this host */
313 286
@@ -407,17 +380,8 @@ int mmc_card_awake(struct mmc_host *host);
407int mmc_card_sleep(struct mmc_host *host); 380int mmc_card_sleep(struct mmc_host *host);
408int mmc_card_can_sleep(struct mmc_host *host); 381int mmc_card_can_sleep(struct mmc_host *host);
409 382
410int mmc_host_enable(struct mmc_host *host);
411int mmc_host_disable(struct mmc_host *host);
412int mmc_host_lazy_disable(struct mmc_host *host);
413int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 383int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
414 384
415static inline void mmc_set_disable_delay(struct mmc_host *host,
416 unsigned int disable_delay)
417{
418 host->disable_delay = disable_delay;
419}
420
421/* Module parameter */ 385/* Module parameter */
422extern bool mmc_assume_removable; 386extern bool mmc_assume_removable;
423 387
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index fb9f6e116e1c..b822a2cb6008 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -274,6 +274,7 @@ struct _mmc_csd {
274#define EXT_CSD_FLUSH_CACHE 32 /* W */ 274#define EXT_CSD_FLUSH_CACHE 32 /* W */
275#define EXT_CSD_CACHE_CTRL 33 /* R/W */ 275#define EXT_CSD_CACHE_CTRL 33 /* R/W */
276#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ 276#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
277#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
277#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ 278#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
278#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 279#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
279#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 280#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
@@ -315,6 +316,8 @@ struct _mmc_csd {
315#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ 316#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */
316#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ 317#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
317#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ 318#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
319#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
320#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
318#define EXT_CSD_HPI_FEATURES 503 /* RO */ 321#define EXT_CSD_HPI_FEATURES 503 /* RO */
319 322
320/* 323/*
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index c750f85177d9..e9051e1cb1ce 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -90,6 +90,8 @@ struct sdhci_host {
90 90
91 unsigned int quirks2; /* More deviations from spec. */ 91 unsigned int quirks2; /* More deviations from spec. */
92 92
93#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
94
93 int irq; /* Device IRQ */ 95 int irq; /* Device IRQ */
94 void __iomem *ioaddr; /* Mapped address */ 96 void __iomem *ioaddr; /* Mapped address */
95 97
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 04ff452bf5c3..05f0e3db1c12 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -77,18 +77,15 @@ struct sh_mmcif_plat_data {
77 77
78/* CE_CLK_CTRL */ 78/* CE_CLK_CTRL */
79#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */ 79#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */
80#define CLK_CLEAR ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) 80#define CLK_CLEAR (0xf << 16)
81#define CLK_SUP_PCLK ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) 81#define CLK_SUP_PCLK (0xf << 16)
82#define CLKDIV_4 (1<<16) /* mmc clock frequency. 82#define CLKDIV_4 (1 << 16) /* mmc clock frequency.
83 * n: bus clock/(2^(n+1)) */ 83 * n: bus clock/(2^(n+1)) */
84#define CLKDIV_256 (7<<16) /* mmc clock frequency. (see above) */ 84#define CLKDIV_256 (7 << 16) /* mmc clock frequency. (see above) */
85#define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */ 85#define SRSPTO_256 (2 << 12) /* resp timeout */
86#define SRBSYTO_29 ((1 << 11) | (1 << 10) | \ 86#define SRBSYTO_29 (0xf << 8) /* resp busy timeout */
87 (1 << 9) | (1 << 8)) /* resp busy timeout */ 87#define SRWDTO_29 (0xf << 4) /* read/write timeout */
88#define SRWDTO_29 ((1 << 7) | (1 << 6) | \ 88#define SCCSTO_29 (0xf << 0) /* ccs timeout */
89 (1 << 5) | (1 << 4)) /* read/write timeout */
90#define SCCSTO_29 ((1 << 3) | (1 << 2) | \
91 (1 << 1) | (1 << 0)) /* ccs timeout */
92 89
93/* CE_VERSION */ 90/* CE_VERSION */
94#define SOFT_RST_ON (1 << 31) 91#define SOFT_RST_ON (1 << 31)
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index 71b805451bd8..e94e620aeddc 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -10,15 +10,29 @@ struct tmio_mmc_data;
10#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard" 10#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard"
11#define SH_MOBILE_SDHI_IRQ_SDIO "sdio" 11#define SH_MOBILE_SDHI_IRQ_SDIO "sdio"
12 12
13/**
14 * struct sh_mobile_sdhi_ops - SDHI driver callbacks
15 * @cd_wakeup: trigger a card-detection run
16 */
17struct sh_mobile_sdhi_ops {
18 void (*cd_wakeup)(const struct platform_device *pdev);
19};
20
13struct sh_mobile_sdhi_info { 21struct sh_mobile_sdhi_info {
14 int dma_slave_tx; 22 int dma_slave_tx;
15 int dma_slave_rx; 23 int dma_slave_rx;
16 unsigned long tmio_flags; 24 unsigned long tmio_flags;
17 unsigned long tmio_caps; 25 unsigned long tmio_caps;
18 u32 tmio_ocr_mask; /* available MMC voltages */ 26 u32 tmio_ocr_mask; /* available MMC voltages */
27 unsigned int cd_gpio;
19 struct tmio_mmc_data *pdata; 28 struct tmio_mmc_data *pdata;
20 void (*set_pwr)(struct platform_device *pdev, int state); 29 void (*set_pwr)(struct platform_device *pdev, int state);
21 int (*get_cd)(struct platform_device *pdev); 30 int (*get_cd)(struct platform_device *pdev);
31
32 /* callbacks for board specific setup code */
33 int (*init)(struct platform_device *pdev,
34 const struct sh_mobile_sdhi_ops *ops);
35 void (*cleanup)(struct platform_device *pdev);
22}; 36};
23 37
24#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */ 38#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 4598bf03e98b..fbcafe2ee13e 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -21,8 +21,6 @@
21#include <linux/percpu.h> 21#include <linux/percpu.h>
22#include <asm/module.h> 22#include <asm/module.h>
23 23
24#include <trace/events/module.h>
25
26/* Not Yet Implemented */ 24/* Not Yet Implemented */
27#define MODULE_SUPPORTED_DEVICE(name) 25#define MODULE_SUPPORTED_DEVICE(name)
28 26
@@ -452,33 +450,11 @@ void symbol_put_addr(void *addr);
452 450
453/* Sometimes we know we already have a refcount, and it's easier not 451/* Sometimes we know we already have a refcount, and it's easier not
454 to handle the error case (which only happens with rmmod --wait). */ 452 to handle the error case (which only happens with rmmod --wait). */
455static inline void __module_get(struct module *module) 453extern void __module_get(struct module *module);
456{
457 if (module) {
458 preempt_disable();
459 __this_cpu_inc(module->refptr->incs);
460 trace_module_get(module, _THIS_IP_);
461 preempt_enable();
462 }
463}
464
465static inline int try_module_get(struct module *module)
466{
467 int ret = 1;
468
469 if (module) {
470 preempt_disable();
471 454
472 if (likely(module_is_live(module))) { 455/* This is the Right Way to get a module: if it fails, it's being removed,
473 __this_cpu_inc(module->refptr->incs); 456 * so pretend it's not there. */
474 trace_module_get(module, _THIS_IP_); 457extern bool try_module_get(struct module *module);
475 } else
476 ret = 0;
477
478 preempt_enable();
479 }
480 return ret;
481}
482 458
483extern void module_put(struct module *module); 459extern void module_put(struct module *module);
484 460
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index c47f4d60db0b..ea36486378d8 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -47,14 +47,11 @@ struct kernel_param_ops {
47 void (*free)(void *arg); 47 void (*free)(void *arg);
48}; 48};
49 49
50/* Flag bits for kernel_param.flags */
51#define KPARAM_ISBOOL 2
52
53struct kernel_param { 50struct kernel_param {
54 const char *name; 51 const char *name;
55 const struct kernel_param_ops *ops; 52 const struct kernel_param_ops *ops;
56 u16 perm; 53 u16 perm;
57 u16 flags; 54 s16 level;
58 union { 55 union {
59 void *arg; 56 void *arg;
60 const struct kparam_string *str; 57 const struct kparam_string *str;
@@ -131,8 +128,40 @@ struct kparam_array
131 * The ops can have NULL set or get functions. 128 * The ops can have NULL set or get functions.
132 */ 129 */
133#define module_param_cb(name, ops, arg, perm) \ 130#define module_param_cb(name, ops, arg, perm) \
134 __module_param_call(MODULE_PARAM_PREFIX, \ 131 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0)
135 name, ops, arg, __same_type((arg), bool *), perm) 132
133/**
134 * <level>_param_cb - general callback for a module/cmdline parameter
135 * to be evaluated before certain initcall level
136 * @name: a valid C identifier which is the parameter name.
137 * @ops: the set & get operations for this parameter.
138 * @perm: visibility in sysfs.
139 *
140 * The ops can have NULL set or get functions.
141 */
142#define __level_param_cb(name, ops, arg, perm, level) \
143 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level)
144
145#define core_param_cb(name, ops, arg, perm) \
146 __level_param_cb(name, ops, arg, perm, 1)
147
148#define postcore_param_cb(name, ops, arg, perm) \
149 __level_param_cb(name, ops, arg, perm, 2)
150
151#define arch_param_cb(name, ops, arg, perm) \
152 __level_param_cb(name, ops, arg, perm, 3)
153
154#define subsys_param_cb(name, ops, arg, perm) \
155 __level_param_cb(name, ops, arg, perm, 4)
156
157#define fs_param_cb(name, ops, arg, perm) \
158 __level_param_cb(name, ops, arg, perm, 5)
159
160#define device_param_cb(name, ops, arg, perm) \
161 __level_param_cb(name, ops, arg, perm, 6)
162
163#define late_param_cb(name, ops, arg, perm) \
164 __level_param_cb(name, ops, arg, perm, 7)
136 165
137/* On alpha, ia64 and ppc64 relocations to global data cannot go into 166/* On alpha, ia64 and ppc64 relocations to global data cannot go into
138 read-only sections (which is part of respective UNIX ABI on these 167 read-only sections (which is part of respective UNIX ABI on these
@@ -146,7 +175,7 @@ struct kparam_array
146 175
147/* This is the fundamental function for registering boot/module 176/* This is the fundamental function for registering boot/module
148 parameters. */ 177 parameters. */
149#define __module_param_call(prefix, name, ops, arg, isbool, perm) \ 178#define __module_param_call(prefix, name, ops, arg, perm, level) \
150 /* Default value instead of permissions? */ \ 179 /* Default value instead of permissions? */ \
151 static int __param_perm_check_##name __attribute__((unused)) = \ 180 static int __param_perm_check_##name __attribute__((unused)) = \
152 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ 181 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
@@ -155,8 +184,7 @@ struct kparam_array
155 static struct kernel_param __moduleparam_const __param_##name \ 184 static struct kernel_param __moduleparam_const __param_##name \
156 __used \ 185 __used \
157 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 186 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
158 = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \ 187 = { __param_str_##name, ops, perm, level, { arg } }
159 { arg } }
160 188
161/* Obsolete - use module_param_cb() */ 189/* Obsolete - use module_param_cb() */
162#define module_param_call(name, set, get, arg, perm) \ 190#define module_param_call(name, set, get, arg, perm) \
@@ -164,8 +192,7 @@ struct kparam_array
164 { (void *)set, (void *)get }; \ 192 { (void *)set, (void *)get }; \
165 __module_param_call(MODULE_PARAM_PREFIX, \ 193 __module_param_call(MODULE_PARAM_PREFIX, \
166 name, &__param_ops_##name, arg, \ 194 name, &__param_ops_##name, arg, \
167 __same_type(arg, bool *), \ 195 (perm) + sizeof(__check_old_set_param(set))*0, 0)
168 (perm) + sizeof(__check_old_set_param(set))*0)
169 196
170/* We don't get oldget: it's often a new-style param_get_uint, etc. */ 197/* We don't get oldget: it's often a new-style param_get_uint, etc. */
171static inline int 198static inline int
@@ -245,8 +272,7 @@ static inline void __kernel_param_unlock(void)
245 */ 272 */
246#define core_param(name, var, type, perm) \ 273#define core_param(name, var, type, perm) \
247 param_check_##type(name, &(var)); \ 274 param_check_##type(name, &(var)); \
248 __module_param_call("", name, &param_ops_##type, \ 275 __module_param_call("", name, &param_ops_##type, &var, perm, 0)
249 &var, __same_type(var, bool), perm)
250#endif /* !MODULE */ 276#endif /* !MODULE */
251 277
252/** 278/**
@@ -264,7 +290,7 @@ static inline void __kernel_param_unlock(void)
264 = { len, string }; \ 290 = { len, string }; \
265 __module_param_call(MODULE_PARAM_PREFIX, name, \ 291 __module_param_call(MODULE_PARAM_PREFIX, name, \
266 &param_ops_string, \ 292 &param_ops_string, \
267 .str = &__param_string_##name, 0, perm); \ 293 .str = &__param_string_##name, perm, 0); \
268 __MODULE_PARM_TYPE(name, "string") 294 __MODULE_PARM_TYPE(name, "string")
269 295
270/** 296/**
@@ -292,6 +318,8 @@ extern int parse_args(const char *name,
292 char *args, 318 char *args,
293 const struct kernel_param *params, 319 const struct kernel_param *params,
294 unsigned num, 320 unsigned num,
321 s16 level_min,
322 s16 level_max,
295 int (*unknown)(char *param, char *val)); 323 int (*unknown)(char *param, char *val));
296 324
297/* Called by module remove. */ 325/* Called by module remove. */
@@ -403,7 +431,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
403 __module_param_call(MODULE_PARAM_PREFIX, name, \ 431 __module_param_call(MODULE_PARAM_PREFIX, name, \
404 &param_array_ops, \ 432 &param_array_ops, \
405 .arr = &__param_arr_##name, \ 433 .arr = &__param_arr_##name, \
406 __same_type(array[0], bool), perm); \ 434 perm, 0); \
407 __MODULE_PARM_TYPE(name, "array of " #type) 435 __MODULE_PARM_TYPE(name, "array of " #type)
408 436
409extern struct kernel_param_ops param_array_ops; 437extern struct kernel_param_ops param_array_ops;
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index c4eec228eef9..650ef352f045 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -112,6 +112,11 @@ struct nand_bbt_descr {
112#define NAND_BBT_USE_FLASH 0x00020000 112#define NAND_BBT_USE_FLASH 0x00020000
113/* Do not store flash based bad block table in OOB area; store it in-band */ 113/* Do not store flash based bad block table in OOB area; store it in-band */
114#define NAND_BBT_NO_OOB 0x00040000 114#define NAND_BBT_NO_OOB 0x00040000
115/*
116 * Do not write new bad block markers to OOB; useful, e.g., when ECC covers
117 * entire spare area. Must be used with NAND_BBT_USE_FLASH.
118 */
119#define NAND_BBT_NO_OOB_BBM 0x00080000
115 120
116/* 121/*
117 * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr 122 * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 1bbd9f289245..ed270bd2e4df 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -47,6 +47,7 @@ struct mtd_blktrans_dev {
47 struct request_queue *rq; 47 struct request_queue *rq;
48 spinlock_t queue_lock; 48 spinlock_t queue_lock;
49 void *priv; 49 void *priv;
50 fmode_t file_mode;
50}; 51};
51 52
52struct mtd_blktrans_ops { 53struct mtd_blktrans_ops {
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index 6987995ad3cf..b20029221fb1 100644
--- a/include/linux/mtd/fsmc.h
+++ b/include/linux/mtd/fsmc.h
@@ -26,95 +26,83 @@
26#define FSMC_NAND_BW8 1 26#define FSMC_NAND_BW8 1
27#define FSMC_NAND_BW16 2 27#define FSMC_NAND_BW16 2
28 28
29/*
30 * The placement of the Command Latch Enable (CLE) and
31 * Address Latch Enable (ALE) is twisted around in the
32 * SPEAR310 implementation.
33 */
34#if defined(CONFIG_MACH_SPEAR310)
35#define PLAT_NAND_CLE (1 << 17)
36#define PLAT_NAND_ALE (1 << 16)
37#else
38#define PLAT_NAND_CLE (1 << 16)
39#define PLAT_NAND_ALE (1 << 17)
40#endif
41
42#define FSMC_MAX_NOR_BANKS 4 29#define FSMC_MAX_NOR_BANKS 4
43#define FSMC_MAX_NAND_BANKS 4 30#define FSMC_MAX_NAND_BANKS 4
44 31
45#define FSMC_FLASH_WIDTH8 1 32#define FSMC_FLASH_WIDTH8 1
46#define FSMC_FLASH_WIDTH16 2 33#define FSMC_FLASH_WIDTH16 2
47 34
48struct fsmc_nor_bank_regs { 35/* fsmc controller registers for NOR flash */
49 uint32_t ctrl; 36#define CTRL 0x0
50 uint32_t ctrl_tim; 37 /* ctrl register definitions */
51}; 38 #define BANK_ENABLE (1 << 0)
52 39 #define MUXED (1 << 1)
53/* ctrl register definitions */ 40 #define NOR_DEV (2 << 2)
54#define BANK_ENABLE (1 << 0) 41 #define WIDTH_8 (0 << 4)
55#define MUXED (1 << 1) 42 #define WIDTH_16 (1 << 4)
56#define NOR_DEV (2 << 2) 43 #define RSTPWRDWN (1 << 6)
57#define WIDTH_8 (0 << 4) 44 #define WPROT (1 << 7)
58#define WIDTH_16 (1 << 4) 45 #define WRT_ENABLE (1 << 12)
59#define RSTPWRDWN (1 << 6) 46 #define WAIT_ENB (1 << 13)
60#define WPROT (1 << 7) 47
61#define WRT_ENABLE (1 << 12) 48#define CTRL_TIM 0x4
62#define WAIT_ENB (1 << 13) 49 /* ctrl_tim register definitions */
63 50
64/* ctrl_tim register definitions */ 51#define FSMC_NOR_BANK_SZ 0x8
65
66struct fsmc_nand_bank_regs {
67 uint32_t pc;
68 uint32_t sts;
69 uint32_t comm;
70 uint32_t attrib;
71 uint32_t ioata;
72 uint32_t ecc1;
73 uint32_t ecc2;
74 uint32_t ecc3;
75};
76
77#define FSMC_NOR_REG_SIZE 0x40 52#define FSMC_NOR_REG_SIZE 0x40
78 53
79struct fsmc_regs { 54#define FSMC_NOR_REG(base, bank, reg) (base + \
80 struct fsmc_nor_bank_regs nor_bank_regs[FSMC_MAX_NOR_BANKS]; 55 FSMC_NOR_BANK_SZ * (bank) + \
81 uint8_t reserved_1[0x40 - 0x20]; 56 reg)
82 struct fsmc_nand_bank_regs bank_regs[FSMC_MAX_NAND_BANKS]; 57
83 uint8_t reserved_2[0xfe0 - 0xc0]; 58/* fsmc controller registers for NAND flash */
84 uint32_t peripid0; /* 0xfe0 */ 59#define PC 0x00
85 uint32_t peripid1; /* 0xfe4 */ 60 /* pc register definitions */
86 uint32_t peripid2; /* 0xfe8 */ 61 #define FSMC_RESET (1 << 0)
87 uint32_t peripid3; /* 0xfec */ 62 #define FSMC_WAITON (1 << 1)
88 uint32_t pcellid0; /* 0xff0 */ 63 #define FSMC_ENABLE (1 << 2)
89 uint32_t pcellid1; /* 0xff4 */ 64 #define FSMC_DEVTYPE_NAND (1 << 3)
90 uint32_t pcellid2; /* 0xff8 */ 65 #define FSMC_DEVWID_8 (0 << 4)
91 uint32_t pcellid3; /* 0xffc */ 66 #define FSMC_DEVWID_16 (1 << 4)
92}; 67 #define FSMC_ECCEN (1 << 6)
68 #define FSMC_ECCPLEN_512 (0 << 7)
69 #define FSMC_ECCPLEN_256 (1 << 7)
70 #define FSMC_TCLR_1 (1)
71 #define FSMC_TCLR_SHIFT (9)
72 #define FSMC_TCLR_MASK (0xF)
73 #define FSMC_TAR_1 (1)
74 #define FSMC_TAR_SHIFT (13)
75 #define FSMC_TAR_MASK (0xF)
76#define STS 0x04
77 /* sts register definitions */
78 #define FSMC_CODE_RDY (1 << 15)
79#define COMM 0x08
80 /* comm register definitions */
81 #define FSMC_TSET_0 0
82 #define FSMC_TSET_SHIFT 0
83 #define FSMC_TSET_MASK 0xFF
84 #define FSMC_TWAIT_6 6
85 #define FSMC_TWAIT_SHIFT 8
86 #define FSMC_TWAIT_MASK 0xFF
87 #define FSMC_THOLD_4 4
88 #define FSMC_THOLD_SHIFT 16
89 #define FSMC_THOLD_MASK 0xFF
90 #define FSMC_THIZ_1 1
91 #define FSMC_THIZ_SHIFT 24
92 #define FSMC_THIZ_MASK 0xFF
93#define ATTRIB 0x0C
94#define IOATA 0x10
95#define ECC1 0x14
96#define ECC2 0x18
97#define ECC3 0x1C
98#define FSMC_NAND_BANK_SZ 0x20
99
100#define FSMC_NAND_REG(base, bank, reg) (base + FSMC_NOR_REG_SIZE + \
101 (FSMC_NAND_BANK_SZ * (bank)) + \
102 reg)
93 103
94#define FSMC_BUSY_WAIT_TIMEOUT (1 * HZ) 104#define FSMC_BUSY_WAIT_TIMEOUT (1 * HZ)
95 105
96/* pc register definitions */
97#define FSMC_RESET (1 << 0)
98#define FSMC_WAITON (1 << 1)
99#define FSMC_ENABLE (1 << 2)
100#define FSMC_DEVTYPE_NAND (1 << 3)
101#define FSMC_DEVWID_8 (0 << 4)
102#define FSMC_DEVWID_16 (1 << 4)
103#define FSMC_ECCEN (1 << 6)
104#define FSMC_ECCPLEN_512 (0 << 7)
105#define FSMC_ECCPLEN_256 (1 << 7)
106#define FSMC_TCLR_1 (1 << 9)
107#define FSMC_TAR_1 (1 << 13)
108
109/* sts register definitions */
110#define FSMC_CODE_RDY (1 << 15)
111
112/* comm register definitions */
113#define FSMC_TSET_0 (0 << 0)
114#define FSMC_TWAIT_6 (6 << 8)
115#define FSMC_THOLD_4 (4 << 16)
116#define FSMC_THIZ_1 (1 << 24)
117
118/* 106/*
119 * There are 13 bytes of ecc for every 512 byte block in FSMC version 8 107 * There are 13 bytes of ecc for every 512 byte block in FSMC version 8
120 * and it has to be read consecutively and immediately after the 512 108 * and it has to be read consecutively and immediately after the 512
@@ -133,6 +121,20 @@ struct fsmc_eccplace {
133 struct fsmc_nand_eccplace eccplace[MAX_ECCPLACE_ENTRIES]; 121 struct fsmc_nand_eccplace eccplace[MAX_ECCPLACE_ENTRIES];
134}; 122};
135 123
124struct fsmc_nand_timings {
125 uint8_t tclr;
126 uint8_t tar;
127 uint8_t thiz;
128 uint8_t thold;
129 uint8_t twait;
130 uint8_t tset;
131};
132
133enum access_mode {
134 USE_DMA_ACCESS = 1,
135 USE_WORD_ACCESS,
136};
137
136/** 138/**
137 * fsmc_nand_platform_data - platform specific NAND controller config 139 * fsmc_nand_platform_data - platform specific NAND controller config
138 * @partitions: partition table for the platform, use a default fallback 140 * @partitions: partition table for the platform, use a default fallback
@@ -146,12 +148,23 @@ struct fsmc_eccplace {
146 * this may be set to NULL 148 * this may be set to NULL
147 */ 149 */
148struct fsmc_nand_platform_data { 150struct fsmc_nand_platform_data {
151 struct fsmc_nand_timings *nand_timings;
149 struct mtd_partition *partitions; 152 struct mtd_partition *partitions;
150 unsigned int nr_partitions; 153 unsigned int nr_partitions;
151 unsigned int options; 154 unsigned int options;
152 unsigned int width; 155 unsigned int width;
153 unsigned int bank; 156 unsigned int bank;
157
158 /* CLE, ALE offsets */
159 unsigned int cle_off;
160 unsigned int ale_off;
161 enum access_mode mode;
162
154 void (*select_bank)(uint32_t bank, uint32_t busw); 163 void (*select_bank)(uint32_t bank, uint32_t busw);
164
165 /* priv structures for dma accesses */
166 void *read_dma_priv;
167 void *write_dma_priv;
155}; 168};
156 169
157extern int __init fsmc_nor_init(struct platform_device *pdev, 170extern int __init fsmc_nor_init(struct platform_device *pdev,
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 94e924e2ecd5..3595a0236b0f 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -29,8 +29,8 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30 30
31#include <asm/unaligned.h> 31#include <asm/unaligned.h>
32#include <asm/system.h>
33#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/barrier.h>
34 34
35#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 35#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1
36#define map_bankwidth(map) 1 36#define map_bankwidth(map) 1
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index d43dc25af82e..cf5ea8cdcf8e 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -164,6 +164,9 @@ struct mtd_info {
164 /* ECC layout structure pointer - read only! */ 164 /* ECC layout structure pointer - read only! */
165 struct nand_ecclayout *ecclayout; 165 struct nand_ecclayout *ecclayout;
166 166
167 /* max number of correctible bit errors per writesize */
168 unsigned int ecc_strength;
169
167 /* Data for variable erase regions. If numeraseregions is zero, 170 /* Data for variable erase regions. If numeraseregions is zero,
168 * it means that the whole device has erasesize as given above. 171 * it means that the whole device has erasesize as given above.
169 */ 172 */
@@ -174,52 +177,52 @@ struct mtd_info {
174 * Do not call via these pointers, use corresponding mtd_*() 177 * Do not call via these pointers, use corresponding mtd_*()
175 * wrappers instead. 178 * wrappers instead.
176 */ 179 */
177 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 180 int (*_erase) (struct mtd_info *mtd, struct erase_info *instr);
178 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, 181 int (*_point) (struct mtd_info *mtd, loff_t from, size_t len,
179 size_t *retlen, void **virt, resource_size_t *phys); 182 size_t *retlen, void **virt, resource_size_t *phys);
180 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); 183 int (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
181 unsigned long (*get_unmapped_area) (struct mtd_info *mtd, 184 unsigned long (*_get_unmapped_area) (struct mtd_info *mtd,
182 unsigned long len, 185 unsigned long len,
183 unsigned long offset, 186 unsigned long offset,
184 unsigned long flags); 187 unsigned long flags);
185 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, 188 int (*_read) (struct mtd_info *mtd, loff_t from, size_t len,
186 size_t *retlen, u_char *buf); 189 size_t *retlen, u_char *buf);
187 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, 190 int (*_write) (struct mtd_info *mtd, loff_t to, size_t len,
188 size_t *retlen, const u_char *buf); 191 size_t *retlen, const u_char *buf);
189 int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, 192 int (*_panic_write) (struct mtd_info *mtd, loff_t to, size_t len,
190 size_t *retlen, const u_char *buf); 193 size_t *retlen, const u_char *buf);
191 int (*read_oob) (struct mtd_info *mtd, loff_t from, 194 int (*_read_oob) (struct mtd_info *mtd, loff_t from,
192 struct mtd_oob_ops *ops);
193 int (*write_oob) (struct mtd_info *mtd, loff_t to,
194 struct mtd_oob_ops *ops); 195 struct mtd_oob_ops *ops);
195 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, 196 int (*_write_oob) (struct mtd_info *mtd, loff_t to,
196 size_t len); 197 struct mtd_oob_ops *ops);
197 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, 198 int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
198 size_t len, size_t *retlen, u_char *buf); 199 size_t len);
199 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, 200 int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
200 size_t len); 201 size_t len, size_t *retlen, u_char *buf);
201 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, 202 int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
202 size_t len, size_t *retlen, u_char *buf); 203 size_t len);
203 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len, 204 int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from,
204 size_t *retlen, u_char *buf); 205 size_t len, size_t *retlen, u_char *buf);
205 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, 206 int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to,
206 size_t len); 207 size_t len, size_t *retlen, u_char *buf);
207 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, 208 int (*_lock_user_prot_reg) (struct mtd_info *mtd, loff_t from,
209 size_t len);
210 int (*_writev) (struct mtd_info *mtd, const struct kvec *vecs,
208 unsigned long count, loff_t to, size_t *retlen); 211 unsigned long count, loff_t to, size_t *retlen);
209 void (*sync) (struct mtd_info *mtd); 212 void (*_sync) (struct mtd_info *mtd);
210 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 213 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
211 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 214 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
212 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 215 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
213 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); 216 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs);
214 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); 217 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
215 int (*suspend) (struct mtd_info *mtd); 218 int (*_suspend) (struct mtd_info *mtd);
216 void (*resume) (struct mtd_info *mtd); 219 void (*_resume) (struct mtd_info *mtd);
217 /* 220 /*
218 * If the driver is something smart, like UBI, it may need to maintain 221 * If the driver is something smart, like UBI, it may need to maintain
219 * its own reference counting. The below functions are only for driver. 222 * its own reference counting. The below functions are only for driver.
220 */ 223 */
221 int (*get_device) (struct mtd_info *mtd); 224 int (*_get_device) (struct mtd_info *mtd);
222 void (*put_device) (struct mtd_info *mtd); 225 void (*_put_device) (struct mtd_info *mtd);
223 226
224 /* Backing device capabilities for this device 227 /* Backing device capabilities for this device
225 * - provides mmap capabilities 228 * - provides mmap capabilities
@@ -240,214 +243,75 @@ struct mtd_info {
240 int usecount; 243 int usecount;
241}; 244};
242 245
243/* 246int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
244 * Erase is an asynchronous operation. Device drivers are supposed 247int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
245 * to call instr->callback() whenever the operation completes, even 248 void **virt, resource_size_t *phys);
246 * if it completes with a failure. 249int mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len);
247 * Callers are supposed to pass a callback function and wait for it 250unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, unsigned long len,
248 * to be called before writing to the block. 251 unsigned long offset, unsigned long flags);
249 */ 252int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
250static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr) 253 u_char *buf);
251{ 254int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
252 return mtd->erase(mtd, instr); 255 const u_char *buf);
253} 256int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
254 257 const u_char *buf);
255/*
256 * This stuff for eXecute-In-Place. phys is optional and may be set to NULL.
257 */
258static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len,
259 size_t *retlen, void **virt, resource_size_t *phys)
260{
261 *retlen = 0;
262 if (!mtd->point)
263 return -EOPNOTSUPP;
264 return mtd->point(mtd, from, len, retlen, virt, phys);
265}
266
267/* We probably shouldn't allow XIP if the unpoint isn't a NULL */
268static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
269{
270 return mtd->unpoint(mtd, from, len);
271}
272
273/*
274 * Allow NOMMU mmap() to directly map the device (if not NULL)
275 * - return the address to which the offset maps
276 * - return -ENOSYS to indicate refusal to do the mapping
277 */
278static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd,
279 unsigned long len,
280 unsigned long offset,
281 unsigned long flags)
282{
283 if (!mtd->get_unmapped_area)
284 return -EOPNOTSUPP;
285 return mtd->get_unmapped_area(mtd, len, offset, flags);
286}
287
288static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
289 size_t *retlen, u_char *buf)
290{
291 return mtd->read(mtd, from, len, retlen, buf);
292}
293
294static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
295 size_t *retlen, const u_char *buf)
296{
297 *retlen = 0;
298 if (!mtd->write)
299 return -EROFS;
300 return mtd->write(mtd, to, len, retlen, buf);
301}
302
303/*
304 * In blackbox flight recorder like scenarios we want to make successful writes
305 * in interrupt context. panic_write() is only intended to be called when its
306 * known the kernel is about to panic and we need the write to succeed. Since
307 * the kernel is not going to be running for much longer, this function can
308 * break locks and delay to ensure the write succeeds (but not sleep).
309 */
310static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
311 size_t *retlen, const u_char *buf)
312{
313 *retlen = 0;
314 if (!mtd->panic_write)
315 return -EOPNOTSUPP;
316 return mtd->panic_write(mtd, to, len, retlen, buf);
317}
318 258
319static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, 259static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
320 struct mtd_oob_ops *ops) 260 struct mtd_oob_ops *ops)
321{ 261{
322 ops->retlen = ops->oobretlen = 0; 262 ops->retlen = ops->oobretlen = 0;
323 if (!mtd->read_oob) 263 if (!mtd->_read_oob)
324 return -EOPNOTSUPP; 264 return -EOPNOTSUPP;
325 return mtd->read_oob(mtd, from, ops); 265 return mtd->_read_oob(mtd, from, ops);
326} 266}
327 267
328static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, 268static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
329 struct mtd_oob_ops *ops) 269 struct mtd_oob_ops *ops)
330{ 270{
331 ops->retlen = ops->oobretlen = 0; 271 ops->retlen = ops->oobretlen = 0;
332 if (!mtd->write_oob) 272 if (!mtd->_write_oob)
333 return -EOPNOTSUPP;
334 return mtd->write_oob(mtd, to, ops);
335}
336
337/*
338 * Method to access the protection register area, present in some flash
339 * devices. The user data is one time programmable but the factory data is read
340 * only.
341 */
342static inline int mtd_get_fact_prot_info(struct mtd_info *mtd,
343 struct otp_info *buf, size_t len)
344{
345 if (!mtd->get_fact_prot_info)
346 return -EOPNOTSUPP; 273 return -EOPNOTSUPP;
347 return mtd->get_fact_prot_info(mtd, buf, len); 274 if (!(mtd->flags & MTD_WRITEABLE))
348} 275 return -EROFS;
349 276 return mtd->_write_oob(mtd, to, ops);
350static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from,
351 size_t len, size_t *retlen,
352 u_char *buf)
353{
354 *retlen = 0;
355 if (!mtd->read_fact_prot_reg)
356 return -EOPNOTSUPP;
357 return mtd->read_fact_prot_reg(mtd, from, len, retlen, buf);
358}
359
360static inline int mtd_get_user_prot_info(struct mtd_info *mtd,
361 struct otp_info *buf,
362 size_t len)
363{
364 if (!mtd->get_user_prot_info)
365 return -EOPNOTSUPP;
366 return mtd->get_user_prot_info(mtd, buf, len);
367}
368
369static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from,
370 size_t len, size_t *retlen,
371 u_char *buf)
372{
373 *retlen = 0;
374 if (!mtd->read_user_prot_reg)
375 return -EOPNOTSUPP;
376 return mtd->read_user_prot_reg(mtd, from, len, retlen, buf);
377}
378
379static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
380 size_t len, size_t *retlen,
381 u_char *buf)
382{
383 *retlen = 0;
384 if (!mtd->write_user_prot_reg)
385 return -EOPNOTSUPP;
386 return mtd->write_user_prot_reg(mtd, to, len, retlen, buf);
387} 277}
388 278
389static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, 279int mtd_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf,
390 size_t len) 280 size_t len);
391{ 281int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
392 if (!mtd->lock_user_prot_reg) 282 size_t *retlen, u_char *buf);
393 return -EOPNOTSUPP; 283int mtd_get_user_prot_info(struct mtd_info *mtd, struct otp_info *buf,
394 return mtd->lock_user_prot_reg(mtd, from, len); 284 size_t len);
395} 285int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
286 size_t *retlen, u_char *buf);
287int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len,
288 size_t *retlen, u_char *buf);
289int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len);
396 290
397int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, 291int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
398 unsigned long count, loff_t to, size_t *retlen); 292 unsigned long count, loff_t to, size_t *retlen);
399 293
400static inline void mtd_sync(struct mtd_info *mtd) 294static inline void mtd_sync(struct mtd_info *mtd)
401{ 295{
402 if (mtd->sync) 296 if (mtd->_sync)
403 mtd->sync(mtd); 297 mtd->_sync(mtd);
404}
405
406/* Chip-supported device locking */
407static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
408{
409 if (!mtd->lock)
410 return -EOPNOTSUPP;
411 return mtd->lock(mtd, ofs, len);
412} 298}
413 299
414static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) 300int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
415{ 301int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
416 if (!mtd->unlock) 302int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len);
417 return -EOPNOTSUPP; 303int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs);
418 return mtd->unlock(mtd, ofs, len); 304int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs);
419}
420
421static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
422{
423 if (!mtd->is_locked)
424 return -EOPNOTSUPP;
425 return mtd->is_locked(mtd, ofs, len);
426}
427 305
428static inline int mtd_suspend(struct mtd_info *mtd) 306static inline int mtd_suspend(struct mtd_info *mtd)
429{ 307{
430 return mtd->suspend ? mtd->suspend(mtd) : 0; 308 return mtd->_suspend ? mtd->_suspend(mtd) : 0;
431} 309}
432 310
433static inline void mtd_resume(struct mtd_info *mtd) 311static inline void mtd_resume(struct mtd_info *mtd)
434{ 312{
435 if (mtd->resume) 313 if (mtd->_resume)
436 mtd->resume(mtd); 314 mtd->_resume(mtd);
437}
438
439static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
440{
441 if (!mtd->block_isbad)
442 return 0;
443 return mtd->block_isbad(mtd, ofs);
444}
445
446static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
447{
448 if (!mtd->block_markbad)
449 return -EOPNOTSUPP;
450 return mtd->block_markbad(mtd, ofs);
451} 315}
452 316
453static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) 317static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
@@ -482,12 +346,12 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
482 346
483static inline int mtd_has_oob(const struct mtd_info *mtd) 347static inline int mtd_has_oob(const struct mtd_info *mtd)
484{ 348{
485 return mtd->read_oob && mtd->write_oob; 349 return mtd->_read_oob && mtd->_write_oob;
486} 350}
487 351
488static inline int mtd_can_have_bb(const struct mtd_info *mtd) 352static inline int mtd_can_have_bb(const struct mtd_info *mtd)
489{ 353{
490 return !!mtd->block_isbad; 354 return !!mtd->_block_isbad;
491} 355}
492 356
493 /* Kernel-side ioctl definitions */ 357 /* Kernel-side ioctl definitions */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 63b5a8b6dfbd..1482340d3d9f 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -324,6 +324,7 @@ struct nand_hw_control {
324 * @steps: number of ECC steps per page 324 * @steps: number of ECC steps per page
325 * @size: data bytes per ECC step 325 * @size: data bytes per ECC step
326 * @bytes: ECC bytes per step 326 * @bytes: ECC bytes per step
327 * @strength: max number of correctible bits per ECC step
327 * @total: total number of ECC bytes per page 328 * @total: total number of ECC bytes per page
328 * @prepad: padding information for syndrome based ECC generators 329 * @prepad: padding information for syndrome based ECC generators
329 * @postpad: padding information for syndrome based ECC generators 330 * @postpad: padding information for syndrome based ECC generators
@@ -351,6 +352,7 @@ struct nand_ecc_ctrl {
351 int size; 352 int size;
352 int bytes; 353 int bytes;
353 int total; 354 int total;
355 int strength;
354 int prepad; 356 int prepad;
355 int postpad; 357 int postpad;
356 struct nand_ecclayout *layout; 358 struct nand_ecclayout *layout;
@@ -448,8 +450,9 @@ struct nand_buffers {
448 * will be copied to the appropriate nand_bbt_descr's. 450 * will be copied to the appropriate nand_bbt_descr's.
449 * @badblockpos: [INTERN] position of the bad block marker in the oob 451 * @badblockpos: [INTERN] position of the bad block marker in the oob
450 * area. 452 * area.
451 * @badblockbits: [INTERN] number of bits to left-shift the bad block 453 * @badblockbits: [INTERN] minimum number of set bits in a good block's
452 * number 454 * bad block marker position; i.e., BBM == 11110111b is
455 * not bad when badblockbits == 7
453 * @cellinfo: [INTERN] MLC/multichip data from chip ident 456 * @cellinfo: [INTERN] MLC/multichip data from chip ident
454 * @numchips: [INTERN] number of physical chips 457 * @numchips: [INTERN] number of physical chips
455 * @chipsize: [INTERN] the size of one chip for multichip arrays 458 * @chipsize: [INTERN] the size of one chip for multichip arrays
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h
deleted file mode 100644
index 27ad40aed19f..000000000000
--- a/include/linux/mtd/pmc551.h
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * PMC551 PCI Mezzanine Ram Device
3 *
4 * Author:
5 * Mark Ferrell
6 * Copyright 1999,2000 Nortel Networks
7 *
8 * License:
9 * As part of this driver was derrived from the slram.c driver it falls
10 * under the same license, which is GNU General Public License v2
11 */
12
13#ifndef __MTD_PMC551_H__
14#define __MTD_PMC551_H__
15
16#include <linux/mtd/mtd.h>
17
18#define PMC551_VERSION \
19 "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n"
20
21/*
22 * Our personal and private information
23 */
24struct mypriv {
25 struct pci_dev *dev;
26 u_char *start;
27 u32 base_map0;
28 u32 curr_map0;
29 u32 asize;
30 struct mtd_info *nextpmc551;
31};
32
33/*
34 * Function Prototypes
35 */
36static int pmc551_erase(struct mtd_info *, struct erase_info *);
37static void pmc551_unpoint(struct mtd_info *, loff_t, size_t);
38static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
39 size_t *retlen, void **virt, resource_size_t *phys);
40static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
41static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
42
43
44/*
45 * Define the PCI ID's if the kernel doesn't define them for us
46 */
47#ifndef PCI_VENDOR_ID_V3_SEMI
48#define PCI_VENDOR_ID_V3_SEMI 0x11b0
49#endif
50
51#ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC
52#define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200
53#endif
54
55
56#define PMC551_PCI_MEM_MAP0 0x50
57#define PMC551_PCI_MEM_MAP1 0x54
58#define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000
59#define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0
60#define PMC551_PCI_MEM_MAP_REG_EN 0x00000002
61#define PMC551_PCI_MEM_MAP_ENABLE 0x00000001
62
63#define PMC551_SDRAM_MA 0x60
64#define PMC551_SDRAM_CMD 0x62
65#define PMC551_DRAM_CFG 0x64
66#define PMC551_SYS_CTRL_REG 0x78
67
68#define PMC551_DRAM_BLK0 0x68
69#define PMC551_DRAM_BLK1 0x6c
70#define PMC551_DRAM_BLK2 0x70
71#define PMC551_DRAM_BLK3 0x74
72#define PMC551_DRAM_BLK_GET_SIZE(x) (524288<<((x>>4)&0x0f))
73#define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12))
74#define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8))
75
76
77#endif /* __MTD_PMC551_H__ */
78
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index 9cf4c4c79555..a38e1fa8af01 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -23,6 +23,7 @@
23#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
24#include <linux/mtd/nand.h> 24#include <linux/mtd/nand.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/pm_qos.h>
26 27
27/* FLCTL registers */ 28/* FLCTL registers */
28#define FLCMNCR(f) (f->reg + 0x0) 29#define FLCMNCR(f) (f->reg + 0x0)
@@ -38,6 +39,7 @@
38#define FLDTFIFO(f) (f->reg + 0x24) 39#define FLDTFIFO(f) (f->reg + 0x24)
39#define FLECFIFO(f) (f->reg + 0x28) 40#define FLECFIFO(f) (f->reg + 0x28)
40#define FLTRCR(f) (f->reg + 0x2C) 41#define FLTRCR(f) (f->reg + 0x2C)
42#define FLHOLDCR(f) (f->reg + 0x38)
41#define FL4ECCRESULT0(f) (f->reg + 0x80) 43#define FL4ECCRESULT0(f) (f->reg + 0x80)
42#define FL4ECCRESULT1(f) (f->reg + 0x84) 44#define FL4ECCRESULT1(f) (f->reg + 0x84)
43#define FL4ECCRESULT2(f) (f->reg + 0x88) 45#define FL4ECCRESULT2(f) (f->reg + 0x88)
@@ -67,6 +69,30 @@
67#define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */ 69#define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */
68#define TYPESEL_SET (0x1 << 0) 70#define TYPESEL_SET (0x1 << 0)
69 71
72/*
73 * Clock settings using the PULSEx registers from FLCMNCR
74 *
75 * Some hardware uses bits called PULSEx instead of FCKSEL_E and QTSEL_E
76 * to control the clock divider used between the High-Speed Peripheral Clock
77 * and the FLCTL internal clock. If so, use CLK_8_BIT_xxx for connecting 8 bit
78 * and CLK_16_BIT_xxx for connecting 16 bit bus bandwith NAND chips. For the 16
79 * bit version the divider is seperate for the pulse width of high and low
80 * signals.
81 */
82#define PULSE3 (0x1 << 27)
83#define PULSE2 (0x1 << 17)
84#define PULSE1 (0x1 << 15)
85#define PULSE0 (0x1 << 9)
86#define CLK_8B_0_5 PULSE1
87#define CLK_8B_1 0x0
88#define CLK_8B_1_5 (PULSE1 | PULSE2)
89#define CLK_8B_2 PULSE0
90#define CLK_8B_3 (PULSE0 | PULSE1 | PULSE2)
91#define CLK_8B_4 (PULSE0 | PULSE2)
92#define CLK_16B_6L_2H PULSE0
93#define CLK_16B_9L_3H (PULSE0 | PULSE1 | PULSE2)
94#define CLK_16B_12L_4H (PULSE0 | PULSE2)
95
70/* FLCMDCR control bits */ 96/* FLCMDCR control bits */
71#define ADRCNT2_E (0x1 << 31) /* 5byte address enable */ 97#define ADRCNT2_E (0x1 << 31) /* 5byte address enable */
72#define ADRMD_E (0x1 << 26) /* Sector address access */ 98#define ADRMD_E (0x1 << 26) /* Sector address access */
@@ -85,6 +111,15 @@
85#define TRSTRT (0x1 << 0) /* translation start */ 111#define TRSTRT (0x1 << 0) /* translation start */
86#define TREND (0x1 << 1) /* translation end */ 112#define TREND (0x1 << 1) /* translation end */
87 113
114/*
115 * FLHOLDCR control bits
116 *
117 * HOLDEN: Bus Occupancy Enable (inverted)
118 * Enable this bit when the external bus might be used in between transfers.
119 * If not set and the bus gets used by other modules, a deadlock occurs.
120 */
121#define HOLDEN (0x1 << 0)
122
88/* FL4ECCCR control bits */ 123/* FL4ECCCR control bits */
89#define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */ 124#define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */
90#define _4ECCEND (0x1 << 1) /* 4 symbols end */ 125#define _4ECCEND (0x1 << 1) /* 4 symbols end */
@@ -97,6 +132,7 @@ struct sh_flctl {
97 struct mtd_info mtd; 132 struct mtd_info mtd;
98 struct nand_chip chip; 133 struct nand_chip chip;
99 struct platform_device *pdev; 134 struct platform_device *pdev;
135 struct dev_pm_qos_request pm_qos;
100 void __iomem *reg; 136 void __iomem *reg;
101 137
102 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ 138 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */
@@ -108,11 +144,14 @@ struct sh_flctl {
108 int erase1_page_addr; /* page_addr in ERASE1 cmd */ 144 int erase1_page_addr; /* page_addr in ERASE1 cmd */
109 uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ 145 uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */
110 uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ 146 uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */
147 uint32_t flcmncr_base; /* base value of FLCMNCR */
111 148
112 int hwecc_cant_correct[4]; 149 int hwecc_cant_correct[4];
113 150
114 unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ 151 unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */
115 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ 152 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */
153 unsigned holden:1; /* Hardware has FLHOLDCR and HOLDEN is set */
154 unsigned qos_request:1; /* QoS request to prevent deep power shutdown */
116}; 155};
117 156
118struct sh_flctl_platform_data { 157struct sh_flctl_platform_data {
@@ -121,6 +160,7 @@ struct sh_flctl_platform_data {
121 unsigned long flcmncr_val; 160 unsigned long flcmncr_val;
122 161
123 unsigned has_hwecc:1; 162 unsigned has_hwecc:1;
163 unsigned use_holden:1;
124}; 164};
125 165
126static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo) 166static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo)
diff --git a/include/linux/mtd/spear_smi.h b/include/linux/mtd/spear_smi.h
new file mode 100644
index 000000000000..8ae1726044c3
--- /dev/null
+++ b/include/linux/mtd/spear_smi.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright © 2010 ST Microelectronics
3 * Shiraz Hashim <shiraz.hashim@st.com>
4 *
5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any
7 * warranty of any kind, whether express or implied.
8 */
9
10#ifndef __MTD_SPEAR_SMI_H
11#define __MTD_SPEAR_SMI_H
12
13#include <linux/types.h>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/platform_device.h>
17#include <linux/of.h>
18
19/* max possible slots for serial-nor flash chip in the SMI controller */
20#define MAX_NUM_FLASH_CHIP 4
21
22/* macro to define partitions for flash devices */
23#define DEFINE_PARTS(n, of, s) \
24{ \
25 .name = n, \
26 .offset = of, \
27 .size = s, \
28}
29
30/**
31 * struct spear_smi_flash_info - platform structure for passing flash
32 * information
33 *
34 * name: name of the serial nor flash for identification
35 * mem_base: the memory base on which the flash is mapped
36 * size: size of the flash in bytes
37 * partitions: parition details
38 * nr_partitions: number of partitions
39 * fast_mode: whether flash supports fast mode
40 */
41
42struct spear_smi_flash_info {
43 char *name;
44 unsigned long mem_base;
45 unsigned long size;
46 struct mtd_partition *partitions;
47 int nr_partitions;
48 u8 fast_mode;
49};
50
51/**
52 * struct spear_smi_plat_data - platform structure for configuring smi
53 *
54 * clk_rate: clk rate at which SMI must operate
55 * num_flashes: number of flashes present on board
56 * board_flash_info: specific details of each flash present on board
57 */
58struct spear_smi_plat_data {
59 unsigned long clk_rate;
60 int num_flashes;
61 struct spear_smi_flash_info *board_flash_info;
62 struct device_node *np[MAX_NUM_FLASH_CHIP];
63};
64
65#endif /* __MTD_SPEAR_SMI_H */
diff --git a/include/linux/mtio.h b/include/linux/mtio.h
index 8f825756c459..18543e2db06f 100644
--- a/include/linux/mtio.h
+++ b/include/linux/mtio.h
@@ -194,6 +194,7 @@ struct mtpos {
194#define MT_ST_SYSV 0x1000 194#define MT_ST_SYSV 0x1000
195#define MT_ST_NOWAIT 0x2000 195#define MT_ST_NOWAIT 0x2000
196#define MT_ST_SILI 0x4000 196#define MT_ST_SILI 0x4000
197#define MT_ST_NOWAIT_EOF 0x8000
197 198
198/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ 199/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */
199#define MT_ST_CLEAR_DEFAULT 0xfffff 200#define MT_ST_CLEAR_DEFAULT 0xfffff
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1f77540bdc95..5cbaa20f1659 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2604,8 +2604,6 @@ extern void net_disable_timestamp(void);
2604extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); 2604extern void *dev_seq_start(struct seq_file *seq, loff_t *pos);
2605extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); 2605extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos);
2606extern void dev_seq_stop(struct seq_file *seq, void *v); 2606extern void dev_seq_stop(struct seq_file *seq, void *v);
2607extern int dev_seq_open_ops(struct inode *inode, struct file *file,
2608 const struct seq_operations *ops);
2609#endif 2607#endif
2610 2608
2611extern int netdev_class_create_file(struct class_attribute *class_attr); 2609extern int netdev_class_create_file(struct class_attribute *class_attr);
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h
index c0405ac92870..e3a9978f259f 100644
--- a/include/linux/netfilter/xt_set.h
+++ b/include/linux/netfilter/xt_set.h
@@ -58,8 +58,8 @@ struct xt_set_info_target_v1 {
58struct xt_set_info_target_v2 { 58struct xt_set_info_target_v2 {
59 struct xt_set_info add_set; 59 struct xt_set_info add_set;
60 struct xt_set_info del_set; 60 struct xt_set_info del_set;
61 u32 flags; 61 __u32 flags;
62 u32 timeout; 62 __u32 timeout;
63}; 63};
64 64
65#endif /*_XT_SET_H*/ 65#endif /*_XT_SET_H*/
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 834df8bf08b6..0987146b0637 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -438,7 +438,20 @@ enum limit_by4 {
438enum open_delegation_type4 { 438enum open_delegation_type4 {
439 NFS4_OPEN_DELEGATE_NONE = 0, 439 NFS4_OPEN_DELEGATE_NONE = 0,
440 NFS4_OPEN_DELEGATE_READ = 1, 440 NFS4_OPEN_DELEGATE_READ = 1,
441 NFS4_OPEN_DELEGATE_WRITE = 2 441 NFS4_OPEN_DELEGATE_WRITE = 2,
442 NFS4_OPEN_DELEGATE_NONE_EXT = 3, /* 4.1 */
443};
444
445enum why_no_delegation4 { /* new to v4.1 */
446 WND4_NOT_WANTED = 0,
447 WND4_CONTENTION = 1,
448 WND4_RESOURCE = 2,
449 WND4_NOT_SUPP_FTYPE = 3,
450 WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4,
451 WND4_NOT_SUPP_UPGRADE = 5,
452 WND4_NOT_SUPP_DOWNGRADE = 6,
453 WND4_CANCELLED = 7,
454 WND4_IS_DIR = 8,
442}; 455};
443 456
444enum lock_type4 { 457enum lock_type4 {
diff --git a/include/linux/nfsd/cld.h b/include/linux/nfsd/cld.h
new file mode 100644
index 000000000000..f14a9ab06f1f
--- /dev/null
+++ b/include/linux/nfsd/cld.h
@@ -0,0 +1,56 @@
1/*
2 * Upcall description for nfsdcld communication
3 *
4 * Copyright (c) 2012 Red Hat, Inc.
5 * Author(s): Jeff Layton <jlayton@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef _NFSD_CLD_H
23#define _NFSD_CLD_H
24
25/* latest upcall version available */
26#define CLD_UPCALL_VERSION 1
27
28/* defined by RFC3530 */
29#define NFS4_OPAQUE_LIMIT 1024
30
31enum cld_command {
32 Cld_Create, /* create a record for this cm_id */
33 Cld_Remove, /* remove record of this cm_id */
34 Cld_Check, /* is this cm_id allowed? */
35 Cld_GraceDone, /* grace period is complete */
36};
37
38/* representation of long-form NFSv4 client ID */
39struct cld_name {
40 uint16_t cn_len; /* length of cm_id */
41 unsigned char cn_id[NFS4_OPAQUE_LIMIT]; /* client-provided */
42} __attribute__((packed));
43
44/* message struct for communication with userspace */
45struct cld_msg {
46 uint8_t cm_vers; /* upcall version */
47 uint8_t cm_cmd; /* upcall command */
48 int16_t cm_status; /* return code */
49 uint32_t cm_xid; /* transaction id */
50 union {
51 int64_t cm_gracetime; /* grace period start time */
52 struct cld_name cm_name;
53 } __attribute__((packed)) cm_u;
54} __attribute__((packed));
55
56#endif /* !_NFSD_CLD_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index d46a18ffbebb..fa7fb1d97458 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -58,9 +58,6 @@ struct device_node {
58 struct kref kref; 58 struct kref kref;
59 unsigned long _flags; 59 unsigned long _flags;
60 void *data; 60 void *data;
61#if defined(CONFIG_EEH)
62 struct eeh_dev *edev;
63#endif
64#if defined(CONFIG_SPARC) 61#if defined(CONFIG_SPARC)
65 char *path_component_name; 62 char *path_component_name;
66 unsigned int unique_id; 63 unsigned int unique_id;
@@ -75,13 +72,6 @@ struct of_phandle_args {
75 uint32_t args[MAX_PHANDLE_ARGS]; 72 uint32_t args[MAX_PHANDLE_ARGS];
76}; 73};
77 74
78#if defined(CONFIG_EEH)
79static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
80{
81 return dn->edev;
82}
83#endif
84
85#ifdef CONFIG_OF_DYNAMIC 75#ifdef CONFIG_OF_DYNAMIC
86extern struct device_node *of_node_get(struct device_node *node); 76extern struct device_node *of_node_get(struct device_node *node);
87extern void of_node_put(struct device_node *node); 77extern void of_node_put(struct device_node *node);
@@ -361,6 +351,22 @@ static inline int of_machine_is_compatible(const char *compat)
361#define of_match_node(_matches, _node) NULL 351#define of_match_node(_matches, _node) NULL
362#endif /* CONFIG_OF */ 352#endif /* CONFIG_OF */
363 353
354/**
355 * of_property_read_bool - Findfrom a property
356 * @np: device node from which the property value is to be read.
357 * @propname: name of the property to be searched.
358 *
359 * Search for a property in a device node.
360 * Returns true if the property exist false otherwise.
361 */
362static inline bool of_property_read_bool(const struct device_node *np,
363 const char *propname)
364{
365 struct property *prop = of_find_property(np, propname, NULL);
366
367 return prop ? true : false;
368}
369
364static inline int of_property_read_u32(const struct device_node *np, 370static inline int of_property_read_u32(const struct device_node *np,
365 const char *propname, 371 const char *propname,
366 u32 *out_value) 372 u32 *out_value)
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index b254052a49d7..81733d12cbea 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -50,7 +50,8 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
50extern int of_get_named_gpio_flags(struct device_node *np, 50extern int of_get_named_gpio_flags(struct device_node *np,
51 const char *list_name, int index, enum of_gpio_flags *flags); 51 const char *list_name, int index, enum of_gpio_flags *flags);
52 52
53extern unsigned int of_gpio_count(struct device_node *np); 53extern unsigned int of_gpio_named_count(struct device_node *np,
54 const char* propname);
54 55
55extern int of_mm_gpiochip_add(struct device_node *np, 56extern int of_mm_gpiochip_add(struct device_node *np,
56 struct of_mm_gpio_chip *mm_gc); 57 struct of_mm_gpio_chip *mm_gc);
@@ -71,7 +72,8 @@ static inline int of_get_named_gpio_flags(struct device_node *np,
71 return -ENOSYS; 72 return -ENOSYS;
72} 73}
73 74
74static inline unsigned int of_gpio_count(struct device_node *np) 75static inline unsigned int of_gpio_named_count(struct device_node *np,
76 const char* propname)
75{ 77{
76 return 0; 78 return 0;
77} 79}
@@ -89,6 +91,27 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
89#endif /* CONFIG_OF_GPIO */ 91#endif /* CONFIG_OF_GPIO */
90 92
91/** 93/**
94 * of_gpio_count - Count GPIOs for a device
95 * @np: device node to count GPIOs for
96 *
97 * The function returns the count of GPIOs specified for a node.
98 *
99 * Note that the empty GPIO specifiers counts too. For example,
100 *
101 * gpios = <0
102 * &pio1 1 2
103 * 0
104 * &pio2 3 4>;
105 *
106 * defines four GPIOs (so this function will return 4), two of which
107 * are not specified.
108 */
109static inline unsigned int of_gpio_count(struct device_node *np)
110{
111 return of_gpio_named_count(np, "gpios");
112}
113
114/**
92 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API 115 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API
93 * @np: device node to get GPIO from 116 * @np: device node to get GPIO from
94 * @index: index of the GPIO 117 * @index: index of the GPIO
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
new file mode 100644
index 000000000000..bae1b6094c63
--- /dev/null
+++ b/include/linux/of_mtd.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
3 *
4 * OF helpers for mtd.
5 *
6 * This file is released under the GPLv2
7 */
8
9#ifndef __LINUX_OF_MTD_H
10#define __LINUX_OF_NET_H
11
12#ifdef CONFIG_OF_MTD
13#include <linux/of.h>
14extern const int of_get_nand_ecc_mode(struct device_node *np);
15int of_get_nand_bus_width(struct device_node *np);
16bool of_get_nand_on_flash_bbt(struct device_node *np);
17#endif
18
19#endif /* __LINUX_OF_MTD_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 38a423ed3c01..106c2ca9440b 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -100,7 +100,6 @@ typedef enum {
100#include <linux/wait.h> 100#include <linux/wait.h>
101#include <linux/irqreturn.h> 101#include <linux/irqreturn.h>
102#include <linux/semaphore.h> 102#include <linux/semaphore.h>
103#include <asm/system.h>
104#include <asm/ptrace.h> 103#include <asm/ptrace.h>
105 104
106/* Define this later. */ 105/* Define this later. */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index bd9f55a5958d..ddbb6a901f65 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -299,18 +299,31 @@ struct perf_event_mmap_page {
299 /* 299 /*
300 * Bits needed to read the hw events in user-space. 300 * Bits needed to read the hw events in user-space.
301 * 301 *
302 * u32 seq; 302 * u32 seq, time_mult, time_shift, idx, width;
303 * s64 count; 303 * u64 count, enabled, running;
304 * u64 cyc, time_offset;
305 * s64 pmc = 0;
304 * 306 *
305 * do { 307 * do {
306 * seq = pc->lock; 308 * seq = pc->lock;
307 *
308 * barrier() 309 * barrier()
309 * if (pc->index) { 310 *
310 * count = pmc_read(pc->index - 1); 311 * enabled = pc->time_enabled;
311 * count += pc->offset; 312 * running = pc->time_running;
312 * } else 313 *
313 * goto regular_read; 314 * if (pc->cap_usr_time && enabled != running) {
315 * cyc = rdtsc();
316 * time_offset = pc->time_offset;
317 * time_mult = pc->time_mult;
318 * time_shift = pc->time_shift;
319 * }
320 *
321 * idx = pc->index;
322 * count = pc->offset;
323 * if (pc->cap_usr_rdpmc && idx) {
324 * width = pc->pmc_width;
325 * pmc = rdpmc(idx - 1);
326 * }
314 * 327 *
315 * barrier(); 328 * barrier();
316 * } while (pc->lock != seq); 329 * } while (pc->lock != seq);
@@ -323,14 +336,57 @@ struct perf_event_mmap_page {
323 __s64 offset; /* add to hardware event value */ 336 __s64 offset; /* add to hardware event value */
324 __u64 time_enabled; /* time event active */ 337 __u64 time_enabled; /* time event active */
325 __u64 time_running; /* time event on cpu */ 338 __u64 time_running; /* time event on cpu */
326 __u32 time_mult, time_shift; 339 union {
340 __u64 capabilities;
341 __u64 cap_usr_time : 1,
342 cap_usr_rdpmc : 1,
343 cap_____res : 62;
344 };
345
346 /*
347 * If cap_usr_rdpmc this field provides the bit-width of the value
348 * read using the rdpmc() or equivalent instruction. This can be used
349 * to sign extend the result like:
350 *
351 * pmc <<= 64 - width;
352 * pmc >>= 64 - width; // signed shift right
353 * count += pmc;
354 */
355 __u16 pmc_width;
356
357 /*
358 * If cap_usr_time the below fields can be used to compute the time
359 * delta since time_enabled (in ns) using rdtsc or similar.
360 *
361 * u64 quot, rem;
362 * u64 delta;
363 *
364 * quot = (cyc >> time_shift);
365 * rem = cyc & ((1 << time_shift) - 1);
366 * delta = time_offset + quot * time_mult +
367 * ((rem * time_mult) >> time_shift);
368 *
369 * Where time_offset,time_mult,time_shift and cyc are read in the
370 * seqcount loop described above. This delta can then be added to
371 * enabled and possible running (if idx), improving the scaling:
372 *
373 * enabled += delta;
374 * if (idx)
375 * running += delta;
376 *
377 * quot = count / running;
378 * rem = count % running;
379 * count = quot * enabled + (rem * enabled) / running;
380 */
381 __u16 time_shift;
382 __u32 time_mult;
327 __u64 time_offset; 383 __u64 time_offset;
328 384
329 /* 385 /*
330 * Hole for extension of the self monitor capabilities 386 * Hole for extension of the self monitor capabilities
331 */ 387 */
332 388
333 __u64 __reserved[121]; /* align to 1k */ 389 __u64 __reserved[120]; /* align to 1k */
334 390
335 /* 391 /*
336 * Control data for the mmap() data buffer. 392 * Control data for the mmap() data buffer.
@@ -550,6 +606,7 @@ struct perf_guest_info_callbacks {
550#include <linux/irq_work.h> 606#include <linux/irq_work.h>
551#include <linux/static_key.h> 607#include <linux/static_key.h>
552#include <linux/atomic.h> 608#include <linux/atomic.h>
609#include <linux/sysfs.h>
553#include <asm/local.h> 610#include <asm/local.h>
554 611
555#define PERF_MAX_STACK_DEPTH 255 612#define PERF_MAX_STACK_DEPTH 255
@@ -1291,5 +1348,18 @@ do { \
1291 register_cpu_notifier(&fn##_nb); \ 1348 register_cpu_notifier(&fn##_nb); \
1292} while (0) 1349} while (0)
1293 1350
1351
1352#define PMU_FORMAT_ATTR(_name, _format) \
1353static ssize_t \
1354_name##_show(struct device *dev, \
1355 struct device_attribute *attr, \
1356 char *page) \
1357{ \
1358 BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
1359 return sprintf(page, _format "\n"); \
1360} \
1361 \
1362static struct device_attribute format_attr_##_name = __ATTR_RO(_name)
1363
1294#endif /* __KERNEL__ */ 1364#endif /* __KERNEL__ */
1295#endif /* _LINUX_PERF_EVENT_H */ 1365#endif /* _LINUX_PERF_EVENT_H */
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index f5bd679be46b..b067bd8c49d0 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -33,6 +33,7 @@ struct pid_namespace {
33#endif 33#endif
34 gid_t pid_gid; 34 gid_t pid_gid;
35 int hide_pid; 35 int hide_pid;
36 int reboot; /* group exit code if this pidns was rebooted */
36}; 37};
37 38
38extern struct pid_namespace init_pid_ns; 39extern struct pid_namespace init_pid_ns;
@@ -48,6 +49,7 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
48extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); 49extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
49extern void free_pid_ns(struct kref *kref); 50extern void free_pid_ns(struct kref *kref);
50extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); 51extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
52extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);
51 53
52static inline void put_pid_ns(struct pid_namespace *ns) 54static inline void put_pid_ns(struct pid_namespace *ns)
53{ 55{
@@ -75,11 +77,15 @@ static inline void put_pid_ns(struct pid_namespace *ns)
75{ 77{
76} 78}
77 79
78
79static inline void zap_pid_ns_processes(struct pid_namespace *ns) 80static inline void zap_pid_ns_processes(struct pid_namespace *ns)
80{ 81{
81 BUG(); 82 BUG();
82} 83}
84
85static inline int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
86{
87 return 0;
88}
83#endif /* CONFIG_PID_NS */ 89#endif /* CONFIG_PID_NS */
84 90
85extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk); 91extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
new file mode 100644
index 000000000000..b0f2c56a8ea2
--- /dev/null
+++ b/include/linux/platform_data/atmel.h
@@ -0,0 +1,27 @@
1/*
2 * atmel platform data
3 *
4 * GPL v2 Only
5 */
6
7#ifndef __ATMEL_H__
8#define __ATMEL_H__
9
10#include <linux/mtd/nand.h>
11
12 /* NAND / SmartMedia */
13struct atmel_nand_data {
14 int enable_pin; /* chip enable */
15 int det_pin; /* card detect */
16 int rdy_pin; /* ready/busy */
17 u8 rdy_pin_active_low; /* rdy_pin value is inverted */
18 u8 ale; /* address line number connected to ALE */
19 u8 cle; /* address line number connected to CLE */
20 u8 bus_width_16; /* buswidth is 16 bit */
21 u8 ecc_mode; /* ecc mode */
22 u8 on_flash_bbt; /* bbt on flash */
23 struct mtd_partition *parts;
24 unsigned int num_parts;
25};
26
27#endif /* __ATMEL_H__ */
diff --git a/include/linux/platform_data/spear_thermal.h b/include/linux/platform_data/spear_thermal.h
new file mode 100644
index 000000000000..724f2e1cbbcb
--- /dev/null
+++ b/include/linux/platform_data/spear_thermal.h
@@ -0,0 +1,26 @@
1/*
2 * SPEAr thermal driver platform data.
3 *
4 * Copyright (C) 2011-2012 ST Microelectronics
5 * Author: Vincenzo Frascino <vincenzo.frascino@st.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
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 */
17#ifndef SPEAR_THERMAL_H
18#define SPEAR_THERMAL_H
19
20/* SPEAr Thermal Sensor Platform Data */
21struct spear_thermal_pdata {
22 /* flags used to enable thermal sensor */
23 unsigned int thermal_flags;
24};
25
26#endif /* SPEAR_THERMAL_H */
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 2e9191a712f3..233149cb19f4 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -8,6 +8,7 @@
8#include <linux/notifier.h> 8#include <linux/notifier.h>
9#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
10#include <linux/device.h> 10#include <linux/device.h>
11#include <linux/workqueue.h>
11 12
12enum { 13enum {
13 PM_QOS_RESERVED = 0, 14 PM_QOS_RESERVED = 0,
@@ -29,6 +30,7 @@ enum {
29struct pm_qos_request { 30struct pm_qos_request {
30 struct plist_node node; 31 struct plist_node node;
31 int pm_qos_class; 32 int pm_qos_class;
33 struct delayed_work work; /* for pm_qos_update_request_timeout */
32}; 34};
33 35
34struct dev_pm_qos_request { 36struct dev_pm_qos_request {
@@ -73,6 +75,8 @@ void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
73 s32 value); 75 s32 value);
74void pm_qos_update_request(struct pm_qos_request *req, 76void pm_qos_update_request(struct pm_qos_request *req,
75 s32 new_value); 77 s32 new_value);
78void pm_qos_update_request_timeout(struct pm_qos_request *req,
79 s32 new_value, unsigned long timeout_us);
76void pm_qos_remove_request(struct pm_qos_request *req); 80void pm_qos_remove_request(struct pm_qos_request *req);
77 81
78int pm_qos_request(int pm_qos_class); 82int pm_qos_request(int pm_qos_class);
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index fe99211fb2b8..e01b167e66f0 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -27,6 +27,8 @@
27#define MAX17042_BATTERY_FULL (100) 27#define MAX17042_BATTERY_FULL (100)
28#define MAX17042_DEFAULT_SNS_RESISTOR (10000) 28#define MAX17042_DEFAULT_SNS_RESISTOR (10000)
29 29
30#define MAX17042_CHARACTERIZATION_DATA_SIZE 48
31
30enum max17042_register { 32enum max17042_register {
31 MAX17042_STATUS = 0x00, 33 MAX17042_STATUS = 0x00,
32 MAX17042_VALRT_Th = 0x01, 34 MAX17042_VALRT_Th = 0x01,
@@ -40,11 +42,11 @@ enum max17042_register {
40 MAX17042_VCELL = 0x09, 42 MAX17042_VCELL = 0x09,
41 MAX17042_Current = 0x0A, 43 MAX17042_Current = 0x0A,
42 MAX17042_AvgCurrent = 0x0B, 44 MAX17042_AvgCurrent = 0x0B,
43 MAX17042_Qresidual = 0x0C, 45
44 MAX17042_SOC = 0x0D, 46 MAX17042_SOC = 0x0D,
45 MAX17042_AvSOC = 0x0E, 47 MAX17042_AvSOC = 0x0E,
46 MAX17042_RemCap = 0x0F, 48 MAX17042_RemCap = 0x0F,
47 MAX17402_FullCAP = 0x10, 49 MAX17042_FullCAP = 0x10,
48 MAX17042_TTE = 0x11, 50 MAX17042_TTE = 0x11,
49 MAX17042_V_empty = 0x12, 51 MAX17042_V_empty = 0x12,
50 52
@@ -62,14 +64,14 @@ enum max17042_register {
62 MAX17042_AvCap = 0x1F, 64 MAX17042_AvCap = 0x1F,
63 MAX17042_ManName = 0x20, 65 MAX17042_ManName = 0x20,
64 MAX17042_DevName = 0x21, 66 MAX17042_DevName = 0x21,
65 MAX17042_DevChem = 0x22,
66 67
68 MAX17042_FullCAPNom = 0x23,
67 MAX17042_TempNom = 0x24, 69 MAX17042_TempNom = 0x24,
68 MAX17042_TempCold = 0x25, 70 MAX17042_TempLim = 0x25,
69 MAX17042_TempHot = 0x26, 71 MAX17042_TempHot = 0x26,
70 MAX17042_AIN = 0x27, 72 MAX17042_AIN = 0x27,
71 MAX17042_LearnCFG = 0x28, 73 MAX17042_LearnCFG = 0x28,
72 MAX17042_SHFTCFG = 0x29, 74 MAX17042_FilterCFG = 0x29,
73 MAX17042_RelaxCFG = 0x2A, 75 MAX17042_RelaxCFG = 0x2A,
74 MAX17042_MiscCFG = 0x2B, 76 MAX17042_MiscCFG = 0x2B,
75 MAX17042_TGAIN = 0x2C, 77 MAX17042_TGAIN = 0x2C,
@@ -77,22 +79,41 @@ enum max17042_register {
77 MAX17042_CGAIN = 0x2E, 79 MAX17042_CGAIN = 0x2E,
78 MAX17042_COFF = 0x2F, 80 MAX17042_COFF = 0x2F,
79 81
80 MAX17042_Q_empty = 0x33, 82 MAX17042_MaskSOC = 0x32,
83 MAX17042_SOC_empty = 0x33,
81 MAX17042_T_empty = 0x34, 84 MAX17042_T_empty = 0x34,
82 85
86 MAX17042_FullCAP0 = 0x35,
87 MAX17042_LAvg_empty = 0x36,
88 MAX17042_FCTC = 0x37,
83 MAX17042_RCOMP0 = 0x38, 89 MAX17042_RCOMP0 = 0x38,
84 MAX17042_TempCo = 0x39, 90 MAX17042_TempCo = 0x39,
85 MAX17042_Rx = 0x3A, 91 MAX17042_EmptyTempCo = 0x3A,
86 MAX17042_T_empty0 = 0x3B, 92 MAX17042_K_empty0 = 0x3B,
87 MAX17042_TaskPeriod = 0x3C, 93 MAX17042_TaskPeriod = 0x3C,
88 MAX17042_FSTAT = 0x3D, 94 MAX17042_FSTAT = 0x3D,
89 95
90 MAX17042_SHDNTIMER = 0x3F, 96 MAX17042_SHDNTIMER = 0x3F,
91 97
92 MAX17042_VFRemCap = 0x4A, 98 MAX17042_dQacc = 0x45,
99 MAX17042_dPacc = 0x46,
100
101 MAX17042_VFSOC0 = 0x48,
93 102
94 MAX17042_QH = 0x4D, 103 MAX17042_QH = 0x4D,
95 MAX17042_QL = 0x4E, 104 MAX17042_QL = 0x4E,
105
106 MAX17042_VFSOC0Enable = 0x60,
107 MAX17042_MLOCKReg1 = 0x62,
108 MAX17042_MLOCKReg2 = 0x63,
109
110 MAX17042_MODELChrTbl = 0x80,
111
112 MAX17042_OCV = 0xEE,
113
114 MAX17042_OCVInternal = 0xFB,
115
116 MAX17042_VFSOC = 0xFF,
96}; 117};
97 118
98/* 119/*
@@ -105,10 +126,64 @@ struct max17042_reg_data {
105 u16 data; 126 u16 data;
106}; 127};
107 128
129struct max17042_config_data {
130 /* External current sense resistor value in milli-ohms */
131 u32 cur_sense_val;
132
133 /* A/D measurement */
134 u16 tgain; /* 0x2C */
135 u16 toff; /* 0x2D */
136 u16 cgain; /* 0x2E */
137 u16 coff; /* 0x2F */
138
139 /* Alert / Status */
140 u16 valrt_thresh; /* 0x01 */
141 u16 talrt_thresh; /* 0x02 */
142 u16 soc_alrt_thresh; /* 0x03 */
143 u16 config; /* 0x01D */
144 u16 shdntimer; /* 0x03F */
145
146 /* App data */
147 u16 design_cap; /* 0x18 */
148 u16 ichgt_term; /* 0x1E */
149
150 /* MG3 config */
151 u16 at_rate; /* 0x04 */
152 u16 learn_cfg; /* 0x28 */
153 u16 filter_cfg; /* 0x29 */
154 u16 relax_cfg; /* 0x2A */
155 u16 misc_cfg; /* 0x2B */
156 u16 masksoc; /* 0x32 */
157
158 /* MG3 save and restore */
159 u16 fullcap; /* 0x10 */
160 u16 fullcapnom; /* 0x23 */
161 u16 socempty; /* 0x33 */
162 u16 lavg_empty; /* 0x36 */
163 u16 dqacc; /* 0x45 */
164 u16 dpacc; /* 0x46 */
165
166 /* Cell technology from power_supply.h */
167 u16 cell_technology;
168
169 /* Cell Data */
170 u16 vempty; /* 0x12 */
171 u16 temp_nom; /* 0x24 */
172 u16 temp_lim; /* 0x25 */
173 u16 fctc; /* 0x37 */
174 u16 rcomp0; /* 0x38 */
175 u16 tcompc0; /* 0x39 */
176 u16 empty_tempco; /* 0x3A */
177 u16 kempty0; /* 0x3B */
178 u16 cell_char_tbl[MAX17042_CHARACTERIZATION_DATA_SIZE];
179} __packed;
180
108struct max17042_platform_data { 181struct max17042_platform_data {
109 struct max17042_reg_data *init_data; 182 struct max17042_reg_data *init_data;
183 struct max17042_config_data *config_data;
110 int num_init_data; /* Number of enties in init_data array */ 184 int num_init_data; /* Number of enties in init_data array */
111 bool enable_current_sense; 185 bool enable_current_sense;
186 bool enable_por_init; /* Use POR init from Maxim appnote */
112 187
113 /* 188 /*
114 * R_sns in micro-ohms. 189 * R_sns in micro-ohms.
diff --git a/include/linux/power/smb347-charger.h b/include/linux/power/smb347-charger.h
new file mode 100644
index 000000000000..b3cb20dab55f
--- /dev/null
+++ b/include/linux/power/smb347-charger.h
@@ -0,0 +1,117 @@
1/*
2 * Summit Microelectronics SMB347 Battery Charger Driver
3 *
4 * Copyright (C) 2011, Intel Corporation
5 *
6 * Authors: Bruce E. Robertson <bruce.e.robertson@intel.com>
7 * Mika Westerberg <mika.westerberg@linux.intel.com>
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#ifndef SMB347_CHARGER_H
15#define SMB347_CHARGER_H
16
17#include <linux/types.h>
18#include <linux/power_supply.h>
19
20enum {
21 /* use the default compensation method */
22 SMB347_SOFT_TEMP_COMPENSATE_DEFAULT = -1,
23
24 SMB347_SOFT_TEMP_COMPENSATE_NONE,
25 SMB347_SOFT_TEMP_COMPENSATE_CURRENT,
26 SMB347_SOFT_TEMP_COMPENSATE_VOLTAGE,
27};
28
29/* Use default factory programmed value for hard/soft temperature limit */
30#define SMB347_TEMP_USE_DEFAULT -273
31
32/*
33 * Charging enable can be controlled by software (via i2c) by
34 * smb347-charger driver or by EN pin (active low/high).
35 */
36enum smb347_chg_enable {
37 SMB347_CHG_ENABLE_SW,
38 SMB347_CHG_ENABLE_PIN_ACTIVE_LOW,
39 SMB347_CHG_ENABLE_PIN_ACTIVE_HIGH,
40};
41
42/**
43 * struct smb347_charger_platform_data - platform data for SMB347 charger
44 * @battery_info: Information about the battery
45 * @max_charge_current: maximum current (in uA) the battery can be charged
46 * @max_charge_voltage: maximum voltage (in uV) the battery can be charged
47 * @pre_charge_current: current (in uA) to use in pre-charging phase
48 * @termination_current: current (in uA) used to determine when the
49 * charging cycle terminates
50 * @pre_to_fast_voltage: voltage (in uV) treshold used for transitioning to
51 * pre-charge to fast charge mode
52 * @mains_current_limit: maximum input current drawn from AC/DC input (in uA)
53 * @usb_hc_current_limit: maximum input high current (in uA) drawn from USB
54 * input
55 * @chip_temp_threshold: die temperature where device starts limiting charge
56 * current [%100 - %130] (in degree C)
57 * @soft_cold_temp_limit: soft cold temperature limit [%0 - %15] (in degree C),
58 * granularity is 5 deg C.
59 * @soft_hot_temp_limit: soft hot temperature limit [%40 - %55] (in degree C),
60 * granularity is 5 deg C.
61 * @hard_cold_temp_limit: hard cold temperature limit [%-5 - %10] (in degree C),
62 * granularity is 5 deg C.
63 * @hard_hot_temp_limit: hard hot temperature limit [%50 - %65] (in degree C),
64 * granularity is 5 deg C.
65 * @suspend_on_hard_temp_limit: suspend charging when hard limit is hit
66 * @soft_temp_limit_compensation: compensation method when soft temperature
67 * limit is hit
68 * @charge_current_compensation: current (in uA) for charging compensation
69 * current when temperature hits soft limits
70 * @use_mains: AC/DC input can be used
71 * @use_usb: USB input can be used
72 * @use_usb_otg: USB OTG output can be used (not implemented yet)
73 * @irq_gpio: GPIO number used for interrupts (%-1 if not used)
74 * @enable_control: how charging enable/disable is controlled
75 * (driver/pin controls)
76 *
77 * @use_main, @use_usb, and @use_usb_otg are means to enable/disable
78 * hardware support for these. This is useful when we want to have for
79 * example OTG charging controlled via OTG transceiver driver and not by
80 * the SMB347 hardware.
81 *
82 * Hard and soft temperature limit values are given as described in the
83 * device data sheet and assuming NTC beta value is %3750. Even if this is
84 * not the case, these values should be used. They can be mapped to the
85 * corresponding NTC beta values with the help of table %2 in the data
86 * sheet. So for example if NTC beta is %3375 and we want to program hard
87 * hot limit to be %53 deg C, @hard_hot_temp_limit should be set to %50.
88 *
89 * If zero value is given in any of the current and voltage values, the
90 * factory programmed default will be used. For soft/hard temperature
91 * values, pass in %SMB347_TEMP_USE_DEFAULT instead.
92 */
93struct smb347_charger_platform_data {
94 struct power_supply_info battery_info;
95 unsigned int max_charge_current;
96 unsigned int max_charge_voltage;
97 unsigned int pre_charge_current;
98 unsigned int termination_current;
99 unsigned int pre_to_fast_voltage;
100 unsigned int mains_current_limit;
101 unsigned int usb_hc_current_limit;
102 unsigned int chip_temp_threshold;
103 int soft_cold_temp_limit;
104 int soft_hot_temp_limit;
105 int hard_cold_temp_limit;
106 int hard_hot_temp_limit;
107 bool suspend_on_hard_temp_limit;
108 unsigned int soft_temp_limit_compensation;
109 unsigned int charge_current_compensation;
110 bool use_mains;
111 bool use_usb;
112 bool use_usb_otg;
113 int irq_gpio;
114 enum smb347_chg_enable enable_control;
115};
116
117#endif /* SMB347_CHARGER_H */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index e9a48234e693..0d04cd69ab9b 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -2,6 +2,7 @@
2 * Copyright (C) 2001 Momchil Velikov 2 * Copyright (C) 2001 Momchil Velikov
3 * Portions Copyright (C) 2001 Christoph Hellwig 3 * Portions Copyright (C) 2001 Christoph Hellwig
4 * Copyright (C) 2006 Nick Piggin 4 * Copyright (C) 2006 Nick Piggin
5 * Copyright (C) 2012 Konstantin Khlebnikov
5 * 6 *
6 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
@@ -257,4 +258,199 @@ static inline void radix_tree_preload_end(void)
257 preempt_enable(); 258 preempt_enable();
258} 259}
259 260
261/**
262 * struct radix_tree_iter - radix tree iterator state
263 *
264 * @index: index of current slot
265 * @next_index: next-to-last index for this chunk
266 * @tags: bit-mask for tag-iterating
267 *
268 * This radix tree iterator works in terms of "chunks" of slots. A chunk is a
269 * subinterval of slots contained within one radix tree leaf node. It is
270 * described by a pointer to its first slot and a struct radix_tree_iter
271 * which holds the chunk's position in the tree and its size. For tagged
272 * iteration radix_tree_iter also holds the slots' bit-mask for one chosen
273 * radix tree tag.
274 */
275struct radix_tree_iter {
276 unsigned long index;
277 unsigned long next_index;
278 unsigned long tags;
279};
280
281#define RADIX_TREE_ITER_TAG_MASK 0x00FF /* tag index in lower byte */
282#define RADIX_TREE_ITER_TAGGED 0x0100 /* lookup tagged slots */
283#define RADIX_TREE_ITER_CONTIG 0x0200 /* stop at first hole */
284
285/**
286 * radix_tree_iter_init - initialize radix tree iterator
287 *
288 * @iter: pointer to iterator state
289 * @start: iteration starting index
290 * Returns: NULL
291 */
292static __always_inline void **
293radix_tree_iter_init(struct radix_tree_iter *iter, unsigned long start)
294{
295 /*
296 * Leave iter->tags uninitialized. radix_tree_next_chunk() will fill it
297 * in the case of a successful tagged chunk lookup. If the lookup was
298 * unsuccessful or non-tagged then nobody cares about ->tags.
299 *
300 * Set index to zero to bypass next_index overflow protection.
301 * See the comment in radix_tree_next_chunk() for details.
302 */
303 iter->index = 0;
304 iter->next_index = start;
305 return NULL;
306}
307
308/**
309 * radix_tree_next_chunk - find next chunk of slots for iteration
310 *
311 * @root: radix tree root
312 * @iter: iterator state
313 * @flags: RADIX_TREE_ITER_* flags and tag index
314 * Returns: pointer to chunk first slot, or NULL if there no more left
315 *
316 * This function looks up the next chunk in the radix tree starting from
317 * @iter->next_index. It returns a pointer to the chunk's first slot.
318 * Also it fills @iter with data about chunk: position in the tree (index),
319 * its end (next_index), and constructs a bit mask for tagged iterating (tags).
320 */
321void **radix_tree_next_chunk(struct radix_tree_root *root,
322 struct radix_tree_iter *iter, unsigned flags);
323
324/**
325 * radix_tree_chunk_size - get current chunk size
326 *
327 * @iter: pointer to radix tree iterator
328 * Returns: current chunk size
329 */
330static __always_inline unsigned
331radix_tree_chunk_size(struct radix_tree_iter *iter)
332{
333 return iter->next_index - iter->index;
334}
335
336/**
337 * radix_tree_next_slot - find next slot in chunk
338 *
339 * @slot: pointer to current slot
340 * @iter: pointer to interator state
341 * @flags: RADIX_TREE_ITER_*, should be constant
342 * Returns: pointer to next slot, or NULL if there no more left
343 *
344 * This function updates @iter->index in the case of a successful lookup.
345 * For tagged lookup it also eats @iter->tags.
346 */
347static __always_inline void **
348radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags)
349{
350 if (flags & RADIX_TREE_ITER_TAGGED) {
351 iter->tags >>= 1;
352 if (likely(iter->tags & 1ul)) {
353 iter->index++;
354 return slot + 1;
355 }
356 if (!(flags & RADIX_TREE_ITER_CONTIG) && likely(iter->tags)) {
357 unsigned offset = __ffs(iter->tags);
358
359 iter->tags >>= offset;
360 iter->index += offset + 1;
361 return slot + offset + 1;
362 }
363 } else {
364 unsigned size = radix_tree_chunk_size(iter) - 1;
365
366 while (size--) {
367 slot++;
368 iter->index++;
369 if (likely(*slot))
370 return slot;
371 if (flags & RADIX_TREE_ITER_CONTIG)
372 break;
373 }
374 }
375 return NULL;
376}
377
378/**
379 * radix_tree_for_each_chunk - iterate over chunks
380 *
381 * @slot: the void** variable for pointer to chunk first slot
382 * @root: the struct radix_tree_root pointer
383 * @iter: the struct radix_tree_iter pointer
384 * @start: iteration starting index
385 * @flags: RADIX_TREE_ITER_* and tag index
386 *
387 * Locks can be released and reacquired between iterations.
388 */
389#define radix_tree_for_each_chunk(slot, root, iter, start, flags) \
390 for (slot = radix_tree_iter_init(iter, start) ; \
391 (slot = radix_tree_next_chunk(root, iter, flags)) ;)
392
393/**
394 * radix_tree_for_each_chunk_slot - iterate over slots in one chunk
395 *
396 * @slot: the void** variable, at the beginning points to chunk first slot
397 * @iter: the struct radix_tree_iter pointer
398 * @flags: RADIX_TREE_ITER_*, should be constant
399 *
400 * This macro is designed to be nested inside radix_tree_for_each_chunk().
401 * @slot points to the radix tree slot, @iter->index contains its index.
402 */
403#define radix_tree_for_each_chunk_slot(slot, iter, flags) \
404 for (; slot ; slot = radix_tree_next_slot(slot, iter, flags))
405
406/**
407 * radix_tree_for_each_slot - iterate over non-empty slots
408 *
409 * @slot: the void** variable for pointer to slot
410 * @root: the struct radix_tree_root pointer
411 * @iter: the struct radix_tree_iter pointer
412 * @start: iteration starting index
413 *
414 * @slot points to radix tree slot, @iter->index contains its index.
415 */
416#define radix_tree_for_each_slot(slot, root, iter, start) \
417 for (slot = radix_tree_iter_init(iter, start) ; \
418 slot || (slot = radix_tree_next_chunk(root, iter, 0)) ; \
419 slot = radix_tree_next_slot(slot, iter, 0))
420
421/**
422 * radix_tree_for_each_contig - iterate over contiguous slots
423 *
424 * @slot: the void** variable for pointer to slot
425 * @root: the struct radix_tree_root pointer
426 * @iter: the struct radix_tree_iter pointer
427 * @start: iteration starting index
428 *
429 * @slot points to radix tree slot, @iter->index contains its index.
430 */
431#define radix_tree_for_each_contig(slot, root, iter, start) \
432 for (slot = radix_tree_iter_init(iter, start) ; \
433 slot || (slot = radix_tree_next_chunk(root, iter, \
434 RADIX_TREE_ITER_CONTIG)) ; \
435 slot = radix_tree_next_slot(slot, iter, \
436 RADIX_TREE_ITER_CONTIG))
437
438/**
439 * radix_tree_for_each_tagged - iterate over tagged slots
440 *
441 * @slot: the void** variable for pointer to slot
442 * @root: the struct radix_tree_root pointer
443 * @iter: the struct radix_tree_iter pointer
444 * @start: iteration starting index
445 * @tag: tag index
446 *
447 * @slot points to radix tree slot, @iter->index contains its index.
448 */
449#define radix_tree_for_each_tagged(slot, root, iter, start, tag) \
450 for (slot = radix_tree_iter_init(iter, start) ; \
451 slot || (slot = radix_tree_next_chunk(root, iter, \
452 RADIX_TREE_ITER_TAGGED | tag)) ; \
453 slot = radix_tree_next_slot(slot, iter, \
454 RADIX_TREE_ITER_TAGGED))
455
260#endif /* _LINUX_RADIX_TREE_H */ 456#endif /* _LINUX_RADIX_TREE_H */
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 76579f964a29..7bd73bbdfd1b 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -26,7 +26,26 @@ enum ab8500_regulator_id {
26 AB8500_NUM_REGULATORS, 26 AB8500_NUM_REGULATORS,
27}; 27};
28 28
29/* AB8500 register initialization */ 29/* AB9450 regulators */
30enum ab9540_regulator_id {
31 AB9540_LDO_AUX1,
32 AB9540_LDO_AUX2,
33 AB9540_LDO_AUX3,
34 AB9540_LDO_AUX4,
35 AB9540_LDO_INTCORE,
36 AB9540_LDO_TVOUT,
37 AB9540_LDO_USB,
38 AB9540_LDO_AUDIO,
39 AB9540_LDO_ANAMIC1,
40 AB9540_LDO_ANAMIC2,
41 AB9540_LDO_DMIC,
42 AB9540_LDO_ANA,
43 AB9540_SYSCLKREQ_2,
44 AB9540_SYSCLKREQ_4,
45 AB9540_NUM_REGULATORS,
46};
47
48/* AB8500 and AB9540 register initialization */
30struct ab8500_regulator_reg_init { 49struct ab8500_regulator_reg_init {
31 int id; 50 int id;
32 u8 value; 51 u8 value;
@@ -71,4 +90,53 @@ enum ab8500_regulator_reg {
71 AB8500_NUM_REGULATOR_REGISTERS, 90 AB8500_NUM_REGULATOR_REGISTERS,
72}; 91};
73 92
93
94/* AB9540 registers */
95enum ab9540_regulator_reg {
96 AB9540_REGUREQUESTCTRL1,
97 AB9540_REGUREQUESTCTRL2,
98 AB9540_REGUREQUESTCTRL3,
99 AB9540_REGUREQUESTCTRL4,
100 AB9540_REGUSYSCLKREQ1HPVALID1,
101 AB9540_REGUSYSCLKREQ1HPVALID2,
102 AB9540_REGUHWHPREQ1VALID1,
103 AB9540_REGUHWHPREQ1VALID2,
104 AB9540_REGUHWHPREQ2VALID1,
105 AB9540_REGUHWHPREQ2VALID2,
106 AB9540_REGUSWHPREQVALID1,
107 AB9540_REGUSWHPREQVALID2,
108 AB9540_REGUSYSCLKREQVALID1,
109 AB9540_REGUSYSCLKREQVALID2,
110 AB9540_REGUVAUX4REQVALID,
111 AB9540_REGUMISC1,
112 AB9540_VAUDIOSUPPLY,
113 AB9540_REGUCTRL1VAMIC,
114 AB9540_VSMPS1REGU,
115 AB9540_VSMPS2REGU,
116 AB9540_VSMPS3REGU, /* NOTE! PRCMU register */
117 AB9540_VPLLVANAREGU,
118 AB9540_EXTSUPPLYREGU,
119 AB9540_VAUX12REGU,
120 AB9540_VRF1VAUX3REGU,
121 AB9540_VSMPS1SEL1,
122 AB9540_VSMPS1SEL2,
123 AB9540_VSMPS1SEL3,
124 AB9540_VSMPS2SEL1,
125 AB9540_VSMPS2SEL2,
126 AB9540_VSMPS2SEL3,
127 AB9540_VSMPS3SEL1, /* NOTE! PRCMU register */
128 AB9540_VSMPS3SEL2, /* NOTE! PRCMU register */
129 AB9540_VAUX1SEL,
130 AB9540_VAUX2SEL,
131 AB9540_VRF1VAUX3SEL,
132 AB9540_REGUCTRL2SPARE,
133 AB9540_VAUX4REQCTRL,
134 AB9540_VAUX4REGU,
135 AB9540_VAUX4SEL,
136 AB9540_REGUCTRLDISCH,
137 AB9540_REGUCTRLDISCH2,
138 AB9540_REGUCTRLDISCH3,
139 AB9540_NUM_REGULATOR_REGISTERS,
140};
141
74#endif 142#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 7abb16093312..b02108446be7 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -71,7 +71,7 @@ struct regulator_state {
71 * @uV_offset: Offset applied to voltages from consumer to compensate for 71 * @uV_offset: Offset applied to voltages from consumer to compensate for
72 * voltage drops. 72 * voltage drops.
73 * 73 *
74 * @min_uA: Smallest consumers consumers may set. 74 * @min_uA: Smallest current consumers may set.
75 * @max_uA: Largest current consumers may set. 75 * @max_uA: Largest current consumers may set.
76 * 76 *
77 * @valid_modes_mask: Mask of modes which may be configured by consumers. 77 * @valid_modes_mask: Mask of modes which may be configured by consumers.
@@ -134,10 +134,8 @@ struct regulation_constraints {
134/** 134/**
135 * struct regulator_consumer_supply - supply -> device mapping 135 * struct regulator_consumer_supply - supply -> device mapping
136 * 136 *
137 * This maps a supply name to a device. Only one of dev or dev_name 137 * This maps a supply name to a device. Use of dev_name allows support for
138 * can be specified. Use of dev_name allows support for buses which 138 * buses which make struct device available late such as I2C.
139 * make struct device available late such as I2C and is the preferred
140 * form.
141 * 139 *
142 * @dev_name: Result of dev_name() for the consumer. 140 * @dev_name: Result of dev_name() for the consumer.
143 * @supply: Name for the supply. 141 * @supply: Name for the supply.
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 67be0376d8e3..7be2e88f23fd 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -151,6 +151,9 @@ int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu);
151 151
152void ring_buffer_record_disable(struct ring_buffer *buffer); 152void ring_buffer_record_disable(struct ring_buffer *buffer);
153void ring_buffer_record_enable(struct ring_buffer *buffer); 153void ring_buffer_record_enable(struct ring_buffer *buffer);
154void ring_buffer_record_off(struct ring_buffer *buffer);
155void ring_buffer_record_on(struct ring_buffer *buffer);
156int ring_buffer_record_is_on(struct ring_buffer *buffer);
154void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); 157void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu);
155void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); 158void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
156 159
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 93f4d035076b..fcabfb4873c8 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -202,7 +202,8 @@ struct rtc_device
202 struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ 202 struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */
203 int pie_enabled; 203 int pie_enabled;
204 struct work_struct irqwork; 204 struct work_struct irqwork;
205 205 /* Some hardware can't support UIE mode */
206 int uie_unsupported;
206 207
207#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL 208#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
208 struct work_struct uie_task; 209 struct work_struct uie_task;
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 63d406554391..54bd7cd7ecbd 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -14,7 +14,6 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16 16
17#include <asm/system.h>
18#include <linux/atomic.h> 17#include <linux/atomic.h>
19 18
20struct rw_semaphore; 19struct rw_semaphore;
diff --git a/include/linux/sa11x0-dma.h b/include/linux/sa11x0-dma.h
new file mode 100644
index 000000000000..65839a58b8e5
--- /dev/null
+++ b/include/linux/sa11x0-dma.h
@@ -0,0 +1,24 @@
1/*
2 * SA11x0 DMA Engine support
3 *
4 * Copyright (C) 2012 Russell King
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#ifndef __LINUX_SA11X0_DMA_H
11#define __LINUX_SA11X0_DMA_H
12
13struct dma_chan;
14
15#if defined(CONFIG_DMA_SA11X0) || defined(CONFIG_DMA_SA11X0_MODULE)
16bool sa11x0_dma_filter_fn(struct dma_chan *, void *);
17#else
18static inline bool sa11x0_dma_filter_fn(struct dma_chan *c, void *d)
19{
20 return false;
21}
22#endif
23
24#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0c3854b0d4b1..81a173c0897d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -63,7 +63,6 @@ struct sched_param {
63#include <linux/nodemask.h> 63#include <linux/nodemask.h>
64#include <linux/mm_types.h> 64#include <linux/mm_types.h>
65 65
66#include <asm/system.h>
67#include <asm/page.h> 66#include <asm/page.h>
68#include <asm/ptrace.h> 67#include <asm/ptrace.h>
69#include <asm/cputime.h> 68#include <asm/cputime.h>
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index b160645f5599..6aed0805927f 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -3,6 +3,23 @@
3 3
4#include <linux/ioport.h> 4#include <linux/ioport.h>
5 5
6#ifdef CONFIG_SUPERH
7#define INTC_NR_IRQS 512
8#else
9#define INTC_NR_IRQS 1024
10#endif
11
12/*
13 * Convert back and forth between INTEVT and IRQ values.
14 */
15#ifdef CONFIG_CPU_HAS_INTEVT
16#define evt2irq(evt) (((evt) >> 5) - 16)
17#define irq2evt(irq) (((irq) + 16) << 5)
18#else
19#define evt2irq(evt) (evt)
20#define irq2evt(irq) (irq)
21#endif
22
6typedef unsigned char intc_enum; 23typedef unsigned char intc_enum;
7 24
8struct intc_vect { 25struct intc_vect {
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 192250bd49f5..33370271b8b2 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -501,7 +501,6 @@ struct sk_buff {
501 */ 501 */
502#include <linux/slab.h> 502#include <linux/slab.h>
503 503
504#include <asm/system.h>
505 504
506/* 505/*
507 * skb might have a dst pointer attached, refcounted or not. 506 * skb might have a dst pointer attached, refcounted or not.
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 573c809c33d9..a595dce6b0c7 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -190,7 +190,7 @@ size_t ksize(const void *);
190#endif 190#endif
191 191
192/** 192/**
193 * kcalloc - allocate memory for an array. The memory is set to zero. 193 * kmalloc_array - allocate memory for an array.
194 * @n: number of elements. 194 * @n: number of elements.
195 * @size: element size. 195 * @size: element size.
196 * @flags: the type of memory to allocate. 196 * @flags: the type of memory to allocate.
@@ -240,11 +240,22 @@ size_t ksize(const void *);
240 * for general use, and so are not documented here. For a full list of 240 * for general use, and so are not documented here. For a full list of
241 * potential flags, always refer to linux/gfp.h. 241 * potential flags, always refer to linux/gfp.h.
242 */ 242 */
243static inline void *kcalloc(size_t n, size_t size, gfp_t flags) 243static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
244{ 244{
245 if (size != 0 && n > ULONG_MAX / size) 245 if (size != 0 && n > ULONG_MAX / size)
246 return NULL; 246 return NULL;
247 return __kmalloc(n * size, flags | __GFP_ZERO); 247 return __kmalloc(n * size, flags);
248}
249
250/**
251 * kcalloc - allocate memory for an array. The memory is set to zero.
252 * @n: number of elements.
253 * @size: element size.
254 * @flags: the type of memory to allocate (see kmalloc).
255 */
256static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
257{
258 return kmalloc_array(n, size, flags | __GFP_ZERO);
248} 259}
249 260
250#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB) 261#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB)
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index ca122b36aec1..c2f8c8bc56ed 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -22,7 +22,7 @@ enum stat_item {
22 FREE_FROZEN, /* Freeing to frozen slab */ 22 FREE_FROZEN, /* Freeing to frozen slab */
23 FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ 23 FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */
24 FREE_REMOVE_PARTIAL, /* Freeing removes last object */ 24 FREE_REMOVE_PARTIAL, /* Freeing removes last object */
25 ALLOC_FROM_PARTIAL, /* Cpu slab acquired from partial list */ 25 ALLOC_FROM_PARTIAL, /* Cpu slab acquired from node partial list */
26 ALLOC_SLAB, /* Cpu slab acquired from page allocator */ 26 ALLOC_SLAB, /* Cpu slab acquired from page allocator */
27 ALLOC_REFILL, /* Refill cpu slab from slab freelist */ 27 ALLOC_REFILL, /* Refill cpu slab from slab freelist */
28 ALLOC_NODE_MISMATCH, /* Switching cpu slab */ 28 ALLOC_NODE_MISMATCH, /* Switching cpu slab */
@@ -38,7 +38,9 @@ enum stat_item {
38 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */ 38 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */
39 CMPXCHG_DOUBLE_FAIL, /* Number of times that cmpxchg double did not match */ 39 CMPXCHG_DOUBLE_FAIL, /* Number of times that cmpxchg double did not match */
40 CPU_PARTIAL_ALLOC, /* Used cpu partial on alloc */ 40 CPU_PARTIAL_ALLOC, /* Used cpu partial on alloc */
41 CPU_PARTIAL_FREE, /* USed cpu partial on free */ 41 CPU_PARTIAL_FREE, /* Refill cpu partial on free */
42 CPU_PARTIAL_NODE, /* Refill cpu partial from node partial */
43 CPU_PARTIAL_DRAIN, /* Drain cpu partial to node partial */
42 NR_SLUB_STAT_ITEMS }; 44 NR_SLUB_STAT_ITEMS };
43 45
44struct kmem_cache_cpu { 46struct kmem_cache_cpu {
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8cc38d3bab0c..10530d92c04b 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -102,6 +102,22 @@ static inline void call_function_init(void) { }
102int on_each_cpu(smp_call_func_t func, void *info, int wait); 102int on_each_cpu(smp_call_func_t func, void *info, int wait);
103 103
104/* 104/*
105 * Call a function on processors specified by mask, which might include
106 * the local one.
107 */
108void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
109 void *info, bool wait);
110
111/*
112 * Call a function on each processor for which the supplied function
113 * cond_func returns a positive value. This may include the local
114 * processor.
115 */
116void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
117 smp_call_func_t func, void *info, bool wait,
118 gfp_t gfp_flags);
119
120/*
105 * Mark the boot cpu "online" so that it can call console drivers in 121 * Mark the boot cpu "online" so that it can call console drivers in
106 * printk() and can access its per-cpu storage. 122 * printk() and can access its per-cpu storage.
107 */ 123 */
@@ -132,6 +148,36 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
132 local_irq_enable(); \ 148 local_irq_enable(); \
133 0; \ 149 0; \
134 }) 150 })
151/*
152 * Note we still need to test the mask even for UP
153 * because we actually can get an empty mask from
154 * code that on SMP might call us without the local
155 * CPU in the mask.
156 */
157#define on_each_cpu_mask(mask, func, info, wait) \
158 do { \
159 if (cpumask_test_cpu(0, (mask))) { \
160 local_irq_disable(); \
161 (func)(info); \
162 local_irq_enable(); \
163 } \
164 } while (0)
165/*
166 * Preemption is disabled here to make sure the cond_func is called under the
167 * same condtions in UP and SMP.
168 */
169#define on_each_cpu_cond(cond_func, func, info, wait, gfp_flags)\
170 do { \
171 void *__info = (info); \
172 preempt_disable(); \
173 if ((cond_func)(0, __info)) { \
174 local_irq_disable(); \
175 (func)(__info); \
176 local_irq_enable(); \
177 } \
178 preempt_enable(); \
179 } while (0)
180
135static inline void smp_send_reschedule(int cpu) { } 181static inline void smp_send_reschedule(int cpu) { }
136#define num_booting_cpus() 1 182#define num_booting_cpus() 1
137#define smp_prepare_boot_cpu() do {} while (0) 183#define smp_prepare_boot_cpu() do {} while (0)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index da2d3e2543f3..b84bbd48b874 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -265,7 +265,7 @@ struct ucred {
265#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ 265#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */
266#define MSG_MORE 0x8000 /* Sender will send more */ 266#define MSG_MORE 0x8000 /* Sender will send more */
267#define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */ 267#define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */
268 268#define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */
269#define MSG_EOF MSG_FIN 269#define MSG_EOF MSG_FIN
270 270
271#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file 271#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h
index decf6d8c77b7..b4d9fa6f797c 100644
--- a/include/linux/spi/orion_spi.h
+++ b/include/linux/spi/orion_spi.h
@@ -11,7 +11,6 @@
11 11
12struct orion_spi_info { 12struct orion_spi_info {
13 u32 tclk; /* no <linux/clk.h> support yet */ 13 u32 tclk; /* no <linux/clk.h> support yet */
14 u32 enable_clock_fix;
15}; 14};
16 15
17 16
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 363239087263..7d537ced949a 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -55,8 +55,8 @@
55#include <linux/kernel.h> 55#include <linux/kernel.h>
56#include <linux/stringify.h> 56#include <linux/stringify.h>
57#include <linux/bottom_half.h> 57#include <linux/bottom_half.h>
58#include <asm/barrier.h>
58 59
59#include <asm/system.h>
60 60
61/* 61/*
62 * Must define these before including other files, inline functions need them 62 * Must define these before including other files, inline functions need them
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index e253ccd7a604..51df117abe46 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -67,7 +67,7 @@ _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags)
67#define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock) 67#define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock)
68#endif 68#endif
69 69
70#ifdef CONFIG_INLINE_SPIN_UNLOCK 70#ifndef CONFIG_UNINLINE_SPIN_UNLOCK
71#define _raw_spin_unlock(lock) __raw_spin_unlock(lock) 71#define _raw_spin_unlock(lock) __raw_spin_unlock(lock)
72#endif 72#endif
73 73
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index c170edc3bf5f..3b5e910d14ca 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -5,7 +5,6 @@
5#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/smp.h> 6#include <linux/smp.h>
7#include <linux/list.h> 7#include <linux/list.h>
8#include <asm/system.h>
9 8
10/* 9/*
11 * stop_cpu[s]() is simplistic per-cpu maximum priority cpu 10 * stop_cpu[s]() is simplistic per-cpu maximum priority cpu
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index c14fe86dac59..0b8e3e6bdacf 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -190,7 +190,7 @@ extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *,
190extern void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *, int); 190extern void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *, int);
191extern void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *, int); 191extern void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *, int);
192extern void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *, int, 192extern void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *, int,
193 u32, u64, u32); 193 __be32, __be64, u32);
194extern void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *, 194extern void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *,
195 struct rpcrdma_msg *, 195 struct rpcrdma_msg *,
196 struct rpcrdma_msg *, 196 struct rpcrdma_msg *,
@@ -292,7 +292,7 @@ svc_rdma_get_reply_array(struct rpcrdma_msg *rmsgp)
292 if (wr_ary) { 292 if (wr_ary) {
293 rp_ary = (struct rpcrdma_write_array *) 293 rp_ary = (struct rpcrdma_write_array *)
294 &wr_ary-> 294 &wr_ary->
295 wc_array[wr_ary->wc_nchunks].wc_target.rs_length; 295 wc_array[ntohl(wr_ary->wc_nchunks)].wc_target.rs_length;
296 296
297 goto found_it; 297 goto found_it;
298 } 298 }
diff --git a/include/linux/swap.h b/include/linux/swap.h
index b86b5c20617d..b1fd5c7925fe 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -21,6 +21,9 @@ struct bio;
21#define SWAP_FLAG_PRIO_SHIFT 0 21#define SWAP_FLAG_PRIO_SHIFT 0
22#define SWAP_FLAG_DISCARD 0x10000 /* discard swap cluster after use */ 22#define SWAP_FLAG_DISCARD 0x10000 /* discard swap cluster after use */
23 23
24#define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \
25 SWAP_FLAG_DISCARD)
26
24static inline int current_is_kswapd(void) 27static inline int current_is_kswapd(void)
25{ 28{
26 return current->flags & PF_KSWAPD; 29 return current->flags & PF_KSWAPD;
@@ -302,6 +305,13 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
302 return vm_swappiness; 305 return vm_swappiness;
303} 306}
304#endif 307#endif
308#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
309extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
310#else
311static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
312{
313}
314#endif
305#ifdef CONFIG_SWAP 315#ifdef CONFIG_SWAP
306/* linux/mm/page_io.c */ 316/* linux/mm/page_io.c */
307extern int swap_readpage(struct page *); 317extern int swap_readpage(struct page *);
@@ -372,13 +382,6 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
372{ 382{
373} 383}
374#endif 384#endif
375#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
376extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
377#else
378static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
379{
380}
381#endif
382 385
383#else /* CONFIG_SWAP */ 386#else /* CONFIG_SWAP */
384 387
diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h
new file mode 100644
index 000000000000..934335a22522
--- /dev/null
+++ b/include/linux/sysinfo.h
@@ -0,0 +1,24 @@
1#ifndef _LINUX_SYSINFO_H
2#define _LINUX_SYSINFO_H
3
4#include <linux/types.h>
5
6#define SI_LOAD_SHIFT 16
7struct sysinfo {
8 __kernel_long_t uptime; /* Seconds since boot */
9 __kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */
10 __kernel_ulong_t totalram; /* Total usable main memory size */
11 __kernel_ulong_t freeram; /* Available memory size */
12 __kernel_ulong_t sharedram; /* Amount of shared memory */
13 __kernel_ulong_t bufferram; /* Memory used by buffers */
14 __kernel_ulong_t totalswap; /* Total swap space size */
15 __kernel_ulong_t freeswap; /* swap space still available */
16 __u16 procs; /* Number of current processes */
17 __u16 pad; /* Explicit padding for m68k */
18 __kernel_ulong_t totalhigh; /* Total high memory size */
19 __kernel_ulong_t freehigh; /* Available high memory size */
20 __u32 mem_unit; /* Memory unit size in bytes */
21 char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */
22};
23
24#endif /* _LINUX_SYSINFO_H */
diff --git a/include/linux/tboot.h b/include/linux/tboot.h
index 1dba6ee55203..c75128bed5fa 100644
--- a/include/linux/tboot.h
+++ b/include/linux/tboot.h
@@ -143,7 +143,6 @@ static inline int tboot_enabled(void)
143 143
144extern void tboot_probe(void); 144extern void tboot_probe(void);
145extern void tboot_shutdown(u32 shutdown_type); 145extern void tboot_shutdown(u32 shutdown_type);
146extern void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control);
147extern struct acpi_table_header *tboot_get_dmar_table( 146extern struct acpi_table_header *tboot_get_dmar_table(
148 struct acpi_table_header *dmar_tbl); 147 struct acpi_table_header *dmar_tbl);
149extern int tboot_force_iommu(void); 148extern int tboot_force_iommu(void);
diff --git a/include/linux/time.h b/include/linux/time.h
index b3061782dec3..33a92ead4d88 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -116,7 +116,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
116extern void read_persistent_clock(struct timespec *ts); 116extern void read_persistent_clock(struct timespec *ts);
117extern void read_boot_clock(struct timespec *ts); 117extern void read_boot_clock(struct timespec *ts);
118extern int update_persistent_clock(struct timespec now); 118extern int update_persistent_clock(struct timespec now);
119extern int no_sync_cmos_clock __read_mostly;
120void timekeeping_init(void); 119void timekeeping_init(void);
121extern int timekeeping_suspended; 120extern int timekeeping_suspended;
122 121
@@ -256,6 +255,7 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
256 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns); 255 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
257 a->tv_nsec = ns; 256 a->tv_nsec = ns;
258} 257}
258
259#endif /* __KERNEL__ */ 259#endif /* __KERNEL__ */
260 260
261#define NFDBITS __NFDBITS 261#define NFDBITS __NFDBITS
diff --git a/include/linux/timex.h b/include/linux/timex.h
index b75e1864ed19..99bc88b1fc02 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -252,7 +252,7 @@ extern void ntp_clear(void);
252/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ 252/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
253extern u64 ntp_tick_length(void); 253extern u64 ntp_tick_length(void);
254 254
255extern void second_overflow(void); 255extern int second_overflow(unsigned long secs);
256extern int do_adjtimex(struct timex *); 256extern int do_adjtimex(struct timex *);
257extern void hardpps(const struct timespec *, const struct timespec *); 257extern void hardpps(const struct timespec *, const struct timespec *);
258 258
diff --git a/include/linux/tty.h b/include/linux/tty.h
index a91ff403b3bf..9f47ab540f65 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -44,7 +44,6 @@
44#include <linux/tty_ldisc.h> 44#include <linux/tty_ldisc.h>
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46 46
47#include <asm/system.h>
48 47
49 48
50/* 49/*
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index d0018d27c281..8efd28ae5597 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -96,7 +96,6 @@ struct virtio_driver {
96 void (*config_changed)(struct virtio_device *dev); 96 void (*config_changed)(struct virtio_device *dev);
97#ifdef CONFIG_PM 97#ifdef CONFIG_PM
98 int (*freeze)(struct virtio_device *dev); 98 int (*freeze)(struct virtio_device *dev);
99 int (*thaw)(struct virtio_device *dev);
100 int (*restore)(struct virtio_device *dev); 99 int (*restore)(struct virtio_device *dev);
101#endif 100#endif
102}; 101};
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 7d9a9e990ce6..1dee81c41ff1 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -22,7 +22,6 @@
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/stddef.h> 23#include <linux/stddef.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <asm/system.h>
26#include <asm/current.h> 25#include <asm/current.h>
27 26
28typedef struct __wait_queue wait_queue_t; 27typedef struct __wait_queue wait_queue_t;
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 43ba5b3ce2a3..ac40716b44e9 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -66,6 +66,7 @@ struct watchdog_device;
66 * @ping: The routine that sends a keepalive ping to the watchdog device. 66 * @ping: The routine that sends a keepalive ping to the watchdog device.
67 * @status: The routine that shows the status of the watchdog device. 67 * @status: The routine that shows the status of the watchdog device.
68 * @set_timeout:The routine for setting the watchdog devices timeout value. 68 * @set_timeout:The routine for setting the watchdog devices timeout value.
69 * @get_timeleft:The routine that get's the time that's left before a reset.
69 * @ioctl: The routines that handles extra ioctl calls. 70 * @ioctl: The routines that handles extra ioctl calls.
70 * 71 *
71 * The watchdog_ops structure contains a list of low-level operations 72 * The watchdog_ops structure contains a list of low-level operations
@@ -82,6 +83,7 @@ struct watchdog_ops {
82 int (*ping)(struct watchdog_device *); 83 int (*ping)(struct watchdog_device *);
83 unsigned int (*status)(struct watchdog_device *); 84 unsigned int (*status)(struct watchdog_device *);
84 int (*set_timeout)(struct watchdog_device *, unsigned int); 85 int (*set_timeout)(struct watchdog_device *, unsigned int);
86 unsigned int (*get_timeleft)(struct watchdog_device *);
85 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); 87 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
86}; 88};
87 89
@@ -127,7 +129,7 @@ struct watchdog_device {
127#endif 129#endif
128 130
129/* Use the following function to set the nowayout feature */ 131/* Use the following function to set the nowayout feature */
130static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout) 132static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool nowayout)
131{ 133{
132 if (nowayout) 134 if (nowayout)
133 set_bit(WDOG_NO_WAY_OUT, &wdd->status); 135 set_bit(WDOG_NO_WAY_OUT, &wdd->status);
diff --git a/include/net/netfilter/xt_log.h b/include/net/netfilter/xt_log.h
index 7e1544e8f70d..9d9756cca013 100644
--- a/include/net/netfilter/xt_log.h
+++ b/include/net/netfilter/xt_log.h
@@ -47,7 +47,7 @@ static void sb_close(struct sbuff *m)
47 if (likely(m != &emergency)) 47 if (likely(m != &emergency))
48 kfree(m); 48 kfree(m);
49 else { 49 else {
50 xchg(&emergency_ptr, m); 50 emergency_ptr = m;
51 local_bh_enable(); 51 local_bh_enable();
52 } 52 }
53} 53}
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 9c23ee8fd2d3..917741bb8e11 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -261,7 +261,8 @@ struct iscsi_uevent {
261 } host_event; 261 } host_event;
262 struct msg_ping_comp { 262 struct msg_ping_comp {
263 uint32_t host_no; 263 uint32_t host_no;
264 uint32_t status; 264 uint32_t status; /* enum
265 * iscsi_ping_status_code */
265 uint32_t pid; /* unique ping id associated 266 uint32_t pid; /* unique ping id associated
266 with each ping request */ 267 with each ping request */
267 uint32_t data_size; 268 uint32_t data_size;
@@ -483,6 +484,20 @@ enum iscsi_port_state {
483 ISCSI_PORT_STATE_UP = 0x2, 484 ISCSI_PORT_STATE_UP = 0x2,
484}; 485};
485 486
487/* iSCSI PING status/error code */
488enum iscsi_ping_status_code {
489 ISCSI_PING_SUCCESS = 0,
490 ISCSI_PING_FW_DISABLED = 0x1,
491 ISCSI_PING_IPADDR_INVALID = 0x2,
492 ISCSI_PING_LINKLOCAL_IPV6_ADDR_INVALID = 0x3,
493 ISCSI_PING_TIMEOUT = 0x4,
494 ISCSI_PING_INVALID_DEST_ADDR = 0x5,
495 ISCSI_PING_OVERSIZE_PACKET = 0x6,
496 ISCSI_PING_ICMP_ERROR = 0x7,
497 ISCSI_PING_MAX_REQ_EXCEEDED = 0x8,
498 ISCSI_PING_NO_ARP_RECEIVED = 0x9,
499};
500
486#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 501#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
487#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) 502#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
488 503
@@ -578,6 +593,6 @@ struct iscsi_chap_rec {
578 char username[ISCSI_CHAP_AUTH_NAME_MAX_LEN]; 593 char username[ISCSI_CHAP_AUTH_NAME_MAX_LEN];
579 uint8_t password[ISCSI_CHAP_AUTH_SECRET_MAX_LEN]; 594 uint8_t password[ISCSI_CHAP_AUTH_SECRET_MAX_LEN];
580 uint8_t password_length; 595 uint8_t password_length;
581} __packed; 596};
582 597
583#endif 598#endif
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 5a35a2a2d3c5..cfdb55f0937e 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -165,7 +165,8 @@ struct fcoe_ctlr {
165 * @switch_name: WWN of switch from advertisement 165 * @switch_name: WWN of switch from advertisement
166 * @fabric_name: WWN of fabric from advertisement 166 * @fabric_name: WWN of fabric from advertisement
167 * @fc_map: FC_MAP value from advertisement 167 * @fc_map: FC_MAP value from advertisement
168 * @fcf_mac: Ethernet address of the FCF 168 * @fcf_mac: Ethernet address of the FCF for FIP traffic
169 * @fcoe_mac: Ethernet address of the FCF for FCoE traffic
169 * @vfid: virtual fabric ID 170 * @vfid: virtual fabric ID
170 * @pri: selection priority, smaller values are better 171 * @pri: selection priority, smaller values are better
171 * @flogi_sent: current FLOGI sent to this FCF 172 * @flogi_sent: current FLOGI sent to this FCF
@@ -188,6 +189,7 @@ struct fcoe_fcf {
188 u32 fc_map; 189 u32 fc_map;
189 u16 vfid; 190 u16 vfid;
190 u8 fcf_mac[ETH_ALEN]; 191 u8 fcf_mac[ETH_ALEN];
192 u8 fcoe_mac[ETH_ALEN];
191 193
192 u8 pri; 194 u8 pri;
193 u8 flogi_sent; 195 u8 flogi_sent;
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 84f3001a568d..91b91e805673 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/writeback.h> 7#include <linux/writeback.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9#include <trace/events/gfpflags.h>
9 10
10struct btrfs_root; 11struct btrfs_root;
11struct btrfs_fs_info; 12struct btrfs_fs_info;
@@ -862,6 +863,49 @@ TRACE_EVENT(btrfs_setup_cluster,
862 __entry->size, __entry->max_size, __entry->bitmap) 863 __entry->size, __entry->max_size, __entry->bitmap)
863); 864);
864 865
866struct extent_state;
867TRACE_EVENT(alloc_extent_state,
868
869 TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP),
870
871 TP_ARGS(state, mask, IP),
872
873 TP_STRUCT__entry(
874 __field(struct extent_state *, state)
875 __field(gfp_t, mask)
876 __field(unsigned long, ip)
877 ),
878
879 TP_fast_assign(
880 __entry->state = state,
881 __entry->mask = mask,
882 __entry->ip = IP
883 ),
884
885 TP_printk("state=%p; mask = %s; caller = %pF", __entry->state,
886 show_gfp_flags(__entry->mask), (void *)__entry->ip)
887);
888
889TRACE_EVENT(free_extent_state,
890
891 TP_PROTO(struct extent_state *state, unsigned long IP),
892
893 TP_ARGS(state, IP),
894
895 TP_STRUCT__entry(
896 __field(struct extent_state *, state)
897 __field(unsigned long, ip)
898 ),
899
900 TP_fast_assign(
901 __entry->state = state,
902 __entry->ip = IP
903 ),
904
905 TP_printk(" state=%p; caller = %pF", __entry->state,
906 (void *)__entry->ip)
907);
908
865#endif /* _TRACE_BTRFS_H */ 909#endif /* _TRACE_BTRFS_H */
866 910
867/* This part must be outside protection */ 911/* This part must be outside protection */
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 75964412ddbb..127993dbf322 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -81,6 +81,13 @@ DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
81 TP_ARGS(journal, commit_transaction) 81 TP_ARGS(journal, commit_transaction)
82); 82);
83 83
84DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,
85
86 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
87
88 TP_ARGS(journal, commit_transaction)
89);
90
84TRACE_EVENT(jbd2_end_commit, 91TRACE_EVENT(jbd2_end_commit,
85 TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 92 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
86 93
@@ -200,7 +207,7 @@ TRACE_EVENT(jbd2_checkpoint_stats,
200 __entry->forced_to_close, __entry->written, __entry->dropped) 207 __entry->forced_to_close, __entry->written, __entry->dropped)
201); 208);
202 209
203TRACE_EVENT(jbd2_cleanup_journal_tail, 210TRACE_EVENT(jbd2_update_log_tail,
204 211
205 TP_PROTO(journal_t *journal, tid_t first_tid, 212 TP_PROTO(journal_t *journal, tid_t first_tid,
206 unsigned long block_nr, unsigned long freed), 213 unsigned long block_nr, unsigned long freed),
@@ -229,6 +236,26 @@ TRACE_EVENT(jbd2_cleanup_journal_tail,
229 __entry->block_nr, __entry->freed) 236 __entry->block_nr, __entry->freed)
230); 237);
231 238
239TRACE_EVENT(jbd2_write_superblock,
240
241 TP_PROTO(journal_t *journal, int write_op),
242
243 TP_ARGS(journal, write_op),
244
245 TP_STRUCT__entry(
246 __field( dev_t, dev )
247 __field( int, write_op )
248 ),
249
250 TP_fast_assign(
251 __entry->dev = journal->j_fs_dev->bd_dev;
252 __entry->write_op = write_op;
253 ),
254
255 TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
256 MINOR(__entry->dev), __entry->write_op)
257);
258
232#endif /* _TRACE_JBD2_H */ 259#endif /* _TRACE_JBD2_H */
233 260
234/* This part must be outside protection */ 261/* This part must be outside protection */
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index fbc7b1ad929b..ea7a2035456d 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -295,7 +295,7 @@ TRACE_EVENT(sched_process_exec,
295 TP_fast_assign( 295 TP_fast_assign(
296 __assign_str(filename, bprm->filename); 296 __assign_str(filename, bprm->filename);
297 __entry->pid = p->pid; 297 __entry->pid = p->pid;
298 __entry->old_pid = p->pid; 298 __entry->old_pid = old_pid;
299 ), 299 ),
300 300
301 TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), 301 TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
diff --git a/include/video/sa1100fb.h b/include/video/sa1100fb.h
new file mode 100644
index 000000000000..4ab409653785
--- /dev/null
+++ b/include/video/sa1100fb.h
@@ -0,0 +1,63 @@
1/*
2 * StrongARM 1100 LCD Controller Frame Buffer Device
3 *
4 * Copyright (C) 1999 Eric A. Thomas
5 * Based on acornfb.c Copyright (C) Russell King.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive
9 * for more details.
10 */
11#ifndef _VIDEO_SA1100FB_H
12#define _VIDEO_SA1100FB_H
13
14#include <linux/fb.h>
15#include <linux/types.h>
16
17#define RGB_4 0
18#define RGB_8 1
19#define RGB_16 2
20#define NR_RGB 3
21
22/* These are the bitfields for each display depth that we support. */
23struct sa1100fb_rgb {
24 struct fb_bitfield red;
25 struct fb_bitfield green;
26 struct fb_bitfield blue;
27 struct fb_bitfield transp;
28};
29
30/* This structure describes the machine which we are running on. */
31struct sa1100fb_mach_info {
32 u_long pixclock;
33
34 u_short xres;
35 u_short yres;
36
37 u_char bpp;
38 u_char hsync_len;
39 u_char left_margin;
40 u_char right_margin;
41
42 u_char vsync_len;
43 u_char upper_margin;
44 u_char lower_margin;
45 u_char sync;
46
47 u_int cmap_greyscale:1,
48 cmap_inverse:1,
49 cmap_static:1,
50 unused:29;
51
52 u_int lccr0;
53 u_int lccr3;
54
55 /* Overrides for the default RGB maps */
56 const struct sa1100fb_rgb *rgb[NR_RGB];
57
58 void (*backlight_power)(int);
59 void (*lcd_power)(int);
60 void (*set_visual)(u32);
61};
62
63#endif
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
index 2ea2fdc79c16..4f4d449f00f6 100644
--- a/include/xen/swiotlb-xen.h
+++ b/include/xen/swiotlb-xen.h
@@ -7,11 +7,13 @@ extern void xen_swiotlb_init(int verbose);
7 7
8extern void 8extern void
9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, 9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
10 dma_addr_t *dma_handle, gfp_t flags); 10 dma_addr_t *dma_handle, gfp_t flags,
11 struct dma_attrs *attrs);
11 12
12extern void 13extern void
13xen_swiotlb_free_coherent(struct device *hwdev, size_t size, 14xen_swiotlb_free_coherent(struct device *hwdev, size_t size,
14 void *vaddr, dma_addr_t dma_handle); 15 void *vaddr, dma_addr_t dma_handle,
16 struct dma_attrs *attrs);
15 17
16extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, 18extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
17 unsigned long offset, size_t size, 19 unsigned long offset, size_t size,
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 03c85d7387fb..6a198e46ab6e 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -23,6 +23,7 @@ int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
23 23
24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); 24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
25 25
26struct vm_area_struct;
26int xen_remap_domain_mfn_range(struct vm_area_struct *vma, 27int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
27 unsigned long addr, 28 unsigned long addr,
28 unsigned long mfn, int nr, 29 unsigned long mfn, int nr,