aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h13
-rw-r--r--include/linux/acpi_dma.h5
-rw-r--r--include/linux/atmel-ssc.h1
-rw-r--r--include/linux/audit.h14
-rw-r--r--include/linux/backing-dev.h2
-rw-r--r--include/linux/backlight.h6
-rw-r--r--include/linux/basic_mmio_gpio.h1
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/bio.h11
-rw-r--r--include/linux/blk-iopoll.h2
-rw-r--r--include/linux/blk-mq.h5
-rw-r--r--include/linux/blk_types.h2
-rw-r--r--include/linux/blkdev.h18
-rw-r--r--include/linux/brcmphy.h60
-rw-r--r--include/linux/buffer_head.h4
-rw-r--r--include/linux/can/dev.h9
-rw-r--r--include/linux/ccp.h7
-rw-r--r--include/linux/ceph/ceph_features.h12
-rw-r--r--include/linux/ceph/ceph_fs.h5
-rw-r--r--include/linux/ceph/osd_client.h11
-rw-r--r--include/linux/ceph/osdmap.h50
-rw-r--r--include/linux/ceph/rados.h18
-rw-r--r--include/linux/cgroup.h275
-rw-r--r--include/linux/cgroup_subsys.h30
-rw-r--r--include/linux/clk-provider.h8
-rw-r--r--include/linux/clk.h14
-rw-r--r--include/linux/clk/zynq.h2
-rw-r--r--include/linux/compat.h23
-rw-r--r--include/linux/compiler-clang.h12
-rw-r--r--include/linux/compiler.h7
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/cpu.h54
-rw-r--r--include/linux/cpufeature.h60
-rw-r--r--include/linux/cpufreq.h46
-rw-r--r--include/linux/cpuidle.h23
-rw-r--r--include/linux/cpuset.h27
-rw-r--r--include/linux/crash_dump.h1
-rw-r--r--include/linux/cred.h2
-rw-r--r--include/linux/crush/crush.h7
-rw-r--r--include/linux/dcache.h8
-rw-r--r--include/linux/decompress/inflate.h4
-rw-r--r--include/linux/device-mapper.h8
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/dmaengine.h14
-rw-r--r--include/linux/dmar.h82
-rw-r--r--include/linux/drbd.h8
-rw-r--r--include/linux/drbd_genl.h6
-rw-r--r--include/linux/dw_dmac.h5
-rw-r--r--include/linux/elevator.h11
-rw-r--r--include/linux/err.h7
-rw-r--r--include/linux/ethtool.h3
-rw-r--r--include/linux/extcon.h12
-rw-r--r--include/linux/extcon/of_extcon.h31
-rw-r--r--include/linux/f2fs_fs.h2
-rw-r--r--include/linux/fdtable.h2
-rw-r--r--include/linux/filter.h118
-rw-r--r--include/linux/fmc-sdb.h2
-rw-r--r--include/linux/fs.h157
-rw-r--r--include/linux/fsl_ifc.h838
-rw-r--r--include/linux/fsnotify_backend.h2
-rw-r--r--include/linux/ftrace.h27
-rw-r--r--include/linux/ftrace_event.h50
-rw-r--r--include/linux/gpio.h2
-rw-r--r--include/linux/gpio/consumer.h15
-rw-r--r--include/linux/gpio/driver.h48
-rw-r--r--include/linux/hdmi.h12
-rw-r--r--include/linux/hid-sensor-hub.h9
-rw-r--r--include/linux/hid-sensor-ids.h26
-rw-r--r--include/linux/hid.h76
-rw-r--r--include/linux/host1x.h1
-rw-r--r--include/linux/hsi/hsi.h2
-rw-r--r--include/linux/hugetlb.h10
-rw-r--r--include/linux/hugetlb_cgroup.h2
-rw-r--r--include/linux/hyperv.h353
-rw-r--r--include/linux/i2c.h1
-rw-r--r--include/linux/i2c/adp5588.h4
-rw-r--r--include/linux/i2c/bfin_twi.h145
-rw-r--r--include/linux/i2c/twl.h12
-rw-r--r--include/linux/i2c/twl4030-madc.h2
-rw-r--r--include/linux/idr.h65
-rw-r--r--include/linux/ieee80211.h239
-rw-r--r--include/linux/if_vlan.h9
-rw-r--r--include/linux/iio/iio.h16
-rw-r--r--include/linux/input/pmic8xxx-keypad.h52
-rw-r--r--include/linux/input/pmic8xxx-pwrkey.h31
-rw-r--r--include/linux/intel-iommu.h1
-rw-r--r--include/linux/io.h2
-rw-r--r--include/linux/ioport.h12
-rw-r--r--include/linux/iova.h2
-rw-r--r--include/linux/irqchip/arm-gic.h7
-rw-r--r--include/linux/irqchip/arm-vic.h6
-rw-r--r--include/linux/irqchip/irq-crossbar.h11
-rw-r--r--include/linux/isapnp.h4
-rw-r--r--include/linux/isdn_ppp.h5
-rw-r--r--include/linux/kernel.h9
-rw-r--r--include/linux/kernfs.h109
-rw-r--r--include/linux/kfifo.h2
-rw-r--r--include/linux/kmemleak.h2
-rw-r--r--include/linux/kobject.h1
-rw-r--r--include/linux/kvm_host.h20
-rw-r--r--include/linux/lglock.h16
-rw-r--r--include/linux/list_lru.h8
-rw-r--r--include/linux/mbcache.h12
-rw-r--r--include/linux/mcb.h119
-rw-r--r--include/linux/memblock.h2
-rw-r--r--include/linux/memcontrol.h25
-rw-r--r--include/linux/mempolicy.h3
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
-rw-r--r--include/linux/mfd/arizona/registers.h90
-rw-r--r--include/linux/mfd/bcm590xx.h31
-rw-r--r--include/linux/mfd/da9052/da9052.h1
-rw-r--r--include/linux/mfd/da9063/core.h6
-rw-r--r--include/linux/mfd/da9063/registers.h120
-rw-r--r--include/linux/mfd/dbx500-prcmu.h2
-rw-r--r--include/linux/mfd/lpc_ich.h25
-rw-r--r--include/linux/mfd/max14577-private.h8
-rw-r--r--include/linux/mfd/max14577.h5
-rw-r--r--include/linux/mfd/mc13xxx.h6
-rw-r--r--include/linux/mfd/pm8xxx/irq.h59
-rw-r--r--include/linux/mfd/pm8xxx/pm8921.h30
-rw-r--r--include/linux/mfd/pm8xxx/rtc.h25
-rw-r--r--include/linux/mfd/rtsx_common.h1
-rw-r--r--include/linux/mfd/rtsx_pci.h8
-rw-r--r--include/linux/mfd/rtsx_usb.h628
-rw-r--r--include/linux/mfd/samsung/core.h22
-rw-r--r--include/linux/mfd/samsung/irq.h81
-rw-r--r--include/linux/mfd/samsung/rtc.h57
-rw-r--r--include/linux/mfd/samsung/s2mpa01.h192
-rw-r--r--include/linux/mfd/samsung/s2mps14.h154
-rw-r--r--include/linux/mfd/samsung/s5m8767.h7
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h18
-rw-r--r--include/linux/mfd/tps65218.h284
-rw-r--r--include/linux/miscdevice.h17
-rw-r--r--include/linux/mlx4/cmd.h8
-rw-r--r--include/linux/mlx4/device.h50
-rw-r--r--include/linux/mlx4/driver.h12
-rw-r--r--include/linux/mlx4/qp.h11
-rw-r--r--include/linux/mlx5/cq.h1
-rw-r--r--include/linux/mlx5/device.h43
-rw-r--r--include/linux/mlx5/driver.h41
-rw-r--r--include/linux/mlx5/qp.h67
-rw-r--r--include/linux/mm.h32
-rw-r--r--include/linux/mm_types.h7
-rw-r--r--include/linux/mmc/core.h4
-rw-r--r--include/linux/mmc/host.h13
-rw-r--r--include/linux/mmc/sdhci-spear.h8
-rw-r--r--include/linux/mmc/sdhci.h2
-rw-r--r--include/linux/mmc/sdio_ids.h1
-rw-r--r--include/linux/mmc/slot-gpio.h6
-rw-r--r--include/linux/mmdebug.h4
-rw-r--r--include/linux/mmzone.h6
-rw-r--r--include/linux/mod_devicetable.h27
-rw-r--r--include/linux/module.h21
-rw-r--r--include/linux/moduleparam.h10
-rw-r--r--include/linux/mount.h3
-rw-r--r--include/linux/mpls.h6
-rw-r--r--include/linux/mtd/mtd.h16
-rw-r--r--include/linux/mtd/nand.h135
-rw-r--r--include/linux/nbd.h3
-rw-r--r--include/linux/netdev_features.h2
-rw-r--r--include/linux/netdevice.h181
-rw-r--r--include/linux/netfilter/ipset/ip_set.h15
-rw-r--r--include/linux/netfilter/nfnetlink.h21
-rw-r--r--include/linux/netpoll.h71
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nfs_xdr.h3
-rw-r--r--include/linux/nilfs2_fs.h52
-rw-r--r--include/linux/nl802154.h12
-rw-r--r--include/linux/ntb.h19
-rw-r--r--include/linux/nvme.h21
-rw-r--r--include/linux/of.h137
-rw-r--r--include/linux/of_fdt.h4
-rw-r--r--include/linux/of_graph.h66
-rw-r--r--include/linux/of_mtd.h12
-rw-r--r--include/linux/of_reserved_mem.h53
-rw-r--r--include/linux/omap-dma.h25
-rw-r--r--include/linux/pagemap.h43
-rw-r--r--include/linux/pagevec.h5
-rw-r--r--include/linux/pci-acpi.h4
-rw-r--r--include/linux/pci.h11
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/percpu.h350
-rw-r--r--include/linux/perf_event.h16
-rw-r--r--include/linux/phy.h56
-rw-r--r--include/linux/phy/omap_control_phy.h (renamed from include/linux/usb/omap_control_usb.h)36
-rw-r--r--include/linux/phy/omap_usb.h (renamed from include/linux/usb/omap_usb.h)14
-rw-r--r--include/linux/phy/phy.h15
-rw-r--r--include/linux/pipe_fs_i.h21
-rw-r--r--include/linux/platform_data/adau1977.h45
-rw-r--r--include/linux/platform_data/asoc-s3c.h3
-rw-r--r--include/linux/platform_data/asoc-s3c24xx_simtec.h3
-rw-r--r--include/linux/platform_data/ata-samsung_cf.h9
-rw-r--r--include/linux/platform_data/atmel.h1
-rw-r--r--include/linux/platform_data/bt-nokia-h4p.h38
-rw-r--r--include/linux/platform_data/clk-integrator.h1
-rw-r--r--include/linux/platform_data/davinci_asp.h4
-rw-r--r--include/linux/platform_data/dma-rcar-audmapp.h34
-rw-r--r--include/linux/platform_data/elm.h10
-rw-r--r--include/linux/platform_data/gpio-davinci.h4
-rw-r--r--include/linux/platform_data/i2c-s3c2410.h9
-rw-r--r--include/linux/platform_data/leds-s3c24xx.h9
-rw-r--r--include/linux/platform_data/max310x.h64
-rw-r--r--include/linux/platform_data/mmc-msm_sdcc.h7
-rw-r--r--include/linux/platform_data/mmc-mvsdio.h6
-rw-r--r--include/linux/platform_data/mtd-davinci-aemif.h5
-rw-r--r--include/linux/platform_data/mtd-nand-s3c2410.h8
-rw-r--r--include/linux/platform_data/serial-imx.h2
-rw-r--r--include/linux/platform_data/spi-s3c64xx.h9
-rw-r--r--include/linux/platform_data/touchscreen-s3c2410.h17
-rw-r--r--include/linux/platform_data/video-imxfb.h12
-rw-r--r--include/linux/pm.h71
-rw-r--r--include/linux/pm_qos.h34
-rw-r--r--include/linux/pm_runtime.h4
-rw-r--r--include/linux/printk.h16
-rw-r--r--include/linux/ptp_classify.h103
-rw-r--r--include/linux/ptp_clock_kernel.h33
-rw-r--r--include/linux/pwm.h2
-rw-r--r--include/linux/pxa2xx_ssp.h2
-rw-r--r--include/linux/quotaops.h8
-rw-r--r--include/linux/radix-tree.h55
-rw-r--r--include/linux/random.h16
-rw-r--r--include/linux/regmap.h32
-rw-r--r--include/linux/regulator/driver.h8
-rw-r--r--include/linux/regulator/pfuze100.h14
-rw-r--r--include/linux/res_counter.h6
-rw-r--r--include/linux/reset.h65
-rw-r--r--include/linux/rio.h5
-rw-r--r--include/linux/sched.h35
-rw-r--r--include/linux/seccomp.h1
-rw-r--r--include/linux/security.h12
-rw-r--r--include/linux/serial_bcm63xx.h2
-rw-r--r--include/linux/serial_s3c.h2
-rw-r--r--include/linux/serial_sci.h93
-rw-r--r--include/linux/sh_clk.h19
-rw-r--r--include/linux/shmem_fs.h1
-rw-r--r--include/linux/skbuff.h106
-rw-r--r--include/linux/slab.h17
-rw-r--r--include/linux/slub_def.h3
-rw-r--r--include/linux/smp.h8
-rw-r--r--include/linux/spi/spi.h39
-rw-r--r--include/linux/spi/spi_bitbang.h2
-rw-r--r--include/linux/spmi.h191
-rw-r--r--include/linux/ssbi.h20
-rw-r--r--include/linux/sunrpc/bc_xprt.h3
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/svcsock.h3
-rw-r--r--include/linux/sunrpc/xprt.h13
-rw-r--r--include/linux/swap.h36
-rw-r--r--include/linux/sxgbe_platform.h54
-rw-r--r--include/linux/syscalls.h13
-rw-r--r--include/linux/sysfs.h19
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/topology.h4
-rw-r--r--include/linux/tracepoint.h67
-rw-r--r--include/linux/tty.h8
-rw-r--r--include/linux/tty_ldisc.h1
-rw-r--r--include/linux/u64_stats_sync.h16
-rw-r--r--include/linux/uinput.h2
-rw-r--r--include/linux/uio.h52
-rw-r--r--include/linux/uprobes.h1
-rw-r--r--include/linux/usb.h15
-rw-r--r--include/linux/usb/cdc_ncm.h1
-rw-r--r--include/linux/usb/chipidea.h1
-rw-r--r--include/linux/usb/composite.h2
-rw-r--r--include/linux/usb/hcd.h1
-rw-r--r--include/linux/usb/phy.h16
-rw-r--r--include/linux/usb/serial.h3
-rw-r--r--include/linux/usb/uas.h14
-rw-r--r--include/linux/usb_usual.h6
-rw-r--r--include/linux/vfio.h2
-rw-r--r--include/linux/video_output.h57
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--include/linux/vmacache.h38
-rw-r--r--include/linux/vmstat.h25
-rw-r--r--include/linux/wait.h11
-rw-r--r--include/linux/wl12xx.h24
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/xilinxfb.h30
278 files changed, 6923 insertions, 2399 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 1151a1dcfe41..7a8f2cd66c8b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -108,6 +108,10 @@ static inline void acpi_initrd_override(void *data, size_t size)
108} 108}
109#endif 109#endif
110 110
111#define BAD_MADT_ENTRY(entry, end) ( \
112 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
113 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
114
111char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 115char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
112void __acpi_unmap_table(char *map, unsigned long size); 116void __acpi_unmap_table(char *map, unsigned long size);
113int early_acpi_boot_init(void); 117int early_acpi_boot_init(void);
@@ -259,14 +263,9 @@ extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
259extern void acpi_osi_setup(char *str); 263extern void acpi_osi_setup(char *str);
260 264
261#ifdef CONFIG_ACPI_NUMA 265#ifdef CONFIG_ACPI_NUMA
262int acpi_get_pxm(acpi_handle handle); 266int acpi_get_node(acpi_handle handle);
263int acpi_get_node(acpi_handle *handle);
264#else 267#else
265static inline int acpi_get_pxm(acpi_handle handle) 268static inline int acpi_get_node(acpi_handle handle)
266{
267 return 0;
268}
269static inline int acpi_get_node(acpi_handle *handle)
270{ 269{
271 return 0; 270 return 0;
272} 271}
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h
index fb0298082916..329436d38e66 100644
--- a/include/linux/acpi_dma.h
+++ b/include/linux/acpi_dma.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/err.h>
19#include <linux/dmaengine.h> 20#include <linux/dmaengine.h>
20 21
21/** 22/**
@@ -103,12 +104,12 @@ static inline void devm_acpi_dma_controller_free(struct device *dev)
103static inline struct dma_chan *acpi_dma_request_slave_chan_by_index( 104static inline struct dma_chan *acpi_dma_request_slave_chan_by_index(
104 struct device *dev, size_t index) 105 struct device *dev, size_t index)
105{ 106{
106 return NULL; 107 return ERR_PTR(-ENODEV);
107} 108}
108static inline struct dma_chan *acpi_dma_request_slave_chan_by_name( 109static inline struct dma_chan *acpi_dma_request_slave_chan_by_name(
109 struct device *dev, const char *name) 110 struct device *dev, const char *name)
110{ 111{
111 return NULL; 112 return ERR_PTR(-ENODEV);
112} 113}
113 114
114#define acpi_dma_simple_xlate NULL 115#define acpi_dma_simple_xlate NULL
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 66a0e5384edd..571a12ebb018 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -18,6 +18,7 @@ struct ssc_device {
18 struct clk *clk; 18 struct clk *clk;
19 int user; 19 int user;
20 int irq; 20 int irq;
21 bool clk_from_rk_pin;
21}; 22};
22 23
23struct ssc_device * __must_check ssc_request(unsigned int ssc_num); 24struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
diff --git a/include/linux/audit.h b/include/linux/audit.h
index ec1464df4c60..22cfddb75566 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -79,6 +79,14 @@ extern int is_audit_feature_set(int which);
79extern int __init audit_register_class(int class, unsigned *list); 79extern int __init audit_register_class(int class, unsigned *list);
80extern int audit_classify_syscall(int abi, unsigned syscall); 80extern int audit_classify_syscall(int abi, unsigned syscall);
81extern int audit_classify_arch(int arch); 81extern int audit_classify_arch(int arch);
82/* only for compat system calls */
83extern unsigned compat_write_class[];
84extern unsigned compat_read_class[];
85extern unsigned compat_dir_class[];
86extern unsigned compat_chattr_class[];
87extern unsigned compat_signal_class[];
88
89extern int __weak audit_classify_compat_syscall(int abi, unsigned syscall);
82 90
83/* audit_names->type values */ 91/* audit_names->type values */
84#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ 92#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
@@ -94,6 +102,12 @@ struct filename;
94 102
95extern void audit_log_session_info(struct audit_buffer *ab); 103extern void audit_log_session_info(struct audit_buffer *ab);
96 104
105#ifdef CONFIG_AUDIT_COMPAT_GENERIC
106#define audit_is_compat(arch) (!((arch) & __AUDIT_ARCH_64BIT))
107#else
108#define audit_is_compat(arch) false
109#endif
110
97#ifdef CONFIG_AUDITSYSCALL 111#ifdef CONFIG_AUDITSYSCALL
98/* These are defined in auditsc.c */ 112/* These are defined in auditsc.c */
99 /* Public API */ 113 /* Public API */
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 24819001f5c8..e488e9459a93 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -95,7 +95,7 @@ struct backing_dev_info {
95 unsigned int max_ratio, max_prop_frac; 95 unsigned int max_ratio, max_prop_frac;
96 96
97 struct bdi_writeback wb; /* default writeback info for this bdi */ 97 struct bdi_writeback wb; /* default writeback info for this bdi */
98 spinlock_t wb_lock; /* protects work_list */ 98 spinlock_t wb_lock; /* protects work_list & wb.dwork scheduling */
99 99
100 struct list_head work_list; 100 struct list_head work_list;
101 101
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5f9cd963213d..72647429adf6 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -9,6 +9,7 @@
9#define _LINUX_BACKLIGHT_H 9#define _LINUX_BACKLIGHT_H
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/fb.h>
12#include <linux/mutex.h> 13#include <linux/mutex.h>
13#include <linux/notifier.h> 14#include <linux/notifier.h>
14 15
@@ -104,6 +105,11 @@ struct backlight_device {
104 struct list_head entry; 105 struct list_head entry;
105 106
106 struct device dev; 107 struct device dev;
108
109 /* Multiple framebuffers may share one backlight device */
110 bool fb_bl_on[FB_MAX];
111
112 int use_count;
107}; 113};
108 114
109static inline void backlight_update_status(struct backlight_device *bd) 115static inline void backlight_update_status(struct backlight_device *bd)
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index d8a97ec0e2b8..0e97856b2cff 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -19,6 +19,7 @@
19#include <linux/spinlock_types.h> 19#include <linux/spinlock_types.h>
20 20
21struct bgpio_pdata { 21struct bgpio_pdata {
22 const char *label;
22 int base; 23 int base;
23 int ngpio; 24 int ngpio;
24}; 25};
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index b4a745d7d9a9..61f29e5ea840 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -44,7 +44,6 @@ struct linux_binprm {
44 unsigned interp_flags; 44 unsigned interp_flags;
45 unsigned interp_data; 45 unsigned interp_data;
46 unsigned long loader, exec; 46 unsigned long loader, exec;
47 char tcomm[TASK_COMM_LEN];
48}; 47};
49 48
50#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 49#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 5a4d39b4686b..bba550826921 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -216,9 +216,9 @@ static inline void bvec_iter_advance(struct bio_vec *bv, struct bvec_iter *iter,
216} 216}
217 217
218#define for_each_bvec(bvl, bio_vec, iter, start) \ 218#define for_each_bvec(bvl, bio_vec, iter, start) \
219 for ((iter) = start; \ 219 for (iter = (start); \
220 (bvl) = bvec_iter_bvec((bio_vec), (iter)), \ 220 (iter).bi_size && \
221 (iter).bi_size; \ 221 ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \
222 bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len)) 222 bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len))
223 223
224 224
@@ -388,7 +388,7 @@ struct sg_iovec;
388struct rq_map_data; 388struct rq_map_data;
389extern struct bio *bio_map_user_iov(struct request_queue *, 389extern struct bio *bio_map_user_iov(struct request_queue *,
390 struct block_device *, 390 struct block_device *,
391 struct sg_iovec *, int, int, gfp_t); 391 const struct sg_iovec *, int, int, gfp_t);
392extern void bio_unmap_user(struct bio *); 392extern void bio_unmap_user(struct bio *);
393extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, 393extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
394 gfp_t); 394 gfp_t);
@@ -414,7 +414,8 @@ extern int bio_alloc_pages(struct bio *bio, gfp_t gfp);
414extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, 414extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *,
415 unsigned long, unsigned int, int, gfp_t); 415 unsigned long, unsigned int, int, gfp_t);
416extern struct bio *bio_copy_user_iov(struct request_queue *, 416extern struct bio *bio_copy_user_iov(struct request_queue *,
417 struct rq_map_data *, struct sg_iovec *, 417 struct rq_map_data *,
418 const struct sg_iovec *,
418 int, int, gfp_t); 419 int, int, gfp_t);
419extern int bio_uncopy_user(struct bio *); 420extern int bio_uncopy_user(struct bio *);
420void zero_fill_bio(struct bio *bio); 421void zero_fill_bio(struct bio *bio);
diff --git a/include/linux/blk-iopoll.h b/include/linux/blk-iopoll.h
index 308734d3d4a2..77ae77c0b704 100644
--- a/include/linux/blk-iopoll.h
+++ b/include/linux/blk-iopoll.h
@@ -43,6 +43,4 @@ extern void __blk_iopoll_complete(struct blk_iopoll *);
43extern void blk_iopoll_enable(struct blk_iopoll *); 43extern void blk_iopoll_enable(struct blk_iopoll *);
44extern void blk_iopoll_disable(struct blk_iopoll *); 44extern void blk_iopoll_disable(struct blk_iopoll *);
45 45
46extern int blk_iopoll_enabled;
47
48#endif 46#endif
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 2ff2e8d982be..0120451545d8 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -109,7 +109,7 @@ enum {
109 BLK_MQ_F_SHOULD_SORT = 1 << 1, 109 BLK_MQ_F_SHOULD_SORT = 1 << 1,
110 BLK_MQ_F_SHOULD_IPI = 1 << 2, 110 BLK_MQ_F_SHOULD_IPI = 1 << 2,
111 111
112 BLK_MQ_S_STOPPED = 1 << 0, 112 BLK_MQ_S_STOPPED = 0,
113 113
114 BLK_MQ_MAX_DEPTH = 2048, 114 BLK_MQ_MAX_DEPTH = 2048,
115}; 115};
@@ -117,7 +117,8 @@ enum {
117struct request_queue *blk_mq_init_queue(struct blk_mq_reg *, void *); 117struct request_queue *blk_mq_init_queue(struct blk_mq_reg *, void *);
118int blk_mq_register_disk(struct gendisk *); 118int blk_mq_register_disk(struct gendisk *);
119void blk_mq_unregister_disk(struct gendisk *); 119void blk_mq_unregister_disk(struct gendisk *);
120void blk_mq_init_commands(struct request_queue *, void (*init)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data); 120int blk_mq_init_commands(struct request_queue *, int (*init)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data);
121void blk_mq_free_commands(struct request_queue *, void (*free)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data);
121 122
122void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); 123void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
123 124
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index bbc3a6c88fce..aa0eaa2d0bd8 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -189,6 +189,7 @@ enum rq_flag_bits {
189 __REQ_KERNEL, /* direct IO to kernel pages */ 189 __REQ_KERNEL, /* direct IO to kernel pages */
190 __REQ_PM, /* runtime pm request */ 190 __REQ_PM, /* runtime pm request */
191 __REQ_END, /* last of chain of requests */ 191 __REQ_END, /* last of chain of requests */
192 __REQ_HASHED, /* on IO scheduler merge hash */
192 __REQ_NR_BITS, /* stops here */ 193 __REQ_NR_BITS, /* stops here */
193}; 194};
194 195
@@ -241,5 +242,6 @@ enum rq_flag_bits {
241#define REQ_KERNEL (1ULL << __REQ_KERNEL) 242#define REQ_KERNEL (1ULL << __REQ_KERNEL)
242#define REQ_PM (1ULL << __REQ_PM) 243#define REQ_PM (1ULL << __REQ_PM)
243#define REQ_END (1ULL << __REQ_END) 244#define REQ_END (1ULL << __REQ_END)
245#define REQ_HASHED (1ULL << __REQ_HASHED)
244 246
245#endif /* __LINUX_BLK_TYPES_H */ 247#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4afa4f8f6090..0d84981ee03f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -99,6 +99,7 @@ struct request {
99 union { 99 union {
100 struct call_single_data csd; 100 struct call_single_data csd;
101 struct work_struct mq_flush_work; 101 struct work_struct mq_flush_work;
102 unsigned long fifo_time;
102 }; 103 };
103 104
104 struct request_queue *q; 105 struct request_queue *q;
@@ -117,7 +118,18 @@ struct request {
117 struct bio *bio; 118 struct bio *bio;
118 struct bio *biotail; 119 struct bio *biotail;
119 120
120 struct hlist_node hash; /* merge hash */ 121 /*
122 * The hash is used inside the scheduler, and killed once the
123 * request reaches the dispatch list. The ipi_list is only used
124 * to queue the request for softirq completion, which is long
125 * after the request has been unhashed (and even removed from
126 * the dispatch list).
127 */
128 union {
129 struct hlist_node hash; /* merge hash */
130 struct list_head ipi_list;
131 };
132
121 /* 133 /*
122 * The rb_node is only used inside the io scheduler, requests 134 * The rb_node is only used inside the io scheduler, requests
123 * are pruned when moved to the dispatch queue. So let the 135 * are pruned when moved to the dispatch queue. So let the
@@ -823,8 +835,8 @@ extern int blk_rq_map_user(struct request_queue *, struct request *,
823extern int blk_rq_unmap_user(struct bio *); 835extern int blk_rq_unmap_user(struct bio *);
824extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); 836extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t);
825extern int blk_rq_map_user_iov(struct request_queue *, struct request *, 837extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
826 struct rq_map_data *, struct sg_iovec *, int, 838 struct rq_map_data *, const struct sg_iovec *,
827 unsigned int, gfp_t); 839 int, unsigned int, gfp_t);
828extern int blk_execute_rq(struct request_queue *, struct gendisk *, 840extern int blk_execute_rq(struct request_queue *, struct gendisk *,
829 struct request *, int); 841 struct request *, int);
830extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 842extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 677b4f01b2d0..6f76277baf39 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -13,10 +13,17 @@
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM57780 0x03625d90 14#define PHY_ID_BCM57780 0x03625d90
15 15
16#define PHY_ID_BCM7366 0x600d8490
17#define PHY_ID_BCM7439 0x600d8480
18#define PHY_ID_BCM7445 0x600d8510
19#define PHY_ID_BCM7XXX_28 0x600d8400
20
16#define PHY_BCM_OUI_MASK 0xfffffc00 21#define PHY_BCM_OUI_MASK 0xfffffc00
17#define PHY_BCM_OUI_1 0x00206000 22#define PHY_BCM_OUI_1 0x00206000
18#define PHY_BCM_OUI_2 0x0143bc00 23#define PHY_BCM_OUI_2 0x0143bc00
19#define PHY_BCM_OUI_3 0x03625c00 24#define PHY_BCM_OUI_3 0x03625c00
25#define PHY_BCM_OUI_4 0x600d0000
26#define PHY_BCM_OUI_5 0x03625e00
20 27
21 28
22#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 29#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
@@ -31,6 +38,59 @@
31#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 38#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000
32#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 39#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
33#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 40#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
41/* Broadcom BCM7xxx specific workarounds */
42#define PHY_BRCM_100MBPS_WAR 0x00010000
34#define PHY_BCM_FLAGS_VALID 0x80000000 43#define PHY_BCM_FLAGS_VALID 0x80000000
35 44
45/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */
46#define MII_BCM54XX_ECR 0x10 /* BCM54xx extended control register */
47#define MII_BCM54XX_ECR_IM 0x1000 /* Interrupt mask */
48#define MII_BCM54XX_ECR_IF 0x0800 /* Interrupt force */
49
50#define MII_BCM54XX_ESR 0x11 /* BCM54xx extended status register */
51#define MII_BCM54XX_ESR_IS 0x1000 /* Interrupt status */
52
53#define MII_BCM54XX_EXP_DATA 0x15 /* Expansion register data */
54#define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */
55#define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */
56#define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */
57
58#define MII_BCM54XX_AUX_CTL 0x18 /* Auxiliary control register */
59#define MII_BCM54XX_ISR 0x1a /* BCM54xx interrupt status register */
60#define MII_BCM54XX_IMR 0x1b /* BCM54xx interrupt mask register */
61#define MII_BCM54XX_INT_CRCERR 0x0001 /* CRC error */
62#define MII_BCM54XX_INT_LINK 0x0002 /* Link status changed */
63#define MII_BCM54XX_INT_SPEED 0x0004 /* Link speed change */
64#define MII_BCM54XX_INT_DUPLEX 0x0008 /* Duplex mode changed */
65#define MII_BCM54XX_INT_LRS 0x0010 /* Local receiver status changed */
66#define MII_BCM54XX_INT_RRS 0x0020 /* Remote receiver status changed */
67#define MII_BCM54XX_INT_SSERR 0x0040 /* Scrambler synchronization error */
68#define MII_BCM54XX_INT_UHCD 0x0080 /* Unsupported HCD negotiated */
69#define MII_BCM54XX_INT_NHCD 0x0100 /* No HCD */
70#define MII_BCM54XX_INT_NHCDL 0x0200 /* No HCD link */
71#define MII_BCM54XX_INT_ANPR 0x0400 /* Auto-negotiation page received */
72#define MII_BCM54XX_INT_LC 0x0800 /* All counters below 128 */
73#define MII_BCM54XX_INT_HC 0x1000 /* Counter above 32768 */
74#define MII_BCM54XX_INT_MDIX 0x2000 /* MDIX status change */
75#define MII_BCM54XX_INT_PSERR 0x4000 /* Pair swap error */
76
77#define MII_BCM54XX_SHD 0x1c /* 0x1c shadow registers */
78#define MII_BCM54XX_SHD_WRITE 0x8000
79#define MII_BCM54XX_SHD_VAL(x) ((x & 0x1f) << 10)
80#define MII_BCM54XX_SHD_DATA(x) ((x & 0x3ff) << 0)
81
82/*
83 * AUXILIARY CONTROL SHADOW ACCESS REGISTERS. (PHY REG 0x18)
84 */
85#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
86#define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400
87#define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800
88
89#define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000
90#define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200
91#define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000
92#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007
93
94#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
95
36#endif /* _LINUX_BRCMPHY_H */ 96#endif /* _LINUX_BRCMPHY_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index d77797a52b7b..c40302f909ce 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -210,8 +210,8 @@ int block_write_full_page(struct page *page, get_block_t *get_block,
210int block_write_full_page_endio(struct page *page, get_block_t *get_block, 210int block_write_full_page_endio(struct page *page, get_block_t *get_block,
211 struct writeback_control *wbc, bh_end_io_t *handler); 211 struct writeback_control *wbc, bh_end_io_t *handler);
212int block_read_full_page(struct page*, get_block_t*); 212int block_read_full_page(struct page*, get_block_t*);
213int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, 213int block_is_partially_uptodate(struct page *page, unsigned long from,
214 unsigned long from); 214 unsigned long count);
215int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len, 215int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
216 unsigned flags, struct page **pagep, get_block_t *get_block); 216 unsigned flags, struct page **pagep, get_block_t *get_block);
217int __block_write_begin(struct page *page, loff_t pos, unsigned len, 217int __block_write_begin(struct page *page, loff_t pos, unsigned len,
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index fb0ab651a041..3ce5e526525f 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -33,8 +33,9 @@ enum can_mode {
33struct can_priv { 33struct can_priv {
34 struct can_device_stats can_stats; 34 struct can_device_stats can_stats;
35 35
36 struct can_bittiming bittiming; 36 struct can_bittiming bittiming, data_bittiming;
37 const struct can_bittiming_const *bittiming_const; 37 const struct can_bittiming_const *bittiming_const,
38 *data_bittiming_const;
38 struct can_clock clock; 39 struct can_clock clock;
39 40
40 enum can_state state; 41 enum can_state state;
@@ -45,6 +46,7 @@ struct can_priv {
45 struct timer_list restart_timer; 46 struct timer_list restart_timer;
46 47
47 int (*do_set_bittiming)(struct net_device *dev); 48 int (*do_set_bittiming)(struct net_device *dev);
49 int (*do_set_data_bittiming)(struct net_device *dev);
48 int (*do_set_mode)(struct net_device *dev, enum can_mode mode); 50 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
49 int (*do_get_state)(const struct net_device *dev, 51 int (*do_get_state)(const struct net_device *dev,
50 enum can_state *state); 52 enum can_state *state);
@@ -111,6 +113,7 @@ struct can_priv *safe_candev_priv(struct net_device *dev);
111 113
112int open_candev(struct net_device *dev); 114int open_candev(struct net_device *dev);
113void close_candev(struct net_device *dev); 115void close_candev(struct net_device *dev);
116int can_change_mtu(struct net_device *dev, int new_mtu);
114 117
115int register_candev(struct net_device *dev); 118int register_candev(struct net_device *dev);
116void unregister_candev(struct net_device *dev); 119void unregister_candev(struct net_device *dev);
@@ -124,6 +127,8 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
124void can_free_echo_skb(struct net_device *dev, unsigned int idx); 127void can_free_echo_skb(struct net_device *dev, unsigned int idx);
125 128
126struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); 129struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);
130struct sk_buff *alloc_canfd_skb(struct net_device *dev,
131 struct canfd_frame **cfd);
127struct sk_buff *alloc_can_err_skb(struct net_device *dev, 132struct sk_buff *alloc_can_err_skb(struct net_device *dev,
128 struct can_frame **cf); 133 struct can_frame **cf);
129 134
diff --git a/include/linux/ccp.h b/include/linux/ccp.h
index b941ab9f762b..ebcc9d146219 100644
--- a/include/linux/ccp.h
+++ b/include/linux/ccp.h
@@ -232,6 +232,9 @@ enum ccp_sha_type {
232 * @ctx_len: length in bytes of hash value 232 * @ctx_len: length in bytes of hash value
233 * @src: data to be used for this operation 233 * @src: data to be used for this operation
234 * @src_len: length in bytes of data used for this operation 234 * @src_len: length in bytes of data used for this operation
235 * @opad: data to be used for final HMAC operation
236 * @opad_len: length in bytes of data used for final HMAC operation
237 * @first: indicates first SHA operation
235 * @final: indicates final SHA operation 238 * @final: indicates final SHA operation
236 * @msg_bits: total length of the message in bits used in final SHA operation 239 * @msg_bits: total length of the message in bits used in final SHA operation
237 * 240 *
@@ -251,6 +254,10 @@ struct ccp_sha_engine {
251 struct scatterlist *src; 254 struct scatterlist *src;
252 u64 src_len; /* In bytes */ 255 u64 src_len; /* In bytes */
253 256
257 struct scatterlist *opad;
258 u32 opad_len; /* In bytes */
259
260 u32 first; /* Indicates first sha cmd */
254 u32 final; /* Indicates final sha cmd */ 261 u32 final; /* Indicates final sha cmd */
255 u64 msg_bits; /* Message length in bits required for 262 u64 msg_bits; /* Message length in bits required for
256 * final sha cmd */ 263 * final sha cmd */
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index 138448f766b4..d12659ce550d 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -43,6 +43,13 @@
43#define CEPH_FEATURE_CRUSH_V2 (1ULL<<36) /* new indep; SET_* steps */ 43#define CEPH_FEATURE_CRUSH_V2 (1ULL<<36) /* new indep; SET_* steps */
44#define CEPH_FEATURE_EXPORT_PEER (1ULL<<37) 44#define CEPH_FEATURE_EXPORT_PEER (1ULL<<37)
45#define CEPH_FEATURE_OSD_ERASURE_CODES (1ULL<<38) 45#define CEPH_FEATURE_OSD_ERASURE_CODES (1ULL<<38)
46#define CEPH_FEATURE_OSD_TMAP2OMAP (1ULL<<38) /* overlap with EC */
47/* The process supports new-style OSDMap encoding. Monitors also use
48 this bit to determine if peers support NAK messages. */
49#define CEPH_FEATURE_OSDMAP_ENC (1ULL<<39)
50#define CEPH_FEATURE_MDS_INLINE_DATA (1ULL<<40)
51#define CEPH_FEATURE_CRUSH_TUNABLES3 (1ULL<<41)
52#define CEPH_FEATURE_OSD_PRIMARY_AFFINITY (1ULL<<41) /* overlap w/ tunables3 */
46 53
47/* 54/*
48 * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature 55 * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
@@ -82,7 +89,10 @@ static inline u64 ceph_sanitize_features(u64 features)
82 CEPH_FEATURE_OSDHASHPSPOOL | \ 89 CEPH_FEATURE_OSDHASHPSPOOL | \
83 CEPH_FEATURE_OSD_CACHEPOOL | \ 90 CEPH_FEATURE_OSD_CACHEPOOL | \
84 CEPH_FEATURE_CRUSH_V2 | \ 91 CEPH_FEATURE_CRUSH_V2 | \
85 CEPH_FEATURE_EXPORT_PEER) 92 CEPH_FEATURE_EXPORT_PEER | \
93 CEPH_FEATURE_OSDMAP_ENC | \
94 CEPH_FEATURE_CRUSH_TUNABLES3 | \
95 CEPH_FEATURE_OSD_PRIMARY_AFFINITY)
86 96
87#define CEPH_FEATURES_REQUIRED_DEFAULT \ 97#define CEPH_FEATURES_REQUIRED_DEFAULT \
88 (CEPH_FEATURE_NOSRCADDR | \ 98 (CEPH_FEATURE_NOSRCADDR | \
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 25bfb0eff772..5f6db18d72e8 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -332,6 +332,7 @@ enum {
332 CEPH_MDS_OP_LOOKUPHASH = 0x00102, 332 CEPH_MDS_OP_LOOKUPHASH = 0x00102,
333 CEPH_MDS_OP_LOOKUPPARENT = 0x00103, 333 CEPH_MDS_OP_LOOKUPPARENT = 0x00103,
334 CEPH_MDS_OP_LOOKUPINO = 0x00104, 334 CEPH_MDS_OP_LOOKUPINO = 0x00104,
335 CEPH_MDS_OP_LOOKUPNAME = 0x00105,
335 336
336 CEPH_MDS_OP_SETXATTR = 0x01105, 337 CEPH_MDS_OP_SETXATTR = 0x01105,
337 CEPH_MDS_OP_RMXATTR = 0x01106, 338 CEPH_MDS_OP_RMXATTR = 0x01106,
@@ -420,8 +421,8 @@ union ceph_mds_request_args {
420 struct { 421 struct {
421 __u8 rule; /* currently fcntl or flock */ 422 __u8 rule; /* currently fcntl or flock */
422 __u8 type; /* shared, exclusive, remove*/ 423 __u8 type; /* shared, exclusive, remove*/
424 __le64 owner; /* owner of the lock */
423 __le64 pid; /* process id requesting the lock */ 425 __le64 pid; /* process id requesting the lock */
424 __le64 pid_namespace;
425 __le64 start; /* initial location to lock */ 426 __le64 start; /* initial location to lock */
426 __le64 length; /* num bytes to lock from start */ 427 __le64 length; /* num bytes to lock from start */
427 __u8 wait; /* will caller wait for lock to become available? */ 428 __u8 wait; /* will caller wait for lock to become available? */
@@ -532,8 +533,8 @@ struct ceph_filelock {
532 __le64 start;/* file offset to start lock at */ 533 __le64 start;/* file offset to start lock at */
533 __le64 length; /* num bytes to lock; 0 for all following start */ 534 __le64 length; /* num bytes to lock; 0 for all following start */
534 __le64 client; /* which client holds the lock */ 535 __le64 client; /* which client holds the lock */
536 __le64 owner; /* owner the lock */
535 __le64 pid; /* process id holding the lock on the client */ 537 __le64 pid; /* process id holding the lock on the client */
536 __le64 pid_namespace;
537 __u8 type; /* shared lock, exclusive lock, or unlock */ 538 __u8 type; /* shared lock, exclusive lock, or unlock */
538} __attribute__ ((packed)); 539} __attribute__ ((packed));
539 540
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index fd47e872ebcc..94ec69672164 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -43,7 +43,7 @@ struct ceph_osd {
43}; 43};
44 44
45 45
46#define CEPH_OSD_MAX_OP 2 46#define CEPH_OSD_MAX_OP 3
47 47
48enum ceph_osd_data_type { 48enum ceph_osd_data_type {
49 CEPH_OSD_DATA_TYPE_NONE = 0, 49 CEPH_OSD_DATA_TYPE_NONE = 0,
@@ -76,6 +76,7 @@ struct ceph_osd_data {
76 76
77struct ceph_osd_req_op { 77struct ceph_osd_req_op {
78 u16 op; /* CEPH_OSD_OP_* */ 78 u16 op; /* CEPH_OSD_OP_* */
79 u32 flags; /* CEPH_OSD_OP_FLAG_* */
79 u32 payload_len; 80 u32 payload_len;
80 union { 81 union {
81 struct ceph_osd_data raw_data_in; 82 struct ceph_osd_data raw_data_in;
@@ -102,6 +103,10 @@ struct ceph_osd_req_op {
102 u32 timeout; 103 u32 timeout;
103 __u8 flag; 104 __u8 flag;
104 } watch; 105 } watch;
106 struct {
107 u64 expected_object_size;
108 u64 expected_write_size;
109 } alloc_hint;
105 }; 110 };
106}; 111};
107 112
@@ -293,6 +298,10 @@ extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req,
293extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req, 298extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req,
294 unsigned int which, u16 opcode, 299 unsigned int which, u16 opcode,
295 u64 cookie, u64 version, int flag); 300 u64 cookie, u64 version, int flag);
301extern void osd_req_op_alloc_hint_init(struct ceph_osd_request *osd_req,
302 unsigned int which,
303 u64 expected_object_size,
304 u64 expected_write_size);
296 305
297extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, 306extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
298 struct ceph_snap_context *snapc, 307 struct ceph_snap_context *snapc,
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 49ff69f0746b..561ea896c657 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -41,6 +41,18 @@ struct ceph_pg_pool_info {
41 char *name; 41 char *name;
42}; 42};
43 43
44static inline bool ceph_can_shift_osds(struct ceph_pg_pool_info *pool)
45{
46 switch (pool->type) {
47 case CEPH_POOL_TYPE_REP:
48 return true;
49 case CEPH_POOL_TYPE_EC:
50 return false;
51 default:
52 BUG_ON(1);
53 }
54}
55
44struct ceph_object_locator { 56struct ceph_object_locator {
45 s64 pool; 57 s64 pool;
46}; 58};
@@ -60,8 +72,16 @@ struct ceph_object_id {
60struct ceph_pg_mapping { 72struct ceph_pg_mapping {
61 struct rb_node node; 73 struct rb_node node;
62 struct ceph_pg pgid; 74 struct ceph_pg pgid;
63 int len; 75
64 int osds[]; 76 union {
77 struct {
78 int len;
79 int osds[];
80 } pg_temp;
81 struct {
82 int osd;
83 } primary_temp;
84 };
65}; 85};
66 86
67struct ceph_osdmap { 87struct ceph_osdmap {
@@ -78,12 +98,19 @@ struct ceph_osdmap {
78 struct ceph_entity_addr *osd_addr; 98 struct ceph_entity_addr *osd_addr;
79 99
80 struct rb_root pg_temp; 100 struct rb_root pg_temp;
101 struct rb_root primary_temp;
102
103 u32 *osd_primary_affinity;
104
81 struct rb_root pg_pools; 105 struct rb_root pg_pools;
82 u32 pool_max; 106 u32 pool_max;
83 107
84 /* the CRUSH map specifies the mapping of placement groups to 108 /* the CRUSH map specifies the mapping of placement groups to
85 * the list of osds that store+replicate them. */ 109 * the list of osds that store+replicate them. */
86 struct crush_map *crush; 110 struct crush_map *crush;
111
112 struct mutex crush_scratch_mutex;
113 int crush_scratch_ary[CEPH_PG_MAX_SIZE * 3];
87}; 114};
88 115
89static inline void ceph_oid_set_name(struct ceph_object_id *oid, 116static inline void ceph_oid_set_name(struct ceph_object_id *oid,
@@ -110,9 +137,21 @@ static inline void ceph_oid_copy(struct ceph_object_id *dest,
110 dest->name_len = src->name_len; 137 dest->name_len = src->name_len;
111} 138}
112 139
140static inline int ceph_osd_exists(struct ceph_osdmap *map, int osd)
141{
142 return osd >= 0 && osd < map->max_osd &&
143 (map->osd_state[osd] & CEPH_OSD_EXISTS);
144}
145
113static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) 146static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd)
114{ 147{
115 return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP); 148 return ceph_osd_exists(map, osd) &&
149 (map->osd_state[osd] & CEPH_OSD_UP);
150}
151
152static inline int ceph_osd_is_down(struct ceph_osdmap *map, int osd)
153{
154 return !ceph_osd_is_up(map, osd);
116} 155}
117 156
118static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag) 157static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag)
@@ -121,6 +160,7 @@ static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag)
121} 160}
122 161
123extern char *ceph_osdmap_state_str(char *str, int len, int state); 162extern char *ceph_osdmap_state_str(char *str, int len, int state);
163extern u32 ceph_get_primary_affinity(struct ceph_osdmap *map, int osd);
124 164
125static inline struct ceph_entity_addr *ceph_osd_addr(struct ceph_osdmap *map, 165static inline struct ceph_entity_addr *ceph_osd_addr(struct ceph_osdmap *map,
126 int osd) 166 int osd)
@@ -153,7 +193,7 @@ static inline int ceph_decode_pgid(void **p, void *end, struct ceph_pg *pgid)
153 return 0; 193 return 0;
154} 194}
155 195
156extern struct ceph_osdmap *osdmap_decode(void **p, void *end); 196extern struct ceph_osdmap *ceph_osdmap_decode(void **p, void *end);
157extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, 197extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
158 struct ceph_osdmap *map, 198 struct ceph_osdmap *map,
159 struct ceph_messenger *msgr); 199 struct ceph_messenger *msgr);
@@ -172,7 +212,7 @@ extern int ceph_oloc_oid_to_pg(struct ceph_osdmap *osdmap,
172 212
173extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, 213extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap,
174 struct ceph_pg pgid, 214 struct ceph_pg pgid,
175 int *acting); 215 int *osds, int *primary);
176extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, 216extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
177 struct ceph_pg pgid); 217 struct ceph_pg pgid);
178 218
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 96292df4041b..f20e0d8a2155 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -81,8 +81,9 @@ struct ceph_pg_v1 {
81 */ 81 */
82#define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */ 82#define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */
83 83
84#define CEPH_PG_TYPE_REP 1 84#define CEPH_POOL_TYPE_REP 1
85#define CEPH_PG_TYPE_RAID4 2 85#define CEPH_POOL_TYPE_RAID4 2 /* never implemented */
86#define CEPH_POOL_TYPE_EC 3
86 87
87/* 88/*
88 * stable_mod func is used to control number of placement groups. 89 * stable_mod func is used to control number of placement groups.
@@ -133,6 +134,10 @@ extern const char *ceph_osd_state_name(int s);
133#define CEPH_OSD_IN 0x10000 134#define CEPH_OSD_IN 0x10000
134#define CEPH_OSD_OUT 0 135#define CEPH_OSD_OUT 0
135 136
137/* osd primary-affinity. fixed point value: 0x10000 == baseline */
138#define CEPH_OSD_MAX_PRIMARY_AFFINITY 0x10000
139#define CEPH_OSD_DEFAULT_PRIMARY_AFFINITY 0x10000
140
136 141
137/* 142/*
138 * osd map flag bits 143 * osd map flag bits
@@ -227,6 +232,9 @@ enum {
227 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24, 232 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
228 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25, 233 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
229 234
235 /* hints */
236 CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35,
237
230 /** multi **/ 238 /** multi **/
231 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1, 239 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
232 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2, 240 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
@@ -382,7 +390,7 @@ enum {
382 */ 390 */
383struct ceph_osd_op { 391struct ceph_osd_op {
384 __le16 op; /* CEPH_OSD_OP_* */ 392 __le16 op; /* CEPH_OSD_OP_* */
385 __le32 flags; /* CEPH_OSD_FLAG_* */ 393 __le32 flags; /* CEPH_OSD_OP_FLAG_* */
386 union { 394 union {
387 struct { 395 struct {
388 __le64 offset, length; 396 __le64 offset, length;
@@ -416,6 +424,10 @@ struct ceph_osd_op {
416 __le64 offset, length; 424 __le64 offset, length;
417 __le64 src_offset; 425 __le64 src_offset;
418 } __attribute__ ((packed)) clonerange; 426 } __attribute__ ((packed)) clonerange;
427 struct {
428 __le64 expected_object_size;
429 __le64 expected_write_size;
430 } __attribute__ ((packed)) alloc_hint;
419 }; 431 };
420 __le32 payload_len; 432 __le32 payload_len;
421} __attribute__ ((packed)); 433} __attribute__ ((packed));
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 9450f025fe0c..c2515851c1aa 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -14,18 +14,17 @@
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15#include <linux/rculist.h> 15#include <linux/rculist.h>
16#include <linux/cgroupstats.h> 16#include <linux/cgroupstats.h>
17#include <linux/prio_heap.h>
18#include <linux/rwsem.h> 17#include <linux/rwsem.h>
19#include <linux/idr.h> 18#include <linux/idr.h>
20#include <linux/workqueue.h> 19#include <linux/workqueue.h>
21#include <linux/xattr.h>
22#include <linux/fs.h> 20#include <linux/fs.h>
23#include <linux/percpu-refcount.h> 21#include <linux/percpu-refcount.h>
24#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/kernfs.h>
25 24
26#ifdef CONFIG_CGROUPS 25#ifdef CONFIG_CGROUPS
27 26
28struct cgroupfs_root; 27struct cgroup_root;
29struct cgroup_subsys; 28struct cgroup_subsys;
30struct inode; 29struct inode;
31struct cgroup; 30struct cgroup;
@@ -34,31 +33,16 @@ extern int cgroup_init_early(void);
34extern int cgroup_init(void); 33extern int cgroup_init(void);
35extern void cgroup_fork(struct task_struct *p); 34extern void cgroup_fork(struct task_struct *p);
36extern void cgroup_post_fork(struct task_struct *p); 35extern void cgroup_post_fork(struct task_struct *p);
37extern void cgroup_exit(struct task_struct *p, int run_callbacks); 36extern void cgroup_exit(struct task_struct *p);
38extern int cgroupstats_build(struct cgroupstats *stats, 37extern int cgroupstats_build(struct cgroupstats *stats,
39 struct dentry *dentry); 38 struct dentry *dentry);
40extern int cgroup_load_subsys(struct cgroup_subsys *ss);
41extern void cgroup_unload_subsys(struct cgroup_subsys *ss);
42 39
43extern int proc_cgroup_show(struct seq_file *, void *); 40extern int proc_cgroup_show(struct seq_file *, void *);
44 41
45/* 42/* define the enumeration of all cgroup subsystems */
46 * Define the enumeration of all cgroup subsystems. 43#define SUBSYS(_x) _x ## _cgrp_id,
47 *
48 * We define ids for builtin subsystems and then modular ones.
49 */
50#define SUBSYS(_x) _x ## _subsys_id,
51enum cgroup_subsys_id { 44enum cgroup_subsys_id {
52#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
53#include <linux/cgroup_subsys.h>
54#undef IS_SUBSYS_ENABLED
55 CGROUP_BUILTIN_SUBSYS_COUNT,
56
57 __CGROUP_SUBSYS_TEMP_PLACEHOLDER = CGROUP_BUILTIN_SUBSYS_COUNT - 1,
58
59#define IS_SUBSYS_ENABLED(option) IS_MODULE(option)
60#include <linux/cgroup_subsys.h> 45#include <linux/cgroup_subsys.h>
61#undef IS_SUBSYS_ENABLED
62 CGROUP_SUBSYS_COUNT, 46 CGROUP_SUBSYS_COUNT,
63}; 47};
64#undef SUBSYS 48#undef SUBSYS
@@ -153,11 +137,6 @@ enum {
153 CGRP_SANE_BEHAVIOR, 137 CGRP_SANE_BEHAVIOR,
154}; 138};
155 139
156struct cgroup_name {
157 struct rcu_head rcu_head;
158 char name[];
159};
160
161struct cgroup { 140struct cgroup {
162 unsigned long flags; /* "unsigned long" so bitops work */ 141 unsigned long flags; /* "unsigned long" so bitops work */
163 142
@@ -174,16 +153,17 @@ struct cgroup {
174 /* the number of attached css's */ 153 /* the number of attached css's */
175 int nr_css; 154 int nr_css;
176 155
156 atomic_t refcnt;
157
177 /* 158 /*
178 * We link our 'sibling' struct into our parent's 'children'. 159 * We link our 'sibling' struct into our parent's 'children'.
179 * Our children link their 'sibling' into our 'children'. 160 * Our children link their 'sibling' into our 'children'.
180 */ 161 */
181 struct list_head sibling; /* my parent's children */ 162 struct list_head sibling; /* my parent's children */
182 struct list_head children; /* my children */ 163 struct list_head children; /* my children */
183 struct list_head files; /* my files */
184 164
185 struct cgroup *parent; /* my parent */ 165 struct cgroup *parent; /* my parent */
186 struct dentry *dentry; /* cgroup fs entry, RCU protected */ 166 struct kernfs_node *kn; /* cgroup kernfs entry */
187 167
188 /* 168 /*
189 * Monotonically increasing unique serial number which defines a 169 * Monotonically increasing unique serial number which defines a
@@ -193,23 +173,13 @@ struct cgroup {
193 */ 173 */
194 u64 serial_nr; 174 u64 serial_nr;
195 175
196 /* 176 /* The bitmask of subsystems attached to this cgroup */
197 * This is a copy of dentry->d_name, and it's needed because 177 unsigned long subsys_mask;
198 * we can't use dentry->d_name in cgroup_path().
199 *
200 * You must acquire rcu_read_lock() to access cgrp->name, and
201 * the only place that can change it is rename(), which is
202 * protected by parent dir's i_mutex.
203 *
204 * Normally you should use cgroup_name() wrapper rather than
205 * access it directly.
206 */
207 struct cgroup_name __rcu *name;
208 178
209 /* Private pointers for each registered subsystem */ 179 /* Private pointers for each registered subsystem */
210 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT]; 180 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
211 181
212 struct cgroupfs_root *root; 182 struct cgroup_root *root;
213 183
214 /* 184 /*
215 * List of cgrp_cset_links pointing at css_sets with tasks in this 185 * List of cgrp_cset_links pointing at css_sets with tasks in this
@@ -237,14 +207,11 @@ struct cgroup {
237 /* For css percpu_ref killing and RCU-protected deletion */ 207 /* For css percpu_ref killing and RCU-protected deletion */
238 struct rcu_head rcu_head; 208 struct rcu_head rcu_head;
239 struct work_struct destroy_work; 209 struct work_struct destroy_work;
240
241 /* directory xattrs */
242 struct simple_xattrs xattrs;
243}; 210};
244 211
245#define MAX_CGROUP_ROOT_NAMELEN 64 212#define MAX_CGROUP_ROOT_NAMELEN 64
246 213
247/* cgroupfs_root->flags */ 214/* cgroup_root->flags */
248enum { 215enum {
249 /* 216 /*
250 * Unfortunately, cgroup core and various controllers are riddled 217 * Unfortunately, cgroup core and various controllers are riddled
@@ -262,8 +229,8 @@ enum {
262 * 229 *
263 * The followings are the behaviors currently affected this flag. 230 * The followings are the behaviors currently affected this flag.
264 * 231 *
265 * - Mount options "noprefix" and "clone_children" are disallowed. 232 * - Mount options "noprefix", "xattr", "clone_children",
266 * Also, cgroupfs file cgroup.clone_children is not created. 233 * "release_agent" and "name" are disallowed.
267 * 234 *
268 * - When mounting an existing superblock, mount options should 235 * - When mounting an existing superblock, mount options should
269 * match. 236 * match.
@@ -281,6 +248,11 @@ enum {
281 * - "release_agent" and "notify_on_release" are removed. 248 * - "release_agent" and "notify_on_release" are removed.
282 * Replacement notification mechanism will be implemented. 249 * Replacement notification mechanism will be implemented.
283 * 250 *
251 * - "cgroup.clone_children" is removed.
252 *
253 * - If mount is requested with sane_behavior but without any
254 * subsystem, the default unified hierarchy is mounted.
255 *
284 * - cpuset: tasks will be kept in empty cpusets when hotplug happens 256 * - cpuset: tasks will be kept in empty cpusets when hotplug happens
285 * and take masks of ancestors with non-empty cpus/mems, instead of 257 * and take masks of ancestors with non-empty cpus/mems, instead of
286 * being moved to an ancestor. 258 * being moved to an ancestor.
@@ -300,29 +272,24 @@ enum {
300 272
301 /* mount options live below bit 16 */ 273 /* mount options live below bit 16 */
302 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1, 274 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1,
303
304 CGRP_ROOT_SUBSYS_BOUND = (1 << 16), /* subsystems finished binding */
305}; 275};
306 276
307/* 277/*
308 * A cgroupfs_root represents the root of a cgroup hierarchy, and may be 278 * A cgroup_root represents the root of a cgroup hierarchy, and may be
309 * associated with a superblock to form an active hierarchy. This is 279 * associated with a kernfs_root to form an active hierarchy. This is
310 * internal to cgroup core. Don't access directly from controllers. 280 * internal to cgroup core. Don't access directly from controllers.
311 */ 281 */
312struct cgroupfs_root { 282struct cgroup_root {
313 struct super_block *sb; 283 struct kernfs_root *kf_root;
314
315 /* The bitmask of subsystems attached to this hierarchy */
316 unsigned long subsys_mask;
317 284
318 /* Unique id for this hierarchy. */ 285 /* Unique id for this hierarchy. */
319 int hierarchy_id; 286 int hierarchy_id;
320 287
321 /* The root cgroup for this hierarchy */ 288 /* The root cgroup. Root is destroyed on its release. */
322 struct cgroup top_cgroup; 289 struct cgroup cgrp;
323 290
324 /* Tracks how many cgroups are currently defined in hierarchy.*/ 291 /* Number of cgroups in the hierarchy, used only for /proc/cgroups */
325 int number_of_cgroups; 292 atomic_t nr_cgrps;
326 293
327 /* A list running through the active hierarchies */ 294 /* A list running through the active hierarchies */
328 struct list_head root_list; 295 struct list_head root_list;
@@ -360,10 +327,14 @@ struct css_set {
360 struct hlist_node hlist; 327 struct hlist_node hlist;
361 328
362 /* 329 /*
363 * List running through all tasks using this cgroup 330 * Lists running through all tasks using this cgroup group.
364 * group. Protected by css_set_lock 331 * mg_tasks lists tasks which belong to this cset but are in the
332 * process of being migrated out or in. Protected by
333 * css_set_rwsem, but, during migration, once tasks are moved to
334 * mg_tasks, it can be read safely while holding cgroup_mutex.
365 */ 335 */
366 struct list_head tasks; 336 struct list_head tasks;
337 struct list_head mg_tasks;
367 338
368 /* 339 /*
369 * List of cgrp_cset_links pointing at cgroups referenced from this 340 * List of cgrp_cset_links pointing at cgroups referenced from this
@@ -372,13 +343,29 @@ struct css_set {
372 struct list_head cgrp_links; 343 struct list_head cgrp_links;
373 344
374 /* 345 /*
375 * Set of subsystem states, one for each subsystem. This array 346 * Set of subsystem states, one for each subsystem. This array is
376 * is immutable after creation apart from the init_css_set 347 * immutable after creation apart from the init_css_set during
377 * during subsystem registration (at boot time) and modular subsystem 348 * subsystem registration (at boot time).
378 * loading/unloading.
379 */ 349 */
380 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 350 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
381 351
352 /*
353 * List of csets participating in the on-going migration either as
354 * source or destination. Protected by cgroup_mutex.
355 */
356 struct list_head mg_preload_node;
357 struct list_head mg_node;
358
359 /*
360 * If this cset is acting as the source of migration the following
361 * two fields are set. mg_src_cgrp is the source cgroup of the
362 * on-going migration and mg_dst_cset is the destination cset the
363 * target tasks on this cset should be migrated to. Protected by
364 * cgroup_mutex.
365 */
366 struct cgroup *mg_src_cgrp;
367 struct css_set *mg_dst_cset;
368
382 /* For RCU-protected deletion */ 369 /* For RCU-protected deletion */
383 struct rcu_head rcu_head; 370 struct rcu_head rcu_head;
384}; 371};
@@ -397,6 +384,7 @@ enum {
397 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ 384 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
398 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */ 385 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
399 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ 386 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
387 CFTYPE_ONLY_ON_DFL = (1 << 4), /* only on default hierarchy */
400}; 388};
401 389
402#define MAX_CFTYPE_NAME 64 390#define MAX_CFTYPE_NAME 64
@@ -416,8 +404,9 @@ struct cftype {
416 umode_t mode; 404 umode_t mode;
417 405
418 /* 406 /*
419 * If non-zero, defines the maximum length of string that can 407 * The maximum length of string, excluding trailing nul, that can
420 * be passed to write_string; defaults to 64 408 * be passed to write_string. If < PAGE_SIZE-1, PAGE_SIZE-1 is
409 * assumed.
421 */ 410 */
422 size_t max_write_len; 411 size_t max_write_len;
423 412
@@ -425,10 +414,12 @@ struct cftype {
425 unsigned int flags; 414 unsigned int flags;
426 415
427 /* 416 /*
428 * The subsys this file belongs to. Initialized automatically 417 * Fields used for internal bookkeeping. Initialized automatically
429 * during registration. NULL for cgroup core files. 418 * during registration.
430 */ 419 */
431 struct cgroup_subsys *ss; 420 struct cgroup_subsys *ss; /* NULL for cgroup core files */
421 struct list_head node; /* anchored at ss->cfts */
422 struct kernfs_ops *kf_ops;
432 423
433 /* 424 /*
434 * read_u64() is a shortcut for the common case of returning a 425 * read_u64() is a shortcut for the common case of returning a
@@ -467,7 +458,7 @@ struct cftype {
467 * Returns 0 or -ve error code. 458 * Returns 0 or -ve error code.
468 */ 459 */
469 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft, 460 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft,
470 const char *buffer); 461 char *buffer);
471 /* 462 /*
472 * trigger() callback can be used to get some kick from the 463 * trigger() callback can be used to get some kick from the
473 * userspace, when the actual string written is not important 464 * userspace, when the actual string written is not important
@@ -475,37 +466,18 @@ struct cftype {
475 * kick type for multiplexing. 466 * kick type for multiplexing.
476 */ 467 */
477 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event); 468 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event);
478};
479 469
480/* 470#ifdef CONFIG_DEBUG_LOCK_ALLOC
481 * cftype_sets describe cftypes belonging to a subsystem and are chained at 471 struct lock_class_key lockdep_key;
482 * cgroup_subsys->cftsets. Each cftset points to an array of cftypes 472#endif
483 * terminated by zero length name.
484 */
485struct cftype_set {
486 struct list_head node; /* chained at subsys->cftsets */
487 struct cftype *cfts;
488}; 473};
489 474
490/* 475extern struct cgroup_root cgrp_dfl_root;
491 * cgroupfs file entry, pointed to from leaf dentry->d_fsdata. Don't
492 * access directly.
493 */
494struct cfent {
495 struct list_head node;
496 struct dentry *dentry;
497 struct cftype *type;
498 struct cgroup_subsys_state *css;
499
500 /* file xattrs */
501 struct simple_xattrs xattrs;
502};
503 476
504/* seq_file->private points to the following, only ->priv is public */ 477static inline bool cgroup_on_dfl(const struct cgroup *cgrp)
505struct cgroup_open_file { 478{
506 struct cfent *cfe; 479 return cgrp->root == &cgrp_dfl_root;
507 void *priv; 480}
508};
509 481
510/* 482/*
511 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This 483 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
@@ -516,34 +488,63 @@ static inline bool cgroup_sane_behavior(const struct cgroup *cgrp)
516 return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR; 488 return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR;
517} 489}
518 490
519/* Caller should hold rcu_read_lock() */ 491/* no synchronization, the result can only be used as a hint */
520static inline const char *cgroup_name(const struct cgroup *cgrp) 492static inline bool cgroup_has_tasks(struct cgroup *cgrp)
521{ 493{
522 return rcu_dereference(cgrp->name)->name; 494 return !list_empty(&cgrp->cset_links);
523} 495}
524 496
525static inline struct cgroup_subsys_state *seq_css(struct seq_file *seq) 497/* returns ino associated with a cgroup, 0 indicates unmounted root */
498static inline ino_t cgroup_ino(struct cgroup *cgrp)
526{ 499{
527 struct cgroup_open_file *of = seq->private; 500 if (cgrp->kn)
528 return of->cfe->css; 501 return cgrp->kn->ino;
502 else
503 return 0;
529} 504}
530 505
531static inline struct cftype *seq_cft(struct seq_file *seq) 506static inline struct cftype *seq_cft(struct seq_file *seq)
532{ 507{
533 struct cgroup_open_file *of = seq->private; 508 struct kernfs_open_file *of = seq->private;
534 return of->cfe->type; 509
510 return of->kn->priv;
511}
512
513struct cgroup_subsys_state *seq_css(struct seq_file *seq);
514
515/*
516 * Name / path handling functions. All are thin wrappers around the kernfs
517 * counterparts and can be called under any context.
518 */
519
520static inline int cgroup_name(struct cgroup *cgrp, char *buf, size_t buflen)
521{
522 return kernfs_name(cgrp->kn, buf, buflen);
535} 523}
536 524
525static inline char * __must_check cgroup_path(struct cgroup *cgrp, char *buf,
526 size_t buflen)
527{
528 return kernfs_path(cgrp->kn, buf, buflen);
529}
530
531static inline void pr_cont_cgroup_name(struct cgroup *cgrp)
532{
533 pr_cont_kernfs_name(cgrp->kn);
534}
535
536static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
537{
538 pr_cont_kernfs_path(cgrp->kn);
539}
540
541char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
542
537int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 543int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
538int cgroup_rm_cftypes(struct cftype *cfts); 544int cgroup_rm_cftypes(struct cftype *cfts);
539 545
540bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 546bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
541 547
542int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
543int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
544
545int cgroup_task_count(const struct cgroup *cgrp);
546
547/* 548/*
548 * Control Group taskset, used to pass around set of tasks to cgroup_subsys 549 * Control Group taskset, used to pass around set of tasks to cgroup_subsys
549 * methods. 550 * methods.
@@ -551,22 +552,15 @@ int cgroup_task_count(const struct cgroup *cgrp);
551struct cgroup_taskset; 552struct cgroup_taskset;
552struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); 553struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
553struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); 554struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
554struct cgroup_subsys_state *cgroup_taskset_cur_css(struct cgroup_taskset *tset,
555 int subsys_id);
556int cgroup_taskset_size(struct cgroup_taskset *tset);
557 555
558/** 556/**
559 * cgroup_taskset_for_each - iterate cgroup_taskset 557 * cgroup_taskset_for_each - iterate cgroup_taskset
560 * @task: the loop cursor 558 * @task: the loop cursor
561 * @skip_css: skip if task's css matches this, %NULL to iterate through all
562 * @tset: taskset to iterate 559 * @tset: taskset to iterate
563 */ 560 */
564#define cgroup_taskset_for_each(task, skip_css, tset) \ 561#define cgroup_taskset_for_each(task, tset) \
565 for ((task) = cgroup_taskset_first((tset)); (task); \ 562 for ((task) = cgroup_taskset_first((tset)); (task); \
566 (task) = cgroup_taskset_next((tset))) \ 563 (task) = cgroup_taskset_next((tset)))
567 if (!(skip_css) || \
568 cgroup_taskset_cur_css((tset), \
569 (skip_css)->ss->subsys_id) != (skip_css))
570 564
571/* 565/*
572 * Control Group subsystem type. 566 * Control Group subsystem type.
@@ -591,7 +585,6 @@ struct cgroup_subsys {
591 struct task_struct *task); 585 struct task_struct *task);
592 void (*bind)(struct cgroup_subsys_state *root_css); 586 void (*bind)(struct cgroup_subsys_state *root_css);
593 587
594 int subsys_id;
595 int disabled; 588 int disabled;
596 int early_init; 589 int early_init;
597 590
@@ -610,27 +603,26 @@ struct cgroup_subsys {
610 bool broken_hierarchy; 603 bool broken_hierarchy;
611 bool warned_broken_hierarchy; 604 bool warned_broken_hierarchy;
612 605
606 /* the following two fields are initialized automtically during boot */
607 int id;
613#define MAX_CGROUP_TYPE_NAMELEN 32 608#define MAX_CGROUP_TYPE_NAMELEN 32
614 const char *name; 609 const char *name;
615 610
616 /* link to parent, protected by cgroup_lock() */ 611 /* link to parent, protected by cgroup_lock() */
617 struct cgroupfs_root *root; 612 struct cgroup_root *root;
618 613
619 /* list of cftype_sets */ 614 /*
620 struct list_head cftsets; 615 * List of cftypes. Each entry is the first entry of an array
616 * terminated by zero length name.
617 */
618 struct list_head cfts;
621 619
622 /* base cftypes, automatically [de]registered with subsys itself */ 620 /* base cftypes, automatically registered with subsys itself */
623 struct cftype *base_cftypes; 621 struct cftype *base_cftypes;
624 struct cftype_set base_cftset;
625
626 /* should be defined only by modular subsystems */
627 struct module *module;
628}; 622};
629 623
630#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; 624#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys;
631#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
632#include <linux/cgroup_subsys.h> 625#include <linux/cgroup_subsys.h>
633#undef IS_SUBSYS_ENABLED
634#undef SUBSYS 626#undef SUBSYS
635 627
636/** 628/**
@@ -661,10 +653,12 @@ struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
661 */ 653 */
662#ifdef CONFIG_PROVE_RCU 654#ifdef CONFIG_PROVE_RCU
663extern struct mutex cgroup_mutex; 655extern struct mutex cgroup_mutex;
656extern struct rw_semaphore css_set_rwsem;
664#define task_css_set_check(task, __c) \ 657#define task_css_set_check(task, __c) \
665 rcu_dereference_check((task)->cgroups, \ 658 rcu_dereference_check((task)->cgroups, \
666 lockdep_is_held(&(task)->alloc_lock) || \ 659 lockdep_is_held(&cgroup_mutex) || \
667 lockdep_is_held(&cgroup_mutex) || (__c)) 660 lockdep_is_held(&css_set_rwsem) || \
661 ((task)->flags & PF_EXITING) || (__c))
668#else 662#else
669#define task_css_set_check(task, __c) \ 663#define task_css_set_check(task, __c) \
670 rcu_dereference((task)->cgroups) 664 rcu_dereference((task)->cgroups)
@@ -837,16 +831,11 @@ void css_task_iter_start(struct cgroup_subsys_state *css,
837struct task_struct *css_task_iter_next(struct css_task_iter *it); 831struct task_struct *css_task_iter_next(struct css_task_iter *it);
838void css_task_iter_end(struct css_task_iter *it); 832void css_task_iter_end(struct css_task_iter *it);
839 833
840int css_scan_tasks(struct cgroup_subsys_state *css,
841 bool (*test)(struct task_struct *, void *),
842 void (*process)(struct task_struct *, void *),
843 void *data, struct ptr_heap *heap);
844
845int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 834int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
846int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 835int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
847 836
848struct cgroup_subsys_state *css_from_dir(struct dentry *dentry, 837struct cgroup_subsys_state *css_tryget_from_dir(struct dentry *dentry,
849 struct cgroup_subsys *ss); 838 struct cgroup_subsys *ss);
850 839
851#else /* !CONFIG_CGROUPS */ 840#else /* !CONFIG_CGROUPS */
852 841
@@ -854,7 +843,7 @@ static inline int cgroup_init_early(void) { return 0; }
854static inline int cgroup_init(void) { return 0; } 843static inline int cgroup_init(void) { return 0; }
855static inline void cgroup_fork(struct task_struct *p) {} 844static inline void cgroup_fork(struct task_struct *p) {}
856static inline void cgroup_post_fork(struct task_struct *p) {} 845static inline void cgroup_post_fork(struct task_struct *p) {}
857static inline void cgroup_exit(struct task_struct *p, int callbacks) {} 846static inline void cgroup_exit(struct task_struct *p) {}
858 847
859static inline int cgroupstats_build(struct cgroupstats *stats, 848static inline int cgroupstats_build(struct cgroupstats *stats,
860 struct dentry *dentry) 849 struct dentry *dentry)
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 7b99d717411d..768fe44e19f0 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -3,51 +3,51 @@
3 * 3 *
4 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS. 4 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
5 */ 5 */
6#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS) 6#if IS_ENABLED(CONFIG_CPUSETS)
7SUBSYS(cpuset) 7SUBSYS(cpuset)
8#endif 8#endif
9 9
10#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG) 10#if IS_ENABLED(CONFIG_CGROUP_DEBUG)
11SUBSYS(debug) 11SUBSYS(debug)
12#endif 12#endif
13 13
14#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED) 14#if IS_ENABLED(CONFIG_CGROUP_SCHED)
15SUBSYS(cpu_cgroup) 15SUBSYS(cpu)
16#endif 16#endif
17 17
18#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT) 18#if IS_ENABLED(CONFIG_CGROUP_CPUACCT)
19SUBSYS(cpuacct) 19SUBSYS(cpuacct)
20#endif 20#endif
21 21
22#if IS_SUBSYS_ENABLED(CONFIG_MEMCG) 22#if IS_ENABLED(CONFIG_MEMCG)
23SUBSYS(mem_cgroup) 23SUBSYS(memory)
24#endif 24#endif
25 25
26#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE) 26#if IS_ENABLED(CONFIG_CGROUP_DEVICE)
27SUBSYS(devices) 27SUBSYS(devices)
28#endif 28#endif
29 29
30#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER) 30#if IS_ENABLED(CONFIG_CGROUP_FREEZER)
31SUBSYS(freezer) 31SUBSYS(freezer)
32#endif 32#endif
33 33
34#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_NET_CLASSID) 34#if IS_ENABLED(CONFIG_CGROUP_NET_CLASSID)
35SUBSYS(net_cls) 35SUBSYS(net_cls)
36#endif 36#endif
37 37
38#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP) 38#if IS_ENABLED(CONFIG_BLK_CGROUP)
39SUBSYS(blkio) 39SUBSYS(blkio)
40#endif 40#endif
41 41
42#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) 42#if IS_ENABLED(CONFIG_CGROUP_PERF)
43SUBSYS(perf) 43SUBSYS(perf_event)
44#endif 44#endif
45 45
46#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_NET_PRIO) 46#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
47SUBSYS(net_prio) 47SUBSYS(net_prio)
48#endif 48#endif
49 49
50#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB) 50#if IS_ENABLED(CONFIG_CGROUP_HUGETLB)
51SUBSYS(hugetlb) 51SUBSYS(hugetlb)
52#endif 52#endif
53/* 53/*
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 939533da93a7..511917416fb0 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -32,6 +32,7 @@
32#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ 32#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */
33 33
34struct clk_hw; 34struct clk_hw;
35struct dentry;
35 36
36/** 37/**
37 * struct clk_ops - Callback operations for hardware clocks; these are to 38 * struct clk_ops - Callback operations for hardware clocks; these are to
@@ -127,6 +128,12 @@ struct clk_hw;
127 * separately via calls to .set_parent and .set_rate. 128 * separately via calls to .set_parent and .set_rate.
128 * Returns 0 on success, -EERROR otherwise. 129 * Returns 0 on success, -EERROR otherwise.
129 * 130 *
131 * @debug_init: Set up type-specific debugfs entries for this clock. This
132 * is called once, after the debugfs directory entry for this
133 * clock has been created. The dentry pointer representing that
134 * directory is provided as an argument. Called with
135 * prepare_lock held. Returns 0 on success, -EERROR otherwise.
136 *
130 * 137 *
131 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow 138 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
132 * implementations to split any work between atomic (enable) and sleepable 139 * implementations to split any work between atomic (enable) and sleepable
@@ -165,6 +172,7 @@ struct clk_ops {
165 unsigned long (*recalc_accuracy)(struct clk_hw *hw, 172 unsigned long (*recalc_accuracy)(struct clk_hw *hw,
166 unsigned long parent_accuracy); 173 unsigned long parent_accuracy);
167 void (*init)(struct clk_hw *hw); 174 void (*init)(struct clk_hw *hw);
175 int (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
168}; 176};
169 177
170/** 178/**
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 0dd91148165e..fb5e097d8f72 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -78,8 +78,22 @@ struct clk_notifier_data {
78 unsigned long new_rate; 78 unsigned long new_rate;
79}; 79};
80 80
81/**
82 * clk_notifier_register: register a clock rate-change notifier callback
83 * @clk: clock whose rate we are interested in
84 * @nb: notifier block with callback function pointer
85 *
86 * ProTip: debugging across notifier chains can be frustrating. Make sure that
87 * your notifier callback function prints a nice big warning in case of
88 * failure.
89 */
81int clk_notifier_register(struct clk *clk, struct notifier_block *nb); 90int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
82 91
92/**
93 * clk_notifier_unregister: unregister a clock rate-change notifier callback
94 * @clk: clock whose rate we are no longer interested in
95 * @nb: notifier block which will be unregistered
96 */
83int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); 97int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
84 98
85/** 99/**
diff --git a/include/linux/clk/zynq.h b/include/linux/clk/zynq.h
index e062d317ccce..7a5633b71533 100644
--- a/include/linux/clk/zynq.h
+++ b/include/linux/clk/zynq.h
@@ -22,7 +22,7 @@
22 22
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24 24
25void zynq_clock_init(void __iomem *slcr); 25void zynq_clock_init(void);
26 26
27struct clk *clk_register_zynq_pll(const char *name, const char *parent, 27struct clk *clk_register_zynq_pll(const char *name, const char *parent,
28 void __iomem *pll_ctrl, void __iomem *pll_status, u8 lock_index, 28 void __iomem *pll_ctrl, void __iomem *pll_status, u8 lock_index,
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 01c0aa57ccec..e6494261eaff 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -147,26 +147,23 @@ struct compat_sigaction {
147}; 147};
148 148
149/* 149/*
150 * These functions operate strictly on struct compat_time*
151 */
152extern int get_compat_timespec(struct timespec *,
153 const struct compat_timespec __user *);
154extern int put_compat_timespec(const struct timespec *,
155 struct compat_timespec __user *);
156extern int get_compat_timeval(struct timeval *,
157 const struct compat_timeval __user *);
158extern int put_compat_timeval(const struct timeval *,
159 struct compat_timeval __user *);
160/*
161 * These functions operate on 32- or 64-bit specs depending on 150 * These functions operate on 32- or 64-bit specs depending on
162 * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the 151 * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments.
163 * naming as compat_get/put_ rather than get/put_compat_.
164 */ 152 */
165extern int compat_get_timespec(struct timespec *, const void __user *); 153extern int compat_get_timespec(struct timespec *, const void __user *);
166extern int compat_put_timespec(const struct timespec *, void __user *); 154extern int compat_put_timespec(const struct timespec *, void __user *);
167extern int compat_get_timeval(struct timeval *, const void __user *); 155extern int compat_get_timeval(struct timeval *, const void __user *);
168extern int compat_put_timeval(const struct timeval *, void __user *); 156extern int compat_put_timeval(const struct timeval *, void __user *);
169 157
158/*
159 * This function convert a timespec if necessary and returns a *user
160 * space* pointer. If no conversion is necessary, it returns the
161 * initial pointer. NULL is a legitimate argument and will always
162 * output NULL.
163 */
164extern int compat_convert_timespec(struct timespec __user **,
165 const void __user *);
166
170struct compat_iovec { 167struct compat_iovec {
171 compat_uptr_t iov_base; 168 compat_uptr_t iov_base;
172 compat_size_t iov_len; 169 compat_size_t iov_len;
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
new file mode 100644
index 000000000000..d1e49d52b640
--- /dev/null
+++ b/include/linux/compiler-clang.h
@@ -0,0 +1,12 @@
1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."
3#endif
4
5/* Some compiler specific definitions are overwritten here
6 * for Clang compiler
7 */
8
9#ifdef uninitialized_var
10#undef uninitialized_var
11#define uninitialized_var(x) x = *(&(x))
12#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 2472740d7ab2..ee7239ea1583 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -63,6 +63,13 @@ extern void __chk_io_ptr(const volatile void __iomem *);
63# include <linux/compiler-intel.h> 63# include <linux/compiler-intel.h>
64#endif 64#endif
65 65
66/* Clang compiler defines __GNUC__. So we will overwrite implementations
67 * coming from above header files here
68 */
69#ifdef __clang__
70#include <linux/compiler-clang.h>
71#endif
72
66/* 73/*
67 * Generic compiler-dependent macros required for kernel 74 * Generic compiler-dependent macros required for kernel
68 * build go below this comment. Actual compiler/compiler version 75 * build go below this comment. Actual compiler/compiler version
diff --git a/include/linux/connector.h b/include/linux/connector.h
index b2b5a41b6a24..be9c4747d511 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -71,7 +71,7 @@ struct cn_dev {
71int cn_add_callback(struct cb_id *id, const char *name, 71int cn_add_callback(struct cb_id *id, const char *name,
72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); 72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
73void cn_del_callback(struct cb_id *); 73void cn_del_callback(struct cb_id *);
74int cn_netlink_send(struct cn_msg *, u32, gfp_t); 74int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask);
75 75
76int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, 76int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
77 struct cb_id *id, 77 struct cb_id *id,
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 03e235ad1bba..81887120395c 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -46,13 +46,6 @@ extern ssize_t arch_cpu_release(const char *, size_t);
46#endif 46#endif
47struct notifier_block; 47struct notifier_block;
48 48
49#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
50extern int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env);
51extern ssize_t arch_print_cpu_modalias(struct device *dev,
52 struct device_attribute *attr,
53 char *bufptr);
54#endif
55
56/* 49/*
57 * CPU notifier priorities. 50 * CPU notifier priorities.
58 */ 51 */
@@ -122,26 +115,46 @@ enum {
122 { .notifier_call = fn, .priority = pri }; \ 115 { .notifier_call = fn, .priority = pri }; \
123 register_cpu_notifier(&fn##_nb); \ 116 register_cpu_notifier(&fn##_nb); \
124} 117}
118
119#define __cpu_notifier(fn, pri) { \
120 static struct notifier_block fn##_nb = \
121 { .notifier_call = fn, .priority = pri }; \
122 __register_cpu_notifier(&fn##_nb); \
123}
125#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ 124#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
126#define cpu_notifier(fn, pri) do { (void)(fn); } while (0) 125#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
126#define __cpu_notifier(fn, pri) do { (void)(fn); } while (0)
127#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ 127#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
128
128#ifdef CONFIG_HOTPLUG_CPU 129#ifdef CONFIG_HOTPLUG_CPU
129extern int register_cpu_notifier(struct notifier_block *nb); 130extern int register_cpu_notifier(struct notifier_block *nb);
131extern int __register_cpu_notifier(struct notifier_block *nb);
130extern void unregister_cpu_notifier(struct notifier_block *nb); 132extern void unregister_cpu_notifier(struct notifier_block *nb);
133extern void __unregister_cpu_notifier(struct notifier_block *nb);
131#else 134#else
132 135
133#ifndef MODULE 136#ifndef MODULE
134extern int register_cpu_notifier(struct notifier_block *nb); 137extern int register_cpu_notifier(struct notifier_block *nb);
138extern int __register_cpu_notifier(struct notifier_block *nb);
135#else 139#else
136static inline int register_cpu_notifier(struct notifier_block *nb) 140static inline int register_cpu_notifier(struct notifier_block *nb)
137{ 141{
138 return 0; 142 return 0;
139} 143}
144
145static inline int __register_cpu_notifier(struct notifier_block *nb)
146{
147 return 0;
148}
140#endif 149#endif
141 150
142static inline void unregister_cpu_notifier(struct notifier_block *nb) 151static inline void unregister_cpu_notifier(struct notifier_block *nb)
143{ 152{
144} 153}
154
155static inline void __unregister_cpu_notifier(struct notifier_block *nb)
156{
157}
145#endif 158#endif
146 159
147int cpu_up(unsigned int cpu); 160int cpu_up(unsigned int cpu);
@@ -149,19 +162,32 @@ void notify_cpu_starting(unsigned int cpu);
149extern void cpu_maps_update_begin(void); 162extern void cpu_maps_update_begin(void);
150extern void cpu_maps_update_done(void); 163extern void cpu_maps_update_done(void);
151 164
165#define cpu_notifier_register_begin cpu_maps_update_begin
166#define cpu_notifier_register_done cpu_maps_update_done
167
152#else /* CONFIG_SMP */ 168#else /* CONFIG_SMP */
153 169
154#define cpu_notifier(fn, pri) do { (void)(fn); } while (0) 170#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
171#define __cpu_notifier(fn, pri) do { (void)(fn); } while (0)
155 172
156static inline int register_cpu_notifier(struct notifier_block *nb) 173static inline int register_cpu_notifier(struct notifier_block *nb)
157{ 174{
158 return 0; 175 return 0;
159} 176}
160 177
178static inline int __register_cpu_notifier(struct notifier_block *nb)
179{
180 return 0;
181}
182
161static inline void unregister_cpu_notifier(struct notifier_block *nb) 183static inline void unregister_cpu_notifier(struct notifier_block *nb)
162{ 184{
163} 185}
164 186
187static inline void __unregister_cpu_notifier(struct notifier_block *nb)
188{
189}
190
165static inline void cpu_maps_update_begin(void) 191static inline void cpu_maps_update_begin(void)
166{ 192{
167} 193}
@@ -170,6 +196,14 @@ static inline void cpu_maps_update_done(void)
170{ 196{
171} 197}
172 198
199static inline void cpu_notifier_register_begin(void)
200{
201}
202
203static inline void cpu_notifier_register_done(void)
204{
205}
206
173#endif /* CONFIG_SMP */ 207#endif /* CONFIG_SMP */
174extern struct bus_type cpu_subsys; 208extern struct bus_type cpu_subsys;
175 209
@@ -183,8 +217,11 @@ extern void put_online_cpus(void);
183extern void cpu_hotplug_disable(void); 217extern void cpu_hotplug_disable(void);
184extern void cpu_hotplug_enable(void); 218extern void cpu_hotplug_enable(void);
185#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) 219#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri)
220#define __hotcpu_notifier(fn, pri) __cpu_notifier(fn, pri)
186#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 221#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
222#define __register_hotcpu_notifier(nb) __register_cpu_notifier(nb)
187#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 223#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
224#define __unregister_hotcpu_notifier(nb) __unregister_cpu_notifier(nb)
188void clear_tasks_mm_cpumask(int cpu); 225void clear_tasks_mm_cpumask(int cpu);
189int cpu_down(unsigned int cpu); 226int cpu_down(unsigned int cpu);
190 227
@@ -197,9 +234,12 @@ static inline void cpu_hotplug_done(void) {}
197#define cpu_hotplug_disable() do { } while (0) 234#define cpu_hotplug_disable() do { } while (0)
198#define cpu_hotplug_enable() do { } while (0) 235#define cpu_hotplug_enable() do { } while (0)
199#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 236#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
237#define __hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
200/* These aren't inline functions due to a GCC bug. */ 238/* These aren't inline functions due to a GCC bug. */
201#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; }) 239#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
240#define __register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
202#define unregister_hotcpu_notifier(nb) ({ (void)(nb); }) 241#define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
242#define __unregister_hotcpu_notifier(nb) ({ (void)(nb); })
203#endif /* CONFIG_HOTPLUG_CPU */ 243#endif /* CONFIG_HOTPLUG_CPU */
204 244
205#ifdef CONFIG_PM_SLEEP_SMP 245#ifdef CONFIG_PM_SLEEP_SMP
diff --git a/include/linux/cpufeature.h b/include/linux/cpufeature.h
new file mode 100644
index 000000000000..c4d4eb8ac9fe
--- /dev/null
+++ b/include/linux/cpufeature.h
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_CPUFEATURE_H
10#define __LINUX_CPUFEATURE_H
11
12#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
13
14#include <linux/mod_devicetable.h>
15#include <asm/cpufeature.h>
16
17/*
18 * Macros imported from <asm/cpufeature.h>:
19 * - cpu_feature(x) ordinal value of feature called 'x'
20 * - cpu_have_feature(u32 n) whether feature #n is available
21 * - MAX_CPU_FEATURES upper bound for feature ordinal values
22 * Optional:
23 * - CPU_FEATURE_TYPEFMT format string fragment for printing the cpu type
24 * - CPU_FEATURE_TYPEVAL set of values matching the format string above
25 */
26
27#ifndef CPU_FEATURE_TYPEFMT
28#define CPU_FEATURE_TYPEFMT "%s"
29#endif
30
31#ifndef CPU_FEATURE_TYPEVAL
32#define CPU_FEATURE_TYPEVAL ELF_PLATFORM
33#endif
34
35/*
36 * Use module_cpu_feature_match(feature, module_init_function) to
37 * declare that
38 * a) the module shall be probed upon discovery of CPU feature 'feature'
39 * (typically at boot time using udev)
40 * b) the module must not be loaded if CPU feature 'feature' is not present
41 * (not even by manual insmod).
42 *
43 * For a list of legal values for 'feature', please consult the file
44 * 'asm/cpufeature.h' of your favorite architecture.
45 */
46#define module_cpu_feature_match(x, __init) \
47static struct cpu_feature const cpu_feature_match_ ## x[] = \
48 { { .feature = cpu_feature(x) }, { } }; \
49MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \
50 \
51static int cpu_feature_match_ ## x ## _init(void) \
52{ \
53 if (!cpu_have_feature(cpu_feature(x))) \
54 return -ENODEV; \
55 return __init(); \
56} \
57module_init(cpu_feature_match_ ## x ## _init)
58
59#endif
60#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 4d89e0e6f9cc..5ae5100c1f24 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -16,6 +16,7 @@
16#include <linux/completion.h> 16#include <linux/completion.h>
17#include <linux/kobject.h> 17#include <linux/kobject.h>
18#include <linux/notifier.h> 18#include <linux/notifier.h>
19#include <linux/spinlock.h>
19#include <linux/sysfs.h> 20#include <linux/sysfs.h>
20 21
21/********************************************************************* 22/*********************************************************************
@@ -74,6 +75,8 @@ struct cpufreq_policy {
74 unsigned int max; /* in kHz */ 75 unsigned int max; /* in kHz */
75 unsigned int cur; /* in kHz, only needed if cpufreq 76 unsigned int cur; /* in kHz, only needed if cpufreq
76 * governors are used */ 77 * governors are used */
78 unsigned int suspend_freq; /* freq to set during suspend */
79
77 unsigned int policy; /* see above */ 80 unsigned int policy; /* see above */
78 struct cpufreq_governor *governor; /* see below */ 81 struct cpufreq_governor *governor; /* see below */
79 void *governor_data; 82 void *governor_data;
@@ -83,6 +86,7 @@ struct cpufreq_policy {
83 * called, but you're in IRQ context */ 86 * called, but you're in IRQ context */
84 87
85 struct cpufreq_real_policy user_policy; 88 struct cpufreq_real_policy user_policy;
89 struct cpufreq_frequency_table *freq_table;
86 90
87 struct list_head policy_list; 91 struct list_head policy_list;
88 struct kobject kobj; 92 struct kobject kobj;
@@ -101,6 +105,11 @@ struct cpufreq_policy {
101 * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); 105 * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);
102 */ 106 */
103 struct rw_semaphore rwsem; 107 struct rw_semaphore rwsem;
108
109 /* Synchronization for frequency transitions */
110 bool transition_ongoing; /* Tracks transition status */
111 spinlock_t transition_lock;
112 wait_queue_head_t transition_wait;
104}; 113};
105 114
106/* Only for ACPI */ 115/* Only for ACPI */
@@ -224,6 +233,7 @@ struct cpufreq_driver {
224 int (*bios_limit) (int cpu, unsigned int *limit); 233 int (*bios_limit) (int cpu, unsigned int *limit);
225 234
226 int (*exit) (struct cpufreq_policy *policy); 235 int (*exit) (struct cpufreq_policy *policy);
236 void (*stop_cpu) (struct cpufreq_policy *policy);
227 int (*suspend) (struct cpufreq_policy *policy); 237 int (*suspend) (struct cpufreq_policy *policy);
228 int (*resume) (struct cpufreq_policy *policy); 238 int (*resume) (struct cpufreq_policy *policy);
229 struct freq_attr **attr; 239 struct freq_attr **attr;
@@ -296,6 +306,15 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
296 policy->cpuinfo.max_freq); 306 policy->cpuinfo.max_freq);
297} 307}
298 308
309#ifdef CONFIG_CPU_FREQ
310void cpufreq_suspend(void);
311void cpufreq_resume(void);
312int cpufreq_generic_suspend(struct cpufreq_policy *policy);
313#else
314static inline void cpufreq_suspend(void) {}
315static inline void cpufreq_resume(void) {}
316#endif
317
299/********************************************************************* 318/*********************************************************************
300 * CPUFREQ NOTIFIER INTERFACE * 319 * CPUFREQ NOTIFIER INTERFACE *
301 *********************************************************************/ 320 *********************************************************************/
@@ -306,8 +325,6 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
306/* Transition notifiers */ 325/* Transition notifiers */
307#define CPUFREQ_PRECHANGE (0) 326#define CPUFREQ_PRECHANGE (0)
308#define CPUFREQ_POSTCHANGE (1) 327#define CPUFREQ_POSTCHANGE (1)
309#define CPUFREQ_RESUMECHANGE (8)
310#define CPUFREQ_SUSPENDCHANGE (9)
311 328
312/* Policy Notifiers */ 329/* Policy Notifiers */
313#define CPUFREQ_ADJUST (0) 330#define CPUFREQ_ADJUST (0)
@@ -322,9 +339,9 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
322int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); 339int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
323int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); 340int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
324 341
325void cpufreq_notify_transition(struct cpufreq_policy *policy, 342void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,
326 struct cpufreq_freqs *freqs, unsigned int state); 343 struct cpufreq_freqs *freqs);
327void cpufreq_notify_post_transition(struct cpufreq_policy *policy, 344void cpufreq_freq_transition_end(struct cpufreq_policy *policy,
328 struct cpufreq_freqs *freqs, int transition_failed); 345 struct cpufreq_freqs *freqs, int transition_failed);
329 346
330#else /* CONFIG_CPU_FREQ */ 347#else /* CONFIG_CPU_FREQ */
@@ -438,11 +455,14 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
438 * FREQUENCY TABLE HELPERS * 455 * FREQUENCY TABLE HELPERS *
439 *********************************************************************/ 456 *********************************************************************/
440 457
441#define CPUFREQ_ENTRY_INVALID ~0 458/* Special Values of .frequency field */
442#define CPUFREQ_TABLE_END ~1 459#define CPUFREQ_ENTRY_INVALID ~0
443#define CPUFREQ_BOOST_FREQ ~2 460#define CPUFREQ_TABLE_END ~1
461/* Special Values of .flags field */
462#define CPUFREQ_BOOST_FREQ (1 << 0)
444 463
445struct cpufreq_frequency_table { 464struct cpufreq_frequency_table {
465 unsigned int flags;
446 unsigned int driver_data; /* driver specific data, not used by core */ 466 unsigned int driver_data; /* driver specific data, not used by core */
447 unsigned int frequency; /* kHz - doesn't need to be in ascending 467 unsigned int frequency; /* kHz - doesn't need to be in ascending
448 * order */ 468 * order */
@@ -463,7 +483,6 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
463int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, 483int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
464 unsigned int freq); 484 unsigned int freq);
465 485
466void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
467ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); 486ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
468 487
469#ifdef CONFIG_CPU_FREQ 488#ifdef CONFIG_CPU_FREQ
@@ -490,9 +509,6 @@ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
490/* the following are really really optional */ 509/* the following are really really optional */
491extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 510extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
492extern struct freq_attr *cpufreq_generic_attr[]; 511extern struct freq_attr *cpufreq_generic_attr[];
493void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
494 unsigned int cpu);
495void cpufreq_frequency_table_put_attr(unsigned int cpu);
496int cpufreq_table_validate_and_show(struct cpufreq_policy *policy, 512int cpufreq_table_validate_and_show(struct cpufreq_policy *policy,
497 struct cpufreq_frequency_table *table); 513 struct cpufreq_frequency_table *table);
498 514
@@ -500,10 +516,4 @@ unsigned int cpufreq_generic_get(unsigned int cpu);
500int cpufreq_generic_init(struct cpufreq_policy *policy, 516int cpufreq_generic_init(struct cpufreq_policy *policy,
501 struct cpufreq_frequency_table *table, 517 struct cpufreq_frequency_table *table,
502 unsigned int transition_latency); 518 unsigned int transition_latency);
503static inline int cpufreq_generic_exit(struct cpufreq_policy *policy)
504{
505 cpufreq_frequency_table_put_attr(policy->cpu);
506 return 0;
507}
508
509#endif /* _LINUX_CPUFREQ_H */ 519#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 50fcbb0ac4e7..b0238cba440b 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -119,7 +119,15 @@ struct cpuidle_driver {
119 119
120#ifdef CONFIG_CPU_IDLE 120#ifdef CONFIG_CPU_IDLE
121extern void disable_cpuidle(void); 121extern void disable_cpuidle(void);
122extern int cpuidle_idle_call(void); 122
123extern int cpuidle_enabled(struct cpuidle_driver *drv,
124 struct cpuidle_device *dev);
125extern int cpuidle_select(struct cpuidle_driver *drv,
126 struct cpuidle_device *dev);
127extern int cpuidle_enter(struct cpuidle_driver *drv,
128 struct cpuidle_device *dev, int index);
129extern void cpuidle_reflect(struct cpuidle_device *dev, int index);
130
123extern int cpuidle_register_driver(struct cpuidle_driver *drv); 131extern int cpuidle_register_driver(struct cpuidle_driver *drv);
124extern struct cpuidle_driver *cpuidle_get_driver(void); 132extern struct cpuidle_driver *cpuidle_get_driver(void);
125extern struct cpuidle_driver *cpuidle_driver_ref(void); 133extern struct cpuidle_driver *cpuidle_driver_ref(void);
@@ -141,7 +149,16 @@ extern int cpuidle_play_dead(void);
141extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 149extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
142#else 150#else
143static inline void disable_cpuidle(void) { } 151static inline void disable_cpuidle(void) { }
144static inline int cpuidle_idle_call(void) { return -ENODEV; } 152static inline int cpuidle_enabled(struct cpuidle_driver *drv,
153 struct cpuidle_device *dev)
154{return -ENODEV; }
155static inline int cpuidle_select(struct cpuidle_driver *drv,
156 struct cpuidle_device *dev)
157{return -ENODEV; }
158static inline int cpuidle_enter(struct cpuidle_driver *drv,
159 struct cpuidle_device *dev, int index)
160{return -ENODEV; }
161static inline void cpuidle_reflect(struct cpuidle_device *dev, int index) { }
145static inline int cpuidle_register_driver(struct cpuidle_driver *drv) 162static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
146{return -ENODEV; } 163{return -ENODEV; }
147static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } 164static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
@@ -163,6 +180,8 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev)
163{return -ENODEV; } 180{return -ENODEV; }
164static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 181static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
165static inline int cpuidle_play_dead(void) {return -ENODEV; } 182static inline int cpuidle_play_dead(void) {return -ENODEV; }
183static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
184 struct cpuidle_device *dev) {return NULL; }
166#endif 185#endif
167 186
168#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED 187#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 3fe661fe96d1..b19d3dc2e651 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -87,25 +87,26 @@ extern void rebuild_sched_domains(void);
87extern void cpuset_print_task_mems_allowed(struct task_struct *p); 87extern void cpuset_print_task_mems_allowed(struct task_struct *p);
88 88
89/* 89/*
90 * get_mems_allowed is required when making decisions involving mems_allowed 90 * read_mems_allowed_begin is required when making decisions involving
91 * such as during page allocation. mems_allowed can be updated in parallel 91 * mems_allowed such as during page allocation. mems_allowed can be updated in
92 * and depending on the new value an operation can fail potentially causing 92 * parallel and depending on the new value an operation can fail potentially
93 * process failure. A retry loop with get_mems_allowed and put_mems_allowed 93 * causing process failure. A retry loop with read_mems_allowed_begin and
94 * prevents these artificial failures. 94 * read_mems_allowed_retry prevents these artificial failures.
95 */ 95 */
96static inline unsigned int get_mems_allowed(void) 96static inline unsigned int read_mems_allowed_begin(void)
97{ 97{
98 return read_seqcount_begin(&current->mems_allowed_seq); 98 return read_seqcount_begin(&current->mems_allowed_seq);
99} 99}
100 100
101/* 101/*
102 * If this returns false, the operation that took place after get_mems_allowed 102 * If this returns true, the operation that took place after
103 * may have failed. It is up to the caller to retry the operation if 103 * read_mems_allowed_begin may have failed artificially due to a concurrent
104 * update of mems_allowed. It is up to the caller to retry the operation if
104 * appropriate. 105 * appropriate.
105 */ 106 */
106static inline bool put_mems_allowed(unsigned int seq) 107static inline bool read_mems_allowed_retry(unsigned int seq)
107{ 108{
108 return !read_seqcount_retry(&current->mems_allowed_seq, seq); 109 return read_seqcount_retry(&current->mems_allowed_seq, seq);
109} 110}
110 111
111static inline void set_mems_allowed(nodemask_t nodemask) 112static inline void set_mems_allowed(nodemask_t nodemask)
@@ -225,14 +226,14 @@ static inline void set_mems_allowed(nodemask_t nodemask)
225{ 226{
226} 227}
227 228
228static inline unsigned int get_mems_allowed(void) 229static inline unsigned int read_mems_allowed_begin(void)
229{ 230{
230 return 0; 231 return 0;
231} 232}
232 233
233static inline bool put_mems_allowed(unsigned int seq) 234static inline bool read_mems_allowed_retry(unsigned int seq)
234{ 235{
235 return true; 236 return false;
236} 237}
237 238
238#endif /* !CONFIG_CPUSETS */ 239#endif /* !CONFIG_CPUSETS */
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 7032518f8542..72ab536ad3de 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -25,6 +25,7 @@ extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma,
25 25
26extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 26extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
27 unsigned long, int); 27 unsigned long, int);
28void vmcore_cleanup(void);
28 29
29/* Architecture code defines this if there are other possible ELF 30/* Architecture code defines this if there are other possible ELF
30 * machine types, e.g. on bi-arch capable hardware. */ 31 * machine types, e.g. on bi-arch capable hardware. */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 04421e825365..f61d6c8f5ef3 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -66,7 +66,7 @@ extern struct group_info *groups_alloc(int);
66extern struct group_info init_groups; 66extern struct group_info init_groups;
67extern void groups_free(struct group_info *); 67extern void groups_free(struct group_info *);
68extern int set_current_groups(struct group_info *); 68extern int set_current_groups(struct group_info *);
69extern int set_groups(struct cred *, struct group_info *); 69extern void set_groups(struct cred *, struct group_info *);
70extern int groups_search(const struct group_info *, kgid_t); 70extern int groups_search(const struct group_info *, kgid_t);
71 71
72/* access the groups "array" with this macro */ 72/* access the groups "array" with this macro */
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h
index acaa5615d634..4fad5f8ee01d 100644
--- a/include/linux/crush/crush.h
+++ b/include/linux/crush/crush.h
@@ -51,6 +51,7 @@ enum {
51 CRUSH_RULE_SET_CHOOSELEAF_TRIES = 9, /* override chooseleaf_descend_once */ 51 CRUSH_RULE_SET_CHOOSELEAF_TRIES = 9, /* override chooseleaf_descend_once */
52 CRUSH_RULE_SET_CHOOSE_LOCAL_TRIES = 10, 52 CRUSH_RULE_SET_CHOOSE_LOCAL_TRIES = 10,
53 CRUSH_RULE_SET_CHOOSE_LOCAL_FALLBACK_TRIES = 11, 53 CRUSH_RULE_SET_CHOOSE_LOCAL_FALLBACK_TRIES = 11,
54 CRUSH_RULE_SET_CHOOSELEAF_VARY_R = 12
54}; 55};
55 56
56/* 57/*
@@ -173,6 +174,12 @@ struct crush_map {
173 * apply to a collision: in that case we will retry as we used 174 * apply to a collision: in that case we will retry as we used
174 * to. */ 175 * to. */
175 __u32 chooseleaf_descend_once; 176 __u32 chooseleaf_descend_once;
177
178 /* if non-zero, feed r into chooseleaf, bit-shifted right by (r-1)
179 * bits. a value of 1 is best for new clusters. for legacy clusters
180 * that want to limit reshuffling, a value of 3 or 4 will make the
181 * mappings line up a bit better with previous mappings. */
182 __u8 chooseleaf_vary_r;
176}; 183};
177 184
178 185
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index bf72e9ac6de0..3b9bfdb83ba6 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -308,6 +308,7 @@ extern void dentry_update_name_case(struct dentry *, struct qstr *);
308 308
309/* used for rename() and baskets */ 309/* used for rename() and baskets */
310extern void d_move(struct dentry *, struct dentry *); 310extern void d_move(struct dentry *, struct dentry *);
311extern void d_exchange(struct dentry *, struct dentry *);
311extern struct dentry *d_ancestor(struct dentry *, struct dentry *); 312extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
312 313
313/* appendix may either be NULL or be used for transname suffixes */ 314/* appendix may either be NULL or be used for transname suffixes */
@@ -429,7 +430,7 @@ static inline unsigned __d_entry_type(const struct dentry *dentry)
429 return dentry->d_flags & DCACHE_ENTRY_TYPE; 430 return dentry->d_flags & DCACHE_ENTRY_TYPE;
430} 431}
431 432
432static inline bool d_is_directory(const struct dentry *dentry) 433static inline bool d_can_lookup(const struct dentry *dentry)
433{ 434{
434 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE; 435 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE;
435} 436}
@@ -439,6 +440,11 @@ static inline bool d_is_autodir(const struct dentry *dentry)
439 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE; 440 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE;
440} 441}
441 442
443static inline bool d_is_dir(const struct dentry *dentry)
444{
445 return d_can_lookup(dentry) || d_is_autodir(dentry);
446}
447
442static inline bool d_is_symlink(const struct dentry *dentry) 448static inline bool d_is_symlink(const struct dentry *dentry)
443{ 449{
444 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; 450 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE;
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
index 8c0aef1ba5f5..1d0aedef9822 100644
--- a/include/linux/decompress/inflate.h
+++ b/include/linux/decompress/inflate.h
@@ -1,5 +1,5 @@
1#ifndef INFLATE_H 1#ifndef LINUX_DECOMPRESS_INFLATE_H
2#define INFLATE_H 2#define LINUX_DECOMPRESS_INFLATE_H
3 3
4int gunzip(unsigned char *inbuf, int len, 4int gunzip(unsigned char *inbuf, int len,
5 int(*fill)(void*, unsigned int), 5 int(*fill)(void*, unsigned int),
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index ed419c62dde1..63da56ed9796 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -23,7 +23,6 @@ typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
23 23
24union map_info { 24union map_info {
25 void *ptr; 25 void *ptr;
26 unsigned long long ll;
27}; 26};
28 27
29/* 28/*
@@ -291,7 +290,6 @@ struct dm_target_callbacks {
291struct dm_target_io { 290struct dm_target_io {
292 struct dm_io *io; 291 struct dm_io *io;
293 struct dm_target *ti; 292 struct dm_target *ti;
294 union map_info info;
295 unsigned target_bio_nr; 293 unsigned target_bio_nr;
296 struct bio clone; 294 struct bio clone;
297}; 295};
@@ -403,7 +401,6 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
403struct gendisk *dm_disk(struct mapped_device *md); 401struct gendisk *dm_disk(struct mapped_device *md);
404int dm_suspended(struct dm_target *ti); 402int dm_suspended(struct dm_target *ti);
405int dm_noflush_suspending(struct dm_target *ti); 403int dm_noflush_suspending(struct dm_target *ti);
406union map_info *dm_get_mapinfo(struct bio *bio);
407union map_info *dm_get_rq_mapinfo(struct request *rq); 404union map_info *dm_get_rq_mapinfo(struct request *rq);
408 405
409struct queue_limits *dm_get_queue_limits(struct mapped_device *md); 406struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
@@ -466,6 +463,11 @@ struct mapped_device *dm_table_get_md(struct dm_table *t);
466void dm_table_event(struct dm_table *t); 463void dm_table_event(struct dm_table *t);
467 464
468/* 465/*
466 * Run the queue for request-based targets.
467 */
468void dm_table_run_md_queue_async(struct dm_table *t);
469
470/*
469 * The device must be suspended before calling this method. 471 * The device must be suspended before calling this method.
470 * Returns the previous table, which the caller must destroy. 472 * Returns the previous table, which the caller must destroy.
471 */ 473 */
diff --git a/include/linux/device.h b/include/linux/device.h
index 952b01033c32..233bbbeb768d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -560,6 +560,8 @@ extern int device_create_file(struct device *device,
560 const struct device_attribute *entry); 560 const struct device_attribute *entry);
561extern void device_remove_file(struct device *dev, 561extern void device_remove_file(struct device *dev,
562 const struct device_attribute *attr); 562 const struct device_attribute *attr);
563extern bool device_remove_file_self(struct device *dev,
564 const struct device_attribute *attr);
563extern int __must_check device_create_bin_file(struct device *dev, 565extern int __must_check device_create_bin_file(struct device *dev,
564 const struct bin_attribute *attr); 566 const struct bin_attribute *attr);
565extern void device_remove_bin_file(struct device *dev, 567extern void device_remove_bin_file(struct device *dev,
@@ -626,6 +628,7 @@ static inline void *devm_kcalloc(struct device *dev,
626 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 628 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
627} 629}
628extern void devm_kfree(struct device *dev, void *p); 630extern void devm_kfree(struct device *dev, void *p);
631extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
629 632
630void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 633void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
631void __iomem *devm_request_and_ioremap(struct device *dev, 634void __iomem *devm_request_and_ioremap(struct device *dev,
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index c5c92d59e531..8300fb87b84a 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -341,15 +341,11 @@ enum dma_slave_buswidth {
341 * and this struct will then be passed in as an argument to the 341 * and this struct will then be passed in as an argument to the
342 * DMA engine device_control() function. 342 * DMA engine device_control() function.
343 * 343 *
344 * The rationale for adding configuration information to this struct 344 * The rationale for adding configuration information to this struct is as
345 * is as follows: if it is likely that most DMA slave controllers in 345 * follows: if it is likely that more than one DMA slave controllers in
346 * the world will support the configuration option, then make it 346 * the world will support the configuration option, then make it generic.
347 * generic. If not: if it is fixed so that it be sent in static from 347 * If not: if it is fixed so that it be sent in static from the platform
348 * the platform data, then prefer to do that. Else, if it is neither 348 * data, then prefer to do that.
349 * fixed at runtime, nor generic enough (such as bus mastership on
350 * some CPU family and whatnot) then create a custom slave config
351 * struct and pass that, then make this config a member of that
352 * struct, if applicable.
353 */ 349 */
354struct dma_slave_config { 350struct dma_slave_config {
355 enum dma_transfer_direction direction; 351 enum dma_transfer_direction direction;
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index eccb0c0c6cf6..23c8db129560 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -25,6 +25,8 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27#include <linux/irqreturn.h> 27#include <linux/irqreturn.h>
28#include <linux/rwsem.h>
29#include <linux/rcupdate.h>
28 30
29struct acpi_dmar_header; 31struct acpi_dmar_header;
30 32
@@ -34,13 +36,19 @@ struct acpi_dmar_header;
34 36
35struct intel_iommu; 37struct intel_iommu;
36 38
39struct dmar_dev_scope {
40 struct device __rcu *dev;
41 u8 bus;
42 u8 devfn;
43};
44
37#ifdef CONFIG_DMAR_TABLE 45#ifdef CONFIG_DMAR_TABLE
38extern struct acpi_table_header *dmar_tbl; 46extern struct acpi_table_header *dmar_tbl;
39struct dmar_drhd_unit { 47struct dmar_drhd_unit {
40 struct list_head list; /* list of drhd units */ 48 struct list_head list; /* list of drhd units */
41 struct acpi_dmar_header *hdr; /* ACPI header */ 49 struct acpi_dmar_header *hdr; /* ACPI header */
42 u64 reg_base_addr; /* register base address*/ 50 u64 reg_base_addr; /* register base address*/
43 struct pci_dev **devices; /* target device array */ 51 struct dmar_dev_scope *devices;/* target device array */
44 int devices_cnt; /* target device count */ 52 int devices_cnt; /* target device count */
45 u16 segment; /* PCI domain */ 53 u16 segment; /* PCI domain */
46 u8 ignored:1; /* ignore drhd */ 54 u8 ignored:1; /* ignore drhd */
@@ -48,33 +56,66 @@ struct dmar_drhd_unit {
48 struct intel_iommu *iommu; 56 struct intel_iommu *iommu;
49}; 57};
50 58
59struct dmar_pci_notify_info {
60 struct pci_dev *dev;
61 unsigned long event;
62 int bus;
63 u16 seg;
64 u16 level;
65 struct acpi_dmar_pci_path path[];
66} __attribute__((packed));
67
68extern struct rw_semaphore dmar_global_lock;
51extern struct list_head dmar_drhd_units; 69extern struct list_head dmar_drhd_units;
52 70
53#define for_each_drhd_unit(drhd) \ 71#define for_each_drhd_unit(drhd) \
54 list_for_each_entry(drhd, &dmar_drhd_units, list) 72 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)
55 73
56#define for_each_active_drhd_unit(drhd) \ 74#define for_each_active_drhd_unit(drhd) \
57 list_for_each_entry(drhd, &dmar_drhd_units, list) \ 75 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
58 if (drhd->ignored) {} else 76 if (drhd->ignored) {} else
59 77
60#define for_each_active_iommu(i, drhd) \ 78#define for_each_active_iommu(i, drhd) \
61 list_for_each_entry(drhd, &dmar_drhd_units, list) \ 79 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
62 if (i=drhd->iommu, drhd->ignored) {} else 80 if (i=drhd->iommu, drhd->ignored) {} else
63 81
64#define for_each_iommu(i, drhd) \ 82#define for_each_iommu(i, drhd) \
65 list_for_each_entry(drhd, &dmar_drhd_units, list) \ 83 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
66 if (i=drhd->iommu, 0) {} else 84 if (i=drhd->iommu, 0) {} else
67 85
86static inline bool dmar_rcu_check(void)
87{
88 return rwsem_is_locked(&dmar_global_lock) ||
89 system_state == SYSTEM_BOOTING;
90}
91
92#define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check())
93
94#define for_each_dev_scope(a, c, p, d) \
95 for ((p) = 0; ((d) = (p) < (c) ? dmar_rcu_dereference((a)[(p)].dev) : \
96 NULL, (p) < (c)); (p)++)
97
98#define for_each_active_dev_scope(a, c, p, d) \
99 for_each_dev_scope((a), (c), (p), (d)) if (!(d)) { continue; } else
100
68extern int dmar_table_init(void); 101extern int dmar_table_init(void);
69extern int dmar_dev_scope_init(void); 102extern int dmar_dev_scope_init(void);
70extern int dmar_parse_dev_scope(void *start, void *end, int *cnt, 103extern int dmar_parse_dev_scope(void *start, void *end, int *cnt,
71 struct pci_dev ***devices, u16 segment); 104 struct dmar_dev_scope **devices, u16 segment);
72extern void dmar_free_dev_scope(struct pci_dev ***devices, int *cnt); 105extern void *dmar_alloc_dev_scope(void *start, void *end, int *cnt);
73 106extern void dmar_free_dev_scope(struct dmar_dev_scope **devices, int *cnt);
107extern int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
108 void *start, void*end, u16 segment,
109 struct dmar_dev_scope *devices,
110 int devices_cnt);
111extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info,
112 u16 segment, struct dmar_dev_scope *devices,
113 int count);
74/* Intel IOMMU detection */ 114/* Intel IOMMU detection */
75extern int detect_intel_iommu(void); 115extern int detect_intel_iommu(void);
76extern int enable_drhd_fault_handling(void); 116extern int enable_drhd_fault_handling(void);
77#else 117#else
118struct dmar_pci_notify_info;
78static inline int detect_intel_iommu(void) 119static inline int detect_intel_iommu(void)
79{ 120{
80 return -ENODEV; 121 return -ENODEV;
@@ -138,30 +179,9 @@ extern int arch_setup_dmar_msi(unsigned int irq);
138 179
139#ifdef CONFIG_INTEL_IOMMU 180#ifdef CONFIG_INTEL_IOMMU
140extern int iommu_detected, no_iommu; 181extern int iommu_detected, no_iommu;
141extern struct list_head dmar_rmrr_units;
142struct dmar_rmrr_unit {
143 struct list_head list; /* list of rmrr units */
144 struct acpi_dmar_header *hdr; /* ACPI header */
145 u64 base_address; /* reserved base address*/
146 u64 end_address; /* reserved end address */
147 struct pci_dev **devices; /* target devices */
148 int devices_cnt; /* target device count */
149};
150
151#define for_each_rmrr_units(rmrr) \
152 list_for_each_entry(rmrr, &dmar_rmrr_units, list)
153
154struct dmar_atsr_unit {
155 struct list_head list; /* list of ATSR units */
156 struct acpi_dmar_header *hdr; /* ACPI header */
157 struct pci_dev **devices; /* target devices */
158 int devices_cnt; /* target device count */
159 u8 include_all:1; /* include all ports */
160};
161
162int dmar_parse_rmrr_atsr_dev(void);
163extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header); 182extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header);
164extern int dmar_parse_one_atsr(struct acpi_dmar_header *header); 183extern int dmar_parse_one_atsr(struct acpi_dmar_header *header);
184extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info);
165extern int intel_iommu_init(void); 185extern int intel_iommu_init(void);
166#else /* !CONFIG_INTEL_IOMMU: */ 186#else /* !CONFIG_INTEL_IOMMU: */
167static inline int intel_iommu_init(void) { return -ENODEV; } 187static inline int intel_iommu_init(void) { return -ENODEV; }
@@ -173,7 +193,7 @@ static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header)
173{ 193{
174 return 0; 194 return 0;
175} 195}
176static inline int dmar_parse_rmrr_atsr_dev(void) 196static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
177{ 197{
178 return 0; 198 return 0;
179} 199}
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index de7d74ab3de6..3dbe9bd57a09 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -327,12 +327,6 @@ enum drbd_state_rv {
327 SS_AFTER_LAST_ERROR = -22, /* Keep this at bottom */ 327 SS_AFTER_LAST_ERROR = -22, /* Keep this at bottom */
328}; 328};
329 329
330/* from drbd_strings.c */
331extern const char *drbd_conn_str(enum drbd_conns);
332extern const char *drbd_role_str(enum drbd_role);
333extern const char *drbd_disk_str(enum drbd_disk_state);
334extern const char *drbd_set_st_err_str(enum drbd_state_rv);
335
336#define SHARED_SECRET_MAX 64 330#define SHARED_SECRET_MAX 64
337 331
338#define MDF_CONSISTENT (1 << 0) 332#define MDF_CONSISTENT (1 << 0)
@@ -382,4 +376,6 @@ enum drbd_timeout_flag {
382#define DRBD_MD_INDEX_FLEX_EXT -2 376#define DRBD_MD_INDEX_FLEX_EXT -2
383#define DRBD_MD_INDEX_FLEX_INT -3 377#define DRBD_MD_INDEX_FLEX_INT -3
384 378
379#define DRBD_CPU_MASK_SIZE 32
380
385#endif 381#endif
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index e8c44572b8cb..4193f5f2636c 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -135,7 +135,7 @@ GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
135) 135)
136 136
137GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts, 137GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts,
138 __str_field_def(1, DRBD_GENLA_F_MANDATORY, cpu_mask, 32) 138 __str_field_def(1, DRBD_GENLA_F_MANDATORY, cpu_mask, DRBD_CPU_MASK_SIZE)
139 __u32_field_def(2, DRBD_GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF) 139 __u32_field_def(2, DRBD_GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF)
140) 140)
141 141
@@ -276,9 +276,9 @@ GENL_op(
276) 276)
277 277
278 /* add DRBD minor devices as volumes to resources */ 278 /* add DRBD minor devices as volumes to resources */
279GENL_op(DRBD_ADM_NEW_MINOR, 5, GENL_doit(drbd_adm_add_minor), 279GENL_op(DRBD_ADM_NEW_MINOR, 5, GENL_doit(drbd_adm_new_minor),
280 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 280 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
281GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_delete_minor), 281GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_del_minor),
282 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 282 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
283 283
284 /* add or delete resources */ 284 /* add or delete resources */
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 481ab2345d6b..68b4024184de 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * Driver for the Synopsys DesignWare DMA Controller (aka DMACA on 2 * Driver for the Synopsys DesignWare DMA Controller
3 * AVR32 systems.)
4 * 3 *
5 * Copyright (C) 2007 Atmel Corporation 4 * Copyright (C) 2007 Atmel Corporation
6 * Copyright (C) 2010-2011 ST Microelectronics 5 * Copyright (C) 2010-2011 ST Microelectronics
@@ -44,8 +43,6 @@ struct dw_dma_slave {
44 * @nr_masters: Number of AHB masters supported by the controller 43 * @nr_masters: Number of AHB masters supported by the controller
45 * @data_width: Maximum data width supported by hardware per AHB master 44 * @data_width: Maximum data width supported by hardware per AHB master
46 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits) 45 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
47 * @sd: slave specific data. Used for configuring channels
48 * @sd_count: count of slave data structures passed.
49 */ 46 */
50struct dw_dma_platform_data { 47struct dw_dma_platform_data {
51 unsigned int nr_channels; 48 unsigned int nr_channels;
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 306dd8cd0b6f..df63bd3a8cf1 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -202,17 +202,8 @@ enum {
202#define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq)) 202#define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq))
203#define rb_entry_rq(node) rb_entry((node), struct request, rb_node) 203#define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
204 204
205/*
206 * Hack to reuse the csd.list list_head as the fifo time holder while
207 * the request is in the io scheduler. Saves an unsigned long in rq.
208 */
209#define rq_fifo_time(rq) ((unsigned long) (rq)->csd.list.next)
210#define rq_set_fifo_time(rq,exp) ((rq)->csd.list.next = (void *) (exp))
211#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist) 205#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist)
212#define rq_fifo_clear(rq) do { \ 206#define rq_fifo_clear(rq) list_del_init(&(rq)->queuelist)
213 list_del_init(&(rq)->queuelist); \
214 INIT_LIST_HEAD(&(rq)->csd.list); \
215 } while (0)
216 207
217#else /* CONFIG_BLOCK */ 208#else /* CONFIG_BLOCK */
218 209
diff --git a/include/linux/err.h b/include/linux/err.h
index 15f92e072450..a729120644d5 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -2,12 +2,13 @@
2#define _LINUX_ERR_H 2#define _LINUX_ERR_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
6#include <asm/errno.h> 7#include <asm/errno.h>
7 8
8/* 9/*
9 * Kernel pointers have redundant information, so we can use a 10 * Kernel pointers have redundant information, so we can use a
10 * scheme where we can return either an error code or a dentry 11 * scheme where we can return either an error code or a normal
11 * pointer with the same return value. 12 * pointer with the same return value.
12 * 13 *
13 * This should be a per-architecture thing, to allow different 14 * This should be a per-architecture thing, to allow different
@@ -29,12 +30,12 @@ static inline long __must_check PTR_ERR(__force const void *ptr)
29 return (long) ptr; 30 return (long) ptr;
30} 31}
31 32
32static inline long __must_check IS_ERR(__force const void *ptr) 33static inline bool __must_check IS_ERR(__force const void *ptr)
33{ 34{
34 return IS_ERR_VALUE((unsigned long)ptr); 35 return IS_ERR_VALUE((unsigned long)ptr);
35} 36}
36 37
37static inline long __must_check IS_ERR_OR_NULL(__force const void *ptr) 38static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
38{ 39{
39 return !ptr || IS_ERR_VALUE((unsigned long)ptr); 40 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
40} 41}
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c8e3e7e39c6b..0a114d05f68d 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -183,6 +183,9 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
183 * hold the RTNL lock. 183 * hold the RTNL lock.
184 * 184 *
185 * See the structures used by these operations for further documentation. 185 * See the structures used by these operations for further documentation.
186 * Note that for all operations using a structure ending with a zero-
187 * length array, the array is allocated separately in the kernel and
188 * is passed to the driver as an additional parameter.
186 * 189 *
187 * See &struct net_device and &struct net_device_ops for documentation 190 * See &struct net_device and &struct net_device_ops for documentation
188 * of the generic netdev features interface. 191 * of the generic netdev features interface.
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 21c59af1150b..f488145bb2d4 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -240,6 +240,12 @@ extern int extcon_register_notifier(struct extcon_dev *edev,
240 struct notifier_block *nb); 240 struct notifier_block *nb);
241extern int extcon_unregister_notifier(struct extcon_dev *edev, 241extern int extcon_unregister_notifier(struct extcon_dev *edev,
242 struct notifier_block *nb); 242 struct notifier_block *nb);
243
244/*
245 * Following API get the extcon device from devicetree.
246 * This function use phandle of devicetree to get extcon device directly.
247 */
248extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index);
243#else /* CONFIG_EXTCON */ 249#else /* CONFIG_EXTCON */
244static inline int extcon_dev_register(struct extcon_dev *edev) 250static inline int extcon_dev_register(struct extcon_dev *edev)
245{ 251{
@@ -324,5 +330,11 @@ static inline int extcon_unregister_interest(struct extcon_specific_cable_nb
324{ 330{
325 return 0; 331 return 0;
326} 332}
333
334static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,
335 int index)
336{
337 return ERR_PTR(-ENODEV);
338}
327#endif /* CONFIG_EXTCON */ 339#endif /* CONFIG_EXTCON */
328#endif /* __LINUX_EXTCON_H__ */ 340#endif /* __LINUX_EXTCON_H__ */
diff --git a/include/linux/extcon/of_extcon.h b/include/linux/extcon/of_extcon.h
deleted file mode 100644
index 0ebfeff1b55d..000000000000
--- a/include/linux/extcon/of_extcon.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * OF helpers for External connector (extcon) framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 * Kishon Vijay Abraham I <kishon@ti.com>
6 *
7 * Copyright (C) 2013 Samsung Electronics
8 * Chanwoo Choi <cw00.choi@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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef __LINUX_OF_EXTCON_H
17#define __LINUX_OF_EXTCON_H
18
19#include <linux/err.h>
20
21#if IS_ENABLED(CONFIG_OF_EXTCON)
22extern struct extcon_dev
23 *of_extcon_get_extcon_dev(struct device *dev, int index);
24#else
25static inline struct extcon_dev
26 *of_extcon_get_extcon_dev(struct device *dev, int index)
27{
28 return ERR_PTR(-ENOSYS);
29}
30#endif /* CONFIG_OF_EXTCON */
31#endif /* __LINUX_OF_EXTCON_H */
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index da74d878dc4f..df53e1753a76 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -183,7 +183,7 @@ struct f2fs_inode {
183 __le32 i_pino; /* parent inode number */ 183 __le32 i_pino; /* parent inode number */
184 __le32 i_namelen; /* file name length */ 184 __le32 i_namelen; /* file name length */
185 __u8 i_name[F2FS_NAME_LEN]; /* file name for SPOR */ 185 __u8 i_name[F2FS_NAME_LEN]; /* file name for SPOR */
186 __u8 i_reserved2; /* for backward compatibility */ 186 __u8 i_dir_level; /* dentry_level for large dir */
187 187
188 struct f2fs_extent i_ext; /* caching a largest extent */ 188 struct f2fs_extent i_ext; /* caching a largest extent */
189 189
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 70e8e21c0a30..230f87bdf5ad 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -63,8 +63,6 @@ struct file_operations;
63struct vfsmount; 63struct vfsmount;
64struct dentry; 64struct dentry;
65 65
66extern void __init files_defer_init(void);
67
68#define rcu_dereference_check_fdtable(files, fdtfd) \ 66#define rcu_dereference_check_fdtable(files, fdtfd) \
69 rcu_dereference_check((fdtfd), lockdep_is_held(&(files)->file_lock)) 67 rcu_dereference_check((fdtfd), lockdep_is_held(&(files)->file_lock))
70 68
diff --git a/include/linux/filter.h b/include/linux/filter.h
index e568c8ef896b..262dcbb75ffe 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -9,28 +9,81 @@
9#include <linux/workqueue.h> 9#include <linux/workqueue.h>
10#include <uapi/linux/filter.h> 10#include <uapi/linux/filter.h>
11 11
12#ifdef CONFIG_COMPAT 12/* Internally used and optimized filter representation with extended
13/* 13 * instruction set based on top of classic BPF.
14 * A struct sock_filter is architecture independent.
15 */ 14 */
15
16/* instruction classes */
17#define BPF_ALU64 0x07 /* alu mode in double word width */
18
19/* ld/ldx fields */
20#define BPF_DW 0x18 /* double word */
21#define BPF_XADD 0xc0 /* exclusive add */
22
23/* alu/jmp fields */
24#define BPF_MOV 0xb0 /* mov reg to reg */
25#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
26
27/* change endianness of a register */
28#define BPF_END 0xd0 /* flags for endianness conversion: */
29#define BPF_TO_LE 0x00 /* convert to little-endian */
30#define BPF_TO_BE 0x08 /* convert to big-endian */
31#define BPF_FROM_LE BPF_TO_LE
32#define BPF_FROM_BE BPF_TO_BE
33
34#define BPF_JNE 0x50 /* jump != */
35#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
36#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
37#define BPF_CALL 0x80 /* function call */
38#define BPF_EXIT 0x90 /* function return */
39
40/* BPF has 10 general purpose 64-bit registers and stack frame. */
41#define MAX_BPF_REG 11
42
43/* BPF program can access up to 512 bytes of stack space. */
44#define MAX_BPF_STACK 512
45
46/* Arg1, context and stack frame pointer register positions. */
47#define ARG1_REG 1
48#define CTX_REG 6
49#define FP_REG 10
50
51struct sock_filter_int {
52 __u8 code; /* opcode */
53 __u8 a_reg:4; /* dest register */
54 __u8 x_reg:4; /* source register */
55 __s16 off; /* signed offset */
56 __s32 imm; /* signed immediate constant */
57};
58
59#ifdef CONFIG_COMPAT
60/* A struct sock_filter is architecture independent. */
16struct compat_sock_fprog { 61struct compat_sock_fprog {
17 u16 len; 62 u16 len;
18 compat_uptr_t filter; /* struct sock_filter * */ 63 compat_uptr_t filter; /* struct sock_filter * */
19}; 64};
20#endif 65#endif
21 66
67struct sock_fprog_kern {
68 u16 len;
69 struct sock_filter *filter;
70};
71
22struct sk_buff; 72struct sk_buff;
23struct sock; 73struct sock;
74struct seccomp_data;
24 75
25struct sk_filter 76struct sk_filter {
26{
27 atomic_t refcnt; 77 atomic_t refcnt;
28 unsigned int len; /* Number of filter blocks */ 78 u32 jited:1, /* Is our filter JIT'ed? */
79 len:31; /* Number of filter blocks */
80 struct sock_fprog_kern *orig_prog; /* Original BPF program */
29 struct rcu_head rcu; 81 struct rcu_head rcu;
30 unsigned int (*bpf_func)(const struct sk_buff *skb, 82 unsigned int (*bpf_func)(const struct sk_buff *skb,
31 const struct sock_filter *filter); 83 const struct sock_filter_int *filter);
32 union { 84 union {
33 struct sock_filter insns[0]; 85 struct sock_filter insns[0];
86 struct sock_filter_int insnsi[0];
34 struct work_struct work; 87 struct work_struct work;
35 }; 88 };
36}; 89};
@@ -41,25 +94,44 @@ static inline unsigned int sk_filter_size(unsigned int proglen)
41 offsetof(struct sk_filter, insns[proglen])); 94 offsetof(struct sk_filter, insns[proglen]));
42} 95}
43 96
44extern int sk_filter(struct sock *sk, struct sk_buff *skb); 97#define sk_filter_proglen(fprog) \
45extern unsigned int sk_run_filter(const struct sk_buff *skb, 98 (fprog->len * sizeof(fprog->filter[0]))
46 const struct sock_filter *filter); 99
47extern int sk_unattached_filter_create(struct sk_filter **pfp, 100#define SK_RUN_FILTER(filter, ctx) \
48 struct sock_fprog *fprog); 101 (*filter->bpf_func)(ctx, filter->insnsi)
49extern void sk_unattached_filter_destroy(struct sk_filter *fp); 102
50extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 103int sk_filter(struct sock *sk, struct sk_buff *skb);
51extern int sk_detach_filter(struct sock *sk); 104
52extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 105u32 sk_run_filter_int_seccomp(const struct seccomp_data *ctx,
53extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); 106 const struct sock_filter_int *insni);
54extern void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to); 107u32 sk_run_filter_int_skb(const struct sk_buff *ctx,
108 const struct sock_filter_int *insni);
109
110int sk_convert_filter(struct sock_filter *prog, int len,
111 struct sock_filter_int *new_prog, int *new_len);
112
113int sk_unattached_filter_create(struct sk_filter **pfp,
114 struct sock_fprog *fprog);
115void sk_unattached_filter_destroy(struct sk_filter *fp);
116
117int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
118int sk_detach_filter(struct sock *sk);
119
120int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
121int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
122 unsigned int len);
123void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to);
124
125void sk_filter_charge(struct sock *sk, struct sk_filter *fp);
126void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
55 127
56#ifdef CONFIG_BPF_JIT 128#ifdef CONFIG_BPF_JIT
57#include <stdarg.h> 129#include <stdarg.h>
58#include <linux/linkage.h> 130#include <linux/linkage.h>
59#include <linux/printk.h> 131#include <linux/printk.h>
60 132
61extern void bpf_jit_compile(struct sk_filter *fp); 133void bpf_jit_compile(struct sk_filter *fp);
62extern void bpf_jit_free(struct sk_filter *fp); 134void bpf_jit_free(struct sk_filter *fp);
63 135
64static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 136static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
65 u32 pass, void *image) 137 u32 pass, void *image)
@@ -70,7 +142,6 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
70 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET, 142 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
71 16, 1, image, proglen, false); 143 16, 1, image, proglen, false);
72} 144}
73#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
74#else 145#else
75#include <linux/slab.h> 146#include <linux/slab.h>
76static inline void bpf_jit_compile(struct sk_filter *fp) 147static inline void bpf_jit_compile(struct sk_filter *fp)
@@ -80,7 +151,6 @@ static inline void bpf_jit_free(struct sk_filter *fp)
80{ 151{
81 kfree(fp); 152 kfree(fp);
82} 153}
83#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns)
84#endif 154#endif
85 155
86static inline int bpf_tell_extensions(void) 156static inline int bpf_tell_extensions(void)
diff --git a/include/linux/fmc-sdb.h b/include/linux/fmc-sdb.h
index 1974317a9b3d..599bd6bab56d 100644
--- a/include/linux/fmc-sdb.h
+++ b/include/linux/fmc-sdb.h
@@ -14,6 +14,8 @@ union sdb_record {
14 struct sdb_bridge bridge; 14 struct sdb_bridge bridge;
15 struct sdb_integration integr; 15 struct sdb_integration integr;
16 struct sdb_empty empty; 16 struct sdb_empty empty;
17 struct sdb_synthesis synthesis;
18 struct sdb_repo_url repo_url;
17}; 19};
18 20
19struct fmc_device; 21struct fmc_device;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 23b2a35d712e..7a9c5bca2b76 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -48,6 +48,7 @@ struct cred;
48struct swap_info_struct; 48struct swap_info_struct;
49struct seq_file; 49struct seq_file;
50struct workqueue_struct; 50struct workqueue_struct;
51struct iov_iter;
51 52
52extern void __init inode_init(void); 53extern void __init inode_init(void);
53extern void __init inode_init_early(void); 54extern void __init inode_init_early(void);
@@ -125,6 +126,8 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
125 126
126/* File needs atomic accesses to f_pos */ 127/* File needs atomic accesses to f_pos */
127#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000) 128#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000)
129/* Write access to underlying fs */
130#define FMODE_WRITER ((__force fmode_t)0x10000)
128 131
129/* File was opened by fanotify and shouldn't generate fanotify events */ 132/* File was opened by fanotify and shouldn't generate fanotify events */
130#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 133#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
@@ -293,38 +296,6 @@ struct page;
293struct address_space; 296struct address_space;
294struct writeback_control; 297struct writeback_control;
295 298
296struct iov_iter {
297 const struct iovec *iov;
298 unsigned long nr_segs;
299 size_t iov_offset;
300 size_t count;
301};
302
303size_t iov_iter_copy_from_user_atomic(struct page *page,
304 struct iov_iter *i, unsigned long offset, size_t bytes);
305size_t iov_iter_copy_from_user(struct page *page,
306 struct iov_iter *i, unsigned long offset, size_t bytes);
307void iov_iter_advance(struct iov_iter *i, size_t bytes);
308int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
309size_t iov_iter_single_seg_count(const struct iov_iter *i);
310
311static inline void iov_iter_init(struct iov_iter *i,
312 const struct iovec *iov, unsigned long nr_segs,
313 size_t count, size_t written)
314{
315 i->iov = iov;
316 i->nr_segs = nr_segs;
317 i->iov_offset = 0;
318 i->count = count + written;
319
320 iov_iter_advance(i, written);
321}
322
323static inline size_t iov_iter_count(struct iov_iter *i)
324{
325 return i->count;
326}
327
328/* 299/*
329 * "descriptor" for what we're up to with a read. 300 * "descriptor" for what we're up to with a read.
330 * This allows us to use the same read code yet 301 * This allows us to use the same read code yet
@@ -383,7 +354,7 @@ struct address_space_operations {
383 int (*migratepage) (struct address_space *, 354 int (*migratepage) (struct address_space *,
384 struct page *, struct page *, enum migrate_mode); 355 struct page *, struct page *, enum migrate_mode);
385 int (*launder_page) (struct page *); 356 int (*launder_page) (struct page *);
386 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 357 int (*is_partially_uptodate) (struct page *, unsigned long,
387 unsigned long); 358 unsigned long);
388 void (*is_dirty_writeback) (struct page *, bool *, bool *); 359 void (*is_dirty_writeback) (struct page *, bool *, bool *);
389 int (*error_remove_page)(struct address_space *, struct page *); 360 int (*error_remove_page)(struct address_space *, struct page *);
@@ -419,6 +390,7 @@ struct address_space {
419 struct mutex i_mmap_mutex; /* protect tree, count, list */ 390 struct mutex i_mmap_mutex; /* protect tree, count, list */
420 /* Protected by tree_lock together with the radix tree */ 391 /* Protected by tree_lock together with the radix tree */
421 unsigned long nrpages; /* number of total pages */ 392 unsigned long nrpages; /* number of total pages */
393 unsigned long nrshadows; /* number of shadow entries */
422 pgoff_t writeback_index;/* writeback starts here */ 394 pgoff_t writeback_index;/* writeback starts here */
423 const struct address_space_operations *a_ops; /* methods */ 395 const struct address_space_operations *a_ops; /* methods */
424 unsigned long flags; /* error bits/gfp mask */ 396 unsigned long flags; /* error bits/gfp mask */
@@ -589,6 +561,9 @@ struct inode {
589 atomic_t i_count; 561 atomic_t i_count;
590 atomic_t i_dio_count; 562 atomic_t i_dio_count;
591 atomic_t i_writecount; 563 atomic_t i_writecount;
564#ifdef CONFIG_IMA
565 atomic_t i_readcount; /* struct files open RO */
566#endif
592 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 567 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
593 struct file_lock *i_flock; 568 struct file_lock *i_flock;
594 struct address_space i_data; 569 struct address_space i_data;
@@ -609,9 +584,6 @@ struct inode {
609 struct hlist_head i_fsnotify_marks; 584 struct hlist_head i_fsnotify_marks;
610#endif 585#endif
611 586
612#ifdef CONFIG_IMA
613 atomic_t i_readcount; /* struct files open RO */
614#endif
615 void *i_private; /* fs or device private pointer */ 587 void *i_private; /* fs or device private pointer */
616}; 588};
617 589
@@ -769,9 +741,6 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
769 index < ra->start + ra->size); 741 index < ra->start + ra->size);
770} 742}
771 743
772#define FILE_MNT_WRITE_TAKEN 1
773#define FILE_MNT_WRITE_RELEASED 2
774
775struct file { 744struct file {
776 union { 745 union {
777 struct llist_node fu_llist; 746 struct llist_node fu_llist;
@@ -809,9 +778,6 @@ struct file {
809 struct list_head f_tfile_llink; 778 struct list_head f_tfile_llink;
810#endif /* #ifdef CONFIG_EPOLL */ 779#endif /* #ifdef CONFIG_EPOLL */
811 struct address_space *f_mapping; 780 struct address_space *f_mapping;
812#ifdef CONFIG_DEBUG_WRITECOUNT
813 unsigned long f_mnt_write_state;
814#endif
815} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ 781} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
816 782
817struct file_handle { 783struct file_handle {
@@ -829,49 +795,6 @@ static inline struct file *get_file(struct file *f)
829#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 795#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
830#define file_count(x) atomic_long_read(&(x)->f_count) 796#define file_count(x) atomic_long_read(&(x)->f_count)
831 797
832#ifdef CONFIG_DEBUG_WRITECOUNT
833static inline void file_take_write(struct file *f)
834{
835 WARN_ON(f->f_mnt_write_state != 0);
836 f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN;
837}
838static inline void file_release_write(struct file *f)
839{
840 f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED;
841}
842static inline void file_reset_write(struct file *f)
843{
844 f->f_mnt_write_state = 0;
845}
846static inline void file_check_state(struct file *f)
847{
848 /*
849 * At this point, either both or neither of these bits
850 * should be set.
851 */
852 WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN);
853 WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED);
854}
855static inline int file_check_writeable(struct file *f)
856{
857 if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN)
858 return 0;
859 printk(KERN_WARNING "writeable file with no "
860 "mnt_want_write()\n");
861 WARN_ON(1);
862 return -EINVAL;
863}
864#else /* !CONFIG_DEBUG_WRITECOUNT */
865static inline void file_take_write(struct file *filp) {}
866static inline void file_release_write(struct file *filp) {}
867static inline void file_reset_write(struct file *filp) {}
868static inline void file_check_state(struct file *filp) {}
869static inline int file_check_writeable(struct file *filp)
870{
871 return 0;
872}
873#endif /* CONFIG_DEBUG_WRITECOUNT */
874
875#define MAX_NON_LFS ((1UL<<31) - 1) 798#define MAX_NON_LFS ((1UL<<31) - 1)
876 799
877/* Page cache limit. The filesystems should put that into their s_maxbytes 800/* Page cache limit. The filesystems should put that into their s_maxbytes
@@ -892,6 +815,7 @@ static inline int file_check_writeable(struct file *filp)
892#define FL_SLEEP 128 /* A blocking lock */ 815#define FL_SLEEP 128 /* A blocking lock */
893#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */ 816#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */
894#define FL_UNLOCK_PENDING 512 /* Lease is being broken */ 817#define FL_UNLOCK_PENDING 512 /* Lease is being broken */
818#define FL_FILE_PVT 1024 /* lock is private to the file */
895 819
896/* 820/*
897 * Special return value from posix_lock_file() and vfs_lock_file() for 821 * Special return value from posix_lock_file() and vfs_lock_file() for
@@ -996,12 +920,12 @@ struct file_lock {
996extern void send_sigio(struct fown_struct *fown, int fd, int band); 920extern void send_sigio(struct fown_struct *fown, int fd, int band);
997 921
998#ifdef CONFIG_FILE_LOCKING 922#ifdef CONFIG_FILE_LOCKING
999extern int fcntl_getlk(struct file *, struct flock __user *); 923extern int fcntl_getlk(struct file *, unsigned int, struct flock __user *);
1000extern int fcntl_setlk(unsigned int, struct file *, unsigned int, 924extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
1001 struct flock __user *); 925 struct flock __user *);
1002 926
1003#if BITS_PER_LONG == 32 927#if BITS_PER_LONG == 32
1004extern int fcntl_getlk64(struct file *, struct flock64 __user *); 928extern int fcntl_getlk64(struct file *, unsigned int, struct flock64 __user *);
1005extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, 929extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
1006 struct flock64 __user *); 930 struct flock64 __user *);
1007#endif 931#endif
@@ -1016,7 +940,7 @@ extern struct file_lock * locks_alloc_lock(void);
1016extern void locks_copy_lock(struct file_lock *, struct file_lock *); 940extern void locks_copy_lock(struct file_lock *, struct file_lock *);
1017extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); 941extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
1018extern void locks_remove_posix(struct file *, fl_owner_t); 942extern void locks_remove_posix(struct file *, fl_owner_t);
1019extern void locks_remove_flock(struct file *); 943extern void locks_remove_file(struct file *);
1020extern void locks_release_private(struct file_lock *); 944extern void locks_release_private(struct file_lock *);
1021extern void posix_test_lock(struct file *, struct file_lock *); 945extern void posix_test_lock(struct file *, struct file_lock *);
1022extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 946extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
@@ -1034,7 +958,8 @@ extern int lease_modify(struct file_lock **, int);
1034extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 958extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1035extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 959extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1036#else /* !CONFIG_FILE_LOCKING */ 960#else /* !CONFIG_FILE_LOCKING */
1037static inline int fcntl_getlk(struct file *file, struct flock __user *user) 961static inline int fcntl_getlk(struct file *file, unsigned int cmd,
962 struct flock __user *user)
1038{ 963{
1039 return -EINVAL; 964 return -EINVAL;
1040} 965}
@@ -1046,7 +971,8 @@ static inline int fcntl_setlk(unsigned int fd, struct file *file,
1046} 971}
1047 972
1048#if BITS_PER_LONG == 32 973#if BITS_PER_LONG == 32
1049static inline int fcntl_getlk64(struct file *file, struct flock64 __user *user) 974static inline int fcntl_getlk64(struct file *file, unsigned int cmd,
975 struct flock64 __user *user)
1050{ 976{
1051 return -EINVAL; 977 return -EINVAL;
1052} 978}
@@ -1087,7 +1013,7 @@ static inline void locks_remove_posix(struct file *filp, fl_owner_t owner)
1087 return; 1013 return;
1088} 1014}
1089 1015
1090static inline void locks_remove_flock(struct file *filp) 1016static inline void locks_remove_file(struct file *filp)
1091{ 1017{
1092 return; 1018 return;
1093} 1019}
@@ -1460,7 +1386,7 @@ extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1460extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **); 1386extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **);
1461extern int vfs_rmdir(struct inode *, struct dentry *); 1387extern int vfs_rmdir(struct inode *, struct dentry *);
1462extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); 1388extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1463extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **); 1389extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);
1464 1390
1465/* 1391/*
1466 * VFS dentry helper functions. 1392 * VFS dentry helper functions.
@@ -1571,6 +1497,8 @@ struct inode_operations {
1571 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); 1497 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1572 int (*rename) (struct inode *, struct dentry *, 1498 int (*rename) (struct inode *, struct dentry *,
1573 struct inode *, struct dentry *); 1499 struct inode *, struct dentry *);
1500 int (*rename2) (struct inode *, struct dentry *,
1501 struct inode *, struct dentry *, unsigned int);
1574 int (*setattr) (struct dentry *, struct iattr *); 1502 int (*setattr) (struct dentry *, struct iattr *);
1575 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1503 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1576 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1504 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1913,6 +1841,11 @@ extern int current_umask(void);
1913extern void ihold(struct inode * inode); 1841extern void ihold(struct inode * inode);
1914extern void iput(struct inode *); 1842extern void iput(struct inode *);
1915 1843
1844static inline struct inode *file_inode(struct file *f)
1845{
1846 return f->f_inode;
1847}
1848
1916/* /sys/fs */ 1849/* /sys/fs */
1917extern struct kobject *fs_kobj; 1850extern struct kobject *fs_kobj;
1918 1851
@@ -1922,7 +1855,7 @@ extern struct kobject *fs_kobj;
1922#define FLOCK_VERIFY_WRITE 2 1855#define FLOCK_VERIFY_WRITE 2
1923 1856
1924#ifdef CONFIG_FILE_LOCKING 1857#ifdef CONFIG_FILE_LOCKING
1925extern int locks_mandatory_locked(struct inode *); 1858extern int locks_mandatory_locked(struct file *);
1926extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); 1859extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
1927 1860
1928/* 1861/*
@@ -1945,10 +1878,10 @@ static inline int mandatory_lock(struct inode *ino)
1945 return IS_MANDLOCK(ino) && __mandatory_lock(ino); 1878 return IS_MANDLOCK(ino) && __mandatory_lock(ino);
1946} 1879}
1947 1880
1948static inline int locks_verify_locked(struct inode *inode) 1881static inline int locks_verify_locked(struct file *file)
1949{ 1882{
1950 if (mandatory_lock(inode)) 1883 if (mandatory_lock(file_inode(file)))
1951 return locks_mandatory_locked(inode); 1884 return locks_mandatory_locked(file);
1952 return 0; 1885 return 0;
1953} 1886}
1954 1887
@@ -1968,6 +1901,12 @@ static inline int locks_verify_truncate(struct inode *inode,
1968 1901
1969static inline int break_lease(struct inode *inode, unsigned int mode) 1902static inline int break_lease(struct inode *inode, unsigned int mode)
1970{ 1903{
1904 /*
1905 * Since this check is lockless, we must ensure that any refcounts
1906 * taken are done before checking inode->i_flock. Otherwise, we could
1907 * end up racing with tasks trying to set a new lease on this file.
1908 */
1909 smp_mb();
1971 if (inode->i_flock) 1910 if (inode->i_flock)
1972 return __break_lease(inode, mode, FL_LEASE); 1911 return __break_lease(inode, mode, FL_LEASE);
1973 return 0; 1912 return 0;
@@ -2003,7 +1942,7 @@ static inline int break_deleg_wait(struct inode **delegated_inode)
2003} 1942}
2004 1943
2005#else /* !CONFIG_FILE_LOCKING */ 1944#else /* !CONFIG_FILE_LOCKING */
2006static inline int locks_mandatory_locked(struct inode *inode) 1945static inline int locks_mandatory_locked(struct file *file)
2007{ 1946{
2008 return 0; 1947 return 0;
2009} 1948}
@@ -2025,7 +1964,7 @@ static inline int mandatory_lock(struct inode *inode)
2025 return 0; 1964 return 0;
2026} 1965}
2027 1966
2028static inline int locks_verify_locked(struct inode *inode) 1967static inline int locks_verify_locked(struct file *file)
2029{ 1968{
2030 return 0; 1969 return 0;
2031} 1970}
@@ -2299,11 +2238,6 @@ static inline bool execute_ok(struct inode *inode)
2299 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); 2238 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
2300} 2239}
2301 2240
2302static inline struct inode *file_inode(struct file *f)
2303{
2304 return f->f_inode;
2305}
2306
2307static inline void file_start_write(struct file *file) 2241static inline void file_start_write(struct file *file)
2308{ 2242{
2309 if (!S_ISREG(file_inode(file)->i_mode)) 2243 if (!S_ISREG(file_inode(file)->i_mode))
@@ -2469,16 +2403,13 @@ extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2469extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 2403extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2470extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr, 2404extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr,
2471 unsigned long size, pgoff_t pgoff); 2405 unsigned long size, pgoff_t pgoff);
2472extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
2473int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2406int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2474extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2407extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2475extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, 2408extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long);
2476 loff_t *);
2477extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2409extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2478extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *, 2410extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *,
2479 unsigned long *, loff_t, loff_t *, size_t, size_t); 2411 unsigned long *, loff_t, size_t, size_t);
2480extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *, 2412extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
2481 unsigned long, loff_t, loff_t *, size_t, ssize_t);
2482extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); 2413extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2483extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 2414extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2484extern int generic_segment_checks(const struct iovec *iov, 2415extern int generic_segment_checks(const struct iovec *iov,
@@ -2538,6 +2469,9 @@ enum {
2538 2469
2539 /* filesystem does not support filling holes */ 2470 /* filesystem does not support filling holes */
2540 DIO_SKIP_HOLES = 0x02, 2471 DIO_SKIP_HOLES = 0x02,
2472
2473 /* filesystem can handle aio writes beyond i_size */
2474 DIO_ASYNC_EXTEND = 0x04,
2541}; 2475};
2542 2476
2543void dio_end_io(struct bio *bio, int error); 2477void dio_end_io(struct bio *bio, int error);
@@ -2560,11 +2494,14 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2560void inode_dio_wait(struct inode *inode); 2494void inode_dio_wait(struct inode *inode);
2561void inode_dio_done(struct inode *inode); 2495void inode_dio_done(struct inode *inode);
2562 2496
2497extern void inode_set_flags(struct inode *inode, unsigned int flags,
2498 unsigned int mask);
2499
2563extern const struct file_operations generic_ro_fops; 2500extern const struct file_operations generic_ro_fops;
2564 2501
2565#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) 2502#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
2566 2503
2567extern int vfs_readlink(struct dentry *, char __user *, int, const char *); 2504extern int readlink_copy(char __user *, int, const char *);
2568extern int page_readlink(struct dentry *, char __user *, int); 2505extern int page_readlink(struct dentry *, char __user *, int);
2569extern void *page_follow_link_light(struct dentry *, struct nameidata *); 2506extern void *page_follow_link_light(struct dentry *, struct nameidata *);
2570extern void page_put_link(struct dentry *, struct nameidata *, void *); 2507extern void page_put_link(struct dentry *, struct nameidata *, void *);
diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
new file mode 100644
index 000000000000..f49ddb1b2273
--- /dev/null
+++ b/include/linux/fsl_ifc.h
@@ -0,0 +1,838 @@
1/* Freescale Integrated Flash Controller
2 *
3 * Copyright 2011 Freescale Semiconductor, Inc
4 *
5 * Author: Dipen Dudhat <dipen.dudhat@freescale.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __ASM_FSL_IFC_H
23#define __ASM_FSL_IFC_H
24
25#include <linux/compiler.h>
26#include <linux/types.h>
27#include <linux/io.h>
28
29#include <linux/of_platform.h>
30#include <linux/interrupt.h>
31
32#define FSL_IFC_BANK_COUNT 4
33
34/*
35 * CSPR - Chip Select Property Register
36 */
37#define CSPR_BA 0xFFFF0000
38#define CSPR_BA_SHIFT 16
39#define CSPR_PORT_SIZE 0x00000180
40#define CSPR_PORT_SIZE_SHIFT 7
41/* Port Size 8 bit */
42#define CSPR_PORT_SIZE_8 0x00000080
43/* Port Size 16 bit */
44#define CSPR_PORT_SIZE_16 0x00000100
45/* Port Size 32 bit */
46#define CSPR_PORT_SIZE_32 0x00000180
47/* Write Protect */
48#define CSPR_WP 0x00000040
49#define CSPR_WP_SHIFT 6
50/* Machine Select */
51#define CSPR_MSEL 0x00000006
52#define CSPR_MSEL_SHIFT 1
53/* NOR */
54#define CSPR_MSEL_NOR 0x00000000
55/* NAND */
56#define CSPR_MSEL_NAND 0x00000002
57/* GPCM */
58#define CSPR_MSEL_GPCM 0x00000004
59/* Bank Valid */
60#define CSPR_V 0x00000001
61#define CSPR_V_SHIFT 0
62
63/*
64 * Address Mask Register
65 */
66#define IFC_AMASK_MASK 0xFFFF0000
67#define IFC_AMASK_SHIFT 16
68#define IFC_AMASK(n) (IFC_AMASK_MASK << \
69 (__ilog2(n) - IFC_AMASK_SHIFT))
70
71/*
72 * Chip Select Option Register IFC_NAND Machine
73 */
74/* Enable ECC Encoder */
75#define CSOR_NAND_ECC_ENC_EN 0x80000000
76#define CSOR_NAND_ECC_MODE_MASK 0x30000000
77/* 4 bit correction per 520 Byte sector */
78#define CSOR_NAND_ECC_MODE_4 0x00000000
79/* 8 bit correction per 528 Byte sector */
80#define CSOR_NAND_ECC_MODE_8 0x10000000
81/* Enable ECC Decoder */
82#define CSOR_NAND_ECC_DEC_EN 0x04000000
83/* Row Address Length */
84#define CSOR_NAND_RAL_MASK 0x01800000
85#define CSOR_NAND_RAL_SHIFT 20
86#define CSOR_NAND_RAL_1 0x00000000
87#define CSOR_NAND_RAL_2 0x00800000
88#define CSOR_NAND_RAL_3 0x01000000
89#define CSOR_NAND_RAL_4 0x01800000
90/* Page Size 512b, 2k, 4k */
91#define CSOR_NAND_PGS_MASK 0x00180000
92#define CSOR_NAND_PGS_SHIFT 16
93#define CSOR_NAND_PGS_512 0x00000000
94#define CSOR_NAND_PGS_2K 0x00080000
95#define CSOR_NAND_PGS_4K 0x00100000
96#define CSOR_NAND_PGS_8K 0x00180000
97/* Spare region Size */
98#define CSOR_NAND_SPRZ_MASK 0x0000E000
99#define CSOR_NAND_SPRZ_SHIFT 13
100#define CSOR_NAND_SPRZ_16 0x00000000
101#define CSOR_NAND_SPRZ_64 0x00002000
102#define CSOR_NAND_SPRZ_128 0x00004000
103#define CSOR_NAND_SPRZ_210 0x00006000
104#define CSOR_NAND_SPRZ_218 0x00008000
105#define CSOR_NAND_SPRZ_224 0x0000A000
106#define CSOR_NAND_SPRZ_CSOR_EXT 0x0000C000
107/* Pages Per Block */
108#define CSOR_NAND_PB_MASK 0x00000700
109#define CSOR_NAND_PB_SHIFT 8
110#define CSOR_NAND_PB(n) ((__ilog2(n) - 5) << CSOR_NAND_PB_SHIFT)
111/* Time for Read Enable High to Output High Impedance */
112#define CSOR_NAND_TRHZ_MASK 0x0000001C
113#define CSOR_NAND_TRHZ_SHIFT 2
114#define CSOR_NAND_TRHZ_20 0x00000000
115#define CSOR_NAND_TRHZ_40 0x00000004
116#define CSOR_NAND_TRHZ_60 0x00000008
117#define CSOR_NAND_TRHZ_80 0x0000000C
118#define CSOR_NAND_TRHZ_100 0x00000010
119/* Buffer control disable */
120#define CSOR_NAND_BCTLD 0x00000001
121
122/*
123 * Chip Select Option Register - NOR Flash Mode
124 */
125/* Enable Address shift Mode */
126#define CSOR_NOR_ADM_SHFT_MODE_EN 0x80000000
127/* Page Read Enable from NOR device */
128#define CSOR_NOR_PGRD_EN 0x10000000
129/* AVD Toggle Enable during Burst Program */
130#define CSOR_NOR_AVD_TGL_PGM_EN 0x01000000
131/* Address Data Multiplexing Shift */
132#define CSOR_NOR_ADM_MASK 0x0003E000
133#define CSOR_NOR_ADM_SHIFT_SHIFT 13
134#define CSOR_NOR_ADM_SHIFT(n) ((n) << CSOR_NOR_ADM_SHIFT_SHIFT)
135/* Type of the NOR device hooked */
136#define CSOR_NOR_NOR_MODE_AYSNC_NOR 0x00000000
137#define CSOR_NOR_NOR_MODE_AVD_NOR 0x00000020
138/* Time for Read Enable High to Output High Impedance */
139#define CSOR_NOR_TRHZ_MASK 0x0000001C
140#define CSOR_NOR_TRHZ_SHIFT 2
141#define CSOR_NOR_TRHZ_20 0x00000000
142#define CSOR_NOR_TRHZ_40 0x00000004
143#define CSOR_NOR_TRHZ_60 0x00000008
144#define CSOR_NOR_TRHZ_80 0x0000000C
145#define CSOR_NOR_TRHZ_100 0x00000010
146/* Buffer control disable */
147#define CSOR_NOR_BCTLD 0x00000001
148
149/*
150 * Chip Select Option Register - GPCM Mode
151 */
152/* GPCM Mode - Normal */
153#define CSOR_GPCM_GPMODE_NORMAL 0x00000000
154/* GPCM Mode - GenericASIC */
155#define CSOR_GPCM_GPMODE_ASIC 0x80000000
156/* Parity Mode odd/even */
157#define CSOR_GPCM_PARITY_EVEN 0x40000000
158/* Parity Checking enable/disable */
159#define CSOR_GPCM_PAR_EN 0x20000000
160/* GPCM Timeout Count */
161#define CSOR_GPCM_GPTO_MASK 0x0F000000
162#define CSOR_GPCM_GPTO_SHIFT 24
163#define CSOR_GPCM_GPTO(n) ((__ilog2(n) - 8) << CSOR_GPCM_GPTO_SHIFT)
164/* GPCM External Access Termination mode for read access */
165#define CSOR_GPCM_RGETA_EXT 0x00080000
166/* GPCM External Access Termination mode for write access */
167#define CSOR_GPCM_WGETA_EXT 0x00040000
168/* Address Data Multiplexing Shift */
169#define CSOR_GPCM_ADM_MASK 0x0003E000
170#define CSOR_GPCM_ADM_SHIFT_SHIFT 13
171#define CSOR_GPCM_ADM_SHIFT(n) ((n) << CSOR_GPCM_ADM_SHIFT_SHIFT)
172/* Generic ASIC Parity error indication delay */
173#define CSOR_GPCM_GAPERRD_MASK 0x00000180
174#define CSOR_GPCM_GAPERRD_SHIFT 7
175#define CSOR_GPCM_GAPERRD(n) (((n) - 1) << CSOR_GPCM_GAPERRD_SHIFT)
176/* Time for Read Enable High to Output High Impedance */
177#define CSOR_GPCM_TRHZ_MASK 0x0000001C
178#define CSOR_GPCM_TRHZ_20 0x00000000
179#define CSOR_GPCM_TRHZ_40 0x00000004
180#define CSOR_GPCM_TRHZ_60 0x00000008
181#define CSOR_GPCM_TRHZ_80 0x0000000C
182#define CSOR_GPCM_TRHZ_100 0x00000010
183/* Buffer control disable */
184#define CSOR_GPCM_BCTLD 0x00000001
185
186/*
187 * Ready Busy Status Register (RB_STAT)
188 */
189/* CSn is READY */
190#define IFC_RB_STAT_READY_CS0 0x80000000
191#define IFC_RB_STAT_READY_CS1 0x40000000
192#define IFC_RB_STAT_READY_CS2 0x20000000
193#define IFC_RB_STAT_READY_CS3 0x10000000
194
195/*
196 * General Control Register (GCR)
197 */
198#define IFC_GCR_MASK 0x8000F800
199/* reset all IFC hardware */
200#define IFC_GCR_SOFT_RST_ALL 0x80000000
201/* Turnaroud Time of external buffer */
202#define IFC_GCR_TBCTL_TRN_TIME 0x0000F800
203#define IFC_GCR_TBCTL_TRN_TIME_SHIFT 11
204
205/*
206 * Common Event and Error Status Register (CM_EVTER_STAT)
207 */
208/* Chip select error */
209#define IFC_CM_EVTER_STAT_CSER 0x80000000
210
211/*
212 * Common Event and Error Enable Register (CM_EVTER_EN)
213 */
214/* Chip select error checking enable */
215#define IFC_CM_EVTER_EN_CSEREN 0x80000000
216
217/*
218 * Common Event and Error Interrupt Enable Register (CM_EVTER_INTR_EN)
219 */
220/* Chip select error interrupt enable */
221#define IFC_CM_EVTER_INTR_EN_CSERIREN 0x80000000
222
223/*
224 * Common Transfer Error Attribute Register-0 (CM_ERATTR0)
225 */
226/* transaction type of error Read/Write */
227#define IFC_CM_ERATTR0_ERTYP_READ 0x80000000
228#define IFC_CM_ERATTR0_ERAID 0x0FF00000
229#define IFC_CM_ERATTR0_ERAID_SHIFT 20
230#define IFC_CM_ERATTR0_ESRCID 0x0000FF00
231#define IFC_CM_ERATTR0_ESRCID_SHIFT 8
232
233/*
234 * Clock Control Register (CCR)
235 */
236#define IFC_CCR_MASK 0x0F0F8800
237/* Clock division ratio */
238#define IFC_CCR_CLK_DIV_MASK 0x0F000000
239#define IFC_CCR_CLK_DIV_SHIFT 24
240#define IFC_CCR_CLK_DIV(n) ((n-1) << IFC_CCR_CLK_DIV_SHIFT)
241/* IFC Clock Delay */
242#define IFC_CCR_CLK_DLY_MASK 0x000F0000
243#define IFC_CCR_CLK_DLY_SHIFT 16
244#define IFC_CCR_CLK_DLY(n) ((n) << IFC_CCR_CLK_DLY_SHIFT)
245/* Invert IFC clock before sending out */
246#define IFC_CCR_INV_CLK_EN 0x00008000
247/* Fedback IFC Clock */
248#define IFC_CCR_FB_IFC_CLK_SEL 0x00000800
249
250/*
251 * Clock Status Register (CSR)
252 */
253/* Clk is stable */
254#define IFC_CSR_CLK_STAT_STABLE 0x80000000
255
256/*
257 * IFC_NAND Machine Specific Registers
258 */
259/*
260 * NAND Configuration Register (NCFGR)
261 */
262/* Auto Boot Mode */
263#define IFC_NAND_NCFGR_BOOT 0x80000000
264/* Addressing Mode-ROW0+n/COL0 */
265#define IFC_NAND_NCFGR_ADDR_MODE_RC0 0x00000000
266/* Addressing Mode-ROW0+n/COL0+n */
267#define IFC_NAND_NCFGR_ADDR_MODE_RC1 0x00400000
268/* Number of loop iterations of FIR sequences for multi page operations */
269#define IFC_NAND_NCFGR_NUM_LOOP_MASK 0x0000F000
270#define IFC_NAND_NCFGR_NUM_LOOP_SHIFT 12
271#define IFC_NAND_NCFGR_NUM_LOOP(n) ((n) << IFC_NAND_NCFGR_NUM_LOOP_SHIFT)
272/* Number of wait cycles */
273#define IFC_NAND_NCFGR_NUM_WAIT_MASK 0x000000FF
274#define IFC_NAND_NCFGR_NUM_WAIT_SHIFT 0
275
276/*
277 * NAND Flash Command Registers (NAND_FCR0/NAND_FCR1)
278 */
279/* General purpose FCM flash command bytes CMD0-CMD7 */
280#define IFC_NAND_FCR0_CMD0 0xFF000000
281#define IFC_NAND_FCR0_CMD0_SHIFT 24
282#define IFC_NAND_FCR0_CMD1 0x00FF0000
283#define IFC_NAND_FCR0_CMD1_SHIFT 16
284#define IFC_NAND_FCR0_CMD2 0x0000FF00
285#define IFC_NAND_FCR0_CMD2_SHIFT 8
286#define IFC_NAND_FCR0_CMD3 0x000000FF
287#define IFC_NAND_FCR0_CMD3_SHIFT 0
288#define IFC_NAND_FCR1_CMD4 0xFF000000
289#define IFC_NAND_FCR1_CMD4_SHIFT 24
290#define IFC_NAND_FCR1_CMD5 0x00FF0000
291#define IFC_NAND_FCR1_CMD5_SHIFT 16
292#define IFC_NAND_FCR1_CMD6 0x0000FF00
293#define IFC_NAND_FCR1_CMD6_SHIFT 8
294#define IFC_NAND_FCR1_CMD7 0x000000FF
295#define IFC_NAND_FCR1_CMD7_SHIFT 0
296
297/*
298 * Flash ROW and COL Address Register (ROWn, COLn)
299 */
300/* Main/spare region locator */
301#define IFC_NAND_COL_MS 0x80000000
302/* Column Address */
303#define IFC_NAND_COL_CA_MASK 0x00000FFF
304
305/*
306 * NAND Flash Byte Count Register (NAND_BC)
307 */
308/* Byte Count for read/Write */
309#define IFC_NAND_BC 0x000001FF
310
311/*
312 * NAND Flash Instruction Registers (NAND_FIR0/NAND_FIR1/NAND_FIR2)
313 */
314/* NAND Machine specific opcodes OP0-OP14*/
315#define IFC_NAND_FIR0_OP0 0xFC000000
316#define IFC_NAND_FIR0_OP0_SHIFT 26
317#define IFC_NAND_FIR0_OP1 0x03F00000
318#define IFC_NAND_FIR0_OP1_SHIFT 20
319#define IFC_NAND_FIR0_OP2 0x000FC000
320#define IFC_NAND_FIR0_OP2_SHIFT 14
321#define IFC_NAND_FIR0_OP3 0x00003F00
322#define IFC_NAND_FIR0_OP3_SHIFT 8
323#define IFC_NAND_FIR0_OP4 0x000000FC
324#define IFC_NAND_FIR0_OP4_SHIFT 2
325#define IFC_NAND_FIR1_OP5 0xFC000000
326#define IFC_NAND_FIR1_OP5_SHIFT 26
327#define IFC_NAND_FIR1_OP6 0x03F00000
328#define IFC_NAND_FIR1_OP6_SHIFT 20
329#define IFC_NAND_FIR1_OP7 0x000FC000
330#define IFC_NAND_FIR1_OP7_SHIFT 14
331#define IFC_NAND_FIR1_OP8 0x00003F00
332#define IFC_NAND_FIR1_OP8_SHIFT 8
333#define IFC_NAND_FIR1_OP9 0x000000FC
334#define IFC_NAND_FIR1_OP9_SHIFT 2
335#define IFC_NAND_FIR2_OP10 0xFC000000
336#define IFC_NAND_FIR2_OP10_SHIFT 26
337#define IFC_NAND_FIR2_OP11 0x03F00000
338#define IFC_NAND_FIR2_OP11_SHIFT 20
339#define IFC_NAND_FIR2_OP12 0x000FC000
340#define IFC_NAND_FIR2_OP12_SHIFT 14
341#define IFC_NAND_FIR2_OP13 0x00003F00
342#define IFC_NAND_FIR2_OP13_SHIFT 8
343#define IFC_NAND_FIR2_OP14 0x000000FC
344#define IFC_NAND_FIR2_OP14_SHIFT 2
345
346/*
347 * Instruction opcodes to be programmed
348 * in FIR registers- 6bits
349 */
350enum ifc_nand_fir_opcodes {
351 IFC_FIR_OP_NOP,
352 IFC_FIR_OP_CA0,
353 IFC_FIR_OP_CA1,
354 IFC_FIR_OP_CA2,
355 IFC_FIR_OP_CA3,
356 IFC_FIR_OP_RA0,
357 IFC_FIR_OP_RA1,
358 IFC_FIR_OP_RA2,
359 IFC_FIR_OP_RA3,
360 IFC_FIR_OP_CMD0,
361 IFC_FIR_OP_CMD1,
362 IFC_FIR_OP_CMD2,
363 IFC_FIR_OP_CMD3,
364 IFC_FIR_OP_CMD4,
365 IFC_FIR_OP_CMD5,
366 IFC_FIR_OP_CMD6,
367 IFC_FIR_OP_CMD7,
368 IFC_FIR_OP_CW0,
369 IFC_FIR_OP_CW1,
370 IFC_FIR_OP_CW2,
371 IFC_FIR_OP_CW3,
372 IFC_FIR_OP_CW4,
373 IFC_FIR_OP_CW5,
374 IFC_FIR_OP_CW6,
375 IFC_FIR_OP_CW7,
376 IFC_FIR_OP_WBCD,
377 IFC_FIR_OP_RBCD,
378 IFC_FIR_OP_BTRD,
379 IFC_FIR_OP_RDSTAT,
380 IFC_FIR_OP_NWAIT,
381 IFC_FIR_OP_WFR,
382 IFC_FIR_OP_SBRD,
383 IFC_FIR_OP_UA,
384 IFC_FIR_OP_RB,
385};
386
387/*
388 * NAND Chip Select Register (NAND_CSEL)
389 */
390#define IFC_NAND_CSEL 0x0C000000
391#define IFC_NAND_CSEL_SHIFT 26
392#define IFC_NAND_CSEL_CS0 0x00000000
393#define IFC_NAND_CSEL_CS1 0x04000000
394#define IFC_NAND_CSEL_CS2 0x08000000
395#define IFC_NAND_CSEL_CS3 0x0C000000
396
397/*
398 * NAND Operation Sequence Start (NANDSEQ_STRT)
399 */
400/* NAND Flash Operation Start */
401#define IFC_NAND_SEQ_STRT_FIR_STRT 0x80000000
402/* Automatic Erase */
403#define IFC_NAND_SEQ_STRT_AUTO_ERS 0x00800000
404/* Automatic Program */
405#define IFC_NAND_SEQ_STRT_AUTO_PGM 0x00100000
406/* Automatic Copyback */
407#define IFC_NAND_SEQ_STRT_AUTO_CPB 0x00020000
408/* Automatic Read Operation */
409#define IFC_NAND_SEQ_STRT_AUTO_RD 0x00004000
410/* Automatic Status Read */
411#define IFC_NAND_SEQ_STRT_AUTO_STAT_RD 0x00000800
412
413/*
414 * NAND Event and Error Status Register (NAND_EVTER_STAT)
415 */
416/* Operation Complete */
417#define IFC_NAND_EVTER_STAT_OPC 0x80000000
418/* Flash Timeout Error */
419#define IFC_NAND_EVTER_STAT_FTOER 0x08000000
420/* Write Protect Error */
421#define IFC_NAND_EVTER_STAT_WPER 0x04000000
422/* ECC Error */
423#define IFC_NAND_EVTER_STAT_ECCER 0x02000000
424/* RCW Load Done */
425#define IFC_NAND_EVTER_STAT_RCW_DN 0x00008000
426/* Boot Loadr Done */
427#define IFC_NAND_EVTER_STAT_BOOT_DN 0x00004000
428/* Bad Block Indicator search select */
429#define IFC_NAND_EVTER_STAT_BBI_SRCH_SE 0x00000800
430
431/*
432 * NAND Flash Page Read Completion Event Status Register
433 * (PGRDCMPL_EVT_STAT)
434 */
435#define PGRDCMPL_EVT_STAT_MASK 0xFFFF0000
436/* Small Page 0-15 Done */
437#define PGRDCMPL_EVT_STAT_SECTION_SP(n) (1 << (31 - (n)))
438/* Large Page(2K) 0-3 Done */
439#define PGRDCMPL_EVT_STAT_LP_2K(n) (0xF << (28 - (n)*4))
440/* Large Page(4K) 0-1 Done */
441#define PGRDCMPL_EVT_STAT_LP_4K(n) (0xFF << (24 - (n)*8))
442
443/*
444 * NAND Event and Error Enable Register (NAND_EVTER_EN)
445 */
446/* Operation complete event enable */
447#define IFC_NAND_EVTER_EN_OPC_EN 0x80000000
448/* Page read complete event enable */
449#define IFC_NAND_EVTER_EN_PGRDCMPL_EN 0x20000000
450/* Flash Timeout error enable */
451#define IFC_NAND_EVTER_EN_FTOER_EN 0x08000000
452/* Write Protect error enable */
453#define IFC_NAND_EVTER_EN_WPER_EN 0x04000000
454/* ECC error logging enable */
455#define IFC_NAND_EVTER_EN_ECCER_EN 0x02000000
456
457/*
458 * NAND Event and Error Interrupt Enable Register (NAND_EVTER_INTR_EN)
459 */
460/* Enable interrupt for operation complete */
461#define IFC_NAND_EVTER_INTR_OPCIR_EN 0x80000000
462/* Enable interrupt for Page read complete */
463#define IFC_NAND_EVTER_INTR_PGRDCMPLIR_EN 0x20000000
464/* Enable interrupt for Flash timeout error */
465#define IFC_NAND_EVTER_INTR_FTOERIR_EN 0x08000000
466/* Enable interrupt for Write protect error */
467#define IFC_NAND_EVTER_INTR_WPERIR_EN 0x04000000
468/* Enable interrupt for ECC error*/
469#define IFC_NAND_EVTER_INTR_ECCERIR_EN 0x02000000
470
471/*
472 * NAND Transfer Error Attribute Register-0 (NAND_ERATTR0)
473 */
474#define IFC_NAND_ERATTR0_MASK 0x0C080000
475/* Error on CS0-3 for NAND */
476#define IFC_NAND_ERATTR0_ERCS_CS0 0x00000000
477#define IFC_NAND_ERATTR0_ERCS_CS1 0x04000000
478#define IFC_NAND_ERATTR0_ERCS_CS2 0x08000000
479#define IFC_NAND_ERATTR0_ERCS_CS3 0x0C000000
480/* Transaction type of error Read/Write */
481#define IFC_NAND_ERATTR0_ERTTYPE_READ 0x00080000
482
483/*
484 * NAND Flash Status Register (NAND_FSR)
485 */
486/* First byte of data read from read status op */
487#define IFC_NAND_NFSR_RS0 0xFF000000
488/* Second byte of data read from read status op */
489#define IFC_NAND_NFSR_RS1 0x00FF0000
490
491/*
492 * ECC Error Status Registers (ECCSTAT0-ECCSTAT3)
493 */
494/* Number of ECC errors on sector n (n = 0-15) */
495#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR0_MASK 0x0F000000
496#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR0_SHIFT 24
497#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR1_MASK 0x000F0000
498#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR1_SHIFT 16
499#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR2_MASK 0x00000F00
500#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR2_SHIFT 8
501#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR3_MASK 0x0000000F
502#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR3_SHIFT 0
503#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR4_MASK 0x0F000000
504#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR4_SHIFT 24
505#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR5_MASK 0x000F0000
506#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR5_SHIFT 16
507#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR6_MASK 0x00000F00
508#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR6_SHIFT 8
509#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR7_MASK 0x0000000F
510#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR7_SHIFT 0
511#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR8_MASK 0x0F000000
512#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR8_SHIFT 24
513#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR9_MASK 0x000F0000
514#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR9_SHIFT 16
515#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR10_MASK 0x00000F00
516#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR10_SHIFT 8
517#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR11_MASK 0x0000000F
518#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR11_SHIFT 0
519#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR12_MASK 0x0F000000
520#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR12_SHIFT 24
521#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR13_MASK 0x000F0000
522#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR13_SHIFT 16
523#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR14_MASK 0x00000F00
524#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR14_SHIFT 8
525#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR15_MASK 0x0000000F
526#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR15_SHIFT 0
527
528/*
529 * NAND Control Register (NANDCR)
530 */
531#define IFC_NAND_NCR_FTOCNT_MASK 0x1E000000
532#define IFC_NAND_NCR_FTOCNT_SHIFT 25
533#define IFC_NAND_NCR_FTOCNT(n) ((_ilog2(n) - 8) << IFC_NAND_NCR_FTOCNT_SHIFT)
534
535/*
536 * NAND_AUTOBOOT_TRGR
537 */
538/* Trigger RCW load */
539#define IFC_NAND_AUTOBOOT_TRGR_RCW_LD 0x80000000
540/* Trigget Auto Boot */
541#define IFC_NAND_AUTOBOOT_TRGR_BOOT_LD 0x20000000
542
543/*
544 * NAND_MDR
545 */
546/* 1st read data byte when opcode SBRD */
547#define IFC_NAND_MDR_RDATA0 0xFF000000
548/* 2nd read data byte when opcode SBRD */
549#define IFC_NAND_MDR_RDATA1 0x00FF0000
550
551/*
552 * NOR Machine Specific Registers
553 */
554/*
555 * NOR Event and Error Status Register (NOR_EVTER_STAT)
556 */
557/* NOR Command Sequence Operation Complete */
558#define IFC_NOR_EVTER_STAT_OPC_NOR 0x80000000
559/* Write Protect Error */
560#define IFC_NOR_EVTER_STAT_WPER 0x04000000
561/* Command Sequence Timeout Error */
562#define IFC_NOR_EVTER_STAT_STOER 0x01000000
563
564/*
565 * NOR Event and Error Enable Register (NOR_EVTER_EN)
566 */
567/* NOR Command Seq complete event enable */
568#define IFC_NOR_EVTER_EN_OPCEN_NOR 0x80000000
569/* Write Protect Error Checking Enable */
570#define IFC_NOR_EVTER_EN_WPEREN 0x04000000
571/* Timeout Error Enable */
572#define IFC_NOR_EVTER_EN_STOEREN 0x01000000
573
574/*
575 * NOR Event and Error Interrupt Enable Register (NOR_EVTER_INTR_EN)
576 */
577/* Enable interrupt for OPC complete */
578#define IFC_NOR_EVTER_INTR_OPCEN_NOR 0x80000000
579/* Enable interrupt for write protect error */
580#define IFC_NOR_EVTER_INTR_WPEREN 0x04000000
581/* Enable interrupt for timeout error */
582#define IFC_NOR_EVTER_INTR_STOEREN 0x01000000
583
584/*
585 * NOR Transfer Error Attribute Register-0 (NOR_ERATTR0)
586 */
587/* Source ID for error transaction */
588#define IFC_NOR_ERATTR0_ERSRCID 0xFF000000
589/* AXI ID for error transation */
590#define IFC_NOR_ERATTR0_ERAID 0x000FF000
591/* Chip select corresponds to NOR error */
592#define IFC_NOR_ERATTR0_ERCS_CS0 0x00000000
593#define IFC_NOR_ERATTR0_ERCS_CS1 0x00000010
594#define IFC_NOR_ERATTR0_ERCS_CS2 0x00000020
595#define IFC_NOR_ERATTR0_ERCS_CS3 0x00000030
596/* Type of transaction read/write */
597#define IFC_NOR_ERATTR0_ERTYPE_READ 0x00000001
598
599/*
600 * NOR Transfer Error Attribute Register-2 (NOR_ERATTR2)
601 */
602#define IFC_NOR_ERATTR2_ER_NUM_PHASE_EXP 0x000F0000
603#define IFC_NOR_ERATTR2_ER_NUM_PHASE_PER 0x00000F00
604
605/*
606 * NOR Control Register (NORCR)
607 */
608#define IFC_NORCR_MASK 0x0F0F0000
609/* No. of Address/Data Phase */
610#define IFC_NORCR_NUM_PHASE_MASK 0x0F000000
611#define IFC_NORCR_NUM_PHASE_SHIFT 24
612#define IFC_NORCR_NUM_PHASE(n) ((n-1) << IFC_NORCR_NUM_PHASE_SHIFT)
613/* Sequence Timeout Count */
614#define IFC_NORCR_STOCNT_MASK 0x000F0000
615#define IFC_NORCR_STOCNT_SHIFT 16
616#define IFC_NORCR_STOCNT(n) ((__ilog2(n) - 8) << IFC_NORCR_STOCNT_SHIFT)
617
618/*
619 * GPCM Machine specific registers
620 */
621/*
622 * GPCM Event and Error Status Register (GPCM_EVTER_STAT)
623 */
624/* Timeout error */
625#define IFC_GPCM_EVTER_STAT_TOER 0x04000000
626/* Parity error */
627#define IFC_GPCM_EVTER_STAT_PER 0x01000000
628
629/*
630 * GPCM Event and Error Enable Register (GPCM_EVTER_EN)
631 */
632/* Timeout error enable */
633#define IFC_GPCM_EVTER_EN_TOER_EN 0x04000000
634/* Parity error enable */
635#define IFC_GPCM_EVTER_EN_PER_EN 0x01000000
636
637/*
638 * GPCM Event and Error Interrupt Enable Register (GPCM_EVTER_INTR_EN)
639 */
640/* Enable Interrupt for timeout error */
641#define IFC_GPCM_EEIER_TOERIR_EN 0x04000000
642/* Enable Interrupt for Parity error */
643#define IFC_GPCM_EEIER_PERIR_EN 0x01000000
644
645/*
646 * GPCM Transfer Error Attribute Register-0 (GPCM_ERATTR0)
647 */
648/* Source ID for error transaction */
649#define IFC_GPCM_ERATTR0_ERSRCID 0xFF000000
650/* AXI ID for error transaction */
651#define IFC_GPCM_ERATTR0_ERAID 0x000FF000
652/* Chip select corresponds to GPCM error */
653#define IFC_GPCM_ERATTR0_ERCS_CS0 0x00000000
654#define IFC_GPCM_ERATTR0_ERCS_CS1 0x00000040
655#define IFC_GPCM_ERATTR0_ERCS_CS2 0x00000080
656#define IFC_GPCM_ERATTR0_ERCS_CS3 0x000000C0
657/* Type of transaction read/Write */
658#define IFC_GPCM_ERATTR0_ERTYPE_READ 0x00000001
659
660/*
661 * GPCM Transfer Error Attribute Register-2 (GPCM_ERATTR2)
662 */
663/* On which beat of address/data parity error is observed */
664#define IFC_GPCM_ERATTR2_PERR_BEAT 0x00000C00
665/* Parity Error on byte */
666#define IFC_GPCM_ERATTR2_PERR_BYTE 0x000000F0
667/* Parity Error reported in addr or data phase */
668#define IFC_GPCM_ERATTR2_PERR_DATA_PHASE 0x00000001
669
670/*
671 * GPCM Status Register (GPCM_STAT)
672 */
673#define IFC_GPCM_STAT_BSY 0x80000000 /* GPCM is busy */
674
675/*
676 * IFC Controller NAND Machine registers
677 */
678struct fsl_ifc_nand {
679 __be32 ncfgr;
680 u32 res1[0x4];
681 __be32 nand_fcr0;
682 __be32 nand_fcr1;
683 u32 res2[0x8];
684 __be32 row0;
685 u32 res3;
686 __be32 col0;
687 u32 res4;
688 __be32 row1;
689 u32 res5;
690 __be32 col1;
691 u32 res6;
692 __be32 row2;
693 u32 res7;
694 __be32 col2;
695 u32 res8;
696 __be32 row3;
697 u32 res9;
698 __be32 col3;
699 u32 res10[0x24];
700 __be32 nand_fbcr;
701 u32 res11;
702 __be32 nand_fir0;
703 __be32 nand_fir1;
704 __be32 nand_fir2;
705 u32 res12[0x10];
706 __be32 nand_csel;
707 u32 res13;
708 __be32 nandseq_strt;
709 u32 res14;
710 __be32 nand_evter_stat;
711 u32 res15;
712 __be32 pgrdcmpl_evt_stat;
713 u32 res16[0x2];
714 __be32 nand_evter_en;
715 u32 res17[0x2];
716 __be32 nand_evter_intr_en;
717 u32 res18[0x2];
718 __be32 nand_erattr0;
719 __be32 nand_erattr1;
720 u32 res19[0x10];
721 __be32 nand_fsr;
722 u32 res20;
723 __be32 nand_eccstat[4];
724 u32 res21[0x20];
725 __be32 nanndcr;
726 u32 res22[0x2];
727 __be32 nand_autoboot_trgr;
728 u32 res23;
729 __be32 nand_mdr;
730 u32 res24[0x5C];
731};
732
733/*
734 * IFC controller NOR Machine registers
735 */
736struct fsl_ifc_nor {
737 __be32 nor_evter_stat;
738 u32 res1[0x2];
739 __be32 nor_evter_en;
740 u32 res2[0x2];
741 __be32 nor_evter_intr_en;
742 u32 res3[0x2];
743 __be32 nor_erattr0;
744 __be32 nor_erattr1;
745 __be32 nor_erattr2;
746 u32 res4[0x4];
747 __be32 norcr;
748 u32 res5[0xEF];
749};
750
751/*
752 * IFC controller GPCM Machine registers
753 */
754struct fsl_ifc_gpcm {
755 __be32 gpcm_evter_stat;
756 u32 res1[0x2];
757 __be32 gpcm_evter_en;
758 u32 res2[0x2];
759 __be32 gpcm_evter_intr_en;
760 u32 res3[0x2];
761 __be32 gpcm_erattr0;
762 __be32 gpcm_erattr1;
763 __be32 gpcm_erattr2;
764 __be32 gpcm_stat;
765 u32 res4[0x1F3];
766};
767
768/*
769 * IFC Controller Registers
770 */
771struct fsl_ifc_regs {
772 __be32 ifc_rev;
773 u32 res1[0x2];
774 struct {
775 __be32 cspr_ext;
776 __be32 cspr;
777 u32 res2;
778 } cspr_cs[FSL_IFC_BANK_COUNT];
779 u32 res3[0x19];
780 struct {
781 __be32 amask;
782 u32 res4[0x2];
783 } amask_cs[FSL_IFC_BANK_COUNT];
784 u32 res5[0x17];
785 struct {
786 __be32 csor_ext;
787 __be32 csor;
788 u32 res6;
789 } csor_cs[FSL_IFC_BANK_COUNT];
790 u32 res7[0x19];
791 struct {
792 __be32 ftim[4];
793 u32 res8[0x8];
794 } ftim_cs[FSL_IFC_BANK_COUNT];
795 u32 res9[0x60];
796 __be32 rb_stat;
797 u32 res10[0x2];
798 __be32 ifc_gcr;
799 u32 res11[0x2];
800 __be32 cm_evter_stat;
801 u32 res12[0x2];
802 __be32 cm_evter_en;
803 u32 res13[0x2];
804 __be32 cm_evter_intr_en;
805 u32 res14[0x2];
806 __be32 cm_erattr0;
807 __be32 cm_erattr1;
808 u32 res15[0x2];
809 __be32 ifc_ccr;
810 __be32 ifc_csr;
811 u32 res16[0x2EB];
812 struct fsl_ifc_nand ifc_nand;
813 struct fsl_ifc_nor ifc_nor;
814 struct fsl_ifc_gpcm ifc_gpcm;
815};
816
817extern unsigned int convert_ifc_address(phys_addr_t addr_base);
818extern int fsl_ifc_find(phys_addr_t addr_base);
819
820/* overview of the fsl ifc controller */
821
822struct fsl_ifc_ctrl {
823 /* device info */
824 struct device *dev;
825 struct fsl_ifc_regs __iomem *regs;
826 int irq;
827 int nand_irq;
828 spinlock_t lock;
829 void *nand;
830
831 u32 nand_stat;
832 wait_queue_head_t nand_wait;
833};
834
835extern struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
836
837
838#endif /* __ASM_FSL_IFC_H */
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 64cf3ef50696..fc7718c6bd3e 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -178,7 +178,7 @@ struct fsnotify_group {
178 struct fanotify_group_private_data { 178 struct fanotify_group_private_data {
179#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS 179#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
180 /* allows a group to block waiting for a userspace response */ 180 /* allows a group to block waiting for a userspace response */
181 struct mutex access_mutex; 181 spinlock_t access_lock;
182 struct list_head access_list; 182 struct list_head access_list;
183 wait_queue_head_t access_waitq; 183 wait_queue_head_t access_waitq;
184 atomic_t bypass_perm; 184 atomic_t bypass_perm;
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f4233b195dab..9212b017bc72 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -92,6 +92,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
92 * STUB - The ftrace_ops is just a place holder. 92 * STUB - The ftrace_ops is just a place holder.
93 * INITIALIZED - The ftrace_ops has already been initialized (first use time 93 * INITIALIZED - The ftrace_ops has already been initialized (first use time
94 * register_ftrace_function() is called, it will initialized the ops) 94 * register_ftrace_function() is called, it will initialized the ops)
95 * DELETED - The ops are being deleted, do not let them be registered again.
95 */ 96 */
96enum { 97enum {
97 FTRACE_OPS_FL_ENABLED = 1 << 0, 98 FTRACE_OPS_FL_ENABLED = 1 << 0,
@@ -103,13 +104,26 @@ enum {
103 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6, 104 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6,
104 FTRACE_OPS_FL_STUB = 1 << 7, 105 FTRACE_OPS_FL_STUB = 1 << 7,
105 FTRACE_OPS_FL_INITIALIZED = 1 << 8, 106 FTRACE_OPS_FL_INITIALIZED = 1 << 8,
107 FTRACE_OPS_FL_DELETED = 1 << 9,
106}; 108};
107 109
110/*
111 * Note, ftrace_ops can be referenced outside of RCU protection.
112 * (Although, for perf, the control ops prevent that). If ftrace_ops is
113 * allocated and not part of kernel core data, the unregistering of it will
114 * perform a scheduling on all CPUs to make sure that there are no more users.
115 * Depending on the load of the system that may take a bit of time.
116 *
117 * Any private data added must also take care not to be freed and if private
118 * data is added to a ftrace_ops that is in core code, the user of the
119 * ftrace_ops must perform a schedule_on_each_cpu() before freeing it.
120 */
108struct ftrace_ops { 121struct ftrace_ops {
109 ftrace_func_t func; 122 ftrace_func_t func;
110 struct ftrace_ops *next; 123 struct ftrace_ops *next;
111 unsigned long flags; 124 unsigned long flags;
112 int __percpu *disabled; 125 int __percpu *disabled;
126 void *private;
113#ifdef CONFIG_DYNAMIC_FTRACE 127#ifdef CONFIG_DYNAMIC_FTRACE
114 struct ftrace_hash *notrace_hash; 128 struct ftrace_hash *notrace_hash;
115 struct ftrace_hash *filter_hash; 129 struct ftrace_hash *filter_hash;
@@ -285,7 +299,7 @@ extern void
285unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); 299unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
286extern void unregister_ftrace_function_probe_all(char *glob); 300extern void unregister_ftrace_function_probe_all(char *glob);
287 301
288extern int ftrace_text_reserved(void *start, void *end); 302extern int ftrace_text_reserved(const void *start, const void *end);
289 303
290extern int ftrace_nr_registered_ops(void); 304extern int ftrace_nr_registered_ops(void);
291 305
@@ -316,12 +330,9 @@ enum {
316#define FTRACE_REF_MAX ((1UL << 29) - 1) 330#define FTRACE_REF_MAX ((1UL << 29) - 1)
317 331
318struct dyn_ftrace { 332struct dyn_ftrace {
319 union { 333 unsigned long ip; /* address of mcount call-site */
320 unsigned long ip; /* address of mcount call-site */
321 struct dyn_ftrace *freelist;
322 };
323 unsigned long flags; 334 unsigned long flags;
324 struct dyn_arch_ftrace arch; 335 struct dyn_arch_ftrace arch;
325}; 336};
326 337
327int ftrace_force_update(void); 338int ftrace_force_update(void);
@@ -409,7 +420,7 @@ ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
409 420
410/* defined in arch */ 421/* defined in arch */
411extern int ftrace_ip_converted(unsigned long ip); 422extern int ftrace_ip_converted(unsigned long ip);
412extern int ftrace_dyn_arch_init(void *data); 423extern int ftrace_dyn_arch_init(void);
413extern void ftrace_replace_code(int enable); 424extern void ftrace_replace_code(int enable);
414extern int ftrace_update_ftrace_func(ftrace_func_t func); 425extern int ftrace_update_ftrace_func(ftrace_func_t func);
415extern void ftrace_caller(void); 426extern void ftrace_caller(void);
@@ -541,7 +552,7 @@ static inline __init int unregister_ftrace_command(char *cmd_name)
541{ 552{
542 return -EINVAL; 553 return -EINVAL;
543} 554}
544static inline int ftrace_text_reserved(void *start, void *end) 555static inline int ftrace_text_reserved(const void *start, const void *end)
545{ 556{
546 return 0; 557 return 0;
547} 558}
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4cdb3a17bcb5..d16da3e53bc7 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -7,6 +7,7 @@
7#include <linux/percpu.h> 7#include <linux/percpu.h>
8#include <linux/hardirq.h> 8#include <linux/hardirq.h>
9#include <linux/perf_event.h> 9#include <linux/perf_event.h>
10#include <linux/tracepoint.h>
10 11
11struct trace_array; 12struct trace_array;
12struct trace_buffer; 13struct trace_buffer;
@@ -163,6 +164,8 @@ void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
163 164
164void tracing_record_cmdline(struct task_struct *tsk); 165void tracing_record_cmdline(struct task_struct *tsk);
165 166
167int ftrace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...);
168
166struct event_filter; 169struct event_filter;
167 170
168enum trace_reg { 171enum trace_reg {
@@ -197,6 +200,32 @@ struct ftrace_event_class {
197extern int ftrace_event_reg(struct ftrace_event_call *event, 200extern int ftrace_event_reg(struct ftrace_event_call *event,
198 enum trace_reg type, void *data); 201 enum trace_reg type, void *data);
199 202
203int ftrace_output_event(struct trace_iterator *iter, struct ftrace_event_call *event,
204 char *fmt, ...);
205
206int ftrace_event_define_field(struct ftrace_event_call *call,
207 char *type, int len, char *item, int offset,
208 int field_size, int sign, int filter);
209
210struct ftrace_event_buffer {
211 struct ring_buffer *buffer;
212 struct ring_buffer_event *event;
213 struct ftrace_event_file *ftrace_file;
214 void *entry;
215 unsigned long flags;
216 int pc;
217};
218
219void *ftrace_event_buffer_reserve(struct ftrace_event_buffer *fbuffer,
220 struct ftrace_event_file *ftrace_file,
221 unsigned long len);
222
223void ftrace_event_buffer_commit(struct ftrace_event_buffer *fbuffer);
224
225int ftrace_event_define_field(struct ftrace_event_call *call,
226 char *type, int len, char *item, int offset,
227 int field_size, int sign, int filter);
228
200enum { 229enum {
201 TRACE_EVENT_FL_FILTERED_BIT, 230 TRACE_EVENT_FL_FILTERED_BIT,
202 TRACE_EVENT_FL_CAP_ANY_BIT, 231 TRACE_EVENT_FL_CAP_ANY_BIT,
@@ -204,6 +233,7 @@ enum {
204 TRACE_EVENT_FL_IGNORE_ENABLE_BIT, 233 TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
205 TRACE_EVENT_FL_WAS_ENABLED_BIT, 234 TRACE_EVENT_FL_WAS_ENABLED_BIT,
206 TRACE_EVENT_FL_USE_CALL_FILTER_BIT, 235 TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
236 TRACE_EVENT_FL_TRACEPOINT_BIT,
207}; 237};
208 238
209/* 239/*
@@ -216,6 +246,7 @@ enum {
216 * (used for module unloading, if a module event is enabled, 246 * (used for module unloading, if a module event is enabled,
217 * it is best to clear the buffers that used it). 247 * it is best to clear the buffers that used it).
218 * USE_CALL_FILTER - For ftrace internal events, don't use file filter 248 * USE_CALL_FILTER - For ftrace internal events, don't use file filter
249 * TRACEPOINT - Event is a tracepoint
219 */ 250 */
220enum { 251enum {
221 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 252 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
@@ -224,12 +255,17 @@ enum {
224 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), 255 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
225 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), 256 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
226 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT), 257 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
258 TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT),
227}; 259};
228 260
229struct ftrace_event_call { 261struct ftrace_event_call {
230 struct list_head list; 262 struct list_head list;
231 struct ftrace_event_class *class; 263 struct ftrace_event_class *class;
232 char *name; 264 union {
265 char *name;
266 /* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */
267 struct tracepoint *tp;
268 };
233 struct trace_event event; 269 struct trace_event event;
234 const char *print_fmt; 270 const char *print_fmt;
235 struct event_filter *filter; 271 struct event_filter *filter;
@@ -243,6 +279,7 @@ struct ftrace_event_call {
243 * bit 3: ftrace internal event (do not enable) 279 * bit 3: ftrace internal event (do not enable)
244 * bit 4: Event was enabled by module 280 * bit 4: Event was enabled by module
245 * bit 5: use call filter rather than file filter 281 * bit 5: use call filter rather than file filter
282 * bit 6: Event is a tracepoint
246 */ 283 */
247 int flags; /* static flags of different events */ 284 int flags; /* static flags of different events */
248 285
@@ -255,6 +292,15 @@ struct ftrace_event_call {
255#endif 292#endif
256}; 293};
257 294
295static inline const char *
296ftrace_event_name(struct ftrace_event_call *call)
297{
298 if (call->flags & TRACE_EVENT_FL_TRACEPOINT)
299 return call->tp ? call->tp->name : NULL;
300 else
301 return call->name;
302}
303
258struct trace_array; 304struct trace_array;
259struct ftrace_subsystem_dir; 305struct ftrace_subsystem_dir;
260 306
@@ -325,7 +371,7 @@ struct ftrace_event_file {
325#define __TRACE_EVENT_FLAGS(name, value) \ 371#define __TRACE_EVENT_FLAGS(name, value) \
326 static int __init trace_init_flags_##name(void) \ 372 static int __init trace_init_flags_##name(void) \
327 { \ 373 { \
328 event_##name.flags = value; \ 374 event_##name.flags |= value; \
329 return 0; \ 375 return 0; \
330 } \ 376 } \
331 early_initcall(trace_init_flags_##name); 377 early_initcall(trace_init_flags_##name);
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index b581b13d29d9..85aa5d0b9357 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/errno.h> 4#include <linux/errno.h>
5 5
6/* see Documentation/gpio.txt */ 6/* see Documentation/gpio/gpio-legacy.txt */
7 7
8/* make these flag values available regardless of GPIO kconfig options */ 8/* make these flag values available regardless of GPIO kconfig options */
9#define GPIOF_DIR_OUT (0 << 0) 9#define GPIOF_DIR_OUT (0 << 0)
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 7a8144fef406..bed128e8f4b1 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -5,7 +5,6 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6 6
7struct device; 7struct device;
8struct gpio_chip;
9 8
10/** 9/**
11 * Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are 10 * Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are
@@ -36,6 +35,7 @@ void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
36int gpiod_get_direction(const struct gpio_desc *desc); 35int gpiod_get_direction(const struct gpio_desc *desc);
37int gpiod_direction_input(struct gpio_desc *desc); 36int gpiod_direction_input(struct gpio_desc *desc);
38int gpiod_direction_output(struct gpio_desc *desc, int value); 37int gpiod_direction_output(struct gpio_desc *desc, int value);
38int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
39 39
40/* Value get/set from non-sleeping context */ 40/* Value get/set from non-sleeping context */
41int gpiod_get_value(const struct gpio_desc *desc); 41int gpiod_get_value(const struct gpio_desc *desc);
@@ -59,7 +59,6 @@ int gpiod_to_irq(const struct gpio_desc *desc);
59/* Convert between the old gpio_ and new gpiod_ interfaces */ 59/* Convert between the old gpio_ and new gpiod_ interfaces */
60struct gpio_desc *gpio_to_desc(unsigned gpio); 60struct gpio_desc *gpio_to_desc(unsigned gpio);
61int desc_to_gpio(const struct gpio_desc *desc); 61int desc_to_gpio(const struct gpio_desc *desc);
62struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
63 62
64#else /* CONFIG_GPIOLIB */ 63#else /* CONFIG_GPIOLIB */
65 64
@@ -121,6 +120,12 @@ static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
121 WARN_ON(1); 120 WARN_ON(1);
122 return -ENOSYS; 121 return -ENOSYS;
123} 122}
123static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
124{
125 /* GPIO can never have been requested */
126 WARN_ON(1);
127 return -ENOSYS;
128}
124 129
125 130
126static inline int gpiod_get_value(const struct gpio_desc *desc) 131static inline int gpiod_get_value(const struct gpio_desc *desc)
@@ -207,12 +212,6 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
207 WARN_ON(1); 212 WARN_ON(1);
208 return -EINVAL; 213 return -EINVAL;
209} 214}
210static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
211{
212 /* GPIO can never have been requested */
213 WARN_ON(1);
214 return ERR_PTR(-ENODEV);
215}
216 215
217 216
218#endif /* CONFIG_GPIOLIB */ 217#endif /* CONFIG_GPIOLIB */
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index a3e181e09636..1827b43966d9 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -3,6 +3,9 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/irq.h>
7#include <linux/irqchip/chained_irq.h>
8#include <linux/irqdomain.h>
6 9
7struct device; 10struct device;
8struct gpio_desc; 11struct gpio_desc;
@@ -10,6 +13,8 @@ struct of_phandle_args;
10struct device_node; 13struct device_node;
11struct seq_file; 14struct seq_file;
12 15
16#ifdef CONFIG_GPIOLIB
17
13/** 18/**
14 * struct gpio_chip - abstract a GPIO controller 19 * struct gpio_chip - abstract a GPIO controller
15 * @label: for diagnostics 20 * @label: for diagnostics
@@ -95,6 +100,18 @@ struct gpio_chip {
95 bool can_sleep; 100 bool can_sleep;
96 bool exported; 101 bool exported;
97 102
103#ifdef CONFIG_GPIOLIB_IRQCHIP
104 /*
105 * With CONFIG_GPIO_IRQCHIP we get an irqchip inside the gpiolib
106 * to handle IRQs for most practical cases.
107 */
108 struct irq_chip *irqchip;
109 struct irq_domain *irqdomain;
110 unsigned int irq_base;
111 irq_flow_handler_t irq_handler;
112 unsigned int irq_default_type;
113#endif
114
98#if defined(CONFIG_OF_GPIO) 115#if defined(CONFIG_OF_GPIO)
99 /* 116 /*
100 * If CONFIG_OF is enabled, then all GPIO controllers described in the 117 * If CONFIG_OF is enabled, then all GPIO controllers described in the
@@ -129,6 +146,11 @@ extern struct gpio_chip *gpiochip_find(void *data,
129int gpiod_lock_as_irq(struct gpio_desc *desc); 146int gpiod_lock_as_irq(struct gpio_desc *desc);
130void gpiod_unlock_as_irq(struct gpio_desc *desc); 147void gpiod_unlock_as_irq(struct gpio_desc *desc);
131 148
149struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
150
151struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip,
152 u16 hwnum);
153
132enum gpio_lookup_flags { 154enum gpio_lookup_flags {
133 GPIO_ACTIVE_HIGH = (0 << 0), 155 GPIO_ACTIVE_HIGH = (0 << 0),
134 GPIO_ACTIVE_LOW = (1 << 0), 156 GPIO_ACTIVE_LOW = (1 << 0),
@@ -183,4 +205,30 @@ struct gpiod_lookup_table {
183 205
184void gpiod_add_lookup_table(struct gpiod_lookup_table *table); 206void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
185 207
208#ifdef CONFIG_GPIOLIB_IRQCHIP
209
210void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
211 struct irq_chip *irqchip,
212 int parent_irq,
213 irq_flow_handler_t parent_handler);
214
215int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
216 struct irq_chip *irqchip,
217 unsigned int first_irq,
218 irq_flow_handler_t handler,
219 unsigned int type);
220
221#endif /* CONFIG_GPIO_IRQCHIP */
222
223#else /* CONFIG_GPIOLIB */
224
225static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
226{
227 /* GPIO can never have been requested */
228 WARN_ON(1);
229 return ERR_PTR(-ENODEV);
230}
231
232#endif /* CONFIG_GPIOLIB */
233
186#endif 234#endif
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 9231be9e90a2..11c0182a153b 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -262,6 +262,18 @@ union hdmi_vendor_any_infoframe {
262 struct hdmi_vendor_infoframe hdmi; 262 struct hdmi_vendor_infoframe hdmi;
263}; 263};
264 264
265/**
266 * union hdmi_infoframe - overall union of all abstract infoframe representations
267 * @any: generic infoframe
268 * @avi: avi infoframe
269 * @spd: spd infoframe
270 * @vendor: union of all vendor infoframes
271 * @audio: audio infoframe
272 *
273 * This is used by the generic pack function. This works since all infoframes
274 * have the same header which also indicates which type of infoframe should be
275 * packed.
276 */
265union hdmi_infoframe { 277union hdmi_infoframe {
266 struct hdmi_any_infoframe any; 278 struct hdmi_any_infoframe any;
267 struct hdmi_avi_infoframe avi; 279 struct hdmi_avi_infoframe avi;
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index b914ca3f57ba..b70cfd7ff29c 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -51,13 +51,15 @@ struct hid_sensor_hub_attribute_info {
51 * @hdev: Stores the hid instance. 51 * @hdev: Stores the hid instance.
52 * @vendor_id: Vendor id of hub device. 52 * @vendor_id: Vendor id of hub device.
53 * @product_id: Product id of hub device. 53 * @product_id: Product id of hub device.
54 * @ref_cnt: Number of MFD clients have opened this device 54 * @start_collection_index: Starting index for a phy type collection
55 * @end_collection_index: Last index for a phy type collection
55 */ 56 */
56struct hid_sensor_hub_device { 57struct hid_sensor_hub_device {
57 struct hid_device *hdev; 58 struct hid_device *hdev;
58 u32 vendor_id; 59 u32 vendor_id;
59 u32 product_id; 60 u32 product_id;
60 int ref_cnt; 61 int start_collection_index;
62 int end_collection_index;
61}; 63};
62 64
63/** 65/**
@@ -218,4 +220,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
218int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, 220int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
219 int *val1, int *val2); 221 int *val1, int *val2);
220 222
223int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
224 u32 report_id, int field_index, u32 usage_id);
225
221#endif 226#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index beaf965621c1..14ead9e8eda8 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -33,6 +33,16 @@
33#define HID_USAGE_SENSOR_DATA_LIGHT 0x2004d0 33#define HID_USAGE_SENSOR_DATA_LIGHT 0x2004d0
34#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1 34#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1
35 35
36/* PROX (200011) */
37#define HID_USAGE_SENSOR_PROX 0x200011
38#define HID_USAGE_SENSOR_DATA_PRESENCE 0x2004b0
39#define HID_USAGE_SENSOR_HUMAN_PRESENCE 0x2004b1
40
41/* Pressure (200031) */
42#define HID_USAGE_SENSOR_PRESSURE 0x200031
43#define HID_USAGE_SENSOR_DATA_ATMOSPHERIC_PRESSURE 0x200430
44#define HID_USAGE_SENSOR_ATMOSPHERIC_PRESSURE 0x200431
45
36/* Gyro 3D: (200076) */ 46/* Gyro 3D: (200076) */
37#define HID_USAGE_SENSOR_GYRO_3D 0x200076 47#define HID_USAGE_SENSOR_GYRO_3D 0x200076
38#define HID_USAGE_SENSOR_DATA_ANGL_VELOCITY 0x200456 48#define HID_USAGE_SENSOR_DATA_ANGL_VELOCITY 0x200456
@@ -130,15 +140,15 @@
130#define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000 140#define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000
131 141
132/* Power state enumerations */ 142/* Power state enumerations */
133#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00 143#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x200850
134#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01 144#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x200851
135#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x02 145#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x200852
136#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x03 146#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x200853
137#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x04 147#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x200854
138#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x05 148#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x200855
139 149
140/* Report State enumerations */ 150/* Report State enumerations */
141#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x00 151#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x200840
142#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x01 152#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x200841
143 153
144#endif 154#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 31b9d299ef6c..720e3a10608c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -201,6 +201,7 @@ struct hid_item {
201#define HID_GD_VBRZ 0x00010045 201#define HID_GD_VBRZ 0x00010045
202#define HID_GD_VNO 0x00010046 202#define HID_GD_VNO 0x00010046
203#define HID_GD_FEATURE 0x00010047 203#define HID_GD_FEATURE 0x00010047
204#define HID_GD_SYSTEM_CONTROL 0x00010080
204#define HID_GD_UP 0x00010090 205#define HID_GD_UP 0x00010090
205#define HID_GD_DOWN 0x00010091 206#define HID_GD_DOWN 0x00010091
206#define HID_GD_RIGHT 0x00010092 207#define HID_GD_RIGHT 0x00010092
@@ -208,6 +209,8 @@ struct hid_item {
208 209
209#define HID_DC_BATTERYSTRENGTH 0x00060020 210#define HID_DC_BATTERYSTRENGTH 0x00060020
210 211
212#define HID_CP_CONSUMER_CONTROL 0x000c0001
213
211#define HID_DG_DIGITIZER 0x000d0001 214#define HID_DG_DIGITIZER 0x000d0001
212#define HID_DG_PEN 0x000d0002 215#define HID_DG_PEN 0x000d0002
213#define HID_DG_LIGHTPEN 0x000d0003 216#define HID_DG_LIGHTPEN 0x000d0003
@@ -287,6 +290,8 @@ struct hid_item {
287#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 290#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
288#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 291#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200
289#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 292#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
293#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000
294#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000
290#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 295#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
291#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 296#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
292#define HID_QUIRK_NO_IGNORE 0x40000000 297#define HID_QUIRK_NO_IGNORE 0x40000000
@@ -508,12 +513,6 @@ struct hid_device { /* device report descriptor */
508 struct hid_usage *, __s32); 513 struct hid_usage *, __s32);
509 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 514 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
510 515
511 /* handler for raw input (Get_Report) data, used by hidraw */
512 int (*hid_get_raw_report) (struct hid_device *, unsigned char, __u8 *, size_t, unsigned char);
513
514 /* handler for raw output data, used by hidraw */
515 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
516
517 /* debugging support via debugfs */ 516 /* debugging support via debugfs */
518 unsigned short debug; 517 unsigned short debug;
519 struct dentry *debug_dir; 518 struct dentry *debug_dir;
@@ -675,11 +674,12 @@ struct hid_driver {
675 * @stop: called on remove 674 * @stop: called on remove
676 * @open: called by input layer on open 675 * @open: called by input layer on open
677 * @close: called by input layer on close 676 * @close: called by input layer on close
678 * @hidinput_input_event: event input event (e.g. ff or leds)
679 * @parse: this method is called only once to parse the device data, 677 * @parse: this method is called only once to parse the device data,
680 * shouldn't allocate anything to not leak memory 678 * shouldn't allocate anything to not leak memory
681 * @request: send report request to device (e.g. feature report) 679 * @request: send report request to device (e.g. feature report)
682 * @wait: wait for buffered io to complete (send/recv reports) 680 * @wait: wait for buffered io to complete (send/recv reports)
681 * @raw_request: send raw report request to device (e.g. feature report)
682 * @output_report: send output report to device
683 * @idle: send idle request to device 683 * @idle: send idle request to device
684 */ 684 */
685struct hid_ll_driver { 685struct hid_ll_driver {
@@ -691,17 +691,20 @@ struct hid_ll_driver {
691 691
692 int (*power)(struct hid_device *hdev, int level); 692 int (*power)(struct hid_device *hdev, int level);
693 693
694 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
695 unsigned int code, int value);
696
697 int (*parse)(struct hid_device *hdev); 694 int (*parse)(struct hid_device *hdev);
698 695
699 void (*request)(struct hid_device *hdev, 696 void (*request)(struct hid_device *hdev,
700 struct hid_report *report, int reqtype); 697 struct hid_report *report, int reqtype);
701 698
702 int (*wait)(struct hid_device *hdev); 699 int (*wait)(struct hid_device *hdev);
703 int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
704 700
701 int (*raw_request) (struct hid_device *hdev, unsigned char reportnum,
702 __u8 *buf, size_t len, unsigned char rtype,
703 int reqtype);
704
705 int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);
706
707 int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
705}; 708};
706 709
707#define PM_HINT_FULLON 1<<5 710#define PM_HINT_FULLON 1<<5
@@ -752,6 +755,7 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid);
752unsigned int hidinput_count_leds(struct hid_device *hid); 755unsigned int hidinput_count_leds(struct hid_device *hid);
753__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); 756__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
754void hid_output_report(struct hid_report *report, __u8 *data); 757void hid_output_report(struct hid_report *report, __u8 *data);
758void __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype);
755u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); 759u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
756struct hid_device *hid_allocate_device(void); 760struct hid_device *hid_allocate_device(void);
757struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 761struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -964,7 +968,55 @@ static inline void hid_hw_request(struct hid_device *hdev,
964 struct hid_report *report, int reqtype) 968 struct hid_report *report, int reqtype)
965{ 969{
966 if (hdev->ll_driver->request) 970 if (hdev->ll_driver->request)
967 hdev->ll_driver->request(hdev, report, reqtype); 971 return hdev->ll_driver->request(hdev, report, reqtype);
972
973 __hid_request(hdev, report, reqtype);
974}
975
976/**
977 * hid_hw_raw_request - send report request to device
978 *
979 * @hdev: hid device
980 * @reportnum: report ID
981 * @buf: in/out data to transfer
982 * @len: length of buf
983 * @rtype: HID report type
984 * @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT
985 *
986 * @return: count of data transfered, negative if error
987 *
988 * Same behavior as hid_hw_request, but with raw buffers instead.
989 */
990static inline int hid_hw_raw_request(struct hid_device *hdev,
991 unsigned char reportnum, __u8 *buf,
992 size_t len, unsigned char rtype, int reqtype)
993{
994 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
995 return -EINVAL;
996
997 return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
998 rtype, reqtype);
999}
1000
1001/**
1002 * hid_hw_output_report - send output report to device
1003 *
1004 * @hdev: hid device
1005 * @buf: raw data to transfer
1006 * @len: length of buf
1007 *
1008 * @return: count of data transfered, negative if error
1009 */
1010static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf,
1011 size_t len)
1012{
1013 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
1014 return -EINVAL;
1015
1016 if (hdev->ll_driver->output_report)
1017 return hdev->ll_driver->output_report(hdev, buf, len);
1018
1019 return -ENOSYS;
968} 1020}
969 1021
970/** 1022/**
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index 3af847273277..d2b52999e771 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -136,6 +136,7 @@ u32 host1x_syncpt_id(struct host1x_syncpt *sp);
136u32 host1x_syncpt_read_min(struct host1x_syncpt *sp); 136u32 host1x_syncpt_read_min(struct host1x_syncpt *sp);
137u32 host1x_syncpt_read_max(struct host1x_syncpt *sp); 137u32 host1x_syncpt_read_max(struct host1x_syncpt *sp);
138int host1x_syncpt_incr(struct host1x_syncpt *sp); 138int host1x_syncpt_incr(struct host1x_syncpt *sp);
139u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);
139int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, 140int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
140 u32 *value); 141 u32 *value);
141struct host1x_syncpt *host1x_syncpt_request(struct device *dev, 142struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 0dca785288cf..39bfd5b89077 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -178,7 +178,7 @@ static inline void hsi_unregister_client_driver(struct hsi_client_driver *drv)
178 * @complete: Transfer completion callback 178 * @complete: Transfer completion callback
179 * @destructor: Destructor to free resources when flushing 179 * @destructor: Destructor to free resources when flushing
180 * @status: Status of the transfer when completed 180 * @status: Status of the transfer when completed
181 * @actual_len: Actual length of data transfered on completion 181 * @actual_len: Actual length of data transferred on completion
182 * @channel: Channel were to TX/RX the message 182 * @channel: Channel were to TX/RX the message
183 * @ttype: Transfer type (TX if set, RX otherwise) 183 * @ttype: Transfer type (TX if set, RX otherwise)
184 * @break_frame: if true HSI will send/receive a break frame. Data buffers are 184 * @break_frame: if true HSI will send/receive a break frame. Data buffers are
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 8c43cc469d78..5b337cf8fb86 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -6,6 +6,8 @@
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/hugetlb_inline.h> 7#include <linux/hugetlb_inline.h>
8#include <linux/cgroup.h> 8#include <linux/cgroup.h>
9#include <linux/list.h>
10#include <linux/kref.h>
9 11
10struct ctl_table; 12struct ctl_table;
11struct user_struct; 13struct user_struct;
@@ -23,6 +25,14 @@ struct hugepage_subpool {
23 long max_hpages, used_hpages; 25 long max_hpages, used_hpages;
24}; 26};
25 27
28struct resv_map {
29 struct kref refs;
30 spinlock_t lock;
31 struct list_head regions;
32};
33extern struct resv_map *resv_map_alloc(void);
34void resv_map_release(struct kref *ref);
35
26extern spinlock_t hugetlb_lock; 36extern spinlock_t hugetlb_lock;
27extern int hugetlb_max_hstate __read_mostly; 37extern int hugetlb_max_hstate __read_mostly;
28#define for_each_hstate(h) \ 38#define for_each_hstate(h) \
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
index 787bba3bf552..0129f89cf98d 100644
--- a/include/linux/hugetlb_cgroup.h
+++ b/include/linux/hugetlb_cgroup.h
@@ -49,7 +49,7 @@ int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)
49 49
50static inline bool hugetlb_cgroup_disabled(void) 50static inline bool hugetlb_cgroup_disabled(void)
51{ 51{
52 if (hugetlb_subsys.disabled) 52 if (hugetlb_cgrp_subsys.disabled)
53 return true; 53 return true;
54 return false; 54 return false;
55} 55}
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 344883dce584..ab7359fde987 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -25,328 +25,11 @@
25#ifndef _HYPERV_H 25#ifndef _HYPERV_H
26#define _HYPERV_H 26#define _HYPERV_H
27 27
28#include <linux/types.h> 28#include <uapi/linux/hyperv.h>
29
30/*
31 * Framework version for util services.
32 */
33#define UTIL_FW_MINOR 0
34
35#define UTIL_WS2K8_FW_MAJOR 1
36#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
37
38#define UTIL_FW_MAJOR 3
39#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
40
41
42/*
43 * Implementation of host controlled snapshot of the guest.
44 */
45
46#define VSS_OP_REGISTER 128
47
48enum hv_vss_op {
49 VSS_OP_CREATE = 0,
50 VSS_OP_DELETE,
51 VSS_OP_HOT_BACKUP,
52 VSS_OP_GET_DM_INFO,
53 VSS_OP_BU_COMPLETE,
54 /*
55 * Following operations are only supported with IC version >= 5.0
56 */
57 VSS_OP_FREEZE, /* Freeze the file systems in the VM */
58 VSS_OP_THAW, /* Unfreeze the file systems */
59 VSS_OP_AUTO_RECOVER,
60 VSS_OP_COUNT /* Number of operations, must be last */
61};
62
63
64/*
65 * Header for all VSS messages.
66 */
67struct hv_vss_hdr {
68 __u8 operation;
69 __u8 reserved[7];
70} __attribute__((packed));
71
72
73/*
74 * Flag values for the hv_vss_check_feature. Linux supports only
75 * one value.
76 */
77#define VSS_HBU_NO_AUTO_RECOVERY 0x00000005
78
79struct hv_vss_check_feature {
80 __u32 flags;
81} __attribute__((packed));
82
83struct hv_vss_check_dm_info {
84 __u32 flags;
85} __attribute__((packed));
86
87struct hv_vss_msg {
88 union {
89 struct hv_vss_hdr vss_hdr;
90 int error;
91 };
92 union {
93 struct hv_vss_check_feature vss_cf;
94 struct hv_vss_check_dm_info dm_info;
95 };
96} __attribute__((packed));
97
98/*
99 * An implementation of HyperV key value pair (KVP) functionality for Linux.
100 *
101 *
102 * Copyright (C) 2010, Novell, Inc.
103 * Author : K. Y. Srinivasan <ksrinivasan@novell.com>
104 *
105 */
106
107/*
108 * Maximum value size - used for both key names and value data, and includes
109 * any applicable NULL terminators.
110 *
111 * Note: This limit is somewhat arbitrary, but falls easily within what is
112 * supported for all native guests (back to Win 2000) and what is reasonable
113 * for the IC KVP exchange functionality. Note that Windows Me/98/95 are
114 * limited to 255 character key names.
115 *
116 * MSDN recommends not storing data values larger than 2048 bytes in the
117 * registry.
118 *
119 * Note: This value is used in defining the KVP exchange message - this value
120 * cannot be modified without affecting the message size and compatibility.
121 */
122
123/*
124 * bytes, including any null terminators
125 */
126#define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048)
127
128
129/*
130 * Maximum key size - the registry limit for the length of an entry name
131 * is 256 characters, including the null terminator
132 */
133
134#define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512)
135
136/*
137 * In Linux, we implement the KVP functionality in two components:
138 * 1) The kernel component which is packaged as part of the hv_utils driver
139 * is responsible for communicating with the host and responsible for
140 * implementing the host/guest protocol. 2) A user level daemon that is
141 * responsible for data gathering.
142 *
143 * Host/Guest Protocol: The host iterates over an index and expects the guest
144 * to assign a key name to the index and also return the value corresponding to
145 * the key. The host will have atmost one KVP transaction outstanding at any
146 * given point in time. The host side iteration stops when the guest returns
147 * an error. Microsoft has specified the following mapping of key names to
148 * host specified index:
149 *
150 * Index Key Name
151 * 0 FullyQualifiedDomainName
152 * 1 IntegrationServicesVersion
153 * 2 NetworkAddressIPv4
154 * 3 NetworkAddressIPv6
155 * 4 OSBuildNumber
156 * 5 OSName
157 * 6 OSMajorVersion
158 * 7 OSMinorVersion
159 * 8 OSVersion
160 * 9 ProcessorArchitecture
161 *
162 * The Windows host expects the Key Name and Key Value to be encoded in utf16.
163 *
164 * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the
165 * data gathering functionality in a user mode daemon. The user level daemon
166 * is also responsible for binding the key name to the index as well. The
167 * kernel and user-level daemon communicate using a connector channel.
168 *
169 * The user mode component first registers with the
170 * the kernel component. Subsequently, the kernel component requests, data
171 * for the specified keys. In response to this message the user mode component
172 * fills in the value corresponding to the specified key. We overload the
173 * sequence field in the cn_msg header to define our KVP message types.
174 *
175 *
176 * The kernel component simply acts as a conduit for communication between the
177 * Windows host and the user-level daemon. The kernel component passes up the
178 * index received from the Host to the user-level daemon. If the index is
179 * valid (supported), the corresponding key as well as its
180 * value (both are strings) is returned. If the index is invalid
181 * (not supported), a NULL key string is returned.
182 */
183
184
185/*
186 * Registry value types.
187 */
188
189#define REG_SZ 1
190#define REG_U32 4
191#define REG_U64 8
192
193/*
194 * As we look at expanding the KVP functionality to include
195 * IP injection functionality, we need to maintain binary
196 * compatibility with older daemons.
197 *
198 * The KVP opcodes are defined by the host and it was unfortunate
199 * that I chose to treat the registration operation as part of the
200 * KVP operations defined by the host.
201 * Here is the level of compatibility
202 * (between the user level daemon and the kernel KVP driver) that we
203 * will implement:
204 *
205 * An older daemon will always be supported on a newer driver.
206 * A given user level daemon will require a minimal version of the
207 * kernel driver.
208 * If we cannot handle the version differences, we will fail gracefully
209 * (this can happen when we have a user level daemon that is more
210 * advanced than the KVP driver.
211 *
212 * We will use values used in this handshake for determining if we have
213 * workable user level daemon and the kernel driver. We begin by taking the
214 * registration opcode out of the KVP opcode namespace. We will however,
215 * maintain compatibility with the existing user-level daemon code.
216 */
217
218/*
219 * Daemon code not supporting IP injection (legacy daemon).
220 */
221
222#define KVP_OP_REGISTER 4
223
224/*
225 * Daemon code supporting IP injection.
226 * The KVP opcode field is used to communicate the
227 * registration information; so define a namespace that
228 * will be distinct from the host defined KVP opcode.
229 */
230
231#define KVP_OP_REGISTER1 100
232
233enum hv_kvp_exchg_op {
234 KVP_OP_GET = 0,
235 KVP_OP_SET,
236 KVP_OP_DELETE,
237 KVP_OP_ENUMERATE,
238 KVP_OP_GET_IP_INFO,
239 KVP_OP_SET_IP_INFO,
240 KVP_OP_COUNT /* Number of operations, must be last. */
241};
242
243enum hv_kvp_exchg_pool {
244 KVP_POOL_EXTERNAL = 0,
245 KVP_POOL_GUEST,
246 KVP_POOL_AUTO,
247 KVP_POOL_AUTO_EXTERNAL,
248 KVP_POOL_AUTO_INTERNAL,
249 KVP_POOL_COUNT /* Number of pools, must be last. */
250};
251
252/*
253 * Some Hyper-V status codes.
254 */
255 29
256#define HV_S_OK 0x00000000 30#include <linux/types.h>
257#define HV_E_FAIL 0x80004005
258#define HV_S_CONT 0x80070103
259#define HV_ERROR_NOT_SUPPORTED 0x80070032
260#define HV_ERROR_MACHINE_LOCKED 0x800704F7
261#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F
262#define HV_INVALIDARG 0x80070057
263#define HV_GUID_NOTFOUND 0x80041002
264
265#define ADDR_FAMILY_NONE 0x00
266#define ADDR_FAMILY_IPV4 0x01
267#define ADDR_FAMILY_IPV6 0x02
268
269#define MAX_ADAPTER_ID_SIZE 128
270#define MAX_IP_ADDR_SIZE 1024
271#define MAX_GATEWAY_SIZE 512
272
273
274struct hv_kvp_ipaddr_value {
275 __u16 adapter_id[MAX_ADAPTER_ID_SIZE];
276 __u8 addr_family;
277 __u8 dhcp_enabled;
278 __u16 ip_addr[MAX_IP_ADDR_SIZE];
279 __u16 sub_net[MAX_IP_ADDR_SIZE];
280 __u16 gate_way[MAX_GATEWAY_SIZE];
281 __u16 dns_addr[MAX_IP_ADDR_SIZE];
282} __attribute__((packed));
283
284
285struct hv_kvp_hdr {
286 __u8 operation;
287 __u8 pool;
288 __u16 pad;
289} __attribute__((packed));
290
291struct hv_kvp_exchg_msg_value {
292 __u32 value_type;
293 __u32 key_size;
294 __u32 value_size;
295 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
296 union {
297 __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
298 __u32 value_u32;
299 __u64 value_u64;
300 };
301} __attribute__((packed));
302
303struct hv_kvp_msg_enumerate {
304 __u32 index;
305 struct hv_kvp_exchg_msg_value data;
306} __attribute__((packed));
307
308struct hv_kvp_msg_get {
309 struct hv_kvp_exchg_msg_value data;
310};
311
312struct hv_kvp_msg_set {
313 struct hv_kvp_exchg_msg_value data;
314};
315
316struct hv_kvp_msg_delete {
317 __u32 key_size;
318 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
319};
320
321struct hv_kvp_register {
322 __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
323};
324
325struct hv_kvp_msg {
326 union {
327 struct hv_kvp_hdr kvp_hdr;
328 int error;
329 };
330 union {
331 struct hv_kvp_msg_get kvp_get;
332 struct hv_kvp_msg_set kvp_set;
333 struct hv_kvp_msg_delete kvp_delete;
334 struct hv_kvp_msg_enumerate kvp_enum_data;
335 struct hv_kvp_ipaddr_value kvp_ip_val;
336 struct hv_kvp_register kvp_register;
337 } body;
338} __attribute__((packed));
339
340struct hv_kvp_ip_msg {
341 __u8 operation;
342 __u8 pool;
343 struct hv_kvp_ipaddr_value kvp_ip_val;
344} __attribute__((packed));
345
346#ifdef __KERNEL__
347#include <linux/scatterlist.h> 31#include <linux/scatterlist.h>
348#include <linux/list.h> 32#include <linux/list.h>
349#include <linux/uuid.h>
350#include <linux/timer.h> 33#include <linux/timer.h>
351#include <linux/workqueue.h> 34#include <linux/workqueue.h>
352#include <linux/completion.h> 35#include <linux/completion.h>
@@ -354,7 +37,7 @@ struct hv_kvp_ip_msg {
354#include <linux/mod_devicetable.h> 37#include <linux/mod_devicetable.h>
355 38
356 39
357#define MAX_PAGE_BUFFER_COUNT 19 40#define MAX_PAGE_BUFFER_COUNT 32
358#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ 41#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
359 42
360#pragma pack(push, 1) 43#pragma pack(push, 1)
@@ -1043,6 +726,10 @@ struct vmbus_channel {
1043 * This will be NULL for the primary channel. 726 * This will be NULL for the primary channel.
1044 */ 727 */
1045 struct vmbus_channel *primary_channel; 728 struct vmbus_channel *primary_channel;
729 /*
730 * Support per-channel state for use by vmbus drivers.
731 */
732 void *per_channel_state;
1046}; 733};
1047 734
1048static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 735static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
@@ -1050,6 +737,16 @@ static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
1050 c->batched_reading = state; 737 c->batched_reading = state;
1051} 738}
1052 739
740static inline void set_per_channel_state(struct vmbus_channel *c, void *s)
741{
742 c->per_channel_state = s;
743}
744
745static inline void *get_per_channel_state(struct vmbus_channel *c)
746{
747 return c->per_channel_state;
748}
749
1053void vmbus_onmessage(void *context); 750void vmbus_onmessage(void *context);
1054 751
1055int vmbus_request_offers(void); 752int vmbus_request_offers(void);
@@ -1118,7 +815,7 @@ extern int vmbus_open(struct vmbus_channel *channel,
1118extern void vmbus_close(struct vmbus_channel *channel); 815extern void vmbus_close(struct vmbus_channel *channel);
1119 816
1120extern int vmbus_sendpacket(struct vmbus_channel *channel, 817extern int vmbus_sendpacket(struct vmbus_channel *channel,
1121 const void *buffer, 818 void *buffer,
1122 u32 bufferLen, 819 u32 bufferLen,
1123 u64 requestid, 820 u64 requestid,
1124 enum vmbus_packet_type type, 821 enum vmbus_packet_type type,
@@ -1352,6 +1049,17 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1352 } 1049 }
1353 1050
1354/* 1051/*
1052 * Guest File Copy Service
1053 * {34D14BE3-DEE4-41c8-9AE7-6B174977C192}
1054 */
1055
1056#define HV_FCOPY_GUID \
1057 .guid = { \
1058 0xE3, 0x4B, 0xD1, 0x34, 0xE4, 0xDE, 0xC8, 0x41, \
1059 0x9A, 0xE7, 0x6B, 0x17, 0x49, 0x77, 0xC1, 0x92 \
1060 }
1061
1062/*
1355 * Common header for Hyper-V ICs 1063 * Common header for Hyper-V ICs
1356 */ 1064 */
1357 1065
@@ -1459,11 +1167,12 @@ int hv_vss_init(struct hv_util_service *);
1459void hv_vss_deinit(void); 1167void hv_vss_deinit(void);
1460void hv_vss_onchannelcallback(void *); 1168void hv_vss_onchannelcallback(void *);
1461 1169
1170extern struct resource hyperv_mmio;
1171
1462/* 1172/*
1463 * Negotiated version with the Host. 1173 * Negotiated version with the Host.
1464 */ 1174 */
1465 1175
1466extern __u32 vmbus_proto_version; 1176extern __u32 vmbus_proto_version;
1467 1177
1468#endif /* __KERNEL__ */
1469#endif /* _HYPERV_H */ 1178#endif /* _HYPERV_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index deddeb8c337c..b556e0ab946f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -487,6 +487,7 @@ void i2c_unlock_adapter(struct i2c_adapter *);
487#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 487#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
488#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 488#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
489#define I2C_CLASS_SPD (1<<7) /* Memory modules */ 489#define I2C_CLASS_SPD (1<<7) /* Memory modules */
490#define I2C_CLASS_DEPRECATED (1<<8) /* Warn users that adapter will stop using classes */
490 491
491/* Internal numbers to terminate lists */ 492/* Internal numbers to terminate lists */
492#define I2C_CLIENT_END 0xfffeU 493#define I2C_CLIENT_END 0xfffeU
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index d8341cb47b60..c2153049cfbd 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -161,10 +161,10 @@ struct adp5588_gpio_platform_data {
161 unsigned irq_base; /* interrupt base # */ 161 unsigned irq_base; /* interrupt base # */
162 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ 162 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
163 int (*setup)(struct i2c_client *client, 163 int (*setup)(struct i2c_client *client,
164 int gpio, unsigned ngpio, 164 unsigned gpio, unsigned ngpio,
165 void *context); 165 void *context);
166 int (*teardown)(struct i2c_client *client, 166 int (*teardown)(struct i2c_client *client,
167 int gpio, unsigned ngpio, 167 unsigned gpio, unsigned ngpio,
168 void *context); 168 void *context);
169 void *context; 169 void *context;
170}; 170};
diff --git a/include/linux/i2c/bfin_twi.h b/include/linux/i2c/bfin_twi.h
new file mode 100644
index 000000000000..135a4e0876ae
--- /dev/null
+++ b/include/linux/i2c/bfin_twi.h
@@ -0,0 +1,145 @@
1/*
2 * i2c-bfin-twi.h - interface to ADI TWI controller
3 *
4 * Copyright 2005-2014 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __I2C_BFIN_TWI_H__
10#define __I2C_BFIN_TWI_H__
11
12#include <linux/types.h>
13#include <linux/i2c.h>
14
15/*
16 * ADI twi registers layout
17 */
18struct bfin_twi_regs {
19 u16 clkdiv;
20 u16 dummy1;
21 u16 control;
22 u16 dummy2;
23 u16 slave_ctl;
24 u16 dummy3;
25 u16 slave_stat;
26 u16 dummy4;
27 u16 slave_addr;
28 u16 dummy5;
29 u16 master_ctl;
30 u16 dummy6;
31 u16 master_stat;
32 u16 dummy7;
33 u16 master_addr;
34 u16 dummy8;
35 u16 int_stat;
36 u16 dummy9;
37 u16 int_mask;
38 u16 dummy10;
39 u16 fifo_ctl;
40 u16 dummy11;
41 u16 fifo_stat;
42 u16 dummy12;
43 u32 __pad[20];
44 u16 xmt_data8;
45 u16 dummy13;
46 u16 xmt_data16;
47 u16 dummy14;
48 u16 rcv_data8;
49 u16 dummy15;
50 u16 rcv_data16;
51 u16 dummy16;
52};
53
54struct bfin_twi_iface {
55 int irq;
56 spinlock_t lock;
57 char read_write;
58 u8 command;
59 u8 *transPtr;
60 int readNum;
61 int writeNum;
62 int cur_mode;
63 int manual_stop;
64 int result;
65 struct i2c_adapter adap;
66 struct completion complete;
67 struct i2c_msg *pmsg;
68 int msg_num;
69 int cur_msg;
70 u16 saved_clkdiv;
71 u16 saved_control;
72 struct bfin_twi_regs __iomem *regs_base;
73};
74
75/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ********************/
76/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
77#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
78#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
79
80/* TWI_PRESCALE Masks */
81#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
82#define TWI_ENA 0x0080 /* TWI Enable */
83#define SCCB 0x0200 /* SCCB Compatibility Enable */
84
85/* TWI_SLAVE_CTL Masks */
86#define SEN 0x0001 /* Slave Enable */
87#define SADD_LEN 0x0002 /* Slave Address Length */
88#define STDVAL 0x0004 /* Slave Transmit Data Valid */
89#define NAK 0x0008 /* NAK Generated At Conclusion Of Transfer */
90#define GEN 0x0010 /* General Call Address Matching Enabled */
91
92/* TWI_SLAVE_STAT Masks */
93#define SDIR 0x0001 /* Slave Transfer Direction (RX/TX*) */
94#define GCALL 0x0002 /* General Call Indicator */
95
96/* TWI_MASTER_CTL Masks */
97#define MEN 0x0001 /* Master Mode Enable */
98#define MADD_LEN 0x0002 /* Master Address Length */
99#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
100#define FAST 0x0008 /* Use Fast Mode Timing Specs */
101#define STOP 0x0010 /* Issue Stop Condition */
102#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
103#define DCNT 0x3FC0 /* Data Bytes To Transfer */
104#define SDAOVR 0x4000 /* Serial Data Override */
105#define SCLOVR 0x8000 /* Serial Clock Override */
106
107/* TWI_MASTER_STAT Masks */
108#define MPROG 0x0001 /* Master Transfer In Progress */
109#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
110#define ANAK 0x0004 /* Address Not Acknowledged */
111#define DNAK 0x0008 /* Data Not Acknowledged */
112#define BUFRDERR 0x0010 /* Buffer Read Error */
113#define BUFWRERR 0x0020 /* Buffer Write Error */
114#define SDASEN 0x0040 /* Serial Data Sense */
115#define SCLSEN 0x0080 /* Serial Clock Sense */
116#define BUSBUSY 0x0100 /* Bus Busy Indicator */
117
118/* TWI_INT_SRC and TWI_INT_ENABLE Masks */
119#define SINIT 0x0001 /* Slave Transfer Initiated */
120#define SCOMP 0x0002 /* Slave Transfer Complete */
121#define SERR 0x0004 /* Slave Transfer Error */
122#define SOVF 0x0008 /* Slave Overflow */
123#define MCOMP 0x0010 /* Master Transfer Complete */
124#define MERR 0x0020 /* Master Transfer Error */
125#define XMTSERV 0x0040 /* Transmit FIFO Service */
126#define RCVSERV 0x0080 /* Receive FIFO Service */
127
128/* TWI_FIFO_CTRL Masks */
129#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
130#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
131#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
132#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
133
134/* TWI_FIFO_STAT Masks */
135#define XMTSTAT 0x0003 /* Transmit FIFO Status */
136#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
137#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
138#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
139
140#define RCVSTAT 0x000C /* Receive FIFO Status */
141#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
142#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
143#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
144
145#endif
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index ade1c06d4ceb..d2b16704624c 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -195,6 +195,18 @@ static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) {
195 return twl_i2c_read(mod_no, val, reg, 1); 195 return twl_i2c_read(mod_no, val, reg, 1);
196} 196}
197 197
198static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) {
199 val = cpu_to_le16(val);
200 return twl_i2c_write(mod_no, (u8*) &val, reg, 2);
201}
202
203static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) {
204 int ret;
205 ret = twl_i2c_read(mod_no, (u8*) val, reg, 2);
206 *val = le16_to_cpu(*val);
207 return ret;
208}
209
198int twl_get_type(void); 210int twl_get_type(void);
199int twl_get_version(void); 211int twl_get_version(void);
200int twl_get_hfclk_rate(void); 212int twl_get_hfclk_rate(void);
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index 01f595107048..1c0134dd3271 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -44,7 +44,7 @@ struct twl4030_madc_conversion_method {
44 44
45struct twl4030_madc_request { 45struct twl4030_madc_request {
46 unsigned long channels; 46 unsigned long channels;
47 u16 do_avg; 47 bool do_avg;
48 u16 method; 48 u16 method;
49 u16 type; 49 u16 type;
50 bool active; 50 bool active;
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 871a213a8477..6af3400b9b2f 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -82,9 +82,9 @@ int idr_for_each(struct idr *idp,
82void *idr_get_next(struct idr *idp, int *nextid); 82void *idr_get_next(struct idr *idp, int *nextid);
83void *idr_replace(struct idr *idp, void *ptr, int id); 83void *idr_replace(struct idr *idp, void *ptr, int id);
84void idr_remove(struct idr *idp, int id); 84void idr_remove(struct idr *idp, int id);
85void idr_free(struct idr *idp, int id);
86void idr_destroy(struct idr *idp); 85void idr_destroy(struct idr *idp);
87void idr_init(struct idr *idp); 86void idr_init(struct idr *idp);
87bool idr_is_empty(struct idr *idp);
88 88
89/** 89/**
90 * idr_preload_end - end preload section started with idr_preload() 90 * idr_preload_end - end preload section started with idr_preload()
@@ -133,69 +133,6 @@ static inline void *idr_find(struct idr *idr, int id)
133 for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id) 133 for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id)
134 134
135/* 135/*
136 * Don't use the following functions. These exist only to suppress
137 * deprecated warnings on EXPORT_SYMBOL()s.
138 */
139int __idr_pre_get(struct idr *idp, gfp_t gfp_mask);
140int __idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
141void __idr_remove_all(struct idr *idp);
142
143/**
144 * idr_pre_get - reserve resources for idr allocation
145 * @idp: idr handle
146 * @gfp_mask: memory allocation flags
147 *
148 * Part of old alloc interface. This is going away. Use
149 * idr_preload[_end]() and idr_alloc() instead.
150 */
151static inline int __deprecated idr_pre_get(struct idr *idp, gfp_t gfp_mask)
152{
153 return __idr_pre_get(idp, gfp_mask);
154}
155
156/**
157 * idr_get_new_above - allocate new idr entry above or equal to a start id
158 * @idp: idr handle
159 * @ptr: pointer you want associated with the id
160 * @starting_id: id to start search at
161 * @id: pointer to the allocated handle
162 *
163 * Part of old alloc interface. This is going away. Use
164 * idr_preload[_end]() and idr_alloc() instead.
165 */
166static inline int __deprecated idr_get_new_above(struct idr *idp, void *ptr,
167 int starting_id, int *id)
168{
169 return __idr_get_new_above(idp, ptr, starting_id, id);
170}
171
172/**
173 * idr_get_new - allocate new idr entry
174 * @idp: idr handle
175 * @ptr: pointer you want associated with the id
176 * @id: pointer to the allocated handle
177 *
178 * Part of old alloc interface. This is going away. Use
179 * idr_preload[_end]() and idr_alloc() instead.
180 */
181static inline int __deprecated idr_get_new(struct idr *idp, void *ptr, int *id)
182{
183 return __idr_get_new_above(idp, ptr, 0, id);
184}
185
186/**
187 * idr_remove_all - remove all ids from the given idr tree
188 * @idp: idr handle
189 *
190 * If you're trying to destroy @idp, calling idr_destroy() is enough.
191 * This is going away. Don't use.
192 */
193static inline void __deprecated idr_remove_all(struct idr *idp)
194{
195 __idr_remove_all(idp);
196}
197
198/*
199 * IDA - IDR based id allocator, use when translation from id to 136 * IDA - IDR based id allocator, use when translation from id to
200 * pointer isn't necessary. 137 * pointer isn't necessary.
201 * 138 *
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index e526a8cecb70..f194ccb8539c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -154,6 +154,10 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
154 802.11e clarifies the figure in section 7.1.2. The frame body is 154 802.11e clarifies the figure in section 7.1.2. The frame body is
155 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */ 155 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
156#define IEEE80211_MAX_DATA_LEN 2304 156#define IEEE80211_MAX_DATA_LEN 2304
157/* 802.11ad extends maximum MSDU size for DMG (freq > 40Ghz) networks
158 * to 7920 bytes, see 8.2.3 General frame format
159 */
160#define IEEE80211_MAX_DATA_LEN_DMG 7920
157/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */ 161/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
158#define IEEE80211_MAX_FRAME_LEN 2352 162#define IEEE80211_MAX_FRAME_LEN 2352
159 163
@@ -597,6 +601,20 @@ static inline int ieee80211_is_qos_nullfunc(__le16 fc)
597} 601}
598 602
599/** 603/**
604 * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
605 * @fc: frame control field in little-endian byteorder
606 */
607static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc)
608{
609 /* IEEE 802.11-2012, definition of "bufferable management frame";
610 * note that this ignores the IBSS special case. */
611 return ieee80211_is_mgmt(fc) &&
612 (ieee80211_is_action(fc) ||
613 ieee80211_is_disassoc(fc) ||
614 ieee80211_is_deauth(fc));
615}
616
617/**
600 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set 618 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
601 * @seq_ctrl: frame sequence control bytes in little-endian byteorder 619 * @seq_ctrl: frame sequence control bytes in little-endian byteorder
602 */ 620 */
@@ -1636,51 +1654,22 @@ enum ieee80211_reasoncode {
1636enum ieee80211_eid { 1654enum ieee80211_eid {
1637 WLAN_EID_SSID = 0, 1655 WLAN_EID_SSID = 0,
1638 WLAN_EID_SUPP_RATES = 1, 1656 WLAN_EID_SUPP_RATES = 1,
1639 WLAN_EID_FH_PARAMS = 2, 1657 WLAN_EID_FH_PARAMS = 2, /* reserved now */
1640 WLAN_EID_DS_PARAMS = 3, 1658 WLAN_EID_DS_PARAMS = 3,
1641 WLAN_EID_CF_PARAMS = 4, 1659 WLAN_EID_CF_PARAMS = 4,
1642 WLAN_EID_TIM = 5, 1660 WLAN_EID_TIM = 5,
1643 WLAN_EID_IBSS_PARAMS = 6, 1661 WLAN_EID_IBSS_PARAMS = 6,
1644 WLAN_EID_CHALLENGE = 16,
1645
1646 WLAN_EID_COUNTRY = 7, 1662 WLAN_EID_COUNTRY = 7,
1647 WLAN_EID_HP_PARAMS = 8, 1663 WLAN_EID_HP_PARAMS = 8,
1648 WLAN_EID_HP_TABLE = 9, 1664 WLAN_EID_HP_TABLE = 9,
1649 WLAN_EID_REQUEST = 10, 1665 WLAN_EID_REQUEST = 10,
1650
1651 WLAN_EID_QBSS_LOAD = 11, 1666 WLAN_EID_QBSS_LOAD = 11,
1652 WLAN_EID_EDCA_PARAM_SET = 12, 1667 WLAN_EID_EDCA_PARAM_SET = 12,
1653 WLAN_EID_TSPEC = 13, 1668 WLAN_EID_TSPEC = 13,
1654 WLAN_EID_TCLAS = 14, 1669 WLAN_EID_TCLAS = 14,
1655 WLAN_EID_SCHEDULE = 15, 1670 WLAN_EID_SCHEDULE = 15,
1656 WLAN_EID_TS_DELAY = 43, 1671 WLAN_EID_CHALLENGE = 16,
1657 WLAN_EID_TCLAS_PROCESSING = 44, 1672 /* 17-31 reserved for challenge text extension */
1658 WLAN_EID_QOS_CAPA = 46,
1659 /* 802.11z */
1660 WLAN_EID_LINK_ID = 101,
1661 /* 802.11s */
1662 WLAN_EID_MESH_CONFIG = 113,
1663 WLAN_EID_MESH_ID = 114,
1664 WLAN_EID_LINK_METRIC_REPORT = 115,
1665 WLAN_EID_CONGESTION_NOTIFICATION = 116,
1666 WLAN_EID_PEER_MGMT = 117,
1667 WLAN_EID_CHAN_SWITCH_PARAM = 118,
1668 WLAN_EID_MESH_AWAKE_WINDOW = 119,
1669 WLAN_EID_BEACON_TIMING = 120,
1670 WLAN_EID_MCCAOP_SETUP_REQ = 121,
1671 WLAN_EID_MCCAOP_SETUP_RESP = 122,
1672 WLAN_EID_MCCAOP_ADVERT = 123,
1673 WLAN_EID_MCCAOP_TEARDOWN = 124,
1674 WLAN_EID_GANN = 125,
1675 WLAN_EID_RANN = 126,
1676 WLAN_EID_PREQ = 130,
1677 WLAN_EID_PREP = 131,
1678 WLAN_EID_PERR = 132,
1679 WLAN_EID_PXU = 137,
1680 WLAN_EID_PXUC = 138,
1681 WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
1682 WLAN_EID_MIC = 140,
1683
1684 WLAN_EID_PWR_CONSTRAINT = 32, 1673 WLAN_EID_PWR_CONSTRAINT = 32,
1685 WLAN_EID_PWR_CAPABILITY = 33, 1674 WLAN_EID_PWR_CAPABILITY = 33,
1686 WLAN_EID_TPC_REQUEST = 34, 1675 WLAN_EID_TPC_REQUEST = 34,
@@ -1691,66 +1680,114 @@ enum ieee80211_eid {
1691 WLAN_EID_MEASURE_REPORT = 39, 1680 WLAN_EID_MEASURE_REPORT = 39,
1692 WLAN_EID_QUIET = 40, 1681 WLAN_EID_QUIET = 40,
1693 WLAN_EID_IBSS_DFS = 41, 1682 WLAN_EID_IBSS_DFS = 41,
1694
1695 WLAN_EID_ERP_INFO = 42, 1683 WLAN_EID_ERP_INFO = 42,
1696 WLAN_EID_EXT_SUPP_RATES = 50, 1684 WLAN_EID_TS_DELAY = 43,
1697 1685 WLAN_EID_TCLAS_PROCESSING = 44,
1698 WLAN_EID_HT_CAPABILITY = 45, 1686 WLAN_EID_HT_CAPABILITY = 45,
1699 WLAN_EID_HT_OPERATION = 61, 1687 WLAN_EID_QOS_CAPA = 46,
1700 WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62, 1688 /* 47 reserved for Broadcom */
1701
1702 WLAN_EID_RSN = 48, 1689 WLAN_EID_RSN = 48,
1703 WLAN_EID_MMIE = 76, 1690 WLAN_EID_802_15_COEX = 49,
1704 WLAN_EID_VENDOR_SPECIFIC = 221, 1691 WLAN_EID_EXT_SUPP_RATES = 50,
1705 WLAN_EID_QOS_PARAMETER = 222,
1706
1707 WLAN_EID_AP_CHAN_REPORT = 51, 1692 WLAN_EID_AP_CHAN_REPORT = 51,
1708 WLAN_EID_NEIGHBOR_REPORT = 52, 1693 WLAN_EID_NEIGHBOR_REPORT = 52,
1709 WLAN_EID_RCPI = 53, 1694 WLAN_EID_RCPI = 53,
1695 WLAN_EID_MOBILITY_DOMAIN = 54,
1696 WLAN_EID_FAST_BSS_TRANSITION = 55,
1697 WLAN_EID_TIMEOUT_INTERVAL = 56,
1698 WLAN_EID_RIC_DATA = 57,
1699 WLAN_EID_DSE_REGISTERED_LOCATION = 58,
1700 WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59,
1701 WLAN_EID_EXT_CHANSWITCH_ANN = 60,
1702 WLAN_EID_HT_OPERATION = 61,
1703 WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62,
1710 WLAN_EID_BSS_AVG_ACCESS_DELAY = 63, 1704 WLAN_EID_BSS_AVG_ACCESS_DELAY = 63,
1711 WLAN_EID_ANTENNA_INFO = 64, 1705 WLAN_EID_ANTENNA_INFO = 64,
1712 WLAN_EID_RSNI = 65, 1706 WLAN_EID_RSNI = 65,
1713 WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66, 1707 WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66,
1714 WLAN_EID_BSS_AVAILABLE_CAPACITY = 67, 1708 WLAN_EID_BSS_AVAILABLE_CAPACITY = 67,
1715 WLAN_EID_BSS_AC_ACCESS_DELAY = 68, 1709 WLAN_EID_BSS_AC_ACCESS_DELAY = 68,
1710 WLAN_EID_TIME_ADVERTISEMENT = 69,
1716 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, 1711 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
1717 WLAN_EID_MULTIPLE_BSSID = 71, 1712 WLAN_EID_MULTIPLE_BSSID = 71,
1718 WLAN_EID_BSS_COEX_2040 = 72, 1713 WLAN_EID_BSS_COEX_2040 = 72,
1719 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, 1714 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
1720 WLAN_EID_EXT_CAPABILITY = 127,
1721
1722 WLAN_EID_MOBILITY_DOMAIN = 54,
1723 WLAN_EID_FAST_BSS_TRANSITION = 55,
1724 WLAN_EID_TIMEOUT_INTERVAL = 56,
1725 WLAN_EID_RIC_DATA = 57,
1726 WLAN_EID_RIC_DESCRIPTOR = 75, 1715 WLAN_EID_RIC_DESCRIPTOR = 75,
1727 1716 WLAN_EID_MMIE = 76,
1728 WLAN_EID_DSE_REGISTERED_LOCATION = 58, 1717 WLAN_EID_ASSOC_COMEBACK_TIME = 77,
1729 WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59, 1718 WLAN_EID_EVENT_REQUEST = 78,
1730 WLAN_EID_EXT_CHANSWITCH_ANN = 60, 1719 WLAN_EID_EVENT_REPORT = 79,
1731 1720 WLAN_EID_DIAGNOSTIC_REQUEST = 80,
1732 WLAN_EID_VHT_CAPABILITY = 191, 1721 WLAN_EID_DIAGNOSTIC_REPORT = 81,
1733 WLAN_EID_VHT_OPERATION = 192, 1722 WLAN_EID_LOCATION_PARAMS = 82,
1734 WLAN_EID_OPMODE_NOTIF = 199,
1735 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1736 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1737 WLAN_EID_EXTENDED_BSS_LOAD = 193,
1738 WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
1739 WLAN_EID_AID = 197,
1740 WLAN_EID_QUIET_CHANNEL = 198,
1741
1742 /* 802.11ad */
1743 WLAN_EID_NON_TX_BSSID_CAP = 83, 1723 WLAN_EID_NON_TX_BSSID_CAP = 83,
1724 WLAN_EID_SSID_LIST = 84,
1725 WLAN_EID_MULTI_BSSID_IDX = 85,
1726 WLAN_EID_FMS_DESCRIPTOR = 86,
1727 WLAN_EID_FMS_REQUEST = 87,
1728 WLAN_EID_FMS_RESPONSE = 88,
1729 WLAN_EID_QOS_TRAFFIC_CAPA = 89,
1730 WLAN_EID_BSS_MAX_IDLE_PERIOD = 90,
1731 WLAN_EID_TSF_REQUEST = 91,
1732 WLAN_EID_TSF_RESPOSNE = 92,
1733 WLAN_EID_WNM_SLEEP_MODE = 93,
1734 WLAN_EID_TIM_BCAST_REQ = 94,
1735 WLAN_EID_TIM_BCAST_RESP = 95,
1736 WLAN_EID_COLL_IF_REPORT = 96,
1737 WLAN_EID_CHANNEL_USAGE = 97,
1738 WLAN_EID_TIME_ZONE = 98,
1739 WLAN_EID_DMS_REQUEST = 99,
1740 WLAN_EID_DMS_RESPONSE = 100,
1741 WLAN_EID_LINK_ID = 101,
1742 WLAN_EID_WAKEUP_SCHEDUL = 102,
1743 /* 103 reserved */
1744 WLAN_EID_CHAN_SWITCH_TIMING = 104,
1745 WLAN_EID_PTI_CONTROL = 105,
1746 WLAN_EID_PU_BUFFER_STATUS = 106,
1747 WLAN_EID_INTERWORKING = 107,
1748 WLAN_EID_ADVERTISEMENT_PROTOCOL = 108,
1749 WLAN_EID_EXPEDITED_BW_REQ = 109,
1750 WLAN_EID_QOS_MAP_SET = 110,
1751 WLAN_EID_ROAMING_CONSORTIUM = 111,
1752 WLAN_EID_EMERGENCY_ALERT = 112,
1753 WLAN_EID_MESH_CONFIG = 113,
1754 WLAN_EID_MESH_ID = 114,
1755 WLAN_EID_LINK_METRIC_REPORT = 115,
1756 WLAN_EID_CONGESTION_NOTIFICATION = 116,
1757 WLAN_EID_PEER_MGMT = 117,
1758 WLAN_EID_CHAN_SWITCH_PARAM = 118,
1759 WLAN_EID_MESH_AWAKE_WINDOW = 119,
1760 WLAN_EID_BEACON_TIMING = 120,
1761 WLAN_EID_MCCAOP_SETUP_REQ = 121,
1762 WLAN_EID_MCCAOP_SETUP_RESP = 122,
1763 WLAN_EID_MCCAOP_ADVERT = 123,
1764 WLAN_EID_MCCAOP_TEARDOWN = 124,
1765 WLAN_EID_GANN = 125,
1766 WLAN_EID_RANN = 126,
1767 WLAN_EID_EXT_CAPABILITY = 127,
1768 /* 128, 129 reserved for Agere */
1769 WLAN_EID_PREQ = 130,
1770 WLAN_EID_PREP = 131,
1771 WLAN_EID_PERR = 132,
1772 /* 133-136 reserved for Cisco */
1773 WLAN_EID_PXU = 137,
1774 WLAN_EID_PXUC = 138,
1775 WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
1776 WLAN_EID_MIC = 140,
1777 WLAN_EID_DESTINATION_URI = 141,
1778 WLAN_EID_UAPSD_COEX = 142,
1744 WLAN_EID_WAKEUP_SCHEDULE = 143, 1779 WLAN_EID_WAKEUP_SCHEDULE = 143,
1745 WLAN_EID_EXT_SCHEDULE = 144, 1780 WLAN_EID_EXT_SCHEDULE = 144,
1746 WLAN_EID_STA_AVAILABILITY = 145, 1781 WLAN_EID_STA_AVAILABILITY = 145,
1747 WLAN_EID_DMG_TSPEC = 146, 1782 WLAN_EID_DMG_TSPEC = 146,
1748 WLAN_EID_DMG_AT = 147, 1783 WLAN_EID_DMG_AT = 147,
1749 WLAN_EID_DMG_CAP = 148, 1784 WLAN_EID_DMG_CAP = 148,
1785 /* 149-150 reserved for Cisco */
1750 WLAN_EID_DMG_OPERATION = 151, 1786 WLAN_EID_DMG_OPERATION = 151,
1751 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152, 1787 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
1752 WLAN_EID_DMG_BEAM_REFINEMENT = 153, 1788 WLAN_EID_DMG_BEAM_REFINEMENT = 153,
1753 WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154, 1789 WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154,
1790 /* 155-156 reserved for Cisco */
1754 WLAN_EID_AWAKE_WINDOW = 157, 1791 WLAN_EID_AWAKE_WINDOW = 157,
1755 WLAN_EID_MULTI_BAND = 158, 1792 WLAN_EID_MULTI_BAND = 158,
1756 WLAN_EID_ADDBA_EXT = 159, 1793 WLAN_EID_ADDBA_EXT = 159,
@@ -1767,11 +1804,34 @@ enum ieee80211_eid {
1767 WLAN_EID_MULTIPLE_MAC_ADDR = 170, 1804 WLAN_EID_MULTIPLE_MAC_ADDR = 170,
1768 WLAN_EID_U_PID = 171, 1805 WLAN_EID_U_PID = 171,
1769 WLAN_EID_DMG_LINK_ADAPT_ACK = 172, 1806 WLAN_EID_DMG_LINK_ADAPT_ACK = 172,
1807 /* 173 reserved for Symbol */
1808 WLAN_EID_MCCAOP_ADV_OVERVIEW = 174,
1770 WLAN_EID_QUIET_PERIOD_REQ = 175, 1809 WLAN_EID_QUIET_PERIOD_REQ = 175,
1810 /* 176 reserved for Symbol */
1771 WLAN_EID_QUIET_PERIOD_RESP = 177, 1811 WLAN_EID_QUIET_PERIOD_RESP = 177,
1812 /* 178-179 reserved for Symbol */
1813 /* 180 reserved for ISO/IEC 20011 */
1772 WLAN_EID_EPAC_POLICY = 182, 1814 WLAN_EID_EPAC_POLICY = 182,
1773 WLAN_EID_CLISTER_TIME_OFF = 183, 1815 WLAN_EID_CLISTER_TIME_OFF = 183,
1816 WLAN_EID_INTER_AC_PRIO = 184,
1817 WLAN_EID_SCS_DESCRIPTOR = 185,
1818 WLAN_EID_QLOAD_REPORT = 186,
1819 WLAN_EID_HCCA_TXOP_UPDATE_COUNT = 187,
1820 WLAN_EID_HL_STREAM_ID = 188,
1821 WLAN_EID_GCR_GROUP_ADDR = 189,
1774 WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190, 1822 WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190,
1823 WLAN_EID_VHT_CAPABILITY = 191,
1824 WLAN_EID_VHT_OPERATION = 192,
1825 WLAN_EID_EXTENDED_BSS_LOAD = 193,
1826 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1827 WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
1828 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1829 WLAN_EID_AID = 197,
1830 WLAN_EID_QUIET_CHANNEL = 198,
1831 WLAN_EID_OPMODE_NOTIF = 199,
1832
1833 WLAN_EID_VENDOR_SPECIFIC = 221,
1834 WLAN_EID_QOS_PARAMETER = 222,
1775}; 1835};
1776 1836
1777/* Action category code */ 1837/* Action category code */
@@ -2192,10 +2252,10 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
2192} 2252}
2193 2253
2194/** 2254/**
2195 * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame 2255 * _ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
2196 * @hdr: the frame (buffer must include at least the first octet of payload) 2256 * @hdr: the frame (buffer must include at least the first octet of payload)
2197 */ 2257 */
2198static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr) 2258static inline bool _ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
2199{ 2259{
2200 if (ieee80211_is_disassoc(hdr->frame_control) || 2260 if (ieee80211_is_disassoc(hdr->frame_control) ||
2201 ieee80211_is_deauth(hdr->frame_control)) 2261 ieee80211_is_deauth(hdr->frame_control))
@@ -2224,6 +2284,17 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
2224} 2284}
2225 2285
2226/** 2286/**
2287 * ieee80211_is_robust_mgmt_frame - check if skb contains a robust mgmt frame
2288 * @skb: the skb containing the frame, length will be checked
2289 */
2290static inline bool ieee80211_is_robust_mgmt_frame(struct sk_buff *skb)
2291{
2292 if (skb->len < 25)
2293 return false;
2294 return _ieee80211_is_robust_mgmt_frame((void *)skb->data);
2295}
2296
2297/**
2227 * ieee80211_is_public_action - check if frame is a public action frame 2298 * ieee80211_is_public_action - check if frame is a public action frame
2228 * @hdr: the frame 2299 * @hdr: the frame
2229 * @len: length of the frame 2300 * @len: length of the frame
@@ -2241,42 +2312,6 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
2241} 2312}
2242 2313
2243/** 2314/**
2244 * ieee80211_dsss_chan_to_freq - get channel center frequency
2245 * @channel: the DSSS channel
2246 *
2247 * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
2248 * Ref IEEE 802.11-2007 section 15.6
2249 */
2250static inline int ieee80211_dsss_chan_to_freq(int channel)
2251{
2252 if ((channel > 0) && (channel < 14))
2253 return 2407 + (channel * 5);
2254 else if (channel == 14)
2255 return 2484;
2256 else
2257 return -1;
2258}
2259
2260/**
2261 * ieee80211_freq_to_dsss_chan - get channel
2262 * @freq: the frequency
2263 *
2264 * Convert frequency (MHz) to IEEE802.11 DSSS channel
2265 * Ref IEEE 802.11-2007 section 15.6
2266 *
2267 * This routine selects the channel with the closest center frequency.
2268 */
2269static inline int ieee80211_freq_to_dsss_chan(int freq)
2270{
2271 if ((freq >= 2410) && (freq < 2475))
2272 return (freq - 2405) / 5;
2273 else if ((freq >= 2482) && (freq < 2487))
2274 return 14;
2275 else
2276 return -1;
2277}
2278
2279/**
2280 * ieee80211_tu_to_usec - convert time units (TU) to microseconds 2315 * ieee80211_tu_to_usec - convert time units (TU) to microseconds
2281 * @tu: the TUs 2316 * @tu: the TUs
2282 */ 2317 */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index bbedfb56bd66..13bbbde00e68 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -110,6 +110,7 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
110 __be16 vlan_proto, u16 vlan_id); 110 __be16 vlan_proto, u16 vlan_id);
111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
112extern u16 vlan_dev_vlan_id(const struct net_device *dev); 112extern u16 vlan_dev_vlan_id(const struct net_device *dev);
113extern __be16 vlan_dev_vlan_proto(const struct net_device *dev);
113 114
114/** 115/**
115 * struct vlan_priority_tci_mapping - vlan egress priority mappings 116 * struct vlan_priority_tci_mapping - vlan egress priority mappings
@@ -216,6 +217,12 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
216 return 0; 217 return 0;
217} 218}
218 219
220static inline __be16 vlan_dev_vlan_proto(const struct net_device *dev)
221{
222 BUG();
223 return 0;
224}
225
219static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev, 226static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev,
220 u32 skprio) 227 u32 skprio)
221{ 228{
@@ -288,7 +295,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
288 struct vlan_ethhdr *veth; 295 struct vlan_ethhdr *veth;
289 296
290 if (skb_cow_head(skb, VLAN_HLEN) < 0) { 297 if (skb_cow_head(skb, VLAN_HLEN) < 0) {
291 kfree_skb(skb); 298 dev_kfree_skb_any(skb);
292 return NULL; 299 return NULL;
293 } 300 }
294 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 301 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 75a8a20c8179..5f2d00e7e488 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -254,12 +254,16 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
254 (chan->info_mask_shared_by_all & BIT(type)); 254 (chan->info_mask_shared_by_all & BIT(type));
255} 255}
256 256
257#define IIO_ST(si, rb, sb, sh) \ 257#define IIO_CHAN_SOFT_TIMESTAMP(_si) { \
258 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh } 258 .type = IIO_TIMESTAMP, \
259 259 .channel = -1, \
260#define IIO_CHAN_SOFT_TIMESTAMP(_si) \ 260 .scan_index = _si, \
261 { .type = IIO_TIMESTAMP, .channel = -1, \ 261 .scan_type = { \
262 .scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) } 262 .sign = 's', \
263 .realbits = 64, \
264 .storagebits = 64, \
265 }, \
266}
263 267
264/** 268/**
265 * iio_get_time_ns() - utility function to get a time stamp for events etc 269 * iio_get_time_ns() - utility function to get a time stamp for events etc
diff --git a/include/linux/input/pmic8xxx-keypad.h b/include/linux/input/pmic8xxx-keypad.h
deleted file mode 100644
index 5f1e2f9ad959..000000000000
--- a/include/linux/input/pmic8xxx-keypad.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/* Copyright (c) 2011, 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 __PMIC8XXX_KEYPAD_H__
14#define __PMIC8XXX_KEYPAD_H__
15
16#include <linux/input/matrix_keypad.h>
17
18#define PM8XXX_KEYPAD_DEV_NAME "pm8xxx-keypad"
19
20/**
21 * struct pm8xxx_keypad_platform_data - platform data for keypad
22 * @keymap_data - matrix keymap data
23 * @input_name - input device name
24 * @input_phys_device - input device name
25 * @num_cols - number of columns of keypad
26 * @num_rows - number of row of keypad
27 * @debounce_ms - debounce period in milliseconds
28 * @scan_delay_ms - scan delay in milliseconds
29 * @row_hold_ns - row hold period in nanoseconds
30 * @wakeup - configure keypad as wakeup
31 * @rep - enable or disable key repeat bit
32 */
33struct pm8xxx_keypad_platform_data {
34 const struct matrix_keymap_data *keymap_data;
35
36 const char *input_name;
37 const char *input_phys_device;
38
39 unsigned int num_cols;
40 unsigned int num_rows;
41 unsigned int rows_gpio_start;
42 unsigned int cols_gpio_start;
43
44 unsigned int debounce_ms;
45 unsigned int scan_delay_ms;
46 unsigned int row_hold_ns;
47
48 bool wakeup;
49 bool rep;
50};
51
52#endif /*__PMIC8XXX_KEYPAD_H__ */
diff --git a/include/linux/input/pmic8xxx-pwrkey.h b/include/linux/input/pmic8xxx-pwrkey.h
deleted file mode 100644
index 6d2974e57109..000000000000
--- a/include/linux/input/pmic8xxx-pwrkey.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/* Copyright (c) 2010-2011, 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 __PMIC8XXX_PWRKEY_H__
14#define __PMIC8XXX_PWRKEY_H__
15
16#define PM8XXX_PWRKEY_DEV_NAME "pm8xxx-pwrkey"
17
18/**
19 * struct pm8xxx_pwrkey_platform_data - platform data for pwrkey driver
20 * @pull up: power on register control for pull up/down configuration
21 * @kpd_trigger_delay_us: time delay for power key state change interrupt
22 * trigger.
23 * @wakeup: configure power key as wakeup source
24 */
25struct pm8xxx_pwrkey_platform_data {
26 bool pull_up;
27 u32 kpd_trigger_delay_us;
28 u32 wakeup;
29};
30
31#endif /* __PMIC8XXX_PWRKEY_H__ */
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 2c4bed593b32..0a2da5188217 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -319,6 +319,7 @@ struct intel_iommu {
319 int agaw; /* agaw of this iommu */ 319 int agaw; /* agaw of this iommu */
320 int msagaw; /* max sagaw of this iommu */ 320 int msagaw; /* max sagaw of this iommu */
321 unsigned int irq; 321 unsigned int irq;
322 u16 segment; /* PCI segment# */
322 unsigned char name[13]; /* Device Name */ 323 unsigned char name[13]; /* Device Name */
323 324
324#ifdef CONFIG_INTEL_IOMMU 325#ifdef CONFIG_INTEL_IOMMU
diff --git a/include/linux/io.h b/include/linux/io.h
index 8a18e75600cc..b76e6e545806 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -41,7 +41,7 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end,
41/* 41/*
42 * Managed iomap interface 42 * Managed iomap interface
43 */ 43 */
44#ifdef CONFIG_HAS_IOPORT 44#ifdef CONFIG_HAS_IOPORT_MAP
45void __iomem * devm_ioport_map(struct device *dev, unsigned long port, 45void __iomem * devm_ioport_map(struct device *dev, unsigned long port,
46 unsigned int nr); 46 unsigned int nr);
47void devm_ioport_unmap(struct device *dev, void __iomem *addr); 47void devm_ioport_unmap(struct device *dev, void __iomem *addr);
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 89b7c24a36e9..5e3a906cc089 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -51,7 +51,7 @@ struct resource {
51 51
52#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 52#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */
53#define IORESOURCE_DISABLED 0x10000000 53#define IORESOURCE_DISABLED 0x10000000
54#define IORESOURCE_UNSET 0x20000000 54#define IORESOURCE_UNSET 0x20000000 /* No address assigned yet */
55#define IORESOURCE_AUTO 0x40000000 55#define IORESOURCE_AUTO 0x40000000
56#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ 56#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */
57 57
@@ -169,6 +169,16 @@ static inline unsigned long resource_type(const struct resource *res)
169{ 169{
170 return res->flags & IORESOURCE_TYPE_BITS; 170 return res->flags & IORESOURCE_TYPE_BITS;
171} 171}
172/* True iff r1 completely contains r2 */
173static inline bool resource_contains(struct resource *r1, struct resource *r2)
174{
175 if (resource_type(r1) != resource_type(r2))
176 return false;
177 if (r1->flags & IORESOURCE_UNSET || r2->flags & IORESOURCE_UNSET)
178 return false;
179 return r1->start <= r2->start && r1->end >= r2->end;
180}
181
172 182
173/* Convenience shorthand with allocation */ 183/* Convenience shorthand with allocation */
174#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) 184#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 76a0759e88ec..3277f4711349 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -47,5 +47,7 @@ void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to);
47void init_iova_domain(struct iova_domain *iovad, unsigned long pfn_32bit); 47void init_iova_domain(struct iova_domain *iovad, unsigned long pfn_32bit);
48struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn); 48struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn);
49void put_iova_domain(struct iova_domain *iovad); 49void put_iova_domain(struct iova_domain *iovad);
50struct iova *split_and_remove_iova(struct iova_domain *iovad,
51 struct iova *iova, unsigned long pfn_lo, unsigned long pfn_hi);
50 52
51#endif 53#endif
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 0ceb389dba6c..7ed92d0560d5 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -93,6 +93,11 @@ int gic_get_cpu_id(unsigned int cpu);
93void gic_migrate_target(unsigned int new_cpu_id); 93void gic_migrate_target(unsigned int new_cpu_id);
94unsigned long gic_get_sgir_physaddr(void); 94unsigned long gic_get_sgir_physaddr(void);
95 95
96extern const struct irq_domain_ops *gic_routable_irq_domain_ops;
97static inline void __init register_routable_domain_ops
98 (const struct irq_domain_ops *ops)
99{
100 gic_routable_irq_domain_ops = ops;
101}
96#endif /* __ASSEMBLY */ 102#endif /* __ASSEMBLY */
97
98#endif 103#endif
diff --git a/include/linux/irqchip/arm-vic.h b/include/linux/irqchip/arm-vic.h
index e3c82dc95756..ba46c794b4e5 100644
--- a/include/linux/irqchip/arm-vic.h
+++ b/include/linux/irqchip/arm-vic.h
@@ -29,8 +29,10 @@
29struct device_node; 29struct device_node;
30struct pt_regs; 30struct pt_regs;
31 31
32void __vic_init(void __iomem *base, int irq_start, u32 vic_sources, 32void __vic_init(void __iomem *base, int parent_irq, int irq_start,
33 u32 resume_sources, struct device_node *node); 33 u32 vic_sources, u32 resume_sources, struct device_node *node);
34void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); 34void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
35int vic_init_cascaded(void __iomem *base, unsigned int parent_irq,
36 u32 vic_sources, u32 resume_sources);
35 37
36#endif 38#endif
diff --git a/include/linux/irqchip/irq-crossbar.h b/include/linux/irqchip/irq-crossbar.h
new file mode 100644
index 000000000000..e5537b81df8d
--- /dev/null
+++ b/include/linux/irqchip/irq-crossbar.h
@@ -0,0 +1,11 @@
1/*
2 * drivers/irqchip/irq-crossbar.h
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
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 */
11int irqcrossbar_init(void);
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
index e2d28b026a8c..3c77bf9b1efd 100644
--- a/include/linux/isapnp.h
+++ b/include/linux/isapnp.h
@@ -56,10 +56,6 @@
56#define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \ 56#define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \
57 { .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) } 57 { .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) }
58 58
59/* export used IDs outside module */
60#define ISAPNP_CARD_TABLE(name) \
61 MODULE_GENERIC_TABLE(isapnp_card, name)
62
63struct isapnp_card_id { 59struct isapnp_card_id {
64 unsigned long driver_data; /* data private to the driver */ 60 unsigned long driver_data; /* data private to the driver */
65 unsigned short card_vendor, card_device; 61 unsigned short card_vendor, card_device;
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index d5f62bc5f4be..8e10f57f109f 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -180,9 +180,8 @@ struct ippp_struct {
180 struct slcompress *slcomp; 180 struct slcompress *slcomp;
181#endif 181#endif
182#ifdef CONFIG_IPPP_FILTER 182#ifdef CONFIG_IPPP_FILTER
183 struct sock_filter *pass_filter; /* filter for packets to pass */ 183 struct sk_filter *pass_filter; /* filter for packets to pass */
184 struct sock_filter *active_filter; /* filter for pkts to reset idle */ 184 struct sk_filter *active_filter; /* filter for pkts to reset idle */
185 unsigned pass_len, active_len;
186#endif 185#endif
187 unsigned long debug; 186 unsigned long debug;
188 struct isdn_ppp_compressor *compressor,*decompressor; 187 struct isdn_ppp_compressor *compressor,*decompressor;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 08fb02477641..4c52907a6d8b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -469,6 +469,7 @@ extern enum system_states {
469#define TAINT_CRAP 10 469#define TAINT_CRAP 10
470#define TAINT_FIRMWARE_WORKAROUND 11 470#define TAINT_FIRMWARE_WORKAROUND 11
471#define TAINT_OOT_MODULE 12 471#define TAINT_OOT_MODULE 12
472#define TAINT_UNSIGNED_MODULE 13
472 473
473extern const char hex_asc[]; 474extern const char hex_asc[];
474#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] 475#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
@@ -841,4 +842,12 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
841# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 842# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
842#endif 843#endif
843 844
845/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */
846#define VERIFY_OCTAL_PERMISSIONS(perms) \
847 (BUILD_BUG_ON_ZERO((perms) < 0) + \
848 BUILD_BUG_ON_ZERO((perms) > 0777) + \
849 /* User perms >= group perms >= other perms */ \
850 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \
851 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \
852 (perms))
844#endif 853#endif
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index d267623c28cf..b0122dc6f96a 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -15,7 +15,7 @@
15#include <linux/lockdep.h> 15#include <linux/lockdep.h>
16#include <linux/rbtree.h> 16#include <linux/rbtree.h>
17#include <linux/atomic.h> 17#include <linux/atomic.h>
18#include <linux/completion.h> 18#include <linux/wait.h>
19 19
20struct file; 20struct file;
21struct dentry; 21struct dentry;
@@ -35,16 +35,22 @@ enum kernfs_node_type {
35}; 35};
36 36
37#define KERNFS_TYPE_MASK 0x000f 37#define KERNFS_TYPE_MASK 0x000f
38#define KERNFS_ACTIVE_REF KERNFS_FILE
39#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK 38#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK
40 39
41enum kernfs_node_flag { 40enum kernfs_node_flag {
42 KERNFS_REMOVED = 0x0010, 41 KERNFS_ACTIVATED = 0x0010,
43 KERNFS_NS = 0x0020, 42 KERNFS_NS = 0x0020,
44 KERNFS_HAS_SEQ_SHOW = 0x0040, 43 KERNFS_HAS_SEQ_SHOW = 0x0040,
45 KERNFS_HAS_MMAP = 0x0080, 44 KERNFS_HAS_MMAP = 0x0080,
46 KERNFS_LOCKDEP = 0x0100, 45 KERNFS_LOCKDEP = 0x0100,
47 KERNFS_STATIC_NAME = 0x0200, 46 KERNFS_STATIC_NAME = 0x0200,
47 KERNFS_SUICIDAL = 0x0400,
48 KERNFS_SUICIDED = 0x0800,
49};
50
51/* @flags for kernfs_create_root() */
52enum kernfs_root_flag {
53 KERNFS_ROOT_CREATE_DEACTIVATED = 0x0001,
48}; 54};
49 55
50/* type-specific structures for kernfs_node union members */ 56/* type-specific structures for kernfs_node union members */
@@ -85,17 +91,17 @@ struct kernfs_node {
85#ifdef CONFIG_DEBUG_LOCK_ALLOC 91#ifdef CONFIG_DEBUG_LOCK_ALLOC
86 struct lockdep_map dep_map; 92 struct lockdep_map dep_map;
87#endif 93#endif
88 /* the following two fields are published */ 94 /*
95 * Use kernfs_get_parent() and kernfs_name/path() instead of
96 * accessing the following two fields directly. If the node is
97 * never moved to a different parent, it is safe to access the
98 * parent directly.
99 */
89 struct kernfs_node *parent; 100 struct kernfs_node *parent;
90 const char *name; 101 const char *name;
91 102
92 struct rb_node rb; 103 struct rb_node rb;
93 104
94 union {
95 struct completion *completion;
96 struct kernfs_node *removed_list;
97 } u;
98
99 const void *ns; /* namespace tag */ 105 const void *ns; /* namespace tag */
100 unsigned int hash; /* ns + name hash */ 106 unsigned int hash; /* ns + name hash */
101 union { 107 union {
@@ -113,12 +119,16 @@ struct kernfs_node {
113}; 119};
114 120
115/* 121/*
116 * kernfs_dir_ops may be specified on kernfs_create_root() to support 122 * kernfs_syscall_ops may be specified on kernfs_create_root() to support
117 * directory manipulation syscalls. These optional callbacks are invoked 123 * syscalls. These optional callbacks are invoked on the matching syscalls
118 * on the matching syscalls and can perform any kernfs operations which 124 * and can perform any kernfs operations which don't necessarily have to be
119 * don't necessarily have to be the exact operation requested. 125 * the exact operation requested. An active reference is held for each
126 * kernfs_node parameter.
120 */ 127 */
121struct kernfs_dir_ops { 128struct kernfs_syscall_ops {
129 int (*remount_fs)(struct kernfs_root *root, int *flags, char *data);
130 int (*show_options)(struct seq_file *sf, struct kernfs_root *root);
131
122 int (*mkdir)(struct kernfs_node *parent, const char *name, 132 int (*mkdir)(struct kernfs_node *parent, const char *name,
123 umode_t mode); 133 umode_t mode);
124 int (*rmdir)(struct kernfs_node *kn); 134 int (*rmdir)(struct kernfs_node *kn);
@@ -129,22 +139,26 @@ struct kernfs_dir_ops {
129struct kernfs_root { 139struct kernfs_root {
130 /* published fields */ 140 /* published fields */
131 struct kernfs_node *kn; 141 struct kernfs_node *kn;
142 unsigned int flags; /* KERNFS_ROOT_* flags */
132 143
133 /* private fields, do not use outside kernfs proper */ 144 /* private fields, do not use outside kernfs proper */
134 struct ida ino_ida; 145 struct ida ino_ida;
135 struct kernfs_dir_ops *dir_ops; 146 struct kernfs_syscall_ops *syscall_ops;
147 wait_queue_head_t deactivate_waitq;
136}; 148};
137 149
138struct kernfs_open_file { 150struct kernfs_open_file {
139 /* published fields */ 151 /* published fields */
140 struct kernfs_node *kn; 152 struct kernfs_node *kn;
141 struct file *file; 153 struct file *file;
154 void *priv;
142 155
143 /* private fields, do not use outside kernfs proper */ 156 /* private fields, do not use outside kernfs proper */
144 struct mutex mutex; 157 struct mutex mutex;
145 int event; 158 int event;
146 struct list_head list; 159 struct list_head list;
147 160
161 size_t atomic_write_len;
148 bool mmapped; 162 bool mmapped;
149 const struct vm_operations_struct *vm_ops; 163 const struct vm_operations_struct *vm_ops;
150}; 164};
@@ -171,9 +185,13 @@ struct kernfs_ops {
171 loff_t off); 185 loff_t off);
172 186
173 /* 187 /*
174 * write() is bounced through kernel buffer and a write larger than 188 * write() is bounced through kernel buffer. If atomic_write_len
175 * PAGE_SIZE results in partial operation of PAGE_SIZE. 189 * is not set, a write larger than PAGE_SIZE results in partial
190 * operations of PAGE_SIZE chunks. If atomic_write_len is set,
191 * writes upto the specified size are executed atomically but
192 * larger ones are rejected with -E2BIG.
176 */ 193 */
194 size_t atomic_write_len;
177 ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes, 195 ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes,
178 loff_t off); 196 loff_t off);
179 197
@@ -184,7 +202,7 @@ struct kernfs_ops {
184#endif 202#endif
185}; 203};
186 204
187#ifdef CONFIG_SYSFS 205#ifdef CONFIG_KERNFS
188 206
189static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) 207static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn)
190{ 208{
@@ -217,13 +235,22 @@ static inline bool kernfs_ns_enabled(struct kernfs_node *kn)
217 return kn->flags & KERNFS_NS; 235 return kn->flags & KERNFS_NS;
218} 236}
219 237
238int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen);
239char * __must_check kernfs_path(struct kernfs_node *kn, char *buf,
240 size_t buflen);
241void pr_cont_kernfs_name(struct kernfs_node *kn);
242void pr_cont_kernfs_path(struct kernfs_node *kn);
243struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn);
220struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent, 244struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
221 const char *name, const void *ns); 245 const char *name, const void *ns);
222void kernfs_get(struct kernfs_node *kn); 246void kernfs_get(struct kernfs_node *kn);
223void kernfs_put(struct kernfs_node *kn); 247void kernfs_put(struct kernfs_node *kn);
224 248
225struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops, 249struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry);
226 void *priv); 250struct kernfs_root *kernfs_root_from_sb(struct super_block *sb);
251
252struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
253 unsigned int flags, void *priv);
227void kernfs_destroy_root(struct kernfs_root *root); 254void kernfs_destroy_root(struct kernfs_root *root);
228 255
229struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, 256struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent,
@@ -239,7 +266,11 @@ struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent,
239struct kernfs_node *kernfs_create_link(struct kernfs_node *parent, 266struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
240 const char *name, 267 const char *name,
241 struct kernfs_node *target); 268 struct kernfs_node *target);
269void kernfs_activate(struct kernfs_node *kn);
242void kernfs_remove(struct kernfs_node *kn); 270void kernfs_remove(struct kernfs_node *kn);
271void kernfs_break_active_protection(struct kernfs_node *kn);
272void kernfs_unbreak_active_protection(struct kernfs_node *kn);
273bool kernfs_remove_self(struct kernfs_node *kn);
243int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, 274int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
244 const void *ns); 275 const void *ns);
245int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent, 276int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
@@ -255,7 +286,7 @@ void kernfs_kill_sb(struct super_block *sb);
255 286
256void kernfs_init(void); 287void kernfs_init(void);
257 288
258#else /* CONFIG_SYSFS */ 289#else /* CONFIG_KERNFS */
259 290
260static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) 291static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn)
261{ return 0; } /* whatever */ 292{ return 0; } /* whatever */
@@ -265,6 +296,19 @@ static inline void kernfs_enable_ns(struct kernfs_node *kn) { }
265static inline bool kernfs_ns_enabled(struct kernfs_node *kn) 296static inline bool kernfs_ns_enabled(struct kernfs_node *kn)
266{ return false; } 297{ return false; }
267 298
299static inline int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
300{ return -ENOSYS; }
301
302static inline char * __must_check kernfs_path(struct kernfs_node *kn, char *buf,
303 size_t buflen)
304{ return NULL; }
305
306static inline void pr_cont_kernfs_name(struct kernfs_node *kn) { }
307static inline void pr_cont_kernfs_path(struct kernfs_node *kn) { }
308
309static inline struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn)
310{ return NULL; }
311
268static inline struct kernfs_node * 312static inline struct kernfs_node *
269kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name, 313kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name,
270 const void *ns) 314 const void *ns)
@@ -273,8 +317,15 @@ kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name,
273static inline void kernfs_get(struct kernfs_node *kn) { } 317static inline void kernfs_get(struct kernfs_node *kn) { }
274static inline void kernfs_put(struct kernfs_node *kn) { } 318static inline void kernfs_put(struct kernfs_node *kn) { }
275 319
320static inline struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry)
321{ return NULL; }
322
323static inline struct kernfs_root *kernfs_root_from_sb(struct super_block *sb)
324{ return NULL; }
325
276static inline struct kernfs_root * 326static inline struct kernfs_root *
277kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv) 327kernfs_create_root(struct kernfs_syscall_ops *scops, unsigned int flags,
328 void *priv)
278{ return ERR_PTR(-ENOSYS); } 329{ return ERR_PTR(-ENOSYS); }
279 330
280static inline void kernfs_destroy_root(struct kernfs_root *root) { } 331static inline void kernfs_destroy_root(struct kernfs_root *root) { }
@@ -296,8 +347,13 @@ kernfs_create_link(struct kernfs_node *parent, const char *name,
296 struct kernfs_node *target) 347 struct kernfs_node *target)
297{ return ERR_PTR(-ENOSYS); } 348{ return ERR_PTR(-ENOSYS); }
298 349
350static inline void kernfs_activate(struct kernfs_node *kn) { }
351
299static inline void kernfs_remove(struct kernfs_node *kn) { } 352static inline void kernfs_remove(struct kernfs_node *kn) { }
300 353
354static inline bool kernfs_remove_self(struct kernfs_node *kn)
355{ return false; }
356
301static inline int kernfs_remove_by_name_ns(struct kernfs_node *kn, 357static inline int kernfs_remove_by_name_ns(struct kernfs_node *kn,
302 const char *name, const void *ns) 358 const char *name, const void *ns)
303{ return -ENOSYS; } 359{ return -ENOSYS; }
@@ -325,7 +381,7 @@ static inline void kernfs_kill_sb(struct super_block *sb) { }
325 381
326static inline void kernfs_init(void) { } 382static inline void kernfs_init(void) { }
327 383
328#endif /* CONFIG_SYSFS */ 384#endif /* CONFIG_KERNFS */
329 385
330static inline struct kernfs_node * 386static inline struct kernfs_node *
331kernfs_find_and_get(struct kernfs_node *kn, const char *name) 387kernfs_find_and_get(struct kernfs_node *kn, const char *name)
@@ -367,6 +423,13 @@ static inline int kernfs_remove_by_name(struct kernfs_node *parent,
367 return kernfs_remove_by_name_ns(parent, name, NULL); 423 return kernfs_remove_by_name_ns(parent, name, NULL);
368} 424}
369 425
426static inline int kernfs_rename(struct kernfs_node *kn,
427 struct kernfs_node *new_parent,
428 const char *new_name)
429{
430 return kernfs_rename_ns(kn, new_parent, new_name, NULL);
431}
432
370static inline struct dentry * 433static inline struct dentry *
371kernfs_mount(struct file_system_type *fs_type, int flags, 434kernfs_mount(struct file_system_type *fs_type, int flags,
372 struct kernfs_root *root, bool *new_sb_created) 435 struct kernfs_root *root, bool *new_sb_created)
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 552d51efb429..554fde3a3927 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -722,7 +722,7 @@ __kfifo_uint_must_check_helper( \
722/** 722/**
723 * kfifo_dma_out_finish - finish a DMA OUT operation 723 * kfifo_dma_out_finish - finish a DMA OUT operation
724 * @fifo: address of the fifo to be used 724 * @fifo: address of the fifo to be used
725 * @len: number of bytes transferd 725 * @len: number of bytes transferrd
726 * 726 *
727 * This macro finish a DMA OUT operation. The out counter will be updated by 727 * This macro finish a DMA OUT operation. The out counter will be updated by
728 * the len parameter. No error checking will be done. 728 * the len parameter. No error checking will be done.
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 2a5e5548a1d2..5bb424659c04 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -30,8 +30,6 @@ extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) __ref;
30extern void kmemleak_free(const void *ptr) __ref; 30extern void kmemleak_free(const void *ptr) __ref;
31extern void kmemleak_free_part(const void *ptr, size_t size) __ref; 31extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref; 32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
33extern void kmemleak_padding(const void *ptr, unsigned long offset,
34 size_t size) __ref;
35extern void kmemleak_not_leak(const void *ptr) __ref; 33extern void kmemleak_not_leak(const void *ptr) __ref;
36extern void kmemleak_ignore(const void *ptr) __ref; 34extern void kmemleak_ignore(const void *ptr) __ref;
37extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref; 35extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 926afb6f6b5f..f896a33e8341 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -119,6 +119,7 @@ struct kobj_type {
119}; 119};
120 120
121struct kobj_uevent_env { 121struct kobj_uevent_env {
122 char *argv[3];
122 char *envp[UEVENT_NUM_ENVP]; 123 char *envp[UEVENT_NUM_ENVP];
123 int envp_idx; 124 int envp_idx;
124 char buf[UEVENT_BUFFER_SIZE]; 125 char buf[UEVENT_BUFFER_SIZE];
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index b8e9a43e501a..7d21cf9f4380 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -192,7 +192,7 @@ struct kvm_async_pf {
192 192
193void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu); 193void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu);
194void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu); 194void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu);
195int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn, 195int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, unsigned long hva,
196 struct kvm_arch_async_pf *arch); 196 struct kvm_arch_async_pf *arch);
197int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu); 197int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
198#endif 198#endif
@@ -297,6 +297,14 @@ static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memsl
297 return ALIGN(memslot->npages, BITS_PER_LONG) / 8; 297 return ALIGN(memslot->npages, BITS_PER_LONG) / 8;
298} 298}
299 299
300struct kvm_s390_adapter_int {
301 u64 ind_addr;
302 u64 summary_addr;
303 u64 ind_offset;
304 u32 summary_offset;
305 u32 adapter_id;
306};
307
300struct kvm_kernel_irq_routing_entry { 308struct kvm_kernel_irq_routing_entry {
301 u32 gsi; 309 u32 gsi;
302 u32 type; 310 u32 type;
@@ -309,6 +317,7 @@ struct kvm_kernel_irq_routing_entry {
309 unsigned pin; 317 unsigned pin;
310 } irqchip; 318 } irqchip;
311 struct msi_msg msi; 319 struct msi_msg msi;
320 struct kvm_s390_adapter_int adapter;
312 }; 321 };
313 struct hlist_node link; 322 struct hlist_node link;
314}; 323};
@@ -401,7 +410,9 @@ struct kvm {
401 unsigned long mmu_notifier_seq; 410 unsigned long mmu_notifier_seq;
402 long mmu_notifier_count; 411 long mmu_notifier_count;
403#endif 412#endif
404 long tlbs_dirty; 413 /* Protected by mmu_lock */
414 bool tlbs_dirty;
415
405 struct list_head devices; 416 struct list_head devices;
406}; 417};
407 418
@@ -911,7 +922,11 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
911 922
912#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING 923#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
913 924
925#ifdef CONFIG_S390
926#define KVM_MAX_IRQ_ROUTES 4096 //FIXME: we can have more than that...
927#else
914#define KVM_MAX_IRQ_ROUTES 1024 928#define KVM_MAX_IRQ_ROUTES 1024
929#endif
915 930
916int kvm_setup_default_irq_routing(struct kvm *kvm); 931int kvm_setup_default_irq_routing(struct kvm *kvm);
917int kvm_set_irq_routing(struct kvm *kvm, 932int kvm_set_irq_routing(struct kvm *kvm,
@@ -1064,6 +1079,7 @@ extern struct kvm_device_ops kvm_mpic_ops;
1064extern struct kvm_device_ops kvm_xics_ops; 1079extern struct kvm_device_ops kvm_xics_ops;
1065extern struct kvm_device_ops kvm_vfio_ops; 1080extern struct kvm_device_ops kvm_vfio_ops;
1066extern struct kvm_device_ops kvm_arm_vgic_v2_ops; 1081extern struct kvm_device_ops kvm_arm_vgic_v2_ops;
1082extern struct kvm_device_ops kvm_flic_ops;
1067 1083
1068#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 1084#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
1069 1085
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index 96549abe8842..0081f000e34b 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -25,6 +25,8 @@
25#include <linux/cpu.h> 25#include <linux/cpu.h>
26#include <linux/notifier.h> 26#include <linux/notifier.h>
27 27
28#ifdef CONFIG_SMP
29
28#ifdef CONFIG_DEBUG_LOCK_ALLOC 30#ifdef CONFIG_DEBUG_LOCK_ALLOC
29#define LOCKDEP_INIT_MAP lockdep_init_map 31#define LOCKDEP_INIT_MAP lockdep_init_map
30#else 32#else
@@ -57,4 +59,18 @@ void lg_local_unlock_cpu(struct lglock *lg, int cpu);
57void lg_global_lock(struct lglock *lg); 59void lg_global_lock(struct lglock *lg);
58void lg_global_unlock(struct lglock *lg); 60void lg_global_unlock(struct lglock *lg);
59 61
62#else
63/* When !CONFIG_SMP, map lglock to spinlock */
64#define lglock spinlock
65#define DEFINE_LGLOCK(name) DEFINE_SPINLOCK(name)
66#define DEFINE_STATIC_LGLOCK(name) static DEFINE_SPINLOCK(name)
67#define lg_lock_init(lg, name) spin_lock_init(lg)
68#define lg_local_lock spin_lock
69#define lg_local_unlock spin_unlock
70#define lg_local_lock_cpu(lg, cpu) spin_lock(lg)
71#define lg_local_unlock_cpu(lg, cpu) spin_unlock(lg)
72#define lg_global_lock spin_lock
73#define lg_global_unlock spin_unlock
74#endif
75
60#endif 76#endif
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
index 3ce541753c88..f3434533fbf8 100644
--- a/include/linux/list_lru.h
+++ b/include/linux/list_lru.h
@@ -13,6 +13,8 @@
13/* list_lru_walk_cb has to always return one of those */ 13/* list_lru_walk_cb has to always return one of those */
14enum lru_status { 14enum lru_status {
15 LRU_REMOVED, /* item removed from list */ 15 LRU_REMOVED, /* item removed from list */
16 LRU_REMOVED_RETRY, /* item removed, but lock has been
17 dropped and reacquired */
16 LRU_ROTATE, /* item referenced, give another pass */ 18 LRU_ROTATE, /* item referenced, give another pass */
17 LRU_SKIP, /* item cannot be locked, skip */ 19 LRU_SKIP, /* item cannot be locked, skip */
18 LRU_RETRY, /* item not freeable. May drop the lock 20 LRU_RETRY, /* item not freeable. May drop the lock
@@ -32,7 +34,11 @@ struct list_lru {
32}; 34};
33 35
34void list_lru_destroy(struct list_lru *lru); 36void list_lru_destroy(struct list_lru *lru);
35int list_lru_init(struct list_lru *lru); 37int list_lru_init_key(struct list_lru *lru, struct lock_class_key *key);
38static inline int list_lru_init(struct list_lru *lru)
39{
40 return list_lru_init_key(lru, NULL);
41}
36 42
37/** 43/**
38 * list_lru_add: add an element to the lru list's tail 44 * list_lru_add: add an element to the lru list's tail
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index 5525d370701d..6a392e7a723a 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -3,19 +3,21 @@
3 3
4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
5*/ 5*/
6
7struct mb_cache_entry { 6struct mb_cache_entry {
8 struct list_head e_lru_list; 7 struct list_head e_lru_list;
9 struct mb_cache *e_cache; 8 struct mb_cache *e_cache;
10 unsigned short e_used; 9 unsigned short e_used;
11 unsigned short e_queued; 10 unsigned short e_queued;
11 atomic_t e_refcnt;
12 struct block_device *e_bdev; 12 struct block_device *e_bdev;
13 sector_t e_block; 13 sector_t e_block;
14 struct list_head e_block_list; 14 struct hlist_bl_node e_block_list;
15 struct { 15 struct {
16 struct list_head o_list; 16 struct hlist_bl_node o_list;
17 unsigned int o_key; 17 unsigned int o_key;
18 } e_index; 18 } e_index;
19 struct hlist_bl_head *e_block_hash_p;
20 struct hlist_bl_head *e_index_hash_p;
19}; 21};
20 22
21struct mb_cache { 23struct mb_cache {
@@ -25,8 +27,8 @@ struct mb_cache {
25 int c_max_entries; 27 int c_max_entries;
26 int c_bucket_bits; 28 int c_bucket_bits;
27 struct kmem_cache *c_entry_cache; 29 struct kmem_cache *c_entry_cache;
28 struct list_head *c_block_hash; 30 struct hlist_bl_head *c_block_hash;
29 struct list_head *c_index_hash; 31 struct hlist_bl_head *c_index_hash;
30}; 32};
31 33
32/* Functions on caches */ 34/* Functions on caches */
diff --git a/include/linux/mcb.h b/include/linux/mcb.h
new file mode 100644
index 000000000000..2db284d14064
--- /dev/null
+++ b/include/linux/mcb.h
@@ -0,0 +1,119 @@
1/*
2 * MEN Chameleon Bus.
3 *
4 * Copyright (C) 2014 MEN Mikroelektronik GmbH (www.men.de)
5 * Author: Johannes Thumshirn <johannes.thumshirn@men.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; version 2 of the License.
10 */
11#ifndef _LINUX_MCB_H
12#define _LINUX_MCB_H
13
14#include <linux/mod_devicetable.h>
15#include <linux/device.h>
16#include <linux/irqreturn.h>
17
18struct mcb_driver;
19
20/**
21 * struct mcb_bus - MEN Chameleon Bus
22 *
23 * @dev: pointer to carrier device
24 * @children: the child busses
25 * @bus_nr: mcb bus number
26 */
27struct mcb_bus {
28 struct list_head children;
29 struct device dev;
30 int bus_nr;
31};
32#define to_mcb_bus(b) container_of((b), struct mcb_bus, dev)
33
34/**
35 * struct mcb_device - MEN Chameleon Bus device
36 *
37 * @bus_list: internal list handling for bus code
38 * @dev: device in kernel representation
39 * @bus: mcb bus the device is plugged to
40 * @subordinate: subordinate MCBus in case of bridge
41 * @is_added: flag to check if device is added to bus
42 * @driver: associated mcb_driver
43 * @id: mcb device id
44 * @inst: instance in Chameleon table
45 * @group: group in Chameleon table
46 * @var: variant in Chameleon table
47 * @bar: BAR in Chameleon table
48 * @rev: revision in Chameleon table
49 * @irq: IRQ resource
50 * @memory: memory resource
51 */
52struct mcb_device {
53 struct list_head bus_list;
54 struct device dev;
55 struct mcb_bus *bus;
56 struct mcb_bus *subordinate;
57 bool is_added;
58 struct mcb_driver *driver;
59 u16 id;
60 int inst;
61 int group;
62 int var;
63 int bar;
64 int rev;
65 struct resource irq;
66 struct resource mem;
67};
68#define to_mcb_device(x) container_of((x), struct mcb_device, dev)
69
70/**
71 * struct mcb_driver - MEN Chameleon Bus device driver
72 *
73 * @driver: device_driver
74 * @id_table: mcb id table
75 * @probe: probe callback
76 * @remove: remove callback
77 * @shutdown: shutdown callback
78 */
79struct mcb_driver {
80 struct device_driver driver;
81 const struct mcb_device_id *id_table;
82 int (*probe)(struct mcb_device *mdev, const struct mcb_device_id *id);
83 void (*remove)(struct mcb_device *mdev);
84 void (*shutdown)(struct mcb_device *mdev);
85};
86#define to_mcb_driver(x) container_of((x), struct mcb_driver, driver)
87
88static inline void *mcb_get_drvdata(struct mcb_device *dev)
89{
90 return dev_get_drvdata(&dev->dev);
91}
92
93static inline void mcb_set_drvdata(struct mcb_device *dev, void *data)
94{
95 dev_set_drvdata(&dev->dev, data);
96}
97
98extern int __must_check __mcb_register_driver(struct mcb_driver *drv,
99 struct module *owner,
100 const char *mod_name);
101#define mcb_register_driver(driver) \
102 __mcb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
103extern void mcb_unregister_driver(struct mcb_driver *driver);
104#define module_mcb_driver(__mcb_driver) \
105 module_driver(__mcb_driver, mcb_register_driver, mcb_unregister_driver);
106extern void mcb_bus_add_devices(const struct mcb_bus *bus);
107extern int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev);
108extern struct mcb_bus *mcb_alloc_bus(void);
109extern struct mcb_bus *mcb_bus_get(struct mcb_bus *bus);
110extern void mcb_bus_put(struct mcb_bus *bus);
111extern struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus);
112extern void mcb_free_dev(struct mcb_device *dev);
113extern void mcb_release_bus(struct mcb_bus *bus);
114extern struct resource *mcb_request_mem(struct mcb_device *dev,
115 const char *name);
116extern void mcb_release_mem(struct resource *mem);
117extern int mcb_get_irq(struct mcb_device *dev);
118
119#endif /* _LINUX_MCB_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 1ef66360f0b0..8a20a51ed42d 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -252,6 +252,8 @@ static inline void memblock_dump_all(void)
252void memblock_set_current_limit(phys_addr_t limit); 252void memblock_set_current_limit(phys_addr_t limit);
253 253
254 254
255phys_addr_t memblock_get_current_limit(void);
256
255/* 257/*
256 * pfn conversion functions 258 * pfn conversion functions
257 * 259 *
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index abd0113b6620..b569b8be5c5a 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -65,7 +65,7 @@ struct mem_cgroup_reclaim_cookie {
65 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.) 65 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
66 */ 66 */
67 67
68extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm, 68extern int mem_cgroup_charge_anon(struct page *page, struct mm_struct *mm,
69 gfp_t gfp_mask); 69 gfp_t gfp_mask);
70/* for swap handling */ 70/* for swap handling */
71extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 71extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
@@ -74,7 +74,7 @@ extern void mem_cgroup_commit_charge_swapin(struct page *page,
74 struct mem_cgroup *memcg); 74 struct mem_cgroup *memcg);
75extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg); 75extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
76 76
77extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 77extern int mem_cgroup_charge_file(struct page *page, struct mm_struct *mm,
78 gfp_t gfp_mask); 78 gfp_t gfp_mask);
79 79
80struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); 80struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
@@ -94,7 +94,6 @@ bool task_in_mem_cgroup(struct task_struct *task,
94 94
95extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); 95extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
96extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 96extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
97extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
98 97
99extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg); 98extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
100extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css); 99extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css);
@@ -162,7 +161,7 @@ extern int do_swap_account;
162 161
163static inline bool mem_cgroup_disabled(void) 162static inline bool mem_cgroup_disabled(void)
164{ 163{
165 if (mem_cgroup_subsys.disabled) 164 if (memory_cgrp_subsys.disabled)
166 return true; 165 return true;
167 return false; 166 return false;
168} 167}
@@ -234,13 +233,13 @@ void mem_cgroup_print_bad_page(struct page *page);
234#else /* CONFIG_MEMCG */ 233#else /* CONFIG_MEMCG */
235struct mem_cgroup; 234struct mem_cgroup;
236 235
237static inline int mem_cgroup_newpage_charge(struct page *page, 236static inline int mem_cgroup_charge_anon(struct page *page,
238 struct mm_struct *mm, gfp_t gfp_mask) 237 struct mm_struct *mm, gfp_t gfp_mask)
239{ 238{
240 return 0; 239 return 0;
241} 240}
242 241
243static inline int mem_cgroup_cache_charge(struct page *page, 242static inline int mem_cgroup_charge_file(struct page *page,
244 struct mm_struct *mm, gfp_t gfp_mask) 243 struct mm_struct *mm, gfp_t gfp_mask)
245{ 244{
246 return 0; 245 return 0;
@@ -294,11 +293,6 @@ static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
294 return NULL; 293 return NULL;
295} 294}
296 295
297static inline struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
298{
299 return NULL;
300}
301
302static inline bool mm_match_cgroup(struct mm_struct *mm, 296static inline bool mm_match_cgroup(struct mm_struct *mm,
303 struct mem_cgroup *memcg) 297 struct mem_cgroup *memcg)
304{ 298{
@@ -497,6 +491,9 @@ void __memcg_kmem_commit_charge(struct page *page,
497void __memcg_kmem_uncharge_pages(struct page *page, int order); 491void __memcg_kmem_uncharge_pages(struct page *page, int order);
498 492
499int memcg_cache_id(struct mem_cgroup *memcg); 493int memcg_cache_id(struct mem_cgroup *memcg);
494
495char *memcg_create_cache_name(struct mem_cgroup *memcg,
496 struct kmem_cache *root_cache);
500int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s, 497int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s,
501 struct kmem_cache *root_cache); 498 struct kmem_cache *root_cache);
502void memcg_free_cache_params(struct kmem_cache *s); 499void memcg_free_cache_params(struct kmem_cache *s);
@@ -510,7 +507,7 @@ struct kmem_cache *
510__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp); 507__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp);
511 508
512void mem_cgroup_destroy_cache(struct kmem_cache *cachep); 509void mem_cgroup_destroy_cache(struct kmem_cache *cachep);
513void kmem_cache_destroy_memcg_children(struct kmem_cache *s); 510int __kmem_cache_destroy_memcg_children(struct kmem_cache *s);
514 511
515/** 512/**
516 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed. 513 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed.
@@ -664,10 +661,6 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
664{ 661{
665 return cachep; 662 return cachep;
666} 663}
667
668static inline void kmem_cache_destroy_memcg_children(struct kmem_cache *s)
669{
670}
671#endif /* CONFIG_MEMCG_KMEM */ 664#endif /* CONFIG_MEMCG_KMEM */
672#endif /* _LINUX_MEMCONTROL_H */ 665#endif /* _LINUX_MEMCONTROL_H */
673 666
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 5f1ea756aace..3c1b968da0ca 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -143,7 +143,6 @@ extern void numa_policy_init(void);
143extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new, 143extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new,
144 enum mpol_rebind_step step); 144 enum mpol_rebind_step step);
145extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 145extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
146extern void mpol_fix_fork_child_flag(struct task_struct *p);
147 146
148extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 147extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
149 unsigned long addr, gfp_t gfp_flags, 148 unsigned long addr, gfp_t gfp_flags,
@@ -151,7 +150,7 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
151extern bool init_nodemask_of_mempolicy(nodemask_t *mask); 150extern bool init_nodemask_of_mempolicy(nodemask_t *mask);
152extern bool mempolicy_nodemask_intersects(struct task_struct *tsk, 151extern bool mempolicy_nodemask_intersects(struct task_struct *tsk,
153 const nodemask_t *mask); 152 const nodemask_t *mask);
154extern unsigned slab_node(void); 153extern unsigned int mempolicy_slab_node(void);
155 154
156extern enum zone_type policy_zone; 155extern enum zone_type policy_zone;
157 156
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index a86ca1406fb8..4e7fe7417fc9 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -347,7 +347,6 @@ struct ab8500 {
347 struct mutex lock; 347 struct mutex lock;
348 struct mutex irq_lock; 348 struct mutex irq_lock;
349 atomic_t transfer_ongoing; 349 atomic_t transfer_ongoing;
350 int irq_base;
351 int irq; 350 int irq;
352 struct irq_domain *domain; 351 struct irq_domain *domain;
353 enum ab8500_version version; 352 enum ab8500_version version;
@@ -378,7 +377,6 @@ struct ab8500_sysctrl_platform_data;
378 * @regulator: machine-specific constraints for regulators 377 * @regulator: machine-specific constraints for regulators
379 */ 378 */
380struct ab8500_platform_data { 379struct ab8500_platform_data {
381 int irq_base;
382 void (*init) (struct ab8500 *); 380 void (*init) (struct ab8500 *);
383 struct ab8500_regulator_platform_data *regulator; 381 struct ab8500_regulator_platform_data *regulator;
384 struct ab8500_codec_platform_data *codec; 382 struct ab8500_codec_platform_data *codec;
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index fdf3aa376eb2..7b35c21170d5 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -1034,6 +1034,27 @@
1034#define ARIZONA_DSP1_STATUS_1 0x1104 1034#define ARIZONA_DSP1_STATUS_1 0x1104
1035#define ARIZONA_DSP1_STATUS_2 0x1105 1035#define ARIZONA_DSP1_STATUS_2 0x1105
1036#define ARIZONA_DSP1_STATUS_3 0x1106 1036#define ARIZONA_DSP1_STATUS_3 0x1106
1037#define ARIZONA_DSP1_STATUS_4 0x1107
1038#define ARIZONA_DSP1_WDMA_BUFFER_1 0x1110
1039#define ARIZONA_DSP1_WDMA_BUFFER_2 0x1111
1040#define ARIZONA_DSP1_WDMA_BUFFER_3 0x1112
1041#define ARIZONA_DSP1_WDMA_BUFFER_4 0x1113
1042#define ARIZONA_DSP1_WDMA_BUFFER_5 0x1114
1043#define ARIZONA_DSP1_WDMA_BUFFER_6 0x1115
1044#define ARIZONA_DSP1_WDMA_BUFFER_7 0x1116
1045#define ARIZONA_DSP1_WDMA_BUFFER_8 0x1117
1046#define ARIZONA_DSP1_RDMA_BUFFER_1 0x1120
1047#define ARIZONA_DSP1_RDMA_BUFFER_2 0x1121
1048#define ARIZONA_DSP1_RDMA_BUFFER_3 0x1122
1049#define ARIZONA_DSP1_RDMA_BUFFER_4 0x1123
1050#define ARIZONA_DSP1_RDMA_BUFFER_5 0x1124
1051#define ARIZONA_DSP1_RDMA_BUFFER_6 0x1125
1052#define ARIZONA_DSP1_WDMA_CONFIG_1 0x1130
1053#define ARIZONA_DSP1_WDMA_CONFIG_2 0x1131
1054#define ARIZONA_DSP1_WDMA_OFFSET_1 0x1132
1055#define ARIZONA_DSP1_RDMA_CONFIG_1 0x1134
1056#define ARIZONA_DSP1_RDMA_OFFSET_1 0x1135
1057#define ARIZONA_DSP1_EXTERNAL_START_SELECT_1 0x1138
1037#define ARIZONA_DSP1_SCRATCH_0 0x1140 1058#define ARIZONA_DSP1_SCRATCH_0 0x1140
1038#define ARIZONA_DSP1_SCRATCH_1 0x1141 1059#define ARIZONA_DSP1_SCRATCH_1 0x1141
1039#define ARIZONA_DSP1_SCRATCH_2 0x1142 1060#define ARIZONA_DSP1_SCRATCH_2 0x1142
@@ -1043,6 +1064,27 @@
1043#define ARIZONA_DSP2_STATUS_1 0x1204 1064#define ARIZONA_DSP2_STATUS_1 0x1204
1044#define ARIZONA_DSP2_STATUS_2 0x1205 1065#define ARIZONA_DSP2_STATUS_2 0x1205
1045#define ARIZONA_DSP2_STATUS_3 0x1206 1066#define ARIZONA_DSP2_STATUS_3 0x1206
1067#define ARIZONA_DSP2_STATUS_4 0x1207
1068#define ARIZONA_DSP2_WDMA_BUFFER_1 0x1210
1069#define ARIZONA_DSP2_WDMA_BUFFER_2 0x1211
1070#define ARIZONA_DSP2_WDMA_BUFFER_3 0x1212
1071#define ARIZONA_DSP2_WDMA_BUFFER_4 0x1213
1072#define ARIZONA_DSP2_WDMA_BUFFER_5 0x1214
1073#define ARIZONA_DSP2_WDMA_BUFFER_6 0x1215
1074#define ARIZONA_DSP2_WDMA_BUFFER_7 0x1216
1075#define ARIZONA_DSP2_WDMA_BUFFER_8 0x1217
1076#define ARIZONA_DSP2_RDMA_BUFFER_1 0x1220
1077#define ARIZONA_DSP2_RDMA_BUFFER_2 0x1221
1078#define ARIZONA_DSP2_RDMA_BUFFER_3 0x1222
1079#define ARIZONA_DSP2_RDMA_BUFFER_4 0x1223
1080#define ARIZONA_DSP2_RDMA_BUFFER_5 0x1224
1081#define ARIZONA_DSP2_RDMA_BUFFER_6 0x1225
1082#define ARIZONA_DSP2_WDMA_CONFIG_1 0x1230
1083#define ARIZONA_DSP2_WDMA_CONFIG_2 0x1231
1084#define ARIZONA_DSP2_WDMA_OFFSET_1 0x1232
1085#define ARIZONA_DSP2_RDMA_CONFIG_1 0x1234
1086#define ARIZONA_DSP2_RDMA_OFFSET_1 0x1235
1087#define ARIZONA_DSP2_EXTERNAL_START_SELECT_1 0x1238
1046#define ARIZONA_DSP2_SCRATCH_0 0x1240 1088#define ARIZONA_DSP2_SCRATCH_0 0x1240
1047#define ARIZONA_DSP2_SCRATCH_1 0x1241 1089#define ARIZONA_DSP2_SCRATCH_1 0x1241
1048#define ARIZONA_DSP2_SCRATCH_2 0x1242 1090#define ARIZONA_DSP2_SCRATCH_2 0x1242
@@ -1052,6 +1094,27 @@
1052#define ARIZONA_DSP3_STATUS_1 0x1304 1094#define ARIZONA_DSP3_STATUS_1 0x1304
1053#define ARIZONA_DSP3_STATUS_2 0x1305 1095#define ARIZONA_DSP3_STATUS_2 0x1305
1054#define ARIZONA_DSP3_STATUS_3 0x1306 1096#define ARIZONA_DSP3_STATUS_3 0x1306
1097#define ARIZONA_DSP3_STATUS_4 0x1307
1098#define ARIZONA_DSP3_WDMA_BUFFER_1 0x1310
1099#define ARIZONA_DSP3_WDMA_BUFFER_2 0x1311
1100#define ARIZONA_DSP3_WDMA_BUFFER_3 0x1312
1101#define ARIZONA_DSP3_WDMA_BUFFER_4 0x1313
1102#define ARIZONA_DSP3_WDMA_BUFFER_5 0x1314
1103#define ARIZONA_DSP3_WDMA_BUFFER_6 0x1315
1104#define ARIZONA_DSP3_WDMA_BUFFER_7 0x1316
1105#define ARIZONA_DSP3_WDMA_BUFFER_8 0x1317
1106#define ARIZONA_DSP3_RDMA_BUFFER_1 0x1320
1107#define ARIZONA_DSP3_RDMA_BUFFER_2 0x1321
1108#define ARIZONA_DSP3_RDMA_BUFFER_3 0x1322
1109#define ARIZONA_DSP3_RDMA_BUFFER_4 0x1323
1110#define ARIZONA_DSP3_RDMA_BUFFER_5 0x1324
1111#define ARIZONA_DSP3_RDMA_BUFFER_6 0x1325
1112#define ARIZONA_DSP3_WDMA_CONFIG_1 0x1330
1113#define ARIZONA_DSP3_WDMA_CONFIG_2 0x1331
1114#define ARIZONA_DSP3_WDMA_OFFSET_1 0x1332
1115#define ARIZONA_DSP3_RDMA_CONFIG_1 0x1334
1116#define ARIZONA_DSP3_RDMA_OFFSET_1 0x1335
1117#define ARIZONA_DSP3_EXTERNAL_START_SELECT_1 0x1338
1055#define ARIZONA_DSP3_SCRATCH_0 0x1340 1118#define ARIZONA_DSP3_SCRATCH_0 0x1340
1056#define ARIZONA_DSP3_SCRATCH_1 0x1341 1119#define ARIZONA_DSP3_SCRATCH_1 0x1341
1057#define ARIZONA_DSP3_SCRATCH_2 0x1342 1120#define ARIZONA_DSP3_SCRATCH_2 0x1342
@@ -1061,6 +1124,27 @@
1061#define ARIZONA_DSP4_STATUS_1 0x1404 1124#define ARIZONA_DSP4_STATUS_1 0x1404
1062#define ARIZONA_DSP4_STATUS_2 0x1405 1125#define ARIZONA_DSP4_STATUS_2 0x1405
1063#define ARIZONA_DSP4_STATUS_3 0x1406 1126#define ARIZONA_DSP4_STATUS_3 0x1406
1127#define ARIZONA_DSP4_STATUS_4 0x1407
1128#define ARIZONA_DSP4_WDMA_BUFFER_1 0x1410
1129#define ARIZONA_DSP4_WDMA_BUFFER_2 0x1411
1130#define ARIZONA_DSP4_WDMA_BUFFER_3 0x1412
1131#define ARIZONA_DSP4_WDMA_BUFFER_4 0x1413
1132#define ARIZONA_DSP4_WDMA_BUFFER_5 0x1414
1133#define ARIZONA_DSP4_WDMA_BUFFER_6 0x1415
1134#define ARIZONA_DSP4_WDMA_BUFFER_7 0x1416
1135#define ARIZONA_DSP4_WDMA_BUFFER_8 0x1417
1136#define ARIZONA_DSP4_RDMA_BUFFER_1 0x1420
1137#define ARIZONA_DSP4_RDMA_BUFFER_2 0x1421
1138#define ARIZONA_DSP4_RDMA_BUFFER_3 0x1422
1139#define ARIZONA_DSP4_RDMA_BUFFER_4 0x1423
1140#define ARIZONA_DSP4_RDMA_BUFFER_5 0x1424
1141#define ARIZONA_DSP4_RDMA_BUFFER_6 0x1425
1142#define ARIZONA_DSP4_WDMA_CONFIG_1 0x1430
1143#define ARIZONA_DSP4_WDMA_CONFIG_2 0x1431
1144#define ARIZONA_DSP4_WDMA_OFFSET_1 0x1432
1145#define ARIZONA_DSP4_RDMA_CONFIG_1 0x1434
1146#define ARIZONA_DSP4_RDMA_OFFSET_1 0x1435
1147#define ARIZONA_DSP4_EXTERNAL_START_SELECT_1 0x1438
1064#define ARIZONA_DSP4_SCRATCH_0 0x1440 1148#define ARIZONA_DSP4_SCRATCH_0 0x1440
1065#define ARIZONA_DSP4_SCRATCH_1 0x1441 1149#define ARIZONA_DSP4_SCRATCH_1 0x1441
1066#define ARIZONA_DSP4_SCRATCH_2 0x1442 1150#define ARIZONA_DSP4_SCRATCH_2 0x1442
@@ -1702,9 +1786,9 @@
1702/* 1786/*
1703 * R373 (0x175) - FLL1 Control 5 1787 * R373 (0x175) - FLL1 Control 5
1704 */ 1788 */
1705#define ARIZONA_FLL1_FRATIO_MASK 0x0700 /* FLL1_FRATIO - [10:8] */ 1789#define ARIZONA_FLL1_FRATIO_MASK 0x0F00 /* FLL1_FRATIO - [11:8] */
1706#define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [10:8] */ 1790#define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [11:8] */
1707#define ARIZONA_FLL1_FRATIO_WIDTH 3 /* FLL1_FRATIO - [10:8] */ 1791#define ARIZONA_FLL1_FRATIO_WIDTH 4 /* FLL1_FRATIO - [11:8] */
1708#define ARIZONA_FLL1_OUTDIV_MASK 0x000E /* FLL1_OUTDIV - [3:1] */ 1792#define ARIZONA_FLL1_OUTDIV_MASK 0x000E /* FLL1_OUTDIV - [3:1] */
1709#define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */ 1793#define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */
1710#define ARIZONA_FLL1_OUTDIV_WIDTH 3 /* FLL1_OUTDIV - [3:1] */ 1794#define ARIZONA_FLL1_OUTDIV_WIDTH 3 /* FLL1_OUTDIV - [3:1] */
diff --git a/include/linux/mfd/bcm590xx.h b/include/linux/mfd/bcm590xx.h
new file mode 100644
index 000000000000..434df2d4e587
--- /dev/null
+++ b/include/linux/mfd/bcm590xx.h
@@ -0,0 +1,31 @@
1/*
2 * Broadcom BCM590xx PMU
3 *
4 * Copyright 2014 Linaro Limited
5 * Author: Matt Porter <mporter@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_BCM590XX_H
15#define __LINUX_MFD_BCM590XX_H
16
17#include <linux/device.h>
18#include <linux/i2c.h>
19#include <linux/regmap.h>
20
21/* max register address */
22#define BCM590XX_MAX_REGISTER 0xe7
23
24struct bcm590xx {
25 struct device *dev;
26 struct i2c_client *i2c_client;
27 struct regmap *regmap;
28 unsigned int id;
29};
30
31#endif /* __LINUX_MFD_BCM590XX_H */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 21e21b81cc75..bba65f51a0b5 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -83,6 +83,7 @@ enum da9052_chip_id {
83 DA9053_AA, 83 DA9053_AA,
84 DA9053_BA, 84 DA9053_BA,
85 DA9053_BB, 85 DA9053_BB,
86 DA9053_BC,
86}; 87};
87 88
88struct da9052_pdata; 89struct da9052_pdata;
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 2d2a0af675fd..00a9aac5d1e8 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -33,6 +33,10 @@ enum da9063_models {
33 PMIC_DA9063 = 0x61, 33 PMIC_DA9063 = 0x61,
34}; 34};
35 35
36enum da9063_variant_codes {
37 PMIC_DA9063_BB = 0x5
38};
39
36/* Interrupts */ 40/* Interrupts */
37enum da9063_irqs { 41enum da9063_irqs {
38 DA9063_IRQ_ONKEY = 0, 42 DA9063_IRQ_ONKEY = 0,
@@ -72,7 +76,7 @@ struct da9063 {
72 /* Device */ 76 /* Device */
73 struct device *dev; 77 struct device *dev;
74 unsigned short model; 78 unsigned short model;
75 unsigned short revision; 79 unsigned char variant_code;
76 unsigned int flags; 80 unsigned int flags;
77 81
78 /* Control interface */ 82 /* Control interface */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
index 5834813fb5f3..09a85c699da1 100644
--- a/include/linux/mfd/da9063/registers.h
+++ b/include/linux/mfd/da9063/registers.h
@@ -17,11 +17,7 @@
17#define _DA9063_REG_H 17#define _DA9063_REG_H
18 18
19#define DA9063_I2C_PAGE_SEL_SHIFT 1 19#define DA9063_I2C_PAGE_SEL_SHIFT 1
20
21#define DA9063_EVENT_REG_NUM 4 20#define DA9063_EVENT_REG_NUM 4
22#define DA9210_EVENT_REG_NUM 2
23#define DA9063_EXT_EVENT_REG_NUM (DA9063_EVENT_REG_NUM + \
24 DA9210_EVENT_REG_NUM)
25 21
26/* Page selection I2C or SPI always in the begining of any page. */ 22/* Page selection I2C or SPI always in the begining of any page. */
27/* Page 0 : I2C access 0x000 - 0x0FF SPI access 0x000 - 0x07F */ 23/* Page 0 : I2C access 0x000 - 0x0FF SPI access 0x000 - 0x07F */
@@ -61,9 +57,9 @@
61#define DA9063_REG_GPIO_10_11 0x1A 57#define DA9063_REG_GPIO_10_11 0x1A
62#define DA9063_REG_GPIO_12_13 0x1B 58#define DA9063_REG_GPIO_12_13 0x1B
63#define DA9063_REG_GPIO_14_15 0x1C 59#define DA9063_REG_GPIO_14_15 0x1C
64#define DA9063_REG_GPIO_MODE_0_7 0x1D 60#define DA9063_REG_GPIO_MODE0_7 0x1D
65#define DA9063_REG_GPIO_MODE_8_15 0x1E 61#define DA9063_REG_GPIO_MODE8_15 0x1E
66#define DA9063_REG_GPIO_SWITCH_CONT 0x1F 62#define DA9063_REG_SWITCH_CONT 0x1F
67 63
68/* Regulator Control Registers */ 64/* Regulator Control Registers */
69#define DA9063_REG_BCORE2_CONT 0x20 65#define DA9063_REG_BCORE2_CONT 0x20
@@ -83,7 +79,7 @@
83#define DA9063_REG_LDO9_CONT 0x2E 79#define DA9063_REG_LDO9_CONT 0x2E
84#define DA9063_REG_LDO10_CONT 0x2F 80#define DA9063_REG_LDO10_CONT 0x2F
85#define DA9063_REG_LDO11_CONT 0x30 81#define DA9063_REG_LDO11_CONT 0x30
86#define DA9063_REG_VIB 0x31 82#define DA9063_REG_SUPPLIES 0x31
87#define DA9063_REG_DVC_1 0x32 83#define DA9063_REG_DVC_1 0x32
88#define DA9063_REG_DVC_2 0x33 84#define DA9063_REG_DVC_2 0x33
89 85
@@ -97,9 +93,9 @@
97#define DA9063_REG_ADCIN1_RES 0x3A 93#define DA9063_REG_ADCIN1_RES 0x3A
98#define DA9063_REG_ADCIN2_RES 0x3B 94#define DA9063_REG_ADCIN2_RES 0x3B
99#define DA9063_REG_ADCIN3_RES 0x3C 95#define DA9063_REG_ADCIN3_RES 0x3C
100#define DA9063_REG_MON1_RES 0x3D 96#define DA9063_REG_MON_A8_RES 0x3D
101#define DA9063_REG_MON2_RES 0x3E 97#define DA9063_REG_MON_A9_RES 0x3E
102#define DA9063_REG_MON3_RES 0x3F 98#define DA9063_REG_MON_A10_RES 0x3F
103 99
104/* RTC Calendar and Alarm Registers */ 100/* RTC Calendar and Alarm Registers */
105#define DA9063_REG_COUNT_S 0x40 101#define DA9063_REG_COUNT_S 0x40
@@ -108,15 +104,16 @@
108#define DA9063_REG_COUNT_D 0x43 104#define DA9063_REG_COUNT_D 0x43
109#define DA9063_REG_COUNT_MO 0x44 105#define DA9063_REG_COUNT_MO 0x44
110#define DA9063_REG_COUNT_Y 0x45 106#define DA9063_REG_COUNT_Y 0x45
111#define DA9063_REG_ALARM_MI 0x46 107#define DA9063_REG_ALARM_S 0x46
112#define DA9063_REG_ALARM_H 0x47 108#define DA9063_REG_ALARM_MI 0x47
113#define DA9063_REG_ALARM_D 0x48 109#define DA9063_REG_ALARM_H 0x48
114#define DA9063_REG_ALARM_MO 0x49 110#define DA9063_REG_ALARM_D 0x49
115#define DA9063_REG_ALARM_Y 0x4A 111#define DA9063_REG_ALARM_MO 0x4A
116#define DA9063_REG_SECOND_A 0x4B 112#define DA9063_REG_ALARM_Y 0x4B
117#define DA9063_REG_SECOND_B 0x4C 113#define DA9063_REG_SECOND_A 0x4C
118#define DA9063_REG_SECOND_C 0x4D 114#define DA9063_REG_SECOND_B 0x4D
119#define DA9063_REG_SECOND_D 0x4E 115#define DA9063_REG_SECOND_C 0x4E
116#define DA9063_REG_SECOND_D 0x4F
120 117
121/* Sequencer Control Registers */ 118/* Sequencer Control Registers */
122#define DA9063_REG_SEQ 0x81 119#define DA9063_REG_SEQ 0x81
@@ -226,35 +223,37 @@
226#define DA9063_REG_CONFIG_J 0x10F 223#define DA9063_REG_CONFIG_J 0x10F
227#define DA9063_REG_CONFIG_K 0x110 224#define DA9063_REG_CONFIG_K 0x110
228#define DA9063_REG_CONFIG_L 0x111 225#define DA9063_REG_CONFIG_L 0x111
229#define DA9063_REG_MON_REG_1 0x112 226#define DA9063_REG_CONFIG_M 0x112
230#define DA9063_REG_MON_REG_2 0x113 227#define DA9063_REG_CONFIG_N 0x113
231#define DA9063_REG_MON_REG_3 0x114 228
232#define DA9063_REG_MON_REG_4 0x115 229#define DA9063_REG_MON_REG_1 0x114
233#define DA9063_REG_MON_REG_5 0x116 230#define DA9063_REG_MON_REG_2 0x115
234#define DA9063_REG_MON_REG_6 0x117 231#define DA9063_REG_MON_REG_3 0x116
235#define DA9063_REG_TRIM_CLDR 0x118 232#define DA9063_REG_MON_REG_4 0x117
236 233#define DA9063_REG_MON_REG_5 0x11E
234#define DA9063_REG_MON_REG_6 0x11F
235#define DA9063_REG_TRIM_CLDR 0x120
237/* General Purpose Registers */ 236/* General Purpose Registers */
238#define DA9063_REG_GP_ID_0 0x119 237#define DA9063_REG_GP_ID_0 0x121
239#define DA9063_REG_GP_ID_1 0x11A 238#define DA9063_REG_GP_ID_1 0x122
240#define DA9063_REG_GP_ID_2 0x11B 239#define DA9063_REG_GP_ID_2 0x123
241#define DA9063_REG_GP_ID_3 0x11C 240#define DA9063_REG_GP_ID_3 0x124
242#define DA9063_REG_GP_ID_4 0x11D 241#define DA9063_REG_GP_ID_4 0x125
243#define DA9063_REG_GP_ID_5 0x11E 242#define DA9063_REG_GP_ID_5 0x126
244#define DA9063_REG_GP_ID_6 0x11F 243#define DA9063_REG_GP_ID_6 0x127
245#define DA9063_REG_GP_ID_7 0x120 244#define DA9063_REG_GP_ID_7 0x128
246#define DA9063_REG_GP_ID_8 0x121 245#define DA9063_REG_GP_ID_8 0x129
247#define DA9063_REG_GP_ID_9 0x122 246#define DA9063_REG_GP_ID_9 0x12A
248#define DA9063_REG_GP_ID_10 0x123 247#define DA9063_REG_GP_ID_10 0x12B
249#define DA9063_REG_GP_ID_11 0x124 248#define DA9063_REG_GP_ID_11 0x12C
250#define DA9063_REG_GP_ID_12 0x125 249#define DA9063_REG_GP_ID_12 0x12D
251#define DA9063_REG_GP_ID_13 0x126 250#define DA9063_REG_GP_ID_13 0x12E
252#define DA9063_REG_GP_ID_14 0x127 251#define DA9063_REG_GP_ID_14 0x12F
253#define DA9063_REG_GP_ID_15 0x128 252#define DA9063_REG_GP_ID_15 0x130
254#define DA9063_REG_GP_ID_16 0x129 253#define DA9063_REG_GP_ID_16 0x131
255#define DA9063_REG_GP_ID_17 0x12A 254#define DA9063_REG_GP_ID_17 0x132
256#define DA9063_REG_GP_ID_18 0x12B 255#define DA9063_REG_GP_ID_18 0x133
257#define DA9063_REG_GP_ID_19 0x12C 256#define DA9063_REG_GP_ID_19 0x134
258 257
259/* Chip ID and variant */ 258/* Chip ID and variant */
260#define DA9063_REG_CHIP_ID 0x181 259#define DA9063_REG_CHIP_ID 0x181
@@ -405,8 +404,10 @@
405/* DA9063_REG_CONTROL_B (addr=0x0F) */ 404/* DA9063_REG_CONTROL_B (addr=0x0F) */
406#define DA9063_CHG_SEL 0x01 405#define DA9063_CHG_SEL 0x01
407#define DA9063_WATCHDOG_PD 0x02 406#define DA9063_WATCHDOG_PD 0x02
407#define DA9063_RESET_BLINKING 0x04
408#define DA9063_NRES_MODE 0x08 408#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10 409#define DA9063_NONKEY_LOCK 0x10
410#define DA9063_BUCK_SLOWSTART 0x80
410 411
411/* DA9063_REG_CONTROL_C (addr=0x10) */ 412/* DA9063_REG_CONTROL_C (addr=0x10) */
412#define DA9063_DEBOUNCING_MASK 0x07 413#define DA9063_DEBOUNCING_MASK 0x07
@@ -466,6 +467,7 @@
466#define DA9063_GPADC_PAUSE 0x02 467#define DA9063_GPADC_PAUSE 0x02
467#define DA9063_PMIF_DIS 0x04 468#define DA9063_PMIF_DIS 0x04
468#define DA9063_HS2WIRE_DIS 0x08 469#define DA9063_HS2WIRE_DIS 0x08
470#define DA9063_CLDR_PAUSE 0x10
469#define DA9063_BBAT_DIS 0x20 471#define DA9063_BBAT_DIS 0x20
470#define DA9063_OUT_32K_PAUSE 0x40 472#define DA9063_OUT_32K_PAUSE 0x40
471#define DA9063_PMCONT_DIS 0x80 473#define DA9063_PMCONT_DIS 0x80
@@ -660,7 +662,7 @@
660#define DA9063_GPIO15_TYPE_GPO 0x04 662#define DA9063_GPIO15_TYPE_GPO 0x04
661#define DA9063_GPIO15_NO_WAKEUP 0x80 663#define DA9063_GPIO15_NO_WAKEUP 0x80
662 664
663/* DA9063_REG_GPIO_MODE_0_7 (addr=0x1D) */ 665/* DA9063_REG_GPIO_MODE0_7 (addr=0x1D) */
664#define DA9063_GPIO0_MODE 0x01 666#define DA9063_GPIO0_MODE 0x01
665#define DA9063_GPIO1_MODE 0x02 667#define DA9063_GPIO1_MODE 0x02
666#define DA9063_GPIO2_MODE 0x04 668#define DA9063_GPIO2_MODE 0x04
@@ -670,7 +672,7 @@
670#define DA9063_GPIO6_MODE 0x40 672#define DA9063_GPIO6_MODE 0x40
671#define DA9063_GPIO7_MODE 0x80 673#define DA9063_GPIO7_MODE 0x80
672 674
673/* DA9063_REG_GPIO_MODE_8_15 (addr=0x1E) */ 675/* DA9063_REG_GPIO_MODE8_15 (addr=0x1E) */
674#define DA9063_GPIO8_MODE 0x01 676#define DA9063_GPIO8_MODE 0x01
675#define DA9063_GPIO9_MODE 0x02 677#define DA9063_GPIO9_MODE 0x02
676#define DA9063_GPIO10_MODE 0x04 678#define DA9063_GPIO10_MODE 0x04
@@ -702,12 +704,12 @@
702#define DA9063_SWITCH_SR_5MV 0x10 704#define DA9063_SWITCH_SR_5MV 0x10
703#define DA9063_SWITCH_SR_10MV 0x20 705#define DA9063_SWITCH_SR_10MV 0x20
704#define DA9063_SWITCH_SR_50MV 0x30 706#define DA9063_SWITCH_SR_50MV 0x30
705#define DA9063_SWITCH_SR_DIS 0x40 707#define DA9063_CORE_SW_INTERNAL 0x40
706#define DA9063_CP_EN_MODE 0x80 708#define DA9063_CP_EN_MODE 0x80
707 709
708/* DA9063_REGL_Bxxxx_CONT common bits (addr=0x20-0x25) */ 710/* DA9063_REGL_Bxxxx_CONT common bits (addr=0x20-0x25) */
709#define DA9063_BUCK_EN 0x01 711#define DA9063_BUCK_EN 0x01
710#define DA9063_BUCK_GPI_MASK 0x06 712#define DA9063_BUCK_GPI_MASK 0x06
711#define DA9063_BUCK_GPI_OFF 0x00 713#define DA9063_BUCK_GPI_OFF 0x00
712#define DA9063_BUCK_GPI_GPIO1 0x02 714#define DA9063_BUCK_GPI_GPIO1 0x02
713#define DA9063_BUCK_GPI_GPIO2 0x04 715#define DA9063_BUCK_GPI_GPIO2 0x04
@@ -841,25 +843,27 @@
841#define DA9063_COUNT_YEAR_MASK 0x3F 843#define DA9063_COUNT_YEAR_MASK 0x3F
842#define DA9063_MONITOR 0x40 844#define DA9063_MONITOR 0x40
843 845
844/* DA9063_REG_ALARM_MI (addr=0x46) */ 846/* DA9063_REG_ALARM_S (addr=0x46) */
847#define DA9063_ALARM_S_MASK 0x3F
845#define DA9063_ALARM_STATUS_ALARM 0x80 848#define DA9063_ALARM_STATUS_ALARM 0x80
846#define DA9063_ALARM_STATUS_TICK 0x40 849#define DA9063_ALARM_STATUS_TICK 0x40
850/* DA9063_REG_ALARM_MI (addr=0x47) */
847#define DA9063_ALARM_MIN_MASK 0x3F 851#define DA9063_ALARM_MIN_MASK 0x3F
848 852
849/* DA9063_REG_ALARM_H (addr=0x47) */ 853/* DA9063_REG_ALARM_H (addr=0x48) */
850#define DA9063_ALARM_HOUR_MASK 0x1F 854#define DA9063_ALARM_HOUR_MASK 0x1F
851 855
852/* DA9063_REG_ALARM_D (addr=0x48) */ 856/* DA9063_REG_ALARM_D (addr=0x49) */
853#define DA9063_ALARM_DAY_MASK 0x1F 857#define DA9063_ALARM_DAY_MASK 0x1F
854 858
855/* DA9063_REG_ALARM_MO (addr=0x49) */ 859/* DA9063_REG_ALARM_MO (addr=0x4A) */
856#define DA9063_TICK_WAKE 0x20 860#define DA9063_TICK_WAKE 0x20
857#define DA9063_TICK_TYPE 0x10 861#define DA9063_TICK_TYPE 0x10
858#define DA9063_TICK_TYPE_SEC 0x00 862#define DA9063_TICK_TYPE_SEC 0x00
859#define DA9063_TICK_TYPE_MIN 0x10 863#define DA9063_TICK_TYPE_MIN 0x10
860#define DA9063_ALARM_MONTH_MASK 0x0F 864#define DA9063_ALARM_MONTH_MASK 0x0F
861 865
862/* DA9063_REG_ALARM_Y (addr=0x4A) */ 866/* DA9063_REG_ALARM_Y (addr=0x4B) */
863#define DA9063_TICK_ON 0x80 867#define DA9063_TICK_ON 0x80
864#define DA9063_ALARM_ON 0x40 868#define DA9063_ALARM_ON 0x40
865#define DA9063_ALARM_YEAR_MASK 0x3F 869#define DA9063_ALARM_YEAR_MASK 0x3F
@@ -906,7 +910,7 @@
906 910
907/* DA9063_REG_Bxxxx_CFG common bits (addr=0x9D-0xA2) */ 911/* DA9063_REG_Bxxxx_CFG common bits (addr=0x9D-0xA2) */
908#define DA9063_BUCK_FB_MASK 0x07 912#define DA9063_BUCK_FB_MASK 0x07
909#define DA9063_BUCK_PD_DIS_SHIFT 5 913#define DA9063_BUCK_PD_DIS_MASK 0x20
910#define DA9063_BUCK_MODE_MASK 0xC0 914#define DA9063_BUCK_MODE_MASK 0xC0
911#define DA9063_BUCK_MODE_MANUAL 0x00 915#define DA9063_BUCK_MODE_MANUAL 0x00
912#define DA9063_BUCK_MODE_SLEEP 0x40 916#define DA9063_BUCK_MODE_SLEEP 0x40
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index 060e11256fbc..bf5109d38a26 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -183,8 +183,6 @@ struct prcmu_pdata
183 bool enable_set_ddr_opp; 183 bool enable_set_ddr_opp;
184 bool enable_ape_opp_100_voltage; 184 bool enable_ape_opp_100_voltage;
185 struct ab8500_platform_data *ab_platdata; 185 struct ab8500_platform_data *ab_platdata;
186 int ab_irq;
187 int irq_base;
188 u32 version_offset; 186 u32 version_offset;
189 u32 legacy_offset; 187 u32 legacy_offset;
190 u32 adt_offset; 188 u32 adt_offset;
diff --git a/include/linux/mfd/lpc_ich.h b/include/linux/mfd/lpc_ich.h
index 3e1df644c407..8feac782fa83 100644
--- a/include/linux/mfd/lpc_ich.h
+++ b/include/linux/mfd/lpc_ich.h
@@ -21,23 +21,26 @@
21#define LPC_ICH_H 21#define LPC_ICH_H
22 22
23/* Watchdog resources */ 23/* Watchdog resources */
24#define ICH_RES_IO_TCO 0 24#define ICH_RES_IO_TCO 0
25#define ICH_RES_IO_SMI 1 25#define ICH_RES_IO_SMI 1
26#define ICH_RES_MEM_OFF 2 26#define ICH_RES_MEM_OFF 2
27#define ICH_RES_MEM_GCS 0 27#define ICH_RES_MEM_GCS_PMC 0
28 28
29/* GPIO resources */ 29/* GPIO resources */
30#define ICH_RES_GPIO 0 30#define ICH_RES_GPIO 0
31#define ICH_RES_GPE0 1 31#define ICH_RES_GPE0 1
32 32
33/* GPIO compatibility */ 33/* GPIO compatibility */
34#define ICH_I3100_GPIO 0x401 34enum {
35#define ICH_V5_GPIO 0x501 35 ICH_I3100_GPIO,
36#define ICH_V6_GPIO 0x601 36 ICH_V5_GPIO,
37#define ICH_V7_GPIO 0x701 37 ICH_V6_GPIO,
38#define ICH_V9_GPIO 0x801 38 ICH_V7_GPIO,
39#define ICH_V10CORP_GPIO 0xa01 39 ICH_V9_GPIO,
40#define ICH_V10CONS_GPIO 0xa11 40 ICH_V10CORP_GPIO,
41 ICH_V10CONS_GPIO,
42 AVOTON_GPIO,
43};
41 44
42struct lpc_ich_info { 45struct lpc_ich_info {
43 char name[32]; 46 char name[32];
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index a3d0185196d3..c9b332fb0d5d 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -248,14 +248,6 @@ enum max14577_charger_reg {
248/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */ 248/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
249#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000 249#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
250 250
251enum max14577_irq_source {
252 MAX14577_IRQ_INT1 = 0,
253 MAX14577_IRQ_INT2,
254 MAX14577_IRQ_INT3,
255
256 MAX14577_IRQ_REGS_NUM,
257};
258
259enum max14577_irq { 251enum max14577_irq {
260 /* INT1 */ 252 /* INT1 */
261 MAX14577_IRQ_INT1_ADC, 253 MAX14577_IRQ_INT1_ADC,
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index 247b021dfaaf..736d39c3ec0d 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -25,13 +25,8 @@
25#ifndef __MAX14577_H__ 25#ifndef __MAX14577_H__
26#define __MAX14577_H__ 26#define __MAX14577_H__
27 27
28#include <linux/mfd/max14577-private.h>
29#include <linux/regulator/consumer.h> 28#include <linux/regulator/consumer.h>
30 29
31/*
32 * MAX14577 Regulator
33 */
34
35/* MAX14577 regulator IDs */ 30/* MAX14577 regulator IDs */
36enum max14577_regulators { 31enum max14577_regulators {
37 MAX14577_SAFEOUT = 0, 32 MAX14577_SAFEOUT = 0,
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index ac39d910e70b..a326c850f046 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -104,6 +104,9 @@ enum {
104 MC13892_LED_R, 104 MC13892_LED_R,
105 MC13892_LED_G, 105 MC13892_LED_G,
106 MC13892_LED_B, 106 MC13892_LED_B,
107 /* MC34708 LED IDs */
108 MC34708_LED_R,
109 MC34708_LED_G,
107}; 110};
108 111
109struct mc13xxx_led_platform_data { 112struct mc13xxx_led_platform_data {
@@ -163,6 +166,9 @@ struct mc13xxx_leds_platform_data {
163#define MC13892_LED_C2_CURRENT_G(x) (((x) & 0x7) << 21) 166#define MC13892_LED_C2_CURRENT_G(x) (((x) & 0x7) << 21)
164/* MC13892 LED Control 3 */ 167/* MC13892 LED Control 3 */
165#define MC13892_LED_C3_CURRENT_B(x) (((x) & 0x7) << 9) 168#define MC13892_LED_C3_CURRENT_B(x) (((x) & 0x7) << 9)
169/* MC34708 LED Control 0 */
170#define MC34708_LED_C0_CURRENT_R(x) (((x) & 0x3) << 9)
171#define MC34708_LED_C0_CURRENT_G(x) (((x) & 0x3) << 21)
166 u32 led_control[MAX_LED_CONTROL_REGS]; 172 u32 led_control[MAX_LED_CONTROL_REGS];
167}; 173};
168 174
diff --git a/include/linux/mfd/pm8xxx/irq.h b/include/linux/mfd/pm8xxx/irq.h
deleted file mode 100644
index f83d6b43ecbb..000000000000
--- a/include/linux/mfd/pm8xxx/irq.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13/*
14 * Qualcomm PMIC irq 8xxx driver header file
15 *
16 */
17
18#ifndef __MFD_PM8XXX_IRQ_H
19#define __MFD_PM8XXX_IRQ_H
20
21#include <linux/errno.h>
22#include <linux/err.h>
23
24struct pm8xxx_irq_core_data {
25 u32 rev;
26 int nirqs;
27};
28
29struct pm8xxx_irq_platform_data {
30 int irq_base;
31 struct pm8xxx_irq_core_data irq_cdata;
32 int devirq;
33 int irq_trigger_flag;
34};
35
36struct pm_irq_chip;
37
38#ifdef CONFIG_MFD_PM8XXX_IRQ
39int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq);
40struct pm_irq_chip *pm8xxx_irq_init(struct device *dev,
41 const struct pm8xxx_irq_platform_data *pdata);
42int pm8xxx_irq_exit(struct pm_irq_chip *chip);
43#else
44static inline int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq)
45{
46 return -ENXIO;
47}
48static inline struct pm_irq_chip *pm8xxx_irq_init(
49 const struct device *dev,
50 const struct pm8xxx_irq_platform_data *pdata)
51{
52 return ERR_PTR(-ENXIO);
53}
54static inline int pm8xxx_irq_exit(struct pm_irq_chip *chip)
55{
56 return -ENXIO;
57}
58#endif /* CONFIG_MFD_PM8XXX_IRQ */
59#endif /* __MFD_PM8XXX_IRQ_H */
diff --git a/include/linux/mfd/pm8xxx/pm8921.h b/include/linux/mfd/pm8xxx/pm8921.h
deleted file mode 100644
index 00fa3de7659d..000000000000
--- a/include/linux/mfd/pm8xxx/pm8921.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13/*
14 * Qualcomm PMIC 8921 driver header file
15 *
16 */
17
18#ifndef __MFD_PM8921_H
19#define __MFD_PM8921_H
20
21#include <linux/mfd/pm8xxx/irq.h>
22
23#define PM8921_NR_IRQS 256
24
25struct pm8921_platform_data {
26 int irq_base;
27 struct pm8xxx_irq_platform_data *irq_pdata;
28};
29
30#endif
diff --git a/include/linux/mfd/pm8xxx/rtc.h b/include/linux/mfd/pm8xxx/rtc.h
deleted file mode 100644
index 14f1983eaecc..000000000000
--- a/include/linux/mfd/pm8xxx/rtc.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/* Copyright (c) 2010-2011, 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 __RTC_PM8XXX_H__
14#define __RTC_PM8XXX_H__
15
16#define PM8XXX_RTC_DEV_NAME "rtc-pm8xxx"
17/**
18 * struct pm8xxx_rtc_pdata - RTC driver platform data
19 * @rtc_write_enable: variable stating RTC write capability
20 */
21struct pm8xxx_rtc_platform_data {
22 bool rtc_write_enable;
23};
24
25#endif /* __RTC_PM8XXX_H__ */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index 443176ee1ab0..7c36cc55d2c7 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -45,6 +45,7 @@ struct platform_device;
45struct rtsx_slot { 45struct rtsx_slot {
46 struct platform_device *p_dev; 46 struct platform_device *p_dev;
47 void (*card_event)(struct platform_device *p_dev); 47 void (*card_event)(struct platform_device *p_dev);
48 void (*done_transfer)(struct platform_device *p_dev);
48}; 49};
49 50
50#endif 51#endif
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 0ce772105508..8d6bbd609ad9 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -144,7 +144,7 @@
144#define HOST_TO_DEVICE 0 144#define HOST_TO_DEVICE 0
145#define DEVICE_TO_HOST 1 145#define DEVICE_TO_HOST 1
146 146
147#define MAX_PHASE 31 147#define RTSX_PHASE_MAX 32
148#define RX_TUNING_CNT 3 148#define RX_TUNING_CNT 3
149 149
150/* SG descriptor */ 150/* SG descriptor */
@@ -943,6 +943,12 @@ void rtsx_pci_send_cmd_no_wait(struct rtsx_pcr *pcr);
943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout); 943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout);
944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist, 944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
945 int num_sg, bool read, int timeout); 945 int num_sg, bool read, int timeout);
946int rtsx_pci_dma_map_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
947 int num_sg, bool read);
948int rtsx_pci_dma_unmap_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
949 int num_sg, bool read);
950int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist,
951 int sg_count, bool read);
946int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 952int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
947int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 953int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
948int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card); 954int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card);
diff --git a/include/linux/mfd/rtsx_usb.h b/include/linux/mfd/rtsx_usb.h
new file mode 100644
index 000000000000..c446e4fd6b5c
--- /dev/null
+++ b/include/linux/mfd/rtsx_usb.h
@@ -0,0 +1,628 @@
1/* Driver for Realtek RTS5139 USB card reader
2 *
3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
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 version 2
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * Author:
18 * Roger Tseng <rogerable@realtek.com>
19 */
20
21#ifndef __RTSX_USB_H
22#define __RTSX_USB_H
23
24#include <linux/usb.h>
25
26/* related module names */
27#define RTSX_USB_SD_CARD 0
28#define RTSX_USB_MS_CARD 1
29
30/* endpoint numbers */
31#define EP_BULK_OUT 1
32#define EP_BULK_IN 2
33#define EP_INTR_IN 3
34
35/* USB vendor requests */
36#define RTSX_USB_REQ_REG_OP 0x00
37#define RTSX_USB_REQ_POLL 0x02
38
39/* miscellaneous parameters */
40#define MIN_DIV_N 60
41#define MAX_DIV_N 120
42
43#define MAX_PHASE 15
44#define RX_TUNING_CNT 3
45
46#define QFN24 0
47#define LQFP48 1
48#define CHECK_PKG(ucr, pkg) ((ucr)->package == (pkg))
49
50/* data structures */
51struct rtsx_ucr {
52 u16 vendor_id;
53 u16 product_id;
54
55 int package;
56 u8 ic_version;
57 bool is_rts5179;
58
59 unsigned int cur_clk;
60
61 u8 *cmd_buf;
62 unsigned int cmd_idx;
63 u8 *rsp_buf;
64
65 struct usb_device *pusb_dev;
66 struct usb_interface *pusb_intf;
67 struct usb_sg_request current_sg;
68 unsigned char *iobuf;
69 dma_addr_t iobuf_dma;
70
71 struct timer_list sg_timer;
72 struct mutex dev_mutex;
73};
74
75/* buffer size */
76#define IOBUF_SIZE 1024
77
78/* prototypes of exported functions */
79extern int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status);
80
81extern int rtsx_usb_read_register(struct rtsx_ucr *ucr, u16 addr, u8 *data);
82extern int rtsx_usb_write_register(struct rtsx_ucr *ucr, u16 addr, u8 mask,
83 u8 data);
84
85extern int rtsx_usb_ep0_write_register(struct rtsx_ucr *ucr, u16 addr, u8 mask,
86 u8 data);
87extern int rtsx_usb_ep0_read_register(struct rtsx_ucr *ucr, u16 addr,
88 u8 *data);
89
90extern void rtsx_usb_add_cmd(struct rtsx_ucr *ucr, u8 cmd_type,
91 u16 reg_addr, u8 mask, u8 data);
92extern int rtsx_usb_send_cmd(struct rtsx_ucr *ucr, u8 flag, int timeout);
93extern int rtsx_usb_get_rsp(struct rtsx_ucr *ucr, int rsp_len, int timeout);
94extern int rtsx_usb_transfer_data(struct rtsx_ucr *ucr, unsigned int pipe,
95 void *buf, unsigned int len, int use_sg,
96 unsigned int *act_len, int timeout);
97
98extern int rtsx_usb_read_ppbuf(struct rtsx_ucr *ucr, u8 *buf, int buf_len);
99extern int rtsx_usb_write_ppbuf(struct rtsx_ucr *ucr, u8 *buf, int buf_len);
100extern int rtsx_usb_switch_clock(struct rtsx_ucr *ucr, unsigned int card_clock,
101 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);
102extern int rtsx_usb_card_exclusive_check(struct rtsx_ucr *ucr, int card);
103
104/* card status */
105#define SD_CD 0x01
106#define MS_CD 0x02
107#define XD_CD 0x04
108#define CD_MASK (SD_CD | MS_CD | XD_CD)
109#define SD_WP 0x08
110
111/* reader command field offset & parameters */
112#define READ_REG_CMD 0
113#define WRITE_REG_CMD 1
114#define CHECK_REG_CMD 2
115
116#define PACKET_TYPE 4
117#define CNT_H 5
118#define CNT_L 6
119#define STAGE_FLAG 7
120#define CMD_OFFSET 8
121#define SEQ_WRITE_DATA_OFFSET 12
122
123#define BATCH_CMD 0
124#define SEQ_READ 1
125#define SEQ_WRITE 2
126
127#define STAGE_R 0x01
128#define STAGE_DI 0x02
129#define STAGE_DO 0x04
130#define STAGE_MS_STATUS 0x08
131#define STAGE_XD_STATUS 0x10
132#define MODE_C 0x00
133#define MODE_CR (STAGE_R)
134#define MODE_CDIR (STAGE_R | STAGE_DI)
135#define MODE_CDOR (STAGE_R | STAGE_DO)
136
137#define EP0_OP_SHIFT 14
138#define EP0_READ_REG_CMD 2
139#define EP0_WRITE_REG_CMD 3
140
141#define rtsx_usb_cmd_hdr_tag(ucr) \
142 do { \
143 ucr->cmd_buf[0] = 'R'; \
144 ucr->cmd_buf[1] = 'T'; \
145 ucr->cmd_buf[2] = 'C'; \
146 ucr->cmd_buf[3] = 'R'; \
147 } while (0)
148
149static inline void rtsx_usb_init_cmd(struct rtsx_ucr *ucr)
150{
151 rtsx_usb_cmd_hdr_tag(ucr);
152 ucr->cmd_idx = 0;
153 ucr->cmd_buf[PACKET_TYPE] = BATCH_CMD;
154}
155
156/* internal register address */
157#define FPDCTL 0xFC00
158#define SSC_DIV_N_0 0xFC07
159#define SSC_CTL1 0xFC09
160#define SSC_CTL2 0xFC0A
161#define CFG_MODE 0xFC0E
162#define CFG_MODE_1 0xFC0F
163#define RCCTL 0xFC14
164#define SOF_WDOG 0xFC28
165#define SYS_DUMMY0 0xFC30
166
167#define MS_BLKEND 0xFD30
168#define MS_READ_START 0xFD31
169#define MS_READ_COUNT 0xFD32
170#define MS_WRITE_START 0xFD33
171#define MS_WRITE_COUNT 0xFD34
172#define MS_COMMAND 0xFD35
173#define MS_OLD_BLOCK_0 0xFD36
174#define MS_OLD_BLOCK_1 0xFD37
175#define MS_NEW_BLOCK_0 0xFD38
176#define MS_NEW_BLOCK_1 0xFD39
177#define MS_LOG_BLOCK_0 0xFD3A
178#define MS_LOG_BLOCK_1 0xFD3B
179#define MS_BUS_WIDTH 0xFD3C
180#define MS_PAGE_START 0xFD3D
181#define MS_PAGE_LENGTH 0xFD3E
182#define MS_CFG 0xFD40
183#define MS_TPC 0xFD41
184#define MS_TRANS_CFG 0xFD42
185#define MS_TRANSFER 0xFD43
186#define MS_INT_REG 0xFD44
187#define MS_BYTE_CNT 0xFD45
188#define MS_SECTOR_CNT_L 0xFD46
189#define MS_SECTOR_CNT_H 0xFD47
190#define MS_DBUS_H 0xFD48
191
192#define CARD_DMA1_CTL 0xFD5C
193#define CARD_PULL_CTL1 0xFD60
194#define CARD_PULL_CTL2 0xFD61
195#define CARD_PULL_CTL3 0xFD62
196#define CARD_PULL_CTL4 0xFD63
197#define CARD_PULL_CTL5 0xFD64
198#define CARD_PULL_CTL6 0xFD65
199#define CARD_EXIST 0xFD6F
200#define CARD_INT_PEND 0xFD71
201
202#define LDO_POWER_CFG 0xFD7B
203
204#define SD_CFG1 0xFDA0
205#define SD_CFG2 0xFDA1
206#define SD_CFG3 0xFDA2
207#define SD_STAT1 0xFDA3
208#define SD_STAT2 0xFDA4
209#define SD_BUS_STAT 0xFDA5
210#define SD_PAD_CTL 0xFDA6
211#define SD_SAMPLE_POINT_CTL 0xFDA7
212#define SD_PUSH_POINT_CTL 0xFDA8
213#define SD_CMD0 0xFDA9
214#define SD_CMD1 0xFDAA
215#define SD_CMD2 0xFDAB
216#define SD_CMD3 0xFDAC
217#define SD_CMD4 0xFDAD
218#define SD_CMD5 0xFDAE
219#define SD_BYTE_CNT_L 0xFDAF
220#define SD_BYTE_CNT_H 0xFDB0
221#define SD_BLOCK_CNT_L 0xFDB1
222#define SD_BLOCK_CNT_H 0xFDB2
223#define SD_TRANSFER 0xFDB3
224#define SD_CMD_STATE 0xFDB5
225#define SD_DATA_STATE 0xFDB6
226#define SD_VPCLK0_CTL 0xFC2A
227#define SD_VPCLK1_CTL 0xFC2B
228#define SD_DCMPS0_CTL 0xFC2C
229#define SD_DCMPS1_CTL 0xFC2D
230
231#define CARD_DMA1_CTL 0xFD5C
232
233#define HW_VERSION 0xFC01
234
235#define SSC_CLK_FPGA_SEL 0xFC02
236#define CLK_DIV 0xFC03
237#define SFSM_ED 0xFC04
238
239#define CD_DEGLITCH_WIDTH 0xFC20
240#define CD_DEGLITCH_EN 0xFC21
241#define AUTO_DELINK_EN 0xFC23
242
243#define FPGA_PULL_CTL 0xFC1D
244#define CARD_CLK_SOURCE 0xFC2E
245
246#define CARD_SHARE_MODE 0xFD51
247#define CARD_DRIVE_SEL 0xFD52
248#define CARD_STOP 0xFD53
249#define CARD_OE 0xFD54
250#define CARD_AUTO_BLINK 0xFD55
251#define CARD_GPIO 0xFD56
252#define SD30_DRIVE_SEL 0xFD57
253
254#define CARD_DATA_SOURCE 0xFD5D
255#define CARD_SELECT 0xFD5E
256
257#define CARD_CLK_EN 0xFD79
258#define CARD_PWR_CTL 0xFD7A
259
260#define OCPCTL 0xFD80
261#define OCPPARA1 0xFD81
262#define OCPPARA2 0xFD82
263#define OCPSTAT 0xFD83
264
265#define HS_USB_STAT 0xFE01
266#define HS_VCONTROL 0xFE26
267#define HS_VSTAIN 0xFE27
268#define HS_VLOADM 0xFE28
269#define HS_VSTAOUT 0xFE29
270
271#define MC_IRQ 0xFF00
272#define MC_IRQEN 0xFF01
273#define MC_FIFO_CTL 0xFF02
274#define MC_FIFO_BC0 0xFF03
275#define MC_FIFO_BC1 0xFF04
276#define MC_FIFO_STAT 0xFF05
277#define MC_FIFO_MODE 0xFF06
278#define MC_FIFO_RD_PTR0 0xFF07
279#define MC_FIFO_RD_PTR1 0xFF08
280#define MC_DMA_CTL 0xFF10
281#define MC_DMA_TC0 0xFF11
282#define MC_DMA_TC1 0xFF12
283#define MC_DMA_TC2 0xFF13
284#define MC_DMA_TC3 0xFF14
285#define MC_DMA_RST 0xFF15
286
287#define RBUF_SIZE_MASK 0xFBFF
288#define RBUF_BASE 0xF000
289#define PPBUF_BASE1 0xF800
290#define PPBUF_BASE2 0xFA00
291
292/* internal register value macros */
293#define POWER_OFF 0x03
294#define PARTIAL_POWER_ON 0x02
295#define POWER_ON 0x00
296#define POWER_MASK 0x03
297#define LDO3318_PWR_MASK 0x0C
298#define LDO_ON 0x00
299#define LDO_SUSPEND 0x08
300#define LDO_OFF 0x0C
301#define DV3318_AUTO_PWR_OFF 0x10
302#define FORCE_LDO_POWERB 0x60
303
304/* LDO_POWER_CFG */
305#define TUNE_SD18_MASK 0x1C
306#define TUNE_SD18_1V7 0x00
307#define TUNE_SD18_1V8 (0x01 << 2)
308#define TUNE_SD18_1V9 (0x02 << 2)
309#define TUNE_SD18_2V0 (0x03 << 2)
310#define TUNE_SD18_2V7 (0x04 << 2)
311#define TUNE_SD18_2V8 (0x05 << 2)
312#define TUNE_SD18_2V9 (0x06 << 2)
313#define TUNE_SD18_3V3 (0x07 << 2)
314
315/* CLK_DIV */
316#define CLK_CHANGE 0x80
317#define CLK_DIV_1 0x00
318#define CLK_DIV_2 0x01
319#define CLK_DIV_4 0x02
320#define CLK_DIV_8 0x03
321
322#define SSC_POWER_MASK 0x01
323#define SSC_POWER_DOWN 0x01
324#define SSC_POWER_ON 0x00
325
326#define FPGA_VER 0x80
327#define HW_VER_MASK 0x0F
328
329#define EXTEND_DMA1_ASYNC_SIGNAL 0x02
330
331/* CFG_MODE*/
332#define XTAL_FREE 0x80
333#define CLK_MODE_MASK 0x03
334#define CLK_MODE_12M_XTAL 0x00
335#define CLK_MODE_NON_XTAL 0x01
336#define CLK_MODE_24M_OSC 0x02
337#define CLK_MODE_48M_OSC 0x03
338
339/* CFG_MODE_1*/
340#define RTS5179 0x02
341
342#define NYET_EN 0x01
343#define NYET_MSAK 0x01
344
345#define SD30_DRIVE_MASK 0x07
346#define SD20_DRIVE_MASK 0x03
347
348#define DISABLE_SD_CD 0x08
349#define DISABLE_MS_CD 0x10
350#define DISABLE_XD_CD 0x20
351#define SD_CD_DEGLITCH_EN 0x01
352#define MS_CD_DEGLITCH_EN 0x02
353#define XD_CD_DEGLITCH_EN 0x04
354
355#define CARD_SHARE_LQFP48 0x04
356#define CARD_SHARE_QFN24 0x00
357#define CARD_SHARE_LQFP_SEL 0x04
358#define CARD_SHARE_XD 0x00
359#define CARD_SHARE_SD 0x01
360#define CARD_SHARE_MS 0x02
361#define CARD_SHARE_MASK 0x03
362
363
364/* SD30_DRIVE_SEL */
365#define DRIVER_TYPE_A 0x05
366#define DRIVER_TYPE_B 0x03
367#define DRIVER_TYPE_C 0x02
368#define DRIVER_TYPE_D 0x01
369
370/* SD_BUS_STAT */
371#define SD_CLK_TOGGLE_EN 0x80
372#define SD_CLK_FORCE_STOP 0x40
373#define SD_DAT3_STATUS 0x10
374#define SD_DAT2_STATUS 0x08
375#define SD_DAT1_STATUS 0x04
376#define SD_DAT0_STATUS 0x02
377#define SD_CMD_STATUS 0x01
378
379/* SD_PAD_CTL */
380#define SD_IO_USING_1V8 0x80
381#define SD_IO_USING_3V3 0x7F
382#define TYPE_A_DRIVING 0x00
383#define TYPE_B_DRIVING 0x01
384#define TYPE_C_DRIVING 0x02
385#define TYPE_D_DRIVING 0x03
386
387/* CARD_CLK_EN */
388#define SD_CLK_EN 0x04
389#define MS_CLK_EN 0x08
390
391/* CARD_SELECT */
392#define SD_MOD_SEL 2
393#define MS_MOD_SEL 3
394
395/* CARD_SHARE_MODE */
396#define CARD_SHARE_LQFP48 0x04
397#define CARD_SHARE_QFN24 0x00
398#define CARD_SHARE_LQFP_SEL 0x04
399#define CARD_SHARE_XD 0x00
400#define CARD_SHARE_SD 0x01
401#define CARD_SHARE_MS 0x02
402#define CARD_SHARE_MASK 0x03
403
404/* SSC_CTL1 */
405#define SSC_RSTB 0x80
406#define SSC_8X_EN 0x40
407#define SSC_FIX_FRAC 0x20
408#define SSC_SEL_1M 0x00
409#define SSC_SEL_2M 0x08
410#define SSC_SEL_4M 0x10
411#define SSC_SEL_8M 0x18
412
413/* SSC_CTL2 */
414#define SSC_DEPTH_MASK 0x03
415#define SSC_DEPTH_DISALBE 0x00
416#define SSC_DEPTH_2M 0x01
417#define SSC_DEPTH_1M 0x02
418#define SSC_DEPTH_512K 0x03
419
420/* SD_VPCLK0_CTL */
421#define PHASE_CHANGE 0x80
422#define PHASE_NOT_RESET 0x40
423
424/* SD_TRANSFER */
425#define SD_TRANSFER_START 0x80
426#define SD_TRANSFER_END 0x40
427#define SD_STAT_IDLE 0x20
428#define SD_TRANSFER_ERR 0x10
429#define SD_TM_NORMAL_WRITE 0x00
430#define SD_TM_AUTO_WRITE_3 0x01
431#define SD_TM_AUTO_WRITE_4 0x02
432#define SD_TM_AUTO_READ_3 0x05
433#define SD_TM_AUTO_READ_4 0x06
434#define SD_TM_CMD_RSP 0x08
435#define SD_TM_AUTO_WRITE_1 0x09
436#define SD_TM_AUTO_WRITE_2 0x0A
437#define SD_TM_NORMAL_READ 0x0C
438#define SD_TM_AUTO_READ_1 0x0D
439#define SD_TM_AUTO_READ_2 0x0E
440#define SD_TM_AUTO_TUNING 0x0F
441
442/* SD_CFG1 */
443#define SD_CLK_DIVIDE_0 0x00
444#define SD_CLK_DIVIDE_256 0xC0
445#define SD_CLK_DIVIDE_128 0x80
446#define SD_CLK_DIVIDE_MASK 0xC0
447#define SD_BUS_WIDTH_1BIT 0x00
448#define SD_BUS_WIDTH_4BIT 0x01
449#define SD_BUS_WIDTH_8BIT 0x02
450#define SD_ASYNC_FIFO_RST 0x10
451#define SD_20_MODE 0x00
452#define SD_DDR_MODE 0x04
453#define SD_30_MODE 0x08
454
455/* SD_CFG2 */
456#define SD_CALCULATE_CRC7 0x00
457#define SD_NO_CALCULATE_CRC7 0x80
458#define SD_CHECK_CRC16 0x00
459#define SD_NO_CHECK_CRC16 0x40
460#define SD_WAIT_CRC_TO_EN 0x20
461#define SD_WAIT_BUSY_END 0x08
462#define SD_NO_WAIT_BUSY_END 0x00
463#define SD_CHECK_CRC7 0x00
464#define SD_NO_CHECK_CRC7 0x04
465#define SD_RSP_LEN_0 0x00
466#define SD_RSP_LEN_6 0x01
467#define SD_RSP_LEN_17 0x02
468#define SD_RSP_TYPE_R0 0x04
469#define SD_RSP_TYPE_R1 0x01
470#define SD_RSP_TYPE_R1b 0x09
471#define SD_RSP_TYPE_R2 0x02
472#define SD_RSP_TYPE_R3 0x05
473#define SD_RSP_TYPE_R4 0x05
474#define SD_RSP_TYPE_R5 0x01
475#define SD_RSP_TYPE_R6 0x01
476#define SD_RSP_TYPE_R7 0x01
477
478/* SD_STAT1 */
479#define SD_CRC7_ERR 0x80
480#define SD_CRC16_ERR 0x40
481#define SD_CRC_WRITE_ERR 0x20
482#define SD_CRC_WRITE_ERR_MASK 0x1C
483#define GET_CRC_TIME_OUT 0x02
484#define SD_TUNING_COMPARE_ERR 0x01
485
486/* SD_DATA_STATE */
487#define SD_DATA_IDLE 0x80
488
489/* CARD_DATA_SOURCE */
490#define PINGPONG_BUFFER 0x01
491#define RING_BUFFER 0x00
492
493/* CARD_OE */
494#define SD_OUTPUT_EN 0x04
495#define MS_OUTPUT_EN 0x08
496
497/* CARD_STOP */
498#define SD_STOP 0x04
499#define MS_STOP 0x08
500#define SD_CLR_ERR 0x40
501#define MS_CLR_ERR 0x80
502
503/* CARD_CLK_SOURCE */
504#define CRC_FIX_CLK (0x00 << 0)
505#define CRC_VAR_CLK0 (0x01 << 0)
506#define CRC_VAR_CLK1 (0x02 << 0)
507#define SD30_FIX_CLK (0x00 << 2)
508#define SD30_VAR_CLK0 (0x01 << 2)
509#define SD30_VAR_CLK1 (0x02 << 2)
510#define SAMPLE_FIX_CLK (0x00 << 4)
511#define SAMPLE_VAR_CLK0 (0x01 << 4)
512#define SAMPLE_VAR_CLK1 (0x02 << 4)
513
514/* SD_SAMPLE_POINT_CTL */
515#define DDR_FIX_RX_DAT 0x00
516#define DDR_VAR_RX_DAT 0x80
517#define DDR_FIX_RX_DAT_EDGE 0x00
518#define DDR_FIX_RX_DAT_14_DELAY 0x40
519#define DDR_FIX_RX_CMD 0x00
520#define DDR_VAR_RX_CMD 0x20
521#define DDR_FIX_RX_CMD_POS_EDGE 0x00
522#define DDR_FIX_RX_CMD_14_DELAY 0x10
523#define SD20_RX_POS_EDGE 0x00
524#define SD20_RX_14_DELAY 0x08
525#define SD20_RX_SEL_MASK 0x08
526
527/* SD_PUSH_POINT_CTL */
528#define DDR_FIX_TX_CMD_DAT 0x00
529#define DDR_VAR_TX_CMD_DAT 0x80
530#define DDR_FIX_TX_DAT_14_TSU 0x00
531#define DDR_FIX_TX_DAT_12_TSU 0x40
532#define DDR_FIX_TX_CMD_NEG_EDGE 0x00
533#define DDR_FIX_TX_CMD_14_AHEAD 0x20
534#define SD20_TX_NEG_EDGE 0x00
535#define SD20_TX_14_AHEAD 0x10
536#define SD20_TX_SEL_MASK 0x10
537#define DDR_VAR_SDCLK_POL_SWAP 0x01
538
539/* MS_CFG */
540#define SAMPLE_TIME_RISING 0x00
541#define SAMPLE_TIME_FALLING 0x80
542#define PUSH_TIME_DEFAULT 0x00
543#define PUSH_TIME_ODD 0x40
544#define NO_EXTEND_TOGGLE 0x00
545#define EXTEND_TOGGLE_CHK 0x20
546#define MS_BUS_WIDTH_1 0x00
547#define MS_BUS_WIDTH_4 0x10
548#define MS_BUS_WIDTH_8 0x18
549#define MS_2K_SECTOR_MODE 0x04
550#define MS_512_SECTOR_MODE 0x00
551#define MS_TOGGLE_TIMEOUT_EN 0x00
552#define MS_TOGGLE_TIMEOUT_DISEN 0x01
553#define MS_NO_CHECK_INT 0x02
554
555/* MS_TRANS_CFG */
556#define WAIT_INT 0x80
557#define NO_WAIT_INT 0x00
558#define NO_AUTO_READ_INT_REG 0x00
559#define AUTO_READ_INT_REG 0x40
560#define MS_CRC16_ERR 0x20
561#define MS_RDY_TIMEOUT 0x10
562#define MS_INT_CMDNK 0x08
563#define MS_INT_BREQ 0x04
564#define MS_INT_ERR 0x02
565#define MS_INT_CED 0x01
566
567/* MS_TRANSFER */
568#define MS_TRANSFER_START 0x80
569#define MS_TRANSFER_END 0x40
570#define MS_TRANSFER_ERR 0x20
571#define MS_BS_STATE 0x10
572#define MS_TM_READ_BYTES 0x00
573#define MS_TM_NORMAL_READ 0x01
574#define MS_TM_WRITE_BYTES 0x04
575#define MS_TM_NORMAL_WRITE 0x05
576#define MS_TM_AUTO_READ 0x08
577#define MS_TM_AUTO_WRITE 0x0C
578#define MS_TM_SET_CMD 0x06
579#define MS_TM_COPY_PAGE 0x07
580#define MS_TM_MULTI_READ 0x02
581#define MS_TM_MULTI_WRITE 0x03
582
583/* MC_FIFO_CTL */
584#define FIFO_FLUSH 0x01
585
586/* MC_DMA_RST */
587#define DMA_RESET 0x01
588
589/* MC_DMA_CTL */
590#define DMA_TC_EQ_0 0x80
591#define DMA_DIR_TO_CARD 0x00
592#define DMA_DIR_FROM_CARD 0x02
593#define DMA_EN 0x01
594#define DMA_128 (0 << 2)
595#define DMA_256 (1 << 2)
596#define DMA_512 (2 << 2)
597#define DMA_1024 (3 << 2)
598#define DMA_PACK_SIZE_MASK 0x0C
599
600/* CARD_INT_PEND */
601#define XD_INT 0x10
602#define MS_INT 0x08
603#define SD_INT 0x04
604
605/* LED operations*/
606static inline int rtsx_usb_turn_on_led(struct rtsx_ucr *ucr)
607{
608 return rtsx_usb_ep0_write_register(ucr, CARD_GPIO, 0x03, 0x02);
609}
610
611static inline int rtsx_usb_turn_off_led(struct rtsx_ucr *ucr)
612{
613 return rtsx_usb_ep0_write_register(ucr, CARD_GPIO, 0x03, 0x03);
614}
615
616/* HW error clearing */
617static inline void rtsx_usb_clear_fsm_err(struct rtsx_ucr *ucr)
618{
619 rtsx_usb_ep0_write_register(ucr, SFSM_ED, 0xf8, 0xf8);
620}
621
622static inline void rtsx_usb_clear_dma_err(struct rtsx_ucr *ucr)
623{
624 rtsx_usb_ep0_write_register(ucr, MC_FIFO_CTL,
625 FIFO_FLUSH, FIFO_FLUSH);
626 rtsx_usb_ep0_write_register(ucr, MC_DMA_RST, DMA_RESET, DMA_RESET);
627}
628#endif /* __RTS51139_H */
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 41c9bde410c5..157e32b6ca28 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -18,7 +18,9 @@ enum sec_device_type {
18 S5M8751X, 18 S5M8751X,
19 S5M8763X, 19 S5M8763X,
20 S5M8767X, 20 S5M8767X,
21 S2MPA01,
21 S2MPS11X, 22 S2MPS11X,
23 S2MPS14X,
22}; 24};
23 25
24/** 26/**
@@ -50,7 +52,7 @@ struct sec_pmic_dev {
50 struct regmap_irq_chip_data *irq_data; 52 struct regmap_irq_chip_data *irq_data;
51 53
52 int ono; 54 int ono;
53 int type; 55 unsigned long type;
54 bool wakeup; 56 bool wakeup;
55 bool wtsr_smpl; 57 bool wtsr_smpl;
56}; 58};
@@ -92,7 +94,7 @@ struct sec_platform_data {
92 int buck3_default_idx; 94 int buck3_default_idx;
93 int buck4_default_idx; 95 int buck4_default_idx;
94 96
95 int buck_ramp_delay; 97 int buck_ramp_delay;
96 98
97 int buck2_ramp_delay; 99 int buck2_ramp_delay;
98 int buck34_ramp_delay; 100 int buck34_ramp_delay;
@@ -100,10 +102,15 @@ struct sec_platform_data {
100 int buck16_ramp_delay; 102 int buck16_ramp_delay;
101 int buck7810_ramp_delay; 103 int buck7810_ramp_delay;
102 int buck9_ramp_delay; 104 int buck9_ramp_delay;
103 105 int buck24_ramp_delay;
104 bool buck2_ramp_enable; 106 int buck3_ramp_delay;
105 bool buck3_ramp_enable; 107 int buck7_ramp_delay;
106 bool buck4_ramp_enable; 108 int buck8910_ramp_delay;
109
110 bool buck1_ramp_enable;
111 bool buck2_ramp_enable;
112 bool buck3_ramp_enable;
113 bool buck4_ramp_enable;
107 bool buck6_ramp_enable; 114 bool buck6_ramp_enable;
108 115
109 int buck2_init; 116 int buck2_init;
@@ -119,7 +126,8 @@ struct sec_platform_data {
119struct sec_regulator_data { 126struct sec_regulator_data {
120 int id; 127 int id;
121 struct regulator_init_data *initdata; 128 struct regulator_init_data *initdata;
122 struct device_node *reg_node; 129 struct device_node *reg_node;
130 int ext_control_gpio;
123}; 131};
124 132
125/* 133/*
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index d43b4f9e7fb2..1224f447356b 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -13,6 +13,56 @@
13#ifndef __LINUX_MFD_SEC_IRQ_H 13#ifndef __LINUX_MFD_SEC_IRQ_H
14#define __LINUX_MFD_SEC_IRQ_H 14#define __LINUX_MFD_SEC_IRQ_H
15 15
16enum s2mpa01_irq {
17 S2MPA01_IRQ_PWRONF,
18 S2MPA01_IRQ_PWRONR,
19 S2MPA01_IRQ_JIGONBF,
20 S2MPA01_IRQ_JIGONBR,
21 S2MPA01_IRQ_ACOKBF,
22 S2MPA01_IRQ_ACOKBR,
23 S2MPA01_IRQ_PWRON1S,
24 S2MPA01_IRQ_MRB,
25
26 S2MPA01_IRQ_RTC60S,
27 S2MPA01_IRQ_RTCA1,
28 S2MPA01_IRQ_RTCA0,
29 S2MPA01_IRQ_SMPL,
30 S2MPA01_IRQ_RTC1S,
31 S2MPA01_IRQ_WTSR,
32
33 S2MPA01_IRQ_INT120C,
34 S2MPA01_IRQ_INT140C,
35 S2MPA01_IRQ_LDO3_TSD,
36 S2MPA01_IRQ_B16_TSD,
37 S2MPA01_IRQ_B24_TSD,
38 S2MPA01_IRQ_B35_TSD,
39
40 S2MPA01_IRQ_NR,
41};
42
43#define S2MPA01_IRQ_PWRONF_MASK (1 << 0)
44#define S2MPA01_IRQ_PWRONR_MASK (1 << 1)
45#define S2MPA01_IRQ_JIGONBF_MASK (1 << 2)
46#define S2MPA01_IRQ_JIGONBR_MASK (1 << 3)
47#define S2MPA01_IRQ_ACOKBF_MASK (1 << 4)
48#define S2MPA01_IRQ_ACOKBR_MASK (1 << 5)
49#define S2MPA01_IRQ_PWRON1S_MASK (1 << 6)
50#define S2MPA01_IRQ_MRB_MASK (1 << 7)
51
52#define S2MPA01_IRQ_RTC60S_MASK (1 << 0)
53#define S2MPA01_IRQ_RTCA1_MASK (1 << 1)
54#define S2MPA01_IRQ_RTCA0_MASK (1 << 2)
55#define S2MPA01_IRQ_SMPL_MASK (1 << 3)
56#define S2MPA01_IRQ_RTC1S_MASK (1 << 4)
57#define S2MPA01_IRQ_WTSR_MASK (1 << 5)
58
59#define S2MPA01_IRQ_INT120C_MASK (1 << 0)
60#define S2MPA01_IRQ_INT140C_MASK (1 << 1)
61#define S2MPA01_IRQ_LDO3_TSD_MASK (1 << 2)
62#define S2MPA01_IRQ_B16_TSD_MASK (1 << 3)
63#define S2MPA01_IRQ_B24_TSD_MASK (1 << 4)
64#define S2MPA01_IRQ_B35_TSD_MASK (1 << 5)
65
16enum s2mps11_irq { 66enum s2mps11_irq {
17 S2MPS11_IRQ_PWRONF, 67 S2MPS11_IRQ_PWRONF,
18 S2MPS11_IRQ_PWRONR, 68 S2MPS11_IRQ_PWRONR,
@@ -24,8 +74,8 @@ enum s2mps11_irq {
24 S2MPS11_IRQ_MRB, 74 S2MPS11_IRQ_MRB,
25 75
26 S2MPS11_IRQ_RTC60S, 76 S2MPS11_IRQ_RTC60S,
77 S2MPS11_IRQ_RTCA0,
27 S2MPS11_IRQ_RTCA1, 78 S2MPS11_IRQ_RTCA1,
28 S2MPS11_IRQ_RTCA2,
29 S2MPS11_IRQ_SMPL, 79 S2MPS11_IRQ_SMPL,
30 S2MPS11_IRQ_RTC1S, 80 S2MPS11_IRQ_RTC1S,
31 S2MPS11_IRQ_WTSR, 81 S2MPS11_IRQ_WTSR,
@@ -47,7 +97,7 @@ enum s2mps11_irq {
47 97
48#define S2MPS11_IRQ_RTC60S_MASK (1 << 0) 98#define S2MPS11_IRQ_RTC60S_MASK (1 << 0)
49#define S2MPS11_IRQ_RTCA1_MASK (1 << 1) 99#define S2MPS11_IRQ_RTCA1_MASK (1 << 1)
50#define S2MPS11_IRQ_RTCA2_MASK (1 << 2) 100#define S2MPS11_IRQ_RTCA0_MASK (1 << 2)
51#define S2MPS11_IRQ_SMPL_MASK (1 << 3) 101#define S2MPS11_IRQ_SMPL_MASK (1 << 3)
52#define S2MPS11_IRQ_RTC1S_MASK (1 << 4) 102#define S2MPS11_IRQ_RTC1S_MASK (1 << 4)
53#define S2MPS11_IRQ_WTSR_MASK (1 << 5) 103#define S2MPS11_IRQ_WTSR_MASK (1 << 5)
@@ -55,6 +105,33 @@ enum s2mps11_irq {
55#define S2MPS11_IRQ_INT120C_MASK (1 << 0) 105#define S2MPS11_IRQ_INT120C_MASK (1 << 0)
56#define S2MPS11_IRQ_INT140C_MASK (1 << 1) 106#define S2MPS11_IRQ_INT140C_MASK (1 << 1)
57 107
108enum s2mps14_irq {
109 S2MPS14_IRQ_PWRONF,
110 S2MPS14_IRQ_PWRONR,
111 S2MPS14_IRQ_JIGONBF,
112 S2MPS14_IRQ_JIGONBR,
113 S2MPS14_IRQ_ACOKBF,
114 S2MPS14_IRQ_ACOKBR,
115 S2MPS14_IRQ_PWRON1S,
116 S2MPS14_IRQ_MRB,
117
118 S2MPS14_IRQ_RTC60S,
119 S2MPS14_IRQ_RTCA1,
120 S2MPS14_IRQ_RTCA0,
121 S2MPS14_IRQ_SMPL,
122 S2MPS14_IRQ_RTC1S,
123 S2MPS14_IRQ_WTSR,
124
125 S2MPS14_IRQ_INT120C,
126 S2MPS14_IRQ_INT140C,
127 S2MPS14_IRQ_TSD,
128
129 S2MPS14_IRQ_NR,
130};
131
132/* Masks for interrupts are the same as in s2mps11 */
133#define S2MPS14_IRQ_TSD_MASK (1 << 2)
134
58enum s5m8767_irq { 135enum s5m8767_irq {
59 S5M8767_IRQ_PWRR, 136 S5M8767_IRQ_PWRR,
60 S5M8767_IRQ_PWRF, 137 S5M8767_IRQ_PWRF,
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h
index 94b7cd6d8891..3e02b768d537 100644
--- a/include/linux/mfd/samsung/rtc.h
+++ b/include/linux/mfd/samsung/rtc.h
@@ -1,12 +1,17 @@
1/* rtc.h 1/* rtc.h
2 * 2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd 3 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd
4 * http://www.samsung.com 4 * http://www.samsung.com
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. 9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
10 * 15 *
11 */ 16 */
12 17
@@ -43,6 +48,39 @@ enum sec_rtc_reg {
43 SEC_RTC_STATUS, 48 SEC_RTC_STATUS,
44 SEC_WTSR_SMPL_CNTL, 49 SEC_WTSR_SMPL_CNTL,
45 SEC_RTC_UDR_CON, 50 SEC_RTC_UDR_CON,
51
52 SEC_RTC_REG_MAX,
53};
54
55enum s2mps_rtc_reg {
56 S2MPS_RTC_CTRL,
57 S2MPS_WTSR_SMPL_CNTL,
58 S2MPS_RTC_UDR_CON,
59 S2MPS_RSVD,
60 S2MPS_RTC_SEC,
61 S2MPS_RTC_MIN,
62 S2MPS_RTC_HOUR,
63 S2MPS_RTC_WEEKDAY,
64 S2MPS_RTC_DATE,
65 S2MPS_RTC_MONTH,
66 S2MPS_RTC_YEAR,
67 S2MPS_ALARM0_SEC,
68 S2MPS_ALARM0_MIN,
69 S2MPS_ALARM0_HOUR,
70 S2MPS_ALARM0_WEEKDAY,
71 S2MPS_ALARM0_DATE,
72 S2MPS_ALARM0_MONTH,
73 S2MPS_ALARM0_YEAR,
74 S2MPS_ALARM1_SEC,
75 S2MPS_ALARM1_MIN,
76 S2MPS_ALARM1_HOUR,
77 S2MPS_ALARM1_WEEKDAY,
78 S2MPS_ALARM1_DATE,
79 S2MPS_ALARM1_MONTH,
80 S2MPS_ALARM1_YEAR,
81 S2MPS_OFFSRC,
82
83 S2MPS_RTC_REG_MAX,
46}; 84};
47 85
48#define RTC_I2C_ADDR (0x0C >> 1) 86#define RTC_I2C_ADDR (0x0C >> 1)
@@ -54,6 +92,9 @@ enum sec_rtc_reg {
54#define ALARM1_STATUS (1 << 2) 92#define ALARM1_STATUS (1 << 2)
55#define UPDATE_AD (1 << 0) 93#define UPDATE_AD (1 << 0)
56 94
95#define S2MPS_ALARM0_STATUS (1 << 2)
96#define S2MPS_ALARM1_STATUS (1 << 1)
97
57/* RTC Control Register */ 98/* RTC Control Register */
58#define BCD_EN_SHIFT 0 99#define BCD_EN_SHIFT 0
59#define BCD_EN_MASK (1 << BCD_EN_SHIFT) 100#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
@@ -62,6 +103,10 @@ enum sec_rtc_reg {
62/* RTC Update Register1 */ 103/* RTC Update Register1 */
63#define RTC_UDR_SHIFT 0 104#define RTC_UDR_SHIFT 0
64#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT) 105#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
106#define S2MPS_RTC_WUDR_SHIFT 4
107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT)
108#define S2MPS_RTC_RUDR_SHIFT 0
109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT)
65#define RTC_TCON_SHIFT 1 110#define RTC_TCON_SHIFT 1
66#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT) 111#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT)
67#define RTC_TIME_EN_SHIFT 3 112#define RTC_TIME_EN_SHIFT 3
diff --git a/include/linux/mfd/samsung/s2mpa01.h b/include/linux/mfd/samsung/s2mpa01.h
new file mode 100644
index 000000000000..fbc63bc0d6a2
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mpa01.h
@@ -0,0 +1,192 @@
1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd
3 * http://www.samsung.com
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 */
11
12#ifndef __LINUX_MFD_S2MPA01_H
13#define __LINUX_MFD_S2MPA01_H
14
15/* S2MPA01 registers */
16enum s2mpa01_reg {
17 S2MPA01_REG_ID,
18 S2MPA01_REG_INT1,
19 S2MPA01_REG_INT2,
20 S2MPA01_REG_INT3,
21 S2MPA01_REG_INT1M,
22 S2MPA01_REG_INT2M,
23 S2MPA01_REG_INT3M,
24 S2MPA01_REG_ST1,
25 S2MPA01_REG_ST2,
26 S2MPA01_REG_PWRONSRC,
27 S2MPA01_REG_OFFSRC,
28 S2MPA01_REG_RTC_BUF,
29 S2MPA01_REG_CTRL1,
30 S2MPA01_REG_ETC_TEST,
31 S2MPA01_REG_RSVD1,
32 S2MPA01_REG_BU_CHG,
33 S2MPA01_REG_RAMP1,
34 S2MPA01_REG_RAMP2,
35 S2MPA01_REG_LDO_DSCH1,
36 S2MPA01_REG_LDO_DSCH2,
37 S2MPA01_REG_LDO_DSCH3,
38 S2MPA01_REG_LDO_DSCH4,
39 S2MPA01_REG_OTP_ADRL,
40 S2MPA01_REG_OTP_ADRH,
41 S2MPA01_REG_OTP_DATA,
42 S2MPA01_REG_MON1SEL,
43 S2MPA01_REG_MON2SEL,
44 S2MPA01_REG_LEE,
45 S2MPA01_REG_RSVD2,
46 S2MPA01_REG_RSVD3,
47 S2MPA01_REG_RSVD4,
48 S2MPA01_REG_RSVD5,
49 S2MPA01_REG_RSVD6,
50 S2MPA01_REG_TOP_RSVD,
51 S2MPA01_REG_DVS_SEL,
52 S2MPA01_REG_DVS_PTR,
53 S2MPA01_REG_DVS_DATA,
54 S2MPA01_REG_RSVD_NO,
55 S2MPA01_REG_UVLO,
56 S2MPA01_REG_LEE_NO,
57 S2MPA01_REG_B1CTRL1,
58 S2MPA01_REG_B1CTRL2,
59 S2MPA01_REG_B2CTRL1,
60 S2MPA01_REG_B2CTRL2,
61 S2MPA01_REG_B3CTRL1,
62 S2MPA01_REG_B3CTRL2,
63 S2MPA01_REG_B4CTRL1,
64 S2MPA01_REG_B4CTRL2,
65 S2MPA01_REG_B5CTRL1,
66 S2MPA01_REG_B5CTRL2,
67 S2MPA01_REG_B5CTRL3,
68 S2MPA01_REG_B5CTRL4,
69 S2MPA01_REG_B5CTRL5,
70 S2MPA01_REG_B5CTRL6,
71 S2MPA01_REG_B6CTRL1,
72 S2MPA01_REG_B6CTRL2,
73 S2MPA01_REG_B7CTRL1,
74 S2MPA01_REG_B7CTRL2,
75 S2MPA01_REG_B8CTRL1,
76 S2MPA01_REG_B8CTRL2,
77 S2MPA01_REG_B9CTRL1,
78 S2MPA01_REG_B9CTRL2,
79 S2MPA01_REG_B10CTRL1,
80 S2MPA01_REG_B10CTRL2,
81 S2MPA01_REG_L1CTRL,
82 S2MPA01_REG_L2CTRL,
83 S2MPA01_REG_L3CTRL,
84 S2MPA01_REG_L4CTRL,
85 S2MPA01_REG_L5CTRL,
86 S2MPA01_REG_L6CTRL,
87 S2MPA01_REG_L7CTRL,
88 S2MPA01_REG_L8CTRL,
89 S2MPA01_REG_L9CTRL,
90 S2MPA01_REG_L10CTRL,
91 S2MPA01_REG_L11CTRL,
92 S2MPA01_REG_L12CTRL,
93 S2MPA01_REG_L13CTRL,
94 S2MPA01_REG_L14CTRL,
95 S2MPA01_REG_L15CTRL,
96 S2MPA01_REG_L16CTRL,
97 S2MPA01_REG_L17CTRL,
98 S2MPA01_REG_L18CTRL,
99 S2MPA01_REG_L19CTRL,
100 S2MPA01_REG_L20CTRL,
101 S2MPA01_REG_L21CTRL,
102 S2MPA01_REG_L22CTRL,
103 S2MPA01_REG_L23CTRL,
104 S2MPA01_REG_L24CTRL,
105 S2MPA01_REG_L25CTRL,
106 S2MPA01_REG_L26CTRL,
107
108 S2MPA01_REG_LDO_OVCB1,
109 S2MPA01_REG_LDO_OVCB2,
110 S2MPA01_REG_LDO_OVCB3,
111 S2MPA01_REG_LDO_OVCB4,
112
113};
114
115/* S2MPA01 regulator ids */
116enum s2mpa01_regulators {
117 S2MPA01_LDO1,
118 S2MPA01_LDO2,
119 S2MPA01_LDO3,
120 S2MPA01_LDO4,
121 S2MPA01_LDO5,
122 S2MPA01_LDO6,
123 S2MPA01_LDO7,
124 S2MPA01_LDO8,
125 S2MPA01_LDO9,
126 S2MPA01_LDO10,
127 S2MPA01_LDO11,
128 S2MPA01_LDO12,
129 S2MPA01_LDO13,
130 S2MPA01_LDO14,
131 S2MPA01_LDO15,
132 S2MPA01_LDO16,
133 S2MPA01_LDO17,
134 S2MPA01_LDO18,
135 S2MPA01_LDO19,
136 S2MPA01_LDO20,
137 S2MPA01_LDO21,
138 S2MPA01_LDO22,
139 S2MPA01_LDO23,
140 S2MPA01_LDO24,
141 S2MPA01_LDO25,
142 S2MPA01_LDO26,
143
144 S2MPA01_BUCK1,
145 S2MPA01_BUCK2,
146 S2MPA01_BUCK3,
147 S2MPA01_BUCK4,
148 S2MPA01_BUCK5,
149 S2MPA01_BUCK6,
150 S2MPA01_BUCK7,
151 S2MPA01_BUCK8,
152 S2MPA01_BUCK9,
153 S2MPA01_BUCK10,
154
155 S2MPA01_REGULATOR_MAX,
156};
157
158#define S2MPA01_BUCK_MIN1 600000
159#define S2MPA01_BUCK_MIN2 800000
160#define S2MPA01_BUCK_MIN3 1000000
161#define S2MPA01_BUCK_MIN4 1500000
162#define S2MPA01_LDO_MIN 800000
163
164#define S2MPA01_BUCK_STEP1 6250
165#define S2MPA01_BUCK_STEP2 12500
166
167#define S2MPA01_LDO_STEP1 50000
168#define S2MPA01_LDO_STEP2 25000
169
170#define S2MPA01_LDO_VSEL_MASK 0x3F
171#define S2MPA01_BUCK_VSEL_MASK 0xFF
172#define S2MPA01_ENABLE_MASK (0x03 << S2MPA01_ENABLE_SHIFT)
173#define S2MPA01_ENABLE_SHIFT 0x06
174#define S2MPA01_LDO_N_VOLTAGES (S2MPA01_LDO_VSEL_MASK + 1)
175#define S2MPA01_BUCK_N_VOLTAGES (S2MPA01_BUCK_VSEL_MASK + 1)
176
177#define S2MPA01_RAMP_DELAY 12500 /* uV/us */
178
179#define S2MPA01_BUCK16_RAMP_SHIFT 4
180#define S2MPA01_BUCK24_RAMP_SHIFT 6
181#define S2MPA01_BUCK3_RAMP_SHIFT 4
182#define S2MPA01_BUCK5_RAMP_SHIFT 6
183#define S2MPA01_BUCK7_RAMP_SHIFT 2
184#define S2MPA01_BUCK8910_RAMP_SHIFT 0
185
186#define S2MPA01_BUCK1_RAMP_EN_SHIFT 3
187#define S2MPA01_BUCK2_RAMP_EN_SHIFT 2
188#define S2MPA01_BUCK3_RAMP_EN_SHIFT 1
189#define S2MPA01_BUCK4_RAMP_EN_SHIFT 0
190#define S2MPA01_PMIC_EN_SHIFT 6
191
192#endif /*__LINUX_MFD_S2MPA01_H */
diff --git a/include/linux/mfd/samsung/s2mps14.h b/include/linux/mfd/samsung/s2mps14.h
new file mode 100644
index 000000000000..4b449b8ac548
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mps14.h
@@ -0,0 +1,154 @@
1/*
2 * s2mps14.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * 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 */
18
19#ifndef __LINUX_MFD_S2MPS14_H
20#define __LINUX_MFD_S2MPS14_H
21
22/* S2MPS14 registers */
23enum s2mps14_reg {
24 S2MPS14_REG_ID,
25 S2MPS14_REG_INT1,
26 S2MPS14_REG_INT2,
27 S2MPS14_REG_INT3,
28 S2MPS14_REG_INT1M,
29 S2MPS14_REG_INT2M,
30 S2MPS14_REG_INT3M,
31 S2MPS14_REG_ST1,
32 S2MPS14_REG_ST2,
33 S2MPS14_REG_PWRONSRC,
34 S2MPS14_REG_OFFSRC,
35 S2MPS14_REG_BU_CHG,
36 S2MPS14_REG_RTCCTRL,
37 S2MPS14_REG_CTRL1,
38 S2MPS14_REG_CTRL2,
39 S2MPS14_REG_RSVD1,
40 S2MPS14_REG_RSVD2,
41 S2MPS14_REG_RSVD3,
42 S2MPS14_REG_RSVD4,
43 S2MPS14_REG_RSVD5,
44 S2MPS14_REG_RSVD6,
45 S2MPS14_REG_CTRL3,
46 S2MPS14_REG_RSVD7,
47 S2MPS14_REG_RSVD8,
48 S2MPS14_REG_WRSTBI,
49 S2MPS14_REG_B1CTRL1,
50 S2MPS14_REG_B1CTRL2,
51 S2MPS14_REG_B2CTRL1,
52 S2MPS14_REG_B2CTRL2,
53 S2MPS14_REG_B3CTRL1,
54 S2MPS14_REG_B3CTRL2,
55 S2MPS14_REG_B4CTRL1,
56 S2MPS14_REG_B4CTRL2,
57 S2MPS14_REG_B5CTRL1,
58 S2MPS14_REG_B5CTRL2,
59 S2MPS14_REG_L1CTRL,
60 S2MPS14_REG_L2CTRL,
61 S2MPS14_REG_L3CTRL,
62 S2MPS14_REG_L4CTRL,
63 S2MPS14_REG_L5CTRL,
64 S2MPS14_REG_L6CTRL,
65 S2MPS14_REG_L7CTRL,
66 S2MPS14_REG_L8CTRL,
67 S2MPS14_REG_L9CTRL,
68 S2MPS14_REG_L10CTRL,
69 S2MPS14_REG_L11CTRL,
70 S2MPS14_REG_L12CTRL,
71 S2MPS14_REG_L13CTRL,
72 S2MPS14_REG_L14CTRL,
73 S2MPS14_REG_L15CTRL,
74 S2MPS14_REG_L16CTRL,
75 S2MPS14_REG_L17CTRL,
76 S2MPS14_REG_L18CTRL,
77 S2MPS14_REG_L19CTRL,
78 S2MPS14_REG_L20CTRL,
79 S2MPS14_REG_L21CTRL,
80 S2MPS14_REG_L22CTRL,
81 S2MPS14_REG_L23CTRL,
82 S2MPS14_REG_L24CTRL,
83 S2MPS14_REG_L25CTRL,
84 S2MPS14_REG_LDODSCH1,
85 S2MPS14_REG_LDODSCH2,
86 S2MPS14_REG_LDODSCH3,
87};
88
89/* S2MPS14 regulator ids */
90enum s2mps14_regulators {
91 S2MPS14_LDO1,
92 S2MPS14_LDO2,
93 S2MPS14_LDO3,
94 S2MPS14_LDO4,
95 S2MPS14_LDO5,
96 S2MPS14_LDO6,
97 S2MPS14_LDO7,
98 S2MPS14_LDO8,
99 S2MPS14_LDO9,
100 S2MPS14_LDO10,
101 S2MPS14_LDO11,
102 S2MPS14_LDO12,
103 S2MPS14_LDO13,
104 S2MPS14_LDO14,
105 S2MPS14_LDO15,
106 S2MPS14_LDO16,
107 S2MPS14_LDO17,
108 S2MPS14_LDO18,
109 S2MPS14_LDO19,
110 S2MPS14_LDO20,
111 S2MPS14_LDO21,
112 S2MPS14_LDO22,
113 S2MPS14_LDO23,
114 S2MPS14_LDO24,
115 S2MPS14_LDO25,
116 S2MPS14_BUCK1,
117 S2MPS14_BUCK2,
118 S2MPS14_BUCK3,
119 S2MPS14_BUCK4,
120 S2MPS14_BUCK5,
121
122 S2MPS14_REGULATOR_MAX,
123};
124
125/* Regulator constraints for BUCKx */
126#define S2MPS14_BUCK1235_MIN_600MV 600000
127#define S2MPS14_BUCK4_MIN_1400MV 1400000
128#define S2MPS14_BUCK1235_STEP_6_25MV 6250
129#define S2MPS14_BUCK4_STEP_12_5MV 12500
130#define S2MPS14_BUCK1235_START_SEL 0x20
131#define S2MPS14_BUCK4_START_SEL 0x40
132/*
133 * Default ramp delay in uv/us. Datasheet says that ramp delay can be
134 * controlled however it does not specify which register is used for that.
135 * Let's assume that default value will be set.
136 */
137#define S2MPS14_BUCK_RAMP_DELAY 12500
138
139/* Regulator constraints for different types of LDOx */
140#define S2MPS14_LDO_MIN_800MV 800000
141#define S2MPS14_LDO_MIN_1800MV 1800000
142#define S2MPS14_LDO_STEP_12_5MV 12500
143#define S2MPS14_LDO_STEP_25MV 25000
144
145#define S2MPS14_LDO_VSEL_MASK 0x3F
146#define S2MPS14_BUCK_VSEL_MASK 0xFF
147#define S2MPS14_ENABLE_MASK (0x03 << S2MPS14_ENABLE_SHIFT)
148#define S2MPS14_ENABLE_SHIFT 6
149/* On/Off controlled by PWREN */
150#define S2MPS14_ENABLE_SUSPEND (0x01 << S2MPS14_ENABLE_SHIFT)
151#define S2MPS14_LDO_N_VOLTAGES (S2MPS14_LDO_VSEL_MASK + 1)
152#define S2MPS14_BUCK_N_VOLTAGES (S2MPS14_BUCK_VSEL_MASK + 1)
153
154#endif /* __LINUX_MFD_S2MPS14_H */
diff --git a/include/linux/mfd/samsung/s5m8767.h b/include/linux/mfd/samsung/s5m8767.h
index 2ab0b0f03641..243b58fec33d 100644
--- a/include/linux/mfd/samsung/s5m8767.h
+++ b/include/linux/mfd/samsung/s5m8767.h
@@ -183,10 +183,17 @@ enum s5m8767_regulators {
183 S5M8767_REG_MAX, 183 S5M8767_REG_MAX,
184}; 184};
185 185
186/* LDO_EN/BUCK_EN field in registers */
186#define S5M8767_ENCTRL_SHIFT 6 187#define S5M8767_ENCTRL_SHIFT 6
187#define S5M8767_ENCTRL_MASK (0x3 << S5M8767_ENCTRL_SHIFT) 188#define S5M8767_ENCTRL_MASK (0x3 << S5M8767_ENCTRL_SHIFT)
188 189
189/* 190/*
191 * LDO_EN/BUCK_EN register value for controlling this Buck or LDO
192 * by GPIO (PWREN, BUCKEN).
193 */
194#define S5M8767_ENCTRL_USE_GPIO 0x1
195
196/*
190 * Values for BUCK_RAMP field in DVS_RAMP register, matching raw values 197 * Values for BUCK_RAMP field in DVS_RAMP register, matching raw values
191 * in mV/us. 198 * in mV/us.
192 */ 199 */
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index 866e355fa409..ff44374a1a4e 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -242,6 +242,24 @@
242 242
243#define IMX6Q_GPR5_L2_CLK_STOP BIT(8) 243#define IMX6Q_GPR5_L2_CLK_STOP BIT(8)
244 244
245#define IMX6Q_GPR6_IPU1_ID00_WR_QOS_MASK (0xf << 0)
246#define IMX6Q_GPR6_IPU1_ID01_WR_QOS_MASK (0xf << 4)
247#define IMX6Q_GPR6_IPU1_ID10_WR_QOS_MASK (0xf << 8)
248#define IMX6Q_GPR6_IPU1_ID11_WR_QOS_MASK (0xf << 12)
249#define IMX6Q_GPR6_IPU1_ID00_RD_QOS_MASK (0xf << 16)
250#define IMX6Q_GPR6_IPU1_ID01_RD_QOS_MASK (0xf << 20)
251#define IMX6Q_GPR6_IPU1_ID10_RD_QOS_MASK (0xf << 24)
252#define IMX6Q_GPR6_IPU1_ID11_RD_QOS_MASK (0xf << 28)
253
254#define IMX6Q_GPR7_IPU2_ID00_WR_QOS_MASK (0xf << 0)
255#define IMX6Q_GPR7_IPU2_ID01_WR_QOS_MASK (0xf << 4)
256#define IMX6Q_GPR7_IPU2_ID10_WR_QOS_MASK (0xf << 8)
257#define IMX6Q_GPR7_IPU2_ID11_WR_QOS_MASK (0xf << 12)
258#define IMX6Q_GPR7_IPU2_ID00_RD_QOS_MASK (0xf << 16)
259#define IMX6Q_GPR7_IPU2_ID01_RD_QOS_MASK (0xf << 20)
260#define IMX6Q_GPR7_IPU2_ID10_RD_QOS_MASK (0xf << 24)
261#define IMX6Q_GPR7_IPU2_ID11_RD_QOS_MASK (0xf << 28)
262
245#define IMX6Q_GPR8_TX_SWING_LOW (0x7f << 25) 263#define IMX6Q_GPR8_TX_SWING_LOW (0x7f << 25)
246#define IMX6Q_GPR8_TX_SWING_FULL (0x7f << 18) 264#define IMX6Q_GPR8_TX_SWING_FULL (0x7f << 18)
247#define IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB (0x3f << 12) 265#define IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB (0x3f << 12)
diff --git a/include/linux/mfd/tps65218.h b/include/linux/mfd/tps65218.h
new file mode 100644
index 000000000000..d2e357df5a0e
--- /dev/null
+++ b/include/linux/mfd/tps65218.h
@@ -0,0 +1,284 @@
1/*
2 * linux/mfd/tps65218.h
3 *
4 * Functions to access TPS65219 power management chip.
5 *
6 * Copyright (C) 2014 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 version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether expressed or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License version 2 for more details.
16 */
17
18#ifndef __LINUX_MFD_TPS65218_H
19#define __LINUX_MFD_TPS65218_H
20
21#include <linux/i2c.h>
22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h>
24#include <linux/bitops.h>
25
26/* TPS chip id list */
27#define TPS65218 0xF0
28
29/* I2C ID for TPS65218 part */
30#define TPS65218_I2C_ID 0x24
31
32/* All register addresses */
33#define TPS65218_REG_CHIPID 0x00
34#define TPS65218_REG_INT1 0x01
35#define TPS65218_REG_INT2 0x02
36#define TPS65218_REG_INT_MASK1 0x03
37#define TPS65218_REG_INT_MASK2 0x04
38#define TPS65218_REG_STATUS 0x05
39#define TPS65218_REG_CONTROL 0x06
40#define TPS65218_REG_FLAG 0x07
41
42#define TPS65218_REG_PASSWORD 0x10
43#define TPS65218_REG_ENABLE1 0x11
44#define TPS65218_REG_ENABLE2 0x12
45#define TPS65218_REG_CONFIG1 0x13
46#define TPS65218_REG_CONFIG2 0x14
47#define TPS65218_REG_CONFIG3 0x15
48#define TPS65218_REG_CONTROL_DCDC1 0x16
49#define TPS65218_REG_CONTROL_DCDC2 0x17
50#define TPS65218_REG_CONTROL_DCDC3 0x18
51#define TPS65218_REG_CONTROL_DCDC4 0x19
52#define TPS65218_REG_CONTRL_SLEW_RATE 0x1A
53#define TPS65218_REG_CONTROL_LDO1 0x1B
54#define TPS65218_REG_SEQ1 0x20
55#define TPS65218_REG_SEQ2 0x21
56#define TPS65218_REG_SEQ3 0x22
57#define TPS65218_REG_SEQ4 0x23
58#define TPS65218_REG_SEQ5 0x24
59#define TPS65218_REG_SEQ6 0x25
60#define TPS65218_REG_SEQ7 0x26
61
62/* Register field definitions */
63#define TPS65218_CHIPID_CHIP_MASK 0xF8
64#define TPS65218_CHIPID_REV_MASK 0x07
65
66#define TPS65218_INT1_VPRG BIT(5)
67#define TPS65218_INT1_AC BIT(4)
68#define TPS65218_INT1_PB BIT(3)
69#define TPS65218_INT1_HOT BIT(2)
70#define TPS65218_INT1_CC_AQC BIT(1)
71#define TPS65218_INT1_PRGC BIT(0)
72
73#define TPS65218_INT2_LS3_F BIT(5)
74#define TPS65218_INT2_LS2_F BIT(4)
75#define TPS65218_INT2_LS1_F BIT(3)
76#define TPS65218_INT2_LS3_I BIT(2)
77#define TPS65218_INT2_LS2_I BIT(1)
78#define TPS65218_INT2_LS1_I BIT(0)
79
80#define TPS65218_INT_MASK1_VPRG BIT(5)
81#define TPS65218_INT_MASK1_AC BIT(4)
82#define TPS65218_INT_MASK1_PB BIT(3)
83#define TPS65218_INT_MASK1_HOT BIT(2)
84#define TPS65218_INT_MASK1_CC_AQC BIT(1)
85#define TPS65218_INT_MASK1_PRGC BIT(0)
86
87#define TPS65218_INT_MASK2_LS3_F BIT(5)
88#define TPS65218_INT_MASK2_LS2_F BIT(4)
89#define TPS65218_INT_MASK2_LS1_F BIT(3)
90#define TPS65218_INT_MASK2_LS3_I BIT(2)
91#define TPS65218_INT_MASK2_LS2_I BIT(1)
92#define TPS65218_INT_MASK2_LS1_I BIT(0)
93
94#define TPS65218_STATUS_FSEAL BIT(7)
95#define TPS65218_STATUS_EE BIT(6)
96#define TPS65218_STATUS_AC_STATE BIT(5)
97#define TPS65218_STATUS_PB_STATE BIT(4)
98#define TPS65218_STATUS_STATE_MASK 0xC
99#define TPS65218_STATUS_CC_STAT 0x3
100
101#define TPS65218_CONTROL_OFFNPFO BIT(1)
102#define TPS65218_CONTROL_CC_AQ BIT(0)
103
104#define TPS65218_FLAG_GPO3_FLG BIT(7)
105#define TPS65218_FLAG_GPO2_FLG BIT(6)
106#define TPS65218_FLAG_GPO1_FLG BIT(5)
107#define TPS65218_FLAG_LDO1_FLG BIT(4)
108#define TPS65218_FLAG_DC4_FLG BIT(3)
109#define TPS65218_FLAG_DC3_FLG BIT(2)
110#define TPS65218_FLAG_DC2_FLG BIT(1)
111#define TPS65218_FLAG_DC1_FLG BIT(0)
112
113#define TPS65218_ENABLE1_DC6_EN BIT(5)
114#define TPS65218_ENABLE1_DC5_EN BIT(4)
115#define TPS65218_ENABLE1_DC4_EN BIT(3)
116#define TPS65218_ENABLE1_DC3_EN BIT(2)
117#define TPS65218_ENABLE1_DC2_EN BIT(1)
118#define TPS65218_ENABLE1_DC1_EN BIT(0)
119
120#define TPS65218_ENABLE2_GPIO3 BIT(6)
121#define TPS65218_ENABLE2_GPIO2 BIT(5)
122#define TPS65218_ENABLE2_GPIO1 BIT(4)
123#define TPS65218_ENABLE2_LS3_EN BIT(3)
124#define TPS65218_ENABLE2_LS2_EN BIT(2)
125#define TPS65218_ENABLE2_LS1_EN BIT(1)
126#define TPS65218_ENABLE2_LDO1_EN BIT(0)
127
128
129#define TPS65218_CONFIG1_TRST BIT(7)
130#define TPS65218_CONFIG1_GPO2_BUF BIT(6)
131#define TPS65218_CONFIG1_IO1_SEL BIT(5)
132#define TPS65218_CONFIG1_PGDLY_MASK 0x18
133#define TPS65218_CONFIG1_STRICT BIT(2)
134#define TPS65218_CONFIG1_UVLO_MASK 0x3
135
136#define TPS65218_CONFIG2_DC12_RST BIT(7)
137#define TPS65218_CONFIG2_UVLOHYS BIT(6)
138#define TPS65218_CONFIG2_LS3ILIM_MASK 0xC
139#define TPS65218_CONFIG2_LS2ILIM_MASK 0x3
140
141#define TPS65218_CONFIG3_LS3NPFO BIT(5)
142#define TPS65218_CONFIG3_LS2NPFO BIT(4)
143#define TPS65218_CONFIG3_LS1NPFO BIT(3)
144#define TPS65218_CONFIG3_LS3DCHRG BIT(2)
145#define TPS65218_CONFIG3_LS2DCHRG BIT(1)
146#define TPS65218_CONFIG3_LS1DCHRG BIT(0)
147
148#define TPS65218_CONTROL_DCDC1_PFM BIT(7)
149#define TPS65218_CONTROL_DCDC1_MASK 0x7F
150
151#define TPS65218_CONTROL_DCDC2_PFM BIT(7)
152#define TPS65218_CONTROL_DCDC2_MASK 0x3F
153
154#define TPS65218_CONTROL_DCDC3_PFM BIT(7)
155#define TPS65218_CONTROL_DCDC3_MASK 0x3F
156
157#define TPS65218_CONTROL_DCDC4_PFM BIT(7)
158#define TPS65218_CONTROL_DCDC4_MASK 0x3F
159
160#define TPS65218_SLEW_RATE_GO BIT(7)
161#define TPS65218_SLEW_RATE_GODSBL BIT(6)
162#define TPS65218_SLEW_RATE_SLEW_MASK 0x7
163
164#define TPS65218_CONTROL_LDO1_MASK 0x3F
165
166#define TPS65218_SEQ1_DLY8 BIT(7)
167#define TPS65218_SEQ1_DLY7 BIT(6)
168#define TPS65218_SEQ1_DLY6 BIT(5)
169#define TPS65218_SEQ1_DLY5 BIT(4)
170#define TPS65218_SEQ1_DLY4 BIT(3)
171#define TPS65218_SEQ1_DLY3 BIT(2)
172#define TPS65218_SEQ1_DLY2 BIT(1)
173#define TPS65218_SEQ1_DLY1 BIT(0)
174
175#define TPS65218_SEQ2_DLYFCTR BIT(7)
176#define TPS65218_SEQ2_DLY9 BIT(0)
177
178#define TPS65218_SEQ3_DC2_SEQ_MASK 0xF0
179#define TPS65218_SEQ3_DC1_SEQ_MASK 0xF
180
181#define TPS65218_SEQ4_DC4_SEQ_MASK 0xF0
182#define TPS65218_SEQ4_DC3_SEQ_MASK 0xF
183
184#define TPS65218_SEQ5_DC6_SEQ_MASK 0xF0
185#define TPS65218_SEQ5_DC5_SEQ_MASK 0xF
186
187#define TPS65218_SEQ6_LS1_SEQ_MASK 0xF0
188#define TPS65218_SEQ6_LDO1_SEQ_MASK 0xF
189
190#define TPS65218_SEQ7_GPO3_SEQ_MASK 0xF0
191#define TPS65218_SEQ7_GPO1_SEQ_MASK 0xF
192#define TPS65218_PROTECT_NONE 0
193#define TPS65218_PROTECT_L1 1
194
195enum tps65218_regulator_id {
196 /* DCDC's */
197 TPS65218_DCDC_1,
198 TPS65218_DCDC_2,
199 TPS65218_DCDC_3,
200 TPS65218_DCDC_4,
201 TPS65218_DCDC_5,
202 TPS65218_DCDC_6,
203 /* LDOs */
204 TPS65218_LDO_1,
205};
206
207#define TPS65218_MAX_REG_ID TPS65218_LDO_1
208
209/* Number of step-down converters available */
210#define TPS65218_NUM_DCDC 6
211/* Number of LDO voltage regulators available */
212#define TPS65218_NUM_LDO 1
213/* Number of total regulators available */
214#define TPS65218_NUM_REGULATOR (TPS65218_NUM_DCDC + TPS65218_NUM_LDO)
215
216/* Define the TPS65218 IRQ numbers */
217enum tps65218_irqs {
218 /* INT1 registers */
219 TPS65218_PRGC_IRQ,
220 TPS65218_CC_AQC_IRQ,
221 TPS65218_HOT_IRQ,
222 TPS65218_PB_IRQ,
223 TPS65218_AC_IRQ,
224 TPS65218_VPRG_IRQ,
225 TPS65218_INVALID1_IRQ,
226 TPS65218_INVALID2_IRQ,
227 /* INT2 registers */
228 TPS65218_LS1_I_IRQ,
229 TPS65218_LS2_I_IRQ,
230 TPS65218_LS3_I_IRQ,
231 TPS65218_LS1_F_IRQ,
232 TPS65218_LS2_F_IRQ,
233 TPS65218_LS3_F_IRQ,
234 TPS65218_INVALID3_IRQ,
235 TPS65218_INVALID4_IRQ,
236};
237
238/**
239 * struct tps_info - packages regulator constraints
240 * @id: Id of the regulator
241 * @name: Voltage regulator name
242 * @min_uV: minimum micro volts
243 * @max_uV: minimum micro volts
244 *
245 * This data is used to check the regualtor voltage limits while setting.
246 */
247struct tps_info {
248 int id;
249 const char *name;
250 int min_uV;
251 int max_uV;
252};
253
254/**
255 * struct tps65218 - tps65218 sub-driver chip access routines
256 *
257 * Device data may be used to access the TPS65218 chip
258 */
259
260struct tps65218 {
261 struct device *dev;
262 unsigned int id;
263
264 struct mutex tps_lock; /* lock guarding the data structure */
265 /* IRQ Data */
266 int irq;
267 u32 irq_mask;
268 struct regmap_irq_chip_data *irq_data;
269 struct regulator_desc desc[TPS65218_NUM_REGULATOR];
270 struct regulator_dev *rdev[TPS65218_NUM_REGULATOR];
271 struct tps_info *info[TPS65218_NUM_REGULATOR];
272 struct regmap *regmap;
273};
274
275int tps65218_reg_read(struct tps65218 *tps, unsigned int reg,
276 unsigned int *val);
277int tps65218_reg_write(struct tps65218 *tps, unsigned int reg,
278 unsigned int val, unsigned int level);
279int tps65218_set_bits(struct tps65218 *tps, unsigned int reg,
280 unsigned int mask, unsigned int val, unsigned int level);
281int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
282 unsigned int mask, unsigned int level);
283
284#endif /* __LINUX_MFD_TPS65218_H */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 3737f7218f51..51e26f3cd3b3 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -11,23 +11,24 @@
11 */ 11 */
12 12
13#define PSMOUSE_MINOR 1 13#define PSMOUSE_MINOR 1
14#define MS_BUSMOUSE_MINOR 2 14#define MS_BUSMOUSE_MINOR 2 /* unused */
15#define ATIXL_BUSMOUSE_MINOR 3 15#define ATIXL_BUSMOUSE_MINOR 3 /* unused */
16/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */ 16/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */
17#define ATARIMOUSE_MINOR 5 17#define ATARIMOUSE_MINOR 5 /* unused */
18#define SUN_MOUSE_MINOR 6 18#define SUN_MOUSE_MINOR 6 /* unused */
19#define APOLLO_MOUSE_MINOR 7 19#define APOLLO_MOUSE_MINOR 7 /* unused */
20#define PC110PAD_MINOR 9 20#define PC110PAD_MINOR 9 /* unused */
21/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ 21/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
22#define WATCHDOG_MINOR 130 /* Watchdog timer */ 22#define WATCHDOG_MINOR 130 /* Watchdog timer */
23#define TEMP_MINOR 131 /* Temperature Sensor */ 23#define TEMP_MINOR 131 /* Temperature Sensor */
24#define RTC_MINOR 135 24#define RTC_MINOR 135
25#define EFI_RTC_MINOR 136 /* EFI Time services */ 25#define EFI_RTC_MINOR 136 /* EFI Time services */
26#define VHCI_MINOR 137
26#define SUN_OPENPROM_MINOR 139 27#define SUN_OPENPROM_MINOR 139
27#define DMAPI_MINOR 140 /* DMAPI */ 28#define DMAPI_MINOR 140 /* unused */
28#define NVRAM_MINOR 144 29#define NVRAM_MINOR 144
29#define SGI_MMTIMER 153 30#define SGI_MMTIMER 153
30#define STORE_QUEUE_MINOR 155 31#define STORE_QUEUE_MINOR 155 /* unused */
31#define I2O_MINOR 166 32#define I2O_MINOR 166
32#define MICROCODE_MINOR 184 33#define MICROCODE_MINOR 184
33#define VFIO_MINOR 196 34#define VFIO_MINOR 196
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 79a347238168..c8450366c130 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -125,6 +125,7 @@ enum {
125 /* miscellaneous commands */ 125 /* miscellaneous commands */
126 MLX4_CMD_DIAG_RPRT = 0x30, 126 MLX4_CMD_DIAG_RPRT = 0x30,
127 MLX4_CMD_NOP = 0x31, 127 MLX4_CMD_NOP = 0x31,
128 MLX4_CMD_CONFIG_DEV = 0x3a,
128 MLX4_CMD_ACCESS_MEM = 0x2e, 129 MLX4_CMD_ACCESS_MEM = 0x2e,
129 MLX4_CMD_SET_VEP = 0x52, 130 MLX4_CMD_SET_VEP = 0x52,
130 131
@@ -240,6 +241,13 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
240int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 241int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
241int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 242int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
242int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); 243int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
244/*
245 * mlx4_get_slave_default_vlan -
246 * return true if VST ( default vlan)
247 * if VST, will return vlan & qos (if not NULL)
248 */
249bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave,
250 u16 *vlan, u8 *qos);
243 251
244#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) 252#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
245 253
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 5edd2c68274d..ba87bd21295a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -48,6 +48,9 @@
48#define MSIX_LEGACY_SZ 4 48#define MSIX_LEGACY_SZ 4
49#define MIN_MSIX_P_PORT 5 49#define MIN_MSIX_P_PORT 5
50 50
51#define MLX4_ROCE_MAX_GIDS 128
52#define MLX4_ROCE_PF_GIDS 16
53
51enum { 54enum {
52 MLX4_FLAG_MSI_X = 1 << 0, 55 MLX4_FLAG_MSI_X = 1 << 0,
53 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 56 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
@@ -81,6 +84,7 @@ enum {
81enum { 84enum {
82 MLX4_MAX_NUM_PF = 16, 85 MLX4_MAX_NUM_PF = 16,
83 MLX4_MAX_NUM_VF = 64, 86 MLX4_MAX_NUM_VF = 64,
87 MLX4_MAX_NUM_VF_P_PORT = 64,
84 MLX4_MFUNC_MAX = 80, 88 MLX4_MFUNC_MAX = 80,
85 MLX4_MAX_EQ_NUM = 1024, 89 MLX4_MAX_EQ_NUM = 1024,
86 MLX4_MFUNC_EQ_NUM = 4, 90 MLX4_MFUNC_EQ_NUM = 4,
@@ -629,7 +633,8 @@ struct mlx4_eth_av {
629 u8 hop_limit; 633 u8 hop_limit;
630 __be32 sl_tclass_flowlabel; 634 __be32 sl_tclass_flowlabel;
631 u8 dgid[16]; 635 u8 dgid[16];
632 u32 reserved4[2]; 636 u8 s_mac[6];
637 u8 reserved4[2];
633 __be16 vlan; 638 __be16 vlan;
634 u8 mac[ETH_ALEN]; 639 u8 mac[ETH_ALEN];
635}; 640};
@@ -660,6 +665,11 @@ struct mlx4_quotas {
660 int xrcd; 665 int xrcd;
661}; 666};
662 667
668struct mlx4_vf_dev {
669 u8 min_port;
670 u8 n_ports;
671};
672
663struct mlx4_dev { 673struct mlx4_dev {
664 struct pci_dev *pdev; 674 struct pci_dev *pdev;
665 unsigned long flags; 675 unsigned long flags;
@@ -675,6 +685,7 @@ struct mlx4_dev {
675 int oper_log_mgm_entry_size; 685 int oper_log_mgm_entry_size;
676 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 686 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
677 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 687 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
688 struct mlx4_vf_dev *dev_vfs;
678}; 689};
679 690
680struct mlx4_eqe { 691struct mlx4_eqe {
@@ -1131,7 +1142,7 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
1131int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); 1142int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc);
1132int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, 1143int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw,
1133 u8 *pg, u16 *ratelimit); 1144 u8 *pg, u16 *ratelimit);
1134int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering); 1145int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable);
1135int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); 1146int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
1136int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1147int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
1137int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 1148int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
@@ -1183,9 +1194,44 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int
1183void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); 1194void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid);
1184__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); 1195__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave);
1185 1196
1197int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid,
1198 int *slave_id);
1199int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev, int port, int slave_id,
1200 u8 *gid);
1201
1186int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, 1202int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn,
1187 u32 max_range_qpn); 1203 u32 max_range_qpn);
1188 1204
1189cycle_t mlx4_read_clock(struct mlx4_dev *dev); 1205cycle_t mlx4_read_clock(struct mlx4_dev *dev);
1190 1206
1207struct mlx4_active_ports {
1208 DECLARE_BITMAP(ports, MLX4_MAX_PORTS);
1209};
1210/* Returns a bitmap of the physical ports which are assigned to slave */
1211struct mlx4_active_ports mlx4_get_active_ports(struct mlx4_dev *dev, int slave);
1212
1213/* Returns the physical port that represents the virtual port of the slave, */
1214/* or a value < 0 in case of an error. If a slave has 2 ports, the identity */
1215/* mapping is returned. */
1216int mlx4_slave_convert_port(struct mlx4_dev *dev, int slave, int port);
1217
1218struct mlx4_slaves_pport {
1219 DECLARE_BITMAP(slaves, MLX4_MFUNC_MAX);
1220};
1221/* Returns a bitmap of all slaves that are assigned to port. */
1222struct mlx4_slaves_pport mlx4_phys_to_slaves_pport(struct mlx4_dev *dev,
1223 int port);
1224
1225/* Returns a bitmap of all slaves that are assigned exactly to all the */
1226/* the ports that are set in crit_ports. */
1227struct mlx4_slaves_pport mlx4_phys_to_slaves_pport_actv(
1228 struct mlx4_dev *dev,
1229 const struct mlx4_active_ports *crit_ports);
1230
1231/* Returns the slave's virtual port that represents the physical port. */
1232int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port);
1233
1234int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port);
1235
1236int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port);
1191#endif /* MLX4_DEVICE_H */ 1237#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index c257e1b211be..022055c8fb26 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -64,4 +64,16 @@ void mlx4_unregister_interface(struct mlx4_interface *intf);
64 64
65void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port); 65void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port);
66 66
67static inline u64 mlx4_mac_to_u64(u8 *addr)
68{
69 u64 mac = 0;
70 int i;
71
72 for (i = 0; i < ETH_ALEN; i++) {
73 mac <<= 8;
74 mac |= addr[i];
75 }
76 return mac;
77}
78
67#endif /* MLX4_DRIVER_H */ 79#endif /* MLX4_DRIVER_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 59f8ba84568b..b66e7610d4ee 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -270,9 +270,14 @@ enum {
270 270
271struct mlx4_wqe_ctrl_seg { 271struct mlx4_wqe_ctrl_seg {
272 __be32 owner_opcode; 272 __be32 owner_opcode;
273 __be16 vlan_tag; 273 union {
274 u8 ins_vlan; 274 struct {
275 u8 fence_size; 275 __be16 vlan_tag;
276 u8 ins_vlan;
277 u8 fence_size;
278 };
279 __be32 bf_qpn;
280 };
276 /* 281 /*
277 * High 24 bits are SRC remote buffer; low 8 bits are flags: 282 * High 24 bits are SRC remote buffer; low 8 bits are flags:
278 * [7] SO (strong ordering) 283 * [7] SO (strong ordering)
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index 2202c7f72b75..f6b17ac601bd 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -80,6 +80,7 @@ enum {
80 MLX5_CQE_RESP_SEND_IMM = 3, 80 MLX5_CQE_RESP_SEND_IMM = 3,
81 MLX5_CQE_RESP_SEND_INV = 4, 81 MLX5_CQE_RESP_SEND_INV = 4,
82 MLX5_CQE_RESIZE_CQ = 5, 82 MLX5_CQE_RESIZE_CQ = 5,
83 MLX5_CQE_SIG_ERR = 12,
83 MLX5_CQE_REQ_ERR = 13, 84 MLX5_CQE_REQ_ERR = 13,
84 MLX5_CQE_RESP_ERR = 14, 85 MLX5_CQE_RESP_ERR = 14,
85 MLX5_CQE_INVALID = 15, 86 MLX5_CQE_INVALID = 15,
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 817a6fae6d2c..407bdb67fd4f 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -48,6 +48,8 @@ enum {
48 MLX5_MAX_COMMANDS = 32, 48 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512, 49 MLX5_CMD_DATA_BLOCK_SIZE = 512,
50 MLX5_PCI_CMD_XPORT = 7, 50 MLX5_PCI_CMD_XPORT = 7,
51 MLX5_MKEY_BSF_OCTO_SIZE = 4,
52 MLX5_MAX_PSVS = 4,
51}; 53};
52 54
53enum { 55enum {
@@ -116,6 +118,7 @@ enum {
116 MLX5_MKEY_MASK_START_ADDR = 1ull << 6, 118 MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
117 MLX5_MKEY_MASK_PD = 1ull << 7, 119 MLX5_MKEY_MASK_PD = 1ull << 7,
118 MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8, 120 MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
121 MLX5_MKEY_MASK_EN_SIGERR = 1ull << 9,
119 MLX5_MKEY_MASK_BSF_EN = 1ull << 12, 122 MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
120 MLX5_MKEY_MASK_KEY = 1ull << 13, 123 MLX5_MKEY_MASK_KEY = 1ull << 13,
121 MLX5_MKEY_MASK_QPN = 1ull << 14, 124 MLX5_MKEY_MASK_QPN = 1ull << 14,
@@ -555,6 +558,23 @@ struct mlx5_cqe64 {
555 u8 op_own; 558 u8 op_own;
556}; 559};
557 560
561struct mlx5_sig_err_cqe {
562 u8 rsvd0[16];
563 __be32 expected_trans_sig;
564 __be32 actual_trans_sig;
565 __be32 expected_reftag;
566 __be32 actual_reftag;
567 __be16 syndrome;
568 u8 rsvd22[2];
569 __be32 mkey;
570 __be64 err_offset;
571 u8 rsvd30[8];
572 __be32 qpn;
573 u8 rsvd38[2];
574 u8 signature;
575 u8 op_own;
576};
577
558struct mlx5_wqe_srq_next_seg { 578struct mlx5_wqe_srq_next_seg {
559 u8 rsvd0[2]; 579 u8 rsvd0[2];
560 __be16 next_wqe_index; 580 __be16 next_wqe_index;
@@ -936,4 +956,27 @@ enum {
936 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0 956 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
937}; 957};
938 958
959struct mlx5_allocate_psv_in {
960 struct mlx5_inbox_hdr hdr;
961 __be32 npsv_pd;
962 __be32 rsvd_psv0;
963};
964
965struct mlx5_allocate_psv_out {
966 struct mlx5_outbox_hdr hdr;
967 u8 rsvd[8];
968 __be32 psv_idx[4];
969};
970
971struct mlx5_destroy_psv_in {
972 struct mlx5_inbox_hdr hdr;
973 __be32 psv_number;
974 u8 rsvd[4];
975};
976
977struct mlx5_destroy_psv_out {
978 struct mlx5_outbox_hdr hdr;
979 u8 rsvd[8];
980};
981
939#endif /* MLX5_DEVICE_H */ 982#endif /* MLX5_DEVICE_H */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 130bc8d77fa5..93cef6313e72 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -401,6 +401,26 @@ struct mlx5_eq {
401 struct mlx5_rsc_debug *dbg; 401 struct mlx5_rsc_debug *dbg;
402}; 402};
403 403
404struct mlx5_core_psv {
405 u32 psv_idx;
406 struct psv_layout {
407 u32 pd;
408 u16 syndrome;
409 u16 reserved;
410 u16 bg;
411 u16 app_tag;
412 u32 ref_tag;
413 } psv;
414};
415
416struct mlx5_core_sig_ctx {
417 struct mlx5_core_psv psv_memory;
418 struct mlx5_core_psv psv_wire;
419 struct ib_sig_err err_item;
420 bool sig_status_checked;
421 bool sig_err_exists;
422 u32 sigerr_count;
423};
404 424
405struct mlx5_core_mr { 425struct mlx5_core_mr {
406 u64 iova; 426 u64 iova;
@@ -475,6 +495,13 @@ struct mlx5_srq_table {
475 struct radix_tree_root tree; 495 struct radix_tree_root tree;
476}; 496};
477 497
498struct mlx5_mr_table {
499 /* protect radix tree
500 */
501 rwlock_t lock;
502 struct radix_tree_root tree;
503};
504
478struct mlx5_priv { 505struct mlx5_priv {
479 char name[MLX5_MAX_NAME_LEN]; 506 char name[MLX5_MAX_NAME_LEN];
480 struct mlx5_eq_table eq_table; 507 struct mlx5_eq_table eq_table;
@@ -504,6 +531,10 @@ struct mlx5_priv {
504 struct mlx5_cq_table cq_table; 531 struct mlx5_cq_table cq_table;
505 /* end: cq staff */ 532 /* end: cq staff */
506 533
534 /* start: mr staff */
535 struct mlx5_mr_table mr_table;
536 /* end: mr staff */
537
507 /* start: alloc staff */ 538 /* start: alloc staff */
508 struct mutex pgdir_mutex; 539 struct mutex pgdir_mutex;
509 struct list_head pgdir_list; 540 struct list_head pgdir_list;
@@ -651,6 +682,11 @@ static inline void mlx5_vfree(const void *addr)
651 kfree(addr); 682 kfree(addr);
652} 683}
653 684
685static inline u32 mlx5_base_mkey(const u32 key)
686{
687 return key & 0xffffff00u;
688}
689
654int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev); 690int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev);
655void mlx5_dev_cleanup(struct mlx5_core_dev *dev); 691void mlx5_dev_cleanup(struct mlx5_core_dev *dev);
656int mlx5_cmd_init(struct mlx5_core_dev *dev); 692int mlx5_cmd_init(struct mlx5_core_dev *dev);
@@ -685,6 +721,8 @@ int mlx5_core_query_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
685 struct mlx5_query_srq_mbox_out *out); 721 struct mlx5_query_srq_mbox_out *out);
686int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, 722int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
687 u16 lwm, int is_srq); 723 u16 lwm, int is_srq);
724void mlx5_init_mr_table(struct mlx5_core_dev *dev);
725void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev);
688int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, 726int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
689 struct mlx5_create_mkey_mbox_in *in, int inlen, 727 struct mlx5_create_mkey_mbox_in *in, int inlen,
690 mlx5_cmd_cbk_t callback, void *context, 728 mlx5_cmd_cbk_t callback, void *context,
@@ -746,6 +784,9 @@ void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
746const char *mlx5_command_str(int command); 784const char *mlx5_command_str(int command);
747int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); 785int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
748void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev); 786void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
787int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn,
788 int npsvs, u32 *sig_index);
789int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num);
749 790
750static inline u32 mlx5_mkey_to_idx(u32 mkey) 791static inline u32 mlx5_mkey_to_idx(u32 mkey)
751{ 792{
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index d51eff713549..f829ad80ff28 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -37,6 +37,9 @@
37#include <linux/mlx5/driver.h> 37#include <linux/mlx5/driver.h>
38 38
39#define MLX5_INVALID_LKEY 0x100 39#define MLX5_INVALID_LKEY 0x100
40#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5)
41#define MLX5_DIF_SIZE 8
42#define MLX5_STRIDE_BLOCK_OP 0x400
40 43
41enum mlx5_qp_optpar { 44enum mlx5_qp_optpar {
42 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0, 45 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
@@ -151,6 +154,11 @@ enum {
151 MLX5_SND_DBR = 1, 154 MLX5_SND_DBR = 1,
152}; 155};
153 156
157enum {
158 MLX5_FLAGS_INLINE = 1<<7,
159 MLX5_FLAGS_CHECK_FREE = 1<<5,
160};
161
154struct mlx5_wqe_fmr_seg { 162struct mlx5_wqe_fmr_seg {
155 __be32 flags; 163 __be32 flags;
156 __be32 mem_key; 164 __be32 mem_key;
@@ -278,6 +286,60 @@ struct mlx5_wqe_inline_seg {
278 __be32 byte_count; 286 __be32 byte_count;
279}; 287};
280 288
289struct mlx5_bsf {
290 struct mlx5_bsf_basic {
291 u8 bsf_size_sbs;
292 u8 check_byte_mask;
293 union {
294 u8 copy_byte_mask;
295 u8 bs_selector;
296 u8 rsvd_wflags;
297 } wire;
298 union {
299 u8 bs_selector;
300 u8 rsvd_mflags;
301 } mem;
302 __be32 raw_data_size;
303 __be32 w_bfs_psv;
304 __be32 m_bfs_psv;
305 } basic;
306 struct mlx5_bsf_ext {
307 __be32 t_init_gen_pro_size;
308 __be32 rsvd_epi_size;
309 __be32 w_tfs_psv;
310 __be32 m_tfs_psv;
311 } ext;
312 struct mlx5_bsf_inl {
313 __be32 w_inl_vld;
314 __be32 w_rsvd;
315 __be64 w_block_format;
316 __be32 m_inl_vld;
317 __be32 m_rsvd;
318 __be64 m_block_format;
319 } inl;
320};
321
322struct mlx5_klm {
323 __be32 bcount;
324 __be32 key;
325 __be64 va;
326};
327
328struct mlx5_stride_block_entry {
329 __be16 stride;
330 __be16 bcount;
331 __be32 key;
332 __be64 va;
333};
334
335struct mlx5_stride_block_ctrl_seg {
336 __be32 bcount_per_cycle;
337 __be32 op;
338 __be32 repeat_count;
339 u16 rsvd;
340 __be16 num_entries;
341};
342
281struct mlx5_core_qp { 343struct mlx5_core_qp {
282 void (*event) (struct mlx5_core_qp *, int); 344 void (*event) (struct mlx5_core_qp *, int);
283 int qpn; 345 int qpn;
@@ -444,6 +506,11 @@ static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u
444 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn); 506 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
445} 507}
446 508
509static inline struct mlx5_core_mr *__mlx5_mr_lookup(struct mlx5_core_dev *dev, u32 key)
510{
511 return radix_tree_lookup(&dev->priv.mr_table.tree, key);
512}
513
447int mlx5_core_create_qp(struct mlx5_core_dev *dev, 514int mlx5_core_create_qp(struct mlx5_core_dev *dev,
448 struct mlx5_core_qp *qp, 515 struct mlx5_core_qp *qp,
449 struct mlx5_create_qp_mbox_in *in, 516 struct mlx5_create_qp_mbox_in *in,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a0df4295e171..bf9811e1321a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -177,6 +177,9 @@ extern unsigned int kobjsize(const void *objp);
177 */ 177 */
178#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP) 178#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP)
179 179
180/* This mask defines which mm->def_flags a process can inherit its parent */
181#define VM_INIT_DEF_MASK VM_NOHUGEPAGE
182
180/* 183/*
181 * mapping from the currently active vm_flags protection bits (the 184 * mapping from the currently active vm_flags protection bits (the
182 * low four bits) to a page protection mask.. 185 * low four bits) to a page protection mask..
@@ -210,6 +213,10 @@ struct vm_fault {
210 * is set (which is also implied by 213 * is set (which is also implied by
211 * VM_FAULT_ERROR). 214 * VM_FAULT_ERROR).
212 */ 215 */
216 /* for ->map_pages() only */
217 pgoff_t max_pgoff; /* map pages for offset from pgoff till
218 * max_pgoff inclusive */
219 pte_t *pte; /* pte entry associated with ->pgoff */
213}; 220};
214 221
215/* 222/*
@@ -221,6 +228,7 @@ struct vm_operations_struct {
221 void (*open)(struct vm_area_struct * area); 228 void (*open)(struct vm_area_struct * area);
222 void (*close)(struct vm_area_struct * area); 229 void (*close)(struct vm_area_struct * area);
223 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); 230 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
231 void (*map_pages)(struct vm_area_struct *vma, struct vm_fault *vmf);
224 232
225 /* notification that a previously read-only page is about to become 233 /* notification that a previously read-only page is about to become
226 * writable, if an error is returned it will cause a SIGBUS */ 234 * writable, if an error is returned it will cause a SIGBUS */
@@ -581,6 +589,9 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
581 pte = pte_mkwrite(pte); 589 pte = pte_mkwrite(pte);
582 return pte; 590 return pte;
583} 591}
592
593void do_set_pte(struct vm_area_struct *vma, unsigned long address,
594 struct page *page, pte_t *pte, bool write, bool anon);
584#endif 595#endif
585 596
586/* 597/*
@@ -684,7 +695,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
684#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 695#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
685#define NODES_MASK ((1UL << NODES_WIDTH) - 1) 696#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
686#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 697#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
687#define LAST_CPUPID_MASK ((1UL << LAST_CPUPID_WIDTH) - 1) 698#define LAST_CPUPID_MASK ((1UL << LAST_CPUPID_SHIFT) - 1)
688#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1) 699#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
689 700
690static inline enum zone_type page_zonenum(const struct page *page) 701static inline enum zone_type page_zonenum(const struct page *page)
@@ -1041,6 +1052,14 @@ extern void show_free_areas(unsigned int flags);
1041extern bool skip_free_areas_node(unsigned int flags, int nid); 1052extern bool skip_free_areas_node(unsigned int flags, int nid);
1042 1053
1043int shmem_zero_setup(struct vm_area_struct *); 1054int shmem_zero_setup(struct vm_area_struct *);
1055#ifdef CONFIG_SHMEM
1056bool shmem_mapping(struct address_space *mapping);
1057#else
1058static inline bool shmem_mapping(struct address_space *mapping)
1059{
1060 return false;
1061}
1062#endif
1044 1063
1045extern int can_do_mlock(void); 1064extern int can_do_mlock(void);
1046extern int user_shm_lock(size_t, struct user_struct *); 1065extern int user_shm_lock(size_t, struct user_struct *);
@@ -1185,6 +1204,7 @@ void account_page_writeback(struct page *page);
1185int set_page_dirty(struct page *page); 1204int set_page_dirty(struct page *page);
1186int set_page_dirty_lock(struct page *page); 1205int set_page_dirty_lock(struct page *page);
1187int clear_page_dirty_for_io(struct page *page); 1206int clear_page_dirty_for_io(struct page *page);
1207int get_cmdline(struct task_struct *task, char *buffer, int buflen);
1188 1208
1189/* Is the vma a continuation of the stack vma above it? */ 1209/* Is the vma a continuation of the stack vma above it? */
1190static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr) 1210static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr)
@@ -1658,10 +1678,8 @@ static inline int __early_pfn_to_nid(unsigned long pfn)
1658#else 1678#else
1659/* please see mm/page_alloc.c */ 1679/* please see mm/page_alloc.c */
1660extern int __meminit early_pfn_to_nid(unsigned long pfn); 1680extern int __meminit early_pfn_to_nid(unsigned long pfn);
1661#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
1662/* there is a per-arch backend function. */ 1681/* there is a per-arch backend function. */
1663extern int __meminit __early_pfn_to_nid(unsigned long pfn); 1682extern int __meminit __early_pfn_to_nid(unsigned long pfn);
1664#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
1665#endif 1683#endif
1666 1684
1667extern void set_dma_reserve(unsigned long new_dma_reserve); 1685extern void set_dma_reserve(unsigned long new_dma_reserve);
@@ -1756,6 +1774,9 @@ extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file);
1756extern struct file *get_mm_exe_file(struct mm_struct *mm); 1774extern struct file *get_mm_exe_file(struct mm_struct *mm);
1757 1775
1758extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); 1776extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
1777extern struct vm_area_struct *_install_special_mapping(struct mm_struct *mm,
1778 unsigned long addr, unsigned long len,
1779 unsigned long flags, struct page **pages);
1759extern int install_special_mapping(struct mm_struct *mm, 1780extern int install_special_mapping(struct mm_struct *mm,
1760 unsigned long addr, unsigned long len, 1781 unsigned long addr, unsigned long len,
1761 unsigned long flags, struct page **pages); 1782 unsigned long flags, struct page **pages);
@@ -1823,9 +1844,11 @@ vm_unmapped_area(struct vm_unmapped_area_info *info)
1823extern void truncate_inode_pages(struct address_space *, loff_t); 1844extern void truncate_inode_pages(struct address_space *, loff_t);
1824extern void truncate_inode_pages_range(struct address_space *, 1845extern void truncate_inode_pages_range(struct address_space *,
1825 loff_t lstart, loff_t lend); 1846 loff_t lstart, loff_t lend);
1847extern void truncate_inode_pages_final(struct address_space *);
1826 1848
1827/* generic vm_area_ops exported for stackable file systems */ 1849/* generic vm_area_ops exported for stackable file systems */
1828extern int filemap_fault(struct vm_area_struct *, struct vm_fault *); 1850extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
1851extern void filemap_map_pages(struct vm_area_struct *vma, struct vm_fault *vmf);
1829extern int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); 1852extern int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
1830 1853
1831/* mm/page-writeback.c */ 1854/* mm/page-writeback.c */
@@ -1853,9 +1876,6 @@ void page_cache_async_readahead(struct address_space *mapping,
1853 unsigned long size); 1876 unsigned long size);
1854 1877
1855unsigned long max_sane_readahead(unsigned long nr); 1878unsigned long max_sane_readahead(unsigned long nr);
1856unsigned long ra_submit(struct file_ra_state *ra,
1857 struct address_space *mapping,
1858 struct file *filp);
1859 1879
1860/* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ 1880/* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
1861extern int expand_stack(struct vm_area_struct *vma, unsigned long address); 1881extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 290901a8c1de..8967e20cbe57 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -124,6 +124,8 @@ struct page {
124 union { 124 union {
125 struct list_head lru; /* Pageout list, eg. active_list 125 struct list_head lru; /* Pageout list, eg. active_list
126 * protected by zone->lru_lock ! 126 * protected by zone->lru_lock !
127 * Can be used as a generic list
128 * by the page owner.
127 */ 129 */
128 struct { /* slub per cpu partial pages */ 130 struct { /* slub per cpu partial pages */
129 struct page *next; /* Next partial slab */ 131 struct page *next; /* Next partial slab */
@@ -136,7 +138,6 @@ struct page {
136#endif 138#endif
137 }; 139 };
138 140
139 struct list_head list; /* slobs list of pages */
140 struct slab *slab_page; /* slab fields */ 141 struct slab *slab_page; /* slab fields */
141 struct rcu_head rcu_head; /* Used by SLAB 142 struct rcu_head rcu_head; /* Used by SLAB
142 * when destroying via RCU 143 * when destroying via RCU
@@ -342,9 +343,9 @@ struct mm_rss_stat {
342 343
343struct kioctx_table; 344struct kioctx_table;
344struct mm_struct { 345struct mm_struct {
345 struct vm_area_struct * mmap; /* list of VMAs */ 346 struct vm_area_struct *mmap; /* list of VMAs */
346 struct rb_root mm_rb; 347 struct rb_root mm_rb;
347 struct vm_area_struct * mmap_cache; /* last find_vma result */ 348 u32 vmacache_seqnum; /* per-thread vmacache */
348#ifdef CONFIG_MMU 349#ifdef CONFIG_MMU
349 unsigned long (*get_unmapped_area) (struct file *filp, 350 unsigned long (*get_unmapped_area) (struct file *filp,
350 unsigned long addr, unsigned long len, 351 unsigned long addr, unsigned long len,
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 87079fc38011..f206e29f94d7 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -95,7 +95,7 @@ struct mmc_command {
95 * actively failing requests 95 * actively failing requests
96 */ 96 */
97 97
98 unsigned int cmd_timeout_ms; /* in milliseconds */ 98 unsigned int busy_timeout; /* busy detect timeout in ms */
99 /* Set this flag only for blocking sanitize request */ 99 /* Set this flag only for blocking sanitize request */
100 bool sanitize_busy; 100 bool sanitize_busy;
101 101
@@ -152,7 +152,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
152 struct mmc_command *, int); 152 struct mmc_command *, int);
153extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); 153extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
154extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool, 154extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool,
155 bool); 155 bool, bool);
156extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 156extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
157extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd); 157extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
158 158
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 99f5709ac343..cb61ea4d6945 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -264,15 +264,12 @@ struct mmc_host {
264 u32 caps2; /* More host capabilities */ 264 u32 caps2; /* More host capabilities */
265 265
266#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 266#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
267#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
268#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */ 267#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
269#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
270#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
271#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 269#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
272#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ 270#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
273#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 271#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
274 MMC_CAP2_HS200_1_2V_SDR) 272 MMC_CAP2_HS200_1_2V_SDR)
275#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
276#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 273#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
277#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 274#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
278#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 275#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
@@ -281,7 +278,6 @@ struct mmc_host {
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 278#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR) 279 MMC_CAP2_PACKED_WR)
283#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 280#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
284#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
285 281
286 mmc_pm_flag_t pm_caps; /* supported pm features */ 282 mmc_pm_flag_t pm_caps; /* supported pm features */
287 283
@@ -304,7 +300,7 @@ struct mmc_host {
304 unsigned int max_req_size; /* maximum number of bytes in one req */ 300 unsigned int max_req_size; /* maximum number of bytes in one req */
305 unsigned int max_blk_size; /* maximum size of one mmc block */ 301 unsigned int max_blk_size; /* maximum size of one mmc block */
306 unsigned int max_blk_count; /* maximum number of blocks in one req */ 302 unsigned int max_blk_count; /* maximum number of blocks in one req */
307 unsigned int max_discard_to; /* max. discard timeout in ms */ 303 unsigned int max_busy_timeout; /* max busy timeout in ms */
308 304
309 /* private data */ 305 /* private data */
310 spinlock_t lock; /* lock for claim and bus ops */ 306 spinlock_t lock; /* lock for claim and bus ops */
@@ -388,8 +384,6 @@ int mmc_power_restore_host(struct mmc_host *host);
388void mmc_detect_change(struct mmc_host *, unsigned long delay); 384void mmc_detect_change(struct mmc_host *, unsigned long delay);
389void mmc_request_done(struct mmc_host *, struct mmc_request *); 385void mmc_request_done(struct mmc_host *, struct mmc_request *);
390 386
391int mmc_cache_ctrl(struct mmc_host *, u8);
392
393static inline void mmc_signal_sdio_irq(struct mmc_host *host) 387static inline void mmc_signal_sdio_irq(struct mmc_host *host)
394{ 388{
395 host->ops->enable_sdio_irq(host, 0); 389 host->ops->enable_sdio_irq(host, 0);
@@ -424,12 +418,9 @@ static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
424 418
425int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 419int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
426 420
427/* Module parameter */
428extern bool mmc_assume_removable;
429
430static inline int mmc_card_is_removable(struct mmc_host *host) 421static inline int mmc_card_is_removable(struct mmc_host *host)
431{ 422{
432 return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable; 423 return !(host->caps & MMC_CAP_NONREMOVABLE);
433} 424}
434 425
435static inline int mmc_card_keep_power(struct mmc_host *host) 426static inline int mmc_card_keep_power(struct mmc_host *host)
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
index e78c0e236e9d..8cc095a76cf8 100644
--- a/include/linux/mmc/sdhci-spear.h
+++ b/include/linux/mmc/sdhci-spear.h
@@ -18,17 +18,9 @@
18/* 18/*
19 * struct sdhci_plat_data: spear sdhci platform data structure 19 * struct sdhci_plat_data: spear sdhci platform data structure
20 * 20 *
21 * @card_power_gpio: gpio pin for enabling/disabling power to sdhci socket
22 * @power_active_high: if set, enable power to sdhci socket by setting
23 * card_power_gpio
24 * @power_always_enb: If set, then enable power on probe, otherwise enable only
25 * on card insertion and disable on card removal.
26 * card_int_gpio: gpio pin used for card detection 21 * card_int_gpio: gpio pin used for card detection
27 */ 22 */
28struct sdhci_plat_data { 23struct sdhci_plat_data {
29 int card_power_gpio;
30 int power_active_high;
31 int power_always_enb;
32 int card_int_gpio; 24 int card_int_gpio;
33}; 25};
34 26
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 362927c48f97..7be12b883485 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -100,6 +100,8 @@ struct sdhci_host {
100#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5) 100#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
101/* Controller does not support HS200 */ 101/* Controller does not support HS200 */
102#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6) 102#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6)
103/* Controller does not support DDR50 */
104#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
103 105
104 int irq; /* Device IRQ */ 106 int irq; /* Device IRQ */
105 void __iomem *ioaddr; /* Mapped address */ 107 void __iomem *ioaddr; /* Mapped address */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index d8836623f36a..0f01fe065424 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -31,6 +31,7 @@
31#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334 31#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334
32#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 32#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
33#define SDIO_DEVICE_ID_BROADCOM_43362 43362 33#define SDIO_DEVICE_ID_BROADCOM_43362 43362
34#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
34 35
35#define SDIO_VENDOR_ID_INTEL 0x0089 36#define SDIO_VENDOR_ID_INTEL 0x0089
36#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 37#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index b0c73e4cacea..d2433381e828 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -22,4 +22,10 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
22 unsigned int debounce); 22 unsigned int debounce);
23void mmc_gpio_free_cd(struct mmc_host *host); 23void mmc_gpio_free_cd(struct mmc_host *host);
24 24
25int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
26 unsigned int idx, bool override_active_level,
27 unsigned int debounce);
28void mmc_gpiod_free_cd(struct mmc_host *host);
29void mmc_gpiod_request_cd_irq(struct mmc_host *host);
30
25#endif 31#endif
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 5042c036dda9..2d57efa64cc1 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -3,8 +3,8 @@
3 3
4struct page; 4struct page;
5 5
6extern void dump_page(struct page *page, char *reason); 6extern void dump_page(struct page *page, const char *reason);
7extern void dump_page_badflags(struct page *page, char *reason, 7extern void dump_page_badflags(struct page *page, const char *reason,
8 unsigned long badflags); 8 unsigned long badflags);
9 9
10#ifdef CONFIG_DEBUG_VM 10#ifdef CONFIG_DEBUG_VM
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9b61b9bf81ac..fac5509c18f0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -142,6 +142,9 @@ enum zone_stat_item {
142 NUMA_LOCAL, /* allocation from local node */ 142 NUMA_LOCAL, /* allocation from local node */
143 NUMA_OTHER, /* allocation from other node */ 143 NUMA_OTHER, /* allocation from other node */
144#endif 144#endif
145 WORKINGSET_REFAULT,
146 WORKINGSET_ACTIVATE,
147 WORKINGSET_NODERECLAIM,
145 NR_ANON_TRANSPARENT_HUGEPAGES, 148 NR_ANON_TRANSPARENT_HUGEPAGES,
146 NR_FREE_CMA_PAGES, 149 NR_FREE_CMA_PAGES,
147 NR_VM_ZONE_STAT_ITEMS }; 150 NR_VM_ZONE_STAT_ITEMS };
@@ -392,6 +395,9 @@ struct zone {
392 spinlock_t lru_lock; 395 spinlock_t lru_lock;
393 struct lruvec lruvec; 396 struct lruvec lruvec;
394 397
398 /* Evictions & activations on the inactive file list */
399 atomic_long_t inactive_age;
400
395 unsigned long pages_scanned; /* since last reclaim */ 401 unsigned long pages_scanned; /* since last reclaim */
396 unsigned long flags; /* zone flags, see below */ 402 unsigned long flags; /* zone flags, see below */
397 403
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 45e921401b06..44eeef0da186 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -432,6 +432,14 @@ struct spi_device_id {
432 kernel_ulong_t driver_data; /* Data private to the driver */ 432 kernel_ulong_t driver_data; /* Data private to the driver */
433}; 433};
434 434
435#define SPMI_NAME_SIZE 32
436#define SPMI_MODULE_PREFIX "spmi:"
437
438struct spmi_device_id {
439 char name[SPMI_NAME_SIZE];
440 kernel_ulong_t driver_data; /* Data private to the driver */
441};
442
435/* dmi */ 443/* dmi */
436enum dmi_field { 444enum dmi_field {
437 DMI_NONE, 445 DMI_NONE,
@@ -548,6 +556,11 @@ struct amba_id {
548 * See documentation of "x86_match_cpu" for details. 556 * See documentation of "x86_match_cpu" for details.
549 */ 557 */
550 558
559/*
560 * MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id.
561 * Although gcc seems to ignore this error, clang fails without this define.
562 */
563#define x86cpu_device_id x86_cpu_id
551struct x86_cpu_id { 564struct x86_cpu_id {
552 __u16 vendor; 565 __u16 vendor;
553 __u16 family; 566 __u16 family;
@@ -564,6 +577,15 @@ struct x86_cpu_id {
564#define X86_MODEL_ANY 0 577#define X86_MODEL_ANY 0
565#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ 578#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
566 579
580/*
581 * Generic table type for matching CPU features.
582 * @feature: the bit number of the feature (0 - 65535)
583 */
584
585struct cpu_feature {
586 __u16 feature;
587};
588
567#define IPACK_ANY_FORMAT 0xff 589#define IPACK_ANY_FORMAT 0xff
568#define IPACK_ANY_ID (~0) 590#define IPACK_ANY_ID (~0)
569struct ipack_device_id { 591struct ipack_device_id {
@@ -599,4 +621,9 @@ struct rio_device_id {
599 __u16 asm_did, asm_vid; 621 __u16 asm_did, asm_vid;
600}; 622};
601 623
624struct mcb_device_id {
625 __u16 device;
626 kernel_ulong_t driver_data;
627};
628
602#endif /* LINUX_MOD_DEVICETABLE_H */ 629#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index eaf60ff9ba94..f520a767c86c 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -15,7 +15,7 @@
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/tracepoint.h> 18#include <linux/jump_label.h>
19#include <linux/export.h> 19#include <linux/export.h>
20 20
21#include <linux/percpu.h> 21#include <linux/percpu.h>
@@ -82,15 +82,6 @@ void sort_extable(struct exception_table_entry *start,
82void sort_main_extable(void); 82void sort_main_extable(void);
83void trim_init_extable(struct module *m); 83void trim_init_extable(struct module *m);
84 84
85#ifdef MODULE
86#define MODULE_GENERIC_TABLE(gtype, name) \
87extern const struct gtype##_id __mod_##gtype##_table \
88 __attribute__ ((unused, alias(__stringify(name))))
89
90#else /* !MODULE */
91#define MODULE_GENERIC_TABLE(gtype, name)
92#endif
93
94/* Generic info of form tag = "info" */ 85/* Generic info of form tag = "info" */
95#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) 86#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
96 87
@@ -141,8 +132,14 @@ extern const struct gtype##_id __mod_##gtype##_table \
141/* What your module does. */ 132/* What your module does. */
142#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) 133#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
143 134
144#define MODULE_DEVICE_TABLE(type, name) \ 135#ifdef MODULE
145 MODULE_GENERIC_TABLE(type##_device, name) 136/* Creates an alias so file2alias.c can find device table. */
137#define MODULE_DEVICE_TABLE(type, name) \
138 extern const struct type##_device_id __mod_##type##__##name##_device_table \
139 __attribute__ ((unused, alias(__stringify(name))))
140#else /* !MODULE */
141#define MODULE_DEVICE_TABLE(type, name)
142#endif
146 143
147/* Version of form [<epoch>:]<version>[-<extra-version>]. 144/* Version of form [<epoch>:]<version>[-<extra-version>].
148 * Or for CVS/RCS ID version, everything but the number is stripped. 145 * Or for CVS/RCS ID version, everything but the number is stripped.
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index c3eb102a9cc8..204a67743804 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -186,14 +186,12 @@ struct kparam_array
186 parameters. */ 186 parameters. */
187#define __module_param_call(prefix, name, ops, arg, perm, level) \ 187#define __module_param_call(prefix, name, ops, arg, perm, level) \
188 /* Default value instead of permissions? */ \ 188 /* Default value instead of permissions? */ \
189 static int __param_perm_check_##name __attribute__((unused)) = \ 189 static const char __param_str_##name[] = prefix #name; \
190 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
191 + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \
192 static const char __param_str_##name[] = prefix #name; \
193 static struct kernel_param __moduleparam_const __param_##name \ 190 static struct kernel_param __moduleparam_const __param_##name \
194 __used \ 191 __used \
195 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 192 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
196 = { __param_str_##name, ops, perm, level, { arg } } 193 = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \
194 level, { arg } }
197 195
198/* Obsolete - use module_param_cb() */ 196/* Obsolete - use module_param_cb() */
199#define module_param_call(name, set, get, arg, perm) \ 197#define module_param_call(name, set, get, arg, perm) \
@@ -346,7 +344,7 @@ static inline void destroy_params(const struct kernel_param *params,
346/* The macros to do compile-time type checking stolen from Jakub 344/* The macros to do compile-time type checking stolen from Jakub
347 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */ 345 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */
348#define __param_check(name, p, type) \ 346#define __param_check(name, p, type) \
349 static inline type *__check_##name(void) { return(p); } 347 static inline type __always_unused *__check_##name(void) { return(p); }
350 348
351extern struct kernel_param_ops param_ops_byte; 349extern struct kernel_param_ops param_ops_byte;
352extern int param_set_byte(const char *val, const struct kernel_param *kp); 350extern int param_set_byte(const char *val, const struct kernel_param *kp);
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 371d346fa270..839bac270904 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -44,6 +44,8 @@ struct mnt_namespace;
44#define MNT_SHARED_MASK (MNT_UNBINDABLE) 44#define MNT_SHARED_MASK (MNT_UNBINDABLE)
45#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE) 45#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE)
46 46
47#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
48 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED)
47 49
48#define MNT_INTERNAL 0x4000 50#define MNT_INTERNAL 0x4000
49 51
@@ -51,6 +53,7 @@ struct mnt_namespace;
51#define MNT_LOCKED 0x800000 53#define MNT_LOCKED 0x800000
52#define MNT_DOOMED 0x1000000 54#define MNT_DOOMED 0x1000000
53#define MNT_SYNC_UMOUNT 0x2000000 55#define MNT_SYNC_UMOUNT 0x2000000
56#define MNT_MARKED 0x4000000
54 57
55struct vfsmount { 58struct vfsmount {
56 struct dentry *mnt_root; /* root of the mounted tree */ 59 struct dentry *mnt_root; /* root of the mounted tree */
diff --git a/include/linux/mpls.h b/include/linux/mpls.h
new file mode 100644
index 000000000000..9999145bc190
--- /dev/null
+++ b/include/linux/mpls.h
@@ -0,0 +1,6 @@
1#ifndef _LINUX_MPLS_H
2#define _LINUX_MPLS_H
3
4#include <uapi/linux/mpls.h>
5
6#endif /* _LINUX_MPLS_H */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 8cc0e2fb6894..a1b0b4c8fd79 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -204,12 +204,12 @@ struct mtd_info {
204 struct mtd_oob_ops *ops); 204 struct mtd_oob_ops *ops);
205 int (*_write_oob) (struct mtd_info *mtd, loff_t to, 205 int (*_write_oob) (struct mtd_info *mtd, loff_t to,
206 struct mtd_oob_ops *ops); 206 struct mtd_oob_ops *ops);
207 int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, 207 int (*_get_fact_prot_info) (struct mtd_info *mtd, size_t len,
208 size_t len); 208 size_t *retlen, struct otp_info *buf);
209 int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, 209 int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
210 size_t len, size_t *retlen, u_char *buf); 210 size_t len, size_t *retlen, u_char *buf);
211 int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, 211 int (*_get_user_prot_info) (struct mtd_info *mtd, size_t len,
212 size_t len); 212 size_t *retlen, struct otp_info *buf);
213 int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from, 213 int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from,
214 size_t len, size_t *retlen, u_char *buf); 214 size_t len, size_t *retlen, u_char *buf);
215 int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to, 215 int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to,
@@ -278,12 +278,12 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
278 return mtd->_write_oob(mtd, to, ops); 278 return mtd->_write_oob(mtd, to, ops);
279} 279}
280 280
281int mtd_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf, 281int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen,
282 size_t len); 282 struct otp_info *buf);
283int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, 283int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
284 size_t *retlen, u_char *buf); 284 size_t *retlen, u_char *buf);
285int mtd_get_user_prot_info(struct mtd_info *mtd, struct otp_info *buf, 285int mtd_get_user_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen,
286 size_t len); 286 struct otp_info *buf);
287int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, 287int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
288 size_t *retlen, u_char *buf); 288 size_t *retlen, u_char *buf);
289int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len, 289int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len,
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 32f8612469d8..450d61ec7f06 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -52,14 +52,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
52#define NAND_MAX_CHIPS 8 52#define NAND_MAX_CHIPS 8
53 53
54/* 54/*
55 * This constant declares the max. oobsize / page, which
56 * is supported now. If you add a chip with bigger oobsize/page
57 * adjust this accordingly.
58 */
59#define NAND_MAX_OOBSIZE 744
60#define NAND_MAX_PAGESIZE 8192
61
62/*
63 * Constants for hardware specific CLE/ALE/NCE function 55 * Constants for hardware specific CLE/ALE/NCE function
64 * 56 *
65 * These are bits which can be or'ed to set/clear multiple 57 * These are bits which can be or'ed to set/clear multiple
@@ -350,6 +342,84 @@ struct nand_onfi_vendor_micron {
350 u8 param_revision; 342 u8 param_revision;
351} __packed; 343} __packed;
352 344
345struct jedec_ecc_info {
346 u8 ecc_bits;
347 u8 codeword_size;
348 __le16 bb_per_lun;
349 __le16 block_endurance;
350 u8 reserved[2];
351} __packed;
352
353/* JEDEC features */
354#define JEDEC_FEATURE_16_BIT_BUS (1 << 0)
355
356struct nand_jedec_params {
357 /* rev info and features block */
358 /* 'J' 'E' 'S' 'D' */
359 u8 sig[4];
360 __le16 revision;
361 __le16 features;
362 u8 opt_cmd[3];
363 __le16 sec_cmd;
364 u8 num_of_param_pages;
365 u8 reserved0[18];
366
367 /* manufacturer information block */
368 char manufacturer[12];
369 char model[20];
370 u8 jedec_id[6];
371 u8 reserved1[10];
372
373 /* memory organization block */
374 __le32 byte_per_page;
375 __le16 spare_bytes_per_page;
376 u8 reserved2[6];
377 __le32 pages_per_block;
378 __le32 blocks_per_lun;
379 u8 lun_count;
380 u8 addr_cycles;
381 u8 bits_per_cell;
382 u8 programs_per_page;
383 u8 multi_plane_addr;
384 u8 multi_plane_op_attr;
385 u8 reserved3[38];
386
387 /* electrical parameter block */
388 __le16 async_sdr_speed_grade;
389 __le16 toggle_ddr_speed_grade;
390 __le16 sync_ddr_speed_grade;
391 u8 async_sdr_features;
392 u8 toggle_ddr_features;
393 u8 sync_ddr_features;
394 __le16 t_prog;
395 __le16 t_bers;
396 __le16 t_r;
397 __le16 t_r_multi_plane;
398 __le16 t_ccs;
399 __le16 io_pin_capacitance_typ;
400 __le16 input_pin_capacitance_typ;
401 __le16 clk_pin_capacitance_typ;
402 u8 driver_strength_support;
403 __le16 t_ald;
404 u8 reserved4[36];
405
406 /* ECC and endurance block */
407 u8 guaranteed_good_blocks;
408 __le16 guaranteed_block_endurance;
409 struct jedec_ecc_info ecc_info[4];
410 u8 reserved5[29];
411
412 /* reserved */
413 u8 reserved6[148];
414
415 /* vendor */
416 __le16 vendor_rev_num;
417 u8 reserved7[88];
418
419 /* CRC for Parameter Page */
420 __le16 crc;
421} __packed;
422
353/** 423/**
354 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 424 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
355 * @lock: protection lock 425 * @lock: protection lock
@@ -418,7 +488,7 @@ struct nand_ecc_ctrl {
418 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, 488 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
419 uint8_t *buf, int oob_required, int page); 489 uint8_t *buf, int oob_required, int page);
420 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 490 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
421 uint32_t offs, uint32_t len, uint8_t *buf); 491 uint32_t offs, uint32_t len, uint8_t *buf, int page);
422 int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 492 int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
423 uint32_t offset, uint32_t data_len, 493 uint32_t offset, uint32_t data_len,
424 const uint8_t *data_buf, int oob_required); 494 const uint8_t *data_buf, int oob_required);
@@ -435,17 +505,17 @@ struct nand_ecc_ctrl {
435 505
436/** 506/**
437 * struct nand_buffers - buffer structure for read/write 507 * struct nand_buffers - buffer structure for read/write
438 * @ecccalc: buffer for calculated ECC 508 * @ecccalc: buffer pointer for calculated ECC, size is oobsize.
439 * @ecccode: buffer for ECC read from flash 509 * @ecccode: buffer pointer for ECC read from flash, size is oobsize.
440 * @databuf: buffer for data - dynamically sized 510 * @databuf: buffer pointer for data, size is (page size + oobsize).
441 * 511 *
442 * Do not change the order of buffers. databuf and oobrbuf must be in 512 * Do not change the order of buffers. databuf and oobrbuf must be in
443 * consecutive order. 513 * consecutive order.
444 */ 514 */
445struct nand_buffers { 515struct nand_buffers {
446 uint8_t ecccalc[NAND_MAX_OOBSIZE]; 516 uint8_t *ecccalc;
447 uint8_t ecccode[NAND_MAX_OOBSIZE]; 517 uint8_t *ecccode;
448 uint8_t databuf[NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE]; 518 uint8_t *databuf;
449}; 519};
450 520
451/** 521/**
@@ -523,8 +593,12 @@ struct nand_buffers {
523 * @subpagesize: [INTERN] holds the subpagesize 593 * @subpagesize: [INTERN] holds the subpagesize
524 * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded), 594 * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded),
525 * non 0 if ONFI supported. 595 * non 0 if ONFI supported.
596 * @jedec_version: [INTERN] holds the chip JEDEC version (BCD encoded),
597 * non 0 if JEDEC supported.
526 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is 598 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is
527 * supported, 0 otherwise. 599 * supported, 0 otherwise.
600 * @jedec_params: [INTERN] holds the JEDEC parameter page when JEDEC is
601 * supported, 0 otherwise.
528 * @read_retries: [INTERN] the number of read retry modes supported 602 * @read_retries: [INTERN] the number of read retry modes supported
529 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand 603 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand
530 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand 604 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand
@@ -597,7 +671,11 @@ struct nand_chip {
597 int badblockbits; 671 int badblockbits;
598 672
599 int onfi_version; 673 int onfi_version;
600 struct nand_onfi_params onfi_params; 674 int jedec_version;
675 union {
676 struct nand_onfi_params onfi_params;
677 struct nand_jedec_params jedec_params;
678 };
601 679
602 int read_retries; 680 int read_retries;
603 681
@@ -840,4 +918,29 @@ static inline bool nand_is_slc(struct nand_chip *chip)
840{ 918{
841 return chip->bits_per_cell == 1; 919 return chip->bits_per_cell == 1;
842} 920}
921
922/**
923 * Check if the opcode's address should be sent only on the lower 8 bits
924 * @command: opcode to check
925 */
926static inline int nand_opcode_8bits(unsigned int command)
927{
928 switch (command) {
929 case NAND_CMD_READID:
930 case NAND_CMD_PARAM:
931 case NAND_CMD_GET_FEATURES:
932 case NAND_CMD_SET_FEATURES:
933 return 1;
934 default:
935 break;
936 }
937 return 0;
938}
939
940/* return the supported JEDEC features. */
941static inline int jedec_feature(struct nand_chip *chip)
942{
943 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features)
944 : 0;
945}
843#endif /* __LINUX_MTD_NAND_H */ 946#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index ae4981ebd18e..f62f78aef4ac 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -24,8 +24,7 @@ struct request;
24struct nbd_device { 24struct nbd_device {
25 int flags; 25 int flags;
26 int harderror; /* Code of hard error */ 26 int harderror; /* Code of hard error */
27 struct socket * sock; 27 struct socket * sock; /* If == NULL, device is not ready, yet */
28 struct file * file; /* If == NULL, device is not ready, yet */
29 int magic; 28 int magic;
30 29
31 spinlock_t queue_lock; 30 spinlock_t queue_lock;
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 5a09a48f2658..c26d0ec2ef3a 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -63,6 +63,7 @@ enum {
63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */ 63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */
64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */ 64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
65 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */ 65 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */
66 NETIF_F_BUSY_POLL_BIT, /* Busy poll */
66 67
67 /* 68 /*
68 * Add your fresh new feature above and remember to update 69 * Add your fresh new feature above and remember to update
@@ -118,6 +119,7 @@ enum {
118#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 119#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
119#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 120#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
120#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD) 121#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD)
122#define NETIF_F_BUSY_POLL __NETIF_F(BUSY_POLL)
121 123
122/* Features valid for ethtool to change */ 124/* Features valid for ethtool to change */
123/* = all defined minus driver/device-class-related */ 125/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index daafd9561cbc..7ed3a3aa6604 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -63,13 +63,6 @@ struct wireless_dev;
63void netdev_set_default_ethtool_ops(struct net_device *dev, 63void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops); 64 const struct ethtool_ops *ops);
65 65
66/* hardware address assignment types */
67#define NET_ADDR_PERM 0 /* address is permanent (default) */
68#define NET_ADDR_RANDOM 1 /* address is generated randomly */
69#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
70#define NET_ADDR_SET 3 /* address is set using
71 * dev_set_mac_address() */
72
73/* Backlog congestion levels */ 66/* Backlog congestion levels */
74#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 67#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
75#define NET_RX_DROP 1 /* packet dropped */ 68#define NET_RX_DROP 1 /* packet dropped */
@@ -526,11 +519,18 @@ enum netdev_queue_state_t {
526 __QUEUE_STATE_DRV_XOFF, 519 __QUEUE_STATE_DRV_XOFF,
527 __QUEUE_STATE_STACK_XOFF, 520 __QUEUE_STATE_STACK_XOFF,
528 __QUEUE_STATE_FROZEN, 521 __QUEUE_STATE_FROZEN,
529#define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \
530 (1 << __QUEUE_STATE_STACK_XOFF))
531#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
532 (1 << __QUEUE_STATE_FROZEN))
533}; 522};
523
524#define QUEUE_STATE_DRV_XOFF (1 << __QUEUE_STATE_DRV_XOFF)
525#define QUEUE_STATE_STACK_XOFF (1 << __QUEUE_STATE_STACK_XOFF)
526#define QUEUE_STATE_FROZEN (1 << __QUEUE_STATE_FROZEN)
527
528#define QUEUE_STATE_ANY_XOFF (QUEUE_STATE_DRV_XOFF | QUEUE_STATE_STACK_XOFF)
529#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
530 QUEUE_STATE_FROZEN)
531#define QUEUE_STATE_DRV_XOFF_OR_FROZEN (QUEUE_STATE_DRV_XOFF | \
532 QUEUE_STATE_FROZEN)
533
534/* 534/*
535 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The 535 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The
536 * netif_tx_* functions below are used to manipulate this flag. The 536 * netif_tx_* functions below are used to manipulate this flag. The
@@ -1037,8 +1037,7 @@ struct net_device_ops {
1037#ifdef CONFIG_NET_POLL_CONTROLLER 1037#ifdef CONFIG_NET_POLL_CONTROLLER
1038 void (*ndo_poll_controller)(struct net_device *dev); 1038 void (*ndo_poll_controller)(struct net_device *dev);
1039 int (*ndo_netpoll_setup)(struct net_device *dev, 1039 int (*ndo_netpoll_setup)(struct net_device *dev,
1040 struct netpoll_info *info, 1040 struct netpoll_info *info);
1041 gfp_t gfp);
1042 void (*ndo_netpoll_cleanup)(struct net_device *dev); 1041 void (*ndo_netpoll_cleanup)(struct net_device *dev);
1043#endif 1042#endif
1044#ifdef CONFIG_NET_RX_BUSY_POLL 1043#ifdef CONFIG_NET_RX_BUSY_POLL
@@ -1147,6 +1146,89 @@ struct net_device_ops {
1147 void *priv); 1146 void *priv);
1148}; 1147};
1149 1148
1149/**
1150 * enum net_device_priv_flags - &struct net_device priv_flags
1151 *
1152 * These are the &struct net_device, they are only set internally
1153 * by drivers and used in the kernel. These flags are invisible to
1154 * userspace, this means that the order of these flags can change
1155 * during any kernel release.
1156 *
1157 * You should have a pretty good reason to be extending these flags.
1158 *
1159 * @IFF_802_1Q_VLAN: 802.1Q VLAN device
1160 * @IFF_EBRIDGE: Ethernet bridging device
1161 * @IFF_SLAVE_INACTIVE: bonding slave not the curr. active
1162 * @IFF_MASTER_8023AD: bonding master, 802.3ad
1163 * @IFF_MASTER_ALB: bonding master, balance-alb
1164 * @IFF_BONDING: bonding master or slave
1165 * @IFF_SLAVE_NEEDARP: need ARPs for validation
1166 * @IFF_ISATAP: ISATAP interface (RFC4214)
1167 * @IFF_MASTER_ARPMON: bonding master, ARP mon in use
1168 * @IFF_WAN_HDLC: WAN HDLC device
1169 * @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
1170 * release skb->dst
1171 * @IFF_DONT_BRIDGE: disallow bridging this ether dev
1172 * @IFF_DISABLE_NETPOLL: disable netpoll at run-time
1173 * @IFF_MACVLAN_PORT: device used as macvlan port
1174 * @IFF_BRIDGE_PORT: device used as bridge port
1175 * @IFF_OVS_DATAPATH: device used as Open vSwitch datapath port
1176 * @IFF_TX_SKB_SHARING: The interface supports sharing skbs on transmit
1177 * @IFF_UNICAST_FLT: Supports unicast filtering
1178 * @IFF_TEAM_PORT: device used as team port
1179 * @IFF_SUPP_NOFCS: device supports sending custom FCS
1180 * @IFF_LIVE_ADDR_CHANGE: device supports hardware address
1181 * change when it's running
1182 * @IFF_MACVLAN: Macvlan device
1183 */
1184enum netdev_priv_flags {
1185 IFF_802_1Q_VLAN = 1<<0,
1186 IFF_EBRIDGE = 1<<1,
1187 IFF_SLAVE_INACTIVE = 1<<2,
1188 IFF_MASTER_8023AD = 1<<3,
1189 IFF_MASTER_ALB = 1<<4,
1190 IFF_BONDING = 1<<5,
1191 IFF_SLAVE_NEEDARP = 1<<6,
1192 IFF_ISATAP = 1<<7,
1193 IFF_MASTER_ARPMON = 1<<8,
1194 IFF_WAN_HDLC = 1<<9,
1195 IFF_XMIT_DST_RELEASE = 1<<10,
1196 IFF_DONT_BRIDGE = 1<<11,
1197 IFF_DISABLE_NETPOLL = 1<<12,
1198 IFF_MACVLAN_PORT = 1<<13,
1199 IFF_BRIDGE_PORT = 1<<14,
1200 IFF_OVS_DATAPATH = 1<<15,
1201 IFF_TX_SKB_SHARING = 1<<16,
1202 IFF_UNICAST_FLT = 1<<17,
1203 IFF_TEAM_PORT = 1<<18,
1204 IFF_SUPP_NOFCS = 1<<19,
1205 IFF_LIVE_ADDR_CHANGE = 1<<20,
1206 IFF_MACVLAN = 1<<21,
1207};
1208
1209#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
1210#define IFF_EBRIDGE IFF_EBRIDGE
1211#define IFF_SLAVE_INACTIVE IFF_SLAVE_INACTIVE
1212#define IFF_MASTER_8023AD IFF_MASTER_8023AD
1213#define IFF_MASTER_ALB IFF_MASTER_ALB
1214#define IFF_BONDING IFF_BONDING
1215#define IFF_SLAVE_NEEDARP IFF_SLAVE_NEEDARP
1216#define IFF_ISATAP IFF_ISATAP
1217#define IFF_MASTER_ARPMON IFF_MASTER_ARPMON
1218#define IFF_WAN_HDLC IFF_WAN_HDLC
1219#define IFF_XMIT_DST_RELEASE IFF_XMIT_DST_RELEASE
1220#define IFF_DONT_BRIDGE IFF_DONT_BRIDGE
1221#define IFF_DISABLE_NETPOLL IFF_DISABLE_NETPOLL
1222#define IFF_MACVLAN_PORT IFF_MACVLAN_PORT
1223#define IFF_BRIDGE_PORT IFF_BRIDGE_PORT
1224#define IFF_OVS_DATAPATH IFF_OVS_DATAPATH
1225#define IFF_TX_SKB_SHARING IFF_TX_SKB_SHARING
1226#define IFF_UNICAST_FLT IFF_UNICAST_FLT
1227#define IFF_TEAM_PORT IFF_TEAM_PORT
1228#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS
1229#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1230#define IFF_MACVLAN IFF_MACVLAN
1231
1150/* 1232/*
1151 * The DEVICE structure. 1233 * The DEVICE structure.
1152 * Actually, this whole structure is a big mistake. It mixes I/O 1234 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -1228,9 +1310,13 @@ struct net_device {
1228 int iflink; 1310 int iflink;
1229 1311
1230 struct net_device_stats stats; 1312 struct net_device_stats stats;
1231 atomic_long_t rx_dropped; /* dropped packets by core network 1313
1232 * Do not use this in drivers. 1314 /* dropped packets by core network, Do not use this in drivers */
1233 */ 1315 atomic_long_t rx_dropped;
1316 atomic_long_t tx_dropped;
1317
1318 /* Stats to monitor carrier on<->off transitions */
1319 atomic_t carrier_changes;
1234 1320
1235#ifdef CONFIG_WIRELESS_EXT 1321#ifdef CONFIG_WIRELESS_EXT
1236 /* List of functions to handle Wireless Extensions (instead of ioctl). 1322 /* List of functions to handle Wireless Extensions (instead of ioctl).
@@ -1279,6 +1365,10 @@ struct net_device {
1279 * that share the same link 1365 * that share the same link
1280 * layer address 1366 * layer address
1281 */ 1367 */
1368 unsigned short dev_port; /* Used to differentiate
1369 * devices that share the same
1370 * function
1371 */
1282 spinlock_t addr_list_lock; 1372 spinlock_t addr_list_lock;
1283 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1373 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1284 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1374 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
@@ -1316,13 +1406,7 @@ struct net_device {
1316/* 1406/*
1317 * Cache lines mostly used on receive path (including eth_type_trans()) 1407 * Cache lines mostly used on receive path (including eth_type_trans())
1318 */ 1408 */
1319 unsigned long last_rx; /* Time of last Rx 1409 unsigned long last_rx; /* Time of last Rx */
1320 * This should not be set in
1321 * drivers, unless really needed,
1322 * because network stack (bonding)
1323 * use it if/when necessary, to
1324 * avoid dirtying this cache line.
1325 */
1326 1410
1327 /* Interface address info used in eth_type_trans() */ 1411 /* Interface address info used in eth_type_trans() */
1328 unsigned char *dev_addr; /* hw address, (before bcast 1412 unsigned char *dev_addr; /* hw address, (before bcast
@@ -1729,6 +1813,20 @@ struct pcpu_sw_netstats {
1729 struct u64_stats_sync syncp; 1813 struct u64_stats_sync syncp;
1730}; 1814};
1731 1815
1816#define netdev_alloc_pcpu_stats(type) \
1817({ \
1818 typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
1819 if (pcpu_stats) { \
1820 int i; \
1821 for_each_possible_cpu(i) { \
1822 typeof(type) *stat; \
1823 stat = per_cpu_ptr(pcpu_stats, i); \
1824 u64_stats_init(&stat->syncp); \
1825 } \
1826 } \
1827 pcpu_stats; \
1828})
1829
1732#include <linux/notifier.h> 1830#include <linux/notifier.h>
1733 1831
1734/* netdevice notifier chain. Please remember to update the rtnetlink 1832/* netdevice notifier chain. Please remember to update the rtnetlink
@@ -1884,9 +1982,6 @@ struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1884struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1982struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
1885int netdev_get_name(struct net *net, char *name, int ifindex); 1983int netdev_get_name(struct net *net, char *name, int ifindex);
1886int dev_restart(struct net_device *dev); 1984int dev_restart(struct net_device *dev);
1887#ifdef CONFIG_NETPOLL_TRAP
1888int netpoll_trap(void);
1889#endif
1890int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); 1985int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1891 1986
1892static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1987static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
@@ -1926,11 +2021,6 @@ static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
1926 return skb->data + offset; 2021 return skb->data + offset;
1927} 2022}
1928 2023
1929static inline void *skb_gro_mac_header(struct sk_buff *skb)
1930{
1931 return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb);
1932}
1933
1934static inline void *skb_gro_network_header(struct sk_buff *skb) 2024static inline void *skb_gro_network_header(struct sk_buff *skb)
1935{ 2025{
1936 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) + 2026 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
@@ -2091,12 +2181,6 @@ static inline void netif_tx_start_all_queues(struct net_device *dev)
2091 2181
2092static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) 2182static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
2093{ 2183{
2094#ifdef CONFIG_NETPOLL_TRAP
2095 if (netpoll_trap()) {
2096 netif_tx_start_queue(dev_queue);
2097 return;
2098 }
2099#endif
2100 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state)) 2184 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
2101 __netif_schedule(dev_queue->qdisc); 2185 __netif_schedule(dev_queue->qdisc);
2102} 2186}
@@ -2175,11 +2259,18 @@ static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue)
2175 return dev_queue->state & QUEUE_STATE_ANY_XOFF; 2259 return dev_queue->state & QUEUE_STATE_ANY_XOFF;
2176} 2260}
2177 2261
2178static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) 2262static inline bool
2263netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
2179{ 2264{
2180 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; 2265 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
2181} 2266}
2182 2267
2268static inline bool
2269netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue)
2270{
2271 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN;
2272}
2273
2183static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, 2274static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
2184 unsigned int bytes) 2275 unsigned int bytes)
2185{ 2276{
@@ -2340,10 +2431,6 @@ static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
2340static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) 2431static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
2341{ 2432{
2342 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2433 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2343#ifdef CONFIG_NETPOLL_TRAP
2344 if (netpoll_trap())
2345 return;
2346#endif
2347 netif_tx_stop_queue(txq); 2434 netif_tx_stop_queue(txq);
2348} 2435}
2349 2436
@@ -2378,10 +2465,6 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
2378static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) 2465static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2379{ 2466{
2380 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2467 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2381#ifdef CONFIG_NETPOLL_TRAP
2382 if (netpoll_trap())
2383 return;
2384#endif
2385 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state)) 2468 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
2386 __netif_schedule(txq->qdisc); 2469 __netif_schedule(txq->qdisc);
2387} 2470}
@@ -2551,6 +2634,7 @@ int dev_get_phys_port_id(struct net_device *dev,
2551int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2634int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2552 struct netdev_queue *txq); 2635 struct netdev_queue *txq);
2553int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2636int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2637bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
2554 2638
2555extern int netdev_budget; 2639extern int netdev_budget;
2556 2640
@@ -2831,6 +2915,11 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
2831 } \ 2915 } \
2832} 2916}
2833 2917
2918#define HARD_TX_TRYLOCK(dev, txq) \
2919 (((dev->features & NETIF_F_LLTX) == 0) ? \
2920 __netif_tx_trylock(txq) : \
2921 true )
2922
2834#define HARD_TX_UNLOCK(dev, txq) { \ 2923#define HARD_TX_UNLOCK(dev, txq) { \
2835 if ((dev->features & NETIF_F_LLTX) == 0) { \ 2924 if ((dev->features & NETIF_F_LLTX) == 0) { \
2836 __netif_tx_unlock(txq); \ 2925 __netif_tx_unlock(txq); \
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 0c7d01eae56c..96afc29184be 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -39,11 +39,13 @@ enum ip_set_feature {
39 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG), 39 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
40 IPSET_TYPE_IFACE_FLAG = 5, 40 IPSET_TYPE_IFACE_FLAG = 5,
41 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG), 41 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG),
42 IPSET_TYPE_NOMATCH_FLAG = 6, 42 IPSET_TYPE_MARK_FLAG = 6,
43 IPSET_TYPE_MARK = (1 << IPSET_TYPE_MARK_FLAG),
44 IPSET_TYPE_NOMATCH_FLAG = 7,
43 IPSET_TYPE_NOMATCH = (1 << IPSET_TYPE_NOMATCH_FLAG), 45 IPSET_TYPE_NOMATCH = (1 << IPSET_TYPE_NOMATCH_FLAG),
44 /* Strictly speaking not a feature, but a flag for dumping: 46 /* Strictly speaking not a feature, but a flag for dumping:
45 * this settype must be dumped last */ 47 * this settype must be dumped last */
46 IPSET_DUMP_LAST_FLAG = 7, 48 IPSET_DUMP_LAST_FLAG = 8,
47 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), 49 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG),
48}; 50};
49 51
@@ -63,6 +65,7 @@ enum ip_set_extension {
63#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) 65#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
64#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) 66#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
65#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT) 67#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT)
68#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD)
66 69
67/* Extension id, in size order */ 70/* Extension id, in size order */
68enum ip_set_ext_id { 71enum ip_set_ext_id {
@@ -171,8 +174,6 @@ struct ip_set_type {
171 char name[IPSET_MAXNAMELEN]; 174 char name[IPSET_MAXNAMELEN];
172 /* Protocol version */ 175 /* Protocol version */
173 u8 protocol; 176 u8 protocol;
174 /* Set features to control swapping */
175 u8 features;
176 /* Set type dimension */ 177 /* Set type dimension */
177 u8 dimension; 178 u8 dimension;
178 /* 179 /*
@@ -182,6 +183,8 @@ struct ip_set_type {
182 u8 family; 183 u8 family;
183 /* Type revisions */ 184 /* Type revisions */
184 u8 revision_min, revision_max; 185 u8 revision_min, revision_max;
186 /* Set features to control swapping */
187 u16 features;
185 188
186 /* Create set */ 189 /* Create set */
187 int (*create)(struct net *net, struct ip_set *set, 190 int (*create)(struct net *net, struct ip_set *set,
@@ -217,6 +220,8 @@ struct ip_set {
217 u8 revision; 220 u8 revision;
218 /* Extensions */ 221 /* Extensions */
219 u8 extensions; 222 u8 extensions;
223 /* Create flags */
224 u8 flags;
220 /* Default timeout value, if enabled */ 225 /* Default timeout value, if enabled */
221 u32 timeout; 226 u32 timeout;
222 /* Element data size */ 227 /* Element data size */
@@ -251,6 +256,8 @@ ip_set_put_flags(struct sk_buff *skb, struct ip_set *set)
251 cadt_flags |= IPSET_FLAG_WITH_COUNTERS; 256 cadt_flags |= IPSET_FLAG_WITH_COUNTERS;
252 if (SET_WITH_COMMENT(set)) 257 if (SET_WITH_COMMENT(set))
253 cadt_flags |= IPSET_FLAG_WITH_COMMENT; 258 cadt_flags |= IPSET_FLAG_WITH_COMMENT;
259 if (SET_WITH_FORCEADD(set))
260 cadt_flags |= IPSET_FLAG_WITH_FORCEADD;
254 261
255 if (!cadt_flags) 262 if (!cadt_flags)
256 return 0; 263 return 0;
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 28c74367e900..e955d4730625 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -44,6 +44,27 @@ int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
44 44
45void nfnl_lock(__u8 subsys_id); 45void nfnl_lock(__u8 subsys_id);
46void nfnl_unlock(__u8 subsys_id); 46void nfnl_unlock(__u8 subsys_id);
47#ifdef CONFIG_PROVE_LOCKING
48int lockdep_nfnl_is_held(__u8 subsys_id);
49#else
50static inline int lockdep_nfnl_is_held(__u8 subsys_id)
51{
52 return 1;
53}
54#endif /* CONFIG_PROVE_LOCKING */
55
56/*
57 * nfnl_dereference - fetch RCU pointer when updates are prevented by subsys mutex
58 *
59 * @p: The pointer to read, prior to dereferencing
60 * @ss: The nfnetlink subsystem ID
61 *
62 * Return the value of the specified RCU-protected pointer, but omit
63 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
64 * caller holds the NFNL subsystem mutex.
65 */
66#define nfnl_dereference(p, ss) \
67 rcu_dereference_protected(p, lockdep_nfnl_is_held(ss))
47 68
48#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 69#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
49 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 70 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index fbfdb9d8d3a7..b25ee9ffdbe6 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -24,27 +24,20 @@ struct netpoll {
24 struct net_device *dev; 24 struct net_device *dev;
25 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
26 const char *name; 26 const char *name;
27 void (*rx_skb_hook)(struct netpoll *np, int source, struct sk_buff *skb,
28 int offset, int len);
29 27
30 union inet_addr local_ip, remote_ip; 28 union inet_addr local_ip, remote_ip;
31 bool ipv6; 29 bool ipv6;
32 u16 local_port, remote_port; 30 u16 local_port, remote_port;
33 u8 remote_mac[ETH_ALEN]; 31 u8 remote_mac[ETH_ALEN];
34 32
35 struct list_head rx; /* rx_np list element */
36 struct work_struct cleanup_work; 33 struct work_struct cleanup_work;
37}; 34};
38 35
39struct netpoll_info { 36struct netpoll_info {
40 atomic_t refcnt; 37 atomic_t refcnt;
41 38
42 unsigned long rx_flags;
43 spinlock_t rx_lock;
44 struct semaphore dev_lock; 39 struct semaphore dev_lock;
45 struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
46 40
47 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
48 struct sk_buff_head txq; 41 struct sk_buff_head txq;
49 42
50 struct delayed_work tx_work; 43 struct delayed_work tx_work;
@@ -54,24 +47,21 @@ struct netpoll_info {
54}; 47};
55 48
56#ifdef CONFIG_NETPOLL 49#ifdef CONFIG_NETPOLL
57extern void netpoll_rx_disable(struct net_device *dev); 50extern void netpoll_poll_disable(struct net_device *dev);
58extern void netpoll_rx_enable(struct net_device *dev); 51extern void netpoll_poll_enable(struct net_device *dev);
59#else 52#else
60static inline void netpoll_rx_disable(struct net_device *dev) { return; } 53static inline void netpoll_poll_disable(struct net_device *dev) { return; }
61static inline void netpoll_rx_enable(struct net_device *dev) { return; } 54static inline void netpoll_poll_enable(struct net_device *dev) { return; }
62#endif 55#endif
63 56
64void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 57void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
65void netpoll_print_options(struct netpoll *np); 58void netpoll_print_options(struct netpoll *np);
66int netpoll_parse_options(struct netpoll *np, char *opt); 59int netpoll_parse_options(struct netpoll *np, char *opt);
67int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp); 60int __netpoll_setup(struct netpoll *np, struct net_device *ndev);
68int netpoll_setup(struct netpoll *np); 61int netpoll_setup(struct netpoll *np);
69int netpoll_trap(void);
70void netpoll_set_trap(int trap);
71void __netpoll_cleanup(struct netpoll *np); 62void __netpoll_cleanup(struct netpoll *np);
72void __netpoll_free_async(struct netpoll *np); 63void __netpoll_free_async(struct netpoll *np);
73void netpoll_cleanup(struct netpoll *np); 64void netpoll_cleanup(struct netpoll *np);
74int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
75void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 65void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
76 struct net_device *dev); 66 struct net_device *dev);
77static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) 67static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
@@ -82,46 +72,7 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
82 local_irq_restore(flags); 72 local_irq_restore(flags);
83} 73}
84 74
85
86
87#ifdef CONFIG_NETPOLL 75#ifdef CONFIG_NETPOLL
88static inline bool netpoll_rx_on(struct sk_buff *skb)
89{
90 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
91
92 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
93}
94
95static inline bool netpoll_rx(struct sk_buff *skb)
96{
97 struct netpoll_info *npinfo;
98 unsigned long flags;
99 bool ret = false;
100
101 local_irq_save(flags);
102
103 if (!netpoll_rx_on(skb))
104 goto out;
105
106 npinfo = rcu_dereference_bh(skb->dev->npinfo);
107 spin_lock(&npinfo->rx_lock);
108 /* check rx_flags again with the lock held */
109 if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
110 ret = true;
111 spin_unlock(&npinfo->rx_lock);
112
113out:
114 local_irq_restore(flags);
115 return ret;
116}
117
118static inline int netpoll_receive_skb(struct sk_buff *skb)
119{
120 if (!list_empty(&skb->dev->napi_list))
121 return netpoll_rx(skb);
122 return 0;
123}
124
125static inline void *netpoll_poll_lock(struct napi_struct *napi) 76static inline void *netpoll_poll_lock(struct napi_struct *napi)
126{ 77{
127 struct net_device *dev = napi->dev; 78 struct net_device *dev = napi->dev;
@@ -150,18 +101,6 @@ static inline bool netpoll_tx_running(struct net_device *dev)
150} 101}
151 102
152#else 103#else
153static inline bool netpoll_rx(struct sk_buff *skb)
154{
155 return false;
156}
157static inline bool netpoll_rx_on(struct sk_buff *skb)
158{
159 return false;
160}
161static inline int netpoll_receive_skb(struct sk_buff *skb)
162{
163 return 0;
164}
165static inline void *netpoll_poll_lock(struct napi_struct *napi) 104static inline void *netpoll_poll_lock(struct napi_struct *napi)
166{ 105{
167 return NULL; 106 return NULL;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 0ae5807480f4..fa6918b0f829 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -92,6 +92,7 @@ struct nfs_open_context {
92}; 92};
93 93
94struct nfs_open_dir_context { 94struct nfs_open_dir_context {
95 struct list_head list;
95 struct rpc_cred *cred; 96 struct rpc_cred *cred;
96 unsigned long attr_gencount; 97 unsigned long attr_gencount;
97 __u64 dir_cookie; 98 __u64 dir_cookie;
@@ -510,7 +511,6 @@ extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
510extern void nfs_wait_on_sillyrename(struct dentry *dentry); 511extern void nfs_wait_on_sillyrename(struct dentry *dentry);
511extern void nfs_block_sillyrename(struct dentry *dentry); 512extern void nfs_block_sillyrename(struct dentry *dentry);
512extern void nfs_unblock_sillyrename(struct dentry *dentry); 513extern void nfs_unblock_sillyrename(struct dentry *dentry);
513extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry);
514 514
515/* 515/*
516 * linux/fs/nfs/write.c 516 * linux/fs/nfs/write.c
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 5624e4e2763c..6fb5b2335b59 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1402,6 +1402,7 @@ struct nfs_renamedata {
1402 struct inode *new_dir; 1402 struct inode *new_dir;
1403 struct dentry *new_dentry; 1403 struct dentry *new_dentry;
1404 struct nfs_fattr new_fattr; 1404 struct nfs_fattr new_fattr;
1405 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1405}; 1406};
1406 1407
1407struct nfs_access_entry; 1408struct nfs_access_entry;
@@ -1444,8 +1445,6 @@ struct nfs_rpc_ops {
1444 void (*unlink_setup) (struct rpc_message *, struct inode *dir); 1445 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1445 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *); 1446 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1446 int (*unlink_done) (struct rpc_task *, struct inode *); 1447 int (*unlink_done) (struct rpc_task *, struct inode *);
1447 int (*rename) (struct inode *, struct qstr *,
1448 struct inode *, struct qstr *);
1449 void (*rename_setup) (struct rpc_message *msg, struct inode *dir); 1448 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1450 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *); 1449 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1451 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); 1450 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 98755767c7b0..ff3fea3194c6 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -82,6 +82,8 @@ struct nilfs_inode {
82 __le32 i_pad; 82 __le32 i_pad;
83}; 83};
84 84
85#define NILFS_MIN_INODE_SIZE 128
86
85/** 87/**
86 * struct nilfs_super_root - structure of super root 88 * struct nilfs_super_root - structure of super root
87 * @sr_sum: check sum 89 * @sr_sum: check sum
@@ -482,6 +484,8 @@ struct nilfs_dat_entry {
482 __le64 de_rsv; 484 __le64 de_rsv;
483}; 485};
484 486
487#define NILFS_MIN_DAT_ENTRY_SIZE 32
488
485/** 489/**
486 * struct nilfs_snapshot_list - snapshot list 490 * struct nilfs_snapshot_list - snapshot list
487 * @ssl_next: next checkpoint number on snapshot list 491 * @ssl_next: next checkpoint number on snapshot list
@@ -520,6 +524,8 @@ struct nilfs_checkpoint {
520 struct nilfs_inode cp_ifile_inode; 524 struct nilfs_inode cp_ifile_inode;
521}; 525};
522 526
527#define NILFS_MIN_CHECKPOINT_SIZE (64 + NILFS_MIN_INODE_SIZE)
528
523/* checkpoint flags */ 529/* checkpoint flags */
524enum { 530enum {
525 NILFS_CHECKPOINT_SNAPSHOT, 531 NILFS_CHECKPOINT_SNAPSHOT,
@@ -615,6 +621,8 @@ struct nilfs_segment_usage {
615 __le32 su_flags; 621 __le32 su_flags;
616}; 622};
617 623
624#define NILFS_MIN_SEGMENT_USAGE_SIZE 16
625
618/* segment usage flag */ 626/* segment usage flag */
619enum { 627enum {
620 NILFS_SEGMENT_USAGE_ACTIVE, 628 NILFS_SEGMENT_USAGE_ACTIVE,
@@ -710,6 +718,48 @@ static inline int nilfs_suinfo_clean(const struct nilfs_suinfo *si)
710} 718}
711 719
712/* ioctl */ 720/* ioctl */
721/**
722 * nilfs_suinfo_update - segment usage information update
723 * @sup_segnum: segment number
724 * @sup_flags: flags for which fields are active in sup_sui
725 * @sup_reserved: reserved necessary for alignment
726 * @sup_sui: segment usage information
727 */
728struct nilfs_suinfo_update {
729 __u64 sup_segnum;
730 __u32 sup_flags;
731 __u32 sup_reserved;
732 struct nilfs_suinfo sup_sui;
733};
734
735enum {
736 NILFS_SUINFO_UPDATE_LASTMOD,
737 NILFS_SUINFO_UPDATE_NBLOCKS,
738 NILFS_SUINFO_UPDATE_FLAGS,
739 __NR_NILFS_SUINFO_UPDATE_FIELDS,
740};
741
742#define NILFS_SUINFO_UPDATE_FNS(flag, name) \
743static inline void \
744nilfs_suinfo_update_set_##name(struct nilfs_suinfo_update *sup) \
745{ \
746 sup->sup_flags |= 1UL << NILFS_SUINFO_UPDATE_##flag; \
747} \
748static inline void \
749nilfs_suinfo_update_clear_##name(struct nilfs_suinfo_update *sup) \
750{ \
751 sup->sup_flags &= ~(1UL << NILFS_SUINFO_UPDATE_##flag); \
752} \
753static inline int \
754nilfs_suinfo_update_##name(const struct nilfs_suinfo_update *sup) \
755{ \
756 return !!(sup->sup_flags & (1UL << NILFS_SUINFO_UPDATE_##flag));\
757}
758
759NILFS_SUINFO_UPDATE_FNS(LASTMOD, lastmod)
760NILFS_SUINFO_UPDATE_FNS(NBLOCKS, nblocks)
761NILFS_SUINFO_UPDATE_FNS(FLAGS, flags)
762
713enum { 763enum {
714 NILFS_CHECKPOINT, 764 NILFS_CHECKPOINT,
715 NILFS_SNAPSHOT, 765 NILFS_SNAPSHOT,
@@ -863,5 +913,7 @@ struct nilfs_bdesc {
863 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64) 913 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64)
864#define NILFS_IOCTL_SET_ALLOC_RANGE \ 914#define NILFS_IOCTL_SET_ALLOC_RANGE \
865 _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2]) 915 _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2])
916#define NILFS_IOCTL_SET_SUINFO \
917 _IOW(NILFS_IOCTL_IDENT, 0x8D, struct nilfs_argv)
866 918
867#endif /* _LINUX_NILFS_FS_H */ 919#endif /* _LINUX_NILFS_FS_H */
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index fd4f2d1cdf6c..c8d7f3965fff 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -70,6 +70,16 @@ enum {
70 IEEE802154_ATTR_PHY_NAME, 70 IEEE802154_ATTR_PHY_NAME,
71 IEEE802154_ATTR_DEV_TYPE, 71 IEEE802154_ATTR_DEV_TYPE,
72 72
73 IEEE802154_ATTR_TXPOWER,
74 IEEE802154_ATTR_LBT_ENABLED,
75 IEEE802154_ATTR_CCA_MODE,
76 IEEE802154_ATTR_CCA_ED_LEVEL,
77 IEEE802154_ATTR_CSMA_RETRIES,
78 IEEE802154_ATTR_CSMA_MIN_BE,
79 IEEE802154_ATTR_CSMA_MAX_BE,
80
81 IEEE802154_ATTR_FRAME_RETRIES,
82
73 __IEEE802154_ATTR_MAX, 83 __IEEE802154_ATTR_MAX,
74}; 84};
75 85
@@ -122,6 +132,8 @@ enum {
122 IEEE802154_ADD_IFACE, 132 IEEE802154_ADD_IFACE,
123 IEEE802154_DEL_IFACE, 133 IEEE802154_DEL_IFACE,
124 134
135 IEEE802154_SET_MACPARAMS,
136
125 __IEEE802154_CMD_MAX, 137 __IEEE802154_CMD_MAX,
126}; 138};
127 139
diff --git a/include/linux/ntb.h b/include/linux/ntb.h
index f6a15205853b..9ac1a62fc6f5 100644
--- a/include/linux/ntb.h
+++ b/include/linux/ntb.h
@@ -50,8 +50,13 @@ struct ntb_transport_qp;
50 50
51struct ntb_client { 51struct ntb_client {
52 struct device_driver driver; 52 struct device_driver driver;
53 int (*probe) (struct pci_dev *pdev); 53 int (*probe)(struct pci_dev *pdev);
54 void (*remove) (struct pci_dev *pdev); 54 void (*remove)(struct pci_dev *pdev);
55};
56
57enum {
58 NTB_LINK_DOWN = 0,
59 NTB_LINK_UP,
55}; 60};
56 61
57int ntb_register_client(struct ntb_client *drvr); 62int ntb_register_client(struct ntb_client *drvr);
@@ -60,11 +65,11 @@ int ntb_register_client_dev(char *device_name);
60void ntb_unregister_client_dev(char *device_name); 65void ntb_unregister_client_dev(char *device_name);
61 66
62struct ntb_queue_handlers { 67struct ntb_queue_handlers {
63 void (*rx_handler) (struct ntb_transport_qp *qp, void *qp_data, 68 void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data,
64 void *data, int len); 69 void *data, int len);
65 void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data, 70 void (*tx_handler)(struct ntb_transport_qp *qp, void *qp_data,
66 void *data, int len); 71 void *data, int len);
67 void (*event_handler) (void *data, int status); 72 void (*event_handler)(void *data, int status);
68}; 73};
69 74
70unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp); 75unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 6b9aafed225f..a50173ca1d72 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -66,20 +66,25 @@ enum {
66 66
67#define NVME_VS(major, minor) (major << 16 | minor) 67#define NVME_VS(major, minor) (major << 16 | minor)
68 68
69#define NVME_IO_TIMEOUT (5 * HZ) 69extern unsigned char io_timeout;
70#define NVME_IO_TIMEOUT (io_timeout * HZ)
70 71
71/* 72/*
72 * Represents an NVM Express device. Each nvme_dev is a PCI function. 73 * Represents an NVM Express device. Each nvme_dev is a PCI function.
73 */ 74 */
74struct nvme_dev { 75struct nvme_dev {
75 struct list_head node; 76 struct list_head node;
76 struct nvme_queue **queues; 77 struct nvme_queue __rcu **queues;
78 unsigned short __percpu *io_queue;
77 u32 __iomem *dbs; 79 u32 __iomem *dbs;
78 struct pci_dev *pci_dev; 80 struct pci_dev *pci_dev;
79 struct dma_pool *prp_page_pool; 81 struct dma_pool *prp_page_pool;
80 struct dma_pool *prp_small_pool; 82 struct dma_pool *prp_small_pool;
81 int instance; 83 int instance;
82 int queue_count; 84 unsigned queue_count;
85 unsigned online_queues;
86 unsigned max_qid;
87 int q_depth;
83 u32 db_stride; 88 u32 db_stride;
84 u32 ctrl_config; 89 u32 ctrl_config;
85 struct msix_entry *entry; 90 struct msix_entry *entry;
@@ -89,6 +94,7 @@ struct nvme_dev {
89 struct miscdevice miscdev; 94 struct miscdevice miscdev;
90 work_func_t reset_workfn; 95 work_func_t reset_workfn;
91 struct work_struct reset_work; 96 struct work_struct reset_work;
97 struct notifier_block nb;
92 char name[12]; 98 char name[12];
93 char serial[20]; 99 char serial[20];
94 char model[40]; 100 char model[40];
@@ -131,6 +137,7 @@ struct nvme_iod {
131 int length; /* Of data, in bytes */ 137 int length; /* Of data, in bytes */
132 unsigned long start_time; 138 unsigned long start_time;
133 dma_addr_t first_dma; 139 dma_addr_t first_dma;
140 struct list_head node;
134 struct scatterlist sg[0]; 141 struct scatterlist sg[0];
135}; 142};
136 143
@@ -146,16 +153,12 @@ static inline u64 nvme_block_nr(struct nvme_ns *ns, sector_t sector)
146 */ 153 */
147void nvme_free_iod(struct nvme_dev *dev, struct nvme_iod *iod); 154void nvme_free_iod(struct nvme_dev *dev, struct nvme_iod *iod);
148 155
149int nvme_setup_prps(struct nvme_dev *dev, struct nvme_common_command *cmd, 156int nvme_setup_prps(struct nvme_dev *, struct nvme_iod *, int , gfp_t);
150 struct nvme_iod *iod, int total_len, gfp_t gfp);
151struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, 157struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
152 unsigned long addr, unsigned length); 158 unsigned long addr, unsigned length);
153void nvme_unmap_user_pages(struct nvme_dev *dev, int write, 159void nvme_unmap_user_pages(struct nvme_dev *dev, int write,
154 struct nvme_iod *iod); 160 struct nvme_iod *iod);
155struct nvme_queue *get_nvmeq(struct nvme_dev *dev); 161int nvme_submit_io_cmd(struct nvme_dev *, struct nvme_command *, u32 *);
156void put_nvmeq(struct nvme_queue *nvmeq);
157int nvme_submit_sync_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd,
158 u32 *result, unsigned timeout);
159int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns); 162int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns);
160int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *, 163int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *,
161 u32 *result); 164 u32 *result);
diff --git a/include/linux/of.h b/include/linux/of.h
index 435cb995904d..919bf211877d 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -18,7 +18,7 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/kref.h> 21#include <linux/kobject.h>
22#include <linux/mod_devicetable.h> 22#include <linux/mod_devicetable.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
@@ -37,6 +37,7 @@ struct property {
37 struct property *next; 37 struct property *next;
38 unsigned long _flags; 38 unsigned long _flags;
39 unsigned int unique_id; 39 unsigned int unique_id;
40 struct bin_attribute attr;
40}; 41};
41 42
42#if defined(CONFIG_SPARC) 43#if defined(CONFIG_SPARC)
@@ -56,8 +57,7 @@ struct device_node {
56 struct device_node *sibling; 57 struct device_node *sibling;
57 struct device_node *next; /* next device of same type */ 58 struct device_node *next; /* next device of same type */
58 struct device_node *allnext; /* next in list of all nodes */ 59 struct device_node *allnext; /* next in list of all nodes */
59 struct proc_dir_entry *pde; /* this node's proc directory */ 60 struct kobject kobj;
60 struct kref kref;
61 unsigned long _flags; 61 unsigned long _flags;
62 void *data; 62 void *data;
63#if defined(CONFIG_SPARC) 63#if defined(CONFIG_SPARC)
@@ -67,13 +67,34 @@ struct device_node {
67#endif 67#endif
68}; 68};
69 69
70#define MAX_PHANDLE_ARGS 8 70#define MAX_PHANDLE_ARGS 16
71struct of_phandle_args { 71struct of_phandle_args {
72 struct device_node *np; 72 struct device_node *np;
73 int args_count; 73 int args_count;
74 uint32_t args[MAX_PHANDLE_ARGS]; 74 uint32_t args[MAX_PHANDLE_ARGS];
75}; 75};
76 76
77extern int of_node_add(struct device_node *node);
78
79/* initialize a node */
80extern struct kobj_type of_node_ktype;
81static inline void of_node_init(struct device_node *node)
82{
83 kobject_init(&node->kobj, &of_node_ktype);
84}
85
86/* true when node is initialized */
87static inline int of_node_is_initialized(struct device_node *node)
88{
89 return node && node->kobj.state_initialized;
90}
91
92/* true when node is attached (i.e. present on sysfs) */
93static inline int of_node_is_attached(struct device_node *node)
94{
95 return node && node->kobj.state_in_sysfs;
96}
97
77#ifdef CONFIG_OF_DYNAMIC 98#ifdef CONFIG_OF_DYNAMIC
78extern struct device_node *of_node_get(struct device_node *node); 99extern struct device_node *of_node_get(struct device_node *node);
79extern void of_node_put(struct device_node *node); 100extern void of_node_put(struct device_node *node);
@@ -114,6 +135,26 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
114 set_bit(flag, &n->_flags); 135 set_bit(flag, &n->_flags);
115} 136}
116 137
138static inline void of_node_clear_flag(struct device_node *n, unsigned long flag)
139{
140 clear_bit(flag, &n->_flags);
141}
142
143static inline int of_property_check_flag(struct property *p, unsigned long flag)
144{
145 return test_bit(flag, &p->_flags);
146}
147
148static inline void of_property_set_flag(struct property *p, unsigned long flag)
149{
150 set_bit(flag, &p->_flags);
151}
152
153static inline void of_property_clear_flag(struct property *p, unsigned long flag)
154{
155 clear_bit(flag, &p->_flags);
156}
157
117extern struct device_node *of_find_all_nodes(struct device_node *prev); 158extern struct device_node *of_find_all_nodes(struct device_node *prev);
118 159
119/* 160/*
@@ -167,6 +208,8 @@ static inline const char *of_node_full_name(const struct device_node *np)
167 return np ? np->full_name : "<no-node>"; 208 return np ? np->full_name : "<no-node>";
168} 209}
169 210
211#define for_each_of_allnodes(dn) \
212 for (dn = of_allnodes; dn; dn = dn->allnext)
170extern struct device_node *of_find_node_by_name(struct device_node *from, 213extern struct device_node *of_find_node_by_name(struct device_node *from,
171 const char *name); 214 const char *name);
172extern struct device_node *of_find_node_by_type(struct device_node *from, 215extern struct device_node *of_find_node_by_type(struct device_node *from,
@@ -198,6 +241,8 @@ extern struct device_node *of_find_node_with_property(
198extern struct property *of_find_property(const struct device_node *np, 241extern struct property *of_find_property(const struct device_node *np,
199 const char *name, 242 const char *name,
200 int *lenp); 243 int *lenp);
244extern int of_property_count_elems_of_size(const struct device_node *np,
245 const char *propname, int elem_size);
201extern int of_property_read_u32_index(const struct device_node *np, 246extern int of_property_read_u32_index(const struct device_node *np,
202 const char *propname, 247 const char *propname,
203 u32 index, u32 *out_value); 248 u32 index, u32 *out_value);
@@ -390,6 +435,12 @@ static inline struct device_node *of_find_compatible_node(
390 return NULL; 435 return NULL;
391} 436}
392 437
438static inline int of_property_count_elems_of_size(const struct device_node *np,
439 const char *propname, int elem_size)
440{
441 return -ENOSYS;
442}
443
393static inline int of_property_read_u32_index(const struct device_node *np, 444static inline int of_property_read_u32_index(const struct device_node *np,
394 const char *propname, u32 index, u32 *out_value) 445 const char *propname, u32 index, u32 *out_value)
395{ 446{
@@ -536,6 +587,74 @@ static inline struct device_node *of_find_matching_node(
536} 587}
537 588
538/** 589/**
590 * of_property_count_u8_elems - Count the number of u8 elements in a property
591 *
592 * @np: device node from which the property value is to be read.
593 * @propname: name of the property to be searched.
594 *
595 * Search for a property in a device node and count the number of u8 elements
596 * in it. Returns number of elements on sucess, -EINVAL if the property does
597 * not exist or its length does not match a multiple of u8 and -ENODATA if the
598 * property does not have a value.
599 */
600static inline int of_property_count_u8_elems(const struct device_node *np,
601 const char *propname)
602{
603 return of_property_count_elems_of_size(np, propname, sizeof(u8));
604}
605
606/**
607 * of_property_count_u16_elems - Count the number of u16 elements in a property
608 *
609 * @np: device node from which the property value is to be read.
610 * @propname: name of the property to be searched.
611 *
612 * Search for a property in a device node and count the number of u16 elements
613 * in it. Returns number of elements on sucess, -EINVAL if the property does
614 * not exist or its length does not match a multiple of u16 and -ENODATA if the
615 * property does not have a value.
616 */
617static inline int of_property_count_u16_elems(const struct device_node *np,
618 const char *propname)
619{
620 return of_property_count_elems_of_size(np, propname, sizeof(u16));
621}
622
623/**
624 * of_property_count_u32_elems - Count the number of u32 elements in a property
625 *
626 * @np: device node from which the property value is to be read.
627 * @propname: name of the property to be searched.
628 *
629 * Search for a property in a device node and count the number of u32 elements
630 * in it. Returns number of elements on sucess, -EINVAL if the property does
631 * not exist or its length does not match a multiple of u32 and -ENODATA if the
632 * property does not have a value.
633 */
634static inline int of_property_count_u32_elems(const struct device_node *np,
635 const char *propname)
636{
637 return of_property_count_elems_of_size(np, propname, sizeof(u32));
638}
639
640/**
641 * of_property_count_u64_elems - Count the number of u64 elements in a property
642 *
643 * @np: device node from which the property value is to be read.
644 * @propname: name of the property to be searched.
645 *
646 * Search for a property in a device node and count the number of u64 elements
647 * in it. Returns number of elements on sucess, -EINVAL if the property does
648 * not exist or its length does not match a multiple of u64 and -ENODATA if the
649 * property does not have a value.
650 */
651static inline int of_property_count_u64_elems(const struct device_node *np,
652 const char *propname)
653{
654 return of_property_count_elems_of_size(np, propname, sizeof(u64));
655}
656
657/**
539 * of_property_read_bool - Findfrom a property 658 * of_property_read_bool - Findfrom a property
540 * @np: device node from which the property value is to be read. 659 * @np: device node from which the property value is to be read.
541 * @propname: name of the property to be searched. 660 * @propname: name of the property to be searched.
@@ -633,14 +752,4 @@ static inline int of_get_available_child_count(const struct device_node *np)
633 return num; 752 return num;
634} 753}
635 754
636#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
637extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
638extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
639extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
640 struct property *prop);
641extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
642 struct property *newprop,
643 struct property *oldprop);
644#endif
645
646#endif /* _LINUX_OF_H */ 755#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 2b77058a7335..ddd7219af8ac 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -98,7 +98,10 @@ extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
98 int depth, void *data); 98 int depth, void *data);
99extern int early_init_dt_scan_memory(unsigned long node, const char *uname, 99extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
100 int depth, void *data); 100 int depth, void *data);
101extern void early_init_fdt_scan_reserved_mem(void);
101extern void early_init_dt_add_memory_arch(u64 base, u64 size); 102extern void early_init_dt_add_memory_arch(u64 base, u64 size);
103extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
104 bool no_map);
102extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 105extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
103extern u64 dt_mem_next_cell(int s, __be32 **cellp); 106extern u64 dt_mem_next_cell(int s, __be32 **cellp);
104 107
@@ -118,6 +121,7 @@ extern void unflatten_and_copy_device_tree(void);
118extern void early_init_devtree(void *); 121extern void early_init_devtree(void *);
119extern void early_get_first_memblock_info(void *, phys_addr_t *); 122extern void early_get_first_memblock_info(void *, phys_addr_t *);
120#else /* CONFIG_OF_FLATTREE */ 123#else /* CONFIG_OF_FLATTREE */
124static inline void early_init_fdt_scan_reserved_mem(void) {}
121static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 125static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
122static inline void unflatten_device_tree(void) {} 126static inline void unflatten_device_tree(void) {}
123static inline void unflatten_and_copy_device_tree(void) {} 127static inline void unflatten_and_copy_device_tree(void) {}
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
new file mode 100644
index 000000000000..befef42e015b
--- /dev/null
+++ b/include/linux/of_graph.h
@@ -0,0 +1,66 @@
1/*
2 * OF graph binding parsing helpers
3 *
4 * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
5 * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 *
7 * Copyright (C) 2012 Renesas Electronics Corp.
8 * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 */
14#ifndef __LINUX_OF_GRAPH_H
15#define __LINUX_OF_GRAPH_H
16
17/**
18 * struct of_endpoint - the OF graph endpoint data structure
19 * @port: identifier (value of reg property) of a port this endpoint belongs to
20 * @id: identifier (value of reg property) of this endpoint
21 * @local_node: pointer to device_node of this endpoint
22 */
23struct of_endpoint {
24 unsigned int port;
25 unsigned int id;
26 const struct device_node *local_node;
27};
28
29#ifdef CONFIG_OF
30int of_graph_parse_endpoint(const struct device_node *node,
31 struct of_endpoint *endpoint);
32struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
33 struct device_node *previous);
34struct device_node *of_graph_get_remote_port_parent(
35 const struct device_node *node);
36struct device_node *of_graph_get_remote_port(const struct device_node *node);
37#else
38
39static inline int of_graph_parse_endpoint(const struct device_node *node,
40 struct of_endpoint *endpoint)
41{
42 return -ENOSYS;
43}
44
45static inline struct device_node *of_graph_get_next_endpoint(
46 const struct device_node *parent,
47 struct device_node *previous)
48{
49 return NULL;
50}
51
52static inline struct device_node *of_graph_get_remote_port_parent(
53 const struct device_node *node)
54{
55 return NULL;
56}
57
58static inline struct device_node *of_graph_get_remote_port(
59 const struct device_node *node)
60{
61 return NULL;
62}
63
64#endif /* CONFIG_OF */
65
66#endif /* __LINUX_OF_GRAPH_H */
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
index cb32d9c1e8dc..e266caa36402 100644
--- a/include/linux/of_mtd.h
+++ b/include/linux/of_mtd.h
@@ -13,6 +13,8 @@
13 13
14#include <linux/of.h> 14#include <linux/of.h>
15int of_get_nand_ecc_mode(struct device_node *np); 15int of_get_nand_ecc_mode(struct device_node *np);
16int of_get_nand_ecc_step_size(struct device_node *np);
17int of_get_nand_ecc_strength(struct device_node *np);
16int of_get_nand_bus_width(struct device_node *np); 18int of_get_nand_bus_width(struct device_node *np);
17bool of_get_nand_on_flash_bbt(struct device_node *np); 19bool of_get_nand_on_flash_bbt(struct device_node *np);
18 20
@@ -23,6 +25,16 @@ static inline int of_get_nand_ecc_mode(struct device_node *np)
23 return -ENOSYS; 25 return -ENOSYS;
24} 26}
25 27
28static inline int of_get_nand_ecc_step_size(struct device_node *np)
29{
30 return -ENOSYS;
31}
32
33static inline int of_get_nand_ecc_strength(struct device_node *np)
34{
35 return -ENOSYS;
36}
37
26static inline int of_get_nand_bus_width(struct device_node *np) 38static inline int of_get_nand_bus_width(struct device_node *np)
27{ 39{
28 return -ENOSYS; 40 return -ENOSYS;
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
new file mode 100644
index 000000000000..9b1fbb7f29fc
--- /dev/null
+++ b/include/linux/of_reserved_mem.h
@@ -0,0 +1,53 @@
1#ifndef __OF_RESERVED_MEM_H
2#define __OF_RESERVED_MEM_H
3
4struct device;
5struct of_phandle_args;
6struct reserved_mem_ops;
7
8struct reserved_mem {
9 const char *name;
10 unsigned long fdt_node;
11 const struct reserved_mem_ops *ops;
12 phys_addr_t base;
13 phys_addr_t size;
14 void *priv;
15};
16
17struct reserved_mem_ops {
18 void (*device_init)(struct reserved_mem *rmem,
19 struct device *dev);
20 void (*device_release)(struct reserved_mem *rmem,
21 struct device *dev);
22};
23
24typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem,
25 unsigned long node, const char *uname);
26
27#ifdef CONFIG_OF_RESERVED_MEM
28void fdt_init_reserved_mem(void);
29void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
30 phys_addr_t base, phys_addr_t size);
31
32#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
33 static const struct of_device_id __reservedmem_of_table_##name \
34 __used __section(__reservedmem_of_table) \
35 = { .compatible = compat, \
36 .data = (init == (reservedmem_of_init_fn)NULL) ? \
37 init : init }
38
39#else
40static inline void fdt_init_reserved_mem(void) { }
41static inline void fdt_reserved_mem_save_node(unsigned long node,
42 const char *uname, phys_addr_t base, phys_addr_t size) { }
43
44#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
45 static const struct of_device_id __reservedmem_of_table_##name \
46 __attribute__((unused)) \
47 = { .compatible = compat, \
48 .data = (init == (reservedmem_of_init_fn)NULL) ? \
49 init : init }
50
51#endif
52
53#endif /* __OF_RESERVED_MEM_H */
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 7af25a9c9c51..41a13e70f41f 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -268,14 +268,27 @@ struct omap_dma_dev_attr {
268 u32 dev_caps; 268 u32 dev_caps;
269 u16 lch_count; 269 u16 lch_count;
270 u16 chan_count; 270 u16 chan_count;
271 struct omap_dma_lch *chan; 271};
272
273enum {
274 OMAP_DMA_REG_NONE,
275 OMAP_DMA_REG_16BIT,
276 OMAP_DMA_REG_2X16BIT,
277 OMAP_DMA_REG_32BIT,
278};
279
280struct omap_dma_reg {
281 u16 offset;
282 u8 stride;
283 u8 type;
272}; 284};
273 285
274/* System DMA platform data structure */ 286/* System DMA platform data structure */
275struct omap_system_dma_plat_info { 287struct omap_system_dma_plat_info {
288 const struct omap_dma_reg *reg_map;
289 unsigned channel_stride;
276 struct omap_dma_dev_attr *dma_attr; 290 struct omap_dma_dev_attr *dma_attr;
277 u32 errata; 291 u32 errata;
278 void (*disable_irq_lch)(int lch);
279 void (*show_dma_caps)(void); 292 void (*show_dma_caps)(void);
280 void (*clear_lch_regs)(int lch); 293 void (*clear_lch_regs)(int lch);
281 void (*clear_dma)(int lch); 294 void (*clear_dma)(int lch);
@@ -289,8 +302,12 @@ struct omap_system_dma_plat_info {
289#define dma_omap2plus() 0 302#define dma_omap2plus() 0
290#endif 303#endif
291#define dma_omap1() (!dma_omap2plus()) 304#define dma_omap1() (!dma_omap2plus())
292#define dma_omap15xx() ((dma_omap1() && (d->dev_caps & ENABLE_1510_MODE))) 305#define __dma_omap15xx(d) (dma_omap1() && (d)->dev_caps & ENABLE_1510_MODE)
293#define dma_omap16xx() ((dma_omap1() && (d->dev_caps & ENABLE_16XX_MODE))) 306#define __dma_omap16xx(d) (dma_omap1() && (d)->dev_caps & ENABLE_16XX_MODE)
307#define dma_omap15xx() __dma_omap15xx(d)
308#define dma_omap16xx() __dma_omap16xx(d)
309
310extern struct omap_system_dma_plat_info *omap_get_plat_info(void);
294 311
295extern void omap_set_dma_priority(int lch, int dst_port, int priority); 312extern void omap_set_dma_priority(int lch, int dst_port, int priority);
296extern int omap_request_dma(int dev_id, const char *dev_name, 313extern int omap_request_dma(int dev_id, const char *dev_name,
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 1710d1b060ba..45598f1e9aa3 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -25,6 +25,7 @@ enum mapping_flags {
25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */ 27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */
28 AS_EXITING = __GFP_BITS_SHIFT + 5, /* final truncate in progress */
28}; 29};
29 30
30static inline void mapping_set_error(struct address_space *mapping, int error) 31static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -69,6 +70,16 @@ static inline int mapping_balloon(struct address_space *mapping)
69 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags); 70 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags);
70} 71}
71 72
73static inline void mapping_set_exiting(struct address_space *mapping)
74{
75 set_bit(AS_EXITING, &mapping->flags);
76}
77
78static inline int mapping_exiting(struct address_space *mapping)
79{
80 return test_bit(AS_EXITING, &mapping->flags);
81}
82
72static inline gfp_t mapping_gfp_mask(struct address_space * mapping) 83static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
73{ 84{
74 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; 85 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK;
@@ -243,12 +254,20 @@ static inline struct page *page_cache_alloc_readahead(struct address_space *x)
243 254
244typedef int filler_t(void *, struct page *); 255typedef int filler_t(void *, struct page *);
245 256
246extern struct page * find_get_page(struct address_space *mapping, 257pgoff_t page_cache_next_hole(struct address_space *mapping,
247 pgoff_t index); 258 pgoff_t index, unsigned long max_scan);
248extern struct page * find_lock_page(struct address_space *mapping, 259pgoff_t page_cache_prev_hole(struct address_space *mapping,
249 pgoff_t index); 260 pgoff_t index, unsigned long max_scan);
250extern struct page * find_or_create_page(struct address_space *mapping, 261
251 pgoff_t index, gfp_t gfp_mask); 262struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
263struct page *find_get_page(struct address_space *mapping, pgoff_t offset);
264struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset);
265struct page *find_lock_page(struct address_space *mapping, pgoff_t offset);
266struct page *find_or_create_page(struct address_space *mapping, pgoff_t index,
267 gfp_t gfp_mask);
268unsigned find_get_entries(struct address_space *mapping, pgoff_t start,
269 unsigned int nr_entries, struct page **entries,
270 pgoff_t *indices);
252unsigned find_get_pages(struct address_space *mapping, pgoff_t start, 271unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
253 unsigned int nr_pages, struct page **pages); 272 unsigned int nr_pages, struct page **pages);
254unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, 273unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
@@ -270,8 +289,6 @@ static inline struct page *grab_cache_page(struct address_space *mapping,
270 289
271extern struct page * grab_cache_page_nowait(struct address_space *mapping, 290extern struct page * grab_cache_page_nowait(struct address_space *mapping,
272 pgoff_t index); 291 pgoff_t index);
273extern struct page * read_cache_page_async(struct address_space *mapping,
274 pgoff_t index, filler_t *filler, void *data);
275extern struct page * read_cache_page(struct address_space *mapping, 292extern struct page * read_cache_page(struct address_space *mapping,
276 pgoff_t index, filler_t *filler, void *data); 293 pgoff_t index, filler_t *filler, void *data);
277extern struct page * read_cache_page_gfp(struct address_space *mapping, 294extern struct page * read_cache_page_gfp(struct address_space *mapping,
@@ -279,14 +296,6 @@ extern struct page * read_cache_page_gfp(struct address_space *mapping,
279extern int read_cache_pages(struct address_space *mapping, 296extern int read_cache_pages(struct address_space *mapping,
280 struct list_head *pages, filler_t *filler, void *data); 297 struct list_head *pages, filler_t *filler, void *data);
281 298
282static inline struct page *read_mapping_page_async(
283 struct address_space *mapping,
284 pgoff_t index, void *data)
285{
286 filler_t *filler = (filler_t *)mapping->a_ops->readpage;
287 return read_cache_page_async(mapping, index, filler, data);
288}
289
290static inline struct page *read_mapping_page(struct address_space *mapping, 299static inline struct page *read_mapping_page(struct address_space *mapping,
291 pgoff_t index, void *data) 300 pgoff_t index, void *data)
292{ 301{
@@ -539,7 +548,7 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
539int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 548int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
540 pgoff_t index, gfp_t gfp_mask); 549 pgoff_t index, gfp_t gfp_mask);
541extern void delete_from_page_cache(struct page *page); 550extern void delete_from_page_cache(struct page *page);
542extern void __delete_from_page_cache(struct page *page); 551extern void __delete_from_page_cache(struct page *page, void *shadow);
543int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask); 552int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask);
544 553
545/* 554/*
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index e4dbfab37729..b45d391b4540 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -22,6 +22,11 @@ struct pagevec {
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_lru_add(struct pagevec *pvec); 24void __pagevec_lru_add(struct pagevec *pvec);
25unsigned pagevec_lookup_entries(struct pagevec *pvec,
26 struct address_space *mapping,
27 pgoff_t start, unsigned nr_entries,
28 pgoff_t *indices);
29void pagevec_remove_exceptionals(struct pagevec *pvec);
25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 30unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
26 pgoff_t start, unsigned nr_pages); 31 pgoff_t start, unsigned nr_pages);
27unsigned pagevec_lookup_tag(struct pagevec *pvec, 32unsigned pagevec_lookup_tag(struct pagevec *pvec,
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 5a462c4e5009..637a608ded0b 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -59,12 +59,12 @@ static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
59void acpiphp_init(void); 59void acpiphp_init(void);
60void acpiphp_enumerate_slots(struct pci_bus *bus); 60void acpiphp_enumerate_slots(struct pci_bus *bus);
61void acpiphp_remove_slots(struct pci_bus *bus); 61void acpiphp_remove_slots(struct pci_bus *bus);
62void acpiphp_check_host_bridge(acpi_handle handle); 62void acpiphp_check_host_bridge(struct acpi_device *adev);
63#else 63#else
64static inline void acpiphp_init(void) { } 64static inline void acpiphp_init(void) { }
65static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { } 65static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { }
66static inline void acpiphp_remove_slots(struct pci_bus *bus) { } 66static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
67static inline void acpiphp_check_host_bridge(acpi_handle handle) { } 67static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
68#endif 68#endif
69 69
70#else /* CONFIG_ACPI */ 70#else /* CONFIG_ACPI */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 33aa2caf0f0c..aab57b4abe7f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -29,7 +29,6 @@
29#include <linux/atomic.h> 29#include <linux/atomic.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/irqreturn.h>
33#include <uapi/linux/pci.h> 32#include <uapi/linux/pci.h>
34 33
35#include <linux/pci_ids.h> 34#include <linux/pci_ids.h>
@@ -170,6 +169,8 @@ enum pci_dev_flags {
170 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 169 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
171 /* Provide indication device is assigned by a Virtual Machine Manager */ 170 /* Provide indication device is assigned by a Virtual Machine Manager */
172 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, 171 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4,
172 /* Flag for quirk use to store if quirk-specific ACS is enabled */
173 PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) 8,
173}; 174};
174 175
175enum pci_irq_reroute_variant { 176enum pci_irq_reroute_variant {
@@ -461,7 +462,6 @@ struct pci_bus {
461 unsigned int is_added:1; 462 unsigned int is_added:1;
462}; 463};
463 464
464#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
465#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 465#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
466 466
467/* 467/*
@@ -1066,7 +1066,7 @@ void pci_bus_remove_resources(struct pci_bus *bus);
1066int __must_check pci_bus_alloc_resource(struct pci_bus *bus, 1066int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
1067 struct resource *res, resource_size_t size, 1067 struct resource *res, resource_size_t size,
1068 resource_size_t align, resource_size_t min, 1068 resource_size_t align, resource_size_t min,
1069 unsigned int type_mask, 1069 unsigned long type_mask,
1070 resource_size_t (*alignf)(void *, 1070 resource_size_t (*alignf)(void *,
1071 const struct resource *, 1071 const struct resource *,
1072 resource_size_t, 1072 resource_size_t,
@@ -1530,6 +1530,7 @@ enum pci_fixup_pass {
1530void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1530void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1531struct pci_dev *pci_get_dma_source(struct pci_dev *dev); 1531struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
1532int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); 1532int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1533void pci_dev_specific_enable_acs(struct pci_dev *dev);
1533#else 1534#else
1534static inline void pci_fixup_device(enum pci_fixup_pass pass, 1535static inline void pci_fixup_device(enum pci_fixup_pass pass,
1535 struct pci_dev *dev) { } 1536 struct pci_dev *dev) { }
@@ -1542,6 +1543,7 @@ static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
1542{ 1543{
1543 return -ENOTTY; 1544 return -ENOTTY;
1544} 1545}
1546static inline void pci_dev_specific_enable_acs(struct pci_dev *dev) { }
1545#endif 1547#endif
1546 1548
1547void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1549void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
@@ -1597,7 +1599,6 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1597#ifdef CONFIG_PCI_IOV 1599#ifdef CONFIG_PCI_IOV
1598int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1600int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1599void pci_disable_sriov(struct pci_dev *dev); 1601void pci_disable_sriov(struct pci_dev *dev);
1600irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1601int pci_num_vf(struct pci_dev *dev); 1602int pci_num_vf(struct pci_dev *dev);
1602int pci_vfs_assigned(struct pci_dev *dev); 1603int pci_vfs_assigned(struct pci_dev *dev);
1603int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1604int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
@@ -1606,8 +1607,6 @@ int pci_sriov_get_totalvfs(struct pci_dev *dev);
1606static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1607static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1607{ return -ENODEV; } 1608{ return -ENODEV; }
1608static inline void pci_disable_sriov(struct pci_dev *dev) { } 1609static inline void pci_disable_sriov(struct pci_dev *dev) { }
1609static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1610{ return IRQ_NONE; }
1611static inline int pci_num_vf(struct pci_dev *dev) { return 0; } 1610static inline int pci_num_vf(struct pci_dev *dev) { return 0; }
1612static inline int pci_vfs_assigned(struct pci_dev *dev) 1611static inline int pci_vfs_assigned(struct pci_dev *dev)
1613{ return 0; } 1612{ return 0; }
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7399e6a3e9a0..d4de24b4d4c6 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -528,6 +528,8 @@
528#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605 528#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605
529#define PCI_DEVICE_ID_AMD_16H_NB_F3 0x1533 529#define PCI_DEVICE_ID_AMD_16H_NB_F3 0x1533
530#define PCI_DEVICE_ID_AMD_16H_NB_F4 0x1534 530#define PCI_DEVICE_ID_AMD_16H_NB_F4 0x1534
531#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F3 0x1583
532#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F4 0x1584
531#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 533#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
532#define PCI_DEVICE_ID_AMD_LANCE 0x2000 534#define PCI_DEVICE_ID_AMD_LANCE 0x2000
533#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 535#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
@@ -726,6 +728,7 @@
726#define PCI_DEVICE_ID_SI_7018 0x7018 728#define PCI_DEVICE_ID_SI_7018 0x7018
727 729
728#define PCI_VENDOR_ID_HP 0x103c 730#define PCI_VENDOR_ID_HP 0x103c
731#define PCI_VENDOR_ID_HP_3PAR 0x1590
729#define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005 732#define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005
730#define PCI_DEVICE_ID_HP_VISUALIZE_FX6 0x1006 733#define PCI_DEVICE_ID_HP_VISUALIZE_FX6 0x1006
731#define PCI_DEVICE_ID_HP_VISUALIZE_FX4 0x1008 734#define PCI_DEVICE_ID_HP_VISUALIZE_FX4 0x1008
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index e3817d2441b6..e7a0b95ed527 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -173,6 +173,12 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
173 173
174extern void __bad_size_call_parameter(void); 174extern void __bad_size_call_parameter(void);
175 175
176#ifdef CONFIG_DEBUG_PREEMPT
177extern void __this_cpu_preempt_check(const char *op);
178#else
179static inline void __this_cpu_preempt_check(const char *op) { }
180#endif
181
176#define __pcpu_size_call_return(stem, variable) \ 182#define __pcpu_size_call_return(stem, variable) \
177({ typeof(variable) pscr_ret__; \ 183({ typeof(variable) pscr_ret__; \
178 __verify_pcpu_ptr(&(variable)); \ 184 __verify_pcpu_ptr(&(variable)); \
@@ -243,6 +249,8 @@ do { \
243} while (0) 249} while (0)
244 250
245/* 251/*
252 * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
253 *
246 * Optimized manipulation for memory allocated through the per cpu 254 * Optimized manipulation for memory allocated through the per cpu
247 * allocator or for addresses of per cpu variables. 255 * allocator or for addresses of per cpu variables.
248 * 256 *
@@ -296,7 +304,7 @@ do { \
296do { \ 304do { \
297 unsigned long flags; \ 305 unsigned long flags; \
298 raw_local_irq_save(flags); \ 306 raw_local_irq_save(flags); \
299 *__this_cpu_ptr(&(pcp)) op val; \ 307 *raw_cpu_ptr(&(pcp)) op val; \
300 raw_local_irq_restore(flags); \ 308 raw_local_irq_restore(flags); \
301} while (0) 309} while (0)
302 310
@@ -381,8 +389,8 @@ do { \
381 typeof(pcp) ret__; \ 389 typeof(pcp) ret__; \
382 unsigned long flags; \ 390 unsigned long flags; \
383 raw_local_irq_save(flags); \ 391 raw_local_irq_save(flags); \
384 __this_cpu_add(pcp, val); \ 392 raw_cpu_add(pcp, val); \
385 ret__ = __this_cpu_read(pcp); \ 393 ret__ = raw_cpu_read(pcp); \
386 raw_local_irq_restore(flags); \ 394 raw_local_irq_restore(flags); \
387 ret__; \ 395 ret__; \
388}) 396})
@@ -411,8 +419,8 @@ do { \
411({ typeof(pcp) ret__; \ 419({ typeof(pcp) ret__; \
412 unsigned long flags; \ 420 unsigned long flags; \
413 raw_local_irq_save(flags); \ 421 raw_local_irq_save(flags); \
414 ret__ = __this_cpu_read(pcp); \ 422 ret__ = raw_cpu_read(pcp); \
415 __this_cpu_write(pcp, nval); \ 423 raw_cpu_write(pcp, nval); \
416 raw_local_irq_restore(flags); \ 424 raw_local_irq_restore(flags); \
417 ret__; \ 425 ret__; \
418}) 426})
@@ -439,9 +447,9 @@ do { \
439 typeof(pcp) ret__; \ 447 typeof(pcp) ret__; \
440 unsigned long flags; \ 448 unsigned long flags; \
441 raw_local_irq_save(flags); \ 449 raw_local_irq_save(flags); \
442 ret__ = __this_cpu_read(pcp); \ 450 ret__ = raw_cpu_read(pcp); \
443 if (ret__ == (oval)) \ 451 if (ret__ == (oval)) \
444 __this_cpu_write(pcp, nval); \ 452 raw_cpu_write(pcp, nval); \
445 raw_local_irq_restore(flags); \ 453 raw_local_irq_restore(flags); \
446 ret__; \ 454 ret__; \
447}) 455})
@@ -476,7 +484,7 @@ do { \
476 int ret__; \ 484 int ret__; \
477 unsigned long flags; \ 485 unsigned long flags; \
478 raw_local_irq_save(flags); \ 486 raw_local_irq_save(flags); \
479 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ 487 ret__ = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \
480 oval1, oval2, nval1, nval2); \ 488 oval1, oval2, nval1, nval2); \
481 raw_local_irq_restore(flags); \ 489 raw_local_irq_restore(flags); \
482 ret__; \ 490 ret__; \
@@ -504,12 +512,8 @@ do { \
504#endif 512#endif
505 513
506/* 514/*
507 * Generic percpu operations for context that are safe from preemption/interrupts. 515 * Generic percpu operations for contexts where we do not want to do
508 * Either we do not care about races or the caller has the 516 * any checks for preemptiosn.
509 * responsibility of handling preemption/interrupt issues. Arch code can still
510 * override these instructions since the arch per cpu code may be more
511 * efficient and may actually get race freeness for free (that is the
512 * case for x86 for example).
513 * 517 *
514 * If there is no other protection through preempt disable and/or 518 * If there is no other protection through preempt disable and/or
515 * disabling interupts then one of these RMW operations can show unexpected 519 * disabling interupts then one of these RMW operations can show unexpected
@@ -517,211 +521,285 @@ do { \
517 * or an interrupt occurred and the same percpu variable was modified from 521 * or an interrupt occurred and the same percpu variable was modified from
518 * the interrupt context. 522 * the interrupt context.
519 */ 523 */
520#ifndef __this_cpu_read 524#ifndef raw_cpu_read
521# ifndef __this_cpu_read_1 525# ifndef raw_cpu_read_1
522# define __this_cpu_read_1(pcp) (*__this_cpu_ptr(&(pcp))) 526# define raw_cpu_read_1(pcp) (*raw_cpu_ptr(&(pcp)))
523# endif 527# endif
524# ifndef __this_cpu_read_2 528# ifndef raw_cpu_read_2
525# define __this_cpu_read_2(pcp) (*__this_cpu_ptr(&(pcp))) 529# define raw_cpu_read_2(pcp) (*raw_cpu_ptr(&(pcp)))
526# endif 530# endif
527# ifndef __this_cpu_read_4 531# ifndef raw_cpu_read_4
528# define __this_cpu_read_4(pcp) (*__this_cpu_ptr(&(pcp))) 532# define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))
529# endif 533# endif
530# ifndef __this_cpu_read_8 534# ifndef raw_cpu_read_8
531# define __this_cpu_read_8(pcp) (*__this_cpu_ptr(&(pcp))) 535# define raw_cpu_read_8(pcp) (*raw_cpu_ptr(&(pcp)))
532# endif 536# endif
533# define __this_cpu_read(pcp) __pcpu_size_call_return(__this_cpu_read_, (pcp)) 537# define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, (pcp))
534#endif 538#endif
535 539
536#define __this_cpu_generic_to_op(pcp, val, op) \ 540#define raw_cpu_generic_to_op(pcp, val, op) \
537do { \ 541do { \
538 *__this_cpu_ptr(&(pcp)) op val; \ 542 *raw_cpu_ptr(&(pcp)) op val; \
539} while (0) 543} while (0)
540 544
541#ifndef __this_cpu_write 545
542# ifndef __this_cpu_write_1 546#ifndef raw_cpu_write
543# define __this_cpu_write_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 547# ifndef raw_cpu_write_1
548# define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
544# endif 549# endif
545# ifndef __this_cpu_write_2 550# ifndef raw_cpu_write_2
546# define __this_cpu_write_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 551# define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
547# endif 552# endif
548# ifndef __this_cpu_write_4 553# ifndef raw_cpu_write_4
549# define __this_cpu_write_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 554# define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
550# endif 555# endif
551# ifndef __this_cpu_write_8 556# ifndef raw_cpu_write_8
552# define __this_cpu_write_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 557# define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
553# endif 558# endif
554# define __this_cpu_write(pcp, val) __pcpu_size_call(__this_cpu_write_, (pcp), (val)) 559# define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, (pcp), (val))
555#endif 560#endif
556 561
557#ifndef __this_cpu_add 562#ifndef raw_cpu_add
558# ifndef __this_cpu_add_1 563# ifndef raw_cpu_add_1
559# define __this_cpu_add_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 564# define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
560# endif 565# endif
561# ifndef __this_cpu_add_2 566# ifndef raw_cpu_add_2
562# define __this_cpu_add_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 567# define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
563# endif 568# endif
564# ifndef __this_cpu_add_4 569# ifndef raw_cpu_add_4
565# define __this_cpu_add_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 570# define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
566# endif 571# endif
567# ifndef __this_cpu_add_8 572# ifndef raw_cpu_add_8
568# define __this_cpu_add_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 573# define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
569# endif 574# endif
570# define __this_cpu_add(pcp, val) __pcpu_size_call(__this_cpu_add_, (pcp), (val)) 575# define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, (pcp), (val))
571#endif 576#endif
572 577
573#ifndef __this_cpu_sub 578#ifndef raw_cpu_sub
574# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val)) 579# define raw_cpu_sub(pcp, val) raw_cpu_add((pcp), -(val))
575#endif 580#endif
576 581
577#ifndef __this_cpu_inc 582#ifndef raw_cpu_inc
578# define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1) 583# define raw_cpu_inc(pcp) raw_cpu_add((pcp), 1)
579#endif 584#endif
580 585
581#ifndef __this_cpu_dec 586#ifndef raw_cpu_dec
582# define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1) 587# define raw_cpu_dec(pcp) raw_cpu_sub((pcp), 1)
583#endif 588#endif
584 589
585#ifndef __this_cpu_and 590#ifndef raw_cpu_and
586# ifndef __this_cpu_and_1 591# ifndef raw_cpu_and_1
587# define __this_cpu_and_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 592# define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
588# endif 593# endif
589# ifndef __this_cpu_and_2 594# ifndef raw_cpu_and_2
590# define __this_cpu_and_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 595# define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
591# endif 596# endif
592# ifndef __this_cpu_and_4 597# ifndef raw_cpu_and_4
593# define __this_cpu_and_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 598# define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
594# endif 599# endif
595# ifndef __this_cpu_and_8 600# ifndef raw_cpu_and_8
596# define __this_cpu_and_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 601# define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
597# endif 602# endif
598# define __this_cpu_and(pcp, val) __pcpu_size_call(__this_cpu_and_, (pcp), (val)) 603# define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, (pcp), (val))
599#endif 604#endif
600 605
601#ifndef __this_cpu_or 606#ifndef raw_cpu_or
602# ifndef __this_cpu_or_1 607# ifndef raw_cpu_or_1
603# define __this_cpu_or_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 608# define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
604# endif 609# endif
605# ifndef __this_cpu_or_2 610# ifndef raw_cpu_or_2
606# define __this_cpu_or_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 611# define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
607# endif 612# endif
608# ifndef __this_cpu_or_4 613# ifndef raw_cpu_or_4
609# define __this_cpu_or_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 614# define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
610# endif 615# endif
611# ifndef __this_cpu_or_8 616# ifndef raw_cpu_or_8
612# define __this_cpu_or_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 617# define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
613# endif 618# endif
614# define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val)) 619# define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, (pcp), (val))
615#endif 620#endif
616 621
617#define __this_cpu_generic_add_return(pcp, val) \ 622#define raw_cpu_generic_add_return(pcp, val) \
618({ \ 623({ \
619 __this_cpu_add(pcp, val); \ 624 raw_cpu_add(pcp, val); \
620 __this_cpu_read(pcp); \ 625 raw_cpu_read(pcp); \
621}) 626})
622 627
623#ifndef __this_cpu_add_return 628#ifndef raw_cpu_add_return
624# ifndef __this_cpu_add_return_1 629# ifndef raw_cpu_add_return_1
625# define __this_cpu_add_return_1(pcp, val) __this_cpu_generic_add_return(pcp, val) 630# define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val)
626# endif 631# endif
627# ifndef __this_cpu_add_return_2 632# ifndef raw_cpu_add_return_2
628# define __this_cpu_add_return_2(pcp, val) __this_cpu_generic_add_return(pcp, val) 633# define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val)
629# endif 634# endif
630# ifndef __this_cpu_add_return_4 635# ifndef raw_cpu_add_return_4
631# define __this_cpu_add_return_4(pcp, val) __this_cpu_generic_add_return(pcp, val) 636# define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val)
632# endif 637# endif
633# ifndef __this_cpu_add_return_8 638# ifndef raw_cpu_add_return_8
634# define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val) 639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
635# endif 640# endif
636# define __this_cpu_add_return(pcp, val) \ 641# define raw_cpu_add_return(pcp, val) \
637 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) 642 __pcpu_size_call_return2(raw_add_return_, pcp, val)
638#endif 643#endif
639 644
640#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val)) 645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
641#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) 646#define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1)
642#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) 647#define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1)
643 648
644#define __this_cpu_generic_xchg(pcp, nval) \ 649#define raw_cpu_generic_xchg(pcp, nval) \
645({ typeof(pcp) ret__; \ 650({ typeof(pcp) ret__; \
646 ret__ = __this_cpu_read(pcp); \ 651 ret__ = raw_cpu_read(pcp); \
647 __this_cpu_write(pcp, nval); \ 652 raw_cpu_write(pcp, nval); \
648 ret__; \ 653 ret__; \
649}) 654})
650 655
651#ifndef __this_cpu_xchg 656#ifndef raw_cpu_xchg
652# ifndef __this_cpu_xchg_1 657# ifndef raw_cpu_xchg_1
653# define __this_cpu_xchg_1(pcp, nval) __this_cpu_generic_xchg(pcp, nval) 658# define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
654# endif 659# endif
655# ifndef __this_cpu_xchg_2 660# ifndef raw_cpu_xchg_2
656# define __this_cpu_xchg_2(pcp, nval) __this_cpu_generic_xchg(pcp, nval) 661# define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
657# endif 662# endif
658# ifndef __this_cpu_xchg_4 663# ifndef raw_cpu_xchg_4
659# define __this_cpu_xchg_4(pcp, nval) __this_cpu_generic_xchg(pcp, nval) 664# define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
660# endif 665# endif
661# ifndef __this_cpu_xchg_8 666# ifndef raw_cpu_xchg_8
662# define __this_cpu_xchg_8(pcp, nval) __this_cpu_generic_xchg(pcp, nval) 667# define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
663# endif 668# endif
664# define __this_cpu_xchg(pcp, nval) \ 669# define raw_cpu_xchg(pcp, nval) \
665 __pcpu_size_call_return2(__this_cpu_xchg_, (pcp), nval) 670 __pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval)
666#endif 671#endif
667 672
668#define __this_cpu_generic_cmpxchg(pcp, oval, nval) \ 673#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
669({ \ 674({ \
670 typeof(pcp) ret__; \ 675 typeof(pcp) ret__; \
671 ret__ = __this_cpu_read(pcp); \ 676 ret__ = raw_cpu_read(pcp); \
672 if (ret__ == (oval)) \ 677 if (ret__ == (oval)) \
673 __this_cpu_write(pcp, nval); \ 678 raw_cpu_write(pcp, nval); \
674 ret__; \ 679 ret__; \
675}) 680})
676 681
677#ifndef __this_cpu_cmpxchg 682#ifndef raw_cpu_cmpxchg
678# ifndef __this_cpu_cmpxchg_1 683# ifndef raw_cpu_cmpxchg_1
679# define __this_cpu_cmpxchg_1(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval) 684# define raw_cpu_cmpxchg_1(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
680# endif 685# endif
681# ifndef __this_cpu_cmpxchg_2 686# ifndef raw_cpu_cmpxchg_2
682# define __this_cpu_cmpxchg_2(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval) 687# define raw_cpu_cmpxchg_2(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
683# endif 688# endif
684# ifndef __this_cpu_cmpxchg_4 689# ifndef raw_cpu_cmpxchg_4
685# define __this_cpu_cmpxchg_4(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval) 690# define raw_cpu_cmpxchg_4(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
686# endif 691# endif
687# ifndef __this_cpu_cmpxchg_8 692# ifndef raw_cpu_cmpxchg_8
688# define __this_cpu_cmpxchg_8(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval) 693# define raw_cpu_cmpxchg_8(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
689# endif 694# endif
690# define __this_cpu_cmpxchg(pcp, oval, nval) \ 695# define raw_cpu_cmpxchg(pcp, oval, nval) \
691 __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval) 696 __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
692#endif 697#endif
693 698
694#define __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 699#define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
695({ \ 700({ \
696 int __ret = 0; \ 701 int __ret = 0; \
697 if (__this_cpu_read(pcp1) == (oval1) && \ 702 if (raw_cpu_read(pcp1) == (oval1) && \
698 __this_cpu_read(pcp2) == (oval2)) { \ 703 raw_cpu_read(pcp2) == (oval2)) { \
699 __this_cpu_write(pcp1, (nval1)); \ 704 raw_cpu_write(pcp1, (nval1)); \
700 __this_cpu_write(pcp2, (nval2)); \ 705 raw_cpu_write(pcp2, (nval2)); \
701 __ret = 1; \ 706 __ret = 1; \
702 } \ 707 } \
703 (__ret); \ 708 (__ret); \
704}) 709})
705 710
706#ifndef __this_cpu_cmpxchg_double 711#ifndef raw_cpu_cmpxchg_double
707# ifndef __this_cpu_cmpxchg_double_1 712# ifndef raw_cpu_cmpxchg_double_1
708# define __this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 713# define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
709 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 714 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
710# endif 715# endif
711# ifndef __this_cpu_cmpxchg_double_2 716# ifndef raw_cpu_cmpxchg_double_2
712# define __this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 717# define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
713 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 718 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
714# endif 719# endif
715# ifndef __this_cpu_cmpxchg_double_4 720# ifndef raw_cpu_cmpxchg_double_4
716# define __this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 721# define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
717 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 722 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
718# endif 723# endif
719# ifndef __this_cpu_cmpxchg_double_8 724# ifndef raw_cpu_cmpxchg_double_8
720# define __this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 725# define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
721 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 726 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
722# endif 727# endif
728# define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
729 __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
730#endif
731
732/*
733 * Generic percpu operations for context that are safe from preemption/interrupts.
734 */
735#ifndef __this_cpu_read
736# define __this_cpu_read(pcp) \
737 (__this_cpu_preempt_check("read"),__pcpu_size_call_return(raw_cpu_read_, (pcp)))
738#endif
739
740#ifndef __this_cpu_write
741# define __this_cpu_write(pcp, val) \
742do { __this_cpu_preempt_check("write"); \
743 __pcpu_size_call(raw_cpu_write_, (pcp), (val)); \
744} while (0)
745#endif
746
747#ifndef __this_cpu_add
748# define __this_cpu_add(pcp, val) \
749do { __this_cpu_preempt_check("add"); \
750 __pcpu_size_call(raw_cpu_add_, (pcp), (val)); \
751} while (0)
752#endif
753
754#ifndef __this_cpu_sub
755# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val))
756#endif
757
758#ifndef __this_cpu_inc
759# define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1)
760#endif
761
762#ifndef __this_cpu_dec
763# define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1)
764#endif
765
766#ifndef __this_cpu_and
767# define __this_cpu_and(pcp, val) \
768do { __this_cpu_preempt_check("and"); \
769 __pcpu_size_call(raw_cpu_and_, (pcp), (val)); \
770} while (0)
771
772#endif
773
774#ifndef __this_cpu_or
775# define __this_cpu_or(pcp, val) \
776do { __this_cpu_preempt_check("or"); \
777 __pcpu_size_call(raw_cpu_or_, (pcp), (val)); \
778} while (0)
779#endif
780
781#ifndef __this_cpu_add_return
782# define __this_cpu_add_return(pcp, val) \
783 (__this_cpu_preempt_check("add_return"),__pcpu_size_call_return2(raw_cpu_add_return_, pcp, val))
784#endif
785
786#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
787#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
788#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
789
790#ifndef __this_cpu_xchg
791# define __this_cpu_xchg(pcp, nval) \
792 (__this_cpu_preempt_check("xchg"),__pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval))
793#endif
794
795#ifndef __this_cpu_cmpxchg
796# define __this_cpu_cmpxchg(pcp, oval, nval) \
797 (__this_cpu_preempt_check("cmpxchg"),__pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval))
798#endif
799
800#ifndef __this_cpu_cmpxchg_double
723# define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 801# define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
724 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) 802 (__this_cpu_preempt_check("cmpxchg_double"),__pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)))
725#endif 803#endif
726 804
727#endif /* __LINUX_PERCPU_H */ 805#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index e56b07f5c9b6..3356abcfff18 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -835,6 +835,8 @@ do { \
835 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ 835 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
836 unsigned long cpu = smp_processor_id(); \ 836 unsigned long cpu = smp_processor_id(); \
837 unsigned long flags; \ 837 unsigned long flags; \
838 \
839 cpu_notifier_register_begin(); \
838 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ 840 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \
839 (void *)(unsigned long)cpu); \ 841 (void *)(unsigned long)cpu); \
840 local_irq_save(flags); \ 842 local_irq_save(flags); \
@@ -843,9 +845,21 @@ do { \
843 local_irq_restore(flags); \ 845 local_irq_restore(flags); \
844 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \ 846 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \
845 (void *)(unsigned long)cpu); \ 847 (void *)(unsigned long)cpu); \
846 register_cpu_notifier(&fn##_nb); \ 848 __register_cpu_notifier(&fn##_nb); \
849 cpu_notifier_register_done(); \
847} while (0) 850} while (0)
848 851
852/*
853 * Bare-bones version of perf_cpu_notifier(), which doesn't invoke the
854 * callback for already online CPUs.
855 */
856#define __perf_cpu_notifier(fn) \
857do { \
858 static struct notifier_block fn##_nb = \
859 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
860 \
861 __register_cpu_notifier(&fn##_nb); \
862} while (0)
849 863
850struct perf_pmu_events_attr { 864struct perf_pmu_events_attr {
851 struct device_attribute attr; 865 struct device_attribute attr;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 565188ca328f..24126c4b27b5 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -74,8 +74,53 @@ typedef enum {
74 PHY_INTERFACE_MODE_RTBI, 74 PHY_INTERFACE_MODE_RTBI,
75 PHY_INTERFACE_MODE_SMII, 75 PHY_INTERFACE_MODE_SMII,
76 PHY_INTERFACE_MODE_XGMII, 76 PHY_INTERFACE_MODE_XGMII,
77 PHY_INTERFACE_MODE_MOCA,
78 PHY_INTERFACE_MODE_MAX,
77} phy_interface_t; 79} phy_interface_t;
78 80
81/**
82 * It maps 'enum phy_interface_t' found in include/linux/phy.h
83 * into the device tree binding of 'phy-mode', so that Ethernet
84 * device driver can get phy interface from device tree.
85 */
86static inline const char *phy_modes(phy_interface_t interface)
87{
88 switch (interface) {
89 case PHY_INTERFACE_MODE_NA:
90 return "";
91 case PHY_INTERFACE_MODE_MII:
92 return "mii";
93 case PHY_INTERFACE_MODE_GMII:
94 return "gmii";
95 case PHY_INTERFACE_MODE_SGMII:
96 return "sgmii";
97 case PHY_INTERFACE_MODE_TBI:
98 return "tbi";
99 case PHY_INTERFACE_MODE_REVMII:
100 return "rev-mii";
101 case PHY_INTERFACE_MODE_RMII:
102 return "rmii";
103 case PHY_INTERFACE_MODE_RGMII:
104 return "rgmii";
105 case PHY_INTERFACE_MODE_RGMII_ID:
106 return "rgmii-id";
107 case PHY_INTERFACE_MODE_RGMII_RXID:
108 return "rgmii-rxid";
109 case PHY_INTERFACE_MODE_RGMII_TXID:
110 return "rgmii-txid";
111 case PHY_INTERFACE_MODE_RTBI:
112 return "rtbi";
113 case PHY_INTERFACE_MODE_SMII:
114 return "smii";
115 case PHY_INTERFACE_MODE_XGMII:
116 return "xgmii";
117 case PHY_INTERFACE_MODE_MOCA:
118 return "moca";
119 default:
120 return "unknown";
121 }
122}
123
79 124
80#define PHY_INIT_TIMEOUT 100000 125#define PHY_INIT_TIMEOUT 100000
81#define PHY_STATE_TIME 1 126#define PHY_STATE_TIME 1
@@ -308,6 +353,7 @@ struct phy_device {
308 struct phy_c45_device_ids c45_ids; 353 struct phy_c45_device_ids c45_ids;
309 bool is_c45; 354 bool is_c45;
310 bool is_internal; 355 bool is_internal;
356 bool has_fixups;
311 357
312 enum phy_state state; 358 enum phy_state state;
313 359
@@ -394,6 +440,11 @@ struct phy_driver {
394 u32 flags; 440 u32 flags;
395 441
396 /* 442 /*
443 * Called to issue a PHY software reset
444 */
445 int (*soft_reset)(struct phy_device *phydev);
446
447 /*
397 * Called to initialize the PHY, 448 * Called to initialize the PHY,
398 * including after a reset 449 * including after a reset
399 */ 450 */
@@ -417,6 +468,9 @@ struct phy_driver {
417 */ 468 */
418 int (*config_aneg)(struct phy_device *phydev); 469 int (*config_aneg)(struct phy_device *phydev);
419 470
471 /* Determines the auto negotiation result */
472 int (*aneg_done)(struct phy_device *phydev);
473
420 /* Determines the negotiated speed and duplex */ 474 /* Determines the negotiated speed and duplex */
421 int (*read_status)(struct phy_device *phydev); 475 int (*read_status)(struct phy_device *phydev);
422 476
@@ -612,10 +666,12 @@ static inline int phy_read_status(struct phy_device *phydev)
612int genphy_setup_forced(struct phy_device *phydev); 666int genphy_setup_forced(struct phy_device *phydev);
613int genphy_restart_aneg(struct phy_device *phydev); 667int genphy_restart_aneg(struct phy_device *phydev);
614int genphy_config_aneg(struct phy_device *phydev); 668int genphy_config_aneg(struct phy_device *phydev);
669int genphy_aneg_done(struct phy_device *phydev);
615int genphy_update_link(struct phy_device *phydev); 670int genphy_update_link(struct phy_device *phydev);
616int genphy_read_status(struct phy_device *phydev); 671int genphy_read_status(struct phy_device *phydev);
617int genphy_suspend(struct phy_device *phydev); 672int genphy_suspend(struct phy_device *phydev);
618int genphy_resume(struct phy_device *phydev); 673int genphy_resume(struct phy_device *phydev);
674int genphy_soft_reset(struct phy_device *phydev);
619void phy_driver_unregister(struct phy_driver *drv); 675void phy_driver_unregister(struct phy_driver *drv);
620void phy_drivers_unregister(struct phy_driver *drv, int n); 676void phy_drivers_unregister(struct phy_driver *drv, int n);
621int phy_driver_register(struct phy_driver *new_driver); 677int phy_driver_register(struct phy_driver *new_driver);
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/phy/omap_control_phy.h
index 69ae383ee3cc..5450403c7546 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/phy/omap_control_phy.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * omap_control_usb.h - Header file for the USB part of control module. 2 * omap_control_phy.h - Header file for the PHY part of control module.
3 * 3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com 4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
@@ -16,10 +16,10 @@
16 * 16 *
17 */ 17 */
18 18
19#ifndef __OMAP_CONTROL_USB_H__ 19#ifndef __OMAP_CONTROL_PHY_H__
20#define __OMAP_CONTROL_USB_H__ 20#define __OMAP_CONTROL_PHY_H__
21 21
22enum omap_control_usb_type { 22enum omap_control_phy_type {
23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */ 23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ 24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */ 25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
@@ -27,7 +27,7 @@ enum omap_control_usb_type {
27 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ 27 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
28}; 28};
29 29
30struct omap_control_usb { 30struct omap_control_phy {
31 struct device *dev; 31 struct device *dev;
32 32
33 u32 __iomem *otghs_control; 33 u32 __iomem *otghs_control;
@@ -36,7 +36,7 @@ struct omap_control_usb {
36 36
37 struct clk *sys_clk; 37 struct clk *sys_clk;
38 38
39 enum omap_control_usb_type type; 39 enum omap_control_phy_type type;
40}; 40};
41 41
42enum omap_control_usb_mode { 42enum omap_control_usb_mode {
@@ -54,14 +54,14 @@ enum omap_control_usb_mode {
54#define OMAP_CTRL_DEV_SESSEND BIT(3) 54#define OMAP_CTRL_DEV_SESSEND BIT(3)
55#define OMAP_CTRL_DEV_IDDIG BIT(4) 55#define OMAP_CTRL_DEV_IDDIG BIT(4)
56 56
57#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000 57#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
58#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE 58#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
59 59
60#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000 60#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
61#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16 61#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
62 62
63#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 63#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 64#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
65 65
66#define OMAP_CTRL_USB2_PHY_PD BIT(28) 66#define OMAP_CTRL_USB2_PHY_PD BIT(28)
67 67
@@ -70,13 +70,13 @@ enum omap_control_usb_mode {
70#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19) 70#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
71#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20) 71#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
72 72
73#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) 73#if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
74extern void omap_control_usb_phy_power(struct device *dev, int on); 74void omap_control_phy_power(struct device *dev, int on);
75extern void omap_control_usb_set_mode(struct device *dev, 75void omap_control_usb_set_mode(struct device *dev,
76 enum omap_control_usb_mode mode); 76 enum omap_control_usb_mode mode);
77#else 77#else
78 78
79static inline void omap_control_usb_phy_power(struct device *dev, int on) 79static inline void omap_control_phy_power(struct device *dev, int on)
80{ 80{
81} 81}
82 82
@@ -86,4 +86,4 @@ static inline void omap_control_usb_set_mode(struct device *dev,
86} 86}
87#endif 87#endif
88 88
89#endif /* __OMAP_CONTROL_USB_H__ */ 89#endif /* __OMAP_CONTROL_PHY_H__ */
diff --git a/include/linux/usb/omap_usb.h b/include/linux/phy/omap_usb.h
index 6ae29360e1d2..dc2c541a619b 100644
--- a/include/linux/usb/omap_usb.h
+++ b/include/linux/phy/omap_usb.h
@@ -34,14 +34,24 @@ struct omap_usb {
34 struct usb_phy phy; 34 struct usb_phy phy;
35 struct phy_companion *comparator; 35 struct phy_companion *comparator;
36 void __iomem *pll_ctrl_base; 36 void __iomem *pll_ctrl_base;
37 void __iomem *phy_base;
37 struct device *dev; 38 struct device *dev;
38 struct device *control_dev; 39 struct device *control_dev;
39 struct clk *wkupclk; 40 struct clk *wkupclk;
40 struct clk *sys_clk;
41 struct clk *optclk; 41 struct clk *optclk;
42 u8 is_suspended:1; 42 u8 flags;
43}; 43};
44 44
45struct usb_phy_data {
46 const char *label;
47 u8 flags;
48};
49
50/* Driver Flags */
51#define OMAP_USB2_HAS_START_SRP (1 << 0)
52#define OMAP_USB2_HAS_SET_VBUS (1 << 1)
53#define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
54
45#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) 55#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
46 56
47#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) 57#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 3f83459dbb20..e2f5ca96cddc 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -149,8 +149,11 @@ struct phy *phy_get(struct device *dev, const char *string);
149struct phy *phy_optional_get(struct device *dev, const char *string); 149struct phy *phy_optional_get(struct device *dev, const char *string);
150struct phy *devm_phy_get(struct device *dev, const char *string); 150struct phy *devm_phy_get(struct device *dev, const char *string);
151struct phy *devm_phy_optional_get(struct device *dev, const char *string); 151struct phy *devm_phy_optional_get(struct device *dev, const char *string);
152struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
153 const char *con_id);
152void phy_put(struct phy *phy); 154void phy_put(struct phy *phy);
153void devm_phy_put(struct device *dev, struct phy *phy); 155void devm_phy_put(struct device *dev, struct phy *phy);
156struct phy *of_phy_get(struct device_node *np, const char *con_id);
154struct phy *of_phy_simple_xlate(struct device *dev, 157struct phy *of_phy_simple_xlate(struct device *dev,
155 struct of_phandle_args *args); 158 struct of_phandle_args *args);
156struct phy *phy_create(struct device *dev, const struct phy_ops *ops, 159struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
@@ -251,6 +254,13 @@ static inline struct phy *devm_phy_optional_get(struct device *dev,
251 return ERR_PTR(-ENOSYS); 254 return ERR_PTR(-ENOSYS);
252} 255}
253 256
257static inline struct phy *devm_of_phy_get(struct device *dev,
258 struct device_node *np,
259 const char *con_id)
260{
261 return ERR_PTR(-ENOSYS);
262}
263
254static inline void phy_put(struct phy *phy) 264static inline void phy_put(struct phy *phy)
255{ 265{
256} 266}
@@ -259,6 +269,11 @@ static inline void devm_phy_put(struct device *dev, struct phy *phy)
259{ 269{
260} 270}
261 271
272static inline struct phy *of_phy_get(struct device_node *np, const char *con_id)
273{
274 return ERR_PTR(-ENOSYS);
275}
276
262static inline struct phy *of_phy_simple_xlate(struct device *dev, 277static inline struct phy *of_phy_simple_xlate(struct device *dev,
263 struct of_phandle_args *args) 278 struct of_phandle_args *args)
264{ 279{
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index ab5752692113..eb8b8ac6df3c 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -35,7 +35,7 @@ struct pipe_buffer {
35 * @tmp_page: cached released page 35 * @tmp_page: cached released page
36 * @readers: number of current readers of this pipe 36 * @readers: number of current readers of this pipe
37 * @writers: number of current writers of this pipe 37 * @writers: number of current writers of this pipe
38 * @files: number of struct file refering this pipe (protected by ->i_lock) 38 * @files: number of struct file referring this pipe (protected by ->i_lock)
39 * @waiting_writers: number of writers blocked waiting for room 39 * @waiting_writers: number of writers blocked waiting for room
40 * @r_counter: reader counter 40 * @r_counter: reader counter
41 * @w_counter: writer counter 41 * @w_counter: writer counter
@@ -83,23 +83,6 @@ struct pipe_buf_operations {
83 int can_merge; 83 int can_merge;
84 84
85 /* 85 /*
86 * ->map() returns a virtual address mapping of the pipe buffer.
87 * The last integer flag reflects whether this should be an atomic
88 * mapping or not. The atomic map is faster, however you can't take
89 * page faults before calling ->unmap() again. So if you need to eg
90 * access user data through copy_to/from_user(), then you must get
91 * a non-atomic map. ->map() uses the kmap_atomic slot for
92 * atomic maps, you have to be careful if mapping another page as
93 * source or destination for a copy.
94 */
95 void * (*map)(struct pipe_inode_info *, struct pipe_buffer *, int);
96
97 /*
98 * Undoes ->map(), finishes the virtual mapping of the pipe buffer.
99 */
100 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *, void *);
101
102 /*
103 * ->confirm() verifies that the data in the pipe buffer is there 86 * ->confirm() verifies that the data in the pipe buffer is there
104 * and that the contents are good. If the pages in the pipe belong 87 * and that the contents are good. If the pages in the pipe belong
105 * to a file system, we may need to wait for IO completion in this 88 * to a file system, we may need to wait for IO completion in this
@@ -150,8 +133,6 @@ struct pipe_inode_info *alloc_pipe_info(void);
150void free_pipe_info(struct pipe_inode_info *); 133void free_pipe_info(struct pipe_inode_info *);
151 134
152/* Generic pipe buffer ops functions */ 135/* Generic pipe buffer ops functions */
153void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int);
154void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *);
155void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); 136void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
156int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); 137int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
157int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 138int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
diff --git a/include/linux/platform_data/adau1977.h b/include/linux/platform_data/adau1977.h
new file mode 100644
index 000000000000..bed11d908f92
--- /dev/null
+++ b/include/linux/platform_data/adau1977.h
@@ -0,0 +1,45 @@
1/*
2 * ADAU1977/ADAU1978/ADAU1979 driver
3 *
4 * Copyright 2014 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2.
8 */
9
10#ifndef __LINUX_PLATFORM_DATA_ADAU1977_H__
11#define __LINUX_PLATFORM_DATA_ADAU1977_H__
12
13/**
14 * enum adau1977_micbias - ADAU1977 MICBIAS pin voltage setting
15 * @ADAU1977_MICBIAS_5V0: MICBIAS is set to 5.0 V
16 * @ADAU1977_MICBIAS_5V5: MICBIAS is set to 5.5 V
17 * @ADAU1977_MICBIAS_6V0: MICBIAS is set to 6.0 V
18 * @ADAU1977_MICBIAS_6V5: MICBIAS is set to 6.5 V
19 * @ADAU1977_MICBIAS_7V0: MICBIAS is set to 7.0 V
20 * @ADAU1977_MICBIAS_7V5: MICBIAS is set to 7.5 V
21 * @ADAU1977_MICBIAS_8V0: MICBIAS is set to 8.0 V
22 * @ADAU1977_MICBIAS_8V5: MICBIAS is set to 8.5 V
23 * @ADAU1977_MICBIAS_9V0: MICBIAS is set to 9.0 V
24 */
25enum adau1977_micbias {
26 ADAU1977_MICBIAS_5V0 = 0x0,
27 ADAU1977_MICBIAS_5V5 = 0x1,
28 ADAU1977_MICBIAS_6V0 = 0x2,
29 ADAU1977_MICBIAS_6V5 = 0x3,
30 ADAU1977_MICBIAS_7V0 = 0x4,
31 ADAU1977_MICBIAS_7V5 = 0x5,
32 ADAU1977_MICBIAS_8V0 = 0x6,
33 ADAU1977_MICBIAS_8V5 = 0x7,
34 ADAU1977_MICBIAS_9V0 = 0x8,
35};
36
37/**
38 * struct adau1977_platform_data - Platform configuration data for the ADAU1977
39 * @micbias: Specifies the voltage for the MICBIAS pin
40 */
41struct adau1977_platform_data {
42 enum adau1977_micbias micbias;
43};
44
45#endif
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index 9efc04dd255a..709c6f7e2f8c 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-samsung/include/plat/audio.h 1/*
2 *
3 * Copyright (c) 2009 Samsung Electronics Co. Ltd 2 * Copyright (c) 2009 Samsung Electronics Co. Ltd
4 * Author: Jaswinder Singh <jassi.brar@samsung.com> 3 * Author: Jaswinder Singh <jassi.brar@samsung.com>
5 * 4 *
diff --git a/include/linux/platform_data/asoc-s3c24xx_simtec.h b/include/linux/platform_data/asoc-s3c24xx_simtec.h
index 376af5286a3e..d220e54123aa 100644
--- a/include/linux/platform_data/asoc-s3c24xx_simtec.h
+++ b/include/linux/platform_data/asoc-s3c24xx_simtec.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-samsung/include/plat/audio-simtec.h 1/*
2 *
3 * Copyright 2008 Simtec Electronics 2 * Copyright 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 3 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
diff --git a/include/linux/platform_data/ata-samsung_cf.h b/include/linux/platform_data/ata-samsung_cf.h
index 2a3855a8372a..c2049e3d7444 100644
--- a/include/linux/platform_data/ata-samsung_cf.h
+++ b/include/linux/platform_data/ata-samsung_cf.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/ata.h 1/*
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
@@ -10,8 +9,8 @@
10 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
11*/ 10*/
12 11
13#ifndef __ASM_PLAT_ATA_H 12#ifndef __ATA_SAMSUNG_CF_H
14#define __ASM_PLAT_ATA_H __FILE__ 13#define __ATA_SAMSUNG_CF_H __FILE__
15 14
16/** 15/**
17 * struct s3c_ide_platdata - S3C IDE driver platform data. 16 * struct s3c_ide_platdata - S3C IDE driver platform data.
@@ -33,4 +32,4 @@ extern void s3c64xx_ide_setup_gpio(void);
33extern void s5pc100_ide_setup_gpio(void); 32extern void s5pc100_ide_setup_gpio(void);
34extern void s5pv210_ide_setup_gpio(void); 33extern void s5pv210_ide_setup_gpio(void);
35 34
36#endif /*__ASM_PLAT_ATA_H */ 35#endif /*__ATA_SAMSUNG_CF_H */
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index cea9f70133c5..e26b0c14edea 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -84,6 +84,7 @@ struct atmel_uart_data {
84 short use_dma_rx; /* use receive DMA? */ 84 short use_dma_rx; /* use receive DMA? */
85 void __iomem *regs; /* virt. base address, if any */ 85 void __iomem *regs; /* virt. base address, if any */
86 struct serial_rs485 rs485; /* rs485 settings */ 86 struct serial_rs485 rs485; /* rs485 settings */
87 int rts_gpio; /* optional RTS GPIO */
87}; 88};
88 89
89 /* Touchscreen Controller */ 90 /* Touchscreen Controller */
diff --git a/include/linux/platform_data/bt-nokia-h4p.h b/include/linux/platform_data/bt-nokia-h4p.h
new file mode 100644
index 000000000000..30d169dfadf3
--- /dev/null
+++ b/include/linux/platform_data/bt-nokia-h4p.h
@@ -0,0 +1,38 @@
1/*
2 * This file is part of Nokia H4P bluetooth driver
3 *
4 * Copyright (C) 2010 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * 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., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22
23/**
24 * struct hci_h4p_platform data - hci_h4p Platform data structure
25 */
26struct hci_h4p_platform_data {
27 int chip_type;
28 int bt_sysclk;
29 unsigned int bt_wakeup_gpio;
30 unsigned int host_wakeup_gpio;
31 unsigned int reset_gpio;
32 int reset_gpio_shared;
33 unsigned int uart_irq;
34 phys_addr_t uart_base;
35 const char *uart_iclk;
36 const char *uart_fclk;
37 void (*set_pm_limits)(struct device *dev, bool set);
38};
diff --git a/include/linux/platform_data/clk-integrator.h b/include/linux/platform_data/clk-integrator.h
index 280edac9d0a5..addd48cac625 100644
--- a/include/linux/platform_data/clk-integrator.h
+++ b/include/linux/platform_data/clk-integrator.h
@@ -1,3 +1,2 @@
1void integrator_clk_init(bool is_cp);
2void integrator_impd1_clk_init(void __iomem *base, unsigned int id); 1void integrator_impd1_clk_init(void __iomem *base, unsigned int id);
3void integrator_impd1_clk_exit(unsigned int id); 2void integrator_impd1_clk_exit(unsigned int id);
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index 5245992b0367..85ad68f9206a 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -18,7 +18,7 @@
18 18
19#include <linux/genalloc.h> 19#include <linux/genalloc.h>
20 20
21struct snd_platform_data { 21struct davinci_mcasp_pdata {
22 u32 tx_dma_offset; 22 u32 tx_dma_offset;
23 u32 rx_dma_offset; 23 u32 rx_dma_offset;
24 int asp_chan_q; /* event queue number for ASP channel */ 24 int asp_chan_q; /* event queue number for ASP channel */
@@ -87,6 +87,8 @@ struct snd_platform_data {
87 int tx_dma_channel; 87 int tx_dma_channel;
88 int rx_dma_channel; 88 int rx_dma_channel;
89}; 89};
90/* TODO: Fix arch/arm/mach-davinci/ users and remove this define */
91#define snd_platform_data davinci_mcasp_pdata
90 92
91enum { 93enum {
92 MCASP_VERSION_1 = 0, /* DM646x */ 94 MCASP_VERSION_1 = 0, /* DM646x */
diff --git a/include/linux/platform_data/dma-rcar-audmapp.h b/include/linux/platform_data/dma-rcar-audmapp.h
new file mode 100644
index 000000000000..471fffebbeb4
--- /dev/null
+++ b/include/linux/platform_data/dma-rcar-audmapp.h
@@ -0,0 +1,34 @@
1/*
2 * This is for Renesas R-Car Audio-DMAC-peri-peri.
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 * Copyright (C) 2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This file is based on the include/linux/sh_dma.h
8 *
9 * Header for the new SH dmaengine driver
10 *
11 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17#ifndef SH_AUDMAPP_H
18#define SH_AUDMAPP_H
19
20#include <linux/dmaengine.h>
21
22struct audmapp_slave_config {
23 int slave_id;
24 dma_addr_t src;
25 dma_addr_t dst;
26 u32 chcr;
27};
28
29struct audmapp_pdata {
30 struct audmapp_slave_config *slave;
31 int slave_num;
32};
33
34#endif /* SH_AUDMAPP_H */
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
index bf0a83b7ed9d..4edb40676b3f 100644
--- a/include/linux/platform_data/elm.h
+++ b/include/linux/platform_data/elm.h
@@ -26,13 +26,6 @@ enum bch_ecc {
26/* ELM support 8 error syndrome process */ 26/* ELM support 8 error syndrome process */
27#define ERROR_VECTOR_MAX 8 27#define ERROR_VECTOR_MAX 8
28 28
29#define BCH8_ECC_OOB_BYTES 13
30#define BCH4_ECC_OOB_BYTES 7
31/* RBL requires 14 byte even though BCH8 uses only 13 byte */
32#define BCH8_SIZE (BCH8_ECC_OOB_BYTES + 1)
33/* Uses 1 extra byte to handle erased pages */
34#define BCH4_SIZE (BCH4_ECC_OOB_BYTES + 1)
35
36/** 29/**
37 * struct elm_errorvec - error vector for elm 30 * struct elm_errorvec - error vector for elm
38 * @error_reported: set true for vectors error is reported 31 * @error_reported: set true for vectors error is reported
@@ -50,5 +43,6 @@ struct elm_errorvec {
50 43
51void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, 44void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
52 struct elm_errorvec *err_vec); 45 struct elm_errorvec *err_vec);
53int elm_config(struct device *dev, enum bch_ecc bch_type); 46int elm_config(struct device *dev, enum bch_ecc bch_type,
47 int ecc_steps, int ecc_step_size, int ecc_syndrome_size);
54#endif /* __ELM_H */ 48#endif /* __ELM_H */
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
index fbe2f7535741..6ace3fd32b6a 100644
--- a/include/linux/platform_data/gpio-davinci.h
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -21,10 +21,6 @@
21 21
22#include <asm-generic/gpio.h> 22#include <asm-generic/gpio.h>
23 23
24enum davinci_gpio_type {
25 GPIO_TYPE_TNETV107X = 0,
26};
27
28struct davinci_gpio_platform_data { 24struct davinci_gpio_platform_data {
29 u32 ngpio; 25 u32 ngpio;
30 u32 gpio_unbanked; 26 u32 gpio_unbanked;
diff --git a/include/linux/platform_data/i2c-s3c2410.h b/include/linux/platform_data/i2c-s3c2410.h
index 2a50048c1c44..05af66b840b9 100644
--- a/include/linux/platform_data/i2c-s3c2410.h
+++ b/include/linux/platform_data/i2c-s3c2410.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-s3c/include/plat/iic.h 1/*
2 *
3 * Copyright 2004-2009 Simtec Electronics 2 * Copyright 2004-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * 4 *
@@ -10,8 +9,8 @@
10 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
11*/ 10*/
12 11
13#ifndef __ASM_ARCH_IIC_H 12#ifndef __I2C_S3C2410_H
14#define __ASM_ARCH_IIC_H __FILE__ 13#define __I2C_S3C2410_H __FILE__
15 14
16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */ 15#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
17 16
@@ -76,4 +75,4 @@ extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
76 75
77extern struct s3c2410_platform_i2c default_i2c_data; 76extern struct s3c2410_platform_i2c default_i2c_data;
78 77
79#endif /* __ASM_ARCH_IIC_H */ 78#endif /* __I2C_S3C2410_H */
diff --git a/include/linux/platform_data/leds-s3c24xx.h b/include/linux/platform_data/leds-s3c24xx.h
index d8a7672519b6..441a6f290649 100644
--- a/include/linux/platform_data/leds-s3c24xx.h
+++ b/include/linux/platform_data/leds-s3c24xx.h
@@ -1,5 +1,4 @@
1/* arch/arm/mach-s3c2410/include/mach/leds-gpio.h 1/*
2 *
3 * Copyright (c) 2006 Simtec Electronics 2 * Copyright (c) 2006 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 3 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
@@ -11,8 +10,8 @@
11 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
12*/ 11*/
13 12
14#ifndef __ASM_ARCH_LEDSGPIO_H 13#ifndef __LEDS_S3C24XX_H
15#define __ASM_ARCH_LEDSGPIO_H "leds-gpio.h" 14#define __LEDS_S3C24XX_H
16 15
17#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */ 16#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */
18#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */ 17#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */
@@ -25,4 +24,4 @@ struct s3c24xx_led_platdata {
25 char *def_trigger; 24 char *def_trigger;
26}; 25};
27 26
28#endif /* __ASM_ARCH_LEDSGPIO_H */ 27#endif /* __LEDS_S3C24XX_H */
diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h
deleted file mode 100644
index dd11dcd1a184..000000000000
--- a/include/linux/platform_data/max310x.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Maxim (Dallas) MAX3107/8/9, MAX14830 serial driver
3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
5 *
6 * Based on max3100.c, by Christian Pellegrin <chripell@evolware.org>
7 * Based on max3110.c, by Feng Tang <feng.tang@intel.com>
8 * Based on max3107.c, by Aavamobile
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef _MAX310X_H_
17#define _MAX310X_H_
18
19/*
20 * Example board initialization data:
21 *
22 * static struct max310x_pdata max3107_pdata = {
23 * .driver_flags = MAX310X_EXT_CLK,
24 * .uart_flags[0] = MAX310X_ECHO_SUPRESS | MAX310X_AUTO_DIR_CTRL,
25 * .frequency = 3686400,
26 * .gpio_base = -1,
27 * };
28 *
29 * static struct spi_board_info spi_device_max3107[] = {
30 * {
31 * .modalias = "max3107",
32 * .irq = IRQ_EINT3,
33 * .bus_num = 1,
34 * .chip_select = 1,
35 * .platform_data = &max3107_pdata,
36 * },
37 * };
38 */
39
40#define MAX310X_MAX_UARTS 4
41
42/* MAX310X platform data structure */
43struct max310x_pdata {
44 /* Flags global to driver */
45 const u8 driver_flags;
46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */
47 /* Flags global to UART port */
48 const u8 uart_flags[MAX310X_MAX_UARTS];
49#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */
50#define MAX310X_ECHO_SUPRESS (0x00000002) /* Enable echo supress */
51#define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction
52 * control (RS-485)
53 */
54 /* Frequency (extrenal clock or crystal) */
55 const int frequency;
56 /* GPIO base number (can be negative) */
57 const int gpio_base;
58 /* Called during startup */
59 void (*init)(void);
60 /* Called before finish */
61 void (*exit)(void);
62};
63
64#endif
diff --git a/include/linux/platform_data/mmc-msm_sdcc.h b/include/linux/platform_data/mmc-msm_sdcc.h
index ffcd9e3a6a7e..55aa873c9396 100644
--- a/include/linux/platform_data/mmc-msm_sdcc.h
+++ b/include/linux/platform_data/mmc-msm_sdcc.h
@@ -1,8 +1,5 @@
1/* 1#ifndef __MMC_MSM_SDCC_H
2 * arch/arm/include/asm/mach/mmc.h 2#define __MMC_MSM_SDCC_H
3 */
4#ifndef ASMARM_MACH_MMC_H
5#define ASMARM_MACH_MMC_H
6 3
7#include <linux/mmc/host.h> 4#include <linux/mmc/host.h>
8#include <linux/mmc/card.h> 5#include <linux/mmc/card.h>
diff --git a/include/linux/platform_data/mmc-mvsdio.h b/include/linux/platform_data/mmc-mvsdio.h
index 1190efedcb94..d02704cd3695 100644
--- a/include/linux/platform_data/mmc-mvsdio.h
+++ b/include/linux/platform_data/mmc-mvsdio.h
@@ -1,13 +1,11 @@
1/* 1/*
2 * arch/arm/plat-orion/include/plat/mvsdio.h
3 *
4 * This file is licensed under the terms of the GNU General Public 2 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any 3 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 4 * warranty of any kind, whether express or implied.
7 */ 5 */
8 6
9#ifndef __MACH_MVSDIO_H 7#ifndef __MMC_MVSDIO_H
10#define __MACH_MVSDIO_H 8#define __MMC_MVSDIO_H
11 9
12#include <linux/mbus.h> 10#include <linux/mbus.h>
13 11
diff --git a/include/linux/platform_data/mtd-davinci-aemif.h b/include/linux/platform_data/mtd-davinci-aemif.h
index 05b293443097..97948ac2bb9b 100644
--- a/include/linux/platform_data/mtd-davinci-aemif.h
+++ b/include/linux/platform_data/mtd-davinci-aemif.h
@@ -10,6 +10,8 @@
10#ifndef _MACH_DAVINCI_AEMIF_H 10#ifndef _MACH_DAVINCI_AEMIF_H
11#define _MACH_DAVINCI_AEMIF_H 11#define _MACH_DAVINCI_AEMIF_H
12 12
13#include <linux/platform_device.h>
14
13#define NRCSR_OFFSET 0x00 15#define NRCSR_OFFSET 0x00
14#define AWCCR_OFFSET 0x04 16#define AWCCR_OFFSET 0x04
15#define A1CR_OFFSET 0x10 17#define A1CR_OFFSET 0x10
@@ -31,6 +33,5 @@ struct davinci_aemif_timing {
31 u8 ta; 33 u8 ta;
32}; 34};
33 35
34int davinci_aemif_setup_timing(struct davinci_aemif_timing *t, 36int davinci_aemif_setup(struct platform_device *pdev);
35 void __iomem *base, unsigned cs);
36#endif 37#endif
diff --git a/include/linux/platform_data/mtd-nand-s3c2410.h b/include/linux/platform_data/mtd-nand-s3c2410.h
index b64115fa93a4..36bb92172f47 100644
--- a/include/linux/platform_data/mtd-nand-s3c2410.h
+++ b/include/linux/platform_data/mtd-nand-s3c2410.h
@@ -1,5 +1,4 @@
1/* arch/arm/mach-s3c2410/include/mach/nand.h 1/*
2 *
3 * Copyright (c) 2004 Simtec Electronics 2 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * 4 *
@@ -10,6 +9,9 @@
10 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
11*/ 10*/
12 11
12#ifndef __MTD_NAND_S3C2410_H
13#define __MTD_NAND_S3C2410_H
14
13/** 15/**
14 * struct s3c2410_nand_set - define a set of one or more nand chips 16 * struct s3c2410_nand_set - define a set of one or more nand chips
15 * @disable_ecc: Entirely disable ECC - Dangerous 17 * @disable_ecc: Entirely disable ECC - Dangerous
@@ -65,3 +67,5 @@ struct s3c2410_platform_nand {
65 * it with the s3c_device_nand. This allows @nand to be __initdata. 67 * it with the s3c_device_nand. This allows @nand to be __initdata.
66*/ 68*/
67extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand); 69extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand);
70
71#endif /*__MTD_NAND_S3C2410_H */
diff --git a/include/linux/platform_data/serial-imx.h b/include/linux/platform_data/serial-imx.h
index 4adec9b154dd..3cc2e3c40914 100644
--- a/include/linux/platform_data/serial-imx.h
+++ b/include/linux/platform_data/serial-imx.h
@@ -23,8 +23,6 @@
23#define IMXUART_IRDA (1<<1) 23#define IMXUART_IRDA (1<<1)
24 24
25struct imxuart_platform_data { 25struct imxuart_platform_data {
26 int (*init)(struct platform_device *pdev);
27 void (*exit)(struct platform_device *pdev);
28 unsigned int flags; 26 unsigned int flags;
29 void (*irda_enable)(int enable); 27 void (*irda_enable)(int enable);
30 unsigned int irda_inv_rx:1; 28 unsigned int irda_inv_rx:1;
diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h
index 8447f634c7f5..d3889b98a1a1 100644
--- a/include/linux/platform_data/spi-s3c64xx.h
+++ b/include/linux/platform_data/spi-s3c64xx.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h 1/*
2 *
3 * Copyright (C) 2009 Samsung Electronics Ltd. 2 * Copyright (C) 2009 Samsung Electronics Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com> 3 * Jaswinder Singh <jassi.brar@samsung.com>
5 * 4 *
@@ -8,8 +7,8 @@
8 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
9 */ 8 */
10 9
11#ifndef __S3C64XX_PLAT_SPI_H 10#ifndef __SPI_S3C64XX_H
12#define __S3C64XX_PLAT_SPI_H 11#define __SPI_S3C64XX_H
13 12
14#include <linux/dmaengine.h> 13#include <linux/dmaengine.h>
15 14
@@ -68,4 +67,4 @@ extern int s3c64xx_spi2_cfg_gpio(void);
68extern struct s3c64xx_spi_info s3c64xx_spi0_pdata; 67extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
69extern struct s3c64xx_spi_info s3c64xx_spi1_pdata; 68extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
70extern struct s3c64xx_spi_info s3c64xx_spi2_pdata; 69extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
71#endif /* __S3C64XX_PLAT_SPI_H */ 70#endif /*__SPI_S3C64XX_H */
diff --git a/include/linux/platform_data/touchscreen-s3c2410.h b/include/linux/platform_data/touchscreen-s3c2410.h
index 26fdb22e0fc2..58dc7c5ae63b 100644
--- a/include/linux/platform_data/touchscreen-s3c2410.h
+++ b/include/linux/platform_data/touchscreen-s3c2410.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-samsung/include/plat/ts.h 1/*
2 *
3 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org> 2 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -7,14 +6,14 @@
7 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
8*/ 7*/
9 8
10#ifndef __ASM_ARM_TS_H 9#ifndef __TOUCHSCREEN_S3C2410_H
11#define __ASM_ARM_TS_H 10#define __TOUCHSCREEN_S3C2410_H
12 11
13struct s3c2410_ts_mach_info { 12struct s3c2410_ts_mach_info {
14 int delay; 13 int delay;
15 int presc; 14 int presc;
16 int oversampling_shift; 15 int oversampling_shift;
17 void (*cfg_gpio)(struct platform_device *dev); 16 void (*cfg_gpio)(struct platform_device *dev);
18}; 17};
19 18
20extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *); 19extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
@@ -22,4 +21,4 @@ extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
22/* defined by architecture to configure gpio */ 21/* defined by architecture to configure gpio */
23extern void s3c24xx_ts_cfg_gpio(struct platform_device *dev); 22extern void s3c24xx_ts_cfg_gpio(struct platform_device *dev);
24 23
25#endif /* __ASM_ARM_TS_H */ 24#endif /*__TOUCHSCREEN_S3C2410_H */
diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
index 9de8f062ad5d..18e908324549 100644
--- a/include/linux/platform_data/video-imxfb.h
+++ b/include/linux/platform_data/video-imxfb.h
@@ -61,24 +61,12 @@ struct imx_fb_platform_data {
61 struct imx_fb_videomode *mode; 61 struct imx_fb_videomode *mode;
62 int num_modes; 62 int num_modes;
63 63
64 u_int cmap_greyscale:1,
65 cmap_inverse:1,
66 cmap_static:1,
67 unused:29;
68
69 u_int pwmr; 64 u_int pwmr;
70 u_int lscr1; 65 u_int lscr1;
71 u_int dmacr; 66 u_int dmacr;
72 67
73 u_char * fixed_screen_cpu;
74 dma_addr_t fixed_screen_dma;
75
76 int (*init)(struct platform_device *); 68 int (*init)(struct platform_device *);
77 void (*exit)(struct platform_device *); 69 void (*exit)(struct platform_device *);
78
79 void (*lcd_power)(int);
80 void (*backlight_power)(int);
81}; 70};
82 71
83void set_imx_fb_info(struct imx_fb_platform_data *);
84#endif /* ifndef __MACH_IMXFB_H__ */ 72#endif /* ifndef __MACH_IMXFB_H__ */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 8c6583a53a06..d915d0345fa1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -264,9 +264,9 @@ typedef struct pm_message {
264 * registers, so that it is fully operational. 264 * registers, so that it is fully operational.
265 * 265 *
266 * @runtime_idle: Device appears to be inactive and it might be put into a 266 * @runtime_idle: Device appears to be inactive and it might be put into a
267 * low-power state if all of the necessary conditions are satisfied. Check 267 * low-power state if all of the necessary conditions are satisfied.
268 * these conditions and handle the device as appropriate, possibly queueing 268 * Check these conditions, and return 0 if it's appropriate to let the PM
269 * a suspend request for it. The return value is ignored by the PM core. 269 * core queue a suspend request for the device.
270 * 270 *
271 * Refer to Documentation/power/runtime_pm.txt for more information about the 271 * Refer to Documentation/power/runtime_pm.txt for more information about the
272 * role of the above callbacks in device runtime power management. 272 * role of the above callbacks in device runtime power management.
@@ -352,7 +352,7 @@ const struct dev_pm_ops name = { \
352 352
353/* 353/*
354 * Use this for defining a set of PM operations to be used in all situations 354 * Use this for defining a set of PM operations to be used in all situations
355 * (sustem suspend, hibernation or runtime PM). 355 * (system suspend, hibernation or runtime PM).
356 * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should 356 * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should
357 * be different from the corresponding runtime PM callbacks, .runtime_suspend(), 357 * be different from the corresponding runtime PM callbacks, .runtime_suspend(),
358 * and .runtime_resume(), because .runtime_suspend() always works on an already 358 * and .runtime_resume(), because .runtime_suspend() always works on an already
@@ -379,7 +379,7 @@ const struct dev_pm_ops name = { \
379 * 379 *
380 * ON No transition. 380 * ON No transition.
381 * 381 *
382 * FREEZE System is going to hibernate, call ->prepare() and ->freeze() 382 * FREEZE System is going to hibernate, call ->prepare() and ->freeze()
383 * for all devices. 383 * for all devices.
384 * 384 *
385 * SUSPEND System is going to suspend, call ->prepare() and ->suspend() 385 * SUSPEND System is going to suspend, call ->prepare() and ->suspend()
@@ -423,7 +423,7 @@ const struct dev_pm_ops name = { \
423 423
424#define PM_EVENT_INVALID (-1) 424#define PM_EVENT_INVALID (-1)
425#define PM_EVENT_ON 0x0000 425#define PM_EVENT_ON 0x0000
426#define PM_EVENT_FREEZE 0x0001 426#define PM_EVENT_FREEZE 0x0001
427#define PM_EVENT_SUSPEND 0x0002 427#define PM_EVENT_SUSPEND 0x0002
428#define PM_EVENT_HIBERNATE 0x0004 428#define PM_EVENT_HIBERNATE 0x0004
429#define PM_EVENT_QUIESCE 0x0008 429#define PM_EVENT_QUIESCE 0x0008
@@ -542,6 +542,8 @@ struct dev_pm_info {
542 unsigned int async_suspend:1; 542 unsigned int async_suspend:1;
543 bool is_prepared:1; /* Owned by the PM core */ 543 bool is_prepared:1; /* Owned by the PM core */
544 bool is_suspended:1; /* Ditto */ 544 bool is_suspended:1; /* Ditto */
545 bool is_noirq_suspended:1;
546 bool is_late_suspended:1;
545 bool ignore_children:1; 547 bool ignore_children:1;
546 bool early_init:1; /* Owned by the PM core */ 548 bool early_init:1; /* Owned by the PM core */
547 spinlock_t lock; 549 spinlock_t lock;
@@ -582,6 +584,7 @@ struct dev_pm_info {
582 unsigned long accounting_timestamp; 584 unsigned long accounting_timestamp;
583#endif 585#endif
584 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 586 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
587 void (*set_latency_tolerance)(struct device *, s32);
585 struct dev_pm_qos *qos; 588 struct dev_pm_qos *qos;
586}; 589};
587 590
@@ -612,11 +615,11 @@ struct dev_pm_domain {
612 * message is implicit: 615 * message is implicit:
613 * 616 *
614 * ON Driver starts working again, responding to hardware events 617 * ON Driver starts working again, responding to hardware events
615 * and software requests. The hardware may have gone through 618 * and software requests. The hardware may have gone through
616 * a power-off reset, or it may have maintained state from the 619 * a power-off reset, or it may have maintained state from the
617 * previous suspend() which the driver will rely on while 620 * previous suspend() which the driver will rely on while
618 * resuming. On most platforms, there are no restrictions on 621 * resuming. On most platforms, there are no restrictions on
619 * availability of resources like clocks during resume(). 622 * availability of resources like clocks during resume().
620 * 623 *
621 * Other transitions are triggered by messages sent using suspend(). All 624 * Other transitions are triggered by messages sent using suspend(). All
622 * these transitions quiesce the driver, so that I/O queues are inactive. 625 * these transitions quiesce the driver, so that I/O queues are inactive.
@@ -626,21 +629,21 @@ struct dev_pm_domain {
626 * differ according to the message: 629 * differ according to the message:
627 * 630 *
628 * SUSPEND Quiesce, enter a low power device state appropriate for 631 * SUSPEND Quiesce, enter a low power device state appropriate for
629 * the upcoming system state (such as PCI_D3hot), and enable 632 * the upcoming system state (such as PCI_D3hot), and enable
630 * wakeup events as appropriate. 633 * wakeup events as appropriate.
631 * 634 *
632 * HIBERNATE Enter a low power device state appropriate for the hibernation 635 * HIBERNATE Enter a low power device state appropriate for the hibernation
633 * state (eg. ACPI S4) and enable wakeup events as appropriate. 636 * state (eg. ACPI S4) and enable wakeup events as appropriate.
634 * 637 *
635 * FREEZE Quiesce operations so that a consistent image can be saved; 638 * FREEZE Quiesce operations so that a consistent image can be saved;
636 * but do NOT otherwise enter a low power device state, and do 639 * but do NOT otherwise enter a low power device state, and do
637 * NOT emit system wakeup events. 640 * NOT emit system wakeup events.
638 * 641 *
639 * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring 642 * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring
640 * the system from a snapshot taken after an earlier FREEZE. 643 * the system from a snapshot taken after an earlier FREEZE.
641 * Some drivers will need to reset their hardware state instead 644 * Some drivers will need to reset their hardware state instead
642 * of preserving it, to ensure that it's never mistaken for the 645 * of preserving it, to ensure that it's never mistaken for the
643 * state which that earlier snapshot had set up. 646 * state which that earlier snapshot had set up.
644 * 647 *
645 * A minimally power-aware driver treats all messages as SUSPEND, fully 648 * A minimally power-aware driver treats all messages as SUSPEND, fully
646 * reinitializes its device during resume() -- whether or not it was reset 649 * reinitializes its device during resume() -- whether or not it was reset
@@ -717,14 +720,26 @@ static inline void dpm_for_each_dev(void *data, void (*fn)(struct device *, void
717{ 720{
718} 721}
719 722
720#define pm_generic_prepare NULL 723#define pm_generic_prepare NULL
721#define pm_generic_suspend NULL 724#define pm_generic_suspend_late NULL
722#define pm_generic_resume NULL 725#define pm_generic_suspend_noirq NULL
723#define pm_generic_freeze NULL 726#define pm_generic_suspend NULL
724#define pm_generic_thaw NULL 727#define pm_generic_resume_early NULL
725#define pm_generic_restore NULL 728#define pm_generic_resume_noirq NULL
726#define pm_generic_poweroff NULL 729#define pm_generic_resume NULL
727#define pm_generic_complete NULL 730#define pm_generic_freeze_noirq NULL
731#define pm_generic_freeze_late NULL
732#define pm_generic_freeze NULL
733#define pm_generic_thaw_noirq NULL
734#define pm_generic_thaw_early NULL
735#define pm_generic_thaw NULL
736#define pm_generic_restore_noirq NULL
737#define pm_generic_restore_early NULL
738#define pm_generic_restore NULL
739#define pm_generic_poweroff_noirq NULL
740#define pm_generic_poweroff_late NULL
741#define pm_generic_poweroff NULL
742#define pm_generic_complete NULL
728#endif /* !CONFIG_PM_SLEEP */ 743#endif /* !CONFIG_PM_SLEEP */
729 744
730/* How to reorder dpm_list after device_move() */ 745/* How to reorder dpm_list after device_move() */
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 5a95013905c8..9ab4bf7c4646 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -32,7 +32,10 @@ enum pm_qos_flags_status {
32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
35#define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 35#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0
36#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0
37#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1)
38#define PM_QOS_LATENCY_ANY ((s32)(~(__u32)0 >> 1))
36 39
37#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) 40#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
38#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) 41#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1)
@@ -49,7 +52,8 @@ struct pm_qos_flags_request {
49}; 52};
50 53
51enum dev_pm_qos_req_type { 54enum dev_pm_qos_req_type {
52 DEV_PM_QOS_LATENCY = 1, 55 DEV_PM_QOS_RESUME_LATENCY = 1,
56 DEV_PM_QOS_LATENCY_TOLERANCE,
53 DEV_PM_QOS_FLAGS, 57 DEV_PM_QOS_FLAGS,
54}; 58};
55 59
@@ -77,6 +81,7 @@ struct pm_qos_constraints {
77 struct plist_head list; 81 struct plist_head list;
78 s32 target_value; /* Do not change to 64 bit */ 82 s32 target_value; /* Do not change to 64 bit */
79 s32 default_value; 83 s32 default_value;
84 s32 no_constraint_value;
80 enum pm_qos_type type; 85 enum pm_qos_type type;
81 struct blocking_notifier_head *notifiers; 86 struct blocking_notifier_head *notifiers;
82}; 87};
@@ -87,9 +92,11 @@ struct pm_qos_flags {
87}; 92};
88 93
89struct dev_pm_qos { 94struct dev_pm_qos {
90 struct pm_qos_constraints latency; 95 struct pm_qos_constraints resume_latency;
96 struct pm_qos_constraints latency_tolerance;
91 struct pm_qos_flags flags; 97 struct pm_qos_flags flags;
92 struct dev_pm_qos_request *latency_req; 98 struct dev_pm_qos_request *resume_latency_req;
99 struct dev_pm_qos_request *latency_tolerance_req;
93 struct dev_pm_qos_request *flags_req; 100 struct dev_pm_qos_request *flags_req;
94}; 101};
95 102
@@ -142,7 +149,8 @@ int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier);
142void dev_pm_qos_constraints_init(struct device *dev); 149void dev_pm_qos_constraints_init(struct device *dev);
143void dev_pm_qos_constraints_destroy(struct device *dev); 150void dev_pm_qos_constraints_destroy(struct device *dev);
144int dev_pm_qos_add_ancestor_request(struct device *dev, 151int dev_pm_qos_add_ancestor_request(struct device *dev,
145 struct dev_pm_qos_request *req, s32 value); 152 struct dev_pm_qos_request *req,
153 enum dev_pm_qos_req_type type, s32 value);
146#else 154#else
147static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, 155static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
148 s32 mask) 156 s32 mask)
@@ -185,7 +193,9 @@ static inline void dev_pm_qos_constraints_destroy(struct device *dev)
185 dev->power.power_state = PMSG_INVALID; 193 dev->power.power_state = PMSG_INVALID;
186} 194}
187static inline int dev_pm_qos_add_ancestor_request(struct device *dev, 195static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
188 struct dev_pm_qos_request *req, s32 value) 196 struct dev_pm_qos_request *req,
197 enum dev_pm_qos_req_type type,
198 s32 value)
189 { return 0; } 199 { return 0; }
190#endif 200#endif
191 201
@@ -195,10 +205,12 @@ void dev_pm_qos_hide_latency_limit(struct device *dev);
195int dev_pm_qos_expose_flags(struct device *dev, s32 value); 205int dev_pm_qos_expose_flags(struct device *dev, s32 value);
196void dev_pm_qos_hide_flags(struct device *dev); 206void dev_pm_qos_hide_flags(struct device *dev);
197int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set); 207int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
208s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev);
209int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val);
198 210
199static inline s32 dev_pm_qos_requested_latency(struct device *dev) 211static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
200{ 212{
201 return dev->power.qos->latency_req->data.pnode.prio; 213 return dev->power.qos->resume_latency_req->data.pnode.prio;
202} 214}
203 215
204static inline s32 dev_pm_qos_requested_flags(struct device *dev) 216static inline s32 dev_pm_qos_requested_flags(struct device *dev)
@@ -214,8 +226,12 @@ static inline int dev_pm_qos_expose_flags(struct device *dev, s32 value)
214static inline void dev_pm_qos_hide_flags(struct device *dev) {} 226static inline void dev_pm_qos_hide_flags(struct device *dev) {}
215static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set) 227static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set)
216 { return 0; } 228 { return 0; }
229static inline s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev)
230 { return PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; }
231static inline int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val)
232 { return 0; }
217 233
218static inline s32 dev_pm_qos_requested_latency(struct device *dev) { return 0; } 234static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) { return 0; }
219static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } 235static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; }
220#endif 236#endif
221 237
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 16c9a62fa1c0..2a5897a4afbc 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -26,9 +26,13 @@
26#ifdef CONFIG_PM 26#ifdef CONFIG_PM
27extern int pm_generic_runtime_suspend(struct device *dev); 27extern int pm_generic_runtime_suspend(struct device *dev);
28extern int pm_generic_runtime_resume(struct device *dev); 28extern int pm_generic_runtime_resume(struct device *dev);
29extern int pm_runtime_force_suspend(struct device *dev);
30extern int pm_runtime_force_resume(struct device *dev);
29#else 31#else
30static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 32static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
31static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 33static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
34static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
35static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
32#endif 36#endif
33 37
34#ifdef CONFIG_PM_RUNTIME 38#ifdef CONFIG_PM_RUNTIME
diff --git a/include/linux/printk.h b/include/linux/printk.h
index fa47e2708c01..8752f7595b27 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -24,13 +24,9 @@ static inline int printk_get_level(const char *buffer)
24 24
25static inline const char *printk_skip_level(const char *buffer) 25static inline const char *printk_skip_level(const char *buffer)
26{ 26{
27 if (printk_get_level(buffer)) { 27 if (printk_get_level(buffer))
28 switch (buffer[1]) { 28 return buffer + 2;
29 case '0' ... '7': 29
30 case 'd': /* KERN_DEFAULT */
31 return buffer + 2;
32 }
33 }
34 return buffer; 30 return buffer;
35} 31}
36 32
@@ -124,9 +120,9 @@ asmlinkage __printf(1, 0)
124int vprintk(const char *fmt, va_list args); 120int vprintk(const char *fmt, va_list args);
125 121
126asmlinkage __printf(5, 6) __cold 122asmlinkage __printf(5, 6) __cold
127asmlinkage int printk_emit(int facility, int level, 123int printk_emit(int facility, int level,
128 const char *dict, size_t dictlen, 124 const char *dict, size_t dictlen,
129 const char *fmt, ...); 125 const char *fmt, ...);
130 126
131asmlinkage __printf(1, 2) __cold 127asmlinkage __printf(1, 2) __cold
132int printk(const char *fmt, ...); 128int printk(const char *fmt, ...);
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
index 1dc420ba213a..7dfed71d76a6 100644
--- a/include/linux/ptp_classify.h
+++ b/include/linux/ptp_classify.h
@@ -23,15 +23,8 @@
23#ifndef _PTP_CLASSIFY_H_ 23#ifndef _PTP_CLASSIFY_H_
24#define _PTP_CLASSIFY_H_ 24#define _PTP_CLASSIFY_H_
25 25
26#include <linux/if_ether.h>
27#include <linux/if_vlan.h>
28#include <linux/ip.h> 26#include <linux/ip.h>
29#include <linux/filter.h> 27#include <linux/skbuff.h>
30#ifdef __KERNEL__
31#include <linux/in.h>
32#else
33#include <netinet/in.h>
34#endif
35 28
36#define PTP_CLASS_NONE 0x00 /* not a PTP event message */ 29#define PTP_CLASS_NONE 0x00 /* not a PTP event message */
37#define PTP_CLASS_V1 0x01 /* protocol version 1 */ 30#define PTP_CLASS_V1 0x01 /* protocol version 1 */
@@ -44,7 +37,7 @@
44#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */ 37#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */
45 38
46#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) 39#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4)
47#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /*probably DNE*/ 40#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /* probably DNE */
48#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4) 41#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4)
49#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6) 42#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6)
50#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2) 43#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2)
@@ -53,88 +46,34 @@
53#define PTP_EV_PORT 319 46#define PTP_EV_PORT 319
54#define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */ 47#define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */
55 48
56#define OFF_ETYPE 12
57#define OFF_IHL 14
58#define OFF_FRAG 20
59#define OFF_PROTO4 23
60#define OFF_NEXT 6
61#define OFF_UDP_DST 2
62
63#define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */ 49#define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */
64#define OFF_PTP_SEQUENCE_ID 30 50#define OFF_PTP_SEQUENCE_ID 30
65#define OFF_PTP_CONTROL 32 /* PTPv1 only */ 51#define OFF_PTP_CONTROL 32 /* PTPv1 only */
66 52
67#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) 53/* Below defines should actually be removed at some point in time. */
68
69#define IP6_HLEN 40 54#define IP6_HLEN 40
70#define UDP_HLEN 8 55#define UDP_HLEN 8
71 56#define OFF_IHL 14
72#define RELOFF_DST4 (ETH_HLEN + OFF_UDP_DST)
73#define OFF_DST6 (ETH_HLEN + IP6_HLEN + OFF_UDP_DST)
74#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN) 57#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN)
58#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2)
75 59
76#define OP_AND (BPF_ALU | BPF_AND | BPF_K) 60#if defined(CONFIG_NET_PTP_CLASSIFY)
77#define OP_JEQ (BPF_JMP | BPF_JEQ | BPF_K) 61/**
78#define OP_JSET (BPF_JMP | BPF_JSET | BPF_K) 62 * ptp_classify_raw - classify a PTP packet
79#define OP_LDB (BPF_LD | BPF_B | BPF_ABS) 63 * @skb: buffer
80#define OP_LDH (BPF_LD | BPF_H | BPF_ABS) 64 *
81#define OP_LDHI (BPF_LD | BPF_H | BPF_IND) 65 * Runs a minimal BPF dissector to classify a network packet to
82#define OP_LDX (BPF_LDX | BPF_B | BPF_MSH) 66 * determine the PTP class. In case the skb does not contain any
83#define OP_OR (BPF_ALU | BPF_OR | BPF_K) 67 * PTP protocol data, PTP_CLASS_NONE will be returned, otherwise
84#define OP_RETA (BPF_RET | BPF_A) 68 * PTP_CLASS_V1_IPV{4,6}, PTP_CLASS_V2_IPV{4,6} or
85#define OP_RETK (BPF_RET | BPF_K) 69 * PTP_CLASS_V2_{L2,VLAN}, depending on the packet content.
70 */
71unsigned int ptp_classify_raw(const struct sk_buff *skb);
86 72
87static inline int ptp_filter_init(struct sock_filter *f, int len) 73void __init ptp_classifier_init(void);
74#else
75static inline void ptp_classifier_init(void)
88{ 76{
89 if (OP_LDH == f[0].code)
90 return sk_chk_filter(f, len);
91 else
92 return 0;
93} 77}
94
95#define PTP_FILTER \
96 {OP_LDH, 0, 0, OFF_ETYPE }, /* */ \
97 {OP_JEQ, 0, 12, ETH_P_IP }, /* f goto L20 */ \
98 {OP_LDB, 0, 0, OFF_PROTO4 }, /* */ \
99 {OP_JEQ, 0, 9, IPPROTO_UDP }, /* f goto L10 */ \
100 {OP_LDH, 0, 0, OFF_FRAG }, /* */ \
101 {OP_JSET, 7, 0, 0x1fff }, /* t goto L11 */ \
102 {OP_LDX, 0, 0, OFF_IHL }, /* */ \
103 {OP_LDHI, 0, 0, RELOFF_DST4 }, /* */ \
104 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L12 */ \
105 {OP_LDHI, 0, 0, ETH_HLEN + UDP_HLEN }, /* */ \
106 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
107 {OP_OR, 0, 0, PTP_CLASS_IPV4 }, /* */ \
108 {OP_RETA, 0, 0, 0 }, /* */ \
109/*L1x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
110/*L20*/ {OP_JEQ, 0, 9, ETH_P_IPV6 }, /* f goto L40 */ \
111 {OP_LDB, 0, 0, ETH_HLEN + OFF_NEXT }, /* */ \
112 {OP_JEQ, 0, 6, IPPROTO_UDP }, /* f goto L30 */ \
113 {OP_LDH, 0, 0, OFF_DST6 }, /* */ \
114 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L31 */ \
115 {OP_LDH, 0, 0, OFF_PTP6 }, /* */ \
116 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
117 {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \
118 {OP_RETA, 0, 0, 0 }, /* */ \
119/*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
120/*L40*/ {OP_JEQ, 0, 9, ETH_P_8021Q }, /* f goto L50 */ \
121 {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \
122 {OP_JEQ, 0, 15, ETH_P_1588 }, /* f goto L60 */ \
123 {OP_LDB, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
124 {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \
125 {OP_JEQ, 0, 12, 0 }, /* f goto L6x */ \
126 {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
127 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
128 {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \
129 {OP_RETA, 0, 0, 0 }, /* */ \
130/*L50*/ {OP_JEQ, 0, 7, ETH_P_1588 }, /* f goto L61 */ \
131 {OP_LDB, 0, 0, ETH_HLEN }, /* */ \
132 {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \
133 {OP_JEQ, 0, 4, 0 }, /* f goto L6x */ \
134 {OP_LDH, 0, 0, ETH_HLEN }, /* */ \
135 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
136 {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \
137 {OP_RETA, 0, 0, 0 }, /* */ \
138/*L6x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE },
139
140#endif 78#endif
79#endif /* _PTP_CLASSIFY_H_ */
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 38a993508327..0d8ff3fb84ba 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -49,7 +49,11 @@ struct ptp_clock_request {
49 * @n_alarm: The number of programmable alarms. 49 * @n_alarm: The number of programmable alarms.
50 * @n_ext_ts: The number of external time stamp channels. 50 * @n_ext_ts: The number of external time stamp channels.
51 * @n_per_out: The number of programmable periodic signals. 51 * @n_per_out: The number of programmable periodic signals.
52 * @n_pins: The number of programmable pins.
52 * @pps: Indicates whether the clock supports a PPS callback. 53 * @pps: Indicates whether the clock supports a PPS callback.
54 * @pin_config: Array of length 'n_pins'. If the number of
55 * programmable pins is nonzero, then drivers must
56 * allocate and initialize this array.
53 * 57 *
54 * clock operations 58 * clock operations
55 * 59 *
@@ -70,6 +74,18 @@ struct ptp_clock_request {
70 * parameter request: Desired resource to enable or disable. 74 * parameter request: Desired resource to enable or disable.
71 * parameter on: Caller passes one to enable or zero to disable. 75 * parameter on: Caller passes one to enable or zero to disable.
72 * 76 *
77 * @verify: Confirm that a pin can perform a given function. The PTP
78 * Hardware Clock subsystem maintains the 'pin_config'
79 * array on behalf of the drivers, but the PHC subsystem
80 * assumes that every pin can perform every function. This
81 * hook gives drivers a way of telling the core about
82 * limitations on specific pins. This function must return
83 * zero if the function can be assigned to this pin, and
84 * nonzero otherwise.
85 * parameter pin: index of the pin in question.
86 * parameter func: the desired function to use.
87 * parameter chan: the function channel index to use.
88 *
73 * Drivers should embed their ptp_clock_info within a private 89 * Drivers should embed their ptp_clock_info within a private
74 * structure, obtaining a reference to it using container_of(). 90 * structure, obtaining a reference to it using container_of().
75 * 91 *
@@ -83,13 +99,17 @@ struct ptp_clock_info {
83 int n_alarm; 99 int n_alarm;
84 int n_ext_ts; 100 int n_ext_ts;
85 int n_per_out; 101 int n_per_out;
102 int n_pins;
86 int pps; 103 int pps;
104 struct ptp_pin_desc *pin_config;
87 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); 105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
88 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); 106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
89 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts); 107 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts);
90 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts); 108 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts);
91 int (*enable)(struct ptp_clock_info *ptp, 109 int (*enable)(struct ptp_clock_info *ptp,
92 struct ptp_clock_request *request, int on); 110 struct ptp_clock_request *request, int on);
111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin,
112 enum ptp_pin_function func, unsigned int chan);
93}; 113};
94 114
95struct ptp_clock; 115struct ptp_clock;
@@ -156,4 +176,17 @@ extern void ptp_clock_event(struct ptp_clock *ptp,
156 176
157extern int ptp_clock_index(struct ptp_clock *ptp); 177extern int ptp_clock_index(struct ptp_clock *ptp);
158 178
179/**
180 * ptp_find_pin() - obtain the pin index of a given auxiliary function
181 *
182 * @ptp: The clock obtained from ptp_clock_register().
183 * @func: One of the ptp_pin_function enumerated values.
184 * @chan: The particular functional channel to find.
185 * Return: Pin index in the range of zero to ptp_clock_caps.n_pins - 1,
186 * or -1 if the auxiliary function cannot be found.
187 */
188
189int ptp_find_pin(struct ptp_clock *ptp,
190 enum ptp_pin_function func, unsigned int chan);
191
159#endif 192#endif
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index f0feafd184a0..4717f54051cb 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -7,7 +7,7 @@
7struct pwm_device; 7struct pwm_device;
8struct seq_file; 8struct seq_file;
9 9
10#if IS_ENABLED(CONFIG_PWM) || IS_ENABLED(CONFIG_HAVE_PWM) 10#if IS_ENABLED(CONFIG_PWM)
11/* 11/*
12 * pwm_request - request a PWM device 12 * pwm_request - request a PWM device
13 */ 13 */
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 49444203328a..f2b405116166 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -219,7 +219,7 @@ static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
219 return __raw_readl(dev->mmio_base + reg); 219 return __raw_readl(dev->mmio_base + reg);
220} 220}
221 221
222#ifdef CONFIG_ARCH_PXA 222#if IS_ENABLED(CONFIG_PXA_SSP)
223struct ssp_device *pxa_ssp_request(int port, const char *label); 223struct ssp_device *pxa_ssp_request(int port, const char *label);
224void pxa_ssp_free(struct ssp_device *); 224void pxa_ssp_free(struct ssp_device *);
225struct ssp_device *pxa_ssp_request_of(const struct device_node *of_node, 225struct ssp_device *pxa_ssp_request_of(const struct device_node *of_node,
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 6965fe394c3b..1d3eee594cd6 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -46,6 +46,14 @@ void inode_reclaim_rsv_space(struct inode *inode, qsize_t number);
46void dquot_initialize(struct inode *inode); 46void dquot_initialize(struct inode *inode);
47void dquot_drop(struct inode *inode); 47void dquot_drop(struct inode *inode);
48struct dquot *dqget(struct super_block *sb, struct kqid qid); 48struct dquot *dqget(struct super_block *sb, struct kqid qid);
49static inline struct dquot *dqgrab(struct dquot *dquot)
50{
51 /* Make sure someone else has active reference to dquot */
52 WARN_ON_ONCE(!atomic_read(&dquot->dq_count));
53 WARN_ON_ONCE(!test_bit(DQ_ACTIVE_B, &dquot->dq_flags));
54 atomic_inc(&dquot->dq_count);
55 return dquot;
56}
49void dqput(struct dquot *dquot); 57void dqput(struct dquot *dquot);
50int dquot_scan_active(struct super_block *sb, 58int dquot_scan_active(struct super_block *sb,
51 int (*fn)(struct dquot *dquot, unsigned long priv), 59 int (*fn)(struct dquot *dquot, unsigned long priv),
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 403940787be1..33170dbd9db4 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -60,6 +60,49 @@ static inline int radix_tree_is_indirect_ptr(void *ptr)
60 60
61#define RADIX_TREE_MAX_TAGS 3 61#define RADIX_TREE_MAX_TAGS 3
62 62
63#ifdef __KERNEL__
64#define RADIX_TREE_MAP_SHIFT (CONFIG_BASE_SMALL ? 4 : 6)
65#else
66#define RADIX_TREE_MAP_SHIFT 3 /* For more stressful testing */
67#endif
68
69#define RADIX_TREE_MAP_SIZE (1UL << RADIX_TREE_MAP_SHIFT)
70#define RADIX_TREE_MAP_MASK (RADIX_TREE_MAP_SIZE-1)
71
72#define RADIX_TREE_TAG_LONGS \
73 ((RADIX_TREE_MAP_SIZE + BITS_PER_LONG - 1) / BITS_PER_LONG)
74
75#define RADIX_TREE_INDEX_BITS (8 /* CHAR_BIT */ * sizeof(unsigned long))
76#define RADIX_TREE_MAX_PATH (DIV_ROUND_UP(RADIX_TREE_INDEX_BITS, \
77 RADIX_TREE_MAP_SHIFT))
78
79/* Height component in node->path */
80#define RADIX_TREE_HEIGHT_SHIFT (RADIX_TREE_MAX_PATH + 1)
81#define RADIX_TREE_HEIGHT_MASK ((1UL << RADIX_TREE_HEIGHT_SHIFT) - 1)
82
83/* Internally used bits of node->count */
84#define RADIX_TREE_COUNT_SHIFT (RADIX_TREE_MAP_SHIFT + 1)
85#define RADIX_TREE_COUNT_MASK ((1UL << RADIX_TREE_COUNT_SHIFT) - 1)
86
87struct radix_tree_node {
88 unsigned int path; /* Offset in parent & height from the bottom */
89 unsigned int count;
90 union {
91 struct {
92 /* Used when ascending tree */
93 struct radix_tree_node *parent;
94 /* For tree user */
95 void *private_data;
96 };
97 /* Used when freeing node */
98 struct rcu_head rcu_head;
99 };
100 /* For tree user */
101 struct list_head private_list;
102 void __rcu *slots[RADIX_TREE_MAP_SIZE];
103 unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS];
104};
105
63/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */ 106/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */
64struct radix_tree_root { 107struct radix_tree_root {
65 unsigned int height; 108 unsigned int height;
@@ -101,6 +144,7 @@ do { \
101 * concurrently with other readers. 144 * concurrently with other readers.
102 * 145 *
103 * The notable exceptions to this rule are the following functions: 146 * The notable exceptions to this rule are the following functions:
147 * __radix_tree_lookup
104 * radix_tree_lookup 148 * radix_tree_lookup
105 * radix_tree_lookup_slot 149 * radix_tree_lookup_slot
106 * radix_tree_tag_get 150 * radix_tree_tag_get
@@ -216,9 +260,16 @@ static inline void radix_tree_replace_slot(void **pslot, void *item)
216 rcu_assign_pointer(*pslot, item); 260 rcu_assign_pointer(*pslot, item);
217} 261}
218 262
263int __radix_tree_create(struct radix_tree_root *root, unsigned long index,
264 struct radix_tree_node **nodep, void ***slotp);
219int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); 265int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
266void *__radix_tree_lookup(struct radix_tree_root *root, unsigned long index,
267 struct radix_tree_node **nodep, void ***slotp);
220void *radix_tree_lookup(struct radix_tree_root *, unsigned long); 268void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
221void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); 269void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
270bool __radix_tree_delete_node(struct radix_tree_root *root,
271 struct radix_tree_node *node);
272void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *);
222void *radix_tree_delete(struct radix_tree_root *, unsigned long); 273void *radix_tree_delete(struct radix_tree_root *, unsigned long);
223unsigned int 274unsigned int
224radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 275radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
@@ -226,10 +277,6 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
226unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root, 277unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root,
227 void ***results, unsigned long *indices, 278 void ***results, unsigned long *indices,
228 unsigned long first_index, unsigned int max_items); 279 unsigned long first_index, unsigned int max_items);
229unsigned long radix_tree_next_hole(struct radix_tree_root *root,
230 unsigned long index, unsigned long max_scan);
231unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
232 unsigned long index, unsigned long max_scan);
233int radix_tree_preload(gfp_t gfp_mask); 280int radix_tree_preload(gfp_t gfp_mask);
234int radix_tree_maybe_preload(gfp_t gfp_mask); 281int radix_tree_maybe_preload(gfp_t gfp_mask);
235void radix_tree_init(void); 282void radix_tree_init(void);
diff --git a/include/linux/random.h b/include/linux/random.h
index 1cfce0e24dbd..57fbbffd77a0 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -88,6 +88,22 @@ static inline int arch_get_random_int(unsigned int *v)
88{ 88{
89 return 0; 89 return 0;
90} 90}
91static inline int arch_has_random(void)
92{
93 return 0;
94}
95static inline int arch_get_random_seed_long(unsigned long *v)
96{
97 return 0;
98}
99static inline int arch_get_random_seed_int(unsigned int *v)
100{
101 return 0;
102}
103static inline int arch_has_random_seed(void)
104{
105 return 0;
106}
91#endif 107#endif
92 108
93/* Pseudo random number generator from numerical recipes. */ 109/* Pseudo random number generator from numerical recipes. */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4149f1a9b003..85691b9b4fa7 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -164,6 +164,9 @@ typedef void (*regmap_unlock)(void *);
164 * @use_single_rw: If set, converts the bulk read and write operations into 164 * @use_single_rw: If set, converts the bulk read and write operations into
165 * a series of single read and write operations. This is useful 165 * a series of single read and write operations. This is useful
166 * for device that does not support bulk read and write. 166 * for device that does not support bulk read and write.
167 * @can_multi_write: If set, the device supports the multi write mode of bulk
168 * write operations, if clear multi write requests will be
169 * split into individual write operations
167 * 170 *
168 * @cache_type: The actual cache type. 171 * @cache_type: The actual cache type.
169 * @reg_defaults_raw: Power on reset values for registers (for use with 172 * @reg_defaults_raw: Power on reset values for registers (for use with
@@ -215,6 +218,7 @@ struct regmap_config {
215 u8 write_flag_mask; 218 u8 write_flag_mask;
216 219
217 bool use_single_rw; 220 bool use_single_rw;
221 bool can_multi_write;
218 222
219 enum regmap_endian reg_format_endian; 223 enum regmap_endian reg_format_endian;
220 enum regmap_endian val_format_endian; 224 enum regmap_endian val_format_endian;
@@ -317,12 +321,16 @@ struct regmap *regmap_init(struct device *dev,
317 const struct regmap_bus *bus, 321 const struct regmap_bus *bus,
318 void *bus_context, 322 void *bus_context,
319 const struct regmap_config *config); 323 const struct regmap_config *config);
324int regmap_attach_dev(struct device *dev, struct regmap *map,
325 const struct regmap_config *config);
320struct regmap *regmap_init_i2c(struct i2c_client *i2c, 326struct regmap *regmap_init_i2c(struct i2c_client *i2c,
321 const struct regmap_config *config); 327 const struct regmap_config *config);
322struct regmap *regmap_init_spi(struct spi_device *dev, 328struct regmap *regmap_init_spi(struct spi_device *dev,
323 const struct regmap_config *config); 329 const struct regmap_config *config);
324struct regmap *regmap_init_spmi(struct spmi_device *dev, 330struct regmap *regmap_init_spmi_base(struct spmi_device *dev,
325 const struct regmap_config *config); 331 const struct regmap_config *config);
332struct regmap *regmap_init_spmi_ext(struct spmi_device *dev,
333 const struct regmap_config *config);
326struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, 334struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
327 void __iomem *regs, 335 void __iomem *regs,
328 const struct regmap_config *config); 336 const struct regmap_config *config);
@@ -335,8 +343,10 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
335 const struct regmap_config *config); 343 const struct regmap_config *config);
336struct regmap *devm_regmap_init_spi(struct spi_device *dev, 344struct regmap *devm_regmap_init_spi(struct spi_device *dev,
337 const struct regmap_config *config); 345 const struct regmap_config *config);
338struct regmap *devm_regmap_init_spmi(struct spmi_device *dev, 346struct regmap *devm_regmap_init_spmi_base(struct spmi_device *dev,
339 const struct regmap_config *config); 347 const struct regmap_config *config);
348struct regmap *devm_regmap_init_spmi_ext(struct spmi_device *dev,
349 const struct regmap_config *config);
340struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, 350struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
341 void __iomem *regs, 351 void __iomem *regs,
342 const struct regmap_config *config); 352 const struct regmap_config *config);
@@ -386,8 +396,11 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
386 const void *val, size_t val_len); 396 const void *val, size_t val_len);
387int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, 397int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
388 size_t val_count); 398 size_t val_count);
389int regmap_multi_reg_write(struct regmap *map, struct reg_default *regs, 399int regmap_multi_reg_write(struct regmap *map, const struct reg_default *regs,
390 int num_regs); 400 int num_regs);
401int regmap_multi_reg_write_bypassed(struct regmap *map,
402 const struct reg_default *regs,
403 int num_regs);
391int regmap_raw_write_async(struct regmap *map, unsigned int reg, 404int regmap_raw_write_async(struct regmap *map, unsigned int reg,
392 const void *val, size_t val_len); 405 const void *val, size_t val_len);
393int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 406int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
@@ -423,6 +436,8 @@ bool regmap_check_range_table(struct regmap *map, unsigned int reg,
423 436
424int regmap_register_patch(struct regmap *map, const struct reg_default *regs, 437int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
425 int num_regs); 438 int num_regs);
439int regmap_parse_val(struct regmap *map, const void *buf,
440 unsigned int *val);
426 441
427static inline bool regmap_reg_in_range(unsigned int reg, 442static inline bool regmap_reg_in_range(unsigned int reg,
428 const struct regmap_range *range) 443 const struct regmap_range *range)
@@ -695,6 +710,13 @@ static inline int regmap_register_patch(struct regmap *map,
695 return -EINVAL; 710 return -EINVAL;
696} 711}
697 712
713static inline int regmap_parse_val(struct regmap *map, const void *buf,
714 unsigned int *val)
715{
716 WARN_ONCE(1, "regmap API is disabled");
717 return -EINVAL;
718}
719
698static inline struct regmap *dev_get_regmap(struct device *dev, 720static inline struct regmap *dev_get_regmap(struct device *dev,
699 const char *name) 721 const char *name)
700{ 722{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 9370e65348a4..bbe03a1924c0 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -228,10 +228,14 @@ enum regulator_type {
228 * output when using regulator_set_voltage_sel_regmap 228 * output when using regulator_set_voltage_sel_regmap
229 * @enable_reg: Register for control when using regmap enable/disable ops 229 * @enable_reg: Register for control when using regmap enable/disable ops
230 * @enable_mask: Mask for control when using regmap enable/disable ops 230 * @enable_mask: Mask for control when using regmap enable/disable ops
231 * @enable_val: Enabling value for control when using regmap enable/disable ops
232 * @disable_val: Disabling value for control when using regmap enable/disable ops
231 * @enable_is_inverted: A flag to indicate set enable_mask bits to disable 233 * @enable_is_inverted: A flag to indicate set enable_mask bits to disable
232 * when using regulator_enable_regmap and friends APIs. 234 * when using regulator_enable_regmap and friends APIs.
233 * @bypass_reg: Register for control when using regmap set_bypass 235 * @bypass_reg: Register for control when using regmap set_bypass
234 * @bypass_mask: Mask for control when using regmap set_bypass 236 * @bypass_mask: Mask for control when using regmap set_bypass
237 * @bypass_val_on: Enabling value for control when using regmap set_bypass
238 * @bypass_val_off: Disabling value for control when using regmap set_bypass
235 * 239 *
236 * @enable_time: Time taken for initial enable of regulator (in uS). 240 * @enable_time: Time taken for initial enable of regulator (in uS).
237 */ 241 */
@@ -263,9 +267,13 @@ struct regulator_desc {
263 unsigned int apply_bit; 267 unsigned int apply_bit;
264 unsigned int enable_reg; 268 unsigned int enable_reg;
265 unsigned int enable_mask; 269 unsigned int enable_mask;
270 unsigned int enable_val;
271 unsigned int disable_val;
266 bool enable_is_inverted; 272 bool enable_is_inverted;
267 unsigned int bypass_reg; 273 unsigned int bypass_reg;
268 unsigned int bypass_mask; 274 unsigned int bypass_mask;
275 unsigned int bypass_val_on;
276 unsigned int bypass_val_off;
269 277
270 unsigned int enable_time; 278 unsigned int enable_time;
271}; 279};
diff --git a/include/linux/regulator/pfuze100.h b/include/linux/regulator/pfuze100.h
index 65d550bf3954..364f7a7c43db 100644
--- a/include/linux/regulator/pfuze100.h
+++ b/include/linux/regulator/pfuze100.h
@@ -35,6 +35,20 @@
35#define PFUZE100_VGEN6 14 35#define PFUZE100_VGEN6 14
36#define PFUZE100_MAX_REGULATOR 15 36#define PFUZE100_MAX_REGULATOR 15
37 37
38#define PFUZE200_SW1AB 0
39#define PFUZE200_SW2 1
40#define PFUZE200_SW3A 2
41#define PFUZE200_SW3B 3
42#define PFUZE200_SWBST 4
43#define PFUZE200_VSNVS 5
44#define PFUZE200_VREFDDR 6
45#define PFUZE200_VGEN1 7
46#define PFUZE200_VGEN2 8
47#define PFUZE200_VGEN3 9
48#define PFUZE200_VGEN4 10
49#define PFUZE200_VGEN5 11
50#define PFUZE200_VGEN6 12
51
38struct regulator_init_data; 52struct regulator_init_data;
39 53
40struct pfuze_regulator_platform_data { 54struct pfuze_regulator_platform_data {
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 201a69749659..56b7bc32db4f 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -104,15 +104,13 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
104 * units, e.g. numbers, bytes, Kbytes, etc 104 * units, e.g. numbers, bytes, Kbytes, etc
105 * 105 *
106 * returns 0 on success and <0 if the counter->usage will exceed the 106 * returns 0 on success and <0 if the counter->usage will exceed the
107 * counter->limit _locked call expects the counter->lock to be taken 107 * counter->limit
108 * 108 *
109 * charge_nofail works the same, except that it charges the resource 109 * charge_nofail works the same, except that it charges the resource
110 * counter unconditionally, and returns < 0 if the after the current 110 * counter unconditionally, and returns < 0 if the after the current
111 * charge we are over limit. 111 * charge we are over limit.
112 */ 112 */
113 113
114int __must_check res_counter_charge_locked(struct res_counter *counter,
115 unsigned long val, bool force);
116int __must_check res_counter_charge(struct res_counter *counter, 114int __must_check res_counter_charge(struct res_counter *counter,
117 unsigned long val, struct res_counter **limit_fail_at); 115 unsigned long val, struct res_counter **limit_fail_at);
118int res_counter_charge_nofail(struct res_counter *counter, 116int res_counter_charge_nofail(struct res_counter *counter,
@@ -125,12 +123,10 @@ int res_counter_charge_nofail(struct res_counter *counter,
125 * @val: the amount of the resource 123 * @val: the amount of the resource
126 * 124 *
127 * these calls check for usage underflow and show a warning on the console 125 * these calls check for usage underflow and show a warning on the console
128 * _locked call expects the counter->lock to be taken
129 * 126 *
130 * returns the total charges still present in @counter. 127 * returns the total charges still present in @counter.
131 */ 128 */
132 129
133u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
134u64 res_counter_uncharge(struct res_counter *counter, unsigned long val); 130u64 res_counter_uncharge(struct res_counter *counter, unsigned long val);
135 131
136u64 res_counter_uncharge_until(struct res_counter *counter, 132u64 res_counter_uncharge_until(struct res_counter *counter,
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 6082247feab1..c0eda5023d74 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -4,6 +4,8 @@
4struct device; 4struct device;
5struct reset_control; 5struct reset_control;
6 6
7#ifdef CONFIG_RESET_CONTROLLER
8
7int reset_control_reset(struct reset_control *rstc); 9int reset_control_reset(struct reset_control *rstc);
8int reset_control_assert(struct reset_control *rstc); 10int reset_control_assert(struct reset_control *rstc);
9int reset_control_deassert(struct reset_control *rstc); 11int reset_control_deassert(struct reset_control *rstc);
@@ -12,6 +14,67 @@ struct reset_control *reset_control_get(struct device *dev, const char *id);
12void reset_control_put(struct reset_control *rstc); 14void reset_control_put(struct reset_control *rstc);
13struct reset_control *devm_reset_control_get(struct device *dev, const char *id); 15struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
14 16
15int device_reset(struct device *dev); 17int __must_check device_reset(struct device *dev);
18
19static inline int device_reset_optional(struct device *dev)
20{
21 return device_reset(dev);
22}
23
24static inline struct reset_control *reset_control_get_optional(
25 struct device *dev, const char *id)
26{
27 return reset_control_get(dev, id);
28}
29
30static inline struct reset_control *devm_reset_control_get_optional(
31 struct device *dev, const char *id)
32{
33 return devm_reset_control_get(dev, id);
34}
35
36#else
37
38static inline int reset_control_reset(struct reset_control *rstc)
39{
40 WARN_ON(1);
41 return 0;
42}
43
44static inline int reset_control_assert(struct reset_control *rstc)
45{
46 WARN_ON(1);
47 return 0;
48}
49
50static inline int reset_control_deassert(struct reset_control *rstc)
51{
52 WARN_ON(1);
53 return 0;
54}
55
56static inline void reset_control_put(struct reset_control *rstc)
57{
58 WARN_ON(1);
59}
60
61static inline int device_reset_optional(struct device *dev)
62{
63 return -ENOSYS;
64}
65
66static inline struct reset_control *reset_control_get_optional(
67 struct device *dev, const char *id)
68{
69 return ERR_PTR(-ENOSYS);
70}
71
72static inline struct reset_control *devm_reset_control_get_optional(
73 struct device *dev, const char *id)
74{
75 return ERR_PTR(-ENOSYS);
76}
77
78#endif /* CONFIG_RESET_CONTROLLER */
16 79
17#endif 80#endif
diff --git a/include/linux/rio.h b/include/linux/rio.h
index b71d5738e683..6bda06f21930 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -83,7 +83,7 @@
83#define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */ 83#define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */
84 84
85extern struct bus_type rio_bus_type; 85extern struct bus_type rio_bus_type;
86extern struct device rio_bus; 86extern struct class rio_mport_class;
87 87
88struct rio_mport; 88struct rio_mport;
89struct rio_dev; 89struct rio_dev;
@@ -201,6 +201,7 @@ struct rio_dev {
201#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) 201#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list)
202#define to_rio_dev(n) container_of(n, struct rio_dev, dev) 202#define to_rio_dev(n) container_of(n, struct rio_dev, dev)
203#define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0]) 203#define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0])
204#define to_rio_mport(n) container_of(n, struct rio_mport, dev)
204 205
205/** 206/**
206 * struct rio_msg - RIO message event 207 * struct rio_msg - RIO message event
@@ -248,6 +249,7 @@ enum rio_phy_type {
248 * @phy_type: RapidIO phy type 249 * @phy_type: RapidIO phy type
249 * @phys_efptr: RIO port extended features pointer 250 * @phys_efptr: RIO port extended features pointer
250 * @name: Port name string 251 * @name: Port name string
252 * @dev: device structure associated with an mport
251 * @priv: Master port private data 253 * @priv: Master port private data
252 * @dma: DMA device associated with mport 254 * @dma: DMA device associated with mport
253 * @nscan: RapidIO network enumeration/discovery operations 255 * @nscan: RapidIO network enumeration/discovery operations
@@ -272,6 +274,7 @@ struct rio_mport {
272 enum rio_phy_type phy_type; /* RapidIO phy type */ 274 enum rio_phy_type phy_type; /* RapidIO phy type */
273 u32 phys_efptr; 275 u32 phys_efptr;
274 unsigned char name[RIO_MAX_MPORT_NAME]; 276 unsigned char name[RIO_MAX_MPORT_NAME];
277 struct device dev;
275 void *priv; /* Master port private data */ 278 void *priv; /* Master port private data */
276#ifdef CONFIG_RAPIDIO_DMA_ENGINE 279#ifdef CONFIG_RAPIDIO_DMA_ENGINE
277 struct dma_device dma; 280 struct dma_device dma;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7cb07fd26680..25f54c79f757 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -132,6 +132,10 @@ struct perf_event_context;
132struct blk_plug; 132struct blk_plug;
133struct filename; 133struct filename;
134 134
135#define VMACACHE_BITS 2
136#define VMACACHE_SIZE (1U << VMACACHE_BITS)
137#define VMACACHE_MASK (VMACACHE_SIZE - 1)
138
135/* 139/*
136 * List of flags we want to share for kernel threads, 140 * List of flags we want to share for kernel threads,
137 * if only because they are not used by them anyway. 141 * if only because they are not used by them anyway.
@@ -206,8 +210,9 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
206#define __TASK_STOPPED 4 210#define __TASK_STOPPED 4
207#define __TASK_TRACED 8 211#define __TASK_TRACED 8
208/* in tsk->exit_state */ 212/* in tsk->exit_state */
209#define EXIT_ZOMBIE 16 213#define EXIT_DEAD 16
210#define EXIT_DEAD 32 214#define EXIT_ZOMBIE 32
215#define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD)
211/* in tsk->state again */ 216/* in tsk->state again */
212#define TASK_DEAD 64 217#define TASK_DEAD 64
213#define TASK_WAKEKILL 128 218#define TASK_WAKEKILL 128
@@ -1235,6 +1240,9 @@ struct task_struct {
1235#ifdef CONFIG_COMPAT_BRK 1240#ifdef CONFIG_COMPAT_BRK
1236 unsigned brk_randomized:1; 1241 unsigned brk_randomized:1;
1237#endif 1242#endif
1243 /* per-thread vma caching */
1244 u32 vmacache_seqnum;
1245 struct vm_area_struct *vmacache[VMACACHE_SIZE];
1238#if defined(SPLIT_RSS_COUNTING) 1246#if defined(SPLIT_RSS_COUNTING)
1239 struct task_rss_stat rss_stat; 1247 struct task_rss_stat rss_stat;
1240#endif 1248#endif
@@ -1711,6 +1719,24 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1711} 1719}
1712 1720
1713 1721
1722static inline int pid_alive(const struct task_struct *p);
1723static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1724{
1725 pid_t pid = 0;
1726
1727 rcu_read_lock();
1728 if (pid_alive(tsk))
1729 pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1730 rcu_read_unlock();
1731
1732 return pid;
1733}
1734
1735static inline pid_t task_ppid_nr(const struct task_struct *tsk)
1736{
1737 return task_ppid_nr_ns(tsk, &init_pid_ns);
1738}
1739
1714static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, 1740static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
1715 struct pid_namespace *ns) 1741 struct pid_namespace *ns)
1716{ 1742{
@@ -1750,7 +1776,7 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1750 * 1776 *
1751 * Return: 1 if the process is alive. 0 otherwise. 1777 * Return: 1 if the process is alive. 0 otherwise.
1752 */ 1778 */
1753static inline int pid_alive(struct task_struct *p) 1779static inline int pid_alive(const struct task_struct *p)
1754{ 1780{
1755 return p->pids[PIDTYPE_PID].pid != NULL; 1781 return p->pids[PIDTYPE_PID].pid != NULL;
1756} 1782}
@@ -1844,7 +1870,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1844#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1870#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1845#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ 1871#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */
1846#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 1872#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1847#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1848#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1873#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1849#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1874#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1850#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */ 1875#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */
@@ -2351,7 +2376,7 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, i
2351struct task_struct *fork_idle(int); 2376struct task_struct *fork_idle(int);
2352extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2377extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2353 2378
2354extern void set_task_comm(struct task_struct *tsk, char *from); 2379extern void set_task_comm(struct task_struct *tsk, const char *from);
2355extern char *get_task_comm(char *to, struct task_struct *tsk); 2380extern char *get_task_comm(char *to, struct task_struct *tsk);
2356 2381
2357#ifdef CONFIG_SMP 2382#ifdef CONFIG_SMP
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 6f19cfd1840e..4054b0994071 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -76,7 +76,6 @@ static inline int seccomp_mode(struct seccomp *s)
76#ifdef CONFIG_SECCOMP_FILTER 76#ifdef CONFIG_SECCOMP_FILTER
77extern void put_seccomp_filter(struct task_struct *tsk); 77extern void put_seccomp_filter(struct task_struct *tsk);
78extern void get_seccomp_filter(struct task_struct *tsk); 78extern void get_seccomp_filter(struct task_struct *tsk);
79extern u32 seccomp_bpf_load(int off);
80#else /* CONFIG_SECCOMP_FILTER */ 79#else /* CONFIG_SECCOMP_FILTER */
81static inline void put_seccomp_filter(struct task_struct *tsk) 80static inline void put_seccomp_filter(struct task_struct *tsk)
82{ 81{
diff --git a/include/linux/security.h b/include/linux/security.h
index 2fc42d191f79..6478ce3252c7 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1793,7 +1793,8 @@ int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1793int security_inode_rmdir(struct inode *dir, struct dentry *dentry); 1793int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1794int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev); 1794int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
1795int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 1795int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1796 struct inode *new_dir, struct dentry *new_dentry); 1796 struct inode *new_dir, struct dentry *new_dentry,
1797 unsigned int flags);
1797int security_inode_readlink(struct dentry *dentry); 1798int security_inode_readlink(struct dentry *dentry);
1798int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1799int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1799int security_inode_permission(struct inode *inode, int mask); 1800int security_inode_permission(struct inode *inode, int mask);
@@ -2161,7 +2162,8 @@ static inline int security_inode_mknod(struct inode *dir,
2161static inline int security_inode_rename(struct inode *old_dir, 2162static inline int security_inode_rename(struct inode *old_dir,
2162 struct dentry *old_dentry, 2163 struct dentry *old_dentry,
2163 struct inode *new_dir, 2164 struct inode *new_dir,
2164 struct dentry *new_dentry) 2165 struct dentry *new_dentry,
2166 unsigned int flags)
2165{ 2167{
2166 return 0; 2168 return 0;
2167} 2169}
@@ -2955,7 +2957,8 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
2955int security_path_link(struct dentry *old_dentry, struct path *new_dir, 2957int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2956 struct dentry *new_dentry); 2958 struct dentry *new_dentry);
2957int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 2959int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2958 struct path *new_dir, struct dentry *new_dentry); 2960 struct path *new_dir, struct dentry *new_dentry,
2961 unsigned int flags);
2959int security_path_chmod(struct path *path, umode_t mode); 2962int security_path_chmod(struct path *path, umode_t mode);
2960int security_path_chown(struct path *path, kuid_t uid, kgid_t gid); 2963int security_path_chown(struct path *path, kuid_t uid, kgid_t gid);
2961int security_path_chroot(struct path *path); 2964int security_path_chroot(struct path *path);
@@ -3003,7 +3006,8 @@ static inline int security_path_link(struct dentry *old_dentry,
3003static inline int security_path_rename(struct path *old_dir, 3006static inline int security_path_rename(struct path *old_dir,
3004 struct dentry *old_dentry, 3007 struct dentry *old_dentry,
3005 struct path *new_dir, 3008 struct path *new_dir,
3006 struct dentry *new_dentry) 3009 struct dentry *new_dentry,
3010 unsigned int flags)
3007{ 3011{
3008 return 0; 3012 return 0;
3009} 3013}
diff --git a/include/linux/serial_bcm63xx.h b/include/linux/serial_bcm63xx.h
index 570e964dc899..a80aa1a5bee2 100644
--- a/include/linux/serial_bcm63xx.h
+++ b/include/linux/serial_bcm63xx.h
@@ -116,4 +116,6 @@
116 UART_FIFO_PARERR_MASK | \ 116 UART_FIFO_PARERR_MASK | \
117 UART_FIFO_BRKDET_MASK) 117 UART_FIFO_BRKDET_MASK)
118 118
119#define UART_REG_SIZE 24
120
119#endif /* _LINUX_SERIAL_BCM63XX_H */ 121#endif /* _LINUX_SERIAL_BCM63XX_H */
diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h
index 907d9d1d56cf..e6fc9567690b 100644
--- a/include/linux/serial_s3c.h
+++ b/include/linux/serial_s3c.h
@@ -233,6 +233,8 @@
233 233
234#ifndef __ASSEMBLY__ 234#ifndef __ASSEMBLY__
235 235
236#include <linux/serial_core.h>
237
236/* configuration structure for per-machine configurations for the 238/* configuration structure for per-machine configurations for the
237 * serial port 239 * serial port
238 * 240 *
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 22b3640c9424..6c5e3bb282b0 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -10,45 +10,59 @@
10 10
11#define SCIx_NOT_SUPPORTED (-1) 11#define SCIx_NOT_SUPPORTED (-1)
12 12
13#define SCSCR_TIE (1 << 7) 13/* SCSMR (Serial Mode Register) */
14#define SCSCR_RIE (1 << 6) 14#define SCSMR_CHR (1 << 6) /* 7-bit Character Length */
15#define SCSCR_TE (1 << 5) 15#define SCSMR_PE (1 << 5) /* Parity Enable */
16#define SCSCR_RE (1 << 4) 16#define SCSMR_ODD (1 << 4) /* Odd Parity */
17#define SCSCR_REIE (1 << 3) /* not supported by all parts */ 17#define SCSMR_STOP (1 << 3) /* Stop Bit Length */
18#define SCSCR_TOIE (1 << 2) /* not supported by all parts */ 18#define SCSMR_CKS 0x0003 /* Clock Select */
19#define SCSCR_CKE1 (1 << 1) 19
20#define SCSCR_CKE0 (1 << 0) 20/* Serial Control Register (@ = not supported by all parts) */
21 21#define SCSCR_TIE (1 << 7) /* Transmit Interrupt Enable */
22/* SCxSR SCI */ 22#define SCSCR_RIE (1 << 6) /* Receive Interrupt Enable */
23#define SCI_TDRE 0x80 23#define SCSCR_TE (1 << 5) /* Transmit Enable */
24#define SCI_RDRF 0x40 24#define SCSCR_RE (1 << 4) /* Receive Enable */
25#define SCI_ORER 0x20 25#define SCSCR_REIE (1 << 3) /* Receive Error Interrupt Enable @ */
26#define SCI_FER 0x10 26#define SCSCR_TOIE (1 << 2) /* Timeout Interrupt Enable @ */
27#define SCI_PER 0x08 27#define SCSCR_CKE1 (1 << 1) /* Clock Enable 1 */
28#define SCI_TEND 0x04 28#define SCSCR_CKE0 (1 << 0) /* Clock Enable 0 */
29/* SCIFA/SCIFB only */
30#define SCSCR_TDRQE (1 << 15) /* Tx Data Transfer Request Enable */
31#define SCSCR_RDRQE (1 << 14) /* Rx Data Transfer Request Enable */
32
33/* SCxSR (Serial Status Register) on SCI */
34#define SCI_TDRE 0x80 /* Transmit Data Register Empty */
35#define SCI_RDRF 0x40 /* Receive Data Register Full */
36#define SCI_ORER 0x20 /* Overrun Error */
37#define SCI_FER 0x10 /* Framing Error */
38#define SCI_PER 0x08 /* Parity Error */
39#define SCI_TEND 0x04 /* Transmit End */
29 40
30#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER) 41#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)
31 42
32/* SCxSR SCIF, HSCIF */ 43/* SCxSR (Serial Status Register) on SCIF, HSCIF */
33#define SCIF_ER 0x0080 44#define SCIF_ER 0x0080 /* Receive Error */
34#define SCIF_TEND 0x0040 45#define SCIF_TEND 0x0040 /* Transmission End */
35#define SCIF_TDFE 0x0020 46#define SCIF_TDFE 0x0020 /* Transmit FIFO Data Empty */
36#define SCIF_BRK 0x0010 47#define SCIF_BRK 0x0010 /* Break Detect */
37#define SCIF_FER 0x0008 48#define SCIF_FER 0x0008 /* Framing Error */
38#define SCIF_PER 0x0004 49#define SCIF_PER 0x0004 /* Parity Error */
39#define SCIF_RDF 0x0002 50#define SCIF_RDF 0x0002 /* Receive FIFO Data Full */
40#define SCIF_DR 0x0001 51#define SCIF_DR 0x0001 /* Receive Data Ready */
41 52
42#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) 53#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
43 54
44/* SCSPTR, optional */ 55/* SCFCR (FIFO Control Register) */
45#define SCSPTR_RTSIO (1 << 7) 56#define SCFCR_LOOP (1 << 0) /* Loopback Test */
46#define SCSPTR_CTSIO (1 << 5) 57
47#define SCSPTR_SPB2IO (1 << 1) 58/* SCSPTR (Serial Port Register), optional */
48#define SCSPTR_SPB2DT (1 << 0) 59#define SCSPTR_RTSIO (1 << 7) /* Serial Port RTS Pin Input/Output */
60#define SCSPTR_CTSIO (1 << 5) /* Serial Port CTS Pin Input/Output */
61#define SCSPTR_SPB2IO (1 << 1) /* Serial Port Break Input/Output */
62#define SCSPTR_SPB2DT (1 << 0) /* Serial Port Break Data */
49 63
50/* HSSRR HSCIF */ 64/* HSSRR HSCIF */
51#define HSCIF_SRE 0x8000 65#define HSCIF_SRE 0x8000 /* Sampling Rate Register Enable */
52 66
53enum { 67enum {
54 SCIx_PROBE_REGTYPE, 68 SCIx_PROBE_REGTYPE,
@@ -73,10 +87,19 @@ enum {
73 * Not all registers will exist on all parts. 87 * Not all registers will exist on all parts.
74 */ 88 */
75enum { 89enum {
76 SCSMR, SCBRR, SCSCR, SCxSR, 90 SCSMR, /* Serial Mode Register */
77 SCFCR, SCFDR, SCxTDR, SCxRDR, 91 SCBRR, /* Bit Rate Register */
78 SCLSR, SCTFDR, SCRFDR, SCSPTR, 92 SCSCR, /* Serial Control Register */
79 HSSRR, 93 SCxSR, /* Serial Status Register */
94 SCFCR, /* FIFO Control Register */
95 SCFDR, /* FIFO Data Count Register */
96 SCxTDR, /* Transmit (FIFO) Data Register */
97 SCxRDR, /* Receive (FIFO) Data Register */
98 SCLSR, /* Line Status Register */
99 SCTFDR, /* Transmit FIFO Data Count Register */
100 SCRFDR, /* Receive FIFO Data Count Register */
101 SCSPTR, /* Serial Port Register */
102 HSSRR, /* Sampling Rate Register */
80 103
81 SCIx_NR_REGS, 104 SCIx_NR_REGS,
82}; 105};
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 60c72395ec6b..1f208b2a1ed6 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -52,6 +52,7 @@ struct clk {
52 unsigned long flags; 52 unsigned long flags;
53 53
54 void __iomem *enable_reg; 54 void __iomem *enable_reg;
55 void __iomem *status_reg;
55 unsigned int enable_bit; 56 unsigned int enable_bit;
56 void __iomem *mapped_reg; 57 void __iomem *mapped_reg;
57 58
@@ -116,22 +117,26 @@ long clk_round_parent(struct clk *clk, unsigned long target,
116 unsigned long *best_freq, unsigned long *parent_freq, 117 unsigned long *best_freq, unsigned long *parent_freq,
117 unsigned int div_min, unsigned int div_max); 118 unsigned int div_min, unsigned int div_max);
118 119
119#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _flags) \ 120#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _status_reg, _flags) \
120{ \ 121{ \
121 .parent = _parent, \ 122 .parent = _parent, \
122 .enable_reg = (void __iomem *)_enable_reg, \ 123 .enable_reg = (void __iomem *)_enable_reg, \
123 .enable_bit = _enable_bit, \ 124 .enable_bit = _enable_bit, \
125 .status_reg = _status_reg, \
124 .flags = _flags, \ 126 .flags = _flags, \
125} 127}
126 128
127#define SH_CLK_MSTP32(_p, _r, _b, _f) \ 129#define SH_CLK_MSTP32(_p, _r, _b, _f) \
128 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_32BIT) 130 SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_32BIT)
129 131
130#define SH_CLK_MSTP16(_p, _r, _b, _f) \ 132#define SH_CLK_MSTP32_STS(_p, _r, _b, _s, _f) \
131 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_16BIT) 133 SH_CLK_MSTP(_p, _r, _b, _s, _f | CLK_ENABLE_REG_32BIT)
132 134
133#define SH_CLK_MSTP8(_p, _r, _b, _f) \ 135#define SH_CLK_MSTP16(_p, _r, _b, _f) \
134 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_8BIT) 136 SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_16BIT)
137
138#define SH_CLK_MSTP8(_p, _r, _b, _f) \
139 SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_8BIT)
135 140
136int sh_clk_mstp_register(struct clk *clks, int nr); 141int sh_clk_mstp_register(struct clk *clks, int nr);
137 142
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 9d55438bc4ad..4d1771c2d29f 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -51,6 +51,7 @@ extern struct file *shmem_kernel_file_setup(const char *name, loff_t size,
51 unsigned long flags); 51 unsigned long flags);
52extern int shmem_zero_setup(struct vm_area_struct *); 52extern int shmem_zero_setup(struct vm_area_struct *);
53extern int shmem_lock(struct file *file, int lock, struct user_struct *user); 53extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
54extern bool shmem_mapping(struct address_space *mapping);
54extern void shmem_unlock_mapping(struct address_space *mapping); 55extern void shmem_unlock_mapping(struct address_space *mapping);
55extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, 56extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
56 pgoff_t index, gfp_t gfp_mask); 57 pgoff_t index, gfp_t gfp_mask);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 15ede6a823a6..08074a810164 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -32,6 +32,7 @@
32#include <linux/hrtimer.h> 32#include <linux/hrtimer.h>
33#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
34#include <linux/netdev_features.h> 34#include <linux/netdev_features.h>
35#include <linux/sched.h>
35#include <net/flow_keys.h> 36#include <net/flow_keys.h>
36 37
37/* A. Checksumming of received packets by device. 38/* A. Checksumming of received packets by device.
@@ -356,11 +357,62 @@ typedef unsigned int sk_buff_data_t;
356typedef unsigned char *sk_buff_data_t; 357typedef unsigned char *sk_buff_data_t;
357#endif 358#endif
358 359
360/**
361 * struct skb_mstamp - multi resolution time stamps
362 * @stamp_us: timestamp in us resolution
363 * @stamp_jiffies: timestamp in jiffies
364 */
365struct skb_mstamp {
366 union {
367 u64 v64;
368 struct {
369 u32 stamp_us;
370 u32 stamp_jiffies;
371 };
372 };
373};
374
375/**
376 * skb_mstamp_get - get current timestamp
377 * @cl: place to store timestamps
378 */
379static inline void skb_mstamp_get(struct skb_mstamp *cl)
380{
381 u64 val = local_clock();
382
383 do_div(val, NSEC_PER_USEC);
384 cl->stamp_us = (u32)val;
385 cl->stamp_jiffies = (u32)jiffies;
386}
387
388/**
389 * skb_mstamp_delta - compute the difference in usec between two skb_mstamp
390 * @t1: pointer to newest sample
391 * @t0: pointer to oldest sample
392 */
393static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
394 const struct skb_mstamp *t0)
395{
396 s32 delta_us = t1->stamp_us - t0->stamp_us;
397 u32 delta_jiffies = t1->stamp_jiffies - t0->stamp_jiffies;
398
399 /* If delta_us is negative, this might be because interval is too big,
400 * or local_clock() drift is too big : fallback using jiffies.
401 */
402 if (delta_us <= 0 ||
403 delta_jiffies >= (INT_MAX / (USEC_PER_SEC / HZ)))
404
405 delta_us = jiffies_to_usecs(delta_jiffies);
406
407 return delta_us;
408}
409
410
359/** 411/**
360 * struct sk_buff - socket buffer 412 * struct sk_buff - socket buffer
361 * @next: Next buffer in list 413 * @next: Next buffer in list
362 * @prev: Previous buffer in list 414 * @prev: Previous buffer in list
363 * @tstamp: Time we arrived 415 * @tstamp: Time we arrived/left
364 * @sk: Socket we are owned by 416 * @sk: Socket we are owned by
365 * @dev: Device we arrived on/are leaving by 417 * @dev: Device we arrived on/are leaving by
366 * @cb: Control buffer. Free for use by every layer. Put private vars here 418 * @cb: Control buffer. Free for use by every layer. Put private vars here
@@ -392,11 +444,11 @@ typedef unsigned char *sk_buff_data_t;
392 * @skb_iif: ifindex of device we arrived on 444 * @skb_iif: ifindex of device we arrived on
393 * @tc_index: Traffic control index 445 * @tc_index: Traffic control index
394 * @tc_verd: traffic control verdict 446 * @tc_verd: traffic control verdict
395 * @rxhash: the packet hash computed on receive 447 * @hash: the packet hash
396 * @queue_mapping: Queue mapping for multiqueue devices 448 * @queue_mapping: Queue mapping for multiqueue devices
397 * @ndisc_nodetype: router type (from link layer) 449 * @ndisc_nodetype: router type (from link layer)
398 * @ooo_okay: allow the mapping of a socket to a queue to be changed 450 * @ooo_okay: allow the mapping of a socket to a queue to be changed
399 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport 451 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
400 * ports. 452 * ports.
401 * @wifi_acked_valid: wifi_acked was set 453 * @wifi_acked_valid: wifi_acked was set
402 * @wifi_acked: whether frame was acked on wifi or not 454 * @wifi_acked: whether frame was acked on wifi or not
@@ -429,7 +481,10 @@ struct sk_buff {
429 struct sk_buff *next; 481 struct sk_buff *next;
430 struct sk_buff *prev; 482 struct sk_buff *prev;
431 483
432 ktime_t tstamp; 484 union {
485 ktime_t tstamp;
486 struct skb_mstamp skb_mstamp;
487 };
433 488
434 struct sock *sk; 489 struct sock *sk;
435 struct net_device *dev; 490 struct net_device *dev;
@@ -482,7 +537,7 @@ struct sk_buff {
482 537
483 int skb_iif; 538 int skb_iif;
484 539
485 __u32 rxhash; 540 __u32 hash;
486 541
487 __be16 vlan_proto; 542 __be16 vlan_proto;
488 __u16 vlan_tci; 543 __u16 vlan_tci;
@@ -501,7 +556,7 @@ struct sk_buff {
501#endif 556#endif
502 __u8 pfmemalloc:1; 557 __u8 pfmemalloc:1;
503 __u8 ooo_okay:1; 558 __u8 ooo_okay:1;
504 __u8 l4_rxhash:1; 559 __u8 l4_hash:1;
505 __u8 wifi_acked_valid:1; 560 __u8 wifi_acked_valid:1;
506 __u8 wifi_acked:1; 561 __u8 wifi_acked:1;
507 __u8 no_fcs:1; 562 __u8 no_fcs:1;
@@ -691,6 +746,8 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
691 unsigned int headroom); 746 unsigned int headroom);
692struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom, 747struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
693 int newtailroom, gfp_t priority); 748 int newtailroom, gfp_t priority);
749int skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg,
750 int offset, int len);
694int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, 751int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
695 int len); 752 int len);
696int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); 753int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
@@ -758,40 +815,40 @@ enum pkt_hash_types {
758static inline void 815static inline void
759skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) 816skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type)
760{ 817{
761 skb->l4_rxhash = (type == PKT_HASH_TYPE_L4); 818 skb->l4_hash = (type == PKT_HASH_TYPE_L4);
762 skb->rxhash = hash; 819 skb->hash = hash;
763} 820}
764 821
765void __skb_get_hash(struct sk_buff *skb); 822void __skb_get_hash(struct sk_buff *skb);
766static inline __u32 skb_get_hash(struct sk_buff *skb) 823static inline __u32 skb_get_hash(struct sk_buff *skb)
767{ 824{
768 if (!skb->l4_rxhash) 825 if (!skb->l4_hash)
769 __skb_get_hash(skb); 826 __skb_get_hash(skb);
770 827
771 return skb->rxhash; 828 return skb->hash;
772} 829}
773 830
774static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) 831static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
775{ 832{
776 return skb->rxhash; 833 return skb->hash;
777} 834}
778 835
779static inline void skb_clear_hash(struct sk_buff *skb) 836static inline void skb_clear_hash(struct sk_buff *skb)
780{ 837{
781 skb->rxhash = 0; 838 skb->hash = 0;
782 skb->l4_rxhash = 0; 839 skb->l4_hash = 0;
783} 840}
784 841
785static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb) 842static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
786{ 843{
787 if (!skb->l4_rxhash) 844 if (!skb->l4_hash)
788 skb_clear_hash(skb); 845 skb_clear_hash(skb);
789} 846}
790 847
791static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) 848static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
792{ 849{
793 to->rxhash = from->rxhash; 850 to->hash = from->hash;
794 to->l4_rxhash = from->l4_rxhash; 851 to->l4_hash = from->l4_hash;
795}; 852};
796 853
797#ifdef NET_SKBUFF_DATA_USES_OFFSET 854#ifdef NET_SKBUFF_DATA_USES_OFFSET
@@ -2038,7 +2095,7 @@ static inline void skb_propagate_pfmemalloc(struct page *page,
2038} 2095}
2039 2096
2040/** 2097/**
2041 * skb_frag_page - retrieve the page refered to by a paged fragment 2098 * skb_frag_page - retrieve the page referred to by a paged fragment
2042 * @frag: the paged fragment 2099 * @frag: the paged fragment
2043 * 2100 *
2044 * Returns the &struct page associated with @frag. 2101 * Returns the &struct page associated with @frag.
@@ -2573,8 +2630,6 @@ static inline ktime_t net_invalid_timestamp(void)
2573 return ktime_set(0, 0); 2630 return ktime_set(0, 0);
2574} 2631}
2575 2632
2576void skb_timestamping_init(void);
2577
2578#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2633#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2579 2634
2580void skb_clone_tx_timestamp(struct sk_buff *skb); 2635void skb_clone_tx_timestamp(struct sk_buff *skb);
@@ -2776,6 +2831,19 @@ static inline void skb_init_secmark(struct sk_buff *skb)
2776{ } 2831{ }
2777#endif 2832#endif
2778 2833
2834static inline bool skb_irq_freeable(const struct sk_buff *skb)
2835{
2836 return !skb->destructor &&
2837#if IS_ENABLED(CONFIG_XFRM)
2838 !skb->sp &&
2839#endif
2840#if IS_ENABLED(CONFIG_NF_CONNTRACK)
2841 !skb->nfct &&
2842#endif
2843 !skb->_skb_refdst &&
2844 !skb_has_frag_list(skb);
2845}
2846
2779static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) 2847static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
2780{ 2848{
2781 skb->queue_mapping = queue_mapping; 2849 skb->queue_mapping = queue_mapping;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index b5b2df60299e..307bfbe62387 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -115,9 +115,9 @@ int slab_is_available(void);
115struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 115struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
116 unsigned long, 116 unsigned long,
117 void (*)(void *)); 117 void (*)(void *));
118struct kmem_cache * 118#ifdef CONFIG_MEMCG_KMEM
119kmem_cache_create_memcg(struct mem_cgroup *, const char *, size_t, size_t, 119void kmem_cache_create_memcg(struct mem_cgroup *, struct kmem_cache *);
120 unsigned long, void (*)(void *), struct kmem_cache *); 120#endif
121void kmem_cache_destroy(struct kmem_cache *); 121void kmem_cache_destroy(struct kmem_cache *);
122int kmem_cache_shrink(struct kmem_cache *); 122int kmem_cache_shrink(struct kmem_cache *);
123void kmem_cache_free(struct kmem_cache *, void *); 123void kmem_cache_free(struct kmem_cache *, void *);
@@ -242,6 +242,17 @@ struct kmem_cache {
242#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW) 242#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
243#endif 243#endif
244 244
245/*
246 * This restriction comes from byte sized index implementation.
247 * Page size is normally 2^12 bytes and, in this case, if we want to use
248 * byte sized index which can represent 2^8 entries, the size of the object
249 * should be equal or greater to 2^12 / 2^8 = 2^4 = 16.
250 * If minimum size of kmalloc is less than 16, we use it as minimum object
251 * size and give up to use byte sized index.
252 */
253#define SLAB_OBJ_MIN_SIZE (KMALLOC_MIN_SIZE < 16 ? \
254 (KMALLOC_MIN_SIZE) : 16)
255
245#ifndef CONFIG_SLOB 256#ifndef CONFIG_SLOB
246extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; 257extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
247#ifdef CONFIG_ZONE_DMA 258#ifdef CONFIG_ZONE_DMA
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index f56bfa9e4526..f2f7398848cf 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -87,6 +87,9 @@ struct kmem_cache {
87#ifdef CONFIG_MEMCG_KMEM 87#ifdef CONFIG_MEMCG_KMEM
88 struct memcg_cache_params *memcg_params; 88 struct memcg_cache_params *memcg_params;
89 int max_attr_size; /* for propagation, maximum size of a stored attr */ 89 int max_attr_size; /* for propagation, maximum size of a stored attr */
90#ifdef CONFIG_SYSFS
91 struct kset *memcg_kset;
92#endif
90#endif 93#endif
91 94
92#ifdef CONFIG_NUMA 95#ifdef CONFIG_NUMA
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 6ae004e437ea..633f5edd7470 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -17,10 +17,7 @@ extern void cpu_idle(void);
17 17
18typedef void (*smp_call_func_t)(void *info); 18typedef void (*smp_call_func_t)(void *info);
19struct call_single_data { 19struct call_single_data {
20 union { 20 struct llist_node llist;
21 struct list_head list;
22 struct llist_node llist;
23 };
24 smp_call_func_t func; 21 smp_call_func_t func;
25 void *info; 22 void *info;
26 u16 flags; 23 u16 flags;
@@ -53,8 +50,7 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
53 smp_call_func_t func, void *info, bool wait, 50 smp_call_func_t func, void *info, bool wait,
54 gfp_t gfp_flags); 51 gfp_t gfp_flags);
55 52
56void __smp_call_function_single(int cpuid, struct call_single_data *data, 53int smp_call_function_single_async(int cpu, struct call_single_data *csd);
57 int wait);
58 54
59#ifdef CONFIG_SMP 55#ifdef CONFIG_SMP
60 56
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 4203c66d8803..e713543336f1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -24,6 +24,9 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kthread.h> 25#include <linux/kthread.h>
26#include <linux/completion.h> 26#include <linux/completion.h>
27#include <linux/scatterlist.h>
28
29struct dma_chan;
27 30
28/* 31/*
29 * INTERFACES between SPI master-side drivers and SPI infrastructure. 32 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -234,7 +237,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
234 * @mode_bits: flags understood by this controller driver 237 * @mode_bits: flags understood by this controller driver
235 * @bits_per_word_mask: A mask indicating which values of bits_per_word are 238 * @bits_per_word_mask: A mask indicating which values of bits_per_word are
236 * supported by the driver. Bit n indicates that a bits_per_word n+1 is 239 * supported by the driver. Bit n indicates that a bits_per_word n+1 is
237 * suported. If set, the SPI core will reject any transfer with an 240 * supported. If set, the SPI core will reject any transfer with an
238 * unsupported bits_per_word. If not set, this value is simply ignored, 241 * unsupported bits_per_word. If not set, this value is simply ignored,
239 * and it's up to the individual driver to perform any validation. 242 * and it's up to the individual driver to perform any validation.
240 * @min_speed_hz: Lowest supported transfer speed 243 * @min_speed_hz: Lowest supported transfer speed
@@ -259,13 +262,14 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
259 * @cur_msg: the currently in-flight message 262 * @cur_msg: the currently in-flight message
260 * @cur_msg_prepared: spi_prepare_message was called for the currently 263 * @cur_msg_prepared: spi_prepare_message was called for the currently
261 * in-flight message 264 * in-flight message
262 * @xfer_completion: used by core tranfer_one_message() 265 * @xfer_completion: used by core transfer_one_message()
263 * @busy: message pump is busy 266 * @busy: message pump is busy
264 * @running: message pump is running 267 * @running: message pump is running
265 * @rt: whether this queue is set to run as a realtime task 268 * @rt: whether this queue is set to run as a realtime task
266 * @auto_runtime_pm: the core should ensure a runtime PM reference is held 269 * @auto_runtime_pm: the core should ensure a runtime PM reference is held
267 * while the hardware is prepared, using the parent 270 * while the hardware is prepared, using the parent
268 * device for the spidev 271 * device for the spidev
272 * @max_dma_len: Maximum length of a DMA transfer for the device.
269 * @prepare_transfer_hardware: a message will soon arrive from the queue 273 * @prepare_transfer_hardware: a message will soon arrive from the queue
270 * so the subsystem requests the driver to prepare the transfer hardware 274 * so the subsystem requests the driver to prepare the transfer hardware
271 * by issuing this call 275 * by issuing this call
@@ -348,6 +352,8 @@ struct spi_master {
348#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 352#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
349#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ 353#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */
350#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ 354#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
355#define SPI_MASTER_MUST_RX BIT(3) /* requires rx */
356#define SPI_MASTER_MUST_TX BIT(4) /* requires tx */
351 357
352 /* lock and mutex for SPI bus locking */ 358 /* lock and mutex for SPI bus locking */
353 spinlock_t bus_lock_spinlock; 359 spinlock_t bus_lock_spinlock;
@@ -390,6 +396,17 @@ struct spi_master {
390 void (*cleanup)(struct spi_device *spi); 396 void (*cleanup)(struct spi_device *spi);
391 397
392 /* 398 /*
399 * Used to enable core support for DMA handling, if can_dma()
400 * exists and returns true then the transfer will be mapped
401 * prior to transfer_one() being called. The driver should
402 * not modify or store xfer and dma_tx and dma_rx must be set
403 * while the device is prepared.
404 */
405 bool (*can_dma)(struct spi_master *master,
406 struct spi_device *spi,
407 struct spi_transfer *xfer);
408
409 /*
393 * These hooks are for drivers that want to use the generic 410 * These hooks are for drivers that want to use the generic
394 * master transfer queueing mechanism. If these are used, the 411 * master transfer queueing mechanism. If these are used, the
395 * transfer() function above must NOT be specified by the driver. 412 * transfer() function above must NOT be specified by the driver.
@@ -407,7 +424,9 @@ struct spi_master {
407 bool rt; 424 bool rt;
408 bool auto_runtime_pm; 425 bool auto_runtime_pm;
409 bool cur_msg_prepared; 426 bool cur_msg_prepared;
427 bool cur_msg_mapped;
410 struct completion xfer_completion; 428 struct completion xfer_completion;
429 size_t max_dma_len;
411 430
412 int (*prepare_transfer_hardware)(struct spi_master *master); 431 int (*prepare_transfer_hardware)(struct spi_master *master);
413 int (*transfer_one_message)(struct spi_master *master, 432 int (*transfer_one_message)(struct spi_master *master,
@@ -428,6 +447,14 @@ struct spi_master {
428 447
429 /* gpio chip select */ 448 /* gpio chip select */
430 int *cs_gpios; 449 int *cs_gpios;
450
451 /* DMA channels for use with core dmaengine helpers */
452 struct dma_chan *dma_tx;
453 struct dma_chan *dma_rx;
454
455 /* dummy data for full duplex devices */
456 void *dummy_rx;
457 void *dummy_tx;
431}; 458};
432 459
433static inline void *spi_master_get_devdata(struct spi_master *master) 460static inline void *spi_master_get_devdata(struct spi_master *master)
@@ -498,7 +525,7 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
498 * @rx_buf: data to be read (dma-safe memory), or NULL 525 * @rx_buf: data to be read (dma-safe memory), or NULL
499 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 526 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
500 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 527 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
501 * @tx_nbits: number of bits used for writting. If 0 the default 528 * @tx_nbits: number of bits used for writing. If 0 the default
502 * (SPI_NBITS_SINGLE) is used. 529 * (SPI_NBITS_SINGLE) is used.
503 * @rx_nbits: number of bits used for reading. If 0 the default 530 * @rx_nbits: number of bits used for reading. If 0 the default
504 * (SPI_NBITS_SINGLE) is used. 531 * (SPI_NBITS_SINGLE) is used.
@@ -512,6 +539,8 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
512 * (optionally) changing the chipselect status, then starting 539 * (optionally) changing the chipselect status, then starting
513 * the next transfer or completing this @spi_message. 540 * the next transfer or completing this @spi_message.
514 * @transfer_list: transfers are sequenced through @spi_message.transfers 541 * @transfer_list: transfers are sequenced through @spi_message.transfers
542 * @tx_sg: Scatterlist for transmit, currently not for client use
543 * @rx_sg: Scatterlist for receive, currently not for client use
515 * 544 *
516 * SPI transfers always write the same number of bytes as they read. 545 * SPI transfers always write the same number of bytes as they read.
517 * Protocol drivers should always provide @rx_buf and/or @tx_buf. 546 * Protocol drivers should always provide @rx_buf and/or @tx_buf.
@@ -556,7 +585,7 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
556 * by the results of previous messages and where the whole transaction 585 * by the results of previous messages and where the whole transaction
557 * ends when the chipselect goes intactive. 586 * ends when the chipselect goes intactive.
558 * 587 *
559 * When SPI can transfer in 1x,2x or 4x. It can get this tranfer information 588 * When SPI can transfer in 1x,2x or 4x. It can get this transfer information
560 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these 589 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these
561 * two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x) 590 * two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
562 * SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer. 591 * SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
@@ -579,6 +608,8 @@ struct spi_transfer {
579 608
580 dma_addr_t tx_dma; 609 dma_addr_t tx_dma;
581 dma_addr_t rx_dma; 610 dma_addr_t rx_dma;
611 struct sg_table tx_sg;
612 struct sg_table rx_sg;
582 613
583 unsigned cs_change:1; 614 unsigned cs_change:1;
584 unsigned tx_nbits:3; 615 unsigned tx_nbits:3;
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index daebaba886aa..85578d4be034 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -42,6 +42,6 @@ extern int spi_bitbang_setup_transfer(struct spi_device *spi,
42 42
43/* start or stop queue processing */ 43/* start or stop queue processing */
44extern int spi_bitbang_start(struct spi_bitbang *spi); 44extern int spi_bitbang_start(struct spi_bitbang *spi);
45extern int spi_bitbang_stop(struct spi_bitbang *spi); 45extern void spi_bitbang_stop(struct spi_bitbang *spi);
46 46
47#endif /* __SPI_BITBANG_H */ 47#endif /* __SPI_BITBANG_H */
diff --git a/include/linux/spmi.h b/include/linux/spmi.h
new file mode 100644
index 000000000000..91f5eab9e428
--- /dev/null
+++ b/include/linux/spmi.h
@@ -0,0 +1,191 @@
1/* Copyright (c) 2012-2013, The Linux Foundation. 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#ifndef _LINUX_SPMI_H
13#define _LINUX_SPMI_H
14
15#include <linux/types.h>
16#include <linux/device.h>
17#include <linux/mod_devicetable.h>
18
19/* Maximum slave identifier */
20#define SPMI_MAX_SLAVE_ID 16
21
22/* SPMI Commands */
23#define SPMI_CMD_EXT_WRITE 0x00
24#define SPMI_CMD_RESET 0x10
25#define SPMI_CMD_SLEEP 0x11
26#define SPMI_CMD_SHUTDOWN 0x12
27#define SPMI_CMD_WAKEUP 0x13
28#define SPMI_CMD_AUTHENTICATE 0x14
29#define SPMI_CMD_MSTR_READ 0x15
30#define SPMI_CMD_MSTR_WRITE 0x16
31#define SPMI_CMD_TRANSFER_BUS_OWNERSHIP 0x1A
32#define SPMI_CMD_DDB_MASTER_READ 0x1B
33#define SPMI_CMD_DDB_SLAVE_READ 0x1C
34#define SPMI_CMD_EXT_READ 0x20
35#define SPMI_CMD_EXT_WRITEL 0x30
36#define SPMI_CMD_EXT_READL 0x38
37#define SPMI_CMD_WRITE 0x40
38#define SPMI_CMD_READ 0x60
39#define SPMI_CMD_ZERO_WRITE 0x80
40
41/**
42 * struct spmi_device - Basic representation of an SPMI device
43 * @dev: Driver model representation of the device.
44 * @ctrl: SPMI controller managing the bus hosting this device.
45 * @usid: This devices' Unique Slave IDentifier.
46 */
47struct spmi_device {
48 struct device dev;
49 struct spmi_controller *ctrl;
50 u8 usid;
51};
52
53static inline struct spmi_device *to_spmi_device(struct device *d)
54{
55 return container_of(d, struct spmi_device, dev);
56}
57
58static inline void *spmi_device_get_drvdata(const struct spmi_device *sdev)
59{
60 return dev_get_drvdata(&sdev->dev);
61}
62
63static inline void spmi_device_set_drvdata(struct spmi_device *sdev, void *data)
64{
65 dev_set_drvdata(&sdev->dev, data);
66}
67
68struct spmi_device *spmi_device_alloc(struct spmi_controller *ctrl);
69
70static inline void spmi_device_put(struct spmi_device *sdev)
71{
72 if (sdev)
73 put_device(&sdev->dev);
74}
75
76int spmi_device_add(struct spmi_device *sdev);
77
78void spmi_device_remove(struct spmi_device *sdev);
79
80/**
81 * struct spmi_controller - interface to the SPMI master controller
82 * @dev: Driver model representation of the device.
83 * @nr: board-specific number identifier for this controller/bus
84 * @cmd: sends a non-data command sequence on the SPMI bus.
85 * @read_cmd: sends a register read command sequence on the SPMI bus.
86 * @write_cmd: sends a register write command sequence on the SPMI bus.
87 */
88struct spmi_controller {
89 struct device dev;
90 unsigned int nr;
91 int (*cmd)(struct spmi_controller *ctrl, u8 opcode, u8 sid);
92 int (*read_cmd)(struct spmi_controller *ctrl, u8 opcode,
93 u8 sid, u16 addr, u8 *buf, size_t len);
94 int (*write_cmd)(struct spmi_controller *ctrl, u8 opcode,
95 u8 sid, u16 addr, const u8 *buf, size_t len);
96};
97
98static inline struct spmi_controller *to_spmi_controller(struct device *d)
99{
100 return container_of(d, struct spmi_controller, dev);
101}
102
103static inline
104void *spmi_controller_get_drvdata(const struct spmi_controller *ctrl)
105{
106 return dev_get_drvdata(&ctrl->dev);
107}
108
109static inline void spmi_controller_set_drvdata(struct spmi_controller *ctrl,
110 void *data)
111{
112 dev_set_drvdata(&ctrl->dev, data);
113}
114
115struct spmi_controller *spmi_controller_alloc(struct device *parent,
116 size_t size);
117
118/**
119 * spmi_controller_put() - decrement controller refcount
120 * @ctrl SPMI controller.
121 */
122static inline void spmi_controller_put(struct spmi_controller *ctrl)
123{
124 if (ctrl)
125 put_device(&ctrl->dev);
126}
127
128int spmi_controller_add(struct spmi_controller *ctrl);
129void spmi_controller_remove(struct spmi_controller *ctrl);
130
131/**
132 * struct spmi_driver - SPMI slave device driver
133 * @driver: SPMI device drivers should initialize name and owner field of
134 * this structure.
135 * @probe: binds this driver to a SPMI device.
136 * @remove: unbinds this driver from the SPMI device.
137 * @shutdown: standard shutdown callback used during powerdown/halt.
138 * @suspend: standard suspend callback used during system suspend.
139 * @resume: standard resume callback used during system resume.
140 *
141 * If PM runtime support is desired for a slave, a device driver can call
142 * pm_runtime_put() from their probe() routine (and a balancing
143 * pm_runtime_get() in remove()). PM runtime support for a slave is
144 * implemented by issuing a SLEEP command to the slave on runtime_suspend(),
145 * transitioning the slave into the SLEEP state. On runtime_resume(), a WAKEUP
146 * command is sent to the slave to bring it back to ACTIVE.
147 */
148struct spmi_driver {
149 struct device_driver driver;
150 int (*probe)(struct spmi_device *sdev);
151 void (*remove)(struct spmi_device *sdev);
152};
153
154static inline struct spmi_driver *to_spmi_driver(struct device_driver *d)
155{
156 return container_of(d, struct spmi_driver, driver);
157}
158
159int spmi_driver_register(struct spmi_driver *sdrv);
160
161/**
162 * spmi_driver_unregister() - unregister an SPMI client driver
163 * @sdrv: the driver to unregister
164 */
165static inline void spmi_driver_unregister(struct spmi_driver *sdrv)
166{
167 if (sdrv)
168 driver_unregister(&sdrv->driver);
169}
170
171#define module_spmi_driver(__spmi_driver) \
172 module_driver(__spmi_driver, spmi_driver_register, \
173 spmi_driver_unregister)
174
175int spmi_register_read(struct spmi_device *sdev, u8 addr, u8 *buf);
176int spmi_ext_register_read(struct spmi_device *sdev, u8 addr, u8 *buf,
177 size_t len);
178int spmi_ext_register_readl(struct spmi_device *sdev, u16 addr, u8 *buf,
179 size_t len);
180int spmi_register_write(struct spmi_device *sdev, u8 addr, u8 data);
181int spmi_register_zero_write(struct spmi_device *sdev, u8 data);
182int spmi_ext_register_write(struct spmi_device *sdev, u8 addr,
183 const u8 *buf, size_t len);
184int spmi_ext_register_writel(struct spmi_device *sdev, u16 addr,
185 const u8 *buf, size_t len);
186int spmi_command_reset(struct spmi_device *sdev);
187int spmi_command_sleep(struct spmi_device *sdev);
188int spmi_command_wakeup(struct spmi_device *sdev);
189int spmi_command_shutdown(struct spmi_device *sdev);
190
191#endif
diff --git a/include/linux/ssbi.h b/include/linux/ssbi.h
index bcbb642a7641..087b08a4d333 100644
--- a/include/linux/ssbi.h
+++ b/include/linux/ssbi.h
@@ -20,4 +20,24 @@
20int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len); 20int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len);
21int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len); 21int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len);
22 22
23static inline int
24ssbi_reg_read(void *context, unsigned int reg, unsigned int *val)
25{
26 int ret;
27 u8 v;
28
29 ret = ssbi_read(context, reg, &v, 1);
30 if (!ret)
31 *val = v;
32
33 return ret;
34}
35
36static inline int
37ssbi_reg_write(void *context, unsigned int reg, unsigned int val)
38{
39 u8 v = val;
40 return ssbi_write(context, reg, &v, 1);
41}
42
23#endif 43#endif
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
index 969c0a671dbf..2ca67b55e0fe 100644
--- a/include/linux/sunrpc/bc_xprt.h
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -32,7 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#include <linux/sunrpc/sched.h> 32#include <linux/sunrpc/sched.h>
33 33
34#ifdef CONFIG_SUNRPC_BACKCHANNEL 34#ifdef CONFIG_SUNRPC_BACKCHANNEL
35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); 35struct rpc_rqst *xprt_lookup_bc_request(struct rpc_xprt *xprt, __be32 xid);
36void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied);
36void xprt_free_bc_request(struct rpc_rqst *req); 37void xprt_free_bc_request(struct rpc_rqst *req);
37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); 38int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
38void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs); 39void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 8af2804bab16..70736b98c721 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -130,6 +130,8 @@ struct rpc_create_args {
130#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) 130#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9)
131 131
132struct rpc_clnt *rpc_create(struct rpc_create_args *args); 132struct rpc_clnt *rpc_create(struct rpc_create_args *args);
133struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
134 struct rpc_xprt *xprt);
133struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 135struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
134 const struct rpc_program *, u32); 136 const struct rpc_program *, u32);
135void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); 137void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 62fd1b756e99..2e780134f449 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -22,7 +22,7 @@ struct svc_sock {
22 22
23 /* We keep the old state_change and data_ready CB's here */ 23 /* We keep the old state_change and data_ready CB's here */
24 void (*sk_ostate)(struct sock *); 24 void (*sk_ostate)(struct sock *);
25 void (*sk_odata)(struct sock *, int bytes); 25 void (*sk_odata)(struct sock *);
26 void (*sk_owspace)(struct sock *); 26 void (*sk_owspace)(struct sock *);
27 27
28 /* private TCP part */ 28 /* private TCP part */
@@ -56,6 +56,7 @@ int svc_recv(struct svc_rqst *, long);
56int svc_send(struct svc_rqst *); 56int svc_send(struct svc_rqst *);
57void svc_drop(struct svc_rqst *); 57void svc_drop(struct svc_rqst *);
58void svc_sock_update_bufs(struct svc_serv *serv); 58void svc_sock_update_bufs(struct svc_serv *serv);
59bool svc_alien_sock(struct net *net, int fd);
59int svc_addsock(struct svc_serv *serv, const int fd, 60int svc_addsock(struct svc_serv *serv, const int fd,
60 char *name_return, const size_t len); 61 char *name_return, const size_t len);
61void svc_init_xprt_sock(void); 62void svc_init_xprt_sock(void);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 8097b9df6773..3e5efb2b236e 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -295,13 +295,24 @@ int xprt_adjust_timeout(struct rpc_rqst *req);
295void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); 295void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
296void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 296void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
297void xprt_release(struct rpc_task *task); 297void xprt_release(struct rpc_task *task);
298struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
299void xprt_put(struct rpc_xprt *xprt); 298void xprt_put(struct rpc_xprt *xprt);
300struct rpc_xprt * xprt_alloc(struct net *net, size_t size, 299struct rpc_xprt * xprt_alloc(struct net *net, size_t size,
301 unsigned int num_prealloc, 300 unsigned int num_prealloc,
302 unsigned int max_req); 301 unsigned int max_req);
303void xprt_free(struct rpc_xprt *); 302void xprt_free(struct rpc_xprt *);
304 303
304/**
305 * xprt_get - return a reference to an RPC transport.
306 * @xprt: pointer to the transport
307 *
308 */
309static inline struct rpc_xprt *xprt_get(struct rpc_xprt *xprt)
310{
311 if (atomic_inc_not_zero(&xprt->count))
312 return xprt;
313 return NULL;
314}
315
305static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) 316static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
306{ 317{
307 return p + xprt->tsh_size; 318 return p + xprt->tsh_size;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 46ba0c6c219f..350711560753 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -260,6 +260,42 @@ struct swap_list_t {
260 int next; /* swapfile to be used next */ 260 int next; /* swapfile to be used next */
261}; 261};
262 262
263/* linux/mm/workingset.c */
264void *workingset_eviction(struct address_space *mapping, struct page *page);
265bool workingset_refault(void *shadow);
266void workingset_activation(struct page *page);
267extern struct list_lru workingset_shadow_nodes;
268
269static inline unsigned int workingset_node_pages(struct radix_tree_node *node)
270{
271 return node->count & RADIX_TREE_COUNT_MASK;
272}
273
274static inline void workingset_node_pages_inc(struct radix_tree_node *node)
275{
276 node->count++;
277}
278
279static inline void workingset_node_pages_dec(struct radix_tree_node *node)
280{
281 node->count--;
282}
283
284static inline unsigned int workingset_node_shadows(struct radix_tree_node *node)
285{
286 return node->count >> RADIX_TREE_COUNT_SHIFT;
287}
288
289static inline void workingset_node_shadows_inc(struct radix_tree_node *node)
290{
291 node->count += 1U << RADIX_TREE_COUNT_SHIFT;
292}
293
294static inline void workingset_node_shadows_dec(struct radix_tree_node *node)
295{
296 node->count -= 1U << RADIX_TREE_COUNT_SHIFT;
297}
298
263/* linux/mm/page_alloc.c */ 299/* linux/mm/page_alloc.c */
264extern unsigned long totalram_pages; 300extern unsigned long totalram_pages;
265extern unsigned long totalreserve_pages; 301extern unsigned long totalreserve_pages;
diff --git a/include/linux/sxgbe_platform.h b/include/linux/sxgbe_platform.h
new file mode 100644
index 000000000000..a62442cf0037
--- /dev/null
+++ b/include/linux/sxgbe_platform.h
@@ -0,0 +1,54 @@
1/*
2 * 10G controller driver for Samsung EXYNOS SoCs
3 *
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Author: Siva Reddy Kallam <siva.kallam@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#ifndef __SXGBE_PLATFORM_H__
14#define __SXGBE_PLATFORM_H__
15
16/* MDC Clock Selection define*/
17#define SXGBE_CSR_100_150M 0x0 /* MDC = clk_scr_i/62 */
18#define SXGBE_CSR_150_250M 0x1 /* MDC = clk_scr_i/102 */
19#define SXGBE_CSR_250_300M 0x2 /* MDC = clk_scr_i/122 */
20#define SXGBE_CSR_300_350M 0x3 /* MDC = clk_scr_i/142 */
21#define SXGBE_CSR_350_400M 0x4 /* MDC = clk_scr_i/162 */
22#define SXGBE_CSR_400_500M 0x5 /* MDC = clk_scr_i/202 */
23
24/* Platfrom data for platform device structure's
25 * platform_data field
26 */
27struct sxgbe_mdio_bus_data {
28 unsigned int phy_mask;
29 int *irqs;
30 int probed_phy_irq;
31};
32
33struct sxgbe_dma_cfg {
34 int pbl;
35 int fixed_burst;
36 int burst_map;
37 int adv_addr_mode;
38};
39
40struct sxgbe_plat_data {
41 char *phy_bus_name;
42 int bus_id;
43 int phy_addr;
44 int interface;
45 struct sxgbe_mdio_bus_data *mdio_bus_data;
46 struct sxgbe_dma_cfg *dma_cfg;
47 int clk_csr;
48 int pmt;
49 int force_sf_dma_mode;
50 int force_thresh_dma_mode;
51 int riwt_off;
52};
53
54#endif /* __SXGBE_PLATFORM_H__ */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 1e67b7a5968c..a4a0588c5397 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -119,8 +119,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
119 static struct syscall_metadata __syscall_meta_##sname; \ 119 static struct syscall_metadata __syscall_meta_##sname; \
120 static struct ftrace_event_call __used \ 120 static struct ftrace_event_call __used \
121 event_enter_##sname = { \ 121 event_enter_##sname = { \
122 .name = "sys_enter"#sname, \
123 .class = &event_class_syscall_enter, \ 122 .class = &event_class_syscall_enter, \
123 { \
124 .name = "sys_enter"#sname, \
125 }, \
124 .event.funcs = &enter_syscall_print_funcs, \ 126 .event.funcs = &enter_syscall_print_funcs, \
125 .data = (void *)&__syscall_meta_##sname,\ 127 .data = (void *)&__syscall_meta_##sname,\
126 .flags = TRACE_EVENT_FL_CAP_ANY, \ 128 .flags = TRACE_EVENT_FL_CAP_ANY, \
@@ -133,8 +135,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
133 static struct syscall_metadata __syscall_meta_##sname; \ 135 static struct syscall_metadata __syscall_meta_##sname; \
134 static struct ftrace_event_call __used \ 136 static struct ftrace_event_call __used \
135 event_exit_##sname = { \ 137 event_exit_##sname = { \
136 .name = "sys_exit"#sname, \
137 .class = &event_class_syscall_exit, \ 138 .class = &event_class_syscall_exit, \
139 { \
140 .name = "sys_exit"#sname, \
141 }, \
138 .event.funcs = &exit_syscall_print_funcs, \ 142 .event.funcs = &exit_syscall_print_funcs, \
139 .data = (void *)&__syscall_meta_##sname,\ 143 .data = (void *)&__syscall_meta_##sname,\
140 .flags = TRACE_EVENT_FL_CAP_ANY, \ 144 .flags = TRACE_EVENT_FL_CAP_ANY, \
@@ -200,6 +204,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
200 } \ 204 } \
201 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 205 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
202 206
207asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
208 qid_t id, void __user *addr);
203asmlinkage long sys_time(time_t __user *tloc); 209asmlinkage long sys_time(time_t __user *tloc);
204asmlinkage long sys_stime(time_t __user *tptr); 210asmlinkage long sys_stime(time_t __user *tptr);
205asmlinkage long sys_gettimeofday(struct timeval __user *tv, 211asmlinkage long sys_gettimeofday(struct timeval __user *tv,
@@ -746,6 +752,9 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
746 int newdfd, const char __user *newname, int flags); 752 int newdfd, const char __user *newname, int flags);
747asmlinkage long sys_renameat(int olddfd, const char __user * oldname, 753asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
748 int newdfd, const char __user * newname); 754 int newdfd, const char __user * newname);
755asmlinkage long sys_renameat2(int olddfd, const char __user *oldname,
756 int newdfd, const char __user *newname,
757 unsigned int flags);
749asmlinkage long sys_futimesat(int dfd, const char __user *filename, 758asmlinkage long sys_futimesat(int dfd, const char __user *filename,
750 struct timeval __user *utimes); 759 struct timeval __user *utimes);
751asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 760asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 30b2ebee6439..084354b0e814 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -71,7 +71,8 @@ struct attribute_group {
71 */ 71 */
72 72
73#define __ATTR(_name, _mode, _show, _store) { \ 73#define __ATTR(_name, _mode, _show, _store) { \
74 .attr = {.name = __stringify(_name), .mode = _mode }, \ 74 .attr = {.name = __stringify(_name), \
75 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
75 .show = _show, \ 76 .show = _show, \
76 .store = _store, \ 77 .store = _store, \
77} 78}
@@ -198,6 +199,7 @@ int __must_check sysfs_chmod_file(struct kobject *kobj,
198 const struct attribute *attr, umode_t mode); 199 const struct attribute *attr, umode_t mode);
199void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, 200void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
200 const void *ns); 201 const void *ns);
202bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
201void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 203void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
202 204
203int __must_check sysfs_create_bin_file(struct kobject *kobj, 205int __must_check sysfs_create_bin_file(struct kobject *kobj,
@@ -246,6 +248,11 @@ void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
246 248
247int __must_check sysfs_init(void); 249int __must_check sysfs_init(void);
248 250
251static inline void sysfs_enable_ns(struct kernfs_node *kn)
252{
253 return kernfs_enable_ns(kn);
254}
255
249#else /* CONFIG_SYSFS */ 256#else /* CONFIG_SYSFS */
250 257
251static inline int sysfs_schedule_callback(struct kobject *kobj, 258static inline int sysfs_schedule_callback(struct kobject *kobj,
@@ -301,6 +308,12 @@ static inline void sysfs_remove_file_ns(struct kobject *kobj,
301{ 308{
302} 309}
303 310
311static inline bool sysfs_remove_file_self(struct kobject *kobj,
312 const struct attribute *attr)
313{
314 return false;
315}
316
304static inline void sysfs_remove_files(struct kobject *kobj, 317static inline void sysfs_remove_files(struct kobject *kobj,
305 const struct attribute **attr) 318 const struct attribute **attr)
306{ 319{
@@ -418,6 +431,10 @@ static inline int __must_check sysfs_init(void)
418 return 0; 431 return 0;
419} 432}
420 433
434static inline void sysfs_enable_ns(struct kernfs_node *kn)
435{
436}
437
421#endif /* CONFIG_SYSFS */ 438#endif /* CONFIG_SYSFS */
422 439
423static inline int __must_check sysfs_create_file(struct kobject *kobj, 440static inline int __must_check sysfs_create_file(struct kobject *kobj,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 4ad0706d40eb..239946868142 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -201,10 +201,10 @@ struct tcp_sock {
201 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 201 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
202 202
203/* RTT measurement */ 203/* RTT measurement */
204 u32 srtt; /* smoothed round trip time << 3 */ 204 u32 srtt_us; /* smoothed round trip time << 3 in usecs */
205 u32 mdev; /* medium deviation */ 205 u32 mdev_us; /* medium deviation */
206 u32 mdev_max; /* maximal mdev for the last rtt period */ 206 u32 mdev_max_us; /* maximal mdev for the last rtt period */
207 u32 rttvar; /* smoothed mdev_max */ 207 u32 rttvar_us; /* smoothed mdev_max */
208 u32 rtt_seq; /* sequence number to update rttvar */ 208 u32 rtt_seq; /* sequence number to update rttvar */
209 209
210 u32 packets_out; /* Packets which are "in flight" */ 210 u32 packets_out; /* Packets which are "in flight" */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 12ae6ce997d6..7062330a1329 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -188,7 +188,7 @@ DECLARE_PER_CPU(int, numa_node);
188/* Returns the number of the current Node. */ 188/* Returns the number of the current Node. */
189static inline int numa_node_id(void) 189static inline int numa_node_id(void)
190{ 190{
191 return __this_cpu_read(numa_node); 191 return raw_cpu_read(numa_node);
192} 192}
193#endif 193#endif
194 194
@@ -245,7 +245,7 @@ static inline void set_numa_mem(int node)
245/* Returns the number of the nearest Node with memory */ 245/* Returns the number of the nearest Node with memory */
246static inline int numa_mem_id(void) 246static inline int numa_mem_id(void)
247{ 247{
248 return __this_cpu_read(_numa_mem_); 248 return raw_cpu_read(_numa_mem_);
249} 249}
250#endif 250#endif
251 251
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 7159a0a933df..9d30ee469c2a 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * See Documentation/trace/tracepoints.txt. 7 * See Documentation/trace/tracepoints.txt.
8 * 8 *
9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> 9 * Copyright (C) 2008-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 * 10 *
11 * Heavily inspired from the Linux Kernel Markers. 11 * Heavily inspired from the Linux Kernel Markers.
12 * 12 *
@@ -21,6 +21,7 @@
21 21
22struct module; 22struct module;
23struct tracepoint; 23struct tracepoint;
24struct notifier_block;
24 25
25struct tracepoint_func { 26struct tracepoint_func {
26 void *func; 27 void *func;
@@ -35,51 +36,40 @@ struct tracepoint {
35 struct tracepoint_func __rcu *funcs; 36 struct tracepoint_func __rcu *funcs;
36}; 37};
37 38
38/*
39 * Connect a probe to a tracepoint.
40 * Internal API, should not be used directly.
41 */
42extern int tracepoint_probe_register(const char *name, void *probe, void *data);
43
44/*
45 * Disconnect a probe from a tracepoint.
46 * Internal API, should not be used directly.
47 */
48extern int 39extern int
49tracepoint_probe_unregister(const char *name, void *probe, void *data); 40tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data);
50 41extern int
51extern int tracepoint_probe_register_noupdate(const char *name, void *probe, 42tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data);
52 void *data); 43extern void
53extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe, 44for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv),
54 void *data); 45 void *priv);
55extern void tracepoint_probe_update_all(void);
56 46
57#ifdef CONFIG_MODULES 47#ifdef CONFIG_MODULES
58struct tp_module { 48struct tp_module {
59 struct list_head list; 49 struct list_head list;
60 unsigned int num_tracepoints; 50 struct module *mod;
61 struct tracepoint * const *tracepoints_ptrs;
62}; 51};
52
63bool trace_module_has_bad_taint(struct module *mod); 53bool trace_module_has_bad_taint(struct module *mod);
54extern int register_tracepoint_module_notifier(struct notifier_block *nb);
55extern int unregister_tracepoint_module_notifier(struct notifier_block *nb);
64#else 56#else
65static inline bool trace_module_has_bad_taint(struct module *mod) 57static inline bool trace_module_has_bad_taint(struct module *mod)
66{ 58{
67 return false; 59 return false;
68} 60}
61static inline
62int register_tracepoint_module_notifier(struct notifier_block *nb)
63{
64 return 0;
65}
66static inline
67int unregister_tracepoint_module_notifier(struct notifier_block *nb)
68{
69 return 0;
70}
69#endif /* CONFIG_MODULES */ 71#endif /* CONFIG_MODULES */
70 72
71struct tracepoint_iter {
72#ifdef CONFIG_MODULES
73 struct tp_module *module;
74#endif /* CONFIG_MODULES */
75 struct tracepoint * const *tracepoint;
76};
77
78extern void tracepoint_iter_start(struct tracepoint_iter *iter);
79extern void tracepoint_iter_next(struct tracepoint_iter *iter);
80extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
81extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
82
83/* 73/*
84 * tracepoint_synchronize_unregister must be called between the last tracepoint 74 * tracepoint_synchronize_unregister must be called between the last tracepoint
85 * probe unregistration and the end of module exit to make sure there is no 75 * probe unregistration and the end of module exit to make sure there is no
@@ -90,6 +80,11 @@ static inline void tracepoint_synchronize_unregister(void)
90 synchronize_sched(); 80 synchronize_sched();
91} 81}
92 82
83#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
84extern void syscall_regfunc(void);
85extern void syscall_unregfunc(void);
86#endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */
87
93#define PARAMS(args...) args 88#define PARAMS(args...) args
94 89
95#endif /* _LINUX_TRACEPOINT_H */ 90#endif /* _LINUX_TRACEPOINT_H */
@@ -178,14 +173,14 @@ static inline void tracepoint_synchronize_unregister(void)
178 static inline int \ 173 static inline int \
179 register_trace_##name(void (*probe)(data_proto), void *data) \ 174 register_trace_##name(void (*probe)(data_proto), void *data) \
180 { \ 175 { \
181 return tracepoint_probe_register(#name, (void *)probe, \ 176 return tracepoint_probe_register(&__tracepoint_##name, \
182 data); \ 177 (void *)probe, data); \
183 } \ 178 } \
184 static inline int \ 179 static inline int \
185 unregister_trace_##name(void (*probe)(data_proto), void *data) \ 180 unregister_trace_##name(void (*probe)(data_proto), void *data) \
186 { \ 181 { \
187 return tracepoint_probe_unregister(#name, (void *)probe, \ 182 return tracepoint_probe_unregister(&__tracepoint_##name,\
188 data); \ 183 (void *)probe, data); \
189 } \ 184 } \
190 static inline void \ 185 static inline void \
191 check_trace_callback_type_##name(void (*cb)(data_proto)) \ 186 check_trace_callback_type_##name(void (*cb)(data_proto)) \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 90b4fdc8a61f..1c3316a47d7e 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -208,7 +208,7 @@ struct tty_port {
208 wait_queue_head_t delta_msr_wait; /* Modem status change */ 208 wait_queue_head_t delta_msr_wait; /* Modem status change */
209 unsigned long flags; /* TTY flags ASY_*/ 209 unsigned long flags; /* TTY flags ASY_*/
210 unsigned char console:1, /* port is a console */ 210 unsigned char console:1, /* port is a console */
211 low_latency:1; /* direct buffer flush */ 211 low_latency:1; /* optional: tune for latency */
212 struct mutex mutex; /* Locking */ 212 struct mutex mutex; /* Locking */
213 struct mutex buf_mutex; /* Buffer alloc lock */ 213 struct mutex buf_mutex; /* Buffer alloc lock */
214 unsigned char *xmit_buf; /* Optional buffer */ 214 unsigned char *xmit_buf; /* Optional buffer */
@@ -518,9 +518,9 @@ extern void tty_port_put(struct tty_port *port);
518 518
519static inline struct tty_port *tty_port_get(struct tty_port *port) 519static inline struct tty_port *tty_port_get(struct tty_port *port)
520{ 520{
521 if (port) 521 if (port && kref_get_unless_zero(&port->kref))
522 kref_get(&port->kref); 522 return port;
523 return port; 523 return NULL;
524} 524}
525 525
526/* If the cts flow control is enabled, return true. */ 526/* If the cts flow control is enabled, return true. */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index b8347c207cb8..add26da2faeb 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -126,7 +126,6 @@
126 126
127#include <linux/fs.h> 127#include <linux/fs.h>
128#include <linux/wait.h> 128#include <linux/wait.h>
129#include <linux/wait.h>
130 129
131 130
132/* 131/*
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index 7bfabd20204c..4b4439e75f45 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -27,8 +27,8 @@
27 * (On UP, there is no seqcount_t protection, a reader allowing interrupts could 27 * (On UP, there is no seqcount_t protection, a reader allowing interrupts could
28 * read partial values) 28 * read partial values)
29 * 29 *
30 * 7) For softirq uses, readers can use u64_stats_fetch_begin_bh() and 30 * 7) For irq and softirq uses, readers can use u64_stats_fetch_begin_irq() and
31 * u64_stats_fetch_retry_bh() helpers 31 * u64_stats_fetch_retry_irq() helpers
32 * 32 *
33 * Usage : 33 * Usage :
34 * 34 *
@@ -114,31 +114,31 @@ static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
114} 114}
115 115
116/* 116/*
117 * In case softirq handlers can update u64 counters, readers can use following helpers 117 * In case irq handlers can update u64 counters, readers can use following helpers
118 * - SMP 32bit arches use seqcount protection, irq safe. 118 * - SMP 32bit arches use seqcount protection, irq safe.
119 * - UP 32bit must disable BH. 119 * - UP 32bit must disable irqs.
120 * - 64bit have no problem atomically reading u64 values, irq safe. 120 * - 64bit have no problem atomically reading u64 values, irq safe.
121 */ 121 */
122static inline unsigned int u64_stats_fetch_begin_bh(const struct u64_stats_sync *syncp) 122static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp)
123{ 123{
124#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 124#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
125 return read_seqcount_begin(&syncp->seq); 125 return read_seqcount_begin(&syncp->seq);
126#else 126#else
127#if BITS_PER_LONG==32 127#if BITS_PER_LONG==32
128 local_bh_disable(); 128 local_irq_disable();
129#endif 129#endif
130 return 0; 130 return 0;
131#endif 131#endif
132} 132}
133 133
134static inline bool u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp, 134static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp,
135 unsigned int start) 135 unsigned int start)
136{ 136{
137#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 137#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
138 return read_seqcount_retry(&syncp->seq, start); 138 return read_seqcount_retry(&syncp->seq, start);
139#else 139#else
140#if BITS_PER_LONG==32 140#if BITS_PER_LONG==32
141 local_bh_enable(); 141 local_irq_enable();
142#endif 142#endif
143 return false; 143 return false;
144#endif 144#endif
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 0a4487d3fb1e..0994c0d01a09 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -20,6 +20,8 @@
20 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> 20 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
21 * 21 *
22 * Changes/Revisions: 22 * Changes/Revisions:
23 * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
24 * - add UI_GET_SYSNAME ioctl
23 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>) 25 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
24 * - update ff support for the changes in kernel interface 26 * - update ff support for the changes in kernel interface
25 * - add UINPUT_VERSION 27 * - add UINPUT_VERSION
diff --git a/include/linux/uio.h b/include/linux/uio.h
index c55ce243cc09..199bcc34241b 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -9,14 +9,23 @@
9#ifndef __LINUX_UIO_H 9#ifndef __LINUX_UIO_H
10#define __LINUX_UIO_H 10#define __LINUX_UIO_H
11 11
12#include <linux/kernel.h>
12#include <uapi/linux/uio.h> 13#include <uapi/linux/uio.h>
13 14
15struct page;
14 16
15struct kvec { 17struct kvec {
16 void *iov_base; /* and that should *never* hold a userland pointer */ 18 void *iov_base; /* and that should *never* hold a userland pointer */
17 size_t iov_len; 19 size_t iov_len;
18}; 20};
19 21
22struct iov_iter {
23 const struct iovec *iov;
24 unsigned long nr_segs;
25 size_t iov_offset;
26 size_t count;
27};
28
20/* 29/*
21 * Total number of bytes covered by an iovec. 30 * Total number of bytes covered by an iovec.
22 * 31 *
@@ -34,8 +43,51 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
34 return ret; 43 return ret;
35} 44}
36 45
46static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
47{
48 return (struct iovec) {
49 .iov_base = iter->iov->iov_base + iter->iov_offset,
50 .iov_len = min(iter->count,
51 iter->iov->iov_len - iter->iov_offset),
52 };
53}
54
55#define iov_for_each(iov, iter, start) \
56 for (iter = (start); \
57 (iter).count && \
58 ((iov = iov_iter_iovec(&(iter))), 1); \
59 iov_iter_advance(&(iter), (iov).iov_len))
60
37unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); 61unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
38 62
63size_t iov_iter_copy_from_user_atomic(struct page *page,
64 struct iov_iter *i, unsigned long offset, size_t bytes);
65size_t iov_iter_copy_from_user(struct page *page,
66 struct iov_iter *i, unsigned long offset, size_t bytes);
67void iov_iter_advance(struct iov_iter *i, size_t bytes);
68int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
69size_t iov_iter_single_seg_count(const struct iov_iter *i);
70size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
71 struct iov_iter *i);
72
73static inline void iov_iter_init(struct iov_iter *i,
74 const struct iovec *iov, unsigned long nr_segs,
75 size_t count, size_t written)
76{
77 i->iov = iov;
78 i->nr_segs = nr_segs;
79 i->iov_offset = 0;
80 i->count = count + written;
81
82 iov_iter_advance(i, written);
83}
84
85static inline size_t iov_iter_count(struct iov_iter *i)
86{
87 return i->count;
88}
89
39int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 90int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
40int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); 91int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len);
92
41#endif 93#endif
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index e32251e00e62..edff2b97b864 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -126,6 +126,7 @@ extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
126extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); 126extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
127extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 127extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
128extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs); 128extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
129extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
129#else /* !CONFIG_UPROBES */ 130#else /* !CONFIG_UPROBES */
130struct uprobes_state { 131struct uprobes_state {
131}; 132};
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7f6eb859873e..6b7ec376fb4d 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -57,6 +57,7 @@ struct ep_device;
57 * @extra: descriptors following this endpoint in the configuration 57 * @extra: descriptors following this endpoint in the configuration
58 * @extralen: how many bytes of "extra" are valid 58 * @extralen: how many bytes of "extra" are valid
59 * @enabled: URBs may be submitted to this endpoint 59 * @enabled: URBs may be submitted to this endpoint
60 * @streams: number of USB-3 streams allocated on the endpoint
60 * 61 *
61 * USB requests are always queued to a given endpoint, identified by a 62 * USB requests are always queued to a given endpoint, identified by a
62 * descriptor within an active interface in a given USB configuration. 63 * descriptor within an active interface in a given USB configuration.
@@ -71,6 +72,7 @@ struct usb_host_endpoint {
71 unsigned char *extra; /* Extra descriptors */ 72 unsigned char *extra; /* Extra descriptors */
72 int extralen; 73 int extralen;
73 int enabled; 74 int enabled;
75 int streams;
74}; 76};
75 77
76/* host-side wrapper for one interface setting's parsed descriptors */ 78/* host-side wrapper for one interface setting's parsed descriptors */
@@ -202,6 +204,8 @@ static inline void usb_set_intfdata(struct usb_interface *intf, void *data)
202struct usb_interface *usb_get_intf(struct usb_interface *intf); 204struct usb_interface *usb_get_intf(struct usb_interface *intf);
203void usb_put_intf(struct usb_interface *intf); 205void usb_put_intf(struct usb_interface *intf);
204 206
207/* Hard limit */
208#define USB_MAXENDPOINTS 30
205/* this maximum is arbitrary */ 209/* this maximum is arbitrary */
206#define USB_MAXINTERFACES 32 210#define USB_MAXINTERFACES 32
207#define USB_MAXIADS (USB_MAXINTERFACES/2) 211#define USB_MAXIADS (USB_MAXINTERFACES/2)
@@ -366,6 +370,8 @@ struct usb_bus {
366#endif 370#endif
367}; 371};
368 372
373struct usb_dev_state;
374
369/* ----------------------------------------------------------------------- */ 375/* ----------------------------------------------------------------------- */
370 376
371struct usb_tt; 377struct usb_tt;
@@ -749,6 +755,11 @@ extern struct usb_host_interface *usb_find_alt_setting(
749 unsigned int iface_num, 755 unsigned int iface_num,
750 unsigned int alt_num); 756 unsigned int alt_num);
751 757
758/* port claiming functions */
759int usb_hub_claim_port(struct usb_device *hdev, unsigned port1,
760 struct usb_dev_state *owner);
761int usb_hub_release_port(struct usb_device *hdev, unsigned port1,
762 struct usb_dev_state *owner);
752 763
753/** 764/**
754 * usb_make_path - returns stable device path in the usb tree 765 * usb_make_path - returns stable device path in the usb tree
@@ -1666,6 +1677,10 @@ extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr);
1666/* this request isn't really synchronous, but it belongs with the others */ 1677/* this request isn't really synchronous, but it belongs with the others */
1667extern int usb_driver_set_configuration(struct usb_device *udev, int config); 1678extern int usb_driver_set_configuration(struct usb_device *udev, int config);
1668 1679
1680/* choose and set configuration for device */
1681extern int usb_choose_configuration(struct usb_device *udev);
1682extern int usb_set_configuration(struct usb_device *dev, int configuration);
1683
1669/* 1684/*
1670 * timeouts, in milliseconds, used for sending/receiving control messages 1685 * timeouts, in milliseconds, used for sending/receiving control messages
1671 * they typically complete within a few frames (msec) after they're issued 1686 * they typically complete within a few frames (msec) after they're issued
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 2c14d9cdd57a..44b38b92236a 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -94,6 +94,7 @@ struct cdc_ncm_ctx {
94 94
95 const struct usb_cdc_ncm_desc *func_desc; 95 const struct usb_cdc_ncm_desc *func_desc;
96 const struct usb_cdc_mbim_desc *mbim_desc; 96 const struct usb_cdc_mbim_desc *mbim_desc;
97 const struct usb_cdc_mbim_extended_desc *mbim_extended_desc;
97 const struct usb_cdc_ether_desc *ether_desc; 98 const struct usb_cdc_ether_desc *ether_desc;
98 99
99 struct usb_interface *control; 100 struct usb_interface *control;
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 708bd119627f..bbe779f640be 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -25,6 +25,7 @@ struct ci_hdrc_platform_data {
25 */ 25 */
26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) 26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
27#define CI_HDRC_IMX28_WRITE_FIX BIT(5) 27#define CI_HDRC_IMX28_WRITE_FIX BIT(5)
28#define CI_HDRC_FORCE_FULLSPEED BIT(6)
28 enum usb_dr_mode dr_mode; 29 enum usb_dr_mode dr_mode;
29#define CI_HDRC_CONTROLLER_RESET_EVENT 0 30#define CI_HDRC_CONTROLLER_RESET_EVENT 0
30#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 31#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index dba63f53906c..d3ca3b53837c 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -92,7 +92,7 @@ struct usb_configuration;
92 * @suspend: Notifies functions when the host stops sending USB traffic. 92 * @suspend: Notifies functions when the host stops sending USB traffic.
93 * @resume: Notifies functions when the host restarts USB traffic. 93 * @resume: Notifies functions when the host restarts USB traffic.
94 * @get_status: Returns function status as a reply to 94 * @get_status: Returns function status as a reply to
95 * GetStatus() request when the recepient is Interface. 95 * GetStatus() request when the recipient is Interface.
96 * @func_suspend: callback to be called when 96 * @func_suspend: callback to be called when
97 * SetFeature(FUNCTION_SUSPEND) is reseived 97 * SetFeature(FUNCTION_SUSPEND) is reseived
98 * 98 *
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index efe8d8a7c7ad..485cd5e2100c 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -143,6 +143,7 @@ struct usb_hcd {
143 unsigned authorized_default:1; 143 unsigned authorized_default:1;
144 unsigned has_tt:1; /* Integrated TT in root hub */ 144 unsigned has_tt:1; /* Integrated TT in root hub */
145 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ 145 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
146 unsigned can_do_streams:1; /* HC supports streams */
146 147
147 unsigned int irq; /* irq allocated */ 148 unsigned int irq; /* irq allocated */
148 void __iomem *regs; /* device memory/io */ 149 void __iomem *regs; /* device memory/io */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 6c0b1c513db7..353053a33f21 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -111,6 +111,13 @@ struct usb_phy {
111 int (*set_suspend)(struct usb_phy *x, 111 int (*set_suspend)(struct usb_phy *x,
112 int suspend); 112 int suspend);
113 113
114 /*
115 * Set wakeup enable for PHY, in that case, the PHY can be
116 * woken up from suspend status due to external events,
117 * like vbus change, dp/dm change and id.
118 */
119 int (*set_wakeup)(struct usb_phy *x, bool enabled);
120
114 /* notify phy connect status change */ 121 /* notify phy connect status change */
115 int (*notify_connect)(struct usb_phy *x, 122 int (*notify_connect)(struct usb_phy *x,
116 enum usb_device_speed speed); 123 enum usb_device_speed speed);
@@ -265,6 +272,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
265} 272}
266 273
267static inline int 274static inline int
275usb_phy_set_wakeup(struct usb_phy *x, bool enabled)
276{
277 if (x && x->set_wakeup)
278 return x->set_wakeup(x, enabled);
279 else
280 return 0;
281}
282
283static inline int
268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) 284usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
269{ 285{
270 if (x && x->notify_connect) 286 if (x && x->notify_connect)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 704a1ab8240c..9bb547c7bce7 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -190,7 +190,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
190 * @num_ports: the number of different ports this device will have. 190 * @num_ports: the number of different ports this device will have.
191 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer 191 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
192 * (0 = end-point size) 192 * (0 = end-point size)
193 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) 193 * @bulk_out_size: minimum number of bytes to allocate for bulk-out buffer
194 * (0 = end-point size)
194 * @calc_num_ports: pointer to a function to determine how many ports this 195 * @calc_num_ports: pointer to a function to determine how many ports this
195 * device has dynamically. It will be called after the probe() 196 * device has dynamically. It will be called after the probe()
196 * callback is called, but before attach() 197 * callback is called, but before attach()
diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h
index 5499ab5c94bd..3fc8e8b9f043 100644
--- a/include/linux/usb/uas.h
+++ b/include/linux/usb/uas.h
@@ -9,7 +9,7 @@ struct iu {
9 __u8 iu_id; 9 __u8 iu_id;
10 __u8 rsvd1; 10 __u8 rsvd1;
11 __be16 tag; 11 __be16 tag;
12}; 12} __attribute__((__packed__));
13 13
14enum { 14enum {
15 IU_ID_COMMAND = 0x01, 15 IU_ID_COMMAND = 0x01,
@@ -52,7 +52,7 @@ struct command_iu {
52 __u8 rsvd7; 52 __u8 rsvd7;
53 struct scsi_lun lun; 53 struct scsi_lun lun;
54 __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */ 54 __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */
55}; 55} __attribute__((__packed__));
56 56
57struct task_mgmt_iu { 57struct task_mgmt_iu {
58 __u8 iu_id; 58 __u8 iu_id;
@@ -62,7 +62,7 @@ struct task_mgmt_iu {
62 __u8 rsvd2; 62 __u8 rsvd2;
63 __be16 task_tag; 63 __be16 task_tag;
64 struct scsi_lun lun; 64 struct scsi_lun lun;
65}; 65} __attribute__((__packed__));
66 66
67/* 67/*
68 * Also used for the Read Ready and Write Ready IUs since they have the 68 * Also used for the Read Ready and Write Ready IUs since they have the
@@ -77,15 +77,15 @@ struct sense_iu {
77 __u8 rsvd7[7]; 77 __u8 rsvd7[7];
78 __be16 len; 78 __be16 len;
79 __u8 sense[SCSI_SENSE_BUFFERSIZE]; 79 __u8 sense[SCSI_SENSE_BUFFERSIZE];
80}; 80} __attribute__((__packed__));
81 81
82struct response_ui { 82struct response_iu {
83 __u8 iu_id; 83 __u8 iu_id;
84 __u8 rsvd1; 84 __u8 rsvd1;
85 __be16 tag; 85 __be16 tag;
86 __be16 add_response_info; 86 __u8 add_response_info[3];
87 __u8 response_code; 87 __u8 response_code;
88}; 88} __attribute__((__packed__));
89 89
90struct usb_pipe_usage_descriptor { 90struct usb_pipe_usage_descriptor {
91 __u8 bLength; 91 __u8 bLength;
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 630356866030..1a64b26046ed 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -67,8 +67,10 @@
67 /* Initial READ(10) (and others) must be retried */ \ 67 /* Initial READ(10) (and others) must be retried */ \
68 US_FLAG(WRITE_CACHE, 0x00200000) \ 68 US_FLAG(WRITE_CACHE, 0x00200000) \
69 /* Write Cache status is not available */ \ 69 /* Write Cache status is not available */ \
70 US_FLAG(NEEDS_CAP16, 0x00400000) 70 US_FLAG(NEEDS_CAP16, 0x00400000) \
71 /* cannot handle READ_CAPACITY_10 */ 71 /* cannot handle READ_CAPACITY_10 */ \
72 US_FLAG(IGNORE_UAS, 0x00800000) \
73 /* Device advertises UAS but it is broken */
72 74
73#define US_FLAG(name, value) US_FL_##name = value , 75#define US_FLAG(name, value) US_FL_##name = value ,
74enum { US_DO_ALL_FLAGS }; 76enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 24579a0312a0..81022a52bc34 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -96,5 +96,7 @@ extern void vfio_unregister_iommu_driver(
96extern struct vfio_group *vfio_group_get_external_user(struct file *filep); 96extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
97extern void vfio_group_put_external_user(struct vfio_group *group); 97extern void vfio_group_put_external_user(struct vfio_group *group);
98extern int vfio_external_user_iommu_id(struct vfio_group *group); 98extern int vfio_external_user_iommu_id(struct vfio_group *group);
99extern long vfio_external_check_extension(struct vfio_group *group,
100 unsigned long arg);
99 101
100#endif /* VFIO_H */ 102#endif /* VFIO_H */
diff --git a/include/linux/video_output.h b/include/linux/video_output.h
deleted file mode 100644
index ed5cdeb3604d..000000000000
--- a/include/linux/video_output.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 *
3 * Copyright (C) 2006 Luming Yu <luming.yu@intel.com>
4 *
5 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 (at
10 * your option) any later version.
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 along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 */
23#ifndef _LINUX_VIDEO_OUTPUT_H
24#define _LINUX_VIDEO_OUTPUT_H
25#include <linux/device.h>
26#include <linux/err.h>
27struct output_device;
28struct output_properties {
29 int (*set_state)(struct output_device *);
30 int (*get_status)(struct output_device *);
31};
32struct output_device {
33 int request_state;
34 struct output_properties *props;
35 struct device dev;
36};
37#define to_output_device(obj) container_of(obj, struct output_device, dev)
38#if defined(CONFIG_VIDEO_OUTPUT_CONTROL) || defined(CONFIG_VIDEO_OUTPUT_CONTROL_MODULE)
39struct output_device *video_output_register(const char *name,
40 struct device *dev,
41 void *devdata,
42 struct output_properties *op);
43void video_output_unregister(struct output_device *dev);
44#else
45static struct output_device *video_output_register(const char *name,
46 struct device *dev,
47 void *devdata,
48 struct output_properties *op)
49{
50 return ERR_PTR(-ENODEV);
51}
52static void video_output_unregister(struct output_device *dev)
53{
54 return;
55}
56#endif
57#endif
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 3a712e2e7d76..486c3972c0be 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -37,6 +37,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
37 PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL, 37 PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, 38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
39 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 39 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
40 DROP_PAGECACHE, DROP_SLAB,
40#ifdef CONFIG_NUMA_BALANCING 41#ifdef CONFIG_NUMA_BALANCING
41 NUMA_PTE_UPDATES, 42 NUMA_PTE_UPDATES,
42 NUMA_HUGE_PTE_UPDATES, 43 NUMA_HUGE_PTE_UPDATES,
diff --git a/include/linux/vmacache.h b/include/linux/vmacache.h
new file mode 100644
index 000000000000..c3fa0fd43949
--- /dev/null
+++ b/include/linux/vmacache.h
@@ -0,0 +1,38 @@
1#ifndef __LINUX_VMACACHE_H
2#define __LINUX_VMACACHE_H
3
4#include <linux/sched.h>
5#include <linux/mm.h>
6
7/*
8 * Hash based on the page number. Provides a good hit rate for
9 * workloads with good locality and those with random accesses as well.
10 */
11#define VMACACHE_HASH(addr) ((addr >> PAGE_SHIFT) & VMACACHE_MASK)
12
13static inline void vmacache_flush(struct task_struct *tsk)
14{
15 memset(tsk->vmacache, 0, sizeof(tsk->vmacache));
16}
17
18extern void vmacache_flush_all(struct mm_struct *mm);
19extern void vmacache_update(unsigned long addr, struct vm_area_struct *newvma);
20extern struct vm_area_struct *vmacache_find(struct mm_struct *mm,
21 unsigned long addr);
22
23#ifndef CONFIG_MMU
24extern struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm,
25 unsigned long start,
26 unsigned long end);
27#endif
28
29static inline void vmacache_invalidate(struct mm_struct *mm)
30{
31 mm->vmacache_seqnum++;
32
33 /* deal with overflows */
34 if (unlikely(mm->vmacache_seqnum == 0))
35 vmacache_flush_all(mm);
36}
37
38#endif /* __LINUX_VMACACHE_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 67ce70c8279b..45c9cd1daf7a 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -27,9 +27,13 @@ struct vm_event_state {
27 27
28DECLARE_PER_CPU(struct vm_event_state, vm_event_states); 28DECLARE_PER_CPU(struct vm_event_state, vm_event_states);
29 29
30/*
31 * vm counters are allowed to be racy. Use raw_cpu_ops to avoid the
32 * local_irq_disable overhead.
33 */
30static inline void __count_vm_event(enum vm_event_item item) 34static inline void __count_vm_event(enum vm_event_item item)
31{ 35{
32 __this_cpu_inc(vm_event_states.event[item]); 36 raw_cpu_inc(vm_event_states.event[item]);
33} 37}
34 38
35static inline void count_vm_event(enum vm_event_item item) 39static inline void count_vm_event(enum vm_event_item item)
@@ -39,7 +43,7 @@ static inline void count_vm_event(enum vm_event_item item)
39 43
40static inline void __count_vm_events(enum vm_event_item item, long delta) 44static inline void __count_vm_events(enum vm_event_item item, long delta)
41{ 45{
42 __this_cpu_add(vm_event_states.event[item], delta); 46 raw_cpu_add(vm_event_states.event[item], delta);
43} 47}
44 48
45static inline void count_vm_events(enum vm_event_item item, long delta) 49static inline void count_vm_events(enum vm_event_item item, long delta)
@@ -187,8 +191,6 @@ extern void zone_statistics(struct zone *, struct zone *, gfp_t gfp);
187#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d) 191#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d)
188#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d)) 192#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
189 193
190extern void inc_zone_state(struct zone *, enum zone_stat_item);
191
192#ifdef CONFIG_SMP 194#ifdef CONFIG_SMP
193void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int); 195void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int);
194void __inc_zone_page_state(struct page *, enum zone_stat_item); 196void __inc_zone_page_state(struct page *, enum zone_stat_item);
@@ -230,18 +232,18 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
230 atomic_long_inc(&vm_stat[item]); 232 atomic_long_inc(&vm_stat[item]);
231} 233}
232 234
233static inline void __inc_zone_page_state(struct page *page,
234 enum zone_stat_item item)
235{
236 __inc_zone_state(page_zone(page), item);
237}
238
239static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) 235static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item)
240{ 236{
241 atomic_long_dec(&zone->vm_stat[item]); 237 atomic_long_dec(&zone->vm_stat[item]);
242 atomic_long_dec(&vm_stat[item]); 238 atomic_long_dec(&vm_stat[item]);
243} 239}
244 240
241static inline void __inc_zone_page_state(struct page *page,
242 enum zone_stat_item item)
243{
244 __inc_zone_state(page_zone(page), item);
245}
246
245static inline void __dec_zone_page_state(struct page *page, 247static inline void __dec_zone_page_state(struct page *page,
246 enum zone_stat_item item) 248 enum zone_stat_item item)
247{ 249{
@@ -256,6 +258,9 @@ static inline void __dec_zone_page_state(struct page *page,
256#define dec_zone_page_state __dec_zone_page_state 258#define dec_zone_page_state __dec_zone_page_state
257#define mod_zone_page_state __mod_zone_page_state 259#define mod_zone_page_state __mod_zone_page_state
258 260
261#define inc_zone_state __inc_zone_state
262#define dec_zone_state __dec_zone_state
263
259#define set_pgdat_percpu_threshold(pgdat, callback) { } 264#define set_pgdat_percpu_threshold(pgdat, callback) { }
260 265
261static inline void refresh_cpu_vm_stats(int cpu) { } 266static inline void refresh_cpu_vm_stats(int cpu) { }
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 559044c79232..e7d9d9ed14f5 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -803,17 +803,6 @@ do { \
803 __ret; \ 803 __ret; \
804}) 804})
805 805
806
807/*
808 * These are the old interfaces to sleep waiting for an event.
809 * They are racy. DO NOT use them, use the wait_event* interfaces above.
810 * We plan to remove these interfaces.
811 */
812extern void sleep_on(wait_queue_head_t *q);
813extern long sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
814extern void interruptible_sleep_on(wait_queue_head_t *q);
815extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
816
817/* 806/*
818 * Waitqueues which are removed from the waitqueue_head at wakeup time 807 * Waitqueues which are removed from the waitqueue_head at wakeup time
819 */ 808 */
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a54fe82e704b..a9c723be1acf 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -48,11 +48,15 @@ enum {
48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ 48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
49}; 49};
50 50
51struct wl12xx_platform_data { 51struct wl1251_platform_data {
52 void (*set_power)(bool enable); 52 int power_gpio;
53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ 53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
54 int irq; 54 int irq;
55 bool use_eeprom; 55 bool use_eeprom;
56};
57
58struct wl12xx_platform_data {
59 int irq;
56 int board_ref_clock; 60 int board_ref_clock;
57 int board_tcxo_clock; 61 int board_tcxo_clock;
58 unsigned long platform_quirks; 62 unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
68 72
69struct wl12xx_platform_data *wl12xx_get_platform_data(void); 73struct wl12xx_platform_data *wl12xx_get_platform_data(void);
70 74
75int wl1251_set_platform_data(const struct wl1251_platform_data *data);
76
77struct wl1251_platform_data *wl1251_get_platform_data(void);
78
71#else 79#else
72 80
73static inline 81static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)
82 return ERR_PTR(-ENODATA); 90 return ERR_PTR(-ENODATA);
83} 91}
84 92
93static inline
94int wl1251_set_platform_data(const struct wl1251_platform_data *data)
95{
96 return -ENOSYS;
97}
98
99static inline
100struct wl1251_platform_data *wl1251_get_platform_data(void)
101{
102 return ERR_PTR(-ENODATA);
103}
104
85#endif 105#endif
86 106
87#endif 107#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 021b8a319b9e..5777c13849ba 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -178,7 +178,7 @@ int write_cache_pages(struct address_space *mapping,
178 struct writeback_control *wbc, writepage_t writepage, 178 struct writeback_control *wbc, writepage_t writepage,
179 void *data); 179 void *data);
180int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 180int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
181void set_page_dirty_balance(struct page *page, int page_mkwrite); 181void set_page_dirty_balance(struct page *page);
182void writeback_set_ratelimit(void); 182void writeback_set_ratelimit(void);
183void tag_pages_for_writeback(struct address_space *mapping, 183void tag_pages_for_writeback(struct address_space *mapping,
184 pgoff_t start, pgoff_t end); 184 pgoff_t start, pgoff_t end);
diff --git a/include/linux/xilinxfb.h b/include/linux/xilinxfb.h
deleted file mode 100644
index 5a155a968054..000000000000
--- a/include/linux/xilinxfb.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Platform device data for Xilinx Framebuffer device
3 *
4 * Copyright 2007 Secret Lab Technologies Ltd.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __XILINXFB_H__
12#define __XILINXFB_H__
13
14#include <linux/types.h>
15
16/* ML300/403 reference design framebuffer driver platform data struct */
17struct xilinxfb_platform_data {
18 u32 rotate_screen; /* Flag to rotate display 180 degrees */
19 u32 screen_height_mm; /* Physical dimensions of screen in mm */
20 u32 screen_width_mm;
21 u32 xres, yres; /* resolution of screen in pixels */
22 u32 xvirt, yvirt; /* resolution of memory buffer */
23
24 /* Physical address of framebuffer memory; If non-zero, driver
25 * will use provided memory address instead of allocating one from
26 * the consistent pool. */
27 u32 fb_phys;
28};
29
30#endif /* __XILINXFB_H__ */