aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-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/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/vmlinux.lds.h36
-rw-r--r--include/drm/drm.h2
-rw-r--r--include/drm/drmP.h25
-rw-r--r--include/drm/drm_crtc.h48
-rw-r--r--include/drm/drm_edid.h1
-rw-r--r--include/drm/drm_fb_helper.h2
-rw-r--r--include/drm/drm_mode.h2
-rw-r--r--include/drm/drm_pciids.h54
-rw-r--r--include/drm/exynos_drm.h26
-rw-r--r--include/drm/gma_drm.h2
-rw-r--r--include/drm/i915_drm.h1
-rw-r--r--include/drm/intel-gtt.h4
-rw-r--r--include/drm/radeon_drm.h27
-rw-r--r--include/drm/ttm/ttm_memory.h1
-rw-r--r--include/linux/acpi.h1
-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/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/cleancache.h24
-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/compiler-gcc.h3
-rw-r--r--include/linux/cpu.h3
-rw-r--r--include/linux/cpufreq.h3
-rw-r--r--include/linux/cpumask.h4
-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/dmaengine.h1
-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/ext3_fs.h1
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/firewire-cdev.h39
-rw-r--r--include/linux/firewire.h19
-rw-r--r--include/linux/fs.h14
-rw-r--r--include/linux/fsnotify.h1
-rw-r--r--include/linux/gpio.h7
-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.h4
-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/tc35876x.h11
-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.h72
-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/libata.h2
-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/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.h10
-rw-r--r--include/linux/mfd/abx500/ab5500.h2
-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/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.h4
-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/cfi.h1
-rw-r--r--include/linux/mtd/map.h2
-rw-r--r--include/linux/netdevice.h3
-rw-r--r--include/linux/nfs.h2
-rw-r--r--include/linux/nfs4.h7
-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/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.h106
-rw-r--r--include/linux/pci_regs.h1
-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/omap-abe-twl6040.h49
-rw-r--r--include/linux/platform_data/omap4-keypad.h13
-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_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/raid/md_p.h6
-rw-r--r--include/linux/rcupdate.h3
-rw-r--r--include/linux/regmap.h134
-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/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/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/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_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/time.h1
-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_config.h1
-rw-r--r--include/linux/virtio_ids.h2
-rw-r--r--include/linux/virtio_scsi.h114
-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/fc/fc_fcp.h6
-rw-r--r--include/scsi/fc/fc_ms.h213
-rw-r--r--include/scsi/fc_encode.h363
-rw-r--r--include/scsi/iscsi_if.h79
-rw-r--r--include/scsi/libfc.h11
-rw-r--r--include/scsi/libiscsi.h3
-rw-r--r--include/scsi/libiscsi_tcp.h2
-rw-r--r--include/scsi/libsas.h71
-rw-r--r--include/scsi/osd_ore.h1
-rw-r--r--include/scsi/sas.h4
-rw-r--r--include/scsi/sas_ata.h44
-rw-r--r--include/scsi/scsi.h1
-rw-r--r--include/scsi/scsi_cmnd.h12
-rw-r--r--include/scsi/scsi_device.h2
-rw-r--r--include/scsi/scsi_driver.h1
-rw-r--r--include/scsi/scsi_netlink.h2
-rw-r--r--include/scsi/scsi_transport.h1
-rw-r--r--include/scsi/scsi_transport_fc.h32
-rw-r--r--include/scsi/scsi_transport_iscsi.h22
-rw-r--r--include/scsi/scsi_transport_sas.h12
-rw-r--r--include/sound/compress_params.h2
-rw-r--r--include/sound/control.h7
-rw-r--r--include/sound/core.h5
-rw-r--r--include/sound/dmaengine_pcm.h49
-rw-r--r--include/sound/jack.h3
-rw-r--r--include/sound/max9768.h24
-rw-r--r--include/sound/pcm.h9
-rw-r--r--include/sound/sh_fsi.h12
-rw-r--r--include/sound/soc-dai.h11
-rw-r--r--include/sound/soc-dapm.h36
-rw-r--r--include/sound/soc.h45
-rw-r--r--include/sound/tea575x-tuner.h6
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wm2200.h41
-rw-r--r--include/sound/wm8962.h6
-rw-r--r--include/sound/ymfpci.h2
-rw-r--r--include/target/target_core_backend.h2
-rw-r--r--include/target/target_core_base.h85
-rw-r--r--include/target/target_core_fabric.h14
-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/hvm/params.h6
-rw-r--r--include/xen/interface/physdev.h28
-rw-r--r--include/xen/interface/platform.h20
-rw-r--r--include/xen/tmem.h6
-rw-r--r--include/xen/xen-ops.h1
-rw-r--r--include/xen/xenbus.h4
356 files changed, 8665 insertions, 1589 deletions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f4b2effe0333..6fbc4cab5834 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -57,7 +57,6 @@
57#include <linux/kernel.h> 57#include <linux/kernel.h>
58#include <linux/ctype.h> 58#include <linux/ctype.h>
59#include <linux/sched.h> 59#include <linux/sched.h>
60#include <asm/system.h>
61#include <linux/atomic.h> 60#include <linux/atomic.h>
62#include <asm/div64.h> 61#include <asm/div64.h>
63#include <asm/acpi.h> 62#include <asm/acpi.h>
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index e37963c1df4d..1ced6413ea03 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -15,6 +15,8 @@
15#ifndef __ASM_GENERIC_ATOMIC_H 15#ifndef __ASM_GENERIC_ATOMIC_H
16#define __ASM_GENERIC_ATOMIC_H 16#define __ASM_GENERIC_ATOMIC_H
17 17
18#include <asm/cmpxchg.h>
19
18#ifdef CONFIG_SMP 20#ifdef CONFIG_SMP
19/* Force people to define core atomics */ 21/* Force people to define core atomics */
20# if !defined(atomic_add_return) || !defined(atomic_sub_return) || \ 22# if !defined(atomic_add_return) || !defined(atomic_sub_return) || \
@@ -52,7 +54,6 @@
52#define atomic_set(v, i) (((v)->counter) = (i)) 54#define atomic_set(v, i) (((v)->counter) = (i))
53 55
54#include <linux/irqflags.h> 56#include <linux/irqflags.h>
55#include <asm/system.h>
56 57
57/** 58/**
58 * atomic_add_return - add integer to atomic variable 59 * atomic_add_return - add integer to atomic variable
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
new file mode 100644
index 000000000000..639d7a4d033b
--- /dev/null
+++ b/include/asm-generic/barrier.h
@@ -0,0 +1,50 @@
1/* Generic barrier definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_BARRIER_H
15#define __ASM_GENERIC_BARRIER_H
16
17#ifndef __ASSEMBLY__
18
19#define nop() asm volatile ("nop")
20
21/*
22 * Force strict CPU ordering.
23 * And yes, this is required on UP too when we're talking
24 * to devices.
25 *
26 * This implementation only contains a compiler barrier.
27 */
28
29#define mb() asm volatile ("": : :"memory")
30#define rmb() mb()
31#define wmb() asm volatile ("": : :"memory")
32
33#ifdef CONFIG_SMP
34#define smp_mb() mb()
35#define smp_rmb() rmb()
36#define smp_wmb() wmb()
37#else
38#define smp_mb() barrier()
39#define smp_rmb() barrier()
40#define smp_wmb() barrier()
41#endif
42
43#define set_mb(var, value) do { var = value; mb(); } while (0)
44#define set_wmb(var, value) do { var = value; wmb(); } while (0)
45
46#define read_barrier_depends() do {} while (0)
47#define smp_read_barrier_depends() do {} while (0)
48
49#endif /* !__ASSEMBLY__ */
50#endif /* __ASM_GENERIC_BARRIER_H */
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index ecc44a8e2b44..9ae6c34dc191 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -2,7 +2,7 @@
2#define _ASM_GENERIC_BITOPS_ATOMIC_H_ 2#define _ASM_GENERIC_BITOPS_ATOMIC_H_
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/system.h> 5#include <linux/irqflags.h>
6 6
7#ifdef CONFIG_SMP 7#ifdef CONFIG_SMP
8#include <asm/spinlock.h> 8#include <asm/spinlock.h>
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 84458b0c38d1..2520a6e241dc 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 213ac6e8fe39..8a361834dc25 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 9fa3f96e38cf..2e248d8924dc 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 000000000000..567766b0074a
--- /dev/null
+++ b/include/asm-generic/exec.h
@@ -0,0 +1,19 @@
1/* Generic process execution definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_EXEC_H
15#define __ASM_GENERIC_EXEC_H
16
17#define arch_align_stack(x) (x)
18
19#endif /* __ASM_GENERIC_EXEC_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 1ff4e221cb4d..5f52690c3c8f 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -142,9 +142,9 @@ extern int __must_check gpiochip_reserve(int start, int ngpio);
142/* add/remove chips */ 142/* add/remove chips */
143extern int gpiochip_add(struct gpio_chip *chip); 143extern int gpiochip_add(struct gpio_chip *chip);
144extern int __must_check gpiochip_remove(struct gpio_chip *chip); 144extern int __must_check gpiochip_remove(struct gpio_chip *chip);
145extern struct gpio_chip *gpiochip_find(void *data, 145extern struct gpio_chip *gpiochip_find(const void *data,
146 int (*match)(struct gpio_chip *chip, 146 int (*match)(struct gpio_chip *chip,
147 void *data)); 147 const void *data));
148 148
149 149
150/* Always use the library code for GPIO management calls, 150/* Always use the library code for GPIO management calls,
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
index 787abbb6d867..d030d2c2647a 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 4a5aca2a2c94..a5b5d5a89a4f 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 26373cff4546..e80a0495e5b0 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 a03c098b0cce..125c54e98517 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/switch_to.h b/include/asm-generic/switch_to.h
new file mode 100644
index 000000000000..052c4ac04fd5
--- /dev/null
+++ b/include/asm-generic/switch_to.h
@@ -0,0 +1,30 @@
1/* Generic task switch macro wrapper, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_SWITCH_TO_H
15#define __ASM_GENERIC_SWITCH_TO_H
16
17#include <linux/thread_info.h>
18
19/*
20 * Context switching is now performed out-of-line in switch_to.S
21 */
22extern struct task_struct *__switch_to(struct task_struct *,
23 struct task_struct *);
24
25#define switch_to(prev, next, last) \
26 do { \
27 ((last) = __switch_to((prev), (next))); \
28 } while (0)
29
30#endif /* __ASM_GENERIC_SWITCH_TO_H */
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
deleted file mode 100644
index 215efa74f5a2..000000000000
--- a/include/asm-generic/system.h
+++ /dev/null
@@ -1,141 +0,0 @@
1/* Generic system definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_SYSTEM_H
15#define __ASM_GENERIC_SYSTEM_H
16
17#ifndef __ASSEMBLY__
18
19#include <linux/types.h>
20#include <linux/irqflags.h>
21
22#include <asm/cmpxchg-local.h>
23#include <asm/cmpxchg.h>
24
25struct task_struct;
26
27/* context switching is now performed out-of-line in switch_to.S */
28extern struct task_struct *__switch_to(struct task_struct *,
29 struct task_struct *);
30#define switch_to(prev, next, last) \
31 do { \
32 ((last) = __switch_to((prev), (next))); \
33 } while (0)
34
35#define arch_align_stack(x) (x)
36
37#define nop() asm volatile ("nop")
38
39#endif /* !__ASSEMBLY__ */
40
41/*
42 * Force strict CPU ordering.
43 * And yes, this is required on UP too when we're talking
44 * to devices.
45 *
46 * This implementation only contains a compiler barrier.
47 */
48
49#define mb() asm volatile ("": : :"memory")
50#define rmb() mb()
51#define wmb() asm volatile ("": : :"memory")
52
53#ifdef CONFIG_SMP
54#define smp_mb() mb()
55#define smp_rmb() rmb()
56#define smp_wmb() wmb()
57#else
58#define smp_mb() barrier()
59#define smp_rmb() barrier()
60#define smp_wmb() barrier()
61#endif
62
63#define set_mb(var, value) do { var = value; mb(); } while (0)
64#define set_wmb(var, value) do { var = value; wmb(); } while (0)
65
66#define read_barrier_depends() do {} while (0)
67#define smp_read_barrier_depends() do {} while (0)
68
69/*
70 * we make sure local_irq_enable() doesn't cause priority inversion
71 */
72#ifndef __ASSEMBLY__
73
74/* This function doesn't exist, so you'll get a linker error
75 * if something tries to do an invalid xchg(). */
76extern void __xchg_called_with_bad_pointer(void);
77
78static inline
79unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
80{
81 unsigned long ret, flags;
82
83 switch (size) {
84 case 1:
85#ifdef __xchg_u8
86 return __xchg_u8(x, ptr);
87#else
88 local_irq_save(flags);
89 ret = *(volatile u8 *)ptr;
90 *(volatile u8 *)ptr = x;
91 local_irq_restore(flags);
92 return ret;
93#endif /* __xchg_u8 */
94
95 case 2:
96#ifdef __xchg_u16
97 return __xchg_u16(x, ptr);
98#else
99 local_irq_save(flags);
100 ret = *(volatile u16 *)ptr;
101 *(volatile u16 *)ptr = x;
102 local_irq_restore(flags);
103 return ret;
104#endif /* __xchg_u16 */
105
106 case 4:
107#ifdef __xchg_u32
108 return __xchg_u32(x, ptr);
109#else
110 local_irq_save(flags);
111 ret = *(volatile u32 *)ptr;
112 *(volatile u32 *)ptr = x;
113 local_irq_restore(flags);
114 return ret;
115#endif /* __xchg_u32 */
116
117#ifdef CONFIG_64BIT
118 case 8:
119#ifdef __xchg_u64
120 return __xchg_u64(x, ptr);
121#else
122 local_irq_save(flags);
123 ret = *(volatile u64 *)ptr;
124 *(volatile u64 *)ptr = x;
125 local_irq_restore(flags);
126 return ret;
127#endif /* __xchg_u64 */
128#endif /* CONFIG_64BIT */
129
130 default:
131 __xchg_called_with_bad_pointer();
132 return x;
133 }
134}
135
136#define xchg(ptr, x) \
137 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
138
139#endif /* !__ASSEMBLY__ */
140
141#endif /* __ASM_GENERIC_SYSTEM_H */
diff --git a/include/asm-generic/tlbflush.h b/include/asm-generic/tlbflush.h
index c7af037024c7..d6d0a88430fe 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/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index b5e2e4c6b017..8aeadf6b553a 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.h b/include/drm/drm.h
index 49d94ede2ec2..34a7b89fd006 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -761,6 +761,8 @@ struct drm_event_vblank {
761 761
762#define DRM_CAP_DUMB_BUFFER 0x1 762#define DRM_CAP_DUMB_BUFFER 0x1
763#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 763#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
764#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
765#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
764 766
765/* typedef area */ 767/* typedef area */
766#ifndef __KERNEL__ 768#ifndef __KERNEL__
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 92f0981b5fb8..574bd1c81ebd 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1170,6 +1170,8 @@ struct drm_device {
1170 struct idr object_name_idr; 1170 struct idr object_name_idr;
1171 /*@} */ 1171 /*@} */
1172 int switch_power_state; 1172 int switch_power_state;
1173
1174 atomic_t unplugged; /* device has been unplugged or gone away */
1173}; 1175};
1174 1176
1175#define DRM_SWITCH_POWER_ON 0 1177#define DRM_SWITCH_POWER_ON 0
@@ -1235,6 +1237,19 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
1235} 1237}
1236#endif 1238#endif
1237 1239
1240static inline void drm_device_set_unplugged(struct drm_device *dev)
1241{
1242 smp_wmb();
1243 atomic_set(&dev->unplugged, 1);
1244}
1245
1246static inline int drm_device_is_unplugged(struct drm_device *dev)
1247{
1248 int ret = atomic_read(&dev->unplugged);
1249 smp_rmb();
1250 return ret;
1251}
1252
1238/******************************************************************/ 1253/******************************************************************/
1239/** \name Internal function definitions */ 1254/** \name Internal function definitions */
1240/*@{*/ 1255/*@{*/
@@ -1264,11 +1279,6 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1264 1279
1265 /* Memory management support (drm_memory.h) */ 1280 /* Memory management support (drm_memory.h) */
1266#include "drm_memory.h" 1281#include "drm_memory.h"
1267extern void drm_mem_init(void);
1268extern int drm_mem_info(char *buf, char **start, off_t offset,
1269 int request, int *eof, void *data);
1270extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
1271
1272extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); 1282extern void drm_free_agp(DRM_AGP_MEM * handle, int pages);
1273extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); 1283extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
1274extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, 1284extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
@@ -1383,12 +1393,8 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
1383 /* IRQ support (drm_irq.h) */ 1393 /* IRQ support (drm_irq.h) */
1384extern int drm_control(struct drm_device *dev, void *data, 1394extern int drm_control(struct drm_device *dev, void *data,
1385 struct drm_file *file_priv); 1395 struct drm_file *file_priv);
1386extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
1387extern int drm_irq_install(struct drm_device *dev); 1396extern int drm_irq_install(struct drm_device *dev);
1388extern int drm_irq_uninstall(struct drm_device *dev); 1397extern int drm_irq_uninstall(struct drm_device *dev);
1389extern void drm_driver_irq_preinstall(struct drm_device *dev);
1390extern void drm_driver_irq_postinstall(struct drm_device *dev);
1391extern void drm_driver_irq_uninstall(struct drm_device *dev);
1392 1398
1393extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); 1399extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
1394extern int drm_wait_vblank(struct drm_device *dev, void *data, 1400extern int drm_wait_vblank(struct drm_device *dev, void *data,
@@ -1464,6 +1470,7 @@ extern void drm_master_put(struct drm_master **master);
1464 1470
1465extern void drm_put_dev(struct drm_device *dev); 1471extern void drm_put_dev(struct drm_device *dev);
1466extern int drm_put_minor(struct drm_minor **minor); 1472extern int drm_put_minor(struct drm_minor **minor);
1473extern void drm_unplug_dev(struct drm_device *dev);
1467extern unsigned int drm_debug; 1474extern unsigned int drm_debug;
1468 1475
1469extern unsigned int drm_vblank_offdelay; 1476extern unsigned int drm_vblank_offdelay;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 4cd4be26722c..e250eda4e3a8 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -121,7 +121,7 @@ struct drm_display_mode {
121 char name[DRM_DISPLAY_MODE_LEN]; 121 char name[DRM_DISPLAY_MODE_LEN];
122 122
123 enum drm_mode_status status; 123 enum drm_mode_status status;
124 int type; 124 unsigned int type;
125 125
126 /* Proposed mode values */ 126 /* Proposed mode values */
127 int clock; /* in kHz */ 127 int clock; /* in kHz */
@@ -257,7 +257,7 @@ struct drm_property_blob {
257 struct drm_mode_object base; 257 struct drm_mode_object base;
258 struct list_head head; 258 struct list_head head;
259 unsigned int length; 259 unsigned int length;
260 void *data; 260 unsigned char data[];
261}; 261};
262 262
263struct drm_property_enum { 263struct drm_property_enum {
@@ -796,6 +796,9 @@ struct drm_mode_config {
796 struct drm_property *scaling_mode_property; 796 struct drm_property *scaling_mode_property;
797 struct drm_property *dithering_mode_property; 797 struct drm_property *dithering_mode_property;
798 struct drm_property *dirty_info_property; 798 struct drm_property *dirty_info_property;
799
800 /* dumb ioctl parameters */
801 uint32_t preferred_depth, prefer_shadow;
799}; 802};
800 803
801#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 804#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
@@ -807,23 +810,29 @@ struct drm_mode_config {
807#define obj_to_blob(x) container_of(x, struct drm_property_blob, base) 810#define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
808#define obj_to_plane(x) container_of(x, struct drm_plane, base) 811#define obj_to_plane(x) container_of(x, struct drm_plane, base)
809 812
813struct drm_prop_enum_list {
814 int type;
815 char *name;
816};
810 817
811extern void drm_crtc_init(struct drm_device *dev, 818extern int drm_crtc_init(struct drm_device *dev,
812 struct drm_crtc *crtc, 819 struct drm_crtc *crtc,
813 const struct drm_crtc_funcs *funcs); 820 const struct drm_crtc_funcs *funcs);
814extern void drm_crtc_cleanup(struct drm_crtc *crtc); 821extern void drm_crtc_cleanup(struct drm_crtc *crtc);
815 822
816extern void drm_connector_init(struct drm_device *dev, 823extern int drm_connector_init(struct drm_device *dev,
817 struct drm_connector *connector, 824 struct drm_connector *connector,
818 const struct drm_connector_funcs *funcs, 825 const struct drm_connector_funcs *funcs,
819 int connector_type); 826 int connector_type);
820 827
821extern void drm_connector_cleanup(struct drm_connector *connector); 828extern void drm_connector_cleanup(struct drm_connector *connector);
829/* helper to unplug all connectors from sysfs for device */
830extern void drm_connector_unplug_all(struct drm_device *dev);
822 831
823extern void drm_encoder_init(struct drm_device *dev, 832extern int drm_encoder_init(struct drm_device *dev,
824 struct drm_encoder *encoder, 833 struct drm_encoder *encoder,
825 const struct drm_encoder_funcs *funcs, 834 const struct drm_encoder_funcs *funcs,
826 int encoder_type); 835 int encoder_type);
827 836
828extern int drm_plane_init(struct drm_device *dev, 837extern int drm_plane_init(struct drm_device *dev,
829 struct drm_plane *plane, 838 struct drm_plane *plane,
@@ -848,6 +857,7 @@ extern struct edid *drm_get_edid(struct drm_connector *connector,
848extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 857extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
849extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 858extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
850extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 859extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
860extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
851extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, 861extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
852 const struct drm_display_mode *mode); 862 const struct drm_display_mode *mode);
853extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); 863extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
@@ -862,7 +872,7 @@ extern int drm_mode_height(struct drm_display_mode *mode);
862/* for us by fb module */ 872/* for us by fb module */
863extern int drm_mode_attachmode_crtc(struct drm_device *dev, 873extern int drm_mode_attachmode_crtc(struct drm_device *dev,
864 struct drm_crtc *crtc, 874 struct drm_crtc *crtc,
865 struct drm_display_mode *mode); 875 const struct drm_display_mode *mode);
866extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode); 876extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode);
867 877
868extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); 878extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
@@ -904,6 +914,13 @@ extern int drm_connector_attach_property(struct drm_connector *connector,
904 struct drm_property *property, uint64_t init_val); 914 struct drm_property *property, uint64_t init_val);
905extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, 915extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
906 const char *name, int num_values); 916 const char *name, int num_values);
917extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
918 const char *name,
919 const struct drm_prop_enum_list *props,
920 int num_values);
921struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
922 const char *name,
923 uint64_t min, uint64_t max);
907extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); 924extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
908extern int drm_property_add_enum(struct drm_property *property, int index, 925extern int drm_property_add_enum(struct drm_property *property, int index,
909 uint64_t value, const char *name); 926 uint64_t value, const char *name);
@@ -919,7 +936,7 @@ extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
919 struct drm_encoder *encoder); 936 struct drm_encoder *encoder);
920extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, 937extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
921 struct drm_encoder *encoder); 938 struct drm_encoder *encoder);
922extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, 939extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
923 int gamma_size); 940 int gamma_size);
924extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, 941extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
925 uint32_t id, uint32_t type); 942 uint32_t id, uint32_t type);
@@ -995,6 +1012,7 @@ extern int drm_add_modes_noedid(struct drm_connector *connector,
995 int hdisplay, int vdisplay); 1012 int hdisplay, int vdisplay);
996 1013
997extern int drm_edid_header_is_valid(const u8 *raw_edid); 1014extern int drm_edid_header_is_valid(const u8 *raw_edid);
1015extern bool drm_edid_block_valid(u8 *raw_edid);
998extern bool drm_edid_is_valid(struct edid *edid); 1016extern bool drm_edid_is_valid(struct edid *edid);
999struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 1017struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
1000 int hsize, int vsize, int fresh); 1018 int hsize, int vsize, int fresh);
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 74ce91684629..bcb9a66baa8c 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -238,5 +238,6 @@ int drm_av_sync_delay(struct drm_connector *connector,
238 struct drm_display_mode *mode); 238 struct drm_display_mode *mode);
239struct drm_connector *drm_select_eld(struct drm_encoder *encoder, 239struct drm_connector *drm_select_eld(struct drm_encoder *encoder,
240 struct drm_display_mode *mode); 240 struct drm_display_mode *mode);
241int drm_load_edid_firmware(struct drm_connector *connector);
241 242
242#endif /* __DRM_EDID_H__ */ 243#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 6e3076ad646e..5120b01c2eeb 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -35,7 +35,6 @@ struct drm_fb_helper;
35#include <linux/kgdb.h> 35#include <linux/kgdb.h>
36 36
37struct drm_fb_helper_crtc { 37struct drm_fb_helper_crtc {
38 uint32_t crtc_id;
39 struct drm_mode_set mode_set; 38 struct drm_mode_set mode_set;
40 struct drm_display_mode *desired_mode; 39 struct drm_display_mode *desired_mode;
41}; 40};
@@ -74,7 +73,6 @@ struct drm_fb_helper {
74 int connector_count; 73 int connector_count;
75 struct drm_fb_helper_connector **connector_info; 74 struct drm_fb_helper_connector **connector_info;
76 struct drm_fb_helper_funcs *funcs; 75 struct drm_fb_helper_funcs *funcs;
77 int conn_limit;
78 struct fb_info *fbdev; 76 struct fb_info *fbdev;
79 u32 pseudo_palette[17]; 77 u32 pseudo_palette[17];
80 struct list_head kernel_fb_list; 78 struct list_head kernel_fb_list;
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 2a2acda8b437..4a0aae38e160 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/drm_pciids.h b/include/drm/drm_pciids.h
index 14b6cd022284..58d0bdab68dd 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -202,11 +202,49 @@
202 {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 202 {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
203 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 203 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
204 {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 204 {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
205 {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
206 {0x1002, 0x6784, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
207 {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
208 {0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
209 {0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
210 {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
211 {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
212 {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
213 {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
214 {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
215 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
216 {0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
217 {0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
218 {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
219 {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
220 {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
221 {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
222 {0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
223 {0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
224 {0x1002, 0x6821, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
225 {0x1002, 0x6823, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
226 {0x1002, 0x6824, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
227 {0x1002, 0x6825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
228 {0x1002, 0x6826, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
229 {0x1002, 0x6827, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
230 {0x1002, 0x6828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
231 {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
232 {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
233 {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
234 {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
235 {0x1002, 0x6831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
236 {0x1002, 0x6837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
237 {0x1002, 0x6838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
238 {0x1002, 0x6839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
239 {0x1002, 0x683B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
240 {0x1002, 0x683D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
241 {0x1002, 0x683F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
205 {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 242 {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
206 {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 243 {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
207 {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 244 {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
208 {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 245 {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
209 {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 246 {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
247 {0x1002, 0x684C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
210 {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 248 {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
211 {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 249 {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
212 {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 250 {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
@@ -512,6 +550,22 @@
512 {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 550 {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
513 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 551 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
514 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 552 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
553 {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
554 {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
555 {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
556 {0x1002, 0x9904, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
557 {0x1002, 0x9905, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
558 {0x1002, 0x9906, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
559 {0x1002, 0x9907, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
560 {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
561 {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
562 {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
563 {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
564 {0x1002, 0x9990, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
565 {0x1002, 0x9991, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
566 {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
567 {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
568 {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
515 {0, 0, 0} 569 {0, 0, 0}
516 570
517#define r128_PCI_IDS \ 571#define r128_PCI_IDS \
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 1ed3aae893a5..3963116083ae 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -74,16 +74,37 @@ struct drm_exynos_gem_mmap {
74 uint64_t mapped; 74 uint64_t mapped;
75}; 75};
76 76
77/**
78 * A structure for user connection request of virtual display.
79 *
80 * @connection: indicate whether doing connetion or not by user.
81 * @extensions: if this value is 1 then the vidi driver would need additional
82 * 128bytes edid data.
83 * @edid: the edid data pointer from user side.
84 */
85struct drm_exynos_vidi_connection {
86 unsigned int connection;
87 unsigned int extensions;
88 uint64_t *edid;
89};
90
77struct drm_exynos_plane_set_zpos { 91struct drm_exynos_plane_set_zpos {
78 __u32 plane_id; 92 __u32 plane_id;
79 __s32 zpos; 93 __s32 zpos;
80}; 94};
81 95
96/* memory type definitions. */
97enum e_drm_exynos_gem_mem_type {
98 /* Physically Non-Continuous memory. */
99 EXYNOS_BO_NONCONTIG = 1 << 0
100};
101
82#define DRM_EXYNOS_GEM_CREATE 0x00 102#define DRM_EXYNOS_GEM_CREATE 0x00
83#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 103#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
84#define DRM_EXYNOS_GEM_MMAP 0x02 104#define DRM_EXYNOS_GEM_MMAP 0x02
85/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ 105/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
86#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 106#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
107#define DRM_EXYNOS_VIDI_CONNECTION 0x07
87 108
88#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 109#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
89 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 110 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
@@ -97,6 +118,9 @@ struct drm_exynos_plane_set_zpos {
97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ 118#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) 119 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
99 120
121#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
122 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
123
100#ifdef __KERNEL__ 124#ifdef __KERNEL__
101 125
102/** 126/**
@@ -147,11 +171,13 @@ struct exynos_drm_common_hdmi_pd {
147 * @timing: default video mode for initializing 171 * @timing: default video mode for initializing
148 * @default_win: default window layer number to be used for UI. 172 * @default_win: default window layer number to be used for UI.
149 * @bpp: default bit per pixel. 173 * @bpp: default bit per pixel.
174 * @is_v13: set if hdmi version 13 is.
150 */ 175 */
151struct exynos_drm_hdmi_pdata { 176struct exynos_drm_hdmi_pdata {
152 struct fb_videomode timing; 177 struct fb_videomode timing;
153 unsigned int default_win; 178 unsigned int default_win;
154 unsigned int bpp; 179 unsigned int bpp;
180 unsigned int is_v13:1;
155}; 181};
156 182
157#endif /* __KERNEL__ */ 183#endif /* __KERNEL__ */
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h
index 113686785717..884613ee00ad 100644
--- a/include/drm/gma_drm.h
+++ b/include/drm/gma_drm.h
@@ -83,9 +83,9 @@ struct drm_psb_gem_mmap {
83#define DRM_GMA_GAMMA 0x04 /* Set gamma table */ 83#define DRM_GMA_GAMMA 0x04 /* Set gamma table */
84#define DRM_GMA_ADB 0x05 /* Get backlight */ 84#define DRM_GMA_ADB 0x05 /* Get backlight */
85#define DRM_GMA_DPST_BL 0x06 /* Set backlight */ 85#define DRM_GMA_DPST_BL 0x06 /* Set backlight */
86#define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x1 /* CRTC to physical pipe# */
87#define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */ 86#define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */
88#define PSB_MODE_OPERATION_MODE_VALID 0x01 87#define PSB_MODE_OPERATION_MODE_VALID 0x01
88#define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x08 /* CRTC to physical pipe# */
89 89
90 90
91#endif 91#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 924f6a454fed..da929bb5b788 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -296,6 +296,7 @@ typedef struct drm_i915_irq_wait {
296#define I915_PARAM_HAS_EXEC_CONSTANTS 14 296#define I915_PARAM_HAS_EXEC_CONSTANTS 14
297#define I915_PARAM_HAS_RELAXED_DELTA 15 297#define I915_PARAM_HAS_RELAXED_DELTA 15
298#define I915_PARAM_HAS_GEN7_SOL_RESET 16 298#define I915_PARAM_HAS_GEN7_SOL_RESET 16
299#define I915_PARAM_HAS_LLC 17
299 300
300typedef struct drm_i915_getparam { 301typedef struct drm_i915_getparam {
301 int param; 302 int param;
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index b174620cc9b3..0a0001b9dc78 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -15,6 +15,10 @@ const struct intel_gtt {
15 unsigned int needs_dmar : 1; 15 unsigned int needs_dmar : 1;
16 /* Whether we idle the gpu before mapping/unmapping */ 16 /* Whether we idle the gpu before mapping/unmapping */
17 unsigned int do_idle_maps : 1; 17 unsigned int do_idle_maps : 1;
18 /* Share the scratch page dma with ppgtts. */
19 dma_addr_t scratch_page_dma;
20 /* for ppgtt PDE access */
21 u32 __iomem *gtt;
18} *intel_gtt_get(void); 22} *intel_gtt_get(void);
19 23
20void intel_gtt_chipset_flush(void); 24void intel_gtt_chipset_flush(void);
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index b55da40953fd..7c491b4bcf65 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -804,13 +804,23 @@ struct drm_radeon_gem_create {
804 uint32_t flags; 804 uint32_t flags;
805}; 805};
806 806
807#define RADEON_TILING_MACRO 0x1 807#define RADEON_TILING_MACRO 0x1
808#define RADEON_TILING_MICRO 0x2 808#define RADEON_TILING_MICRO 0x2
809#define RADEON_TILING_SWAP_16BIT 0x4 809#define RADEON_TILING_SWAP_16BIT 0x4
810#define RADEON_TILING_SWAP_32BIT 0x8 810#define RADEON_TILING_SWAP_32BIT 0x8
811#define RADEON_TILING_SURFACE 0x10 /* this object requires a surface 811/* this object requires a surface when mapped - i.e. front buffer */
812 * when mapped - i.e. front buffer */ 812#define RADEON_TILING_SURFACE 0x10
813#define RADEON_TILING_MICRO_SQUARE 0x20 813#define RADEON_TILING_MICRO_SQUARE 0x20
814#define RADEON_TILING_EG_BANKW_SHIFT 8
815#define RADEON_TILING_EG_BANKW_MASK 0xf
816#define RADEON_TILING_EG_BANKH_SHIFT 12
817#define RADEON_TILING_EG_BANKH_MASK 0xf
818#define RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT 16
819#define RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK 0xf
820#define RADEON_TILING_EG_TILE_SPLIT_SHIFT 24
821#define RADEON_TILING_EG_TILE_SPLIT_MASK 0xf
822#define RADEON_TILING_EG_STENCIL_TILE_SPLIT_SHIFT 28
823#define RADEON_TILING_EG_STENCIL_TILE_SPLIT_MASK 0xf
814 824
815struct drm_radeon_gem_set_tiling { 825struct drm_radeon_gem_set_tiling {
816 uint32_t handle; 826 uint32_t handle;
@@ -898,6 +908,7 @@ struct drm_radeon_gem_va {
898#define RADEON_CHUNK_ID_RELOCS 0x01 908#define RADEON_CHUNK_ID_RELOCS 0x01
899#define RADEON_CHUNK_ID_IB 0x02 909#define RADEON_CHUNK_ID_IB 0x02
900#define RADEON_CHUNK_ID_FLAGS 0x03 910#define RADEON_CHUNK_ID_FLAGS 0x03
911#define RADEON_CHUNK_ID_CONST_IB 0x04
901 912
902/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ 913/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
903#define RADEON_CS_KEEP_TILING_FLAGS 0x01 914#define RADEON_CS_KEEP_TILING_FLAGS 0x01
@@ -952,6 +963,8 @@ struct drm_radeon_cs {
952#define RADEON_INFO_VA_START 0x0e 963#define RADEON_INFO_VA_START 0x0e
953/* maximum size of ib using the virtual memory cs */ 964/* maximum size of ib using the virtual memory cs */
954#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f 965#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f
966/* max pipes - needed for compute shaders */
967#define RADEON_INFO_MAX_PIPES 0x10
955 968
956struct drm_radeon_info { 969struct drm_radeon_info {
957 uint32_t request; 970 uint32_t request;
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
index 26c1f78d136f..d6d1da468c97 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/acpi.h b/include/linux/acpi.h
index 3f968665899b..f53fea61f40a 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
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 724c69c40bb8..7847e197730a 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 0101e9c17fa1..32a89cf5ec45 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 3672f40f3455..b8c51124ed19 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/amd-iommu.h b/include/linux/amd-iommu.h
index ef00610837d4..15f6b9edd0b1 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 000000000000..47bedc0eee69
--- /dev/null
+++ b/include/linux/apple_bl.h
@@ -0,0 +1,26 @@
1/*
2 * apple_bl exported symbols
3 */
4
5#ifndef _LINUX_APPLE_BL_H
6#define _LINUX_APPLE_BL_H
7
8#ifdef CONFIG_BACKLIGHT_APPLE
9
10extern int apple_bl_register(void);
11extern void apple_bl_unregister(void);
12
13#else /* !CONFIG_BACKLIGHT_APPLE */
14
15static inline int apple_bl_register(void)
16{
17 return 0;
18}
19
20static inline void apple_bl_unregister(void)
21{
22}
23
24#endif /* !CONFIG_BACKLIGHT_APPLE */
25
26#endif /* _LINUX_APPLE_BL_H */
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index f4ff882cb2da..06fd4bbc58f6 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 53ba65e30caa..1d14b1dc1aee 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 c3ab81428c66..896c6892f327 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 de5422a57511..4d94eb8bcbcc 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 ac4d9f8b52e9..3b5bafce4337 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 94300fe46cce..a3b6b82108b9 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 d276b5510c83..72961c39576a 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 a2f7d7413f30..4efabcb51347 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 7c48029dffe6..dfd7f187c351 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 c5b6939fb32a..220ae21e819b 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 95bd8502e715..e71d683982a6 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 4c5cb0880bba..9935fac8c107 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 ffbeb2c217b4..3bff047f6b0f 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -14,8 +14,6 @@
14struct ceph_msg; 14struct ceph_msg;
15struct ceph_connection; 15struct ceph_connection;
16 16
17extern struct workqueue_struct *ceph_msgr_wq; /* receive work queue */
18
19/* 17/*
20 * Ceph defines these callbacks for handling connection events. 18 * Ceph defines these callbacks for handling connection events.
21 */ 19 */
@@ -54,7 +52,6 @@ struct ceph_connection_operations {
54struct ceph_messenger { 52struct ceph_messenger {
55 struct ceph_entity_inst inst; /* my name+address */ 53 struct ceph_entity_inst inst; /* my name+address */
56 struct ceph_entity_addr my_enc_addr; 54 struct ceph_entity_addr my_enc_addr;
57 struct page *zero_page; /* used in certain error cases */
58 55
59 bool nocrc; 56 bool nocrc;
60 57
@@ -101,7 +98,7 @@ struct ceph_msg {
101struct ceph_msg_pos { 98struct ceph_msg_pos {
102 int page, page_pos; /* which page; offset in page */ 99 int page, page_pos; /* which page; offset in page */
103 int data_pos; /* offset in data payload */ 100 int data_pos; /* offset in data payload */
104 int did_page_crc; /* true if we've calculated crc for current page */ 101 bool did_page_crc; /* true if we've calculated crc for current page */
105}; 102};
106 103
107/* ceph connection fault delay defaults, for exponential backoff */ 104/* ceph connection fault delay defaults, for exponential backoff */
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index 04ffb2e6c9d0..42e55deee757 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -28,9 +28,9 @@ struct cleancache_ops {
28 pgoff_t, struct page *); 28 pgoff_t, struct page *);
29 void (*put_page)(int, struct cleancache_filekey, 29 void (*put_page)(int, struct cleancache_filekey,
30 pgoff_t, struct page *); 30 pgoff_t, struct page *);
31 void (*flush_page)(int, struct cleancache_filekey, pgoff_t); 31 void (*invalidate_page)(int, struct cleancache_filekey, pgoff_t);
32 void (*flush_inode)(int, struct cleancache_filekey); 32 void (*invalidate_inode)(int, struct cleancache_filekey);
33 void (*flush_fs)(int); 33 void (*invalidate_fs)(int);
34}; 34};
35 35
36extern struct cleancache_ops 36extern struct cleancache_ops
@@ -39,9 +39,9 @@ extern void __cleancache_init_fs(struct super_block *);
39extern void __cleancache_init_shared_fs(char *, struct super_block *); 39extern void __cleancache_init_shared_fs(char *, struct super_block *);
40extern int __cleancache_get_page(struct page *); 40extern int __cleancache_get_page(struct page *);
41extern void __cleancache_put_page(struct page *); 41extern void __cleancache_put_page(struct page *);
42extern void __cleancache_flush_page(struct address_space *, struct page *); 42extern void __cleancache_invalidate_page(struct address_space *, struct page *);
43extern void __cleancache_flush_inode(struct address_space *); 43extern void __cleancache_invalidate_inode(struct address_space *);
44extern void __cleancache_flush_fs(struct super_block *); 44extern void __cleancache_invalidate_fs(struct super_block *);
45extern int cleancache_enabled; 45extern int cleancache_enabled;
46 46
47#ifdef CONFIG_CLEANCACHE 47#ifdef CONFIG_CLEANCACHE
@@ -99,24 +99,24 @@ static inline void cleancache_put_page(struct page *page)
99 __cleancache_put_page(page); 99 __cleancache_put_page(page);
100} 100}
101 101
102static inline void cleancache_flush_page(struct address_space *mapping, 102static inline void cleancache_invalidate_page(struct address_space *mapping,
103 struct page *page) 103 struct page *page)
104{ 104{
105 /* careful... page->mapping is NULL sometimes when this is called */ 105 /* careful... page->mapping is NULL sometimes when this is called */
106 if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) 106 if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping))
107 __cleancache_flush_page(mapping, page); 107 __cleancache_invalidate_page(mapping, page);
108} 108}
109 109
110static inline void cleancache_flush_inode(struct address_space *mapping) 110static inline void cleancache_invalidate_inode(struct address_space *mapping)
111{ 111{
112 if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) 112 if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping))
113 __cleancache_flush_inode(mapping); 113 __cleancache_invalidate_inode(mapping);
114} 114}
115 115
116static inline void cleancache_flush_fs(struct super_block *sb) 116static inline void cleancache_invalidate_fs(struct super_block *sb)
117{ 117{
118 if (cleancache_enabled) 118 if (cleancache_enabled)
119 __cleancache_flush_fs(sb); 119 __cleancache_invalidate_fs(sb);
120} 120}
121 121
122#endif /* _LINUX_CLEANCACHE_H */ 122#endif /* _LINUX_CLEANCACHE_H */
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
new file mode 100644
index 000000000000..5e4312b6f5cc
--- /dev/null
+++ b/include/linux/clk-private.h
@@ -0,0 +1,196 @@
1/*
2 * linux/include/linux/clk-private.h
3 *
4 * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
5 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __LINUX_CLK_PRIVATE_H
12#define __LINUX_CLK_PRIVATE_H
13
14#include <linux/clk-provider.h>
15#include <linux/list.h>
16
17/*
18 * WARNING: Do not include clk-private.h from any file that implements struct
19 * clk_ops. Doing so is a layering violation!
20 *
21 * This header exists only to allow for statically initialized clock data. Any
22 * static clock data must be defined in a separate file from the logic that
23 * implements the clock operations for that same data.
24 */
25
26#ifdef CONFIG_COMMON_CLK
27
28struct clk {
29 const char *name;
30 const struct clk_ops *ops;
31 struct clk_hw *hw;
32 struct clk *parent;
33 char **parent_names;
34 struct clk **parents;
35 u8 num_parents;
36 unsigned long rate;
37 unsigned long new_rate;
38 unsigned long flags;
39 unsigned int enable_count;
40 unsigned int prepare_count;
41 struct hlist_head children;
42 struct hlist_node child_node;
43 unsigned int notifier_count;
44#ifdef CONFIG_COMMON_CLK_DEBUG
45 struct dentry *dentry;
46#endif
47};
48
49/*
50 * DOC: Basic clock implementations common to many platforms
51 *
52 * Each basic clock hardware type is comprised of a structure describing the
53 * clock hardware, implementations of the relevant callbacks in struct clk_ops,
54 * unique flags for that hardware type, a registration function and an
55 * alternative macro for static initialization
56 */
57
58extern struct clk_ops clk_fixed_rate_ops;
59
60#define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \
61 _fixed_rate_flags) \
62 static struct clk _name; \
63 static char *_name##_parent_names[] = {}; \
64 static struct clk_fixed_rate _name##_hw = { \
65 .hw = { \
66 .clk = &_name, \
67 }, \
68 .fixed_rate = _rate, \
69 .flags = _fixed_rate_flags, \
70 }; \
71 static struct clk _name = { \
72 .name = #_name, \
73 .ops = &clk_fixed_rate_ops, \
74 .hw = &_name##_hw.hw, \
75 .parent_names = _name##_parent_names, \
76 .num_parents = \
77 ARRAY_SIZE(_name##_parent_names), \
78 .flags = _flags, \
79 };
80
81extern struct clk_ops clk_gate_ops;
82
83#define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \
84 _flags, _reg, _bit_idx, \
85 _gate_flags, _lock) \
86 static struct clk _name; \
87 static char *_name##_parent_names[] = { \
88 _parent_name, \
89 }; \
90 static struct clk *_name##_parents[] = { \
91 _parent_ptr, \
92 }; \
93 static struct clk_gate _name##_hw = { \
94 .hw = { \
95 .clk = &_name, \
96 }, \
97 .reg = _reg, \
98 .bit_idx = _bit_idx, \
99 .flags = _gate_flags, \
100 .lock = _lock, \
101 }; \
102 static struct clk _name = { \
103 .name = #_name, \
104 .ops = &clk_gate_ops, \
105 .hw = &_name##_hw.hw, \
106 .parent_names = _name##_parent_names, \
107 .num_parents = \
108 ARRAY_SIZE(_name##_parent_names), \
109 .parents = _name##_parents, \
110 .flags = _flags, \
111 };
112
113extern struct clk_ops clk_divider_ops;
114
115#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
116 _flags, _reg, _shift, _width, \
117 _divider_flags, _lock) \
118 static struct clk _name; \
119 static char *_name##_parent_names[] = { \
120 _parent_name, \
121 }; \
122 static struct clk *_name##_parents[] = { \
123 _parent_ptr, \
124 }; \
125 static struct clk_divider _name##_hw = { \
126 .hw = { \
127 .clk = &_name, \
128 }, \
129 .reg = _reg, \
130 .shift = _shift, \
131 .width = _width, \
132 .flags = _divider_flags, \
133 .lock = _lock, \
134 }; \
135 static struct clk _name = { \
136 .name = #_name, \
137 .ops = &clk_divider_ops, \
138 .hw = &_name##_hw.hw, \
139 .parent_names = _name##_parent_names, \
140 .num_parents = \
141 ARRAY_SIZE(_name##_parent_names), \
142 .parents = _name##_parents, \
143 .flags = _flags, \
144 };
145
146extern struct clk_ops clk_mux_ops;
147
148#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \
149 _reg, _shift, _width, \
150 _mux_flags, _lock) \
151 static struct clk _name; \
152 static struct clk_mux _name##_hw = { \
153 .hw = { \
154 .clk = &_name, \
155 }, \
156 .reg = _reg, \
157 .shift = _shift, \
158 .width = _width, \
159 .flags = _mux_flags, \
160 .lock = _lock, \
161 }; \
162 static struct clk _name = { \
163 .name = #_name, \
164 .ops = &clk_mux_ops, \
165 .hw = &_name##_hw.hw, \
166 .parent_names = _parent_names, \
167 .num_parents = \
168 ARRAY_SIZE(_parent_names), \
169 .parents = _parents, \
170 .flags = _flags, \
171 };
172
173/**
174 * __clk_init - initialize the data structures in a struct clk
175 * @dev: device initializing this clk, placeholder for now
176 * @clk: clk being initialized
177 *
178 * Initializes the lists in struct clk, queries the hardware for the
179 * parent and rate and sets them both.
180 *
181 * Any struct clk passed into __clk_init must have the following members
182 * populated:
183 * .name
184 * .ops
185 * .hw
186 * .parent_names
187 * .num_parents
188 * .flags
189 *
190 * It is not necessary to call clk_register if __clk_init is used directly with
191 * statically initialized clock data.
192 */
193void __clk_init(struct device *dev, struct clk *clk);
194
195#endif /* CONFIG_COMMON_CLK */
196#endif /* CLK_PRIVATE_H */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
new file mode 100644
index 000000000000..5508897ad376
--- /dev/null
+++ b/include/linux/clk-provider.h
@@ -0,0 +1,300 @@
1/*
2 * linux/include/linux/clk-provider.h
3 *
4 * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
5 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __LINUX_CLK_PROVIDER_H
12#define __LINUX_CLK_PROVIDER_H
13
14#include <linux/clk.h>
15
16#ifdef CONFIG_COMMON_CLK
17
18/**
19 * struct clk_hw - handle for traversing from a struct clk to its corresponding
20 * hardware-specific structure. struct clk_hw should be declared within struct
21 * clk_foo and then referenced by the struct clk instance that uses struct
22 * clk_foo's clk_ops
23 *
24 * clk: pointer to the struct clk instance that points back to this struct
25 * clk_hw instance
26 */
27struct clk_hw {
28 struct clk *clk;
29};
30
31/*
32 * flags used across common struct clk. these flags should only affect the
33 * top-level framework. custom flags for dealing with hardware specifics
34 * belong in struct clk_foo
35 */
36#define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */
37#define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */
38#define CLK_SET_RATE_PARENT BIT(2) /* propagate rate change up one level */
39#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */
40#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
41
42/**
43 * struct clk_ops - Callback operations for hardware clocks; these are to
44 * be provided by the clock implementation, and will be called by drivers
45 * through the clk_* api.
46 *
47 * @prepare: Prepare the clock for enabling. This must not return until
48 * the clock is fully prepared, and it's safe to call clk_enable.
49 * This callback is intended to allow clock implementations to
50 * do any initialisation that may sleep. Called with
51 * prepare_lock held.
52 *
53 * @unprepare: Release the clock from its prepared state. This will typically
54 * undo any work done in the @prepare callback. Called with
55 * prepare_lock held.
56 *
57 * @enable: Enable the clock atomically. This must not return until the
58 * clock is generating a valid clock signal, usable by consumer
59 * devices. Called with enable_lock held. This function must not
60 * sleep.
61 *
62 * @disable: Disable the clock atomically. Called with enable_lock held.
63 * This function must not sleep.
64 *
65 * @recalc_rate Recalculate the rate of this clock, by quering hardware. The
66 * parent rate is an input parameter. It is up to the caller to
67 * insure that the prepare_mutex is held across this call.
68 * Returns the calculated rate. Optional, but recommended - if
69 * this op is not set then clock rate will be initialized to 0.
70 *
71 * @round_rate: Given a target rate as input, returns the closest rate actually
72 * supported by the clock.
73 *
74 * @get_parent: Queries the hardware to determine the parent of a clock. The
75 * return value is a u8 which specifies the index corresponding to
76 * the parent clock. This index can be applied to either the
77 * .parent_names or .parents arrays. In short, this function
78 * translates the parent value read from hardware into an array
79 * index. Currently only called when the clock is initialized by
80 * __clk_init. This callback is mandatory for clocks with
81 * multiple parents. It is optional (and unnecessary) for clocks
82 * with 0 or 1 parents.
83 *
84 * @set_parent: Change the input source of this clock; for clocks with multiple
85 * possible parents specify a new parent by passing in the index
86 * as a u8 corresponding to the parent in either the .parent_names
87 * or .parents arrays. This function in affect translates an
88 * array index into the value programmed into the hardware.
89 * Returns 0 on success, -EERROR otherwise.
90 *
91 * @set_rate: Change the rate of this clock. If this callback returns
92 * CLK_SET_RATE_PARENT, the rate change will be propagated to the
93 * parent clock (which may propagate again if the parent clock
94 * also sets this flag). The requested rate of the parent is
95 * passed back from the callback in the second 'unsigned long *'
96 * argument. Note that it is up to the hardware clock's set_rate
97 * implementation to insure that clocks do not run out of spec
98 * when propgating the call to set_rate up to the parent. One way
99 * to do this is to gate the clock (via clk_disable and/or
100 * clk_unprepare) before calling clk_set_rate, then ungating it
101 * afterward. If your clock also has the CLK_GATE_SET_RATE flag
102 * set then this will insure safety. Returns 0 on success,
103 * -EERROR otherwise.
104 *
105 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
106 * implementations to split any work between atomic (enable) and sleepable
107 * (prepare) contexts. If enabling a clock requires code that might sleep,
108 * this must be done in clk_prepare. Clock enable code that will never be
109 * called in a sleepable context may be implement in clk_enable.
110 *
111 * Typically, drivers will call clk_prepare when a clock may be needed later
112 * (eg. when a device is opened), and clk_enable when the clock is actually
113 * required (eg. from an interrupt). Note that clk_prepare MUST have been
114 * called before clk_enable.
115 */
116struct clk_ops {
117 int (*prepare)(struct clk_hw *hw);
118 void (*unprepare)(struct clk_hw *hw);
119 int (*enable)(struct clk_hw *hw);
120 void (*disable)(struct clk_hw *hw);
121 int (*is_enabled)(struct clk_hw *hw);
122 unsigned long (*recalc_rate)(struct clk_hw *hw,
123 unsigned long parent_rate);
124 long (*round_rate)(struct clk_hw *hw, unsigned long,
125 unsigned long *);
126 int (*set_parent)(struct clk_hw *hw, u8 index);
127 u8 (*get_parent)(struct clk_hw *hw);
128 int (*set_rate)(struct clk_hw *hw, unsigned long);
129 void (*init)(struct clk_hw *hw);
130};
131
132/*
133 * DOC: Basic clock implementations common to many platforms
134 *
135 * Each basic clock hardware type is comprised of a structure describing the
136 * clock hardware, implementations of the relevant callbacks in struct clk_ops,
137 * unique flags for that hardware type, a registration function and an
138 * alternative macro for static initialization
139 */
140
141/**
142 * struct clk_fixed_rate - fixed-rate clock
143 * @hw: handle between common and hardware-specific interfaces
144 * @fixed_rate: constant frequency of clock
145 */
146struct clk_fixed_rate {
147 struct clk_hw hw;
148 unsigned long fixed_rate;
149 u8 flags;
150};
151
152struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
153 const char *parent_name, unsigned long flags,
154 unsigned long fixed_rate);
155
156/**
157 * struct clk_gate - gating clock
158 *
159 * @hw: handle between common and hardware-specific interfaces
160 * @reg: register controlling gate
161 * @bit_idx: single bit controlling gate
162 * @flags: hardware-specific flags
163 * @lock: register lock
164 *
165 * Clock which can gate its output. Implements .enable & .disable
166 *
167 * Flags:
168 * CLK_GATE_SET_DISABLE - by default this clock sets the bit at bit_idx to
169 * enable the clock. Setting this flag does the opposite: setting the bit
170 * disable the clock and clearing it enables the clock
171 */
172struct clk_gate {
173 struct clk_hw hw;
174 void __iomem *reg;
175 u8 bit_idx;
176 u8 flags;
177 spinlock_t *lock;
178 char *parent[1];
179};
180
181#define CLK_GATE_SET_TO_DISABLE BIT(0)
182
183struct clk *clk_register_gate(struct device *dev, const char *name,
184 const char *parent_name, unsigned long flags,
185 void __iomem *reg, u8 bit_idx,
186 u8 clk_gate_flags, spinlock_t *lock);
187
188/**
189 * struct clk_divider - adjustable divider clock
190 *
191 * @hw: handle between common and hardware-specific interfaces
192 * @reg: register containing the divider
193 * @shift: shift to the divider bit field
194 * @width: width of the divider bit field
195 * @lock: register lock
196 *
197 * Clock with an adjustable divider affecting its output frequency. Implements
198 * .recalc_rate, .set_rate and .round_rate
199 *
200 * Flags:
201 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the
202 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is
203 * the raw value read from the register, with the value of zero considered
204 * invalid
205 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from
206 * the hardware register
207 */
208struct clk_divider {
209 struct clk_hw hw;
210 void __iomem *reg;
211 u8 shift;
212 u8 width;
213 u8 flags;
214 spinlock_t *lock;
215 char *parent[1];
216};
217
218#define CLK_DIVIDER_ONE_BASED BIT(0)
219#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
220
221struct clk *clk_register_divider(struct device *dev, const char *name,
222 const char *parent_name, unsigned long flags,
223 void __iomem *reg, u8 shift, u8 width,
224 u8 clk_divider_flags, spinlock_t *lock);
225
226/**
227 * struct clk_mux - multiplexer clock
228 *
229 * @hw: handle between common and hardware-specific interfaces
230 * @reg: register controlling multiplexer
231 * @shift: shift to multiplexer bit field
232 * @width: width of mutliplexer bit field
233 * @num_clks: number of parent clocks
234 * @lock: register lock
235 *
236 * Clock with multiple selectable parents. Implements .get_parent, .set_parent
237 * and .recalc_rate
238 *
239 * Flags:
240 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
241 * CLK_MUX_INDEX_BITWISE - register index is a single bit (power of two)
242 */
243struct clk_mux {
244 struct clk_hw hw;
245 void __iomem *reg;
246 u8 shift;
247 u8 width;
248 u8 flags;
249 spinlock_t *lock;
250};
251
252#define CLK_MUX_INDEX_ONE BIT(0)
253#define CLK_MUX_INDEX_BIT BIT(1)
254
255struct clk *clk_register_mux(struct device *dev, const char *name,
256 char **parent_names, u8 num_parents, unsigned long flags,
257 void __iomem *reg, u8 shift, u8 width,
258 u8 clk_mux_flags, spinlock_t *lock);
259
260/**
261 * clk_register - allocate a new clock, register it and return an opaque cookie
262 * @dev: device that is registering this clock
263 * @name: clock name
264 * @ops: operations this clock supports
265 * @hw: link to hardware-specific clock data
266 * @parent_names: array of string names for all possible parents
267 * @num_parents: number of possible parents
268 * @flags: framework-level hints and quirks
269 *
270 * clk_register is the primary interface for populating the clock tree with new
271 * clock nodes. It returns a pointer to the newly allocated struct clk which
272 * cannot be dereferenced by driver code but may be used in conjuction with the
273 * rest of the clock API.
274 */
275struct clk *clk_register(struct device *dev, const char *name,
276 const struct clk_ops *ops, struct clk_hw *hw,
277 char **parent_names, u8 num_parents, unsigned long flags);
278
279/* helper functions */
280const char *__clk_get_name(struct clk *clk);
281struct clk_hw *__clk_get_hw(struct clk *clk);
282u8 __clk_get_num_parents(struct clk *clk);
283struct clk *__clk_get_parent(struct clk *clk);
284inline int __clk_get_enable_count(struct clk *clk);
285inline int __clk_get_prepare_count(struct clk *clk);
286unsigned long __clk_get_rate(struct clk *clk);
287unsigned long __clk_get_flags(struct clk *clk);
288int __clk_is_enabled(struct clk *clk);
289struct clk *__clk_lookup(const char *name);
290
291/*
292 * FIXME clock api without lock protection
293 */
294int __clk_prepare(struct clk *clk);
295void __clk_unprepare(struct clk *clk);
296void __clk_reparent(struct clk *clk, struct clk *new_parent);
297unsigned long __clk_round_rate(struct clk *clk, unsigned long rate);
298
299#endif /* CONFIG_COMMON_CLK */
300#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b9d46fa154b4..b0252726df61 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2004 ARM Limited. 4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited. 5 * Written by Deep Blue Solutions Limited.
6 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -12,18 +13,75 @@
12#define __LINUX_CLK_H 13#define __LINUX_CLK_H
13 14
14#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/notifier.h>
15 17
16struct device; 18struct device;
17 19
18/* 20struct clk;
19 * The base API. 21
22#ifdef CONFIG_COMMON_CLK
23
24/**
25 * DOC: clk notifier callback types
26 *
27 * PRE_RATE_CHANGE - called immediately before the clk rate is changed,
28 * to indicate that the rate change will proceed. Drivers must
29 * immediately terminate any operations that will be affected by the
30 * rate change. Callbacks may either return NOTIFY_DONE or
31 * NOTIFY_STOP.
32 *
33 * ABORT_RATE_CHANGE: called if the rate change failed for some reason
34 * after PRE_RATE_CHANGE. In this case, all registered notifiers on
35 * the clk will be called with ABORT_RATE_CHANGE. Callbacks must
36 * always return NOTIFY_DONE.
37 *
38 * POST_RATE_CHANGE - called after the clk rate change has successfully
39 * completed. Callbacks must always return NOTIFY_DONE.
40 *
20 */ 41 */
42#define PRE_RATE_CHANGE BIT(0)
43#define POST_RATE_CHANGE BIT(1)
44#define ABORT_RATE_CHANGE BIT(2)
21 45
46/**
47 * struct clk_notifier - associate a clk with a notifier
48 * @clk: struct clk * to associate the notifier with
49 * @notifier_head: a blocking_notifier_head for this clk
50 * @node: linked list pointers
51 *
52 * A list of struct clk_notifier is maintained by the notifier code.
53 * An entry is created whenever code registers the first notifier on a
54 * particular @clk. Future notifiers on that @clk are added to the
55 * @notifier_head.
56 */
57struct clk_notifier {
58 struct clk *clk;
59 struct srcu_notifier_head notifier_head;
60 struct list_head node;
61};
22 62
23/* 63/**
24 * struct clk - an machine class defined object / cookie. 64 * struct clk_notifier_data - rate data to pass to the notifier callback
65 * @clk: struct clk * being changed
66 * @old_rate: previous rate of this clk
67 * @new_rate: new rate of this clk
68 *
69 * For a pre-notifier, old_rate is the clk's rate before this rate
70 * change, and new_rate is what the rate will be in the future. For a
71 * post-notifier, old_rate and new_rate are both set to the clk's
72 * current rate (this was done to optimize the implementation).
25 */ 73 */
26struct clk; 74struct clk_notifier_data {
75 struct clk *clk;
76 unsigned long old_rate;
77 unsigned long new_rate;
78};
79
80int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
81
82int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
83
84#endif /* !CONFIG_COMMON_CLK */
27 85
28/** 86/**
29 * clk_get - lookup and obtain a reference to a clock producer. 87 * clk_get - lookup and obtain a reference to a clock producer.
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h
index e3d8bf26e5eb..aa629bce9033 100644
--- a/include/linux/cnt32_to_63.h
+++ b/include/linux/cnt32_to_63.h
@@ -16,7 +16,6 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/byteorder.h> 18#include <asm/byteorder.h>
19#include <asm/system.h>
20 19
21/* this is used only to give gcc a clue about good code generation */ 20/* this is used only to give gcc a clue about good code generation */
22union cnt32_to_63 { 21union cnt32_to_63 {
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 3fd17c249221..e5834aa24b9e 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 6e53b4823d7f..ee28844ae68e 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 6216115c7789..b60f6ba01d0c 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/cpumask.h b/include/linux/cpumask.h
index 4f7a63237471..1ffdb9856bb9 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
@@ -809,11 +810,10 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
809#else /* NR_CPUS > 1 */ 810#else /* NR_CPUS > 1 */
810int __first_cpu(const cpumask_t *srcp); 811int __first_cpu(const cpumask_t *srcp);
811int __next_cpu(int n, const cpumask_t *srcp); 812int __next_cpu(int n, const cpumask_t *srcp);
812int __any_online_cpu(const cpumask_t *mask);
813 813
814#define first_cpu(src) __first_cpu(&(src)) 814#define first_cpu(src) __first_cpu(&(src))
815#define next_cpu(n, src) __next_cpu((n), &(src)) 815#define next_cpu(n, src) __next_cpu((n), &(src))
816#define any_online_cpu(mask) __any_online_cpu(&(mask)) 816#define any_online_cpu(mask) cpumask_any_and(&mask, cpu_online_mask)
817#define for_each_cpu_mask(cpu, mask) \ 817#define for_each_cpu_mask(cpu, mask) \
818 for ((cpu) = -1; \ 818 for ((cpu) = -1; \
819 (cpu) = next_cpu((cpu), (mask)), \ 819 (cpu) = next_cpu((cpu), (mask)), \
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index b936763f2236..37e4f8da7cdf 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 391a259b2cc9..68267b64bb98 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 48ce5479386c..b92eadf92d72 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 5033fb88c107..3bd46f766751 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 f8ac076afa52..3efbfc2145c3 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/dmaengine.h b/include/linux/dmaengine.h
index 679b349d9b66..a5966f691ef8 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -23,6 +23,7 @@
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>
28#include <asm/page.h> 29#include <asm/page.h>
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 1cd3947987e5..c621d762bb2c 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 47fbf6b3dc77..88ec80670d5f 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -22,7 +22,6 @@
22#include <linux/pstore.h> 22#include <linux/pstore.h>
23 23
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/system.h>
26 25
27#define EFI_SUCCESS 0 26#define EFI_SUCCESS 0
28#define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1))) 27#define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1)))
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 394a3e0e4a6b..0698c79fbcb2 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/ext3_fs.h b/include/linux/ext3_fs.h
index f957085d40ed..f5a84eef6ed2 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -18,6 +18,7 @@
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/bug.h>
21 22
22/* 23/*
23 * The second extended filesystem constants/structures 24 * The second extended filesystem constants/structures
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c18122f40543..d31cb682e173 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>
@@ -1003,6 +1002,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
1003/* drivers/video/fbmem.c */ 1002/* drivers/video/fbmem.c */
1004extern int register_framebuffer(struct fb_info *fb_info); 1003extern int register_framebuffer(struct fb_info *fb_info);
1005extern int unregister_framebuffer(struct fb_info *fb_info); 1004extern int unregister_framebuffer(struct fb_info *fb_info);
1005extern int unlink_framebuffer(struct fb_info *fb_info);
1006extern void remove_conflicting_framebuffers(struct apertures_struct *a, 1006extern void remove_conflicting_framebuffers(struct apertures_struct *a,
1007 const char *name, bool primary); 1007 const char *name, bool primary);
1008extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); 1008extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 357dbfc2829e..d50036953497 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 84ccf8e04fa6..4db7b68f0582 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 9bbe1a9ac432..c437f914d537 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -389,6 +389,7 @@ struct inodes_stat_t {
389#include <linux/prio_tree.h> 389#include <linux/prio_tree.h>
390#include <linux/init.h> 390#include <linux/init.h>
391#include <linux/pid.h> 391#include <linux/pid.h>
392#include <linux/bug.h>
392#include <linux/mutex.h> 393#include <linux/mutex.h>
393#include <linux/capability.h> 394#include <linux/capability.h>
394#include <linux/semaphore.h> 395#include <linux/semaphore.h>
@@ -1871,19 +1872,6 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1871 const struct dentry_operations *dops, 1872 const struct dentry_operations *dops,
1872 unsigned long); 1873 unsigned long);
1873 1874
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 */ 1875/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1888#define fops_get(fops) \ 1876#define fops_get(fops) \
1889 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) 1877 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 2a53f10712b3..a6dfe6944564 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/gpio.h b/include/linux/gpio.h
index 38ac48b7d3a8..6155ecf192b0 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -14,6 +14,12 @@
14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) 14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) 15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
16 16
17/* Gpio pin is open drain */
18#define GPIOF_OPEN_DRAIN (1 << 2)
19
20/* Gpio pin is open source */
21#define GPIOF_OPEN_SOURCE (1 << 3)
22
17/** 23/**
18 * struct gpio - a structure describing a GPIO with configuration 24 * struct gpio - a structure describing a GPIO with configuration
19 * @gpio: the GPIO number 25 * @gpio: the GPIO number
@@ -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/highmem.h b/include/linux/highmem.h
index 6549ed75e0a7..d3999b4e26cc 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 a90c09d331c1..1c7b89ae6bdc 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 6b6ee702b007..82b29ae6ebb0 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 aad6bd4b3efd..3343298e40e8 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 4f98148c11c3..63904ba6887e 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -15,7 +15,8 @@
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 MA 02110-1301 USA. */
19/* ------------------------------------------------------------------------- */ 20/* ------------------------------------------------------------------------- */
20 21
21/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even 22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
@@ -49,5 +50,6 @@ struct i2c_algo_bit_data {
49 50
50int i2c_bit_add_bus(struct i2c_adapter *); 51int i2c_bit_add_bus(struct i2c_adapter *);
51int i2c_bit_add_numbered_bus(struct i2c_adapter *); 52int i2c_bit_add_numbered_bus(struct i2c_adapter *);
53extern const struct i2c_algorithm i2c_bit_algo;
52 54
53#endif /* _LINUX_I2C_ALGO_BIT_H */ 55#endif /* _LINUX_I2C_ALGO_BIT_H */
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 0f91a957a690..538e8f41a319 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -16,7 +16,8 @@
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA. */
20/* ------------------------------------------------------------------------- */ 21/* ------------------------------------------------------------------------- */
21 22
22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even 23/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h
index fd53bfd26470..8a7406b2114d 100644
--- a/include/linux/i2c-dev.h
+++ b/include/linux/i2c-dev.h
@@ -16,7 +16,8 @@
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA.
20*/ 21*/
21 22
22#ifndef _LINUX_I2C_DEV_H 23#ifndef _LINUX_I2C_DEV_H
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index 34536effd652..747f0cde4164 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -18,7 +18,8 @@
18 * 18 *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301 USA.
22 */ 23 */
23 24
24#ifndef _LINUX_I2C_MUX_H 25#ifndef _LINUX_I2C_MUX_H
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h
index 63f57a8c8b31..017fb40f702a 100644
--- a/include/linux/i2c-smbus.h
+++ b/include/linux/i2c-smbus.h
@@ -15,7 +15,8 @@
15 * 15 *
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301 USA.
19 */ 20 */
20 21
21#ifndef _LINUX_I2C_SMBUS_H 22#ifndef _LINUX_I2C_SMBUS_H
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 8e25a9167f13..195d8b3d9cfb 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -17,7 +17,8 @@
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 MA 02110-1301 USA. */
21/* ------------------------------------------------------------------------- */ 22/* ------------------------------------------------------------------------- */
22 23
23/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and 24/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h
index 8ace93024d60..285025a9cdc9 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/tc35876x.h b/include/linux/i2c/tc35876x.h
new file mode 100644
index 000000000000..cd6a51c71e7e
--- /dev/null
+++ b/include/linux/i2c/tc35876x.h
@@ -0,0 +1,11 @@
1
2#ifndef _TC35876X_H
3#define _TC35876X_H
4
5struct tc35876x_platform_data {
6 int gpio_bridge_reset;
7 int gpio_panel_bl_en;
8 int gpio_panel_vadd;
9};
10
11#endif /* _TC35876X_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 7fcab23c59ce..2463b6100333 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -761,7 +761,7 @@ struct twl_regulator_driver_data {
761 761
762/*----------------------------------------------------------------------*/ 762/*----------------------------------------------------------------------*/
763 763
764int twl4030_sih_setup(int module); 764int twl4030_sih_setup(struct device *dev, int module, int irq_base);
765 765
766/* Offsets to Power Registers */ 766/* Offsets to Power Registers */
767#define TWL4030_VDAC_DEV_GRP 0x3B 767#define TWL4030_VDAC_DEV_GRP 0x3B
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index a6deef4f4f67..d23c3c20b201 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 501370b61ee5..b17974917dbf 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 33a6e1951d4d..a810987cb80e 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 3862e32c4eeb..a81671453575 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 000000000000..5af7c66f1fca
--- /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 000000000000..a5471245a13c
--- /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 f6bac89537b8..d415579b56fe 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 fe7c4b9ae270..6c07ced0af81 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 318bb82325a6..f86737586e19 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 000000000000..b10a527a92a4
--- /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 3f830e005118..2aea5d22db07 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -19,7 +19,6 @@
19 19
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/system.h>
23 22
24/* 23/*
25 * These correspond to the IORESOURCE_IRQ_* defines in 24 * These correspond to the IORESOURCE_IRQ_* defines in
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index e44e84f0156c..657fab4efab3 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 9d57a71775b5..e885ba23de70 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 bbd156bb953b..48dcba9b2065 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 3ef0d8b6aa6f..fcb5d44ea635 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 062d20f74322..42bf725751af 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 5557baefed60..912c30a8ddb1 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -971,6 +971,10 @@ extern void __journal_clean_data_list(transaction_t *transaction);
971/* Log buffer allocation */ 971/* Log buffer allocation */
972extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); 972extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *);
973int jbd2_journal_next_log_block(journal_t *, unsigned long long *); 973int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
974int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
975 unsigned long *block);
976void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
977void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
974 978
975/* Commit management */ 979/* Commit management */
976extern void jbd2_journal_commit_transaction(journal_t *); 980extern void jbd2_journal_commit_transaction(journal_t *);
@@ -1020,6 +1024,11 @@ jbd2_journal_write_metadata_buffer(transaction_t *transaction,
1020/* Transaction locking */ 1024/* Transaction locking */
1021extern void __wait_on_journal (journal_t *); 1025extern void __wait_on_journal (journal_t *);
1022 1026
1027/* Transaction cache support */
1028extern void jbd2_journal_destroy_transaction_cache(void);
1029extern int jbd2_journal_init_transaction_cache(void);
1030extern void jbd2_journal_free_transaction(transaction_t *);
1031
1023/* 1032/*
1024 * Journal locking. 1033 * Journal locking.
1025 * 1034 *
@@ -1082,7 +1091,8 @@ extern int jbd2_journal_destroy (journal_t *);
1082extern int jbd2_journal_recover (journal_t *journal); 1091extern int jbd2_journal_recover (journal_t *journal);
1083extern int jbd2_journal_wipe (journal_t *, int); 1092extern int jbd2_journal_wipe (journal_t *, int);
1084extern int jbd2_journal_skip_recovery (journal_t *); 1093extern int jbd2_journal_skip_recovery (journal_t *);
1085extern void jbd2_journal_update_superblock (journal_t *, int); 1094extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t,
1095 unsigned long, int);
1086extern void __jbd2_journal_abort_hard (journal_t *); 1096extern void __jbd2_journal_abort_hard (journal_t *);
1087extern void jbd2_journal_abort (journal_t *, int); 1097extern void jbd2_journal_abort (journal_t *, int);
1088extern int jbd2_journal_errno (journal_t *); 1098extern int jbd2_journal_errno (journal_t *);
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 423cb6d78ee0..c18b46f8aeeb 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -66,6 +66,8 @@ struct journal_head {
66 * transaction (if there is one). Only applies to buffers on a 66 * transaction (if there is one). Only applies to buffers on a
67 * transaction's data or metadata journaling list. 67 * transaction's data or metadata journaling list.
68 * [j_list_lock] [jbd_lock_bh_state()] 68 * [j_list_lock] [jbd_lock_bh_state()]
69 * Either of these locks is enough for reading, both are needed for
70 * changes.
69 */ 71 */
70 transaction_t *b_transaction; 72 transaction_t *b_transaction;
71 73
diff --git a/include/linux/jz4740-adc.h b/include/linux/jz4740-adc.h
index 9053f95e9687..8184578fbfa4 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 d801acb5e680..5db52d0ff1d4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -20,7 +20,6 @@
20#include <linux/printk.h> 20#include <linux/printk.h>
21#include <linux/dynamic_debug.h> 21#include <linux/dynamic_debug.h>
22#include <asm/byteorder.h> 22#include <asm/byteorder.h>
23#include <asm/bug.h>
24 23
25#define USHRT_MAX ((u16)(~0U)) 24#define USHRT_MAX ((u16)(~0U))
26#define SHRT_MAX ((s16)(USHRT_MAX>>1)) 25#define SHRT_MAX ((s16)(USHRT_MAX>>1))
@@ -312,6 +311,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int);
312#define strict_strtoull kstrtoull 311#define strict_strtoull kstrtoull
313#define strict_strtoll kstrtoll 312#define strict_strtoll kstrtoll
314 313
314extern int num_to_str(char *buf, int size, unsigned long long num);
315
315/* lib/printf utilities */ 316/* lib/printf utilities */
316 317
317extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); 318extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...);
@@ -328,10 +329,10 @@ extern __printf(2, 3)
328char *kasprintf(gfp_t gfp, const char *fmt, ...); 329char *kasprintf(gfp_t gfp, const char *fmt, ...);
329extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); 330extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
330 331
331extern int sscanf(const char *, const char *, ...) 332extern __scanf(2, 3)
332 __attribute__ ((format (scanf, 2, 3))); 333int sscanf(const char *, const char *, ...);
333extern int vsscanf(const char *, const char *, va_list) 334extern __scanf(2, 0)
334 __attribute__ ((format (scanf, 2, 0))); 335int vsscanf(const char *, const char *, va_list);
335 336
336extern int get_option(char **str, int *pint); 337extern int get_option(char **str, int *pint);
337extern char *get_options(const char *str, int nints, int *ints); 338extern char *get_options(const char *str, int nints, int *ints);
@@ -675,67 +676,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
675 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 676 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
676 (type *)( (char *)__mptr - offsetof(type,member) );}) 677 (type *)( (char *)__mptr - offsetof(type,member) );})
677 678
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 */ 679/* Trap pasters of __FUNCTION__ at compile-time */
740#define __FUNCTION__ (__func__) 680#define __FUNCTION__ (__func__)
741 681
diff --git a/include/linux/key.h b/include/linux/key.h
index 1600ebf717a7..96933b1e5d24 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 722f477c4ef7..9efeae679106 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 dce6e4dbeda7..b6e1f8c00577 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 68e67e50d028..6c322a90b92f 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -162,6 +162,7 @@ struct kvm_pit_config {
162#define KVM_EXIT_INTERNAL_ERROR 17 162#define KVM_EXIT_INTERNAL_ERROR 17
163#define KVM_EXIT_OSI 18 163#define KVM_EXIT_OSI 18
164#define KVM_EXIT_PAPR_HCALL 19 164#define KVM_EXIT_PAPR_HCALL 19
165#define KVM_EXIT_S390_UCONTROL 20
165 166
166/* For KVM_EXIT_INTERNAL_ERROR */ 167/* For KVM_EXIT_INTERNAL_ERROR */
167#define KVM_INTERNAL_ERROR_EMULATION 1 168#define KVM_INTERNAL_ERROR_EMULATION 1
@@ -249,6 +250,11 @@ struct kvm_run {
249#define KVM_S390_RESET_CPU_INIT 8 250#define KVM_S390_RESET_CPU_INIT 8
250#define KVM_S390_RESET_IPL 16 251#define KVM_S390_RESET_IPL 16
251 __u64 s390_reset_flags; 252 __u64 s390_reset_flags;
253 /* KVM_EXIT_S390_UCONTROL */
254 struct {
255 __u64 trans_exc_code;
256 __u32 pgm_code;
257 } s390_ucontrol;
252 /* KVM_EXIT_DCR */ 258 /* KVM_EXIT_DCR */
253 struct { 259 struct {
254 __u32 dcrn; 260 __u32 dcrn;
@@ -273,6 +279,20 @@ struct kvm_run {
273 /* Fix the size of the union. */ 279 /* Fix the size of the union. */
274 char padding[256]; 280 char padding[256];
275 }; 281 };
282
283 /*
284 * shared registers between kvm and userspace.
285 * kvm_valid_regs specifies the register classes set by the host
286 * kvm_dirty_regs specified the register classes dirtied by userspace
287 * struct kvm_sync_regs is architecture specific, as well as the
288 * bits for kvm_valid_regs and kvm_dirty_regs
289 */
290 __u64 kvm_valid_regs;
291 __u64 kvm_dirty_regs;
292 union {
293 struct kvm_sync_regs regs;
294 char padding[1024];
295 } s;
276}; 296};
277 297
278/* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ 298/* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */
@@ -431,6 +451,11 @@ struct kvm_ppc_pvinfo {
431 451
432#define KVMIO 0xAE 452#define KVMIO 0xAE
433 453
454/* machine type bits, to be used as argument to KVM_CREATE_VM */
455#define KVM_VM_S390_UCONTROL 1
456
457#define KVM_S390_SIE_PAGE_OFFSET 1
458
434/* 459/*
435 * ioctls for /dev/kvm fds: 460 * ioctls for /dev/kvm fds:
436 */ 461 */
@@ -555,9 +580,15 @@ struct kvm_ppc_pvinfo {
555#define KVM_CAP_PPC_SMT 64 580#define KVM_CAP_PPC_SMT 64
556#define KVM_CAP_PPC_RMA 65 581#define KVM_CAP_PPC_RMA 65
557#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ 582#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */
583#define KVM_CAP_PPC_HIOR 67
558#define KVM_CAP_PPC_PAPR 68 584#define KVM_CAP_PPC_PAPR 68
585#define KVM_CAP_SW_TLB 69
586#define KVM_CAP_ONE_REG 70
559#define KVM_CAP_S390_GMAP 71 587#define KVM_CAP_S390_GMAP 71
560#define KVM_CAP_TSC_DEADLINE_TIMER 72 588#define KVM_CAP_TSC_DEADLINE_TIMER 72
589#define KVM_CAP_S390_UCONTROL 73
590#define KVM_CAP_SYNC_REGS 74
591#define KVM_CAP_PCI_2_3 75
561 592
562#ifdef KVM_CAP_IRQ_ROUTING 593#ifdef KVM_CAP_IRQ_ROUTING
563 594
@@ -637,6 +668,52 @@ struct kvm_clock_data {
637 __u32 pad[9]; 668 __u32 pad[9];
638}; 669};
639 670
671#define KVM_MMU_FSL_BOOKE_NOHV 0
672#define KVM_MMU_FSL_BOOKE_HV 1
673
674struct kvm_config_tlb {
675 __u64 params;
676 __u64 array;
677 __u32 mmu_type;
678 __u32 array_len;
679};
680
681struct kvm_dirty_tlb {
682 __u64 bitmap;
683 __u32 num_dirty;
684};
685
686/* Available with KVM_CAP_ONE_REG */
687
688#define KVM_REG_ARCH_MASK 0xff00000000000000ULL
689#define KVM_REG_GENERIC 0x0000000000000000ULL
690
691/*
692 * Architecture specific registers are to be defined in arch headers and
693 * ORed with the arch identifier.
694 */
695#define KVM_REG_PPC 0x1000000000000000ULL
696#define KVM_REG_X86 0x2000000000000000ULL
697#define KVM_REG_IA64 0x3000000000000000ULL
698#define KVM_REG_ARM 0x4000000000000000ULL
699#define KVM_REG_S390 0x5000000000000000ULL
700
701#define KVM_REG_SIZE_SHIFT 52
702#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
703#define KVM_REG_SIZE_U8 0x0000000000000000ULL
704#define KVM_REG_SIZE_U16 0x0010000000000000ULL
705#define KVM_REG_SIZE_U32 0x0020000000000000ULL
706#define KVM_REG_SIZE_U64 0x0030000000000000ULL
707#define KVM_REG_SIZE_U128 0x0040000000000000ULL
708#define KVM_REG_SIZE_U256 0x0050000000000000ULL
709#define KVM_REG_SIZE_U512 0x0060000000000000ULL
710#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
711
712struct kvm_one_reg {
713 __u64 id;
714 __u64 addr;
715};
716
640/* 717/*
641 * ioctls for VM fds 718 * ioctls for VM fds
642 */ 719 */
@@ -655,6 +732,17 @@ struct kvm_clock_data {
655 struct kvm_userspace_memory_region) 732 struct kvm_userspace_memory_region)
656#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) 733#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
657#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) 734#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
735
736/* enable ucontrol for s390 */
737struct kvm_s390_ucas_mapping {
738 __u64 user_addr;
739 __u64 vcpu_addr;
740 __u64 length;
741};
742#define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
743#define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
744#define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
745
658/* Device model IOC */ 746/* Device model IOC */
659#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) 747#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
660#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 748#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
@@ -697,6 +785,9 @@ struct kvm_clock_data {
697/* Available with KVM_CAP_TSC_CONTROL */ 785/* Available with KVM_CAP_TSC_CONTROL */
698#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) 786#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
699#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) 787#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
788/* Available with KVM_CAP_PCI_2_3 */
789#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \
790 struct kvm_assigned_pci_dev)
700 791
701/* 792/*
702 * ioctls for vcpu fds 793 * ioctls for vcpu fds
@@ -763,8 +854,15 @@ struct kvm_clock_data {
763#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) 854#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
764/* Available with KVM_CAP_RMA */ 855/* Available with KVM_CAP_RMA */
765#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) 856#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
857/* Available with KVM_CAP_SW_TLB */
858#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
859/* Available with KVM_CAP_ONE_REG */
860#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg)
861#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
766 862
767#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 863#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
864#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
865#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)
768 866
769struct kvm_assigned_pci_dev { 867struct kvm_assigned_pci_dev {
770 __u32 assigned_dev_id; 868 __u32 assigned_dev_id;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 900c76337e8f..665a260c7e09 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 8eb12357a110..eeae6e742471 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 fd548d2a8775..3f071ec019b2 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/libata.h b/include/linux/libata.h
index cafc09a64fe4..42378d637ffb 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -996,6 +996,7 @@ extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
996extern void ata_sas_port_destroy(struct ata_port *); 996extern void ata_sas_port_destroy(struct ata_port *);
997extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 997extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
998 struct ata_port_info *, struct Scsi_Host *); 998 struct ata_port_info *, struct Scsi_Host *);
999extern int ata_sas_async_port_init(struct ata_port *);
999extern int ata_sas_port_init(struct ata_port *); 1000extern int ata_sas_port_init(struct ata_port *);
1000extern int ata_sas_port_start(struct ata_port *ap); 1001extern int ata_sas_port_start(struct ata_port *ap);
1001extern void ata_sas_port_stop(struct ata_port *ap); 1002extern void ata_sas_port_stop(struct ata_port *ap);
@@ -1147,6 +1148,7 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
1147 * EH - drivers/ata/libata-eh.c 1148 * EH - drivers/ata/libata-eh.c
1148 */ 1149 */
1149extern void ata_port_schedule_eh(struct ata_port *ap); 1150extern void ata_port_schedule_eh(struct ata_port *ap);
1151extern void ata_port_wait_eh(struct ata_port *ap);
1150extern int ata_link_abort(struct ata_link *link); 1152extern int ata_link_abort(struct ata_link *link);
1151extern int ata_port_abort(struct ata_port *ap); 1153extern int ata_port_abort(struct ata_port *ap);
1152extern int ata_port_freeze(struct ata_port *ap); 1154extern int ata_port_freeze(struct ata_port *ap);
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 801b44b07aac..a5199f6d0e82 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -56,8 +56,7 @@
56 */ 56 */
57 57
58#include <linux/kernel.h> 58#include <linux/kernel.h>
59#include <asm/system.h> 59#include <asm/cmpxchg.h>
60#include <asm/processor.h>
61 60
62struct llist_head { 61struct llist_head {
63 struct llist_node *first; 62 struct llist_node *first;
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index fbc48f898521..11a966e5f829 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 88a114fce477..f04ce6ac6d04 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 7353821341ed..e58c88b52ce1 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 000000000000..781a490a451b
--- /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/lsm_audit.h b/include/linux/lsm_audit.h
index 88e78dedc2e8..eab507f2b1cb 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 b7ed4759dbb2..e15192cb9cf4 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 d9a51b9b3300..c37288b23e0c 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 0b8e2a742600..910550f3b70e 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 92be3476c9f5..84d071ade1d8 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -263,6 +263,22 @@ enum {
263#define PM8607_PD_PREBIAS_MASK (0x1F << 0) 263#define PM8607_PD_PREBIAS_MASK (0x1F << 0)
264#define PM8607_PD_PRECHG_MASK (7 << 5) 264#define PM8607_PD_PRECHG_MASK (7 << 5)
265 265
266#define PM8606_REF_GP_OSC_OFF 0
267#define PM8606_REF_GP_OSC_ON 1
268#define PM8606_REF_GP_OSC_UNKNOWN 2
269
270/* Clients of reference group and 8MHz oscillator in 88PM8606 */
271enum pm8606_ref_gp_and_osc_clients {
272 REF_GP_NO_CLIENTS = 0,
273 WLED1_DUTY = (1<<0), /*PF 0x02.7:0*/
274 WLED2_DUTY = (1<<1), /*PF 0x04.7:0*/
275 WLED3_DUTY = (1<<2), /*PF 0x06.7:0*/
276 RGB1_ENABLE = (1<<3), /*PF 0x07.1*/
277 RGB2_ENABLE = (1<<4), /*PF 0x07.2*/
278 LDO_VBR_EN = (1<<5), /*PF 0x12.0*/
279 REF_GP_MAX_CLIENT = 0xFFFF
280};
281
266/* Interrupt Number in 88PM8607 */ 282/* Interrupt Number in 88PM8607 */
267enum { 283enum {
268 PM8607_IRQ_ONKEY, 284 PM8607_IRQ_ONKEY,
@@ -298,6 +314,7 @@ enum {
298struct pm860x_chip { 314struct pm860x_chip {
299 struct device *dev; 315 struct device *dev;
300 struct mutex irq_lock; 316 struct mutex irq_lock;
317 struct mutex osc_lock;
301 struct i2c_client *client; 318 struct i2c_client *client;
302 struct i2c_client *companion; /* companion chip client */ 319 struct i2c_client *companion; /* companion chip client */
303 struct regmap *regmap; 320 struct regmap *regmap;
@@ -305,12 +322,15 @@ struct pm860x_chip {
305 322
306 int buck3_double; /* DVC ramp slope double */ 323 int buck3_double; /* DVC ramp slope double */
307 unsigned short companion_addr; 324 unsigned short companion_addr;
325 unsigned short osc_vote;
308 int id; 326 int id;
309 int irq_mode; 327 int irq_mode;
310 int irq_base; 328 int irq_base;
311 int core_irq; 329 int core_irq;
312 unsigned char chip_version; 330 unsigned char chip_version;
331 unsigned char osc_status;
313 332
333 unsigned int wakeup_flag;
314}; 334};
315 335
316enum { 336enum {
@@ -369,6 +389,9 @@ struct pm860x_platform_data {
369 int num_regulators; 389 int num_regulators;
370}; 390};
371 391
392extern int pm8606_osc_enable(struct pm860x_chip *, unsigned short);
393extern int pm8606_osc_disable(struct pm860x_chip *, unsigned short);
394
372extern int pm860x_reg_read(struct i2c_client *, int); 395extern int pm860x_reg_read(struct i2c_client *, int);
373extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); 396extern int pm860x_reg_write(struct i2c_client *, int, unsigned char);
374extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); 397extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *);
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 9970337ff041..5fa697477b71 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
diff --git a/include/linux/mfd/abx500/ab5500.h b/include/linux/mfd/abx500/ab5500.h
index a720051ae933..54f820ed73bb 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-gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 488a8c920a29..2387c207ea86 100644
--- a/include/linux/mfd/abx500/ab8500-gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
@@ -10,12 +10,14 @@
10 10
11/* 11/*
12 * Platform data to register a block: only the initial gpio/irq number. 12 * Platform data to register a block: only the initial gpio/irq number.
13 * Array sizes are large enough to contain all AB8500 and AB9540 GPIO
14 * registers.
13 */ 15 */
14 16
15struct ab8500_gpio_platform_data { 17struct ab8500_gpio_platform_data {
16 int gpio_base; 18 int gpio_base;
17 u32 irq_base; 19 u32 irq_base;
18 u8 config_reg[7]; 20 u8 config_reg[8];
19}; 21};
20 22
21#endif /* _AB8500_GPIO_H */ 23#endif /* _AB8500_GPIO_H */
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 10da0291f8f8..10eb50973c39 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -71,6 +71,13 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
71#define AB8500_SWATCTRL 0x230 71#define AB8500_SWATCTRL 0x230
72#define AB8500_HIQCLKCTRL 0x232 72#define AB8500_HIQCLKCTRL 0x232
73#define AB8500_VSIMSYSCLKCTRL 0x233 73#define AB8500_VSIMSYSCLKCTRL 0x233
74#define AB9540_SYSCLK12BUFCTRL 0x234
75#define AB9540_SYSCLK12CONFCTRL 0x235
76#define AB9540_SYSCLK12BUFCTRL2 0x236
77#define AB9540_SYSCLK12BUF1VALID 0x237
78#define AB9540_SYSCLK12BUF2VALID 0x238
79#define AB9540_SYSCLK12BUF3VALID 0x239
80#define AB9540_SYSCLK12BUF4VALID 0x23A
74 81
75/* Bits */ 82/* Bits */
76#define AB8500_TURNONSTATUS_PORNVBAT BIT(0) 83#define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
@@ -251,4 +258,40 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
251#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6) 258#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
252#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7) 259#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
253 260
261#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1ENA BIT(0)
262#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2ENA BIT(1)
263#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3ENA BIT(2)
264#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4ENA BIT(3)
265#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFENA_MASK 0x0F
266#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1STRE BIT(4)
267#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2STRE BIT(5)
268#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3STRE BIT(6)
269#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4STRE BIT(7)
270#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFSTRE_MASK 0xF0
271
272#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0)
273#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1)
274#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_MASK 0x0C
275#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_SHIFT 2
276#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4)
277#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5)
278#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6)
279
280#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF1PDENA BIT(0)
281#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF2PDENA BIT(1)
282#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF3PDENA BIT(2)
283#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF4PDENA BIT(3)
284
285#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_MASK 0xFF
286#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_SHIFT 0
287
288#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_MASK 0xFF
289#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_SHIFT 0
290
291#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_MASK 0xFF
292#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_SHIFT 0
293
294#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF
295#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0
296
254#endif /* __AB8500_SYSCTRL_H */ 297#endif /* __AB8500_SYSCTRL_H */
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 838c6b487cc5..fccc3002f271 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/anatop.h b/include/linux/mfd/anatop.h
new file mode 100644
index 000000000000..22c1007d3ec5
--- /dev/null
+++ b/include/linux/mfd/anatop.h
@@ -0,0 +1,40 @@
1/*
2 * anatop.h - Anatop MFD driver
3 *
4 * Copyright (C) 2012 Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
5 * Copyright (C) 2012 Linaro
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __LINUX_MFD_ANATOP_H
23#define __LINUX_MFD_ANATOP_H
24
25#include <linux/spinlock.h>
26
27/**
28 * anatop - MFD data
29 * @ioreg: ioremap register
30 * @reglock: spinlock for register read/write
31 */
32struct anatop {
33 void *ioreg;
34 spinlock_t reglock;
35};
36
37extern u32 anatop_get_bits(struct anatop *, u32, int, int);
38extern void anatop_set_bits(struct anatop *, u32, int, int, u32);
39
40#endif /* __LINUX_MFD_ANATOP_H */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 5702d1be13b4..7ffbd6e9e7fc 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -76,8 +76,6 @@ enum da9052_chip_id {
76struct da9052_pdata; 76struct da9052_pdata;
77 77
78struct da9052 { 78struct da9052 {
79 struct mutex io_lock;
80
81 struct device *dev; 79 struct device *dev;
82 struct regmap *regmap; 80 struct regmap *regmap;
83 81
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index 60d27f7bfc1f..b3a43b1263fe 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -11,6 +11,24 @@
11#define __MFD_DB8500_PRCMU_H 11#define __MFD_DB8500_PRCMU_H
12 12
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/bitops.h>
15
16/*
17 * Registers
18 */
19#define DB8500_PRCM_GPIOCR 0x138
20#define DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0 BIT(0)
21#define DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD BIT(9)
22#define DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 BIT(11)
23#define DB8500_PRCM_GPIOCR_SPI2_SELECT BIT(23)
24
25#define DB8500_PRCM_LINE_VALUE 0x170
26#define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3)
27
28#define DB8500_PRCM_DSI_SW_RESET 0x324
29#define DB8500_PRCM_DSI_SW_RESET_DSI0_SW_RESETN BIT(0)
30#define DB8500_PRCM_DSI_SW_RESET_DSI1_SW_RESETN BIT(1)
31#define DB8500_PRCM_DSI_SW_RESET_DSI2_SW_RESETN BIT(2)
14 32
15/* This portion previously known as <mach/prcmu-fw-defs_v1.h> */ 33/* This portion previously known as <mach/prcmu-fw-defs_v1.h> */
16 34
@@ -421,40 +439,22 @@ enum auto_enable {
421/* End of file previously known as prcmu-fw-defs_v1.h */ 439/* End of file previously known as prcmu-fw-defs_v1.h */
422 440
423/** 441/**
424 * enum hw_acc_dev - enum for hw accelerators 442 * enum prcmu_power_status - results from set_power_state
425 * @HW_ACC_SVAMMDSP: for SVAMMDSP 443 * @PRCMU_SLEEP_OK: Sleep went ok
426 * @HW_ACC_SVAPIPE: for SVAPIPE 444 * @PRCMU_DEEP_SLEEP_OK: DeepSleep went ok
427 * @HW_ACC_SIAMMDSP: for SIAMMDSP 445 * @PRCMU_IDLE_OK: Idle went ok
428 * @HW_ACC_SIAPIPE: for SIAPIPE 446 * @PRCMU_DEEPIDLE_OK: DeepIdle went ok
429 * @HW_ACC_SGA: for SGA 447 * @PRCMU_PRCMU2ARMPENDINGIT_ER: Pending interrupt detected
430 * @HW_ACC_B2R2: for B2R2 448 * @PRCMU_ARMPENDINGIT_ER: Pending interrupt detected
431 * @HW_ACC_MCDE: for MCDE
432 * @HW_ACC_ESRAM1: for ESRAM1
433 * @HW_ACC_ESRAM2: for ESRAM2
434 * @HW_ACC_ESRAM3: for ESRAM3
435 * @HW_ACC_ESRAM4: for ESRAM4
436 * @NUM_HW_ACC: number of hardware accelerators
437 *
438 * Different hw accelerators which can be turned ON/
439 * OFF or put into retention (MMDSPs and ESRAMs).
440 * Used with EPOD API.
441 * 449 *
442 * NOTE! Deprecated, to be removed when all users switched over to use the
443 * regulator API.
444 */ 450 */
445enum hw_acc_dev { 451enum prcmu_power_status {
446 HW_ACC_SVAMMDSP, 452 PRCMU_SLEEP_OK = 0xf3,
447 HW_ACC_SVAPIPE, 453 PRCMU_DEEP_SLEEP_OK = 0xf6,
448 HW_ACC_SIAMMDSP, 454 PRCMU_IDLE_OK = 0xf0,
449 HW_ACC_SIAPIPE, 455 PRCMU_DEEPIDLE_OK = 0xe3,
450 HW_ACC_SGA, 456 PRCMU_PRCMU2ARMPENDINGIT_ER = 0x91,
451 HW_ACC_B2R2, 457 PRCMU_ARMPENDINGIT_ER = 0x93,
452 HW_ACC_MCDE,
453 HW_ACC_ESRAM1,
454 HW_ACC_ESRAM2,
455 HW_ACC_ESRAM3,
456 HW_ACC_ESRAM4,
457 NUM_HW_ACC
458}; 458};
459 459
460/* 460/*
@@ -493,6 +493,20 @@ struct prcmu_auto_pm_config {
493 u8 sva_policy; 493 u8 sva_policy;
494}; 494};
495 495
496#define PRCMU_FW_PROJECT_U8500 2
497#define PRCMU_FW_PROJECT_U9500 4
498#define PRCMU_FW_PROJECT_U8500_C2 7
499#define PRCMU_FW_PROJECT_U9500_C2 11
500#define PRCMU_FW_PROJECT_U8520 13
501#define PRCMU_FW_PROJECT_U8420 14
502
503struct prcmu_fw_version {
504 u8 project;
505 u8 api_version;
506 u8 func_version;
507 u8 errata;
508};
509
496#ifdef CONFIG_MFD_DB8500_PRCMU 510#ifdef CONFIG_MFD_DB8500_PRCMU
497 511
498void db8500_prcmu_early_init(void); 512void db8500_prcmu_early_init(void);
@@ -500,42 +514,41 @@ int prcmu_set_rc_a2p(enum romcode_write);
500enum romcode_read prcmu_get_rc_p2a(void); 514enum romcode_read prcmu_get_rc_p2a(void);
501enum ap_pwrst prcmu_get_xp70_current_state(void); 515enum ap_pwrst prcmu_get_xp70_current_state(void);
502bool prcmu_has_arm_maxopp(void); 516bool prcmu_has_arm_maxopp(void);
503bool prcmu_is_u8400(void); 517struct prcmu_fw_version *prcmu_get_fw_version(void);
504int prcmu_set_ape_opp(u8 opp);
505int prcmu_get_ape_opp(void);
506int prcmu_request_ape_opp_100_voltage(bool enable); 518int prcmu_request_ape_opp_100_voltage(bool enable);
507int prcmu_release_usb_wakeup_state(void); 519int prcmu_release_usb_wakeup_state(void);
508int prcmu_set_ddr_opp(u8 opp);
509int prcmu_get_ddr_opp(void);
510/* NOTE! Use regulator framework instead */
511int prcmu_set_hwacc(u16 hw_acc_dev, u8 state);
512void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, 520void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
513 struct prcmu_auto_pm_config *idle); 521 struct prcmu_auto_pm_config *idle);
514bool prcmu_is_auto_pm_enabled(void); 522bool prcmu_is_auto_pm_enabled(void);
515 523
516int prcmu_config_clkout(u8 clkout, u8 source, u8 div); 524int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
517int prcmu_set_clock_divider(u8 clock, u8 divider); 525int prcmu_set_clock_divider(u8 clock, u8 divider);
518int prcmu_config_hotdog(u8 threshold); 526int db8500_prcmu_config_hotdog(u8 threshold);
519int prcmu_config_hotmon(u8 low, u8 high); 527int db8500_prcmu_config_hotmon(u8 low, u8 high);
520int prcmu_start_temp_sense(u16 cycles32k); 528int db8500_prcmu_start_temp_sense(u16 cycles32k);
521int prcmu_stop_temp_sense(void); 529int db8500_prcmu_stop_temp_sense(void);
522int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 530int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
523int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); 531int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
524 532
525void prcmu_ac_wake_req(void); 533void prcmu_ac_wake_req(void);
526void prcmu_ac_sleep_req(void); 534void prcmu_ac_sleep_req(void);
527void prcmu_modem_reset(void); 535void db8500_prcmu_modem_reset(void);
528void prcmu_enable_spi2(void);
529void prcmu_disable_spi2(void);
530 536
531int prcmu_config_a9wdog(u8 num, bool sleep_auto_off); 537int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off);
532int prcmu_enable_a9wdog(u8 id); 538int db8500_prcmu_enable_a9wdog(u8 id);
533int prcmu_disable_a9wdog(u8 id); 539int db8500_prcmu_disable_a9wdog(u8 id);
534int prcmu_kick_a9wdog(u8 id); 540int db8500_prcmu_kick_a9wdog(u8 id);
535int prcmu_load_a9wdog(u8 id, u32 val); 541int db8500_prcmu_load_a9wdog(u8 id, u32 val);
536 542
537void db8500_prcmu_system_reset(u16 reset_code); 543void db8500_prcmu_system_reset(u16 reset_code);
538int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); 544int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
545u8 db8500_prcmu_get_power_state_result(void);
546int db8500_prcmu_gic_decouple(void);
547int db8500_prcmu_gic_recouple(void);
548int db8500_prcmu_copy_gic_settings(void);
549bool db8500_prcmu_gic_pending_irq(void);
550bool db8500_prcmu_pending_irq(void);
551bool db8500_prcmu_is_cpu_in_wfi(int cpu);
539void db8500_prcmu_enable_wakeups(u32 wakeups); 552void db8500_prcmu_enable_wakeups(u32 wakeups);
540int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); 553int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
541int db8500_prcmu_request_clock(u8 clock, bool enable); 554int db8500_prcmu_request_clock(u8 clock, bool enable);
@@ -549,6 +562,14 @@ u16 db8500_prcmu_get_reset_code(void);
549bool db8500_prcmu_is_ac_wake_requested(void); 562bool db8500_prcmu_is_ac_wake_requested(void);
550int db8500_prcmu_set_arm_opp(u8 opp); 563int db8500_prcmu_set_arm_opp(u8 opp);
551int db8500_prcmu_get_arm_opp(void); 564int db8500_prcmu_get_arm_opp(void);
565int db8500_prcmu_set_ape_opp(u8 opp);
566int db8500_prcmu_get_ape_opp(void);
567int db8500_prcmu_set_ddr_opp(u8 opp);
568int db8500_prcmu_get_ddr_opp(void);
569
570u32 db8500_prcmu_read(unsigned int reg);
571void db8500_prcmu_write(unsigned int reg, u32 value);
572void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value);
552 573
553#else /* !CONFIG_MFD_DB8500_PRCMU */ 574#else /* !CONFIG_MFD_DB8500_PRCMU */
554 575
@@ -574,17 +595,17 @@ static inline bool prcmu_has_arm_maxopp(void)
574 return false; 595 return false;
575} 596}
576 597
577static inline bool prcmu_is_u8400(void) 598static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
578{ 599{
579 return false; 600 return NULL;
580} 601}
581 602
582static inline int prcmu_set_ape_opp(u8 opp) 603static inline int db8500_prcmu_set_ape_opp(u8 opp)
583{ 604{
584 return 0; 605 return 0;
585} 606}
586 607
587static inline int prcmu_get_ape_opp(void) 608static inline int db8500_prcmu_get_ape_opp(void)
588{ 609{
589 return APE_100_OPP; 610 return APE_100_OPP;
590} 611}
@@ -599,21 +620,16 @@ static inline int prcmu_release_usb_wakeup_state(void)
599 return 0; 620 return 0;
600} 621}
601 622
602static inline int prcmu_set_ddr_opp(u8 opp) 623static inline int db8500_prcmu_set_ddr_opp(u8 opp)
603{ 624{
604 return 0; 625 return 0;
605} 626}
606 627
607static inline int prcmu_get_ddr_opp(void) 628static inline int db8500_prcmu_get_ddr_opp(void)
608{ 629{
609 return DDR_100_OPP; 630 return DDR_100_OPP;
610} 631}
611 632
612static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state)
613{
614 return 0;
615}
616
617static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, 633static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
618 struct prcmu_auto_pm_config *idle) 634 struct prcmu_auto_pm_config *idle)
619{ 635{
@@ -634,22 +650,22 @@ static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
634 return 0; 650 return 0;
635} 651}
636 652
637static inline int prcmu_config_hotdog(u8 threshold) 653static inline int db8500_prcmu_config_hotdog(u8 threshold)
638{ 654{
639 return 0; 655 return 0;
640} 656}
641 657
642static inline int prcmu_config_hotmon(u8 low, u8 high) 658static inline int db8500_prcmu_config_hotmon(u8 low, u8 high)
643{ 659{
644 return 0; 660 return 0;
645} 661}
646 662
647static inline int prcmu_start_temp_sense(u16 cycles32k) 663static inline int db8500_prcmu_start_temp_sense(u16 cycles32k)
648{ 664{
649 return 0; 665 return 0;
650} 666}
651 667
652static inline int prcmu_stop_temp_sense(void) 668static inline int db8500_prcmu_stop_temp_sense(void)
653{ 669{
654 return 0; 670 return 0;
655} 671}
@@ -668,22 +684,17 @@ static inline void prcmu_ac_wake_req(void) {}
668 684
669static inline void prcmu_ac_sleep_req(void) {} 685static inline void prcmu_ac_sleep_req(void) {}
670 686
671static inline void prcmu_modem_reset(void) {} 687static inline void db8500_prcmu_modem_reset(void) {}
672 688
673static inline int prcmu_enable_spi2(void) 689static inline void db8500_prcmu_system_reset(u16 reset_code) {}
674{
675 return 0;
676}
677 690
678static inline int prcmu_disable_spi2(void) 691static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
692 bool keep_ap_pll)
679{ 693{
680 return 0; 694 return 0;
681} 695}
682 696
683static inline void db8500_prcmu_system_reset(u16 reset_code) {} 697static inline u8 db8500_prcmu_get_power_state_result(void)
684
685static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
686 bool keep_ap_pll)
687{ 698{
688 return 0; 699 return 0;
689} 700}
@@ -729,27 +740,27 @@ static inline u16 db8500_prcmu_get_reset_code(void)
729 return 0; 740 return 0;
730} 741}
731 742
732static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) 743static inline int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
733{ 744{
734 return 0; 745 return 0;
735} 746}
736 747
737static inline int prcmu_enable_a9wdog(u8 id) 748static inline int db8500_prcmu_enable_a9wdog(u8 id)
738{ 749{
739 return 0; 750 return 0;
740} 751}
741 752
742static inline int prcmu_disable_a9wdog(u8 id) 753static inline int db8500_prcmu_disable_a9wdog(u8 id)
743{ 754{
744 return 0; 755 return 0;
745} 756}
746 757
747static inline int prcmu_kick_a9wdog(u8 id) 758static inline int db8500_prcmu_kick_a9wdog(u8 id)
748{ 759{
749 return 0; 760 return 0;
750} 761}
751 762
752static inline int prcmu_load_a9wdog(u8 id, u32 val) 763static inline int db8500_prcmu_load_a9wdog(u8 id, u32 val)
753{ 764{
754 return 0; 765 return 0;
755} 766}
@@ -769,6 +780,16 @@ static inline int db8500_prcmu_get_arm_opp(void)
769 return 0; 780 return 0;
770} 781}
771 782
783static inline u32 db8500_prcmu_read(unsigned int reg)
784{
785 return 0;
786}
787
788static inline void db8500_prcmu_write(unsigned int reg, u32 value) {}
789
790static inline void db8500_prcmu_write_masked(unsigned int reg, u32 mask,
791 u32 value) {}
792
772#endif /* !CONFIG_MFD_DB8500_PRCMU */ 793#endif /* !CONFIG_MFD_DB8500_PRCMU */
773 794
774#endif /* __MFD_DB8500_PRCMU_H */ 795#endif /* __MFD_DB8500_PRCMU_H */
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index bac942f959c1..d7674eb7305f 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -10,7 +10,7 @@
10 10
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <asm/mach-types.h> 13#include <linux/err.h>
14 14
15/* PRCMU Wakeup defines */ 15/* PRCMU Wakeup defines */
16enum prcmu_wakeup_index { 16enum prcmu_wakeup_index {
@@ -80,6 +80,29 @@ enum prcmu_wakeup_index {
80#define EPOD_STATE_ON_CLK_OFF 0x03 80#define EPOD_STATE_ON_CLK_OFF 0x03
81#define EPOD_STATE_ON 0x04 81#define EPOD_STATE_ON 0x04
82 82
83/* DB5500 CLKOUT IDs */
84enum {
85 DB5500_CLKOUT0 = 0,
86 DB5500_CLKOUT1,
87};
88
89/* DB5500 CLKOUTx sources */
90enum {
91 DB5500_CLKOUT_REF_CLK_SEL0,
92 DB5500_CLKOUT_RTC_CLK0_SEL0,
93 DB5500_CLKOUT_ULP_CLK_SEL0,
94 DB5500_CLKOUT_STATIC0,
95 DB5500_CLKOUT_REFCLK,
96 DB5500_CLKOUT_ULPCLK,
97 DB5500_CLKOUT_ARMCLK,
98 DB5500_CLKOUT_SYSACC0CLK,
99 DB5500_CLKOUT_SOC0PLLCLK,
100 DB5500_CLKOUT_SOC1PLLCLK,
101 DB5500_CLKOUT_DDRPLLCLK,
102 DB5500_CLKOUT_TVCLK,
103 DB5500_CLKOUT_IRDACLK,
104};
105
83/* 106/*
84 * CLKOUT sources 107 * CLKOUT sources
85 */ 108 */
@@ -111,6 +134,7 @@ enum prcmu_clock {
111 PRCMU_MSP1CLK, 134 PRCMU_MSP1CLK,
112 PRCMU_I2CCLK, 135 PRCMU_I2CCLK,
113 PRCMU_SDMMCCLK, 136 PRCMU_SDMMCCLK,
137 PRCMU_SPARE1CLK,
114 PRCMU_SLIMCLK, 138 PRCMU_SLIMCLK,
115 PRCMU_PER1CLK, 139 PRCMU_PER1CLK,
116 PRCMU_PER2CLK, 140 PRCMU_PER2CLK,
@@ -139,12 +163,20 @@ enum prcmu_clock {
139 PRCMU_IRRCCLK, 163 PRCMU_IRRCCLK,
140 PRCMU_SIACLK, 164 PRCMU_SIACLK,
141 PRCMU_SVACLK, 165 PRCMU_SVACLK,
166 PRCMU_ACLK,
142 PRCMU_NUM_REG_CLOCKS, 167 PRCMU_NUM_REG_CLOCKS,
143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS, 168 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
169 PRCMU_CDCLK,
144 PRCMU_TIMCLK, 170 PRCMU_TIMCLK,
145 PRCMU_PLLSOC0, 171 PRCMU_PLLSOC0,
146 PRCMU_PLLSOC1, 172 PRCMU_PLLSOC1,
147 PRCMU_PLLDDR, 173 PRCMU_PLLDDR,
174 PRCMU_PLLDSI,
175 PRCMU_DSI0CLK,
176 PRCMU_DSI1CLK,
177 PRCMU_DSI0ESCCLK,
178 PRCMU_DSI1ESCCLK,
179 PRCMU_DSI2ESCCLK,
148}; 180};
149 181
150/** 182/**
@@ -153,12 +185,14 @@ enum prcmu_clock {
153 * @APE_NO_CHANGE: The APE operating point is unchanged 185 * @APE_NO_CHANGE: The APE operating point is unchanged
154 * @APE_100_OPP: The new APE operating point is ape100opp 186 * @APE_100_OPP: The new APE operating point is ape100opp
155 * @APE_50_OPP: 50% 187 * @APE_50_OPP: 50%
188 * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%.
156 */ 189 */
157enum ape_opp { 190enum ape_opp {
158 APE_OPP_INIT = 0x00, 191 APE_OPP_INIT = 0x00,
159 APE_NO_CHANGE = 0x01, 192 APE_NO_CHANGE = 0x01,
160 APE_100_OPP = 0x02, 193 APE_100_OPP = 0x02,
161 APE_50_OPP = 0x03 194 APE_50_OPP = 0x03,
195 APE_50_PARTLY_25_OPP = 0xFF,
162}; 196};
163 197
164/** 198/**
@@ -218,9 +252,11 @@ enum ddr_pwrst {
218 252
219#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) 253#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500)
220 254
255#include <mach/id.h>
256
221static inline void __init prcmu_early_init(void) 257static inline void __init prcmu_early_init(void)
222{ 258{
223 if (machine_is_u5500()) 259 if (cpu_is_u5500())
224 return db5500_prcmu_early_init(); 260 return db5500_prcmu_early_init();
225 else 261 else
226 return db8500_prcmu_early_init(); 262 return db8500_prcmu_early_init();
@@ -229,7 +265,7 @@ static inline void __init prcmu_early_init(void)
229static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, 265static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
230 bool keep_ap_pll) 266 bool keep_ap_pll)
231{ 267{
232 if (machine_is_u5500()) 268 if (cpu_is_u5500())
233 return db5500_prcmu_set_power_state(state, keep_ulp_clk, 269 return db5500_prcmu_set_power_state(state, keep_ulp_clk,
234 keep_ap_pll); 270 keep_ap_pll);
235 else 271 else
@@ -237,9 +273,65 @@ static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
237 keep_ap_pll); 273 keep_ap_pll);
238} 274}
239 275
276static inline u8 prcmu_get_power_state_result(void)
277{
278 if (cpu_is_u5500())
279 return -EINVAL;
280 else
281 return db8500_prcmu_get_power_state_result();
282}
283
284static inline int prcmu_gic_decouple(void)
285{
286 if (cpu_is_u5500())
287 return -EINVAL;
288 else
289 return db8500_prcmu_gic_decouple();
290}
291
292static inline int prcmu_gic_recouple(void)
293{
294 if (cpu_is_u5500())
295 return -EINVAL;
296 else
297 return db8500_prcmu_gic_recouple();
298}
299
300static inline bool prcmu_gic_pending_irq(void)
301{
302 if (cpu_is_u5500())
303 return -EINVAL;
304 else
305 return db8500_prcmu_gic_pending_irq();
306}
307
308static inline bool prcmu_is_cpu_in_wfi(int cpu)
309{
310 if (cpu_is_u5500())
311 return -EINVAL;
312 else
313 return db8500_prcmu_is_cpu_in_wfi(cpu);
314}
315
316static inline int prcmu_copy_gic_settings(void)
317{
318 if (cpu_is_u5500())
319 return -EINVAL;
320 else
321 return db8500_prcmu_copy_gic_settings();
322}
323
324static inline bool prcmu_pending_irq(void)
325{
326 if (cpu_is_u5500())
327 return -EINVAL;
328 else
329 return db8500_prcmu_pending_irq();
330}
331
240static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) 332static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
241{ 333{
242 if (machine_is_u5500()) 334 if (cpu_is_u5500())
243 return -EINVAL; 335 return -EINVAL;
244 else 336 else
245 return db8500_prcmu_set_epod(epod_id, epod_state); 337 return db8500_prcmu_set_epod(epod_id, epod_state);
@@ -247,7 +339,7 @@ static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
247 339
248static inline void prcmu_enable_wakeups(u32 wakeups) 340static inline void prcmu_enable_wakeups(u32 wakeups)
249{ 341{
250 if (machine_is_u5500()) 342 if (cpu_is_u5500())
251 db5500_prcmu_enable_wakeups(wakeups); 343 db5500_prcmu_enable_wakeups(wakeups);
252 else 344 else
253 db8500_prcmu_enable_wakeups(wakeups); 345 db8500_prcmu_enable_wakeups(wakeups);
@@ -260,7 +352,7 @@ static inline void prcmu_disable_wakeups(void)
260 352
261static inline void prcmu_config_abb_event_readout(u32 abb_events) 353static inline void prcmu_config_abb_event_readout(u32 abb_events)
262{ 354{
263 if (machine_is_u5500()) 355 if (cpu_is_u5500())
264 db5500_prcmu_config_abb_event_readout(abb_events); 356 db5500_prcmu_config_abb_event_readout(abb_events);
265 else 357 else
266 db8500_prcmu_config_abb_event_readout(abb_events); 358 db8500_prcmu_config_abb_event_readout(abb_events);
@@ -268,7 +360,7 @@ static inline void prcmu_config_abb_event_readout(u32 abb_events)
268 360
269static inline void prcmu_get_abb_event_buffer(void __iomem **buf) 361static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
270{ 362{
271 if (machine_is_u5500()) 363 if (cpu_is_u5500())
272 db5500_prcmu_get_abb_event_buffer(buf); 364 db5500_prcmu_get_abb_event_buffer(buf);
273 else 365 else
274 db8500_prcmu_get_abb_event_buffer(buf); 366 db8500_prcmu_get_abb_event_buffer(buf);
@@ -276,25 +368,40 @@ static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
276 368
277int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 369int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
278int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); 370int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
371int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, u8 size);
279 372
280int prcmu_config_clkout(u8 clkout, u8 source, u8 div); 373int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
281 374
282static inline int prcmu_request_clock(u8 clock, bool enable) 375static inline int prcmu_request_clock(u8 clock, bool enable)
283{ 376{
284 if (machine_is_u5500()) 377 if (cpu_is_u5500())
285 return db5500_prcmu_request_clock(clock, enable); 378 return db5500_prcmu_request_clock(clock, enable);
286 else 379 else
287 return db8500_prcmu_request_clock(clock, enable); 380 return db8500_prcmu_request_clock(clock, enable);
288} 381}
289 382
290int prcmu_set_ape_opp(u8 opp); 383unsigned long prcmu_clock_rate(u8 clock);
291int prcmu_get_ape_opp(void); 384long prcmu_round_clock_rate(u8 clock, unsigned long rate);
292int prcmu_set_ddr_opp(u8 opp); 385int prcmu_set_clock_rate(u8 clock, unsigned long rate);
293int prcmu_get_ddr_opp(void); 386
387static inline int prcmu_set_ddr_opp(u8 opp)
388{
389 if (cpu_is_u5500())
390 return -EINVAL;
391 else
392 return db8500_prcmu_set_ddr_opp(opp);
393}
394static inline int prcmu_get_ddr_opp(void)
395{
396 if (cpu_is_u5500())
397 return -EINVAL;
398 else
399 return db8500_prcmu_get_ddr_opp();
400}
294 401
295static inline int prcmu_set_arm_opp(u8 opp) 402static inline int prcmu_set_arm_opp(u8 opp)
296{ 403{
297 if (machine_is_u5500()) 404 if (cpu_is_u5500())
298 return -EINVAL; 405 return -EINVAL;
299 else 406 else
300 return db8500_prcmu_set_arm_opp(opp); 407 return db8500_prcmu_set_arm_opp(opp);
@@ -302,15 +409,31 @@ static inline int prcmu_set_arm_opp(u8 opp)
302 409
303static inline int prcmu_get_arm_opp(void) 410static inline int prcmu_get_arm_opp(void)
304{ 411{
305 if (machine_is_u5500()) 412 if (cpu_is_u5500())
306 return -EINVAL; 413 return -EINVAL;
307 else 414 else
308 return db8500_prcmu_get_arm_opp(); 415 return db8500_prcmu_get_arm_opp();
309} 416}
310 417
418static inline int prcmu_set_ape_opp(u8 opp)
419{
420 if (cpu_is_u5500())
421 return -EINVAL;
422 else
423 return db8500_prcmu_set_ape_opp(opp);
424}
425
426static inline int prcmu_get_ape_opp(void)
427{
428 if (cpu_is_u5500())
429 return -EINVAL;
430 else
431 return db8500_prcmu_get_ape_opp();
432}
433
311static inline void prcmu_system_reset(u16 reset_code) 434static inline void prcmu_system_reset(u16 reset_code)
312{ 435{
313 if (machine_is_u5500()) 436 if (cpu_is_u5500())
314 return db5500_prcmu_system_reset(reset_code); 437 return db5500_prcmu_system_reset(reset_code);
315 else 438 else
316 return db8500_prcmu_system_reset(reset_code); 439 return db8500_prcmu_system_reset(reset_code);
@@ -318,7 +441,7 @@ static inline void prcmu_system_reset(u16 reset_code)
318 441
319static inline u16 prcmu_get_reset_code(void) 442static inline u16 prcmu_get_reset_code(void)
320{ 443{
321 if (machine_is_u5500()) 444 if (cpu_is_u5500())
322 return db5500_prcmu_get_reset_code(); 445 return db5500_prcmu_get_reset_code();
323 else 446 else
324 return db8500_prcmu_get_reset_code(); 447 return db8500_prcmu_get_reset_code();
@@ -326,10 +449,17 @@ static inline u16 prcmu_get_reset_code(void)
326 449
327void prcmu_ac_wake_req(void); 450void prcmu_ac_wake_req(void);
328void prcmu_ac_sleep_req(void); 451void prcmu_ac_sleep_req(void);
329void prcmu_modem_reset(void); 452static inline void prcmu_modem_reset(void)
453{
454 if (cpu_is_u5500())
455 return;
456 else
457 return db8500_prcmu_modem_reset();
458}
459
330static inline bool prcmu_is_ac_wake_requested(void) 460static inline bool prcmu_is_ac_wake_requested(void)
331{ 461{
332 if (machine_is_u5500()) 462 if (cpu_is_u5500())
333 return db5500_prcmu_is_ac_wake_requested(); 463 return db5500_prcmu_is_ac_wake_requested();
334 else 464 else
335 return db8500_prcmu_is_ac_wake_requested(); 465 return db8500_prcmu_is_ac_wake_requested();
@@ -337,7 +467,7 @@ static inline bool prcmu_is_ac_wake_requested(void)
337 467
338static inline int prcmu_set_display_clocks(void) 468static inline int prcmu_set_display_clocks(void)
339{ 469{
340 if (machine_is_u5500()) 470 if (cpu_is_u5500())
341 return db5500_prcmu_set_display_clocks(); 471 return db5500_prcmu_set_display_clocks();
342 else 472 else
343 return db8500_prcmu_set_display_clocks(); 473 return db8500_prcmu_set_display_clocks();
@@ -345,7 +475,7 @@ static inline int prcmu_set_display_clocks(void)
345 475
346static inline int prcmu_disable_dsipll(void) 476static inline int prcmu_disable_dsipll(void)
347{ 477{
348 if (machine_is_u5500()) 478 if (cpu_is_u5500())
349 return db5500_prcmu_disable_dsipll(); 479 return db5500_prcmu_disable_dsipll();
350 else 480 else
351 return db8500_prcmu_disable_dsipll(); 481 return db8500_prcmu_disable_dsipll();
@@ -353,7 +483,7 @@ static inline int prcmu_disable_dsipll(void)
353 483
354static inline int prcmu_enable_dsipll(void) 484static inline int prcmu_enable_dsipll(void)
355{ 485{
356 if (machine_is_u5500()) 486 if (cpu_is_u5500())
357 return db5500_prcmu_enable_dsipll(); 487 return db5500_prcmu_enable_dsipll();
358 else 488 else
359 return db8500_prcmu_enable_dsipll(); 489 return db8500_prcmu_enable_dsipll();
@@ -361,11 +491,107 @@ static inline int prcmu_enable_dsipll(void)
361 491
362static inline int prcmu_config_esram0_deep_sleep(u8 state) 492static inline int prcmu_config_esram0_deep_sleep(u8 state)
363{ 493{
364 if (machine_is_u5500()) 494 if (cpu_is_u5500())
365 return -EINVAL; 495 return -EINVAL;
366 else 496 else
367 return db8500_prcmu_config_esram0_deep_sleep(state); 497 return db8500_prcmu_config_esram0_deep_sleep(state);
368} 498}
499
500static inline int prcmu_config_hotdog(u8 threshold)
501{
502 if (cpu_is_u5500())
503 return -EINVAL;
504 else
505 return db8500_prcmu_config_hotdog(threshold);
506}
507
508static inline int prcmu_config_hotmon(u8 low, u8 high)
509{
510 if (cpu_is_u5500())
511 return -EINVAL;
512 else
513 return db8500_prcmu_config_hotmon(low, high);
514}
515
516static inline int prcmu_start_temp_sense(u16 cycles32k)
517{
518 if (cpu_is_u5500())
519 return -EINVAL;
520 else
521 return db8500_prcmu_start_temp_sense(cycles32k);
522}
523
524static inline int prcmu_stop_temp_sense(void)
525{
526 if (cpu_is_u5500())
527 return -EINVAL;
528 else
529 return db8500_prcmu_stop_temp_sense();
530}
531
532static inline u32 prcmu_read(unsigned int reg)
533{
534 if (cpu_is_u5500())
535 return -EINVAL;
536 else
537 return db8500_prcmu_read(reg);
538}
539
540static inline void prcmu_write(unsigned int reg, u32 value)
541{
542 if (cpu_is_u5500())
543 return;
544 else
545 db8500_prcmu_write(reg, value);
546}
547
548static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
549{
550 if (cpu_is_u5500())
551 return;
552 else
553 db8500_prcmu_write_masked(reg, mask, value);
554}
555
556static inline int prcmu_enable_a9wdog(u8 id)
557{
558 if (cpu_is_u5500())
559 return -EINVAL;
560 else
561 return db8500_prcmu_enable_a9wdog(id);
562}
563
564static inline int prcmu_disable_a9wdog(u8 id)
565{
566 if (cpu_is_u5500())
567 return -EINVAL;
568 else
569 return db8500_prcmu_disable_a9wdog(id);
570}
571
572static inline int prcmu_kick_a9wdog(u8 id)
573{
574 if (cpu_is_u5500())
575 return -EINVAL;
576 else
577 return db8500_prcmu_kick_a9wdog(id);
578}
579
580static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
581{
582 if (cpu_is_u5500())
583 return -EINVAL;
584 else
585 return db8500_prcmu_load_a9wdog(id, timeout);
586}
587
588static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
589{
590 if (cpu_is_u5500())
591 return -EINVAL;
592 else
593 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
594}
369#else 595#else
370 596
371static inline void __init prcmu_early_init(void) {} 597static inline void __init prcmu_early_init(void) {}
@@ -395,6 +621,12 @@ static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
395 return -ENOSYS; 621 return -ENOSYS;
396} 622}
397 623
624static inline int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask,
625 u8 size)
626{
627 return -ENOSYS;
628}
629
398static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div) 630static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
399{ 631{
400 return 0; 632 return 0;
@@ -405,6 +637,21 @@ static inline int prcmu_request_clock(u8 clock, bool enable)
405 return 0; 637 return 0;
406} 638}
407 639
640static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate)
641{
642 return 0;
643}
644
645static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate)
646{
647 return 0;
648}
649
650static inline unsigned long prcmu_clock_rate(u8 clock)
651{
652 return 0;
653}
654
408static inline int prcmu_set_ape_opp(u8 opp) 655static inline int prcmu_set_ape_opp(u8 opp)
409{ 656{
410 return 0; 657 return 0;
@@ -480,14 +727,133 @@ static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
480 *buf = NULL; 727 *buf = NULL;
481} 728}
482 729
730static inline int prcmu_config_hotdog(u8 threshold)
731{
732 return 0;
733}
734
735static inline int prcmu_config_hotmon(u8 low, u8 high)
736{
737 return 0;
738}
739
740static inline int prcmu_start_temp_sense(u16 cycles32k)
741{
742 return 0;
743}
744
745static inline int prcmu_stop_temp_sense(void)
746{
747 return 0;
748}
749
750static inline u32 prcmu_read(unsigned int reg)
751{
752 return 0;
753}
754
755static inline void prcmu_write(unsigned int reg, u32 value) {}
756
757static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {}
758
759#endif
760
761static inline void prcmu_set(unsigned int reg, u32 bits)
762{
763 prcmu_write_masked(reg, bits, bits);
764}
765
766static inline void prcmu_clear(unsigned int reg, u32 bits)
767{
768 prcmu_write_masked(reg, bits, 0);
769}
770
771#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500)
772
773/**
774 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
775 */
776static inline void prcmu_enable_spi2(void)
777{
778 if (cpu_is_u8500())
779 prcmu_set(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
780}
781
782/**
783 * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1.
784 */
785static inline void prcmu_disable_spi2(void)
786{
787 if (cpu_is_u8500())
788 prcmu_clear(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
789}
790
791/**
792 * prcmu_enable_stm_mod_uart - Enables pin muxing for STMMOD
793 * and UARTMOD on OtherAlternateC3.
794 */
795static inline void prcmu_enable_stm_mod_uart(void)
796{
797 if (cpu_is_u8500()) {
798 prcmu_set(DB8500_PRCM_GPIOCR,
799 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
800 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
801 }
802}
803
804/**
805 * prcmu_disable_stm_mod_uart - Disables pin muxing for STMMOD
806 * and UARTMOD on OtherAlternateC3.
807 */
808static inline void prcmu_disable_stm_mod_uart(void)
809{
810 if (cpu_is_u8500()) {
811 prcmu_clear(DB8500_PRCM_GPIOCR,
812 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
813 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
814 }
815}
816
817/**
818 * prcmu_enable_stm_ape - Enables pin muxing for STM APE on OtherAlternateC1.
819 */
820static inline void prcmu_enable_stm_ape(void)
821{
822 if (cpu_is_u8500()) {
823 prcmu_set(DB8500_PRCM_GPIOCR,
824 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
825 }
826}
827
828/**
829 * prcmu_disable_stm_ape - Disables pin muxing for STM APE on OtherAlternateC1.
830 */
831static inline void prcmu_disable_stm_ape(void)
832{
833 if (cpu_is_u8500()) {
834 prcmu_clear(DB8500_PRCM_GPIOCR,
835 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
836 }
837}
838
839#else
840
841static inline void prcmu_enable_spi2(void) {}
842static inline void prcmu_disable_spi2(void) {}
843static inline void prcmu_enable_stm_mod_uart(void) {}
844static inline void prcmu_disable_stm_mod_uart(void) {}
845static inline void prcmu_enable_stm_ape(void) {}
846static inline void prcmu_disable_stm_ape(void) {}
847
483#endif 848#endif
484 849
485/* PRCMU QoS APE OPP class */ 850/* PRCMU QoS APE OPP class */
486#define PRCMU_QOS_APE_OPP 1 851#define PRCMU_QOS_APE_OPP 1
487#define PRCMU_QOS_DDR_OPP 2 852#define PRCMU_QOS_DDR_OPP 2
853#define PRCMU_QOS_ARM_OPP 3
488#define PRCMU_QOS_DEFAULT_VALUE -1 854#define PRCMU_QOS_DEFAULT_VALUE -1
489 855
490#ifdef CONFIG_UX500_PRCMU_QOS_POWER 856#ifdef CONFIG_DBX500_PRCMU_QOS_POWER
491 857
492unsigned long prcmu_qos_get_cpufreq_opp_delay(void); 858unsigned long prcmu_qos_get_cpufreq_opp_delay(void);
493void prcmu_qos_set_cpufreq_opp_delay(unsigned long); 859void prcmu_qos_set_cpufreq_opp_delay(unsigned long);
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index fff590521e50..28726dd540f2 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 b86ee45c8b03..10e038bac8dd 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -38,7 +38,8 @@ int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq);
38int mc13xxx_get_flags(struct mc13xxx *mc13xxx); 38int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
39 39
40int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, 40int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
41 unsigned int mode, unsigned int channel, unsigned int *sample); 41 unsigned int mode, unsigned int channel,
42 u8 ato, bool atox, unsigned int *sample);
42 43
43#define MC13XXX_IRQ_ADCDONE 0 44#define MC13XXX_IRQ_ADCDONE 0
44#define MC13XXX_IRQ_ADCBISDONE 1 45#define MC13XXX_IRQ_ADCBISDONE 1
@@ -157,6 +158,18 @@ struct mc13xxx_buttons_platform_data {
157 unsigned short b3on_key; 158 unsigned short b3on_key;
158}; 159};
159 160
161struct mc13xxx_ts_platform_data {
162 /* Delay between Touchscreen polarization and ADC Conversion.
163 * Given in clock ticks of a 32 kHz clock which gives a granularity of
164 * about 30.5ms */
165 u8 ato;
166
167#define MC13783_TS_ATO_FIRST false
168#define MC13783_TS_ATO_EACH true
169 /* Use the ATO delay only for the first conversion or for each one */
170 bool atox;
171};
172
160struct mc13xxx_platform_data { 173struct mc13xxx_platform_data {
161#define MC13XXX_USE_TOUCHSCREEN (1 << 0) 174#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
162#define MC13XXX_USE_CODEC (1 << 1) 175#define MC13XXX_USE_CODEC (1 << 1)
@@ -167,6 +180,7 @@ struct mc13xxx_platform_data {
167 struct mc13xxx_regulator_platform_data regulators; 180 struct mc13xxx_regulator_platform_data regulators;
168 struct mc13xxx_leds_platform_data *leds; 181 struct mc13xxx_leds_platform_data *leds;
169 struct mc13xxx_buttons_platform_data *buttons; 182 struct mc13xxx_buttons_platform_data *buttons;
183 struct mc13xxx_ts_platform_data touch;
170}; 184};
171 185
172#define MC13XXX_ADC_MODE_TS 1 186#define MC13XXX_ADC_MODE_TS 1
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index f88c1cc0cb0f..a9e8bd157673 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -10,8 +10,6 @@
10#ifndef MCP_H 10#ifndef MCP_H
11#define MCP_H 11#define MCP_H
12 12
13#include <mach/dma.h>
14
15struct mcp_ops; 13struct mcp_ops;
16 14
17struct mcp { 15struct mcp {
@@ -21,12 +19,7 @@ struct mcp {
21 int use_count; 19 int use_count;
22 unsigned int sclk_rate; 20 unsigned int sclk_rate;
23 unsigned int rw_timeout; 21 unsigned int rw_timeout;
24 dma_device_t dma_audio_rd;
25 dma_device_t dma_audio_wr;
26 dma_device_t dma_telco_rd;
27 dma_device_t dma_telco_wr;
28 struct device attached_device; 22 struct device attached_device;
29 int gpio_base;
30}; 23};
31 24
32struct mcp_ops { 25struct mcp_ops {
@@ -47,15 +40,14 @@ void mcp_disable(struct mcp *);
47#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) 40#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate)
48 41
49struct mcp *mcp_host_alloc(struct device *, size_t); 42struct mcp *mcp_host_alloc(struct device *, size_t);
50int mcp_host_register(struct mcp *); 43int mcp_host_add(struct mcp *, void *);
51void mcp_host_unregister(struct mcp *); 44void mcp_host_del(struct mcp *);
45void mcp_host_free(struct mcp *);
52 46
53struct mcp_driver { 47struct mcp_driver {
54 struct device_driver drv; 48 struct device_driver drv;
55 int (*probe)(struct mcp *); 49 int (*probe)(struct mcp *);
56 void (*remove)(struct mcp *); 50 void (*remove)(struct mcp *);
57 int (*suspend)(struct mcp *, pm_message_t);
58 int (*resume)(struct mcp *);
59}; 51};
60 52
61int mcp_driver_register(struct mcp_driver *); 53int mcp_driver_register(struct mcp_driver *);
diff --git a/include/linux/mfd/pm8xxx/pm8921.h b/include/linux/mfd/pm8xxx/pm8921.h
index d5517fd32d1b..00fa3de7659d 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 000000000000..a2c61609d21d
--- /dev/null
+++ b/include/linux/mfd/rc5t583.h
@@ -0,0 +1,295 @@
1/*
2 * Core driver interface to access RICOH_RC5T583 power management chip.
3 *
4 * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved.
5 * Author: Laxman dewangan <ldewangan@nvidia.com>
6 *
7 * Based on code
8 * Copyright (C) 2011 RICOH COMPANY,LTD
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#ifndef __LINUX_MFD_RC5T583_H
25#define __LINUX_MFD_RC5T583_H
26
27#include <linux/mutex.h>
28#include <linux/types.h>
29
30#define RC5T583_MAX_REGS 0xF8
31
32/* Maximum number of main interrupts */
33#define MAX_MAIN_INTERRUPT 5
34#define RC5T583_MAX_GPEDGE_REG 2
35#define RC5T583_MAX_INTERRUPT_MASK_REGS 9
36
37/* Interrupt enable register */
38#define RC5T583_INT_EN_SYS1 0x19
39#define RC5T583_INT_EN_SYS2 0x1D
40#define RC5T583_INT_EN_DCDC 0x41
41#define RC5T583_INT_EN_RTC 0xED
42#define RC5T583_INT_EN_ADC1 0x90
43#define RC5T583_INT_EN_ADC2 0x91
44#define RC5T583_INT_EN_ADC3 0x92
45
46/* Interrupt status registers (monitor regs in Ricoh)*/
47#define RC5T583_INTC_INTPOL 0xAD
48#define RC5T583_INTC_INTEN 0xAE
49#define RC5T583_INTC_INTMON 0xAF
50
51#define RC5T583_INT_MON_GRP 0xAF
52#define RC5T583_INT_MON_SYS1 0x1B
53#define RC5T583_INT_MON_SYS2 0x1F
54#define RC5T583_INT_MON_DCDC 0x43
55#define RC5T583_INT_MON_RTC 0xEE
56
57/* Interrupt clearing registers */
58#define RC5T583_INT_IR_SYS1 0x1A
59#define RC5T583_INT_IR_SYS2 0x1E
60#define RC5T583_INT_IR_DCDC 0x42
61#define RC5T583_INT_IR_RTC 0xEE
62#define RC5T583_INT_IR_ADCL 0x94
63#define RC5T583_INT_IR_ADCH 0x95
64#define RC5T583_INT_IR_ADCEND 0x96
65#define RC5T583_INT_IR_GPIOR 0xA9
66#define RC5T583_INT_IR_GPIOF 0xAA
67
68/* Sleep sequence registers */
69#define RC5T583_SLPSEQ1 0x21
70#define RC5T583_SLPSEQ2 0x22
71#define RC5T583_SLPSEQ3 0x23
72#define RC5T583_SLPSEQ4 0x24
73#define RC5T583_SLPSEQ5 0x25
74#define RC5T583_SLPSEQ6 0x26
75#define RC5T583_SLPSEQ7 0x27
76#define RC5T583_SLPSEQ8 0x28
77#define RC5T583_SLPSEQ9 0x29
78#define RC5T583_SLPSEQ10 0x2A
79#define RC5T583_SLPSEQ11 0x2B
80
81/* Regulator registers */
82#define RC5T583_REG_DC0CTL 0x30
83#define RC5T583_REG_DC0DAC 0x31
84#define RC5T583_REG_DC0LATCTL 0x32
85#define RC5T583_REG_SR0CTL 0x33
86
87#define RC5T583_REG_DC1CTL 0x34
88#define RC5T583_REG_DC1DAC 0x35
89#define RC5T583_REG_DC1LATCTL 0x36
90#define RC5T583_REG_SR1CTL 0x37
91
92#define RC5T583_REG_DC2CTL 0x38
93#define RC5T583_REG_DC2DAC 0x39
94#define RC5T583_REG_DC2LATCTL 0x3A
95#define RC5T583_REG_SR2CTL 0x3B
96
97#define RC5T583_REG_DC3CTL 0x3C
98#define RC5T583_REG_DC3DAC 0x3D
99#define RC5T583_REG_DC3LATCTL 0x3E
100#define RC5T583_REG_SR3CTL 0x3F
101
102
103#define RC5T583_REG_LDOEN1 0x50
104#define RC5T583_REG_LDOEN2 0x51
105#define RC5T583_REG_LDODIS1 0x52
106#define RC5T583_REG_LDODIS2 0x53
107
108#define RC5T583_REG_LDO0DAC 0x54
109#define RC5T583_REG_LDO1DAC 0x55
110#define RC5T583_REG_LDO2DAC 0x56
111#define RC5T583_REG_LDO3DAC 0x57
112#define RC5T583_REG_LDO4DAC 0x58
113#define RC5T583_REG_LDO5DAC 0x59
114#define RC5T583_REG_LDO6DAC 0x5A
115#define RC5T583_REG_LDO7DAC 0x5B
116#define RC5T583_REG_LDO8DAC 0x5C
117#define RC5T583_REG_LDO9DAC 0x5D
118
119#define RC5T583_REG_DC0DAC_DS 0x60
120#define RC5T583_REG_DC1DAC_DS 0x61
121#define RC5T583_REG_DC2DAC_DS 0x62
122#define RC5T583_REG_DC3DAC_DS 0x63
123
124#define RC5T583_REG_LDO0DAC_DS 0x64
125#define RC5T583_REG_LDO1DAC_DS 0x65
126#define RC5T583_REG_LDO2DAC_DS 0x66
127#define RC5T583_REG_LDO3DAC_DS 0x67
128#define RC5T583_REG_LDO4DAC_DS 0x68
129#define RC5T583_REG_LDO5DAC_DS 0x69
130#define RC5T583_REG_LDO6DAC_DS 0x6A
131#define RC5T583_REG_LDO7DAC_DS 0x6B
132#define RC5T583_REG_LDO8DAC_DS 0x6C
133#define RC5T583_REG_LDO9DAC_DS 0x6D
134
135/* GPIO register base address */
136#define RC5T583_GPIO_IOSEL 0xA0
137#define RC5T583_GPIO_PDEN 0xA1
138#define RC5T583_GPIO_IOOUT 0xA2
139#define RC5T583_GPIO_PGSEL 0xA3
140#define RC5T583_GPIO_GPINV 0xA4
141#define RC5T583_GPIO_GPDEB 0xA5
142#define RC5T583_GPIO_GPEDGE1 0xA6
143#define RC5T583_GPIO_GPEDGE2 0xA7
144#define RC5T583_GPIO_EN_INT 0xA8
145#define RC5T583_GPIO_MON_IOIN 0xAB
146#define RC5T583_GPIO_GPOFUNC 0xAC
147
148/* RICOH_RC5T583 IRQ definitions */
149enum {
150 RC5T583_IRQ_ONKEY,
151 RC5T583_IRQ_ACOK,
152 RC5T583_IRQ_LIDOPEN,
153 RC5T583_IRQ_PREOT,
154 RC5T583_IRQ_CLKSTP,
155 RC5T583_IRQ_ONKEY_OFF,
156 RC5T583_IRQ_WD,
157 RC5T583_IRQ_EN_PWRREQ1,
158 RC5T583_IRQ_EN_PWRREQ2,
159 RC5T583_IRQ_PRE_VINDET,
160
161 RC5T583_IRQ_DC0LIM,
162 RC5T583_IRQ_DC1LIM,
163 RC5T583_IRQ_DC2LIM,
164 RC5T583_IRQ_DC3LIM,
165
166 RC5T583_IRQ_CTC,
167 RC5T583_IRQ_YALE,
168 RC5T583_IRQ_DALE,
169 RC5T583_IRQ_WALE,
170
171 RC5T583_IRQ_AIN1L,
172 RC5T583_IRQ_AIN2L,
173 RC5T583_IRQ_AIN3L,
174 RC5T583_IRQ_VBATL,
175 RC5T583_IRQ_VIN3L,
176 RC5T583_IRQ_VIN8L,
177 RC5T583_IRQ_AIN1H,
178 RC5T583_IRQ_AIN2H,
179 RC5T583_IRQ_AIN3H,
180 RC5T583_IRQ_VBATH,
181 RC5T583_IRQ_VIN3H,
182 RC5T583_IRQ_VIN8H,
183 RC5T583_IRQ_ADCEND,
184
185 RC5T583_IRQ_GPIO0,
186 RC5T583_IRQ_GPIO1,
187 RC5T583_IRQ_GPIO2,
188 RC5T583_IRQ_GPIO3,
189 RC5T583_IRQ_GPIO4,
190 RC5T583_IRQ_GPIO5,
191 RC5T583_IRQ_GPIO6,
192 RC5T583_IRQ_GPIO7,
193
194 /* Should be last entry */
195 RC5T583_MAX_IRQS,
196};
197
198/* Ricoh583 gpio definitions */
199enum {
200 RC5T583_GPIO0,
201 RC5T583_GPIO1,
202 RC5T583_GPIO2,
203 RC5T583_GPIO3,
204 RC5T583_GPIO4,
205 RC5T583_GPIO5,
206 RC5T583_GPIO6,
207 RC5T583_GPIO7,
208
209 /* Should be last entry */
210 RC5T583_MAX_GPIO,
211};
212
213enum {
214 RC5T583_DS_NONE,
215 RC5T583_DS_DC0,
216 RC5T583_DS_DC1,
217 RC5T583_DS_DC2,
218 RC5T583_DS_DC3,
219 RC5T583_DS_LDO0,
220 RC5T583_DS_LDO1,
221 RC5T583_DS_LDO2,
222 RC5T583_DS_LDO3,
223 RC5T583_DS_LDO4,
224 RC5T583_DS_LDO5,
225 RC5T583_DS_LDO6,
226 RC5T583_DS_LDO7,
227 RC5T583_DS_LDO8,
228 RC5T583_DS_LDO9,
229 RC5T583_DS_PSO0,
230 RC5T583_DS_PSO1,
231 RC5T583_DS_PSO2,
232 RC5T583_DS_PSO3,
233 RC5T583_DS_PSO4,
234 RC5T583_DS_PSO5,
235 RC5T583_DS_PSO6,
236 RC5T583_DS_PSO7,
237
238 /* Should be last entry */
239 RC5T583_DS_MAX,
240};
241
242/*
243 * Ricoh pmic RC5T583 supports sleep through two external controls.
244 * The output of gpios and regulator can be enable/disable through
245 * this external signals.
246 */
247enum {
248 RC5T583_EXT_PWRREQ1_CONTROL = 0x1,
249 RC5T583_EXT_PWRREQ2_CONTROL = 0x2,
250};
251
252struct rc5t583 {
253 struct device *dev;
254 struct regmap *regmap;
255 int chip_irq;
256 int irq_base;
257 struct mutex irq_lock;
258 unsigned long group_irq_en[MAX_MAIN_INTERRUPT];
259
260 /* For main interrupt bits in INTC */
261 uint8_t intc_inten_reg;
262
263 /* For group interrupt bits and address */
264 uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_MASK_REGS];
265
266 /* For gpio edge */
267 uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG];
268};
269
270/*
271 * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu.
272 * The board specific data is provided through this structure.
273 * @irq_base: Irq base number on which this device registers their interrupts.
274 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
275 */
276
277struct rc5t583_platform_data {
278 int irq_base;
279 bool enable_shutdown;
280};
281
282int rc5t583_write(struct device *dev, u8 reg, uint8_t val);
283int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val);
284int rc5t583_set_bits(struct device *dev, unsigned int reg,
285 unsigned int bit_mask);
286int rc5t583_clear_bits(struct device *dev, unsigned int reg,
287 unsigned int bit_mask);
288int rc5t583_update(struct device *dev, unsigned int reg,
289 unsigned int val, unsigned int mask);
290int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id,
291 int ext_pwr_req, int deepsleep_slot_nr);
292int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);
293int rc5t583_irq_exit(struct rc5t583 *rc5t583);
294
295#endif
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index ca1d7a347600..8516fd1eaabc 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 16c76e124f9c..3acb3a8e3af5 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 0dc98044d8b7..f5171dbf8850 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -1,8 +1,10 @@
1#ifndef MFD_TMIO_H 1#ifndef MFD_TMIO_H
2#define MFD_TMIO_H 2#define MFD_TMIO_H
3 3
4#include <linux/device.h>
4#include <linux/fb.h> 5#include <linux/fb.h>
5#include <linux/io.h> 6#include <linux/io.h>
7#include <linux/jiffies.h>
6#include <linux/platform_device.h> 8#include <linux/platform_device.h>
7#include <linux/pm_runtime.h> 9#include <linux/pm_runtime.h>
8 10
@@ -64,8 +66,8 @@
64#define TMIO_MMC_SDIO_IRQ (1 << 2) 66#define TMIO_MMC_SDIO_IRQ (1 << 2)
65/* 67/*
66 * Some platforms can detect card insertion events with controller powered 68 * Some platforms can detect card insertion events with controller powered
67 * down, in which case they have to call tmio_mmc_cd_wakeup() to power up the 69 * down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio,
68 * controller and report the event to the driver. 70 * and cd_flags fields of struct tmio_mmc_data.
69 */ 71 */
70#define TMIO_MMC_HAS_COLD_CD (1 << 3) 72#define TMIO_MMC_HAS_COLD_CD (1 << 3)
71/* 73/*
@@ -73,6 +75,12 @@
73 * idle before writing to some registers. 75 * idle before writing to some registers.
74 */ 76 */
75#define TMIO_MMC_HAS_IDLE_WAIT (1 << 4) 77#define TMIO_MMC_HAS_IDLE_WAIT (1 << 4)
78/*
79 * A GPIO is used for card hotplug detection. We need an extra flag for this,
80 * because 0 is a valid GPIO number too, and requiring users to specify
81 * cd_gpio < 0 to disable GPIO hotplug would break backwards compatibility.
82 */
83#define TMIO_MMC_USE_GPIO_CD (1 << 5)
76 84
77int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 85int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
78int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 86int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
@@ -97,19 +105,23 @@ struct tmio_mmc_data {
97 u32 ocr_mask; /* available voltages */ 105 u32 ocr_mask; /* available voltages */
98 struct tmio_mmc_dma *dma; 106 struct tmio_mmc_dma *dma;
99 struct device *dev; 107 struct device *dev;
100 bool power; 108 unsigned int cd_gpio;
101 void (*set_pwr)(struct platform_device *host, int state); 109 void (*set_pwr)(struct platform_device *host, int state);
102 void (*set_clk_div)(struct platform_device *host, int state); 110 void (*set_clk_div)(struct platform_device *host, int state);
103 int (*get_cd)(struct platform_device *host); 111 int (*get_cd)(struct platform_device *host);
104 int (*write16_hook)(struct tmio_mmc_host *host, int addr); 112 int (*write16_hook)(struct tmio_mmc_host *host, int addr);
105}; 113};
106 114
115/*
116 * This function is deprecated and will be removed soon. Please, convert your
117 * platform to use drivers/mmc/core/cd-gpio.c
118 */
119#include <linux/mmc/host.h>
107static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) 120static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
108{ 121{
109 if (pdata && !pdata->power) { 122 if (pdata)
110 pdata->power = true; 123 mmc_detect_change(dev_get_drvdata(pdata->dev),
111 pm_runtime_get(pdata->dev); 124 msecs_to_jiffies(100));
112 }
113} 125}
114 126
115/* 127/*
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
new file mode 100644
index 000000000000..38e31c55adbb
--- /dev/null
+++ b/include/linux/mfd/tps65090.h
@@ -0,0 +1,46 @@
1/*
2 * Core driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (C) 2012 NVIDIA Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 */
21
22#ifndef __LINUX_MFD_TPS65090_H
23#define __LINUX_MFD_TPS65090_H
24
25struct tps65090_subdev_info {
26 int id;
27 const char *name;
28 void *platform_data;
29};
30
31struct tps65090_platform_data {
32 int irq_base;
33 int num_subdevs;
34 struct tps65090_subdev_info *subdevs;
35};
36
37/*
38 * NOTE: the functions below are not intended for use outside
39 * of the TPS65090 sub-device drivers
40 */
41extern int tps65090_write(struct device *dev, int reg, uint8_t val);
42extern int tps65090_read(struct device *dev, int reg, uint8_t *val);
43extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num);
44extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num);
45
46#endif /*__LINUX_MFD_TPS65090_H */
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
new file mode 100644
index 000000000000..e030ef9a64ee
--- /dev/null
+++ b/include/linux/mfd/tps65217.h
@@ -0,0 +1,283 @@
1/*
2 * linux/mfd/tps65217.h
3 *
4 * Functions to access TPS65217 power management chip.
5 *
6 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_MFD_TPS65217_H
19#define __LINUX_MFD_TPS65217_H
20
21#include <linux/i2c.h>
22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h>
24
25/* I2C ID for TPS65217 part */
26#define TPS65217_I2C_ID 0x24
27
28/* All register addresses */
29#define TPS65217_REG_CHIPID 0X00
30#define TPS65217_REG_PPATH 0X01
31#define TPS65217_REG_INT 0X02
32#define TPS65217_REG_CHGCONFIG0 0X03
33#define TPS65217_REG_CHGCONFIG1 0X04
34#define TPS65217_REG_CHGCONFIG2 0X05
35#define TPS65217_REG_CHGCONFIG3 0X06
36#define TPS65217_REG_WLEDCTRL1 0X07
37#define TPS65217_REG_WLEDCTRL2 0X08
38#define TPS65217_REG_MUXCTRL 0X09
39#define TPS65217_REG_STATUS 0X0A
40#define TPS65217_REG_PASSWORD 0X0B
41#define TPS65217_REG_PGOOD 0X0C
42#define TPS65217_REG_DEFPG 0X0D
43#define TPS65217_REG_DEFDCDC1 0X0E
44#define TPS65217_REG_DEFDCDC2 0X0F
45#define TPS65217_REG_DEFDCDC3 0X10
46#define TPS65217_REG_DEFSLEW 0X11
47#define TPS65217_REG_DEFLDO1 0X12
48#define TPS65217_REG_DEFLDO2 0X13
49#define TPS65217_REG_DEFLS1 0X14
50#define TPS65217_REG_DEFLS2 0X15
51#define TPS65217_REG_ENABLE 0X16
52#define TPS65217_REG_DEFUVLO 0X18
53#define TPS65217_REG_SEQ1 0X19
54#define TPS65217_REG_SEQ2 0X1A
55#define TPS65217_REG_SEQ3 0X1B
56#define TPS65217_REG_SEQ4 0X1C
57#define TPS65217_REG_SEQ5 0X1D
58#define TPS65217_REG_SEQ6 0X1E
59
60/* Register field definitions */
61#define TPS65217_CHIPID_CHIP_MASK 0xF0
62#define TPS65217_CHIPID_REV_MASK 0x0F
63
64#define TPS65217_PPATH_ACSINK_ENABLE BIT(7)
65#define TPS65217_PPATH_USBSINK_ENABLE BIT(6)
66#define TPS65217_PPATH_AC_PW_ENABLE BIT(5)
67#define TPS65217_PPATH_USB_PW_ENABLE BIT(4)
68#define TPS65217_PPATH_AC_CURRENT_MASK 0x0C
69#define TPS65217_PPATH_USB_CURRENT_MASK 0x03
70
71#define TPS65217_INT_PBM BIT(6)
72#define TPS65217_INT_ACM BIT(5)
73#define TPS65217_INT_USBM BIT(4)
74#define TPS65217_INT_PBI BIT(2)
75#define TPS65217_INT_ACI BIT(1)
76#define TPS65217_INT_USBI BIT(0)
77
78#define TPS65217_CHGCONFIG0_TREG BIT(7)
79#define TPS65217_CHGCONFIG0_DPPM BIT(6)
80#define TPS65217_CHGCONFIG0_TSUSP BIT(5)
81#define TPS65217_CHGCONFIG0_TERMI BIT(4)
82#define TPS65217_CHGCONFIG0_ACTIVE BIT(3)
83#define TPS65217_CHGCONFIG0_CHGTOUT BIT(2)
84#define TPS65217_CHGCONFIG0_PCHGTOUT BIT(1)
85#define TPS65217_CHGCONFIG0_BATTEMP BIT(0)
86
87#define TPS65217_CHGCONFIG1_TMR_MASK 0xC0
88#define TPS65217_CHGCONFIG1_TMR_ENABLE BIT(5)
89#define TPS65217_CHGCONFIG1_NTC_TYPE BIT(4)
90#define TPS65217_CHGCONFIG1_RESET BIT(3)
91#define TPS65217_CHGCONFIG1_TERM BIT(2)
92#define TPS65217_CHGCONFIG1_SUSP BIT(1)
93#define TPS65217_CHGCONFIG1_CHG_EN BIT(0)
94
95#define TPS65217_CHGCONFIG2_DYNTMR BIT(7)
96#define TPS65217_CHGCONFIG2_VPREGHG BIT(6)
97#define TPS65217_CHGCONFIG2_VOREG_MASK 0x30
98
99#define TPS65217_CHGCONFIG3_ICHRG_MASK 0xC0
100#define TPS65217_CHGCONFIG3_DPPMTH_MASK 0x30
101#define TPS65217_CHGCONFIG2_PCHRGT BIT(3)
102#define TPS65217_CHGCONFIG2_TERMIF 0x06
103#define TPS65217_CHGCONFIG2_TRANGE BIT(0)
104
105#define TPS65217_WLEDCTRL1_ISINK_ENABLE BIT(3)
106#define TPS65217_WLEDCTRL1_ISEL BIT(2)
107#define TPS65217_WLEDCTRL1_FDIM_MASK 0x03
108
109#define TPS65217_WLEDCTRL2_DUTY_MASK 0x7F
110
111#define TPS65217_MUXCTRL_MUX_MASK 0x07
112
113#define TPS65217_STATUS_OFF BIT(7)
114#define TPS65217_STATUS_ACPWR BIT(3)
115#define TPS65217_STATUS_USBPWR BIT(2)
116#define TPS65217_STATUS_PB BIT(0)
117
118#define TPS65217_PASSWORD_REGS_UNLOCK 0x7D
119
120#define TPS65217_PGOOD_LDO3_PG BIT(6)
121#define TPS65217_PGOOD_LDO4_PG BIT(5)
122#define TPS65217_PGOOD_DC1_PG BIT(4)
123#define TPS65217_PGOOD_DC2_PG BIT(3)
124#define TPS65217_PGOOD_DC3_PG BIT(2)
125#define TPS65217_PGOOD_LDO1_PG BIT(1)
126#define TPS65217_PGOOD_LDO2_PG BIT(0)
127
128#define TPS65217_DEFPG_LDO1PGM BIT(3)
129#define TPS65217_DEFPG_LDO2PGM BIT(2)
130#define TPS65217_DEFPG_PGDLY_MASK 0x03
131
132#define TPS65217_DEFDCDCX_XADJX BIT(7)
133#define TPS65217_DEFDCDCX_DCDC_MASK 0x3F
134
135#define TPS65217_DEFSLEW_GO BIT(7)
136#define TPS65217_DEFSLEW_GODSBL BIT(6)
137#define TPS65217_DEFSLEW_PFM_EN1 BIT(5)
138#define TPS65217_DEFSLEW_PFM_EN2 BIT(4)
139#define TPS65217_DEFSLEW_PFM_EN3 BIT(3)
140#define TPS65217_DEFSLEW_SLEW_MASK 0x07
141
142#define TPS65217_DEFLDO1_LDO1_MASK 0x0F
143
144#define TPS65217_DEFLDO2_TRACK BIT(6)
145#define TPS65217_DEFLDO2_LDO2_MASK 0x3F
146
147#define TPS65217_DEFLDO3_LDO3_EN BIT(5)
148#define TPS65217_DEFLDO3_LDO3_MASK 0x1F
149
150#define TPS65217_DEFLDO4_LDO4_EN BIT(5)
151#define TPS65217_DEFLDO4_LDO4_MASK 0x1F
152
153#define TPS65217_ENABLE_LS1_EN BIT(6)
154#define TPS65217_ENABLE_LS2_EN BIT(5)
155#define TPS65217_ENABLE_DC1_EN BIT(4)
156#define TPS65217_ENABLE_DC2_EN BIT(3)
157#define TPS65217_ENABLE_DC3_EN BIT(2)
158#define TPS65217_ENABLE_LDO1_EN BIT(1)
159#define TPS65217_ENABLE_LDO2_EN BIT(0)
160
161#define TPS65217_DEFUVLO_UVLOHYS BIT(2)
162#define TPS65217_DEFUVLO_UVLO_MASK 0x03
163
164#define TPS65217_SEQ1_DC1_SEQ_MASK 0xF0
165#define TPS65217_SEQ1_DC2_SEQ_MASK 0x0F
166
167#define TPS65217_SEQ2_DC3_SEQ_MASK 0xF0
168#define TPS65217_SEQ2_LDO1_SEQ_MASK 0x0F
169
170#define TPS65217_SEQ3_LDO2_SEQ_MASK 0xF0
171#define TPS65217_SEQ3_LDO3_SEQ_MASK 0x0F
172
173#define TPS65217_SEQ4_LDO4_SEQ_MASK 0xF0
174
175#define TPS65217_SEQ5_DLY1_MASK 0xC0
176#define TPS65217_SEQ5_DLY2_MASK 0x30
177#define TPS65217_SEQ5_DLY3_MASK 0x0C
178#define TPS65217_SEQ5_DLY4_MASK 0x03
179
180#define TPS65217_SEQ6_DLY5_MASK 0xC0
181#define TPS65217_SEQ6_DLY6_MASK 0x30
182#define TPS65217_SEQ6_SEQUP BIT(2)
183#define TPS65217_SEQ6_SEQDWN BIT(1)
184#define TPS65217_SEQ6_INSTDWN BIT(0)
185
186#define TPS65217_MAX_REGISTER 0x1E
187#define TPS65217_PROTECT_NONE 0
188#define TPS65217_PROTECT_L1 1
189#define TPS65217_PROTECT_L2 2
190
191
192enum tps65217_regulator_id {
193 /* DCDC's */
194 TPS65217_DCDC_1,
195 TPS65217_DCDC_2,
196 TPS65217_DCDC_3,
197 /* LDOs */
198 TPS65217_LDO_1,
199 TPS65217_LDO_2,
200 TPS65217_LDO_3,
201 TPS65217_LDO_4,
202};
203
204#define TPS65217_MAX_REG_ID TPS65217_LDO_4
205
206/* Number of step-down converters available */
207#define TPS65217_NUM_DCDC 3
208/* Number of LDO voltage regulators available */
209#define TPS65217_NUM_LDO 4
210/* Number of total regulators available */
211#define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO)
212
213/**
214 * struct tps65217_board - packages regulator init data
215 * @tps65217_regulator_data: regulator initialization values
216 *
217 * Board data may be used to initialize regulator.
218 */
219struct tps65217_board {
220 struct regulator_init_data *tps65217_init_data;
221};
222
223/**
224 * struct tps_info - packages regulator constraints
225 * @name: Voltage regulator name
226 * @min_uV: minimum micro volts
227 * @max_uV: minimum micro volts
228 * @vsel_to_uv: Function pointer to get voltage from selector
229 * @uv_to_vsel: Function pointer to get selector from voltage
230 * @table: Table for non-uniform voltage step-size
231 * @table_len: Length of the voltage table
232 * @enable_mask: Regulator enable mask bits
233 * @set_vout_reg: Regulator output voltage set register
234 * @set_vout_mask: Regulator output voltage set mask
235 *
236 * This data is used to check the regualtor voltage limits while setting.
237 */
238struct tps_info {
239 const char *name;
240 int min_uV;
241 int max_uV;
242 int (*vsel_to_uv)(unsigned int vsel);
243 int (*uv_to_vsel)(int uV, unsigned int *vsel);
244 const int *table;
245 unsigned int table_len;
246 unsigned int enable_mask;
247 unsigned int set_vout_reg;
248 unsigned int set_vout_mask;
249};
250
251/**
252 * struct tps65217 - tps65217 sub-driver chip access routines
253 *
254 * Device data may be used to access the TPS65217 chip
255 */
256
257struct tps65217 {
258 struct device *dev;
259 struct tps65217_board *pdata;
260 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
261 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
262 struct tps_info *info[TPS65217_NUM_REGULATOR];
263 struct regmap *regmap;
264
265 /* Client devices */
266 struct platform_device *regulator_pdev[TPS65217_NUM_REGULATOR];
267};
268
269static inline struct tps65217 *dev_to_tps65217(struct device *dev)
270{
271 return dev_get_drvdata(dev);
272}
273
274int tps65217_reg_read(struct tps65217 *tps, unsigned int reg,
275 unsigned int *val);
276int tps65217_reg_write(struct tps65217 *tps, unsigned int reg,
277 unsigned int val, unsigned int level);
278int tps65217_set_bits(struct tps65217 *tps, unsigned int reg,
279 unsigned int mask, unsigned int val, unsigned int level);
280int tps65217_clear_bits(struct tps65217 *tps, unsigned int reg,
281 unsigned int mask, unsigned int level);
282
283#endif /* __LINUX_MFD_TPS65217_H */
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 76700b5eee92..1c6c2860d1a6 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -17,6 +17,8 @@
17#ifndef __LINUX_MFD_TPS65910_H 17#ifndef __LINUX_MFD_TPS65910_H
18#define __LINUX_MFD_TPS65910_H 18#define __LINUX_MFD_TPS65910_H
19 19
20#include <linux/gpio.h>
21
20/* TPS chip id list */ 22/* TPS chip id list */
21#define TPS65910 0 23#define TPS65910 0
22#define TPS65911 1 24#define TPS65911 1
@@ -657,6 +659,8 @@
657 659
658 660
659/*Register GPIO (0x80) register.RegisterDescription */ 661/*Register GPIO (0x80) register.RegisterDescription */
662#define GPIO_SLEEP_MASK 0x80
663#define GPIO_SLEEP_SHIFT 7
660#define GPIO_DEB_MASK 0x10 664#define GPIO_DEB_MASK 0x10
661#define GPIO_DEB_SHIFT 4 665#define GPIO_DEB_SHIFT 4
662#define GPIO_PUEN_MASK 0x08 666#define GPIO_PUEN_MASK 0x08
@@ -740,6 +744,11 @@
740#define TPS65910_GPIO_STS BIT(1) 744#define TPS65910_GPIO_STS BIT(1)
741#define TPS65910_GPIO_SET BIT(0) 745#define TPS65910_GPIO_SET BIT(0)
742 746
747/* Max number of TPS65910/11 GPIOs */
748#define TPS65910_NUM_GPIO 6
749#define TPS65911_NUM_GPIO 9
750#define TPS6591X_MAX_NUM_GPIO 9
751
743/* Regulator Index Definitions */ 752/* Regulator Index Definitions */
744#define TPS65910_REG_VRTC 0 753#define TPS65910_REG_VRTC 0
745#define TPS65910_REG_VIO 1 754#define TPS65910_REG_VIO 1
@@ -785,6 +794,7 @@ struct tps65910_board {
785 int irq_base; 794 int irq_base;
786 int vmbch_threshold; 795 int vmbch_threshold;
787 int vmbch2_threshold; 796 int vmbch2_threshold;
797 bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
788 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; 798 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
789 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; 799 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
790}; 800};
@@ -796,6 +806,7 @@ struct tps65910_board {
796struct tps65910 { 806struct tps65910 {
797 struct device *dev; 807 struct device *dev;
798 struct i2c_client *i2c_client; 808 struct i2c_client *i2c_client;
809 struct regmap *regmap;
799 struct mutex io_mutex; 810 struct mutex io_mutex;
800 unsigned int id; 811 unsigned int id;
801 int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest); 812 int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest);
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index 4321f044d1e4..28af41756360 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -12,7 +12,7 @@
12 12
13#include <linux/mfd/mcp.h> 13#include <linux/mfd/mcp.h>
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/semaphore.h> 15#include <linux/mutex.h>
16 16
17#define UCB_IO_DATA 0x00 17#define UCB_IO_DATA 0x00
18#define UCB_IO_DIR 0x01 18#define UCB_IO_DIR 0x01
@@ -104,17 +104,27 @@
104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12) 104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12)
105#define UCB_MODE_AUD_OFF_CAN (1 << 13) 105#define UCB_MODE_AUD_OFF_CAN (1 << 13)
106 106
107enum ucb1x00_reset {
108 UCB_RST_PROBE,
109 UCB_RST_RESUME,
110 UCB_RST_SUSPEND,
111 UCB_RST_REMOVE,
112 UCB_RST_PROBE_FAIL,
113};
107 114
108struct ucb1x00_irq { 115struct ucb1x00_plat_data {
109 void *devid; 116 void (*reset)(enum ucb1x00_reset);
110 void (*fn)(int, void *); 117 unsigned irq_base;
118 int gpio_base;
119 unsigned can_wakeup;
111}; 120};
112 121
113struct ucb1x00 { 122struct ucb1x00 {
114 spinlock_t lock; 123 raw_spinlock_t irq_lock;
115 struct mcp *mcp; 124 struct mcp *mcp;
116 unsigned int irq; 125 unsigned int irq;
117 struct semaphore adc_sem; 126 int irq_base;
127 struct mutex adc_mutex;
118 spinlock_t io_lock; 128 spinlock_t io_lock;
119 u16 id; 129 u16 id;
120 u16 io_dir; 130 u16 io_dir;
@@ -122,7 +132,8 @@ struct ucb1x00 {
122 u16 adc_cr; 132 u16 adc_cr;
123 u16 irq_fal_enbl; 133 u16 irq_fal_enbl;
124 u16 irq_ris_enbl; 134 u16 irq_ris_enbl;
125 struct ucb1x00_irq irq_handler[16]; 135 u16 irq_mask;
136 u16 irq_wake;
126 struct device dev; 137 struct device dev;
127 struct list_head node; 138 struct list_head node;
128 struct list_head devs; 139 struct list_head devs;
@@ -144,7 +155,7 @@ struct ucb1x00_driver {
144 struct list_head devs; 155 struct list_head devs;
145 int (*add)(struct ucb1x00_dev *dev); 156 int (*add)(struct ucb1x00_dev *dev);
146 void (*remove)(struct ucb1x00_dev *dev); 157 void (*remove)(struct ucb1x00_dev *dev);
147 int (*suspend)(struct ucb1x00_dev *dev, pm_message_t state); 158 int (*suspend)(struct ucb1x00_dev *dev);
148 int (*resume)(struct ucb1x00_dev *dev); 159 int (*resume)(struct ucb1x00_dev *dev);
149}; 160};
150 161
@@ -245,15 +256,4 @@ unsigned int ucb1x00_adc_read(struct ucb1x00 *ucb, int adc_channel, int sync);
245void ucb1x00_adc_enable(struct ucb1x00 *ucb); 256void ucb1x00_adc_enable(struct ucb1x00 *ucb);
246void ucb1x00_adc_disable(struct ucb1x00 *ucb); 257void ucb1x00_adc_disable(struct ucb1x00 *ucb);
247 258
248/*
249 * Which edges of the IRQ do you want to control today?
250 */
251#define UCB_RISING (1 << 0)
252#define UCB_FALLING (1 << 1)
253
254int ucb1x00_hook_irq(struct ucb1x00 *ucb, unsigned int idx, void (*fn)(int, void *), void *devid);
255void ucb1x00_enable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges);
256void ucb1x00_disable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges);
257int ucb1x00_free_irq(struct ucb1x00 *ucb, unsigned int idx, void *devid);
258
259#endif 259#endif
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 3fb1f407d5e6..893267bb6229 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -22,7 +22,6 @@ struct wm8994_ldo_pdata {
22 /** GPIOs to enable regulator, 0 or less if not available */ 22 /** GPIOs to enable regulator, 0 or less if not available */
23 int enable; 23 int enable;
24 24
25 const char *supply;
26 const struct regulator_init_data *init_data; 25 const struct regulator_init_data *init_data;
27}; 26};
28 27
@@ -185,6 +184,9 @@ struct wm8994_pdata {
185 unsigned int jd_scthr:2; 184 unsigned int jd_scthr:2;
186 unsigned int jd_thr:2; 185 unsigned int jd_thr:2;
187 186
187 /* Configure WM1811 jack detection for use with external capacitor */
188 unsigned int jd_ext_cap:1;
189
188 /* WM8958 microphone bias configuration */ 190 /* WM8958 microphone bias configuration */
189 int micbias[2]; 191 int micbias[2];
190 192
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index e1eebf78caba..5f1298b1b5ef 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 7330742e7973..d8738a464b94 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 19a41d1737af..01beae78f079 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 a8e469783318..cefaba038ccb 100644
--- a/include/linux/mmc/cd-gpio.h
+++ b/include/linux/mmc/cd-gpio.h
@@ -12,8 +12,7 @@
12#define MMC_CD_GPIO_H 12#define MMC_CD_GPIO_H
13 13
14struct mmc_host; 14struct mmc_host;
15int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio, 15int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio);
16 unsigned int irq, unsigned long flags);
17void mmc_cd_gpio_free(struct mmc_host *host); 16void mmc_cd_gpio_free(struct mmc_host *host);
18 17
19#endif 18#endif
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 87a976cc5654..1b431c728b9a 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 aae5d1f1bb39..8f66e28f5a0f 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -76,7 +76,7 @@ struct mmc_data;
76 * @num_slots: Number of slots available. 76 * @num_slots: Number of slots available.
77 * @verid: Denote Version ID. 77 * @verid: Denote Version ID.
78 * @data_offset: Set the offset of DATA register according to VERID. 78 * @data_offset: Set the offset of DATA register according to VERID.
79 * @pdev: Platform device associated with the MMC controller. 79 * @dev: Device associated with the MMC controller.
80 * @pdata: Platform data associated with the MMC controller. 80 * @pdata: Platform data associated with the MMC controller.
81 * @slot: Slots sharing this MMC controller. 81 * @slot: Slots sharing this MMC controller.
82 * @fifo_depth: depth of FIFO. 82 * @fifo_depth: depth of FIFO.
@@ -87,6 +87,8 @@ struct mmc_data;
87 * @push_data: Pointer to FIFO push function. 87 * @push_data: Pointer to FIFO push function.
88 * @pull_data: Pointer to FIFO pull function. 88 * @pull_data: Pointer to FIFO pull function.
89 * @quirks: Set of quirks that apply to specific versions of the IP. 89 * @quirks: Set of quirks that apply to specific versions of the IP.
90 * @irq_flags: The flags to be passed to request_irq.
91 * @irq: The irq value to be passed to request_irq.
90 * 92 *
91 * Locking 93 * Locking
92 * ======= 94 * =======
@@ -153,7 +155,7 @@ struct dw_mci {
153 u32 fifoth_val; 155 u32 fifoth_val;
154 u16 verid; 156 u16 verid;
155 u16 data_offset; 157 u16 data_offset;
156 struct platform_device *pdev; 158 struct device dev;
157 struct dw_mci_board *pdata; 159 struct dw_mci_board *pdata;
158 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 160 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
159 161
@@ -174,6 +176,8 @@ struct dw_mci {
174 u32 quirks; 176 u32 quirks;
175 177
176 struct regulator *vmmc; /* Power regulator */ 178 struct regulator *vmmc; /* Power regulator */
179 unsigned long irq_flags; /* IRQ flags */
180 unsigned int irq;
177}; 181};
178 182
179/* DMA ops for Internal/External DMAC interface */ 183/* DMA ops for Internal/External DMAC interface */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index ee2b0363c040..cbde4b7e675e 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 8fa5bc5f8059..1f5e68923929 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 fb9f6e116e1c..b822a2cb6008 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -274,6 +274,7 @@ struct _mmc_csd {
274#define EXT_CSD_FLUSH_CACHE 32 /* W */ 274#define EXT_CSD_FLUSH_CACHE 32 /* W */
275#define EXT_CSD_CACHE_CTRL 33 /* R/W */ 275#define EXT_CSD_CACHE_CTRL 33 /* R/W */
276#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ 276#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
277#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
277#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ 278#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
278#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 279#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
279#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 280#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
@@ -315,6 +316,8 @@ struct _mmc_csd {
315#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ 316#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */
316#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ 317#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
317#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ 318#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
319#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
320#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
318#define EXT_CSD_HPI_FEATURES 503 /* RO */ 321#define EXT_CSD_HPI_FEATURES 503 /* RO */
319 322
320/* 323/*
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index c750f85177d9..e9051e1cb1ce 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -90,6 +90,8 @@ struct sdhci_host {
90 90
91 unsigned int quirks2; /* More deviations from spec. */ 91 unsigned int quirks2; /* More deviations from spec. */
92 92
93#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
94
93 int irq; /* Device IRQ */ 95 int irq; /* Device IRQ */
94 void __iomem *ioaddr; /* Mapped address */ 96 void __iomem *ioaddr; /* Mapped address */
95 97
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 04ff452bf5c3..05f0e3db1c12 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -77,18 +77,15 @@ struct sh_mmcif_plat_data {
77 77
78/* CE_CLK_CTRL */ 78/* CE_CLK_CTRL */
79#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */ 79#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */
80#define CLK_CLEAR ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) 80#define CLK_CLEAR (0xf << 16)
81#define CLK_SUP_PCLK ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16)) 81#define CLK_SUP_PCLK (0xf << 16)
82#define CLKDIV_4 (1<<16) /* mmc clock frequency. 82#define CLKDIV_4 (1 << 16) /* mmc clock frequency.
83 * n: bus clock/(2^(n+1)) */ 83 * n: bus clock/(2^(n+1)) */
84#define CLKDIV_256 (7<<16) /* mmc clock frequency. (see above) */ 84#define CLKDIV_256 (7 << 16) /* mmc clock frequency. (see above) */
85#define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */ 85#define SRSPTO_256 (2 << 12) /* resp timeout */
86#define SRBSYTO_29 ((1 << 11) | (1 << 10) | \ 86#define SRBSYTO_29 (0xf << 8) /* resp busy timeout */
87 (1 << 9) | (1 << 8)) /* resp busy timeout */ 87#define SRWDTO_29 (0xf << 4) /* read/write timeout */
88#define SRWDTO_29 ((1 << 7) | (1 << 6) | \ 88#define SCCSTO_29 (0xf << 0) /* ccs timeout */
89 (1 << 5) | (1 << 4)) /* read/write timeout */
90#define SCCSTO_29 ((1 << 3) | (1 << 2) | \
91 (1 << 1) | (1 << 0)) /* ccs timeout */
92 89
93/* CE_VERSION */ 90/* CE_VERSION */
94#define SOFT_RST_ON (1 << 31) 91#define SOFT_RST_ON (1 << 31)
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index 71b805451bd8..e94e620aeddc 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -10,15 +10,29 @@ struct tmio_mmc_data;
10#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard" 10#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard"
11#define SH_MOBILE_SDHI_IRQ_SDIO "sdio" 11#define SH_MOBILE_SDHI_IRQ_SDIO "sdio"
12 12
13/**
14 * struct sh_mobile_sdhi_ops - SDHI driver callbacks
15 * @cd_wakeup: trigger a card-detection run
16 */
17struct sh_mobile_sdhi_ops {
18 void (*cd_wakeup)(const struct platform_device *pdev);
19};
20
13struct sh_mobile_sdhi_info { 21struct sh_mobile_sdhi_info {
14 int dma_slave_tx; 22 int dma_slave_tx;
15 int dma_slave_rx; 23 int dma_slave_rx;
16 unsigned long tmio_flags; 24 unsigned long tmio_flags;
17 unsigned long tmio_caps; 25 unsigned long tmio_caps;
18 u32 tmio_ocr_mask; /* available MMC voltages */ 26 u32 tmio_ocr_mask; /* available MMC voltages */
27 unsigned int cd_gpio;
19 struct tmio_mmc_data *pdata; 28 struct tmio_mmc_data *pdata;
20 void (*set_pwr)(struct platform_device *pdev, int state); 29 void (*set_pwr)(struct platform_device *pdev, int state);
21 int (*get_cd)(struct platform_device *pdev); 30 int (*get_cd)(struct platform_device *pdev);
31
32 /* callbacks for board specific setup code */
33 int (*init)(struct platform_device *pdev,
34 const struct sh_mobile_sdhi_ops *ops);
35 void (*cleanup)(struct platform_device *pdev);
22}; 36};
23 37
24#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */ 38#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index fb69ad191ad7..501da4cb8a6d 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 4598bf03e98b..fbcafe2ee13e 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -21,8 +21,6 @@
21#include <linux/percpu.h> 21#include <linux/percpu.h>
22#include <asm/module.h> 22#include <asm/module.h>
23 23
24#include <trace/events/module.h>
25
26/* Not Yet Implemented */ 24/* Not Yet Implemented */
27#define MODULE_SUPPORTED_DEVICE(name) 25#define MODULE_SUPPORTED_DEVICE(name)
28 26
@@ -452,33 +450,11 @@ void symbol_put_addr(void *addr);
452 450
453/* Sometimes we know we already have a refcount, and it's easier not 451/* Sometimes we know we already have a refcount, and it's easier not
454 to handle the error case (which only happens with rmmod --wait). */ 452 to handle the error case (which only happens with rmmod --wait). */
455static inline void __module_get(struct module *module) 453extern void __module_get(struct module *module);
456{
457 if (module) {
458 preempt_disable();
459 __this_cpu_inc(module->refptr->incs);
460 trace_module_get(module, _THIS_IP_);
461 preempt_enable();
462 }
463}
464
465static inline int try_module_get(struct module *module)
466{
467 int ret = 1;
468
469 if (module) {
470 preempt_disable();
471 454
472 if (likely(module_is_live(module))) { 455/* This is the Right Way to get a module: if it fails, it's being removed,
473 __this_cpu_inc(module->refptr->incs); 456 * so pretend it's not there. */
474 trace_module_get(module, _THIS_IP_); 457extern bool try_module_get(struct module *module);
475 } else
476 ret = 0;
477
478 preempt_enable();
479 }
480 return ret;
481}
482 458
483extern void module_put(struct module *module); 459extern void module_put(struct module *module);
484 460
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index c47f4d60db0b..ea36486378d8 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -47,14 +47,11 @@ struct kernel_param_ops {
47 void (*free)(void *arg); 47 void (*free)(void *arg);
48}; 48};
49 49
50/* Flag bits for kernel_param.flags */
51#define KPARAM_ISBOOL 2
52
53struct kernel_param { 50struct kernel_param {
54 const char *name; 51 const char *name;
55 const struct kernel_param_ops *ops; 52 const struct kernel_param_ops *ops;
56 u16 perm; 53 u16 perm;
57 u16 flags; 54 s16 level;
58 union { 55 union {
59 void *arg; 56 void *arg;
60 const struct kparam_string *str; 57 const struct kparam_string *str;
@@ -131,8 +128,40 @@ struct kparam_array
131 * The ops can have NULL set or get functions. 128 * The ops can have NULL set or get functions.
132 */ 129 */
133#define module_param_cb(name, ops, arg, perm) \ 130#define module_param_cb(name, ops, arg, perm) \
134 __module_param_call(MODULE_PARAM_PREFIX, \ 131 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0)
135 name, ops, arg, __same_type((arg), bool *), perm) 132
133/**
134 * <level>_param_cb - general callback for a module/cmdline parameter
135 * to be evaluated before certain initcall level
136 * @name: a valid C identifier which is the parameter name.
137 * @ops: the set & get operations for this parameter.
138 * @perm: visibility in sysfs.
139 *
140 * The ops can have NULL set or get functions.
141 */
142#define __level_param_cb(name, ops, arg, perm, level) \
143 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level)
144
145#define core_param_cb(name, ops, arg, perm) \
146 __level_param_cb(name, ops, arg, perm, 1)
147
148#define postcore_param_cb(name, ops, arg, perm) \
149 __level_param_cb(name, ops, arg, perm, 2)
150
151#define arch_param_cb(name, ops, arg, perm) \
152 __level_param_cb(name, ops, arg, perm, 3)
153
154#define subsys_param_cb(name, ops, arg, perm) \
155 __level_param_cb(name, ops, arg, perm, 4)
156
157#define fs_param_cb(name, ops, arg, perm) \
158 __level_param_cb(name, ops, arg, perm, 5)
159
160#define device_param_cb(name, ops, arg, perm) \
161 __level_param_cb(name, ops, arg, perm, 6)
162
163#define late_param_cb(name, ops, arg, perm) \
164 __level_param_cb(name, ops, arg, perm, 7)
136 165
137/* On alpha, ia64 and ppc64 relocations to global data cannot go into 166/* On alpha, ia64 and ppc64 relocations to global data cannot go into
138 read-only sections (which is part of respective UNIX ABI on these 167 read-only sections (which is part of respective UNIX ABI on these
@@ -146,7 +175,7 @@ struct kparam_array
146 175
147/* This is the fundamental function for registering boot/module 176/* This is the fundamental function for registering boot/module
148 parameters. */ 177 parameters. */
149#define __module_param_call(prefix, name, ops, arg, isbool, perm) \ 178#define __module_param_call(prefix, name, ops, arg, perm, level) \
150 /* Default value instead of permissions? */ \ 179 /* Default value instead of permissions? */ \
151 static int __param_perm_check_##name __attribute__((unused)) = \ 180 static int __param_perm_check_##name __attribute__((unused)) = \
152 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ 181 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
@@ -155,8 +184,7 @@ struct kparam_array
155 static struct kernel_param __moduleparam_const __param_##name \ 184 static struct kernel_param __moduleparam_const __param_##name \
156 __used \ 185 __used \
157 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 186 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
158 = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \ 187 = { __param_str_##name, ops, perm, level, { arg } }
159 { arg } }
160 188
161/* Obsolete - use module_param_cb() */ 189/* Obsolete - use module_param_cb() */
162#define module_param_call(name, set, get, arg, perm) \ 190#define module_param_call(name, set, get, arg, perm) \
@@ -164,8 +192,7 @@ struct kparam_array
164 { (void *)set, (void *)get }; \ 192 { (void *)set, (void *)get }; \
165 __module_param_call(MODULE_PARAM_PREFIX, \ 193 __module_param_call(MODULE_PARAM_PREFIX, \
166 name, &__param_ops_##name, arg, \ 194 name, &__param_ops_##name, arg, \
167 __same_type(arg, bool *), \ 195 (perm) + sizeof(__check_old_set_param(set))*0, 0)
168 (perm) + sizeof(__check_old_set_param(set))*0)
169 196
170/* We don't get oldget: it's often a new-style param_get_uint, etc. */ 197/* We don't get oldget: it's often a new-style param_get_uint, etc. */
171static inline int 198static inline int
@@ -245,8 +272,7 @@ static inline void __kernel_param_unlock(void)
245 */ 272 */
246#define core_param(name, var, type, perm) \ 273#define core_param(name, var, type, perm) \
247 param_check_##type(name, &(var)); \ 274 param_check_##type(name, &(var)); \
248 __module_param_call("", name, &param_ops_##type, \ 275 __module_param_call("", name, &param_ops_##type, &var, perm, 0)
249 &var, __same_type(var, bool), perm)
250#endif /* !MODULE */ 276#endif /* !MODULE */
251 277
252/** 278/**
@@ -264,7 +290,7 @@ static inline void __kernel_param_unlock(void)
264 = { len, string }; \ 290 = { len, string }; \
265 __module_param_call(MODULE_PARAM_PREFIX, name, \ 291 __module_param_call(MODULE_PARAM_PREFIX, name, \
266 &param_ops_string, \ 292 &param_ops_string, \
267 .str = &__param_string_##name, 0, perm); \ 293 .str = &__param_string_##name, perm, 0); \
268 __MODULE_PARM_TYPE(name, "string") 294 __MODULE_PARM_TYPE(name, "string")
269 295
270/** 296/**
@@ -292,6 +318,8 @@ extern int parse_args(const char *name,
292 char *args, 318 char *args,
293 const struct kernel_param *params, 319 const struct kernel_param *params,
294 unsigned num, 320 unsigned num,
321 s16 level_min,
322 s16 level_max,
295 int (*unknown)(char *param, char *val)); 323 int (*unknown)(char *param, char *val));
296 324
297/* Called by module remove. */ 325/* Called by module remove. */
@@ -403,7 +431,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
403 __module_param_call(MODULE_PARAM_PREFIX, name, \ 431 __module_param_call(MODULE_PARAM_PREFIX, name, \
404 &param_array_ops, \ 432 &param_array_ops, \
405 .arr = &__param_arr_##name, \ 433 .arr = &__param_arr_##name, \
406 __same_type(array[0], bool), perm); \ 434 perm, 0); \
407 __MODULE_PARM_TYPE(name, "array of " #type) 435 __MODULE_PARM_TYPE(name, "array of " #type)
408 436
409extern struct kernel_param_ops param_array_ops; 437extern struct kernel_param_ops param_array_ops;
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index d5d2ec6494bb..37ef6b194089 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/map.h b/include/linux/mtd/map.h
index 94e924e2ecd5..3595a0236b0f 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -29,8 +29,8 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30 30
31#include <asm/unaligned.h> 31#include <asm/unaligned.h>
32#include <asm/system.h>
33#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/barrier.h>
34 34
35#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 35#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1
36#define map_bankwidth(map) 1 36#define map_bankwidth(map) 1
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8debe299676d..1f77540bdc95 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 8c6ee44914cb..6d1fb63f5922 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 32345c2805c0..834df8bf08b6 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,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 8c29950d2fa5..52a1bdb4ee2b 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 861730275ba0..a5c50d97341e 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 ba4d7656ecfd..7073fc74481c 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 308c18877018..7eed2012d288 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 8866bb3502ee..9dcbbe9a51fb 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 ab465fe8c3d6..eac30d6bec17 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 d6ba9a12591e..bfd0d1bf6707 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/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 7454ad7451b4..89bd4a4dcfb4 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 2d304efc89df..db50840e6355 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 d46a18ffbebb..fa7fb1d97458 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -58,9 +58,6 @@ struct device_node {
58 struct kref kref; 58 struct kref kref;
59 unsigned long _flags; 59 unsigned long _flags;
60 void *data; 60 void *data;
61#if defined(CONFIG_EEH)
62 struct eeh_dev *edev;
63#endif
64#if defined(CONFIG_SPARC) 61#if defined(CONFIG_SPARC)
65 char *path_component_name; 62 char *path_component_name;
66 unsigned int unique_id; 63 unsigned int unique_id;
@@ -75,13 +72,6 @@ struct of_phandle_args {
75 uint32_t args[MAX_PHANDLE_ARGS]; 72 uint32_t args[MAX_PHANDLE_ARGS];
76}; 73};
77 74
78#if defined(CONFIG_EEH)
79static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
80{
81 return dn->edev;
82}
83#endif
84
85#ifdef CONFIG_OF_DYNAMIC 75#ifdef CONFIG_OF_DYNAMIC
86extern struct device_node *of_node_get(struct device_node *node); 76extern struct device_node *of_node_get(struct device_node *node);
87extern void of_node_put(struct device_node *node); 77extern void of_node_put(struct device_node *node);
@@ -361,6 +351,22 @@ static inline int of_machine_is_compatible(const char *compat)
361#define of_match_node(_matches, _node) NULL 351#define of_match_node(_matches, _node) NULL
362#endif /* CONFIG_OF */ 352#endif /* CONFIG_OF */
363 353
354/**
355 * of_property_read_bool - Findfrom a property
356 * @np: device node from which the property value is to be read.
357 * @propname: name of the property to be searched.
358 *
359 * Search for a property in a device node.
360 * Returns true if the property exist false otherwise.
361 */
362static inline bool of_property_read_bool(const struct device_node *np,
363 const char *propname)
364{
365 struct property *prop = of_find_property(np, propname, NULL);
366
367 return prop ? true : false;
368}
369
364static inline int of_property_read_u32(const struct device_node *np, 370static inline int of_property_read_u32(const struct device_node *np,
365 const char *propname, 371 const char *propname,
366 u32 *out_value) 372 u32 *out_value)
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index cbc42143fa5b..901b7435e890 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 b254052a49d7..81733d12cbea 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -50,7 +50,8 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
50extern int of_get_named_gpio_flags(struct device_node *np, 50extern int of_get_named_gpio_flags(struct device_node *np,
51 const char *list_name, int index, enum of_gpio_flags *flags); 51 const char *list_name, int index, enum of_gpio_flags *flags);
52 52
53extern unsigned int of_gpio_count(struct device_node *np); 53extern unsigned int of_gpio_named_count(struct device_node *np,
54 const char* propname);
54 55
55extern int of_mm_gpiochip_add(struct device_node *np, 56extern int of_mm_gpiochip_add(struct device_node *np,
56 struct of_mm_gpio_chip *mm_gc); 57 struct of_mm_gpio_chip *mm_gc);
@@ -71,7 +72,8 @@ static inline int of_get_named_gpio_flags(struct device_node *np,
71 return -ENOSYS; 72 return -ENOSYS;
72} 73}
73 74
74static inline unsigned int of_gpio_count(struct device_node *np) 75static inline unsigned int of_gpio_named_count(struct device_node *np,
76 const char* propname)
75{ 77{
76 return 0; 78 return 0;
77} 79}
@@ -89,6 +91,27 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
89#endif /* CONFIG_OF_GPIO */ 91#endif /* CONFIG_OF_GPIO */
90 92
91/** 93/**
94 * of_gpio_count - Count GPIOs for a device
95 * @np: device node to count GPIOs for
96 *
97 * The function returns the count of GPIOs specified for a node.
98 *
99 * Note that the empty GPIO specifiers counts too. For example,
100 *
101 * gpios = <0
102 * &pio1 1 2
103 * 0
104 * &pio2 3 4>;
105 *
106 * defines four GPIOs (so this function will return 4), two of which
107 * are not specified.
108 */
109static inline unsigned int of_gpio_count(struct device_node *np)
110{
111 return of_gpio_named_count(np, "gpios");
112}
113
114/**
92 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API 115 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API
93 * @np: device node to get GPIO from 116 * @np: device node to get GPIO from
94 * @index: index of the GPIO 117 * @index: index of the GPIO
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
new file mode 100644
index 000000000000..bae1b6094c63
--- /dev/null
+++ b/include/linux/of_mtd.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
3 *
4 * OF helpers for mtd.
5 *
6 * This file is released under the GPLv2
7 */
8
9#ifndef __LINUX_OF_MTD_H
10#define __LINUX_OF_NET_H
11
12#ifdef CONFIG_OF_MTD
13#include <linux/of.h>
14extern const int of_get_nand_ecc_mode(struct device_node *np);
15int of_get_nand_bus_width(struct device_node *np);
16bool of_get_nand_on_flash_bbt(struct device_node *np);
17#endif
18
19#endif /* __LINUX_OF_MTD_H */
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
index c0b018790f07..4ff57e81051d 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 ee94b33080c2..2a4e5faee904 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 6b25758e028e..c88d2a9451af 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 38a423ed3c01..106c2ca9440b 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -100,7 +100,6 @@ typedef enum {
100#include <linux/wait.h> 100#include <linux/wait.h>
101#include <linux/irqreturn.h> 101#include <linux/irqreturn.h>
102#include <linux/semaphore.h> 102#include <linux/semaphore.h>
103#include <asm/system.h>
104#include <asm/ptrace.h> 103#include <asm/ptrace.h>
105 104
106/* Define this later. */ 105/* Define this later. */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 27bf521bcebd..e444f5b49118 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);
@@ -817,6 +814,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq);
817int pcie_get_mps(struct pci_dev *dev); 814int pcie_get_mps(struct pci_dev *dev);
818int pcie_set_mps(struct pci_dev *dev, int mps); 815int pcie_set_mps(struct pci_dev *dev, int mps);
819int __pci_reset_function(struct pci_dev *dev); 816int __pci_reset_function(struct pci_dev *dev);
817int __pci_reset_function_locked(struct pci_dev *dev);
820int pci_reset_function(struct pci_dev *dev); 818int pci_reset_function(struct pci_dev *dev);
821void pci_update_resource(struct pci_dev *dev, int resno); 819void pci_update_resource(struct pci_dev *dev, int resno);
822int __must_check pci_assign_resource(struct pci_dev *dev, int i); 820int __must_check pci_assign_resource(struct pci_dev *dev, int i);
@@ -882,6 +880,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev);
882/* Functions for PCI Hotplug drivers to use */ 880/* Functions for PCI Hotplug drivers to use */
883int 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);
884#ifdef CONFIG_HOTPLUG 882#ifdef CONFIG_HOTPLUG
883unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge);
885unsigned int pci_rescan_bus(struct pci_bus *bus); 884unsigned int pci_rescan_bus(struct pci_bus *bus);
886#endif 885#endif
887 886
@@ -891,13 +890,13 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void
891int pci_vpd_truncate(struct pci_dev *dev, size_t size); 890int pci_vpd_truncate(struct pci_dev *dev, size_t size);
892 891
893/* 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);
894void pci_bus_assign_resources(const struct pci_bus *bus); 894void pci_bus_assign_resources(const struct pci_bus *bus);
895void pci_bus_size_bridges(struct pci_bus *bus); 895void pci_bus_size_bridges(struct pci_bus *bus);
896int pci_claim_resource(struct pci_dev *, int); 896int pci_claim_resource(struct pci_dev *, int);
897void pci_assign_unassigned_resources(void); 897void pci_assign_unassigned_resources(void);
898void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 898void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
899void pdev_enable_device(struct pci_dev *); 899void pdev_enable_device(struct pci_dev *);
900void pdev_sort_resources(struct pci_dev *, struct resource_list *);
901int pci_enable_resources(struct pci_dev *, int mask); 900int pci_enable_resources(struct pci_dev *, int mask);
902void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 901void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
903 int (*)(const struct pci_dev *, u8, u8)); 902 int (*)(const struct pci_dev *, u8, u8));
@@ -914,6 +913,8 @@ void pci_release_selected_regions(struct pci_dev *, int);
914 913
915/* drivers/pci/bus.c */ 914/* drivers/pci/bus.c */
916void 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);
917void pci_free_resource_list(struct list_head *resources); 918void pci_free_resource_list(struct list_head *resources);
918void 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);
919struct 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);
@@ -959,7 +960,7 @@ void pci_unregister_driver(struct pci_driver *dev);
959 module_driver(__pci_driver, pci_register_driver, \ 960 module_driver(__pci_driver, pci_register_driver, \
960 pci_unregister_driver) 961 pci_unregister_driver)
961 962
962void pci_remove_behind_bridge(struct pci_dev *dev); 963void pci_stop_and_remove_behind_bridge(struct pci_dev *dev);
963struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 964struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
964int pci_add_dynid(struct pci_driver *drv, 965int pci_add_dynid(struct pci_driver *drv,
965 unsigned int vendor, unsigned int device, 966 unsigned int vendor, unsigned int device,
@@ -1395,7 +1396,10 @@ static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
1395 */ 1396 */
1396 1397
1397struct pci_fixup { 1398struct pci_fixup {
1398 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 */
1399 void (*hook)(struct pci_dev *dev); 1403 void (*hook)(struct pci_dev *dev);
1400}; 1404};
1401 1405
@@ -1410,30 +1414,68 @@ enum pci_fixup_pass {
1410}; 1414};
1411 1415
1412/* Anonymous variables would be nice... */ 1416/* Anonymous variables would be nice... */
1413#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ 1417#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
1414 static const struct pci_fixup __pci_fixup_##name __used \ 1418 class_shift, hook) \
1415 __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
1416#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1455#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
1417 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1456 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
1418 vendor##device##hook, vendor, device, hook) 1457 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1419#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ 1458#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \
1420 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1459 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
1421 vendor##device##hook, vendor, device, hook) 1460 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1422#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ 1461#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \
1423 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1462 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
1424 vendor##device##hook, vendor, device, hook) 1463 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1425#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ 1464#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \
1426 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1465 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
1427 vendor##device##hook, vendor, device, hook) 1466 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1428#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ 1467#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
1429 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1468 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1430 resume##vendor##device##hook, vendor, device, hook) 1469 resume##vendor##device##hook, vendor, device, \
1470 PCI_ANY_ID, 0, hook)
1431#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ 1471#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \
1432 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1472 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1433 resume_early##vendor##device##hook, vendor, device, hook) 1473 resume_early##vendor##device##hook, vendor, device, \
1474 PCI_ANY_ID, 0, hook)
1434#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ 1475#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \
1435 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1476 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1436 suspend##vendor##device##hook, vendor, device, hook) 1477 suspend##vendor##device##hook, vendor, device, \
1478 PCI_ANY_ID, 0, hook)
1437 1479
1438#ifdef CONFIG_PCI_QUIRKS 1480#ifdef CONFIG_PCI_QUIRKS
1439void 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 e41a10f5ae83..4b608f543412 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/phy.h b/include/linux/phy.h
index c599f7eca1e7..6fe0a37d4abf 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 e7cf6669ac34..b067bd8c49d0 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 000000000000..191e72688481
--- /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 d0aecb7f6fb9..fee4349364f7 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 000000000000..4f0abb9f1c09
--- /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 477922cf043a..ec431f03362d 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 000000000000..3920e28b4da7
--- /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 8bd22ee7aa09..4e9f0788c221 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 937b3e2fa36f..47e9237edd47 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 77257c92155a..6d626ff0cfd0 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 000000000000..d056263545b1
--- /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/omap-abe-twl6040.h b/include/linux/platform_data/omap-abe-twl6040.h
new file mode 100644
index 000000000000..5d298ac10fc2
--- /dev/null
+++ b/include/linux/platform_data/omap-abe-twl6040.h
@@ -0,0 +1,49 @@
1/**
2 * omap-abe-twl6040.h - ASoC machine driver OMAP4+ devices, header.
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
5 * All rights reserved.
6 *
7 * Author: Peter Ujfalusi <peter.ujfalusi@ti.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 License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
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
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24#ifndef _OMAP_ABE_TWL6040_H_
25#define _OMAP_ABE_TWL6040_H_
26
27/* To select if only one channel is connected in a stereo port */
28#define ABE_TWL6040_LEFT (1 << 0)
29#define ABE_TWL6040_RIGHT (1 << 1)
30
31struct omap_abe_twl6040_data {
32 char *card_name;
33 /* Feature flags for connected audio pins */
34 u8 has_hs;
35 u8 has_hf;
36 bool has_ep;
37 u8 has_aux;
38 u8 has_vibra;
39 bool has_dmic;
40 bool has_hsmic;
41 bool has_mainmic;
42 bool has_submic;
43 u8 has_afm;
44 /* Other features */
45 bool jack_detection; /* board can detect jack events */
46 int mclk_freq; /* MCLK frequency speed for twl6040 */
47};
48
49#endif /* _OMAP_ABE_TWL6040_H_ */
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h
new file mode 100644
index 000000000000..4eef5fb05a17
--- /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/tegra_emc.h b/include/linux/platform_data/tegra_emc.h
new file mode 100644
index 000000000000..df67505e98f8
--- /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 1236d262b3e8..91f8286106ea 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 cf40010ce0cd..48fe8bc398d1 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 b7681102a4b9..11bad91c4433 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_supply.h b/include/linux/power_supply.h
index fa9b962aec12..c38c13db8832 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 a0413ac3abe8..e0cfec2490aa 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 c2f1f6a5fcb8..5c719627c2aa 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 07e360b1b282..0d04cd69ab9b 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -2,6 +2,7 @@
2 * Copyright (C) 2001 Momchil Velikov 2 * Copyright (C) 2001 Momchil Velikov
3 * Portions Copyright (C) 2001 Christoph Hellwig 3 * Portions Copyright (C) 2001 Christoph Hellwig
4 * Copyright (C) 2006 Nick Piggin 4 * Copyright (C) 2006 Nick Piggin
5 * Copyright (C) 2012 Konstantin Khlebnikov
5 * 6 *
6 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
@@ -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/raid/md_p.h b/include/linux/raid/md_p.h
index 6f6df86f1ae5..8c0a3adc5df5 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -281,6 +281,10 @@ struct mdp_superblock_1 {
281 * active device with same 'role'. 281 * active device with same 'role'.
282 * 'recovery_offset' is also set. 282 * 'recovery_offset' is also set.
283 */ 283 */
284#define MD_FEATURE_ALL (1|2|4|8|16) 284#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
285 |MD_FEATURE_RECOVERY_OFFSET \
286 |MD_FEATURE_RESHAPE_ACTIVE \
287 |MD_FEATURE_BAD_BLOCKS \
288 |MD_FEATURE_REPLACEMENT)
285 289
286#endif 290#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 937217425c47..20fb776a1d4a 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 eb93921cdd30..a90abb6bfa64 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);
@@ -143,12 +158,18 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
143int regmap_update_bits_check(struct regmap *map, unsigned int reg, 158int regmap_update_bits_check(struct regmap *map, unsigned int reg,
144 unsigned int mask, unsigned int val, 159 unsigned int mask, unsigned int val,
145 bool *change); 160 bool *change);
161int regmap_get_val_bytes(struct regmap *map);
146 162
147int 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);
148void regcache_cache_only(struct regmap *map, bool enable); 166void regcache_cache_only(struct regmap *map, bool enable);
149void regcache_cache_bypass(struct regmap *map, bool enable); 167void regcache_cache_bypass(struct regmap *map, bool enable);
150void regcache_mark_dirty(struct regmap *map); 168void regcache_mark_dirty(struct regmap *map);
151 169
170int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
171 int num_regs);
172
152/** 173/**
153 * Description of an IRQ for the generic regmap irq_chip. 174 * Description of an IRQ for the generic regmap irq_chip.
154 * 175 *
@@ -197,4 +218,115 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
197void 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);
198int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 219int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
199 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
200#endif 332#endif
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 686f37327a49..8e0c9febf495 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 76579f964a29..7bd73bbdfd1b 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -26,7 +26,26 @@ enum ab8500_regulator_id {
26 AB8500_NUM_REGULATORS, 26 AB8500_NUM_REGULATORS,
27}; 27};
28 28
29/* AB8500 register initialization */ 29/* AB9450 regulators */
30enum ab9540_regulator_id {
31 AB9540_LDO_AUX1,
32 AB9540_LDO_AUX2,
33 AB9540_LDO_AUX3,
34 AB9540_LDO_AUX4,
35 AB9540_LDO_INTCORE,
36 AB9540_LDO_TVOUT,
37 AB9540_LDO_USB,
38 AB9540_LDO_AUDIO,
39 AB9540_LDO_ANAMIC1,
40 AB9540_LDO_ANAMIC2,
41 AB9540_LDO_DMIC,
42 AB9540_LDO_ANA,
43 AB9540_SYSCLKREQ_2,
44 AB9540_SYSCLKREQ_4,
45 AB9540_NUM_REGULATORS,
46};
47
48/* AB8500 and AB9540 register initialization */
30struct ab8500_regulator_reg_init { 49struct ab8500_regulator_reg_init {
31 int id; 50 int id;
32 u8 value; 51 u8 value;
@@ -71,4 +90,53 @@ enum ab8500_regulator_reg {
71 AB8500_NUM_REGULATOR_REGISTERS, 90 AB8500_NUM_REGULATOR_REGISTERS,
72}; 91};
73 92
93
94/* AB9540 registers */
95enum ab9540_regulator_reg {
96 AB9540_REGUREQUESTCTRL1,
97 AB9540_REGUREQUESTCTRL2,
98 AB9540_REGUREQUESTCTRL3,
99 AB9540_REGUREQUESTCTRL4,
100 AB9540_REGUSYSCLKREQ1HPVALID1,
101 AB9540_REGUSYSCLKREQ1HPVALID2,
102 AB9540_REGUHWHPREQ1VALID1,
103 AB9540_REGUHWHPREQ1VALID2,
104 AB9540_REGUHWHPREQ2VALID1,
105 AB9540_REGUHWHPREQ2VALID2,
106 AB9540_REGUSWHPREQVALID1,
107 AB9540_REGUSWHPREQVALID2,
108 AB9540_REGUSYSCLKREQVALID1,
109 AB9540_REGUSYSCLKREQVALID2,
110 AB9540_REGUVAUX4REQVALID,
111 AB9540_REGUMISC1,
112 AB9540_VAUDIOSUPPLY,
113 AB9540_REGUCTRL1VAMIC,
114 AB9540_VSMPS1REGU,
115 AB9540_VSMPS2REGU,
116 AB9540_VSMPS3REGU, /* NOTE! PRCMU register */
117 AB9540_VPLLVANAREGU,
118 AB9540_EXTSUPPLYREGU,
119 AB9540_VAUX12REGU,
120 AB9540_VRF1VAUX3REGU,
121 AB9540_VSMPS1SEL1,
122 AB9540_VSMPS1SEL2,
123 AB9540_VSMPS1SEL3,
124 AB9540_VSMPS2SEL1,
125 AB9540_VSMPS2SEL2,
126 AB9540_VSMPS2SEL3,
127 AB9540_VSMPS3SEL1, /* NOTE! PRCMU register */
128 AB9540_VSMPS3SEL2, /* NOTE! PRCMU register */
129 AB9540_VAUX1SEL,
130 AB9540_VAUX2SEL,
131 AB9540_VRF1VAUX3SEL,
132 AB9540_REGUCTRL2SPARE,
133 AB9540_VAUX4REQCTRL,
134 AB9540_VAUX4REGU,
135 AB9540_VAUX4SEL,
136 AB9540_REGUCTRLDISCH,
137 AB9540_REGUCTRLDISCH2,
138 AB9540_REGUCTRLDISCH3,
139 AB9540_NUM_REGULATOR_REGISTERS,
140};
141
74#endif 142#endif
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h
deleted file mode 100644
index a6d014005d49..000000000000
--- 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 b6c8d717c7ec..4ed1b30ac5fc 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 a822fd71fd64..91cacc34c159 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 000000000000..f1ffabb978d3
--- /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 c6c608482cba..6fdf02737e9d 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/rio_drv.h b/include/linux/rio_drv.h
index 229b3ca23134..7f07470e1ed9 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 000000000000..a8e50e44203c
--- /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 93f4d035076b..fcabfb4873c8 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -202,7 +202,8 @@ struct rtc_device
202 struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ 202 struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */
203 int pie_enabled; 203 int pie_enabled;
204 struct work_struct irqwork; 204 struct work_struct irqwork;
205 205 /* Some hardware can't support UIE mode */
206 int uie_unsupported;
206 207
207#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL 208#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
208 struct work_struct uie_task; 209 struct work_struct uie_task;
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 63d406554391..54bd7cd7ecbd 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -14,7 +14,6 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16 16
17#include <asm/system.h>
18#include <linux/atomic.h> 17#include <linux/atomic.h>
19 18
20struct rw_semaphore; 19struct rw_semaphore;
diff --git a/include/linux/sa11x0-dma.h b/include/linux/sa11x0-dma.h
new file mode 100644
index 000000000000..65839a58b8e5
--- /dev/null
+++ b/include/linux/sa11x0-dma.h
@@ -0,0 +1,24 @@
1/*
2 * SA11x0 DMA Engine support
3 *
4 * Copyright (C) 2012 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __LINUX_SA11X0_DMA_H
11#define __LINUX_SA11X0_DMA_H
12
13struct dma_chan;
14
15#if defined(CONFIG_DMA_SA11X0) || defined(CONFIG_DMA_SA11X0_MODULE)
16bool sa11x0_dma_filter_fn(struct dma_chan *, void *);
17#else
18static inline bool sa11x0_dma_filter_fn(struct dma_chan *c, void *d)
19{
20 return false;
21}
22#endif
23
24#endif
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 9aaf5bfdad1a..ac9586dadfa5 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 0c147a4260a5..81a173c0897d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -63,7 +63,6 @@ struct sched_param {
63#include <linux/nodemask.h> 63#include <linux/nodemask.h>
64#include <linux/mm_types.h> 64#include <linux/mm_types.h>
65 65
66#include <asm/system.h>
67#include <asm/page.h> 66#include <asm/page.h>
68#include <asm/ptrace.h> 67#include <asm/ptrace.h>
69#include <asm/cputime.h> 68#include <asm/cputime.h>
@@ -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 44f1514b00ba..fc61854f6224 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 de6c19c7f340..79ad87b0be3e 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 54341d811685..0a9d8f2ac519 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/skbuff.h b/include/linux/skbuff.h
index a2b9953b582d..33370271b8b2 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 573c809c33d9..a595dce6b0c7 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -190,7 +190,7 @@ size_t ksize(const void *);
190#endif 190#endif
191 191
192/** 192/**
193 * kcalloc - allocate memory for an array. The memory is set to zero. 193 * kmalloc_array - allocate memory for an array.
194 * @n: number of elements. 194 * @n: number of elements.
195 * @size: element size. 195 * @size: element size.
196 * @flags: the type of memory to allocate. 196 * @flags: the type of memory to allocate.
@@ -240,11 +240,22 @@ size_t ksize(const void *);
240 * for general use, and so are not documented here. For a full list of 240 * for general use, and so are not documented here. For a full list of
241 * potential flags, always refer to linux/gfp.h. 241 * potential flags, always refer to linux/gfp.h.
242 */ 242 */
243static inline void *kcalloc(size_t n, size_t size, gfp_t flags) 243static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
244{ 244{
245 if (size != 0 && n > ULONG_MAX / size) 245 if (size != 0 && n > ULONG_MAX / size)
246 return NULL; 246 return NULL;
247 return __kmalloc(n * size, flags | __GFP_ZERO); 247 return __kmalloc(n * size, flags);
248}
249
250/**
251 * kcalloc - allocate memory for an array. The memory is set to zero.
252 * @n: number of elements.
253 * @size: element size.
254 * @flags: the type of memory to allocate (see kmalloc).
255 */
256static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
257{
258 return kmalloc_array(n, size, flags | __GFP_ZERO);
248} 259}
249 260
250#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB) 261#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB)
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index a32bcfdc7834..c2f8c8bc56ed 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 8cc38d3bab0c..10530d92c04b 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -102,6 +102,22 @@ static inline void call_function_init(void) { }
102int on_each_cpu(smp_call_func_t func, void *info, int wait); 102int on_each_cpu(smp_call_func_t func, void *info, int wait);
103 103
104/* 104/*
105 * Call a function on processors specified by mask, which might include
106 * the local one.
107 */
108void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
109 void *info, bool wait);
110
111/*
112 * Call a function on each processor for which the supplied function
113 * cond_func returns a positive value. This may include the local
114 * processor.
115 */
116void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
117 smp_call_func_t func, void *info, bool wait,
118 gfp_t gfp_flags);
119
120/*
105 * Mark the boot cpu "online" so that it can call console drivers in 121 * Mark the boot cpu "online" so that it can call console drivers in
106 * printk() and can access its per-cpu storage. 122 * printk() and can access its per-cpu storage.
107 */ 123 */
@@ -132,6 +148,36 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
132 local_irq_enable(); \ 148 local_irq_enable(); \
133 0; \ 149 0; \
134 }) 150 })
151/*
152 * Note we still need to test the mask even for UP
153 * because we actually can get an empty mask from
154 * code that on SMP might call us without the local
155 * CPU in the mask.
156 */
157#define on_each_cpu_mask(mask, func, info, wait) \
158 do { \
159 if (cpumask_test_cpu(0, (mask))) { \
160 local_irq_disable(); \
161 (func)(info); \
162 local_irq_enable(); \
163 } \
164 } while (0)
165/*
166 * Preemption is disabled here to make sure the cond_func is called under the
167 * same condtions in UP and SMP.
168 */
169#define on_each_cpu_cond(cond_func, func, info, wait, gfp_flags)\
170 do { \
171 void *__info = (info); \
172 preempt_disable(); \
173 if ((cond_func)(0, __info)) { \
174 local_irq_disable(); \
175 (func)(__info); \
176 local_irq_enable(); \
177 } \
178 preempt_enable(); \
179 } while (0)
180
135static inline void smp_send_reschedule(int cpu) { } 181static inline void smp_send_reschedule(int cpu) { }
136#define num_booting_cpus() 1 182#define num_booting_cpus() 1
137#define smp_prepare_boot_cpu() do {} while (0) 183#define smp_prepare_boot_cpu() do {} while (0)
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index 0f4eb165f254..32be8dbdf191 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 decf6d8c77b7..b4d9fa6f797c 100644
--- a/include/linux/spi/orion_spi.h
+++ b/include/linux/spi/orion_spi.h
@@ -11,7 +11,6 @@
11 11
12struct orion_spi_info { 12struct orion_spi_info {
13 u32 tclk; /* no <linux/clk.h> support yet */ 13 u32 tclk; /* no <linux/clk.h> support yet */
14 u32 enable_clock_fix;
15}; 14};
16 15
17 16
diff --git a/include/linux/spi/s3c24xx.h b/include/linux/spi/s3c24xx.h
new file mode 100644
index 000000000000..c23b923e493b
--- /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 7df6c17b0281..7d537ced949a 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -55,8 +55,8 @@
55#include <linux/kernel.h> 55#include <linux/kernel.h>
56#include <linux/stringify.h> 56#include <linux/stringify.h>
57#include <linux/bottom_half.h> 57#include <linux/bottom_half.h>
58#include <asm/barrier.h>
58 59
59#include <asm/system.h>
60 60
61/* 61/*
62 * Must define these before including other files, inline functions need them 62 * Must define these before including other files, inline functions need them
@@ -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/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index eba52a100533..6b05dcd927ff 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 c170edc3bf5f..3b5e910d14ca 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -5,7 +5,6 @@
5#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/smp.h> 6#include <linux/smp.h>
7#include <linux/list.h> 7#include <linux/list.h>
8#include <asm/system.h>
9 8
10/* 9/*
11 * stop_cpu[s]() is simplistic per-cpu maximum priority cpu 10 * stop_cpu[s]() is simplistic per-cpu maximum priority cpu
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 7874a8a56638..492a36d72829 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 f7f3ce340c08..969c0a671dbf 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 57531f8e5956..f5fd6160dbca 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 2c5993a17c33..523547ecfee2 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 c2786f20016f..a76cc20d98ce 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 b6edbc0ea83d..1565bbe86d51 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 2bb03d77375a..a7b422b33eda 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 e7756896f3ca..dc0c3cc3ada3 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 680471d1f28a..edc64219f92b 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 35b37b1e9299..51b29ac45a8e 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_xprt.h b/include/linux/sunrpc/svc_xprt.h
index dfa900948af7..b3f64b12f141 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 25d333c1b571..548790e9113b 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 83bbee3f089c..7c32daa025eb 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 c84e9741cb2a..cb4ac69e1f33 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 15518a152ac3..77d278defa70 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 3f14a02e9cc0..1ad36cc25b2e 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 b86b5c20617d..8dc0ea7caf02 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 2189d3ffc85d..792d16d9cbc7 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 8ec1153ff57b..3de3acb84a95 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 bb9127dd814b..c34b4c82b0dc 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/time.h b/include/linux/time.h
index b3061782dec3..97734e9409c6 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
diff --git a/include/linux/timex.h b/include/linux/timex.h
index b75e1864ed19..99bc88b1fc02 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -252,7 +252,7 @@ extern void ntp_clear(void);
252/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ 252/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
253extern u64 ntp_tick_length(void); 253extern u64 ntp_tick_length(void);
254 254
255extern void second_overflow(void); 255extern int second_overflow(unsigned long secs);
256extern int do_adjtimex(struct timex *); 256extern int do_adjtimex(struct timex *);
257extern void hardpps(const struct timespec *, const struct timespec *); 257extern void hardpps(const struct timespec *, const struct timespec *);
258 258
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index a71a2927a6a0..51bd91d911c3 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 9ae8da3e6407..11087cdd4ad3 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 a91ff403b3bf..9f47ab540f65 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -44,7 +44,6 @@
44#include <linux/tty_ldisc.h> 44#include <linux/tty_ldisc.h>
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46 46
47#include <asm/system.h>
48 47
49 48
50/* 49/*
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5e11f8a1f867..c9c9a4680cc5 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_config.h b/include/linux/virtio_config.h
index 5206d6541da5..7323a3390206 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 85bb0bb66ffc..7529b854b7fd 100644
--- a/include/linux/virtio_ids.h
+++ b/include/linux/virtio_ids.h
@@ -34,6 +34,8 @@
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 */
38#define VIRTIO_ID_SCSI 8 /* virtio scsi */
37#define VIRTIO_ID_9P 9 /* 9p virtio console */ 39#define VIRTIO_ID_9P 9 /* 9p virtio console */
38 40
39#endif /* _LINUX_VIRTIO_IDS_H */ 41#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h
new file mode 100644
index 000000000000..8ddeafdc0546
--- /dev/null
+++ b/include/linux/virtio_scsi.h
@@ -0,0 +1,114 @@
1#ifndef _LINUX_VIRTIO_SCSI_H
2#define _LINUX_VIRTIO_SCSI_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
5
6#define VIRTIO_SCSI_CDB_SIZE 32
7#define VIRTIO_SCSI_SENSE_SIZE 96
8
9/* SCSI command request, followed by data-out */
10struct virtio_scsi_cmd_req {
11 u8 lun[8]; /* Logical Unit Number */
12 u64 tag; /* Command identifier */
13 u8 task_attr; /* Task attribute */
14 u8 prio;
15 u8 crn;
16 u8 cdb[VIRTIO_SCSI_CDB_SIZE];
17} __packed;
18
19/* Response, followed by sense data and data-in */
20struct virtio_scsi_cmd_resp {
21 u32 sense_len; /* Sense data length */
22 u32 resid; /* Residual bytes in data buffer */
23 u16 status_qualifier; /* Status qualifier */
24 u8 status; /* Command completion status */
25 u8 response; /* Response values */
26 u8 sense[VIRTIO_SCSI_SENSE_SIZE];
27} __packed;
28
29/* Task Management Request */
30struct virtio_scsi_ctrl_tmf_req {
31 u32 type;
32 u32 subtype;
33 u8 lun[8];
34 u64 tag;
35} __packed;
36
37struct virtio_scsi_ctrl_tmf_resp {
38 u8 response;
39} __packed;
40
41/* Asynchronous notification query/subscription */
42struct virtio_scsi_ctrl_an_req {
43 u32 type;
44 u8 lun[8];
45 u32 event_requested;
46} __packed;
47
48struct virtio_scsi_ctrl_an_resp {
49 u32 event_actual;
50 u8 response;
51} __packed;
52
53struct virtio_scsi_event {
54 u32 event;
55 u8 lun[8];
56 u32 reason;
57} __packed;
58
59struct virtio_scsi_config {
60 u32 num_queues;
61 u32 seg_max;
62 u32 max_sectors;
63 u32 cmd_per_lun;
64 u32 event_info_size;
65 u32 sense_size;
66 u32 cdb_size;
67 u16 max_channel;
68 u16 max_target;
69 u32 max_lun;
70} __packed;
71
72/* Response codes */
73#define VIRTIO_SCSI_S_OK 0
74#define VIRTIO_SCSI_S_OVERRUN 1
75#define VIRTIO_SCSI_S_ABORTED 2
76#define VIRTIO_SCSI_S_BAD_TARGET 3
77#define VIRTIO_SCSI_S_RESET 4
78#define VIRTIO_SCSI_S_BUSY 5
79#define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6
80#define VIRTIO_SCSI_S_TARGET_FAILURE 7
81#define VIRTIO_SCSI_S_NEXUS_FAILURE 8
82#define VIRTIO_SCSI_S_FAILURE 9
83#define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10
84#define VIRTIO_SCSI_S_FUNCTION_REJECTED 11
85#define VIRTIO_SCSI_S_INCORRECT_LUN 12
86
87/* Controlq type codes. */
88#define VIRTIO_SCSI_T_TMF 0
89#define VIRTIO_SCSI_T_AN_QUERY 1
90#define VIRTIO_SCSI_T_AN_SUBSCRIBE 2
91
92/* Valid TMF subtypes. */
93#define VIRTIO_SCSI_T_TMF_ABORT_TASK 0
94#define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1
95#define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2
96#define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3
97#define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4
98#define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5
99#define VIRTIO_SCSI_T_TMF_QUERY_TASK 6
100#define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7
101
102/* Events. */
103#define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000
104#define VIRTIO_SCSI_T_NO_EVENT 0
105#define VIRTIO_SCSI_T_TRANSPORT_RESET 1
106#define VIRTIO_SCSI_T_ASYNC_NOTIFY 2
107
108#define VIRTIO_SCSI_S_SIMPLE 0
109#define VIRTIO_SCSI_S_ORDERED 1
110#define VIRTIO_SCSI_S_HEAD 2
111#define VIRTIO_SCSI_S_ACA 3
112
113
114#endif /* _LINUX_VIRTIO_SCSI_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 7d9a9e990ce6..1dee81c41ff1 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -22,7 +22,6 @@
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/stddef.h> 23#include <linux/stddef.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <asm/system.h>
26#include <asm/current.h> 25#include <asm/current.h>
27 26
28typedef struct __wait_queue wait_queue_t; 27typedef struct __wait_queue wait_queue_t;
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 43ba5b3ce2a3..ac40716b44e9 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -66,6 +66,7 @@ struct watchdog_device;
66 * @ping: The routine that sends a keepalive ping to the watchdog device. 66 * @ping: The routine that sends a keepalive ping to the watchdog device.
67 * @status: The routine that shows the status of the watchdog device. 67 * @status: The routine that shows the status of the watchdog device.
68 * @set_timeout:The routine for setting the watchdog devices timeout value. 68 * @set_timeout:The routine for setting the watchdog devices timeout value.
69 * @get_timeleft:The routine that get's the time that's left before a reset.
69 * @ioctl: The routines that handles extra ioctl calls. 70 * @ioctl: The routines that handles extra ioctl calls.
70 * 71 *
71 * The watchdog_ops structure contains a list of low-level operations 72 * The watchdog_ops structure contains a list of low-level operations
@@ -82,6 +83,7 @@ struct watchdog_ops {
82 int (*ping)(struct watchdog_device *); 83 int (*ping)(struct watchdog_device *);
83 unsigned int (*status)(struct watchdog_device *); 84 unsigned int (*status)(struct watchdog_device *);
84 int (*set_timeout)(struct watchdog_device *, unsigned int); 85 int (*set_timeout)(struct watchdog_device *, unsigned int);
86 unsigned int (*get_timeleft)(struct watchdog_device *);
85 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); 87 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
86}; 88};
87 89
@@ -127,7 +129,7 @@ struct watchdog_device {
127#endif 129#endif
128 130
129/* Use the following function to set the nowayout feature */ 131/* Use the following function to set the nowayout feature */
130static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout) 132static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool nowayout)
131{ 133{
132 if (nowayout) 134 if (nowayout)
133 set_bit(WDOG_NO_WAY_OUT, &wdd->status); 135 set_bit(WDOG_NO_WAY_OUT, &wdd->status);
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
index 57031b4d12f2..aaf24ba12c4d 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 000000000000..c5c2d377c0a6
--- /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 000000000000..2038a8a3f8aa
--- /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 000000000000..8f72f8a0b3d0
--- /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 9929b05cff3a..bd8217c2577c 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 000000000000..67797bf5d432
--- /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 6a27d916c250..eaade9815bb6 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 000000000000..c3a78114d7a6
--- /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 f688bde61228..8db6741c1256 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 000000000000..361a751f73af
--- /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 48413b410f15..a90a765f18da 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 000000000000..6a4a809fe9a3
--- /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 29e1920e7339..926aff9bdf65 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 810a20928a21..7395c815939d 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 eeb3df637144..11e67562b3ac 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 c7c40f1d2624..96d22215cc88 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 3f5d60fc5df6..3cb939cd03f9 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 69b7ad3a9925..248fb05feb63 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 344c8dd02874..59c5d18cc385 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 ebe517f2da9f..2bdee51ba30d 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 9a012be615ff..87d203ff7a8a 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 90c67c7db7e9..3b572bb20aa2 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 0e04db4a0865..34ec89f8dbf9 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 d55f43443335..0931618c0f7f 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 28068ec614b2..77d4c3745cb5 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 04bc0b30e9e9..a6ba1f8871fd 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 8607e6aad42b..f75a04d752cb 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 053b3cf2c66a..8d6689cb2c66 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 e39592f682c3..5d606d9da9e5 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 d86fffd3c03c..ff27f1b078d1 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/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 652dec230514..0d7d67e96d43 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -20,6 +20,8 @@
20#ifndef _FC_FCP_H_ 20#ifndef _FC_FCP_H_
21#define _FC_FCP_H_ 21#define _FC_FCP_H_
22 22
23#include <scsi/scsi.h>
24
23/* 25/*
24 * Fibre Channel Protocol for SCSI. 26 * Fibre Channel Protocol for SCSI.
25 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. 27 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005.
@@ -45,7 +47,7 @@
45 * FCP_CMND IU Payload. 47 * FCP_CMND IU Payload.
46 */ 48 */
47struct fcp_cmnd { 49struct fcp_cmnd {
48 __u8 fc_lun[8]; /* logical unit number */ 50 struct scsi_lun fc_lun; /* logical unit number */
49 __u8 fc_cmdref; /* command reference number */ 51 __u8 fc_cmdref; /* command reference number */
50 __u8 fc_pri_ta; /* priority and task attribute */ 52 __u8 fc_pri_ta; /* priority and task attribute */
51 __u8 fc_tm_flags; /* task management flags */ 53 __u8 fc_tm_flags; /* task management flags */
@@ -57,7 +59,7 @@ struct fcp_cmnd {
57#define FCP_CMND_LEN 32 /* expected length of structure */ 59#define FCP_CMND_LEN 32 /* expected length of structure */
58 60
59struct fcp_cmnd32 { 61struct fcp_cmnd32 {
60 __u8 fc_lun[8]; /* logical unit number */ 62 struct scsi_lun fc_lun; /* logical unit number */
61 __u8 fc_cmdref; /* command reference number */ 63 __u8 fc_cmdref; /* command reference number */
62 __u8 fc_pri_ta; /* priority and task attribute */ 64 __u8 fc_pri_ta; /* priority and task attribute */
63 __u8 fc_tm_flags; /* task management flags */ 65 __u8 fc_tm_flags; /* task management flags */
diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h
new file mode 100644
index 000000000000..f52b921b5c70
--- /dev/null
+++ b/include/scsi/fc/fc_ms.h
@@ -0,0 +1,213 @@
1/* * Copyright(c) 2011 Intel Corporation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms and conditions of the GNU General Public License,
5 * version 2, as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope it will be useful, but WITHOUT
8 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
10 * more details.
11 *
12 * You should have received a copy of the GNU General Public License along with
13 * this program; if not, write to the Free Software Foundation, Inc.,
14 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * Maintained at www.Open-FCoE.org
17 */
18
19#ifndef _FC_MS_H_
20#define _FC_MS_H_
21
22#include <linux/types.h>
23
24/*
25 * Fibre Channel Services - Management Service (MS)
26 * From T11.org FC-GS-4 Rev 7.91 February 4, 2004
27 */
28
29/*
30 * Fabric Device Management Interface
31 */
32
33/*
34 * Common-transport sub-type for FDMI
35 */
36#define FC_FDMI_SUBTYPE 0x10 /* fs_ct_hdr.ct_fs_subtype */
37
38/*
39 * Management server FDMI Requests.
40 */
41enum fc_fdmi_req {
42 FC_FDMI_GRHL = 0x0100, /* Get Registered HBA List */
43 FC_FDMI_GHAT = 0x0101, /* Get HBA Attributes */
44 FC_FDMI_GRPL = 0x0102, /* Get Registered Port List */
45 FC_FDMI_GPAT = 0x0110, /* Get Port Attributes */
46 FC_FDMI_RHBA = 0x0200, /* Register HBA */
47 FC_FDMI_RHAT = 0x0201, /* Register HBA Attributes */
48 FC_FDMI_RPRT = 0x0210, /* Register Port */
49 FC_FDMI_RPA = 0x0211, /* Register Port Attributes */
50 FC_FDMI_DHBA = 0x0300, /* Deregister HBA */
51 FC_FDMI_DHAT = 0x0301, /* Deregister HBA Attributes */
52 FC_FDMI_DPRT = 0x0310, /* Deregister Port */
53 FC_FDMI_DPA = 0x0311, /* Deregister Port Attributes */
54};
55
56/*
57 * HBA Attribute Entry Type
58 */
59enum fc_fdmi_hba_attr_type {
60 FC_FDMI_HBA_ATTR_NODENAME = 0x0001,
61 FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002,
62 FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003,
63 FC_FDMI_HBA_ATTR_MODEL = 0x0004,
64 FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005,
65 FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006,
66 FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007,
67 FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008,
68 FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009,
69 FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A,
70 FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B,
71};
72
73/*
74 * HBA Attribute Length
75 */
76#define FC_FDMI_HBA_ATTR_NODENAME_LEN 8
77#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64
78#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64
79#define FC_FDMI_HBA_ATTR_MODEL_LEN 256
80#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256
81#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256
82#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256
83#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256
84#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256
85#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256
86#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4
87
88/*
89 * Port Attribute Type
90 */
91enum fc_fdmi_port_attr_type {
92 FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001,
93 FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002,
94 FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003,
95 FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004,
96 FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005,
97 FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006,
98};
99
100/*
101 * Port Attribute Length
102 */
103#define FC_FDMI_PORT_ATTR_FC4TYPES_LEN 32
104#define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN 4
105#define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN 4
106#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4
107#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256
108#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256
109
110/*
111 * HBA Attribute ID
112 */
113struct fc_fdmi_hba_identifier {
114 __be64 id;
115};
116
117/*
118 * Port Name
119 */
120struct fc_fdmi_port_name {
121 __be64 portname;
122};
123
124/*
125 * Attribute Entry Block for HBA/Port Attributes
126 */
127#define FC_FDMI_ATTR_ENTRY_HEADER_LEN 4
128struct fc_fdmi_attr_entry {
129 __be16 type;
130 __be16 len;
131 __u8 value[1];
132} __attribute__((__packed__));
133
134/*
135 * Common for HBA/Port Attributes
136 */
137struct fs_fdmi_attrs {
138 __be32 numattrs;
139 struct fc_fdmi_attr_entry attr[1];
140} __attribute__((__packed__));
141
142/*
143 * Registered Port List
144 */
145struct fc_fdmi_rpl {
146 __be32 numport;
147 struct fc_fdmi_port_name port[1];
148} __attribute__((__packed__));
149
150/*
151 * Register HBA (RHBA)
152 */
153struct fc_fdmi_rhba {
154 struct fc_fdmi_hba_identifier hbaid;
155 struct fc_fdmi_rpl port;
156 struct fs_fdmi_attrs hba_attrs;
157} __attribute__((__packed__));
158
159/*
160 * Register HBA Attributes (RHAT)
161 */
162struct fc_fdmi_rhat {
163 struct fc_fdmi_hba_identifier hbaid;
164 struct fs_fdmi_attrs hba_attrs;
165} __attribute__((__packed__));
166
167/*
168 * Register Port (RPRT)
169 */
170struct fc_fdmi_rprt {
171 struct fc_fdmi_hba_identifier hbaid;
172 struct fc_fdmi_port_name port;
173 struct fs_fdmi_attrs hba_attrs;
174} __attribute__((__packed__));
175
176/*
177 * Register Port Attributes (RPA)
178 */
179struct fc_fdmi_rpa {
180 struct fc_fdmi_port_name port;
181 struct fs_fdmi_attrs hba_attrs;
182} __attribute__((__packed__));
183
184/*
185 * Deregister Port (DPRT)
186 */
187struct fc_fdmi_dprt {
188 struct fc_fdmi_port_name port;
189} __attribute__((__packed__));
190
191/*
192 * Deregister Port Attributes (DPA)
193 */
194struct fc_fdmi_dpa {
195 struct fc_fdmi_port_name port;
196 struct fs_fdmi_attrs hba_attrs;
197} __attribute__((__packed__));
198
199/*
200 * Deregister HBA Attributes (DHAT)
201 */
202struct fc_fdmi_dhat {
203 struct fc_fdmi_hba_identifier hbaid;
204} __attribute__((__packed__));
205
206/*
207 * Deregister HBA (DHBA)
208 */
209struct fc_fdmi_dhba {
210 struct fc_fdmi_hba_identifier hbaid;
211} __attribute__((__packed__));
212
213#endif /* _FC_MS_H_ */
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index be418d8448a5..35fd4744f3e9 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -20,6 +20,7 @@
20#ifndef _FC_ENCODE_H_ 20#ifndef _FC_ENCODE_H_
21#define _FC_ENCODE_H_ 21#define _FC_ENCODE_H_
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
23#include <linux/utsname.h>
23 24
24/* 25/*
25 * F_CTL values for simple requests and responses. 26 * F_CTL values for simple requests and responses.
@@ -43,6 +44,10 @@ struct fc_ct_req {
43 struct fc_ns_fid fid; 44 struct fc_ns_fid fid;
44 struct fc_ns_rsnn snn; 45 struct fc_ns_rsnn snn;
45 struct fc_ns_rspn spn; 46 struct fc_ns_rspn spn;
47 struct fc_fdmi_rhba rhba;
48 struct fc_fdmi_rpa rpa;
49 struct fc_fdmi_dprt dprt;
50 struct fc_fdmi_dhba dhba;
46 } payload; 51 } payload;
47}; 52};
48 53
@@ -97,7 +102,9 @@ static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp)
97 * returns pointer to ct request. 102 * returns pointer to ct request.
98 */ 103 */
99static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp, 104static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
100 unsigned int op, size_t req_size) 105 unsigned int op, size_t req_size,
106 enum fc_ct_fs_type fs_type,
107 u8 subtype)
101{ 108{
102 struct fc_ct_req *ct; 109 struct fc_ct_req *ct;
103 size_t ct_plen; 110 size_t ct_plen;
@@ -106,14 +113,14 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
106 ct = fc_frame_payload_get(fp, ct_plen); 113 ct = fc_frame_payload_get(fp, ct_plen);
107 memset(ct, 0, ct_plen); 114 memset(ct, 0, ct_plen);
108 ct->hdr.ct_rev = FC_CT_REV; 115 ct->hdr.ct_rev = FC_CT_REV;
109 ct->hdr.ct_fs_type = FC_FST_DIR; 116 ct->hdr.ct_fs_type = fs_type;
110 ct->hdr.ct_fs_subtype = FC_NS_SUBTYPE; 117 ct->hdr.ct_fs_subtype = subtype;
111 ct->hdr.ct_cmd = htons((u16) op); 118 ct->hdr.ct_cmd = htons((u16) op);
112 return ct; 119 return ct;
113} 120}
114 121
115/** 122/**
116 * fc_ct_fill() - Fill in a name service request frame 123 * fc_ct_ns_fill() - Fill in a name service request frame
117 * @lport: local port. 124 * @lport: local port.
118 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. 125 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
119 * @fp: frame to contain payload. 126 * @fp: frame to contain payload.
@@ -121,7 +128,7 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
121 * @r_ctl: pointer to FC header R_CTL. 128 * @r_ctl: pointer to FC header R_CTL.
122 * @fh_type: pointer to FC-4 type. 129 * @fh_type: pointer to FC-4 type.
123 */ 130 */
124static inline int fc_ct_fill(struct fc_lport *lport, 131static inline int fc_ct_ns_fill(struct fc_lport *lport,
125 u32 fc_id, struct fc_frame *fp, 132 u32 fc_id, struct fc_frame *fp,
126 unsigned int op, enum fc_rctl *r_ctl, 133 unsigned int op, enum fc_rctl *r_ctl,
127 enum fc_fh_type *fh_type) 134 enum fc_fh_type *fh_type)
@@ -131,23 +138,28 @@ static inline int fc_ct_fill(struct fc_lport *lport,
131 138
132 switch (op) { 139 switch (op) {
133 case FC_NS_GPN_FT: 140 case FC_NS_GPN_FT:
134 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft)); 141 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft),
142 FC_FST_DIR, FC_NS_SUBTYPE);
135 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP; 143 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
136 break; 144 break;
137 145
138 case FC_NS_GPN_ID: 146 case FC_NS_GPN_ID:
139 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid)); 147 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid),
148 FC_FST_DIR, FC_NS_SUBTYPE);
149 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
140 hton24(ct->payload.fid.fp_fid, fc_id); 150 hton24(ct->payload.fid.fp_fid, fc_id);
141 break; 151 break;
142 152
143 case FC_NS_RFT_ID: 153 case FC_NS_RFT_ID:
144 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); 154 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft),
155 FC_FST_DIR, FC_NS_SUBTYPE);
145 hton24(ct->payload.rft.fid.fp_fid, lport->port_id); 156 hton24(ct->payload.rft.fid.fp_fid, lport->port_id);
146 ct->payload.rft.fts = lport->fcts; 157 ct->payload.rft.fts = lport->fcts;
147 break; 158 break;
148 159
149 case FC_NS_RFF_ID: 160 case FC_NS_RFF_ID:
150 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); 161 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id),
162 FC_FST_DIR, FC_NS_SUBTYPE);
151 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id); 163 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id);
152 ct->payload.rff.fr_type = FC_TYPE_FCP; 164 ct->payload.rff.fr_type = FC_TYPE_FCP;
153 if (lport->service_params & FCP_SPPF_INIT_FCN) 165 if (lport->service_params & FCP_SPPF_INIT_FCN)
@@ -157,14 +169,16 @@ static inline int fc_ct_fill(struct fc_lport *lport,
157 break; 169 break;
158 170
159 case FC_NS_RNN_ID: 171 case FC_NS_RNN_ID:
160 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); 172 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id),
173 FC_FST_DIR, FC_NS_SUBTYPE);
161 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id); 174 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id);
162 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); 175 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
163 break; 176 break;
164 177
165 case FC_NS_RSPN_ID: 178 case FC_NS_RSPN_ID:
166 len = strnlen(fc_host_symbolic_name(lport->host), 255); 179 len = strnlen(fc_host_symbolic_name(lport->host), 255);
167 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); 180 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len,
181 FC_FST_DIR, FC_NS_SUBTYPE);
168 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id); 182 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id);
169 strncpy(ct->payload.spn.fr_name, 183 strncpy(ct->payload.spn.fr_name,
170 fc_host_symbolic_name(lport->host), len); 184 fc_host_symbolic_name(lport->host), len);
@@ -173,7 +187,8 @@ static inline int fc_ct_fill(struct fc_lport *lport,
173 187
174 case FC_NS_RSNN_NN: 188 case FC_NS_RSNN_NN:
175 len = strnlen(fc_host_symbolic_name(lport->host), 255); 189 len = strnlen(fc_host_symbolic_name(lport->host), 255);
176 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len); 190 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len,
191 FC_FST_DIR, FC_NS_SUBTYPE);
177 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn); 192 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn);
178 strncpy(ct->payload.snn.fr_name, 193 strncpy(ct->payload.snn.fr_name,
179 fc_host_symbolic_name(lport->host), len); 194 fc_host_symbolic_name(lport->host), len);
@@ -189,6 +204,330 @@ static inline int fc_ct_fill(struct fc_lport *lport,
189} 204}
190 205
191/** 206/**
207 * fc_ct_ms_fill() - Fill in a mgmt service request frame
208 * @lport: local port.
209 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
210 * @fp: frame to contain payload.
211 * @op: CT opcode.
212 * @r_ctl: pointer to FC header R_CTL.
213 * @fh_type: pointer to FC-4 type.
214 */
215static inline int fc_ct_ms_fill(struct fc_lport *lport,
216 u32 fc_id, struct fc_frame *fp,
217 unsigned int op, enum fc_rctl *r_ctl,
218 enum fc_fh_type *fh_type)
219{
220 struct fc_ct_req *ct;
221 size_t len;
222 struct fc_fdmi_attr_entry *entry;
223 struct fs_fdmi_attrs *hba_attrs;
224 int numattrs = 0;
225
226 switch (op) {
227 case FC_FDMI_RHBA:
228 numattrs = 10;
229 len = sizeof(struct fc_fdmi_rhba);
230 len -= sizeof(struct fc_fdmi_attr_entry);
231 len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN);
232 len += FC_FDMI_HBA_ATTR_NODENAME_LEN;
233 len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN;
234 len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN;
235 len += FC_FDMI_HBA_ATTR_MODEL_LEN;
236 len += FC_FDMI_HBA_ATTR_MODELDESCR_LEN;
237 len += FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN;
238 len += FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN;
239 len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN;
240 len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN;
241 len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN;
242 ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
243 FC_FDMI_SUBTYPE);
244
245 /* HBA Identifier */
246 put_unaligned_be64(lport->wwpn, &ct->payload.rhba.hbaid.id);
247 /* Number of Ports - always 1 */
248 put_unaligned_be32(1, &ct->payload.rhba.port.numport);
249 /* Port Name */
250 put_unaligned_be64(lport->wwpn,
251 &ct->payload.rhba.port.port[0].portname);
252
253 /* HBA Attributes */
254 put_unaligned_be32(numattrs,
255 &ct->payload.rhba.hba_attrs.numattrs);
256 hba_attrs = &ct->payload.rhba.hba_attrs;
257 entry = (struct fc_fdmi_attr_entry *)hba_attrs->attr;
258 /* NodeName*/
259 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
260 len += FC_FDMI_HBA_ATTR_NODENAME_LEN;
261 put_unaligned_be16(FC_FDMI_HBA_ATTR_NODENAME,
262 &entry->type);
263 put_unaligned_be16(len, &entry->len);
264 put_unaligned_be64(lport->wwnn,
265 (__be64 *)&entry->value[0]);
266
267 /* Manufacturer */
268 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
269 FC_FDMI_HBA_ATTR_NODENAME_LEN);
270 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
271 len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN;
272 put_unaligned_be16(FC_FDMI_HBA_ATTR_MANUFACTURER,
273 &entry->type);
274 put_unaligned_be16(len, &entry->len);
275 strncpy((char *)&entry->value,
276 fc_host_manufacturer(lport->host),
277 FC_FDMI_HBA_ATTR_MANUFACTURER_LEN);
278
279 /* SerialNumber */
280 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
281 FC_FDMI_HBA_ATTR_MANUFACTURER_LEN);
282 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
283 len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN;
284 put_unaligned_be16(FC_FDMI_HBA_ATTR_SERIALNUMBER,
285 &entry->type);
286 put_unaligned_be16(len, &entry->len);
287 strncpy((char *)&entry->value,
288 fc_host_serial_number(lport->host),
289 FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN);
290
291 /* Model */
292 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
293 FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN);
294 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
295 len += FC_FDMI_HBA_ATTR_MODEL_LEN;
296 put_unaligned_be16(FC_FDMI_HBA_ATTR_MODEL,
297 &entry->type);
298 put_unaligned_be16(len, &entry->len);
299 strncpy((char *)&entry->value,
300 fc_host_model(lport->host),
301 FC_FDMI_HBA_ATTR_MODEL_LEN);
302
303 /* Model Description */
304 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
305 FC_FDMI_HBA_ATTR_MODEL_LEN);
306 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
307 len += FC_FDMI_HBA_ATTR_MODELDESCR_LEN;
308 put_unaligned_be16(FC_FDMI_HBA_ATTR_MODELDESCRIPTION,
309 &entry->type);
310 put_unaligned_be16(len, &entry->len);
311 strncpy((char *)&entry->value,
312 fc_host_model_description(lport->host),
313 FC_FDMI_HBA_ATTR_MODELDESCR_LEN);
314
315 /* Hardware Version */
316 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
317 FC_FDMI_HBA_ATTR_MODELDESCR_LEN);
318 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
319 len += FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN;
320 put_unaligned_be16(FC_FDMI_HBA_ATTR_HARDWAREVERSION,
321 &entry->type);
322 put_unaligned_be16(len, &entry->len);
323 strncpy((char *)&entry->value,
324 fc_host_hardware_version(lport->host),
325 FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN);
326
327 /* Driver Version */
328 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
329 FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN);
330 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
331 len += FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN;
332 put_unaligned_be16(FC_FDMI_HBA_ATTR_DRIVERVERSION,
333 &entry->type);
334 put_unaligned_be16(len, &entry->len);
335 strncpy((char *)&entry->value,
336 fc_host_driver_version(lport->host),
337 FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN);
338
339 /* OptionROM Version */
340 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
341 FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN);
342 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
343 len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN;
344 put_unaligned_be16(FC_FDMI_HBA_ATTR_OPTIONROMVERSION,
345 &entry->type);
346 put_unaligned_be16(len, &entry->len);
347 strncpy((char *)&entry->value,
348 fc_host_optionrom_version(lport->host),
349 FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN);
350
351 /* Firmware Version */
352 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
353 FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN);
354 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
355 len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN;
356 put_unaligned_be16(FC_FDMI_HBA_ATTR_FIRMWAREVERSION,
357 &entry->type);
358 put_unaligned_be16(len, &entry->len);
359 strncpy((char *)&entry->value,
360 fc_host_firmware_version(lport->host),
361 FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN);
362
363 /* OS Name and Version */
364 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
365 FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN);
366 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
367 len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN;
368 put_unaligned_be16(FC_FDMI_HBA_ATTR_OSNAMEVERSION,
369 &entry->type);
370 put_unaligned_be16(len, &entry->len);
371 snprintf((char *)&entry->value,
372 FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN,
373 "%s v%s",
374 init_utsname()->sysname,
375 init_utsname()->release);
376 break;
377 case FC_FDMI_RPA:
378 numattrs = 6;
379 len = sizeof(struct fc_fdmi_rpa);
380 len -= sizeof(struct fc_fdmi_attr_entry);
381 len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN);
382 len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN;
383 len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN;
384 len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN;
385 len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN;
386 len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN;
387 len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN;
388 ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
389 FC_FDMI_SUBTYPE);
390
391 /* Port Name */
392 put_unaligned_be64(lport->wwpn,
393 &ct->payload.rpa.port.portname);
394
395 /* Port Attributes */
396 put_unaligned_be32(numattrs,
397 &ct->payload.rpa.hba_attrs.numattrs);
398
399 hba_attrs = &ct->payload.rpa.hba_attrs;
400 entry = (struct fc_fdmi_attr_entry *)hba_attrs->attr;
401
402 /* FC4 types */
403 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
404 len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN;
405 put_unaligned_be16(FC_FDMI_PORT_ATTR_FC4TYPES,
406 &entry->type);
407 put_unaligned_be16(len, &entry->len);
408 memcpy(&entry->value, fc_host_supported_fc4s(lport->host),
409 FC_FDMI_PORT_ATTR_FC4TYPES_LEN);
410
411 /* Supported Speed */
412 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
413 FC_FDMI_PORT_ATTR_FC4TYPES_LEN);
414 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
415 len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN;
416 put_unaligned_be16(FC_FDMI_PORT_ATTR_SUPPORTEDSPEED,
417 &entry->type);
418 put_unaligned_be16(len, &entry->len);
419
420 put_unaligned_be32(fc_host_supported_speeds(lport->host),
421 &entry->value);
422
423 /* Current Port Speed */
424 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
425 FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN);
426 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
427 len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN;
428 put_unaligned_be16(FC_FDMI_PORT_ATTR_CURRENTPORTSPEED,
429 &entry->type);
430 put_unaligned_be16(len, &entry->len);
431 put_unaligned_be32(lport->link_speed,
432 &entry->value);
433
434 /* Max Frame Size */
435 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
436 FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN);
437 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
438 len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN;
439 put_unaligned_be16(FC_FDMI_PORT_ATTR_MAXFRAMESIZE,
440 &entry->type);
441 put_unaligned_be16(len, &entry->len);
442 put_unaligned_be32(fc_host_maxframe_size(lport->host),
443 &entry->value);
444
445 /* OS Device Name */
446 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
447 FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN);
448 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
449 len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN;
450 put_unaligned_be16(FC_FDMI_PORT_ATTR_OSDEVICENAME,
451 &entry->type);
452 put_unaligned_be16(len, &entry->len);
453 /* Use the sysfs device name */
454 strncpy((char *)&entry->value,
455 dev_name(&lport->host->shost_gendev),
456 strnlen(dev_name(&lport->host->shost_gendev),
457 FC_FDMI_PORT_ATTR_HOSTNAME_LEN));
458
459 /* Host Name */
460 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
461 FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN);
462 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
463 len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN;
464 put_unaligned_be16(FC_FDMI_PORT_ATTR_HOSTNAME,
465 &entry->type);
466 put_unaligned_be16(len, &entry->len);
467 if (strlen(fc_host_system_hostname(lport->host)))
468 strncpy((char *)&entry->value,
469 fc_host_system_hostname(lport->host),
470 strnlen(fc_host_system_hostname(lport->host),
471 FC_FDMI_PORT_ATTR_HOSTNAME_LEN));
472 else
473 strncpy((char *)&entry->value,
474 init_utsname()->nodename,
475 FC_FDMI_PORT_ATTR_HOSTNAME_LEN);
476 break;
477 case FC_FDMI_DPRT:
478 len = sizeof(struct fc_fdmi_dprt);
479 ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
480 FC_FDMI_SUBTYPE);
481 /* Port Name */
482 put_unaligned_be64(lport->wwpn,
483 &ct->payload.dprt.port.portname);
484 break;
485 case FC_FDMI_DHBA:
486 len = sizeof(struct fc_fdmi_dhba);
487 ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
488 FC_FDMI_SUBTYPE);
489 /* HBA Identifier */
490 put_unaligned_be64(lport->wwpn, &ct->payload.dhba.hbaid.id);
491 break;
492 default:
493 return -EINVAL;
494 }
495 *r_ctl = FC_RCTL_DD_UNSOL_CTL;
496 *fh_type = FC_TYPE_CT;
497 return 0;
498}
499
500/**
501 * fc_ct_fill() - Fill in a common transport service request frame
502 * @lport: local port.
503 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
504 * @fp: frame to contain payload.
505 * @op: CT opcode.
506 * @r_ctl: pointer to FC header R_CTL.
507 * @fh_type: pointer to FC-4 type.
508 */
509static inline int fc_ct_fill(struct fc_lport *lport,
510 u32 fc_id, struct fc_frame *fp,
511 unsigned int op, enum fc_rctl *r_ctl,
512 enum fc_fh_type *fh_type, u32 *did)
513{
514 int rc = -EINVAL;
515
516 switch (fc_id) {
517 case FC_FID_MGMT_SERV:
518 rc = fc_ct_ms_fill(lport, fc_id, fp, op, r_ctl, fh_type);
519 *did = FC_FID_MGMT_SERV;
520 break;
521 case FC_FID_DIR_SERV:
522 default:
523 rc = fc_ct_ns_fill(lport, fc_id, fp, op, r_ctl, fh_type);
524 *did = FC_FID_DIR_SERV;
525 break;
526 }
527
528 return rc;
529}
530/**
192 * fc_plogi_fill - Fill in plogi request frame 531 * fc_plogi_fill - Fill in plogi request frame
193 */ 532 */
194static inline void fc_plogi_fill(struct fc_lport *lport, struct fc_frame *fp, 533static inline void fc_plogi_fill(struct fc_lport *lport, struct fc_frame *fp,
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 2703e3bedbf5..9c23ee8fd2d3 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -60,6 +60,9 @@ enum iscsi_uevent_e {
60 60
61 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20, 61 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
62 ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21, 62 ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21,
63 ISCSI_UEVENT_PING = UEVENT_BASE + 22,
64 ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23,
65 ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24,
63 66
64 /* up events */ 67 /* up events */
65 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 68 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -72,6 +75,8 @@ enum iscsi_uevent_e {
72 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7, 75 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
73 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8, 76 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
74 ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9, 77 ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
78 ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10,
79 ISCSI_KEVENT_PING_COMP = KEVENT_BASE + 11,
75}; 80};
76 81
77enum iscsi_tgt_dscvr { 82enum iscsi_tgt_dscvr {
@@ -80,6 +85,13 @@ enum iscsi_tgt_dscvr {
80 ISCSI_TGT_DSCVR_SLP = 3, 85 ISCSI_TGT_DSCVR_SLP = 3,
81}; 86};
82 87
88enum iscsi_host_event_code {
89 ISCSI_EVENT_LINKUP = 1,
90 ISCSI_EVENT_LINKDOWN,
91 /* must always be last */
92 ISCSI_EVENT_MAX,
93};
94
83struct iscsi_uevent { 95struct iscsi_uevent {
84 uint32_t type; /* k/u events type */ 96 uint32_t type; /* k/u events type */
85 uint32_t iferror; /* carries interface or resource errors */ 97 uint32_t iferror; /* carries interface or resource errors */
@@ -178,6 +190,26 @@ struct iscsi_uevent {
178 uint32_t host_no; 190 uint32_t host_no;
179 uint32_t count; 191 uint32_t count;
180 } set_iface_params; 192 } set_iface_params;
193 struct msg_iscsi_ping {
194 uint32_t host_no;
195 uint32_t iface_num;
196 uint32_t iface_type;
197 uint32_t payload_size;
198 uint32_t pid; /* unique ping id associated
199 with each ping request */
200 } iscsi_ping;
201 struct msg_get_chap {
202 uint32_t host_no;
203 uint32_t num_entries; /* number of CHAP entries
204 * on request, number of
205 * valid CHAP entries on
206 * response */
207 uint16_t chap_tbl_idx;
208 } get_chap;
209 struct msg_delete_chap {
210 uint32_t host_no;
211 uint16_t chap_tbl_idx;
212 } delete_chap;
181 } u; 213 } u;
182 union { 214 union {
183 /* messages k -> u */ 215 /* messages k -> u */
@@ -222,6 +254,18 @@ struct iscsi_uevent {
222 struct msg_notify_if_down { 254 struct msg_notify_if_down {
223 uint32_t host_no; 255 uint32_t host_no;
224 } notify_if_down; 256 } notify_if_down;
257 struct msg_host_event {
258 uint32_t host_no;
259 uint32_t data_size;
260 enum iscsi_host_event_code code;
261 } host_event;
262 struct msg_ping_comp {
263 uint32_t host_no;
264 uint32_t status;
265 uint32_t pid; /* unique ping id associated
266 with each ping request */
267 uint32_t data_size;
268 } ping_comp;
225 } r; 269 } r;
226} __attribute__ ((aligned (sizeof(uint64_t)))); 270} __attribute__ ((aligned (sizeof(uint64_t))));
227 271
@@ -406,6 +450,9 @@ enum iscsi_param {
406 450
407 ISCSI_PARAM_TGT_RESET_TMO, 451 ISCSI_PARAM_TGT_RESET_TMO,
408 ISCSI_PARAM_TARGET_ALIAS, 452 ISCSI_PARAM_TARGET_ALIAS,
453
454 ISCSI_PARAM_CHAP_IN_IDX,
455 ISCSI_PARAM_CHAP_OUT_IDX,
409 /* must always be last */ 456 /* must always be last */
410 ISCSI_PARAM_MAX, 457 ISCSI_PARAM_MAX,
411}; 458};
@@ -416,9 +463,26 @@ enum iscsi_host_param {
416 ISCSI_HOST_PARAM_INITIATOR_NAME, 463 ISCSI_HOST_PARAM_INITIATOR_NAME,
417 ISCSI_HOST_PARAM_NETDEV_NAME, 464 ISCSI_HOST_PARAM_NETDEV_NAME,
418 ISCSI_HOST_PARAM_IPADDRESS, 465 ISCSI_HOST_PARAM_IPADDRESS,
466 ISCSI_HOST_PARAM_PORT_STATE,
467 ISCSI_HOST_PARAM_PORT_SPEED,
419 ISCSI_HOST_PARAM_MAX, 468 ISCSI_HOST_PARAM_MAX,
420}; 469};
421 470
471/* iSCSI port Speed */
472enum iscsi_port_speed {
473 ISCSI_PORT_SPEED_UNKNOWN = 0x1,
474 ISCSI_PORT_SPEED_10MBPS = 0x2,
475 ISCSI_PORT_SPEED_100MBPS = 0x4,
476 ISCSI_PORT_SPEED_1GBPS = 0x8,
477 ISCSI_PORT_SPEED_10GBPS = 0x10,
478};
479
480/* iSCSI port state */
481enum iscsi_port_state {
482 ISCSI_PORT_STATE_DOWN = 0x1,
483 ISCSI_PORT_STATE_UP = 0x2,
484};
485
422#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 486#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
423#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) 487#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
424 488
@@ -501,4 +565,19 @@ struct iscsi_stats {
501 __attribute__ ((aligned (sizeof(uint64_t)))); 565 __attribute__ ((aligned (sizeof(uint64_t))));
502}; 566};
503 567
568enum chap_type_e {
569 CHAP_TYPE_OUT,
570 CHAP_TYPE_IN,
571};
572
573#define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256
574#define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256
575struct iscsi_chap_rec {
576 uint16_t chap_tbl_idx;
577 enum chap_type_e chap_type;
578 char username[ISCSI_CHAP_AUTH_NAME_MAX_LEN];
579 uint8_t password[ISCSI_CHAP_AUTH_SECRET_MAX_LEN];
580 uint8_t password_length;
581} __packed;
582
504#endif 583#endif
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 6a3922fe0be0..8f9dfba3fcf0 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -30,6 +30,7 @@
30 30
31#include <scsi/fc/fc_fcp.h> 31#include <scsi/fc/fc_fcp.h>
32#include <scsi/fc/fc_ns.h> 32#include <scsi/fc/fc_ns.h>
33#include <scsi/fc/fc_ms.h>
33#include <scsi/fc/fc_els.h> 34#include <scsi/fc/fc_els.h>
34#include <scsi/fc/fc_gs.h> 35#include <scsi/fc/fc_gs.h>
35 36
@@ -52,6 +53,8 @@
52 * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent 53 * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent
53 * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent 54 * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent
54 * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent 55 * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent
56 * @LPORT_ST_FDMI: Waiting for mgmt server rport to become ready
57 * @LPORT_ST_RHBA:
55 * @LPORT_ST_SCR: State Change Register (SCR) sent 58 * @LPORT_ST_SCR: State Change Register (SCR) sent
56 * @LPORT_ST_READY: Ready for use 59 * @LPORT_ST_READY: Ready for use
57 * @LPORT_ST_LOGO: Local port logout (LOGO) sent 60 * @LPORT_ST_LOGO: Local port logout (LOGO) sent
@@ -66,6 +69,11 @@ enum fc_lport_state {
66 LPORT_ST_RSPN_ID, 69 LPORT_ST_RSPN_ID,
67 LPORT_ST_RFT_ID, 70 LPORT_ST_RFT_ID,
68 LPORT_ST_RFF_ID, 71 LPORT_ST_RFF_ID,
72 LPORT_ST_FDMI,
73 LPORT_ST_RHBA,
74 LPORT_ST_RPA,
75 LPORT_ST_DHBA,
76 LPORT_ST_DPRT,
69 LPORT_ST_SCR, 77 LPORT_ST_SCR,
70 LPORT_ST_READY, 78 LPORT_ST_READY,
71 LPORT_ST_LOGO, 79 LPORT_ST_LOGO,
@@ -797,6 +805,7 @@ enum fc_lport_event {
797 * @host: The SCSI host associated with a local port 805 * @host: The SCSI host associated with a local port
798 * @ema_list: Exchange manager anchor list 806 * @ema_list: Exchange manager anchor list
799 * @dns_rdata: The directory server remote port 807 * @dns_rdata: The directory server remote port
808 * @ms_rdata: The management server remote port
800 * @ptp_rdata: Point to point remote port 809 * @ptp_rdata: Point to point remote port
801 * @scsi_priv: FCP layer internal data 810 * @scsi_priv: FCP layer internal data
802 * @disc: Discovery context 811 * @disc: Discovery context
@@ -842,6 +851,7 @@ struct fc_lport {
842 struct Scsi_Host *host; 851 struct Scsi_Host *host;
843 struct list_head ema_list; 852 struct list_head ema_list;
844 struct fc_rport_priv *dns_rdata; 853 struct fc_rport_priv *dns_rdata;
854 struct fc_rport_priv *ms_rdata;
845 struct fc_rport_priv *ptp_rdata; 855 struct fc_rport_priv *ptp_rdata;
846 void *scsi_priv; 856 void *scsi_priv;
847 struct fc_disc disc; 857 struct fc_disc disc;
@@ -877,6 +887,7 @@ struct fc_lport {
877 u32 does_npiv:1; 887 u32 does_npiv:1;
878 u32 npiv_enabled:1; 888 u32 npiv_enabled:1;
879 u32 point_to_multipoint:1; 889 u32 point_to_multipoint:1;
890 u32 fdmi_enabled:1;
880 u32 mfs; 891 u32 mfs;
881 u8 max_retry_count; 892 u8 max_retry_count;
882 u8 max_rport_retry_count; 893 u8 max_rport_retry_count;
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index cedcff371c88..6e33386a3898 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -268,7 +268,7 @@ struct iscsi_session {
268 int lu_reset_timeout; 268 int lu_reset_timeout;
269 int tgt_reset_timeout; 269 int tgt_reset_timeout;
270 int initial_r2t_en; 270 int initial_r2t_en;
271 unsigned max_r2t; 271 unsigned short max_r2t;
272 int imm_data_en; 272 int imm_data_en;
273 unsigned first_burst; 273 unsigned first_burst;
274 unsigned max_burst; 274 unsigned max_burst;
@@ -284,6 +284,7 @@ struct iscsi_session {
284 char *password; 284 char *password;
285 char *password_in; 285 char *password_in;
286 char *targetname; 286 char *targetname;
287 char *targetalias;
287 char *ifacename; 288 char *ifacename;
288 char *initiatorname; 289 char *initiatorname;
289 /* control data */ 290 /* control data */
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index ac0cc1d925ef..215469a9b801 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -128,7 +128,7 @@ extern void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn);
128/* misc helpers */ 128/* misc helpers */
129extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session); 129extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session);
130extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session); 130extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session);
131 131extern int iscsi_tcp_set_max_r2t(struct iscsi_conn *conn, char *buf);
132extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn, 132extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn,
133 struct iscsi_stats *stats); 133 struct iscsi_stats *stats);
134#endif /* LIBISCSI_TCP_H */ 134#endif /* LIBISCSI_TCP_H */
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 6a308d42d98f..5f5ed1b8b41b 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -86,7 +86,9 @@ enum discover_event {
86 DISCE_DISCOVER_DOMAIN = 0U, 86 DISCE_DISCOVER_DOMAIN = 0U,
87 DISCE_REVALIDATE_DOMAIN = 1, 87 DISCE_REVALIDATE_DOMAIN = 1,
88 DISCE_PORT_GONE = 2, 88 DISCE_PORT_GONE = 2,
89 DISC_NUM_EVENTS = 3, 89 DISCE_PROBE = 3,
90 DISCE_DESTRUCT = 4,
91 DISC_NUM_EVENTS = 5,
90}; 92};
91 93
92/* ---------- Expander Devices ---------- */ 94/* ---------- Expander Devices ---------- */
@@ -151,6 +153,8 @@ struct expander_device {
151 153
152 struct ex_phy *ex_phy; 154 struct ex_phy *ex_phy;
153 struct sas_port *parent_port; 155 struct sas_port *parent_port;
156
157 struct mutex cmd_mutex;
154}; 158};
155 159
156/* ---------- SATA device ---------- */ 160/* ---------- SATA device ---------- */
@@ -162,22 +166,21 @@ enum ata_command_set {
162struct sata_device { 166struct sata_device {
163 enum ata_command_set command_set; 167 enum ata_command_set command_set;
164 struct smp_resp rps_resp; /* report_phy_sata_resp */ 168 struct smp_resp rps_resp; /* report_phy_sata_resp */
165 __le16 *identify_device;
166 __le16 *identify_packet_device;
167
168 u8 port_no; /* port number, if this is a PM (Port) */ 169 u8 port_no; /* port number, if this is a PM (Port) */
169 struct list_head children; /* PM Ports if this is a PM */ 170 struct list_head children; /* PM Ports if this is a PM */
170 171
171 struct ata_port *ap; 172 struct ata_port *ap;
172 struct ata_host ata_host; 173 struct ata_host ata_host;
173 struct ata_taskfile tf; 174 struct ata_taskfile tf;
174 u32 sstatus;
175 u32 serror;
176 u32 scontrol;
177}; 175};
178 176
179/* ---------- Domain device ---------- */ 177enum {
178 SAS_DEV_GONE,
179 SAS_DEV_DESTROY,
180};
181
180struct domain_device { 182struct domain_device {
183 spinlock_t done_lock;
181 enum sas_dev_type dev_type; 184 enum sas_dev_type dev_type;
182 185
183 enum sas_linkrate linkrate; 186 enum sas_linkrate linkrate;
@@ -189,8 +192,10 @@ struct domain_device {
189 struct domain_device *parent; 192 struct domain_device *parent;
190 struct list_head siblings; /* devices on the same level */ 193 struct list_head siblings; /* devices on the same level */
191 struct asd_sas_port *port; /* shortcut to root of the tree */ 194 struct asd_sas_port *port; /* shortcut to root of the tree */
195 struct sas_phy *phy;
192 196
193 struct list_head dev_list_node; 197 struct list_head dev_list_node;
198 struct list_head disco_list_node; /* awaiting probe or destruct */
194 199
195 enum sas_protocol iproto; 200 enum sas_protocol iproto;
196 enum sas_protocol tproto; 201 enum sas_protocol tproto;
@@ -208,7 +213,8 @@ struct domain_device {
208 }; 213 };
209 214
210 void *lldd_dev; 215 void *lldd_dev;
211 int gone; 216 unsigned long state;
217 struct kref kref;
212}; 218};
213 219
214struct sas_discovery_event { 220struct sas_discovery_event {
@@ -217,7 +223,6 @@ struct sas_discovery_event {
217}; 223};
218 224
219struct sas_discovery { 225struct sas_discovery {
220 spinlock_t disc_event_lock;
221 struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; 226 struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
222 unsigned long pending; 227 unsigned long pending;
223 u8 fanout_sas_addr[8]; 228 u8 fanout_sas_addr[8];
@@ -226,7 +231,6 @@ struct sas_discovery {
226 int max_level; 231 int max_level;
227}; 232};
228 233
229
230/* The port struct is Class:RW, driver:RO */ 234/* The port struct is Class:RW, driver:RO */
231struct asd_sas_port { 235struct asd_sas_port {
232/* private: */ 236/* private: */
@@ -236,9 +240,10 @@ struct asd_sas_port {
236 struct domain_device *port_dev; 240 struct domain_device *port_dev;
237 spinlock_t dev_list_lock; 241 spinlock_t dev_list_lock;
238 struct list_head dev_list; 242 struct list_head dev_list;
243 struct list_head disco_list;
244 struct list_head destroy_list;
239 enum sas_linkrate linkrate; 245 enum sas_linkrate linkrate;
240 246
241 struct sas_phy *phy;
242 struct work_struct work; 247 struct work_struct work;
243 248
244/* public: */ 249/* public: */
@@ -274,7 +279,6 @@ struct asd_sas_event {
274 */ 279 */
275struct asd_sas_phy { 280struct asd_sas_phy {
276/* private: */ 281/* private: */
277 /* protected by ha->event_lock */
278 struct asd_sas_event port_events[PORT_NUM_EVENTS]; 282 struct asd_sas_event port_events[PORT_NUM_EVENTS];
279 struct asd_sas_event phy_events[PHY_NUM_EVENTS]; 283 struct asd_sas_event phy_events[PHY_NUM_EVENTS];
280 284
@@ -320,6 +324,7 @@ struct asd_sas_phy {
320struct scsi_core { 324struct scsi_core {
321 struct Scsi_Host *shost; 325 struct Scsi_Host *shost;
322 326
327 struct mutex task_queue_flush;
323 spinlock_t task_queue_lock; 328 spinlock_t task_queue_lock;
324 struct list_head task_queue; 329 struct list_head task_queue;
325 int task_queue_size; 330 int task_queue_size;
@@ -334,18 +339,23 @@ struct sas_ha_event {
334 339
335enum sas_ha_state { 340enum sas_ha_state {
336 SAS_HA_REGISTERED, 341 SAS_HA_REGISTERED,
337 SAS_HA_UNREGISTERED 342 SAS_HA_DRAINING,
343 SAS_HA_ATA_EH_ACTIVE,
344 SAS_HA_FROZEN,
338}; 345};
339 346
340struct sas_ha_struct { 347struct sas_ha_struct {
341/* private: */ 348/* private: */
342 spinlock_t event_lock;
343 struct sas_ha_event ha_events[HA_NUM_EVENTS]; 349 struct sas_ha_event ha_events[HA_NUM_EVENTS];
344 unsigned long pending; 350 unsigned long pending;
345 351
346 enum sas_ha_state state; 352 struct list_head defer_q; /* work queued while draining */
353 struct mutex drain_mutex;
354 unsigned long state;
347 spinlock_t state_lock; 355 spinlock_t state_lock;
348 356
357 struct mutex disco_mutex;
358
349 struct scsi_core core; 359 struct scsi_core core;
350 360
351/* public: */ 361/* public: */
@@ -374,7 +384,8 @@ struct sas_ha_struct {
374 384
375 void *lldd_ha; /* not touched by sas class code */ 385 void *lldd_ha; /* not touched by sas class code */
376 386
377 struct list_head eh_done_q; 387 struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */
388 struct list_head eh_ata_q; /* scmds to promote from sas to ata eh */
378}; 389};
379 390
380#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) 391#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata)
@@ -418,6 +429,11 @@ static inline unsigned int to_sas_gpio_od(int device, int bit)
418 return 3 * device + bit; 429 return 3 * device + bit;
419} 430}
420 431
432static inline void sas_put_local_phy(struct sas_phy *phy)
433{
434 put_device(&phy->dev);
435}
436
421#ifdef CONFIG_SCSI_SAS_HOST_SMP 437#ifdef CONFIG_SCSI_SAS_HOST_SMP
422int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count); 438int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count);
423#else 439#else
@@ -447,7 +463,10 @@ enum service_response {
447}; 463};
448 464
449enum exec_status { 465enum exec_status {
450 /* The SAM_STAT_.. codes fit in the lower 6 bits */ 466 /* The SAM_STAT_.. codes fit in the lower 6 bits, alias some of
467 * them here to silence 'case value not in enumerated type' warnings
468 */
469 __SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION,
451 470
452 SAS_DEV_NO_RESPONSE = 0x80, 471 SAS_DEV_NO_RESPONSE = 0x80,
453 SAS_DATA_UNDERRUN, 472 SAS_DATA_UNDERRUN,
@@ -487,10 +506,6 @@ enum exec_status {
487struct ata_task_resp { 506struct ata_task_resp {
488 u16 frame_len; 507 u16 frame_len;
489 u8 ending_fis[24]; /* dev to host or data-in */ 508 u8 ending_fis[24]; /* dev to host or data-in */
490 u32 sstatus;
491 u32 serror;
492 u32 scontrol;
493 u32 sactive;
494}; 509};
495 510
496#define SAS_STATUS_BUF_SIZE 96 511#define SAS_STATUS_BUF_SIZE 96
@@ -604,7 +619,8 @@ struct sas_domain_function_template {
604 int (*lldd_clear_aca)(struct domain_device *, u8 *lun); 619 int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
605 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); 620 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
606 int (*lldd_I_T_nexus_reset)(struct domain_device *); 621 int (*lldd_I_T_nexus_reset)(struct domain_device *);
607 int (*lldd_ata_soft_reset)(struct domain_device *); 622 int (*lldd_ata_check_ready)(struct domain_device *);
623 void (*lldd_ata_set_dmamode)(struct domain_device *);
608 int (*lldd_lu_reset)(struct domain_device *, u8 *lun); 624 int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
609 int (*lldd_query_task)(struct sas_task *); 625 int (*lldd_query_task)(struct sas_task *);
610 626
@@ -625,14 +641,11 @@ extern int sas_unregister_ha(struct sas_ha_struct *);
625 641
626int sas_set_phy_speed(struct sas_phy *phy, 642int sas_set_phy_speed(struct sas_phy *phy,
627 struct sas_phy_linkrates *rates); 643 struct sas_phy_linkrates *rates);
628int sas_phy_enable(struct sas_phy *phy, int enabled);
629int sas_phy_reset(struct sas_phy *phy, int hard_reset); 644int sas_phy_reset(struct sas_phy *phy, int hard_reset);
630int sas_queue_up(struct sas_task *task); 645int sas_queue_up(struct sas_task *task);
631extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *); 646extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
632extern int sas_target_alloc(struct scsi_target *); 647extern int sas_target_alloc(struct scsi_target *);
633extern int sas_slave_alloc(struct scsi_device *);
634extern int sas_slave_configure(struct scsi_device *); 648extern int sas_slave_configure(struct scsi_device *);
635extern void sas_slave_destroy(struct scsi_device *);
636extern int sas_change_queue_depth(struct scsi_device *, int new_depth, 649extern int sas_change_queue_depth(struct scsi_device *, int new_depth,
637 int reason); 650 int reason);
638extern int sas_change_queue_type(struct scsi_device *, int qt); 651extern int sas_change_queue_type(struct scsi_device *, int qt);
@@ -649,7 +662,7 @@ void sas_init_ex_attr(void);
649 662
650int sas_ex_revalidate_domain(struct domain_device *); 663int sas_ex_revalidate_domain(struct domain_device *);
651 664
652void sas_unregister_domain_devices(struct asd_sas_port *port); 665void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
653void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *); 666void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
654int sas_discover_event(struct asd_sas_port *, enum discover_event ev); 667int sas_discover_event(struct asd_sas_port *, enum discover_event ev);
655 668
@@ -661,20 +674,20 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
661void sas_init_dev(struct domain_device *); 674void sas_init_dev(struct domain_device *);
662 675
663void sas_task_abort(struct sas_task *); 676void sas_task_abort(struct sas_task *);
664int __sas_task_abort(struct sas_task *);
665int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); 677int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
666int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd); 678int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd);
667 679
668extern void sas_target_destroy(struct scsi_target *); 680extern void sas_target_destroy(struct scsi_target *);
669extern int sas_slave_alloc(struct scsi_device *); 681extern int sas_slave_alloc(struct scsi_device *);
670extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg); 682extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg);
683extern int sas_drain_work(struct sas_ha_struct *ha);
671 684
672extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, 685extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
673 struct request *req); 686 struct request *req);
674 687
675extern void sas_ssp_task_response(struct device *dev, struct sas_task *task, 688extern void sas_ssp_task_response(struct device *dev, struct sas_task *task,
676 struct ssp_response_iu *iu); 689 struct ssp_response_iu *iu);
677struct sas_phy *sas_find_local_phy(struct domain_device *dev); 690struct sas_phy *sas_get_local_phy(struct domain_device *dev);
678 691
679int sas_request_addr(struct Scsi_Host *shost, u8 *addr); 692int sas_request_addr(struct Scsi_Host *shost, u8 *addr);
680 693
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h
index f05fa826f89e..a5f9b960dfc8 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/sas.h b/include/scsi/sas.h
index 3673d685e6ad..a577a833603d 100644
--- a/include/scsi/sas.h
+++ b/include/scsi/sas.h
@@ -89,8 +89,7 @@ enum sas_oob_mode {
89 SAS_OOB_MODE 89 SAS_OOB_MODE
90}; 90};
91 91
92/* See sas_discover.c if you plan on changing these. 92/* See sas_discover.c if you plan on changing these */
93 */
94enum sas_dev_type { 93enum sas_dev_type {
95 NO_DEVICE = 0, /* protocol */ 94 NO_DEVICE = 0, /* protocol */
96 SAS_END_DEV = 1, /* protocol */ 95 SAS_END_DEV = 1, /* protocol */
@@ -100,6 +99,7 @@ enum sas_dev_type {
100 SATA_DEV = 5, 99 SATA_DEV = 5,
101 SATA_PM = 7, 100 SATA_PM = 7,
102 SATA_PM_PORT= 8, 101 SATA_PM_PORT= 8,
102 SATA_PENDING = 9,
103}; 103};
104 104
105enum sas_protocol { 105enum sas_protocol {
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index 9c159f74c6d0..cdccd2eb7b6c 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -32,19 +32,19 @@
32 32
33static inline int dev_is_sata(struct domain_device *dev) 33static inline int dev_is_sata(struct domain_device *dev)
34{ 34{
35 return (dev->rphy->identify.target_port_protocols & SAS_PROTOCOL_SATA); 35 return dev->dev_type == SATA_DEV || dev->dev_type == SATA_PM ||
36 dev->dev_type == SATA_PM_PORT || dev->dev_type == SATA_PENDING;
36} 37}
37 38
38int sas_ata_init_host_and_port(struct domain_device *found_dev, 39int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy);
39 struct scsi_target *starget); 40int sas_ata_init_host_and_port(struct domain_device *found_dev);
40
41void sas_ata_task_abort(struct sas_task *task); 41void sas_ata_task_abort(struct sas_task *task);
42void sas_ata_strategy_handler(struct Scsi_Host *shost); 42void sas_ata_strategy_handler(struct Scsi_Host *shost);
43int sas_ata_timed_out(struct scsi_cmnd *cmd, struct sas_task *task, 43void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
44 enum blk_eh_timer_return *rtn); 44 struct list_head *done_q);
45int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, 45void sas_ata_schedule_reset(struct domain_device *dev);
46 struct list_head *done_q); 46void sas_ata_wait_eh(struct domain_device *dev);
47 47void sas_probe_sata(struct asd_sas_port *port);
48#else 48#else
49 49
50 50
@@ -52,8 +52,7 @@ static inline int dev_is_sata(struct domain_device *dev)
52{ 52{
53 return 0; 53 return 0;
54} 54}
55static inline int sas_ata_init_host_and_port(struct domain_device *found_dev, 55static inline int sas_ata_init_host_and_port(struct domain_device *found_dev)
56 struct scsi_target *starget)
57{ 56{
58 return 0; 57 return 0;
59} 58}
@@ -65,18 +64,27 @@ static inline void sas_ata_strategy_handler(struct Scsi_Host *shost)
65{ 64{
66} 65}
67 66
68static inline int sas_ata_timed_out(struct scsi_cmnd *cmd, 67static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
69 struct sas_task *task, 68 struct list_head *done_q)
70 enum blk_eh_timer_return *rtn)
71{ 69{
72 return 0;
73} 70}
74static inline int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, 71
75 struct list_head *done_q) 72static inline void sas_ata_schedule_reset(struct domain_device *dev)
73{
74}
75
76static inline void sas_ata_wait_eh(struct domain_device *dev)
77{
78}
79
80static inline void sas_probe_sata(struct asd_sas_port *port)
76{ 81{
77 return 0;
78} 82}
79 83
84static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
85{
86 return 0;
87}
80#endif 88#endif
81 89
82#endif /* _SAS_ATA_H_ */ 90#endif /* _SAS_ATA_H_ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 8001ae4cd7ba..f34a5a87af38 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -143,6 +143,7 @@ struct scsi_cmnd;
143#define READ_ATTRIBUTE 0x8c 143#define READ_ATTRIBUTE 0x8c
144#define WRITE_ATTRIBUTE 0x8d 144#define WRITE_ATTRIBUTE 0x8d
145#define VERIFY_16 0x8f 145#define VERIFY_16 0x8f
146#define SYNCHRONIZE_CACHE_16 0x91
146#define WRITE_SAME_16 0x93 147#define WRITE_SAME_16 0x93
147#define SERVICE_ACTION_IN 0x9e 148#define SERVICE_ACTION_IN 0x9e
148/* values for service action in */ 149/* values for service action in */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index a5e885a111df..377df4a28512 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -10,6 +10,7 @@
10 10
11struct Scsi_Host; 11struct Scsi_Host;
12struct scsi_device; 12struct scsi_device;
13struct scsi_driver;
13 14
14/* 15/*
15 * MAX_COMMAND_SIZE is: 16 * MAX_COMMAND_SIZE is:
@@ -131,6 +132,11 @@ struct scsi_cmnd {
131 unsigned char tag; /* SCSI-II queued command tag */ 132 unsigned char tag; /* SCSI-II queued command tag */
132}; 133};
133 134
135static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
136{
137 return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
138}
139
134extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 140extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
135extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t); 141extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
136extern void scsi_put_command(struct scsi_cmnd *); 142extern void scsi_put_command(struct scsi_cmnd *);
@@ -289,17 +295,17 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd)
289 295
290static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) 296static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
291{ 297{
292 cmd->result |= status << 8; 298 cmd->result = (cmd->result & 0xffff00ff) | (status << 8);
293} 299}
294 300
295static inline void set_host_byte(struct scsi_cmnd *cmd, char status) 301static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
296{ 302{
297 cmd->result |= status << 16; 303 cmd->result = (cmd->result & 0xff00ffff) | (status << 16);
298} 304}
299 305
300static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) 306static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
301{ 307{
302 cmd->result |= status << 24; 308 cmd->result = (cmd->result & 0x00ffffff) | (status << 24);
303} 309}
304 310
305#endif /* _SCSI_SCSI_CMND_H */ 311#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index b3a1c2daf6cc..6efb2e1416e0 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_driver.h b/include/scsi/scsi_driver.h
index 9fd6702f02e2..d443aa06a722 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -16,6 +16,7 @@ struct scsi_driver {
16 16
17 void (*rescan)(struct device *); 17 void (*rescan)(struct device *);
18 int (*done)(struct scsi_cmnd *); 18 int (*done)(struct scsi_cmnd *);
19 int (*eh_action)(struct scsi_cmnd *, unsigned char *, int, int);
19}; 20};
20#define to_scsi_driver(drv) \ 21#define to_scsi_driver(drv) \
21 container_of((drv), struct scsi_driver, gendrv) 22 container_of((drv), struct scsi_driver, gendrv)
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 58ce8fe44783..5cb20ccb1956 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 0de32cd4e8a7..af244f4bba53 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/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 2a65167a8f10..719faf1863ad 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -126,8 +126,8 @@ enum fc_vport_state {
126 incapable of reporting */ 126 incapable of reporting */
127#define FC_PORTSPEED_1GBIT 1 127#define FC_PORTSPEED_1GBIT 1
128#define FC_PORTSPEED_2GBIT 2 128#define FC_PORTSPEED_2GBIT 2
129#define FC_PORTSPEED_4GBIT 4 129#define FC_PORTSPEED_10GBIT 4
130#define FC_PORTSPEED_10GBIT 8 130#define FC_PORTSPEED_4GBIT 8
131#define FC_PORTSPEED_8GBIT 0x10 131#define FC_PORTSPEED_8GBIT 0x10
132#define FC_PORTSPEED_16GBIT 0x20 132#define FC_PORTSPEED_16GBIT 0x20
133#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ 133#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */
@@ -486,6 +486,13 @@ struct fc_host_attrs {
486 u32 maxframe_size; 486 u32 maxframe_size;
487 u16 max_npiv_vports; 487 u16 max_npiv_vports;
488 char serial_number[FC_SERIAL_NUMBER_SIZE]; 488 char serial_number[FC_SERIAL_NUMBER_SIZE];
489 char manufacturer[FC_SERIAL_NUMBER_SIZE];
490 char model[FC_SYMBOLIC_NAME_SIZE];
491 char model_description[FC_SYMBOLIC_NAME_SIZE];
492 char hardware_version[FC_VERSION_STRING_SIZE];
493 char driver_version[FC_VERSION_STRING_SIZE];
494 char firmware_version[FC_VERSION_STRING_SIZE];
495 char optionrom_version[FC_VERSION_STRING_SIZE];
489 496
490 /* Dynamic Attributes */ 497 /* Dynamic Attributes */
491 u32 port_id; 498 u32 port_id;
@@ -541,6 +548,20 @@ struct fc_host_attrs {
541 (((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports) 548 (((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports)
542#define fc_host_serial_number(x) \ 549#define fc_host_serial_number(x) \
543 (((struct fc_host_attrs *)(x)->shost_data)->serial_number) 550 (((struct fc_host_attrs *)(x)->shost_data)->serial_number)
551#define fc_host_manufacturer(x) \
552 (((struct fc_host_attrs *)(x)->shost_data)->manufacturer)
553#define fc_host_model(x) \
554 (((struct fc_host_attrs *)(x)->shost_data)->model)
555#define fc_host_model_description(x) \
556 (((struct fc_host_attrs *)(x)->shost_data)->model_description)
557#define fc_host_hardware_version(x) \
558 (((struct fc_host_attrs *)(x)->shost_data)->hardware_version)
559#define fc_host_driver_version(x) \
560 (((struct fc_host_attrs *)(x)->shost_data)->driver_version)
561#define fc_host_firmware_version(x) \
562 (((struct fc_host_attrs *)(x)->shost_data)->firmware_version)
563#define fc_host_optionrom_version(x) \
564 (((struct fc_host_attrs *)(x)->shost_data)->optionrom_version)
544#define fc_host_port_id(x) \ 565#define fc_host_port_id(x) \
545 (((struct fc_host_attrs *)(x)->shost_data)->port_id) 566 (((struct fc_host_attrs *)(x)->shost_data)->port_id)
546#define fc_host_port_type(x) \ 567#define fc_host_port_type(x) \
@@ -700,6 +721,13 @@ struct fc_function_template {
700 unsigned long show_host_supported_speeds:1; 721 unsigned long show_host_supported_speeds:1;
701 unsigned long show_host_maxframe_size:1; 722 unsigned long show_host_maxframe_size:1;
702 unsigned long show_host_serial_number:1; 723 unsigned long show_host_serial_number:1;
724 unsigned long show_host_manufacturer:1;
725 unsigned long show_host_model:1;
726 unsigned long show_host_model_description:1;
727 unsigned long show_host_hardware_version:1;
728 unsigned long show_host_driver_version:1;
729 unsigned long show_host_firmware_version:1;
730 unsigned long show_host_optionrom_version:1;
703 /* host dynamic attributes */ 731 /* host dynamic attributes */
704 unsigned long show_host_port_id:1; 732 unsigned long show_host_port_id:1;
705 unsigned long show_host_port_type:1; 733 unsigned long show_host_port_type:1;
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 2c3a46d102fd..53f0b361d668 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -144,6 +144,12 @@ struct iscsi_transport {
144 int param, char *buf); 144 int param, char *buf);
145 umode_t (*attr_is_visible)(int param_type, int param); 145 umode_t (*attr_is_visible)(int param_type, int param);
146 int (*bsg_request)(struct bsg_job *job); 146 int (*bsg_request)(struct bsg_job *job);
147 int (*send_ping) (struct Scsi_Host *shost, uint32_t iface_num,
148 uint32_t iface_type, uint32_t payload_size,
149 uint32_t pid, struct sockaddr *dst_addr);
150 int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx,
151 uint32_t *num_entries, char *buf);
152 int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx);
147}; 153};
148 154
149/* 155/*
@@ -166,6 +172,17 @@ extern int iscsi_offload_mesg(struct Scsi_Host *shost,
166 struct iscsi_transport *transport, uint32_t type, 172 struct iscsi_transport *transport, uint32_t type,
167 char *data, uint16_t data_size); 173 char *data, uint16_t data_size);
168 174
175extern void iscsi_post_host_event(uint32_t host_no,
176 struct iscsi_transport *transport,
177 enum iscsi_host_event_code code,
178 uint32_t data_size,
179 uint8_t *data);
180
181extern void iscsi_ping_comp_event(uint32_t host_no,
182 struct iscsi_transport *transport,
183 uint32_t status, uint32_t pid,
184 uint32_t data_size, uint8_t *data);
185
169struct iscsi_cls_conn { 186struct iscsi_cls_conn {
170 struct list_head conn_list; /* item in connlist */ 187 struct list_head conn_list; /* item in connlist */
171 void *dd_data; /* LLD private data */ 188 void *dd_data; /* LLD private data */
@@ -238,6 +255,8 @@ struct iscsi_cls_host {
238 atomic_t nr_scans; 255 atomic_t nr_scans;
239 struct mutex mutex; 256 struct mutex mutex;
240 struct request_queue *bsg_q; 257 struct request_queue *bsg_q;
258 uint32_t port_speed;
259 uint32_t port_state;
241}; 260};
242 261
243#define iscsi_job_to_shost(_job) \ 262#define iscsi_job_to_shost(_job) \
@@ -307,5 +326,8 @@ extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost,
307 uint32_t iface_num, int dd_size); 326 uint32_t iface_num, int dd_size);
308extern void iscsi_destroy_iface(struct iscsi_iface *iface); 327extern void iscsi_destroy_iface(struct iscsi_iface *iface);
309extern struct iscsi_iface *iscsi_lookup_iface(int handle); 328extern struct iscsi_iface *iscsi_lookup_iface(int handle);
329extern char *iscsi_get_port_speed_name(struct Scsi_Host *shost);
330extern char *iscsi_get_port_state_name(struct Scsi_Host *shost);
331extern int iscsi_is_session_dev(const struct device *dev);
310 332
311#endif 333#endif
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index ffeebc34a4f7..98b3a20a0102 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -75,7 +75,8 @@ struct sas_phy {
75 /* for the list of phys belonging to a port */ 75 /* for the list of phys belonging to a port */
76 struct list_head port_siblings; 76 struct list_head port_siblings;
77 77
78 struct work_struct reset_work; 78 /* available to the lldd */
79 void *hostdata;
79}; 80};
80 81
81#define dev_to_phy(d) \ 82#define dev_to_phy(d) \
@@ -169,6 +170,8 @@ struct sas_function_template {
169 int (*get_bay_identifier)(struct sas_rphy *); 170 int (*get_bay_identifier)(struct sas_rphy *);
170 int (*phy_reset)(struct sas_phy *, int); 171 int (*phy_reset)(struct sas_phy *, int);
171 int (*phy_enable)(struct sas_phy *, int); 172 int (*phy_enable)(struct sas_phy *, int);
173 int (*phy_setup)(struct sas_phy *);
174 void (*phy_release)(struct sas_phy *);
172 int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *); 175 int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *);
173 int (*smp_handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); 176 int (*smp_handler)(struct Scsi_Host *, struct sas_rphy *, struct request *);
174}; 177};
@@ -194,6 +197,7 @@ void sas_rphy_free(struct sas_rphy *);
194extern int sas_rphy_add(struct sas_rphy *); 197extern int sas_rphy_add(struct sas_rphy *);
195extern void sas_rphy_remove(struct sas_rphy *); 198extern void sas_rphy_remove(struct sas_rphy *);
196extern void sas_rphy_delete(struct sas_rphy *); 199extern void sas_rphy_delete(struct sas_rphy *);
200extern void sas_rphy_unlink(struct sas_rphy *);
197extern int scsi_is_sas_rphy(const struct device *); 201extern int scsi_is_sas_rphy(const struct device *);
198 202
199struct sas_port *sas_port_alloc(struct device *, int); 203struct sas_port *sas_port_alloc(struct device *, int);
@@ -205,6 +209,12 @@ void sas_port_add_phy(struct sas_port *, struct sas_phy *);
205void sas_port_delete_phy(struct sas_port *, struct sas_phy *); 209void sas_port_delete_phy(struct sas_port *, struct sas_phy *);
206void sas_port_mark_backlink(struct sas_port *); 210void sas_port_mark_backlink(struct sas_port *);
207int scsi_is_sas_port(const struct device *); 211int scsi_is_sas_port(const struct device *);
212struct sas_phy *sas_port_get_phy(struct sas_port *port);
213static inline void sas_port_put_phy(struct sas_phy *phy)
214{
215 if (phy)
216 put_device(&phy->dev);
217}
208 218
209extern struct scsi_transport_template * 219extern struct scsi_transport_template *
210sas_attach_transport(struct sas_function_template *); 220sas_attach_transport(struct sas_function_template *);
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h
index d97d69f81a7d..da4a456de032 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/control.h b/include/sound/control.h
index b2796e83c7ac..8332e865c759 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -40,7 +40,7 @@ struct snd_kcontrol_new {
40 snd_ctl_elem_iface_t iface; /* interface identifier */ 40 snd_ctl_elem_iface_t iface; /* interface identifier */
41 unsigned int device; /* device/client number */ 41 unsigned int device; /* device/client number */
42 unsigned int subdevice; /* subdevice (substream) number */ 42 unsigned int subdevice; /* subdevice (substream) number */
43 unsigned char *name; /* ASCII name of item */ 43 const unsigned char *name; /* ASCII name of item */
44 unsigned int index; /* index of item */ 44 unsigned int index; /* index of item */
45 unsigned int access; /* access rights */ 45 unsigned int access; /* access rights */
46 unsigned int count; /* count of same elements */ 46 unsigned int count; /* count of same elements */
@@ -227,6 +227,11 @@ snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
227 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); 227 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
228} 228}
229 229
230int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl,
231 void (*hook)(void *private_data, int),
232 void *private_data);
233void snd_ctl_sync_vmaster_hook(struct snd_kcontrol *kctl);
234
230/* 235/*
231 * Helper functions for jack-detection controls 236 * Helper functions for jack-detection controls
232 */ 237 */
diff --git a/include/sound/core.h b/include/sound/core.h
index cea1b5426dfa..b6e0f57d451d 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/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
new file mode 100644
index 000000000000..a8fcaa6d531f
--- /dev/null
+++ b/include/sound/dmaengine_pcm.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2012, Analog Devices Inc.
3 * Author: Lars-Peter Clausen <lars@metafoo.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15#ifndef __SOUND_DMAENGINE_PCM_H__
16#define __SOUND_DMAENGINE_PCM_H__
17
18#include <sound/pcm.h>
19#include <linux/dmaengine.h>
20
21/**
22 * snd_pcm_substream_to_dma_direction - Get dma_transfer_direction for a PCM
23 * substream
24 * @substream: PCM substream
25 */
26static inline enum dma_transfer_direction
27snd_pcm_substream_to_dma_direction(const struct snd_pcm_substream *substream)
28{
29 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
30 return DMA_MEM_TO_DEV;
31 else
32 return DMA_DEV_TO_MEM;
33}
34
35void snd_dmaengine_pcm_set_data(struct snd_pcm_substream *substream, void *data);
36void *snd_dmaengine_pcm_get_data(struct snd_pcm_substream *substream);
37
38int snd_hwparams_to_dma_slave_config(const struct snd_pcm_substream *substream,
39 const struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config);
40int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
41snd_pcm_uframes_t snd_dmaengine_pcm_pointer(struct snd_pcm_substream *substream);
42
43int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
44 dma_filter_fn filter_fn, void *filter_data);
45int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream);
46
47struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream);
48
49#endif
diff --git a/include/sound/jack.h b/include/sound/jack.h
index 63c790742db4..58916573db58 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -53,6 +53,9 @@ enum snd_jack_types {
53 SND_JACK_BTN_5 = 0x0200, 53 SND_JACK_BTN_5 = 0x0200,
54}; 54};
55 55
56/* Keep in sync with definitions above */
57#define SND_JACK_SWITCH_TYPES 6
58
56struct snd_jack { 59struct snd_jack {
57 struct input_dev *input_dev; 60 struct input_dev *input_dev;
58 int registered; 61 int registered;
diff --git a/include/sound/max9768.h b/include/sound/max9768.h
new file mode 100644
index 000000000000..0f78b41d030e
--- /dev/null
+++ b/include/sound/max9768.h
@@ -0,0 +1,24 @@
1/*
2 * Platform data for MAX9768
3 * Copyright (C) 2011, 2012 by Wolfram Sang, Pengutronix e.K.
4 * same licence as the driver
5 */
6
7#ifndef __SOUND_MAX9768_PDATA_H__
8#define __SOUND_MAX9768_PDATA_H__
9
10/**
11 * struct max9768_pdata - optional platform specific MAX9768 configuration
12 * @shdn_gpio: GPIO to SHDN pin. If not valid, pin must be hardwired HIGH
13 * @mute_gpio: GPIO to MUTE pin. If not valid, control for mute won't be added
14 * @flags: configuration flags, e.g. set classic PWM mode (check datasheet
15 * regarding "filterless modulation" which is default).
16 */
17struct max9768_pdata {
18 int shdn_gpio;
19 int mute_gpio;
20 unsigned flags;
21#define MAX9768_FLAG_CLASSIC_PWM (1 << 0)
22};
23
24#endif /* __SOUND_MAX9768_PDATA_H__*/
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 0cf91b2f08ca..0d1112815be3 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -264,7 +264,7 @@ struct snd_pcm_hw_constraint_ratdens {
264 264
265struct snd_pcm_hw_constraint_list { 265struct snd_pcm_hw_constraint_list {
266 unsigned int count; 266 unsigned int count;
267 unsigned int *list; 267 const unsigned int *list;
268 unsigned int mask; 268 unsigned int mask;
269}; 269};
270 270
@@ -454,6 +454,7 @@ struct snd_pcm {
454 void *private_data; 454 void *private_data;
455 void (*private_free) (struct snd_pcm *pcm); 455 void (*private_free) (struct snd_pcm *pcm);
456 struct device *dev; /* actual hw device this belongs to */ 456 struct device *dev; /* actual hw device this belongs to */
457 bool internal; /* pcm is for internal use only */
457#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 458#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
458 struct snd_pcm_oss oss; 459 struct snd_pcm_oss oss;
459#endif 460#endif
@@ -475,6 +476,9 @@ extern const struct file_operations snd_pcm_f_ops[2];
475int snd_pcm_new(struct snd_card *card, const char *id, int device, 476int snd_pcm_new(struct snd_card *card, const char *id, int device,
476 int playback_count, int capture_count, 477 int playback_count, int capture_count,
477 struct snd_pcm **rpcm); 478 struct snd_pcm **rpcm);
479int snd_pcm_new_internal(struct snd_card *card, const char *id, int device,
480 int playback_count, int capture_count,
481 struct snd_pcm **rpcm);
478int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); 482int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
479 483
480int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); 484int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
@@ -781,7 +785,8 @@ void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interva
781 unsigned int k, struct snd_interval *c); 785 unsigned int k, struct snd_interval *c);
782void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, 786void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
783 const struct snd_interval *b, struct snd_interval *c); 787 const struct snd_interval *b, struct snd_interval *c);
784int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask); 788int snd_interval_list(struct snd_interval *i, unsigned int count,
789 const unsigned int *list, unsigned int mask);
785int snd_interval_ratnum(struct snd_interval *i, 790int snd_interval_ratnum(struct snd_interval *i,
786 unsigned int rats_count, struct snd_ratnum *rats, 791 unsigned int rats_count, struct snd_ratnum *rats,
787 unsigned int *nump, unsigned int *denp); 792 unsigned int *nump, unsigned int *denp);
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index 9b1aacaa82fe..b457e87fbd08 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -72,10 +72,16 @@
72#define SH_FSI_BPFMD_32 (5 << 4) 72#define SH_FSI_BPFMD_32 (5 << 4)
73#define SH_FSI_BPFMD_16 (6 << 4) 73#define SH_FSI_BPFMD_16 (6 << 4)
74 74
75struct sh_fsi_port_info {
76 unsigned long flags;
77 int tx_id;
78 int rx_id;
79 int (*set_rate)(struct device *dev, int rate, int enable);
80};
81
75struct sh_fsi_platform_info { 82struct sh_fsi_platform_info {
76 unsigned long porta_flags; 83 struct sh_fsi_port_info port_a;
77 unsigned long portb_flags; 84 struct sh_fsi_port_info port_b;
78 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable);
79}; 85};
80 86
81/* 87/*
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 2413acc54883..c429f248cf4e 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -17,6 +17,7 @@
17#include <linux/list.h> 17#include <linux/list.h>
18 18
19struct snd_pcm_substream; 19struct snd_pcm_substream;
20struct snd_soc_dapm_widget;
20 21
21/* 22/*
22 * DAI hardware audio formats. 23 * DAI hardware audio formats.
@@ -238,6 +239,9 @@ struct snd_soc_dai {
238 unsigned char pop_wait:1; 239 unsigned char pop_wait:1;
239 unsigned char probed:1; 240 unsigned char probed:1;
240 241
242 struct snd_soc_dapm_widget *playback_widget;
243 struct snd_soc_dapm_widget *capture_widget;
244
241 /* DAI DMA data */ 245 /* DAI DMA data */
242 void *playback_dma_data; 246 void *playback_dma_data;
243 void *capture_dma_data; 247 void *capture_dma_data;
@@ -246,10 +250,9 @@ struct snd_soc_dai {
246 unsigned int rate; 250 unsigned int rate;
247 251
248 /* parent platform/codec */ 252 /* parent platform/codec */
249 union { 253 struct snd_soc_platform *platform;
250 struct snd_soc_platform *platform; 254 struct snd_soc_codec *codec;
251 struct snd_soc_codec *codec; 255
252 };
253 struct snd_soc_card *card; 256 struct snd_soc_card *card;
254 257
255 struct list_head list; 258 struct list_head list;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index d26a9b784772..8da3c2409060 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
@@ -243,6 +244,10 @@
243{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ 244{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \
244 .shift = wshift, .invert = winvert, .event = wevent, \ 245 .shift = wshift, .invert = winvert, .event = wevent, \
245 .event_flags = wflags} 246 .event_flags = wflags}
247#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay) \
248{ .id = snd_soc_dapm_regulator_supply, .name = wname, \
249 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \
250 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD }
246 251
247/* dapm kcontrol types */ 252/* dapm kcontrol types */
248#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ 253#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
@@ -322,6 +327,8 @@ struct snd_soc_dapm_context;
322 327
323int dapm_reg_event(struct snd_soc_dapm_widget *w, 328int dapm_reg_event(struct snd_soc_dapm_widget *w,
324 struct snd_kcontrol *kcontrol, int event); 329 struct snd_kcontrol *kcontrol, int event);
330int dapm_regulator_event(struct snd_soc_dapm_widget *w,
331 struct snd_kcontrol *kcontrol, int event);
325 332
326/* dapm controls */ 333/* dapm controls */
327int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, 334int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
@@ -346,11 +353,12 @@ int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
346 struct snd_ctl_elem_value *uncontrol); 353 struct snd_ctl_elem_value *uncontrol);
347int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, 354int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
348 struct snd_ctl_elem_value *uncontrol); 355 struct snd_ctl_elem_value *uncontrol);
349int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
350 const struct snd_soc_dapm_widget *widget);
351int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, 356int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
352 const struct snd_soc_dapm_widget *widget, 357 const struct snd_soc_dapm_widget *widget,
353 int num); 358 int num);
359int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
360 struct snd_soc_dai *dai);
361int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
354 362
355/* dapm path setup */ 363/* dapm path setup */
356int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); 364int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm);
@@ -361,10 +369,16 @@ int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
361 const struct snd_soc_dapm_route *route, int num); 369 const struct snd_soc_dapm_route *route, int num);
362 370
363/* dapm events */ 371/* dapm events */
364int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, 372int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
365 const char *stream, int event); 373 struct snd_soc_dai *dai, int event);
366void snd_soc_dapm_shutdown(struct snd_soc_card *card); 374void snd_soc_dapm_shutdown(struct snd_soc_card *card);
367 375
376/* external DAPM widget events */
377int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
378 struct snd_kcontrol *kcontrol, int connect);
379int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
380 struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e);
381
368/* dapm sys fs - used by the core */ 382/* dapm sys fs - used by the core */
369int snd_soc_dapm_sys_add(struct device *dev); 383int snd_soc_dapm_sys_add(struct device *dev);
370void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, 384void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
@@ -411,9 +425,11 @@ enum snd_soc_dapm_type {
411 snd_soc_dapm_pre, /* machine specific pre widget - exec first */ 425 snd_soc_dapm_pre, /* machine specific pre widget - exec first */
412 snd_soc_dapm_post, /* machine specific post widget - exec last */ 426 snd_soc_dapm_post, /* machine specific post widget - exec last */
413 snd_soc_dapm_supply, /* power/clock supply */ 427 snd_soc_dapm_supply, /* power/clock supply */
428 snd_soc_dapm_regulator_supply, /* external regulator */
414 snd_soc_dapm_aif_in, /* audio interface input */ 429 snd_soc_dapm_aif_in, /* audio interface input */
415 snd_soc_dapm_aif_out, /* audio interface output */ 430 snd_soc_dapm_aif_out, /* audio interface output */
416 snd_soc_dapm_siggen, /* signal generator */ 431 snd_soc_dapm_siggen, /* signal generator */
432 snd_soc_dapm_dai, /* link to DAI structure */
417}; 433};
418 434
419/* 435/*
@@ -434,8 +450,8 @@ struct snd_soc_dapm_route {
434 450
435/* dapm audio path between two widgets */ 451/* dapm audio path between two widgets */
436struct snd_soc_dapm_path { 452struct snd_soc_dapm_path {
437 char *name; 453 const char *name;
438 char *long_name; 454 const char *long_name;
439 455
440 /* source (input) and sink (output) widgets */ 456 /* source (input) and sink (output) widgets */
441 struct snd_soc_dapm_widget *source; 457 struct snd_soc_dapm_widget *source;
@@ -458,13 +474,15 @@ struct snd_soc_dapm_path {
458/* dapm widget */ 474/* dapm widget */
459struct snd_soc_dapm_widget { 475struct snd_soc_dapm_widget {
460 enum snd_soc_dapm_type id; 476 enum snd_soc_dapm_type id;
461 char *name; /* widget name */ 477 const char *name; /* widget name */
462 char *sname; /* stream name */ 478 const char *sname; /* stream name */
463 struct snd_soc_codec *codec; 479 struct snd_soc_codec *codec;
464 struct snd_soc_platform *platform; 480 struct snd_soc_platform *platform;
465 struct list_head list; 481 struct list_head list;
466 struct snd_soc_dapm_context *dapm; 482 struct snd_soc_dapm_context *dapm;
467 483
484 void *priv; /* widget specific data */
485
468 /* dapm control */ 486 /* dapm control */
469 short reg; /* negative reg = no direct dapm */ 487 short reg; /* negative reg = no direct dapm */
470 unsigned char shift; /* bits to shift */ 488 unsigned char shift; /* bits to shift */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0992dff55959..2ebf7877c148 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -185,6 +185,20 @@
185 .rreg = xreg_right, .shift = xshift, \ 185 .rreg = xreg_right, .shift = xshift, \
186 .min = xmin, .max = xmax} } 186 .min = xmin, .max = xmax} }
187 187
188#define SND_SOC_BYTES(xname, xbase, xregs) \
189{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
190 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
191 .put = snd_soc_bytes_put, .private_value = \
192 ((unsigned long)&(struct soc_bytes) \
193 {.base = xbase, .num_regs = xregs }) }
194
195#define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \
196{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
197 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
198 .put = snd_soc_bytes_put, .private_value = \
199 ((unsigned long)&(struct soc_bytes) \
200 {.base = xbase, .num_regs = xregs, \
201 .mask = xmask }) }
188 202
189/* 203/*
190 * Simplified versions of above macros, declaring a struct and calculating 204 * Simplified versions of above macros, declaring a struct and calculating
@@ -366,12 +380,16 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
366 *Controls 380 *Controls
367 */ 381 */
368struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 382struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
369 void *data, char *long_name, 383 void *data, const char *long_name,
370 const char *prefix); 384 const char *prefix);
371int snd_soc_add_controls(struct snd_soc_codec *codec, 385int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
372 const struct snd_kcontrol_new *controls, int num_controls); 386 const struct snd_kcontrol_new *controls, int num_controls);
373int snd_soc_add_platform_controls(struct snd_soc_platform *platform, 387int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
374 const struct snd_kcontrol_new *controls, int num_controls); 388 const struct snd_kcontrol_new *controls, int num_controls);
389int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
390 const struct snd_kcontrol_new *controls, int num_controls);
391int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
392 const struct snd_kcontrol_new *controls, int num_controls);
375int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 393int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
376 struct snd_ctl_elem_info *uinfo); 394 struct snd_ctl_elem_info *uinfo);
377int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, 395int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
@@ -409,6 +427,13 @@ int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
409 struct snd_ctl_elem_value *ucontrol); 427 struct snd_ctl_elem_value *ucontrol);
410int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, 428int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
411 struct snd_ctl_elem_value *ucontrol); 429 struct snd_ctl_elem_value *ucontrol);
430int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
431 struct snd_ctl_elem_info *uinfo);
432int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
433 struct snd_ctl_elem_value *ucontrol);
434int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_value *ucontrol);
436
412 437
413/** 438/**
414 * struct snd_soc_reg_access - Describes whether a given register is 439 * struct snd_soc_reg_access - Describes whether a given register is
@@ -505,6 +530,7 @@ struct snd_soc_pcm_stream {
505 unsigned int rate_max; /* max rate */ 530 unsigned int rate_max; /* max rate */
506 unsigned int channels_min; /* min channels */ 531 unsigned int channels_min; /* min channels */
507 unsigned int channels_max; /* max channels */ 532 unsigned int channels_max; /* max channels */
533 unsigned int sig_bits; /* number of bits of content */
508}; 534};
509 535
510/* SoC audio ops */ 536/* SoC audio ops */
@@ -559,6 +585,7 @@ struct snd_soc_codec {
559 unsigned int ac97_created:1; /* Codec has been created by SoC */ 585 unsigned int ac97_created:1; /* Codec has been created by SoC */
560 unsigned int sysfs_registered:1; /* codec has been sysfs registered */ 586 unsigned int sysfs_registered:1; /* codec has been sysfs registered */
561 unsigned int cache_init:1; /* codec cache has been initialized */ 587 unsigned int cache_init:1; /* codec cache has been initialized */
588 unsigned int using_regmap:1; /* using regmap access */
562 u32 cache_only; /* Suppress writes to hardware */ 589 u32 cache_only; /* Suppress writes to hardware */
563 u32 cache_sync; /* Cache needs to be synced to hardware */ 590 u32 cache_sync; /* Cache needs to be synced to hardware */
564 591
@@ -637,6 +664,8 @@ struct snd_soc_codec_driver {
637 /* codec stream completion event */ 664 /* codec stream completion event */
638 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); 665 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
639 666
667 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
668
640 /* probe ordering - for components with runtime dependencies */ 669 /* probe ordering - for components with runtime dependencies */
641 int probe_order; 670 int probe_order;
642 int remove_order; 671 int remove_order;
@@ -689,6 +718,7 @@ struct snd_soc_platform {
689 int id; 718 int id;
690 struct device *dev; 719 struct device *dev;
691 struct snd_soc_platform_driver *driver; 720 struct snd_soc_platform_driver *driver;
721 struct mutex mutex;
692 722
693 unsigned int suspended:1; /* platform is suspended */ 723 unsigned int suspended:1; /* platform is suspended */
694 unsigned int probed:1; 724 unsigned int probed:1;
@@ -698,6 +728,11 @@ struct snd_soc_platform {
698 struct list_head card_list; 728 struct list_head card_list;
699 729
700 struct snd_soc_dapm_context dapm; 730 struct snd_soc_dapm_context dapm;
731
732#ifdef CONFIG_DEBUG_FS
733 struct dentry *debugfs_platform_root;
734 struct dentry *debugfs_dapm;
735#endif
701}; 736};
702 737
703struct snd_soc_dai_link { 738struct snd_soc_dai_link {
@@ -875,6 +910,12 @@ struct soc_mixer_control {
875 unsigned int reg, rreg, shift, rshift, invert; 910 unsigned int reg, rreg, shift, rshift, invert;
876}; 911};
877 912
913struct soc_bytes {
914 int base;
915 int num_regs;
916 u32 mask;
917};
918
878/* enumerated kcontrol */ 919/* enumerated kcontrol */
879struct soc_enum { 920struct soc_enum {
880 unsigned short reg; 921 unsigned short reg;
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index 726e94742a5c..ec3f910aa40b 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/sound/version.h b/include/sound/version.h
index 8fc5321e1ecc..cc75024c1089 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.24" 2#define CONFIG_SND_VERSION "1.0.25"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wm2200.h b/include/sound/wm2200.h
new file mode 100644
index 000000000000..79bf55be7ffa
--- /dev/null
+++ b/include/sound/wm2200.h
@@ -0,0 +1,41 @@
1/*
2 * linux/sound/wm2200.h -- Platform data for WM2200
3 *
4 * Copyright 2012 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM2200_H
12#define __LINUX_SND_WM2200_H
13
14#define WM2200_GPIO_SET 0x10000
15
16enum wm2200_in_mode {
17 WM2200_IN_SE = 0,
18 WM2200_IN_DIFF = 1,
19 WM2200_IN_DMIC = 2,
20};
21
22enum wm2200_dmic_sup {
23 WM2200_DMIC_SUP_MICVDD = 0,
24 WM2200_DMIC_SUP_MICBIAS1 = 1,
25 WM2200_DMIC_SUP_MICBIAS2 = 2,
26};
27
28struct wm2200_pdata {
29 int reset; /** GPIO controlling /RESET, if any */
30 int ldo_ena; /** GPIO controlling LODENA, if any */
31 int irq_flags;
32
33 int gpio_defaults[4];
34
35 enum wm2200_in_mode in_mode[3];
36 enum wm2200_dmic_sup dmic_sup[3];
37
38 int micbias_cfg[2]; /** Register value to configure MICBIAS */
39};
40
41#endif
diff --git a/include/sound/wm8962.h b/include/sound/wm8962.h
index 1750bed7c2f6..79e6d427b858 100644
--- a/include/sound/wm8962.h
+++ b/include/sound/wm8962.h
@@ -49,6 +49,12 @@ struct wm8962_pdata {
49 bool irq_active_low; 49 bool irq_active_low;
50 50
51 bool spk_mono; /* Speaker outputs tied together as mono */ 51 bool spk_mono; /* Speaker outputs tied together as mono */
52
53 /**
54 * This flag should be set if one or both IN4 inputs is wired
55 * in a DC measurement configuration.
56 */
57 bool in4_dc_measure;
52}; 58};
53 59
54#endif 60#endif
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index 444cd6ba0ba7..41199664666b 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -366,6 +366,8 @@ struct snd_ymfpci {
366#ifdef CONFIG_PM 366#ifdef CONFIG_PM
367 u32 *saved_regs; 367 u32 *saved_regs;
368 u32 saved_ydsxgr_mode; 368 u32 saved_ydsxgr_mode;
369 u16 saved_dsxg_legacy;
370 u16 saved_dsxg_elegacy;
369#endif 371#endif
370}; 372};
371 373
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index e5e6ff98f0fa..8c9ff1b14396 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -62,4 +62,6 @@ int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
62void *transport_kmap_data_sg(struct se_cmd *); 62void *transport_kmap_data_sg(struct se_cmd *);
63void transport_kunmap_data_sg(struct se_cmd *); 63void transport_kunmap_data_sg(struct se_cmd *);
64 64
65void array_free(void *array, int n);
66
65#endif /* TARGET_CORE_BACKEND_H */ 67#endif /* TARGET_CORE_BACKEND_H */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index dc4e345a0163..aaccc5f5fc9f 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -9,7 +9,7 @@
9#include <net/sock.h> 9#include <net/sock.h>
10#include <net/tcp.h> 10#include <net/tcp.h>
11 11
12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" 12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc2-ml"
13#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION 13#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION
14 14
15/* Maximum Number of LUNs per Target Portal Group */ 15/* Maximum Number of LUNs per Target Portal Group */
@@ -86,6 +86,8 @@
86#define DA_UNMAP_GRANULARITY_DEFAULT 0 86#define DA_UNMAP_GRANULARITY_DEFAULT 0
87/* Default unmap_granularity_alignment */ 87/* Default unmap_granularity_alignment */
88#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 88#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
89/* Default max transfer length */
90#define DA_FABRIC_MAX_SECTORS 8192
89/* Emulation for Direct Page Out */ 91/* Emulation for Direct Page Out */
90#define DA_EMULATE_DPO 0 92#define DA_EMULATE_DPO 0
91/* Emulation for Forced Unit Access WRITEs */ 93/* Emulation for Forced Unit Access WRITEs */
@@ -118,9 +120,9 @@
118/* Queue Algorithm Modifier default for restricted reordering in control mode page */ 120/* Queue Algorithm Modifier default for restricted reordering in control mode page */
119#define DA_EMULATE_REST_REORD 0 121#define DA_EMULATE_REST_REORD 0
120 122
123#define SE_INQUIRY_BUF 512
121#define SE_MODE_PAGE_BUF 512 124#define SE_MODE_PAGE_BUF 512
122 125
123
124/* struct se_hba->hba_flags */ 126/* struct se_hba->hba_flags */
125enum hba_flags_table { 127enum hba_flags_table {
126 HBA_FLAGS_INTERNAL_USE = 0x01, 128 HBA_FLAGS_INTERNAL_USE = 0x01,
@@ -169,7 +171,8 @@ enum se_cmd_flags_table {
169 SCF_EMULATED_TASK_SENSE = 0x00000004, 171 SCF_EMULATED_TASK_SENSE = 0x00000004,
170 SCF_SCSI_DATA_SG_IO_CDB = 0x00000008, 172 SCF_SCSI_DATA_SG_IO_CDB = 0x00000008,
171 SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010, 173 SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010,
172 SCF_SCSI_NON_DATA_CDB = 0x00000040, 174 SCF_SCSI_NON_DATA_CDB = 0x00000020,
175 SCF_SCSI_TMR_CDB = 0x00000040,
173 SCF_SCSI_CDB_EXCEPTION = 0x00000080, 176 SCF_SCSI_CDB_EXCEPTION = 0x00000080,
174 SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, 177 SCF_SCSI_RESERVATION_CONFLICT = 0x00000100,
175 SCF_FUA = 0x00000200, 178 SCF_FUA = 0x00000200,
@@ -183,7 +186,8 @@ enum se_cmd_flags_table {
183 SCF_ALUA_NON_OPTIMIZED = 0x00040000, 186 SCF_ALUA_NON_OPTIMIZED = 0x00040000,
184 SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000, 187 SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000,
185 SCF_UNUSED = 0x00100000, 188 SCF_UNUSED = 0x00100000,
186 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, 189 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00200000,
190 SCF_ACK_KREF = 0x00400000,
187}; 191};
188 192
189/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ 193/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
@@ -474,12 +478,6 @@ struct t10_reservation {
474 struct t10_reservation_ops pr_ops; 478 struct t10_reservation_ops pr_ops;
475}; 479};
476 480
477struct se_queue_req {
478 int state;
479 struct se_cmd *cmd;
480 struct list_head qr_list;
481};
482
483struct se_queue_obj { 481struct se_queue_obj {
484 atomic_t queue_cnt; 482 atomic_t queue_cnt;
485 spinlock_t cmd_queue_lock; 483 spinlock_t cmd_queue_lock;
@@ -504,6 +502,24 @@ struct se_task {
504 struct completion task_stop_comp; 502 struct completion task_stop_comp;
505}; 503};
506 504
505struct se_tmr_req {
506 /* Task Management function to be performed */
507 u8 function;
508 /* Task Management response to send */
509 u8 response;
510 int call_transport;
511 /* Reference to ITT that Task Mgmt should be performed */
512 u32 ref_task_tag;
513 /* 64-bit encoded SAM LUN from $FABRIC_MOD TMR header */
514 u64 ref_task_lun;
515 void *fabric_tmr_ptr;
516 struct se_cmd *task_cmd;
517 struct se_cmd *ref_cmd;
518 struct se_device *tmr_dev;
519 struct se_lun *tmr_lun;
520 struct list_head tmr_list;
521};
522
507struct se_cmd { 523struct se_cmd {
508 /* SAM response code being sent to initiator */ 524 /* SAM response code being sent to initiator */
509 u8 scsi_status; 525 u8 scsi_status;
@@ -555,23 +571,23 @@ struct se_cmd {
555 unsigned char *t_task_cdb; 571 unsigned char *t_task_cdb;
556 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 572 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
557 unsigned long long t_task_lba; 573 unsigned long long t_task_lba;
558 int t_tasks_failed;
559 u32 t_tasks_sg_chained_no; 574 u32 t_tasks_sg_chained_no;
560 atomic_t t_fe_count; 575 atomic_t t_fe_count;
561 atomic_t t_se_count; 576 atomic_t t_se_count;
562 atomic_t t_task_cdbs_left; 577 atomic_t t_task_cdbs_left;
563 atomic_t t_task_cdbs_ex_left; 578 atomic_t t_task_cdbs_ex_left;
564 atomic_t t_task_cdbs_sent; 579 atomic_t t_task_cdbs_sent;
565 atomic_t t_transport_aborted; 580 unsigned int transport_state;
566 atomic_t t_transport_active; 581#define CMD_T_ABORTED (1 << 0)
567 atomic_t t_transport_complete; 582#define CMD_T_ACTIVE (1 << 1)
568 atomic_t t_transport_queue_active; 583#define CMD_T_COMPLETE (1 << 2)
569 atomic_t t_transport_sent; 584#define CMD_T_QUEUED (1 << 3)
570 atomic_t t_transport_stop; 585#define CMD_T_SENT (1 << 4)
571 atomic_t transport_dev_active; 586#define CMD_T_STOP (1 << 5)
572 atomic_t transport_lun_active; 587#define CMD_T_FAILED (1 << 6)
573 atomic_t transport_lun_fe_stop; 588#define CMD_T_LUN_STOP (1 << 7)
574 atomic_t transport_lun_stop; 589#define CMD_T_LUN_FE_STOP (1 << 8)
590#define CMD_T_DEV_ACTIVE (1 << 9)
575 spinlock_t t_state_lock; 591 spinlock_t t_state_lock;
576 struct completion t_transport_stop_comp; 592 struct completion t_transport_stop_comp;
577 struct completion transport_lun_fe_stop_comp; 593 struct completion transport_lun_fe_stop_comp;
@@ -592,24 +608,6 @@ struct se_cmd {
592 608
593}; 609};
594 610
595struct se_tmr_req {
596 /* Task Management function to be preformed */
597 u8 function;
598 /* Task Management response to send */
599 u8 response;
600 int call_transport;
601 /* Reference to ITT that Task Mgmt should be preformed */
602 u32 ref_task_tag;
603 /* 64-bit encoded SAM LUN from $FABRIC_MOD TMR header */
604 u64 ref_task_lun;
605 void *fabric_tmr_ptr;
606 struct se_cmd *task_cmd;
607 struct se_cmd *ref_cmd;
608 struct se_device *tmr_dev;
609 struct se_lun *tmr_lun;
610 struct list_head tmr_list;
611};
612
613struct se_ua { 611struct se_ua {
614 u8 ua_asc; 612 u8 ua_asc;
615 u8 ua_ascq; 613 u8 ua_ascq;
@@ -622,6 +620,7 @@ struct se_node_acl {
622 char initiatorname[TRANSPORT_IQN_LEN]; 620 char initiatorname[TRANSPORT_IQN_LEN];
623 /* Used to signal demo mode created ACL, disabled by default */ 621 /* Used to signal demo mode created ACL, disabled by default */
624 bool dynamic_node_acl; 622 bool dynamic_node_acl;
623 bool acl_stop:1;
625 u32 queue_depth; 624 u32 queue_depth;
626 u32 acl_index; 625 u32 acl_index;
627 u64 num_cmds; 626 u64 num_cmds;
@@ -630,7 +629,7 @@ struct se_node_acl {
630 spinlock_t stats_lock; 629 spinlock_t stats_lock;
631 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ 630 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */
632 atomic_t acl_pr_ref_count; 631 atomic_t acl_pr_ref_count;
633 struct se_dev_entry *device_list; 632 struct se_dev_entry **device_list;
634 struct se_session *nacl_sess; 633 struct se_session *nacl_sess;
635 struct se_portal_group *se_tpg; 634 struct se_portal_group *se_tpg;
636 spinlock_t device_list_lock; 635 spinlock_t device_list_lock;
@@ -643,6 +642,8 @@ struct se_node_acl {
643 struct config_group *acl_default_groups[5]; 642 struct config_group *acl_default_groups[5];
644 struct list_head acl_list; 643 struct list_head acl_list;
645 struct list_head acl_sess_list; 644 struct list_head acl_sess_list;
645 struct completion acl_free_comp;
646 struct kref acl_kref;
646}; 647};
647 648
648struct se_session { 649struct se_session {
@@ -656,6 +657,7 @@ struct se_session {
656 struct list_head sess_cmd_list; 657 struct list_head sess_cmd_list;
657 struct list_head sess_wait_list; 658 struct list_head sess_wait_list;
658 spinlock_t sess_cmd_lock; 659 spinlock_t sess_cmd_lock;
660 struct kref sess_kref;
659}; 661};
660 662
661struct se_device; 663struct se_device;
@@ -730,6 +732,7 @@ struct se_dev_attrib {
730 u32 block_size; 732 u32 block_size;
731 u32 hw_max_sectors; 733 u32 hw_max_sectors;
732 u32 max_sectors; 734 u32 max_sectors;
735 u32 fabric_max_sectors;
733 u32 optimal_sectors; 736 u32 optimal_sectors;
734 u32 hw_queue_depth; 737 u32 hw_queue_depth;
735 u32 queue_depth; 738 u32 queue_depth;
@@ -931,7 +934,7 @@ struct se_portal_group {
931 struct list_head se_tpg_node; 934 struct list_head se_tpg_node;
932 /* linked list for initiator ACL list */ 935 /* linked list for initiator ACL list */
933 struct list_head acl_node_list; 936 struct list_head acl_node_list;
934 struct se_lun *tpg_lun_list; 937 struct se_lun **tpg_lun_list;
935 struct se_lun tpg_virt_lun0; 938 struct se_lun tpg_virt_lun0;
936 /* List of TCM sessions associated wth this TPG */ 939 /* List of TCM sessions associated wth this TPG */
937 struct list_head tpg_sess_list; 940 struct list_head tpg_sess_list;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index d36fad317e78..10c690809601 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -58,9 +58,6 @@ struct target_core_fabric_ops {
58 */ 58 */
59 int (*shutdown_session)(struct se_session *); 59 int (*shutdown_session)(struct se_session *);
60 void (*close_session)(struct se_session *); 60 void (*close_session)(struct se_session *);
61 void (*stop_session)(struct se_session *, int, int);
62 void (*fall_back_to_erl0)(struct se_session *);
63 int (*sess_logged_in)(struct se_session *);
64 u32 (*sess_get_index)(struct se_session *); 61 u32 (*sess_get_index)(struct se_session *);
65 /* 62 /*
66 * Used only for SCSI fabrics that contain multi-value TransportIDs 63 * Used only for SCSI fabrics that contain multi-value TransportIDs
@@ -78,7 +75,6 @@ struct target_core_fabric_ops {
78 int (*queue_tm_rsp)(struct se_cmd *); 75 int (*queue_tm_rsp)(struct se_cmd *);
79 u16 (*set_fabric_sense_len)(struct se_cmd *, u32); 76 u16 (*set_fabric_sense_len)(struct se_cmd *, u32);
80 u16 (*get_fabric_sense_len)(void); 77 u16 (*get_fabric_sense_len)(void);
81 int (*is_state_remove)(struct se_cmd *);
82 /* 78 /*
83 * fabric module calls for target_core_fabric_configfs.c 79 * fabric module calls for target_core_fabric_configfs.c
84 */ 80 */
@@ -105,7 +101,10 @@ void __transport_register_session(struct se_portal_group *,
105 struct se_node_acl *, struct se_session *, void *); 101 struct se_node_acl *, struct se_session *, void *);
106void transport_register_session(struct se_portal_group *, 102void transport_register_session(struct se_portal_group *,
107 struct se_node_acl *, struct se_session *, void *); 103 struct se_node_acl *, struct se_session *, void *);
104void target_get_session(struct se_session *);
105int target_put_session(struct se_session *);
108void transport_free_session(struct se_session *); 106void transport_free_session(struct se_session *);
107void target_put_nacl(struct se_node_acl *);
109void transport_deregister_session_configfs(struct se_session *); 108void transport_deregister_session_configfs(struct se_session *);
110void transport_deregister_session(struct se_session *); 109void transport_deregister_session(struct se_session *);
111 110
@@ -116,6 +115,10 @@ int transport_lookup_cmd_lun(struct se_cmd *, u32);
116int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 115int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
117void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 116void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
118 unsigned char *, u32, u32, int, int, int); 117 unsigned char *, u32, u32, int, int, int);
118int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
119 unsigned char *sense, u32 unpacked_lun,
120 void *fabric_tmr_ptr, unsigned char tm_type,
121 gfp_t, unsigned int, int);
119int transport_handle_cdb_direct(struct se_cmd *); 122int transport_handle_cdb_direct(struct se_cmd *);
120int transport_generic_handle_cdb_map(struct se_cmd *); 123int transport_generic_handle_cdb_map(struct se_cmd *);
121int transport_generic_handle_data(struct se_cmd *); 124int transport_generic_handle_data(struct se_cmd *);
@@ -139,9 +142,10 @@ void target_wait_for_sess_cmds(struct se_session *, int);
139 142
140int core_alua_check_nonop_delay(struct se_cmd *); 143int core_alua_check_nonop_delay(struct se_cmd *);
141 144
142struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); 145int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
143void core_tmr_release_req(struct se_tmr_req *); 146void core_tmr_release_req(struct se_tmr_req *);
144int transport_generic_handle_tmr(struct se_cmd *); 147int transport_generic_handle_tmr(struct se_cmd *);
148void transport_generic_request_failure(struct se_cmd *);
145int transport_lookup_tmr_lun(struct se_cmd *, u32); 149int transport_lookup_tmr_lun(struct se_cmd *, u32);
146 150
147struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, 151struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *,
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 75964412ddbb..127993dbf322 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -81,6 +81,13 @@ DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
81 TP_ARGS(journal, commit_transaction) 81 TP_ARGS(journal, commit_transaction)
82); 82);
83 83
84DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,
85
86 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
87
88 TP_ARGS(journal, commit_transaction)
89);
90
84TRACE_EVENT(jbd2_end_commit, 91TRACE_EVENT(jbd2_end_commit,
85 TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 92 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
86 93
@@ -200,7 +207,7 @@ TRACE_EVENT(jbd2_checkpoint_stats,
200 __entry->forced_to_close, __entry->written, __entry->dropped) 207 __entry->forced_to_close, __entry->written, __entry->dropped)
201); 208);
202 209
203TRACE_EVENT(jbd2_cleanup_journal_tail, 210TRACE_EVENT(jbd2_update_log_tail,
204 211
205 TP_PROTO(journal_t *journal, tid_t first_tid, 212 TP_PROTO(journal_t *journal, tid_t first_tid,
206 unsigned long block_nr, unsigned long freed), 213 unsigned long block_nr, unsigned long freed),
@@ -229,6 +236,26 @@ TRACE_EVENT(jbd2_cleanup_journal_tail,
229 __entry->block_nr, __entry->freed) 236 __entry->block_nr, __entry->freed)
230); 237);
231 238
239TRACE_EVENT(jbd2_write_superblock,
240
241 TP_PROTO(journal_t *journal, int write_op),
242
243 TP_ARGS(journal, write_op),
244
245 TP_STRUCT__entry(
246 __field( dev_t, dev )
247 __field( int, write_op )
248 ),
249
250 TP_fast_assign(
251 __entry->dev = journal->j_fs_dev->bd_dev;
252 __entry->write_op = write_op;
253 ),
254
255 TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
256 MINOR(__entry->dev), __entry->write_op)
257);
258
232#endif /* _TRACE_JBD2_H */ 259#endif /* _TRACE_JBD2_H */
233 260
234/* This part must be outside protection */ 261/* This part must be outside protection */
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h
index 12fbf43524e9..41a7dbd570e2 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 d62c558bf64b..33f85b68c22c 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 000000000000..43be87d5dd58
--- /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 5973410e8f8c..7b81887b023f 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 000000000000..8847a9d6dd42
--- /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 000000000000..772c770535f1
--- /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 000000000000..4ab409653785
--- /dev/null
+++ b/include/video/sa1100fb.h
@@ -0,0 +1,63 @@
1/*
2 * StrongARM 1100 LCD Controller Frame Buffer Device
3 *
4 * Copyright (C) 1999 Eric A. Thomas
5 * Based on acornfb.c Copyright (C) Russell King.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive
9 * for more details.
10 */
11#ifndef _VIDEO_SA1100FB_H
12#define _VIDEO_SA1100FB_H
13
14#include <linux/fb.h>
15#include <linux/types.h>
16
17#define RGB_4 0
18#define RGB_8 1
19#define RGB_16 2
20#define NR_RGB 3
21
22/* These are the bitfields for each display depth that we support. */
23struct sa1100fb_rgb {
24 struct fb_bitfield red;
25 struct fb_bitfield green;
26 struct fb_bitfield blue;
27 struct fb_bitfield transp;
28};
29
30/* This structure describes the machine which we are running on. */
31struct sa1100fb_mach_info {
32 u_long pixclock;
33
34 u_short xres;
35 u_short yres;
36
37 u_char bpp;
38 u_char hsync_len;
39 u_char left_margin;
40 u_char right_margin;
41
42 u_char vsync_len;
43 u_char upper_margin;
44 u_char lower_margin;
45 u_char sync;
46
47 u_int cmap_greyscale:1,
48 cmap_inverse:1,
49 cmap_static:1,
50 unused:29;
51
52 u_int lccr0;
53 u_int lccr3;
54
55 /* Overrides for the default RGB maps */
56 const struct sa1100fb_rgb *rgb[NR_RGB];
57
58 void (*backlight_power)(int);
59 void (*lcd_power)(int);
60 void (*set_visual)(u32);
61};
62
63#endif
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 434d56b4a1a5..06c67fbc4eee 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 b56932927d0a..728f9de9c258 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 fe30b759c51e..7571b27a0ba1 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 af602d602b28..29b2fd3b147e 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 c41f308c9636..f9466fa54ba4 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/hvm/params.h b/include/xen/interface/hvm/params.h
index 1888d8c157e6..1b4f923d7086 100644
--- a/include/xen/interface/hvm/params.h
+++ b/include/xen/interface/hvm/params.h
@@ -90,6 +90,10 @@
90/* Boolean: Enable aligning all periodic vpts to reduce interrupts */ 90/* Boolean: Enable aligning all periodic vpts to reduce interrupts */
91#define HVM_PARAM_VPT_ALIGN 16 91#define HVM_PARAM_VPT_ALIGN 16
92 92
93#define HVM_NR_PARAMS 17 93/* Console debug shared memory ring and event channel */
94#define HVM_PARAM_CONSOLE_PFN 17
95#define HVM_PARAM_CONSOLE_EVTCHN 18
96
97#define HVM_NR_PARAMS 19
94 98
95#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ 99#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index c1080d9c705d..9ce788d8cf49 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 */
@@ -145,6 +166,13 @@ struct physdev_manage_pci {
145 uint8_t devfn; 166 uint8_t devfn;
146}; 167};
147 168
169#define PHYSDEVOP_restore_msi 19
170struct physdev_restore_msi {
171 /* IN */
172 uint8_t bus;
173 uint8_t devfn;
174};
175
148#define PHYSDEVOP_manage_pci_add_ext 20 176#define PHYSDEVOP_manage_pci_add_ext 20
149struct physdev_manage_pci_ext { 177struct physdev_manage_pci_ext {
150 /* IN */ 178 /* IN */
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c1684680431b..486653f0dd8f 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -200,7 +200,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t);
200#define XEN_PM_CX 0 200#define XEN_PM_CX 0
201#define XEN_PM_PX 1 201#define XEN_PM_PX 1
202#define XEN_PM_TX 2 202#define XEN_PM_TX 2
203 203#define XEN_PM_PDC 3
204/* Px sub info type */ 204/* Px sub info type */
205#define XEN_PX_PCT 1 205#define XEN_PX_PCT 1
206#define XEN_PX_PSS 2 206#define XEN_PX_PSS 2
@@ -293,10 +293,27 @@ struct xenpf_set_processor_pminfo {
293 union { 293 union {
294 struct xen_processor_power power;/* Cx: _CST/_CSD */ 294 struct xen_processor_power power;/* Cx: _CST/_CSD */
295 struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ 295 struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */
296 GUEST_HANDLE(uint32_t) pdc;
296 }; 297 };
297}; 298};
298DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo); 299DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo);
299 300
301#define XENPF_get_cpuinfo 55
302struct xenpf_pcpuinfo {
303 /* IN */
304 uint32_t xen_cpuid;
305 /* OUT */
306 /* The maxium cpu_id that is present */
307 uint32_t max_present;
308#define XEN_PCPU_FLAGS_ONLINE 1
309 /* Correponding xen_cpuid is not present*/
310#define XEN_PCPU_FLAGS_INVALID 2
311 uint32_t flags;
312 uint32_t apic_id;
313 uint32_t acpi_id;
314};
315DEFINE_GUEST_HANDLE_STRUCT(xenpf_pcpuinfo);
316
300struct xen_platform_op { 317struct xen_platform_op {
301 uint32_t cmd; 318 uint32_t cmd;
302 uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ 319 uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -312,6 +329,7 @@ struct xen_platform_op {
312 struct xenpf_change_freq change_freq; 329 struct xenpf_change_freq change_freq;
313 struct xenpf_getidletime getidletime; 330 struct xenpf_getidletime getidletime;
314 struct xenpf_set_processor_pminfo set_pminfo; 331 struct xenpf_set_processor_pminfo set_pminfo;
332 struct xenpf_pcpuinfo pcpu_info;
315 uint8_t pad[128]; 333 uint8_t pad[128];
316 } u; 334 } u;
317}; 335};
diff --git a/include/xen/tmem.h b/include/xen/tmem.h
index 82e2c83a32f5..591550a22ac7 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 03c85d7387fb..6a198e46ab6e 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -23,6 +23,7 @@ int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
23 23
24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); 24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
25 25
26struct vm_area_struct;
26int xen_remap_domain_mfn_range(struct vm_area_struct *vma, 27int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
27 unsigned long addr, 28 unsigned long addr,
28 unsigned long mfn, int nr, 29 unsigned long mfn, int nr,
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index e8c599b237c2..0a7515c1e3a4 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)