aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
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/bug.h6
-rw-r--r--include/asm-generic/cmpxchg.h87
-rw-r--r--include/asm-generic/dma-mapping-common.h1
-rw-r--r--include/asm-generic/exec.h19
-rw-r--r--include/asm-generic/gpio.h4
-rw-r--r--include/asm-generic/mman-common.h4
-rw-r--r--include/asm-generic/pci-bridge.h6
-rw-r--r--include/asm-generic/pci.h24
-rw-r--r--include/asm-generic/pgtable.h1
-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/tlbflush.h2
-rw-r--r--include/asm-generic/unistd.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h36
-rw-r--r--include/drm/drm_mode.h2
-rw-r--r--include/drm/ttm/ttm_memory.h1
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/acpi.h11
-rw-r--r--include/linux/aio_abi.h2
-rw-r--r--include/linux/amba/bus.h45
-rw-r--r--include/linux/amba/mmci.h22
-rw-r--r--include/linux/amba/pl022.h2
-rw-r--r--include/linux/amba/pl08x.h10
-rw-r--r--include/linux/amba/pl330.h1
-rw-r--r--include/linux/amd-iommu.h2
-rw-r--r--include/linux/apple_bl.h26
-rw-r--r--include/linux/atmdev.h3
-rw-r--r--include/linux/atmel_tc.h10
-rw-r--r--include/linux/attribute_container.h3
-rw-r--r--include/linux/bio.h1
-rw-r--r--include/linux/bit_spinlock.h1
-rw-r--r--include/linux/bitops.h13
-rw-r--r--include/linux/bug.h61
-rw-r--r--include/linux/c2port.h3
-rw-r--r--include/linux/cdrom.h1
-rw-r--r--include/linux/ceph/decode.h3
-rw-r--r--include/linux/ceph/libceph.h3
-rw-r--r--include/linux/ceph/mdsmap.h1
-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/compiler-gcc.h3
-rw-r--r--include/linux/cpu.h3
-rw-r--r--include/linux/cpufreq.h3
-rw-r--r--include/linux/cpuidle.h22
-rw-r--r--include/linux/cpumask.h10
-rw-r--r--include/linux/cpuset.h6
-rw-r--r--include/linux/crash_dump.h1
-rw-r--r--include/linux/crc32.h2
-rw-r--r--include/linux/crypto.h1
-rw-r--r--include/linux/debug_locks.h2
-rw-r--r--include/linux/dma-buf.h99
-rw-r--r--include/linux/dma-mapping.h2
-rw-r--r--include/linux/dmaengine.h36
-rw-r--r--include/linux/dw_dmac.h38
-rw-r--r--include/linux/edac.h185
-rw-r--r--include/linux/efi.h1
-rw-r--r--include/linux/elfcore.h1
-rw-r--r--include/linux/ext2_fs.h569
-rw-r--r--include/linux/ext2_fs_sb.h126
-rw-r--r--include/linux/ext3_fs.h979
-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/fb.h1
-rw-r--r--include/linux/fdtable.h46
-rw-r--r--include/linux/firewire-cdev.h39
-rw-r--r--include/linux/firewire.h19
-rw-r--r--include/linux/fs.h18
-rw-r--r--include/linux/fsl/mxs-dma.h28
-rw-r--r--include/linux/fsnotify.h1
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/gpio.h7
-rw-r--r--include/linux/gpio_keys.h3
-rw-r--r--include/linux/highmem.h1
-rw-r--r--include/linux/hwmon-sysfs.h2
-rw-r--r--include/linux/hwmon.h2
-rw-r--r--include/linux/hwspinlock.h2
-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/at24.h35
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/i2o.h1
-rw-r--r--include/linux/ide.h4
-rw-r--r--include/linux/if_vlan.h1
-rw-r--r--include/linux/input.h27
-rw-r--r--include/linux/input/cyttsp.h58
-rw-r--r--include/linux/input/ili210x.h10
-rw-r--r--include/linux/input/kxtj9.h11
-rw-r--r--include/linux/input/matrix_keypad.h19
-rw-r--r--include/linux/input/mt.h8
-rw-r--r--include/linux/input/ti_tscadc.h17
-rw-r--r--include/linux/interrupt.h1
-rw-r--r--include/linux/io-mapping.h1
-rw-r--r--include/linux/ioport.h6
-rw-r--r--include/linux/ipmi.h2
-rw-r--r--include/linux/ipmi_smi.h3
-rw-r--r--include/linux/ivtv.h6
-rw-r--r--include/linux/jbd2.h12
-rw-r--r--include/linux/journal-head.h2
-rw-r--r--include/linux/jz4740-adc.h2
-rw-r--r--include/linux/kernel.h108
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/kmod.h18
-rw-r--r--include/linux/kprobes.h1
-rw-r--r--include/linux/kvm.h98
-rw-r--r--include/linux/kvm_host.h70
-rw-r--r--include/linux/led-lm3530.h9
-rw-r--r--include/linux/leds-lp5521.h25
-rw-r--r--include/linux/llist.h3
-rw-r--r--include/linux/lockd/bind.h1
-rw-r--r--include/linux/lockd/lockd.h7
-rw-r--r--include/linux/lockd/xdr4.h2
-rw-r--r--include/linux/lp855x.h131
-rw-r--r--include/linux/lp8727.h18
-rw-r--r--include/linux/lsm_audit.h1
-rw-r--r--include/linux/magic.h18
-rw-r--r--include/linux/maple.h2
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--include/linux/mfd/88pm860x.h23
-rw-r--r--include/linux/mfd/abx500.h283
-rw-r--r--include/linux/mfd/abx500/ab5500.h2
-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.h212
-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/max8997.h53
-rw-r--r--include/linux/mfd/mc13xxx.h16
-rw-r--r--include/linux/mfd/mcp.h14
-rw-r--r--include/linux/mfd/pm8xxx/pm8921.h1
-rw-r--r--include/linux/mfd/rc5t583.h295
-rw-r--r--include/linux/mfd/stmpe.h5
-rw-r--r--include/linux/mfd/tc3589x.h2
-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/mlx4/driver.h1
-rw-r--r--include/linux/mm.h7
-rw-r--r--include/linux/mmc/card.h3
-rw-r--r--include/linux/mmc/cd-gpio.h3
-rw-r--r--include/linux/mmc/core.h3
-rw-r--r--include/linux/mmc/dw_mmc.h8
-rw-r--r--include/linux/mmc/host.h49
-rw-r--r--include/linux/mmc/ioctl.h3
-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/mod_devicetable.h9
-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/cfi.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.h3
-rw-r--r--include/linux/nfs.h2
-rw-r--r--include/linux/nfs4.h22
-rw-r--r--include/linux/nfs_fs.h46
-rw-r--r--include/linux/nfs_fs_i.h4
-rw-r--r--include/linux/nfs_fs_sb.h23
-rw-r--r--include/linux/nfs_idmap.h22
-rw-r--r--include/linux/nfs_iostat.h2
-rw-r--r--include/linux/nfs_page.h27
-rw-r--r--include/linux/nfs_xdr.h65
-rw-r--r--include/linux/nfsd/cld.h56
-rw-r--r--include/linux/nilfs2_fs.h1
-rw-r--r--include/linux/nmi.h2
-rw-r--r--include/linux/of.h26
-rw-r--r--include/linux/of_device.h3
-rw-r--r--include/linux/of_gpio.h27
-rw-r--r--include/linux/of_mtd.h19
-rw-r--r--include/linux/omapfb.h32
-rw-r--r--include/linux/opp.h1
-rw-r--r--include/linux/page-flags.h1
-rw-r--r--include/linux/parport.h1
-rw-r--r--include/linux/pci.h105
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/perf_event.h90
-rw-r--r--include/linux/phy.h5
-rw-r--r--include/linux/pid_namespace.h9
-rw-r--r--include/linux/pinctrl/consumer.h159
-rw-r--r--include/linux/pinctrl/machine.h190
-rw-r--r--include/linux/pinctrl/pinconf-generic.h114
-rw-r--r--include/linux/pinctrl/pinconf.h44
-rw-r--r--include/linux/pinctrl/pinctrl-state.h6
-rw-r--r--include/linux/pinctrl/pinctrl.h3
-rw-r--r--include/linux/pinctrl/pinmux.h52
-rw-r--r--include/linux/pipe_fs_i.h2
-rw-r--r--include/linux/platform_data/atmel.h27
-rw-r--r--include/linux/platform_data/omap4-keypad.h13
-rw-r--r--include/linux/platform_data/spear_thermal.h26
-rw-r--r--include/linux/platform_data/tegra_emc.h34
-rw-r--r--include/linux/pm_domain.h2
-rw-r--r--include/linux/poll.h37
-rw-r--r--include/linux/posix_acl.h1
-rw-r--r--include/linux/power/max17042_battery.h93
-rw-r--r--include/linux/power/smb347-charger.h117
-rw-r--r--include/linux/power_supply.h3
-rw-r--r--include/linux/prctl.h3
-rw-r--r--include/linux/ptrace.h45
-rw-r--r--include/linux/radix-tree.h197
-rw-r--r--include/linux/rcupdate.h3
-rw-r--r--include/linux/regmap.h130
-rw-r--r--include/linux/regset.h1
-rw-r--r--include/linux/regulator/ab8500.h70
-rw-r--r--include/linux/regulator/bq24022.h24
-rw-r--r--include/linux/regulator/consumer.h3
-rw-r--r--include/linux/relay.h1
-rw-r--r--include/linux/remoteproc.h478
-rw-r--r--include/linux/rfkill.h2
-rw-r--r--include/linux/ring_buffer.h3
-rw-r--r--include/linux/rio_drv.h1
-rw-r--r--include/linux/rpmsg.h326
-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/scatterlist.h6
-rw-r--r--include/linux/sched.h13
-rw-r--r--include/linux/seq_file.h6
-rw-r--r--include/linux/serial_pnx8xxx.h1
-rw-r--r--include/linux/sh_clk.h5
-rw-r--r--include/linux/sh_intc.h17
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/linux/slab.h17
-rw-r--r--include/linux/slub_def.h7
-rw-r--r--include/linux/smp.h46
-rw-r--r--include/linux/spi/mmc_spi.h2
-rw-r--r--include/linux/spi/orion_spi.h1
-rw-r--r--include/linux/spi/s3c24xx.h26
-rw-r--r--include/linux/spinlock.h7
-rw-r--r--include/linux/spinlock_api_smp.h2
-rw-r--r--include/linux/ssb/ssb_driver_gige.h1
-rw-r--r--include/linux/stop_machine.h1
-rw-r--r--include/linux/sunrpc/auth.h2
-rw-r--r--include/linux/sunrpc/bc_xprt.h2
-rw-r--r--include/linux/sunrpc/cache.h8
-rw-r--r--include/linux/sunrpc/clnt.h40
-rw-r--r--include/linux/sunrpc/debug.h26
-rw-r--r--include/linux/sunrpc/metrics.h6
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h46
-rw-r--r--include/linux/sunrpc/sched.h24
-rw-r--r--include/linux/sunrpc/stats.h22
-rw-r--r--include/linux/sunrpc/svc.h13
-rw-r--r--include/linux/sunrpc/svc_rdma.h4
-rw-r--r--include/linux/sunrpc/svc_xprt.h3
-rw-r--r--include/linux/sunrpc/svcauth.h3
-rw-r--r--include/linux/sunrpc/svcauth_gss.h2
-rw-r--r--include/linux/sunrpc/svcsock.h2
-rw-r--r--include/linux/sunrpc/xprt.h11
-rw-r--r--include/linux/sunrpc/xprtsock.h12
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/swapops.h1
-rw-r--r--include/linux/syscalls.h1
-rw-r--r--include/linux/sysctl.h106
-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/tracehook.h9
-rw-r--r--include/linux/transport_class.h1
-rw-r--r--include/linux/tty.h1
-rw-r--r--include/linux/videodev2.h149
-rw-r--r--include/linux/virtio.h1
-rw-r--r--include/linux/virtio_config.h1
-rw-r--r--include/linux/virtio_ids.h1
-rw-r--r--include/linux/wait.h1
-rw-r--r--include/linux/watchdog.h4
-rw-r--r--include/linux/wimax/debug.h2
-rw-r--r--include/media/adv7183.h47
-rw-r--r--include/media/blackfin/bfin_capture.h37
-rw-r--r--include/media/blackfin/ppi.h74
-rw-r--r--include/media/davinci/vpif_types.h2
-rw-r--r--include/media/gpio-ir-recv.h22
-rw-r--r--include/media/media-device.h3
-rw-r--r--include/media/mt9m032.h36
-rw-r--r--include/media/rc-map.h3
-rw-r--r--include/media/s5p_hdmi.h35
-rw-r--r--include/media/sh_mobile_ceu.h2
-rw-r--r--include/media/sii9234.h24
-rw-r--r--include/media/tuner.h1
-rw-r--r--include/media/v4l2-chip-ident.h6
-rw-r--r--include/media/v4l2-ctrls.h14
-rw-r--r--include/media/v4l2-dev.h3
-rw-r--r--include/media/v4l2-ioctl.h5
-rw-r--r--include/net/cfg80211.h1
-rw-r--r--include/net/dst.h1
-rw-r--r--include/net/ip_vs.h1
-rw-r--r--include/net/mac80211.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h4
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h2
-rw-r--r--include/net/netns/generic.h1
-rw-r--r--include/net/red.h1
-rw-r--r--include/net/sock.h2
-rw-r--r--include/net/tcp.h1
-rw-r--r--include/net/timewait_sock.h1
-rw-r--r--include/net/udp.h1
-rw-r--r--include/net/wpan-phy.h1
-rw-r--r--include/scsi/iscsi_if.h19
-rw-r--r--include/scsi/libfcoe.h4
-rw-r--r--include/scsi/osd_ore.h1
-rw-r--r--include/scsi/scsi_device.h2
-rw-r--r--include/scsi/scsi_netlink.h2
-rw-r--r--include/scsi/scsi_transport.h1
-rw-r--r--include/sound/compress_params.h2
-rw-r--r--include/sound/core.h5
-rw-r--r--include/sound/soc-dapm.h3
-rw-r--r--include/sound/tea575x-tuner.h6
-rw-r--r--include/trace/events/btrfs.h44
-rw-r--r--include/trace/events/jbd2.h29
-rw-r--r--include/trace/events/regmap.h38
-rw-r--r--include/trace/events/rpm.h3
-rw-r--r--include/trace/events/sunrpc.h177
-rw-r--r--include/trace/events/writeback.h1
-rw-r--r--include/video/exynos_dp.h131
-rw-r--r--include/video/exynos_mipi_dsim.h359
-rw-r--r--include/video/sa1100fb.h63
-rw-r--r--include/video/sh_mipi_dsi.h1
-rw-r--r--include/video/sh_mobile_hdmi.h2
-rw-r--r--include/video/sh_mobile_lcdc.h35
-rw-r--r--include/video/sh_mobile_meram.h45
-rw-r--r--include/video/udlfb.h1
-rw-r--r--include/xen/interface/physdev.h21
-rw-r--r--include/xen/tmem.h6
-rw-r--r--include/xen/xen-ops.h1
-rw-r--r--include/xen/xenbus.h4
361 files changed, 9443 insertions, 4223 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
new file mode 100644
index 00000000000..03f14856bd0
--- /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 5b6c391efc8..92d6e1d701f 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 5b5af0d30a9..38f508816e4 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 6cd5b6403a7..f1c8ca60e82 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 7c9aebe8a7a..21a5548c668 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 a28da35ba45..98211013467 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 8e1b92f6f65..8dea54665dc 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 d5dee7ce947..eba66043cf1 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 f4b2effe033..6fbc4cab583 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 e37963c1df4..1ced6413ea0 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 00000000000..639d7a4d033
--- /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 ecc44a8e2b4..9ae6c34dc19 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/bug.h b/include/asm-generic/bug.h
index 84458b0c38d..2520a6e241d 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const char *file, const int line);
134#endif 134#endif
135 135
136#define WARN_ON_ONCE(condition) ({ \ 136#define WARN_ON_ONCE(condition) ({ \
137 static bool __warned; \ 137 static bool __section(.data.unlikely) __warned; \
138 int __ret_warn_once = !!(condition); \ 138 int __ret_warn_once = !!(condition); \
139 \ 139 \
140 if (unlikely(__ret_warn_once)) \ 140 if (unlikely(__ret_warn_once)) \
@@ -144,7 +144,7 @@ extern void warn_slowpath_null(const char *file, const int line);
144}) 144})
145 145
146#define WARN_ONCE(condition, format...) ({ \ 146#define WARN_ONCE(condition, format...) ({ \
147 static bool __warned; \ 147 static bool __section(.data.unlikely) __warned; \
148 int __ret_warn_once = !!(condition); \ 148 int __ret_warn_once = !!(condition); \
149 \ 149 \
150 if (unlikely(__ret_warn_once)) \ 150 if (unlikely(__ret_warn_once)) \
@@ -154,7 +154,7 @@ extern void warn_slowpath_null(const char *file, const int line);
154}) 154})
155 155
156#define WARN_TAINT_ONCE(condition, taint, format...) ({ \ 156#define WARN_TAINT_ONCE(condition, taint, format...) ({ \
157 static bool __warned; \ 157 static bool __section(.data.unlikely) __warned; \
158 int __ret_warn_once = !!(condition); \ 158 int __ret_warn_once = !!(condition); \
159 \ 159 \
160 if (unlikely(__ret_warn_once)) \ 160 if (unlikely(__ret_warn_once)) \
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h
index 213ac6e8fe3..8a361834dc2 100644
--- a/include/asm-generic/cmpxchg.h
+++ b/include/asm-generic/cmpxchg.h
@@ -1,22 +1,97 @@
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/irqflags.h>
14
15#ifndef xchg
16
17/*
18 * This function doesn't exist, so you'll get a linker error if
19 * something tries to do an invalidly-sized xchg().
20 */
21extern void __xchg_called_with_bad_pointer(void);
22
23static inline
24unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
25{
26 unsigned long ret, flags;
27
28 switch (size) {
29 case 1:
30#ifdef __xchg_u8
31 return __xchg_u8(x, ptr);
32#else
33 local_irq_save(flags);
34 ret = *(volatile u8 *)ptr;
35 *(volatile u8 *)ptr = x;
36 local_irq_restore(flags);
37 return ret;
38#endif /* __xchg_u8 */
39
40 case 2:
41#ifdef __xchg_u16
42 return __xchg_u16(x, ptr);
43#else
44 local_irq_save(flags);
45 ret = *(volatile u16 *)ptr;
46 *(volatile u16 *)ptr = x;
47 local_irq_restore(flags);
48 return ret;
49#endif /* __xchg_u16 */
50
51 case 4:
52#ifdef __xchg_u32
53 return __xchg_u32(x, ptr);
54#else
55 local_irq_save(flags);
56 ret = *(volatile u32 *)ptr;
57 *(volatile u32 *)ptr = x;
58 local_irq_restore(flags);
59 return ret;
60#endif /* __xchg_u32 */
61
62#ifdef CONFIG_64BIT
63 case 8:
64#ifdef __xchg_u64
65 return __xchg_u64(x, ptr);
66#else
67 local_irq_save(flags);
68 ret = *(volatile u64 *)ptr;
69 *(volatile u64 *)ptr = x;
70 local_irq_restore(flags);
71 return ret;
72#endif /* __xchg_u64 */
73#endif /* CONFIG_64BIT */
74
75 default:
76 __xchg_called_with_bad_pointer();
77 return x;
78 }
79}
80
81#define xchg(ptr, x) \
82 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
83
84#endif /* xchg */
85
13/* 86/*
14 * Atomic compare and exchange. 87 * Atomic compare and exchange.
15 * 88 *
16 * Do not define __HAVE_ARCH_CMPXCHG because we want to use it to check whether 89 * 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. 90 * a cmpxchg primitive faster than repeated local irq save/restore exists.
18 */ 91 */
92#include <asm-generic/cmpxchg-local.h>
93
19#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) 94#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
20#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) 95#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
21 96
22#endif 97#endif /* __ASM_GENERIC_CMPXCHG_H */
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index 9fa3f96e38c..2e248d8924d 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -2,6 +2,7 @@
2#define _ASM_GENERIC_DMA_MAPPING_H 2#define _ASM_GENERIC_DMA_MAPPING_H
3 3
4#include <linux/kmemcheck.h> 4#include <linux/kmemcheck.h>
5#include <linux/bug.h>
5#include <linux/scatterlist.h> 6#include <linux/scatterlist.h>
6#include <linux/dma-debug.h> 7#include <linux/dma-debug.h>
7#include <linux/dma-attrs.h> 8#include <linux/dma-attrs.h>
diff --git a/include/asm-generic/exec.h b/include/asm-generic/exec.h
new file mode 100644
index 00000000000..567766b0074
--- /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 1ff4e221cb4..5f52690c3c8 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/mman-common.h b/include/asm-generic/mman-common.h
index 787abbb6d86..d030d2c2647 100644
--- a/include/asm-generic/mman-common.h
+++ b/include/asm-generic/mman-common.h
@@ -48,6 +48,10 @@
48#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 48#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
49#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 49#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
50 50
51#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
52 overrides the coredump filter bits */
53#define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */
54
51/* compatibility flags */ 55/* compatibility flags */
52#define MAP_FILE 0 56#define MAP_FILE 0
53 57
diff --git a/include/asm-generic/pci-bridge.h b/include/asm-generic/pci-bridge.h
index 4a5aca2a2c9..a5b5d5a89a4 100644
--- a/include/asm-generic/pci-bridge.h
+++ b/include/asm-generic/pci-bridge.h
@@ -45,6 +45,11 @@ static inline void pci_add_flags(int flags)
45 pci_flags |= flags; 45 pci_flags |= flags;
46} 46}
47 47
48static inline void pci_clear_flags(int flags)
49{
50 pci_flags &= ~flags;
51}
52
48static inline int pci_has_flag(int flag) 53static inline int pci_has_flag(int flag)
49{ 54{
50 return pci_flags & flag; 55 return pci_flags & flag;
@@ -52,6 +57,7 @@ static inline int pci_has_flag(int flag)
52#else 57#else
53static inline void pci_set_flags(int flags) { } 58static inline void pci_set_flags(int flags) { }
54static inline void pci_add_flags(int flags) { } 59static inline void pci_add_flags(int flags) { }
60static inline void pci_clear_flags(int flags) { }
55static inline int pci_has_flag(int flag) 61static inline int pci_has_flag(int flag)
56{ 62{
57 return 0; 63 return 0;
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index 26373cff454..e80a0495e5b 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -6,30 +6,6 @@
6#ifndef _ASM_GENERIC_PCI_H 6#ifndef _ASM_GENERIC_PCI_H
7#define _ASM_GENERIC_PCI_H 7#define _ASM_GENERIC_PCI_H
8 8
9/**
10 * pcibios_resource_to_bus - convert resource to PCI bus address
11 * @dev: device which owns this resource
12 * @region: converted bus-centric region (start,end)
13 * @res: resource to convert
14 *
15 * Convert a resource to a PCI device bus address or bus window.
16 */
17static inline void
18pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
19 struct resource *res)
20{
21 region->start = res->start;
22 region->end = res->end;
23}
24
25static inline void
26pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
27 struct pci_bus_region *region)
28{
29 res->start = region->start;
30 res->end = region->end;
31}
32
33static inline struct resource * 9static inline struct resource *
34pcibios_select_root(struct pci_dev *pdev, struct resource *res) 10pcibios_select_root(struct pci_dev *pdev, struct resource *res)
35{ 11{
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index a03c098b0cc..125c54e9851 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -5,6 +5,7 @@
5#ifdef CONFIG_MMU 5#ifdef CONFIG_MMU
6 6
7#include <linux/mm_types.h> 7#include <linux/mm_types.h>
8#include <linux/bug.h>
8 9
9#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 10#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
10extern int ptep_set_access_flags(struct vm_area_struct *vma, 11extern int ptep_set_access_flags(struct vm_area_struct *vma,
diff --git a/include/asm-generic/posix_types.h b/include/asm-generic/posix_types.h
index 3dab00860e7..91d44bd4dde 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 00000000000..052c4ac04fd
--- /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 215efa74f5a..00000000000
--- 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/tlbflush.h b/include/asm-generic/tlbflush.h
index c7af037024c..d6d0a88430f 100644
--- a/include/asm-generic/tlbflush.h
+++ b/include/asm-generic/tlbflush.h
@@ -9,6 +9,8 @@
9#error need to implement an architecture specific asm/tlbflush.h 9#error need to implement an architecture specific asm/tlbflush.h
10#endif 10#endif
11 11
12#include <linux/bug.h>
13
12static inline void flush_tlb_mm(struct mm_struct *mm) 14static inline void flush_tlb_mm(struct mm_struct *mm)
13{ 15{
14 BUG(); 16 BUG();
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 2292d1af9d7..991ef01cd77 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 b5e2e4c6b01..8aeadf6b553 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -167,6 +167,7 @@
167 CPU_KEEP(exit.data) \ 167 CPU_KEEP(exit.data) \
168 MEM_KEEP(init.data) \ 168 MEM_KEEP(init.data) \
169 MEM_KEEP(exit.data) \ 169 MEM_KEEP(exit.data) \
170 *(.data.unlikely) \
170 STRUCT_ALIGN(); \ 171 STRUCT_ALIGN(); \
171 *(__tracepoints) \ 172 *(__tracepoints) \
172 /* implement dynamic printk debug */ \ 173 /* implement dynamic printk debug */ \
@@ -615,30 +616,23 @@
615 *(.init.setup) \ 616 *(.init.setup) \
616 VMLINUX_SYMBOL(__setup_end) = .; 617 VMLINUX_SYMBOL(__setup_end) = .;
617 618
618#define INITCALLS \ 619#define INIT_CALLS_LEVEL(level) \
619 *(.initcallearly.init) \ 620 VMLINUX_SYMBOL(__initcall##level##_start) = .; \
620 VMLINUX_SYMBOL(__early_initcall_end) = .; \ 621 *(.initcall##level##.init) \
621 *(.initcall0.init) \ 622 *(.initcall##level##s.init) \
622 *(.initcall0s.init) \
623 *(.initcall1.init) \
624 *(.initcall1s.init) \
625 *(.initcall2.init) \
626 *(.initcall2s.init) \
627 *(.initcall3.init) \
628 *(.initcall3s.init) \
629 *(.initcall4.init) \
630 *(.initcall4s.init) \
631 *(.initcall5.init) \
632 *(.initcall5s.init) \
633 *(.initcallrootfs.init) \
634 *(.initcall6.init) \
635 *(.initcall6s.init) \
636 *(.initcall7.init) \
637 *(.initcall7s.init)
638 623
639#define INIT_CALLS \ 624#define INIT_CALLS \
640 VMLINUX_SYMBOL(__initcall_start) = .; \ 625 VMLINUX_SYMBOL(__initcall_start) = .; \
641 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) \
642 VMLINUX_SYMBOL(__initcall_end) = .; 636 VMLINUX_SYMBOL(__initcall_end) = .;
643 637
644#define CON_INITCALL \ 638#define CON_INITCALL \
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 2a2acda8b43..4a0aae38e16 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -27,6 +27,8 @@
27#ifndef _DRM_MODE_H 27#ifndef _DRM_MODE_H
28#define _DRM_MODE_H 28#define _DRM_MODE_H
29 29
30#include <linux/types.h>
31
30#define DRM_DISPLAY_INFO_LEN 32 32#define DRM_DISPLAY_INFO_LEN 32
31#define DRM_CONNECTOR_NAME_LEN 32 33#define DRM_CONNECTOR_NAME_LEN 32
32#define DRM_DISPLAY_MODE_LEN 32 34#define DRM_DISPLAY_MODE_LEN 32
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
index 26c1f78d136..d6d1da468c9 100644
--- a/include/drm/ttm/ttm_memory.h
+++ b/include/drm/ttm/ttm_memory.h
@@ -30,6 +30,7 @@
30 30
31#include <linux/workqueue.h> 31#include <linux/workqueue.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/bug.h>
33#include <linux/wait.h> 34#include <linux/wait.h>
34#include <linux/errno.h> 35#include <linux/errno.h>
35#include <linux/kobject.h> 36#include <linux/kobject.h>
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index a2555538109..d05df281035 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -120,7 +120,6 @@ header-y += errno.h
120header-y += errqueue.h 120header-y += errqueue.h
121header-y += ethtool.h 121header-y += ethtool.h
122header-y += eventpoll.h 122header-y += eventpoll.h
123header-y += ext2_fs.h
124header-y += fadvise.h 123header-y += fadvise.h
125header-y += falloc.h 124header-y += falloc.h
126header-y += fanotify.h 125header-y += fanotify.h
@@ -357,6 +356,7 @@ header-y += suspend_ioctls.h
357header-y += swab.h 356header-y += swab.h
358header-y += synclink.h 357header-y += synclink.h
359header-y += sysctl.h 358header-y += sysctl.h
359header-y += sysinfo.h
360header-y += taskstats.h 360header-y += taskstats.h
361header-y += tcp.h 361header-y += tcp.h
362header-y += telephony.h 362header-y += telephony.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 3f968665899..f421dd84f29 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 2c873166418..86fa7a71336 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/bus.h b/include/linux/amba/bus.h
index 724c69c40bb..7847e197730 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -60,6 +60,9 @@ extern struct bus_type amba_bustype;
60 60
61int amba_driver_register(struct amba_driver *); 61int amba_driver_register(struct amba_driver *);
62void amba_driver_unregister(struct amba_driver *); 62void amba_driver_unregister(struct amba_driver *);
63struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
64void amba_device_put(struct amba_device *);
65int amba_device_add(struct amba_device *, struct resource *);
63int amba_device_register(struct amba_device *, struct resource *); 66int amba_device_register(struct amba_device *, struct resource *);
64void amba_device_unregister(struct amba_device *); 67void amba_device_unregister(struct amba_device *);
65struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 68struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
@@ -89,4 +92,46 @@ void amba_release_regions(struct amba_device *);
89#define amba_manf(d) AMBA_MANF_BITS((d)->periphid) 92#define amba_manf(d) AMBA_MANF_BITS((d)->periphid)
90#define amba_part(d) AMBA_PART_BITS((d)->periphid) 93#define amba_part(d) AMBA_PART_BITS((d)->periphid)
91 94
95#define __AMBA_DEV(busid, data, mask) \
96 { \
97 .coherent_dma_mask = mask, \
98 .init_name = busid, \
99 .platform_data = data, \
100 }
101
102/*
103 * APB devices do not themselves have the ability to address memory,
104 * so DMA masks should be zero (much like USB peripheral devices.)
105 * The DMA controller DMA masks should be used instead (much like
106 * USB host controllers in conventional PCs.)
107 */
108#define AMBA_APB_DEVICE(name, busid, id, base, irqs, data) \
109struct amba_device name##_device = { \
110 .dev = __AMBA_DEV(busid, data, 0), \
111 .res = DEFINE_RES_MEM(base, SZ_4K), \
112 .irq = irqs, \
113 .periphid = id, \
114}
115
116/*
117 * AHB devices are DMA capable, so set their DMA masks
118 */
119#define AMBA_AHB_DEVICE(name, busid, id, base, irqs, data) \
120struct amba_device name##_device = { \
121 .dev = __AMBA_DEV(busid, data, ~0ULL), \
122 .res = DEFINE_RES_MEM(base, SZ_4K), \
123 .dma_mask = ~0ULL, \
124 .irq = irqs, \
125 .periphid = id, \
126}
127
128/*
129 * module_amba_driver() - Helper macro for drivers that don't do anything
130 * special in module init/exit. This eliminates a lot of boilerplate. Each
131 * module may only use this macro once, and calling it replaces module_init()
132 * and module_exit()
133 */
134#define module_amba_driver(__amba_drv) \
135 module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
136
92#endif 137#endif
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 0101e9c17fa..32a89cf5ec4 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,6 +6,19 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9
10/*
11 * These defines is places here due to access is needed from machine
12 * configuration files. The ST Micro version does not have ROD and
13 * reuse the voltage registers for direction settings.
14 */
15#define MCI_ST_DATA2DIREN (1 << 2)
16#define MCI_ST_CMDDIREN (1 << 3)
17#define MCI_ST_DATA0DIREN (1 << 4)
18#define MCI_ST_DATA31DIREN (1 << 5)
19#define MCI_ST_FBCLKEN (1 << 7)
20#define MCI_ST_DATA74DIREN (1 << 8)
21
9/* Just some dummy forwarding */ 22/* Just some dummy forwarding */
10struct dma_chan; 23struct dma_chan;
11 24
@@ -18,7 +31,8 @@ struct dma_chan;
18 * @ocr_mask: available voltages on the 4 pins from the block, this 31 * @ocr_mask: available voltages on the 4 pins from the block, this
19 * is ignored if a regulator is used, see the MMC_VDD_* masks in 32 * is ignored if a regulator is used, see the MMC_VDD_* masks in
20 * mmc/host.h 33 * mmc/host.h
21 * @vdd_handler: a callback function to translate a MMC_VDD_* 34 * @ios_handler: a callback function to act on specfic ios changes,
35 * used for example to control a levelshifter
22 * mask into a value to be binary (or set some other custom bits 36 * mask into a value to be binary (or set some other custom bits
23 * in MMCIPWR) or:ed and written into the MMCIPWR register of the 37 * in MMCIPWR) or:ed and written into the MMCIPWR register of the
24 * block. May also control external power based on the power_mode. 38 * block. May also control external power based on the power_mode.
@@ -31,6 +45,8 @@ struct dma_chan;
31 * @capabilities: the capabilities of the block as implemented in 45 * @capabilities: the capabilities of the block as implemented in
32 * this platform, signify anything MMC_CAP_* from mmc/host.h 46 * this platform, signify anything MMC_CAP_* from mmc/host.h
33 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h 47 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
48 * @sigdir: a bit field indicating for what bits in the MMC bus the host
49 * should enable signal direction indication.
34 * @dma_filter: function used to select an appropriate RX and TX 50 * @dma_filter: function used to select an appropriate RX and TX
35 * DMA channel to be used for DMA, if and only if you're deploying the 51 * DMA channel to be used for DMA, if and only if you're deploying the
36 * generic DMA engine 52 * generic DMA engine
@@ -46,14 +62,14 @@ struct dma_chan;
46struct mmci_platform_data { 62struct mmci_platform_data {
47 unsigned int f_max; 63 unsigned int f_max;
48 unsigned int ocr_mask; 64 unsigned int ocr_mask;
49 u32 (*vdd_handler)(struct device *, unsigned int vdd, 65 int (*ios_handler)(struct device *, struct mmc_ios *);
50 unsigned char power_mode);
51 unsigned int (*status)(struct device *); 66 unsigned int (*status)(struct device *);
52 int gpio_wp; 67 int gpio_wp;
53 int gpio_cd; 68 int gpio_cd;
54 bool cd_invert; 69 bool cd_invert;
55 unsigned long capabilities; 70 unsigned long capabilities;
56 unsigned long capabilities2; 71 unsigned long capabilities2;
72 u32 sigdir;
57 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 73 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
58 void *dma_rx_param; 74 void *dma_rx_param;
59 void *dma_tx_param; 75 void *dma_tx_param;
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index 3672f40f345..b8c51124ed1 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -25,8 +25,6 @@
25#ifndef _SSP_PL022_H 25#ifndef _SSP_PL022_H
26#define _SSP_PL022_H 26#define _SSP_PL022_H
27 27
28#include <linux/device.h>
29
30/** 28/**
31 * whether SSP is in loopback mode or not 29 * whether SSP is in loopback mode or not
32 */ 30 */
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 033f6aa670d..e64ce2cfee9 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 12e023c19ac..fe93758e840 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/amd-iommu.h b/include/linux/amd-iommu.h
index ef00610837d..15f6b9edd0b 100644
--- a/include/linux/amd-iommu.h
+++ b/include/linux/amd-iommu.h
@@ -28,7 +28,7 @@ struct task_struct;
28struct pci_dev; 28struct pci_dev;
29 29
30extern int amd_iommu_detect(void); 30extern int amd_iommu_detect(void);
31 31extern int amd_iommu_init_hardware(void);
32 32
33/** 33/**
34 * amd_iommu_enable_device_erratum() - Enable erratum workaround for device 34 * amd_iommu_enable_device_erratum() - Enable erratum workaround for device
diff --git a/include/linux/apple_bl.h b/include/linux/apple_bl.h
new file mode 100644
index 00000000000..47bedc0eee6
--- /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/atmdev.h b/include/linux/atmdev.h
index f4ff882cb2d..06fd4bbc58f 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -213,10 +213,10 @@ struct atm_cirange {
213 213
214#ifdef __KERNEL__ 214#ifdef __KERNEL__
215 215
216#include <linux/device.h>
217#include <linux/wait.h> /* wait_queue_head_t */ 216#include <linux/wait.h> /* wait_queue_head_t */
218#include <linux/time.h> /* struct timeval */ 217#include <linux/time.h> /* struct timeval */
219#include <linux/net.h> 218#include <linux/net.h>
219#include <linux/bug.h>
220#include <linux/skbuff.h> /* struct sk_buff */ 220#include <linux/skbuff.h> /* struct sk_buff */
221#include <linux/uio.h> 221#include <linux/uio.h>
222#include <net/sock.h> 222#include <net/sock.h>
@@ -249,6 +249,7 @@ struct k_atm_dev_stats {
249 struct k_atm_aal_stats aal5; 249 struct k_atm_aal_stats aal5;
250}; 250};
251 251
252struct device;
252 253
253enum { 254enum {
254 ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared 255 ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
index 53ba65e30ca..1d14b1dc1ae 100644
--- a/include/linux/atmel_tc.h
+++ b/include/linux/atmel_tc.h
@@ -34,10 +34,19 @@
34struct clk; 34struct clk;
35 35
36/** 36/**
37 * struct atmel_tcb_config - SoC data for a Timer/Counter Block
38 * @counter_width: size in bits of a timer counter register
39 */
40struct atmel_tcb_config {
41 size_t counter_width;
42};
43
44/**
37 * struct atmel_tc - information about a Timer/Counter Block 45 * struct atmel_tc - information about a Timer/Counter Block
38 * @pdev: physical device 46 * @pdev: physical device
39 * @iomem: resource associated with the I/O register 47 * @iomem: resource associated with the I/O register
40 * @regs: mapping through which the I/O registers can be accessed 48 * @regs: mapping through which the I/O registers can be accessed
49 * @tcb_config: configuration data from SoC
41 * @irq: irq for each of the three channels 50 * @irq: irq for each of the three channels
42 * @clk: internal clock source for each of the three channels 51 * @clk: internal clock source for each of the three channels
43 * @node: list node, for tclib internal use 52 * @node: list node, for tclib internal use
@@ -54,6 +63,7 @@ struct atmel_tc {
54 struct platform_device *pdev; 63 struct platform_device *pdev;
55 struct resource *iomem; 64 struct resource *iomem;
56 void __iomem *regs; 65 void __iomem *regs;
66 struct atmel_tcb_config *tcb_config;
57 int irq[3]; 67 int irq[3];
58 struct clk *clk[3]; 68 struct clk *clk[3];
59 struct list_head node; 69 struct list_head node;
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index c3ab81428c6..896c6892f32 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -9,10 +9,11 @@
9#ifndef _ATTRIBUTE_CONTAINER_H_ 9#ifndef _ATTRIBUTE_CONTAINER_H_
10#define _ATTRIBUTE_CONTAINER_H_ 10#define _ATTRIBUTE_CONTAINER_H_
11 11
12#include <linux/device.h>
13#include <linux/list.h> 12#include <linux/list.h>
14#include <linux/klist.h> 13#include <linux/klist.h>
15 14
15struct device;
16
16struct attribute_container { 17struct attribute_container {
17 struct list_head node; 18 struct list_head node;
18 struct klist containers; 19 struct klist containers;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index de5422a5751..4d94eb8bcbc 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -23,6 +23,7 @@
23#include <linux/highmem.h> 23#include <linux/highmem.h>
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/ioprio.h> 25#include <linux/ioprio.h>
26#include <linux/bug.h>
26 27
27#ifdef CONFIG_BLOCK 28#ifdef CONFIG_BLOCK
28 29
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
index ac4d9f8b52e..3b5bafce433 100644
--- a/include/linux/bit_spinlock.h
+++ b/include/linux/bit_spinlock.h
@@ -4,6 +4,7 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/preempt.h> 5#include <linux/preempt.h>
6#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <linux/bug.h>
7 8
8/* 9/*
9 * bit-based spin_lock() 10 * bit-based spin_lock()
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 94300fe46cc..a3b6b82108b 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -27,11 +27,22 @@ extern unsigned long __sw_hweight64(__u64 w);
27 (bit) = find_next_bit((addr), (size), (bit) + 1)) 27 (bit) = find_next_bit((addr), (size), (bit) + 1))
28 28
29/* same as for_each_set_bit() but use bit as value to start with */ 29/* same as for_each_set_bit() but use bit as value to start with */
30#define for_each_set_bit_cont(bit, addr, size) \ 30#define for_each_set_bit_from(bit, addr, size) \
31 for ((bit) = find_next_bit((addr), (size), (bit)); \ 31 for ((bit) = find_next_bit((addr), (size), (bit)); \
32 (bit) < (size); \ 32 (bit) < (size); \
33 (bit) = find_next_bit((addr), (size), (bit) + 1)) 33 (bit) = find_next_bit((addr), (size), (bit) + 1))
34 34
35#define for_each_clear_bit(bit, addr, size) \
36 for ((bit) = find_first_zero_bit((addr), (size)); \
37 (bit) < (size); \
38 (bit) = find_next_zero_bit((addr), (size), (bit) + 1))
39
40/* same as for_each_clear_bit() but use bit as value to start with */
41#define for_each_clear_bit_from(bit, addr, size) \
42 for ((bit) = find_next_zero_bit((addr), (size), (bit)); \
43 (bit) < (size); \
44 (bit) = find_next_zero_bit((addr), (size), (bit) + 1))
45
35static __inline__ int get_bitmask_order(unsigned int count) 46static __inline__ int get_bitmask_order(unsigned int count)
36{ 47{
37 int order; 48 int order;
diff --git a/include/linux/bug.h b/include/linux/bug.h
index d276b5510c8..72961c39576 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -11,6 +11,67 @@ enum bug_trap_type {
11 11
12struct pt_regs; 12struct pt_regs;
13 13
14#ifdef __CHECKER__
15#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
16#define BUILD_BUG_ON_ZERO(e) (0)
17#define BUILD_BUG_ON_NULL(e) ((void*)0)
18#define BUILD_BUG_ON(condition)
19#define BUILD_BUG() (0)
20#else /* __CHECKER__ */
21
22/* Force a compilation error if a constant expression is not a power of 2 */
23#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
24 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
25
26/* Force a compilation error if condition is true, but also produce a
27 result (of value 0 and type size_t), so the expression can be used
28 e.g. in a structure initializer (or where-ever else comma expressions
29 aren't permitted). */
30#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
31#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
32
33/**
34 * BUILD_BUG_ON - break compile if a condition is true.
35 * @condition: the condition which the compiler should know is false.
36 *
37 * If you have some code which relies on certain constants being equal, or
38 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to
39 * detect if someone changes it.
40 *
41 * The implementation uses gcc's reluctance to create a negative array, but
42 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
43 * to inline functions). So as a fallback we use the optimizer; if it can't
44 * prove the condition is false, it will cause a link error on the undefined
45 * "__build_bug_on_failed". This error message can be harder to track down
46 * though, hence the two different methods.
47 */
48#ifndef __OPTIMIZE__
49#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
50#else
51extern int __build_bug_on_failed;
52#define BUILD_BUG_ON(condition) \
53 do { \
54 ((void)sizeof(char[1 - 2*!!(condition)])); \
55 if (condition) __build_bug_on_failed = 1; \
56 } while(0)
57#endif
58
59/**
60 * BUILD_BUG - break compile if used.
61 *
62 * If you have some code that you expect the compiler to eliminate at
63 * build time, you should use BUILD_BUG to detect if it is
64 * unexpectedly used.
65 */
66#define BUILD_BUG() \
67 do { \
68 extern void __build_bug_failed(void) \
69 __linktime_error("BUILD_BUG failed"); \
70 __build_bug_failed(); \
71 } while (0)
72
73#endif /* __CHECKER__ */
74
14#ifdef CONFIG_GENERIC_BUG 75#ifdef CONFIG_GENERIC_BUG
15#include <asm-generic/bug.h> 76#include <asm-generic/bug.h>
16 77
diff --git a/include/linux/c2port.h b/include/linux/c2port.h
index a2f7d7413f3..4efabcb5134 100644
--- a/include/linux/c2port.h
+++ b/include/linux/c2port.h
@@ -9,11 +9,12 @@
9 * the Free Software Foundation 9 * the Free Software Foundation
10 */ 10 */
11 11
12#include <linux/device.h>
13#include <linux/kmemcheck.h> 12#include <linux/kmemcheck.h>
14 13
15#define C2PORT_NAME_LEN 32 14#define C2PORT_NAME_LEN 32
16 15
16struct device;
17
17/* 18/*
18 * C2 port basic structs 19 * C2 port basic structs
19 */ 20 */
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 7c48029dffe..dfd7f187c35 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -910,7 +910,6 @@ struct mode_page_header {
910 910
911#ifdef __KERNEL__ 911#ifdef __KERNEL__
912#include <linux/fs.h> /* not really needed, later.. */ 912#include <linux/fs.h> /* not really needed, later.. */
913#include <linux/device.h>
914#include <linux/list.h> 913#include <linux/list.h>
915 914
916struct packet_command 915struct packet_command
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index c5b6939fb32..220ae21e819 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -1,8 +1,9 @@
1#ifndef __CEPH_DECODE_H 1#ifndef __CEPH_DECODE_H
2#define __CEPH_DECODE_H 2#define __CEPH_DECODE_H
3 3
4#include <asm/unaligned.h> 4#include <linux/bug.h>
5#include <linux/time.h> 5#include <linux/time.h>
6#include <asm/unaligned.h>
6 7
7#include "types.h" 8#include "types.h"
8 9
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 95bd8502e71..e71d683982a 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -7,6 +7,7 @@
7#include <linux/backing-dev.h> 7#include <linux/backing-dev.h>
8#include <linux/completion.h> 8#include <linux/completion.h>
9#include <linux/exportfs.h> 9#include <linux/exportfs.h>
10#include <linux/bug.h>
10#include <linux/fs.h> 11#include <linux/fs.h>
11#include <linux/mempool.h> 12#include <linux/mempool.h>
12#include <linux/pagemap.h> 13#include <linux/pagemap.h>
@@ -207,7 +208,7 @@ extern struct kmem_cache *ceph_cap_cachep;
207extern struct kmem_cache *ceph_dentry_cachep; 208extern struct kmem_cache *ceph_dentry_cachep;
208extern struct kmem_cache *ceph_file_cachep; 209extern struct kmem_cache *ceph_file_cachep;
209 210
210extern int ceph_parse_options(struct ceph_options **popt, char *options, 211extern struct ceph_options *ceph_parse_options(char *options,
211 const char *dev_name, const char *dev_name_end, 212 const char *dev_name, const char *dev_name_end,
212 int (*parse_extra_token)(char *c, void *private), 213 int (*parse_extra_token)(char *c, void *private),
213 void *private); 214 void *private);
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
index 4c5cb0880bb..9935fac8c10 100644
--- a/include/linux/ceph/mdsmap.h
+++ b/include/linux/ceph/mdsmap.h
@@ -1,6 +1,7 @@
1#ifndef _FS_CEPH_MDSMAP_H 1#ifndef _FS_CEPH_MDSMAP_H
2#define _FS_CEPH_MDSMAP_H 2#define _FS_CEPH_MDSMAP_H
3 3
4#include <linux/bug.h>
4#include "types.h" 5#include "types.h"
5 6
6/* 7/*
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index ffbeb2c217b..3bff047f6b0 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 00000000000..5e4312b6f5c
--- /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 00000000000..5508897ad37
--- /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 b9d46fa154b..b0252726df6 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 e3d8bf26e5e..aa629bce903 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 7e05fcee75a..5d46217f84a 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/compiler-gcc.h b/include/linux/compiler-gcc.h
index 3fd17c24922..e5834aa24b9 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -87,7 +87,8 @@
87 */ 87 */
88#define __pure __attribute__((pure)) 88#define __pure __attribute__((pure))
89#define __aligned(x) __attribute__((aligned(x))) 89#define __aligned(x) __attribute__((aligned(x)))
90#define __printf(a,b) __attribute__((format(printf,a,b))) 90#define __printf(a, b) __attribute__((format(printf, a, b)))
91#define __scanf(a, b) __attribute__((format(scanf, a, b)))
91#define noinline __attribute__((noinline)) 92#define noinline __attribute__((noinline))
92#define __attribute_const__ __attribute__((__const__)) 93#define __attribute_const__ __attribute__((__const__))
93#define __maybe_unused __attribute__((unused)) 94#define __maybe_unused __attribute__((unused))
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 6e53b4823d7..ee28844ae68 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -14,11 +14,12 @@
14#ifndef _LINUX_CPU_H_ 14#ifndef _LINUX_CPU_H_
15#define _LINUX_CPU_H_ 15#define _LINUX_CPU_H_
16 16
17#include <linux/device.h>
18#include <linux/node.h> 17#include <linux/node.h>
19#include <linux/compiler.h> 18#include <linux/compiler.h>
20#include <linux/cpumask.h> 19#include <linux/cpumask.h>
21 20
21struct device;
22
22struct cpu { 23struct cpu {
23 int node_id; /* The node which contains the CPU */ 24 int node_id; /* The node which contains the CPU */
24 int hotpluggable; /* creates sysfs control file if hotpluggable */ 25 int hotpluggable; /* creates sysfs control file if hotpluggable */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 6216115c778..b60f6ba01d0 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -14,7 +14,6 @@
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/notifier.h> 15#include <linux/notifier.h>
16#include <linux/threads.h> 16#include <linux/threads.h>
17#include <linux/device.h>
18#include <linux/kobject.h> 17#include <linux/kobject.h>
19#include <linux/sysfs.h> 18#include <linux/sysfs.h>
20#include <linux/completion.h> 19#include <linux/completion.h>
@@ -35,6 +34,7 @@
35#ifdef CONFIG_CPU_FREQ 34#ifdef CONFIG_CPU_FREQ
36int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); 35int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
37int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); 36int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
37extern void disable_cpufreq(void);
38#else /* CONFIG_CPU_FREQ */ 38#else /* CONFIG_CPU_FREQ */
39static inline int cpufreq_register_notifier(struct notifier_block *nb, 39static inline int cpufreq_register_notifier(struct notifier_block *nb,
40 unsigned int list) 40 unsigned int list)
@@ -46,6 +46,7 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
46{ 46{
47 return 0; 47 return 0;
48} 48}
49static inline void disable_cpufreq(void) { }
49#endif /* CONFIG_CPU_FREQ */ 50#endif /* CONFIG_CPU_FREQ */
50 51
51/* if (cpufreq_driver->target) exists, the ->governor decides what frequency 52/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 712abcc205a..6c26a3da0e0 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 4f7a6323747..a2c819d3c96 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/threads.h> 10#include <linux/threads.h>
11#include <linux/bitmap.h> 11#include <linux/bitmap.h>
12#include <linux/bug.h>
12 13
13typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 14typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
14 15
@@ -763,12 +764,6 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
763 * 764 *
764 */ 765 */
765#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS 766#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
766/* These strip const, as traditionally they weren't const. */
767#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
768#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
769#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
770#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
771
772#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu)) 767#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
773 768
774#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) 769#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
@@ -809,11 +804,10 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
809#else /* NR_CPUS > 1 */ 804#else /* NR_CPUS > 1 */
810int __first_cpu(const cpumask_t *srcp); 805int __first_cpu(const cpumask_t *srcp);
811int __next_cpu(int n, const cpumask_t *srcp); 806int __next_cpu(int n, const cpumask_t *srcp);
812int __any_online_cpu(const cpumask_t *mask);
813 807
814#define first_cpu(src) __first_cpu(&(src)) 808#define first_cpu(src) __first_cpu(&(src))
815#define next_cpu(n, src) __next_cpu((n), &(src)) 809#define next_cpu(n, src) __next_cpu((n), &(src))
816#define any_online_cpu(mask) __any_online_cpu(&(mask)) 810#define any_online_cpu(mask) cpumask_any_and(&mask, cpu_online_mask)
817#define for_each_cpu_mask(cpu, mask) \ 811#define for_each_cpu_mask(cpu, mask) \
818 for ((cpu) = -1; \ 812 for ((cpu) = -1; \
819 (cpu) = next_cpu((cpu), (mask)), \ 813 (cpu) = next_cpu((cpu), (mask)), \
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 7a7e5fd2a27..668f66baac7 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/crash_dump.h b/include/linux/crash_dump.h
index b936763f223..37e4f8da7cd 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -3,7 +3,6 @@
3 3
4#ifdef CONFIG_CRASH_DUMP 4#ifdef CONFIG_CRASH_DUMP
5#include <linux/kexec.h> 5#include <linux/kexec.h>
6#include <linux/device.h>
7#include <linux/proc_fs.h> 6#include <linux/proc_fs.h>
8#include <linux/elf.h> 7#include <linux/elf.h>
9 8
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index 391a259b2cc..68267b64bb9 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -11,6 +11,8 @@
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len);
15
14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) 16#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
15 17
16/* 18/*
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 48ce5479386..b92eadf92d7 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -20,6 +20,7 @@
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/bug.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/string.h> 25#include <linux/string.h>
25#include <linux/uaccess.h> 26#include <linux/uaccess.h>
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 5033fb88c10..3bd46f76675 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/atomic.h> 5#include <linux/atomic.h>
6#include <asm/system.h> 6#include <linux/bug.h>
7 7
8struct task_struct; 8struct task_struct;
9 9
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index f8ac076afa5..3efbfc2145c 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -26,11 +26,12 @@
26 26
27#include <linux/file.h> 27#include <linux/file.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/device.h>
30#include <linux/scatterlist.h> 29#include <linux/scatterlist.h>
31#include <linux/list.h> 30#include <linux/list.h>
32#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
32#include <linux/fs.h>
33 33
34struct device;
34struct dma_buf; 35struct dma_buf;
35struct dma_buf_attachment; 36struct dma_buf_attachment;
36 37
@@ -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 e13117cbd2f..5a736af3cc7 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -77,7 +77,7 @@ static inline u64 dma_get_mask(struct device *dev)
77 return DMA_BIT_MASK(32); 77 return DMA_BIT_MASK(32);
78} 78}
79 79
80#ifdef ARCH_HAS_DMA_SET_COHERENT_MASK 80#ifdef CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK
81int dma_set_coherent_mask(struct device *dev, u64 mask); 81int dma_set_coherent_mask(struct device *dev, u64 mask);
82#else 82#else
83static inline int dma_set_coherent_mask(struct device *dev, u64 mask) 83static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 679b349d9b6..676f967390a 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -18,13 +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/scatterlist.h> 27#include <linux/scatterlist.h>
27#include <linux/bitmap.h> 28#include <linux/bitmap.h>
29#include <linux/types.h>
28#include <asm/page.h> 30#include <asm/page.h>
29 31
30/** 32/**
@@ -257,6 +259,7 @@ struct dma_chan_percpu {
257 * struct dma_chan - devices supply DMA channels, clients use them 259 * struct dma_chan - devices supply DMA channels, clients use them
258 * @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
259 * @cookie: last cookie value returned to client 261 * @cookie: last cookie value returned to client
262 * @completed_cookie: last completed cookie for this channel
260 * @chan_id: channel ID for sysfs 263 * @chan_id: channel ID for sysfs
261 * @dev: class device for sysfs 264 * @dev: class device for sysfs
262 * @device_node: used to add this to the device chan list 265 * @device_node: used to add this to the device chan list
@@ -268,6 +271,7 @@ struct dma_chan_percpu {
268struct dma_chan { 271struct dma_chan {
269 struct dma_device *device; 272 struct dma_device *device;
270 dma_cookie_t cookie; 273 dma_cookie_t cookie;
274 dma_cookie_t completed_cookie;
271 275
272 /* sysfs */ 276 /* sysfs */
273 int chan_id; 277 int chan_id;
@@ -331,6 +335,9 @@ enum dma_slave_buswidth {
331 * may or may not be applicable on memory sources. 335 * may or may not be applicable on memory sources.
332 * @dst_maxburst: same as src_maxburst but for destination target 336 * @dst_maxburst: same as src_maxburst but for destination target
333 * 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.
334 * 341 *
335 * 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
336 * 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.
@@ -357,6 +364,7 @@ struct dma_slave_config {
357 enum dma_slave_buswidth dst_addr_width; 364 enum dma_slave_buswidth dst_addr_width;
358 u32 src_maxburst; 365 u32 src_maxburst;
359 u32 dst_maxburst; 366 u32 dst_maxburst;
367 bool device_fc;
360}; 368};
361 369
362static inline const char *dma_chan_name(struct dma_chan *chan) 370static inline const char *dma_chan_name(struct dma_chan *chan)
@@ -575,10 +583,11 @@ struct dma_device {
575 struct dma_async_tx_descriptor *(*device_prep_slave_sg)( 583 struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
576 struct dma_chan *chan, struct scatterlist *sgl, 584 struct dma_chan *chan, struct scatterlist *sgl,
577 unsigned int sg_len, enum dma_transfer_direction direction, 585 unsigned int sg_len, enum dma_transfer_direction direction,
578 unsigned long flags); 586 unsigned long flags, void *context);
579 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 587 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
580 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,
581 size_t period_len, enum dma_transfer_direction direction); 589 size_t period_len, enum dma_transfer_direction direction,
590 void *context);
582 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( 591 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
583 struct dma_chan *chan, struct dma_interleaved_template *xt, 592 struct dma_chan *chan, struct dma_interleaved_template *xt,
584 unsigned long flags); 593 unsigned long flags);
@@ -612,7 +621,24 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
612 struct scatterlist sg; 621 struct scatterlist sg;
613 sg_init_one(&sg, buf, len); 622 sg_init_one(&sg, buf, len);
614 623
615 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);
616} 642}
617 643
618static 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 f2c64f92c4a..2412e02d7c0 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 1cd3947987e..c621d762bb2 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -13,7 +13,11 @@
13#define _LINUX_EDAC_H_ 13#define _LINUX_EDAC_H_
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/device.h> 16#include <linux/kobject.h>
17#include <linux/completion.h>
18#include <linux/workqueue.h>
19
20struct device;
17 21
18#define EDAC_OPSTATE_INVAL -1 22#define EDAC_OPSTATE_INVAL -1
19#define EDAC_OPSTATE_POLL 0 23#define EDAC_OPSTATE_POLL 0
@@ -66,25 +70,64 @@ enum dev_type {
66#define DEV_FLAG_X32 BIT(DEV_X32) 70#define DEV_FLAG_X32 BIT(DEV_X32)
67#define DEV_FLAG_X64 BIT(DEV_X64) 71#define DEV_FLAG_X64 BIT(DEV_X64)
68 72
69/* 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 */
70enum mem_type { 113enum mem_type {
71 MEM_EMPTY = 0, /* Empty csrow */ 114 MEM_EMPTY = 0,
72 MEM_RESERVED, /* Reserved csrow type */ 115 MEM_RESERVED,
73 MEM_UNKNOWN, /* Unknown csrow type */ 116 MEM_UNKNOWN,
74 MEM_FPM, /* Fast page mode */ 117 MEM_FPM,
75 MEM_EDO, /* Extended data out */ 118 MEM_EDO,
76 MEM_BEDO, /* Burst Extended data out */ 119 MEM_BEDO,
77 MEM_SDR, /* Single data rate SDRAM */ 120 MEM_SDR,
78 MEM_RDR, /* Registered single data rate SDRAM */ 121 MEM_RDR,
79 MEM_DDR, /* Double data rate SDRAM */ 122 MEM_DDR,
80 MEM_RDDR, /* Registered Double data rate SDRAM */ 123 MEM_RDDR,
81 MEM_RMBS, /* Rambus DRAM */ 124 MEM_RMBS,
82 MEM_DDR2, /* DDR2 RAM */ 125 MEM_DDR2,
83 MEM_FB_DDR2, /* fully buffered DDR2 */ 126 MEM_FB_DDR2,
84 MEM_RDDR2, /* Registered DDR2 RAM */ 127 MEM_RDDR2,
85 MEM_XDR, /* Rambus XDR */ 128 MEM_XDR,
86 MEM_DDR3, /* DDR3 RAM */ 129 MEM_DDR3,
87 MEM_RDDR3, /* Registered DDR3 RAM */ 130 MEM_RDDR3,
88}; 131};
89 132
90#define MEM_FLAG_EMPTY BIT(MEM_EMPTY) 133#define MEM_FLAG_EMPTY BIT(MEM_EMPTY)
@@ -162,8 +205,9 @@ enum scrub_type {
162#define OP_OFFLINE 0x300 205#define OP_OFFLINE 0x300
163 206
164/* 207/*
165 * There are several things to be aware of that aren't at all obvious: 208 * Concepts used at the EDAC subsystem
166 * 209 *
210 * There are several things to be aware of that aren't at all obvious:
167 * 211 *
168 * SOCKETS, SOCKET SETS, BANKS, ROWS, CHIP-SELECT ROWS, CHANNELS, etc.. 212 * SOCKETS, SOCKET SETS, BANKS, ROWS, CHIP-SELECT ROWS, CHANNELS, etc..
169 * 213 *
@@ -172,36 +216,61 @@ enum scrub_type {
172 * creating a common ground for discussion, terms and their definitions 216 * creating a common ground for discussion, terms and their definitions
173 * will be established. 217 * will be established.
174 * 218 *
175 * Memory devices: The individual chip on a memory stick. These devices 219 * Memory devices: The individual DRAM chips on a memory stick. These
176 * commonly output 4 and 8 bits each. Grouping several 220 * devices commonly output 4 and 8 bits each (x4, x8).
177 * of these in parallel provides 64 bits which is common 221 * Grouping several of these in parallel provides the
178 * 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.
179 * 225 *
180 * Memory Stick: A printed circuit board that aggregates multiple 226 * Memory Stick: A printed circuit board that aggregates multiple
181 * memory devices in parallel. This is the atomic 227 * memory devices in parallel. In general, this is the
182 * memory component that is purchaseable by Joe consumer 228 * Field Replaceable Unit (FRU) which gets replaced, in
183 * 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.
184 * 235 *
185 * Socket: A physical connector on the motherboard that accepts 236 * Channel: A memory controller channel, responsible to communicate
186 * 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.
187 * 240 *
188 * Channel: Set of memory devices on a memory stick that must be 241 * Branch: It is typically the highest hierarchy on a
189 * grouped in parallel with one or more additional 242 * Fully-Buffered DIMM memory controller.
190 * channels from other memory sticks. This parallel 243 * Typically, it contains two channels.
191 * grouping of the output from multiple channels are 244 * Two channels at the same branch can be used in single
192 * necessary for the smallest granularity of memory access. 245 * mode or in lockstep mode.
193 * Some memory controllers are capable of single channel - 246 * When lockstep is enabled, the cacheline is doubled,
194 * which means that memory sticks can be loaded 247 * but it generally brings some performance penalty.
195 * individually. Other memory controllers are only 248 * Also, it is generally not possible to point to just one
196 * capable of dual channel - which means that memory 249 * memory stick when an error occurs, as the error
197 * 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.
198 * 253 *
199 * Chip-select row: All of the memory devices that are selected together. 254 * Single-channel: The data accessed by the memory controller is contained
200 * for a single, minimum grain of memory access. 255 * into one dimm only. E. g. if the data is 64 bits-wide,
201 * This selects all of the parallel memory devices across 256 * the data flows to the CPU using one 64 bits parallel
202 * all of the parallel channels. Common chip-select rows 257 * access.
203 * for single channel are 64 bits, for dual channel 128 258 * Typically used with SDR, DDR, DDR2 and DDR3 memories.
204 * 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.
205 * 274 *
206 * 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.
207 * Motherboards commonly drive two chip-select pins to 276 * Motherboards commonly drive two chip-select pins to
@@ -214,8 +283,8 @@ enum scrub_type {
214 * 283 *
215 * Double-sided stick: DEPRECATED TERM, see Double-Ranked stick. 284 * Double-sided stick: DEPRECATED TERM, see Double-Ranked stick.
216 * A double-sided stick has two chip-select rows which 285 * A double-sided stick has two chip-select rows which
217 * access different sets of memory devices. The two 286 * access different sets of memory devices. The two
218 * rows cannot be accessed concurrently. "Double-sided" 287 * rows cannot be accessed concurrently. "Double-sided"
219 * is irrespective of the memory devices being mounted 288 * is irrespective of the memory devices being mounted
220 * on both sides of the memory stick. 289 * on both sides of the memory stick.
221 * 290 *
@@ -243,10 +312,22 @@ enum scrub_type {
243 * 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.
244 */ 313 */
245 314
246struct channel_info { 315/**
247 int chan_idx; /* channel index */ 316 * struct rank_info - contains the information for one DIMM rank
248 u32 ce_count; /* Correctable Errors for this CHANNEL */ 317 *
249 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];
250 struct csrow_info *csrow; /* the parent */ 331 struct csrow_info *csrow; /* the parent */
251}; 332};
252 333
@@ -270,7 +351,7 @@ struct csrow_info {
270 351
271 /* channel information for this csrow */ 352 /* channel information for this csrow */
272 u32 nr_channels; 353 u32 nr_channels;
273 struct channel_info *channels; 354 struct rank_info *channels;
274}; 355};
275 356
276struct mcidev_sysfs_group { 357struct mcidev_sysfs_group {
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 47fbf6b3dc7..88ec80670d5 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/elfcore.h b/include/linux/elfcore.h
index 394a3e0e4a6..0698c79fbcb 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -6,6 +6,7 @@
6#include <linux/time.h> 6#include <linux/time.h>
7#ifdef __KERNEL__ 7#ifdef __KERNEL__
8#include <linux/user.h> 8#include <linux/user.h>
9#include <linux/bug.h>
9#endif 10#endif
10#include <linux/ptrace.h> 11#include <linux/ptrace.h>
11#include <linux/elf.h> 12#include <linux/elf.h>
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index ce1b719e8bd..2723e715f67 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 db4d9f586bb..00000000000
--- 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 f957085d40e..00000000000
--- a/include/linux/ext3_fs.h
+++ /dev/null
@@ -1,979 +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
22/*
23 * The second extended filesystem constants/structures
24 */
25
26/*
27 * Define EXT3FS_DEBUG to produce debug messages
28 */
29#undef EXT3FS_DEBUG
30
31/*
32 * Define EXT3_RESERVATION to reserve data blocks for expanding files
33 */
34#define EXT3_DEFAULT_RESERVE_BLOCKS 8
35/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
36#define EXT3_MAX_RESERVE_BLOCKS 1027
37#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
38
39/*
40 * Debug code
41 */
42#ifdef EXT3FS_DEBUG
43#define ext3_debug(f, a...) \
44 do { \
45 printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \
46 __FILE__, __LINE__, __func__); \
47 printk (KERN_DEBUG f, ## a); \
48 } while (0)
49#else
50#define ext3_debug(f, a...) do {} while (0)
51#endif
52
53/*
54 * Special inodes numbers
55 */
56#define EXT3_BAD_INO 1 /* Bad blocks inode */
57#define EXT3_ROOT_INO 2 /* Root inode */
58#define EXT3_BOOT_LOADER_INO 5 /* Boot loader inode */
59#define EXT3_UNDEL_DIR_INO 6 /* Undelete directory inode */
60#define EXT3_RESIZE_INO 7 /* Reserved group descriptors inode */
61#define EXT3_JOURNAL_INO 8 /* Journal inode */
62
63/* First non-reserved inode for old ext3 filesystems */
64#define EXT3_GOOD_OLD_FIRST_INO 11
65
66/*
67 * Maximal count of links to a file
68 */
69#define EXT3_LINK_MAX 32000
70
71/*
72 * Macro-instructions used to manage several block sizes
73 */
74#define EXT3_MIN_BLOCK_SIZE 1024
75#define EXT3_MAX_BLOCK_SIZE 65536
76#define EXT3_MIN_BLOCK_LOG_SIZE 10
77#ifdef __KERNEL__
78# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
79#else
80# define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
81#endif
82#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
83#ifdef __KERNEL__
84# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
85#else
86# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
87#endif
88#ifdef __KERNEL__
89#define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits)
90#define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size)
91#define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino)
92#else
93#define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
94 EXT3_GOOD_OLD_INODE_SIZE : \
95 (s)->s_inode_size)
96#define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
97 EXT3_GOOD_OLD_FIRST_INO : \
98 (s)->s_first_ino)
99#endif
100
101/*
102 * Macro-instructions used to manage fragments
103 */
104#define EXT3_MIN_FRAG_SIZE 1024
105#define EXT3_MAX_FRAG_SIZE 4096
106#define EXT3_MIN_FRAG_LOG_SIZE 10
107#ifdef __KERNEL__
108# define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size)
109# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block)
110#else
111# define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
112# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
113#endif
114
115/*
116 * Structure of a blocks group descriptor
117 */
118struct ext3_group_desc
119{
120 __le32 bg_block_bitmap; /* Blocks bitmap block */
121 __le32 bg_inode_bitmap; /* Inodes bitmap block */
122 __le32 bg_inode_table; /* Inodes table block */
123 __le16 bg_free_blocks_count; /* Free blocks count */
124 __le16 bg_free_inodes_count; /* Free inodes count */
125 __le16 bg_used_dirs_count; /* Directories count */
126 __u16 bg_pad;
127 __le32 bg_reserved[3];
128};
129
130/*
131 * Macro-instructions used to manage group descriptors
132 */
133#ifdef __KERNEL__
134# define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group)
135# define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block)
136# define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group)
137# define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits)
138#else
139# define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
140# define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
141# define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
142#endif
143
144/*
145 * Constants relative to the data blocks
146 */
147#define EXT3_NDIR_BLOCKS 12
148#define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS
149#define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1)
150#define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1)
151#define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1)
152
153/*
154 * Inode flags
155 */
156#define EXT3_SECRM_FL 0x00000001 /* Secure deletion */
157#define EXT3_UNRM_FL 0x00000002 /* Undelete */
158#define EXT3_COMPR_FL 0x00000004 /* Compress file */
159#define EXT3_SYNC_FL 0x00000008 /* Synchronous updates */
160#define EXT3_IMMUTABLE_FL 0x00000010 /* Immutable file */
161#define EXT3_APPEND_FL 0x00000020 /* writes to file may only append */
162#define EXT3_NODUMP_FL 0x00000040 /* do not dump file */
163#define EXT3_NOATIME_FL 0x00000080 /* do not update atime */
164/* Reserved for compression usage... */
165#define EXT3_DIRTY_FL 0x00000100
166#define EXT3_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
167#define EXT3_NOCOMPR_FL 0x00000400 /* Don't compress */
168#define EXT3_ECOMPR_FL 0x00000800 /* Compression error */
169/* End compression flags --- maybe not all used */
170#define EXT3_INDEX_FL 0x00001000 /* hash-indexed directory */
171#define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */
172#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
173#define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
174#define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
175#define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
176#define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */
177
178#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
179#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
180
181/* Flags that should be inherited by new inodes from their parent. */
182#define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
183 EXT3_SYNC_FL | EXT3_NODUMP_FL |\
184 EXT3_NOATIME_FL | EXT3_COMPRBLK_FL |\
185 EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\
186 EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL)
187
188/* Flags that are appropriate for regular files (all but dir-specific ones). */
189#define EXT3_REG_FLMASK (~(EXT3_DIRSYNC_FL | EXT3_TOPDIR_FL))
190
191/* Flags that are appropriate for non-directories/regular files. */
192#define EXT3_OTHER_FLMASK (EXT3_NODUMP_FL | EXT3_NOATIME_FL)
193
194/* Mask out flags that are inappropriate for the given type of inode. */
195static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
196{
197 if (S_ISDIR(mode))
198 return flags;
199 else if (S_ISREG(mode))
200 return flags & EXT3_REG_FLMASK;
201 else
202 return flags & EXT3_OTHER_FLMASK;
203}
204
205/* Used to pass group descriptor data when online resize is done */
206struct ext3_new_group_input {
207 __u32 group; /* Group number for this data */
208 __u32 block_bitmap; /* Absolute block number of block bitmap */
209 __u32 inode_bitmap; /* Absolute block number of inode bitmap */
210 __u32 inode_table; /* Absolute block number of inode table start */
211 __u32 blocks_count; /* Total number of blocks in this group */
212 __u16 reserved_blocks; /* Number of reserved blocks in this group */
213 __u16 unused;
214};
215
216/* The struct ext3_new_group_input in kernel space, with free_blocks_count */
217struct ext3_new_group_data {
218 __u32 group;
219 __u32 block_bitmap;
220 __u32 inode_bitmap;
221 __u32 inode_table;
222 __u32 blocks_count;
223 __u16 reserved_blocks;
224 __u16 unused;
225 __u32 free_blocks_count;
226};
227
228
229/*
230 * ioctl commands
231 */
232#define EXT3_IOC_GETFLAGS FS_IOC_GETFLAGS
233#define EXT3_IOC_SETFLAGS FS_IOC_SETFLAGS
234#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
235#define EXT3_IOC_SETVERSION _IOW('f', 4, long)
236#define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
237#define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input)
238#define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION
239#define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION
240#ifdef CONFIG_JBD_DEBUG
241#define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
242#endif
243#define EXT3_IOC_GETRSVSZ _IOR('f', 5, long)
244#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long)
245
246/*
247 * ioctl commands in 32 bit emulation
248 */
249#define EXT3_IOC32_GETFLAGS FS_IOC32_GETFLAGS
250#define EXT3_IOC32_SETFLAGS FS_IOC32_SETFLAGS
251#define EXT3_IOC32_GETVERSION _IOR('f', 3, int)
252#define EXT3_IOC32_SETVERSION _IOW('f', 4, int)
253#define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int)
254#define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int)
255#define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
256#ifdef CONFIG_JBD_DEBUG
257#define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
258#endif
259#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
260#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
261
262
263/*
264 * Mount options
265 */
266struct ext3_mount_options {
267 unsigned long s_mount_opt;
268 uid_t s_resuid;
269 gid_t s_resgid;
270 unsigned long s_commit_interval;
271#ifdef CONFIG_QUOTA
272 int s_jquota_fmt;
273 char *s_qf_names[MAXQUOTAS];
274#endif
275};
276
277/*
278 * Structure of an inode on the disk
279 */
280struct ext3_inode {
281 __le16 i_mode; /* File mode */
282 __le16 i_uid; /* Low 16 bits of Owner Uid */
283 __le32 i_size; /* Size in bytes */
284 __le32 i_atime; /* Access time */
285 __le32 i_ctime; /* Creation time */
286 __le32 i_mtime; /* Modification time */
287 __le32 i_dtime; /* Deletion Time */
288 __le16 i_gid; /* Low 16 bits of Group Id */
289 __le16 i_links_count; /* Links count */
290 __le32 i_blocks; /* Blocks count */
291 __le32 i_flags; /* File flags */
292 union {
293 struct {
294 __u32 l_i_reserved1;
295 } linux1;
296 struct {
297 __u32 h_i_translator;
298 } hurd1;
299 struct {
300 __u32 m_i_reserved1;
301 } masix1;
302 } osd1; /* OS dependent 1 */
303 __le32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
304 __le32 i_generation; /* File version (for NFS) */
305 __le32 i_file_acl; /* File ACL */
306 __le32 i_dir_acl; /* Directory ACL */
307 __le32 i_faddr; /* Fragment address */
308 union {
309 struct {
310 __u8 l_i_frag; /* Fragment number */
311 __u8 l_i_fsize; /* Fragment size */
312 __u16 i_pad1;
313 __le16 l_i_uid_high; /* these 2 fields */
314 __le16 l_i_gid_high; /* were reserved2[0] */
315 __u32 l_i_reserved2;
316 } linux2;
317 struct {
318 __u8 h_i_frag; /* Fragment number */
319 __u8 h_i_fsize; /* Fragment size */
320 __u16 h_i_mode_high;
321 __u16 h_i_uid_high;
322 __u16 h_i_gid_high;
323 __u32 h_i_author;
324 } hurd2;
325 struct {
326 __u8 m_i_frag; /* Fragment number */
327 __u8 m_i_fsize; /* Fragment size */
328 __u16 m_pad1;
329 __u32 m_i_reserved2[2];
330 } masix2;
331 } osd2; /* OS dependent 2 */
332 __le16 i_extra_isize;
333 __le16 i_pad1;
334};
335
336#define i_size_high i_dir_acl
337
338#if defined(__KERNEL__) || defined(__linux__)
339#define i_reserved1 osd1.linux1.l_i_reserved1
340#define i_frag osd2.linux2.l_i_frag
341#define i_fsize osd2.linux2.l_i_fsize
342#define i_uid_low i_uid
343#define i_gid_low i_gid
344#define i_uid_high osd2.linux2.l_i_uid_high
345#define i_gid_high osd2.linux2.l_i_gid_high
346#define i_reserved2 osd2.linux2.l_i_reserved2
347
348#elif defined(__GNU__)
349
350#define i_translator osd1.hurd1.h_i_translator
351#define i_frag osd2.hurd2.h_i_frag;
352#define i_fsize osd2.hurd2.h_i_fsize;
353#define i_uid_high osd2.hurd2.h_i_uid_high
354#define i_gid_high osd2.hurd2.h_i_gid_high
355#define i_author osd2.hurd2.h_i_author
356
357#elif defined(__masix__)
358
359#define i_reserved1 osd1.masix1.m_i_reserved1
360#define i_frag osd2.masix2.m_i_frag
361#define i_fsize osd2.masix2.m_i_fsize
362#define i_reserved2 osd2.masix2.m_i_reserved2
363
364#endif /* defined(__KERNEL__) || defined(__linux__) */
365
366/*
367 * File system states
368 */
369#define EXT3_VALID_FS 0x0001 /* Unmounted cleanly */
370#define EXT3_ERROR_FS 0x0002 /* Errors detected */
371#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
372
373/*
374 * Misc. filesystem flags
375 */
376#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
377#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
378#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */
379
380/*
381 * Mount flags
382 */
383#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */
384/* EXT3_MOUNT_OLDALLOC was there */
385#define EXT3_MOUNT_GRPID 0x00004 /* Create files with directory's group */
386#define EXT3_MOUNT_DEBUG 0x00008 /* Some debugging messages */
387#define EXT3_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
388#define EXT3_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */
389#define EXT3_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
390#define EXT3_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
391#define EXT3_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
392#define EXT3_MOUNT_ABORT 0x00200 /* Fatal error detected */
393#define EXT3_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
394#define EXT3_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
395#define EXT3_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
396#define EXT3_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */
397#define EXT3_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */
398#define EXT3_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */
399#define EXT3_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */
400#define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
401#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
402#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
403#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
404#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
405#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
406#define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write
407 * error in ordered mode */
408
409/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
410#ifndef _LINUX_EXT2_FS_H
411#define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
412#define set_opt(o, opt) o |= EXT3_MOUNT_##opt
413#define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \
414 EXT3_MOUNT_##opt)
415#else
416#define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
417#define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT
418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
419#endif
420
421#define ext3_set_bit __set_bit_le
422#define ext3_set_bit_atomic ext2_set_bit_atomic
423#define ext3_clear_bit __clear_bit_le
424#define ext3_clear_bit_atomic ext2_clear_bit_atomic
425#define ext3_test_bit test_bit_le
426#define ext3_find_next_zero_bit find_next_zero_bit_le
427
428/*
429 * Maximal mount counts between two filesystem checks
430 */
431#define EXT3_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
432#define EXT3_DFL_CHECKINTERVAL 0 /* Don't use interval check */
433
434/*
435 * Behaviour when detecting errors
436 */
437#define EXT3_ERRORS_CONTINUE 1 /* Continue execution */
438#define EXT3_ERRORS_RO 2 /* Remount fs read-only */
439#define EXT3_ERRORS_PANIC 3 /* Panic */
440#define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE
441
442/*
443 * Structure of the super block
444 */
445struct ext3_super_block {
446/*00*/ __le32 s_inodes_count; /* Inodes count */
447 __le32 s_blocks_count; /* Blocks count */
448 __le32 s_r_blocks_count; /* Reserved blocks count */
449 __le32 s_free_blocks_count; /* Free blocks count */
450/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
451 __le32 s_first_data_block; /* First Data Block */
452 __le32 s_log_block_size; /* Block size */
453 __le32 s_log_frag_size; /* Fragment size */
454/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
455 __le32 s_frags_per_group; /* # Fragments per group */
456 __le32 s_inodes_per_group; /* # Inodes per group */
457 __le32 s_mtime; /* Mount time */
458/*30*/ __le32 s_wtime; /* Write time */
459 __le16 s_mnt_count; /* Mount count */
460 __le16 s_max_mnt_count; /* Maximal mount count */
461 __le16 s_magic; /* Magic signature */
462 __le16 s_state; /* File system state */
463 __le16 s_errors; /* Behaviour when detecting errors */
464 __le16 s_minor_rev_level; /* minor revision level */
465/*40*/ __le32 s_lastcheck; /* time of last check */
466 __le32 s_checkinterval; /* max. time between checks */
467 __le32 s_creator_os; /* OS */
468 __le32 s_rev_level; /* Revision level */
469/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
470 __le16 s_def_resgid; /* Default gid for reserved blocks */
471 /*
472 * These fields are for EXT3_DYNAMIC_REV superblocks only.
473 *
474 * Note: the difference between the compatible feature set and
475 * the incompatible feature set is that if there is a bit set
476 * in the incompatible feature set that the kernel doesn't
477 * know about, it should refuse to mount the filesystem.
478 *
479 * e2fsck's requirements are more strict; if it doesn't know
480 * about a feature in either the compatible or incompatible
481 * feature set, it must abort and not try to meddle with
482 * things it doesn't understand...
483 */
484 __le32 s_first_ino; /* First non-reserved inode */
485 __le16 s_inode_size; /* size of inode structure */
486 __le16 s_block_group_nr; /* block group # of this superblock */
487 __le32 s_feature_compat; /* compatible feature set */
488/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
489 __le32 s_feature_ro_compat; /* readonly-compatible feature set */
490/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
491/*78*/ char s_volume_name[16]; /* volume name */
492/*88*/ char s_last_mounted[64]; /* directory where last mounted */
493/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
494 /*
495 * Performance hints. Directory preallocation should only
496 * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on.
497 */
498 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
499 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
500 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
501 /*
502 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
503 */
504/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
505/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
506 __le32 s_journal_dev; /* device number of journal file */
507 __le32 s_last_orphan; /* start of list of inodes to delete */
508 __le32 s_hash_seed[4]; /* HTREE hash seed */
509 __u8 s_def_hash_version; /* Default hash version to use */
510 __u8 s_reserved_char_pad;
511 __u16 s_reserved_word_pad;
512 __le32 s_default_mount_opts;
513 __le32 s_first_meta_bg; /* First metablock block group */
514 __le32 s_mkfs_time; /* When the filesystem was created */
515 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
516 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
517/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
518 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
519 __le32 s_free_blocks_count_hi; /* Free blocks count */
520 __le16 s_min_extra_isize; /* All inodes have at least # bytes */
521 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
522 __le32 s_flags; /* Miscellaneous flags */
523 __le16 s_raid_stride; /* RAID stride */
524 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
525 __le64 s_mmp_block; /* Block for multi-mount protection */
526 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
527 __u8 s_log_groups_per_flex; /* FLEX_BG group size */
528 __u8 s_reserved_char_pad2;
529 __le16 s_reserved_pad;
530 __u32 s_reserved[162]; /* Padding to the end of the block */
531};
532
533#ifdef __KERNEL__
534#include <linux/ext3_fs_i.h>
535#include <linux/ext3_fs_sb.h>
536static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb)
537{
538 return sb->s_fs_info;
539}
540static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
541{
542 return container_of(inode, struct ext3_inode_info, vfs_inode);
543}
544
545static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
546{
547 return ino == EXT3_ROOT_INO ||
548 ino == EXT3_JOURNAL_INO ||
549 ino == EXT3_RESIZE_INO ||
550 (ino >= EXT3_FIRST_INO(sb) &&
551 ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
552}
553
554/*
555 * Inode dynamic state flags
556 */
557enum {
558 EXT3_STATE_JDATA, /* journaled data exists */
559 EXT3_STATE_NEW, /* inode is newly created */
560 EXT3_STATE_XATTR, /* has in-inode xattrs */
561 EXT3_STATE_FLUSH_ON_CLOSE, /* flush dirty pages on close */
562};
563
564static inline int ext3_test_inode_state(struct inode *inode, int bit)
565{
566 return test_bit(bit, &EXT3_I(inode)->i_state_flags);
567}
568
569static inline void ext3_set_inode_state(struct inode *inode, int bit)
570{
571 set_bit(bit, &EXT3_I(inode)->i_state_flags);
572}
573
574static inline void ext3_clear_inode_state(struct inode *inode, int bit)
575{
576 clear_bit(bit, &EXT3_I(inode)->i_state_flags);
577}
578#else
579/* Assume that user mode programs are passing in an ext3fs superblock, not
580 * a kernel struct super_block. This will allow us to call the feature-test
581 * macros from user land. */
582#define EXT3_SB(sb) (sb)
583#endif
584
585#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
586
587/*
588 * Codes for operating systems
589 */
590#define EXT3_OS_LINUX 0
591#define EXT3_OS_HURD 1
592#define EXT3_OS_MASIX 2
593#define EXT3_OS_FREEBSD 3
594#define EXT3_OS_LITES 4
595
596/*
597 * Revision levels
598 */
599#define EXT3_GOOD_OLD_REV 0 /* The good old (original) format */
600#define EXT3_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
601
602#define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV
603#define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV
604
605#define EXT3_GOOD_OLD_INODE_SIZE 128
606
607/*
608 * Feature set definitions
609 */
610
611#define EXT3_HAS_COMPAT_FEATURE(sb,mask) \
612 ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
613#define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) \
614 ( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
615#define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) \
616 ( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
617#define EXT3_SET_COMPAT_FEATURE(sb,mask) \
618 EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
619#define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) \
620 EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
621#define EXT3_SET_INCOMPAT_FEATURE(sb,mask) \
622 EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
623#define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) \
624 EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
625#define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
626 EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
627#define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) \
628 EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
629
630#define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001
631#define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002
632#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
633#define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008
634#define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010
635#define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020
636
637#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
638#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
639#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
640
641#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
642#define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
643#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
644#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
645#define EXT3_FEATURE_INCOMPAT_META_BG 0x0010
646
647#define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
648#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \
649 EXT3_FEATURE_INCOMPAT_RECOVER| \
650 EXT3_FEATURE_INCOMPAT_META_BG)
651#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
652 EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
653 EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
654
655/*
656 * Default values for user and/or group using reserved blocks
657 */
658#define EXT3_DEF_RESUID 0
659#define EXT3_DEF_RESGID 0
660
661/*
662 * Default mount options
663 */
664#define EXT3_DEFM_DEBUG 0x0001
665#define EXT3_DEFM_BSDGROUPS 0x0002
666#define EXT3_DEFM_XATTR_USER 0x0004
667#define EXT3_DEFM_ACL 0x0008
668#define EXT3_DEFM_UID16 0x0010
669#define EXT3_DEFM_JMODE 0x0060
670#define EXT3_DEFM_JMODE_DATA 0x0020
671#define EXT3_DEFM_JMODE_ORDERED 0x0040
672#define EXT3_DEFM_JMODE_WBACK 0x0060
673
674/*
675 * Structure of a directory entry
676 */
677#define EXT3_NAME_LEN 255
678
679struct ext3_dir_entry {
680 __le32 inode; /* Inode number */
681 __le16 rec_len; /* Directory entry length */
682 __le16 name_len; /* Name length */
683 char name[EXT3_NAME_LEN]; /* File name */
684};
685
686/*
687 * The new version of the directory entry. Since EXT3 structures are
688 * stored in intel byte order, and the name_len field could never be
689 * bigger than 255 chars, it's safe to reclaim the extra byte for the
690 * file_type field.
691 */
692struct ext3_dir_entry_2 {
693 __le32 inode; /* Inode number */
694 __le16 rec_len; /* Directory entry length */
695 __u8 name_len; /* Name length */
696 __u8 file_type;
697 char name[EXT3_NAME_LEN]; /* File name */
698};
699
700/*
701 * Ext3 directory file types. Only the low 3 bits are used. The
702 * other bits are reserved for now.
703 */
704#define EXT3_FT_UNKNOWN 0
705#define EXT3_FT_REG_FILE 1
706#define EXT3_FT_DIR 2
707#define EXT3_FT_CHRDEV 3
708#define EXT3_FT_BLKDEV 4
709#define EXT3_FT_FIFO 5
710#define EXT3_FT_SOCK 6
711#define EXT3_FT_SYMLINK 7
712
713#define EXT3_FT_MAX 8
714
715/*
716 * EXT3_DIR_PAD defines the directory entries boundaries
717 *
718 * NOTE: It must be a multiple of 4
719 */
720#define EXT3_DIR_PAD 4
721#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1)
722#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \
723 ~EXT3_DIR_ROUND)
724#define EXT3_MAX_REC_LEN ((1<<16)-1)
725
726/*
727 * Tests against MAX_REC_LEN etc were put in place for 64k block
728 * sizes; if that is not possible on this arch, we can skip
729 * those tests and speed things up.
730 */
731static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
732{
733 unsigned len = le16_to_cpu(dlen);
734
735#if (PAGE_CACHE_SIZE >= 65536)
736 if (len == EXT3_MAX_REC_LEN)
737 return 1 << 16;
738#endif
739 return len;
740}
741
742static inline __le16 ext3_rec_len_to_disk(unsigned len)
743{
744#if (PAGE_CACHE_SIZE >= 65536)
745 if (len == (1 << 16))
746 return cpu_to_le16(EXT3_MAX_REC_LEN);
747 else if (len > (1 << 16))
748 BUG();
749#endif
750 return cpu_to_le16(len);
751}
752
753/*
754 * Hash Tree Directory indexing
755 * (c) Daniel Phillips, 2001
756 */
757
758#define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
759 EXT3_FEATURE_COMPAT_DIR_INDEX) && \
760 (EXT3_I(dir)->i_flags & EXT3_INDEX_FL))
761#define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX)
762#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
763
764/* Legal values for the dx_root hash_version field: */
765
766#define DX_HASH_LEGACY 0
767#define DX_HASH_HALF_MD4 1
768#define DX_HASH_TEA 2
769#define DX_HASH_LEGACY_UNSIGNED 3
770#define DX_HASH_HALF_MD4_UNSIGNED 4
771#define DX_HASH_TEA_UNSIGNED 5
772
773#ifdef __KERNEL__
774
775/* hash info structure used by the directory hash */
776struct dx_hash_info
777{
778 u32 hash;
779 u32 minor_hash;
780 int hash_version;
781 u32 *seed;
782};
783
784#define EXT3_HTREE_EOF 0x7fffffff
785
786/*
787 * Control parameters used by ext3_htree_next_block
788 */
789#define HASH_NB_ALWAYS 1
790
791
792/*
793 * Describe an inode's exact location on disk and in memory
794 */
795struct ext3_iloc
796{
797 struct buffer_head *bh;
798 unsigned long offset;
799 unsigned long block_group;
800};
801
802static inline struct ext3_inode *ext3_raw_inode(struct ext3_iloc *iloc)
803{
804 return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset);
805}
806
807/*
808 * This structure is stuffed into the struct file's private_data field
809 * for directories. It is where we put information so that we can do
810 * readdir operations in hash tree order.
811 */
812struct dir_private_info {
813 struct rb_root root;
814 struct rb_node *curr_node;
815 struct fname *extra_fname;
816 loff_t last_pos;
817 __u32 curr_hash;
818 __u32 curr_minor_hash;
819 __u32 next_hash;
820};
821
822/* calculate the first block number of the group */
823static inline ext3_fsblk_t
824ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
825{
826 return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
827 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
828}
829
830/*
831 * Special error return code only used by dx_probe() and its callers.
832 */
833#define ERR_BAD_DX_DIR -75000
834
835/*
836 * Function prototypes
837 */
838
839/*
840 * Ok, these declarations are also in <linux/kernel.h> but none of the
841 * ext3 source programs needs to include it so they are duplicated here.
842 */
843# define NORET_TYPE /**/
844# define ATTRIB_NORET __attribute__((noreturn))
845# define NORET_AND noreturn,
846
847/* balloc.c */
848extern int ext3_bg_has_super(struct super_block *sb, int group);
849extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
850extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode,
851 ext3_fsblk_t goal, int *errp);
852extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode,
853 ext3_fsblk_t goal, unsigned long *count, int *errp);
854extern void ext3_free_blocks (handle_t *handle, struct inode *inode,
855 ext3_fsblk_t block, unsigned long count);
856extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
857 ext3_fsblk_t block, unsigned long count,
858 unsigned long *pdquot_freed_blocks);
859extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);
860extern void ext3_check_blocks_bitmap (struct super_block *);
861extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
862 unsigned int block_group,
863 struct buffer_head ** bh);
864extern int ext3_should_retry_alloc(struct super_block *sb, int *retries);
865extern void ext3_init_block_alloc_info(struct inode *);
866extern void ext3_rsv_window_add(struct super_block *sb, struct ext3_reserve_window_node *rsv);
867extern int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range);
868
869/* dir.c */
870extern int ext3_check_dir_entry(const char *, struct inode *,
871 struct ext3_dir_entry_2 *,
872 struct buffer_head *, unsigned long);
873extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
874 __u32 minor_hash,
875 struct ext3_dir_entry_2 *dirent);
876extern void ext3_htree_free_dir_info(struct dir_private_info *p);
877
878/* fsync.c */
879extern int ext3_sync_file(struct file *, loff_t, loff_t, int);
880
881/* hash.c */
882extern int ext3fs_dirhash(const char *name, int len, struct
883 dx_hash_info *hinfo);
884
885/* ialloc.c */
886extern struct inode * ext3_new_inode (handle_t *, struct inode *,
887 const struct qstr *, umode_t);
888extern void ext3_free_inode (handle_t *, struct inode *);
889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
890extern unsigned long ext3_count_free_inodes (struct super_block *);
891extern unsigned long ext3_count_dirs (struct super_block *);
892extern void ext3_check_inodes_bitmap (struct super_block *);
893extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
894
895
896/* inode.c */
897int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
898 struct buffer_head *bh, ext3_fsblk_t blocknr);
899struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
900struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
901int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
902 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
903 int create);
904
905extern struct inode *ext3_iget(struct super_block *, unsigned long);
906extern int ext3_write_inode (struct inode *, struct writeback_control *);
907extern int ext3_setattr (struct dentry *, struct iattr *);
908extern void ext3_evict_inode (struct inode *);
909extern int ext3_sync_inode (handle_t *, struct inode *);
910extern void ext3_discard_reservation (struct inode *);
911extern void ext3_dirty_inode(struct inode *, int);
912extern int ext3_change_inode_journal_flag(struct inode *, int);
913extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *);
914extern int ext3_can_truncate(struct inode *inode);
915extern void ext3_truncate(struct inode *inode);
916extern void ext3_set_inode_flags(struct inode *);
917extern void ext3_get_inode_flags(struct ext3_inode_info *);
918extern void ext3_set_aops(struct inode *inode);
919extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
920 u64 start, u64 len);
921
922/* ioctl.c */
923extern long ext3_ioctl(struct file *, unsigned int, unsigned long);
924extern long ext3_compat_ioctl(struct file *, unsigned int, unsigned long);
925
926/* namei.c */
927extern int ext3_orphan_add(handle_t *, struct inode *);
928extern int ext3_orphan_del(handle_t *, struct inode *);
929extern int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
930 __u32 start_minor_hash, __u32 *next_hash);
931
932/* resize.c */
933extern int ext3_group_add(struct super_block *sb,
934 struct ext3_new_group_data *input);
935extern int ext3_group_extend(struct super_block *sb,
936 struct ext3_super_block *es,
937 ext3_fsblk_t n_blocks_count);
938
939/* super.c */
940extern __printf(3, 4)
941void ext3_error(struct super_block *, const char *, const char *, ...);
942extern void __ext3_std_error (struct super_block *, const char *, int);
943extern __printf(3, 4)
944void ext3_abort(struct super_block *, const char *, const char *, ...);
945extern __printf(3, 4)
946void ext3_warning(struct super_block *, const char *, const char *, ...);
947extern __printf(3, 4)
948void ext3_msg(struct super_block *, const char *, const char *, ...);
949extern void ext3_update_dynamic_rev (struct super_block *sb);
950
951#define ext3_std_error(sb, errno) \
952do { \
953 if ((errno)) \
954 __ext3_std_error((sb), __func__, (errno)); \
955} while (0)
956
957/*
958 * Inodes and files operations
959 */
960
961/* dir.c */
962extern const struct file_operations ext3_dir_operations;
963
964/* file.c */
965extern const struct inode_operations ext3_file_inode_operations;
966extern const struct file_operations ext3_file_operations;
967
968/* namei.c */
969extern const struct inode_operations ext3_dir_inode_operations;
970extern const struct inode_operations ext3_special_inode_operations;
971
972/* symlink.c */
973extern const struct inode_operations ext3_symlink_inode_operations;
974extern const struct inode_operations ext3_fast_symlink_inode_operations;
975
976
977#endif /* __KERNEL__ */
978
979#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 f42c098aed8..00000000000
--- 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 64365252f1b..00000000000
--- 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 d7b5ddca99c..00000000000
--- 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/fb.h b/include/linux/fb.h
index a395b8c7699..d31cb682e17 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -407,7 +407,6 @@ struct fb_cursor {
407 407
408#include <linux/fs.h> 408#include <linux/fs.h>
409#include <linux/init.h> 409#include <linux/init.h>
410#include <linux/device.h>
411#include <linux/workqueue.h> 410#include <linux/workqueue.h>
412#include <linux/notifier.h> 411#include <linux/notifier.h>
413#include <linux/list.h> 412#include <linux/list.h>
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 82163c4b32c..158a41eed31 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-cdev.h b/include/linux/firewire-cdev.h
index 357dbfc2829..d5003695349 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -207,12 +207,16 @@ struct fw_cdev_event_request2 {
207 * @closure: See &fw_cdev_event_common; 207 * @closure: See &fw_cdev_event_common;
208 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl 208 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
209 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT 209 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT
210 * @cycle: Cycle counter of the interrupt packet 210 * @cycle: Cycle counter of the last completed packet
211 * @header_length: Total length of following headers, in bytes 211 * @header_length: Total length of following headers, in bytes
212 * @header: Stripped headers, if any 212 * @header: Stripped headers, if any
213 * 213 *
214 * This event is sent when the controller has completed an &fw_cdev_iso_packet 214 * This event is sent when the controller has completed an &fw_cdev_iso_packet
215 * with the %FW_CDEV_ISO_INTERRUPT bit set. 215 * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with
216 * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets
217 * without the interrupt bit set that the kernel's internal buffer for @header
218 * is about to overflow. (In the last case, kernels with ABI version < 5 drop
219 * header data up to the next interrupt packet.)
216 * 220 *
217 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): 221 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
218 * 222 *
@@ -267,9 +271,9 @@ struct fw_cdev_event_iso_interrupt {
267 * 271 *
268 * This event is sent in multichannel contexts (context type 272 * This event is sent in multichannel contexts (context type
269 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer 273 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
270 * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set. Whether this happens 274 * chunks that have been completely filled and that have the
271 * when a packet is completed and/or when a buffer chunk is completed depends 275 * %FW_CDEV_ISO_INTERRUPT bit set, or when explicitly requested with
272 * on the hardware implementation. 276 * %FW_CDEV_IOC_FLUSH_ISO.
273 * 277 *
274 * The buffer is continuously filled with the following data, per packet: 278 * The buffer is continuously filled with the following data, per packet:
275 * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, 279 * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt,
@@ -419,6 +423,9 @@ union fw_cdev_event {
419#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) 423#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets)
420#define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) 424#define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels)
421 425
426/* available since kernel version 3.4 */
427#define FW_CDEV_IOC_FLUSH_ISO _IOW('#', 0x18, struct fw_cdev_flush_iso)
428
422/* 429/*
423 * ABI version history 430 * ABI version history
424 * 1 (2.6.22) - initial version 431 * 1 (2.6.22) - initial version
@@ -441,6 +448,9 @@ union fw_cdev_event {
441 * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, 448 * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL,
442 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and 449 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
443 * %FW_CDEV_IOC_SET_ISO_CHANNELS 450 * %FW_CDEV_IOC_SET_ISO_CHANNELS
451 * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to
452 * avoid dropping data
453 * - added %FW_CDEV_IOC_FLUSH_ISO
444 */ 454 */
445 455
446/** 456/**
@@ -851,6 +861,25 @@ struct fw_cdev_stop_iso {
851}; 861};
852 862
853/** 863/**
864 * struct fw_cdev_flush_iso - flush completed iso packets
865 * @handle: handle of isochronous context to flush
866 *
867 * For %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE contexts,
868 * report any completed packets.
869 *
870 * For %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL contexts, report the current
871 * offset in the receive buffer, if it has changed; this is typically in the
872 * middle of some buffer chunk.
873 *
874 * Any %FW_CDEV_EVENT_ISO_INTERRUPT or %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
875 * events generated by this ioctl are sent synchronously, i.e., are available
876 * for reading from the file descriptor when this ioctl returns.
877 */
878struct fw_cdev_flush_iso {
879 __u32 handle;
880};
881
882/**
854 * struct fw_cdev_get_cycle_timer - read cycle timer register 883 * struct fw_cdev_get_cycle_timer - read cycle timer register
855 * @local_time: system time, in microseconds since the Epoch 884 * @local_time: system time, in microseconds since the Epoch
856 * @cycle_timer: Cycle Time register contents 885 * @cycle_timer: Cycle Time register contents
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 84ccf8e04fa..4db7b68f058 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -2,7 +2,6 @@
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>
6#include <linux/dma-mapping.h> 5#include <linux/dma-mapping.h>
7#include <linux/kernel.h> 6#include <linux/kernel.h>
8#include <linux/kref.h> 7#include <linux/kref.h>
@@ -17,9 +16,6 @@
17#include <linux/atomic.h> 16#include <linux/atomic.h>
18#include <asm/byteorder.h> 17#include <asm/byteorder.h>
19 18
20#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
21#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
22
23#define CSR_REGISTER_BASE 0xfffff0000000ULL 19#define CSR_REGISTER_BASE 0xfffff0000000ULL
24 20
25/* register offsets are relative to CSR_REGISTER_BASE */ 21/* register offsets are relative to CSR_REGISTER_BASE */
@@ -68,6 +64,8 @@
68#define CSR_MODEL 0x17 64#define CSR_MODEL 0x17
69#define CSR_DIRECTORY_ID 0x20 65#define CSR_DIRECTORY_ID 0x20
70 66
67struct device;
68
71struct fw_csr_iterator { 69struct fw_csr_iterator {
72 const u32 *p; 70 const u32 *p;
73 const u32 *end; 71 const u32 *end;
@@ -203,18 +201,6 @@ static inline int fw_device_is_shutdown(struct fw_device *device)
203 return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; 201 return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN;
204} 202}
205 203
206static inline struct fw_device *fw_device_get(struct fw_device *device)
207{
208 get_device(&device->device);
209
210 return device;
211}
212
213static inline void fw_device_put(struct fw_device *device)
214{
215 put_device(&device->device);
216}
217
218int fw_device_enable_phys_dma(struct fw_device *device); 204int fw_device_enable_phys_dma(struct fw_device *device);
219 205
220/* 206/*
@@ -441,6 +427,7 @@ int fw_iso_context_queue(struct fw_iso_context *ctx,
441 struct fw_iso_buffer *buffer, 427 struct fw_iso_buffer *buffer,
442 unsigned long payload); 428 unsigned long payload);
443void fw_iso_context_queue_flush(struct fw_iso_context *ctx); 429void fw_iso_context_queue_flush(struct fw_iso_context *ctx);
430int fw_iso_context_flush_completions(struct fw_iso_context *ctx);
444int fw_iso_context_start(struct fw_iso_context *ctx, 431int fw_iso_context_start(struct fw_iso_context *ctx,
445 int cycle, int sync, int tags); 432 int cycle, int sync, int tags);
446int fw_iso_context_stop(struct fw_iso_context *ctx); 433int fw_iso_context_stop(struct fw_iso_context *ctx);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9bbe1a9ac43..135693e79f2 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.
@@ -389,6 +393,7 @@ struct inodes_stat_t {
389#include <linux/prio_tree.h> 393#include <linux/prio_tree.h>
390#include <linux/init.h> 394#include <linux/init.h>
391#include <linux/pid.h> 395#include <linux/pid.h>
396#include <linux/bug.h>
392#include <linux/mutex.h> 397#include <linux/mutex.h>
393#include <linux/capability.h> 398#include <linux/capability.h>
394#include <linux/semaphore.h> 399#include <linux/semaphore.h>
@@ -1871,19 +1876,6 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1871 const struct dentry_operations *dops, 1876 const struct dentry_operations *dops,
1872 unsigned long); 1877 unsigned long);
1873 1878
1874static inline void sb_mark_dirty(struct super_block *sb)
1875{
1876 sb->s_dirt = 1;
1877}
1878static inline void sb_mark_clean(struct super_block *sb)
1879{
1880 sb->s_dirt = 0;
1881}
1882static inline int sb_is_dirty(struct super_block *sb)
1883{
1884 return sb->s_dirt;
1885}
1886
1887/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1879/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1888#define fops_get(fops) \ 1880#define fops_get(fops) \
1889 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) 1881 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
new file mode 100644
index 00000000000..203d7c4a3e1
--- /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/fsnotify.h b/include/linux/fsnotify.h
index 2a53f10712b..a6dfe694456 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -14,6 +14,7 @@
14#include <linux/fsnotify_backend.h> 14#include <linux/fsnotify_backend.h>
15#include <linux/audit.h> 15#include <linux/audit.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/bug.h>
17 18
18/* 19/*
19 * fsnotify_d_instantiate - instantiate a dentry for inode 20 * fsnotify_d_instantiate - instantiate a dentry for inode
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index dd478fc8f9f..5f3f3be5af0 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 38ac48b7d3a..6155ecf192b 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
@@ -34,6 +40,7 @@ struct gpio {
34#include <linux/kernel.h> 40#include <linux/kernel.h>
35#include <linux/types.h> 41#include <linux/types.h>
36#include <linux/errno.h> 42#include <linux/errno.h>
43#include <linux/bug.h>
37 44
38struct device; 45struct device;
39struct gpio_chip; 46struct gpio_chip;
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 004ff33ab38..a7e977ff4ab 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/highmem.h b/include/linux/highmem.h
index 6549ed75e0a..d3999b4e26c 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/bug.h>
6#include <linux/mm.h> 7#include <linux/mm.h>
7#include <linux/uaccess.h> 8#include <linux/uaccess.h>
8#include <linux/hardirq.h> 9#include <linux/hardirq.h>
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h
index a90c09d331c..1c7b89ae6bd 100644
--- a/include/linux/hwmon-sysfs.h
+++ b/include/linux/hwmon-sysfs.h
@@ -20,6 +20,8 @@
20#ifndef _LINUX_HWMON_SYSFS_H 20#ifndef _LINUX_HWMON_SYSFS_H
21#define _LINUX_HWMON_SYSFS_H 21#define _LINUX_HWMON_SYSFS_H
22 22
23#include <linux/device.h>
24
23struct sensor_device_attribute{ 25struct sensor_device_attribute{
24 struct device_attribute dev_attr; 26 struct device_attribute dev_attr;
25 int index; 27 int index;
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 6b6ee702b00..82b29ae6ebb 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -14,7 +14,7 @@
14#ifndef _HWMON_H_ 14#ifndef _HWMON_H_
15#define _HWMON_H_ 15#define _HWMON_H_
16 16
17#include <linux/device.h> 17struct device;
18 18
19struct device *hwmon_device_register(struct device *dev); 19struct device *hwmon_device_register(struct device *dev);
20 20
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
index aad6bd4b3ef..3343298e40e 100644
--- a/include/linux/hwspinlock.h
+++ b/include/linux/hwspinlock.h
@@ -20,12 +20,12 @@
20 20
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/device.h>
24 23
25/* hwspinlock mode argument */ 24/* hwspinlock mode argument */
26#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ 25#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
27#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ 26#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
28 27
28struct device;
29struct hwspinlock; 29struct hwspinlock;
30struct hwspinlock_device; 30struct hwspinlock_device;
31struct hwspinlock_ops; 31struct hwspinlock_ops;
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index 584ffa0f328..63904ba6887 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 0f91a957a69..538e8f41a31 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 fd53bfd2647..8a7406b2114 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 34536effd65..747f0cde416 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 63f57a8c8b3..017fb40f702 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 8e25a9167f1..195d8b3d9cf 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/at24.h b/include/linux/i2c/at24.h
index 8ace93024d6..285025a9cdc 100644
--- a/include/linux/i2c/at24.h
+++ b/include/linux/i2c/at24.h
@@ -1,19 +1,42 @@
1/*
2 * at24.h - platform_data for the at24 (generic eeprom) driver
3 * (C) Copyright 2008 by Pengutronix
4 * (C) Copyright 2012 by Wolfram Sang
5 * same license as the driver
6 */
7
1#ifndef _LINUX_AT24_H 8#ifndef _LINUX_AT24_H
2#define _LINUX_AT24_H 9#define _LINUX_AT24_H
3 10
4#include <linux/types.h> 11#include <linux/types.h>
5#include <linux/memory.h> 12#include <linux/memory.h>
6 13
7/* 14/**
8 * As seen through Linux I2C, differences between the most common types of I2C 15 * struct at24_platform_data - data to set up at24 (generic eeprom) driver
9 * memory include: 16 * @byte_len: size of eeprom in byte
10 * - How much memory is available (usually specified in bit)? 17 * @page_size: number of byte which can be written in one go
11 * - What write page size does it support? 18 * @flags: tunable options, check AT24_FLAG_* defines
12 * - Special flags (16 bit addresses, read_only, world readable...)? 19 * @setup: an optional callback invoked after eeprom is probed; enables kernel
20 code to access eeprom via memory_accessor, see example
21 * @context: optional parameter passed to setup()
13 * 22 *
14 * If you set up a custom eeprom type, please double-check the parameters. 23 * If you set up a custom eeprom type, please double-check the parameters.
15 * Especially page_size needs extra care, as you risk data loss if your value 24 * Especially page_size needs extra care, as you risk data loss if your value
16 * is bigger than what the chip actually supports! 25 * is bigger than what the chip actually supports!
26 *
27 * An example in pseudo code for a setup() callback:
28 *
29 * void get_mac_addr(struct memory_accessor *mem_acc, void *context)
30 * {
31 * u8 *mac_addr = ethernet_pdata->mac_addr;
32 * off_t offset = context;
33 *
34 * // Read MAC addr from EEPROM
35 * if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN)
36 * pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
37 * }
38 *
39 * This function pointer and context can now be set up in at24_platform_data.
17 */ 40 */
18 41
19struct at24_platform_data { 42struct at24_platform_data {
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 7fcab23c59c..2463b610033 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/i2o.h b/include/linux/i2o.h
index a6deef4f4f6..d23c3c20b20 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -24,6 +24,7 @@
24#define I2O_MAX_DRIVERS 8 24#define I2O_MAX_DRIVERS 8
25 25
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/bug.h>
27#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
28#include <linux/string.h> 29#include <linux/string.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 501370b61ee..b17974917db 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -14,7 +14,6 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/bio.h> 16#include <linux/bio.h>
17#include <linux/device.h>
18#include <linux/pci.h> 17#include <linux/pci.h>
19#include <linux/completion.h> 18#include <linux/completion.h>
20#include <linux/pm.h> 19#include <linux/pm.h>
@@ -23,7 +22,6 @@
23#include <acpi/acpi.h> 22#include <acpi/acpi.h>
24#endif 23#endif
25#include <asm/byteorder.h> 24#include <asm/byteorder.h>
26#include <asm/system.h>
27#include <asm/io.h> 25#include <asm/io.h>
28 26
29/* for request_sense */ 27/* for request_sense */
@@ -43,6 +41,8 @@
43#define ERROR_RESET 3 /* Reset controller every 4th retry */ 41#define ERROR_RESET 3 /* Reset controller every 4th retry */
44#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 42#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
45 43
44struct device;
45
46/* Error codes returned in rq->errors to the higher part of the driver. */ 46/* Error codes returned in rq->errors to the higher part of the driver. */
47enum { 47enum {
48 IDE_DRV_ERROR_GENERAL = 101, 48 IDE_DRV_ERROR_GENERAL = 101,
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 33a6e1951d4..a810987cb80 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -17,6 +17,7 @@
17#include <linux/netdevice.h> 17#include <linux/netdevice.h>
18#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
19#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
20#include <linux/bug.h>
20 21
21#define VLAN_HLEN 4 /* The additional bytes required by VLAN 22#define VLAN_HLEN 4 /* The additional bytes required by VLAN
22 * (in addition to the Ethernet header) 23 * (in addition to the Ethernet header)
diff --git a/include/linux/input.h b/include/linux/input.h
index 3862e32c4ee..a8167145357 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -114,6 +114,31 @@ struct input_keymap_entry {
114#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ 114#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
115#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ 115#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
116 116
117/**
118 * EVIOCGMTSLOTS(len) - get MT slot values
119 *
120 * The ioctl buffer argument should be binary equivalent to
121 *
122 * struct input_mt_request_layout {
123 * __u32 code;
124 * __s32 values[num_slots];
125 * };
126 *
127 * where num_slots is the (arbitrary) number of MT slots to extract.
128 *
129 * The ioctl size argument (len) is the size of the buffer, which
130 * should satisfy len = (num_slots + 1) * sizeof(__s32). If len is
131 * too small to fit all available slots, the first num_slots are
132 * returned.
133 *
134 * Before the call, code is set to the wanted ABS_MT event type. On
135 * return, values[] is filled with the slot values for the specified
136 * ABS_MT code.
137 *
138 * If the request code is not an ABS_MT value, -EINVAL is returned.
139 */
140#define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len)
141
117#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ 142#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */
118#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 143#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
119#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ 144#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
@@ -129,6 +154,8 @@ struct input_keymap_entry {
129 154
130#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 155#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
131 156
157#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */
158
132/* 159/*
133 * Device properties and quirks 160 * Device properties and quirks
134 */ 161 */
diff --git a/include/linux/input/cyttsp.h b/include/linux/input/cyttsp.h
new file mode 100644
index 00000000000..5af7c66f1fc
--- /dev/null
+++ b/include/linux/input/cyttsp.h
@@ -0,0 +1,58 @@
1/*
2 * Header file for:
3 * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
4 * For use with Cypress Txx3xx parts.
5 * Supported parts include:
6 * CY8CTST341
7 * CY8CTMA340
8 *
9 * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
10 * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * version 2, and only version 2, as published by the
15 * Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 *
26 * Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com)
27 *
28 */
29#ifndef _CYTTSP_H_
30#define _CYTTSP_H_
31
32#define CY_SPI_NAME "cyttsp-spi"
33#define CY_I2C_NAME "cyttsp-i2c"
34/* Active Power state scanning/processing refresh interval */
35#define CY_ACT_INTRVL_DFLT 0x00 /* ms */
36/* touch timeout for the Active power */
37#define CY_TCH_TMOUT_DFLT 0xFF /* ms */
38/* Low Power state scanning/processing refresh interval */
39#define CY_LP_INTRVL_DFLT 0x0A /* ms */
40/* Active distance in pixels for a gesture to be reported */
41#define CY_ACT_DIST_DFLT 0xF8 /* pixels */
42
43struct cyttsp_platform_data {
44 u32 maxx;
45 u32 maxy;
46 bool use_hndshk;
47 u8 act_dist; /* Active distance */
48 u8 act_intrvl; /* Active refresh interval; ms */
49 u8 tch_tmout; /* Active touch timeout; ms */
50 u8 lp_intrvl; /* Low power refresh interval; ms */
51 int (*init)(void);
52 void (*exit)(void);
53 char *name;
54 s16 irq_gpio;
55 u8 *bl_keys;
56};
57
58#endif /* _CYTTSP_H_ */
diff --git a/include/linux/input/ili210x.h b/include/linux/input/ili210x.h
new file mode 100644
index 00000000000..a5471245a13
--- /dev/null
+++ b/include/linux/input/ili210x.h
@@ -0,0 +1,10 @@
1#ifndef _ILI210X_H
2#define _ILI210X_H
3
4struct ili210x_platform_data {
5 unsigned long irq_flags;
6 unsigned int poll_period;
7 bool (*get_pendown_state)(void);
8};
9
10#endif
diff --git a/include/linux/input/kxtj9.h b/include/linux/input/kxtj9.h
index f6bac89537b..d415579b56f 100644
--- a/include/linux/input/kxtj9.h
+++ b/include/linux/input/kxtj9.h
@@ -24,6 +24,7 @@
24 24
25struct kxtj9_platform_data { 25struct kxtj9_platform_data {
26 unsigned int min_interval; /* minimum poll interval (in milli-seconds) */ 26 unsigned int min_interval; /* minimum poll interval (in milli-seconds) */
27 unsigned int init_interval; /* initial poll interval (in milli-seconds) */
27 28
28 /* 29 /*
29 * By default, x is axis 0, y is axis 1, z is axis 2; these can be 30 * By default, x is axis 0, y is axis 1, z is axis 2; these can be
@@ -52,16 +53,6 @@ struct kxtj9_platform_data {
52 #define KXTJ9_G_8G (1 << 4) 53 #define KXTJ9_G_8G (1 << 4)
53 u8 g_range; 54 u8 g_range;
54 55
55 /* DATA_CTRL_REG: controls the output data rate of the part */
56 #define ODR12_5F 0
57 #define ODR25F 1
58 #define ODR50F 2
59 #define ODR100F 3
60 #define ODR200F 4
61 #define ODR400F 5
62 #define ODR800F 6
63 u8 data_odr_init;
64
65 int (*init)(void); 56 int (*init)(void);
66 void (*exit)(void); 57 void (*exit)(void);
67 int (*power_on)(void); 58 int (*power_on)(void);
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index fe7c4b9ae27..6c07ced0af8 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/input.h> 5#include <linux/input.h>
6#include <linux/of.h>
6 7
7#define MATRIX_MAX_ROWS 32 8#define MATRIX_MAX_ROWS 32
8#define MATRIX_MAX_COLS 32 9#define MATRIX_MAX_COLS 32
@@ -106,4 +107,22 @@ matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
106 __clear_bit(KEY_RESERVED, keybit); 107 __clear_bit(KEY_RESERVED, keybit);
107} 108}
108 109
110#ifdef CONFIG_INPUT_OF_MATRIX_KEYMAP
111struct matrix_keymap_data *
112matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname);
113
114void matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd);
115#else
116static inline struct matrix_keymap_data *
117matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname)
118{
119 return NULL;
120}
121
122static inline void
123matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd)
124{
125}
126#endif
127
109#endif /* _MATRIX_KEYPAD_H */ 128#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 318bb82325a..f86737586e1 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -48,10 +48,14 @@ static inline void input_mt_slot(struct input_dev *dev, int slot)
48 input_event(dev, EV_ABS, ABS_MT_SLOT, slot); 48 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
49} 49}
50 50
51static inline bool input_is_mt_value(int axis)
52{
53 return axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST;
54}
55
51static inline bool input_is_mt_axis(int axis) 56static inline bool input_is_mt_axis(int axis)
52{ 57{
53 return axis == ABS_MT_SLOT || 58 return axis == ABS_MT_SLOT || input_is_mt_value(axis);
54 (axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST);
55} 59}
56 60
57void input_mt_report_slot_state(struct input_dev *dev, 61void input_mt_report_slot_state(struct input_dev *dev,
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h
new file mode 100644
index 00000000000..b10a527a92a
--- /dev/null
+++ b/include/linux/input/ti_tscadc.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_TI_TSCADC_H
2#define __LINUX_TI_TSCADC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 */
11
12struct tsc_data {
13 int wires;
14 int x_plate_resistance;
15};
16
17#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 3f830e00511..2aea5d22db0 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/io-mapping.h b/include/linux/io-mapping.h
index e44e84f0156..657fab4efab 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -20,6 +20,7 @@
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/bug.h>
23#include <asm/io.h> 24#include <asm/io.h>
24#include <asm/page.h> 25#include <asm/page.h>
25 26
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 9d57a71775b..e885ba23de7 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -23,12 +23,6 @@ struct resource {
23 struct resource *parent, *sibling, *child; 23 struct resource *parent, *sibling, *child;
24}; 24};
25 25
26struct resource_list {
27 struct resource_list *next;
28 struct resource *res;
29 struct pci_dev *dev;
30};
31
32/* 26/*
33 * IO resources have these defined flags. 27 * IO resources have these defined flags.
34 */ 28 */
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index bbd156bb953..48dcba9b206 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -220,10 +220,10 @@ struct kernel_ipmi_msg {
220 * The in-kernel interface. 220 * The in-kernel interface.
221 */ 221 */
222#include <linux/list.h> 222#include <linux/list.h>
223#include <linux/device.h>
224#include <linux/proc_fs.h> 223#include <linux/proc_fs.h>
225 224
226struct module; 225struct module;
226struct device;
227 227
228/* Opaque type for a IPMI message user. One of these is needed to 228/* Opaque type for a IPMI message user. One of these is needed to
229 send and receive messages. */ 229 send and receive messages. */
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 3ef0d8b6aa6..fcb5d44ea63 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -36,10 +36,11 @@
36 36
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/device.h>
40#include <linux/platform_device.h> 39#include <linux/platform_device.h>
41#include <linux/ipmi.h> 40#include <linux/ipmi.h>
42 41
42struct device;
43
43/* This files describes the interface for IPMI system management interface 44/* This files describes the interface for IPMI system management interface
44 drivers to bind into the IPMI message handler. */ 45 drivers to bind into the IPMI message handler. */
45 46
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index 062d20f7432..42bf725751a 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -58,7 +58,11 @@ struct ivtv_dma_frame {
58 __u32 src_height; 58 __u32 src_height;
59}; 59};
60 60
61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) 61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
62
63/* Select the passthrough mode (if the argument is non-zero). In the passthrough
64 mode the output of the encoder is passed immediately into the decoder. */
65#define IVTV_IOC_PASSTHROUGH_MODE _IOW ('V', BASE_VIDIOC_PRIVATE+1, int)
62 66
63/* Deprecated defines: applications should use the defines from videodev2.h */ 67/* Deprecated defines: applications should use the defines from videodev2.h */
64#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B 68#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 5557baefed6..912c30a8ddb 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 423cb6d78ee..c18b46f8aee 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/jz4740-adc.h b/include/linux/jz4740-adc.h
index 9053f95e968..8184578fbfa 100644
--- a/include/linux/jz4740-adc.h
+++ b/include/linux/jz4740-adc.h
@@ -2,7 +2,7 @@
2#ifndef __LINUX_JZ4740_ADC 2#ifndef __LINUX_JZ4740_ADC
3#define __LINUX_JZ4740_ADC 3#define __LINUX_JZ4740_ADC
4 4
5#include <linux/device.h> 5struct device;
6 6
7/* 7/*
8 * jz4740_adc_set_config - Configure a JZ4740 adc device 8 * jz4740_adc_set_config - Configure a JZ4740 adc device
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d801acb5e68..645231c373c 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 */
@@ -20,7 +22,6 @@
20#include <linux/printk.h> 22#include <linux/printk.h>
21#include <linux/dynamic_debug.h> 23#include <linux/dynamic_debug.h>
22#include <asm/byteorder.h> 24#include <asm/byteorder.h>
23#include <asm/bug.h>
24 25
25#define USHRT_MAX ((u16)(~0U)) 26#define USHRT_MAX ((u16)(~0U))
26#define SHRT_MAX ((s16)(USHRT_MAX>>1)) 27#define SHRT_MAX ((s16)(USHRT_MAX>>1))
@@ -312,6 +313,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int);
312#define strict_strtoull kstrtoull 313#define strict_strtoull kstrtoull
313#define strict_strtoll kstrtoll 314#define strict_strtoll kstrtoll
314 315
316extern int num_to_str(char *buf, int size, unsigned long long num);
317
315/* lib/printf utilities */ 318/* lib/printf utilities */
316 319
317extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); 320extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...);
@@ -328,10 +331,10 @@ extern __printf(2, 3)
328char *kasprintf(gfp_t gfp, const char *fmt, ...); 331char *kasprintf(gfp_t gfp, const char *fmt, ...);
329extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); 332extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
330 333
331extern int sscanf(const char *, const char *, ...) 334extern __scanf(2, 3)
332 __attribute__ ((format (scanf, 2, 3))); 335int sscanf(const char *, const char *, ...);
333extern int vsscanf(const char *, const char *, va_list) 336extern __scanf(2, 0)
334 __attribute__ ((format (scanf, 2, 0))); 337int vsscanf(const char *, const char *, va_list);
335 338
336extern int get_option(char **str, int *pint); 339extern int get_option(char **str, int *pint);
337extern char *get_options(const char *str, int nints, int *ints); 340extern char *get_options(const char *str, int nints, int *ints);
@@ -427,16 +430,10 @@ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
427 * Most likely, you want to use tracing_on/tracing_off. 430 * Most likely, you want to use tracing_on/tracing_off.
428 */ 431 */
429#ifdef CONFIG_RING_BUFFER 432#ifdef CONFIG_RING_BUFFER
430void tracing_on(void);
431void tracing_off(void);
432/* 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 */
433void tracing_off_permanent(void); 434void tracing_off_permanent(void);
434int tracing_is_on(void);
435#else 435#else
436static inline void tracing_on(void) { }
437static inline void tracing_off(void) { }
438static inline void tracing_off_permanent(void) { } 436static inline void tracing_off_permanent(void) { }
439static inline int tracing_is_on(void) { return 0; }
440#endif 437#endif
441 438
442enum ftrace_dump_mode { 439enum ftrace_dump_mode {
@@ -446,6 +443,10 @@ enum ftrace_dump_mode {
446}; 443};
447 444
448#ifdef CONFIG_TRACING 445#ifdef CONFIG_TRACING
446void tracing_on(void);
447void tracing_off(void);
448int tracing_is_on(void);
449
449extern void tracing_start(void); 450extern void tracing_start(void);
450extern void tracing_stop(void); 451extern void tracing_stop(void);
451extern void ftrace_off_permanent(void); 452extern void ftrace_off_permanent(void);
@@ -530,6 +531,11 @@ static inline void tracing_start(void) { }
530static inline void tracing_stop(void) { } 531static inline void tracing_stop(void) { }
531static inline void ftrace_off_permanent(void) { } 532static inline void ftrace_off_permanent(void) { }
532static 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
533static inline int 539static inline int
534trace_printk(const char *fmt, ...) 540trace_printk(const char *fmt, ...)
535{ 541{
@@ -675,67 +681,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
675 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 681 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
676 (type *)( (char *)__mptr - offsetof(type,member) );}) 682 (type *)( (char *)__mptr - offsetof(type,member) );})
677 683
678#ifdef __CHECKER__
679#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
680#define BUILD_BUG_ON_ZERO(e) (0)
681#define BUILD_BUG_ON_NULL(e) ((void*)0)
682#define BUILD_BUG_ON(condition)
683#define BUILD_BUG() (0)
684#else /* __CHECKER__ */
685
686/* Force a compilation error if a constant expression is not a power of 2 */
687#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
688 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
689
690/* Force a compilation error if condition is true, but also produce a
691 result (of value 0 and type size_t), so the expression can be used
692 e.g. in a structure initializer (or where-ever else comma expressions
693 aren't permitted). */
694#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
695#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
696
697/**
698 * BUILD_BUG_ON - break compile if a condition is true.
699 * @condition: the condition which the compiler should know is false.
700 *
701 * If you have some code which relies on certain constants being equal, or
702 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to
703 * detect if someone changes it.
704 *
705 * The implementation uses gcc's reluctance to create a negative array, but
706 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
707 * to inline functions). So as a fallback we use the optimizer; if it can't
708 * prove the condition is false, it will cause a link error on the undefined
709 * "__build_bug_on_failed". This error message can be harder to track down
710 * though, hence the two different methods.
711 */
712#ifndef __OPTIMIZE__
713#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
714#else
715extern int __build_bug_on_failed;
716#define BUILD_BUG_ON(condition) \
717 do { \
718 ((void)sizeof(char[1 - 2*!!(condition)])); \
719 if (condition) __build_bug_on_failed = 1; \
720 } while(0)
721#endif
722
723/**
724 * BUILD_BUG - break compile if used.
725 *
726 * If you have some code that you expect the compiler to eliminate at
727 * build time, you should use BUILD_BUG to detect if it is
728 * unexpectedly used.
729 */
730#define BUILD_BUG() \
731 do { \
732 extern void __build_bug_failed(void) \
733 __linktime_error("BUILD_BUG failed"); \
734 __build_bug_failed(); \
735 } while (0)
736
737#endif /* __CHECKER__ */
738
739/* Trap pasters of __FUNCTION__ at compile-time */ 684/* Trap pasters of __FUNCTION__ at compile-time */
740#define __FUNCTION__ (__func__) 685#define __FUNCTION__ (__func__)
741 686
@@ -758,27 +703,8 @@ extern int __build_bug_on_failed;
758# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 703# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
759#endif 704#endif
760 705
761struct sysinfo;
762extern int do_sysinfo(struct sysinfo *info); 706extern int do_sysinfo(struct sysinfo *info);
763 707
764#endif /* __KERNEL__ */ 708#endif /* __KERNEL__ */
765 709
766#define SI_LOAD_SHIFT 16
767struct sysinfo {
768 long uptime; /* Seconds since boot */
769 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
770 unsigned long totalram; /* Total usable main memory size */
771 unsigned long freeram; /* Available memory size */
772 unsigned long sharedram; /* Amount of shared memory */
773 unsigned long bufferram; /* Memory used by buffers */
774 unsigned long totalswap; /* Total swap space size */
775 unsigned long freeswap; /* swap space still available */
776 unsigned short procs; /* Number of current processes */
777 unsigned short pad; /* explicit padding for m68k */
778 unsigned long totalhigh; /* Total high memory size */
779 unsigned long freehigh; /* Available high memory size */
780 unsigned int mem_unit; /* Memory unit size in bytes */
781 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
782};
783
784#endif 710#endif
diff --git a/include/linux/key.h b/include/linux/key.h
index 1600ebf717a..96933b1e5d2 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -277,6 +277,8 @@ static inline key_serial_t key_serial(const struct key *key)
277 return key ? key->serial : 0; 277 return key ? key->serial : 0;
278} 278}
279 279
280extern void key_set_timeout(struct key *, unsigned);
281
280/** 282/**
281 * key_is_instantiated - Determine if a key has been positively instantiated 283 * key_is_instantiated - Determine if a key has been positively instantiated
282 * @key: The key to check. 284 * @key: The key to check.
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 722f477c4ef..9efeae67910 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -48,11 +48,10 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
48struct cred; 48struct cred;
49struct file; 49struct file;
50 50
51enum umh_wait { 51#define UMH_NO_WAIT 0 /* don't wait at all */
52 UMH_NO_WAIT = -1, /* don't wait at all */ 52#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */
53 UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */ 53#define UMH_WAIT_PROC 2 /* wait for the process to complete */
54 UMH_WAIT_PROC = 1, /* wait for the process to complete */ 54#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */
55};
56 55
57struct subprocess_info { 56struct subprocess_info {
58 struct work_struct work; 57 struct work_struct work;
@@ -60,7 +59,7 @@ struct subprocess_info {
60 char *path; 59 char *path;
61 char **argv; 60 char **argv;
62 char **envp; 61 char **envp;
63 enum umh_wait wait; 62 int wait;
64 int retval; 63 int retval;
65 int (*init)(struct subprocess_info *info, struct cred *new); 64 int (*init)(struct subprocess_info *info, struct cred *new);
66 void (*cleanup)(struct subprocess_info *info); 65 void (*cleanup)(struct subprocess_info *info);
@@ -78,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
78 void *data); 77 void *data);
79 78
80/* Actually execute the sub-process */ 79/* Actually execute the sub-process */
81int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); 80int call_usermodehelper_exec(struct subprocess_info *info, int wait);
82 81
83/* Free the subprocess_info. This is only needed if you're not going 82/* Free the subprocess_info. This is only needed if you're not going
84 to call call_usermodehelper_exec */ 83 to call call_usermodehelper_exec */
85void call_usermodehelper_freeinfo(struct subprocess_info *info); 84void call_usermodehelper_freeinfo(struct subprocess_info *info);
86 85
87static inline int 86static inline int
88call_usermodehelper_fns(char *path, char **argv, char **envp, 87call_usermodehelper_fns(char *path, char **argv, char **envp, int wait,
89 enum umh_wait wait,
90 int (*init)(struct subprocess_info *info, struct cred *new), 88 int (*init)(struct subprocess_info *info, struct cred *new),
91 void (*cleanup)(struct subprocess_info *), void *data) 89 void (*cleanup)(struct subprocess_info *), void *data)
92{ 90{
@@ -104,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
104} 102}
105 103
106static inline int 104static inline int
107call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) 105call_usermodehelper(char *path, char **argv, char **envp, int wait)
108{ 106{
109 return call_usermodehelper_fns(path, argv, envp, wait, 107 return call_usermodehelper_fns(path, argv, envp, wait,
110 NULL, NULL, NULL); 108 NULL, NULL, NULL);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index dce6e4dbeda..b6e1f8c0057 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -33,6 +33,7 @@
33#include <linux/list.h> 33#include <linux/list.h>
34#include <linux/notifier.h> 34#include <linux/notifier.h>
35#include <linux/smp.h> 35#include <linux/smp.h>
36#include <linux/bug.h>
36#include <linux/percpu.h> 37#include <linux/percpu.h>
37#include <linux/spinlock.h> 38#include <linux/spinlock.h>
38#include <linux/rcupdate.h> 39#include <linux/rcupdate.h>
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 68e67e50d02..6c322a90b92 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 900c76337e8..665a260c7e0 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -13,6 +13,7 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/bug.h>
16#include <linux/mm.h> 17#include <linux/mm.h>
17#include <linux/mmu_notifier.h> 18#include <linux/mmu_notifier.h>
18#include <linux/preempt.h> 19#include <linux/preempt.h>
@@ -171,11 +172,6 @@ static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
171 */ 172 */
172#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1) 173#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1)
173 174
174struct kvm_lpage_info {
175 unsigned long rmap_pde;
176 int write_count;
177};
178
179struct kvm_memory_slot { 175struct kvm_memory_slot {
180 gfn_t base_gfn; 176 gfn_t base_gfn;
181 unsigned long npages; 177 unsigned long npages;
@@ -184,7 +180,7 @@ struct kvm_memory_slot {
184 unsigned long *dirty_bitmap; 180 unsigned long *dirty_bitmap;
185 unsigned long *dirty_bitmap_head; 181 unsigned long *dirty_bitmap_head;
186 unsigned long nr_dirty_pages; 182 unsigned long nr_dirty_pages;
187 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; 183 struct kvm_arch_memory_slot arch;
188 unsigned long userspace_addr; 184 unsigned long userspace_addr;
189 int user_alloc; 185 int user_alloc;
190 int id; 186 int id;
@@ -376,6 +372,9 @@ int kvm_set_memory_region(struct kvm *kvm,
376int __kvm_set_memory_region(struct kvm *kvm, 372int __kvm_set_memory_region(struct kvm *kvm,
377 struct kvm_userspace_memory_region *mem, 373 struct kvm_userspace_memory_region *mem,
378 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);
379int kvm_arch_prepare_memory_region(struct kvm *kvm, 378int kvm_arch_prepare_memory_region(struct kvm *kvm,
380 struct kvm_memory_slot *memslot, 379 struct kvm_memory_slot *memslot,
381 struct kvm_memory_slot old, 380 struct kvm_memory_slot old,
@@ -385,6 +384,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
385 struct kvm_userspace_memory_region *mem, 384 struct kvm_userspace_memory_region *mem,
386 struct kvm_memory_slot old, 385 struct kvm_memory_slot old,
387 int user_alloc); 386 int user_alloc);
387bool kvm_largepages_enabled(void);
388void kvm_disable_largepages(void); 388void kvm_disable_largepages(void);
389void kvm_arch_flush_shadow(struct kvm *kvm); 389void kvm_arch_flush_shadow(struct kvm *kvm);
390 390
@@ -450,6 +450,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
450 unsigned int ioctl, unsigned long arg); 450 unsigned int ioctl, unsigned long arg);
451long kvm_arch_vcpu_ioctl(struct file *filp, 451long kvm_arch_vcpu_ioctl(struct file *filp,
452 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);
453 454
454int kvm_dev_ioctl_check_extension(long ext); 455int kvm_dev_ioctl_check_extension(long ext);
455 456
@@ -520,7 +521,7 @@ static inline void kvm_arch_free_vm(struct kvm *kvm)
520} 521}
521#endif 522#endif
522 523
523int kvm_arch_init_vm(struct kvm *kvm); 524int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
524void kvm_arch_destroy_vm(struct kvm *kvm); 525void kvm_arch_destroy_vm(struct kvm *kvm);
525void kvm_free_all_assigned_devices(struct kvm *kvm); 526void kvm_free_all_assigned_devices(struct kvm *kvm);
526void kvm_arch_sync_events(struct kvm *kvm); 527void kvm_arch_sync_events(struct kvm *kvm);
@@ -546,6 +547,7 @@ struct kvm_assigned_dev_kernel {
546 unsigned int entries_nr; 547 unsigned int entries_nr;
547 int host_irq; 548 int host_irq;
548 bool host_irq_disabled; 549 bool host_irq_disabled;
550 bool pci_2_3;
549 struct msix_entry *host_msix_entries; 551 struct msix_entry *host_msix_entries;
550 int guest_irq; 552 int guest_irq;
551 struct msix_entry *guest_msix_entries; 553 struct msix_entry *guest_msix_entries;
@@ -555,6 +557,7 @@ struct kvm_assigned_dev_kernel {
555 struct pci_dev *dev; 557 struct pci_dev *dev;
556 struct kvm *kvm; 558 struct kvm *kvm;
557 spinlock_t intx_lock; 559 spinlock_t intx_lock;
560 spinlock_t intx_mask_lock;
558 char irq_name[32]; 561 char irq_name[32];
559 struct pci_saved_state *pci_saved_state; 562 struct pci_saved_state *pci_saved_state;
560}; 563};
@@ -650,11 +653,43 @@ static inline void kvm_guest_exit(void)
650 current->flags &= ~PF_VCPU; 653 current->flags &= ~PF_VCPU;
651} 654}
652 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
653static inline int memslot_id(struct kvm *kvm, gfn_t gfn) 681static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
654{ 682{
655 return gfn_to_memslot(kvm, gfn)->id; 683 return gfn_to_memslot(kvm, gfn)->id;
656} 684}
657 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
658static 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,
659 gfn_t gfn) 694 gfn_t gfn)
660{ 695{
@@ -701,12 +736,16 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
701 if (unlikely(vcpu->kvm->mmu_notifier_count)) 736 if (unlikely(vcpu->kvm->mmu_notifier_count))
702 return 1; 737 return 1;
703 /* 738 /*
704 * Both reads happen under the mmu_lock and both values are 739 * Ensure the read of mmu_notifier_count happens before the read
705 * modified under mmu_lock, so there's no need of smb_rmb() 740 * of mmu_notifier_seq. This interacts with the smp_wmb() in
706 * here in between, otherwise mmu_notifier_count should be 741 * mmu_notifier_invalidate_range_end to make sure that the caller
707 * read before mmu_notifier_seq, see 742 * either sees the old (non-zero) value of mmu_notifier_count or
708 * 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.
709 */ 747 */
748 smp_rmb();
710 if (vcpu->kvm->mmu_notifier_seq != mmu_seq) 749 if (vcpu->kvm->mmu_notifier_seq != mmu_seq)
711 return 1; 750 return 1;
712 return 0; 751 return 0;
@@ -769,6 +808,13 @@ static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
769{ 808{
770 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; 809 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
771} 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
772#endif 818#endif
773 819
774#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT 820#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h
index 8eb12357a11..eeae6e74247 100644
--- a/include/linux/led-lm3530.h
+++ b/include/linux/led-lm3530.h
@@ -72,6 +72,12 @@ enum lm3530_als_mode {
72 LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ 72 LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */
73}; 73};
74 74
75/* PWM Platform Specific Data */
76struct lm3530_pwm_data {
77 void (*pwm_set_intensity) (int brightness, int max_brightness);
78 int (*pwm_get_intensity) (int max_brightness);
79};
80
75/** 81/**
76 * struct lm3530_platform_data 82 * struct lm3530_platform_data
77 * @mode: mode of operation i.e. Manual, ALS or PWM 83 * @mode: mode of operation i.e. Manual, ALS or PWM
@@ -87,6 +93,7 @@ enum lm3530_als_mode {
87 * @als_vmin: als input voltage calibrated for max brightness in mV 93 * @als_vmin: als input voltage calibrated for max brightness in mV
88 * @als_vmax: als input voltage calibrated for min brightness in mV 94 * @als_vmax: als input voltage calibrated for min brightness in mV
89 * @brt_val: brightness value (0-255) 95 * @brt_val: brightness value (0-255)
96 * @pwm_data: PWM control functions (only valid when the mode is PWM)
90 */ 97 */
91struct lm3530_platform_data { 98struct lm3530_platform_data {
92 enum lm3530_mode mode; 99 enum lm3530_mode mode;
@@ -107,6 +114,8 @@ struct lm3530_platform_data {
107 u32 als_vmax; 114 u32 als_vmax;
108 115
109 u8 brt_val; 116 u8 brt_val;
117
118 struct lm3530_pwm_data pwm_data;
110}; 119};
111 120
112#endif /* _LINUX_LED_LM3530_H__ */ 121#endif /* _LINUX_LED_LM3530_H__ */
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
index fd548d2a877..3f071ec019b 100644
--- a/include/linux/leds-lp5521.h
+++ b/include/linux/leds-lp5521.h
@@ -26,15 +26,37 @@
26/* See Documentation/leds/leds-lp5521.txt */ 26/* See Documentation/leds/leds-lp5521.txt */
27 27
28struct lp5521_led_config { 28struct lp5521_led_config {
29 char *name;
29 u8 chan_nr; 30 u8 chan_nr;
30 u8 led_current; /* mA x10, 0 if led is not connected */ 31 u8 led_current; /* mA x10, 0 if led is not connected */
31 u8 max_current; 32 u8 max_current;
32}; 33};
33 34
35struct lp5521_led_pattern {
36 u8 *r;
37 u8 *g;
38 u8 *b;
39 u8 size_r;
40 u8 size_g;
41 u8 size_b;
42};
43
34#define LP5521_CLOCK_AUTO 0 44#define LP5521_CLOCK_AUTO 0
35#define LP5521_CLOCK_INT 1 45#define LP5521_CLOCK_INT 1
36#define LP5521_CLOCK_EXT 2 46#define LP5521_CLOCK_EXT 2
37 47
48/* Bits in CONFIG register */
49#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
50#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
51#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
52#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
53#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
54#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
55#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
56#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
57#define LP5521_CLK_INT 1 /* Internal clock */
58#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
59
38struct lp5521_platform_data { 60struct lp5521_platform_data {
39 struct lp5521_led_config *led_config; 61 struct lp5521_led_config *led_config;
40 u8 num_channels; 62 u8 num_channels;
@@ -43,6 +65,9 @@ struct lp5521_platform_data {
43 void (*release_resources)(void); 65 void (*release_resources)(void);
44 void (*enable)(bool state); 66 void (*enable)(bool state);
45 const char *label; 67 const char *label;
68 u8 update_config;
69 struct lp5521_led_pattern *patterns;
70 int num_patterns;
46}; 71};
47 72
48#endif /* __LINUX_LP5521_H */ 73#endif /* __LINUX_LP5521_H */
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 801b44b07aa..a5199f6d0e8 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/lockd/bind.h b/include/linux/lockd/bind.h
index fbc48f89852..11a966e5f82 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -42,6 +42,7 @@ struct nlmclnt_initdata {
42 unsigned short protocol; 42 unsigned short protocol;
43 u32 nfs_version; 43 u32 nfs_version;
44 int noresvport; 44 int noresvport;
45 struct net *net;
45}; 46};
46 47
47/* 48/*
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 88a114fce47..f04ce6ac6d0 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -67,6 +67,7 @@ struct nlm_host {
67 struct list_head h_reclaim; /* Locks in RECLAIM state */ 67 struct list_head h_reclaim; /* Locks in RECLAIM state */
68 struct nsm_handle *h_nsmhandle; /* NSM status handle */ 68 struct nsm_handle *h_nsmhandle; /* NSM status handle */
69 char *h_addrbuf; /* address eyecatcher */ 69 char *h_addrbuf; /* address eyecatcher */
70 struct net *net; /* host net */
70}; 71};
71 72
72/* 73/*
@@ -188,7 +189,7 @@ struct nlm_block {
188/* 189/*
189 * Global variables 190 * Global variables
190 */ 191 */
191extern struct rpc_program nlm_program; 192extern const struct rpc_program nlm_program;
192extern struct svc_procedure nlmsvc_procedures[]; 193extern struct svc_procedure nlmsvc_procedures[];
193#ifdef CONFIG_LOCKD_V4 194#ifdef CONFIG_LOCKD_V4
194extern struct svc_procedure nlmsvc_procedures4[]; 195extern struct svc_procedure nlmsvc_procedures4[];
@@ -222,7 +223,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
222 const unsigned short protocol, 223 const unsigned short protocol,
223 const u32 version, 224 const u32 version,
224 const char *hostname, 225 const char *hostname,
225 int noresvport); 226 int noresvport,
227 struct net *net);
226void nlmclnt_release_host(struct nlm_host *); 228void nlmclnt_release_host(struct nlm_host *);
227struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, 229struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
228 const char *hostname, 230 const char *hostname,
@@ -232,6 +234,7 @@ struct rpc_clnt * nlm_bind_host(struct nlm_host *);
232void nlm_rebind_host(struct nlm_host *); 234void nlm_rebind_host(struct nlm_host *);
233struct nlm_host * nlm_get_host(struct nlm_host *); 235struct nlm_host * nlm_get_host(struct nlm_host *);
234void nlm_shutdown_hosts(void); 236void nlm_shutdown_hosts(void);
237void nlm_shutdown_hosts_net(struct net *net);
235void nlm_host_rebooted(const struct nlm_reboot *); 238void nlm_host_rebooted(const struct nlm_reboot *);
236 239
237/* 240/*
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index 7353821341e..e58c88b52ce 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -42,6 +42,6 @@ int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
42int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *); 42int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *);
43int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 43int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
44 */ 44 */
45extern struct rpc_version nlm_version4; 45extern const struct rpc_version nlm_version4;
46 46
47#endif /* LOCKD_XDR4_H */ 47#endif /* LOCKD_XDR4_H */
diff --git a/include/linux/lp855x.h b/include/linux/lp855x.h
new file mode 100644
index 00000000000..781a490a451
--- /dev/null
+++ b/include/linux/lp855x.h
@@ -0,0 +1,131 @@
1/*
2 * LP855x Backlight Driver
3 *
4 * Copyright (C) 2011 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef _LP855X_H
13#define _LP855X_H
14
15#define BL_CTL_SHFT (0)
16#define BRT_MODE_SHFT (1)
17#define BRT_MODE_MASK (0x06)
18
19/* Enable backlight. Only valid when BRT_MODE=10(I2C only) */
20#define ENABLE_BL (1)
21#define DISABLE_BL (0)
22
23#define I2C_CONFIG(id) id ## _I2C_CONFIG
24#define PWM_CONFIG(id) id ## _PWM_CONFIG
25
26/* DEVICE CONTROL register - LP8550 */
27#define LP8550_PWM_CONFIG (LP8550_PWM_ONLY << BRT_MODE_SHFT)
28#define LP8550_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \
29 (LP8550_I2C_ONLY << BRT_MODE_SHFT))
30
31/* DEVICE CONTROL register - LP8551 */
32#define LP8551_PWM_CONFIG LP8550_PWM_CONFIG
33#define LP8551_I2C_CONFIG LP8550_I2C_CONFIG
34
35/* DEVICE CONTROL register - LP8552 */
36#define LP8552_PWM_CONFIG LP8550_PWM_CONFIG
37#define LP8552_I2C_CONFIG LP8550_I2C_CONFIG
38
39/* DEVICE CONTROL register - LP8553 */
40#define LP8553_PWM_CONFIG LP8550_PWM_CONFIG
41#define LP8553_I2C_CONFIG LP8550_I2C_CONFIG
42
43/* DEVICE CONTROL register - LP8556 */
44#define LP8556_PWM_CONFIG (LP8556_PWM_ONLY << BRT_MODE_SHFT)
45#define LP8556_COMB1_CONFIG (LP8556_COMBINED1 << BRT_MODE_SHFT)
46#define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \
47 (LP8556_I2C_ONLY << BRT_MODE_SHFT))
48#define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT)
49
50/* ROM area boundary */
51#define EEPROM_START (0xA0)
52#define EEPROM_END (0xA7)
53#define EPROM_START (0xA0)
54#define EPROM_END (0xAF)
55
56enum lp855x_chip_id {
57 LP8550,
58 LP8551,
59 LP8552,
60 LP8553,
61 LP8556,
62};
63
64enum lp855x_brightness_ctrl_mode {
65 PWM_BASED = 1,
66 REGISTER_BASED,
67};
68
69enum lp8550_brighntess_source {
70 LP8550_PWM_ONLY,
71 LP8550_I2C_ONLY = 2,
72};
73
74enum lp8551_brighntess_source {
75 LP8551_PWM_ONLY = LP8550_PWM_ONLY,
76 LP8551_I2C_ONLY = LP8550_I2C_ONLY,
77};
78
79enum lp8552_brighntess_source {
80 LP8552_PWM_ONLY = LP8550_PWM_ONLY,
81 LP8552_I2C_ONLY = LP8550_I2C_ONLY,
82};
83
84enum lp8553_brighntess_source {
85 LP8553_PWM_ONLY = LP8550_PWM_ONLY,
86 LP8553_I2C_ONLY = LP8550_I2C_ONLY,
87};
88
89enum lp8556_brightness_source {
90 LP8556_PWM_ONLY,
91 LP8556_COMBINED1, /* pwm + i2c before the shaper block */
92 LP8556_I2C_ONLY,
93 LP8556_COMBINED2, /* pwm + i2c after the shaper block */
94};
95
96struct lp855x_pwm_data {
97 void (*pwm_set_intensity) (int brightness, int max_brightness);
98 int (*pwm_get_intensity) (int max_brightness);
99};
100
101struct lp855x_rom_data {
102 u8 addr;
103 u8 val;
104};
105
106/**
107 * struct lp855x_platform_data
108 * @name : Backlight driver name. If it is not defined, default name is set.
109 * @mode : brightness control by pwm or lp855x register
110 * @device_control : value of DEVICE CONTROL register
111 * @initial_brightness : initial value of backlight brightness
112 * @pwm_data : platform specific pwm generation functions.
113 Only valid when mode is PWM_BASED.
114 * @load_new_rom_data :
115 0 : use default configuration data
116 1 : update values of eeprom or eprom registers on loading driver
117 * @size_program : total size of lp855x_rom_data
118 * @rom_data : list of new eeprom/eprom registers
119 */
120struct lp855x_platform_data {
121 char *name;
122 enum lp855x_brightness_ctrl_mode mode;
123 u8 device_control;
124 int initial_brightness;
125 struct lp855x_pwm_data pwm_data;
126 u8 load_new_rom_data;
127 int size_program;
128 struct lp855x_rom_data *rom_data;
129};
130
131#endif
diff --git a/include/linux/lp8727.h b/include/linux/lp8727.h
index d21fa2865bf..ea98c6133d3 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 88e78dedc2e..eab507f2b1c 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -21,7 +21,6 @@
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
26 25
27/* Auxiliary data to use in generating the audit record. */ 26/* Auxiliary data to use in generating the audit record. */
diff --git a/include/linux/magic.h b/include/linux/magic.h
index b7ed4759dbb..e15192cb9cf 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -9,7 +9,6 @@
9#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ 9#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
10#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ 10#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */
11#define DEBUGFS_MAGIC 0x64626720 11#define DEBUGFS_MAGIC 0x64626720
12#define SYSFS_MAGIC 0x62656572
13#define SECURITYFS_MAGIC 0x73636673 12#define SECURITYFS_MAGIC 0x73636673
14#define SELINUX_MAGIC 0xf97cff8c 13#define SELINUX_MAGIC 0xf97cff8c
15#define RAMFS_MAGIC 0x858458f6 /* some random number */ 14#define RAMFS_MAGIC 0x858458f6 /* some random number */
@@ -27,7 +26,6 @@
27#define HPFS_SUPER_MAGIC 0xf995e849 26#define HPFS_SUPER_MAGIC 0xf995e849
28#define ISOFS_SUPER_MAGIC 0x9660 27#define ISOFS_SUPER_MAGIC 0x9660
29#define JFFS2_SUPER_MAGIC 0x72b6 28#define JFFS2_SUPER_MAGIC 0x72b6
30#define ANON_INODE_FS_MAGIC 0x09041934
31#define PSTOREFS_MAGIC 0x6165676C 29#define PSTOREFS_MAGIC 0x6165676C
32 30
33#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ 31#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */
@@ -40,7 +38,6 @@
40#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ 38#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */
41#define NFS_SUPER_MAGIC 0x6969 39#define NFS_SUPER_MAGIC 0x6969
42#define OPENPROM_SUPER_MAGIC 0x9fa1 40#define OPENPROM_SUPER_MAGIC 0x9fa1
43#define PROC_SUPER_MAGIC 0x9fa0
44#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ 41#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
45#define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ 42#define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */
46 43
@@ -52,15 +49,24 @@
52#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" 49#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
53 50
54#define SMB_SUPER_MAGIC 0x517B 51#define SMB_SUPER_MAGIC 0x517B
55#define USBDEVICE_SUPER_MAGIC 0x9fa2
56#define CGROUP_SUPER_MAGIC 0x27e0eb 52#define CGROUP_SUPER_MAGIC 0x27e0eb
57 53
58#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
59 54
60#define STACK_END_MAGIC 0x57AC6E9D 55#define STACK_END_MAGIC 0x57AC6E9D
61 56
57#define V9FS_MAGIC 0x01021997
58
59#define BDEVFS_MAGIC 0x62646576
60#define BINFMTFS_MAGIC 0x42494e4d
62#define DEVPTS_SUPER_MAGIC 0x1cd1 61#define DEVPTS_SUPER_MAGIC 0x1cd1
62#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
63#define PIPEFS_MAGIC 0x50495045
64#define PROC_SUPER_MAGIC 0x9fa0
63#define SOCKFS_MAGIC 0x534F434B 65#define SOCKFS_MAGIC 0x534F434B
64#define V9FS_MAGIC 0x01021997 66#define SYSFS_MAGIC 0x62656572
67#define USBDEVICE_SUPER_MAGIC 0x9fa2
68#define MTD_INODE_FS_MAGIC 0x11307854
69#define ANON_INODE_FS_MAGIC 0x09041934
70
65 71
66#endif /* __LINUX_MAGIC_H__ */ 72#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/maple.h b/include/linux/maple.h
index d9a51b9b330..c37288b23e0 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -1,9 +1,9 @@
1#ifndef __LINUX_MAPLE_H 1#ifndef __LINUX_MAPLE_H
2#define __LINUX_MAPLE_H 2#define __LINUX_MAPLE_H
3 3
4#include <linux/device.h>
5#include <mach/maple.h> 4#include <mach/maple.h>
6 5
6struct device;
7extern struct bus_type maple_bus_type; 7extern struct bus_type maple_bus_type;
8 8
9/* Maple Bus command and response codes */ 9/* Maple Bus command and response codes */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 0b8e2a74260..910550f3b70 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -4,6 +4,7 @@
4#include <linux/mmzone.h> 4#include <linux/mmzone.h>
5#include <linux/spinlock.h> 5#include <linux/spinlock.h>
6#include <linux/notifier.h> 6#include <linux/notifier.h>
7#include <linux/bug.h>
7 8
8struct page; 9struct page;
9struct zone; 10struct zone;
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 92be3476c9f..84d071ade1d 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 9970337ff04..ee96cd51d8b 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -14,9 +14,10 @@
14 * Author: Rickard Andersson <rickard.andersson@stericsson.com> 14 * Author: Rickard Andersson <rickard.andersson@stericsson.com>
15 */ 15 */
16 16
17#include <linux/device.h>
18#include <linux/regulator/machine.h> 17#include <linux/regulator/machine.h>
19 18
19struct device;
20
20#ifndef MFD_ABX500_H 21#ifndef MFD_ABX500_H
21#define MFD_ABX500_H 22#define MFD_ABX500_H
22 23
@@ -33,13 +34,6 @@
33#define AB5500_1_1 0x21 34#define AB5500_1_1 0x21
34#define AB5500_2_0 0x24 35#define AB5500_2_0 0x24
35 36
36/* AB8500 CIDs*/
37#define AB8500_CUT1P0 0x10
38#define AB8500_CUT1P1 0x11
39#define AB8500_CUT2P0 0x20
40#define AB8500_CUT3P0 0x30
41#define AB8500_CUT3P3 0x33
42
43/* 37/*
44 * AB3100, EVENTA1, A2 and A3 event register flags 38 * AB3100, EVENTA1, A2 and A3 event register flags
45 * 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
@@ -152,6 +146,279 @@ struct abx500_init_settings {
152 u8 setting; 146 u8 setting;
153}; 147};
154 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
155int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, 422int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
156 u8 value); 423 u8 value);
157int 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/ab5500.h b/include/linux/mfd/abx500/ab5500.h
index a720051ae93..54f820ed73b 100644
--- a/include/linux/mfd/abx500/ab5500.h
+++ b/include/linux/mfd/abx500/ab5500.h
@@ -6,7 +6,7 @@
6#ifndef MFD_AB5500_H 6#ifndef MFD_AB5500_H
7#define MFD_AB5500_H 7#define MFD_AB5500_H
8 8
9#include <linux/device.h> 9struct device;
10 10
11enum ab5500_devid { 11enum ab5500_devid {
12 AB5500_DEVID_ADC, 12 AB5500_DEVID_ADC,
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
new file mode 100644
index 00000000000..44310c98ee6
--- /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 488a8c920a2..2387c207ea8 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 10da0291f8f..10eb50973c3 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 838c6b487cc..fccc3002f27 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -7,7 +7,32 @@
7#ifndef MFD_AB8500_H 7#ifndef MFD_AB8500_H
8#define MFD_AB8500_H 8#define MFD_AB8500_H
9 9
10#include <linux/device.h> 10#include <linux/mutex.h>
11
12struct device;
13
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
11 36
12/* 37/*
13 * AB8500 bank addresses 38 * AB8500 bank addresses
@@ -35,30 +60,34 @@
35 60
36/* 61/*
37 * Interrupts 62 * Interrupts
63 * Values used to index into array ab8500_irq_regoffset[] defined in
64 * drivers/mdf/ab8500-core.c
38 */ 65 */
39 66/* Definitions for AB8500 and AB9540 */
40#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 67/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */
41#define AB8500_INT_UN_PLUG_TV_DET 1 68#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */
42#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 */
43#define AB8500_INT_TEMP_WARM 3 71#define AB8500_INT_TEMP_WARM 3
44#define AB8500_INT_PON_KEY2DB_F 4 72#define AB8500_INT_PON_KEY2DB_F 4
45#define AB8500_INT_PON_KEY2DB_R 5 73#define AB8500_INT_PON_KEY2DB_R 5
46#define AB8500_INT_PON_KEY1DB_F 6 74#define AB8500_INT_PON_KEY1DB_F 6
47#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 */
48#define AB8500_INT_BATT_OVV 8 77#define AB8500_INT_BATT_OVV 8
49#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 78#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505 */
50#define AB8500_INT_MAIN_CH_PLUG_DET 11 79#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505 */
51#define AB8500_INT_USB_ID_DET_F 12
52#define AB8500_INT_USB_ID_DET_R 13
53#define AB8500_INT_VBUS_DET_F 14 80#define AB8500_INT_VBUS_DET_F 14
54#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 */
55#define AB8500_INT_VBUS_CH_DROP_END 16 83#define AB8500_INT_VBUS_CH_DROP_END 16
56#define AB8500_INT_RTC_60S 17 84#define AB8500_INT_RTC_60S 17
57#define AB8500_INT_RTC_ALARM 18 85#define AB8500_INT_RTC_ALARM 18
58#define AB8500_INT_BAT_CTRL_INDB 20 86#define AB8500_INT_BAT_CTRL_INDB 20
59#define AB8500_INT_CH_WD_EXP 21 87#define AB8500_INT_CH_WD_EXP 21
60#define AB8500_INT_VBUS_OVV 22 88#define AB8500_INT_VBUS_OVV 22
61#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 */
62#define AB8500_INT_CCN_CONV_ACC 24 91#define AB8500_INT_CCN_CONV_ACC 24
63#define AB8500_INT_INT_AUD 25 92#define AB8500_INT_INT_AUD 25
64#define AB8500_INT_CCEOC 26 93#define AB8500_INT_CCEOC 26
@@ -67,7 +96,8 @@
67#define AB8500_INT_LOW_BAT_R 29 96#define AB8500_INT_LOW_BAT_R 29
68#define AB8500_INT_BUP_CHG_NOT_OK 30 97#define AB8500_INT_BUP_CHG_NOT_OK 30
69#define AB8500_INT_BUP_CHG_OK 31 98#define AB8500_INT_BUP_CHG_OK 31
70#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 */
71#define AB8500_INT_ACC_DETECT_1DB_F 33 101#define AB8500_INT_ACC_DETECT_1DB_F 33
72#define AB8500_INT_ACC_DETECT_1DB_R 34 102#define AB8500_INT_ACC_DETECT_1DB_R 34
73#define AB8500_INT_ACC_DETECT_22DB_F 35 103#define AB8500_INT_ACC_DETECT_22DB_F 35
@@ -75,38 +105,43 @@
75#define AB8500_INT_ACC_DETECT_21DB_F 37 105#define AB8500_INT_ACC_DETECT_21DB_F 37
76#define AB8500_INT_ACC_DETECT_21DB_R 38 106#define AB8500_INT_ACC_DETECT_21DB_R 38
77#define AB8500_INT_GP_SW_ADC_CONV_END 39 107#define AB8500_INT_GP_SW_ADC_CONV_END 39
78#define AB8500_INT_GPIO6R 40 108/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */
79#define AB8500_INT_GPIO7R 41 109#define AB8500_INT_GPIO6R 40 /* not 8505/9540 */
80#define AB8500_INT_GPIO8R 42 110#define AB8500_INT_GPIO7R 41 /* not 8505/9540 */
81#define AB8500_INT_GPIO9R 43 111#define AB8500_INT_GPIO8R 42 /* not 8505/9540 */
112#define AB8500_INT_GPIO9R 43 /* not 8505/9540 */
82#define AB8500_INT_GPIO10R 44 113#define AB8500_INT_GPIO10R 44
83#define AB8500_INT_GPIO11R 45 114#define AB8500_INT_GPIO11R 45
84#define AB8500_INT_GPIO12R 46 115#define AB8500_INT_GPIO12R 46 /* not 8505 */
85#define AB8500_INT_GPIO13R 47 116#define AB8500_INT_GPIO13R 47
86#define AB8500_INT_GPIO24R 48 117/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */
87#define AB8500_INT_GPIO25R 49 118#define AB8500_INT_GPIO24R 48 /* not 8505 */
88#define AB8500_INT_GPIO36R 50 119#define AB8500_INT_GPIO25R 49 /* not 8505 */
89#define AB8500_INT_GPIO37R 51 120#define AB8500_INT_GPIO36R 50 /* not 8505/9540 */
90#define AB8500_INT_GPIO38R 52 121#define AB8500_INT_GPIO37R 51 /* not 8505/9540 */
91#define AB8500_INT_GPIO39R 53 122#define AB8500_INT_GPIO38R 52 /* not 8505/9540 */
123#define AB8500_INT_GPIO39R 53 /* not 8505/9540 */
92#define AB8500_INT_GPIO40R 54 124#define AB8500_INT_GPIO40R 54
93#define AB8500_INT_GPIO41R 55 125#define AB8500_INT_GPIO41R 55
94#define AB8500_INT_GPIO6F 56 126/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */
95#define AB8500_INT_GPIO7F 57 127#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */
96#define AB8500_INT_GPIO8F 58 128#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */
97#define AB8500_INT_GPIO9F 59 129#define AB8500_INT_GPIO8F 58 /* not 8505/9540 */
130#define AB8500_INT_GPIO9F 59 /* not 8505/9540 */
98#define AB8500_INT_GPIO10F 60 131#define AB8500_INT_GPIO10F 60
99#define AB8500_INT_GPIO11F 61 132#define AB8500_INT_GPIO11F 61
100#define AB8500_INT_GPIO12F 62 133#define AB8500_INT_GPIO12F 62 /* not 8505 */
101#define AB8500_INT_GPIO13F 63 134#define AB8500_INT_GPIO13F 63
102#define AB8500_INT_GPIO24F 64 135/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */
103#define AB8500_INT_GPIO25F 65 136#define AB8500_INT_GPIO24F 64 /* not 8505 */
104#define AB8500_INT_GPIO36F 66 137#define AB8500_INT_GPIO25F 65 /* not 8505 */
105#define AB8500_INT_GPIO37F 67 138#define AB8500_INT_GPIO36F 66 /* not 8505/9540 */
106#define AB8500_INT_GPIO38F 68 139#define AB8500_INT_GPIO37F 67 /* not 8505/9540 */
107#define AB8500_INT_GPIO39F 69 140#define AB8500_INT_GPIO38F 68 /* not 8505/9540 */
141#define AB8500_INT_GPIO39F 69 /* not 8505/9540 */
108#define AB8500_INT_GPIO40F 70 142#define AB8500_INT_GPIO40F 70
109#define AB8500_INT_GPIO41F 71 143#define AB8500_INT_GPIO41F 71
144/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */
110#define AB8500_INT_ADP_SOURCE_ERROR 72 145#define AB8500_INT_ADP_SOURCE_ERROR 72
111#define AB8500_INT_ADP_SINK_ERROR 73 146#define AB8500_INT_ADP_SINK_ERROR 73
112#define AB8500_INT_ADP_PROBE_PLUG 74 147#define AB8500_INT_ADP_PROBE_PLUG 74
@@ -114,30 +149,67 @@
114#define AB8500_INT_ADP_SENSE_OFF 76 149#define AB8500_INT_ADP_SENSE_OFF 76
115#define AB8500_INT_USB_PHY_POWER_ERR 78 150#define AB8500_INT_USB_PHY_POWER_ERR 78
116#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 */
117#define AB8500_INT_BTEMP_LOW 80 153#define AB8500_INT_BTEMP_LOW 80
118#define AB8500_INT_BTEMP_LOW_MEDIUM 81 154#define AB8500_INT_BTEMP_LOW_MEDIUM 81
119#define AB8500_INT_BTEMP_MEDIUM_HIGH 82 155#define AB8500_INT_BTEMP_MEDIUM_HIGH 82
120#define AB8500_INT_BTEMP_HIGH 83 156#define AB8500_INT_BTEMP_HIGH 83
121#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
122#define AB8500_INT_ID_WAKEUP_R 90 160#define AB8500_INT_ID_WAKEUP_R 90
123#define AB8500_INT_ID_DET_R1R 92 161#define AB8500_INT_ID_DET_R1R 92
124#define AB8500_INT_ID_DET_R2R 93 162#define AB8500_INT_ID_DET_R2R 93
125#define AB8500_INT_ID_DET_R3R 94 163#define AB8500_INT_ID_DET_R3R 94
126#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 */
127#define AB8500_INT_ID_WAKEUP_F 96 166#define AB8500_INT_ID_WAKEUP_F 96
128#define AB8500_INT_ID_DET_R1F 98 167#define AB8500_INT_ID_DET_R1F 98
129#define AB8500_INT_ID_DET_R2F 99 168#define AB8500_INT_ID_DET_R2F 99
130#define AB8500_INT_ID_DET_R3F 100 169#define AB8500_INT_ID_DET_R3F 100
131#define AB8500_INT_ID_DET_R4F 101 170#define AB8500_INT_ID_DET_R4F 101
132#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 */
133#define AB8500_INT_USB_CH_TH_PROT_F 104 174#define AB8500_INT_USB_CH_TH_PROT_F 104
134#define AB8500_INT_USB_CH_TH_PROT_R 105 175#define AB8500_INT_USB_CH_TH_PROT_R 105
135#define AB8500_INT_MAIN_CH_TH_PROT_F 106 176#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */
136#define AB8500_INT_MAIN_CH_TH_PROT_R 107 177#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */
137#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
138 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 */
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 */
139#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
140#define AB8500_NUM_IRQ_REGS 14 211#define AB8500_NUM_IRQ_REGS 14
212#define AB9540_NUM_IRQ_REGS 17
141 213
142/** 214/**
143 * struct ab8500 - ab8500 internal structure 215 * struct ab8500 - ab8500 internal structure
@@ -145,13 +217,18 @@
145 * @lock: read/write operations lock 217 * @lock: read/write operations lock
146 * @irq_lock: genirq bus lock 218 * @irq_lock: genirq bus lock
147 * @irq: irq line 219 * @irq: irq line
220 * @version: chip version id (e.g. ab8500 or ab9540)
148 * @chip_id: chip revision id 221 * @chip_id: chip revision id
149 * @write: register write 222 * @write: register write
223 * @write_masked: masked register write
150 * @read: register read 224 * @read: register read
151 * @rx_buf: rx buf for SPI 225 * @rx_buf: rx buf for SPI
152 * @tx_buf: tx buf for SPI 226 * @tx_buf: tx buf for SPI
153 * @mask: cache of IRQ regs for bus lock 227 * @mask: cache of IRQ regs for bus lock
154 * @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
155 */ 232 */
156struct ab8500 { 233struct ab8500 {
157 struct device *dev; 234 struct device *dev;
@@ -160,16 +237,20 @@ struct ab8500 {
160 237
161 int irq_base; 238 int irq_base;
162 int irq; 239 int irq;
240 enum ab8500_version version;
163 u8 chip_id; 241 u8 chip_id;
164 242
165 int (*write) (struct ab8500 *a8500, u16 addr, u8 data); 243 int (*write)(struct ab8500 *ab8500, u16 addr, u8 data);
166 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);
167 246
168 unsigned long tx_buf[4]; 247 unsigned long tx_buf[4];
169 unsigned long rx_buf[4]; 248 unsigned long rx_buf[4];
170 249
171 u8 mask[AB8500_NUM_IRQ_REGS]; 250 u8 *mask;
172 u8 oldmask[AB8500_NUM_IRQ_REGS]; 251 u8 *oldmask;
252 int mask_size;
253 const int *irq_reg_offset;
173}; 254};
174 255
175struct regulator_reg_init; 256struct regulator_reg_init;
@@ -195,7 +276,52 @@ struct ab8500_platform_data {
195 struct ab8500_gpio_platform_data *gpio; 276 struct ab8500_gpio_platform_data *gpio;
196}; 277};
197 278
198extern int __devinit ab8500_init(struct ab8500 *ab8500); 279extern int __devinit ab8500_init(struct ab8500 *ab8500,
280 enum ab8500_version version);
199extern int __devexit ab8500_exit(struct ab8500 *ab8500); 281extern int __devexit ab8500_exit(struct ab8500 *ab8500);
200 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
201#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 00000000000..9b07725750c
--- /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 00000000000..22c1007d3ec
--- /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 5702d1be13b..7ffbd6e9e7f 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 60d27f7bfc1..b3a43b1263f 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 bac942f959c..d7674eb7305 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/max8997.h b/include/linux/mfd/max8997.h
index fff590521e5..28726dd540f 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -131,6 +131,55 @@ struct max8997_muic_platform_data {
131 int num_init_data; 131 int num_init_data;
132}; 132};
133 133
134enum max8997_haptic_motor_type {
135 MAX8997_HAPTIC_ERM,
136 MAX8997_HAPTIC_LRA,
137};
138
139enum max8997_haptic_pulse_mode {
140 MAX8997_EXTERNAL_MODE,
141 MAX8997_INTERNAL_MODE,
142};
143
144enum max8997_haptic_pwm_divisor {
145 MAX8997_PWM_DIVISOR_32,
146 MAX8997_PWM_DIVISOR_64,
147 MAX8997_PWM_DIVISOR_128,
148 MAX8997_PWM_DIVISOR_256,
149};
150
151/**
152 * max8997_haptic_platform_data
153 * @pwm_channel_id: channel number of PWM device
154 * valid for MAX8997_EXTERNAL_MODE
155 * @pwm_period: period in nano second for PWM device
156 * valid for MAX8997_EXTERNAL_MODE
157 * @type: motor type
158 * @mode: pulse mode
159 * MAX8997_EXTERNAL_MODE: external PWM device is used to control motor
160 * MAX8997_INTERNAL_MODE: internal pulse generator is used to control motor
161 * @pwm_divisor: divisor for external PWM device
162 * @internal_mode_pattern: internal mode pattern for internal mode
163 * [0 - 3]: valid pattern number
164 * @pattern_cycle: the number of cycles of the waveform
165 * for the internal mode pattern
166 * [0 - 15]: available cycles
167 * @pattern_signal_period: period of the waveform for the internal mode pattern
168 * [0 - 255]: available period
169 */
170struct max8997_haptic_platform_data {
171 unsigned int pwm_channel_id;
172 unsigned int pwm_period;
173
174 enum max8997_haptic_motor_type type;
175 enum max8997_haptic_pulse_mode mode;
176 enum max8997_haptic_pwm_divisor pwm_divisor;
177
178 unsigned int internal_mode_pattern;
179 unsigned int pattern_cycle;
180 unsigned int pattern_signal_period;
181};
182
134enum max8997_led_mode { 183enum max8997_led_mode {
135 MAX8997_NONE, 184 MAX8997_NONE,
136 MAX8997_FLASH_MODE, 185 MAX8997_FLASH_MODE,
@@ -192,7 +241,9 @@ struct max8997_platform_data {
192 /* ---- MUIC ---- */ 241 /* ---- MUIC ---- */
193 struct max8997_muic_platform_data *muic_pdata; 242 struct max8997_muic_platform_data *muic_pdata;
194 243
195 /* HAPTIC: Not implemented */ 244 /* ---- HAPTIC ---- */
245 struct max8997_haptic_platform_data *haptic_pdata;
246
196 /* RTC: Not implemented */ 247 /* RTC: Not implemented */
197 /* ---- LED ---- */ 248 /* ---- LED ---- */
198 struct max8997_led_platform_data *led_pdata; 249 struct max8997_led_platform_data *led_pdata;
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index b86ee45c8b0..10e038bac8d 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 f88c1cc0cb0..a9e8bd15767 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/pm8xxx/pm8921.h b/include/linux/mfd/pm8xxx/pm8921.h
index d5517fd32d1..00fa3de7659 100644
--- a/include/linux/mfd/pm8xxx/pm8921.h
+++ b/include/linux/mfd/pm8xxx/pm8921.h
@@ -18,7 +18,6 @@
18#ifndef __MFD_PM8921_H 18#ifndef __MFD_PM8921_H
19#define __MFD_PM8921_H 19#define __MFD_PM8921_H
20 20
21#include <linux/device.h>
22#include <linux/mfd/pm8xxx/irq.h> 21#include <linux/mfd/pm8xxx/irq.h>
23 22
24#define PM8921_NR_IRQS 256 23#define PM8921_NR_IRQS 256
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
new file mode 100644
index 00000000000..a2c61609d21
--- /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 ca1d7a34760..8516fd1eaab 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -8,7 +8,9 @@
8#ifndef __LINUX_MFD_STMPE_H 8#ifndef __LINUX_MFD_STMPE_H
9#define __LINUX_MFD_STMPE_H 9#define __LINUX_MFD_STMPE_H
10 10
11#include <linux/device.h> 11#include <linux/mutex.h>
12
13struct device;
12 14
13enum stmpe_block { 15enum stmpe_block {
14 STMPE_BLOCK_GPIO = 1 << 0, 16 STMPE_BLOCK_GPIO = 1 << 0,
@@ -26,6 +28,7 @@ enum stmpe_partnum {
26 STMPE1601, 28 STMPE1601,
27 STMPE2401, 29 STMPE2401,
28 STMPE2403, 30 STMPE2403,
31 STMPE_NBR_PARTS
29}; 32};
30 33
31/* 34/*
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index 16c76e124f9..3acb3a8e3af 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -7,7 +7,7 @@
7#ifndef __LINUX_MFD_TC3589x_H 7#ifndef __LINUX_MFD_TC3589x_H
8#define __LINUX_MFD_TC3589x_H 8#define __LINUX_MFD_TC3589x_H
9 9
10#include <linux/device.h> 10struct device;
11 11
12enum tx3589x_block { 12enum tx3589x_block {
13 TC3589x_BLOCK_GPIO = 1 << 0, 13 TC3589x_BLOCK_GPIO = 1 << 0,
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 0dc98044d8b..f5171dbf885 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 00000000000..38e31c55adb
--- /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 00000000000..e030ef9a64e
--- /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 76700b5eee9..1c6c2860d1a 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 4321f044d1e..28af4175636 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 dc3e0501168..893267bb622 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/mlx4/driver.h b/include/linux/mlx4/driver.h
index e1eebf78cab..5f1298b1b5e 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -33,7 +33,6 @@
33#ifndef MLX4_DRIVER_H 33#ifndef MLX4_DRIVER_H
34#define MLX4_DRIVER_H 34#define MLX4_DRIVER_H
35 35
36#include <linux/device.h>
37#include <linux/mlx4/device.h> 36#include <linux/mlx4/device.h>
38 37
39struct mlx4_dev; 38struct mlx4_dev;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7330742e797..d8738a464b9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -6,6 +6,7 @@
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8#include <linux/gfp.h> 8#include <linux/gfp.h>
9#include <linux/bug.h>
9#include <linux/list.h> 10#include <linux/list.h>
10#include <linux/mmzone.h> 11#include <linux/mmzone.h>
11#include <linux/rbtree.h> 12#include <linux/rbtree.h>
@@ -111,7 +112,7 @@ extern unsigned int kobjsize(const void *objp);
111#define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ 112#define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */
112#endif 113#endif
113#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ 114#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
114#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ 115#define VM_NODUMP 0x04000000 /* Do not include in the core dump */
115 116
116#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 117#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
117#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 118#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
@@ -953,7 +954,7 @@ extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
953extern void truncate_setsize(struct inode *inode, loff_t newsize); 954extern void truncate_setsize(struct inode *inode, loff_t newsize);
954extern int vmtruncate(struct inode *inode, loff_t offset); 955extern int vmtruncate(struct inode *inode, loff_t offset);
955extern 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);
956 957void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
957int truncate_inode_page(struct address_space *mapping, struct page *page); 958int truncate_inode_page(struct address_space *mapping, struct page *page);
958int generic_error_remove_page(struct address_space *mapping, struct page *page); 959int generic_error_remove_page(struct address_space *mapping, struct page *page);
959 960
@@ -1257,6 +1258,8 @@ static inline void pgtable_page_dtor(struct page *page)
1257extern void free_area_init(unsigned long * zones_size); 1258extern void free_area_init(unsigned long * zones_size);
1258extern void free_area_init_node(int nid, unsigned long * zones_size, 1259extern void free_area_init_node(int nid, unsigned long * zones_size,
1259 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
1260#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 1263#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
1261/* 1264/*
1262 * 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 19a41d1737a..01beae78f07 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -10,6 +10,7 @@
10#ifndef LINUX_MMC_CARD_H 10#ifndef LINUX_MMC_CARD_H
11#define LINUX_MMC_CARD_H 11#define LINUX_MMC_CARD_H
12 12
13#include <linux/device.h>
13#include <linux/mmc/core.h> 14#include <linux/mmc/core.h>
14#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
15 16
@@ -71,6 +72,8 @@ struct mmc_ext_csd {
71 bool hpi_en; /* HPI enablebit */ 72 bool hpi_en; /* HPI enablebit */
72 bool hpi; /* HPI support bit */ 73 bool hpi; /* HPI support bit */
73 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 */
74 unsigned int boot_ro_lock; /* ro lock support */ 77 unsigned int boot_ro_lock; /* ro lock support */
75 bool boot_ro_lockable; 78 bool boot_ro_lockable;
76 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 a8e46978331..cefaba038cc 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 87a976cc565..1b431c728b9 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -9,7 +9,7 @@
9#define LINUX_MMC_CORE_H 9#define LINUX_MMC_CORE_H
10 10
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/device.h> 12#include <linux/completion.h>
13 13
14struct request; 14struct request;
15struct mmc_data; 15struct mmc_data;
@@ -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 aae5d1f1bb3..8f66e28f5a0 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 ee2b0363c04..cbde4b7e675 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/leds.h> 13#include <linux/leds.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/device.h>
15#include <linux/fault-inject.h> 16#include <linux/fault-inject.h>
16 17
17#include <linux/mmc/core.h> 18#include <linux/mmc/core.h>
@@ -80,34 +81,11 @@ struct mmc_ios {
80 81
81struct mmc_host_ops { 82struct mmc_host_ops {
82 /* 83 /*
83 * Hosts that support power saving can use the 'enable' and 'disable' 84 * 'enable' is called when the host is claimed and 'disable' is called
84 * methods to exit and enter power saving states. 'enable' is called 85 * when the host is released. 'enable' and 'disable' are deprecated.
85 * when the host is claimed and 'disable' is called (or scheduled with
86 * a delay) when the host is released. The 'disable' is scheduled if
87 * the disable delay set by 'mmc_set_disable_delay()' is non-zero,
88 * otherwise 'disable' is called immediately. 'disable' may be
89 * scheduled repeatedly, to permit ever greater power saving at the
90 * expense of ever greater latency to re-enable. Rescheduling is
91 * determined by the return value of the 'disable' method. A positive
92 * value gives the delay in milliseconds.
93 *
94 * In the case where a host function (like set_ios) may be called
95 * with or without the host claimed, enabling and disabling can be
96 * done directly and will nest correctly. Call 'mmc_host_enable()' and
97 * 'mmc_host_lazy_disable()' for this purpose, but note that these
98 * functions must be paired.
99 *
100 * Alternatively, 'mmc_host_enable()' may be paired with
101 * 'mmc_host_disable()' which calls 'disable' immediately. In this
102 * case the 'disable' method will be called with 'lazy' set to 0.
103 * This is mainly useful for error paths.
104 *
105 * Because lazy disable may be called from a work queue, the 'disable'
106 * method must claim the host when 'lazy' != 0, which will work
107 * correctly because recursion is detected and handled.
108 */ 86 */
109 int (*enable)(struct mmc_host *host); 87 int (*enable)(struct mmc_host *host);
110 int (*disable)(struct mmc_host *host, int lazy); 88 int (*disable)(struct mmc_host *host);
111 /* 89 /*
112 * 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
113 * order to support double buffering of requests (prepare one 91 * order to support double buffering of requests (prepare one
@@ -218,7 +196,7 @@ struct mmc_host {
218#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 196#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
219#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 */
220#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 */
221#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ 199
222#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 200#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
223#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 */
224#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 202#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
@@ -258,6 +236,8 @@ struct mmc_host {
258#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 236#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
259 MMC_CAP2_HS200_1_2V_SDR) 237 MMC_CAP2_HS200_1_2V_SDR)
260#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 */
261 241
262 mmc_pm_flag_t pm_caps; /* supported pm features */ 242 mmc_pm_flag_t pm_caps; /* supported pm features */
263 unsigned int power_notify_type; 243 unsigned int power_notify_type;
@@ -300,13 +280,7 @@ struct mmc_host {
300 unsigned int removed:1; /* host is being removed */ 280 unsigned int removed:1; /* host is being removed */
301#endif 281#endif
302 282
303 /* Only used with MMC_CAP_DISABLE */
304 int enabled; /* host is enabled */
305 int rescan_disable; /* disable card detection */ 283 int rescan_disable; /* disable card detection */
306 int nesting_cnt; /* "enable" nesting count */
307 int en_dis_recurs; /* detect recursion */
308 unsigned int disable_delay; /* disable delay in msecs */
309 struct delayed_work disable; /* disabling work */
310 284
311 struct mmc_card *card; /* device attached to this host */ 285 struct mmc_card *card; /* device attached to this host */
312 286
@@ -406,17 +380,8 @@ int mmc_card_awake(struct mmc_host *host);
406int mmc_card_sleep(struct mmc_host *host); 380int mmc_card_sleep(struct mmc_host *host);
407int mmc_card_can_sleep(struct mmc_host *host); 381int mmc_card_can_sleep(struct mmc_host *host);
408 382
409int mmc_host_enable(struct mmc_host *host);
410int mmc_host_disable(struct mmc_host *host);
411int mmc_host_lazy_disable(struct mmc_host *host);
412int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 383int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
413 384
414static inline void mmc_set_disable_delay(struct mmc_host *host,
415 unsigned int disable_delay)
416{
417 host->disable_delay = disable_delay;
418}
419
420/* Module parameter */ 385/* Module parameter */
421extern bool mmc_assume_removable; 386extern bool mmc_assume_removable;
422 387
diff --git a/include/linux/mmc/ioctl.h b/include/linux/mmc/ioctl.h
index 8fa5bc5f805..1f5e6892392 100644
--- a/include/linux/mmc/ioctl.h
+++ b/include/linux/mmc/ioctl.h
@@ -1,5 +1,8 @@
1#ifndef LINUX_MMC_IOCTL_H 1#ifndef LINUX_MMC_IOCTL_H
2#define LINUX_MMC_IOCTL_H 2#define LINUX_MMC_IOCTL_H
3
4#include <linux/types.h>
5
3struct mmc_ioc_cmd { 6struct mmc_ioc_cmd {
4 /* Implies direction of data. true = write, false = read */ 7 /* Implies direction of data. true = write, false = read */
5 int write_flag; 8 int write_flag;
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index fb9f6e116e1..b822a2cb600 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 c750f85177d..e9051e1cb1c 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 04ff452bf5c..05f0e3db1c1 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 71b805451bd..e94e620aedd 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/mod_devicetable.h b/include/linux/mod_devicetable.h
index fb69ad191ad..501da4cb8a6 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -414,6 +414,15 @@ struct hv_vmbus_device_id {
414 __attribute__((aligned(sizeof(kernel_ulong_t)))); 414 __attribute__((aligned(sizeof(kernel_ulong_t))));
415}; 415};
416 416
417/* rpmsg */
418
419#define RPMSG_NAME_SIZE 32
420#define RPMSG_DEVICE_MODALIAS_FMT "rpmsg:%s"
421
422struct rpmsg_device_id {
423 char name[RPMSG_NAME_SIZE];
424};
425
417/* i2c */ 426/* i2c */
418 427
419#define I2C_NAME_SIZE 20 428#define I2C_NAME_SIZE 20
diff --git a/include/linux/module.h b/include/linux/module.h
index 4598bf03e98..fbcafe2ee13 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 c47f4d60db0..ea36486378d 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 c4eec228eef..650ef352f04 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 1bbd9f28924..ed270bd2e4d 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/cfi.h b/include/linux/mtd/cfi.h
index d5d2ec6494b..37ef6b19408 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/bug.h>
25#include <linux/interrupt.h> 26#include <linux/interrupt.h>
26#include <linux/mtd/flashchip.h> 27#include <linux/mtd/flashchip.h>
27#include <linux/mtd/map.h> 28#include <linux/mtd/map.h>
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index 6987995ad3c..b20029221fb 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 94e924e2ecd..3595a0236b0 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 d43dc25af82..cf5ea8cdcf8 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 63b5a8b6dfb..1482340d3d9 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 27ad40aed19..00000000000
--- 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 9cf4c4c7955..a38e1fa8af0 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 00000000000..8ae1726044c
--- /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 8f825756c45..18543e2db06 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 8debe299676..1f77540bdc9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -33,12 +33,12 @@
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
34#include <linux/pm_qos.h> 34#include <linux/pm_qos.h>
35#include <linux/timer.h> 35#include <linux/timer.h>
36#include <linux/bug.h>
36#include <linux/delay.h> 37#include <linux/delay.h>
37#include <linux/atomic.h> 38#include <linux/atomic.h>
38#include <asm/cache.h> 39#include <asm/cache.h>
39#include <asm/byteorder.h> 40#include <asm/byteorder.h>
40 41
41#include <linux/device.h>
42#include <linux/percpu.h> 42#include <linux/percpu.h>
43#include <linux/rculist.h> 43#include <linux/rculist.h>
44#include <linux/dmaengine.h> 44#include <linux/dmaengine.h>
@@ -56,6 +56,7 @@
56#include <linux/netdev_features.h> 56#include <linux/netdev_features.h>
57 57
58struct netpoll_info; 58struct netpoll_info;
59struct device;
59struct phy_device; 60struct phy_device;
60/* 802.11 specific */ 61/* 802.11 specific */
61struct wireless_dev; 62struct wireless_dev;
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index 8c6ee44914c..6d1fb63f592 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -29,7 +29,7 @@
29#define NFS_MNT_VERSION 1 29#define NFS_MNT_VERSION 1
30#define NFS_MNT3_VERSION 3 30#define NFS_MNT3_VERSION 3
31 31
32#define NFS_PIPE_DIRNAME "/nfs" 32#define NFS_PIPE_DIRNAME "nfs"
33 33
34/* 34/*
35 * NFS stats. The good thing with these values is that NFSv3 errors are 35 * NFS stats. The good thing with these values is that NFSv3 errors are
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 32345c2805c..0987146b063 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -183,15 +183,12 @@ struct nfs4_acl {
183 183
184typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; 184typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
185 185
186struct nfs41_stateid { 186struct nfs_stateid4 {
187 __be32 seqid; 187 __be32 seqid;
188 char other[NFS4_STATEID_OTHER_SIZE]; 188 char other[NFS4_STATEID_OTHER_SIZE];
189} __attribute__ ((packed)); 189} __attribute__ ((packed));
190 190
191typedef union { 191typedef struct nfs_stateid4 nfs4_stateid;
192 char data[NFS4_STATEID_SIZE];
193 struct nfs41_stateid stateid;
194} nfs4_stateid;
195 192
196enum nfs_opnum4 { 193enum nfs_opnum4 {
197 OP_ACCESS = 3, 194 OP_ACCESS = 3,
@@ -441,7 +438,20 @@ enum limit_by4 {
441enum open_delegation_type4 { 438enum open_delegation_type4 {
442 NFS4_OPEN_DELEGATE_NONE = 0, 439 NFS4_OPEN_DELEGATE_NONE = 0,
443 NFS4_OPEN_DELEGATE_READ = 1, 440 NFS4_OPEN_DELEGATE_READ = 1,
444 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,
445}; 455};
446 456
447enum lock_type4 { 457enum lock_type4 {
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 8c29950d2fa..52a1bdb4ee2 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -38,6 +38,13 @@
38 38
39#ifdef __KERNEL__ 39#ifdef __KERNEL__
40 40
41/*
42 * Enable dprintk() debugging support for nfs client.
43 */
44#ifdef CONFIG_NFS_DEBUG
45# define NFS_DEBUG
46#endif
47
41#include <linux/in.h> 48#include <linux/in.h>
42#include <linux/mm.h> 49#include <linux/mm.h>
43#include <linux/pagemap.h> 50#include <linux/pagemap.h>
@@ -171,13 +178,9 @@ struct nfs_inode {
171 */ 178 */
172 __be32 cookieverf[2]; 179 __be32 cookieverf[2];
173 180
174 /*
175 * This is the list of dirty unwritten pages.
176 */
177 struct radix_tree_root nfs_page_tree;
178
179 unsigned long npages; 181 unsigned long npages;
180 unsigned long ncommit; 182 unsigned long ncommit;
183 struct list_head commit_list;
181 184
182 /* Open contexts for shared mmap writes */ 185 /* Open contexts for shared mmap writes */
183 struct list_head open_files; 186 struct list_head open_files;
@@ -395,6 +398,29 @@ static inline void nfs_free_fhandle(const struct nfs_fh *fh)
395 kfree(fh); 398 kfree(fh);
396} 399}
397 400
401#ifdef NFS_DEBUG
402extern u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh);
403static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
404{
405 return _nfs_display_fhandle_hash(fh);
406}
407extern void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption);
408#define nfs_display_fhandle(fh, caption) \
409 do { \
410 if (unlikely(nfs_debug & NFSDBG_FACILITY)) \
411 _nfs_display_fhandle(fh, caption); \
412 } while (0)
413#else
414static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
415{
416 return 0;
417}
418static inline void nfs_display_fhandle(const struct nfs_fh *fh,
419 const char *caption)
420{
421}
422#endif
423
398/* 424/*
399 * linux/fs/nfs/nfsroot.c 425 * linux/fs/nfs/nfsroot.c
400 */ 426 */
@@ -632,19 +658,13 @@ nfs_fileid_to_ino_t(u64 fileid)
632 658
633#ifdef __KERNEL__ 659#ifdef __KERNEL__
634 660
635/*
636 * Enable debugging support for nfs client.
637 * Requires RPC_DEBUG.
638 */
639#ifdef RPC_DEBUG
640# define NFS_DEBUG
641#endif
642
643# undef ifdebug 661# undef ifdebug
644# ifdef NFS_DEBUG 662# ifdef NFS_DEBUG
645# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) 663# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac))
664# define NFS_IFDEBUG(x) x
646# else 665# else
647# define ifdebug(fac) if (0) 666# define ifdebug(fac) if (0)
667# define NFS_IFDEBUG(x)
648# endif 668# endif
649#endif /* __KERNEL */ 669#endif /* __KERNEL */
650 670
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h
index 861730275ba..a5c50d97341 100644
--- a/include/linux/nfs_fs_i.h
+++ b/include/linux/nfs_fs_i.h
@@ -1,10 +1,6 @@
1#ifndef _NFS_FS_I 1#ifndef _NFS_FS_I
2#define _NFS_FS_I 2#define _NFS_FS_I
3 3
4#include <asm/types.h>
5#include <linux/list.h>
6#include <linux/nfs.h>
7
8struct nlm_lockowner; 4struct nlm_lockowner;
9 5
10/* 6/*
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index ba4d7656ecf..7073fc74481 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6#include <linux/idr.h>
6#include <linux/wait.h> 7#include <linux/wait.h>
7#include <linux/nfs_xdr.h> 8#include <linux/nfs_xdr.h>
8#include <linux/sunrpc/xprt.h> 9#include <linux/sunrpc/xprt.h>
@@ -17,6 +18,7 @@ struct nfs4_sequence_res;
17struct nfs_server; 18struct nfs_server;
18struct nfs4_minor_version_ops; 19struct nfs4_minor_version_ops;
19struct server_scope; 20struct server_scope;
21struct nfs41_impl_id;
20 22
21/* 23/*
22 * The nfs_client identifies our client state to the server. 24 * The nfs_client identifies our client state to the server.
@@ -85,6 +87,8 @@ struct nfs_client {
85#endif 87#endif
86 88
87 struct server_scope *server_scope; /* from exchange_id */ 89 struct server_scope *server_scope; /* from exchange_id */
90 struct nfs41_impl_id *impl_id; /* from exchange_id */
91 struct net *net;
88}; 92};
89 93
90/* 94/*
@@ -144,15 +148,18 @@ struct nfs_server {
144 u32 acl_bitmask; /* V4 bitmask representing the ACEs 148 u32 acl_bitmask; /* V4 bitmask representing the ACEs
145 that are supported on this 149 that are supported on this
146 filesystem */ 150 filesystem */
151 u32 fh_expire_type; /* V4 bitmask representing file
152 handle volatility type for
153 this filesystem */
147 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ 154 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */
148 struct rpc_wait_queue roc_rpcwaitq; 155 struct rpc_wait_queue roc_rpcwaitq;
149 void *pnfs_ld_data; /* per mount point data */ 156 void *pnfs_ld_data; /* per mount point data */
150 157
151 /* the following fields are protected by nfs_client->cl_lock */ 158 /* the following fields are protected by nfs_client->cl_lock */
152 struct rb_root state_owners; 159 struct rb_root state_owners;
153 struct rb_root openowner_id;
154 struct rb_root lockowner_id;
155#endif 160#endif
161 struct ida openowner_id;
162 struct ida lockowner_id;
156 struct list_head state_owners_lru; 163 struct list_head state_owners_lru;
157 struct list_head layouts; 164 struct list_head layouts;
158 struct list_head delegations; 165 struct list_head delegations;
@@ -188,21 +195,23 @@ struct nfs_server {
188 195
189 196
190/* maximum number of slots to use */ 197/* maximum number of slots to use */
191#define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE 198#define NFS4_DEF_SLOT_TABLE_SIZE (16U)
199#define NFS4_MAX_SLOT_TABLE (256U)
200#define NFS4_NO_SLOT ((u32)-1)
192 201
193#if defined(CONFIG_NFS_V4) 202#if defined(CONFIG_NFS_V4)
194 203
195/* Sessions */ 204/* Sessions */
196#define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) 205#define SLOT_TABLE_SZ DIV_ROUND_UP(NFS4_MAX_SLOT_TABLE, 8*sizeof(long))
197struct nfs4_slot_table { 206struct nfs4_slot_table {
198 struct nfs4_slot *slots; /* seqid per slot */ 207 struct nfs4_slot *slots; /* seqid per slot */
199 unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */ 208 unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */
200 spinlock_t slot_tbl_lock; 209 spinlock_t slot_tbl_lock;
201 struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */ 210 struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */
202 int max_slots; /* # slots in table */ 211 u32 max_slots; /* # slots in table */
203 int highest_used_slotid; /* sent to server on each SEQ. 212 u32 highest_used_slotid; /* sent to server on each SEQ.
204 * op for dynamic resizing */ 213 * op for dynamic resizing */
205 int target_max_slots; /* Set by CB_RECALL_SLOT as 214 u32 target_max_slots; /* Set by CB_RECALL_SLOT as
206 * the new max_slots */ 215 * the new max_slots */
207 struct completion complete; 216 struct completion complete;
208}; 217};
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index 308c1887701..7eed2012d28 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -69,36 +69,22 @@ struct nfs_server;
69struct nfs_fattr; 69struct nfs_fattr;
70struct nfs4_string; 70struct nfs4_string;
71 71
72#ifdef CONFIG_NFS_USE_NEW_IDMAPPER 72#ifdef CONFIG_NFS_V4
73
74int nfs_idmap_init(void); 73int nfs_idmap_init(void);
75void nfs_idmap_quit(void); 74void nfs_idmap_quit(void);
76 75#else
77static inline int nfs_idmap_new(struct nfs_client *clp)
78{
79 return 0;
80}
81
82static inline void nfs_idmap_delete(struct nfs_client *clp)
83{
84}
85
86#else /* CONFIG_NFS_USE_NEW_IDMAPPER not set */
87
88static inline int nfs_idmap_init(void) 76static inline int nfs_idmap_init(void)
89{ 77{
90 return 0; 78 return 0;
91} 79}
92 80
93static inline void nfs_idmap_quit(void) 81static inline void nfs_idmap_quit(void)
94{ 82{}
95} 83#endif
96 84
97int nfs_idmap_new(struct nfs_client *); 85int nfs_idmap_new(struct nfs_client *);
98void nfs_idmap_delete(struct nfs_client *); 86void nfs_idmap_delete(struct nfs_client *);
99 87
100#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
101
102void nfs_fattr_init_names(struct nfs_fattr *fattr, 88void nfs_fattr_init_names(struct nfs_fattr *fattr,
103 struct nfs4_string *owner_name, 89 struct nfs4_string *owner_name,
104 struct nfs4_string *group_name); 90 struct nfs4_string *group_name);
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h
index 8866bb3502e..9dcbbe9a51f 100644
--- a/include/linux/nfs_iostat.h
+++ b/include/linux/nfs_iostat.h
@@ -21,7 +21,7 @@
21#ifndef _LINUX_NFS_IOSTAT 21#ifndef _LINUX_NFS_IOSTAT
22#define _LINUX_NFS_IOSTAT 22#define _LINUX_NFS_IOSTAT
23 23
24#define NFS_IOSTAT_VERS "1.0" 24#define NFS_IOSTAT_VERS "1.1"
25 25
26/* 26/*
27 * NFS byte counters 27 * NFS byte counters
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index ab465fe8c3d..eac30d6bec1 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -19,12 +19,6 @@
19#include <linux/kref.h> 19#include <linux/kref.h>
20 20
21/* 21/*
22 * Valid flags for the radix tree
23 */
24#define NFS_PAGE_TAG_LOCKED 0
25#define NFS_PAGE_TAG_COMMIT 1
26
27/*
28 * Valid flags for a dirty buffer 22 * Valid flags for a dirty buffer
29 */ 23 */
30enum { 24enum {
@@ -33,16 +27,13 @@ enum {
33 PG_CLEAN, 27 PG_CLEAN,
34 PG_NEED_COMMIT, 28 PG_NEED_COMMIT,
35 PG_NEED_RESCHED, 29 PG_NEED_RESCHED,
36 PG_PNFS_COMMIT,
37 PG_PARTIAL_READ_FAILED, 30 PG_PARTIAL_READ_FAILED,
31 PG_COMMIT_TO_DS,
38}; 32};
39 33
40struct nfs_inode; 34struct nfs_inode;
41struct nfs_page { 35struct nfs_page {
42 union { 36 struct list_head wb_list; /* Defines state of page: */
43 struct list_head wb_list; /* Defines state of page: */
44 struct pnfs_layout_segment *wb_commit_lseg; /* Used when PG_PNFS_COMMIT set */
45 };
46 struct page *wb_page; /* page to read in/write out */ 37 struct page *wb_page; /* page to read in/write out */
47 struct nfs_open_context *wb_context; /* File state context info */ 38 struct nfs_open_context *wb_context; /* File state context info */
48 struct nfs_lock_context *wb_lock_context; /* lock context info */ 39 struct nfs_lock_context *wb_lock_context; /* lock context info */
@@ -90,8 +81,6 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
90extern void nfs_release_request(struct nfs_page *req); 81extern void nfs_release_request(struct nfs_page *req);
91 82
92 83
93extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst,
94 pgoff_t idx_start, unsigned int npages, int tag);
95extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, 84extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
96 struct inode *inode, 85 struct inode *inode,
97 const struct nfs_pageio_ops *pg_ops, 86 const struct nfs_pageio_ops *pg_ops,
@@ -106,8 +95,6 @@ extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
106 struct nfs_page *req); 95 struct nfs_page *req);
107extern int nfs_wait_on_request(struct nfs_page *); 96extern int nfs_wait_on_request(struct nfs_page *);
108extern void nfs_unlock_request(struct nfs_page *req); 97extern void nfs_unlock_request(struct nfs_page *req);
109extern int nfs_set_page_tag_locked(struct nfs_page *req);
110extern void nfs_clear_page_tag_locked(struct nfs_page *req);
111 98
112/* 99/*
113 * Lock the page of an asynchronous request without getting a new reference 100 * Lock the page of an asynchronous request without getting a new reference
@@ -118,6 +105,16 @@ nfs_lock_request_dontget(struct nfs_page *req)
118 return !test_and_set_bit(PG_BUSY, &req->wb_flags); 105 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
119} 106}
120 107
108static inline int
109nfs_lock_request(struct nfs_page *req)
110{
111 if (test_and_set_bit(PG_BUSY, &req->wb_flags))
112 return 0;
113 kref_get(&req->wb_kref);
114 return 1;
115}
116
117
121/** 118/**
122 * nfs_list_add_request - Insert a request into a list 119 * nfs_list_add_request - Insert a request into a list
123 * @req: request 120 * @req: request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index d6ba9a12591..bfd0d1bf670 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -2,7 +2,6 @@
2#define _LINUX_NFS_XDR_H 2#define _LINUX_NFS_XDR_H
3 3
4#include <linux/nfsacl.h> 4#include <linux/nfsacl.h>
5#include <linux/nfs3.h>
6#include <linux/sunrpc/gss_api.h> 5#include <linux/sunrpc/gss_api.h>
7 6
8/* 7/*
@@ -89,11 +88,12 @@ struct nfs_fattr {
89#define NFS_ATTR_FATTR_PRECTIME (1U << 16) 88#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
90#define NFS_ATTR_FATTR_CHANGE (1U << 17) 89#define NFS_ATTR_FATTR_CHANGE (1U << 17)
91#define NFS_ATTR_FATTR_PRECHANGE (1U << 18) 90#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
92#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ 91#define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
93#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ 92#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
94#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) 93#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
95#define NFS_ATTR_FATTR_OWNER_NAME (1U << 22) 94#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
96#define NFS_ATTR_FATTR_GROUP_NAME (1U << 23) 95#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
96#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
97 97
98#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 98#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
99 | NFS_ATTR_FATTR_MODE \ 99 | NFS_ATTR_FATTR_MODE \
@@ -182,7 +182,7 @@ struct nfs4_slot {
182 182
183struct nfs4_sequence_args { 183struct nfs4_sequence_args {
184 struct nfs4_session *sa_session; 184 struct nfs4_session *sa_session;
185 u8 sa_slotid; 185 u32 sa_slotid;
186 u8 sa_cache_this; 186 u8 sa_cache_this;
187}; 187};
188 188
@@ -977,6 +977,7 @@ struct nfs4_server_caps_res {
977 u32 acl_bitmask; 977 u32 acl_bitmask;
978 u32 has_links; 978 u32 has_links;
979 u32 has_symlinks; 979 u32 has_symlinks;
980 u32 fh_expire_type;
980 struct nfs4_sequence_res seq_res; 981 struct nfs4_sequence_res seq_res;
981}; 982};
982 983
@@ -1055,14 +1056,6 @@ struct nfstime4 {
1055}; 1056};
1056 1057
1057#ifdef CONFIG_NFS_V4_1 1058#ifdef CONFIG_NFS_V4_1
1058struct nfs_impl_id4 {
1059 u32 domain_len;
1060 char *domain;
1061 u32 name_len;
1062 char *name;
1063 struct nfstime4 date;
1064};
1065
1066#define NFS4_EXCHANGE_ID_LEN (48) 1059#define NFS4_EXCHANGE_ID_LEN (48)
1067struct nfs41_exchange_id_args { 1060struct nfs41_exchange_id_args {
1068 struct nfs_client *client; 1061 struct nfs_client *client;
@@ -1083,10 +1076,17 @@ struct server_scope {
1083 char server_scope[NFS4_OPAQUE_LIMIT]; 1076 char server_scope[NFS4_OPAQUE_LIMIT];
1084}; 1077};
1085 1078
1079struct nfs41_impl_id {
1080 char domain[NFS4_OPAQUE_LIMIT + 1];
1081 char name[NFS4_OPAQUE_LIMIT + 1];
1082 struct nfstime4 date;
1083};
1084
1086struct nfs41_exchange_id_res { 1085struct nfs41_exchange_id_res {
1087 struct nfs_client *client; 1086 struct nfs_client *client;
1088 u32 flags; 1087 u32 flags;
1089 struct server_scope *server_scope; 1088 struct server_scope *server_scope;
1089 struct nfs41_impl_id *impl_id;
1090}; 1090};
1091 1091
1092struct nfs41_create_session_args { 1092struct nfs41_create_session_args {
@@ -1192,6 +1192,27 @@ struct nfs_write_data {
1192 struct page *page_array[NFS_PAGEVEC_SIZE]; 1192 struct page *page_array[NFS_PAGEVEC_SIZE];
1193}; 1193};
1194 1194
1195struct nfs_unlinkdata {
1196 struct hlist_node list;
1197 struct nfs_removeargs args;
1198 struct nfs_removeres res;
1199 struct inode *dir;
1200 struct rpc_cred *cred;
1201 struct nfs_fattr dir_attr;
1202};
1203
1204struct nfs_renamedata {
1205 struct nfs_renameargs args;
1206 struct nfs_renameres res;
1207 struct rpc_cred *cred;
1208 struct inode *old_dir;
1209 struct dentry *old_dentry;
1210 struct nfs_fattr old_fattr;
1211 struct inode *new_dir;
1212 struct dentry *new_dentry;
1213 struct nfs_fattr new_fattr;
1214};
1215
1195struct nfs_access_entry; 1216struct nfs_access_entry;
1196struct nfs_client; 1217struct nfs_client;
1197struct rpc_timeout; 1218struct rpc_timeout;
@@ -1221,10 +1242,12 @@ struct nfs_rpc_ops {
1221 struct iattr *, int, struct nfs_open_context *); 1242 struct iattr *, int, struct nfs_open_context *);
1222 int (*remove) (struct inode *, struct qstr *); 1243 int (*remove) (struct inode *, struct qstr *);
1223 void (*unlink_setup) (struct rpc_message *, struct inode *dir); 1244 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1245 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1224 int (*unlink_done) (struct rpc_task *, struct inode *); 1246 int (*unlink_done) (struct rpc_task *, struct inode *);
1225 int (*rename) (struct inode *, struct qstr *, 1247 int (*rename) (struct inode *, struct qstr *,
1226 struct inode *, struct qstr *); 1248 struct inode *, struct qstr *);
1227 void (*rename_setup) (struct rpc_message *msg, struct inode *dir); 1249 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1250 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1228 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); 1251 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1229 int (*link) (struct inode *, struct inode *, struct qstr *); 1252 int (*link) (struct inode *, struct inode *, struct qstr *);
1230 int (*symlink) (struct inode *, struct dentry *, struct page *, 1253 int (*symlink) (struct inode *, struct dentry *, struct page *,
@@ -1244,8 +1267,10 @@ struct nfs_rpc_ops {
1244 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1267 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1245 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); 1268 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1246 void (*read_setup) (struct nfs_read_data *, struct rpc_message *); 1269 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
1270 void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
1247 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1271 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1248 void (*write_setup) (struct nfs_write_data *, struct rpc_message *); 1272 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1273 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1249 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 1274 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1250 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); 1275 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
1251 int (*commit_done) (struct rpc_task *, struct nfs_write_data *); 1276 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
@@ -1275,11 +1300,11 @@ struct nfs_rpc_ops {
1275extern const struct nfs_rpc_ops nfs_v2_clientops; 1300extern const struct nfs_rpc_ops nfs_v2_clientops;
1276extern const struct nfs_rpc_ops nfs_v3_clientops; 1301extern const struct nfs_rpc_ops nfs_v3_clientops;
1277extern const struct nfs_rpc_ops nfs_v4_clientops; 1302extern const struct nfs_rpc_ops nfs_v4_clientops;
1278extern struct rpc_version nfs_version2; 1303extern const struct rpc_version nfs_version2;
1279extern struct rpc_version nfs_version3; 1304extern const struct rpc_version nfs_version3;
1280extern struct rpc_version nfs_version4; 1305extern const struct rpc_version nfs_version4;
1281 1306
1282extern struct rpc_version nfsacl_version3; 1307extern const struct rpc_version nfsacl_version3;
1283extern struct rpc_program nfsacl_program; 1308extern const struct rpc_program nfsacl_program;
1284 1309
1285#endif 1310#endif
diff --git a/include/linux/nfsd/cld.h b/include/linux/nfsd/cld.h
new file mode 100644
index 00000000000..f14a9ab06f1
--- /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/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 7454ad7451b..89bd4a4dcfb 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -41,6 +41,7 @@
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/ioctl.h> 42#include <linux/ioctl.h>
43#include <linux/magic.h> 43#include <linux/magic.h>
44#include <linux/bug.h>
44 45
45 46
46#define NILFS_INODE_BMAP_SIZE 7 47#define NILFS_INODE_BMAP_SIZE 7
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 2d304efc89d..db50840e635 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -14,7 +14,7 @@
14 * may be used to reset the timeout - for code which intentionally 14 * may be used to reset the timeout - for code which intentionally
15 * disables interrupts for a long time. This call is stateless. 15 * disables interrupts for a long time. This call is stateless.
16 */ 16 */
17#if defined(ARCH_HAS_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) 17#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
18#include <asm/nmi.h> 18#include <asm/nmi.h>
19extern void touch_nmi_watchdog(void); 19extern void touch_nmi_watchdog(void);
20#else 20#else
diff --git a/include/linux/of.h b/include/linux/of.h
index d46a18ffbeb..fa7fb1d9745 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_device.h b/include/linux/of_device.h
index cbc42143fa5..901b7435e89 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -5,10 +5,11 @@
5#include <linux/of_platform.h> /* temporary until merge */ 5#include <linux/of_platform.h> /* temporary until merge */
6 6
7#ifdef CONFIG_OF_DEVICE 7#ifdef CONFIG_OF_DEVICE
8#include <linux/device.h>
9#include <linux/of.h> 8#include <linux/of.h>
10#include <linux/mod_devicetable.h> 9#include <linux/mod_devicetable.h>
11 10
11struct device;
12
12extern const struct of_device_id *of_match_device( 13extern const struct of_device_id *of_match_device(
13 const struct of_device_id *matches, const struct device *dev); 14 const struct of_device_id *matches, const struct device *dev);
14extern void of_device_make_bus_id(struct device *dev); 15extern void of_device_make_bus_id(struct device *dev);
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index b254052a49d..81733d12cbe 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 00000000000..bae1b6094c6
--- /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/omapfb.h b/include/linux/omapfb.h
index c0b018790f0..4ff57e81051 100644
--- a/include/linux/omapfb.h
+++ b/include/linux/omapfb.h
@@ -222,41 +222,11 @@ struct omapfb_display_info {
222 222
223#include <plat/board.h> 223#include <plat/board.h>
224 224
225#ifdef CONFIG_ARCH_OMAP1
226#define OMAPFB_PLANE_NUM 1
227#else
228#define OMAPFB_PLANE_NUM 3
229#endif
230
231struct omapfb_mem_region {
232 u32 paddr;
233 void __iomem *vaddr;
234 unsigned long size;
235 u8 type; /* OMAPFB_PLANE_MEM_* */
236 enum omapfb_color_format format;/* OMAPFB_COLOR_* */
237 unsigned format_used:1; /* Must be set when format is set.
238 * Needed b/c of the badly chosen 0
239 * base for OMAPFB_COLOR_* values
240 */
241 unsigned alloc:1; /* allocated by the driver */
242 unsigned map:1; /* kernel mapped by the driver */
243};
244
245struct omapfb_mem_desc {
246 int region_cnt;
247 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
248};
249
250struct omapfb_platform_data { 225struct omapfb_platform_data {
251 struct omap_lcd_config lcd; 226 struct omap_lcd_config lcd;
252 struct omapfb_mem_desc mem_desc;
253 void *ctrl_platform_data;
254}; 227};
255 228
256/* in arch/arm/plat-omap/fb.c */ 229void __init omapfb_set_lcd_config(const struct omap_lcd_config *config);
257extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
258extern void omapfb_set_ctrl_platform_data(void *pdata);
259extern void omapfb_reserve_sdram_memblock(void);
260 230
261#endif 231#endif
262 232
diff --git a/include/linux/opp.h b/include/linux/opp.h
index ee94b33080c..2a4e5faee90 100644
--- a/include/linux/opp.h
+++ b/include/linux/opp.h
@@ -19,6 +19,7 @@
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20 20
21struct opp; 21struct opp;
22struct device;
22 23
23enum opp_event { 24enum opp_event {
24 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, 25 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6b25758e028..c88d2a9451a 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -6,6 +6,7 @@
6#define PAGE_FLAGS_H 6#define PAGE_FLAGS_H
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/bug.h>
9#ifndef __GENERATING_BOUNDS_H 10#ifndef __GENERATING_BOUNDS_H
10#include <linux/mm_types.h> 11#include <linux/mm_types.h>
11#include <generated/bounds.h> 12#include <generated/bounds.h>
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 38a423ed3c0..106c2ca9440 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/pci.h b/include/linux/pci.h
index 900da5db60e..e444f5b4911 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -299,7 +299,6 @@ struct pci_dev {
299 */ 299 */
300 unsigned int irq; 300 unsigned int irq;
301 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 301 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
302 resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */
303 302
304 /* These fields are used by common fixups */ 303 /* These fields are used by common fixups */
305 unsigned int transparent:1; /* Transparent PCI bridge */ 304 unsigned int transparent:1; /* Transparent PCI bridge */
@@ -369,24 +368,17 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
369 return (pdev->error_state != pci_channel_io_normal); 368 return (pdev->error_state != pci_channel_io_normal);
370} 369}
371 370
372static inline struct pci_cap_saved_state *pci_find_saved_cap( 371struct pci_host_bridge_window {
373 struct pci_dev *pci_dev, char cap) 372 struct list_head list;
374{ 373 struct resource *res; /* host bridge aperture (CPU address) */
375 struct pci_cap_saved_state *tmp; 374 resource_size_t offset; /* bus address + offset = CPU address */
376 struct hlist_node *pos; 375};
377
378 hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
379 if (tmp->cap.cap_nr == cap)
380 return tmp;
381 }
382 return NULL;
383}
384 376
385static inline void pci_add_saved_cap(struct pci_dev *pci_dev, 377struct pci_host_bridge {
386 struct pci_cap_saved_state *new_cap) 378 struct list_head list;
387{ 379 struct pci_bus *bus; /* root bus */
388 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); 380 struct list_head windows; /* pci_host_bridge_windows */
389} 381};
390 382
391/* 383/*
392 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 384 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
@@ -656,6 +648,10 @@ void pci_fixup_cardbus(struct pci_bus *);
656 648
657/* Generic PCI functions used internally */ 649/* Generic PCI functions used internally */
658 650
651void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
652 struct resource *res);
653void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
654 struct pci_bus_region *region);
659void pcibios_scan_specific_bus(int busn); 655void pcibios_scan_specific_bus(int busn);
660extern struct pci_bus *pci_find_bus(int domain, int busnr); 656extern struct pci_bus *pci_find_bus(int domain, int busnr);
661void pci_bus_add_devices(const struct pci_bus *bus); 657void pci_bus_add_devices(const struct pci_bus *bus);
@@ -690,7 +686,8 @@ u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp);
690extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 686extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
691extern void pci_dev_put(struct pci_dev *dev); 687extern void pci_dev_put(struct pci_dev *dev);
692extern void pci_remove_bus(struct pci_bus *b); 688extern void pci_remove_bus(struct pci_bus *b);
693extern void pci_remove_bus_device(struct pci_dev *dev); 689extern void __pci_remove_bus_device(struct pci_dev *dev);
690extern void pci_stop_and_remove_bus_device(struct pci_dev *dev);
694extern void pci_stop_bus_device(struct pci_dev *dev); 691extern void pci_stop_bus_device(struct pci_dev *dev);
695void pci_setup_cardbus(struct pci_bus *bus); 692void pci_setup_cardbus(struct pci_bus *bus);
696extern void pci_sort_breadthfirst(void); 693extern void pci_sort_breadthfirst(void);
@@ -883,6 +880,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev);
883/* Functions for PCI Hotplug drivers to use */ 880/* Functions for PCI Hotplug drivers to use */
884int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 881int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
885#ifdef CONFIG_HOTPLUG 882#ifdef CONFIG_HOTPLUG
883unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge);
886unsigned int pci_rescan_bus(struct pci_bus *bus); 884unsigned int pci_rescan_bus(struct pci_bus *bus);
887#endif 885#endif
888 886
@@ -892,13 +890,13 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void
892int pci_vpd_truncate(struct pci_dev *dev, size_t size); 890int pci_vpd_truncate(struct pci_dev *dev, size_t size);
893 891
894/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 892/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
893resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);
895void pci_bus_assign_resources(const struct pci_bus *bus); 894void pci_bus_assign_resources(const struct pci_bus *bus);
896void pci_bus_size_bridges(struct pci_bus *bus); 895void pci_bus_size_bridges(struct pci_bus *bus);
897int pci_claim_resource(struct pci_dev *, int); 896int pci_claim_resource(struct pci_dev *, int);
898void pci_assign_unassigned_resources(void); 897void pci_assign_unassigned_resources(void);
899void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 898void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
900void pdev_enable_device(struct pci_dev *); 899void pdev_enable_device(struct pci_dev *);
901void pdev_sort_resources(struct pci_dev *, struct resource_list *);
902int pci_enable_resources(struct pci_dev *, int mask); 900int pci_enable_resources(struct pci_dev *, int mask);
903void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 901void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
904 int (*)(const struct pci_dev *, u8, u8)); 902 int (*)(const struct pci_dev *, u8, u8));
@@ -915,6 +913,8 @@ void pci_release_selected_regions(struct pci_dev *, int);
915 913
916/* drivers/pci/bus.c */ 914/* drivers/pci/bus.c */
917void pci_add_resource(struct list_head *resources, struct resource *res); 915void pci_add_resource(struct list_head *resources, struct resource *res);
916void pci_add_resource_offset(struct list_head *resources, struct resource *res,
917 resource_size_t offset);
918void pci_free_resource_list(struct list_head *resources); 918void pci_free_resource_list(struct list_head *resources);
919void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); 919void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);
920struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); 920struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
@@ -960,7 +960,7 @@ void pci_unregister_driver(struct pci_driver *dev);
960 module_driver(__pci_driver, pci_register_driver, \ 960 module_driver(__pci_driver, pci_register_driver, \
961 pci_unregister_driver) 961 pci_unregister_driver)
962 962
963void pci_remove_behind_bridge(struct pci_dev *dev); 963void pci_stop_and_remove_behind_bridge(struct pci_dev *dev);
964struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 964struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
965int pci_add_dynid(struct pci_driver *drv, 965int pci_add_dynid(struct pci_driver *drv,
966 unsigned int vendor, unsigned int device, 966 unsigned int vendor, unsigned int device,
@@ -1396,7 +1396,10 @@ static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
1396 */ 1396 */
1397 1397
1398struct pci_fixup { 1398struct pci_fixup {
1399 u16 vendor, device; /* You can use PCI_ANY_ID here of course */ 1399 u16 vendor; /* You can use PCI_ANY_ID here of course */
1400 u16 device; /* You can use PCI_ANY_ID here of course */
1401 u32 class; /* You can use PCI_ANY_ID here too */
1402 unsigned int class_shift; /* should be 0, 8, 16 */
1400 void (*hook)(struct pci_dev *dev); 1403 void (*hook)(struct pci_dev *dev);
1401}; 1404};
1402 1405
@@ -1411,30 +1414,68 @@ enum pci_fixup_pass {
1411}; 1414};
1412 1415
1413/* Anonymous variables would be nice... */ 1416/* Anonymous variables would be nice... */
1414#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ 1417#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
1415 static const struct pci_fixup __pci_fixup_##name __used \ 1418 class_shift, hook) \
1416 __attribute__((__section__(#section))) = { vendor, device, hook }; 1419 static const struct pci_fixup const __pci_fixup_##name __used \
1420 __attribute__((__section__(#section), aligned((sizeof(void *))))) \
1421 = { vendor, device, class, class_shift, hook };
1422
1423#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \
1424 class_shift, hook) \
1425 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
1426 vendor##device##hook, vendor, device, class, class_shift, hook)
1427#define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \
1428 class_shift, hook) \
1429 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
1430 vendor##device##hook, vendor, device, class, class_shift, hook)
1431#define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \
1432 class_shift, hook) \
1433 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
1434 vendor##device##hook, vendor, device, class, class_shift, hook)
1435#define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \
1436 class_shift, hook) \
1437 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
1438 vendor##device##hook, vendor, device, class, class_shift, hook)
1439#define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \
1440 class_shift, hook) \
1441 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1442 resume##vendor##device##hook, vendor, device, class, \
1443 class_shift, hook)
1444#define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \
1445 class_shift, hook) \
1446 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1447 resume_early##vendor##device##hook, vendor, device, \
1448 class, class_shift, hook)
1449#define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \
1450 class_shift, hook) \
1451 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1452 suspend##vendor##device##hook, vendor, device, class, \
1453 class_shift, hook)
1454
1417#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1455#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
1418 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1456 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
1419 vendor##device##hook, vendor, device, hook) 1457 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1420#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ 1458#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \
1421 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1459 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
1422 vendor##device##hook, vendor, device, hook) 1460 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1423#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ 1461#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \
1424 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1462 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
1425 vendor##device##hook, vendor, device, hook) 1463 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1426#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ 1464#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \
1427 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1465 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
1428 vendor##device##hook, vendor, device, hook) 1466 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1429#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ 1467#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
1430 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1468 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1431 resume##vendor##device##hook, vendor, device, hook) 1469 resume##vendor##device##hook, vendor, device, \
1470 PCI_ANY_ID, 0, hook)
1432#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ 1471#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \
1433 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1472 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1434 resume_early##vendor##device##hook, vendor, device, hook) 1473 resume_early##vendor##device##hook, vendor, device, \
1474 PCI_ANY_ID, 0, hook)
1435#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ 1475#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \
1436 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1476 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1437 suspend##vendor##device##hook, vendor, device, hook) 1477 suspend##vendor##device##hook, vendor, device, \
1478 PCI_ANY_ID, 0, hook)
1438 1479
1439#ifdef CONFIG_PCI_QUIRKS 1480#ifdef CONFIG_PCI_QUIRKS
1440void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1481void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index e41a10f5ae8..4b608f54341 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -391,6 +391,7 @@
391#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ 391#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ 392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ 393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
394#define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */
394#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ 395#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
395#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ 396#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */
396#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ 397#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index bd9f55a5958..ddbb6a901f6 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/phy.h b/include/linux/phy.h
index c599f7eca1e..6fe0a37d4ab 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -19,7 +19,6 @@
19#define __PHY_H 19#define __PHY_H
20 20
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/device.h>
23#include <linux/ethtool.h> 22#include <linux/ethtool.h>
24#include <linux/mii.h> 23#include <linux/mii.h>
25#include <linux/timer.h> 24#include <linux/timer.h>
@@ -88,6 +87,9 @@ typedef enum {
88 IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ 87 IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
89#define MII_ADDR_C45 (1<<30) 88#define MII_ADDR_C45 (1<<30)
90 89
90struct device;
91struct sk_buff;
92
91/* 93/*
92 * The Bus class for PHYs. Devices which provide access to 94 * The Bus class for PHYs. Devices which provide access to
93 * PHYs should register using this structure 95 * PHYs should register using this structure
@@ -241,7 +243,6 @@ enum phy_state {
241 PHY_RESUMING 243 PHY_RESUMING
242}; 244};
243 245
244struct sk_buff;
245 246
246/* phy_device: An instance of a PHY 247/* phy_device: An instance of a PHY
247 * 248 *
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index e7cf6669ac3..b067bd8c49d 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -2,6 +2,7 @@
2#define _LINUX_PID_NS_H 2#define _LINUX_PID_NS_H
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/bug.h>
5#include <linux/mm.h> 6#include <linux/mm.h>
6#include <linux/threads.h> 7#include <linux/threads.h>
7#include <linux/nsproxy.h> 8#include <linux/nsproxy.h>
@@ -32,6 +33,7 @@ struct pid_namespace {
32#endif 33#endif
33 gid_t pid_gid; 34 gid_t pid_gid;
34 int hide_pid; 35 int hide_pid;
36 int reboot; /* group exit code if this pidns was rebooted */
35}; 37};
36 38
37extern struct pid_namespace init_pid_ns; 39extern struct pid_namespace init_pid_ns;
@@ -47,6 +49,7 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
47extern 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);
48extern void free_pid_ns(struct kref *kref); 50extern void free_pid_ns(struct kref *kref);
49extern 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);
50 53
51static inline void put_pid_ns(struct pid_namespace *ns) 54static inline void put_pid_ns(struct pid_namespace *ns)
52{ 55{
@@ -74,11 +77,15 @@ static inline void put_pid_ns(struct pid_namespace *ns)
74{ 77{
75} 78}
76 79
77
78static inline void zap_pid_ns_processes(struct pid_namespace *ns) 80static inline void zap_pid_ns_processes(struct pid_namespace *ns)
79{ 81{
80 BUG(); 82 BUG();
81} 83}
84
85static inline int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
86{
87 return 0;
88}
82#endif /* CONFIG_PID_NS */ 89#endif /* CONFIG_PID_NS */
83 90
84extern 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/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
new file mode 100644
index 00000000000..191e7268848
--- /dev/null
+++ b/include/linux/pinctrl/consumer.h
@@ -0,0 +1,159 @@
1/*
2 * Consumer interface the pin control subsystem
3 *
4 * Copyright (C) 2012 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * Based on bits of regulator core, gpio core and clk core
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_CONSUMER_H
13#define __LINUX_PINCTRL_CONSUMER_H
14
15#include <linux/err.h>
16#include <linux/list.h>
17#include <linux/seq_file.h>
18#include "pinctrl-state.h"
19
20/* This struct is private to the core and should be regarded as a cookie */
21struct pinctrl;
22struct pinctrl_state;
23
24#ifdef CONFIG_PINCTRL
25
26/* External interface to pin control */
27extern int pinctrl_request_gpio(unsigned gpio);
28extern void pinctrl_free_gpio(unsigned gpio);
29extern int pinctrl_gpio_direction_input(unsigned gpio);
30extern int pinctrl_gpio_direction_output(unsigned gpio);
31
32extern struct pinctrl * __must_check pinctrl_get(struct device *dev);
33extern void pinctrl_put(struct pinctrl *p);
34extern struct pinctrl_state * __must_check pinctrl_lookup_state(
35 struct pinctrl *p,
36 const char *name);
37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
38
39#else /* !CONFIG_PINCTRL */
40
41static inline int pinctrl_request_gpio(unsigned gpio)
42{
43 return 0;
44}
45
46static inline void pinctrl_free_gpio(unsigned gpio)
47{
48}
49
50static inline int pinctrl_gpio_direction_input(unsigned gpio)
51{
52 return 0;
53}
54
55static inline int pinctrl_gpio_direction_output(unsigned gpio)
56{
57 return 0;
58}
59
60static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
61{
62 return NULL;
63}
64
65static inline void pinctrl_put(struct pinctrl *p)
66{
67}
68
69static inline struct pinctrl_state * __must_check pinctrl_lookup_state(
70 struct pinctrl *p,
71 const char *name)
72{
73 return NULL;
74}
75
76static inline int pinctrl_select_state(struct pinctrl *p,
77 struct pinctrl_state *s)
78{
79 return 0;
80}
81
82#endif /* CONFIG_PINCTRL */
83
84static inline struct pinctrl * __must_check pinctrl_get_select(
85 struct device *dev, const char *name)
86{
87 struct pinctrl *p;
88 struct pinctrl_state *s;
89 int ret;
90
91 p = pinctrl_get(dev);
92 if (IS_ERR(p))
93 return p;
94
95 s = pinctrl_lookup_state(p, name);
96 if (IS_ERR(s)) {
97 pinctrl_put(p);
98 return ERR_PTR(PTR_ERR(s));
99 }
100
101 ret = pinctrl_select_state(p, s);
102 if (ret < 0) {
103 pinctrl_put(p);
104 return ERR_PTR(ret);
105 }
106
107 return p;
108}
109
110static inline struct pinctrl * __must_check pinctrl_get_select_default(
111 struct device *dev)
112{
113 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
114}
115
116#ifdef CONFIG_PINCONF
117
118extern int pin_config_get(const char *dev_name, const char *name,
119 unsigned long *config);
120extern int pin_config_set(const char *dev_name, const char *name,
121 unsigned long config);
122extern int pin_config_group_get(const char *dev_name,
123 const char *pin_group,
124 unsigned long *config);
125extern int pin_config_group_set(const char *dev_name,
126 const char *pin_group,
127 unsigned long config);
128
129#else
130
131static inline int pin_config_get(const char *dev_name, const char *name,
132 unsigned long *config)
133{
134 return 0;
135}
136
137static inline int pin_config_set(const char *dev_name, const char *name,
138 unsigned long config)
139{
140 return 0;
141}
142
143static inline int pin_config_group_get(const char *dev_name,
144 const char *pin_group,
145 unsigned long *config)
146{
147 return 0;
148}
149
150static inline int pin_config_group_set(const char *dev_name,
151 const char *pin_group,
152 unsigned long config)
153{
154 return 0;
155}
156
157#endif
158
159#endif /* __LINUX_PINCTRL_CONSUMER_H */
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index d0aecb7f6fb..fee4349364f 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -9,87 +9,153 @@
9 * 9 *
10 * License terms: GNU General Public License (GPL) version 2 10 * License terms: GNU General Public License (GPL) version 2
11 */ 11 */
12#ifndef __LINUX_PINMUX_MACHINE_H 12#ifndef __LINUX_PINCTRL_MACHINE_H
13#define __LINUX_PINMUX_MACHINE_H 13#define __LINUX_PINCTRL_MACHINE_H
14
15#include "pinctrl-state.h"
16
17enum pinctrl_map_type {
18 PIN_MAP_TYPE_INVALID,
19 PIN_MAP_TYPE_DUMMY_STATE,
20 PIN_MAP_TYPE_MUX_GROUP,
21 PIN_MAP_TYPE_CONFIGS_PIN,
22 PIN_MAP_TYPE_CONFIGS_GROUP,
23};
24
25/**
26 * struct pinctrl_map_mux - mapping table content for MAP_TYPE_MUX_GROUP
27 * @group: the name of the group whose mux function is to be configured. This
28 * field may be left NULL, and the first applicable group for the function
29 * will be used.
30 * @function: the mux function to select for the group
31 */
32struct pinctrl_map_mux {
33 const char *group;
34 const char *function;
35};
14 36
15/** 37/**
16 * struct pinmux_map - boards/machines shall provide this map for devices 38 * struct pinctrl_map_configs - mapping table content for MAP_TYPE_CONFIGS_*
39 * @group_or_pin: the name of the pin or group whose configuration parameters
40 * are to be configured.
41 * @configs: a pointer to an array of config parameters/values to program into
42 * hardware. Each individual pin controller defines the format and meaning
43 * of config parameters.
44 * @num_configs: the number of entries in array @configs
45 */
46struct pinctrl_map_configs {
47 const char *group_or_pin;
48 unsigned long *configs;
49 unsigned num_configs;
50};
51
52/**
53 * struct pinctrl_map - boards/machines shall provide this map for devices
54 * @dev_name: the name of the device using this specific mapping, the name
55 * must be the same as in your struct device*. If this name is set to the
56 * same name as the pin controllers own dev_name(), the map entry will be
57 * hogged by the driver itself upon registration
17 * @name: the name of this specific map entry for the particular machine. 58 * @name: the name of this specific map entry for the particular machine.
18 * This is the second parameter passed to pinmux_get() when you want 59 * This is the parameter passed to pinmux_lookup_state()
19 * to have several mappings to the same device 60 * @type: the type of mapping table entry
20 * @ctrl_dev: the pin control device to be used by this mapping, may be NULL
21 * if you provide .ctrl_dev_name instead (this is more common)
22 * @ctrl_dev_name: the name of the device controlling this specific mapping, 61 * @ctrl_dev_name: the name of the device controlling this specific mapping,
23 * the name must be the same as in your struct device*, may be NULL if 62 * the name must be the same as in your struct device*. This field is not
24 * you provide .ctrl_dev instead 63 * used for PIN_MAP_TYPE_DUMMY_STATE
25 * @function: a function in the driver to use for this mapping, the driver 64 * @data: Data specific to the mapping type
26 * will lookup the function referenced by this ID on the specified
27 * pin control device
28 * @group: sometimes a function can map to different pin groups, so this
29 * selects a certain specific pin group to activate for the function, if
30 * left as NULL, the first applicable group will be used
31 * @dev: the device using this specific mapping, may be NULL if you provide
32 * .dev_name instead (this is more common)
33 * @dev_name: the name of the device using this specific mapping, the name
34 * must be the same as in your struct device*, may be NULL if you
35 * provide .dev instead
36 * @hog_on_boot: if this is set to true, the pin control subsystem will itself
37 * hog the mappings as the pinmux device drivers are attached, so this is
38 * typically used with system maps (mux mappings without an assigned
39 * device) that you want to get hogged and enabled by default as soon as
40 * a pinmux device supporting it is registered. These maps will not be
41 * disabled and put until the system shuts down.
42 */ 65 */
43struct pinmux_map { 66struct pinctrl_map {
67 const char *dev_name;
44 const char *name; 68 const char *name;
45 struct device *ctrl_dev; 69 enum pinctrl_map_type type;
46 const char *ctrl_dev_name; 70 const char *ctrl_dev_name;
47 const char *function; 71 union {
48 const char *group; 72 struct pinctrl_map_mux mux;
49 struct device *dev; 73 struct pinctrl_map_configs configs;
50 const char *dev_name; 74 } data;
51 bool hog_on_boot;
52}; 75};
53 76
54/* 77/* Convenience macros to create mapping table entries */
55 * Convenience macro to set a simple map from a certain pin controller and a
56 * certain function to a named device
57 */
58#define PINMUX_MAP(a, b, c, d) \
59 { .name = a, .ctrl_dev_name = b, .function = c, .dev_name = d }
60 78
61/* 79#define PIN_MAP_DUMMY_STATE(dev, state) \
62 * Convenience macro to map a system function onto a certain pinctrl device. 80 { \
63 * System functions are not assigned to a particular device. 81 .dev_name = dev, \
64 */ 82 .name = state, \
65#define PINMUX_MAP_SYS(a, b, c) \ 83 .type = PIN_MAP_TYPE_DUMMY_STATE, \
66 { .name = a, .ctrl_dev_name = b, .function = c } 84 }
67 85
68/* 86#define PIN_MAP_MUX_GROUP(dev, state, pinctrl, grp, func) \
69 * Convenience macro to map a system function onto a certain pinctrl device, 87 { \
70 * to be hogged by the pinmux core until the system shuts down. 88 .dev_name = dev, \
71 */ 89 .name = state, \
72#define PINMUX_MAP_SYS_HOG(a, b, c) \ 90 .type = PIN_MAP_TYPE_MUX_GROUP, \
73 { .name = a, .ctrl_dev_name = b, .function = c, \ 91 .ctrl_dev_name = pinctrl, \
74 .hog_on_boot = true } 92 .data.mux = { \
93 .group = grp, \
94 .function = func, \
95 }, \
96 }
75 97
76/* 98#define PIN_MAP_MUX_GROUP_DEFAULT(dev, pinctrl, grp, func) \
77 * Convenience macro to map a system function onto a certain pinctrl device 99 PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, func)
78 * using a specified group, to be hogged by the pinmux core until the system 100
79 * shuts down. 101#define PIN_MAP_MUX_GROUP_HOG(dev, state, grp, func) \
80 */ 102 PIN_MAP_MUX_GROUP(dev, state, dev, grp, func)
81#define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \ 103
82 { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ 104#define PIN_MAP_MUX_GROUP_HOG_DEFAULT(dev, grp, func) \
83 .hog_on_boot = true } 105 PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, func)
106
107#define PIN_MAP_CONFIGS_PIN(dev, state, pinctrl, pin, cfgs) \
108 { \
109 .dev_name = dev, \
110 .name = state, \
111 .type = PIN_MAP_TYPE_CONFIGS_PIN, \
112 .ctrl_dev_name = pinctrl, \
113 .data.configs = { \
114 .group_or_pin = pin, \
115 .configs = cfgs, \
116 .num_configs = ARRAY_SIZE(cfgs), \
117 }, \
118 }
119
120#define PIN_MAP_CONFIGS_PIN_DEFAULT(dev, pinctrl, pin, cfgs) \
121 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, pinctrl, pin, cfgs)
122
123#define PIN_MAP_CONFIGS_PIN_HOG(dev, state, pin, cfgs) \
124 PIN_MAP_CONFIGS_PIN(dev, state, dev, pin, cfgs)
125
126#define PIN_MAP_CONFIGS_PIN_HOG_DEFAULT(dev, pin, cfgs) \
127 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, dev, pin, cfgs)
128
129#define PIN_MAP_CONFIGS_GROUP(dev, state, pinctrl, grp, cfgs) \
130 { \
131 .dev_name = dev, \
132 .name = state, \
133 .type = PIN_MAP_TYPE_CONFIGS_GROUP, \
134 .ctrl_dev_name = pinctrl, \
135 .data.configs = { \
136 .group_or_pin = grp, \
137 .configs = cfgs, \
138 .num_configs = ARRAY_SIZE(cfgs), \
139 }, \
140 }
141
142#define PIN_MAP_CONFIGS_GROUP_DEFAULT(dev, pinctrl, grp, cfgs) \
143 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, cfgs)
144
145#define PIN_MAP_CONFIGS_GROUP_HOG(dev, state, grp, cfgs) \
146 PIN_MAP_CONFIGS_GROUP(dev, state, dev, grp, cfgs)
147
148#define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \
149 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs)
84 150
85#ifdef CONFIG_PINMUX 151#ifdef CONFIG_PINMUX
86 152
87extern int pinmux_register_mappings(struct pinmux_map const *map, 153extern int pinctrl_register_mappings(struct pinctrl_map const *map,
88 unsigned num_maps); 154 unsigned num_maps);
89 155
90#else 156#else
91 157
92static inline int pinmux_register_mappings(struct pinmux_map const *map, 158static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
93 unsigned num_maps) 159 unsigned num_maps)
94{ 160{
95 return 0; 161 return 0;
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
new file mode 100644
index 00000000000..4f0abb9f1c0
--- /dev/null
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -0,0 +1,114 @@
1/*
2 * Interface the generic pinconfig portions of the pinctrl subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * This interface is used in the core to keep track of pins.
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H
13#define __LINUX_PINCTRL_PINCONF_GENERIC_H
14
15/*
16 * You shouldn't even be able to compile with these enums etc unless you're
17 * using generic pin config. That is why this is defined out.
18 */
19#ifdef CONFIG_GENERIC_PINCONF
20
21/**
22 * enum pin_config_param - possible pin configuration parameters
23 * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a
24 * transition from say pull-up to pull-down implies that you disable
25 * pull-up in the process, this setting disables all biasing.
26 * @PIN_CONFIG_BIAS_HIGH_IMPEDANCE: the pin will be set to a high impedance
27 * mode, also know as "third-state" (tristate) or "high-Z" or "floating".
28 * On output pins this effectively disconnects the pin, which is useful
29 * if for example some other pin is going to drive the signal connected
30 * to it for a while. Pins used for input are usually always high
31 * impedance.
32 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high
33 * impedance to VDD). If the argument is != 0 pull-up is enabled,
34 * if it is 0, pull-up is disabled.
35 * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high
36 * impedance to GROUND). If the argument is != 0 pull-down is enabled,
37 * if it is 0, pull-down is disabled.
38 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and
39 * low, this is the most typical case and is typically achieved with two
40 * active transistors on the output. Sending this config will enabale
41 * push-pull mode, the argument is ignored.
42 * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open
43 * collector) which means it is usually wired with other output ports
44 * which are then pulled up with an external resistor. Sending this
45 * config will enabale open drain mode, the argument is ignored.
46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
47 * (open emitter). Sending this config will enabale open drain mode, the
48 * argument is ignored.
49 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
50 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
51 * the threshold value is given on a custom format as argument when
52 * setting pins to this mode. The argument zero turns the schmitt trigger
53 * off.
54 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode,
55 * which means it will wait for signals to settle when reading inputs. The
56 * argument gives the debounce time on a custom format. Setting the
57 * argument to zero turns debouncing off.
58 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
59 * supplies, the argument to this parameter (on a custom format) tells
60 * the driver which alternative power source to use.
61 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power
62 * operation, if several modes of operation are supported these can be
63 * passed in the argument on a custom form, else just use argument 1
64 * to indicate low power mode, argument 0 turns low power mode off.
65 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if
66 * you need to pass in custom configurations to the pin controller, use
67 * PIN_CONFIG_END+1 as the base offset.
68 */
69enum pin_config_param {
70 PIN_CONFIG_BIAS_DISABLE,
71 PIN_CONFIG_BIAS_HIGH_IMPEDANCE,
72 PIN_CONFIG_BIAS_PULL_UP,
73 PIN_CONFIG_BIAS_PULL_DOWN,
74 PIN_CONFIG_DRIVE_PUSH_PULL,
75 PIN_CONFIG_DRIVE_OPEN_DRAIN,
76 PIN_CONFIG_DRIVE_OPEN_SOURCE,
77 PIN_CONFIG_INPUT_SCHMITT,
78 PIN_CONFIG_INPUT_DEBOUNCE,
79 PIN_CONFIG_POWER_SOURCE,
80 PIN_CONFIG_LOW_POWER_MODE,
81 PIN_CONFIG_END = 0x7FFF,
82};
83
84/*
85 * Helpful configuration macro to be used in tables etc.
86 */
87#define PIN_CONF_PACKED(p, a) ((a << 16) | ((unsigned long) p & 0xffffUL))
88
89/*
90 * The following inlines stuffs a configuration parameter and data value
91 * into and out of an unsigned long argument, as used by the generic pin config
92 * system. We put the parameter in the lower 16 bits and the argument in the
93 * upper 16 bits.
94 */
95
96static inline enum pin_config_param pinconf_to_config_param(unsigned long config)
97{
98 return (enum pin_config_param) (config & 0xffffUL);
99}
100
101static inline u16 pinconf_to_config_argument(unsigned long config)
102{
103 return (enum pin_config_param) ((config >> 16) & 0xffffUL);
104}
105
106static inline unsigned long pinconf_to_config_packed(enum pin_config_param param,
107 u16 argument)
108{
109 return PIN_CONF_PACKED(param, argument);
110}
111
112#endif /* CONFIG_GENERIC_PINCONF */
113
114#endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index 477922cf043..ec431f03362 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -20,6 +20,8 @@ struct seq_file;
20/** 20/**
21 * struct pinconf_ops - pin config operations, to be implemented by 21 * struct pinconf_ops - pin config operations, to be implemented by
22 * pin configuration capable drivers. 22 * pin configuration capable drivers.
23 * @is_generic: for pin controllers that want to use the generic interface,
24 * this flag tells the framework that it's generic.
23 * @pin_config_get: get the config of a certain pin, if the requested config 25 * @pin_config_get: get the config of a certain pin, if the requested config
24 * is not available on this controller this should return -ENOTSUPP 26 * is not available on this controller this should return -ENOTSUPP
25 * and if it is available but disabled it should return -EINVAL 27 * and if it is available but disabled it should return -EINVAL
@@ -33,6 +35,9 @@ struct seq_file;
33 * per-device info for a certain group in debugfs 35 * per-device info for a certain group in debugfs
34 */ 36 */
35struct pinconf_ops { 37struct pinconf_ops {
38#ifdef CONFIG_GENERIC_PINCONF
39 bool is_generic;
40#endif
36 int (*pin_config_get) (struct pinctrl_dev *pctldev, 41 int (*pin_config_get) (struct pinctrl_dev *pctldev,
37 unsigned pin, 42 unsigned pin,
38 unsigned long *config); 43 unsigned long *config);
@@ -53,45 +58,6 @@ struct pinconf_ops {
53 unsigned selector); 58 unsigned selector);
54}; 59};
55 60
56extern int pin_config_get(const char *dev_name, const char *name,
57 unsigned long *config);
58extern int pin_config_set(const char *dev_name, const char *name,
59 unsigned long config);
60extern int pin_config_group_get(const char *dev_name,
61 const char *pin_group,
62 unsigned long *config);
63extern int pin_config_group_set(const char *dev_name,
64 const char *pin_group,
65 unsigned long config);
66
67#else
68
69static inline int pin_config_get(const char *dev_name, const char *name,
70 unsigned long *config)
71{
72 return 0;
73}
74
75static inline int pin_config_set(const char *dev_name, const char *name,
76 unsigned long config)
77{
78 return 0;
79}
80
81static inline int pin_config_group_get(const char *dev_name,
82 const char *pin_group,
83 unsigned long *config)
84{
85 return 0;
86}
87
88static inline int pin_config_group_set(const char *dev_name,
89 const char *pin_group,
90 unsigned long config)
91{
92 return 0;
93}
94
95#endif 61#endif
96 62
97#endif /* __LINUX_PINCTRL_PINCONF_H */ 63#endif /* __LINUX_PINCTRL_PINCONF_H */
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h
new file mode 100644
index 00000000000..3920e28b4da
--- /dev/null
+++ b/include/linux/pinctrl/pinctrl-state.h
@@ -0,0 +1,6 @@
1/*
2 * Standard pin control state definitions
3 */
4
5#define PINCTRL_STATE_DEFAULT "default"
6#define PINCTRL_STATE_IDLE "idle"
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 8bd22ee7aa0..4e9f0788c22 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -15,10 +15,11 @@
15#ifdef CONFIG_PINCTRL 15#ifdef CONFIG_PINCTRL
16 16
17#include <linux/radix-tree.h> 17#include <linux/radix-tree.h>
18#include <linux/spinlock.h>
19#include <linux/list.h> 18#include <linux/list.h>
20#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include "pinctrl-state.h"
21 21
22struct device;
22struct pinctrl_dev; 23struct pinctrl_dev;
23struct pinmux_ops; 24struct pinmux_ops;
24struct pinconf_ops; 25struct pinconf_ops;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 937b3e2fa36..47e9237edd4 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -16,9 +16,6 @@
16#include <linux/seq_file.h> 16#include <linux/seq_file.h>
17#include "pinctrl.h" 17#include "pinctrl.h"
18 18
19/* This struct is private to the core and should be regarded as a cookie */
20struct pinmux;
21
22#ifdef CONFIG_PINMUX 19#ifdef CONFIG_PINMUX
23 20
24struct pinctrl_dev; 21struct pinctrl_dev;
@@ -88,55 +85,6 @@ struct pinmux_ops {
88 bool input); 85 bool input);
89}; 86};
90 87
91/* External interface to pinmux */
92extern int pinmux_request_gpio(unsigned gpio);
93extern void pinmux_free_gpio(unsigned gpio);
94extern int pinmux_gpio_direction_input(unsigned gpio);
95extern int pinmux_gpio_direction_output(unsigned gpio);
96extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
97extern void pinmux_put(struct pinmux *pmx);
98extern int pinmux_enable(struct pinmux *pmx);
99extern void pinmux_disable(struct pinmux *pmx);
100
101#else /* !CONFIG_PINMUX */
102
103static inline int pinmux_request_gpio(unsigned gpio)
104{
105 return 0;
106}
107
108static inline void pinmux_free_gpio(unsigned gpio)
109{
110}
111
112static inline int pinmux_gpio_direction_input(unsigned gpio)
113{
114 return 0;
115}
116
117static inline int pinmux_gpio_direction_output(unsigned gpio)
118{
119 return 0;
120}
121
122static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
123{
124 return NULL;
125}
126
127static inline void pinmux_put(struct pinmux *pmx)
128{
129}
130
131static inline int pinmux_enable(struct pinmux *pmx)
132{
133 return 0;
134}
135
136static inline void pinmux_disable(struct pinmux *pmx)
137{
138}
139
140#endif /* CONFIG_PINMUX */ 88#endif /* CONFIG_PINMUX */
141 89
142#endif /* __LINUX_PINCTRL_PINMUX_H */ 90#endif /* __LINUX_PINCTRL_PINMUX_H */
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 77257c92155..6d626ff0cfd 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_PIPE_FS_I_H 1#ifndef _LINUX_PIPE_FS_I_H
2#define _LINUX_PIPE_FS_I_H 2#define _LINUX_PIPE_FS_I_H
3 3
4#define PIPEFS_MAGIC 0x50495045
5
6#define PIPE_DEF_BUFFERS 16 4#define PIPE_DEF_BUFFERS 16
7 5
8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ 6#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
new file mode 100644
index 00000000000..d056263545b
--- /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_NAND_H__
8#define __ATMEL_NAND_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_NAND_H__ */
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h
new file mode 100644
index 00000000000..4eef5fb05a1
--- /dev/null
+++ b/include/linux/platform_data/omap4-keypad.h
@@ -0,0 +1,13 @@
1#ifndef __LINUX_INPUT_OMAP4_KEYPAD_H
2#define __LINUX_INPUT_OMAP4_KEYPAD_H
3
4#include <linux/input/matrix_keypad.h>
5
6struct omap4_keypad_platform_data {
7 const struct matrix_keymap_data *keymap_data;
8
9 u8 rows;
10 u8 cols;
11};
12
13#endif /* __LINUX_INPUT_OMAP4_KEYPAD_H */
diff --git a/include/linux/platform_data/spear_thermal.h b/include/linux/platform_data/spear_thermal.h
new file mode 100644
index 00000000000..724f2e1cbbc
--- /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/platform_data/tegra_emc.h b/include/linux/platform_data/tegra_emc.h
new file mode 100644
index 00000000000..df67505e98f
--- /dev/null
+++ b/include/linux/platform_data/tegra_emc.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 * Olof Johansson <olof@lixom.net>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
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 */
18
19#ifndef __TEGRA_EMC_H_
20#define __TEGRA_EMC_H_
21
22#define TEGRA_EMC_NUM_REGS 46
23
24struct tegra_emc_table {
25 unsigned long rate;
26 u32 regs[TEGRA_EMC_NUM_REGS];
27};
28
29struct tegra_emc_pdata {
30 int num_tables;
31 struct tegra_emc_table *tables;
32};
33
34#endif
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 1236d262b3e..91f8286106e 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -10,6 +10,8 @@
10#define _LINUX_PM_DOMAIN_H 10#define _LINUX_PM_DOMAIN_H
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/mutex.h>
14#include <linux/pm.h>
13#include <linux/err.h> 15#include <linux/err.h>
14#include <linux/of.h> 16#include <linux/of.h>
15 17
diff --git a/include/linux/poll.h b/include/linux/poll.h
index cf40010ce0c..48fe8bc398d 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -32,21 +32,46 @@ struct poll_table_struct;
32 */ 32 */
33typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); 33typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *);
34 34
35/*
36 * Do not touch the structure directly, use the access functions
37 * poll_does_not_wait() and poll_requested_events() instead.
38 */
35typedef struct poll_table_struct { 39typedef struct poll_table_struct {
36 poll_queue_proc qproc; 40 poll_queue_proc _qproc;
37 unsigned long key; 41 unsigned long _key;
38} poll_table; 42} poll_table;
39 43
40static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) 44static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
41{ 45{
42 if (p && wait_address) 46 if (p && p->_qproc && wait_address)
43 p->qproc(filp, wait_address, p); 47 p->_qproc(filp, wait_address, p);
48}
49
50/*
51 * Return true if it is guaranteed that poll will not wait. This is the case
52 * if the poll() of another file descriptor in the set got an event, so there
53 * is no need for waiting.
54 */
55static inline bool poll_does_not_wait(const poll_table *p)
56{
57 return p == NULL || p->_qproc == NULL;
58}
59
60/*
61 * Return the set of events that the application wants to poll for.
62 * This is useful for drivers that need to know whether a DMA transfer has
63 * to be started implicitly on poll(). You typically only want to do that
64 * if the application is actually polling for POLLIN and/or POLLOUT.
65 */
66static inline unsigned long poll_requested_events(const poll_table *p)
67{
68 return p ? p->_key : ~0UL;
44} 69}
45 70
46static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) 71static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
47{ 72{
48 pt->qproc = qproc; 73 pt->_qproc = qproc;
49 pt->key = ~0UL; /* all events enabled */ 74 pt->_key = ~0UL; /* all events enabled */
50} 75}
51 76
52struct poll_table_entry { 77struct poll_table_entry {
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index b7681102a4b..11bad91c443 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -8,6 +8,7 @@
8#ifndef __LINUX_POSIX_ACL_H 8#ifndef __LINUX_POSIX_ACL_H
9#define __LINUX_POSIX_ACL_H 9#define __LINUX_POSIX_ACL_H
10 10
11#include <linux/bug.h>
11#include <linux/slab.h> 12#include <linux/slab.h>
12#include <linux/rcupdate.h> 13#include <linux/rcupdate.h>
13 14
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index fe99211fb2b..e01b167e66f 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 00000000000..b3cb20dab55
--- /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/power_supply.h b/include/linux/power_supply.h
index fa9b962aec1..c38c13db883 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -13,10 +13,11 @@
13#ifndef __LINUX_POWER_SUPPLY_H__ 13#ifndef __LINUX_POWER_SUPPLY_H__
14#define __LINUX_POWER_SUPPLY_H__ 14#define __LINUX_POWER_SUPPLY_H__
15 15
16#include <linux/device.h>
17#include <linux/workqueue.h> 16#include <linux/workqueue.h>
18#include <linux/leds.h> 17#include <linux/leds.h>
19 18
19struct device;
20
20/* 21/*
21 * All voltages, currents, charges, energies, time and temperatures in uV, 22 * All voltages, currents, charges, energies, time and temperatures in uV,
22 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise 23 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index a0413ac3abe..e0cfec2490a 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -121,4 +121,7 @@
121#define PR_SET_PTRACER 0x59616d61 121#define PR_SET_PTRACER 0x59616d61
122# define PR_SET_PTRACER_ANY ((unsigned long)-1) 122# define PR_SET_PTRACER_ANY ((unsigned long)-1)
123 123
124#define PR_SET_CHILD_SUBREAPER 36
125#define PR_GET_CHILD_SUBREAPER 37
126
124#endif /* _LINUX_PRCTL_H */ 127#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index c2f1f6a5fcb..5c719627c2a 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -51,20 +51,6 @@
51#define PTRACE_INTERRUPT 0x4207 51#define PTRACE_INTERRUPT 0x4207
52#define PTRACE_LISTEN 0x4208 52#define PTRACE_LISTEN 0x4208
53 53
54/* flags in @data for PTRACE_SEIZE */
55#define PTRACE_SEIZE_DEVEL 0x80000000 /* temp flag for development */
56
57/* options set using PTRACE_SETOPTIONS */
58#define PTRACE_O_TRACESYSGOOD 0x00000001
59#define PTRACE_O_TRACEFORK 0x00000002
60#define PTRACE_O_TRACEVFORK 0x00000004
61#define PTRACE_O_TRACECLONE 0x00000008
62#define PTRACE_O_TRACEEXEC 0x00000010
63#define PTRACE_O_TRACEVFORKDONE 0x00000020
64#define PTRACE_O_TRACEEXIT 0x00000040
65
66#define PTRACE_O_MASK 0x0000007f
67
68/* Wait extended result codes for the above trace options. */ 54/* Wait extended result codes for the above trace options. */
69#define PTRACE_EVENT_FORK 1 55#define PTRACE_EVENT_FORK 1
70#define PTRACE_EVENT_VFORK 2 56#define PTRACE_EVENT_VFORK 2
@@ -72,7 +58,19 @@
72#define PTRACE_EVENT_EXEC 4 58#define PTRACE_EVENT_EXEC 4
73#define PTRACE_EVENT_VFORK_DONE 5 59#define PTRACE_EVENT_VFORK_DONE 5
74#define PTRACE_EVENT_EXIT 6 60#define PTRACE_EVENT_EXIT 6
75#define PTRACE_EVENT_STOP 7 61/* Extended result codes which enabled by means other than options. */
62#define PTRACE_EVENT_STOP 128
63
64/* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
65#define PTRACE_O_TRACESYSGOOD 1
66#define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
67#define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
68#define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
69#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
70#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
71#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
72
73#define PTRACE_O_MASK 0x0000007f
76 74
77#include <asm/ptrace.h> 75#include <asm/ptrace.h>
78 76
@@ -88,13 +86,12 @@
88#define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ 86#define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */
89#define PT_PTRACED 0x00000001 87#define PT_PTRACED 0x00000001
90#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ 88#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */
91#define PT_TRACESYSGOOD 0x00000004 89#define PT_PTRACE_CAP 0x00000004 /* ptracer can follow suid-exec */
92#define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */
93 90
91#define PT_OPT_FLAG_SHIFT 3
94/* PT_TRACE_* event enable flags */ 92/* PT_TRACE_* event enable flags */
95#define PT_EVENT_FLAG_SHIFT 4 93#define PT_EVENT_FLAG(event) (1 << (PT_OPT_FLAG_SHIFT + (event)))
96#define PT_EVENT_FLAG(event) (1 << (PT_EVENT_FLAG_SHIFT + (event) - 1)) 94#define PT_TRACESYSGOOD PT_EVENT_FLAG(0)
97
98#define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) 95#define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK)
99#define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) 96#define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK)
100#define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) 97#define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE)
@@ -102,8 +99,6 @@
102#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) 99#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE)
103#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) 100#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
104 101
105#define PT_TRACE_MASK 0x000003f4
106
107/* single stepping state bits (used on ARM and PA-RISC) */ 102/* single stepping state bits (used on ARM and PA-RISC) */
108#define PT_SINGLESTEP_BIT 31 103#define PT_SINGLESTEP_BIT 31
109#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) 104#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT)
@@ -113,6 +108,7 @@
113#include <linux/compiler.h> /* For unlikely. */ 108#include <linux/compiler.h> /* For unlikely. */
114#include <linux/sched.h> /* For struct task_struct. */ 109#include <linux/sched.h> /* For struct task_struct. */
115#include <linux/err.h> /* for IS_ERR_VALUE */ 110#include <linux/err.h> /* for IS_ERR_VALUE */
111#include <linux/bug.h> /* For BUG_ON. */
116 112
117 113
118extern long arch_ptrace(struct task_struct *child, long request, 114extern long arch_ptrace(struct task_struct *child, long request,
@@ -199,9 +195,10 @@ static inline void ptrace_event(int event, unsigned long message)
199 if (unlikely(ptrace_event_enabled(current, event))) { 195 if (unlikely(ptrace_event_enabled(current, event))) {
200 current->ptrace_message = message; 196 current->ptrace_message = message;
201 ptrace_notify((event << 8) | SIGTRAP); 197 ptrace_notify((event << 8) | SIGTRAP);
202 } else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) { 198 } else if (event == PTRACE_EVENT_EXEC) {
203 /* legacy EXEC report via SIGTRAP */ 199 /* legacy EXEC report via SIGTRAP */
204 send_sig(SIGTRAP, current, 0); 200 if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED)
201 send_sig(SIGTRAP, current, 0);
205 } 202 }
206} 203}
207 204
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 07e360b1b28..0d04cd69ab9 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
@@ -22,6 +23,7 @@
22 23
23#include <linux/preempt.h> 24#include <linux/preempt.h>
24#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/bug.h>
25#include <linux/kernel.h> 27#include <linux/kernel.h>
26#include <linux/rcupdate.h> 28#include <linux/rcupdate.h>
27 29
@@ -256,4 +258,199 @@ static inline void radix_tree_preload_end(void)
256 preempt_enable(); 258 preempt_enable();
257} 259}
258 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
259#endif /* _LINUX_RADIX_TREE_H */ 456#endif /* _LINUX_RADIX_TREE_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 937217425c4..20fb776a1d4 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -42,6 +42,7 @@
42#include <linux/lockdep.h> 42#include <linux/lockdep.h>
43#include <linux/completion.h> 43#include <linux/completion.h>
44#include <linux/debugobjects.h> 44#include <linux/debugobjects.h>
45#include <linux/bug.h>
45#include <linux/compiler.h> 46#include <linux/compiler.h>
46 47
47#ifdef CONFIG_RCU_TORTURE_TEST 48#ifdef CONFIG_RCU_TORTURE_TEST
@@ -418,7 +419,7 @@ extern int rcu_my_thread_group_empty(void);
418 */ 419 */
419#define rcu_lockdep_assert(c, s) \ 420#define rcu_lockdep_assert(c, s) \
420 do { \ 421 do { \
421 static bool __warned; \ 422 static bool __section(.data.unlikely) __warned; \
422 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ 423 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \
423 __warned = true; \ 424 __warned = true; \
424 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ 425 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index c47898d47c8..a90abb6bfa6 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -13,12 +13,13 @@
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15
16#include <linux/device.h>
17#include <linux/list.h> 16#include <linux/list.h>
18 17
19struct module; 18struct module;
19struct device;
20struct i2c_client; 20struct i2c_client;
21struct spi_device; 21struct spi_device;
22struct regmap;
22 23
23/* An enum of all the supported cache types */ 24/* An enum of all the supported cache types */
24enum regcache_type { 25enum regcache_type {
@@ -40,10 +41,13 @@ struct reg_default {
40 unsigned int def; 41 unsigned int def;
41}; 42};
42 43
44#ifdef CONFIG_REGMAP
45
43/** 46/**
44 * Configuration for the register map of a device. 47 * Configuration for the register map of a device.
45 * 48 *
46 * @reg_bits: Number of bits in a register address, mandatory. 49 * @reg_bits: Number of bits in a register address, mandatory.
50 * @pad_bits: Number of bits of padding between register and value.
47 * @val_bits: Number of bits in a register value, mandatory. 51 * @val_bits: Number of bits in a register value, mandatory.
48 * 52 *
49 * @writeable_reg: Optional callback returning true if the register 53 * @writeable_reg: Optional callback returning true if the register
@@ -74,6 +78,7 @@ struct reg_default {
74 */ 78 */
75struct regmap_config { 79struct regmap_config {
76 int reg_bits; 80 int reg_bits;
81 int pad_bits;
77 int val_bits; 82 int val_bits;
78 83
79 bool (*writeable_reg)(struct device *dev, unsigned int reg); 84 bool (*writeable_reg)(struct device *dev, unsigned int reg);
@@ -127,12 +132,22 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c,
127struct regmap *regmap_init_spi(struct spi_device *dev, 132struct regmap *regmap_init_spi(struct spi_device *dev,
128 const struct regmap_config *config); 133 const struct regmap_config *config);
129 134
135struct regmap *devm_regmap_init(struct device *dev,
136 const struct regmap_bus *bus,
137 const struct regmap_config *config);
138struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
139 const struct regmap_config *config);
140struct regmap *devm_regmap_init_spi(struct spi_device *dev,
141 const struct regmap_config *config);
142
130void regmap_exit(struct regmap *map); 143void regmap_exit(struct regmap *map);
131int regmap_reinit_cache(struct regmap *map, 144int regmap_reinit_cache(struct regmap *map,
132 const struct regmap_config *config); 145 const struct regmap_config *config);
133int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 146int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
134int regmap_raw_write(struct regmap *map, unsigned int reg, 147int regmap_raw_write(struct regmap *map, unsigned int reg,
135 const void *val, size_t val_len); 148 const void *val, size_t val_len);
149int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
150 size_t val_count);
136int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 151int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
137int regmap_raw_read(struct regmap *map, unsigned int reg, 152int regmap_raw_read(struct regmap *map, unsigned int reg,
138 void *val, size_t val_len); 153 void *val, size_t val_len);
@@ -146,6 +161,8 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
146int regmap_get_val_bytes(struct regmap *map); 161int regmap_get_val_bytes(struct regmap *map);
147 162
148int regcache_sync(struct regmap *map); 163int regcache_sync(struct regmap *map);
164int regcache_sync_region(struct regmap *map, unsigned int min,
165 unsigned int max);
149void regcache_cache_only(struct regmap *map, bool enable); 166void regcache_cache_only(struct regmap *map, bool enable);
150void regcache_cache_bypass(struct regmap *map, bool enable); 167void regcache_cache_bypass(struct regmap *map, bool enable);
151void regcache_mark_dirty(struct regmap *map); 168void regcache_mark_dirty(struct regmap *map);
@@ -201,4 +218,115 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
201void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); 218void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
202int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 219int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
203 220
221#else
222
223/*
224 * These stubs should only ever be called by generic code which has
225 * regmap based facilities, if they ever get called at runtime
226 * something is going wrong and something probably needs to select
227 * REGMAP.
228 */
229
230static inline int regmap_write(struct regmap *map, unsigned int reg,
231 unsigned int val)
232{
233 WARN_ONCE(1, "regmap API is disabled");
234 return -EINVAL;
235}
236
237static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
238 const void *val, size_t val_len)
239{
240 WARN_ONCE(1, "regmap API is disabled");
241 return -EINVAL;
242}
243
244static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
245 const void *val, size_t val_count)
246{
247 WARN_ONCE(1, "regmap API is disabled");
248 return -EINVAL;
249}
250
251static inline int regmap_read(struct regmap *map, unsigned int reg,
252 unsigned int *val)
253{
254 WARN_ONCE(1, "regmap API is disabled");
255 return -EINVAL;
256}
257
258static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
259 void *val, size_t val_len)
260{
261 WARN_ONCE(1, "regmap API is disabled");
262 return -EINVAL;
263}
264
265static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
266 void *val, size_t val_count)
267{
268 WARN_ONCE(1, "regmap API is disabled");
269 return -EINVAL;
270}
271
272static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
273 unsigned int mask, unsigned int val)
274{
275 WARN_ONCE(1, "regmap API is disabled");
276 return -EINVAL;
277}
278
279static inline int regmap_update_bits_check(struct regmap *map,
280 unsigned int reg,
281 unsigned int mask, unsigned int val,
282 bool *change)
283{
284 WARN_ONCE(1, "regmap API is disabled");
285 return -EINVAL;
286}
287
288static inline int regmap_get_val_bytes(struct regmap *map)
289{
290 WARN_ONCE(1, "regmap API is disabled");
291 return -EINVAL;
292}
293
294static inline int regcache_sync(struct regmap *map)
295{
296 WARN_ONCE(1, "regmap API is disabled");
297 return -EINVAL;
298}
299
300static inline int regcache_sync_region(struct regmap *map, unsigned int min,
301 unsigned int max)
302{
303 WARN_ONCE(1, "regmap API is disabled");
304 return -EINVAL;
305}
306
307static inline void regcache_cache_only(struct regmap *map, bool enable)
308{
309 WARN_ONCE(1, "regmap API is disabled");
310}
311
312static inline void regcache_cache_bypass(struct regmap *map, bool enable)
313{
314 WARN_ONCE(1, "regmap API is disabled");
315}
316
317static inline void regcache_mark_dirty(struct regmap *map)
318{
319 WARN_ONCE(1, "regmap API is disabled");
320}
321
322static inline int regmap_register_patch(struct regmap *map,
323 const struct reg_default *regs,
324 int num_regs)
325{
326 WARN_ONCE(1, "regmap API is disabled");
327 return -EINVAL;
328}
329
330#endif
331
204#endif 332#endif
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 686f37327a4..8e0c9febf49 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/bug.h>
18#include <linux/uaccess.h> 19#include <linux/uaccess.h>
19struct task_struct; 20struct task_struct;
20struct user_regset; 21struct user_regset;
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 76579f964a2..7bd73bbdfd1 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/bq24022.h b/include/linux/regulator/bq24022.h
deleted file mode 100644
index a6d014005d4..00000000000
--- a/include/linux/regulator/bq24022.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
3 * 1-Cell Li-Ion Charger connected via GPIOs.
4 *
5 * Copyright (c) 2008 Philipp Zabel
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13struct regulator_init_data;
14
15/**
16 * bq24022_mach_info - platform data for bq24022
17 * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
18 * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA
19 */
20struct bq24022_mach_info {
21 int gpio_nce;
22 int gpio_iset2;
23 struct regulator_init_data *init_data;
24};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index b6c8d717c7e..4ed1b30ac5f 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -35,7 +35,8 @@
35#ifndef __LINUX_REGULATOR_CONSUMER_H_ 35#ifndef __LINUX_REGULATOR_CONSUMER_H_
36#define __LINUX_REGULATOR_CONSUMER_H_ 36#define __LINUX_REGULATOR_CONSUMER_H_
37 37
38#include <linux/device.h> 38struct device;
39struct notifier_block;
39 40
40/* 41/*
41 * Regulator operating modes. 42 * Regulator operating modes.
diff --git a/include/linux/relay.h b/include/linux/relay.h
index a822fd71fd6..91cacc34c15 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -15,6 +15,7 @@
15#include <linux/timer.h> 15#include <linux/timer.h>
16#include <linux/wait.h> 16#include <linux/wait.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/bug.h>
18#include <linux/fs.h> 19#include <linux/fs.h>
19#include <linux/poll.h> 20#include <linux/poll.h>
20#include <linux/kref.h> 21#include <linux/kref.h>
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
new file mode 100644
index 00000000000..f1ffabb978d
--- /dev/null
+++ b/include/linux/remoteproc.h
@@ -0,0 +1,478 @@
1/*
2 * Remote Processor Framework
3 *
4 * Copyright(c) 2011 Texas Instruments, Inc.
5 * Copyright(c) 2011 Google, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name Texas Instruments nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef REMOTEPROC_H
36#define REMOTEPROC_H
37
38#include <linux/types.h>
39#include <linux/kref.h>
40#include <linux/klist.h>
41#include <linux/mutex.h>
42#include <linux/virtio.h>
43#include <linux/completion.h>
44#include <linux/idr.h>
45
46/**
47 * struct resource_table - firmware resource table header
48 * @ver: version number
49 * @num: number of resource entries
50 * @reserved: reserved (must be zero)
51 * @offset: array of offsets pointing at the various resource entries
52 *
53 * A resource table is essentially a list of system resources required
54 * by the remote processor. It may also include configuration entries.
55 * If needed, the remote processor firmware should contain this table
56 * as a dedicated ".resource_table" ELF section.
57 *
58 * Some resources entries are mere announcements, where the host is informed
59 * of specific remoteproc configuration. Other entries require the host to
60 * do something (e.g. allocate a system resource). Sometimes a negotiation
61 * is expected, where the firmware requests a resource, and once allocated,
62 * the host should provide back its details (e.g. address of an allocated
63 * memory region).
64 *
65 * The header of the resource table, as expressed by this structure,
66 * contains a version number (should we need to change this format in the
67 * future), the number of available resource entries, and their offsets
68 * in the table.
69 *
70 * Immediately following this header are the resource entries themselves,
71 * each of which begins with a resource entry header (as described below).
72 */
73struct resource_table {
74 u32 ver;
75 u32 num;
76 u32 reserved[2];
77 u32 offset[0];
78} __packed;
79
80/**
81 * struct fw_rsc_hdr - firmware resource entry header
82 * @type: resource type
83 * @data: resource data
84 *
85 * Every resource entry begins with a 'struct fw_rsc_hdr' header providing
86 * its @type. The content of the entry itself will immediately follow
87 * this header, and it should be parsed according to the resource type.
88 */
89struct fw_rsc_hdr {
90 u32 type;
91 u8 data[0];
92} __packed;
93
94/**
95 * enum fw_resource_type - types of resource entries
96 *
97 * @RSC_CARVEOUT: request for allocation of a physically contiguous
98 * memory region.
99 * @RSC_DEVMEM: request to iommu_map a memory-based peripheral.
100 * @RSC_TRACE: announces the availability of a trace buffer into which
101 * the remote processor will be writing logs.
102 * @RSC_VDEV: declare support for a virtio device, and serve as its
103 * virtio header.
104 * @RSC_LAST: just keep this one at the end
105 *
106 * For more details regarding a specific resource type, please see its
107 * dedicated structure below.
108 *
109 * Please note that these values are used as indices to the rproc_handle_rsc
110 * lookup table, so please keep them sane. Moreover, @RSC_LAST is used to
111 * check the validity of an index before the lookup table is accessed, so
112 * please update it as needed.
113 */
114enum fw_resource_type {
115 RSC_CARVEOUT = 0,
116 RSC_DEVMEM = 1,
117 RSC_TRACE = 2,
118 RSC_VDEV = 3,
119 RSC_LAST = 4,
120};
121
122#define FW_RSC_ADDR_ANY (0xFFFFFFFFFFFFFFFF)
123
124/**
125 * struct fw_rsc_carveout - physically contiguous memory request
126 * @da: device address
127 * @pa: physical address
128 * @len: length (in bytes)
129 * @flags: iommu protection flags
130 * @reserved: reserved (must be zero)
131 * @name: human-readable name of the requested memory region
132 *
133 * This resource entry requests the host to allocate a physically contiguous
134 * memory region.
135 *
136 * These request entries should precede other firmware resource entries,
137 * as other entries might request placing other data objects inside
138 * these memory regions (e.g. data/code segments, trace resource entries, ...).
139 *
140 * Allocating memory this way helps utilizing the reserved physical memory
141 * (e.g. CMA) more efficiently, and also minimizes the number of TLB entries
142 * needed to map it (in case @rproc is using an IOMMU). Reducing the TLB
143 * pressure is important; it may have a substantial impact on performance.
144 *
145 * If the firmware is compiled with static addresses, then @da should specify
146 * the expected device address of this memory region. If @da is set to
147 * FW_RSC_ADDR_ANY, then the host will dynamically allocate it, and then
148 * overwrite @da with the dynamically allocated address.
149 *
150 * We will always use @da to negotiate the device addresses, even if it
151 * isn't using an iommu. In that case, though, it will obviously contain
152 * physical addresses.
153 *
154 * Some remote processors needs to know the allocated physical address
155 * even if they do use an iommu. This is needed, e.g., if they control
156 * hardware accelerators which access the physical memory directly (this
157 * is the case with OMAP4 for instance). In that case, the host will
158 * overwrite @pa with the dynamically allocated physical address.
159 * Generally we don't want to expose physical addresses if we don't have to
160 * (remote processors are generally _not_ trusted), so we might want to
161 * change this to happen _only_ when explicitly required by the hardware.
162 *
163 * @flags is used to provide IOMMU protection flags, and @name should
164 * (optionally) contain a human readable name of this carveout region
165 * (mainly for debugging purposes).
166 */
167struct fw_rsc_carveout {
168 u32 da;
169 u32 pa;
170 u32 len;
171 u32 flags;
172 u32 reserved;
173 u8 name[32];
174} __packed;
175
176/**
177 * struct fw_rsc_devmem - iommu mapping request
178 * @da: device address
179 * @pa: physical address
180 * @len: length (in bytes)
181 * @flags: iommu protection flags
182 * @reserved: reserved (must be zero)
183 * @name: human-readable name of the requested region to be mapped
184 *
185 * This resource entry requests the host to iommu map a physically contiguous
186 * memory region. This is needed in case the remote processor requires
187 * access to certain memory-based peripherals; _never_ use it to access
188 * regular memory.
189 *
190 * This is obviously only needed if the remote processor is accessing memory
191 * via an iommu.
192 *
193 * @da should specify the required device address, @pa should specify
194 * the physical address we want to map, @len should specify the size of
195 * the mapping and @flags is the IOMMU protection flags. As always, @name may
196 * (optionally) contain a human readable name of this mapping (mainly for
197 * debugging purposes).
198 *
199 * Note: at this point we just "trust" those devmem entries to contain valid
200 * physical addresses, but this isn't safe and will be changed: eventually we
201 * want remoteproc implementations to provide us ranges of physical addresses
202 * the firmware is allowed to request, and not allow firmwares to request
203 * access to physical addresses that are outside those ranges.
204 */
205struct fw_rsc_devmem {
206 u32 da;
207 u32 pa;
208 u32 len;
209 u32 flags;
210 u32 reserved;
211 u8 name[32];
212} __packed;
213
214/**
215 * struct fw_rsc_trace - trace buffer declaration
216 * @da: device address
217 * @len: length (in bytes)
218 * @reserved: reserved (must be zero)
219 * @name: human-readable name of the trace buffer
220 *
221 * This resource entry provides the host information about a trace buffer
222 * into which the remote processor will write log messages.
223 *
224 * @da specifies the device address of the buffer, @len specifies
225 * its size, and @name may contain a human readable name of the trace buffer.
226 *
227 * After booting the remote processor, the trace buffers are exposed to the
228 * user via debugfs entries (called trace0, trace1, etc..).
229 */
230struct fw_rsc_trace {
231 u32 da;
232 u32 len;
233 u32 reserved;
234 u8 name[32];
235} __packed;
236
237/**
238 * struct fw_rsc_vdev_vring - vring descriptor entry
239 * @da: device address
240 * @align: the alignment between the consumer and producer parts of the vring
241 * @num: num of buffers supported by this vring (must be power of two)
242 * @notifyid is a unique rproc-wide notify index for this vring. This notify
243 * index is used when kicking a remote processor, to let it know that this
244 * vring is triggered.
245 * @reserved: reserved (must be zero)
246 *
247 * This descriptor is not a resource entry by itself; it is part of the
248 * vdev resource type (see below).
249 *
250 * Note that @da should either contain the device address where
251 * the remote processor is expecting the vring, or indicate that
252 * dynamically allocation of the vring's device address is supported.
253 */
254struct fw_rsc_vdev_vring {
255 u32 da;
256 u32 align;
257 u32 num;
258 u32 notifyid;
259 u32 reserved;
260} __packed;
261
262/**
263 * struct fw_rsc_vdev - virtio device header
264 * @id: virtio device id (as in virtio_ids.h)
265 * @notifyid is a unique rproc-wide notify index for this vdev. This notify
266 * index is used when kicking a remote processor, to let it know that the
267 * status/features of this vdev have changes.
268 * @dfeatures specifies the virtio device features supported by the firmware
269 * @gfeatures is a place holder used by the host to write back the
270 * negotiated features that are supported by both sides.
271 * @config_len is the size of the virtio config space of this vdev. The config
272 * space lies in the resource table immediate after this vdev header.
273 * @status is a place holder where the host will indicate its virtio progress.
274 * @num_of_vrings indicates how many vrings are described in this vdev header
275 * @reserved: reserved (must be zero)
276 * @vring is an array of @num_of_vrings entries of 'struct fw_rsc_vdev_vring'.
277 *
278 * This resource is a virtio device header: it provides information about
279 * the vdev, and is then used by the host and its peer remote processors
280 * to negotiate and share certain virtio properties.
281 *
282 * By providing this resource entry, the firmware essentially asks remoteproc
283 * to statically allocate a vdev upon registration of the rproc (dynamic vdev
284 * allocation is not yet supported).
285 *
286 * Note: unlike virtualization systems, the term 'host' here means
287 * the Linux side which is running remoteproc to control the remote
288 * processors. We use the name 'gfeatures' to comply with virtio's terms,
289 * though there isn't really any virtualized guest OS here: it's the host
290 * which is responsible for negotiating the final features.
291 * Yeah, it's a bit confusing.
292 *
293 * Note: immediately following this structure is the virtio config space for
294 * this vdev (which is specific to the vdev; for more info, read the virtio
295 * spec). the size of the config space is specified by @config_len.
296 */
297struct fw_rsc_vdev {
298 u32 id;
299 u32 notifyid;
300 u32 dfeatures;
301 u32 gfeatures;
302 u32 config_len;
303 u8 status;
304 u8 num_of_vrings;
305 u8 reserved[2];
306 struct fw_rsc_vdev_vring vring[0];
307} __packed;
308
309/**
310 * struct rproc_mem_entry - memory entry descriptor
311 * @va: virtual address
312 * @dma: dma address
313 * @len: length, in bytes
314 * @da: device address
315 * @priv: associated data
316 * @node: list node
317 */
318struct rproc_mem_entry {
319 void *va;
320 dma_addr_t dma;
321 int len;
322 u32 da;
323 void *priv;
324 struct list_head node;
325};
326
327struct rproc;
328
329/**
330 * struct rproc_ops - platform-specific device handlers
331 * @start: power on the device and boot it
332 * @stop: power off the device
333 * @kick: kick a virtqueue (virtqueue id given as a parameter)
334 */
335struct rproc_ops {
336 int (*start)(struct rproc *rproc);
337 int (*stop)(struct rproc *rproc);
338 void (*kick)(struct rproc *rproc, int vqid);
339};
340
341/**
342 * enum rproc_state - remote processor states
343 * @RPROC_OFFLINE: device is powered off
344 * @RPROC_SUSPENDED: device is suspended; needs to be woken up to receive
345 * a message.
346 * @RPROC_RUNNING: device is up and running
347 * @RPROC_CRASHED: device has crashed; need to start recovery
348 * @RPROC_LAST: just keep this one at the end
349 *
350 * Please note that the values of these states are used as indices
351 * to rproc_state_string, a state-to-name lookup table,
352 * so please keep the two synchronized. @RPROC_LAST is used to check
353 * the validity of an index before the lookup table is accessed, so
354 * please update it as needed too.
355 */
356enum rproc_state {
357 RPROC_OFFLINE = 0,
358 RPROC_SUSPENDED = 1,
359 RPROC_RUNNING = 2,
360 RPROC_CRASHED = 3,
361 RPROC_LAST = 4,
362};
363
364/**
365 * struct rproc - represents a physical remote processor device
366 * @node: klist node of this rproc object
367 * @domain: iommu domain
368 * @name: human readable name of the rproc
369 * @firmware: name of firmware file to be loaded
370 * @priv: private data which belongs to the platform-specific rproc module
371 * @ops: platform-specific start/stop rproc handlers
372 * @dev: underlying device
373 * @refcount: refcount of users that have a valid pointer to this rproc
374 * @power: refcount of users who need this rproc powered up
375 * @state: state of the device
376 * @lock: lock which protects concurrent manipulations of the rproc
377 * @dbg_dir: debugfs directory of this rproc device
378 * @traces: list of trace buffers
379 * @num_traces: number of trace buffers
380 * @carveouts: list of physically contiguous memory allocations
381 * @mappings: list of iommu mappings we initiated, needed on shutdown
382 * @firmware_loading_complete: marks e/o asynchronous firmware loading
383 * @bootaddr: address of first instruction to boot rproc with (optional)
384 * @rvdevs: list of remote virtio devices
385 * @notifyids: idr for dynamically assigning rproc-wide unique notify ids
386 */
387struct rproc {
388 struct klist_node node;
389 struct iommu_domain *domain;
390 const char *name;
391 const char *firmware;
392 void *priv;
393 const struct rproc_ops *ops;
394 struct device *dev;
395 struct kref refcount;
396 atomic_t power;
397 unsigned int state;
398 struct mutex lock;
399 struct dentry *dbg_dir;
400 struct list_head traces;
401 int num_traces;
402 struct list_head carveouts;
403 struct list_head mappings;
404 struct completion firmware_loading_complete;
405 u32 bootaddr;
406 struct list_head rvdevs;
407 struct idr notifyids;
408};
409
410/* we currently support only two vrings per rvdev */
411#define RVDEV_NUM_VRINGS 2
412
413/**
414 * struct rproc_vring - remoteproc vring state
415 * @va: virtual address
416 * @dma: dma address
417 * @len: length, in bytes
418 * @da: device address
419 * @align: vring alignment
420 * @notifyid: rproc-specific unique vring index
421 * @rvdev: remote vdev
422 * @vq: the virtqueue of this vring
423 */
424struct rproc_vring {
425 void *va;
426 dma_addr_t dma;
427 int len;
428 u32 da;
429 u32 align;
430 int notifyid;
431 struct rproc_vdev *rvdev;
432 struct virtqueue *vq;
433};
434
435/**
436 * struct rproc_vdev - remoteproc state for a supported virtio device
437 * @node: list node
438 * @rproc: the rproc handle
439 * @vdev: the virio device
440 * @vring: the vrings for this vdev
441 * @dfeatures: virtio device features
442 * @gfeatures: virtio guest features
443 */
444struct rproc_vdev {
445 struct list_head node;
446 struct rproc *rproc;
447 struct virtio_device vdev;
448 struct rproc_vring vring[RVDEV_NUM_VRINGS];
449 unsigned long dfeatures;
450 unsigned long gfeatures;
451};
452
453struct rproc *rproc_get_by_name(const char *name);
454void rproc_put(struct rproc *rproc);
455
456struct rproc *rproc_alloc(struct device *dev, const char *name,
457 const struct rproc_ops *ops,
458 const char *firmware, int len);
459void rproc_free(struct rproc *rproc);
460int rproc_register(struct rproc *rproc);
461int rproc_unregister(struct rproc *rproc);
462
463int rproc_boot(struct rproc *rproc);
464void rproc_shutdown(struct rproc *rproc);
465
466static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev)
467{
468 return container_of(vdev, struct rproc_vdev, vdev);
469}
470
471static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev)
472{
473 struct rproc_vdev *rvdev = vdev_to_rvdev(vdev);
474
475 return rvdev->rproc;
476}
477
478#endif /* REMOTEPROC_H */
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index c6c608482cb..6fdf02737e9 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -117,10 +117,10 @@ enum rfkill_user_states {
117#include <linux/kernel.h> 117#include <linux/kernel.h>
118#include <linux/list.h> 118#include <linux/list.h>
119#include <linux/mutex.h> 119#include <linux/mutex.h>
120#include <linux/device.h>
121#include <linux/leds.h> 120#include <linux/leds.h>
122#include <linux/err.h> 121#include <linux/err.h>
123 122
123struct device;
124/* this is opaque */ 124/* this is opaque */
125struct rfkill; 125struct rfkill;
126 126
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 67be0376d8e..7be2e88f23f 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/rio_drv.h b/include/linux/rio_drv.h
index 229b3ca2313..7f07470e1ed 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -17,7 +17,6 @@
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/device.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/rio.h> 21#include <linux/rio.h>
23 22
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
new file mode 100644
index 00000000000..a8e50e44203
--- /dev/null
+++ b/include/linux/rpmsg.h
@@ -0,0 +1,326 @@
1/*
2 * Remote processor messaging
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Copyright (C) 2011 Google, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name Texas Instruments nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _LINUX_RPMSG_H
36#define _LINUX_RPMSG_H
37
38#include <linux/types.h>
39#include <linux/device.h>
40#include <linux/mod_devicetable.h>
41
42/* The feature bitmap for virtio rpmsg */
43#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */
44
45/**
46 * struct rpmsg_hdr - common header for all rpmsg messages
47 * @src: source address
48 * @dst: destination address
49 * @reserved: reserved for future use
50 * @len: length of payload (in bytes)
51 * @flags: message flags
52 * @data: @len bytes of message payload data
53 *
54 * Every message sent(/received) on the rpmsg bus begins with this header.
55 */
56struct rpmsg_hdr {
57 u32 src;
58 u32 dst;
59 u32 reserved;
60 u16 len;
61 u16 flags;
62 u8 data[0];
63} __packed;
64
65/**
66 * struct rpmsg_ns_msg - dynamic name service announcement message
67 * @name: name of remote service that is published
68 * @addr: address of remote service that is published
69 * @flags: indicates whether service is created or destroyed
70 *
71 * This message is sent across to publish a new service, or announce
72 * about its removal. When we receive these messages, an appropriate
73 * rpmsg channel (i.e device) is created/destroyed. In turn, the ->probe()
74 * or ->remove() handler of the appropriate rpmsg driver will be invoked
75 * (if/as-soon-as one is registered).
76 */
77struct rpmsg_ns_msg {
78 char name[RPMSG_NAME_SIZE];
79 u32 addr;
80 u32 flags;
81} __packed;
82
83/**
84 * enum rpmsg_ns_flags - dynamic name service announcement flags
85 *
86 * @RPMSG_NS_CREATE: a new remote service was just created
87 * @RPMSG_NS_DESTROY: a known remote service was just destroyed
88 */
89enum rpmsg_ns_flags {
90 RPMSG_NS_CREATE = 0,
91 RPMSG_NS_DESTROY = 1,
92};
93
94#define RPMSG_ADDR_ANY 0xFFFFFFFF
95
96struct virtproc_info;
97
98/**
99 * rpmsg_channel - devices that belong to the rpmsg bus are called channels
100 * @vrp: the remote processor this channel belongs to
101 * @dev: the device struct
102 * @id: device id (used to match between rpmsg drivers and devices)
103 * @src: local address
104 * @dst: destination address
105 * @ept: the rpmsg endpoint of this channel
106 * @announce: if set, rpmsg will announce the creation/removal of this channel
107 */
108struct rpmsg_channel {
109 struct virtproc_info *vrp;
110 struct device dev;
111 struct rpmsg_device_id id;
112 u32 src;
113 u32 dst;
114 struct rpmsg_endpoint *ept;
115 bool announce;
116};
117
118typedef void (*rpmsg_rx_cb_t)(struct rpmsg_channel *, void *, int, void *, u32);
119
120/**
121 * struct rpmsg_endpoint - binds a local rpmsg address to its user
122 * @rpdev: rpmsg channel device
123 * @cb: rx callback handler
124 * @addr: local rpmsg address
125 * @priv: private data for the driver's use
126 *
127 * In essence, an rpmsg endpoint represents a listener on the rpmsg bus, as
128 * it binds an rpmsg address with an rx callback handler.
129 *
130 * Simple rpmsg drivers shouldn't use this struct directly, because
131 * things just work: every rpmsg driver provides an rx callback upon
132 * registering to the bus, and that callback is then bound to its rpmsg
133 * address when the driver is probed. When relevant inbound messages arrive
134 * (i.e. messages which their dst address equals to the src address of
135 * the rpmsg channel), the driver's handler is invoked to process it.
136 *
137 * More complicated drivers though, that do need to allocate additional rpmsg
138 * addresses, and bind them to different rx callbacks, must explicitly
139 * create additional endpoints by themselves (see rpmsg_create_ept()).
140 */
141struct rpmsg_endpoint {
142 struct rpmsg_channel *rpdev;
143 rpmsg_rx_cb_t cb;
144 u32 addr;
145 void *priv;
146};
147
148/**
149 * struct rpmsg_driver - rpmsg driver struct
150 * @drv: underlying device driver
151 * @id_table: rpmsg ids serviced by this driver
152 * @probe: invoked when a matching rpmsg channel (i.e. device) is found
153 * @remove: invoked when the rpmsg channel is removed
154 * @callback: invoked when an inbound message is received on the channel
155 */
156struct rpmsg_driver {
157 struct device_driver drv;
158 const struct rpmsg_device_id *id_table;
159 int (*probe)(struct rpmsg_channel *dev);
160 void (*remove)(struct rpmsg_channel *dev);
161 void (*callback)(struct rpmsg_channel *, void *, int, void *, u32);
162};
163
164int register_rpmsg_device(struct rpmsg_channel *dev);
165void unregister_rpmsg_device(struct rpmsg_channel *dev);
166int register_rpmsg_driver(struct rpmsg_driver *drv);
167void unregister_rpmsg_driver(struct rpmsg_driver *drv);
168void rpmsg_destroy_ept(struct rpmsg_endpoint *);
169struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *,
170 rpmsg_rx_cb_t cb, void *priv, u32 addr);
171int
172rpmsg_send_offchannel_raw(struct rpmsg_channel *, u32, u32, void *, int, bool);
173
174/**
175 * rpmsg_send() - send a message across to the remote processor
176 * @rpdev: the rpmsg channel
177 * @data: payload of message
178 * @len: length of payload
179 *
180 * This function sends @data of length @len on the @rpdev channel.
181 * The message will be sent to the remote processor which the @rpdev
182 * channel belongs to, using @rpdev's source and destination addresses.
183 * In case there are no TX buffers available, the function will block until
184 * one becomes available, or a timeout of 15 seconds elapses. When the latter
185 * happens, -ERESTARTSYS is returned.
186 *
187 * Can only be called from process context (for now).
188 *
189 * Returns 0 on success and an appropriate error value on failure.
190 */
191static inline int rpmsg_send(struct rpmsg_channel *rpdev, void *data, int len)
192{
193 u32 src = rpdev->src, dst = rpdev->dst;
194
195 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
196}
197
198/**
199 * rpmsg_sendto() - send a message across to the remote processor, specify dst
200 * @rpdev: the rpmsg channel
201 * @data: payload of message
202 * @len: length of payload
203 * @dst: destination address
204 *
205 * This function sends @data of length @len to the remote @dst address.
206 * The message will be sent to the remote processor which the @rpdev
207 * channel belongs to, using @rpdev's source address.
208 * In case there are no TX buffers available, the function will block until
209 * one becomes available, or a timeout of 15 seconds elapses. When the latter
210 * happens, -ERESTARTSYS is returned.
211 *
212 * Can only be called from process context (for now).
213 *
214 * Returns 0 on success and an appropriate error value on failure.
215 */
216static inline
217int rpmsg_sendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst)
218{
219 u32 src = rpdev->src;
220
221 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
222}
223
224/**
225 * rpmsg_send_offchannel() - send a message using explicit src/dst addresses
226 * @rpdev: the rpmsg channel
227 * @src: source address
228 * @dst: destination address
229 * @data: payload of message
230 * @len: length of payload
231 *
232 * This function sends @data of length @len to the remote @dst address,
233 * and uses @src as the source address.
234 * The message will be sent to the remote processor which the @rpdev
235 * channel belongs to.
236 * In case there are no TX buffers available, the function will block until
237 * one becomes available, or a timeout of 15 seconds elapses. When the latter
238 * happens, -ERESTARTSYS is returned.
239 *
240 * Can only be called from process context (for now).
241 *
242 * Returns 0 on success and an appropriate error value on failure.
243 */
244static inline
245int rpmsg_send_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst,
246 void *data, int len)
247{
248 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
249}
250
251/**
252 * rpmsg_send() - send a message across to the remote processor
253 * @rpdev: the rpmsg channel
254 * @data: payload of message
255 * @len: length of payload
256 *
257 * This function sends @data of length @len on the @rpdev channel.
258 * The message will be sent to the remote processor which the @rpdev
259 * channel belongs to, using @rpdev's source and destination addresses.
260 * In case there are no TX buffers available, the function will immediately
261 * return -ENOMEM without waiting until one becomes available.
262 *
263 * Can only be called from process context (for now).
264 *
265 * Returns 0 on success and an appropriate error value on failure.
266 */
267static inline
268int rpmsg_trysend(struct rpmsg_channel *rpdev, void *data, int len)
269{
270 u32 src = rpdev->src, dst = rpdev->dst;
271
272 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
273}
274
275/**
276 * rpmsg_sendto() - send a message across to the remote processor, specify dst
277 * @rpdev: the rpmsg channel
278 * @data: payload of message
279 * @len: length of payload
280 * @dst: destination address
281 *
282 * This function sends @data of length @len to the remote @dst address.
283 * The message will be sent to the remote processor which the @rpdev
284 * channel belongs to, using @rpdev's source address.
285 * In case there are no TX buffers available, the function will immediately
286 * return -ENOMEM without waiting until one becomes available.
287 *
288 * Can only be called from process context (for now).
289 *
290 * Returns 0 on success and an appropriate error value on failure.
291 */
292static inline
293int rpmsg_trysendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst)
294{
295 u32 src = rpdev->src;
296
297 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
298}
299
300/**
301 * rpmsg_send_offchannel() - send a message using explicit src/dst addresses
302 * @rpdev: the rpmsg channel
303 * @src: source address
304 * @dst: destination address
305 * @data: payload of message
306 * @len: length of payload
307 *
308 * This function sends @data of length @len to the remote @dst address,
309 * and uses @src as the source address.
310 * The message will be sent to the remote processor which the @rpdev
311 * channel belongs to.
312 * In case there are no TX buffers available, the function will immediately
313 * return -ENOMEM without waiting until one becomes available.
314 *
315 * Can only be called from process context (for now).
316 *
317 * Returns 0 on success and an appropriate error value on failure.
318 */
319static inline
320int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst,
321 void *data, int len)
322{
323 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
324}
325
326#endif /* _LINUX_RPMSG_H */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 93f4d035076..fcabfb4873c 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 63d40655439..54bd7cd7ecb 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 00000000000..65839a58b8e
--- /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/scatterlist.h b/include/linux/scatterlist.h
index 9aaf5bfdad1..ac9586dadfa 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -1,10 +1,12 @@
1#ifndef _LINUX_SCATTERLIST_H 1#ifndef _LINUX_SCATTERLIST_H
2#define _LINUX_SCATTERLIST_H 2#define _LINUX_SCATTERLIST_H
3 3
4#include <linux/string.h>
5#include <linux/bug.h>
6#include <linux/mm.h>
7
4#include <asm/types.h> 8#include <asm/types.h>
5#include <asm/scatterlist.h> 9#include <asm/scatterlist.h>
6#include <linux/mm.h>
7#include <linux/string.h>
8#include <asm/io.h> 10#include <asm/io.h>
9 11
10struct sg_table { 12struct sg_table {
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0c147a4260a..81a173c0897 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>
@@ -553,6 +552,18 @@ struct signal_struct {
553 int group_stop_count; 552 int group_stop_count;
554 unsigned int flags; /* see SIGNAL_* flags below */ 553 unsigned int flags; /* see SIGNAL_* flags below */
555 554
555 /*
556 * PR_SET_CHILD_SUBREAPER marks a process, like a service
557 * manager, to re-parent orphan (double-forking) child processes
558 * to this process instead of 'init'. The service manager is
559 * able to receive SIGCHLD signals and is able to investigate
560 * the process until it calls wait(). All children of this
561 * process will inherit a flag if they should look for a
562 * child_subreaper process at exit.
563 */
564 unsigned int is_child_subreaper:1;
565 unsigned int has_child_subreaper:1;
566
556 /* POSIX.1b Interval Timers */ 567 /* POSIX.1b Interval Timers */
557 struct list_head posix_timers; 568 struct list_head posix_timers;
558 569
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 44f1514b00b..fc61854f622 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/string.h> 5#include <linux/string.h>
6#include <linux/bug.h>
6#include <linux/mutex.h> 7#include <linux/mutex.h>
7#include <linux/cpumask.h> 8#include <linux/cpumask.h>
8#include <linux/nodemask.h> 9#include <linux/nodemask.h>
@@ -121,9 +122,12 @@ int single_release(struct inode *, struct file *);
121void *__seq_open_private(struct file *, const struct seq_operations *, int); 122void *__seq_open_private(struct file *, const struct seq_operations *, int);
122int seq_open_private(struct file *, const struct seq_operations *, int); 123int seq_open_private(struct file *, const struct seq_operations *, int);
123int seq_release_private(struct inode *, struct file *); 124int seq_release_private(struct inode *, struct file *);
125int seq_put_decimal_ull(struct seq_file *m, char delimiter,
126 unsigned long long num);
127int seq_put_decimal_ll(struct seq_file *m, char delimiter,
128 long long num);
124 129
125#define SEQ_START_TOKEN ((void *)1) 130#define SEQ_START_TOKEN ((void *)1)
126
127/* 131/*
128 * Helpers for iteration over list_head-s in seq_files 132 * Helpers for iteration over list_head-s in seq_files
129 */ 133 */
diff --git a/include/linux/serial_pnx8xxx.h b/include/linux/serial_pnx8xxx.h
index de6c19c7f34..79ad87b0be3 100644
--- a/include/linux/serial_pnx8xxx.h
+++ b/include/linux/serial_pnx8xxx.h
@@ -20,7 +20,6 @@
20#define _LINUX_SERIAL_PNX8XXX_H 20#define _LINUX_SERIAL_PNX8XXX_H
21 21
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/device.h>
24 23
25#define PNX8XXX_NR_PORTS 2 24#define PNX8XXX_NR_PORTS 2
26 25
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 54341d81168..0a9d8f2ac51 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -18,7 +18,8 @@ struct clk_mapping {
18 struct kref ref; 18 struct kref ref;
19}; 19};
20 20
21struct clk_ops { 21
22struct sh_clk_ops {
22#ifdef CONFIG_SH_CLK_CPG_LEGACY 23#ifdef CONFIG_SH_CLK_CPG_LEGACY
23 void (*init)(struct clk *clk); 24 void (*init)(struct clk *clk);
24#endif 25#endif
@@ -37,7 +38,7 @@ struct clk {
37 unsigned short parent_num; /* choose between */ 38 unsigned short parent_num; /* choose between */
38 unsigned char src_shift; /* source clock field in the */ 39 unsigned char src_shift; /* source clock field in the */
39 unsigned char src_width; /* configuration register */ 40 unsigned char src_width; /* configuration register */
40 struct clk_ops *ops; 41 struct sh_clk_ops *ops;
41 42
42 struct list_head children; 43 struct list_head children;
43 struct list_head sibling; /* node for children */ 44 struct list_head sibling; /* node for children */
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index b160645f559..6aed0805927 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 a2b9953b582..33370271b8b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -18,6 +18,7 @@
18#include <linux/kmemcheck.h> 18#include <linux/kmemcheck.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/bug.h>
21#include <linux/cache.h> 22#include <linux/cache.h>
22 23
23#include <linux/atomic.h> 24#include <linux/atomic.h>
@@ -500,7 +501,6 @@ struct sk_buff {
500 */ 501 */
501#include <linux/slab.h> 502#include <linux/slab.h>
502 503
503#include <asm/system.h>
504 504
505/* 505/*
506 * skb might have a dst pointer attached, refcounted or not. 506 * skb might have a dst pointer attached, refcounted or not.
@@ -1244,7 +1244,7 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
1244} 1244}
1245 1245
1246extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, 1246extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
1247 int off, int size); 1247 int off, int size, unsigned int truesize);
1248 1248
1249#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 1249#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
1250#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) 1250#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb))
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 573c809c33d..a595dce6b0c 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 a32bcfdc783..c2f8c8bc56e 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -8,6 +8,7 @@
8 */ 8 */
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/bug.h>
11#include <linux/workqueue.h> 12#include <linux/workqueue.h>
12#include <linux/kobject.h> 13#include <linux/kobject.h>
13 14
@@ -21,7 +22,7 @@ enum stat_item {
21 FREE_FROZEN, /* Freeing to frozen slab */ 22 FREE_FROZEN, /* Freeing to frozen slab */
22 FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ 23 FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */
23 FREE_REMOVE_PARTIAL, /* Freeing removes last object */ 24 FREE_REMOVE_PARTIAL, /* Freeing removes last object */
24 ALLOC_FROM_PARTIAL, /* Cpu slab acquired from partial list */ 25 ALLOC_FROM_PARTIAL, /* Cpu slab acquired from node partial list */
25 ALLOC_SLAB, /* Cpu slab acquired from page allocator */ 26 ALLOC_SLAB, /* Cpu slab acquired from page allocator */
26 ALLOC_REFILL, /* Refill cpu slab from slab freelist */ 27 ALLOC_REFILL, /* Refill cpu slab from slab freelist */
27 ALLOC_NODE_MISMATCH, /* Switching cpu slab */ 28 ALLOC_NODE_MISMATCH, /* Switching cpu slab */
@@ -37,7 +38,9 @@ enum stat_item {
37 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */ 38 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */
38 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 */
39 CPU_PARTIAL_ALLOC, /* Used cpu partial on alloc */ 40 CPU_PARTIAL_ALLOC, /* Used cpu partial on alloc */
40 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 */
41 NR_SLUB_STAT_ITEMS }; 44 NR_SLUB_STAT_ITEMS };
42 45
43struct kmem_cache_cpu { 46struct kmem_cache_cpu {
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8cc38d3bab0..10530d92c04 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/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index 0f4eb165f25..32be8dbdf19 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -1,10 +1,10 @@
1#ifndef __LINUX_SPI_MMC_SPI_H 1#ifndef __LINUX_SPI_MMC_SPI_H
2#define __LINUX_SPI_MMC_SPI_H 2#define __LINUX_SPI_MMC_SPI_H
3 3
4#include <linux/device.h>
5#include <linux/spi/spi.h> 4#include <linux/spi/spi.h>
6#include <linux/interrupt.h> 5#include <linux/interrupt.h>
7 6
7struct device;
8struct mmc_host; 8struct mmc_host;
9 9
10/* Put this in platform_data of a device being used to manage an MMC/SD 10/* Put this in platform_data of a device being used to manage an MMC/SD
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h
index decf6d8c77b..b4d9fa6f797 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/spi/s3c24xx.h b/include/linux/spi/s3c24xx.h
new file mode 100644
index 00000000000..c23b923e493
--- /dev/null
+++ b/include/linux/spi/s3c24xx.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright (c) 2006 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 *
5 * S3C2410 - SPI Controller platform_device info
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __LINUX_SPI_S3C24XX_H
13#define __LINUX_SPI_S3C24XX_H __FILE__
14
15struct s3c2410_spi_info {
16 int pin_cs; /* simple gpio cs */
17 unsigned int num_cs; /* total chipselects */
18 int bus_num; /* bus number to use. */
19
20 unsigned int use_fiq:1; /* use fiq */
21
22 void (*gpio_setup)(struct s3c2410_spi_info *spi, int enable);
23 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
24};
25
26#endif /* __LINUX_SPI_S3C24XX_H */
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 7df6c17b028..7d537ced949 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
@@ -375,10 +375,7 @@ static inline int spin_can_lock(spinlock_t *lock)
375 return raw_spin_can_lock(&lock->rlock); 375 return raw_spin_can_lock(&lock->rlock);
376} 376}
377 377
378static inline void assert_spin_locked(spinlock_t *lock) 378#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
379{
380 assert_raw_spin_locked(&lock->rlock);
381}
382 379
383/* 380/*
384 * Pull the atomic_t declaration: 381 * Pull the atomic_t declaration:
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index e253ccd7a60..51df117abe4 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/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index eba52a10053..6b05dcd927f 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -2,6 +2,7 @@
2#define LINUX_SSB_DRIVER_GIGE_H_ 2#define LINUX_SSB_DRIVER_GIGE_H_
3 3
4#include <linux/ssb/ssb.h> 4#include <linux/ssb/ssb.h>
5#include <linux/bug.h>
5#include <linux/pci.h> 6#include <linux/pci.h>
6#include <linux/spinlock.h> 7#include <linux/spinlock.h>
7 8
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index c170edc3bf5..3b5e910d14c 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/auth.h b/include/linux/sunrpc/auth.h
index 7874a8a5663..492a36d7282 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -99,6 +99,8 @@ struct rpc_authops {
99 99
100 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); 100 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int);
101 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); 101 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int);
102 int (*pipes_create)(struct rpc_auth *);
103 void (*pipes_destroy)(struct rpc_auth *);
102}; 104};
103 105
104struct rpc_credops { 106struct rpc_credops {
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
index f7f3ce340c0..969c0a671db 100644
--- a/include/linux/sunrpc/bc_xprt.h
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); 35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt);
36void xprt_free_bc_request(struct rpc_rqst *req); 36void xprt_free_bc_request(struct rpc_rqst *req);
37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); 37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
38void xprt_destroy_backchannel(struct rpc_xprt *, int max_reqs); 38void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
39int bc_send(struct rpc_rqst *req); 39int bc_send(struct rpc_rqst *req);
40 40
41/* 41/*
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 57531f8e595..f5fd6160dbc 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -117,6 +117,7 @@ struct cache_detail {
117 struct cache_detail_procfs procfs; 117 struct cache_detail_procfs procfs;
118 struct cache_detail_pipefs pipefs; 118 struct cache_detail_pipefs pipefs;
119 } u; 119 } u;
120 struct net *net;
120}; 121};
121 122
122 123
@@ -197,11 +198,14 @@ extern void cache_flush(void);
197extern void cache_purge(struct cache_detail *detail); 198extern void cache_purge(struct cache_detail *detail);
198#define NEVER (0x7FFFFFFF) 199#define NEVER (0x7FFFFFFF)
199extern void __init cache_initialize(void); 200extern void __init cache_initialize(void);
200extern int cache_register(struct cache_detail *cd);
201extern int cache_register_net(struct cache_detail *cd, struct net *net); 201extern int cache_register_net(struct cache_detail *cd, struct net *net);
202extern void cache_unregister(struct cache_detail *cd);
203extern void cache_unregister_net(struct cache_detail *cd, struct net *net); 202extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
204 203
204extern struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net);
205extern void cache_destroy_net(struct cache_detail *cd, struct net *net);
206
207extern void sunrpc_init_cache_detail(struct cache_detail *cd);
208extern void sunrpc_destroy_cache_detail(struct cache_detail *cd);
205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, 209extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
206 umode_t, struct cache_detail *); 210 umode_t, struct cache_detail *);
207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); 211extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 2c5993a17c3..523547ecfee 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -35,14 +35,13 @@ struct rpc_clnt {
35 struct list_head cl_clients; /* Global list of clients */ 35 struct list_head cl_clients; /* Global list of clients */
36 struct list_head cl_tasks; /* List of tasks */ 36 struct list_head cl_tasks; /* List of tasks */
37 spinlock_t cl_lock; /* spinlock */ 37 spinlock_t cl_lock; /* spinlock */
38 struct rpc_xprt * cl_xprt; /* transport */ 38 struct rpc_xprt __rcu * cl_xprt; /* transport */
39 struct rpc_procinfo * cl_procinfo; /* procedure info */ 39 struct rpc_procinfo * cl_procinfo; /* procedure info */
40 u32 cl_prog, /* RPC program number */ 40 u32 cl_prog, /* RPC program number */
41 cl_vers, /* RPC version number */ 41 cl_vers, /* RPC version number */
42 cl_maxproc; /* max procedure number */ 42 cl_maxproc; /* max procedure number */
43 43
44 char * cl_server; /* server machine name */ 44 const char * cl_protname; /* protocol name */
45 char * cl_protname; /* protocol name */
46 struct rpc_auth * cl_auth; /* authenticator */ 45 struct rpc_auth * cl_auth; /* authenticator */
47 struct rpc_stat * cl_stats; /* per-program statistics */ 46 struct rpc_stat * cl_stats; /* per-program statistics */
48 struct rpc_iostats * cl_metrics; /* per-client statistics */ 47 struct rpc_iostats * cl_metrics; /* per-client statistics */
@@ -57,12 +56,11 @@ struct rpc_clnt {
57 56
58 int cl_nodelen; /* nodename length */ 57 int cl_nodelen; /* nodename length */
59 char cl_nodename[UNX_MAXNODENAME]; 58 char cl_nodename[UNX_MAXNODENAME];
60 struct path cl_path; 59 struct dentry * cl_dentry;
61 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 60 struct rpc_clnt * cl_parent; /* Points to parent of clones */
62 struct rpc_rtt cl_rtt_default; 61 struct rpc_rtt cl_rtt_default;
63 struct rpc_timeout cl_timeout_default; 62 struct rpc_timeout cl_timeout_default;
64 struct rpc_program * cl_program; 63 const struct rpc_program *cl_program;
65 char cl_inline_name[32];
66 char *cl_principal; /* target to authenticate to */ 64 char *cl_principal; /* target to authenticate to */
67}; 65};
68 66
@@ -71,12 +69,12 @@ struct rpc_clnt {
71 */ 69 */
72#define RPC_MAXVERSION 4 70#define RPC_MAXVERSION 4
73struct rpc_program { 71struct rpc_program {
74 char * name; /* protocol name */ 72 const char * name; /* protocol name */
75 u32 number; /* program number */ 73 u32 number; /* program number */
76 unsigned int nrvers; /* number of versions */ 74 unsigned int nrvers; /* number of versions */
77 struct rpc_version ** version; /* version array */ 75 const struct rpc_version ** version; /* version array */
78 struct rpc_stat * stats; /* statistics */ 76 struct rpc_stat * stats; /* statistics */
79 char * pipe_dir_name; /* path to rpc_pipefs dir */ 77 const char * pipe_dir_name; /* path to rpc_pipefs dir */
80}; 78};
81 79
82struct rpc_version { 80struct rpc_version {
@@ -97,7 +95,7 @@ struct rpc_procinfo {
97 unsigned int p_count; /* call count */ 95 unsigned int p_count; /* call count */
98 unsigned int p_timer; /* Which RTT timer to use */ 96 unsigned int p_timer; /* Which RTT timer to use */
99 u32 p_statidx; /* Which procedure to account */ 97 u32 p_statidx; /* Which procedure to account */
100 char * p_name; /* name of procedure */ 98 const char * p_name; /* name of procedure */
101}; 99};
102 100
103#ifdef __KERNEL__ 101#ifdef __KERNEL__
@@ -109,8 +107,8 @@ struct rpc_create_args {
109 size_t addrsize; 107 size_t addrsize;
110 struct sockaddr *saddress; 108 struct sockaddr *saddress;
111 const struct rpc_timeout *timeout; 109 const struct rpc_timeout *timeout;
112 char *servername; 110 const char *servername;
113 struct rpc_program *program; 111 const struct rpc_program *program;
114 u32 prognumber; /* overrides program->number */ 112 u32 prognumber; /* overrides program->number */
115 u32 version; 113 u32 version;
116 rpc_authflavor_t authflavor; 114 rpc_authflavor_t authflavor;
@@ -129,17 +127,18 @@ struct rpc_create_args {
129 127
130struct rpc_clnt *rpc_create(struct rpc_create_args *args); 128struct rpc_clnt *rpc_create(struct rpc_create_args *args);
131struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 129struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
132 struct rpc_program *, u32); 130 const struct rpc_program *, u32);
133void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); 131void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
134struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 132struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
135void rpc_shutdown_client(struct rpc_clnt *); 133void rpc_shutdown_client(struct rpc_clnt *);
136void rpc_release_client(struct rpc_clnt *); 134void rpc_release_client(struct rpc_clnt *);
137void rpc_task_release_client(struct rpc_task *); 135void rpc_task_release_client(struct rpc_task *);
138 136
139int rpcb_create_local(void); 137int rpcb_create_local(struct net *);
140void rpcb_put_local(void); 138void rpcb_put_local(struct net *);
141int rpcb_register(u32, u32, int, unsigned short); 139int rpcb_register(struct net *, u32, u32, int, unsigned short);
142int rpcb_v4_register(const u32 program, const u32 version, 140int rpcb_v4_register(struct net *net, const u32 program,
141 const u32 version,
143 const struct sockaddr *address, 142 const struct sockaddr *address,
144 const char *netid); 143 const char *netid);
145void rpcb_getport_async(struct rpc_task *); 144void rpcb_getport_async(struct rpc_task *);
@@ -156,16 +155,19 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
156int rpc_restart_call_prepare(struct rpc_task *); 155int rpc_restart_call_prepare(struct rpc_task *);
157int rpc_restart_call(struct rpc_task *); 156int rpc_restart_call(struct rpc_task *);
158void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 157void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
158int rpc_protocol(struct rpc_clnt *);
159struct net * rpc_net_ns(struct rpc_clnt *);
159size_t rpc_max_payload(struct rpc_clnt *); 160size_t rpc_max_payload(struct rpc_clnt *);
160void rpc_force_rebind(struct rpc_clnt *); 161void rpc_force_rebind(struct rpc_clnt *);
161size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 162size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
162const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 163const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
164int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t);
163 165
164size_t rpc_ntop(const struct sockaddr *, char *, const size_t); 166size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
165size_t rpc_pton(const char *, const size_t, 167size_t rpc_pton(struct net *, const char *, const size_t,
166 struct sockaddr *, const size_t); 168 struct sockaddr *, const size_t);
167char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t); 169char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t);
168size_t rpc_uaddr2sockaddr(const char *, const size_t, 170size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t,
169 struct sockaddr *, const size_t); 171 struct sockaddr *, const size_t);
170 172
171static inline unsigned short rpc_get_port(const struct sockaddr *sap) 173static inline unsigned short rpc_get_port(const struct sockaddr *sap)
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index c2786f20016..a76cc20d98c 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -31,9 +31,12 @@
31/* 31/*
32 * Enable RPC debugging/profiling. 32 * Enable RPC debugging/profiling.
33 */ 33 */
34#ifdef CONFIG_SYSCTL 34#ifdef CONFIG_SUNRPC_DEBUG
35#define RPC_DEBUG 35#define RPC_DEBUG
36#endif 36#endif
37#ifdef CONFIG_TRACEPOINTS
38#define RPC_TRACEPOINTS
39#endif
37/* #define RPC_PROFILE */ 40/* #define RPC_PROFILE */
38 41
39/* 42/*
@@ -47,15 +50,32 @@ extern unsigned int nlm_debug;
47#endif 50#endif
48 51
49#define dprintk(args...) dfprintk(FACILITY, ## args) 52#define dprintk(args...) dfprintk(FACILITY, ## args)
53#define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args)
50 54
51#undef ifdebug 55#undef ifdebug
52#ifdef RPC_DEBUG 56#ifdef RPC_DEBUG
53# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) 57# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac))
54# define dfprintk(fac, args...) do { ifdebug(fac) printk(args); } while(0) 58
59# define dfprintk(fac, args...) \
60 do { \
61 ifdebug(fac) \
62 printk(KERN_DEFAULT args); \
63 } while (0)
64
65# define dfprintk_rcu(fac, args...) \
66 do { \
67 ifdebug(fac) { \
68 rcu_read_lock(); \
69 printk(KERN_DEFAULT args); \
70 rcu_read_unlock(); \
71 } \
72 } while (0)
73
55# define RPC_IFDEBUG(x) x 74# define RPC_IFDEBUG(x) x
56#else 75#else
57# define ifdebug(fac) if (0) 76# define ifdebug(fac) if (0)
58# define dfprintk(fac, args...) do ; while (0) 77# define dfprintk(fac, args...) do {} while (0)
78# define dfprintk_rcu(fac, args...) do {} while (0)
59# define RPC_IFDEBUG(x) 79# define RPC_IFDEBUG(x)
60#endif 80#endif
61 81
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index b6edbc0ea83..1565bbe86d5 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -74,14 +74,16 @@ struct rpc_clnt;
74#ifdef CONFIG_PROC_FS 74#ifdef CONFIG_PROC_FS
75 75
76struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); 76struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *);
77void rpc_count_iostats(struct rpc_task *); 77void rpc_count_iostats(const struct rpc_task *,
78 struct rpc_iostats *);
78void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); 79void rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
79void rpc_free_iostats(struct rpc_iostats *); 80void rpc_free_iostats(struct rpc_iostats *);
80 81
81#else /* CONFIG_PROC_FS */ 82#else /* CONFIG_PROC_FS */
82 83
83static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; } 84static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
84static inline void rpc_count_iostats(struct rpc_task *task) {} 85static inline void rpc_count_iostats(const struct rpc_task *task,
86 struct rpc_iostats *stats) {}
85static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {} 87static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
86static inline void rpc_free_iostats(struct rpc_iostats *stats) {} 88static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
87 89
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 2bb03d77375..a7b422b33ed 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -21,21 +21,26 @@ struct rpc_pipe_ops {
21 void (*destroy_msg)(struct rpc_pipe_msg *); 21 void (*destroy_msg)(struct rpc_pipe_msg *);
22}; 22};
23 23
24struct rpc_inode { 24struct rpc_pipe {
25 struct inode vfs_inode;
26 void *private;
27 struct list_head pipe; 25 struct list_head pipe;
28 struct list_head in_upcall; 26 struct list_head in_upcall;
29 struct list_head in_downcall; 27 struct list_head in_downcall;
30 int pipelen; 28 int pipelen;
31 int nreaders; 29 int nreaders;
32 int nwriters; 30 int nwriters;
33 int nkern_readwriters;
34 wait_queue_head_t waitq;
35#define RPC_PIPE_WAIT_FOR_OPEN 1 31#define RPC_PIPE_WAIT_FOR_OPEN 1
36 int flags; 32 int flags;
37 struct delayed_work queue_timeout; 33 struct delayed_work queue_timeout;
38 const struct rpc_pipe_ops *ops; 34 const struct rpc_pipe_ops *ops;
35 spinlock_t lock;
36 struct dentry *dentry;
37};
38
39struct rpc_inode {
40 struct inode vfs_inode;
41 void *private;
42 struct rpc_pipe *pipe;
43 wait_queue_head_t waitq;
39}; 44};
40 45
41static inline struct rpc_inode * 46static inline struct rpc_inode *
@@ -44,9 +49,28 @@ RPC_I(struct inode *inode)
44 return container_of(inode, struct rpc_inode, vfs_inode); 49 return container_of(inode, struct rpc_inode, vfs_inode);
45} 50}
46 51
52enum {
53 SUNRPC_PIPEFS_NFS_PRIO,
54 SUNRPC_PIPEFS_RPC_PRIO,
55};
56
57extern int rpc_pipefs_notifier_register(struct notifier_block *);
58extern void rpc_pipefs_notifier_unregister(struct notifier_block *);
59
60enum {
61 RPC_PIPEFS_MOUNT,
62 RPC_PIPEFS_UMOUNT,
63};
64
65extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
66 const unsigned char *dir_name);
67extern void rpc_pipefs_init_net(struct net *net);
68extern struct super_block *rpc_get_sb_net(const struct net *net);
69extern void rpc_put_sb_net(const struct net *net);
70
47extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, 71extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
48 char __user *, size_t); 72 char __user *, size_t);
49extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
50 74
51struct rpc_clnt; 75struct rpc_clnt;
52extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); 76extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
@@ -59,11 +83,13 @@ extern struct dentry *rpc_create_cache_dir(struct dentry *,
59 struct cache_detail *); 83 struct cache_detail *);
60extern void rpc_remove_cache_dir(struct dentry *); 84extern void rpc_remove_cache_dir(struct dentry *);
61 85
62extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, 86extern int rpc_rmdir(struct dentry *dentry);
63 const struct rpc_pipe_ops *, int flags); 87
88struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags);
89void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
90extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
91 struct rpc_pipe *);
64extern int rpc_unlink(struct dentry *); 92extern int rpc_unlink(struct dentry *);
65extern struct vfsmount *rpc_get_mount(void);
66extern void rpc_put_mount(void);
67extern int register_rpc_pipefs(void); 93extern int register_rpc_pipefs(void);
68extern void unregister_rpc_pipefs(void); 94extern void unregister_rpc_pipefs(void);
69 95
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index e7756896f3c..dc0c3cc3ada 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -103,6 +103,7 @@ typedef void (*rpc_action)(struct rpc_task *);
103struct rpc_call_ops { 103struct rpc_call_ops {
104 void (*rpc_call_prepare)(struct rpc_task *, void *); 104 void (*rpc_call_prepare)(struct rpc_task *, void *);
105 void (*rpc_call_done)(struct rpc_task *, void *); 105 void (*rpc_call_done)(struct rpc_task *, void *);
106 void (*rpc_count_stats)(struct rpc_task *, void *);
106 void (*rpc_release)(void *); 107 void (*rpc_release)(void *);
107}; 108};
108 109
@@ -195,7 +196,7 @@ struct rpc_wait_queue {
195 unsigned char nr; /* # tasks remaining for cookie */ 196 unsigned char nr; /* # tasks remaining for cookie */
196 unsigned short qlen; /* total # tasks waiting in queue */ 197 unsigned short qlen; /* total # tasks waiting in queue */
197 struct rpc_timer timer_list; 198 struct rpc_timer timer_list;
198#ifdef RPC_DEBUG 199#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS)
199 const char * name; 200 const char * name;
200#endif 201#endif
201}; 202};
@@ -235,6 +236,9 @@ void rpc_wake_up_queued_task(struct rpc_wait_queue *,
235 struct rpc_task *); 236 struct rpc_task *);
236void rpc_wake_up(struct rpc_wait_queue *); 237void rpc_wake_up(struct rpc_wait_queue *);
237struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); 238struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
239struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
240 bool (*)(struct rpc_task *, void *),
241 void *);
238void rpc_wake_up_status(struct rpc_wait_queue *, int); 242void rpc_wake_up_status(struct rpc_wait_queue *, int);
239int rpc_queue_empty(struct rpc_wait_queue *); 243int rpc_queue_empty(struct rpc_wait_queue *);
240void rpc_delay(struct rpc_task *, unsigned long); 244void rpc_delay(struct rpc_task *, unsigned long);
@@ -244,7 +248,8 @@ int rpciod_up(void);
244void rpciod_down(void); 248void rpciod_down(void);
245int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 249int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
246#ifdef RPC_DEBUG 250#ifdef RPC_DEBUG
247void rpc_show_tasks(void); 251struct net;
252void rpc_show_tasks(struct net *);
248#endif 253#endif
249int rpc_init_mempool(void); 254int rpc_init_mempool(void);
250void rpc_destroy_mempool(void); 255void rpc_destroy_mempool(void);
@@ -266,11 +271,22 @@ static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char pri
266 return (task->tk_priority + RPC_PRIORITY_LOW == prio); 271 return (task->tk_priority + RPC_PRIORITY_LOW == prio);
267} 272}
268 273
269#ifdef RPC_DEBUG 274#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS)
270static inline const char * rpc_qname(struct rpc_wait_queue *q) 275static inline const char * rpc_qname(const struct rpc_wait_queue *q)
271{ 276{
272 return ((q && q->name) ? q->name : "unknown"); 277 return ((q && q->name) ? q->name : "unknown");
273} 278}
279
280static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
281 const char *name)
282{
283 q->name = name;
284}
285#else
286static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
287 const char *name)
288{
289}
274#endif 290#endif
275 291
276#endif /* _LINUX_SUNRPC_SCHED_H_ */ 292#endif /* _LINUX_SUNRPC_SCHED_H_ */
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h
index 680471d1f28..edc64219f92 100644
--- a/include/linux/sunrpc/stats.h
+++ b/include/linux/sunrpc/stats.h
@@ -12,7 +12,7 @@
12#include <linux/proc_fs.h> 12#include <linux/proc_fs.h>
13 13
14struct rpc_stat { 14struct rpc_stat {
15 struct rpc_program * program; 15 const struct rpc_program *program;
16 16
17 unsigned int netcnt, 17 unsigned int netcnt,
18 netudpcnt, 18 netudpcnt,
@@ -58,24 +58,24 @@ void rpc_modcount(struct inode *, int);
58#endif 58#endif
59 59
60#ifdef CONFIG_PROC_FS 60#ifdef CONFIG_PROC_FS
61struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); 61struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *);
62void rpc_proc_unregister(const char *); 62void rpc_proc_unregister(struct net *,const char *);
63void rpc_proc_zero(struct rpc_program *); 63void rpc_proc_zero(const struct rpc_program *);
64struct proc_dir_entry * svc_proc_register(struct svc_stat *, 64struct proc_dir_entry * svc_proc_register(struct net *, struct svc_stat *,
65 const struct file_operations *); 65 const struct file_operations *);
66void svc_proc_unregister(const char *); 66void svc_proc_unregister(struct net *, const char *);
67 67
68void svc_seq_show(struct seq_file *, 68void svc_seq_show(struct seq_file *,
69 const struct svc_stat *); 69 const struct svc_stat *);
70#else 70#else
71 71
72static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; } 72static inline struct proc_dir_entry *rpc_proc_register(struct net *net, struct rpc_stat *s) { return NULL; }
73static inline void rpc_proc_unregister(const char *p) {} 73static inline void rpc_proc_unregister(struct net *net, const char *p) {}
74static inline void rpc_proc_zero(struct rpc_program *p) {} 74static inline void rpc_proc_zero(const struct rpc_program *p) {}
75 75
76static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, 76static inline struct proc_dir_entry *svc_proc_register(struct net *net, struct svc_stat *s,
77 const struct file_operations *f) { return NULL; } 77 const struct file_operations *f) { return NULL; }
78static inline void svc_proc_unregister(const char *p) {} 78static inline void svc_proc_unregister(struct net *net, const char *p) {}
79 79
80static inline void svc_seq_show(struct seq_file *seq, 80static inline void svc_seq_show(struct seq_file *seq,
81 const struct svc_stat *st) {} 81 const struct svc_stat *st) {}
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 35b37b1e929..51b29ac45a8 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -84,7 +84,8 @@ struct svc_serv {
84 unsigned int sv_nrpools; /* number of thread pools */ 84 unsigned int sv_nrpools; /* number of thread pools */
85 struct svc_pool * sv_pools; /* array of thread pools */ 85 struct svc_pool * sv_pools; /* array of thread pools */
86 86
87 void (*sv_shutdown)(struct svc_serv *serv); 87 void (*sv_shutdown)(struct svc_serv *serv,
88 struct net *net);
88 /* Callback to use when last thread 89 /* Callback to use when last thread
89 * exits. 90 * exits.
90 */ 91 */
@@ -413,22 +414,24 @@ struct svc_procedure {
413/* 414/*
414 * Function prototypes. 415 * Function prototypes.
415 */ 416 */
416void svc_rpcb_cleanup(struct svc_serv *serv); 417int svc_rpcb_setup(struct svc_serv *serv, struct net *net);
418void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net);
417struct svc_serv *svc_create(struct svc_program *, unsigned int, 419struct svc_serv *svc_create(struct svc_program *, unsigned int,
418 void (*shutdown)(struct svc_serv *)); 420 void (*shutdown)(struct svc_serv *, struct net *net));
419struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 421struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
420 struct svc_pool *pool, int node); 422 struct svc_pool *pool, int node);
421void svc_exit_thread(struct svc_rqst *); 423void svc_exit_thread(struct svc_rqst *);
422struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 424struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
423 void (*shutdown)(struct svc_serv *), 425 void (*shutdown)(struct svc_serv *, struct net *net),
424 svc_thread_fn, struct module *); 426 svc_thread_fn, struct module *);
425int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 427int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
426int svc_pool_stats_open(struct svc_serv *serv, struct file *file); 428int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
427void svc_destroy(struct svc_serv *); 429void svc_destroy(struct svc_serv *);
430void svc_shutdown_net(struct svc_serv *, struct net *);
428int svc_process(struct svc_rqst *); 431int svc_process(struct svc_rqst *);
429int bc_svc_process(struct svc_serv *, struct rpc_rqst *, 432int bc_svc_process(struct svc_serv *, struct rpc_rqst *,
430 struct svc_rqst *); 433 struct svc_rqst *);
431int svc_register(const struct svc_serv *, const int, 434int svc_register(const struct svc_serv *, struct net *, const int,
432 const unsigned short, const unsigned short); 435 const unsigned short, const unsigned short);
433 436
434void svc_wake_up(struct svc_serv *); 437void svc_wake_up(struct svc_serv *);
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index c14fe86dac5..0b8e3e6bdac 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/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index dfa900948af..b3f64b12f14 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -121,7 +121,8 @@ void svc_close_xprt(struct svc_xprt *xprt);
121int svc_port_is_privileged(struct sockaddr *sin); 121int svc_port_is_privileged(struct sockaddr *sin);
122int svc_print_xprts(char *buf, int maxlen); 122int svc_print_xprts(char *buf, int maxlen);
123struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, 123struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
124 const sa_family_t af, const unsigned short port); 124 struct net *net, const sa_family_t af,
125 const unsigned short port);
125int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); 126int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen);
126 127
127static inline void svc_xprt_get(struct svc_xprt *xprt) 128static inline void svc_xprt_get(struct svc_xprt *xprt)
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 25d333c1b57..548790e9113 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -135,6 +135,9 @@ extern void svcauth_unix_purge(void);
135extern void svcauth_unix_info_release(struct svc_xprt *xpt); 135extern void svcauth_unix_info_release(struct svc_xprt *xpt);
136extern int svcauth_unix_set_client(struct svc_rqst *rqstp); 136extern int svcauth_unix_set_client(struct svc_rqst *rqstp);
137 137
138extern int unix_gid_cache_create(struct net *net);
139extern void unix_gid_cache_destroy(struct net *net);
140
138static inline unsigned long hash_str(char *name, int bits) 141static inline unsigned long hash_str(char *name, int bits)
139{ 142{
140 unsigned long hash = 0; 143 unsigned long hash = 0;
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index 83bbee3f089..7c32daa025e 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -18,6 +18,8 @@
18 18
19int gss_svc_init(void); 19int gss_svc_init(void);
20void gss_svc_shutdown(void); 20void gss_svc_shutdown(void);
21int gss_svc_init_net(struct net *net);
22void gss_svc_shutdown_net(struct net *net);
21int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); 23int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name);
22u32 svcauth_gss_flavor(struct auth_domain *dom); 24u32 svcauth_gss_flavor(struct auth_domain *dom);
23char *svc_gss_principal(struct svc_rqst *); 25char *svc_gss_principal(struct svc_rqst *);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index c84e9741cb2..cb4ac69e1f3 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -34,7 +34,7 @@ struct svc_sock {
34/* 34/*
35 * Function prototypes. 35 * Function prototypes.
36 */ 36 */
37void svc_close_all(struct svc_serv *); 37void svc_close_net(struct svc_serv *, struct net *);
38int svc_recv(struct svc_rqst *, long); 38int svc_recv(struct svc_rqst *, long);
39int svc_send(struct svc_rqst *); 39int svc_send(struct svc_rqst *);
40void svc_drop(struct svc_rqst *); 40void svc_drop(struct svc_rqst *);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 15518a152ac..77d278defa7 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -21,8 +21,8 @@
21 21
22#define RPC_MIN_SLOT_TABLE (2U) 22#define RPC_MIN_SLOT_TABLE (2U)
23#define RPC_DEF_SLOT_TABLE (16U) 23#define RPC_DEF_SLOT_TABLE (16U)
24#define RPC_MAX_SLOT_TABLE (128U)
25#define RPC_MAX_SLOT_TABLE_LIMIT (65536U) 24#define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
25#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT
26 26
27/* 27/*
28 * This describes a timeout strategy 28 * This describes a timeout strategy
@@ -219,13 +219,17 @@ struct rpc_xprt {
219 connect_time, /* jiffies waiting for connect */ 219 connect_time, /* jiffies waiting for connect */
220 sends, /* how many complete requests */ 220 sends, /* how many complete requests */
221 recvs, /* how many complete requests */ 221 recvs, /* how many complete requests */
222 bad_xids; /* lookup_rqst didn't find XID */ 222 bad_xids, /* lookup_rqst didn't find XID */
223 max_slots; /* max rpc_slots used */
223 224
224 unsigned long long req_u, /* average requests on the wire */ 225 unsigned long long req_u, /* average requests on the wire */
225 bklog_u; /* backlog queue utilization */ 226 bklog_u, /* backlog queue utilization */
227 sending_u, /* send q utilization */
228 pending_u; /* pend q utilization */
226 } stat; 229 } stat;
227 230
228 struct net *xprt_net; 231 struct net *xprt_net;
232 const char *servername;
229 const char *address_strings[RPC_DISPLAY_MAX]; 233 const char *address_strings[RPC_DISPLAY_MAX];
230}; 234};
231 235
@@ -255,6 +259,7 @@ struct xprt_create {
255 struct sockaddr * srcaddr; /* optional local address */ 259 struct sockaddr * srcaddr; /* optional local address */
256 struct sockaddr * dstaddr; /* remote peer address */ 260 struct sockaddr * dstaddr; /* remote peer address */
257 size_t addrlen; 261 size_t addrlen;
262 const char *servername;
258 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ 263 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
259}; 264};
260 265
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index 3f14a02e9cc..1ad36cc25b2 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -12,18 +12,6 @@
12int init_socket_xprt(void); 12int init_socket_xprt(void);
13void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
14 14
15/*
16 * RPC slot table sizes for UDP, TCP transports
17 */
18extern unsigned int xprt_udp_slot_table_entries;
19extern unsigned int xprt_tcp_slot_table_entries;
20
21/*
22 * Parameters for choosing a free port
23 */
24extern unsigned int xprt_min_resvport;
25extern unsigned int xprt_max_resvport;
26
27#define RPC_MIN_RESVPORT (1U) 15#define RPC_MIN_RESVPORT (1U)
28#define RPC_MAX_RESVPORT (65535U) 16#define RPC_MAX_RESVPORT (65535U)
29#define RPC_DEF_MIN_RESVPORT (665U) 17#define RPC_DEF_MIN_RESVPORT (665U)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index b86b5c20617..8dc0ea7caf0 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;
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 2189d3ffc85..792d16d9cbc 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -2,6 +2,7 @@
2#define _LINUX_SWAPOPS_H 2#define _LINUX_SWAPOPS_H
3 3
4#include <linux/radix-tree.h> 4#include <linux/radix-tree.h>
5#include <linux/bug.h>
5 6
6/* 7/*
7 * swapcache pages are stored in the swapper_space radix tree. We want to 8 * swapcache pages are stored in the swapper_space radix tree. We want to
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 8ec1153ff57..3de3acb84a9 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -68,6 +68,7 @@ struct file_handle;
68#include <linux/aio_abi.h> 68#include <linux/aio_abi.h>
69#include <linux/capability.h> 69#include <linux/capability.h>
70#include <linux/list.h> 70#include <linux/list.h>
71#include <linux/bug.h>
71#include <linux/sem.h> 72#include <linux/sem.h>
72#include <asm/siginfo.h> 73#include <asm/siginfo.h>
73#include <asm/signal.h> 74#include <asm/signal.h>
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index bb9127dd814..c34b4c82b0d 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -932,34 +932,14 @@ enum
932#include <linux/list.h> 932#include <linux/list.h>
933#include <linux/rcupdate.h> 933#include <linux/rcupdate.h>
934#include <linux/wait.h> 934#include <linux/wait.h>
935#include <linux/rbtree.h>
935 936
936/* For the /proc/sys support */ 937/* For the /proc/sys support */
937struct ctl_table; 938struct ctl_table;
938struct nsproxy; 939struct nsproxy;
939struct ctl_table_root; 940struct ctl_table_root;
940
941struct ctl_table_set {
942 struct list_head list;
943 struct ctl_table_set *parent;
944 int (*is_seen)(struct ctl_table_set *);
945};
946
947extern void setup_sysctl_set(struct ctl_table_set *p,
948 struct ctl_table_set *parent,
949 int (*is_seen)(struct ctl_table_set *));
950
951struct ctl_table_header; 941struct ctl_table_header;
952 942struct ctl_dir;
953extern void sysctl_head_get(struct ctl_table_header *);
954extern void sysctl_head_put(struct ctl_table_header *);
955extern int sysctl_is_seen(struct ctl_table_header *);
956extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *);
957extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
958extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
959 struct ctl_table_header *prev);
960extern void sysctl_head_finish(struct ctl_table_header *prev);
961extern int sysctl_perm(struct ctl_table_root *root,
962 struct ctl_table *table, int op);
963 943
964typedef struct ctl_table ctl_table; 944typedef struct ctl_table ctl_table;
965 945
@@ -1023,8 +1003,6 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)
1023 return (void *)(unsigned long)atomic_read(&poll->event); 1003 return (void *)(unsigned long)atomic_read(&poll->event);
1024} 1004}
1025 1005
1026void proc_sys_poll_notify(struct ctl_table_poll *poll);
1027
1028#define __CTL_TABLE_POLL_INITIALIZER(name) { \ 1006#define __CTL_TABLE_POLL_INITIALIZER(name) { \
1029 .event = ATOMIC_INIT(0), \ 1007 .event = ATOMIC_INIT(0), \
1030 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) } 1008 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) }
@@ -1039,21 +1017,16 @@ struct ctl_table
1039 void *data; 1017 void *data;
1040 int maxlen; 1018 int maxlen;
1041 umode_t mode; 1019 umode_t mode;
1042 struct ctl_table *child; 1020 struct ctl_table *child; /* Deprecated */
1043 struct ctl_table *parent; /* Automatically set */
1044 proc_handler *proc_handler; /* Callback for text formatting */ 1021 proc_handler *proc_handler; /* Callback for text formatting */
1045 struct ctl_table_poll *poll; 1022 struct ctl_table_poll *poll;
1046 void *extra1; 1023 void *extra1;
1047 void *extra2; 1024 void *extra2;
1048}; 1025};
1049 1026
1050struct ctl_table_root { 1027struct ctl_node {
1051 struct list_head root_list; 1028 struct rb_node node;
1052 struct ctl_table_set default_set; 1029 struct ctl_table_header *header;
1053 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
1054 struct nsproxy *namespaces);
1055 int (*permissions)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces, struct ctl_table *table);
1057}; 1030};
1058 1031
1059/* struct ctl_table_header is used to maintain dynamic lists of 1032/* struct ctl_table_header is used to maintain dynamic lists of
@@ -1063,9 +1036,9 @@ struct ctl_table_header
1063 union { 1036 union {
1064 struct { 1037 struct {
1065 struct ctl_table *ctl_table; 1038 struct ctl_table *ctl_table;
1066 struct list_head ctl_entry;
1067 int used; 1039 int used;
1068 int count; 1040 int count;
1041 int nreg;
1069 }; 1042 };
1070 struct rcu_head rcu; 1043 struct rcu_head rcu;
1071 }; 1044 };
@@ -1073,9 +1046,27 @@ struct ctl_table_header
1073 struct ctl_table *ctl_table_arg; 1046 struct ctl_table *ctl_table_arg;
1074 struct ctl_table_root *root; 1047 struct ctl_table_root *root;
1075 struct ctl_table_set *set; 1048 struct ctl_table_set *set;
1076 struct ctl_table *attached_by; 1049 struct ctl_dir *parent;
1077 struct ctl_table *attached_to; 1050 struct ctl_node *node;
1078 struct ctl_table_header *parent; 1051};
1052
1053struct ctl_dir {
1054 /* Header must be at the start of ctl_dir */
1055 struct ctl_table_header header;
1056 struct rb_root root;
1057};
1058
1059struct ctl_table_set {
1060 int (*is_seen)(struct ctl_table_set *);
1061 struct ctl_dir dir;
1062};
1063
1064struct ctl_table_root {
1065 struct ctl_table_set default_set;
1066 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
1067 struct nsproxy *namespaces);
1068 int (*permissions)(struct ctl_table_root *root,
1069 struct nsproxy *namespaces, struct ctl_table *table);
1079}; 1070};
1080 1071
1081/* struct ctl_path describes where in the hierarchy a table is added */ 1072/* struct ctl_path describes where in the hierarchy a table is added */
@@ -1083,16 +1074,53 @@ struct ctl_path {
1083 const char *procname; 1074 const char *procname;
1084}; 1075};
1085 1076
1077#ifdef CONFIG_SYSCTL
1078
1079void proc_sys_poll_notify(struct ctl_table_poll *poll);
1080
1081extern void setup_sysctl_set(struct ctl_table_set *p,
1082 struct ctl_table_root *root,
1083 int (*is_seen)(struct ctl_table_set *));
1084extern void retire_sysctl_set(struct ctl_table_set *set);
1085
1086void register_sysctl_root(struct ctl_table_root *root); 1086void register_sysctl_root(struct ctl_table_root *root);
1087struct ctl_table_header *__register_sysctl_table(
1088 struct ctl_table_set *set,
1089 const char *path, struct ctl_table *table);
1087struct ctl_table_header *__register_sysctl_paths( 1090struct ctl_table_header *__register_sysctl_paths(
1088 struct ctl_table_root *root, struct nsproxy *namespaces, 1091 struct ctl_table_set *set,
1089 const struct ctl_path *path, struct ctl_table *table); 1092 const struct ctl_path *path, struct ctl_table *table);
1093struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table);
1090struct ctl_table_header *register_sysctl_table(struct ctl_table * table); 1094struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
1091struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 1095struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1092 struct ctl_table *table); 1096 struct ctl_table *table);
1093 1097
1094void unregister_sysctl_table(struct ctl_table_header * table); 1098void unregister_sysctl_table(struct ctl_table_header * table);
1095int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); 1099
1100extern int sysctl_init(void);
1101#else /* CONFIG_SYSCTL */
1102static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1103{
1104 return NULL;
1105}
1106
1107static inline struct ctl_table_header *register_sysctl_paths(
1108 const struct ctl_path *path, struct ctl_table *table)
1109{
1110 return NULL;
1111}
1112
1113static inline void unregister_sysctl_table(struct ctl_table_header * table)
1114{
1115}
1116
1117static inline void setup_sysctl_set(struct ctl_table_set *p,
1118 struct ctl_table_root *root,
1119 int (*is_seen)(struct ctl_table_set *))
1120{
1121}
1122
1123#endif /* CONFIG_SYSCTL */
1096 1124
1097#endif /* __KERNEL__ */ 1125#endif /* __KERNEL__ */
1098 1126
diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h
new file mode 100644
index 00000000000..934335a2252
--- /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 1dba6ee5520..c75128bed5f 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 b3061782dec..33a92ead4d8 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 b75e1864ed1..99bc88b1fc0 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/tracehook.h b/include/linux/tracehook.h
index a71a2927a6a..51bd91d911c 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -54,12 +54,12 @@ struct linux_binprm;
54/* 54/*
55 * ptrace report for syscall entry and exit looks identical. 55 * ptrace report for syscall entry and exit looks identical.
56 */ 56 */
57static inline void ptrace_report_syscall(struct pt_regs *regs) 57static inline int ptrace_report_syscall(struct pt_regs *regs)
58{ 58{
59 int ptrace = current->ptrace; 59 int ptrace = current->ptrace;
60 60
61 if (!(ptrace & PT_PTRACED)) 61 if (!(ptrace & PT_PTRACED))
62 return; 62 return 0;
63 63
64 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); 64 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
65 65
@@ -72,6 +72,8 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
72 send_sig(current->exit_code, current, 1); 72 send_sig(current->exit_code, current, 1);
73 current->exit_code = 0; 73 current->exit_code = 0;
74 } 74 }
75
76 return fatal_signal_pending(current);
75} 77}
76 78
77/** 79/**
@@ -96,8 +98,7 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
96static inline __must_check int tracehook_report_syscall_entry( 98static inline __must_check int tracehook_report_syscall_entry(
97 struct pt_regs *regs) 99 struct pt_regs *regs)
98{ 100{
99 ptrace_report_syscall(regs); 101 return ptrace_report_syscall(regs);
100 return 0;
101} 102}
102 103
103/** 104/**
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index 9ae8da3e640..11087cdd4ad 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -10,6 +10,7 @@
10#define _TRANSPORT_CLASS_H_ 10#define _TRANSPORT_CLASS_H_
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/bug.h>
13#include <linux/attribute_container.h> 14#include <linux/attribute_container.h>
14 15
15struct transport_container; 16struct transport_container;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index a91ff403b3b..9f47ab540f6 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/videodev2.h b/include/linux/videodev2.h
index 5e11f8a1f86..c9c9a4680cc 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -235,16 +235,25 @@ struct v4l2_fract {
235 __u32 denominator; 235 __u32 denominator;
236}; 236};
237 237
238/* 238/**
239 * D R I V E R C A P A B I L I T I E S 239 * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
240 */ 240 *
241 * @driver: name of the driver module (e.g. "bttv")
242 * @card: name of the card (e.g. "Hauppauge WinTV")
243 * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) )
244 * @version: KERNEL_VERSION
245 * @capabilities: capabilities of the physical device as a whole
246 * @device_caps: capabilities accessed via this particular device (node)
247 * @reserved: reserved fields for future extensions
248 */
241struct v4l2_capability { 249struct v4l2_capability {
242 __u8 driver[16]; /* i.e. "bttv" */ 250 __u8 driver[16];
243 __u8 card[32]; /* i.e. "Hauppauge WinTV" */ 251 __u8 card[32];
244 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ 252 __u8 bus_info[32];
245 __u32 version; /* should use KERNEL_VERSION() */ 253 __u32 version;
246 __u32 capabilities; /* Device capabilities */ 254 __u32 capabilities;
247 __u32 reserved[4]; 255 __u32 device_caps;
256 __u32 reserved[3];
248}; 257};
249 258
250/* Values for 'capabilities' field */ 259/* Values for 'capabilities' field */
@@ -274,6 +283,8 @@ struct v4l2_capability {
274#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 283#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
275#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ 284#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
276 285
286#define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */
287
277/* 288/*
278 * V I D E O I M A G E F O R M A T 289 * V I D E O I M A G E F O R M A T
279 */ 290 */
@@ -751,20 +762,20 @@ struct v4l2_crop {
751 762
752/* Selection targets */ 763/* Selection targets */
753 764
754/* current cropping area */ 765/* Current cropping area */
755#define V4L2_SEL_TGT_CROP_ACTIVE 0 766#define V4L2_SEL_TGT_CROP_ACTIVE 0x0000
756/* default cropping area */ 767/* Default cropping area */
757#define V4L2_SEL_TGT_CROP_DEFAULT 1 768#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
758/* cropping bounds */ 769/* Cropping bounds */
759#define V4L2_SEL_TGT_CROP_BOUNDS 2 770#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
760/* current composing area */ 771/* Current composing area */
761#define V4L2_SEL_TGT_COMPOSE_ACTIVE 256 772#define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100
762/* default composing area */ 773/* Default composing area */
763#define V4L2_SEL_TGT_COMPOSE_DEFAULT 257 774#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
764/* composing bounds */ 775/* Composing bounds */
765#define V4L2_SEL_TGT_COMPOSE_BOUNDS 258 776#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
766/* current composing area plus all padding pixels */ 777/* Current composing area plus all padding pixels */
767#define V4L2_SEL_TGT_COMPOSE_PADDED 259 778#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
768 779
769/** 780/**
770 * struct v4l2_selection - selection info 781 * struct v4l2_selection - selection info
@@ -774,7 +785,7 @@ struct v4l2_crop {
774 * @r: coordinates of selection window 785 * @r: coordinates of selection window
775 * @reserved: for future use, rounds structure size to 64 bytes, set to zero 786 * @reserved: for future use, rounds structure size to 64 bytes, set to zero
776 * 787 *
777 * Hardware may use multiple helper window to process a video stream. 788 * Hardware may use multiple helper windows to process a video stream.
778 * The structure is used to exchange this selection areas between 789 * The structure is used to exchange this selection areas between
779 * an application and a driver. 790 * an application and a driver.
780 */ 791 */
@@ -1125,6 +1136,7 @@ struct v4l2_ext_controls {
1125#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 1136#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
1126#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 1137#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1127#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ 1138#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1139#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
1128 1140
1129#define V4L2_CTRL_ID_MASK (0x0fffffff) 1141#define V4L2_CTRL_ID_MASK (0x0fffffff)
1130#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1142#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1396,6 +1408,16 @@ enum v4l2_mpeg_audio_ac3_bitrate {
1396 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, 1408 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
1397 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, 1409 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1398}; 1410};
1411#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
1412enum v4l2_mpeg_audio_dec_playback {
1413 V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
1414 V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
1415 V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
1416 V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
1417 V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
1418 V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
1419};
1420#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
1399 1421
1400/* MPEG video controls specific to multiplexed streams */ 1422/* MPEG video controls specific to multiplexed streams */
1401#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1423#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
@@ -1446,6 +1468,9 @@ enum v4l2_mpeg_video_multi_slice_mode {
1446 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, 1468 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
1447}; 1469};
1448#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) 1470#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
1471#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
1472#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
1473
1449#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) 1474#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
1450#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) 1475#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
1451#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) 1476#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
@@ -1734,6 +1759,29 @@ enum v4l2_flash_strobe_source {
1734#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) 1759#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
1735#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) 1760#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
1736 1761
1762/* JPEG-class control IDs defined by V4L2 */
1763#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
1764#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
1765
1766#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
1767enum v4l2_jpeg_chroma_subsampling {
1768 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
1769 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
1770 V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
1771 V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
1772 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
1773 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
1774};
1775#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
1776#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
1777
1778#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
1779#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
1780#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
1781#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
1782#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
1783#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
1784
1737/* 1785/*
1738 * T U N I N G 1786 * T U N I N G
1739 */ 1787 */
@@ -1897,6 +1945,54 @@ struct v4l2_encoder_cmd {
1897 }; 1945 };
1898}; 1946};
1899 1947
1948/* Decoder commands */
1949#define V4L2_DEC_CMD_START (0)
1950#define V4L2_DEC_CMD_STOP (1)
1951#define V4L2_DEC_CMD_PAUSE (2)
1952#define V4L2_DEC_CMD_RESUME (3)
1953
1954/* Flags for V4L2_DEC_CMD_START */
1955#define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0)
1956
1957/* Flags for V4L2_DEC_CMD_PAUSE */
1958#define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0)
1959
1960/* Flags for V4L2_DEC_CMD_STOP */
1961#define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0)
1962#define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1)
1963
1964/* Play format requirements (returned by the driver): */
1965
1966/* The decoder has no special format requirements */
1967#define V4L2_DEC_START_FMT_NONE (0)
1968/* The decoder requires full GOPs */
1969#define V4L2_DEC_START_FMT_GOP (1)
1970
1971/* The structure must be zeroed before use by the application
1972 This ensures it can be extended safely in the future. */
1973struct v4l2_decoder_cmd {
1974 __u32 cmd;
1975 __u32 flags;
1976 union {
1977 struct {
1978 __u64 pts;
1979 } stop;
1980
1981 struct {
1982 /* 0 or 1000 specifies normal speed,
1983 1 specifies forward single stepping,
1984 -1 specifies backward single stepping,
1985 >1: playback at speed/1000 of the normal speed,
1986 <-1: reverse playback at (-speed/1000) of the normal speed. */
1987 __s32 speed;
1988 __u32 format;
1989 } start;
1990
1991 struct {
1992 __u32 data[16];
1993 } raw;
1994 };
1995};
1900#endif 1996#endif
1901 1997
1902 1998
@@ -2307,6 +2403,11 @@ struct v4l2_create_buffers {
2307#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) 2403#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
2308#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) 2404#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
2309 2405
2406/* Experimental, these two ioctls may change over the next couple of kernel
2407 versions. */
2408#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
2409#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
2410
2310/* Reminder: when adding new ioctls please add support for them to 2411/* Reminder: when adding new ioctls please add support for them to
2311 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2412 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2312 2413
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index d0018d27c28..8efd28ae559 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/virtio_config.h b/include/linux/virtio_config.h
index 5206d6541da..7323a339020 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -53,6 +53,7 @@
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55#include <linux/err.h> 55#include <linux/err.h>
56#include <linux/bug.h>
56#include <linux/virtio.h> 57#include <linux/virtio.h>
57 58
58/** 59/**
diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h
index c5d8455c68c..7529b854b7f 100644
--- a/include/linux/virtio_ids.h
+++ b/include/linux/virtio_ids.h
@@ -34,6 +34,7 @@
34#define VIRTIO_ID_CONSOLE 3 /* virtio console */ 34#define VIRTIO_ID_CONSOLE 3 /* virtio console */
35#define VIRTIO_ID_RNG 4 /* virtio ring */ 35#define VIRTIO_ID_RNG 4 /* virtio ring */
36#define VIRTIO_ID_BALLOON 5 /* virtio balloon */ 36#define VIRTIO_ID_BALLOON 5 /* virtio balloon */
37#define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */
37#define VIRTIO_ID_SCSI 8 /* virtio scsi */ 38#define VIRTIO_ID_SCSI 8 /* virtio scsi */
38#define VIRTIO_ID_9P 9 /* 9p virtio console */ 39#define VIRTIO_ID_9P 9 /* 9p virtio console */
39 40
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 7d9a9e990ce..1dee81c41ff 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 43ba5b3ce2a..ac40716b44e 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/linux/wimax/debug.h b/include/linux/wimax/debug.h
index 57031b4d12f..aaf24ba12c4 100644
--- a/include/linux/wimax/debug.h
+++ b/include/linux/wimax/debug.h
@@ -154,9 +154,9 @@
154#define __debug__h__ 154#define __debug__h__
155 155
156#include <linux/types.h> 156#include <linux/types.h>
157#include <linux/device.h>
158#include <linux/slab.h> 157#include <linux/slab.h>
159 158
159struct device;
160 160
161/* Backend stuff */ 161/* Backend stuff */
162 162
diff --git a/include/media/adv7183.h b/include/media/adv7183.h
new file mode 100644
index 00000000000..c5c2d377c0a
--- /dev/null
+++ b/include/media/adv7183.h
@@ -0,0 +1,47 @@
1/*
2 * adv7183.h - definition for adv7183 inputs and outputs
3 *
4 * Copyright (c) 2011 Analog Devices Inc.
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 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef _ADV7183_H_
21#define _ADV7183_H_
22
23/* ADV7183 HW inputs */
24#define ADV7183_COMPOSITE0 0 /* CVBS in on AIN1 */
25#define ADV7183_COMPOSITE1 1 /* CVBS in on AIN2 */
26#define ADV7183_COMPOSITE2 2 /* CVBS in on AIN3 */
27#define ADV7183_COMPOSITE3 3 /* CVBS in on AIN4 */
28#define ADV7183_COMPOSITE4 4 /* CVBS in on AIN5 */
29#define ADV7183_COMPOSITE5 5 /* CVBS in on AIN6 */
30#define ADV7183_COMPOSITE6 6 /* CVBS in on AIN7 */
31#define ADV7183_COMPOSITE7 7 /* CVBS in on AIN8 */
32#define ADV7183_COMPOSITE8 8 /* CVBS in on AIN9 */
33#define ADV7183_COMPOSITE9 9 /* CVBS in on AIN10 */
34#define ADV7183_COMPOSITE10 10 /* CVBS in on AIN11 */
35
36#define ADV7183_SVIDEO0 11 /* Y on AIN1, C on AIN4 */
37#define ADV7183_SVIDEO1 12 /* Y on AIN2, C on AIN5 */
38#define ADV7183_SVIDEO2 13 /* Y on AIN3, C on AIN6 */
39
40#define ADV7183_COMPONENT0 14 /* Y on AIN1, Pr on AIN4, Pb on AIN5 */
41#define ADV7183_COMPONENT1 15 /* Y on AIN2, Pr on AIN3, Pb on AIN6 */
42
43/* ADV7183 HW outputs */
44#define ADV7183_8BIT_OUT 0
45#define ADV7183_16BIT_OUT 1
46
47#endif
diff --git a/include/media/blackfin/bfin_capture.h b/include/media/blackfin/bfin_capture.h
new file mode 100644
index 00000000000..2038a8a3f8a
--- /dev/null
+++ b/include/media/blackfin/bfin_capture.h
@@ -0,0 +1,37 @@
1#ifndef _BFIN_CAPTURE_H_
2#define _BFIN_CAPTURE_H_
3
4#include <linux/i2c.h>
5
6struct v4l2_input;
7struct ppi_info;
8
9struct bcap_route {
10 u32 input;
11 u32 output;
12};
13
14struct bfin_capture_config {
15 /* card name */
16 char *card_name;
17 /* inputs available at the sub device */
18 struct v4l2_input *inputs;
19 /* number of inputs supported */
20 int num_inputs;
21 /* routing information for each input */
22 struct bcap_route *routes;
23 /* i2c bus adapter no */
24 int i2c_adapter_id;
25 /* i2c subdevice board info */
26 struct i2c_board_info board_info;
27 /* ppi board info */
28 const struct ppi_info *ppi_info;
29 /* ppi control */
30 unsigned long ppi_control;
31 /* ppi interrupt mask */
32 u32 int_mask;
33 /* horizontal blanking clocks */
34 int blank_clocks;
35};
36
37#endif
diff --git a/include/media/blackfin/ppi.h b/include/media/blackfin/ppi.h
new file mode 100644
index 00000000000..8f72f8a0b3d
--- /dev/null
+++ b/include/media/blackfin/ppi.h
@@ -0,0 +1,74 @@
1/*
2 * Analog Devices PPI header file
3 *
4 * Copyright (c) 2011 Analog Devices Inc.
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 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef _PPI_H_
21#define _PPI_H_
22
23#include <linux/interrupt.h>
24
25#ifdef EPPI_EN
26#define PORT_EN EPPI_EN
27#define DMA32 0
28#define PACK_EN PACKEN
29#endif
30
31struct ppi_if;
32
33struct ppi_params {
34 int width;
35 int height;
36 int bpp;
37 unsigned long ppi_control;
38 u32 int_mask;
39 int blank_clocks;
40};
41
42struct ppi_ops {
43 int (*attach_irq)(struct ppi_if *ppi, irq_handler_t handler);
44 void (*detach_irq)(struct ppi_if *ppi);
45 int (*start)(struct ppi_if *ppi);
46 int (*stop)(struct ppi_if *ppi);
47 int (*set_params)(struct ppi_if *ppi, struct ppi_params *params);
48 void (*update_addr)(struct ppi_if *ppi, unsigned long addr);
49};
50
51enum ppi_type {
52 PPI_TYPE_PPI,
53 PPI_TYPE_EPPI,
54};
55
56struct ppi_info {
57 enum ppi_type type;
58 int dma_ch;
59 int irq_err;
60 void __iomem *base;
61 const unsigned short *pin_req;
62};
63
64struct ppi_if {
65 unsigned long ppi_control;
66 const struct ppi_ops *ops;
67 const struct ppi_info *info;
68 bool err_int;
69 void *priv;
70};
71
72struct ppi_if *ppi_create_instance(const struct ppi_info *info);
73void ppi_delete_instance(struct ppi_if *ppi);
74#endif
diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h
index 9929b05cff3..bd8217c2577 100644
--- a/include/media/davinci/vpif_types.h
+++ b/include/media/davinci/vpif_types.h
@@ -17,6 +17,8 @@
17#ifndef _VPIF_TYPES_H 17#ifndef _VPIF_TYPES_H
18#define _VPIF_TYPES_H 18#define _VPIF_TYPES_H
19 19
20#include <linux/i2c.h>
21
20#define VPIF_CAPTURE_MAX_CHANNELS 2 22#define VPIF_CAPTURE_MAX_CHANNELS 2
21 23
22enum vpif_if_type { 24enum vpif_if_type {
diff --git a/include/media/gpio-ir-recv.h b/include/media/gpio-ir-recv.h
new file mode 100644
index 00000000000..67797bf5d43
--- /dev/null
+++ b/include/media/gpio-ir-recv.h
@@ -0,0 +1,22 @@
1/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __GPIO_IR_RECV_H__
14#define __GPIO_IR_RECV_H__
15
16struct gpio_ir_recv_platform_data {
17 int gpio_nr;
18 bool active_low;
19};
20
21#endif /* __GPIO_IR_RECV_H__ */
22
diff --git a/include/media/media-device.h b/include/media/media-device.h
index 6a27d916c25..eaade9815bb 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -23,7 +23,6 @@
23#ifndef _MEDIA_DEVICE_H 23#ifndef _MEDIA_DEVICE_H
24#define _MEDIA_DEVICE_H 24#define _MEDIA_DEVICE_H
25 25
26#include <linux/device.h>
27#include <linux/list.h> 26#include <linux/list.h>
28#include <linux/mutex.h> 27#include <linux/mutex.h>
29#include <linux/spinlock.h> 28#include <linux/spinlock.h>
@@ -31,6 +30,8 @@
31#include <media/media-devnode.h> 30#include <media/media-devnode.h>
32#include <media/media-entity.h> 31#include <media/media-entity.h>
33 32
33struct device;
34
34/** 35/**
35 * struct media_device - Media device 36 * struct media_device - Media device
36 * @dev: Parent device 37 * @dev: Parent device
diff --git a/include/media/mt9m032.h b/include/media/mt9m032.h
new file mode 100644
index 00000000000..c3a78114d7a
--- /dev/null
+++ b/include/media/mt9m032.h
@@ -0,0 +1,36 @@
1/*
2 * Driver for MT9M032 CMOS Image Sensor from Micron
3 *
4 * Copyright (C) 2010-2011 Lund Engineering
5 * Contact: Gil Lund <gwlund@lundeng.com>
6 * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
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 MT9M032_H
25#define MT9M032_H
26
27#define MT9M032_NAME "mt9m032"
28#define MT9M032_I2C_ADDR (0xb8 >> 1)
29
30struct mt9m032_platform_data {
31 u32 ext_clock;
32 u32 pix_clock;
33 bool invert_pixclock;
34
35};
36#endif /* MT9M032_H */
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index f688bde6122..8db6741c125 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -102,8 +102,11 @@ void rc_map_init(void);
102#define RC_MAP_IMON_MCE "rc-imon-mce" 102#define RC_MAP_IMON_MCE "rc-imon-mce"
103#define RC_MAP_IMON_PAD "rc-imon-pad" 103#define RC_MAP_IMON_PAD "rc-imon-pad"
104#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e" 104#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e"
105#define RC_MAP_IT913X_V1 "rc-it913x-v1"
106#define RC_MAP_IT913X_V2 "rc-it913x-v2"
105#define RC_MAP_KAIOMY "rc-kaiomy" 107#define RC_MAP_KAIOMY "rc-kaiomy"
106#define RC_MAP_KWORLD_315U "rc-kworld-315u" 108#define RC_MAP_KWORLD_315U "rc-kworld-315u"
109#define RC_MAP_KWORLD_PC150U "rc-kworld-pc150u"
107#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" 110#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog"
108#define RC_MAP_LEADTEK_Y04G0051 "rc-leadtek-y04g0051" 111#define RC_MAP_LEADTEK_Y04G0051 "rc-leadtek-y04g0051"
109#define RC_MAP_LIRC "rc-lirc" 112#define RC_MAP_LIRC "rc-lirc"
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
new file mode 100644
index 00000000000..361a751f73a
--- /dev/null
+++ b/include/media/s5p_hdmi.h
@@ -0,0 +1,35 @@
1/*
2 * Driver header for S5P HDMI chip.
3 *
4 * Copyright (c) 2011 Samsung Electronics, Co. Ltd
5 * Contact: Tomasz Stanislawski <t.stanislaws@samsung.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
13#ifndef S5P_HDMI_H
14#define S5P_HDMI_H
15
16struct i2c_board_info;
17
18/**
19 * @hdmiphy_bus: controller id for HDMIPHY bus
20 * @hdmiphy_info: template for HDMIPHY I2C device
21 * @mhl_bus: controller id for MHL control bus
22 * @mhl_info: template for MHL I2C device
23 *
24 * NULL pointer for *_info fields indicates that
25 * the corresponding chip is not present
26 */
27struct s5p_hdmi_platform_data {
28 int hdmiphy_bus;
29 struct i2c_board_info *hdmiphy_info;
30 int mhl_bus;
31 struct i2c_board_info *mhl_info;
32};
33
34#endif /* S5P_HDMI_H */
35
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 48413b410f1..a90a765f18d 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -18,6 +18,8 @@ struct sh_mobile_ceu_companion {
18 18
19struct sh_mobile_ceu_info { 19struct sh_mobile_ceu_info {
20 unsigned long flags; 20 unsigned long flags;
21 int max_width;
22 int max_height;
21 struct sh_mobile_ceu_companion *csi2; 23 struct sh_mobile_ceu_companion *csi2;
22}; 24};
23 25
diff --git a/include/media/sii9234.h b/include/media/sii9234.h
new file mode 100644
index 00000000000..6a4a809fe9a
--- /dev/null
+++ b/include/media/sii9234.h
@@ -0,0 +1,24 @@
1/*
2 * Driver header for SII9234 MHL converter chip.
3 *
4 * Copyright (c) 2011 Samsung Electronics, Co. Ltd
5 * Contact: Tomasz Stanislawski <t.stanislaws@samsung.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
13#ifndef SII9234_H
14#define SII9234_H
15
16/**
17 * @gpio_n_reset: GPIO driving nRESET pin
18 */
19
20struct sii9234_platform_data {
21 int gpio_n_reset;
22};
23
24#endif /* SII9234_H */
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 29e1920e733..926aff9bdf6 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -136,6 +136,7 @@
136#define TUNER_TENA_TNF_5337 86 136#define TUNER_TENA_TNF_5337 86
137 137
138#define TUNER_XC4000 87 /* Xceive Silicon Tuner */ 138#define TUNER_XC4000 87 /* Xceive Silicon Tuner */
139#define TUNER_XC5000C 88 /* Xceive Silicon Tuner */
139 140
140/* tv card specific */ 141/* tv card specific */
141#define TDA9887_PRESENT (1<<0) 142#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 810a20928a2..7395c815939 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -143,6 +143,9 @@ enum {
143 /* module saa6588: just ident 6588 */ 143 /* module saa6588: just ident 6588 */
144 V4L2_IDENT_SAA6588 = 6588, 144 V4L2_IDENT_SAA6588 = 6588,
145 145
146 /* module vs6624: just ident 6624 */
147 V4L2_IDENT_VS6624 = 6624,
148
146 /* module saa6752hs: reserved range 6750-6759 */ 149 /* module saa6752hs: reserved range 6750-6759 */
147 V4L2_IDENT_SAA6752HS = 6752, 150 V4L2_IDENT_SAA6752HS = 6752,
148 V4L2_IDENT_SAA6752HS_AC3 = 6753, 151 V4L2_IDENT_SAA6752HS_AC3 = 6753,
@@ -162,6 +165,9 @@ enum {
162 /* module adv7180: just ident 7180 */ 165 /* module adv7180: just ident 7180 */
163 V4L2_IDENT_ADV7180 = 7180, 166 V4L2_IDENT_ADV7180 = 7180,
164 167
168 /* module adv7183: just ident 7183 */
169 V4L2_IDENT_ADV7183 = 7183,
170
165 /* module saa7185: just ident 7185 */ 171 /* module saa7185: just ident 7185 */
166 V4L2_IDENT_SAA7185 = 7185, 172 V4L2_IDENT_SAA7185 = 7185,
167 173
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index eeb3df63714..11e67562b3a 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -22,7 +22,6 @@
22#define _V4L2_CTRLS_H 22#define _V4L2_CTRLS_H
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/device.h>
26#include <linux/videodev2.h> 25#include <linux/videodev2.h>
27 26
28/* forward references */ 27/* forward references */
@@ -33,6 +32,7 @@ struct video_device;
33struct v4l2_subdev; 32struct v4l2_subdev;
34struct v4l2_subscribed_event; 33struct v4l2_subscribed_event;
35struct v4l2_fh; 34struct v4l2_fh;
35struct poll_table_struct;
36 36
37/** struct v4l2_ctrl_ops - The control operations that the driver has to provide. 37/** struct v4l2_ctrl_ops - The control operations that the driver has to provide.
38 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant 38 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
@@ -492,6 +492,18 @@ void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
492void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl, 492void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl,
493 struct v4l2_subscribed_event *sev); 493 struct v4l2_subscribed_event *sev);
494 494
495/* Can be used as a vidioc_log_status function that just dumps all controls
496 associated with the filehandle. */
497int v4l2_ctrl_log_status(struct file *file, void *fh);
498
499/* Can be used as a vidioc_subscribe_event function that just subscribes
500 control events. */
501int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
502 struct v4l2_event_subscription *sub);
503
504/* Can be used as a poll function that just polls for control events. */
505unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
506
495/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ 507/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
496int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); 508int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
497int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); 509int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index c7c40f1d262..96d22215cc8 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -62,6 +62,9 @@ struct v4l2_file_operations {
62 unsigned int (*poll) (struct file *, struct poll_table_struct *); 62 unsigned int (*poll) (struct file *, struct poll_table_struct *);
63 long (*ioctl) (struct file *, unsigned int, unsigned long); 63 long (*ioctl) (struct file *, unsigned int, unsigned long);
64 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 64 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
65#ifdef CONFIG_COMPAT
66 long (*compat_ioctl32) (struct file *, unsigned int, unsigned long);
67#endif
65 unsigned long (*get_unmapped_area) (struct file *, unsigned long, 68 unsigned long (*get_unmapped_area) (struct file *, unsigned long,
66 unsigned long, unsigned long, unsigned long); 69 unsigned long, unsigned long, unsigned long);
67 int (*mmap) (struct file *, struct vm_area_struct *); 70 int (*mmap) (struct file *, struct vm_area_struct *);
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 3f5d60fc5df..3cb939cd03f 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -11,7 +11,6 @@
11 11
12#include <linux/poll.h> 12#include <linux/poll.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/device.h>
15#include <linux/mutex.h> 14#include <linux/mutex.h>
16#include <linux/compiler.h> /* need __user */ 15#include <linux/compiler.h> /* need __user */
17#include <linux/videodev2.h> 16#include <linux/videodev2.h>
@@ -211,6 +210,10 @@ struct v4l2_ioctl_ops {
211 struct v4l2_encoder_cmd *a); 210 struct v4l2_encoder_cmd *a);
212 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, 211 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
213 struct v4l2_encoder_cmd *a); 212 struct v4l2_encoder_cmd *a);
213 int (*vidioc_decoder_cmd) (struct file *file, void *fh,
214 struct v4l2_decoder_cmd *a);
215 int (*vidioc_try_decoder_cmd) (struct file *file, void *fh,
216 struct v4l2_decoder_cmd *a);
214 217
215 /* Stream type-dependent parameter ioctls */ 218 /* Stream type-dependent parameter ioctls */
216 int (*vidioc_g_parm) (struct file *file, void *fh, 219 int (*vidioc_g_parm) (struct file *file, void *fh,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 69b7ad3a992..248fb05feb6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -13,6 +13,7 @@
13#include <linux/netdevice.h> 13#include <linux/netdevice.h>
14#include <linux/debugfs.h> 14#include <linux/debugfs.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/bug.h>
16#include <linux/netlink.h> 17#include <linux/netlink.h>
17#include <linux/skbuff.h> 18#include <linux/skbuff.h>
18#include <linux/nl80211.h> 19#include <linux/nl80211.h>
diff --git a/include/net/dst.h b/include/net/dst.h
index 344c8dd0287..59c5d18cc38 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -12,6 +12,7 @@
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15#include <linux/bug.h>
15#include <linux/jiffies.h> 16#include <linux/jiffies.h>
16#include <net/neighbour.h> 17#include <net/neighbour.h>
17#include <asm/processor.h> 18#include <asm/processor.h>
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ebe517f2da9..2bdee51ba30 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -16,6 +16,7 @@
16#include <linux/atomic.h> /* for struct atomic_t */ 16#include <linux/atomic.h> /* for struct atomic_t */
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/bug.h>
19 20
20#include <net/checksum.h> 21#include <net/checksum.h>
21#include <linux/netfilter.h> /* for union nf_inet_addr */ 22#include <linux/netfilter.h> /* for union nf_inet_addr */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 9a012be615f..87d203ff7a8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -13,10 +13,10 @@
13#ifndef MAC80211_H 13#ifndef MAC80211_H
14#define MAC80211_H 14#define MAC80211_H
15 15
16#include <linux/bug.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/if_ether.h> 18#include <linux/if_ether.h>
18#include <linux/skbuff.h> 19#include <linux/skbuff.h>
19#include <linux/device.h>
20#include <linux/ieee80211.h> 20#include <linux/ieee80211.h>
21#include <net/cfg80211.h> 21#include <net/cfg80211.h>
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
@@ -87,6 +87,8 @@
87 * 87 *
88 */ 88 */
89 89
90struct device;
91
90/** 92/**
91 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
92 * 94 *
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 90c67c7db7e..3b572bb20aa 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -118,6 +118,10 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
118extern struct nf_conntrack_l4proto * 118extern struct nf_conntrack_l4proto *
119__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 119__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
120 120
121extern struct nf_conntrack_l4proto *
122nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto);
123extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
124
121/* Protocol registration. */ 125/* Protocol registration. */
122extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); 126extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
123extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); 127extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index 0e04db4a086..34ec89f8dbf 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -15,7 +15,7 @@ struct ctnl_timeout {
15 atomic_t refcnt; 15 atomic_t refcnt;
16 char name[CTNL_TIMEOUT_NAME_MAX]; 16 char name[CTNL_TIMEOUT_NAME_MAX];
17 __u16 l3num; 17 __u16 l3num;
18 __u8 l4num; 18 struct nf_conntrack_l4proto *l4proto;
19 char data[0]; 19 char data[0];
20}; 20};
21 21
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index d55f4344333..0931618c0f7 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -5,6 +5,7 @@
5#ifndef __NET_GENERIC_H__ 5#ifndef __NET_GENERIC_H__
6#define __NET_GENERIC_H__ 6#define __NET_GENERIC_H__
7 7
8#include <linux/bug.h>
8#include <linux/rcupdate.h> 9#include <linux/rcupdate.h>
9 10
10/* 11/*
diff --git a/include/net/red.h b/include/net/red.h
index 28068ec614b..77d4c3745cb 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -2,6 +2,7 @@
2#define __NET_SCHED_RED_H 2#define __NET_SCHED_RED_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/bug.h>
5#include <net/pkt_sched.h> 6#include <net/pkt_sched.h>
6#include <net/inet_ecn.h> 7#include <net/inet_ecn.h>
7#include <net/dsfield.h> 8#include <net/dsfield.h>
diff --git a/include/net/sock.h b/include/net/sock.h
index 04bc0b30e9e..a6ba1f8871f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1854,7 +1854,7 @@ static inline bool wq_has_sleeper(struct socket_wq *wq)
1854static inline void sock_poll_wait(struct file *filp, 1854static inline void sock_poll_wait(struct file *filp,
1855 wait_queue_head_t *wait_address, poll_table *p) 1855 wait_queue_head_t *wait_address, poll_table *p)
1856{ 1856{
1857 if (p && wait_address) { 1857 if (!poll_does_not_wait(p) && wait_address) {
1858 poll_wait(filp, wait_address, p); 1858 poll_wait(filp, wait_address, p);
1859 /* 1859 /*
1860 * We need to be sure we are in sync with the 1860 * We need to be sure we are in sync with the
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 8607e6aad42..f75a04d752c 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/tcp.h> 24#include <linux/tcp.h>
25#include <linux/bug.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
26#include <linux/cache.h> 27#include <linux/cache.h>
27#include <linux/percpu.h> 28#include <linux/percpu.h>
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
index 053b3cf2c66..8d6689cb2c6 100644
--- a/include/net/timewait_sock.h
+++ b/include/net/timewait_sock.h
@@ -12,6 +12,7 @@
12#define _TIMEWAIT_SOCK_H 12#define _TIMEWAIT_SOCK_H
13 13
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/bug.h>
15#include <net/sock.h> 16#include <net/sock.h>
16 17
17struct timewait_sock_ops { 18struct timewait_sock_ops {
diff --git a/include/net/udp.h b/include/net/udp.h
index e39592f682c..5d606d9da9e 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -23,6 +23,7 @@
23#define _UDP_H 23#define _UDP_H
24 24
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/bug.h>
26#include <net/inet_sock.h> 27#include <net/inet_sock.h>
27#include <net/sock.h> 28#include <net/sock.h>
28#include <net/snmp.h> 29#include <net/snmp.h>
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index d86fffd3c03..ff27f1b078d 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/netdevice.h> 24#include <linux/netdevice.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/bug.h>
26 27
27struct wpan_phy { 28struct wpan_phy {
28 struct mutex pib_lock; 29 struct mutex pib_lock;
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 9c23ee8fd2d..917741bb8e1 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 5a35a2a2d3c..cfdb55f0937 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/scsi/osd_ore.h b/include/scsi/osd_ore.h
index f05fa826f89..a5f9b960dfc 100644
--- a/include/scsi/osd_ore.h
+++ b/include/scsi/osd_ore.h
@@ -26,6 +26,7 @@
26#include <scsi/osd_attributes.h> 26#include <scsi/osd_attributes.h>
27#include <scsi/osd_sec.h> 27#include <scsi/osd_sec.h>
28#include <linux/pnfs_osd_xdr.h> 28#include <linux/pnfs_osd_xdr.h>
29#include <linux/bug.h>
29 30
30struct ore_comp { 31struct ore_comp {
31 struct osd_obj_id obj; 32 struct osd_obj_id obj;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index b3a1c2daf6c..6efb2e1416e 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -1,7 +1,6 @@
1#ifndef _SCSI_SCSI_DEVICE_H 1#ifndef _SCSI_SCSI_DEVICE_H
2#define _SCSI_SCSI_DEVICE_H 2#define _SCSI_SCSI_DEVICE_H
3 3
4#include <linux/device.h>
5#include <linux/list.h> 4#include <linux/list.h>
6#include <linux/spinlock.h> 5#include <linux/spinlock.h>
7#include <linux/workqueue.h> 6#include <linux/workqueue.h>
@@ -9,6 +8,7 @@
9#include <scsi/scsi.h> 8#include <scsi/scsi.h>
10#include <linux/atomic.h> 9#include <linux/atomic.h>
11 10
11struct device;
12struct request_queue; 12struct request_queue;
13struct scsi_cmnd; 13struct scsi_cmnd;
14struct scsi_lun; 14struct scsi_lun;
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 58ce8fe4478..5cb20ccb195 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -23,7 +23,7 @@
23#define SCSI_NETLINK_H 23#define SCSI_NETLINK_H
24 24
25#include <linux/netlink.h> 25#include <linux/netlink.h>
26 26#include <linux/types.h>
27 27
28/* 28/*
29 * This file intended to be included by both kernel and user space 29 * This file intended to be included by both kernel and user space
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index 0de32cd4e8a..af244f4bba5 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/transport_class.h> 23#include <linux/transport_class.h>
24#include <linux/blkdev.h> 24#include <linux/blkdev.h>
25#include <linux/bug.h>
25#include <scsi/scsi_host.h> 26#include <scsi/scsi_host.h>
26#include <scsi/scsi_device.h> 27#include <scsi/scsi_device.h>
27 28
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h
index d97d69f81a7..da4a456de03 100644
--- a/include/sound/compress_params.h
+++ b/include/sound/compress_params.h
@@ -51,6 +51,8 @@
51#ifndef __SND_COMPRESS_PARAMS_H 51#ifndef __SND_COMPRESS_PARAMS_H
52#define __SND_COMPRESS_PARAMS_H 52#define __SND_COMPRESS_PARAMS_H
53 53
54#include <linux/types.h>
55
54/* AUDIO CODECS SUPPORTED */ 56/* AUDIO CODECS SUPPORTED */
55#define MAX_NUM_CODECS 32 57#define MAX_NUM_CODECS 32
56#define MAX_NUM_CODEC_DESCRIPTORS 32 58#define MAX_NUM_CODEC_DESCRIPTORS 32
diff --git a/include/sound/core.h b/include/sound/core.h
index cea1b5426df..b6e0f57d451 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -26,7 +26,6 @@
26#include <linux/mutex.h> /* struct mutex */ 26#include <linux/mutex.h> /* struct mutex */
27#include <linux/rwsem.h> /* struct rw_semaphore */ 27#include <linux/rwsem.h> /* struct rw_semaphore */
28#include <linux/pm.h> /* pm_message_t */ 28#include <linux/pm.h> /* pm_message_t */
29#include <linux/device.h>
30#include <linux/stringify.h> 29#include <linux/stringify.h>
31 30
32/* number of supported soundcards */ 31/* number of supported soundcards */
@@ -39,10 +38,10 @@
39#define CONFIG_SND_MAJOR 116 /* standard configuration */ 38#define CONFIG_SND_MAJOR 116 /* standard configuration */
40 39
41/* forward declarations */ 40/* forward declarations */
42#ifdef CONFIG_PCI
43struct pci_dev; 41struct pci_dev;
44#endif
45struct module; 42struct module;
43struct device;
44struct device_attribute;
46 45
47/* device allocation stuff */ 46/* device allocation stuff */
48 47
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index e46107fffeb..8da3c240906 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -13,10 +13,11 @@
13#ifndef __LINUX_SND_SOC_DAPM_H 13#ifndef __LINUX_SND_SOC_DAPM_H
14#define __LINUX_SND_SOC_DAPM_H 14#define __LINUX_SND_SOC_DAPM_H
15 15
16#include <linux/device.h>
17#include <linux/types.h> 16#include <linux/types.h>
18#include <sound/control.h> 17#include <sound/control.h>
19 18
19struct device;
20
20/* widget has no PM register bit */ 21/* widget has no PM register bit */
21#define SND_SOC_NOPM -1 22#define SND_SOC_NOPM -1
22 23
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index 726e94742a5..ec3f910aa40 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -25,6 +25,7 @@
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <media/v4l2-ctrls.h> 26#include <media/v4l2-ctrls.h>
27#include <media/v4l2-dev.h> 27#include <media/v4l2-dev.h>
28#include <media/v4l2-device.h>
28 29
29#define TEA575X_FMIF 10700 30#define TEA575X_FMIF 10700
30 31
@@ -42,13 +43,16 @@ struct snd_tea575x_ops {
42}; 43};
43 44
44struct snd_tea575x { 45struct snd_tea575x {
46 struct v4l2_device *v4l2_dev;
45 struct video_device vd; /* video device */ 47 struct video_device vd; /* video device */
48 int radio_nr; /* radio_nr */
46 bool tea5759; /* 5759 chip is present */ 49 bool tea5759; /* 5759 chip is present */
50 bool cannot_read_data; /* Device cannot read the data pin */
47 bool mute; /* Device is muted? */ 51 bool mute; /* Device is muted? */
48 bool stereo; /* receiving stereo */ 52 bool stereo; /* receiving stereo */
49 bool tuned; /* tuned to a station */ 53 bool tuned; /* tuned to a station */
50 unsigned int val; /* hw value */ 54 unsigned int val; /* hw value */
51 unsigned long freq; /* frequency */ 55 u32 freq; /* frequency */
52 struct mutex mutex; 56 struct mutex mutex;
53 struct snd_tea575x_ops *ops; 57 struct snd_tea575x_ops *ops;
54 void *private_data; 58 void *private_data;
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 84f3001a568..91b91e80567 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 75964412ddb..127993dbf32 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/regmap.h b/include/trace/events/regmap.h
index 12fbf43524e..41a7dbd570e 100644
--- a/include/trace/events/regmap.h
+++ b/include/trace/events/regmap.h
@@ -4,10 +4,10 @@
4#if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ) 4#if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_REGMAP_H 5#define _TRACE_REGMAP_H
6 6
7#include <linux/device.h>
8#include <linux/ktime.h> 7#include <linux/ktime.h>
9#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
10 9
10struct device;
11struct regmap; 11struct regmap;
12 12
13/* 13/*
@@ -139,6 +139,42 @@ TRACE_EVENT(regcache_sync,
139 __get_str(type), __get_str(status)) 139 __get_str(type), __get_str(status))
140); 140);
141 141
142DECLARE_EVENT_CLASS(regmap_bool,
143
144 TP_PROTO(struct device *dev, bool flag),
145
146 TP_ARGS(dev, flag),
147
148 TP_STRUCT__entry(
149 __string( name, dev_name(dev) )
150 __field( int, flag )
151 ),
152
153 TP_fast_assign(
154 __assign_str(name, dev_name(dev));
155 __entry->flag = flag;
156 ),
157
158 TP_printk("%s flag=%d", __get_str(name),
159 (int)__entry->flag)
160);
161
162DEFINE_EVENT(regmap_bool, regmap_cache_only,
163
164 TP_PROTO(struct device *dev, bool flag),
165
166 TP_ARGS(dev, flag)
167
168);
169
170DEFINE_EVENT(regmap_bool, regmap_cache_bypass,
171
172 TP_PROTO(struct device *dev, bool flag),
173
174 TP_ARGS(dev, flag)
175
176);
177
142#endif /* _TRACE_REGMAP_H */ 178#endif /* _TRACE_REGMAP_H */
143 179
144/* This part must be outside protection */ 180/* This part must be outside protection */
diff --git a/include/trace/events/rpm.h b/include/trace/events/rpm.h
index d62c558bf64..33f85b68c22 100644
--- a/include/trace/events/rpm.h
+++ b/include/trace/events/rpm.h
@@ -7,7 +7,8 @@
7 7
8#include <linux/ktime.h> 8#include <linux/ktime.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10#include <linux/device.h> 10
11struct device;
11 12
12/* 13/*
13 * The rpm_internal events are used for tracing some important 14 * The rpm_internal events are used for tracing some important
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
new file mode 100644
index 00000000000..43be87d5dd5
--- /dev/null
+++ b/include/trace/events/sunrpc.h
@@ -0,0 +1,177 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM sunrpc
3
4#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SUNRPC_H
6
7#include <linux/sunrpc/sched.h>
8#include <linux/sunrpc/clnt.h>
9#include <linux/tracepoint.h>
10
11DECLARE_EVENT_CLASS(rpc_task_status,
12
13 TP_PROTO(struct rpc_task *task),
14
15 TP_ARGS(task),
16
17 TP_STRUCT__entry(
18 __field(const struct rpc_task *, task)
19 __field(const struct rpc_clnt *, clnt)
20 __field(int, status)
21 ),
22
23 TP_fast_assign(
24 __entry->task = task;
25 __entry->clnt = task->tk_client;
26 __entry->status = task->tk_status;
27 ),
28
29 TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status)
30);
31
32DEFINE_EVENT(rpc_task_status, rpc_call_status,
33 TP_PROTO(struct rpc_task *task),
34
35 TP_ARGS(task)
36);
37
38DEFINE_EVENT(rpc_task_status, rpc_bind_status,
39 TP_PROTO(struct rpc_task *task),
40
41 TP_ARGS(task)
42);
43
44TRACE_EVENT(rpc_connect_status,
45 TP_PROTO(struct rpc_task *task, int status),
46
47 TP_ARGS(task, status),
48
49 TP_STRUCT__entry(
50 __field(const struct rpc_task *, task)
51 __field(const struct rpc_clnt *, clnt)
52 __field(int, status)
53 ),
54
55 TP_fast_assign(
56 __entry->task = task;
57 __entry->clnt = task->tk_client;
58 __entry->status = status;
59 ),
60
61 TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status)
62);
63
64DECLARE_EVENT_CLASS(rpc_task_running,
65
66 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
67
68 TP_ARGS(clnt, task, action),
69
70 TP_STRUCT__entry(
71 __field(const struct rpc_clnt *, clnt)
72 __field(const struct rpc_task *, task)
73 __field(const void *, action)
74 __field(unsigned long, runstate)
75 __field(int, status)
76 __field(unsigned short, flags)
77 ),
78
79 TP_fast_assign(
80 __entry->clnt = clnt;
81 __entry->task = task;
82 __entry->action = action;
83 __entry->runstate = task->tk_runstate;
84 __entry->status = task->tk_status;
85 __entry->flags = task->tk_flags;
86 ),
87
88 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d action=%pf",
89 __entry->task,
90 __entry->clnt,
91 __entry->flags,
92 __entry->runstate,
93 __entry->status,
94 __entry->action
95 )
96);
97
98DEFINE_EVENT(rpc_task_running, rpc_task_begin,
99
100 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
101
102 TP_ARGS(clnt, task, action)
103
104);
105
106DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
107
108 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
109
110 TP_ARGS(clnt, task, action)
111
112);
113
114DEFINE_EVENT(rpc_task_running, rpc_task_complete,
115
116 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
117
118 TP_ARGS(clnt, task, action)
119
120);
121
122DECLARE_EVENT_CLASS(rpc_task_queued,
123
124 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
125
126 TP_ARGS(clnt, task, q),
127
128 TP_STRUCT__entry(
129 __field(const struct rpc_clnt *, clnt)
130 __field(const struct rpc_task *, task)
131 __field(unsigned long, timeout)
132 __field(unsigned long, runstate)
133 __field(int, status)
134 __field(unsigned short, flags)
135 __string(q_name, rpc_qname(q))
136 ),
137
138 TP_fast_assign(
139 __entry->clnt = clnt;
140 __entry->task = task;
141 __entry->timeout = task->tk_timeout;
142 __entry->runstate = task->tk_runstate;
143 __entry->status = task->tk_status;
144 __entry->flags = task->tk_flags;
145 __assign_str(q_name, rpc_qname(q));
146 ),
147
148 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
149 __entry->task,
150 __entry->clnt,
151 __entry->flags,
152 __entry->runstate,
153 __entry->status,
154 __entry->timeout,
155 __get_str(q_name)
156 )
157);
158
159DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
160
161 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
162
163 TP_ARGS(clnt, task, q)
164
165);
166
167DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
168
169 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
170
171 TP_ARGS(clnt, task, q)
172
173);
174
175#endif /* _TRACE_SUNRPC_H */
176
177#include <trace/define_trace.h>
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 5973410e8f8..7b81887b023 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -5,7 +5,6 @@
5#define _TRACE_WRITEBACK_H 5#define _TRACE_WRITEBACK_H
6 6
7#include <linux/backing-dev.h> 7#include <linux/backing-dev.h>
8#include <linux/device.h>
9#include <linux/writeback.h> 8#include <linux/writeback.h>
10 9
11#define show_inode_state(state) \ 10#define show_inode_state(state) \
diff --git a/include/video/exynos_dp.h b/include/video/exynos_dp.h
new file mode 100644
index 00000000000..8847a9d6dd4
--- /dev/null
+++ b/include/video/exynos_dp.h
@@ -0,0 +1,131 @@
1/*
2 * Samsung SoC DP device support
3 *
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd.
5 * Author: Jingoo Han <jg1.han@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _EXYNOS_DP_H
13#define _EXYNOS_DP_H
14
15#define DP_TIMEOUT_LOOP_COUNT 100
16#define MAX_CR_LOOP 5
17#define MAX_EQ_LOOP 4
18
19enum link_rate_type {
20 LINK_RATE_1_62GBPS = 0x06,
21 LINK_RATE_2_70GBPS = 0x0a
22};
23
24enum link_lane_count_type {
25 LANE_COUNT1 = 1,
26 LANE_COUNT2 = 2,
27 LANE_COUNT4 = 4
28};
29
30enum link_training_state {
31 START,
32 CLOCK_RECOVERY,
33 EQUALIZER_TRAINING,
34 FINISHED,
35 FAILED
36};
37
38enum voltage_swing_level {
39 VOLTAGE_LEVEL_0,
40 VOLTAGE_LEVEL_1,
41 VOLTAGE_LEVEL_2,
42 VOLTAGE_LEVEL_3,
43};
44
45enum pre_emphasis_level {
46 PRE_EMPHASIS_LEVEL_0,
47 PRE_EMPHASIS_LEVEL_1,
48 PRE_EMPHASIS_LEVEL_2,
49 PRE_EMPHASIS_LEVEL_3,
50};
51
52enum pattern_set {
53 PRBS7,
54 D10_2,
55 TRAINING_PTN1,
56 TRAINING_PTN2,
57 DP_NONE
58};
59
60enum color_space {
61 COLOR_RGB,
62 COLOR_YCBCR422,
63 COLOR_YCBCR444
64};
65
66enum color_depth {
67 COLOR_6,
68 COLOR_8,
69 COLOR_10,
70 COLOR_12
71};
72
73enum color_coefficient {
74 COLOR_YCBCR601,
75 COLOR_YCBCR709
76};
77
78enum dynamic_range {
79 VESA,
80 CEA
81};
82
83enum pll_status {
84 PLL_UNLOCKED,
85 PLL_LOCKED
86};
87
88enum clock_recovery_m_value_type {
89 CALCULATED_M,
90 REGISTER_M
91};
92
93enum video_timing_recognition_type {
94 VIDEO_TIMING_FROM_CAPTURE,
95 VIDEO_TIMING_FROM_REGISTER
96};
97
98enum analog_power_block {
99 AUX_BLOCK,
100 CH0_BLOCK,
101 CH1_BLOCK,
102 CH2_BLOCK,
103 CH3_BLOCK,
104 ANALOG_TOTAL,
105 POWER_ALL
106};
107
108struct video_info {
109 char *name;
110
111 bool h_sync_polarity;
112 bool v_sync_polarity;
113 bool interlaced;
114
115 enum color_space color_space;
116 enum dynamic_range dynamic_range;
117 enum color_coefficient ycbcr_coeff;
118 enum color_depth color_depth;
119
120 enum link_rate_type link_rate;
121 enum link_lane_count_type lane_count;
122};
123
124struct exynos_dp_platdata {
125 struct video_info *video_info;
126
127 void (*phy_init)(void);
128 void (*phy_exit)(void);
129};
130
131#endif /* _EXYNOS_DP_H */
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h
new file mode 100644
index 00000000000..772c770535f
--- /dev/null
+++ b/include/video/exynos_mipi_dsim.h
@@ -0,0 +1,359 @@
1/* include/video/exynos_mipi_dsim.h
2 *
3 * Platform data header for Samsung SoC MIPI-DSIM.
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd
6 *
7 * InKi Dae <inki.dae@samsung.com>
8 * Donghwa Lee <dh09.lee@samsung.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef _EXYNOS_MIPI_DSIM_H
16#define _EXYNOS_MIPI_DSIM_H
17
18#include <linux/device.h>
19#include <linux/fb.h>
20
21#define PANEL_NAME_SIZE (32)
22
23/*
24 * Enumerate display interface type.
25 *
26 * DSIM_COMMAND means cpu interface and rgb interface for DSIM_VIDEO.
27 *
28 * P.S. MIPI DSI Master has two display controller intefaces, RGB Interface
29 * for main display and CPU Interface(same as I80 Interface) for main
30 * and sub display.
31 */
32enum mipi_dsim_interface_type {
33 DSIM_COMMAND,
34 DSIM_VIDEO
35};
36
37enum mipi_dsim_virtual_ch_no {
38 DSIM_VIRTUAL_CH_0,
39 DSIM_VIRTUAL_CH_1,
40 DSIM_VIRTUAL_CH_2,
41 DSIM_VIRTUAL_CH_3
42};
43
44enum mipi_dsim_burst_mode_type {
45 DSIM_NON_BURST_SYNC_EVENT,
46 DSIM_BURST_SYNC_EVENT,
47 DSIM_NON_BURST_SYNC_PULSE,
48 DSIM_BURST,
49 DSIM_NON_VIDEO_MODE
50};
51
52enum mipi_dsim_no_of_data_lane {
53 DSIM_DATA_LANE_1,
54 DSIM_DATA_LANE_2,
55 DSIM_DATA_LANE_3,
56 DSIM_DATA_LANE_4
57};
58
59enum mipi_dsim_byte_clk_src {
60 DSIM_PLL_OUT_DIV8,
61 DSIM_EXT_CLK_DIV8,
62 DSIM_EXT_CLK_BYPASS
63};
64
65enum mipi_dsim_pixel_format {
66 DSIM_CMD_3BPP,
67 DSIM_CMD_8BPP,
68 DSIM_CMD_12BPP,
69 DSIM_CMD_16BPP,
70 DSIM_VID_16BPP_565,
71 DSIM_VID_18BPP_666PACKED,
72 DSIM_18BPP_666LOOSELYPACKED,
73 DSIM_24BPP_888
74};
75
76/*
77 * struct mipi_dsim_config - interface for configuring mipi-dsi controller.
78 *
79 * @auto_flush: enable or disable Auto flush of MD FIFO using VSYNC pulse.
80 * @eot_disable: enable or disable EoT packet in HS mode.
81 * @auto_vertical_cnt: specifies auto vertical count mode.
82 * in Video mode, the vertical line transition uses line counter
83 * configured by VSA, VBP, and Vertical resolution.
84 * If this bit is set to '1', the line counter does not use VSA and VBP
85 * registers.(in command mode, this variable is ignored)
86 * @hse: set horizontal sync event mode.
87 * In VSYNC pulse and Vporch area, MIPI DSI master transfers only HSYNC
88 * start packet to MIPI DSI slave at MIPI DSI spec1.1r02.
89 * this bit transfers HSYNC end packet in VSYNC pulse and Vporch area
90 * (in mommand mode, this variable is ignored)
91 * @hfp: specifies HFP disable mode.
92 * if this variable is set, DSI master ignores HFP area in VIDEO mode.
93 * (in command mode, this variable is ignored)
94 * @hbp: specifies HBP disable mode.
95 * if this variable is set, DSI master ignores HBP area in VIDEO mode.
96 * (in command mode, this variable is ignored)
97 * @hsa: specifies HSA disable mode.
98 * if this variable is set, DSI master ignores HSA area in VIDEO mode.
99 * (in command mode, this variable is ignored)
100 * @cma_allow: specifies the number of horizontal lines, where command packet
101 * transmission is allowed after Stable VFP period.
102 * @e_interface: specifies interface to be used.(CPU or RGB interface)
103 * @e_virtual_ch: specifies virtual channel number that main or
104 * sub diaplsy uses.
105 * @e_pixel_format: specifies pixel stream format for main or sub display.
106 * @e_burst_mode: selects Burst mode in Video mode.
107 * in Non-burst mode, RGB data area is filled with RGB data and NULL
108 * packets, according to input bandwidth of RGB interface.
109 * In Burst mode, RGB data area is filled with RGB data only.
110 * @e_no_data_lane: specifies data lane count to be used by Master.
111 * @e_byte_clk: select byte clock source. (it must be DSIM_PLL_OUT_DIV8)
112 * DSIM_EXT_CLK_DIV8 and DSIM_EXT_CLK_BYPASSS are not supported.
113 * @pll_stable_time: specifies the PLL Timer for stability of the ganerated
114 * clock(System clock cycle base)
115 * if the timer value goes to 0x00000000, the clock stable bit of status
116 * and interrupt register is set.
117 * @esc_clk: specifies escape clock frequency for getting the escape clock
118 * prescaler value.
119 * @stop_holding_cnt: specifies the interval value between transmitting
120 * read packet(or write "set_tear_on" command) and BTA request.
121 * after transmitting read packet or write "set_tear_on" command,
122 * BTA requests to D-PHY automatically. this counter value specifies
123 * the interval between them.
124 * @bta_timeout: specifies the timer for BTA.
125 * this register specifies time out from BTA request to change
126 * the direction with respect to Tx escape clock.
127 * @rx_timeout: specifies the timer for LP Rx mode timeout.
128 * this register specifies time out on how long RxValid deasserts,
129 * after RxLpdt asserts with respect to Tx escape clock.
130 * - RxValid specifies Rx data valid indicator.
131 * - RxLpdt specifies an indicator that D-PHY is under RxLpdt mode.
132 * - RxValid and RxLpdt specifies signal from D-PHY.
133 */
134struct mipi_dsim_config {
135 unsigned char auto_flush;
136 unsigned char eot_disable;
137
138 unsigned char auto_vertical_cnt;
139 unsigned char hse;
140 unsigned char hfp;
141 unsigned char hbp;
142 unsigned char hsa;
143 unsigned char cmd_allow;
144
145 enum mipi_dsim_interface_type e_interface;
146 enum mipi_dsim_virtual_ch_no e_virtual_ch;
147 enum mipi_dsim_pixel_format e_pixel_format;
148 enum mipi_dsim_burst_mode_type e_burst_mode;
149 enum mipi_dsim_no_of_data_lane e_no_data_lane;
150 enum mipi_dsim_byte_clk_src e_byte_clk;
151
152 /*
153 * ===========================================
154 * | P | M | S | MHz |
155 * -------------------------------------------
156 * | 3 | 100 | 3 | 100 |
157 * | 3 | 100 | 2 | 200 |
158 * | 3 | 63 | 1 | 252 |
159 * | 4 | 100 | 1 | 300 |
160 * | 4 | 110 | 1 | 330 |
161 * | 12 | 350 | 1 | 350 |
162 * | 3 | 100 | 1 | 400 |
163 * | 4 | 150 | 1 | 450 |
164 * | 6 | 118 | 1 | 472 |
165 * | 3 | 120 | 1 | 480 |
166 * | 12 | 250 | 0 | 500 |
167 * | 4 | 100 | 0 | 600 |
168 * | 3 | 81 | 0 | 648 |
169 * | 3 | 88 | 0 | 704 |
170 * | 3 | 90 | 0 | 720 |
171 * | 3 | 100 | 0 | 800 |
172 * | 12 | 425 | 0 | 850 |
173 * | 4 | 150 | 0 | 900 |
174 * | 12 | 475 | 0 | 950 |
175 * | 6 | 250 | 0 | 1000 |
176 * -------------------------------------------
177 */
178
179 /*
180 * pms could be calculated as the following.
181 * M * 24 / P * 2 ^ S = MHz
182 */
183 unsigned char p;
184 unsigned short m;
185 unsigned char s;
186
187 unsigned int pll_stable_time;
188 unsigned long esc_clk;
189
190 unsigned short stop_holding_cnt;
191 unsigned char bta_timeout;
192 unsigned short rx_timeout;
193};
194
195/*
196 * struct mipi_dsim_device - global interface for mipi-dsi driver.
197 *
198 * @dev: driver model representation of the device.
199 * @id: unique device id.
200 * @clock: pointer to MIPI-DSI clock of clock framework.
201 * @irq: interrupt number to MIPI-DSI controller.
202 * @reg_base: base address to memory mapped SRF of MIPI-DSI controller.
203 * (virtual address)
204 * @lock: the mutex protecting this data structure.
205 * @dsim_info: infomation for configuring mipi-dsi controller.
206 * @master_ops: callbacks to mipi-dsi operations.
207 * @dsim_lcd_dev: pointer to activated ddi device.
208 * (it would be registered by mipi-dsi driver.)
209 * @dsim_lcd_drv: pointer to activated_ddi driver.
210 * (it would be registered by mipi-dsi driver.)
211 * @lcd_info: pointer to mipi_lcd_info structure.
212 * @state: specifies status of MIPI-DSI controller.
213 * the status could be RESET, INIT, STOP, HSCLKEN and ULPS.
214 * @data_lane: specifiec enabled data lane number.
215 * this variable would be set by driver according to e_no_data_lane
216 * automatically.
217 * @e_clk_src: select byte clock source.
218 * @pd: pointer to MIPI-DSI driver platform data.
219 */
220struct mipi_dsim_device {
221 struct device *dev;
222 int id;
223 struct resource *res;
224 struct clk *clock;
225 unsigned int irq;
226 void __iomem *reg_base;
227 struct mutex lock;
228
229 struct mipi_dsim_config *dsim_config;
230 struct mipi_dsim_master_ops *master_ops;
231 struct mipi_dsim_lcd_device *dsim_lcd_dev;
232 struct mipi_dsim_lcd_driver *dsim_lcd_drv;
233
234 unsigned int state;
235 unsigned int data_lane;
236 unsigned int e_clk_src;
237 bool suspended;
238
239 struct mipi_dsim_platform_data *pd;
240};
241
242/*
243 * struct mipi_dsim_platform_data - interface to platform data
244 * for mipi-dsi driver.
245 *
246 * @lcd_panel_name: specifies lcd panel name registered to mipi-dsi driver.
247 * lcd panel driver searched would be actived.
248 * @dsim_config: pointer of structure for configuring mipi-dsi controller.
249 * @enabled: indicate whether mipi controller got enabled or not.
250 * @lcd_panel_info: pointer for lcd panel specific structure.
251 * this structure specifies width, height, timing and polarity and so on.
252 * @phy_enable: pointer to a callback controlling D-PHY enable/reset
253 */
254struct mipi_dsim_platform_data {
255 char lcd_panel_name[PANEL_NAME_SIZE];
256
257 struct mipi_dsim_config *dsim_config;
258 unsigned int enabled;
259 void *lcd_panel_info;
260
261 int (*phy_enable)(struct platform_device *pdev, bool on);
262};
263
264/*
265 * struct mipi_dsim_master_ops - callbacks to mipi-dsi operations.
266 *
267 * @cmd_write: transfer command to lcd panel at LP mode.
268 * @cmd_read: read command from rx register.
269 * @get_dsim_frame_done: get the status that all screen data have been
270 * transferred to mipi-dsi.
271 * @clear_dsim_frame_done: clear frame done status.
272 * @get_fb_frame_done: get frame done status of display controller.
273 * @trigger: trigger display controller.
274 * - this one would be used only in case of CPU mode.
275 * @set_early_blank_mode: set framebuffer blank mode.
276 * - this callback should be called prior to fb_blank() by a client driver
277 * only if needing.
278 * @set_blank_mode: set framebuffer blank mode.
279 * - this callback should be called after fb_blank() by a client driver
280 * only if needing.
281 */
282
283struct mipi_dsim_master_ops {
284 int (*cmd_write)(struct mipi_dsim_device *dsim, unsigned int data_id,
285 const unsigned char *data0, unsigned int data1);
286 int (*cmd_read)(struct mipi_dsim_device *dsim, unsigned int data_id,
287 unsigned int data0, unsigned int req_size, u8 *rx_buf);
288 int (*get_dsim_frame_done)(struct mipi_dsim_device *dsim);
289 int (*clear_dsim_frame_done)(struct mipi_dsim_device *dsim);
290
291 int (*get_fb_frame_done)(struct fb_info *info);
292 void (*trigger)(struct fb_info *info);
293 int (*set_early_blank_mode)(struct mipi_dsim_device *dsim, int power);
294 int (*set_blank_mode)(struct mipi_dsim_device *dsim, int power);
295};
296
297/*
298 * device structure for mipi-dsi based lcd panel.
299 *
300 * @name: name of the device to use with this device, or an
301 * alias for that name.
302 * @dev: driver model representation of the device.
303 * @id: id of device to be registered.
304 * @bus_id: bus id for identifing connected bus
305 * and this bus id should be same as id of mipi_dsim_device.
306 * @irq: irq number for signaling when framebuffer transfer of
307 * lcd panel module is completed.
308 * this irq would be used only for MIPI-DSI based CPU mode lcd panel.
309 * @master: pointer to mipi-dsi master device object.
310 * @platform_data: lcd panel specific platform data.
311 */
312struct mipi_dsim_lcd_device {
313 char *name;
314 struct device dev;
315 int id;
316 int bus_id;
317 int irq;
318
319 struct mipi_dsim_device *master;
320 void *platform_data;
321};
322
323/*
324 * driver structure for mipi-dsi based lcd panel.
325 *
326 * this structure should be registered by lcd panel driver.
327 * mipi-dsi driver seeks lcd panel registered through name field
328 * and calls these callback functions in appropriate time.
329 *
330 * @name: name of the driver to use with this device, or an
331 * alias for that name.
332 * @id: id of driver to be registered.
333 * this id would be used for finding device object registered.
334 */
335struct mipi_dsim_lcd_driver {
336 char *name;
337 int id;
338
339 void (*power_on)(struct mipi_dsim_lcd_device *dsim_dev, int enable);
340 void (*set_sequence)(struct mipi_dsim_lcd_device *dsim_dev);
341 int (*probe)(struct mipi_dsim_lcd_device *dsim_dev);
342 int (*remove)(struct mipi_dsim_lcd_device *dsim_dev);
343 void (*shutdown)(struct mipi_dsim_lcd_device *dsim_dev);
344 int (*suspend)(struct mipi_dsim_lcd_device *dsim_dev);
345 int (*resume)(struct mipi_dsim_lcd_device *dsim_dev);
346};
347
348/*
349 * register mipi_dsim_lcd_device to mipi-dsi master.
350 */
351int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device
352 *lcd_dev);
353/**
354 * register mipi_dsim_lcd_driver object defined by lcd panel driver
355 * to mipi-dsi driver.
356 */
357int exynos_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver
358 *lcd_drv);
359#endif /* _EXYNOS_MIPI_DSIM_H */
diff --git a/include/video/sa1100fb.h b/include/video/sa1100fb.h
new file mode 100644
index 00000000000..4ab40965378
--- /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/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 434d56b4a1a..06c67fbc4ee 100644
--- a/include/video/sh_mipi_dsi.h
+++ b/include/video/sh_mipi_dsi.h
@@ -51,6 +51,7 @@ struct sh_mipi_dsi_info {
51 int lane; 51 int lane;
52 unsigned long flags; 52 unsigned long flags;
53 u32 clksrc; 53 u32 clksrc;
54 u32 phyctrl; /* for extra setting */
54 unsigned int vsynw_offset; 55 unsigned int vsynw_offset;
55 int (*set_dot_clock)(struct platform_device *pdev, 56 int (*set_dot_clock)(struct platform_device *pdev,
56 void __iomem *base, 57 void __iomem *base,
diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h
index b56932927d0..728f9de9c25 100644
--- a/include/video/sh_mobile_hdmi.h
+++ b/include/video/sh_mobile_hdmi.h
@@ -31,8 +31,6 @@ struct clk;
31#define HDMI_SND_SRC_HBR (3 << 0) 31#define HDMI_SND_SRC_HBR (3 << 0)
32 32
33struct sh_mobile_hdmi_info { 33struct sh_mobile_hdmi_info {
34 struct sh_mobile_lcdc_chan_cfg *lcd_chan;
35 struct device *lcd_dev;
36 unsigned int flags; 34 unsigned int flags;
37 long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq, 35 long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq,
38 unsigned long *parent_freq); 36 unsigned long *parent_freq);
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index fe30b759c51..7571b27a0ba 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -147,29 +147,23 @@ struct sh_mobile_lcdc_sys_bus_ops {
147 unsigned long (*read_data)(void *handle); 147 unsigned long (*read_data)(void *handle);
148}; 148};
149 149
150struct module; 150struct sh_mobile_lcdc_panel_cfg {
151struct sh_mobile_lcdc_board_cfg { 151 unsigned long width; /* Panel width in mm */
152 struct module *owner; 152 unsigned long height; /* Panel height in mm */
153 void *board_data; 153 int (*setup_sys)(void *sys_ops_handle,
154 int (*setup_sys)(void *board_data, void *sys_ops_handle,
155 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 154 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
156 void (*start_transfer)(void *board_data, void *sys_ops_handle, 155 void (*start_transfer)(void *sys_ops_handle,
157 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 156 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
158 void (*display_on)(void *board_data, struct fb_info *info); 157 void (*display_on)(void);
159 void (*display_off)(void *board_data); 158 void (*display_off)(void);
160 int (*set_brightness)(void *board_data, int brightness);
161 int (*get_brightness)(void *board_data);
162};
163
164struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
165 unsigned long width;
166 unsigned long height;
167}; 159};
168 160
169/* backlight info */ 161/* backlight info */
170struct sh_mobile_lcdc_bl_info { 162struct sh_mobile_lcdc_bl_info {
171 const char *name; 163 const char *name;
172 int max_brightness; 164 int max_brightness;
165 int (*set_brightness)(int brightness);
166 int (*get_brightness)(void);
173}; 167};
174 168
175struct sh_mobile_lcdc_chan_cfg { 169struct sh_mobile_lcdc_chan_cfg {
@@ -179,13 +173,14 @@ struct sh_mobile_lcdc_chan_cfg {
179 int interface_type; /* selects RGBn or SYSn I/F, see above */ 173 int interface_type; /* selects RGBn or SYSn I/F, see above */
180 int clock_divider; 174 int clock_divider;
181 unsigned long flags; /* LCDC_FLAGS_... */ 175 unsigned long flags; /* LCDC_FLAGS_... */
182 const struct fb_videomode *lcd_cfg; 176 const struct fb_videomode *lcd_modes;
183 int num_cfg; 177 int num_modes;
184 struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; 178 struct sh_mobile_lcdc_panel_cfg panel_cfg;
185 struct sh_mobile_lcdc_board_cfg board_cfg;
186 struct sh_mobile_lcdc_bl_info bl_info; 179 struct sh_mobile_lcdc_bl_info bl_info;
187 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ 180 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
188 struct sh_mobile_meram_cfg *meram_cfg; 181 const struct sh_mobile_meram_cfg *meram_cfg;
182
183 struct platform_device *tx_dev; /* HDMI/DSI transmitter device */
189}; 184};
190 185
191struct sh_mobile_lcdc_info { 186struct sh_mobile_lcdc_info {
diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
index af602d602b2..29b2fd3b147 100644
--- a/include/video/sh_mobile_meram.h
+++ b/include/video/sh_mobile_meram.h
@@ -17,52 +17,47 @@ enum {
17struct sh_mobile_meram_priv; 17struct sh_mobile_meram_priv;
18struct sh_mobile_meram_ops; 18struct sh_mobile_meram_ops;
19 19
20/*
21 * struct sh_mobile_meram_info - MERAM platform data
22 * @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO)
23 */
20struct sh_mobile_meram_info { 24struct sh_mobile_meram_info {
21 int addr_mode; 25 int addr_mode;
26 u32 reserved_icbs;
22 struct sh_mobile_meram_ops *ops; 27 struct sh_mobile_meram_ops *ops;
23 struct sh_mobile_meram_priv *priv; 28 struct sh_mobile_meram_priv *priv;
24 struct platform_device *pdev; 29 struct platform_device *pdev;
25}; 30};
26 31
27/* icb config */ 32/* icb config */
28struct sh_mobile_meram_icb { 33struct sh_mobile_meram_icb_cfg {
29 int marker_icb; /* ICB # for Marker ICB */ 34 unsigned int meram_size; /* MERAM Buffer Size to use */
30 int cache_icb; /* ICB # for Cache ICB */
31 int meram_offset; /* MERAM Buffer Offset to use */
32 int meram_size; /* MERAM Buffer Size to use */
33
34 int cache_unit; /* bytes to cache per ICB */
35}; 35};
36 36
37struct sh_mobile_meram_cfg { 37struct sh_mobile_meram_cfg {
38 struct sh_mobile_meram_icb icb[2]; 38 struct sh_mobile_meram_icb_cfg icb[2];
39 int pixelformat;
40 int current_reg;
41}; 39};
42 40
43struct module; 41struct module;
44struct sh_mobile_meram_ops { 42struct sh_mobile_meram_ops {
45 struct module *module; 43 struct module *module;
46 /* register usage of meram */ 44 /* register usage of meram */
47 int (*meram_register)(struct sh_mobile_meram_info *meram_dev, 45 void *(*meram_register)(struct sh_mobile_meram_info *meram_dev,
48 struct sh_mobile_meram_cfg *cfg, 46 const struct sh_mobile_meram_cfg *cfg,
49 int xres, int yres, int pixelformat, 47 unsigned int xres, unsigned int yres,
50 unsigned long base_addr_y, 48 unsigned int pixelformat,
51 unsigned long base_addr_c, 49 unsigned int *pitch);
52 unsigned long *icb_addr_y,
53 unsigned long *icb_addr_c, int *pitch);
54 50
55 /* unregister usage of meram */ 51 /* unregister usage of meram */
56 int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev, 52 void (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
57 struct sh_mobile_meram_cfg *cfg); 53 void *data);
58 54
59 /* update meram settings */ 55 /* update meram settings */
60 int (*meram_update)(struct sh_mobile_meram_info *meram_dev, 56 void (*meram_update)(struct sh_mobile_meram_info *meram_dev, void *data,
61 struct sh_mobile_meram_cfg *cfg, 57 unsigned long base_addr_y,
62 unsigned long base_addr_y, 58 unsigned long base_addr_c,
63 unsigned long base_addr_c, 59 unsigned long *icb_addr_y,
64 unsigned long *icb_addr_y, 60 unsigned long *icb_addr_c);
65 unsigned long *icb_addr_c);
66}; 61};
67 62
68#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */ 63#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */
diff --git a/include/video/udlfb.h b/include/video/udlfb.h
index c41f308c963..f9466fa54ba 100644
--- a/include/video/udlfb.h
+++ b/include/video/udlfb.h
@@ -41,6 +41,7 @@ struct dlfb_data {
41 char *backing_buffer; 41 char *backing_buffer;
42 int fb_count; 42 int fb_count;
43 bool virtualized; /* true when physical usb device not present */ 43 bool virtualized; /* true when physical usb device not present */
44 struct delayed_work init_framebuffer_work;
44 struct delayed_work free_framebuffer_work; 45 struct delayed_work free_framebuffer_work;
45 atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */ 46 atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
46 atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */ 47 atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index 0c28989007f..9ce788d8cf4 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -39,6 +39,27 @@ struct physdev_eoi {
39}; 39};
40 40
41/* 41/*
42 * Register a shared page for the hypervisor to indicate whether the guest
43 * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly
44 * once the guest used this function in that the associated event channel
45 * will automatically get unmasked. The page registered is used as a bit
46 * array indexed by Xen's PIRQ value.
47 */
48#define PHYSDEVOP_pirq_eoi_gmfn_v1 17
49/*
50 * Register a shared page for the hypervisor to indicate whether the
51 * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
52 * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
53 * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
54 * Xen's PIRQ value.
55 */
56#define PHYSDEVOP_pirq_eoi_gmfn_v2 28
57struct physdev_pirq_eoi_gmfn {
58 /* IN */
59 unsigned long gmfn;
60};
61
62/*
42 * Query the status of an IRQ line. 63 * Query the status of an IRQ line.
43 * @arg == pointer to physdev_irq_status_query structure. 64 * @arg == pointer to physdev_irq_status_query structure.
44 */ 65 */
diff --git a/include/xen/tmem.h b/include/xen/tmem.h
index 82e2c83a32f..591550a22ac 100644
--- a/include/xen/tmem.h
+++ b/include/xen/tmem.h
@@ -1,5 +1,9 @@
1#ifndef _XEN_TMEM_H 1#ifndef _XEN_TMEM_H
2#define _XEN_TMEM_H 2#define _XEN_TMEM_H
3
4#include <linux/types.h>
5
3/* defined in drivers/xen/tmem.c */ 6/* defined in drivers/xen/tmem.c */
4extern int tmem_enabled; 7extern bool tmem_enabled;
8
5#endif /* _XEN_TMEM_H */ 9#endif /* _XEN_TMEM_H */
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 03c85d7387f..6a198e46ab6 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,
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index e8c599b237c..0a7515c1e3a 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -139,9 +139,9 @@ int xenbus_transaction_start(struct xenbus_transaction *t);
139int xenbus_transaction_end(struct xenbus_transaction t, int abort); 139int xenbus_transaction_end(struct xenbus_transaction t, int abort);
140 140
141/* Single read and scanf: returns -errno or num scanned if > 0. */ 141/* Single read and scanf: returns -errno or num scanned if > 0. */
142__scanf(4, 5)
142int xenbus_scanf(struct xenbus_transaction t, 143int xenbus_scanf(struct xenbus_transaction t,
143 const char *dir, const char *node, const char *fmt, ...) 144 const char *dir, const char *node, const char *fmt, ...);
144 __attribute__((format(scanf, 4, 5)));
145 145
146/* Single printf and write: returns -errno or 0. */ 146/* Single printf and write: returns -errno or 0. */
147__printf(4, 5) 147__printf(4, 5)