aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h17
-rw-r--r--include/linux/aer.h2
-rw-r--r--include/linux/ahci_platform.h5
-rw-r--r--include/linux/amd-iommu.h7
-rw-r--r--include/linux/arcdevice.h10
-rw-r--r--include/linux/atmel-pwm-bl.h43
-rw-r--r--include/linux/atmel-ssc.h13
-rw-r--r--include/linux/atmel_pwm.h70
-rw-r--r--include/linux/bcma/bcma.h27
-rw-r--r--include/linux/bcma/bcma_driver_pcie2.h158
-rw-r--r--include/linux/bitmap.h62
-rw-r--r--include/linux/byteorder/generic.h2
-rw-r--r--include/linux/capability.h5
-rw-r--r--include/linux/cgroup.h165
-rw-r--r--include/linux/clk-provider.h5
-rw-r--r--include/linux/clk/clk-conf.h20
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/cma.h27
-rw-r--r--include/linux/component.h7
-rw-r--r--include/linux/cper.h32
-rw-r--r--include/linux/cpufreq.h1
-rw-r--r--include/linux/crc32.h20
-rw-r--r--include/linux/cred.h9
-rw-r--r--include/linux/crypto.h8
-rw-r--r--include/linux/decompress/bunzip2.h8
-rw-r--r--include/linux/decompress/generic.h10
-rw-r--r--include/linux/decompress/inflate.h8
-rw-r--r--include/linux/decompress/unlz4.h8
-rw-r--r--include/linux/decompress/unlzma.h8
-rw-r--r--include/linux/decompress/unlzo.h8
-rw-r--r--include/linux/decompress/unxz.h8
-rw-r--r--include/linux/device.h8
-rw-r--r--include/linux/dma-buf.h21
-rw-r--r--include/linux/dma-contiguous.h11
-rw-r--r--include/linux/dmaengine.h1
-rw-r--r--include/linux/dmar.h50
-rw-r--r--include/linux/efi.h82
-rw-r--r--include/linux/extcon/sm5502.h287
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fence.h360
-rw-r--r--include/linux/filter.h112
-rw-r--r--include/linux/firmware.h15
-rw-r--r--include/linux/fs.h33
-rw-r--r--include/linux/fsnotify_backend.h14
-rw-r--r--include/linux/ftrace.h68
-rw-r--r--include/linux/ftrace_event.h3
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/glob.h9
-rw-r--r--include/linux/gpio/consumer.h81
-rw-r--r--include/linux/gpio/driver.h66
-rw-r--r--include/linux/gpio/machine.h61
-rw-r--r--include/linux/hid.h6
-rw-r--r--include/linux/highmem.h2
-rw-r--r--include/linux/host1x.h15
-rw-r--r--include/linux/hrtimer.h16
-rw-r--r--include/linux/huge_mm.h4
-rw-r--r--include/linux/hugetlb.h1
-rw-r--r--include/linux/hw_random.h5
-rw-r--r--include/linux/i2c.h12
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h3
-rw-r--r--include/linux/i2c/s6000.h10
-rw-r--r--include/linux/ieee80211.h23
-rw-r--r--include/linux/if_bridge.h20
-rw-r--r--include/linux/iio/accel/kxcjk_1013.h (renamed from include/linux/tegra-ahb.h)13
-rw-r--r--include/linux/iio/common/st_sensors.h12
-rw-r--r--include/linux/iio/common/st_sensors_i2c.h11
-rw-r--r--include/linux/iio/iio.h9
-rw-r--r--include/linux/iio/imu/adis.h33
-rw-r--r--include/linux/iio/trigger.h5
-rw-r--r--include/linux/iio/types.h5
-rw-r--r--include/linux/ima.h6
-rw-r--r--include/linux/init_task.h9
-rw-r--r--include/linux/input/pixcir_ts.h12
-rw-r--r--include/linux/intel-iommu.h3
-rw-r--r--include/linux/io.h2
-rw-r--r--include/linux/iommu.h32
-rw-r--r--include/linux/ioport.h6
-rw-r--r--include/linux/iova.h5
-rw-r--r--include/linux/ipv6.h24
-rw-r--r--include/linux/irq.h2
-rw-r--r--include/linux/irq_work.h5
-rw-r--r--include/linux/irqchip/arm-gic-v3.h200
-rw-r--r--include/linux/irqchip/spear-shirq.h64
-rw-r--r--include/linux/irqdomain.h2
-rw-r--r--include/linux/isdn_ppp.h4
-rw-r--r--include/linux/kernel.h8
-rw-r--r--include/linux/kexec.h104
-rw-r--r--include/linux/key-type.h5
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/kthread.h13
-rw-r--r--include/linux/ktime.h228
-rw-r--r--include/linux/kvm_host.h47
-rw-r--r--include/linux/leds.h5
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/memblock.h4
-rw-r--r--include/linux/memcontrol.h98
-rw-r--r--include/linux/memory_hotplug.h10
-rw-r--r--include/linux/mfd/abx500/ab8500.h1
-rw-r--r--include/linux/mfd/arizona/core.h41
-rw-r--r--include/linux/mfd/arizona/pdata.h3
-rw-r--r--include/linux/mfd/arizona/registers.h785
-rw-r--r--include/linux/mfd/cros_ec.h110
-rw-r--r--include/linux/mfd/da9063/core.h3
-rw-r--r--include/linux/mfd/da9063/registers.h129
-rw-r--r--include/linux/mfd/intel_soc_pmic.h30
-rw-r--r--include/linux/mfd/max77686-private.h239
-rw-r--r--include/linux/mfd/max77686.h59
-rw-r--r--include/linux/mfd/max77693-private.h54
-rw-r--r--include/linux/mfd/mc13783.h1
-rw-r--r--include/linux/mfd/mc13xxx.h23
-rw-r--r--include/linux/mfd/palmas.h837
-rw-r--r--include/linux/mfd/rtsx_pci.h6
-rw-r--r--include/linux/mfd/samsung/core.h1
-rw-r--r--include/linux/mfd/samsung/irq.h24
-rw-r--r--include/linux/mfd/samsung/s2mpu02.h201
-rw-r--r--include/linux/mfd/tps65910.h2
-rw-r--r--include/linux/mic_bus.h110
-rw-r--r--include/linux/mlx4/device.h18
-rw-r--r--include/linux/mlx5/device.h4
-rw-r--r--include/linux/mlx5/driver.h31
-rw-r--r--include/linux/mm.h17
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mmdebug.h2
-rw-r--r--include/linux/mmu_notifier.h6
-rw-r--r--include/linux/mmzone.h219
-rw-r--r--include/linux/moduleparam.h5
-rw-r--r--include/linux/mount.h9
-rw-r--r--include/linux/msi.h3
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/linux/mtd/nand.h53
-rw-r--r--include/linux/mtd/spi-nor.h4
-rw-r--r--include/linux/mutex.h4
-rw-r--r--include/linux/mvebu-pmsu.h20
-rw-r--r--include/linux/netdev_features.h8
-rw-r--r--include/linux/netdevice.h421
-rw-r--r--include/linux/nmi.h4
-rw-r--r--include/linux/nodemask.h11
-rw-r--r--include/linux/nsproxy.h16
-rw-r--r--include/linux/of_address.h11
-rw-r--r--include/linux/oid_registry.h8
-rw-r--r--include/linux/omap-dma.h1
-rw-r--r--include/linux/omap-iommu.h37
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/page-flags.h21
-rw-r--r--include/linux/page_cgroup.h70
-rw-r--r--include/linux/pagemap.h3
-rw-r--r--include/linux/pci-acpi.h13
-rw-r--r--include/linux/pci.h16
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/pe.h448
-rw-r--r--include/linux/percpu-defs.h380
-rw-r--r--include/linux/percpu-refcount.h64
-rw-r--r--include/linux/percpu.h673
-rw-r--r--include/linux/phy.h18
-rw-r--r--include/linux/phy/omap_control_phy.h10
-rw-r--r--include/linux/phy/phy.h17
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--include/linux/pinctrl/pinmux.h2
-rw-r--r--include/linux/platform_data/ad7291.h12
-rw-r--r--include/linux/platform_data/asoc-s3c.h9
-rw-r--r--include/linux/platform_data/ata-samsung_cf.h1
-rw-r--r--include/linux/platform_data/camera-mx1.h35
-rw-r--r--include/linux/platform_data/dma-imx.h1
-rw-r--r--include/linux/platform_data/dsp-omap.h34
-rw-r--r--include/linux/platform_data/iommu-omap.h6
-rw-r--r--include/linux/platform_data/ntc_thermistor.h1
-rw-r--r--include/linux/platform_data/st21nfcb.h32
-rw-r--r--include/linux/platform_data/usb-ehci-mxc.h46
-rw-r--r--include/linux/platform_data/usb-imx_udc.h23
-rw-r--r--include/linux/platform_data/video-clcd-versatile.h27
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm_runtime.h11
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/printk.h2
-rw-r--r--include/linux/ptp_classify.h5
-rw-r--r--include/linux/ras.h14
-rw-r--r--include/linux/rculist.h8
-rw-r--r--include/linux/rcupdate.h45
-rw-r--r--include/linux/regmap.h7
-rw-r--r--include/linux/regulator/ab8500.h14
-rw-r--r--include/linux/regulator/act8865.h23
-rw-r--r--include/linux/regulator/consumer.h26
-rw-r--r--include/linux/regulator/da9211.h32
-rw-r--r--include/linux/reservation.h82
-rw-r--r--include/linux/rhashtable.h213
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rndis.h1
-rw-r--r--include/linux/rtmutex.h6
-rw-r--r--include/linux/rtnetlink.h1
-rw-r--r--include/linux/scatterlist.h8
-rw-r--r--include/linux/sched.h59
-rw-r--r--include/linux/seccomp.h8
-rw-r--r--include/linux/security.h17
-rw-r--r--include/linux/seqlock.h29
-rw-r--r--include/linux/seqno-fence.h116
-rw-r--r--include/linux/serial_8250.h7
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/sfi_acpi.h3
-rw-r--r--include/linux/sh_timer.h5
-rw-r--r--include/linux/shm.h18
-rw-r--r--include/linux/shmem_fs.h17
-rw-r--r--include/linux/signal.h15
-rw-r--r--include/linux/skbuff.h44
-rw-r--r--include/linux/spi/cc2520.h26
-rw-r--r--include/linux/spi/sh_msiof.h2
-rw-r--r--include/linux/ssb/ssb_regs.h37
-rw-r--r--include/linux/stmmac.h2
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--include/linux/sunrpc/svc.h4
-rw-r--r--include/linux/sunrpc/svc_rdma.h3
-rw-r--r--include/linux/sunrpc/svc_xprt.h2
-rw-r--r--include/linux/swap.h16
-rw-r--r--include/linux/syscalls.h10
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/tcp.h3
-rw-r--r--include/linux/tegra-cpuidle.h25
-rw-r--r--include/linux/tegra-powergate.h134
-rw-r--r--include/linux/tegra-soc.h22
-rw-r--r--include/linux/tick.h29
-rw-r--r--include/linux/time.h65
-rw-r--r--include/linux/time64.h190
-rw-r--r--include/linux/timekeeper_internal.h150
-rw-r--r--include/linux/timekeeping.h209
-rw-r--r--include/linux/timerfd.h5
-rw-r--r--include/linux/tpm.h3
-rw-r--r--include/linux/trace_seq.h36
-rw-r--r--include/linux/tracehook.h8
-rw-r--r--include/linux/tty.h4
-rw-r--r--include/linux/tty_driver.h8
-rw-r--r--include/linux/usb/composite.h15
-rw-r--r--include/linux/usb/quirks.h11
-rw-r--r--include/linux/usb/renesas_usbhs.h6
-rw-r--r--include/linux/usb/usb338x.h199
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/usb/xhci_pdriver.h27
-rw-r--r--include/linux/user_namespace.h6
-rw-r--r--include/linux/verify_pefile.h18
-rw-r--r--include/linux/vfio.h23
-rw-r--r--include/linux/vmalloc.h2
-rw-r--r--include/linux/wait.h125
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/zbud.h2
-rw-r--r--include/linux/zlib.h122
-rw-r--r--include/linux/zpool.h106
245 files changed, 8187 insertions, 3061 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 358c01b971db..807cbc46d73e 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -29,17 +29,17 @@
29#include <linux/ioport.h> /* for struct resource */ 29#include <linux/ioport.h> /* for struct resource */
30#include <linux/device.h> 30#include <linux/device.h>
31 31
32#ifdef CONFIG_ACPI
33
34#ifndef _LINUX 32#ifndef _LINUX
35#define _LINUX 33#define _LINUX
36#endif 34#endif
35#include <acpi/acpi.h>
36
37#ifdef CONFIG_ACPI
37 38
38#include <linux/list.h> 39#include <linux/list.h>
39#include <linux/mod_devicetable.h> 40#include <linux/mod_devicetable.h>
40#include <linux/dynamic_debug.h> 41#include <linux/dynamic_debug.h>
41 42
42#include <acpi/acpi.h>
43#include <acpi/acpi_bus.h> 43#include <acpi/acpi_bus.h>
44#include <acpi/acpi_drivers.h> 44#include <acpi/acpi_drivers.h>
45#include <acpi/acpi_numa.h> 45#include <acpi/acpi_numa.h>
@@ -364,6 +364,17 @@ extern bool osc_sb_apei_support_acked;
364#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 364#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
365#define OSC_PCI_CONTROL_MASKS 0x0000001f 365#define OSC_PCI_CONTROL_MASKS 0x0000001f
366 366
367#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
368#define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004
369#define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006
370#define ACPI_GSB_ACCESS_ATTRIB_WORD 0x00000008
371#define ACPI_GSB_ACCESS_ATTRIB_BLOCK 0x0000000A
372#define ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE 0x0000000B
373#define ACPI_GSB_ACCESS_ATTRIB_WORD_CALL 0x0000000C
374#define ACPI_GSB_ACCESS_ATTRIB_BLOCK_CALL 0x0000000D
375#define ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES 0x0000000E
376#define ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS 0x0000000F
377
367extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 378extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
368 u32 *mask, u32 req); 379 u32 *mask, u32 req);
369 380
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 4dbaa7081530..c826d1c28f9c 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -11,6 +11,8 @@
11#define AER_FATAL 1 11#define AER_FATAL 1
12#define AER_CORRECTABLE 2 12#define AER_CORRECTABLE 2
13 13
14struct pci_dev;
15
14struct aer_header_log_regs { 16struct aer_header_log_regs {
15 unsigned int dw0; 17 unsigned int dw0;
16 unsigned int dw1; 18 unsigned int dw1;
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 6dfd51a04d77..09a947e8bc87 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -43,10 +43,7 @@ struct ahci_host_priv *ahci_platform_get_resources(
43 struct platform_device *pdev); 43 struct platform_device *pdev);
44int ahci_platform_init_host(struct platform_device *pdev, 44int ahci_platform_init_host(struct platform_device *pdev,
45 struct ahci_host_priv *hpriv, 45 struct ahci_host_priv *hpriv,
46 const struct ata_port_info *pi_template, 46 const struct ata_port_info *pi_template);
47 unsigned long host_flags,
48 unsigned int force_port_map,
49 unsigned int mask_port_map);
50 47
51int ahci_platform_suspend_host(struct device *dev); 48int ahci_platform_suspend_host(struct device *dev);
52int ahci_platform_resume_host(struct device *dev); 49int ahci_platform_resume_host(struct device *dev);
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h
index 15f6b9edd0b1..2b08e79f5100 100644
--- a/include/linux/amd-iommu.h
+++ b/include/linux/amd-iommu.h
@@ -119,6 +119,13 @@ typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev,
119extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev, 119extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev,
120 amd_iommu_invalid_ppr_cb cb); 120 amd_iommu_invalid_ppr_cb cb);
121 121
122#define PPR_FAULT_EXEC (1 << 1)
123#define PPR_FAULT_READ (1 << 2)
124#define PPR_FAULT_WRITE (1 << 5)
125#define PPR_FAULT_USER (1 << 6)
126#define PPR_FAULT_RSVD (1 << 7)
127#define PPR_FAULT_GN (1 << 8)
128
122/** 129/**
123 * amd_iommu_device_info() - Get information about IOMMUv2 support of a 130 * amd_iommu_device_info() - Get information about IOMMUv2 support of a
124 * PCI device 131 * PCI device
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 7216b0daf544..df0356220730 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -22,10 +22,6 @@
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23#include <linux/irqreturn.h> 23#include <linux/irqreturn.h>
24 24
25#ifndef bool
26#define bool int
27#endif
28
29/* 25/*
30 * RECON_THRESHOLD is the maximum number of RECON messages to receive 26 * RECON_THRESHOLD is the maximum number of RECON messages to receive
31 * within one minute before printing a "cabling problem" warning. The 27 * within one minute before printing a "cabling problem" warning. The
@@ -285,9 +281,9 @@ struct arcnet_local {
285 unsigned long first_recon; /* time of "first" RECON message to count */ 281 unsigned long first_recon; /* time of "first" RECON message to count */
286 unsigned long last_recon; /* time of most recent RECON */ 282 unsigned long last_recon; /* time of most recent RECON */
287 int num_recons; /* number of RECONs between first and last. */ 283 int num_recons; /* number of RECONs between first and last. */
288 bool network_down; /* do we think the network is down? */ 284 int network_down; /* do we think the network is down? */
289 285
290 bool excnak_pending; /* We just got an excesive nak interrupt */ 286 int excnak_pending; /* We just got an excesive nak interrupt */
291 287
292 struct { 288 struct {
293 uint16_t sequence; /* sequence number (incs with each packet) */ 289 uint16_t sequence; /* sequence number (incs with each packet) */
@@ -305,7 +301,7 @@ struct arcnet_local {
305 void (*command) (struct net_device * dev, int cmd); 301 void (*command) (struct net_device * dev, int cmd);
306 int (*status) (struct net_device * dev); 302 int (*status) (struct net_device * dev);
307 void (*intmask) (struct net_device * dev, int mask); 303 void (*intmask) (struct net_device * dev, int mask);
308 bool (*reset) (struct net_device * dev, bool really_reset); 304 int (*reset) (struct net_device * dev, int really_reset);
309 void (*open) (struct net_device * dev); 305 void (*open) (struct net_device * dev);
310 void (*close) (struct net_device * dev); 306 void (*close) (struct net_device * dev);
311 307
diff --git a/include/linux/atmel-pwm-bl.h b/include/linux/atmel-pwm-bl.h
deleted file mode 100644
index 0153a47806c2..000000000000
--- a/include/linux/atmel-pwm-bl.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * Driver for the AT32AP700X PS/2 controller (PSIF).
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#ifndef __INCLUDE_ATMEL_PWM_BL_H
12#define __INCLUDE_ATMEL_PWM_BL_H
13
14/**
15 * struct atmel_pwm_bl_platform_data
16 * @pwm_channel: which PWM channel in the PWM module to use.
17 * @pwm_frequency: PWM frequency to generate, the driver will try to be as
18 * close as the prescaler allows.
19 * @pwm_compare_max: value to use in the PWM channel compare register.
20 * @pwm_duty_max: maximum duty cycle value, must be less than or equal to
21 * pwm_compare_max.
22 * @pwm_duty_min: minimum duty cycle value, must be less than pwm_duty_max.
23 * @pwm_active_low: set to one if the low part of the PWM signal increases the
24 * brightness of the backlight.
25 * @gpio_on: GPIO line to control the backlight on/off, set to -1 if not used.
26 * @on_active_low: set to one if the on/off signal is on when GPIO is low.
27 *
28 * This struct must be added to the platform device in the board code. It is
29 * used by the atmel-pwm-bl driver to setup the GPIO to control on/off and the
30 * PWM device.
31 */
32struct atmel_pwm_bl_platform_data {
33 unsigned int pwm_channel;
34 unsigned int pwm_frequency;
35 unsigned int pwm_compare_max;
36 unsigned int pwm_duty_max;
37 unsigned int pwm_duty_min;
38 unsigned int pwm_active_low;
39 int gpio_on;
40 unsigned int on_active_low;
41};
42
43#endif /* __INCLUDE_ATMEL_PWM_BL_H */
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 571a12ebb018..7c0f6549898b 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -7,6 +7,7 @@
7 7
8struct atmel_ssc_platform_data { 8struct atmel_ssc_platform_data {
9 int use_dma; 9 int use_dma;
10 int has_fslen_ext;
10}; 11};
11 12
12struct ssc_device { 13struct ssc_device {
@@ -71,6 +72,12 @@ void ssc_free(struct ssc_device *ssc);
71#define SSC_RFMR_DATNB_OFFSET 8 72#define SSC_RFMR_DATNB_OFFSET 8
72#define SSC_RFMR_FSEDGE_SIZE 1 73#define SSC_RFMR_FSEDGE_SIZE 1
73#define SSC_RFMR_FSEDGE_OFFSET 24 74#define SSC_RFMR_FSEDGE_OFFSET 24
75/*
76 * The FSLEN_EXT exist on at91sam9rl, at91sam9g10,
77 * at91sam9g20, and at91sam9g45 and newer SoCs
78 */
79#define SSC_RFMR_FSLEN_EXT_SIZE 4
80#define SSC_RFMR_FSLEN_EXT_OFFSET 28
74#define SSC_RFMR_FSLEN_SIZE 4 81#define SSC_RFMR_FSLEN_SIZE 4
75#define SSC_RFMR_FSLEN_OFFSET 16 82#define SSC_RFMR_FSLEN_OFFSET 16
76#define SSC_RFMR_FSOS_SIZE 4 83#define SSC_RFMR_FSOS_SIZE 4
@@ -109,6 +116,12 @@ void ssc_free(struct ssc_device *ssc);
109#define SSC_TFMR_FSDEN_OFFSET 23 116#define SSC_TFMR_FSDEN_OFFSET 23
110#define SSC_TFMR_FSEDGE_SIZE 1 117#define SSC_TFMR_FSEDGE_SIZE 1
111#define SSC_TFMR_FSEDGE_OFFSET 24 118#define SSC_TFMR_FSEDGE_OFFSET 24
119/*
120 * The FSLEN_EXT exist on at91sam9rl, at91sam9g10,
121 * at91sam9g20, and at91sam9g45 and newer SoCs
122 */
123#define SSC_TFMR_FSLEN_EXT_SIZE 4
124#define SSC_TFMR_FSLEN_EXT_OFFSET 28
112#define SSC_TFMR_FSLEN_SIZE 4 125#define SSC_TFMR_FSLEN_SIZE 4
113#define SSC_TFMR_FSLEN_OFFSET 16 126#define SSC_TFMR_FSLEN_OFFSET 16
114#define SSC_TFMR_FSOS_SIZE 3 127#define SSC_TFMR_FSOS_SIZE 3
diff --git a/include/linux/atmel_pwm.h b/include/linux/atmel_pwm.h
deleted file mode 100644
index ea04abb3db8e..000000000000
--- a/include/linux/atmel_pwm.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef __LINUX_ATMEL_PWM_H
2#define __LINUX_ATMEL_PWM_H
3
4/**
5 * struct pwm_channel - driver handle to a PWM channel
6 * @regs: base of this channel's registers
7 * @index: number of this channel (0..31)
8 * @mck: base clock rate, which can be prescaled and maybe subdivided
9 *
10 * Drivers initialize a pwm_channel structure using pwm_channel_alloc().
11 * Then they configure its clock rate (derived from MCK), alignment,
12 * polarity, and duty cycle by writing directly to the channel registers,
13 * before enabling the channel by calling pwm_channel_enable().
14 *
15 * After emitting a PWM signal for the desired length of time, drivers
16 * may then pwm_channel_disable() or pwm_channel_free(). Both of these
17 * disable the channel, but when it's freed the IRQ is deconfigured and
18 * the channel must later be re-allocated and reconfigured.
19 *
20 * Note that if the period or duty cycle need to be changed while the
21 * PWM channel is operating, drivers must use the PWM_CUPD double buffer
22 * mechanism, either polling until they change or getting implicitly
23 * notified through a once-per-period interrupt handler.
24 */
25struct pwm_channel {
26 void __iomem *regs;
27 unsigned index;
28 unsigned long mck;
29};
30
31extern int pwm_channel_alloc(int index, struct pwm_channel *ch);
32extern int pwm_channel_free(struct pwm_channel *ch);
33
34extern int pwm_clk_alloc(unsigned prescale, unsigned div);
35extern void pwm_clk_free(unsigned clk);
36
37extern int __pwm_channel_onoff(struct pwm_channel *ch, int enabled);
38
39#define pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1)
40#define pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0)
41
42/* periodic interrupts, mostly for CUPD changes to period or cycle */
43extern int pwm_channel_handler(struct pwm_channel *ch,
44 void (*handler)(struct pwm_channel *ch));
45
46/* per-channel registers (banked at pwm_channel->regs) */
47#define PWM_CMR 0x00 /* mode register */
48#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */
49#define PWM_CPR_CPOL (1 << 9) /* set: idle high */
50#define PWM_CPR_CALG (1 << 8) /* set: center align */
51#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */
52#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */
53#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */
54#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */
55#define PWM_CPRD 0x08 /* period (count up from zero) */
56#define PWM_CCNT 0x0c /* counter (20 bits?) */
57#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */
58
59static inline void
60pwm_channel_writel(struct pwm_channel *pwmc, unsigned offset, u32 val)
61{
62 __raw_writel(val, pwmc->regs + offset);
63}
64
65static inline u32 pwm_channel_readl(struct pwm_channel *pwmc, unsigned offset)
66{
67 return __raw_readl(pwmc->regs + offset);
68}
69
70#endif /* __LINUX_ATMEL_PWM_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 0b3bb16c705a..0272e49135d0 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/bcma/bcma_driver_chipcommon.h> 7#include <linux/bcma/bcma_driver_chipcommon.h>
8#include <linux/bcma/bcma_driver_pci.h> 8#include <linux/bcma/bcma_driver_pci.h>
9#include <linux/bcma/bcma_driver_pcie2.h>
9#include <linux/bcma/bcma_driver_mips.h> 10#include <linux/bcma/bcma_driver_mips.h>
10#include <linux/bcma/bcma_driver_gmac_cmn.h> 11#include <linux/bcma/bcma_driver_gmac_cmn.h>
11#include <linux/ssb/ssb.h> /* SPROM sharing */ 12#include <linux/ssb/ssb.h> /* SPROM sharing */
@@ -72,17 +73,17 @@ struct bcma_host_ops {
72/* Core-ID values. */ 73/* Core-ID values. */
73#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ 74#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
74#define BCMA_CORE_4706_CHIPCOMMON 0x500 75#define BCMA_CORE_4706_CHIPCOMMON 0x500
75#define BCMA_CORE_PCIEG2 0x501 76#define BCMA_CORE_NS_PCIEG2 0x501
76#define BCMA_CORE_DMA 0x502 77#define BCMA_CORE_NS_DMA 0x502
77#define BCMA_CORE_SDIO3 0x503 78#define BCMA_CORE_NS_SDIO3 0x503
78#define BCMA_CORE_USB20 0x504 79#define BCMA_CORE_NS_USB20 0x504
79#define BCMA_CORE_USB30 0x505 80#define BCMA_CORE_NS_USB30 0x505
80#define BCMA_CORE_A9JTAG 0x506 81#define BCMA_CORE_NS_A9JTAG 0x506
81#define BCMA_CORE_DDR23 0x507 82#define BCMA_CORE_NS_DDR23 0x507
82#define BCMA_CORE_ROM 0x508 83#define BCMA_CORE_NS_ROM 0x508
83#define BCMA_CORE_NAND 0x509 84#define BCMA_CORE_NS_NAND 0x509
84#define BCMA_CORE_QSPI 0x50A 85#define BCMA_CORE_NS_QSPI 0x50A
85#define BCMA_CORE_CHIPCOMMON_B 0x50B 86#define BCMA_CORE_NS_CHIPCOMMON_B 0x50B
86#define BCMA_CORE_4706_SOC_RAM 0x50E 87#define BCMA_CORE_4706_SOC_RAM 0x50E
87#define BCMA_CORE_ARMCA9 0x510 88#define BCMA_CORE_ARMCA9 0x510
88#define BCMA_CORE_4706_MAC_GBIT 0x52D 89#define BCMA_CORE_4706_MAC_GBIT 0x52D
@@ -157,6 +158,9 @@ struct bcma_host_ops {
157/* Chip IDs of PCIe devices */ 158/* Chip IDs of PCIe devices */
158#define BCMA_CHIP_ID_BCM4313 0x4313 159#define BCMA_CHIP_ID_BCM4313 0x4313
159#define BCMA_CHIP_ID_BCM43142 43142 160#define BCMA_CHIP_ID_BCM43142 43142
161#define BCMA_CHIP_ID_BCM43131 43131
162#define BCMA_CHIP_ID_BCM43217 43217
163#define BCMA_CHIP_ID_BCM43222 43222
160#define BCMA_CHIP_ID_BCM43224 43224 164#define BCMA_CHIP_ID_BCM43224 43224
161#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 165#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8
162#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa 166#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa
@@ -333,6 +337,7 @@ struct bcma_bus {
333 337
334 struct bcma_drv_cc drv_cc; 338 struct bcma_drv_cc drv_cc;
335 struct bcma_drv_pci drv_pci[2]; 339 struct bcma_drv_pci drv_pci[2];
340 struct bcma_drv_pcie2 drv_pcie2;
336 struct bcma_drv_mips drv_mips; 341 struct bcma_drv_mips drv_mips;
337 struct bcma_drv_gmac_cmn drv_gmac_cmn; 342 struct bcma_drv_gmac_cmn drv_gmac_cmn;
338 343
diff --git a/include/linux/bcma/bcma_driver_pcie2.h b/include/linux/bcma/bcma_driver_pcie2.h
new file mode 100644
index 000000000000..5988b05781c3
--- /dev/null
+++ b/include/linux/bcma/bcma_driver_pcie2.h
@@ -0,0 +1,158 @@
1#ifndef LINUX_BCMA_DRIVER_PCIE2_H_
2#define LINUX_BCMA_DRIVER_PCIE2_H_
3
4#define BCMA_CORE_PCIE2_CLK_CONTROL 0x0000
5#define PCIE2_CLKC_RST_OE 0x0001 /* When set, drives PCI_RESET out to pin */
6#define PCIE2_CLKC_RST 0x0002 /* Value driven out to pin */
7#define PCIE2_CLKC_SPERST 0x0004 /* SurvivePeRst */
8#define PCIE2_CLKC_DISABLE_L1CLK_GATING 0x0010
9#define PCIE2_CLKC_DLYPERST 0x0100 /* Delay PeRst to CoE Core */
10#define PCIE2_CLKC_DISSPROMLD 0x0200 /* DisableSpromLoadOnPerst */
11#define PCIE2_CLKC_WAKE_MODE_L2 0x1000 /* Wake on L2 */
12#define BCMA_CORE_PCIE2_RC_PM_CONTROL 0x0004
13#define BCMA_CORE_PCIE2_RC_PM_STATUS 0x0008
14#define BCMA_CORE_PCIE2_EP_PM_CONTROL 0x000C
15#define BCMA_CORE_PCIE2_EP_PM_STATUS 0x0010
16#define BCMA_CORE_PCIE2_EP_LTR_CONTROL 0x0014
17#define BCMA_CORE_PCIE2_EP_LTR_STATUS 0x0018
18#define BCMA_CORE_PCIE2_EP_OBFF_STATUS 0x001C
19#define BCMA_CORE_PCIE2_PCIE_ERR_STATUS 0x0020
20#define BCMA_CORE_PCIE2_RC_AXI_CONFIG 0x0100
21#define BCMA_CORE_PCIE2_EP_AXI_CONFIG 0x0104
22#define BCMA_CORE_PCIE2_RXDEBUG_STATUS0 0x0108
23#define BCMA_CORE_PCIE2_RXDEBUG_CONTROL0 0x010C
24#define BCMA_CORE_PCIE2_CONFIGINDADDR 0x0120
25#define BCMA_CORE_PCIE2_CONFIGINDDATA 0x0124
26#define BCMA_CORE_PCIE2_MDIOCONTROL 0x0128
27#define BCMA_CORE_PCIE2_MDIOWRDATA 0x012C
28#define BCMA_CORE_PCIE2_MDIORDDATA 0x0130
29#define BCMA_CORE_PCIE2_DATAINTF 0x0180
30#define BCMA_CORE_PCIE2_D2H_INTRLAZY_0 0x0188
31#define BCMA_CORE_PCIE2_H2D_INTRLAZY_0 0x018c
32#define BCMA_CORE_PCIE2_H2D_INTSTAT_0 0x0190
33#define BCMA_CORE_PCIE2_H2D_INTMASK_0 0x0194
34#define BCMA_CORE_PCIE2_D2H_INTSTAT_0 0x0198
35#define BCMA_CORE_PCIE2_D2H_INTMASK_0 0x019c
36#define BCMA_CORE_PCIE2_LTR_STATE 0x01A0 /* Latency Tolerance Reporting */
37#define PCIE2_LTR_ACTIVE 2
38#define PCIE2_LTR_ACTIVE_IDLE 1
39#define PCIE2_LTR_SLEEP 0
40#define PCIE2_LTR_FINAL_MASK 0x300
41#define PCIE2_LTR_FINAL_SHIFT 8
42#define BCMA_CORE_PCIE2_PWR_INT_STATUS 0x01A4
43#define BCMA_CORE_PCIE2_PWR_INT_MASK 0x01A8
44#define BCMA_CORE_PCIE2_CFG_ADDR 0x01F8
45#define BCMA_CORE_PCIE2_CFG_DATA 0x01FC
46#define BCMA_CORE_PCIE2_SYS_EQ_PAGE 0x0200
47#define BCMA_CORE_PCIE2_SYS_MSI_PAGE 0x0204
48#define BCMA_CORE_PCIE2_SYS_MSI_INTREN 0x0208
49#define BCMA_CORE_PCIE2_SYS_MSI_CTRL0 0x0210
50#define BCMA_CORE_PCIE2_SYS_MSI_CTRL1 0x0214
51#define BCMA_CORE_PCIE2_SYS_MSI_CTRL2 0x0218
52#define BCMA_CORE_PCIE2_SYS_MSI_CTRL3 0x021C
53#define BCMA_CORE_PCIE2_SYS_MSI_CTRL4 0x0220
54#define BCMA_CORE_PCIE2_SYS_MSI_CTRL5 0x0224
55#define BCMA_CORE_PCIE2_SYS_EQ_HEAD0 0x0250
56#define BCMA_CORE_PCIE2_SYS_EQ_TAIL0 0x0254
57#define BCMA_CORE_PCIE2_SYS_EQ_HEAD1 0x0258
58#define BCMA_CORE_PCIE2_SYS_EQ_TAIL1 0x025C
59#define BCMA_CORE_PCIE2_SYS_EQ_HEAD2 0x0260
60#define BCMA_CORE_PCIE2_SYS_EQ_TAIL2 0x0264
61#define BCMA_CORE_PCIE2_SYS_EQ_HEAD3 0x0268
62#define BCMA_CORE_PCIE2_SYS_EQ_TAIL3 0x026C
63#define BCMA_CORE_PCIE2_SYS_EQ_HEAD4 0x0270
64#define BCMA_CORE_PCIE2_SYS_EQ_TAIL4 0x0274
65#define BCMA_CORE_PCIE2_SYS_EQ_HEAD5 0x0278
66#define BCMA_CORE_PCIE2_SYS_EQ_TAIL5 0x027C
67#define BCMA_CORE_PCIE2_SYS_RC_INTX_EN 0x0330
68#define BCMA_CORE_PCIE2_SYS_RC_INTX_CSR 0x0334
69#define BCMA_CORE_PCIE2_SYS_MSI_REQ 0x0340
70#define BCMA_CORE_PCIE2_SYS_HOST_INTR_EN 0x0344
71#define BCMA_CORE_PCIE2_SYS_HOST_INTR_CSR 0x0348
72#define BCMA_CORE_PCIE2_SYS_HOST_INTR0 0x0350
73#define BCMA_CORE_PCIE2_SYS_HOST_INTR1 0x0354
74#define BCMA_CORE_PCIE2_SYS_HOST_INTR2 0x0358
75#define BCMA_CORE_PCIE2_SYS_HOST_INTR3 0x035C
76#define BCMA_CORE_PCIE2_SYS_EP_INT_EN0 0x0360
77#define BCMA_CORE_PCIE2_SYS_EP_INT_EN1 0x0364
78#define BCMA_CORE_PCIE2_SYS_EP_INT_CSR0 0x0370
79#define BCMA_CORE_PCIE2_SYS_EP_INT_CSR1 0x0374
80#define BCMA_CORE_PCIE2_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2))
81#define BCMA_CORE_PCIE2_FUNC0_IMAP0_0 0x0C00
82#define BCMA_CORE_PCIE2_FUNC0_IMAP0_1 0x0C04
83#define BCMA_CORE_PCIE2_FUNC0_IMAP0_2 0x0C08
84#define BCMA_CORE_PCIE2_FUNC0_IMAP0_3 0x0C0C
85#define BCMA_CORE_PCIE2_FUNC0_IMAP0_4 0x0C10
86#define BCMA_CORE_PCIE2_FUNC0_IMAP0_5 0x0C14
87#define BCMA_CORE_PCIE2_FUNC0_IMAP0_6 0x0C18
88#define BCMA_CORE_PCIE2_FUNC0_IMAP0_7 0x0C1C
89#define BCMA_CORE_PCIE2_FUNC1_IMAP0_0 0x0C20
90#define BCMA_CORE_PCIE2_FUNC1_IMAP0_1 0x0C24
91#define BCMA_CORE_PCIE2_FUNC1_IMAP0_2 0x0C28
92#define BCMA_CORE_PCIE2_FUNC1_IMAP0_3 0x0C2C
93#define BCMA_CORE_PCIE2_FUNC1_IMAP0_4 0x0C30
94#define BCMA_CORE_PCIE2_FUNC1_IMAP0_5 0x0C34
95#define BCMA_CORE_PCIE2_FUNC1_IMAP0_6 0x0C38
96#define BCMA_CORE_PCIE2_FUNC1_IMAP0_7 0x0C3C
97#define BCMA_CORE_PCIE2_FUNC0_IMAP1 0x0C80
98#define BCMA_CORE_PCIE2_FUNC1_IMAP1 0x0C88
99#define BCMA_CORE_PCIE2_FUNC0_IMAP2 0x0CC0
100#define BCMA_CORE_PCIE2_FUNC1_IMAP2 0x0CC8
101#define BCMA_CORE_PCIE2_IARR0_LOWER 0x0D00
102#define BCMA_CORE_PCIE2_IARR0_UPPER 0x0D04
103#define BCMA_CORE_PCIE2_IARR1_LOWER 0x0D08
104#define BCMA_CORE_PCIE2_IARR1_UPPER 0x0D0C
105#define BCMA_CORE_PCIE2_IARR2_LOWER 0x0D10
106#define BCMA_CORE_PCIE2_IARR2_UPPER 0x0D14
107#define BCMA_CORE_PCIE2_OARR0 0x0D20
108#define BCMA_CORE_PCIE2_OARR1 0x0D28
109#define BCMA_CORE_PCIE2_OARR2 0x0D30
110#define BCMA_CORE_PCIE2_OMAP0_LOWER 0x0D40
111#define BCMA_CORE_PCIE2_OMAP0_UPPER 0x0D44
112#define BCMA_CORE_PCIE2_OMAP1_LOWER 0x0D48
113#define BCMA_CORE_PCIE2_OMAP1_UPPER 0x0D4C
114#define BCMA_CORE_PCIE2_OMAP2_LOWER 0x0D50
115#define BCMA_CORE_PCIE2_OMAP2_UPPER 0x0D54
116#define BCMA_CORE_PCIE2_FUNC1_IARR1_SIZE 0x0D58
117#define BCMA_CORE_PCIE2_FUNC1_IARR2_SIZE 0x0D5C
118#define BCMA_CORE_PCIE2_MEM_CONTROL 0x0F00
119#define BCMA_CORE_PCIE2_MEM_ECC_ERRLOG0 0x0F04
120#define BCMA_CORE_PCIE2_MEM_ECC_ERRLOG1 0x0F08
121#define BCMA_CORE_PCIE2_LINK_STATUS 0x0F0C
122#define BCMA_CORE_PCIE2_STRAP_STATUS 0x0F10
123#define BCMA_CORE_PCIE2_RESET_STATUS 0x0F14
124#define BCMA_CORE_PCIE2_RESETEN_IN_LINKDOWN 0x0F18
125#define BCMA_CORE_PCIE2_MISC_INTR_EN 0x0F1C
126#define BCMA_CORE_PCIE2_TX_DEBUG_CFG 0x0F20
127#define BCMA_CORE_PCIE2_MISC_CONFIG 0x0F24
128#define BCMA_CORE_PCIE2_MISC_STATUS 0x0F28
129#define BCMA_CORE_PCIE2_INTR_EN 0x0F30
130#define BCMA_CORE_PCIE2_INTR_CLEAR 0x0F34
131#define BCMA_CORE_PCIE2_INTR_STATUS 0x0F38
132
133/* PCIE gen2 config regs */
134#define PCIE2_INTSTATUS 0x090
135#define PCIE2_INTMASK 0x094
136#define PCIE2_SBMBX 0x098
137
138#define PCIE2_PMCR_REFUP 0x1814 /* Trefup time */
139
140#define PCIE2_CAP_DEVSTSCTRL2_OFFSET 0xD4
141#define PCIE2_CAP_DEVSTSCTRL2_LTRENAB 0x400
142#define PCIE2_PVT_REG_PM_CLK_PERIOD 0x184c
143
144struct bcma_drv_pcie2 {
145 struct bcma_device *core;
146};
147
148#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset)
149#define pcie2_read32(pcie2, offset) bcma_read32((pcie2)->core, offset)
150#define pcie2_write16(pcie2, offset, val) bcma_write16((pcie2)->core, offset, val)
151#define pcie2_write32(pcie2, offset, val) bcma_write32((pcie2)->core, offset, val)
152
153#define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set)
154#define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask)
155
156void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
157
158#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 7ad634501e48..e1c8d080c427 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -88,32 +88,32 @@
88 * lib/bitmap.c provides these functions: 88 * lib/bitmap.c provides these functions:
89 */ 89 */
90 90
91extern int __bitmap_empty(const unsigned long *bitmap, int bits); 91extern int __bitmap_empty(const unsigned long *bitmap, unsigned int nbits);
92extern int __bitmap_full(const unsigned long *bitmap, int bits); 92extern int __bitmap_full(const unsigned long *bitmap, unsigned int nbits);
93extern int __bitmap_equal(const unsigned long *bitmap1, 93extern int __bitmap_equal(const unsigned long *bitmap1,
94 const unsigned long *bitmap2, int bits); 94 const unsigned long *bitmap2, unsigned int nbits);
95extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, 95extern void __bitmap_complement(unsigned long *dst, const unsigned long *src,
96 int bits); 96 unsigned int nbits);
97extern void __bitmap_shift_right(unsigned long *dst, 97extern void __bitmap_shift_right(unsigned long *dst,
98 const unsigned long *src, int shift, int bits); 98 const unsigned long *src, int shift, int bits);
99extern void __bitmap_shift_left(unsigned long *dst, 99extern void __bitmap_shift_left(unsigned long *dst,
100 const unsigned long *src, int shift, int bits); 100 const unsigned long *src, int shift, int bits);
101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
102 const unsigned long *bitmap2, int bits); 102 const unsigned long *bitmap2, unsigned int nbits);
103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
104 const unsigned long *bitmap2, int bits); 104 const unsigned long *bitmap2, unsigned int nbits);
105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, 105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
106 const unsigned long *bitmap2, int bits); 106 const unsigned long *bitmap2, unsigned int nbits);
107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
108 const unsigned long *bitmap2, int bits); 108 const unsigned long *bitmap2, unsigned int nbits);
109extern int __bitmap_intersects(const unsigned long *bitmap1, 109extern int __bitmap_intersects(const unsigned long *bitmap1,
110 const unsigned long *bitmap2, int bits); 110 const unsigned long *bitmap2, unsigned int nbits);
111extern int __bitmap_subset(const unsigned long *bitmap1, 111extern int __bitmap_subset(const unsigned long *bitmap1,
112 const unsigned long *bitmap2, int bits); 112 const unsigned long *bitmap2, unsigned int nbits);
113extern int __bitmap_weight(const unsigned long *bitmap, int bits); 113extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits);
114 114
115extern void bitmap_set(unsigned long *map, int i, int len); 115extern void bitmap_set(unsigned long *map, unsigned int start, int len);
116extern void bitmap_clear(unsigned long *map, int start, int nr); 116extern void bitmap_clear(unsigned long *map, unsigned int start, int len);
117extern unsigned long bitmap_find_next_zero_area(unsigned long *map, 117extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
118 unsigned long size, 118 unsigned long size,
119 unsigned long start, 119 unsigned long start,
@@ -140,9 +140,9 @@ extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
140 const unsigned long *relmap, int bits); 140 const unsigned long *relmap, int bits);
141extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, 141extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
142 int sz, int bits); 142 int sz, int bits);
143extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 143extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
144extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 144extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
145extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 145extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); 146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); 147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits);
148 148
@@ -188,15 +188,15 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
188} 188}
189 189
190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, 190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
191 const unsigned long *src2, int nbits) 191 const unsigned long *src2, unsigned int nbits)
192{ 192{
193 if (small_const_nbits(nbits)) 193 if (small_const_nbits(nbits))
194 return (*dst = *src1 & *src2) != 0; 194 return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0;
195 return __bitmap_and(dst, src1, src2, nbits); 195 return __bitmap_and(dst, src1, src2, nbits);
196} 196}
197 197
198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
199 const unsigned long *src2, int nbits) 199 const unsigned long *src2, unsigned int nbits)
200{ 200{
201 if (small_const_nbits(nbits)) 201 if (small_const_nbits(nbits))
202 *dst = *src1 | *src2; 202 *dst = *src1 | *src2;
@@ -205,7 +205,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
205} 205}
206 206
207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, 207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
208 const unsigned long *src2, int nbits) 208 const unsigned long *src2, unsigned int nbits)
209{ 209{
210 if (small_const_nbits(nbits)) 210 if (small_const_nbits(nbits))
211 *dst = *src1 ^ *src2; 211 *dst = *src1 ^ *src2;
@@ -214,24 +214,24 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
214} 214}
215 215
216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, 216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
217 const unsigned long *src2, int nbits) 217 const unsigned long *src2, unsigned int nbits)
218{ 218{
219 if (small_const_nbits(nbits)) 219 if (small_const_nbits(nbits))
220 return (*dst = *src1 & ~(*src2)) != 0; 220 return (*dst = *src1 & ~(*src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
221 return __bitmap_andnot(dst, src1, src2, nbits); 221 return __bitmap_andnot(dst, src1, src2, nbits);
222} 222}
223 223
224static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, 224static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
225 int nbits) 225 unsigned int nbits)
226{ 226{
227 if (small_const_nbits(nbits)) 227 if (small_const_nbits(nbits))
228 *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); 228 *dst = ~(*src);
229 else 229 else
230 __bitmap_complement(dst, src, nbits); 230 __bitmap_complement(dst, src, nbits);
231} 231}
232 232
233static inline int bitmap_equal(const unsigned long *src1, 233static inline int bitmap_equal(const unsigned long *src1,
234 const unsigned long *src2, int nbits) 234 const unsigned long *src2, unsigned int nbits)
235{ 235{
236 if (small_const_nbits(nbits)) 236 if (small_const_nbits(nbits))
237 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); 237 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
@@ -240,7 +240,7 @@ static inline int bitmap_equal(const unsigned long *src1,
240} 240}
241 241
242static inline int bitmap_intersects(const unsigned long *src1, 242static inline int bitmap_intersects(const unsigned long *src1,
243 const unsigned long *src2, int nbits) 243 const unsigned long *src2, unsigned int nbits)
244{ 244{
245 if (small_const_nbits(nbits)) 245 if (small_const_nbits(nbits))
246 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; 246 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
@@ -249,7 +249,7 @@ static inline int bitmap_intersects(const unsigned long *src1,
249} 249}
250 250
251static inline int bitmap_subset(const unsigned long *src1, 251static inline int bitmap_subset(const unsigned long *src1,
252 const unsigned long *src2, int nbits) 252 const unsigned long *src2, unsigned int nbits)
253{ 253{
254 if (small_const_nbits(nbits)) 254 if (small_const_nbits(nbits))
255 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); 255 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
@@ -257,7 +257,7 @@ static inline int bitmap_subset(const unsigned long *src1,
257 return __bitmap_subset(src1, src2, nbits); 257 return __bitmap_subset(src1, src2, nbits);
258} 258}
259 259
260static inline int bitmap_empty(const unsigned long *src, int nbits) 260static inline int bitmap_empty(const unsigned long *src, unsigned nbits)
261{ 261{
262 if (small_const_nbits(nbits)) 262 if (small_const_nbits(nbits))
263 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); 263 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -265,7 +265,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits)
265 return __bitmap_empty(src, nbits); 265 return __bitmap_empty(src, nbits);
266} 266}
267 267
268static inline int bitmap_full(const unsigned long *src, int nbits) 268static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
269{ 269{
270 if (small_const_nbits(nbits)) 270 if (small_const_nbits(nbits))
271 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); 271 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
@@ -273,7 +273,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
273 return __bitmap_full(src, nbits); 273 return __bitmap_full(src, nbits);
274} 274}
275 275
276static inline int bitmap_weight(const unsigned long *src, int nbits) 276static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
277{ 277{
278 if (small_const_nbits(nbits)) 278 if (small_const_nbits(nbits))
279 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); 279 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -284,7 +284,7 @@ static inline void bitmap_shift_right(unsigned long *dst,
284 const unsigned long *src, int n, int nbits) 284 const unsigned long *src, int n, int nbits)
285{ 285{
286 if (small_const_nbits(nbits)) 286 if (small_const_nbits(nbits))
287 *dst = *src >> n; 287 *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> n;
288 else 288 else
289 __bitmap_shift_right(dst, src, n, nbits); 289 __bitmap_shift_right(dst, src, n, nbits);
290} 290}
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 0846e6b931ce..89f67c1c3160 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -2,7 +2,7 @@
2#define _LINUX_BYTEORDER_GENERIC_H 2#define _LINUX_BYTEORDER_GENERIC_H
3 3
4/* 4/*
5 * linux/byteorder_generic.h 5 * linux/byteorder/generic.h
6 * Generic Byte-reordering support 6 * Generic Byte-reordering support
7 * 7 *
8 * The "... p" macros, like le64_to_cpup, can be used with pointers 8 * The "... p" macros, like le64_to_cpup, can be used with pointers
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 84b13ad67c1c..aa93e5ef594c 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -78,8 +78,11 @@ extern const kernel_cap_t __cap_init_eff_set;
78# error Fix up hand-coded capability macro initializers 78# error Fix up hand-coded capability macro initializers
79#else /* HAND-CODED capability initializers */ 79#else /* HAND-CODED capability initializers */
80 80
81#define CAP_LAST_U32 ((_KERNEL_CAPABILITY_U32S) - 1)
82#define CAP_LAST_U32_VALID_MASK (CAP_TO_MASK(CAP_LAST_CAP + 1) -1)
83
81# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }}) 84# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }})
82# define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }}) 85# define CAP_FULL_SET ((kernel_cap_t){{ ~0, CAP_LAST_U32_VALID_MASK }})
83# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ 86# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \
84 | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \ 87 | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \
85 CAP_FS_MASK_B1 } }) 88 CAP_FS_MASK_B1 } })
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 8a111dd42d7a..b5223c570eba 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -203,7 +203,15 @@ struct cgroup {
203 struct kernfs_node *kn; /* cgroup kernfs entry */ 203 struct kernfs_node *kn; /* cgroup kernfs entry */
204 struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */ 204 struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */
205 205
206 /* the bitmask of subsystems enabled on the child cgroups */ 206 /*
207 * The bitmask of subsystems enabled on the child cgroups.
208 * ->subtree_control is the one configured through
209 * "cgroup.subtree_control" while ->child_subsys_mask is the
210 * effective one which may have more subsystems enabled.
211 * Controller knobs are made available iff it's enabled in
212 * ->subtree_control.
213 */
214 unsigned int subtree_control;
207 unsigned int child_subsys_mask; 215 unsigned int child_subsys_mask;
208 216
209 /* Private pointers for each registered subsystem */ 217 /* Private pointers for each registered subsystem */
@@ -248,73 +256,9 @@ struct cgroup {
248 256
249/* cgroup_root->flags */ 257/* cgroup_root->flags */
250enum { 258enum {
251 /* 259 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), /* __DEVEL__sane_behavior specified */
252 * Unfortunately, cgroup core and various controllers are riddled
253 * with idiosyncrasies and pointless options. The following flag,
254 * when set, will force sane behavior - some options are forced on,
255 * others are disallowed, and some controllers will change their
256 * hierarchical or other behaviors.
257 *
258 * The set of behaviors affected by this flag are still being
259 * determined and developed and the mount option for this flag is
260 * prefixed with __DEVEL__. The prefix will be dropped once we
261 * reach the point where all behaviors are compatible with the
262 * planned unified hierarchy, which will automatically turn on this
263 * flag.
264 *
265 * The followings are the behaviors currently affected this flag.
266 *
267 * - Mount options "noprefix", "xattr", "clone_children",
268 * "release_agent" and "name" are disallowed.
269 *
270 * - When mounting an existing superblock, mount options should
271 * match.
272 *
273 * - Remount is disallowed.
274 *
275 * - rename(2) is disallowed.
276 *
277 * - "tasks" is removed. Everything should be at process
278 * granularity. Use "cgroup.procs" instead.
279 *
280 * - "cgroup.procs" is not sorted. pids will be unique unless they
281 * got recycled inbetween reads.
282 *
283 * - "release_agent" and "notify_on_release" are removed.
284 * Replacement notification mechanism will be implemented.
285 *
286 * - "cgroup.clone_children" is removed.
287 *
288 * - "cgroup.subtree_populated" is available. Its value is 0 if
289 * the cgroup and its descendants contain no task; otherwise, 1.
290 * The file also generates kernfs notification which can be
291 * monitored through poll and [di]notify when the value of the
292 * file changes.
293 *
294 * - If mount is requested with sane_behavior but without any
295 * subsystem, the default unified hierarchy is mounted.
296 *
297 * - cpuset: tasks will be kept in empty cpusets when hotplug happens
298 * and take masks of ancestors with non-empty cpus/mems, instead of
299 * being moved to an ancestor.
300 *
301 * - cpuset: a task can be moved into an empty cpuset, and again it
302 * takes masks of ancestors.
303 *
304 * - memcg: use_hierarchy is on by default and the cgroup file for
305 * the flag is not created.
306 *
307 * - blkcg: blk-throttle becomes properly hierarchical.
308 *
309 * - debug: disallowed on the default hierarchy.
310 */
311 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
312
313 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */ 260 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */
314 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */ 261 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */
315
316 /* mount options live below bit 16 */
317 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1,
318}; 262};
319 263
320/* 264/*
@@ -440,9 +384,11 @@ struct css_set {
440enum { 384enum {
441 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */ 385 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
442 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ 386 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
443 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
444 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ 387 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
445 CFTYPE_ONLY_ON_DFL = (1 << 4), /* only on default hierarchy */ 388
389 /* internal flags, do not use outside cgroup core proper */
390 __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */
391 __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */
446}; 392};
447 393
448#define MAX_CFTYPE_NAME 64 394#define MAX_CFTYPE_NAME 64
@@ -526,20 +472,64 @@ struct cftype {
526extern struct cgroup_root cgrp_dfl_root; 472extern struct cgroup_root cgrp_dfl_root;
527extern struct css_set init_css_set; 473extern struct css_set init_css_set;
528 474
475/**
476 * cgroup_on_dfl - test whether a cgroup is on the default hierarchy
477 * @cgrp: the cgroup of interest
478 *
479 * The default hierarchy is the v2 interface of cgroup and this function
480 * can be used to test whether a cgroup is on the default hierarchy for
481 * cases where a subsystem should behave differnetly depending on the
482 * interface version.
483 *
484 * The set of behaviors which change on the default hierarchy are still
485 * being determined and the mount option is prefixed with __DEVEL__.
486 *
487 * List of changed behaviors:
488 *
489 * - Mount options "noprefix", "xattr", "clone_children", "release_agent"
490 * and "name" are disallowed.
491 *
492 * - When mounting an existing superblock, mount options should match.
493 *
494 * - Remount is disallowed.
495 *
496 * - rename(2) is disallowed.
497 *
498 * - "tasks" is removed. Everything should be at process granularity. Use
499 * "cgroup.procs" instead.
500 *
501 * - "cgroup.procs" is not sorted. pids will be unique unless they got
502 * recycled inbetween reads.
503 *
504 * - "release_agent" and "notify_on_release" are removed. Replacement
505 * notification mechanism will be implemented.
506 *
507 * - "cgroup.clone_children" is removed.
508 *
509 * - "cgroup.subtree_populated" is available. Its value is 0 if the cgroup
510 * and its descendants contain no task; otherwise, 1. The file also
511 * generates kernfs notification which can be monitored through poll and
512 * [di]notify when the value of the file changes.
513 *
514 * - cpuset: tasks will be kept in empty cpusets when hotplug happens and
515 * take masks of ancestors with non-empty cpus/mems, instead of being
516 * moved to an ancestor.
517 *
518 * - cpuset: a task can be moved into an empty cpuset, and again it takes
519 * masks of ancestors.
520 *
521 * - memcg: use_hierarchy is on by default and the cgroup file for the flag
522 * is not created.
523 *
524 * - blkcg: blk-throttle becomes properly hierarchical.
525 *
526 * - debug: disallowed on the default hierarchy.
527 */
529static inline bool cgroup_on_dfl(const struct cgroup *cgrp) 528static inline bool cgroup_on_dfl(const struct cgroup *cgrp)
530{ 529{
531 return cgrp->root == &cgrp_dfl_root; 530 return cgrp->root == &cgrp_dfl_root;
532} 531}
533 532
534/*
535 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
536 * function can be called as long as @cgrp is accessible.
537 */
538static inline bool cgroup_sane_behavior(const struct cgroup *cgrp)
539{
540 return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR;
541}
542
543/* no synchronization, the result can only be used as a hint */ 533/* no synchronization, the result can only be used as a hint */
544static inline bool cgroup_has_tasks(struct cgroup *cgrp) 534static inline bool cgroup_has_tasks(struct cgroup *cgrp)
545{ 535{
@@ -602,7 +592,8 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
602 592
603char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); 593char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
604 594
605int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 595int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
596int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
606int cgroup_rm_cftypes(struct cftype *cfts); 597int cgroup_rm_cftypes(struct cftype *cfts);
607 598
608bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 599bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
@@ -634,6 +625,7 @@ struct cgroup_subsys {
634 int (*css_online)(struct cgroup_subsys_state *css); 625 int (*css_online)(struct cgroup_subsys_state *css);
635 void (*css_offline)(struct cgroup_subsys_state *css); 626 void (*css_offline)(struct cgroup_subsys_state *css);
636 void (*css_free)(struct cgroup_subsys_state *css); 627 void (*css_free)(struct cgroup_subsys_state *css);
628 void (*css_reset)(struct cgroup_subsys_state *css);
637 629
638 int (*can_attach)(struct cgroup_subsys_state *css, 630 int (*can_attach)(struct cgroup_subsys_state *css,
639 struct cgroup_taskset *tset); 631 struct cgroup_taskset *tset);
@@ -682,8 +674,21 @@ struct cgroup_subsys {
682 */ 674 */
683 struct list_head cfts; 675 struct list_head cfts;
684 676
685 /* base cftypes, automatically registered with subsys itself */ 677 /*
686 struct cftype *base_cftypes; 678 * Base cftypes which are automatically registered. The two can
679 * point to the same array.
680 */
681 struct cftype *dfl_cftypes; /* for the default hierarchy */
682 struct cftype *legacy_cftypes; /* for the legacy hierarchies */
683
684 /*
685 * A subsystem may depend on other subsystems. When such subsystem
686 * is enabled on a cgroup, the depended-upon subsystems are enabled
687 * together if available. Subsystems enabled due to dependency are
688 * not visible to userland until explicitly enabled. The following
689 * specifies the mask of subsystems that this one depends on.
690 */
691 unsigned int depends_on;
687}; 692};
688 693
689#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys; 694#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 0c287dbbb144..411dd7eb2653 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -619,5 +619,10 @@ static inline void clk_writel(u32 val, u32 __iomem *reg)
619 619
620#endif /* platform dependent I/O accessors */ 620#endif /* platform dependent I/O accessors */
621 621
622#ifdef CONFIG_DEBUG_FS
623struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode,
624 void *data, const struct file_operations *fops);
625#endif
626
622#endif /* CONFIG_COMMON_CLK */ 627#endif /* CONFIG_COMMON_CLK */
623#endif /* CLK_PROVIDER_H */ 628#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk/clk-conf.h b/include/linux/clk/clk-conf.h
new file mode 100644
index 000000000000..f3050e15f833
--- /dev/null
+++ b/include/linux/clk/clk-conf.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2014 Samsung Electronics Co., Ltd.
3 * Sylwester Nawrocki <s.nawrocki@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10struct device_node;
11
12#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
13int of_clk_set_defaults(struct device_node *node, bool clk_supplier);
14#else
15static inline int of_clk_set_defaults(struct device_node *node,
16 bool clk_supplier)
17{
18 return 0;
19}
20#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index a16b497d5159..653f0e2b6ca9 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -162,7 +162,6 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
162 * @archdata: arch-specific data 162 * @archdata: arch-specific data
163 * @suspend: suspend function for the clocksource, if necessary 163 * @suspend: suspend function for the clocksource, if necessary
164 * @resume: resume function for the clocksource, if necessary 164 * @resume: resume function for the clocksource, if necessary
165 * @cycle_last: most recent cycle counter value seen by ::read()
166 * @owner: module reference, must be set by clocksource in modules 165 * @owner: module reference, must be set by clocksource in modules
167 */ 166 */
168struct clocksource { 167struct clocksource {
@@ -171,7 +170,6 @@ struct clocksource {
171 * clocksource itself is cacheline aligned. 170 * clocksource itself is cacheline aligned.
172 */ 171 */
173 cycle_t (*read)(struct clocksource *cs); 172 cycle_t (*read)(struct clocksource *cs);
174 cycle_t cycle_last;
175 cycle_t mask; 173 cycle_t mask;
176 u32 mult; 174 u32 mult;
177 u32 shift; 175 u32 shift;
diff --git a/include/linux/cma.h b/include/linux/cma.h
new file mode 100644
index 000000000000..371b93042520
--- /dev/null
+++ b/include/linux/cma.h
@@ -0,0 +1,27 @@
1#ifndef __CMA_H__
2#define __CMA_H__
3
4/*
5 * There is always at least global CMA area and a few optional
6 * areas configured in kernel .config.
7 */
8#ifdef CONFIG_CMA_AREAS
9#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
10
11#else
12#define MAX_CMA_AREAS (0)
13
14#endif
15
16struct cma;
17
18extern phys_addr_t cma_get_base(struct cma *cma);
19extern unsigned long cma_get_size(struct cma *cma);
20
21extern int __init cma_declare_contiguous(phys_addr_t size,
22 phys_addr_t base, phys_addr_t limit,
23 phys_addr_t alignment, unsigned int order_per_bit,
24 bool fixed, struct cma **res_cma);
25extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align);
26extern bool cma_release(struct cma *cma, struct page *pages, int count);
27#endif
diff --git a/include/linux/component.h b/include/linux/component.h
index 68870182ca1e..c00dcc302611 100644
--- a/include/linux/component.h
+++ b/include/linux/component.h
@@ -29,4 +29,11 @@ void component_master_del(struct device *,
29int component_master_add_child(struct master *master, 29int component_master_add_child(struct master *master,
30 int (*compare)(struct device *, void *), void *compare_data); 30 int (*compare)(struct device *, void *), void *compare_data);
31 31
32struct component_match;
33
34int component_master_add_with_match(struct device *,
35 const struct component_master_ops *, struct component_match *);
36void component_match_add(struct device *, struct component_match **,
37 int (*compare)(struct device *, void *), void *compare_data);
38
32#endif 39#endif
diff --git a/include/linux/cper.h b/include/linux/cper.h
index 2fc0ec3d89cc..76abba4b238e 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -22,6 +22,7 @@
22#define LINUX_CPER_H 22#define LINUX_CPER_H
23 23
24#include <linux/uuid.h> 24#include <linux/uuid.h>
25#include <linux/trace_seq.h>
25 26
26/* CPER record signature and the size */ 27/* CPER record signature and the size */
27#define CPER_SIG_RECORD "CPER" 28#define CPER_SIG_RECORD "CPER"
@@ -36,6 +37,13 @@
36#define CPER_RECORD_REV 0x0100 37#define CPER_RECORD_REV 0x0100
37 38
38/* 39/*
40 * CPER record length contains the CPER fields which are relevant for further
41 * handling of a memory error in userspace (we don't carry all the fields
42 * defined in the UEFI spec because some of them don't make any sense.)
43 * Currently, a length of 256 should be more than enough.
44 */
45#define CPER_REC_LEN 256
46/*
39 * Severity difinition for error_severity in struct cper_record_header 47 * Severity difinition for error_severity in struct cper_record_header
40 * and section_severity in struct cper_section_descriptor 48 * and section_severity in struct cper_section_descriptor
41 */ 49 */
@@ -356,6 +364,24 @@ struct cper_sec_mem_err {
356 __u16 mem_dev_handle; /* module handle in UEFI 2.4 */ 364 __u16 mem_dev_handle; /* module handle in UEFI 2.4 */
357}; 365};
358 366
367struct cper_mem_err_compact {
368 __u64 validation_bits;
369 __u16 node;
370 __u16 card;
371 __u16 module;
372 __u16 bank;
373 __u16 device;
374 __u16 row;
375 __u16 column;
376 __u16 bit_pos;
377 __u64 requestor_id;
378 __u64 responder_id;
379 __u64 target_id;
380 __u16 rank;
381 __u16 mem_array_handle;
382 __u16 mem_dev_handle;
383};
384
359struct cper_sec_pcie { 385struct cper_sec_pcie {
360 __u64 validation_bits; 386 __u64 validation_bits;
361 __u32 port_type; 387 __u32 port_type;
@@ -395,7 +421,13 @@ struct cper_sec_pcie {
395#pragma pack() 421#pragma pack()
396 422
397u64 cper_next_record_id(void); 423u64 cper_next_record_id(void);
424const char *cper_severity_str(unsigned int);
425const char *cper_mem_err_type_str(unsigned int);
398void cper_print_bits(const char *prefix, unsigned int bits, 426void cper_print_bits(const char *prefix, unsigned int bits,
399 const char * const strs[], unsigned int strs_size); 427 const char * const strs[], unsigned int strs_size);
428void cper_mem_err_pack(const struct cper_sec_mem_err *,
429 struct cper_mem_err_compact *);
430const char *cper_mem_err_unpack(struct trace_seq *,
431 struct cper_mem_err_compact *);
400 432
401#endif 433#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 8f8ae95c6e27..7d1955afa62c 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -176,6 +176,7 @@ static inline void disable_cpufreq(void) { }
176 176
177#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */ 177#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */
178#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */ 178#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */
179#define CPUFREQ_RELATION_C 2 /* closest frequency to target */
179 180
180struct freq_attr { 181struct freq_attr {
181 struct attribute attr; 182 struct attribute attr;
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index 7d275c4fc011..9e8a032c1788 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -8,8 +8,8 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/bitrev.h> 9#include <linux/bitrev.h>
10 10
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14/** 14/**
15 * crc32_le_combine - Combine two crc32 check values into one. For two 15 * crc32_le_combine - Combine two crc32 check values into one. For two
@@ -29,9 +29,14 @@ extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
29 * with the same initializer as crc1, and crc2 seed was 0. See 29 * with the same initializer as crc1, and crc2 seed was 0. See
30 * also crc32_combine_test(). 30 * also crc32_combine_test().
31 */ 31 */
32extern u32 crc32_le_combine(u32 crc1, u32 crc2, size_t len2); 32u32 __attribute_const__ crc32_le_shift(u32 crc, size_t len);
33 33
34extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); 34static inline u32 crc32_le_combine(u32 crc1, u32 crc2, size_t len2)
35{
36 return crc32_le_shift(crc1, len2) ^ crc2;
37}
38
39u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len);
35 40
36/** 41/**
37 * __crc32c_le_combine - Combine two crc32c check values into one. For two 42 * __crc32c_le_combine - Combine two crc32c check values into one. For two
@@ -51,7 +56,12 @@ extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len);
51 * seeded with the same initializer as crc1, and crc2 seed 56 * seeded with the same initializer as crc1, and crc2 seed
52 * was 0. See also crc32c_combine_test(). 57 * was 0. See also crc32c_combine_test().
53 */ 58 */
54extern u32 __crc32c_le_combine(u32 crc1, u32 crc2, size_t len2); 59u32 __attribute_const__ __crc32c_le_shift(u32 crc, size_t len);
60
61static inline u32 __crc32c_le_combine(u32 crc1, u32 crc2, size_t len2)
62{
63 return __crc32c_le_shift(crc1, len2) ^ crc2;
64}
55 65
56#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) 66#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
57 67
diff --git a/include/linux/cred.h b/include/linux/cred.h
index f61d6c8f5ef3..b2d0820837c4 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -259,6 +259,15 @@ static inline void put_cred(const struct cred *_cred)
259 rcu_dereference_protected(current->cred, 1) 259 rcu_dereference_protected(current->cred, 1)
260 260
261/** 261/**
262 * current_real_cred - Access the current task's objective credentials
263 *
264 * Access the objective credentials of the current task. RCU-safe,
265 * since nobody else can modify it.
266 */
267#define current_real_cred() \
268 rcu_dereference_protected(current->real_cred, 1)
269
270/**
262 * __task_cred - Access a task's objective credentials 271 * __task_cred - Access a task's objective credentials
263 * @task: The task to query 272 * @task: The task to query
264 * 273 *
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index b92eadf92d72..d45e949699ea 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -710,9 +710,9 @@ static inline void ablkcipher_request_free(struct ablkcipher_request *req)
710 710
711static inline void ablkcipher_request_set_callback( 711static inline void ablkcipher_request_set_callback(
712 struct ablkcipher_request *req, 712 struct ablkcipher_request *req,
713 u32 flags, crypto_completion_t complete, void *data) 713 u32 flags, crypto_completion_t compl, void *data)
714{ 714{
715 req->base.complete = complete; 715 req->base.complete = compl;
716 req->base.data = data; 716 req->base.data = data;
717 req->base.flags = flags; 717 req->base.flags = flags;
718} 718}
@@ -841,10 +841,10 @@ static inline void aead_request_free(struct aead_request *req)
841 841
842static inline void aead_request_set_callback(struct aead_request *req, 842static inline void aead_request_set_callback(struct aead_request *req,
843 u32 flags, 843 u32 flags,
844 crypto_completion_t complete, 844 crypto_completion_t compl,
845 void *data) 845 void *data)
846{ 846{
847 req->base.complete = complete; 847 req->base.complete = compl;
848 req->base.data = data; 848 req->base.data = data;
849 req->base.flags = flags; 849 req->base.flags = flags;
850} 850}
diff --git a/include/linux/decompress/bunzip2.h b/include/linux/decompress/bunzip2.h
index 115272137a9c..4d683df898e6 100644
--- a/include/linux/decompress/bunzip2.h
+++ b/include/linux/decompress/bunzip2.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_BUNZIP2_H 1#ifndef DECOMPRESS_BUNZIP2_H
2#define DECOMPRESS_BUNZIP2_H 2#define DECOMPRESS_BUNZIP2_H
3 3
4int bunzip2(unsigned char *inbuf, int len, 4int bunzip2(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h
index 0c7111a55a1a..1fcfd64b5076 100644
--- a/include/linux/decompress/generic.h
+++ b/include/linux/decompress/generic.h
@@ -1,11 +1,11 @@
1#ifndef DECOMPRESS_GENERIC_H 1#ifndef DECOMPRESS_GENERIC_H
2#define DECOMPRESS_GENERIC_H 2#define DECOMPRESS_GENERIC_H
3 3
4typedef int (*decompress_fn) (unsigned char *inbuf, int len, 4typedef int (*decompress_fn) (unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *outbuf, 7 unsigned char *outbuf,
8 int *posp, 8 long *posp,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10 10
11/* inbuf - input buffer 11/* inbuf - input buffer
@@ -33,7 +33,7 @@ typedef int (*decompress_fn) (unsigned char *inbuf, int len,
33 33
34 34
35/* Utility routine to detect the decompression method */ 35/* Utility routine to detect the decompression method */
36decompress_fn decompress_method(const unsigned char *inbuf, int len, 36decompress_fn decompress_method(const unsigned char *inbuf, long len,
37 const char **name); 37 const char **name);
38 38
39#endif 39#endif
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
index 1d0aedef9822..e4f411fdbd24 100644
--- a/include/linux/decompress/inflate.h
+++ b/include/linux/decompress/inflate.h
@@ -1,10 +1,10 @@
1#ifndef LINUX_DECOMPRESS_INFLATE_H 1#ifndef LINUX_DECOMPRESS_INFLATE_H
2#define LINUX_DECOMPRESS_INFLATE_H 2#define LINUX_DECOMPRESS_INFLATE_H
3 3
4int gunzip(unsigned char *inbuf, int len, 4int gunzip(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error_fn)(char *x)); 9 void(*error_fn)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unlz4.h b/include/linux/decompress/unlz4.h
index d5b68bf3ec92..3273c2f36496 100644
--- a/include/linux/decompress/unlz4.h
+++ b/include/linux/decompress/unlz4.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_UNLZ4_H 1#ifndef DECOMPRESS_UNLZ4_H
2#define DECOMPRESS_UNLZ4_H 2#define DECOMPRESS_UNLZ4_H
3 3
4int unlz4(unsigned char *inbuf, int len, 4int unlz4(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unlzma.h b/include/linux/decompress/unlzma.h
index 7796538f1bf4..8a891a193840 100644
--- a/include/linux/decompress/unlzma.h
+++ b/include/linux/decompress/unlzma.h
@@ -1,11 +1,11 @@
1#ifndef DECOMPRESS_UNLZMA_H 1#ifndef DECOMPRESS_UNLZMA_H
2#define DECOMPRESS_UNLZMA_H 2#define DECOMPRESS_UNLZMA_H
3 3
4int unlzma(unsigned char *, int, 4int unlzma(unsigned char *, long,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *posp, 8 long *posp,
9 void(*error)(char *x) 9 void(*error)(char *x)
10 ); 10 );
11 11
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h
index 987229752519..af18f95d6570 100644
--- a/include/linux/decompress/unlzo.h
+++ b/include/linux/decompress/unlzo.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_UNLZO_H 1#ifndef DECOMPRESS_UNLZO_H
2#define DECOMPRESS_UNLZO_H 2#define DECOMPRESS_UNLZO_H
3 3
4int unlzo(unsigned char *inbuf, int len, 4int unlzo(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unxz.h b/include/linux/decompress/unxz.h
index 41728fc6c8a1..f764e2a7201e 100644
--- a/include/linux/decompress/unxz.h
+++ b/include/linux/decompress/unxz.h
@@ -10,10 +10,10 @@
10#ifndef DECOMPRESS_UNXZ_H 10#ifndef DECOMPRESS_UNXZ_H
11#define DECOMPRESS_UNXZ_H 11#define DECOMPRESS_UNXZ_H
12 12
13int unxz(unsigned char *in, int in_size, 13int unxz(unsigned char *in, long in_size,
14 int (*fill)(void *dest, unsigned int size), 14 long (*fill)(void *dest, unsigned long size),
15 int (*flush)(void *src, unsigned int size), 15 long (*flush)(void *src, unsigned long size),
16 unsigned char *out, int *in_used, 16 unsigned char *out, long *in_used,
17 void (*error)(char *x)); 17 void (*error)(char *x));
18 18
19#endif 19#endif
diff --git a/include/linux/device.h b/include/linux/device.h
index af424acd393d..43d183aeb25b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -124,7 +124,7 @@ struct bus_type {
124 124
125 const struct dev_pm_ops *pm; 125 const struct dev_pm_ops *pm;
126 126
127 struct iommu_ops *iommu_ops; 127 const struct iommu_ops *iommu_ops;
128 128
129 struct subsys_private *p; 129 struct subsys_private *p;
130 struct lock_class_key lock_key; 130 struct lock_class_key lock_key;
@@ -605,6 +605,10 @@ extern int devres_release_group(struct device *dev, void *id);
605 605
606/* managed devm_k.alloc/kfree for device drivers */ 606/* managed devm_k.alloc/kfree for device drivers */
607extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); 607extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
608extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
609 va_list ap);
610extern char *devm_kasprintf(struct device *dev, gfp_t gfp,
611 const char *fmt, ...);
608static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 612static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
609{ 613{
610 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
@@ -631,8 +635,6 @@ extern unsigned long devm_get_free_pages(struct device *dev,
631extern void devm_free_pages(struct device *dev, unsigned long addr); 635extern void devm_free_pages(struct device *dev, unsigned long addr);
632 636
633void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 637void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
634void __iomem *devm_request_and_ioremap(struct device *dev,
635 struct resource *res);
636 638
637/* allows to add/remove a custom action to devres stack */ 639/* allows to add/remove a custom action to devres stack */
638int devm_add_action(struct device *dev, void (*action)(void *), void *data); 640int devm_add_action(struct device *dev, void (*action)(void *), void *data);
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index f886985a28b2..694e1fe1c4b4 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -30,6 +30,8 @@
30#include <linux/list.h> 30#include <linux/list.h>
31#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/fence.h>
34#include <linux/wait.h>
33 35
34struct device; 36struct device;
35struct dma_buf; 37struct dma_buf;
@@ -115,6 +117,7 @@ struct dma_buf_ops {
115 * @exp_name: name of the exporter; useful for debugging. 117 * @exp_name: name of the exporter; useful for debugging.
116 * @list_node: node for dma_buf accounting and debugging. 118 * @list_node: node for dma_buf accounting and debugging.
117 * @priv: exporter specific private data for this buffer object. 119 * @priv: exporter specific private data for this buffer object.
120 * @resv: reservation object linked to this dma-buf
118 */ 121 */
119struct dma_buf { 122struct dma_buf {
120 size_t size; 123 size_t size;
@@ -128,6 +131,17 @@ struct dma_buf {
128 const char *exp_name; 131 const char *exp_name;
129 struct list_head list_node; 132 struct list_head list_node;
130 void *priv; 133 void *priv;
134 struct reservation_object *resv;
135
136 /* poll support */
137 wait_queue_head_t poll;
138
139 struct dma_buf_poll_cb_t {
140 struct fence_cb cb;
141 wait_queue_head_t *poll;
142
143 unsigned long active;
144 } cb_excl, cb_shared;
131}; 145};
132 146
133/** 147/**
@@ -168,10 +182,11 @@ void dma_buf_detach(struct dma_buf *dmabuf,
168 struct dma_buf_attachment *dmabuf_attach); 182 struct dma_buf_attachment *dmabuf_attach);
169 183
170struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, 184struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops,
171 size_t size, int flags, const char *); 185 size_t size, int flags, const char *,
186 struct reservation_object *);
172 187
173#define dma_buf_export(priv, ops, size, flags) \ 188#define dma_buf_export(priv, ops, size, flags, resv) \
174 dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME) 189 dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME, resv)
175 190
176int dma_buf_fd(struct dma_buf *dmabuf, int flags); 191int dma_buf_fd(struct dma_buf *dmabuf, int flags);
177struct dma_buf *dma_buf_get(int fd); 192struct dma_buf *dma_buf_get(int fd);
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 772eab5d524a..569bbd039896 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -53,18 +53,13 @@
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55 55
56#include <linux/device.h>
57
56struct cma; 58struct cma;
57struct page; 59struct page;
58struct device;
59 60
60#ifdef CONFIG_DMA_CMA 61#ifdef CONFIG_DMA_CMA
61 62
62/*
63 * There is always at least global CMA area and a few optional device
64 * private areas configured in kernel .config.
65 */
66#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
67
68extern struct cma *dma_contiguous_default_area; 63extern struct cma *dma_contiguous_default_area;
69 64
70static inline struct cma *dev_get_cma_area(struct device *dev) 65static inline struct cma *dev_get_cma_area(struct device *dev)
@@ -123,8 +118,6 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
123 118
124#else 119#else
125 120
126#define MAX_CMA_AREAS (0)
127
128static inline struct cma *dev_get_cma_area(struct device *dev) 121static inline struct cma *dev_get_cma_area(struct device *dev)
129{ 122{
130 return NULL; 123 return NULL;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index d2c5cc7c583c..3d1c2aa51530 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -299,6 +299,7 @@ enum dma_slave_buswidth {
299 DMA_SLAVE_BUSWIDTH_UNDEFINED = 0, 299 DMA_SLAVE_BUSWIDTH_UNDEFINED = 0,
300 DMA_SLAVE_BUSWIDTH_1_BYTE = 1, 300 DMA_SLAVE_BUSWIDTH_1_BYTE = 1,
301 DMA_SLAVE_BUSWIDTH_2_BYTES = 2, 301 DMA_SLAVE_BUSWIDTH_2_BYTES = 2,
302 DMA_SLAVE_BUSWIDTH_3_BYTES = 3,
302 DMA_SLAVE_BUSWIDTH_4_BYTES = 4, 303 DMA_SLAVE_BUSWIDTH_4_BYTES = 4,
303 DMA_SLAVE_BUSWIDTH_8_BYTES = 8, 304 DMA_SLAVE_BUSWIDTH_8_BYTES = 8,
304}; 305};
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 23c8db129560..1deece46a0ca 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -114,22 +114,30 @@ extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info,
114/* Intel IOMMU detection */ 114/* Intel IOMMU detection */
115extern int detect_intel_iommu(void); 115extern int detect_intel_iommu(void);
116extern int enable_drhd_fault_handling(void); 116extern int enable_drhd_fault_handling(void);
117#else 117
118struct dmar_pci_notify_info; 118#ifdef CONFIG_INTEL_IOMMU
119static inline int detect_intel_iommu(void) 119extern int iommu_detected, no_iommu;
120extern int intel_iommu_init(void);
121extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header);
122extern int dmar_parse_one_atsr(struct acpi_dmar_header *header);
123extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info);
124#else /* !CONFIG_INTEL_IOMMU: */
125static inline int intel_iommu_init(void) { return -ENODEV; }
126static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header)
120{ 127{
121 return -ENODEV; 128 return 0;
122} 129}
123 130static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header)
124static inline int dmar_table_init(void)
125{ 131{
126 return -ENODEV; 132 return 0;
127} 133}
128static inline int enable_drhd_fault_handling(void) 134static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
129{ 135{
130 return -1; 136 return 0;
131} 137}
132#endif /* !CONFIG_DMAR_TABLE */ 138#endif /* CONFIG_INTEL_IOMMU */
139
140#endif /* CONFIG_DMAR_TABLE */
133 141
134struct irte { 142struct irte {
135 union { 143 union {
@@ -177,26 +185,4 @@ extern int dmar_set_interrupt(struct intel_iommu *iommu);
177extern irqreturn_t dmar_fault(int irq, void *dev_id); 185extern irqreturn_t dmar_fault(int irq, void *dev_id);
178extern int arch_setup_dmar_msi(unsigned int irq); 186extern int arch_setup_dmar_msi(unsigned int irq);
179 187
180#ifdef CONFIG_INTEL_IOMMU
181extern int iommu_detected, no_iommu;
182extern int dmar_parse_one_rmrr(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);
185extern int intel_iommu_init(void);
186#else /* !CONFIG_INTEL_IOMMU: */
187static inline int intel_iommu_init(void) { return -ENODEV; }
188static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header)
189{
190 return 0;
191}
192static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header)
193{
194 return 0;
195}
196static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
197{
198 return 0;
199}
200#endif /* CONFIG_INTEL_IOMMU */
201
202#endif /* __DMAR_H__ */ 188#endif /* __DMAR_H__ */
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 41bbf8ba4ba8..45cb4ffdea62 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -20,6 +20,7 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/pfn.h> 21#include <linux/pfn.h>
22#include <linux/pstore.h> 22#include <linux/pstore.h>
23#include <linux/reboot.h>
23 24
24#include <asm/page.h> 25#include <asm/page.h>
25 26
@@ -521,6 +522,8 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
521 int *reset_type); 522 int *reset_type);
522typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size); 523typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size);
523 524
525void efi_native_runtime_setup(void);
526
524/* 527/*
525 * EFI Configuration Table and GUID definitions 528 * EFI Configuration Table and GUID definitions
526 */ 529 */
@@ -870,11 +873,13 @@ extern int __init efi_uart_console_only (void);
870extern void efi_initialize_iomem_resources(struct resource *code_resource, 873extern void efi_initialize_iomem_resources(struct resource *code_resource,
871 struct resource *data_resource, struct resource *bss_resource); 874 struct resource *data_resource, struct resource *bss_resource);
872extern void efi_get_time(struct timespec *now); 875extern void efi_get_time(struct timespec *now);
873extern int efi_set_rtc_mmss(const struct timespec *now);
874extern void efi_reserve_boot_services(void); 876extern void efi_reserve_boot_services(void);
875extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose); 877extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose);
876extern struct efi_memory_map memmap; 878extern struct efi_memory_map memmap;
877 879
880extern int efi_reboot_quirk_mode;
881extern bool efi_poweroff_required(void);
882
878/* Iterate through an efi_memory_map */ 883/* Iterate through an efi_memory_map */
879#define for_each_efi_memory_desc(m, md) \ 884#define for_each_efi_memory_desc(m, md) \
880 for ((md) = (m)->map; \ 885 for ((md) = (m)->map; \
@@ -916,7 +921,8 @@ extern int __init efi_setup_pcdp_console(char *);
916#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ 921#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
917#define EFI_MEMMAP 4 /* Can we use EFI memory map? */ 922#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
918#define EFI_64BIT 5 /* Is the firmware 64-bit? */ 923#define EFI_64BIT 5 /* Is the firmware 64-bit? */
919#define EFI_ARCH_1 6 /* First arch-specific bit */ 924#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */
925#define EFI_ARCH_1 7 /* First arch-specific bit */
920 926
921#ifdef CONFIG_EFI 927#ifdef CONFIG_EFI
922/* 928/*
@@ -926,11 +932,14 @@ static inline bool efi_enabled(int feature)
926{ 932{
927 return test_bit(feature, &efi.flags) != 0; 933 return test_bit(feature, &efi.flags) != 0;
928} 934}
935extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
929#else 936#else
930static inline bool efi_enabled(int feature) 937static inline bool efi_enabled(int feature)
931{ 938{
932 return false; 939 return false;
933} 940}
941static inline void
942efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
934#endif 943#endif
935 944
936/* 945/*
@@ -1031,12 +1040,8 @@ struct efivar_operations {
1031struct efivars { 1040struct efivars {
1032 /* 1041 /*
1033 * ->lock protects two things: 1042 * ->lock protects two things:
1034 * 1) ->list - adds, removals, reads, writes 1043 * 1) efivarfs_list and efivars_sysfs_list
1035 * 2) ops.[gs]et_variable() calls. 1044 * 2) ->ops calls
1036 * It must not be held when creating sysfs entries or calling kmalloc.
1037 * ops.get_next_variable() is only called from register_efivars()
1038 * or efivar_update_sysfs_entries(),
1039 * which is protected by the BKL, so that path is safe.
1040 */ 1045 */
1041 spinlock_t lock; 1046 spinlock_t lock;
1042 struct kset *kset; 1047 struct kset *kset;
@@ -1151,6 +1156,9 @@ int efivars_sysfs_init(void);
1151#ifdef CONFIG_EFI_RUNTIME_MAP 1156#ifdef CONFIG_EFI_RUNTIME_MAP
1152int efi_runtime_map_init(struct kobject *); 1157int efi_runtime_map_init(struct kobject *);
1153void efi_runtime_map_setup(void *, int, u32); 1158void efi_runtime_map_setup(void *, int, u32);
1159int efi_get_runtime_map_size(void);
1160int efi_get_runtime_map_desc_size(void);
1161int efi_runtime_map_copy(void *buf, size_t bufsz);
1154#else 1162#else
1155static inline int efi_runtime_map_init(struct kobject *kobj) 1163static inline int efi_runtime_map_init(struct kobject *kobj)
1156{ 1164{
@@ -1159,6 +1167,64 @@ static inline int efi_runtime_map_init(struct kobject *kobj)
1159 1167
1160static inline void 1168static inline void
1161efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {} 1169efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {}
1170
1171static inline int efi_get_runtime_map_size(void)
1172{
1173 return 0;
1174}
1175
1176static inline int efi_get_runtime_map_desc_size(void)
1177{
1178 return 0;
1179}
1180
1181static inline int efi_runtime_map_copy(void *buf, size_t bufsz)
1182{
1183 return 0;
1184}
1185
1162#endif 1186#endif
1163 1187
1188/* prototypes shared between arch specific and generic stub code */
1189
1190#define pr_efi(sys_table, msg) efi_printk(sys_table, "EFI stub: "msg)
1191#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
1192
1193void efi_printk(efi_system_table_t *sys_table_arg, char *str);
1194
1195void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
1196 unsigned long addr);
1197
1198char *efi_convert_cmdline(efi_system_table_t *sys_table_arg,
1199 efi_loaded_image_t *image, int *cmd_line_len);
1200
1201efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
1202 efi_memory_desc_t **map,
1203 unsigned long *map_size,
1204 unsigned long *desc_size,
1205 u32 *desc_ver,
1206 unsigned long *key_ptr);
1207
1208efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
1209 unsigned long size, unsigned long align,
1210 unsigned long *addr);
1211
1212efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
1213 unsigned long size, unsigned long align,
1214 unsigned long *addr, unsigned long max);
1215
1216efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg,
1217 unsigned long *image_addr,
1218 unsigned long image_size,
1219 unsigned long alloc_size,
1220 unsigned long preferred_addr,
1221 unsigned long alignment);
1222
1223efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
1224 efi_loaded_image_t *image,
1225 char *cmd_line, char *option_string,
1226 unsigned long max_addr,
1227 unsigned long *load_addr,
1228 unsigned long *load_size);
1229
1164#endif /* _LINUX_EFI_H */ 1230#endif /* _LINUX_EFI_H */
diff --git a/include/linux/extcon/sm5502.h b/include/linux/extcon/sm5502.h
new file mode 100644
index 000000000000..030526bf8d79
--- /dev/null
+++ b/include/linux/extcon/sm5502.h
@@ -0,0 +1,287 @@
1/*
2 * sm5502.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 *
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
8 * Free Software Foundation; either version 2 of the License, or (at your
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.
15 */
16
17#ifndef __LINUX_EXTCON_SM5502_H
18#define __LINUX_EXTCON_SM5502_H
19
20enum sm5502_types {
21 TYPE_SM5502,
22};
23
24/* SM5502 registers */
25enum sm5502_reg {
26 SM5502_REG_DEVICE_ID = 0x01,
27 SM5502_REG_CONTROL,
28 SM5502_REG_INT1,
29 SM5502_REG_INT2,
30 SM5502_REG_INTMASK1,
31 SM5502_REG_INTMASK2,
32 SM5502_REG_ADC,
33 SM5502_REG_TIMING_SET1,
34 SM5502_REG_TIMING_SET2,
35 SM5502_REG_DEV_TYPE1,
36 SM5502_REG_DEV_TYPE2,
37 SM5502_REG_BUTTON1,
38 SM5502_REG_BUTTON2,
39 SM5502_REG_CAR_KIT_STATUS,
40 SM5502_REG_RSVD1,
41 SM5502_REG_RSVD2,
42 SM5502_REG_RSVD3,
43 SM5502_REG_RSVD4,
44 SM5502_REG_MANUAL_SW1,
45 SM5502_REG_MANUAL_SW2,
46 SM5502_REG_DEV_TYPE3,
47 SM5502_REG_RSVD5,
48 SM5502_REG_RSVD6,
49 SM5502_REG_RSVD7,
50 SM5502_REG_RSVD8,
51 SM5502_REG_RSVD9,
52 SM5502_REG_RESET,
53 SM5502_REG_RSVD10,
54 SM5502_REG_RESERVED_ID1,
55 SM5502_REG_RSVD11,
56 SM5502_REG_RSVD12,
57 SM5502_REG_RESERVED_ID2,
58 SM5502_REG_RSVD13,
59 SM5502_REG_OCP,
60 SM5502_REG_RSVD14,
61 SM5502_REG_RSVD15,
62 SM5502_REG_RSVD16,
63 SM5502_REG_RSVD17,
64 SM5502_REG_RSVD18,
65 SM5502_REG_RSVD19,
66 SM5502_REG_RSVD20,
67 SM5502_REG_RSVD21,
68 SM5502_REG_RSVD22,
69 SM5502_REG_RSVD23,
70 SM5502_REG_RSVD24,
71 SM5502_REG_RSVD25,
72 SM5502_REG_RSVD26,
73 SM5502_REG_RSVD27,
74 SM5502_REG_RSVD28,
75 SM5502_REG_RSVD29,
76 SM5502_REG_RSVD30,
77 SM5502_REG_RSVD31,
78 SM5502_REG_RSVD32,
79 SM5502_REG_RSVD33,
80 SM5502_REG_RSVD34,
81 SM5502_REG_RSVD35,
82 SM5502_REG_RSVD36,
83 SM5502_REG_RESERVED_ID3,
84
85 SM5502_REG_END,
86};
87
88/* Define SM5502 MASK/SHIFT constant */
89#define SM5502_REG_DEVICE_ID_VENDOR_SHIFT 0
90#define SM5502_REG_DEVICE_ID_VERSION_SHIFT 3
91#define SM5502_REG_DEVICE_ID_VENDOR_MASK (0x3 << SM5502_REG_DEVICE_ID_VENDOR_SHIFT)
92#define SM5502_REG_DEVICE_ID_VERSION_MASK (0x1f << SM5502_REG_DEVICE_ID_VERSION_SHIFT)
93
94#define SM5502_REG_CONTROL_MASK_INT_SHIFT 0
95#define SM5502_REG_CONTROL_WAIT_SHIFT 1
96#define SM5502_REG_CONTROL_MANUAL_SW_SHIFT 2
97#define SM5502_REG_CONTROL_RAW_DATA_SHIFT 3
98#define SM5502_REG_CONTROL_SW_OPEN_SHIFT 4
99#define SM5502_REG_CONTROL_MASK_INT_MASK (0x1 << SM5502_REG_CONTROL_MASK_INT_SHIFT)
100#define SM5502_REG_CONTROL_WAIT_MASK (0x1 << SM5502_REG_CONTROL_WAIT_SHIFT)
101#define SM5502_REG_CONTROL_MANUAL_SW_MASK (0x1 << SM5502_REG_CONTROL_MANUAL_SW_SHIFT)
102#define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT)
103#define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT)
104
105#define SM5502_REG_INTM1_ATTACH_SHIFT 0
106#define SM5502_REG_INTM1_DETACH_SHIFT 1
107#define SM5502_REG_INTM1_KP_SHIFT 2
108#define SM5502_REG_INTM1_LKP_SHIFT 3
109#define SM5502_REG_INTM1_LKR_SHIFT 4
110#define SM5502_REG_INTM1_OVP_EVENT_SHIFT 5
111#define SM5502_REG_INTM1_OCP_EVENT_SHIFT 6
112#define SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT 7
113#define SM5502_REG_INTM1_ATTACH_MASK (0x1 << SM5502_REG_INTM1_ATTACH_SHIFT)
114#define SM5502_REG_INTM1_DETACH_MASK (0x1 << SM5502_REG_INTM1_DETACH_SHIFT)
115#define SM5502_REG_INTM1_KP_MASK (0x1 << SM5502_REG_INTM1_KP_SHIFT)
116#define SM5502_REG_INTM1_LKP_MASK (0x1 << SM5502_REG_INTM1_LKP_SHIFT)
117#define SM5502_REG_INTM1_LKR_MASK (0x1 << SM5502_REG_INTM1_LKR_SHIFT)
118#define SM5502_REG_INTM1_OVP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OVP_EVENT_SHIFT)
119#define SM5502_REG_INTM1_OCP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OCP_EVENT_SHIFT)
120#define SM5502_REG_INTM1_OVP_OCP_DIS_MASK (0x1 << SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT)
121
122#define SM5502_REG_INTM2_VBUS_DET_SHIFT 0
123#define SM5502_REG_INTM2_REV_ACCE_SHIFT 1
124#define SM5502_REG_INTM2_ADC_CHG_SHIFT 2
125#define SM5502_REG_INTM2_STUCK_KEY_SHIFT 3
126#define SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT 4
127#define SM5502_REG_INTM2_MHL_SHIFT 5
128#define SM5502_REG_INTM2_VBUS_DET_MASK (0x1 << SM5502_REG_INTM2_VBUS_DET_SHIFT)
129#define SM5502_REG_INTM2_REV_ACCE_MASK (0x1 << SM5502_REG_INTM2_REV_ACCE_SHIFT)
130#define SM5502_REG_INTM2_ADC_CHG_MASK (0x1 << SM5502_REG_INTM2_ADC_CHG_SHIFT)
131#define SM5502_REG_INTM2_STUCK_KEY_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_SHIFT)
132#define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT)
133#define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT)
134
135#define SM5502_REG_ADC_SHIFT 0
136#define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT)
137
138#define SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT 4
139#define SM5502_REG_TIMING_SET1_KEY_PRESS_MASK (0xf << SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT)
140#define TIMING_KEY_PRESS_100MS 0x0
141#define TIMING_KEY_PRESS_200MS 0x1
142#define TIMING_KEY_PRESS_300MS 0x2
143#define TIMING_KEY_PRESS_400MS 0x3
144#define TIMING_KEY_PRESS_500MS 0x4
145#define TIMING_KEY_PRESS_600MS 0x5
146#define TIMING_KEY_PRESS_700MS 0x6
147#define TIMING_KEY_PRESS_800MS 0x7
148#define TIMING_KEY_PRESS_900MS 0x8
149#define TIMING_KEY_PRESS_1000MS 0x9
150#define SM5502_REG_TIMING_SET1_ADC_DET_SHIFT 0
151#define SM5502_REG_TIMING_SET1_ADC_DET_MASK (0xf << SM5502_REG_TIMING_SET1_ADC_DET_SHIFT)
152#define TIMING_ADC_DET_50MS 0x0
153#define TIMING_ADC_DET_100MS 0x1
154#define TIMING_ADC_DET_150MS 0x2
155#define TIMING_ADC_DET_200MS 0x3
156#define TIMING_ADC_DET_300MS 0x4
157#define TIMING_ADC_DET_400MS 0x5
158#define TIMING_ADC_DET_500MS 0x6
159#define TIMING_ADC_DET_600MS 0x7
160#define TIMING_ADC_DET_700MS 0x8
161#define TIMING_ADC_DET_800MS 0x9
162#define TIMING_ADC_DET_900MS 0xA
163#define TIMING_ADC_DET_1000MS 0xB
164
165#define SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT 4
166#define SM5502_REG_TIMING_SET2_SW_WAIT_MASK (0xf << SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT)
167#define TIMING_SW_WAIT_10MS 0x0
168#define TIMING_SW_WAIT_30MS 0x1
169#define TIMING_SW_WAIT_50MS 0x2
170#define TIMING_SW_WAIT_70MS 0x3
171#define TIMING_SW_WAIT_90MS 0x4
172#define TIMING_SW_WAIT_110MS 0x5
173#define TIMING_SW_WAIT_130MS 0x6
174#define TIMING_SW_WAIT_150MS 0x7
175#define TIMING_SW_WAIT_170MS 0x8
176#define TIMING_SW_WAIT_190MS 0x9
177#define TIMING_SW_WAIT_210MS 0xA
178#define SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT 0
179#define SM5502_REG_TIMING_SET2_LONG_KEY_MASK (0xf << SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT)
180#define TIMING_LONG_KEY_300MS 0x0
181#define TIMING_LONG_KEY_400MS 0x1
182#define TIMING_LONG_KEY_500MS 0x2
183#define TIMING_LONG_KEY_600MS 0x3
184#define TIMING_LONG_KEY_700MS 0x4
185#define TIMING_LONG_KEY_800MS 0x5
186#define TIMING_LONG_KEY_900MS 0x6
187#define TIMING_LONG_KEY_1000MS 0x7
188#define TIMING_LONG_KEY_1100MS 0x8
189#define TIMING_LONG_KEY_1200MS 0x9
190#define TIMING_LONG_KEY_1300MS 0xA
191#define TIMING_LONG_KEY_1400MS 0xB
192#define TIMING_LONG_KEY_1500MS 0xC
193
194#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT 0
195#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT 1
196#define SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT 2
197#define SM5502_REG_DEV_TYPE1_UART_SHIFT 3
198#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT 4
199#define SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT 5
200#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT 6
201#define SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT 7
202#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT)
203#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1__MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT)
204#define SM5502_REG_DEV_TYPE1_USB_SDP_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT)
205#define SM5502_REG_DEV_TYPE1_UART_MASK (0x1 << SM5502_REG_DEV_TYPE1_UART_SHIFT)
206#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_MASK (0x1 << SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT)
207#define SM5502_REG_DEV_TYPE1_USB_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT)
208#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT)
209#define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT)
210
211#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0
212#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1
213#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2
214#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT 3
215#define SM5502_REG_DEV_TYPE2_PPD_SHIFT 4
216#define SM5502_REG_DEV_TYPE2_TTY_SHIFT 5
217#define SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT 6
218#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT)
219#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT)
220#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT)
221#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT)
222#define SM5502_REG_DEV_TYPE2_PPD_MASK (0x1 << SM5502_REG_DEV_TYPE2_PPD_SHIFT)
223#define SM5502_REG_DEV_TYPE2_TTY_MASK (0x1 << SM5502_REG_DEV_TYPE2_TTY_SHIFT)
224#define SM5502_REG_DEV_TYPE2_AV_CABLE_MASK (0x1 << SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT)
225
226#define SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT 0
227#define SM5502_REG_MANUAL_SW1_DP_SHIFT 2
228#define SM5502_REG_MANUAL_SW1_DM_SHIFT 5
229#define SM5502_REG_MANUAL_SW1_VBUSIN_MASK (0x3 << SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT)
230#define SM5502_REG_MANUAL_SW1_DP_MASK (0x7 << SM5502_REG_MANUAL_SW1_DP_SHIFT)
231#define SM5502_REG_MANUAL_SW1_DM_MASK (0x7 << SM5502_REG_MANUAL_SW1_DM_SHIFT)
232#define VBUSIN_SWITCH_OPEN 0x0
233#define VBUSIN_SWITCH_VBUSOUT 0x1
234#define VBUSIN_SWITCH_MIC 0x2
235#define VBUSIN_SWITCH_VBUSOUT_WITH_USB 0x3
236#define DM_DP_CON_SWITCH_OPEN 0x0
237#define DM_DP_CON_SWITCH_USB 0x1
238#define DM_DP_CON_SWITCH_AUDIO 0x2
239#define DM_DP_CON_SWITCH_UART 0x3
240#define DM_DP_SWITCH_OPEN ((DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
241 | (DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
242#define DM_DP_SWITCH_USB ((DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
243 | (DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
244#define DM_DP_SWITCH_AUDIO ((DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
245 | (DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
246#define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
247 | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
248
249/* SM5502 Interrupts */
250enum sm5502_irq {
251 /* INT1 */
252 SM5502_IRQ_INT1_ATTACH,
253 SM5502_IRQ_INT1_DETACH,
254 SM5502_IRQ_INT1_KP,
255 SM5502_IRQ_INT1_LKP,
256 SM5502_IRQ_INT1_LKR,
257 SM5502_IRQ_INT1_OVP_EVENT,
258 SM5502_IRQ_INT1_OCP_EVENT,
259 SM5502_IRQ_INT1_OVP_OCP_DIS,
260
261 /* INT2 */
262 SM5502_IRQ_INT2_VBUS_DET,
263 SM5502_IRQ_INT2_REV_ACCE,
264 SM5502_IRQ_INT2_ADC_CHG,
265 SM5502_IRQ_INT2_STUCK_KEY,
266 SM5502_IRQ_INT2_STUCK_KEY_RCV,
267 SM5502_IRQ_INT2_MHL,
268
269 SM5502_IRQ_NUM,
270};
271
272#define SM5502_IRQ_INT1_ATTACH_MASK BIT(0)
273#define SM5502_IRQ_INT1_DETACH_MASK BIT(1)
274#define SM5502_IRQ_INT1_KP_MASK BIT(2)
275#define SM5502_IRQ_INT1_LKP_MASK BIT(3)
276#define SM5502_IRQ_INT1_LKR_MASK BIT(4)
277#define SM5502_IRQ_INT1_OVP_EVENT_MASK BIT(5)
278#define SM5502_IRQ_INT1_OCP_EVENT_MASK BIT(6)
279#define SM5502_IRQ_INT1_OVP_OCP_DIS_MASK BIT(7)
280#define SM5502_IRQ_INT2_VBUS_DET_MASK BIT(0)
281#define SM5502_IRQ_INT2_REV_ACCE_MASK BIT(1)
282#define SM5502_IRQ_INT2_ADC_CHG_MASK BIT(2)
283#define SM5502_IRQ_INT2_STUCK_KEY_MASK BIT(3)
284#define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4)
285#define SM5502_IRQ_INT2_MHL_MASK BIT(5)
286
287#endif /* __LINUX_EXTCON_SM5502_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index b6bfda99add3..09bb7a18d287 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -553,7 +553,7 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
553#define fb_memcpy_fromfb sbus_memcpy_fromio 553#define fb_memcpy_fromfb sbus_memcpy_fromio
554#define fb_memcpy_tofb sbus_memcpy_toio 554#define fb_memcpy_tofb sbus_memcpy_toio
555 555
556#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) 556#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) || defined(__arm__)
557 557
558#define fb_readb __raw_readb 558#define fb_readb __raw_readb
559#define fb_readw __raw_readw 559#define fb_readw __raw_readw
diff --git a/include/linux/fence.h b/include/linux/fence.h
new file mode 100644
index 000000000000..d174585b874b
--- /dev/null
+++ b/include/linux/fence.h
@@ -0,0 +1,360 @@
1/*
2 * Fence mechanism for dma-buf to allow for asynchronous dma access
3 *
4 * Copyright (C) 2012 Canonical Ltd
5 * Copyright (C) 2012 Texas Instruments
6 *
7 * Authors:
8 * Rob Clark <robdclark@gmail.com>
9 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 as published by
13 * the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * more details.
19 */
20
21#ifndef __LINUX_FENCE_H
22#define __LINUX_FENCE_H
23
24#include <linux/err.h>
25#include <linux/wait.h>
26#include <linux/list.h>
27#include <linux/bitops.h>
28#include <linux/kref.h>
29#include <linux/sched.h>
30#include <linux/printk.h>
31#include <linux/rcupdate.h>
32
33struct fence;
34struct fence_ops;
35struct fence_cb;
36
37/**
38 * struct fence - software synchronization primitive
39 * @refcount: refcount for this fence
40 * @ops: fence_ops associated with this fence
41 * @rcu: used for releasing fence with kfree_rcu
42 * @cb_list: list of all callbacks to call
43 * @lock: spin_lock_irqsave used for locking
44 * @context: execution context this fence belongs to, returned by
45 * fence_context_alloc()
46 * @seqno: the sequence number of this fence inside the execution context,
47 * can be compared to decide which fence would be signaled later.
48 * @flags: A mask of FENCE_FLAG_* defined below
49 * @timestamp: Timestamp when the fence was signaled.
50 * @status: Optional, only valid if < 0, must be set before calling
51 * fence_signal, indicates that the fence has completed with an error.
52 *
53 * the flags member must be manipulated and read using the appropriate
54 * atomic ops (bit_*), so taking the spinlock will not be needed most
55 * of the time.
56 *
57 * FENCE_FLAG_SIGNALED_BIT - fence is already signaled
58 * FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called*
59 * FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the
60 * implementer of the fence for its own purposes. Can be used in different
61 * ways by different fence implementers, so do not rely on this.
62 *
63 * *) Since atomic bitops are used, this is not guaranteed to be the case.
64 * Particularly, if the bit was set, but fence_signal was called right
65 * before this bit was set, it would have been able to set the
66 * FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called.
67 * Adding a check for FENCE_FLAG_SIGNALED_BIT after setting
68 * FENCE_FLAG_ENABLE_SIGNAL_BIT closes this race, and makes sure that
69 * after fence_signal was called, any enable_signaling call will have either
70 * been completed, or never called at all.
71 */
72struct fence {
73 struct kref refcount;
74 const struct fence_ops *ops;
75 struct rcu_head rcu;
76 struct list_head cb_list;
77 spinlock_t *lock;
78 unsigned context, seqno;
79 unsigned long flags;
80 ktime_t timestamp;
81 int status;
82};
83
84enum fence_flag_bits {
85 FENCE_FLAG_SIGNALED_BIT,
86 FENCE_FLAG_ENABLE_SIGNAL_BIT,
87 FENCE_FLAG_USER_BITS, /* must always be last member */
88};
89
90typedef void (*fence_func_t)(struct fence *fence, struct fence_cb *cb);
91
92/**
93 * struct fence_cb - callback for fence_add_callback
94 * @node: used by fence_add_callback to append this struct to fence::cb_list
95 * @func: fence_func_t to call
96 *
97 * This struct will be initialized by fence_add_callback, additional
98 * data can be passed along by embedding fence_cb in another struct.
99 */
100struct fence_cb {
101 struct list_head node;
102 fence_func_t func;
103};
104
105/**
106 * struct fence_ops - operations implemented for fence
107 * @get_driver_name: returns the driver name.
108 * @get_timeline_name: return the name of the context this fence belongs to.
109 * @enable_signaling: enable software signaling of fence.
110 * @signaled: [optional] peek whether the fence is signaled, can be null.
111 * @wait: custom wait implementation, or fence_default_wait.
112 * @release: [optional] called on destruction of fence, can be null
113 * @fill_driver_data: [optional] callback to fill in free-form debug info
114 * Returns amount of bytes filled, or -errno.
115 * @fence_value_str: [optional] fills in the value of the fence as a string
116 * @timeline_value_str: [optional] fills in the current value of the timeline
117 * as a string
118 *
119 * Notes on enable_signaling:
120 * For fence implementations that have the capability for hw->hw
121 * signaling, they can implement this op to enable the necessary
122 * irqs, or insert commands into cmdstream, etc. This is called
123 * in the first wait() or add_callback() path to let the fence
124 * implementation know that there is another driver waiting on
125 * the signal (ie. hw->sw case).
126 *
127 * This function can be called called from atomic context, but not
128 * from irq context, so normal spinlocks can be used.
129 *
130 * A return value of false indicates the fence already passed,
131 * or some failure occured that made it impossible to enable
132 * signaling. True indicates succesful enabling.
133 *
134 * fence->status may be set in enable_signaling, but only when false is
135 * returned.
136 *
137 * Calling fence_signal before enable_signaling is called allows
138 * for a tiny race window in which enable_signaling is called during,
139 * before, or after fence_signal. To fight this, it is recommended
140 * that before enable_signaling returns true an extra reference is
141 * taken on the fence, to be released when the fence is signaled.
142 * This will mean fence_signal will still be called twice, but
143 * the second time will be a noop since it was already signaled.
144 *
145 * Notes on signaled:
146 * May set fence->status if returning true.
147 *
148 * Notes on wait:
149 * Must not be NULL, set to fence_default_wait for default implementation.
150 * the fence_default_wait implementation should work for any fence, as long
151 * as enable_signaling works correctly.
152 *
153 * Must return -ERESTARTSYS if the wait is intr = true and the wait was
154 * interrupted, and remaining jiffies if fence has signaled, or 0 if wait
155 * timed out. Can also return other error values on custom implementations,
156 * which should be treated as if the fence is signaled. For example a hardware
157 * lockup could be reported like that.
158 *
159 * Notes on release:
160 * Can be NULL, this function allows additional commands to run on
161 * destruction of the fence. Can be called from irq context.
162 * If pointer is set to NULL, kfree will get called instead.
163 */
164
165struct fence_ops {
166 const char * (*get_driver_name)(struct fence *fence);
167 const char * (*get_timeline_name)(struct fence *fence);
168 bool (*enable_signaling)(struct fence *fence);
169 bool (*signaled)(struct fence *fence);
170 signed long (*wait)(struct fence *fence, bool intr, signed long timeout);
171 void (*release)(struct fence *fence);
172
173 int (*fill_driver_data)(struct fence *fence, void *data, int size);
174 void (*fence_value_str)(struct fence *fence, char *str, int size);
175 void (*timeline_value_str)(struct fence *fence, char *str, int size);
176};
177
178void fence_init(struct fence *fence, const struct fence_ops *ops,
179 spinlock_t *lock, unsigned context, unsigned seqno);
180
181void fence_release(struct kref *kref);
182void fence_free(struct fence *fence);
183
184/**
185 * fence_get - increases refcount of the fence
186 * @fence: [in] fence to increase refcount of
187 *
188 * Returns the same fence, with refcount increased by 1.
189 */
190static inline struct fence *fence_get(struct fence *fence)
191{
192 if (fence)
193 kref_get(&fence->refcount);
194 return fence;
195}
196
197/**
198 * fence_get_rcu - get a fence from a reservation_object_list with rcu read lock
199 * @fence: [in] fence to increase refcount of
200 *
201 * Function returns NULL if no refcount could be obtained, or the fence.
202 */
203static inline struct fence *fence_get_rcu(struct fence *fence)
204{
205 if (kref_get_unless_zero(&fence->refcount))
206 return fence;
207 else
208 return NULL;
209}
210
211/**
212 * fence_put - decreases refcount of the fence
213 * @fence: [in] fence to reduce refcount of
214 */
215static inline void fence_put(struct fence *fence)
216{
217 if (fence)
218 kref_put(&fence->refcount, fence_release);
219}
220
221int fence_signal(struct fence *fence);
222int fence_signal_locked(struct fence *fence);
223signed long fence_default_wait(struct fence *fence, bool intr, signed long timeout);
224int fence_add_callback(struct fence *fence, struct fence_cb *cb,
225 fence_func_t func);
226bool fence_remove_callback(struct fence *fence, struct fence_cb *cb);
227void fence_enable_sw_signaling(struct fence *fence);
228
229/**
230 * fence_is_signaled_locked - Return an indication if the fence is signaled yet.
231 * @fence: [in] the fence to check
232 *
233 * Returns true if the fence was already signaled, false if not. Since this
234 * function doesn't enable signaling, it is not guaranteed to ever return
235 * true if fence_add_callback, fence_wait or fence_enable_sw_signaling
236 * haven't been called before.
237 *
238 * This function requires fence->lock to be held.
239 */
240static inline bool
241fence_is_signaled_locked(struct fence *fence)
242{
243 if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags))
244 return true;
245
246 if (fence->ops->signaled && fence->ops->signaled(fence)) {
247 fence_signal_locked(fence);
248 return true;
249 }
250
251 return false;
252}
253
254/**
255 * fence_is_signaled - Return an indication if the fence is signaled yet.
256 * @fence: [in] the fence to check
257 *
258 * Returns true if the fence was already signaled, false if not. Since this
259 * function doesn't enable signaling, it is not guaranteed to ever return
260 * true if fence_add_callback, fence_wait or fence_enable_sw_signaling
261 * haven't been called before.
262 *
263 * It's recommended for seqno fences to call fence_signal when the
264 * operation is complete, it makes it possible to prevent issues from
265 * wraparound between time of issue and time of use by checking the return
266 * value of this function before calling hardware-specific wait instructions.
267 */
268static inline bool
269fence_is_signaled(struct fence *fence)
270{
271 if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags))
272 return true;
273
274 if (fence->ops->signaled && fence->ops->signaled(fence)) {
275 fence_signal(fence);
276 return true;
277 }
278
279 return false;
280}
281
282/**
283 * fence_later - return the chronologically later fence
284 * @f1: [in] the first fence from the same context
285 * @f2: [in] the second fence from the same context
286 *
287 * Returns NULL if both fences are signaled, otherwise the fence that would be
288 * signaled last. Both fences must be from the same context, since a seqno is
289 * not re-used across contexts.
290 */
291static inline struct fence *fence_later(struct fence *f1, struct fence *f2)
292{
293 if (WARN_ON(f1->context != f2->context))
294 return NULL;
295
296 /*
297 * can't check just FENCE_FLAG_SIGNALED_BIT here, it may never have been
298 * set if enable_signaling wasn't called, and enabling that here is
299 * overkill.
300 */
301 if (f2->seqno - f1->seqno <= INT_MAX)
302 return fence_is_signaled(f2) ? NULL : f2;
303 else
304 return fence_is_signaled(f1) ? NULL : f1;
305}
306
307signed long fence_wait_timeout(struct fence *, bool intr, signed long timeout);
308
309
310/**
311 * fence_wait - sleep until the fence gets signaled
312 * @fence: [in] the fence to wait on
313 * @intr: [in] if true, do an interruptible wait
314 *
315 * This function will return -ERESTARTSYS if interrupted by a signal,
316 * or 0 if the fence was signaled. Other error values may be
317 * returned on custom implementations.
318 *
319 * Performs a synchronous wait on this fence. It is assumed the caller
320 * directly or indirectly holds a reference to the fence, otherwise the
321 * fence might be freed before return, resulting in undefined behavior.
322 */
323static inline signed long fence_wait(struct fence *fence, bool intr)
324{
325 signed long ret;
326
327 /* Since fence_wait_timeout cannot timeout with
328 * MAX_SCHEDULE_TIMEOUT, only valid return values are
329 * -ERESTARTSYS and MAX_SCHEDULE_TIMEOUT.
330 */
331 ret = fence_wait_timeout(fence, intr, MAX_SCHEDULE_TIMEOUT);
332
333 return ret < 0 ? ret : 0;
334}
335
336unsigned fence_context_alloc(unsigned num);
337
338#define FENCE_TRACE(f, fmt, args...) \
339 do { \
340 struct fence *__ff = (f); \
341 if (config_enabled(CONFIG_FENCE_TRACE)) \
342 pr_info("f %u#%u: " fmt, \
343 __ff->context, __ff->seqno, ##args); \
344 } while (0)
345
346#define FENCE_WARN(f, fmt, args...) \
347 do { \
348 struct fence *__ff = (f); \
349 pr_warn("f %u#%u: " fmt, __ff->context, __ff->seqno, \
350 ##args); \
351 } while (0)
352
353#define FENCE_ERR(f, fmt, args...) \
354 do { \
355 struct fence *__ff = (f); \
356 pr_err("f %u#%u: " fmt, __ff->context, __ff->seqno, \
357 ##args); \
358 } while (0)
359
360#endif /* __LINUX_FENCE_H */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a7e3c48d73a7..a5227ab8ccb1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/atomic.h> 7#include <linux/atomic.h>
8#include <linux/compat.h> 8#include <linux/compat.h>
9#include <linux/skbuff.h>
9#include <linux/workqueue.h> 10#include <linux/workqueue.h>
10#include <uapi/linux/filter.h> 11#include <uapi/linux/filter.h>
11 12
@@ -81,7 +82,7 @@ enum {
81/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ 82/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
82 83
83#define BPF_ALU64_REG(OP, DST, SRC) \ 84#define BPF_ALU64_REG(OP, DST, SRC) \
84 ((struct sock_filter_int) { \ 85 ((struct bpf_insn) { \
85 .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \ 86 .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \
86 .dst_reg = DST, \ 87 .dst_reg = DST, \
87 .src_reg = SRC, \ 88 .src_reg = SRC, \
@@ -89,7 +90,7 @@ enum {
89 .imm = 0 }) 90 .imm = 0 })
90 91
91#define BPF_ALU32_REG(OP, DST, SRC) \ 92#define BPF_ALU32_REG(OP, DST, SRC) \
92 ((struct sock_filter_int) { \ 93 ((struct bpf_insn) { \
93 .code = BPF_ALU | BPF_OP(OP) | BPF_X, \ 94 .code = BPF_ALU | BPF_OP(OP) | BPF_X, \
94 .dst_reg = DST, \ 95 .dst_reg = DST, \
95 .src_reg = SRC, \ 96 .src_reg = SRC, \
@@ -99,7 +100,7 @@ enum {
99/* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */ 100/* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */
100 101
101#define BPF_ALU64_IMM(OP, DST, IMM) \ 102#define BPF_ALU64_IMM(OP, DST, IMM) \
102 ((struct sock_filter_int) { \ 103 ((struct bpf_insn) { \
103 .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \ 104 .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \
104 .dst_reg = DST, \ 105 .dst_reg = DST, \
105 .src_reg = 0, \ 106 .src_reg = 0, \
@@ -107,7 +108,7 @@ enum {
107 .imm = IMM }) 108 .imm = IMM })
108 109
109#define BPF_ALU32_IMM(OP, DST, IMM) \ 110#define BPF_ALU32_IMM(OP, DST, IMM) \
110 ((struct sock_filter_int) { \ 111 ((struct bpf_insn) { \
111 .code = BPF_ALU | BPF_OP(OP) | BPF_K, \ 112 .code = BPF_ALU | BPF_OP(OP) | BPF_K, \
112 .dst_reg = DST, \ 113 .dst_reg = DST, \
113 .src_reg = 0, \ 114 .src_reg = 0, \
@@ -117,7 +118,7 @@ enum {
117/* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */ 118/* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */
118 119
119#define BPF_ENDIAN(TYPE, DST, LEN) \ 120#define BPF_ENDIAN(TYPE, DST, LEN) \
120 ((struct sock_filter_int) { \ 121 ((struct bpf_insn) { \
121 .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \ 122 .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \
122 .dst_reg = DST, \ 123 .dst_reg = DST, \
123 .src_reg = 0, \ 124 .src_reg = 0, \
@@ -127,7 +128,7 @@ enum {
127/* Short form of mov, dst_reg = src_reg */ 128/* Short form of mov, dst_reg = src_reg */
128 129
129#define BPF_MOV64_REG(DST, SRC) \ 130#define BPF_MOV64_REG(DST, SRC) \
130 ((struct sock_filter_int) { \ 131 ((struct bpf_insn) { \
131 .code = BPF_ALU64 | BPF_MOV | BPF_X, \ 132 .code = BPF_ALU64 | BPF_MOV | BPF_X, \
132 .dst_reg = DST, \ 133 .dst_reg = DST, \
133 .src_reg = SRC, \ 134 .src_reg = SRC, \
@@ -135,7 +136,7 @@ enum {
135 .imm = 0 }) 136 .imm = 0 })
136 137
137#define BPF_MOV32_REG(DST, SRC) \ 138#define BPF_MOV32_REG(DST, SRC) \
138 ((struct sock_filter_int) { \ 139 ((struct bpf_insn) { \
139 .code = BPF_ALU | BPF_MOV | BPF_X, \ 140 .code = BPF_ALU | BPF_MOV | BPF_X, \
140 .dst_reg = DST, \ 141 .dst_reg = DST, \
141 .src_reg = SRC, \ 142 .src_reg = SRC, \
@@ -145,7 +146,7 @@ enum {
145/* Short form of mov, dst_reg = imm32 */ 146/* Short form of mov, dst_reg = imm32 */
146 147
147#define BPF_MOV64_IMM(DST, IMM) \ 148#define BPF_MOV64_IMM(DST, IMM) \
148 ((struct sock_filter_int) { \ 149 ((struct bpf_insn) { \
149 .code = BPF_ALU64 | BPF_MOV | BPF_K, \ 150 .code = BPF_ALU64 | BPF_MOV | BPF_K, \
150 .dst_reg = DST, \ 151 .dst_reg = DST, \
151 .src_reg = 0, \ 152 .src_reg = 0, \
@@ -153,7 +154,7 @@ enum {
153 .imm = IMM }) 154 .imm = IMM })
154 155
155#define BPF_MOV32_IMM(DST, IMM) \ 156#define BPF_MOV32_IMM(DST, IMM) \
156 ((struct sock_filter_int) { \ 157 ((struct bpf_insn) { \
157 .code = BPF_ALU | BPF_MOV | BPF_K, \ 158 .code = BPF_ALU | BPF_MOV | BPF_K, \
158 .dst_reg = DST, \ 159 .dst_reg = DST, \
159 .src_reg = 0, \ 160 .src_reg = 0, \
@@ -163,7 +164,7 @@ enum {
163/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ 164/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */
164 165
165#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \ 166#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \
166 ((struct sock_filter_int) { \ 167 ((struct bpf_insn) { \
167 .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \ 168 .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \
168 .dst_reg = DST, \ 169 .dst_reg = DST, \
169 .src_reg = SRC, \ 170 .src_reg = SRC, \
@@ -171,7 +172,7 @@ enum {
171 .imm = IMM }) 172 .imm = IMM })
172 173
173#define BPF_MOV32_RAW(TYPE, DST, SRC, IMM) \ 174#define BPF_MOV32_RAW(TYPE, DST, SRC, IMM) \
174 ((struct sock_filter_int) { \ 175 ((struct bpf_insn) { \
175 .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \ 176 .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \
176 .dst_reg = DST, \ 177 .dst_reg = DST, \
177 .src_reg = SRC, \ 178 .src_reg = SRC, \
@@ -181,7 +182,7 @@ enum {
181/* Direct packet access, R0 = *(uint *) (skb->data + imm32) */ 182/* Direct packet access, R0 = *(uint *) (skb->data + imm32) */
182 183
183#define BPF_LD_ABS(SIZE, IMM) \ 184#define BPF_LD_ABS(SIZE, IMM) \
184 ((struct sock_filter_int) { \ 185 ((struct bpf_insn) { \
185 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \ 186 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \
186 .dst_reg = 0, \ 187 .dst_reg = 0, \
187 .src_reg = 0, \ 188 .src_reg = 0, \
@@ -191,7 +192,7 @@ enum {
191/* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */ 192/* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */
192 193
193#define BPF_LD_IND(SIZE, SRC, IMM) \ 194#define BPF_LD_IND(SIZE, SRC, IMM) \
194 ((struct sock_filter_int) { \ 195 ((struct bpf_insn) { \
195 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \ 196 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \
196 .dst_reg = 0, \ 197 .dst_reg = 0, \
197 .src_reg = SRC, \ 198 .src_reg = SRC, \
@@ -201,7 +202,7 @@ enum {
201/* Memory load, dst_reg = *(uint *) (src_reg + off16) */ 202/* Memory load, dst_reg = *(uint *) (src_reg + off16) */
202 203
203#define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \ 204#define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \
204 ((struct sock_filter_int) { \ 205 ((struct bpf_insn) { \
205 .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \ 206 .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \
206 .dst_reg = DST, \ 207 .dst_reg = DST, \
207 .src_reg = SRC, \ 208 .src_reg = SRC, \
@@ -211,7 +212,7 @@ enum {
211/* Memory store, *(uint *) (dst_reg + off16) = src_reg */ 212/* Memory store, *(uint *) (dst_reg + off16) = src_reg */
212 213
213#define BPF_STX_MEM(SIZE, DST, SRC, OFF) \ 214#define BPF_STX_MEM(SIZE, DST, SRC, OFF) \
214 ((struct sock_filter_int) { \ 215 ((struct bpf_insn) { \
215 .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \ 216 .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \
216 .dst_reg = DST, \ 217 .dst_reg = DST, \
217 .src_reg = SRC, \ 218 .src_reg = SRC, \
@@ -221,7 +222,7 @@ enum {
221/* Memory store, *(uint *) (dst_reg + off16) = imm32 */ 222/* Memory store, *(uint *) (dst_reg + off16) = imm32 */
222 223
223#define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ 224#define BPF_ST_MEM(SIZE, DST, OFF, IMM) \
224 ((struct sock_filter_int) { \ 225 ((struct bpf_insn) { \
225 .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \ 226 .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \
226 .dst_reg = DST, \ 227 .dst_reg = DST, \
227 .src_reg = 0, \ 228 .src_reg = 0, \
@@ -231,7 +232,7 @@ enum {
231/* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */ 232/* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */
232 233
233#define BPF_JMP_REG(OP, DST, SRC, OFF) \ 234#define BPF_JMP_REG(OP, DST, SRC, OFF) \
234 ((struct sock_filter_int) { \ 235 ((struct bpf_insn) { \
235 .code = BPF_JMP | BPF_OP(OP) | BPF_X, \ 236 .code = BPF_JMP | BPF_OP(OP) | BPF_X, \
236 .dst_reg = DST, \ 237 .dst_reg = DST, \
237 .src_reg = SRC, \ 238 .src_reg = SRC, \
@@ -241,7 +242,7 @@ enum {
241/* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */ 242/* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */
242 243
243#define BPF_JMP_IMM(OP, DST, IMM, OFF) \ 244#define BPF_JMP_IMM(OP, DST, IMM, OFF) \
244 ((struct sock_filter_int) { \ 245 ((struct bpf_insn) { \
245 .code = BPF_JMP | BPF_OP(OP) | BPF_K, \ 246 .code = BPF_JMP | BPF_OP(OP) | BPF_K, \
246 .dst_reg = DST, \ 247 .dst_reg = DST, \
247 .src_reg = 0, \ 248 .src_reg = 0, \
@@ -251,7 +252,7 @@ enum {
251/* Function call */ 252/* Function call */
252 253
253#define BPF_EMIT_CALL(FUNC) \ 254#define BPF_EMIT_CALL(FUNC) \
254 ((struct sock_filter_int) { \ 255 ((struct bpf_insn) { \
255 .code = BPF_JMP | BPF_CALL, \ 256 .code = BPF_JMP | BPF_CALL, \
256 .dst_reg = 0, \ 257 .dst_reg = 0, \
257 .src_reg = 0, \ 258 .src_reg = 0, \
@@ -261,7 +262,7 @@ enum {
261/* Raw code statement block */ 262/* Raw code statement block */
262 263
263#define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \ 264#define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \
264 ((struct sock_filter_int) { \ 265 ((struct bpf_insn) { \
265 .code = CODE, \ 266 .code = CODE, \
266 .dst_reg = DST, \ 267 .dst_reg = DST, \
267 .src_reg = SRC, \ 268 .src_reg = SRC, \
@@ -271,7 +272,7 @@ enum {
271/* Program exit */ 272/* Program exit */
272 273
273#define BPF_EXIT_INSN() \ 274#define BPF_EXIT_INSN() \
274 ((struct sock_filter_int) { \ 275 ((struct bpf_insn) { \
275 .code = BPF_JMP | BPF_EXIT, \ 276 .code = BPF_JMP | BPF_EXIT, \
276 .dst_reg = 0, \ 277 .dst_reg = 0, \
277 .src_reg = 0, \ 278 .src_reg = 0, \
@@ -295,9 +296,10 @@ enum {
295}) 296})
296 297
297/* Macro to invoke filter function. */ 298/* Macro to invoke filter function. */
298#define SK_RUN_FILTER(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi) 299#define SK_RUN_FILTER(filter, ctx) \
300 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi)
299 301
300struct sock_filter_int { 302struct bpf_insn {
301 __u8 code; /* opcode */ 303 __u8 code; /* opcode */
302 __u8 dst_reg:4; /* dest register */ 304 __u8 dst_reg:4; /* dest register */
303 __u8 src_reg:4; /* source register */ 305 __u8 src_reg:4; /* source register */
@@ -322,54 +324,58 @@ struct sk_buff;
322struct sock; 324struct sock;
323struct seccomp_data; 325struct seccomp_data;
324 326
325struct sk_filter { 327struct bpf_prog {
326 atomic_t refcnt;
327 u32 jited:1, /* Is our filter JIT'ed? */ 328 u32 jited:1, /* Is our filter JIT'ed? */
328 len:31; /* Number of filter blocks */ 329 len:31; /* Number of filter blocks */
329 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 330 struct sock_fprog_kern *orig_prog; /* Original BPF program */
330 struct rcu_head rcu;
331 unsigned int (*bpf_func)(const struct sk_buff *skb, 331 unsigned int (*bpf_func)(const struct sk_buff *skb,
332 const struct sock_filter_int *filter); 332 const struct bpf_insn *filter);
333 union { 333 union {
334 struct sock_filter insns[0]; 334 struct sock_filter insns[0];
335 struct sock_filter_int insnsi[0]; 335 struct bpf_insn insnsi[0];
336 struct work_struct work; 336 struct work_struct work;
337 }; 337 };
338}; 338};
339 339
340static inline unsigned int sk_filter_size(unsigned int proglen) 340struct sk_filter {
341 atomic_t refcnt;
342 struct rcu_head rcu;
343 struct bpf_prog *prog;
344};
345
346#define BPF_PROG_RUN(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi)
347
348static inline unsigned int bpf_prog_size(unsigned int proglen)
341{ 349{
342 return max(sizeof(struct sk_filter), 350 return max(sizeof(struct bpf_prog),
343 offsetof(struct sk_filter, insns[proglen])); 351 offsetof(struct bpf_prog, insns[proglen]));
344} 352}
345 353
346#define sk_filter_proglen(fprog) \ 354#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
347 (fprog->len * sizeof(fprog->filter[0]))
348 355
349int sk_filter(struct sock *sk, struct sk_buff *skb); 356int sk_filter(struct sock *sk, struct sk_buff *skb);
350 357
351void sk_filter_select_runtime(struct sk_filter *fp); 358void bpf_prog_select_runtime(struct bpf_prog *fp);
352void sk_filter_free(struct sk_filter *fp); 359void bpf_prog_free(struct bpf_prog *fp);
353 360
354int sk_convert_filter(struct sock_filter *prog, int len, 361int bpf_convert_filter(struct sock_filter *prog, int len,
355 struct sock_filter_int *new_prog, int *new_len); 362 struct bpf_insn *new_prog, int *new_len);
356 363
357int sk_unattached_filter_create(struct sk_filter **pfp, 364int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
358 struct sock_fprog_kern *fprog); 365void bpf_prog_destroy(struct bpf_prog *fp);
359void sk_unattached_filter_destroy(struct sk_filter *fp);
360 366
361int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 367int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
362int sk_detach_filter(struct sock *sk); 368int sk_detach_filter(struct sock *sk);
363 369
364int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 370int bpf_check_classic(const struct sock_filter *filter, unsigned int flen);
365int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, 371int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
366 unsigned int len); 372 unsigned int len);
367 373
368void sk_filter_charge(struct sock *sk, struct sk_filter *fp); 374bool sk_filter_charge(struct sock *sk, struct sk_filter *fp);
369void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp); 375void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
370 376
371u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); 377u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
372void bpf_int_jit_compile(struct sk_filter *fp); 378void bpf_int_jit_compile(struct bpf_prog *fp);
373 379
374#define BPF_ANC BIT(15) 380#define BPF_ANC BIT(15)
375 381
@@ -406,13 +412,25 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
406 } 412 }
407} 413}
408 414
415void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb,
416 int k, unsigned int size);
417
418static inline void *bpf_load_pointer(const struct sk_buff *skb, int k,
419 unsigned int size, void *buffer)
420{
421 if (k >= 0)
422 return skb_header_pointer(skb, k, size, buffer);
423
424 return bpf_internal_load_pointer_neg_helper(skb, k, size);
425}
426
409#ifdef CONFIG_BPF_JIT 427#ifdef CONFIG_BPF_JIT
410#include <stdarg.h> 428#include <stdarg.h>
411#include <linux/linkage.h> 429#include <linux/linkage.h>
412#include <linux/printk.h> 430#include <linux/printk.h>
413 431
414void bpf_jit_compile(struct sk_filter *fp); 432void bpf_jit_compile(struct bpf_prog *fp);
415void bpf_jit_free(struct sk_filter *fp); 433void bpf_jit_free(struct bpf_prog *fp);
416 434
417static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 435static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
418 u32 pass, void *image) 436 u32 pass, void *image)
@@ -426,11 +444,11 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
426#else 444#else
427#include <linux/slab.h> 445#include <linux/slab.h>
428 446
429static inline void bpf_jit_compile(struct sk_filter *fp) 447static inline void bpf_jit_compile(struct bpf_prog *fp)
430{ 448{
431} 449}
432 450
433static inline void bpf_jit_free(struct sk_filter *fp) 451static inline void bpf_jit_free(struct bpf_prog *fp)
434{ 452{
435 kfree(fp); 453 kfree(fp);
436} 454}
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 59529330efd6..5c41c5e75b5c 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -45,6 +45,8 @@ int request_firmware_nowait(
45 struct module *module, bool uevent, 45 struct module *module, bool uevent,
46 const char *name, struct device *device, gfp_t gfp, void *context, 46 const char *name, struct device *device, gfp_t gfp, void *context,
47 void (*cont)(const struct firmware *fw, void *context)); 47 void (*cont)(const struct firmware *fw, void *context));
48int request_firmware_direct(const struct firmware **fw, const char *name,
49 struct device *device);
48 50
49void release_firmware(const struct firmware *fw); 51void release_firmware(const struct firmware *fw);
50#else 52#else
@@ -66,13 +68,12 @@ static inline void release_firmware(const struct firmware *fw)
66{ 68{
67} 69}
68 70
69#endif 71static inline int request_firmware_direct(const struct firmware **fw,
72 const char *name,
73 struct device *device)
74{
75 return -EINVAL;
76}
70 77
71#ifdef CONFIG_FW_LOADER_USER_HELPER
72int request_firmware_direct(const struct firmware **fw, const char *name,
73 struct device *device);
74#else
75#define request_firmware_direct request_firmware
76#endif 78#endif
77
78#endif 79#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e11d60cc867b..f0890e4a7c25 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -387,7 +387,7 @@ struct address_space {
387 struct inode *host; /* owner: inode, block_device */ 387 struct inode *host; /* owner: inode, block_device */
388 struct radix_tree_root page_tree; /* radix tree of all pages */ 388 struct radix_tree_root page_tree; /* radix tree of all pages */
389 spinlock_t tree_lock; /* and lock protecting it */ 389 spinlock_t tree_lock; /* and lock protecting it */
390 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 390 atomic_t i_mmap_writable;/* count VM_SHARED mappings */
391 struct rb_root i_mmap; /* tree of private and shared mappings */ 391 struct rb_root i_mmap; /* tree of private and shared mappings */
392 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 392 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
393 struct mutex i_mmap_mutex; /* protect tree, count, list */ 393 struct mutex i_mmap_mutex; /* protect tree, count, list */
@@ -470,10 +470,35 @@ static inline int mapping_mapped(struct address_space *mapping)
470 * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff 470 * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff
471 * marks vma as VM_SHARED if it is shared, and the file was opened for 471 * marks vma as VM_SHARED if it is shared, and the file was opened for
472 * writing i.e. vma may be mprotected writable even if now readonly. 472 * writing i.e. vma may be mprotected writable even if now readonly.
473 *
474 * If i_mmap_writable is negative, no new writable mappings are allowed. You
475 * can only deny writable mappings, if none exists right now.
473 */ 476 */
474static inline int mapping_writably_mapped(struct address_space *mapping) 477static inline int mapping_writably_mapped(struct address_space *mapping)
475{ 478{
476 return mapping->i_mmap_writable != 0; 479 return atomic_read(&mapping->i_mmap_writable) > 0;
480}
481
482static inline int mapping_map_writable(struct address_space *mapping)
483{
484 return atomic_inc_unless_negative(&mapping->i_mmap_writable) ?
485 0 : -EPERM;
486}
487
488static inline void mapping_unmap_writable(struct address_space *mapping)
489{
490 atomic_dec(&mapping->i_mmap_writable);
491}
492
493static inline int mapping_deny_writable(struct address_space *mapping)
494{
495 return atomic_dec_unless_positive(&mapping->i_mmap_writable) ?
496 0 : -EBUSY;
497}
498
499static inline void mapping_allow_writable(struct address_space *mapping)
500{
501 atomic_inc(&mapping->i_mmap_writable);
477} 502}
478 503
479/* 504/*
@@ -833,7 +858,7 @@ static inline struct file *get_file(struct file *f)
833 * 858 *
834 * Lockd stuffs a "host" pointer into this. 859 * Lockd stuffs a "host" pointer into this.
835 */ 860 */
836typedef struct files_struct *fl_owner_t; 861typedef void *fl_owner_t;
837 862
838struct file_lock_operations { 863struct file_lock_operations {
839 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 864 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
@@ -2688,7 +2713,7 @@ static const struct file_operations __fops = { \
2688 .read = simple_attr_read, \ 2713 .read = simple_attr_read, \
2689 .write = simple_attr_write, \ 2714 .write = simple_attr_write, \
2690 .llseek = generic_file_llseek, \ 2715 .llseek = generic_file_llseek, \
2691}; 2716}
2692 2717
2693static inline __printf(1, 2) 2718static inline __printf(1, 2)
2694void __simple_attr_check_format(const char *fmt, ...) 2719void __simple_attr_check_format(const char *fmt, ...)
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index fc7718c6bd3e..ca060d7c4fa6 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -322,16 +322,18 @@ extern int fsnotify_fasync(int fd, struct file *file, int on);
322extern void fsnotify_destroy_event(struct fsnotify_group *group, 322extern void fsnotify_destroy_event(struct fsnotify_group *group,
323 struct fsnotify_event *event); 323 struct fsnotify_event *event);
324/* attach the event to the group notification queue */ 324/* attach the event to the group notification queue */
325extern int fsnotify_add_notify_event(struct fsnotify_group *group, 325extern int fsnotify_add_event(struct fsnotify_group *group,
326 struct fsnotify_event *event, 326 struct fsnotify_event *event,
327 int (*merge)(struct list_head *, 327 int (*merge)(struct list_head *,
328 struct fsnotify_event *)); 328 struct fsnotify_event *));
329/* Remove passed event from groups notification queue */
330extern void fsnotify_remove_event(struct fsnotify_group *group, struct fsnotify_event *event);
329/* true if the group notification queue is empty */ 331/* true if the group notification queue is empty */
330extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); 332extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
331/* return, but do not dequeue the first event on the notification queue */ 333/* return, but do not dequeue the first event on the notification queue */
332extern struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group); 334extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
333/* return AND dequeue the first event on the notification queue */ 335/* return AND dequeue the first event on the notification queue */
334extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group); 336extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
335 337
336/* functions used to manipulate the marks attached to inodes */ 338/* functions used to manipulate the marks attached to inodes */
337 339
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 404a686a3644..6bb5e3f2a3b4 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -33,8 +33,7 @@
33 * features, then it must call an indirect function that 33 * features, then it must call an indirect function that
34 * does. Or at least does enough to prevent any unwelcomed side effects. 34 * does. Or at least does enough to prevent any unwelcomed side effects.
35 */ 35 */
36#if !defined(CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST) || \ 36#if !ARCH_SUPPORTS_FTRACE_OPS
37 !ARCH_SUPPORTS_FTRACE_OPS
38# define FTRACE_FORCE_LIST_FUNC 1 37# define FTRACE_FORCE_LIST_FUNC 1
39#else 38#else
40# define FTRACE_FORCE_LIST_FUNC 0 39# define FTRACE_FORCE_LIST_FUNC 0
@@ -118,17 +117,18 @@ struct ftrace_ops {
118 ftrace_func_t func; 117 ftrace_func_t func;
119 struct ftrace_ops *next; 118 struct ftrace_ops *next;
120 unsigned long flags; 119 unsigned long flags;
121 int __percpu *disabled;
122 void *private; 120 void *private;
121 int __percpu *disabled;
123#ifdef CONFIG_DYNAMIC_FTRACE 122#ifdef CONFIG_DYNAMIC_FTRACE
123 int nr_trampolines;
124 struct ftrace_hash *notrace_hash; 124 struct ftrace_hash *notrace_hash;
125 struct ftrace_hash *filter_hash; 125 struct ftrace_hash *filter_hash;
126 struct ftrace_hash *tramp_hash;
126 struct mutex regex_lock; 127 struct mutex regex_lock;
128 unsigned long trampoline;
127#endif 129#endif
128}; 130};
129 131
130extern int function_trace_stop;
131
132/* 132/*
133 * Type of the current tracing. 133 * Type of the current tracing.
134 */ 134 */
@@ -140,32 +140,6 @@ enum ftrace_tracing_type_t {
140/* Current tracing type, default is FTRACE_TYPE_ENTER */ 140/* Current tracing type, default is FTRACE_TYPE_ENTER */
141extern enum ftrace_tracing_type_t ftrace_tracing_type; 141extern enum ftrace_tracing_type_t ftrace_tracing_type;
142 142
143/**
144 * ftrace_stop - stop function tracer.
145 *
146 * A quick way to stop the function tracer. Note this an on off switch,
147 * it is not something that is recursive like preempt_disable.
148 * This does not disable the calling of mcount, it only stops the
149 * calling of functions from mcount.
150 */
151static inline void ftrace_stop(void)
152{
153 function_trace_stop = 1;
154}
155
156/**
157 * ftrace_start - start the function tracer.
158 *
159 * This function is the inverse of ftrace_stop. This does not enable
160 * the function tracing if the function tracer is disabled. This only
161 * sets the function tracer flag to continue calling the functions
162 * from mcount.
163 */
164static inline void ftrace_start(void)
165{
166 function_trace_stop = 0;
167}
168
169/* 143/*
170 * The ftrace_ops must be a static and should also 144 * The ftrace_ops must be a static and should also
171 * be read_mostly. These functions do modify read_mostly variables 145 * be read_mostly. These functions do modify read_mostly variables
@@ -242,8 +216,6 @@ static inline int ftrace_nr_registered_ops(void)
242} 216}
243static inline void clear_ftrace_function(void) { } 217static inline void clear_ftrace_function(void) { }
244static inline void ftrace_kill(void) { } 218static inline void ftrace_kill(void) { }
245static inline void ftrace_stop(void) { }
246static inline void ftrace_start(void) { }
247#endif /* CONFIG_FUNCTION_TRACER */ 219#endif /* CONFIG_FUNCTION_TRACER */
248 220
249#ifdef CONFIG_STACK_TRACER 221#ifdef CONFIG_STACK_TRACER
@@ -317,13 +289,20 @@ extern int ftrace_nr_registered_ops(void);
317 * from tracing that function. 289 * from tracing that function.
318 */ 290 */
319enum { 291enum {
320 FTRACE_FL_ENABLED = (1UL << 29), 292 FTRACE_FL_ENABLED = (1UL << 31),
321 FTRACE_FL_REGS = (1UL << 30), 293 FTRACE_FL_REGS = (1UL << 30),
322 FTRACE_FL_REGS_EN = (1UL << 31) 294 FTRACE_FL_REGS_EN = (1UL << 29),
295 FTRACE_FL_TRAMP = (1UL << 28),
296 FTRACE_FL_TRAMP_EN = (1UL << 27),
323}; 297};
324 298
325#define FTRACE_FL_MASK (0x7UL << 29) 299#define FTRACE_REF_MAX_SHIFT 27
326#define FTRACE_REF_MAX ((1UL << 29) - 1) 300#define FTRACE_FL_BITS 5
301#define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1)
302#define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT)
303#define FTRACE_REF_MAX ((1UL << FTRACE_REF_MAX_SHIFT) - 1)
304
305#define ftrace_rec_count(rec) ((rec)->flags & ~FTRACE_FL_MASK)
327 306
328struct dyn_ftrace { 307struct dyn_ftrace {
329 unsigned long ip; /* address of mcount call-site */ 308 unsigned long ip; /* address of mcount call-site */
@@ -431,6 +410,10 @@ void ftrace_modify_all_code(int command);
431#define FTRACE_ADDR ((unsigned long)ftrace_caller) 410#define FTRACE_ADDR ((unsigned long)ftrace_caller)
432#endif 411#endif
433 412
413#ifndef FTRACE_GRAPH_ADDR
414#define FTRACE_GRAPH_ADDR ((unsigned long)ftrace_graph_caller)
415#endif
416
434#ifndef FTRACE_REGS_ADDR 417#ifndef FTRACE_REGS_ADDR
435#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS 418#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
436# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller) 419# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)
@@ -439,6 +422,16 @@ void ftrace_modify_all_code(int command);
439#endif 422#endif
440#endif 423#endif
441 424
425/*
426 * If an arch would like functions that are only traced
427 * by the function graph tracer to jump directly to its own
428 * trampoline, then they can define FTRACE_GRAPH_TRAMP_ADDR
429 * to be that address to jump to.
430 */
431#ifndef FTRACE_GRAPH_TRAMP_ADDR
432#define FTRACE_GRAPH_TRAMP_ADDR ((unsigned long) 0)
433#endif
434
442#ifdef CONFIG_FUNCTION_GRAPH_TRACER 435#ifdef CONFIG_FUNCTION_GRAPH_TRACER
443extern void ftrace_graph_caller(void); 436extern void ftrace_graph_caller(void);
444extern int ftrace_enable_ftrace_graph_caller(void); 437extern int ftrace_enable_ftrace_graph_caller(void);
@@ -736,6 +729,7 @@ extern char __irqentry_text_end[];
736extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 729extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
737 trace_func_graph_ent_t entryfunc); 730 trace_func_graph_ent_t entryfunc);
738 731
732extern bool ftrace_graph_is_dead(void);
739extern void ftrace_graph_stop(void); 733extern void ftrace_graph_stop(void);
740 734
741/* The current handlers in use */ 735/* The current handlers in use */
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index cff3106ffe2c..06c6faa9e5cc 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -272,7 +272,6 @@ struct ftrace_event_call {
272 struct trace_event event; 272 struct trace_event event;
273 const char *print_fmt; 273 const char *print_fmt;
274 struct event_filter *filter; 274 struct event_filter *filter;
275 struct list_head *files;
276 void *mod; 275 void *mod;
277 void *data; 276 void *data;
278 /* 277 /*
@@ -404,8 +403,6 @@ enum event_trigger_type {
404 ETT_EVENT_ENABLE = (1 << 3), 403 ETT_EVENT_ENABLE = (1 << 3),
405}; 404};
406 405
407extern void destroy_preds(struct ftrace_event_file *file);
408extern void destroy_call_preds(struct ftrace_event_call *call);
409extern int filter_match_preds(struct event_filter *filter, void *rec); 406extern int filter_match_preds(struct event_filter *filter, void *rec);
410 407
411extern int filter_check_discard(struct ftrace_event_file *file, void *rec, 408extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 6eb1fb37de9a..5e7219dc0fae 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -360,7 +360,7 @@ extern unsigned long get_zeroed_page(gfp_t gfp_mask);
360void *alloc_pages_exact(size_t size, gfp_t gfp_mask); 360void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
361void free_pages_exact(void *virt, size_t size); 361void free_pages_exact(void *virt, size_t size);
362/* This is different from alloc_pages_exact_node !!! */ 362/* This is different from alloc_pages_exact_node !!! */
363void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); 363void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
364 364
365#define __get_free_page(gfp_mask) \ 365#define __get_free_page(gfp_mask) \
366 __get_free_pages((gfp_mask), 0) 366 __get_free_pages((gfp_mask), 0)
diff --git a/include/linux/glob.h b/include/linux/glob.h
new file mode 100644
index 000000000000..861d8347d08e
--- /dev/null
+++ b/include/linux/glob.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_GLOB_H
2#define _LINUX_GLOB_H
3
4#include <linux/types.h> /* For bool */
5#include <linux/compiler.h> /* For __pure */
6
7bool __pure glob_match(char const *pat, char const *str);
8
9#endif /* _LINUX_GLOB_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 05e53ccb708b..b7ce0c64c6f3 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -18,30 +18,79 @@ struct gpio_desc;
18 18
19#ifdef CONFIG_GPIOLIB 19#ifdef CONFIG_GPIOLIB
20 20
21#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
22#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
23#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
24
25/**
26 * Optional flags that can be passed to one of gpiod_* to configure direction
27 * and output value. These values cannot be OR'd.
28 */
29enum gpiod_flags {
30 GPIOD_ASIS = 0,
31 GPIOD_IN = GPIOD_FLAGS_BIT_DIR_SET,
32 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
33 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
34 GPIOD_FLAGS_BIT_DIR_VAL,
35};
36
21/* Acquire and dispose GPIOs */ 37/* Acquire and dispose GPIOs */
22struct gpio_desc *__must_check gpiod_get(struct device *dev, 38struct gpio_desc *__must_check __gpiod_get(struct device *dev,
23 const char *con_id); 39 const char *con_id,
24struct gpio_desc *__must_check gpiod_get_index(struct device *dev, 40 enum gpiod_flags flags);
41#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags)
42#define gpiod_get(varargs...) __gpiod_get(varargs, 0)
43struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,
25 const char *con_id, 44 const char *con_id,
26 unsigned int idx); 45 unsigned int idx,
27struct gpio_desc *__must_check gpiod_get_optional(struct device *dev, 46 enum gpiod_flags flags);
28 const char *con_id); 47#define __gpiod_get_index(dev, con_id, index, flags, ...) \
29struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev, 48 __gpiod_get_index(dev, con_id, index, flags)
49#define gpiod_get_index(varargs...) __gpiod_get_index(varargs, 0)
50struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev,
51 const char *con_id,
52 enum gpiod_flags flags);
53#define __gpiod_get_optional(dev, con_id, flags, ...) \
54 __gpiod_get_optional(dev, con_id, flags)
55#define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, 0)
56struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
30 const char *con_id, 57 const char *con_id,
31 unsigned int index); 58 unsigned int index,
59 enum gpiod_flags flags);
60#define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \
61 __gpiod_get_index_optional(dev, con_id, index, flags)
62#define gpiod_get_index_optional(varargs...) \
63 __gpiod_get_index_optional(varargs, 0)
32 64
33void gpiod_put(struct gpio_desc *desc); 65void gpiod_put(struct gpio_desc *desc);
34 66
35struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 67struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
36 const char *con_id); 68 const char *con_id,
37struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 69 enum gpiod_flags flags);
70#define __devm_gpiod_get(dev, con_id, flags, ...) \
71 __devm_gpiod_get(dev, con_id, flags)
72#define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, 0)
73struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
38 const char *con_id, 74 const char *con_id,
39 unsigned int idx); 75 unsigned int idx,
40struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev, 76 enum gpiod_flags flags);
41 const char *con_id); 77#define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \
78 __devm_gpiod_get_index(dev, con_id, index, flags)
79#define devm_gpiod_get_index(varargs...) __devm_gpiod_get_index(varargs, 0)
80struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
81 const char *con_id,
82 enum gpiod_flags flags);
83#define __devm_gpiod_get_optional(dev, con_id, flags, ...) \
84 __devm_gpiod_get_optional(dev, con_id, flags)
85#define devm_gpiod_get_optional(varargs...) \
86 __devm_gpiod_get_optional(varargs, 0)
42struct gpio_desc *__must_check 87struct gpio_desc *__must_check
43devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 88__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
44 unsigned int index); 89 unsigned int index, enum gpiod_flags flags);
90#define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \
91 __devm_gpiod_get_index_optional(dev, con_id, index, flags)
92#define devm_gpiod_get_index_optional(varargs...) \
93 __devm_gpiod_get_index_optional(varargs, 0)
45 94
46void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 95void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
47 96
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 573e4f3243d0..e78a2373e374 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -141,73 +141,16 @@ extern const char *gpiochip_is_requested(struct gpio_chip *chip,
141 141
142/* add/remove chips */ 142/* add/remove chips */
143extern int gpiochip_add(struct gpio_chip *chip); 143extern int gpiochip_add(struct gpio_chip *chip);
144extern int __must_check gpiochip_remove(struct gpio_chip *chip); 144extern int gpiochip_remove(struct gpio_chip *chip);
145extern struct gpio_chip *gpiochip_find(void *data, 145extern struct gpio_chip *gpiochip_find(void *data,
146 int (*match)(struct gpio_chip *chip, void *data)); 146 int (*match)(struct gpio_chip *chip, void *data));
147 147
148/* lock/unlock as IRQ */ 148/* lock/unlock as IRQ */
149int gpiod_lock_as_irq(struct gpio_desc *desc); 149int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
150void gpiod_unlock_as_irq(struct gpio_desc *desc); 150void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
151 151
152struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); 152struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
153 153
154struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip,
155 u16 hwnum);
156
157enum gpio_lookup_flags {
158 GPIO_ACTIVE_HIGH = (0 << 0),
159 GPIO_ACTIVE_LOW = (1 << 0),
160 GPIO_OPEN_DRAIN = (1 << 1),
161 GPIO_OPEN_SOURCE = (1 << 2),
162};
163
164/**
165 * struct gpiod_lookup - lookup table
166 * @chip_label: name of the chip the GPIO belongs to
167 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
168 * @con_id: name of the GPIO from the device's point of view
169 * @idx: index of the GPIO in case several GPIOs share the same name
170 * @flags: mask of GPIO_* values
171 *
172 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
173 * functions using platform data.
174 */
175struct gpiod_lookup {
176 const char *chip_label;
177 u16 chip_hwnum;
178 const char *con_id;
179 unsigned int idx;
180 enum gpio_lookup_flags flags;
181};
182
183struct gpiod_lookup_table {
184 struct list_head list;
185 const char *dev_id;
186 struct gpiod_lookup table[];
187};
188
189/*
190 * Simple definition of a single GPIO under a con_id
191 */
192#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
193 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
194
195/*
196 * Use this macro if you need to have several GPIOs under the same con_id.
197 * Each GPIO needs to use a different index and can be accessed using
198 * gpiod_get_index()
199 */
200#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
201{ \
202 .chip_label = _chip_label, \
203 .chip_hwnum = _chip_hwnum, \
204 .con_id = _con_id, \
205 .idx = _idx, \
206 .flags = _flags, \
207}
208
209void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
210
211#ifdef CONFIG_GPIOLIB_IRQCHIP 154#ifdef CONFIG_GPIOLIB_IRQCHIP
212 155
213void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, 156void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
@@ -223,6 +166,9 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
223 166
224#endif /* CONFIG_GPIO_IRQCHIP */ 167#endif /* CONFIG_GPIO_IRQCHIP */
225 168
169int gpiochip_request_own_desc(struct gpio_desc *desc, const char *label);
170void gpiochip_free_own_desc(struct gpio_desc *desc);
171
226#else /* CONFIG_GPIOLIB */ 172#else /* CONFIG_GPIOLIB */
227 173
228static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) 174static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h
new file mode 100644
index 000000000000..e2706140eaff
--- /dev/null
+++ b/include/linux/gpio/machine.h
@@ -0,0 +1,61 @@
1#ifndef __LINUX_GPIO_MACHINE_H
2#define __LINUX_GPIO_MACHINE_H
3
4#include <linux/types.h>
5#include <linux/list.h>
6
7enum gpio_lookup_flags {
8 GPIO_ACTIVE_HIGH = (0 << 0),
9 GPIO_ACTIVE_LOW = (1 << 0),
10 GPIO_OPEN_DRAIN = (1 << 1),
11 GPIO_OPEN_SOURCE = (1 << 2),
12};
13
14/**
15 * struct gpiod_lookup - lookup table
16 * @chip_label: name of the chip the GPIO belongs to
17 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
18 * @con_id: name of the GPIO from the device's point of view
19 * @idx: index of the GPIO in case several GPIOs share the same name
20 * @flags: mask of GPIO_* values
21 *
22 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
23 * functions using platform data.
24 */
25struct gpiod_lookup {
26 const char *chip_label;
27 u16 chip_hwnum;
28 const char *con_id;
29 unsigned int idx;
30 enum gpio_lookup_flags flags;
31};
32
33struct gpiod_lookup_table {
34 struct list_head list;
35 const char *dev_id;
36 struct gpiod_lookup table[];
37};
38
39/*
40 * Simple definition of a single GPIO under a con_id
41 */
42#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
43 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
44
45/*
46 * Use this macro if you need to have several GPIOs under the same con_id.
47 * Each GPIO needs to use a different index and can be accessed using
48 * gpiod_get_index()
49 */
50#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
51{ \
52 .chip_label = _chip_label, \
53 .chip_hwnum = _chip_hwnum, \
54 .con_id = _con_id, \
55 .idx = _idx, \
56 .flags = _flags, \
57}
58
59void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
60
61#endif /* __LINUX_GPIO_MACHINE_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 77632cf159c0..f53c4a9cca1d 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -167,6 +167,7 @@ struct hid_item {
167#define HID_UP_MSVENDOR 0xff000000 167#define HID_UP_MSVENDOR 0xff000000
168#define HID_UP_CUSTOM 0x00ff0000 168#define HID_UP_CUSTOM 0x00ff0000
169#define HID_UP_LOGIVENDOR 0xffbc0000 169#define HID_UP_LOGIVENDOR 0xffbc0000
170#define HID_UP_LNVENDOR 0xffa00000
170#define HID_UP_SENSOR 0x00200000 171#define HID_UP_SENSOR 0x00200000
171 172
172#define HID_USAGE 0x0000ffff 173#define HID_USAGE 0x0000ffff
@@ -311,6 +312,11 @@ struct hid_item {
311#define HID_GROUP_RMI 0x0100 312#define HID_GROUP_RMI 0x0100
312 313
313/* 314/*
315 * Vendor specific HID device groups
316 */
317#define HID_GROUP_WACOM 0x0101
318
319/*
314 * This is the global environment of the parser. This information is 320 * This is the global environment of the parser. This information is
315 * persistent for main-items. The global environment can be saved and 321 * persistent for main-items. The global environment can be saved and
316 * restored with PUSH/POP statements. 322 * restored with PUSH/POP statements.
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 7fb31da45d03..9286a46b7d69 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -93,7 +93,7 @@ static inline int kmap_atomic_idx_push(void)
93 93
94#ifdef CONFIG_DEBUG_HIGHMEM 94#ifdef CONFIG_DEBUG_HIGHMEM
95 WARN_ON_ONCE(in_irq() && !irqs_disabled()); 95 WARN_ON_ONCE(in_irq() && !irqs_disabled());
96 BUG_ON(idx > KM_TYPE_NR); 96 BUG_ON(idx >= KM_TYPE_NR);
97#endif 97#endif
98 return idx; 98 return idx;
99} 99}
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index d2b52999e771..bb9840fd1e18 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -164,12 +164,15 @@ int host1x_job_submit(struct host1x_job *job);
164 */ 164 */
165 165
166struct host1x_reloc { 166struct host1x_reloc {
167 struct host1x_bo *cmdbuf; 167 struct {
168 u32 cmdbuf_offset; 168 struct host1x_bo *bo;
169 struct host1x_bo *target; 169 unsigned long offset;
170 u32 target_offset; 170 } cmdbuf;
171 u32 shift; 171 struct {
172 u32 pad; 172 struct host1x_bo *bo;
173 unsigned long offset;
174 } target;
175 unsigned long shift;
173}; 176};
174 177
175struct host1x_job { 178struct host1x_job {
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index e7a8d3fa91d5..a036d058a249 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -165,6 +165,7 @@ enum hrtimer_base_type {
165 * struct hrtimer_cpu_base - the per cpu clock bases 165 * struct hrtimer_cpu_base - the per cpu clock bases
166 * @lock: lock protecting the base and associated clock bases 166 * @lock: lock protecting the base and associated clock bases
167 * and timers 167 * and timers
168 * @cpu: cpu number
168 * @active_bases: Bitfield to mark bases with active timers 169 * @active_bases: Bitfield to mark bases with active timers
169 * @clock_was_set: Indicates that clock was set from irq context. 170 * @clock_was_set: Indicates that clock was set from irq context.
170 * @expires_next: absolute time of the next event which was scheduled 171 * @expires_next: absolute time of the next event which was scheduled
@@ -179,6 +180,7 @@ enum hrtimer_base_type {
179 */ 180 */
180struct hrtimer_cpu_base { 181struct hrtimer_cpu_base {
181 raw_spinlock_t lock; 182 raw_spinlock_t lock;
183 unsigned int cpu;
182 unsigned int active_bases; 184 unsigned int active_bases;
183 unsigned int clock_was_set; 185 unsigned int clock_was_set;
184#ifdef CONFIG_HIGH_RES_TIMERS 186#ifdef CONFIG_HIGH_RES_TIMERS
@@ -324,14 +326,6 @@ static inline void timerfd_clock_was_set(void) { }
324#endif 326#endif
325extern void hrtimers_resume(void); 327extern void hrtimers_resume(void);
326 328
327extern ktime_t ktime_get(void);
328extern ktime_t ktime_get_real(void);
329extern ktime_t ktime_get_boottime(void);
330extern ktime_t ktime_get_monotonic_offset(void);
331extern ktime_t ktime_get_clocktai(void);
332extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot,
333 ktime_t *offs_tai);
334
335DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 329DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
336 330
337 331
@@ -452,12 +446,6 @@ extern void hrtimer_run_pending(void);
452/* Bootup initialization: */ 446/* Bootup initialization: */
453extern void __init hrtimers_init(void); 447extern void __init hrtimers_init(void);
454 448
455#if BITS_PER_LONG < 64
456extern u64 ktime_divns(const ktime_t kt, s64 div);
457#else /* BITS_PER_LONG < 64 */
458# define ktime_divns(kt, div) (u64)((kt).tv64 / (div))
459#endif
460
461/* Show pending timers: */ 449/* Show pending timers: */
462extern void sysrq_timer_list_show(void); 450extern void sysrq_timer_list_show(void);
463 451
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index b826239bdce0..63579cb8d3dc 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -93,10 +93,6 @@ extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
93#endif /* CONFIG_DEBUG_VM */ 93#endif /* CONFIG_DEBUG_VM */
94 94
95extern unsigned long transparent_hugepage_flags; 95extern unsigned long transparent_hugepage_flags;
96extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
97 pmd_t *dst_pmd, pmd_t *src_pmd,
98 struct vm_area_struct *vma,
99 unsigned long addr, unsigned long end);
100extern int split_huge_page_to_list(struct page *page, struct list_head *list); 96extern int split_huge_page_to_list(struct page *page, struct list_head *list);
101static inline int split_huge_page(struct page *page) 97static inline int split_huge_page(struct page *page)
102{ 98{
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index a23c096b3080..6e6d338641fe 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -87,7 +87,6 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
87#endif 87#endif
88 88
89extern unsigned long hugepages_treat_as_movable; 89extern unsigned long hugepages_treat_as_movable;
90extern const unsigned long hugetlb_zero, hugetlb_infinity;
91extern int sysctl_hugetlb_shm_group; 90extern int sysctl_hugetlb_shm_group;
92extern struct list_head huge_boot_pages; 91extern struct list_head huge_boot_pages;
93 92
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index b4b0eef5fddf..914bb08cd738 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -29,6 +29,8 @@
29 * @read: New API. drivers can fill up to max bytes of data 29 * @read: New API. drivers can fill up to max bytes of data
30 * into the buffer. The buffer is aligned for any type. 30 * into the buffer. The buffer is aligned for any type.
31 * @priv: Private data, for use by the RNG driver. 31 * @priv: Private data, for use by the RNG driver.
32 * @quality: Estimation of true entropy in RNG's bitstream
33 * (per mill).
32 */ 34 */
33struct hwrng { 35struct hwrng {
34 const char *name; 36 const char *name;
@@ -38,6 +40,7 @@ struct hwrng {
38 int (*data_read)(struct hwrng *rng, u32 *data); 40 int (*data_read)(struct hwrng *rng, u32 *data);
39 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); 41 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait);
40 unsigned long priv; 42 unsigned long priv;
43 unsigned short quality;
41 44
42 /* internal. */ 45 /* internal. */
43 struct list_head list; 46 struct list_head list;
@@ -47,5 +50,7 @@ struct hwrng {
47extern int hwrng_register(struct hwrng *rng); 50extern int hwrng_register(struct hwrng *rng);
48/** Unregister a Hardware Random Number Generator driver. */ 51/** Unregister a Hardware Random Number Generator driver. */
49extern void hwrng_unregister(struct hwrng *rng); 52extern void hwrng_unregister(struct hwrng *rng);
53/** Feed random bits into the pool. */
54extern void add_hwgenerator_randomness(const char *buffer, size_t count, size_t entropy);
50 55
51#endif /* LINUX_HWRANDOM_H_ */ 56#endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index b556e0ab946f..ea507665896c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -577,4 +577,16 @@ static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node
577} 577}
578#endif /* CONFIG_OF */ 578#endif /* CONFIG_OF */
579 579
580#ifdef CONFIG_I2C_ACPI
581int acpi_i2c_install_space_handler(struct i2c_adapter *adapter);
582void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter);
583void acpi_i2c_register_devices(struct i2c_adapter *adap);
584#else
585static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { }
586static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
587{ }
588static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
589{ return 0; }
590#endif
591
580#endif /* _LINUX_I2C_H */ 592#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index 3891dc1de21c..02bf6ea31701 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -17,9 +17,6 @@
17 17
18/* The platform data for the Atmel maXTouch touchscreen driver */ 18/* The platform data for the Atmel maXTouch touchscreen driver */
19struct mxt_platform_data { 19struct mxt_platform_data {
20 const u8 *config;
21 size_t config_length;
22 u32 config_crc;
23 unsigned long irqflags; 20 unsigned long irqflags;
24 u8 t19_num_keys; 21 u8 t19_num_keys;
25 const unsigned int *t19_keymap; 22 const unsigned int *t19_keymap;
diff --git a/include/linux/i2c/s6000.h b/include/linux/i2c/s6000.h
deleted file mode 100644
index d9b34bfdae76..000000000000
--- a/include/linux/i2c/s6000.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __LINUX_I2C_S6000_H
2#define __LINUX_I2C_S6000_H
3
4struct s6_i2c_platform_data {
5 const char *clock; /* the clock to use */
6 int bus_num; /* the bus number to register */
7};
8
9#endif
10
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 6bff13f74050..63ab3873c5ed 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1001,6 +1001,26 @@ struct ieee80211_vendor_ie {
1001 u8 oui_type; 1001 u8 oui_type;
1002} __packed; 1002} __packed;
1003 1003
1004struct ieee80211_wmm_ac_param {
1005 u8 aci_aifsn; /* AIFSN, ACM, ACI */
1006 u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
1007 __le16 txop_limit;
1008} __packed;
1009
1010struct ieee80211_wmm_param_ie {
1011 u8 element_id; /* Element ID: 221 (0xdd); */
1012 u8 len; /* Length: 24 */
1013 /* required fields for WMM version 1 */
1014 u8 oui[3]; /* 00:50:f2 */
1015 u8 oui_type; /* 2 */
1016 u8 oui_subtype; /* 1 */
1017 u8 version; /* 1 for WMM version 1.0 */
1018 u8 qos_info; /* AP/STA specific QoS info */
1019 u8 reserved; /* 0 */
1020 /* AC_BE, AC_BK, AC_VI, AC_VO */
1021 struct ieee80211_wmm_ac_param ac[4];
1022} __packed;
1023
1004/* Control frames */ 1024/* Control frames */
1005struct ieee80211_rts { 1025struct ieee80211_rts {
1006 __le16 frame_control; 1026 __le16 frame_control;
@@ -1621,6 +1641,9 @@ enum ieee80211_reasoncode {
1621 WLAN_REASON_INVALID_RSN_IE_CAP = 22, 1641 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
1622 WLAN_REASON_IEEE8021X_FAILED = 23, 1642 WLAN_REASON_IEEE8021X_FAILED = 23,
1623 WLAN_REASON_CIPHER_SUITE_REJECTED = 24, 1643 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
1644 /* TDLS (802.11z) */
1645 WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE = 25,
1646 WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26,
1624 /* 802.11e */ 1647 /* 802.11e */
1625 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, 1648 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
1626 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, 1649 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index fd22789d7b2e..808dcb8cc04f 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -36,8 +36,28 @@ extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __use
36 36
37typedef int br_should_route_hook_t(struct sk_buff *skb); 37typedef int br_should_route_hook_t(struct sk_buff *skb);
38extern br_should_route_hook_t __rcu *br_should_route_hook; 38extern br_should_route_hook_t __rcu *br_should_route_hook;
39
40#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING)
39int br_multicast_list_adjacent(struct net_device *dev, 41int br_multicast_list_adjacent(struct net_device *dev,
40 struct list_head *br_ip_list); 42 struct list_head *br_ip_list);
43bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto);
41bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto); 44bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto);
45#else
46static inline int br_multicast_list_adjacent(struct net_device *dev,
47 struct list_head *br_ip_list)
48{
49 return 0;
50}
51static inline bool br_multicast_has_querier_anywhere(struct net_device *dev,
52 int proto)
53{
54 return false;
55}
56static inline bool br_multicast_has_querier_adjacent(struct net_device *dev,
57 int proto)
58{
59 return false;
60}
61#endif
42 62
43#endif 63#endif
diff --git a/include/linux/tegra-ahb.h b/include/linux/iio/accel/kxcjk_1013.h
index f1cd075ceee1..fd1d540ea62d 100644
--- a/include/linux/tegra-ahb.h
+++ b/include/linux/iio/accel/kxcjk_1013.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. 2 * KXCJK-1013 3-axis accelerometer Interface
3 * Copyright (c) 2014, Intel Corporation.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -11,9 +12,11 @@
11 * more details. 12 * more details.
12 */ 13 */
13 14
14#ifndef __LINUX_AHB_H__ 15#ifndef __IIO_KXCJK_1013_H__
15#define __LINUX_AHB_H__ 16#define __IIO_KXCJK_1013_H__
16 17
17extern int tegra_ahb_enable_smmu(struct device_node *ahb); 18struct kxcjk_1013_platform_data {
19 bool active_high_intr;
20};
18 21
19#endif /* __LINUX_AHB_H__ */ 22#endif
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 96f51f0e0096..d8257ab60bac 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -47,6 +47,7 @@
47 .type = device_type, \ 47 .type = device_type, \
48 .modified = mod, \ 48 .modified = mod, \
49 .info_mask_separate = mask, \ 49 .info_mask_separate = mask, \
50 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
50 .scan_index = index, \ 51 .scan_index = index, \
51 .channel2 = ch2, \ 52 .channel2 = ch2, \
52 .address = addr, \ 53 .address = addr, \
@@ -59,11 +60,6 @@
59 }, \ 60 }, \
60} 61}
61 62
62#define ST_SENSOR_DEV_ATTR_SAMP_FREQ() \
63 IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, \
64 st_sensors_sysfs_get_sampling_frequency, \
65 st_sensors_sysfs_set_sampling_frequency)
66
67#define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \ 63#define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \
68 IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \ 64 IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \
69 st_sensors_sysfs_sampling_frequency_avail) 65 st_sensors_sysfs_sampling_frequency_avail)
@@ -285,12 +281,6 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
285int st_sensors_check_device_support(struct iio_dev *indio_dev, 281int st_sensors_check_device_support(struct iio_dev *indio_dev,
286 int num_sensors_list, const struct st_sensors *sensors); 282 int num_sensors_list, const struct st_sensors *sensors);
287 283
288ssize_t st_sensors_sysfs_get_sampling_frequency(struct device *dev,
289 struct device_attribute *attr, char *buf);
290
291ssize_t st_sensors_sysfs_set_sampling_frequency(struct device *dev,
292 struct device_attribute *attr, const char *buf, size_t size);
293
294ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, 284ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
295 struct device_attribute *attr, char *buf); 285 struct device_attribute *attr, char *buf);
296 286
diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h
index 67d845385ae2..1796af093368 100644
--- a/include/linux/iio/common/st_sensors_i2c.h
+++ b/include/linux/iio/common/st_sensors_i2c.h
@@ -13,8 +13,19 @@
13 13
14#include <linux/i2c.h> 14#include <linux/i2c.h>
15#include <linux/iio/common/st_sensors.h> 15#include <linux/iio/common/st_sensors.h>
16#include <linux/of.h>
16 17
17void st_sensors_i2c_configure(struct iio_dev *indio_dev, 18void st_sensors_i2c_configure(struct iio_dev *indio_dev,
18 struct i2c_client *client, struct st_sensor_data *sdata); 19 struct i2c_client *client, struct st_sensor_data *sdata);
19 20
21#ifdef CONFIG_OF
22void st_sensors_of_i2c_probe(struct i2c_client *client,
23 const struct of_device_id *match);
24#else
25static inline void st_sensors_of_i2c_probe(struct i2c_client *client,
26 const struct of_device_id *match)
27{
28}
29#endif
30
20#endif /* ST_SENSORS_I2C_H */ 31#endif /* ST_SENSORS_I2C_H */
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index ccde91725f98..15dc6bc2bdd2 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -277,14 +277,7 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
277 **/ 277 **/
278static inline s64 iio_get_time_ns(void) 278static inline s64 iio_get_time_ns(void)
279{ 279{
280 struct timespec ts; 280 return ktime_get_real_ns();
281 /*
282 * calls getnstimeofday.
283 * If hrtimers then up to ns accurate, if not microsecond.
284 */
285 ktime_get_real_ts(&ts);
286
287 return timespec_to_ns(&ts);
288} 281}
289 282
290/* Device operating modes */ 283/* Device operating modes */
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index b665dc7f017b..fa2d01ef8f55 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -157,13 +157,14 @@ int adis_single_conversion(struct iio_dev *indio_dev,
157 const struct iio_chan_spec *chan, unsigned int error_mask, 157 const struct iio_chan_spec *chan, unsigned int error_mask,
158 int *val); 158 int *val);
159 159
160#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, bits) { \ 160#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, info_all, bits) { \
161 .type = IIO_VOLTAGE, \ 161 .type = IIO_VOLTAGE, \
162 .indexed = 1, \ 162 .indexed = 1, \
163 .channel = (chan), \ 163 .channel = (chan), \
164 .extend_name = name, \ 164 .extend_name = name, \
165 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 165 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
166 BIT(IIO_CHAN_INFO_SCALE), \ 166 BIT(IIO_CHAN_INFO_SCALE), \
167 .info_mask_shared_by_all = info_all, \
167 .address = (addr), \ 168 .address = (addr), \
168 .scan_index = (si), \ 169 .scan_index = (si), \
169 .scan_type = { \ 170 .scan_type = { \
@@ -174,19 +175,20 @@ int adis_single_conversion(struct iio_dev *indio_dev,
174 }, \ 175 }, \
175} 176}
176 177
177#define ADIS_SUPPLY_CHAN(addr, si, bits) \ 178#define ADIS_SUPPLY_CHAN(addr, si, info_all, bits) \
178 ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", bits) 179 ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", info_all, bits)
179 180
180#define ADIS_AUX_ADC_CHAN(addr, si, bits) \ 181#define ADIS_AUX_ADC_CHAN(addr, si, info_all, bits) \
181 ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, bits) 182 ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, info_all, bits)
182 183
183#define ADIS_TEMP_CHAN(addr, si, bits) { \ 184#define ADIS_TEMP_CHAN(addr, si, info_all, bits) { \
184 .type = IIO_TEMP, \ 185 .type = IIO_TEMP, \
185 .indexed = 1, \ 186 .indexed = 1, \
186 .channel = 0, \ 187 .channel = 0, \
187 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 188 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
188 BIT(IIO_CHAN_INFO_SCALE) | \ 189 BIT(IIO_CHAN_INFO_SCALE) | \
189 BIT(IIO_CHAN_INFO_OFFSET), \ 190 BIT(IIO_CHAN_INFO_OFFSET), \
191 .info_mask_shared_by_all = info_all, \
190 .address = (addr), \ 192 .address = (addr), \
191 .scan_index = (si), \ 193 .scan_index = (si), \
192 .scan_type = { \ 194 .scan_type = { \
@@ -197,13 +199,14 @@ int adis_single_conversion(struct iio_dev *indio_dev,
197 }, \ 199 }, \
198} 200}
199 201
200#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \ 202#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, info_all, bits) { \
201 .type = (_type), \ 203 .type = (_type), \
202 .modified = 1, \ 204 .modified = 1, \
203 .channel2 = IIO_MOD_ ## mod, \ 205 .channel2 = IIO_MOD_ ## mod, \
204 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 206 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
205 info_sep, \ 207 info_sep, \
206 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ 208 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
209 .info_mask_shared_by_all = info_all, \
207 .address = (addr), \ 210 .address = (addr), \
208 .scan_index = (si), \ 211 .scan_index = (si), \
209 .scan_type = { \ 212 .scan_type = { \
@@ -214,17 +217,17 @@ int adis_single_conversion(struct iio_dev *indio_dev,
214 }, \ 217 }, \
215} 218}
216 219
217#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, bits) \ 220#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, info_all, bits) \
218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, bits) 221 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, info_all, bits)
219 222
220#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, bits) \ 223#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, info_all, bits) \
221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, bits) 224 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, info_all, bits)
222 225
223#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, bits) \ 226#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, info_all, bits) \
224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, bits) 227 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, info_all, bits)
225 228
226#define ADIS_ROT_CHAN(mod, addr, si, info_sep, bits) \ 229#define ADIS_ROT_CHAN(mod, addr, si, info_sep, info_all, bits) \
227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, bits) 230 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, info_all, bits)
228 231
229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER 232#ifdef CONFIG_IIO_ADIS_LIB_BUFFER
230 233
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 369cf2cd5144..4b79ffe7b188 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -129,12 +129,11 @@ void iio_trigger_unregister(struct iio_trigger *trig_info);
129/** 129/**
130 * iio_trigger_poll() - called on a trigger occurring 130 * iio_trigger_poll() - called on a trigger occurring
131 * @trig: trigger which occurred 131 * @trig: trigger which occurred
132 * @time: timestamp when trigger occurred
133 * 132 *
134 * Typically called in relevant hardware interrupt handler. 133 * Typically called in relevant hardware interrupt handler.
135 **/ 134 **/
136void iio_trigger_poll(struct iio_trigger *trig, s64 time); 135void iio_trigger_poll(struct iio_trigger *trig);
137void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time); 136void iio_trigger_poll_chained(struct iio_trigger *trig);
138 137
139irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); 138irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
140 139
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index d480631eabc2..4a2af8adf874 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -56,6 +56,10 @@ enum iio_modifier {
56 IIO_MOD_QUATERNION, 56 IIO_MOD_QUATERNION,
57 IIO_MOD_TEMP_AMBIENT, 57 IIO_MOD_TEMP_AMBIENT,
58 IIO_MOD_TEMP_OBJECT, 58 IIO_MOD_TEMP_OBJECT,
59 IIO_MOD_NORTH_MAGN,
60 IIO_MOD_NORTH_TRUE,
61 IIO_MOD_NORTH_MAGN_TILT_COMP,
62 IIO_MOD_NORTH_TRUE_TILT_COMP
59}; 63};
60 64
61enum iio_event_type { 65enum iio_event_type {
@@ -70,6 +74,7 @@ enum iio_event_info {
70 IIO_EV_INFO_ENABLE, 74 IIO_EV_INFO_ENABLE,
71 IIO_EV_INFO_VALUE, 75 IIO_EV_INFO_VALUE,
72 IIO_EV_INFO_HYSTERESIS, 76 IIO_EV_INFO_HYSTERESIS,
77 IIO_EV_INFO_PERIOD,
73}; 78};
74 79
75enum iio_event_direction { 80enum iio_event_direction {
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 1b7f268cddce..7cf5e9b32550 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -19,6 +19,7 @@ extern int ima_file_check(struct file *file, int mask);
19extern void ima_file_free(struct file *file); 19extern void ima_file_free(struct file *file);
20extern int ima_file_mmap(struct file *file, unsigned long prot); 20extern int ima_file_mmap(struct file *file, unsigned long prot);
21extern int ima_module_check(struct file *file); 21extern int ima_module_check(struct file *file);
22extern int ima_fw_from_file(struct file *file, char *buf, size_t size);
22 23
23#else 24#else
24static inline int ima_bprm_check(struct linux_binprm *bprm) 25static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -46,6 +47,11 @@ static inline int ima_module_check(struct file *file)
46 return 0; 47 return 0;
47} 48}
48 49
50static inline int ima_fw_from_file(struct file *file, char *buf, size_t size)
51{
52 return 0;
53}
54
49#endif /* CONFIG_IMA */ 55#endif /* CONFIG_IMA */
50 56
51#ifdef CONFIG_IMA_APPRAISE 57#ifdef CONFIG_IMA_APPRAISE
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 6df7f9fe0d01..2bb4c4f3531a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -102,12 +102,6 @@ extern struct group_info init_groups;
102#define INIT_IDS 102#define INIT_IDS
103#endif 103#endif
104 104
105#ifdef CONFIG_RCU_BOOST
106#define INIT_TASK_RCU_BOOST() \
107 .rcu_boost_mutex = NULL,
108#else
109#define INIT_TASK_RCU_BOOST()
110#endif
111#ifdef CONFIG_TREE_PREEMPT_RCU 105#ifdef CONFIG_TREE_PREEMPT_RCU
112#define INIT_TASK_RCU_TREE_PREEMPT() \ 106#define INIT_TASK_RCU_TREE_PREEMPT() \
113 .rcu_blocked_node = NULL, 107 .rcu_blocked_node = NULL,
@@ -119,8 +113,7 @@ extern struct group_info init_groups;
119 .rcu_read_lock_nesting = 0, \ 113 .rcu_read_lock_nesting = 0, \
120 .rcu_read_unlock_special = 0, \ 114 .rcu_read_unlock_special = 0, \
121 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ 115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
122 INIT_TASK_RCU_TREE_PREEMPT() \ 116 INIT_TASK_RCU_TREE_PREEMPT()
123 INIT_TASK_RCU_BOOST()
124#else 117#else
125#define INIT_TASK_RCU_PREEMPT(tsk) 118#define INIT_TASK_RCU_PREEMPT(tsk)
126#endif 119#endif
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 160cf353aa39..7bae83b7c396 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -43,10 +43,22 @@ enum pixcir_int_mode {
43#define PIXCIR_INT_ENABLE (1UL << 3) 43#define PIXCIR_INT_ENABLE (1UL << 3)
44#define PIXCIR_INT_POL_HIGH (1UL << 2) 44#define PIXCIR_INT_POL_HIGH (1UL << 2)
45 45
46/**
47 * struct pixcir_irc_chip_data - chip related data
48 * @max_fingers: Max number of fingers reported simultaneously by h/w
49 * @has_hw_ids: Hardware supports finger tracking IDs
50 *
51 */
52struct pixcir_i2c_chip_data {
53 u8 max_fingers;
54 bool has_hw_ids;
55};
56
46struct pixcir_ts_platform_data { 57struct pixcir_ts_platform_data {
47 int x_max; 58 int x_max;
48 int y_max; 59 int y_max;
49 int gpio_attb; /* GPIO connected to ATTB line */ 60 int gpio_attb; /* GPIO connected to ATTB line */
61 struct pixcir_i2c_chip_data chip;
50}; 62};
51 63
52#endif 64#endif
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 0a2da5188217..a65208a8fe18 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -336,6 +336,7 @@ struct intel_iommu {
336#ifdef CONFIG_IRQ_REMAP 336#ifdef CONFIG_IRQ_REMAP
337 struct ir_table *ir_table; /* Interrupt remapping info */ 337 struct ir_table *ir_table; /* Interrupt remapping info */
338#endif 338#endif
339 struct device *iommu_dev; /* IOMMU-sysfs device */
339 int node; 340 int node;
340}; 341};
341 342
@@ -365,4 +366,6 @@ extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
365 366
366extern int dmar_ir_support(void); 367extern int dmar_ir_support(void);
367 368
369extern const struct attribute_group *intel_iommu_groups[];
370
368#endif 371#endif
diff --git a/include/linux/io.h b/include/linux/io.h
index b76e6e545806..d5fc9b8d8b03 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -58,6 +58,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
58} 58}
59#endif 59#endif
60 60
61#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
62
61void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, 63void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
62 unsigned long size); 64 unsigned long size);
63void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, 65void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index b96a5b2136e4..20f9a527922a 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -50,7 +50,7 @@ struct iommu_domain_geometry {
50}; 50};
51 51
52struct iommu_domain { 52struct iommu_domain {
53 struct iommu_ops *ops; 53 const struct iommu_ops *ops;
54 void *priv; 54 void *priv;
55 iommu_fault_handler_t handler; 55 iommu_fault_handler_t handler;
56 void *handler_token; 56 void *handler_token;
@@ -140,7 +140,7 @@ struct iommu_ops {
140#define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */ 140#define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */
141#define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */ 141#define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */
142 142
143extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); 143extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
144extern bool iommu_present(struct bus_type *bus); 144extern bool iommu_present(struct bus_type *bus);
145extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); 145extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
146extern struct iommu_group *iommu_group_get_by_id(int id); 146extern struct iommu_group *iommu_group_get_by_id(int id);
@@ -181,11 +181,18 @@ extern int iommu_group_register_notifier(struct iommu_group *group,
181extern int iommu_group_unregister_notifier(struct iommu_group *group, 181extern int iommu_group_unregister_notifier(struct iommu_group *group,
182 struct notifier_block *nb); 182 struct notifier_block *nb);
183extern int iommu_group_id(struct iommu_group *group); 183extern int iommu_group_id(struct iommu_group *group);
184extern struct iommu_group *iommu_group_get_for_dev(struct device *dev);
184 185
185extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr, 186extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
186 void *data); 187 void *data);
187extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, 188extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
188 void *data); 189 void *data);
190struct device *iommu_device_create(struct device *parent, void *drvdata,
191 const struct attribute_group **groups,
192 const char *fmt, ...);
193void iommu_device_destroy(struct device *dev);
194int iommu_device_link(struct device *dev, struct device *link);
195void iommu_device_unlink(struct device *dev, struct device *link);
189 196
190/* Window handling function prototypes */ 197/* Window handling function prototypes */
191extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, 198extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
@@ -396,6 +403,27 @@ static inline int iommu_domain_set_attr(struct iommu_domain *domain,
396 return -EINVAL; 403 return -EINVAL;
397} 404}
398 405
406static inline struct device *iommu_device_create(struct device *parent,
407 void *drvdata,
408 const struct attribute_group **groups,
409 const char *fmt, ...)
410{
411 return ERR_PTR(-ENODEV);
412}
413
414static inline void iommu_device_destroy(struct device *dev)
415{
416}
417
418static inline int iommu_device_link(struct device *dev, struct device *link)
419{
420 return -EINVAL;
421}
422
423static inline void iommu_device_unlink(struct device *dev, struct device *link)
424{
425}
426
399#endif /* CONFIG_IOMMU_API */ 427#endif /* CONFIG_IOMMU_API */
400 428
401#endif /* __LINUX_IOMMU_H */ 429#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 5e3a906cc089..142ec544167c 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -237,6 +237,12 @@ extern int iomem_is_exclusive(u64 addr);
237extern int 237extern int
238walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 238walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
239 void *arg, int (*func)(unsigned long, unsigned long, void *)); 239 void *arg, int (*func)(unsigned long, unsigned long, void *));
240extern int
241walk_system_ram_res(u64 start, u64 end, void *arg,
242 int (*func)(u64, u64, void *));
243extern int
244walk_iomem_res(char *name, unsigned long flags, u64 start, u64 end, void *arg,
245 int (*func)(u64, u64, void *));
240 246
241/* True if any part of r1 overlaps r2 */ 247/* True if any part of r1 overlaps r2 */
242static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 248static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 3277f4711349..19e81d5ccb6d 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -34,6 +34,11 @@ struct iova_domain {
34 unsigned long dma_32bit_pfn; 34 unsigned long dma_32bit_pfn;
35}; 35};
36 36
37static inline unsigned long iova_size(struct iova *iova)
38{
39 return iova->pfn_hi - iova->pfn_lo + 1;
40}
41
37struct iova *alloc_iova_mem(void); 42struct iova *alloc_iova_mem(void);
38void free_iova_mem(struct iova *iova); 43void free_iova_mem(struct iova *iova);
39void free_iova(struct iova_domain *iovad, unsigned long pfn); 44void free_iova(struct iova_domain *iovad, unsigned long pfn);
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 2faef339d8f2..ff560537dd61 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -39,6 +39,7 @@ struct ipv6_devconf {
39#endif 39#endif
40 __s32 proxy_ndp; 40 __s32 proxy_ndp;
41 __s32 accept_source_route; 41 __s32 accept_source_route;
42 __s32 accept_ra_from_local;
42#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 43#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
43 __s32 optimistic_dad; 44 __s32 optimistic_dad;
44#endif 45#endif
@@ -193,12 +194,13 @@ struct ipv6_pinfo {
193 sndflow:1, 194 sndflow:1,
194 repflow:1, 195 repflow:1,
195 pmtudisc:3, 196 pmtudisc:3,
196 ipv6only:1, 197 padding:1, /* 1 bit hole */
197 srcprefs:3, /* 001: prefer temporary address 198 srcprefs:3, /* 001: prefer temporary address
198 * 010: prefer public address 199 * 010: prefer public address
199 * 100: prefer care-of address 200 * 100: prefer care-of address
200 */ 201 */
201 dontfrag:1; 202 dontfrag:1,
203 autoflowlabel:1;
202 __u8 min_hopcount; 204 __u8 min_hopcount;
203 __u8 tclass; 205 __u8 tclass;
204 __be32 rcv_flowinfo; 206 __be32 rcv_flowinfo;
@@ -256,16 +258,6 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
256 return inet_sk(__sk)->pinet6; 258 return inet_sk(__sk)->pinet6;
257} 259}
258 260
259static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
260{
261 struct request_sock *req = reqsk_alloc(ops);
262
263 if (req)
264 inet_rsk(req)->pktopts = NULL;
265
266 return req;
267}
268
269static inline struct raw6_sock *raw6_sk(const struct sock *sk) 261static inline struct raw6_sock *raw6_sk(const struct sock *sk)
270{ 262{
271 return (struct raw6_sock *)sk; 263 return (struct raw6_sock *)sk;
@@ -282,8 +274,8 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
282 __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size); 274 __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size);
283} 275}
284 276
285#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 277#define __ipv6_only_sock(sk) (sk->sk_ipv6only)
286#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 278#define ipv6_only_sock(sk) (__ipv6_only_sock(sk))
287#define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \ 279#define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \
288 inet6_sk(sk)->rxopt.bits.rxinfo) 280 inet6_sk(sk)->rxopt.bits.rxinfo)
289 281
@@ -296,8 +288,8 @@ static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
296 288
297static inline int inet_v6_ipv6only(const struct sock *sk) 289static inline int inet_v6_ipv6only(const struct sock *sk)
298{ 290{
299 return likely(sk->sk_state != TCP_TIME_WAIT) ? 291 /* ipv6only field is at same position for timewait and other sockets */
300 ipv6_only_sock(sk) : inet_twsk(sk)->tw_ipv6only; 292 return ipv6_only_sock(sk);
301} 293}
302#else 294#else
303#define __ipv6_only_sock(sk) 0 295#define __ipv6_only_sock(sk) 0
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 0d998d8b01d8..62af59242ddc 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -771,6 +771,8 @@ void irq_gc_eoi(struct irq_data *d);
771int irq_gc_set_wake(struct irq_data *d, unsigned int on); 771int irq_gc_set_wake(struct irq_data *d, unsigned int on);
772 772
773/* Setup functions for irq_chip_generic */ 773/* Setup functions for irq_chip_generic */
774int irq_map_generic_chip(struct irq_domain *d, unsigned int virq,
775 irq_hw_number_t hw_irq);
774struct irq_chip_generic * 776struct irq_chip_generic *
775irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base, 777irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base,
776 void __iomem *reg_base, irq_flow_handler_t handler); 778 void __iomem *reg_base, irq_flow_handler_t handler);
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index 19ae05d4b8ec..bf9422c3aefe 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -33,6 +33,11 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
33#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), } 33#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), }
34 34
35bool irq_work_queue(struct irq_work *work); 35bool irq_work_queue(struct irq_work *work);
36
37#ifdef CONFIG_SMP
38bool irq_work_queue_on(struct irq_work *work, int cpu);
39#endif
40
36void irq_work_run(void); 41void irq_work_run(void);
37void irq_work_sync(struct irq_work *work); 42void irq_work_sync(struct irq_work *work);
38 43
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
new file mode 100644
index 000000000000..03a4ea37ba86
--- /dev/null
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -0,0 +1,200 @@
1/*
2 * Copyright (C) 2013, 2014 ARM Limited, All Rights Reserved.
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef __LINUX_IRQCHIP_ARM_GIC_V3_H
19#define __LINUX_IRQCHIP_ARM_GIC_V3_H
20
21#include <asm/sysreg.h>
22
23/*
24 * Distributor registers. We assume we're running non-secure, with ARE
25 * being set. Secure-only and non-ARE registers are not described.
26 */
27#define GICD_CTLR 0x0000
28#define GICD_TYPER 0x0004
29#define GICD_IIDR 0x0008
30#define GICD_STATUSR 0x0010
31#define GICD_SETSPI_NSR 0x0040
32#define GICD_CLRSPI_NSR 0x0048
33#define GICD_SETSPI_SR 0x0050
34#define GICD_CLRSPI_SR 0x0058
35#define GICD_SEIR 0x0068
36#define GICD_ISENABLER 0x0100
37#define GICD_ICENABLER 0x0180
38#define GICD_ISPENDR 0x0200
39#define GICD_ICPENDR 0x0280
40#define GICD_ISACTIVER 0x0300
41#define GICD_ICACTIVER 0x0380
42#define GICD_IPRIORITYR 0x0400
43#define GICD_ICFGR 0x0C00
44#define GICD_IROUTER 0x6000
45#define GICD_PIDR2 0xFFE8
46
47#define GICD_CTLR_RWP (1U << 31)
48#define GICD_CTLR_ARE_NS (1U << 4)
49#define GICD_CTLR_ENABLE_G1A (1U << 1)
50#define GICD_CTLR_ENABLE_G1 (1U << 0)
51
52#define GICD_IROUTER_SPI_MODE_ONE (0U << 31)
53#define GICD_IROUTER_SPI_MODE_ANY (1U << 31)
54
55#define GIC_PIDR2_ARCH_MASK 0xf0
56#define GIC_PIDR2_ARCH_GICv3 0x30
57#define GIC_PIDR2_ARCH_GICv4 0x40
58
59/*
60 * Re-Distributor registers, offsets from RD_base
61 */
62#define GICR_CTLR GICD_CTLR
63#define GICR_IIDR 0x0004
64#define GICR_TYPER 0x0008
65#define GICR_STATUSR GICD_STATUSR
66#define GICR_WAKER 0x0014
67#define GICR_SETLPIR 0x0040
68#define GICR_CLRLPIR 0x0048
69#define GICR_SEIR GICD_SEIR
70#define GICR_PROPBASER 0x0070
71#define GICR_PENDBASER 0x0078
72#define GICR_INVLPIR 0x00A0
73#define GICR_INVALLR 0x00B0
74#define GICR_SYNCR 0x00C0
75#define GICR_MOVLPIR 0x0100
76#define GICR_MOVALLR 0x0110
77#define GICR_PIDR2 GICD_PIDR2
78
79#define GICR_WAKER_ProcessorSleep (1U << 1)
80#define GICR_WAKER_ChildrenAsleep (1U << 2)
81
82/*
83 * Re-Distributor registers, offsets from SGI_base
84 */
85#define GICR_ISENABLER0 GICD_ISENABLER
86#define GICR_ICENABLER0 GICD_ICENABLER
87#define GICR_ISPENDR0 GICD_ISPENDR
88#define GICR_ICPENDR0 GICD_ICPENDR
89#define GICR_ISACTIVER0 GICD_ISACTIVER
90#define GICR_ICACTIVER0 GICD_ICACTIVER
91#define GICR_IPRIORITYR0 GICD_IPRIORITYR
92#define GICR_ICFGR0 GICD_ICFGR
93
94#define GICR_TYPER_VLPIS (1U << 1)
95#define GICR_TYPER_LAST (1U << 4)
96
97/*
98 * CPU interface registers
99 */
100#define ICC_CTLR_EL1_EOImode_drop_dir (0U << 1)
101#define ICC_CTLR_EL1_EOImode_drop (1U << 1)
102#define ICC_SRE_EL1_SRE (1U << 0)
103
104/*
105 * Hypervisor interface registers (SRE only)
106 */
107#define ICH_LR_VIRTUAL_ID_MASK ((1UL << 32) - 1)
108
109#define ICH_LR_EOI (1UL << 41)
110#define ICH_LR_GROUP (1UL << 60)
111#define ICH_LR_STATE (3UL << 62)
112#define ICH_LR_PENDING_BIT (1UL << 62)
113#define ICH_LR_ACTIVE_BIT (1UL << 63)
114
115#define ICH_MISR_EOI (1 << 0)
116#define ICH_MISR_U (1 << 1)
117
118#define ICH_HCR_EN (1 << 0)
119#define ICH_HCR_UIE (1 << 1)
120
121#define ICH_VMCR_CTLR_SHIFT 0
122#define ICH_VMCR_CTLR_MASK (0x21f << ICH_VMCR_CTLR_SHIFT)
123#define ICH_VMCR_BPR1_SHIFT 18
124#define ICH_VMCR_BPR1_MASK (7 << ICH_VMCR_BPR1_SHIFT)
125#define ICH_VMCR_BPR0_SHIFT 21
126#define ICH_VMCR_BPR0_MASK (7 << ICH_VMCR_BPR0_SHIFT)
127#define ICH_VMCR_PMR_SHIFT 24
128#define ICH_VMCR_PMR_MASK (0xffUL << ICH_VMCR_PMR_SHIFT)
129
130#define ICC_EOIR1_EL1 sys_reg(3, 0, 12, 12, 1)
131#define ICC_IAR1_EL1 sys_reg(3, 0, 12, 12, 0)
132#define ICC_SGI1R_EL1 sys_reg(3, 0, 12, 11, 5)
133#define ICC_PMR_EL1 sys_reg(3, 0, 4, 6, 0)
134#define ICC_CTLR_EL1 sys_reg(3, 0, 12, 12, 4)
135#define ICC_SRE_EL1 sys_reg(3, 0, 12, 12, 5)
136#define ICC_GRPEN1_EL1 sys_reg(3, 0, 12, 12, 7)
137
138#define ICC_IAR1_EL1_SPURIOUS 0x3ff
139
140#define ICC_SRE_EL2 sys_reg(3, 4, 12, 9, 5)
141
142#define ICC_SRE_EL2_SRE (1 << 0)
143#define ICC_SRE_EL2_ENABLE (1 << 3)
144
145/*
146 * System register definitions
147 */
148#define ICH_VSEIR_EL2 sys_reg(3, 4, 12, 9, 4)
149#define ICH_HCR_EL2 sys_reg(3, 4, 12, 11, 0)
150#define ICH_VTR_EL2 sys_reg(3, 4, 12, 11, 1)
151#define ICH_MISR_EL2 sys_reg(3, 4, 12, 11, 2)
152#define ICH_EISR_EL2 sys_reg(3, 4, 12, 11, 3)
153#define ICH_ELSR_EL2 sys_reg(3, 4, 12, 11, 5)
154#define ICH_VMCR_EL2 sys_reg(3, 4, 12, 11, 7)
155
156#define __LR0_EL2(x) sys_reg(3, 4, 12, 12, x)
157#define __LR8_EL2(x) sys_reg(3, 4, 12, 13, x)
158
159#define ICH_LR0_EL2 __LR0_EL2(0)
160#define ICH_LR1_EL2 __LR0_EL2(1)
161#define ICH_LR2_EL2 __LR0_EL2(2)
162#define ICH_LR3_EL2 __LR0_EL2(3)
163#define ICH_LR4_EL2 __LR0_EL2(4)
164#define ICH_LR5_EL2 __LR0_EL2(5)
165#define ICH_LR6_EL2 __LR0_EL2(6)
166#define ICH_LR7_EL2 __LR0_EL2(7)
167#define ICH_LR8_EL2 __LR8_EL2(0)
168#define ICH_LR9_EL2 __LR8_EL2(1)
169#define ICH_LR10_EL2 __LR8_EL2(2)
170#define ICH_LR11_EL2 __LR8_EL2(3)
171#define ICH_LR12_EL2 __LR8_EL2(4)
172#define ICH_LR13_EL2 __LR8_EL2(5)
173#define ICH_LR14_EL2 __LR8_EL2(6)
174#define ICH_LR15_EL2 __LR8_EL2(7)
175
176#define __AP0Rx_EL2(x) sys_reg(3, 4, 12, 8, x)
177#define ICH_AP0R0_EL2 __AP0Rx_EL2(0)
178#define ICH_AP0R1_EL2 __AP0Rx_EL2(1)
179#define ICH_AP0R2_EL2 __AP0Rx_EL2(2)
180#define ICH_AP0R3_EL2 __AP0Rx_EL2(3)
181
182#define __AP1Rx_EL2(x) sys_reg(3, 4, 12, 9, x)
183#define ICH_AP1R0_EL2 __AP1Rx_EL2(0)
184#define ICH_AP1R1_EL2 __AP1Rx_EL2(1)
185#define ICH_AP1R2_EL2 __AP1Rx_EL2(2)
186#define ICH_AP1R3_EL2 __AP1Rx_EL2(3)
187
188#ifndef __ASSEMBLY__
189
190#include <linux/stringify.h>
191
192static inline void gic_write_eoir(u64 irq)
193{
194 asm volatile("msr_s " __stringify(ICC_EOIR1_EL1) ", %0" : : "r" (irq));
195 isb();
196}
197
198#endif
199
200#endif
diff --git a/include/linux/irqchip/spear-shirq.h b/include/linux/irqchip/spear-shirq.h
deleted file mode 100644
index c8be16d213a3..000000000000
--- a/include/linux/irqchip/spear-shirq.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * SPEAr platform shared irq layer header file
3 *
4 * Copyright (C) 2009-2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com>
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __SPEAR_SHIRQ_H
13#define __SPEAR_SHIRQ_H
14
15#include <linux/irq.h>
16#include <linux/types.h>
17
18/*
19 * struct shirq_regs: shared irq register configuration
20 *
21 * enb_reg: enable register offset
22 * reset_to_enb: val 1 indicates, we need to clear bit for enabling interrupt
23 * status_reg: status register offset
24 * status_reg_mask: status register valid mask
25 * clear_reg: clear register offset
26 * reset_to_clear: val 1 indicates, we need to clear bit for clearing interrupt
27 */
28struct shirq_regs {
29 u32 enb_reg;
30 u32 reset_to_enb;
31 u32 status_reg;
32 u32 clear_reg;
33 u32 reset_to_clear;
34};
35
36/*
37 * struct spear_shirq: shared irq structure
38 *
39 * irq: hardware irq number
40 * irq_base: base irq in linux domain
41 * irq_nr: no. of shared interrupts in a particular block
42 * irq_bit_off: starting bit offset in the status register
43 * invalid_irq: irq group is currently disabled
44 * base: base address of shared irq register
45 * regs: register configuration for shared irq block
46 */
47struct spear_shirq {
48 u32 irq;
49 u32 irq_base;
50 u32 irq_nr;
51 u32 irq_bit_off;
52 int invalid_irq;
53 void __iomem *base;
54 struct shirq_regs regs;
55};
56
57int __init spear300_shirq_of_init(struct device_node *np,
58 struct device_node *parent);
59int __init spear310_shirq_of_init(struct device_node *np,
60 struct device_node *parent);
61int __init spear320_shirq_of_init(struct device_node *np,
62 struct device_node *parent);
63
64#endif /* __SPEAR_SHIRQ_H */
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index c983ed18c332..b0f9d16e48f6 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -172,6 +172,8 @@ extern int irq_domain_associate(struct irq_domain *domain, unsigned int irq,
172extern void irq_domain_associate_many(struct irq_domain *domain, 172extern void irq_domain_associate_many(struct irq_domain *domain,
173 unsigned int irq_base, 173 unsigned int irq_base,
174 irq_hw_number_t hwirq_base, int count); 174 irq_hw_number_t hwirq_base, int count);
175extern void irq_domain_disassociate(struct irq_domain *domain,
176 unsigned int irq);
175 177
176extern unsigned int irq_create_mapping(struct irq_domain *host, 178extern unsigned int irq_create_mapping(struct irq_domain *host,
177 irq_hw_number_t hwirq); 179 irq_hw_number_t hwirq);
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index 8e10f57f109f..a0070c6dfaf8 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -180,8 +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 sk_filter *pass_filter; /* filter for packets to pass */ 183 struct bpf_prog *pass_filter; /* filter for packets to pass */
184 struct sk_filter *active_filter; /* filter for pkts to reset idle */ 184 struct bpf_prog *active_filter; /* filter for pkts to reset idle */
185#endif 185#endif
186 unsigned long debug; 186 unsigned long debug;
187 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 4c52907a6d8b..31ae66f34235 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -470,6 +470,7 @@ extern enum system_states {
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#define TAINT_UNSIGNED_MODULE 13
473#define TAINT_SOFTLOCKUP 14
473 474
474extern const char hex_asc[]; 475extern const char hex_asc[];
475#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] 476#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
@@ -493,15 +494,10 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte)
493 return buf; 494 return buf;
494} 495}
495 496
496static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
497{
498 return hex_byte_pack(buf, byte);
499}
500
501extern int hex_to_bin(char ch); 497extern int hex_to_bin(char ch);
502extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); 498extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
503 499
504int mac_pton(const char *s, u8 *mac); 500bool mac_pton(const char *s, u8 *mac);
505 501
506/* 502/*
507 * General tracing related utility functions - trace_printk(), 503 * General tracing related utility functions - trace_printk(),
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index a75641930049..4b2a0e11cc5b 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -10,6 +10,7 @@
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/elfcore.h> 11#include <linux/elfcore.h>
12#include <linux/elf.h> 12#include <linux/elf.h>
13#include <linux/module.h>
13#include <asm/kexec.h> 14#include <asm/kexec.h>
14 15
15/* Verify architecture specific macros are defined */ 16/* Verify architecture specific macros are defined */
@@ -69,7 +70,18 @@ typedef unsigned long kimage_entry_t;
69#define IND_SOURCE 0x8 70#define IND_SOURCE 0x8
70 71
71struct kexec_segment { 72struct kexec_segment {
72 void __user *buf; 73 /*
74 * This pointer can point to user memory if kexec_load() system
75 * call is used or will point to kernel memory if
76 * kexec_file_load() system call is used.
77 *
78 * Use ->buf when expecting to deal with user memory and use ->kbuf
79 * when expecting to deal with kernel memory.
80 */
81 union {
82 void __user *buf;
83 void *kbuf;
84 };
73 size_t bufsz; 85 size_t bufsz;
74 unsigned long mem; 86 unsigned long mem;
75 size_t memsz; 87 size_t memsz;
@@ -84,6 +96,27 @@ struct compat_kexec_segment {
84}; 96};
85#endif 97#endif
86 98
99struct kexec_sha_region {
100 unsigned long start;
101 unsigned long len;
102};
103
104struct purgatory_info {
105 /* Pointer to elf header of read only purgatory */
106 Elf_Ehdr *ehdr;
107
108 /* Pointer to purgatory sechdrs which are modifiable */
109 Elf_Shdr *sechdrs;
110 /*
111 * Temporary buffer location where purgatory is loaded and relocated
112 * This memory can be freed post image load
113 */
114 void *purgatory_buf;
115
116 /* Address where purgatory is finally loaded and is executed from */
117 unsigned long purgatory_load_addr;
118};
119
87struct kimage { 120struct kimage {
88 kimage_entry_t head; 121 kimage_entry_t head;
89 kimage_entry_t *entry; 122 kimage_entry_t *entry;
@@ -100,7 +133,7 @@ struct kimage {
100 133
101 struct list_head control_pages; 134 struct list_head control_pages;
102 struct list_head dest_pages; 135 struct list_head dest_pages;
103 struct list_head unuseable_pages; 136 struct list_head unusable_pages;
104 137
105 /* Address of next control page to allocate for crash kernels. */ 138 /* Address of next control page to allocate for crash kernels. */
106 unsigned long control_page; 139 unsigned long control_page;
@@ -110,13 +143,63 @@ struct kimage {
110#define KEXEC_TYPE_DEFAULT 0 143#define KEXEC_TYPE_DEFAULT 0
111#define KEXEC_TYPE_CRASH 1 144#define KEXEC_TYPE_CRASH 1
112 unsigned int preserve_context : 1; 145 unsigned int preserve_context : 1;
146 /* If set, we are using file mode kexec syscall */
147 unsigned int file_mode:1;
113 148
114#ifdef ARCH_HAS_KIMAGE_ARCH 149#ifdef ARCH_HAS_KIMAGE_ARCH
115 struct kimage_arch arch; 150 struct kimage_arch arch;
116#endif 151#endif
152
153 /* Additional fields for file based kexec syscall */
154 void *kernel_buf;
155 unsigned long kernel_buf_len;
156
157 void *initrd_buf;
158 unsigned long initrd_buf_len;
159
160 char *cmdline_buf;
161 unsigned long cmdline_buf_len;
162
163 /* File operations provided by image loader */
164 struct kexec_file_ops *fops;
165
166 /* Image loader handling the kernel can store a pointer here */
167 void *image_loader_data;
168
169 /* Information for loading purgatory */
170 struct purgatory_info purgatory_info;
117}; 171};
118 172
173/*
174 * Keeps track of buffer parameters as provided by caller for requesting
175 * memory placement of buffer.
176 */
177struct kexec_buf {
178 struct kimage *image;
179 char *buffer;
180 unsigned long bufsz;
181 unsigned long memsz;
182 unsigned long buf_align;
183 unsigned long buf_min;
184 unsigned long buf_max;
185 bool top_down; /* allocate from top of memory hole */
186};
119 187
188typedef int (kexec_probe_t)(const char *kernel_buf, unsigned long kernel_size);
189typedef void *(kexec_load_t)(struct kimage *image, char *kernel_buf,
190 unsigned long kernel_len, char *initrd,
191 unsigned long initrd_len, char *cmdline,
192 unsigned long cmdline_len);
193typedef int (kexec_cleanup_t)(void *loader_data);
194typedef int (kexec_verify_sig_t)(const char *kernel_buf,
195 unsigned long kernel_len);
196
197struct kexec_file_ops {
198 kexec_probe_t *probe;
199 kexec_load_t *load;
200 kexec_cleanup_t *cleanup;
201 kexec_verify_sig_t *verify_sig;
202};
120 203
121/* kexec interface functions */ 204/* kexec interface functions */
122extern void machine_kexec(struct kimage *image); 205extern void machine_kexec(struct kimage *image);
@@ -127,8 +210,21 @@ extern asmlinkage long sys_kexec_load(unsigned long entry,
127 struct kexec_segment __user *segments, 210 struct kexec_segment __user *segments,
128 unsigned long flags); 211 unsigned long flags);
129extern int kernel_kexec(void); 212extern int kernel_kexec(void);
213extern int kexec_add_buffer(struct kimage *image, char *buffer,
214 unsigned long bufsz, unsigned long memsz,
215 unsigned long buf_align, unsigned long buf_min,
216 unsigned long buf_max, bool top_down,
217 unsigned long *load_addr);
130extern struct page *kimage_alloc_control_pages(struct kimage *image, 218extern struct page *kimage_alloc_control_pages(struct kimage *image,
131 unsigned int order); 219 unsigned int order);
220extern int kexec_load_purgatory(struct kimage *image, unsigned long min,
221 unsigned long max, int top_down,
222 unsigned long *load_addr);
223extern int kexec_purgatory_get_set_symbol(struct kimage *image,
224 const char *name, void *buf,
225 unsigned int size, bool get_value);
226extern void *kexec_purgatory_get_symbol_addr(struct kimage *image,
227 const char *name);
132extern void crash_kexec(struct pt_regs *); 228extern void crash_kexec(struct pt_regs *);
133int kexec_should_crash(struct task_struct *); 229int kexec_should_crash(struct task_struct *);
134void crash_save_cpu(struct pt_regs *regs, int cpu); 230void crash_save_cpu(struct pt_regs *regs, int cpu);
@@ -177,6 +273,10 @@ extern int kexec_load_disabled;
177#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT) 273#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
178#endif 274#endif
179 275
276/* List of defined/legal kexec file flags */
277#define KEXEC_FILE_FLAGS (KEXEC_FILE_UNLOAD | KEXEC_FILE_ON_CRASH | \
278 KEXEC_FILE_NO_INITRAMFS)
279
180#define VMCOREINFO_BYTES (4096) 280#define VMCOREINFO_BYTES (4096)
181#define VMCOREINFO_NOTE_NAME "VMCOREINFO" 281#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
182#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4) 282#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index a74c3a84dfdd..44792ee649de 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -41,10 +41,11 @@ struct key_construction {
41struct key_preparsed_payload { 41struct key_preparsed_payload {
42 char *description; /* Proposed key description (or NULL) */ 42 char *description; /* Proposed key description (or NULL) */
43 void *type_data[2]; /* Private key-type data */ 43 void *type_data[2]; /* Private key-type data */
44 void *payload; /* Proposed payload */ 44 void *payload[2]; /* Proposed payload */
45 const void *data; /* Raw data */ 45 const void *data; /* Raw data */
46 size_t datalen; /* Raw datalen */ 46 size_t datalen; /* Raw datalen */
47 size_t quotalen; /* Quota length for proposed payload */ 47 size_t quotalen; /* Quota length for proposed payload */
48 time_t expiry; /* Expiry time of key */
48 bool trusted; /* True if key is trusted */ 49 bool trusted; /* True if key is trusted */
49}; 50};
50 51
@@ -159,5 +160,7 @@ static inline int key_negate_and_link(struct key *key,
159 return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); 160 return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey);
160} 161}
161 162
163extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep);
164
162#endif /* CONFIG_KEYS */ 165#endif /* CONFIG_KEYS */
163#endif /* _LINUX_KEY_TYPE_H */ 166#endif /* _LINUX_KEY_TYPE_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 017b0826642f..e1d4715f3222 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -170,6 +170,8 @@ struct key {
170#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */ 170#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */
171#define KEY_FLAG_TRUSTED 8 /* set if key is trusted */ 171#define KEY_FLAG_TRUSTED 8 /* set if key is trusted */
172#define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */ 172#define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */
173#define KEY_FLAG_BUILTIN 10 /* set if key is builtin */
174#define KEY_FLAG_ROOT_CAN_INVAL 11 /* set if key can be invalidated by root without permission */
173 175
174 /* the key type and key description string 176 /* the key type and key description string
175 * - the desc is used to match a key against search criteria 177 * - the desc is used to match a key against search criteria
diff --git a/include/linux/klist.h b/include/linux/klist.h
index a370ce57cf1d..61e5b723ae73 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -44,7 +44,7 @@ struct klist_node {
44 44
45extern void klist_add_tail(struct klist_node *n, struct klist *k); 45extern void klist_add_tail(struct klist_node *n, struct klist *k);
46extern void klist_add_head(struct klist_node *n, struct klist *k); 46extern void klist_add_head(struct klist_node *n, struct klist *k);
47extern void klist_add_after(struct klist_node *n, struct klist_node *pos); 47extern void klist_add_behind(struct klist_node *n, struct klist_node *pos);
48extern void klist_add_before(struct klist_node *n, struct klist_node *pos); 48extern void klist_add_before(struct klist_node *n, struct klist_node *pos);
49 49
50extern void klist_del(struct klist_node *n); 50extern void klist_del(struct klist_node *n);
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 7dcef3317689..13d55206ccf6 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -73,7 +73,6 @@ struct kthread_worker {
73struct kthread_work { 73struct kthread_work {
74 struct list_head node; 74 struct list_head node;
75 kthread_work_func_t func; 75 kthread_work_func_t func;
76 wait_queue_head_t done;
77 struct kthread_worker *worker; 76 struct kthread_worker *worker;
78}; 77};
79 78
@@ -85,7 +84,6 @@ struct kthread_work {
85#define KTHREAD_WORK_INIT(work, fn) { \ 84#define KTHREAD_WORK_INIT(work, fn) { \
86 .node = LIST_HEAD_INIT((work).node), \ 85 .node = LIST_HEAD_INIT((work).node), \
87 .func = (fn), \ 86 .func = (fn), \
88 .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \
89 } 87 }
90 88
91#define DEFINE_KTHREAD_WORKER(worker) \ 89#define DEFINE_KTHREAD_WORKER(worker) \
@@ -95,22 +93,16 @@ struct kthread_work {
95 struct kthread_work work = KTHREAD_WORK_INIT(work, fn) 93 struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
96 94
97/* 95/*
98 * kthread_worker.lock and kthread_work.done need their own lockdep class 96 * kthread_worker.lock needs its own lockdep class key when defined on
99 * keys if they are defined on stack with lockdep enabled. Use the 97 * stack with lockdep enabled. Use the following macros in such cases.
100 * following macros when defining them on stack.
101 */ 98 */
102#ifdef CONFIG_LOCKDEP 99#ifdef CONFIG_LOCKDEP
103# define KTHREAD_WORKER_INIT_ONSTACK(worker) \ 100# define KTHREAD_WORKER_INIT_ONSTACK(worker) \
104 ({ init_kthread_worker(&worker); worker; }) 101 ({ init_kthread_worker(&worker); worker; })
105# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \ 102# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \
106 struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) 103 struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker)
107# define KTHREAD_WORK_INIT_ONSTACK(work, fn) \
108 ({ init_kthread_work((&work), fn); work; })
109# define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) \
110 struct kthread_work work = KTHREAD_WORK_INIT_ONSTACK(work, fn)
111#else 104#else
112# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker) 105# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker)
113# define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) DEFINE_KTHREAD_WORK(work, fn)
114#endif 106#endif
115 107
116extern void __init_kthread_worker(struct kthread_worker *worker, 108extern void __init_kthread_worker(struct kthread_worker *worker,
@@ -127,7 +119,6 @@ extern void __init_kthread_worker(struct kthread_worker *worker,
127 memset((work), 0, sizeof(struct kthread_work)); \ 119 memset((work), 0, sizeof(struct kthread_work)); \
128 INIT_LIST_HEAD(&(work)->node); \ 120 INIT_LIST_HEAD(&(work)->node); \
129 (work)->func = (fn); \ 121 (work)->func = (fn); \
130 init_waitqueue_head(&(work)->done); \
131 } while (0) 122 } while (0)
132 123
133int kthread_worker_fn(void *worker_ptr); 124int kthread_worker_fn(void *worker_ptr);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index de9e46e6bcc9..c9d645ad98ff 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -27,43 +27,19 @@
27/* 27/*
28 * ktime_t: 28 * ktime_t:
29 * 29 *
30 * On 64-bit CPUs a single 64-bit variable is used to store the hrtimers 30 * A single 64-bit variable is used to store the hrtimers
31 * internal representation of time values in scalar nanoseconds. The 31 * internal representation of time values in scalar nanoseconds. The
32 * design plays out best on 64-bit CPUs, where most conversions are 32 * design plays out best on 64-bit CPUs, where most conversions are
33 * NOPs and most arithmetic ktime_t operations are plain arithmetic 33 * NOPs and most arithmetic ktime_t operations are plain arithmetic
34 * operations. 34 * operations.
35 * 35 *
36 * On 32-bit CPUs an optimized representation of the timespec structure
37 * is used to avoid expensive conversions from and to timespecs. The
38 * endian-aware order of the tv struct members is chosen to allow
39 * mathematical operations on the tv64 member of the union too, which
40 * for certain operations produces better code.
41 *
42 * For architectures with efficient support for 64/32-bit conversions the
43 * plain scalar nanosecond based representation can be selected by the
44 * config switch CONFIG_KTIME_SCALAR.
45 */ 36 */
46union ktime { 37union ktime {
47 s64 tv64; 38 s64 tv64;
48#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
49 struct {
50# ifdef __BIG_ENDIAN
51 s32 sec, nsec;
52# else
53 s32 nsec, sec;
54# endif
55 } tv;
56#endif
57}; 39};
58 40
59typedef union ktime ktime_t; /* Kill this */ 41typedef union ktime ktime_t; /* Kill this */
60 42
61/*
62 * ktime_t definitions when using the 64-bit scalar representation:
63 */
64
65#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
66
67/** 43/**
68 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value 44 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
69 * @secs: seconds to set 45 * @secs: seconds to set
@@ -71,13 +47,12 @@ typedef union ktime ktime_t; /* Kill this */
71 * 47 *
72 * Return: The ktime_t representation of the value. 48 * Return: The ktime_t representation of the value.
73 */ 49 */
74static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) 50static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs)
75{ 51{
76#if (BITS_PER_LONG == 64)
77 if (unlikely(secs >= KTIME_SEC_MAX)) 52 if (unlikely(secs >= KTIME_SEC_MAX))
78 return (ktime_t){ .tv64 = KTIME_MAX }; 53 return (ktime_t){ .tv64 = KTIME_MAX };
79#endif 54
80 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; 55 return (ktime_t) { .tv64 = secs * NSEC_PER_SEC + (s64)nsecs };
81} 56}
82 57
83/* Subtract two ktime_t variables. rem = lhs -rhs: */ 58/* Subtract two ktime_t variables. rem = lhs -rhs: */
@@ -108,6 +83,12 @@ static inline ktime_t timespec_to_ktime(struct timespec ts)
108 return ktime_set(ts.tv_sec, ts.tv_nsec); 83 return ktime_set(ts.tv_sec, ts.tv_nsec);
109} 84}
110 85
86/* convert a timespec64 to ktime_t format: */
87static inline ktime_t timespec64_to_ktime(struct timespec64 ts)
88{
89 return ktime_set(ts.tv_sec, ts.tv_nsec);
90}
91
111/* convert a timeval to ktime_t format: */ 92/* convert a timeval to ktime_t format: */
112static inline ktime_t timeval_to_ktime(struct timeval tv) 93static inline ktime_t timeval_to_ktime(struct timeval tv)
113{ 94{
@@ -117,159 +98,15 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
117/* Map the ktime_t to timespec conversion to ns_to_timespec function */ 98/* Map the ktime_t to timespec conversion to ns_to_timespec function */
118#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64) 99#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64)
119 100
101/* Map the ktime_t to timespec conversion to ns_to_timespec function */
102#define ktime_to_timespec64(kt) ns_to_timespec64((kt).tv64)
103
120/* Map the ktime_t to timeval conversion to ns_to_timeval function */ 104/* Map the ktime_t to timeval conversion to ns_to_timeval function */
121#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) 105#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
122 106
123/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ 107/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
124#define ktime_to_ns(kt) ((kt).tv64) 108#define ktime_to_ns(kt) ((kt).tv64)
125 109
126#else /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
127
128/*
129 * Helper macros/inlines to get the ktime_t math right in the timespec
130 * representation. The macros are sometimes ugly - their actual use is
131 * pretty okay-ish, given the circumstances. We do all this for
132 * performance reasons. The pure scalar nsec_t based code was nice and
133 * simple, but created too many 64-bit / 32-bit conversions and divisions.
134 *
135 * Be especially aware that negative values are represented in a way
136 * that the tv.sec field is negative and the tv.nsec field is greater
137 * or equal to zero but less than nanoseconds per second. This is the
138 * same representation which is used by timespecs.
139 *
140 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC
141 */
142
143/* Set a ktime_t variable to a value in sec/nsec representation: */
144static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
145{
146 return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
147}
148
149/**
150 * ktime_sub - subtract two ktime_t variables
151 * @lhs: minuend
152 * @rhs: subtrahend
153 *
154 * Return: The remainder of the subtraction.
155 */
156static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
157{
158 ktime_t res;
159
160 res.tv64 = lhs.tv64 - rhs.tv64;
161 if (res.tv.nsec < 0)
162 res.tv.nsec += NSEC_PER_SEC;
163
164 return res;
165}
166
167/**
168 * ktime_add - add two ktime_t variables
169 * @add1: addend1
170 * @add2: addend2
171 *
172 * Return: The sum of @add1 and @add2.
173 */
174static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
175{
176 ktime_t res;
177
178 res.tv64 = add1.tv64 + add2.tv64;
179 /*
180 * performance trick: the (u32) -NSEC gives 0x00000000Fxxxxxxx
181 * so we subtract NSEC_PER_SEC and add 1 to the upper 32 bit.
182 *
183 * it's equivalent to:
184 * tv.nsec -= NSEC_PER_SEC
185 * tv.sec ++;
186 */
187 if (res.tv.nsec >= NSEC_PER_SEC)
188 res.tv64 += (u32)-NSEC_PER_SEC;
189
190 return res;
191}
192
193/**
194 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
195 * @kt: addend
196 * @nsec: the scalar nsec value to add
197 *
198 * Return: The sum of @kt and @nsec in ktime_t format.
199 */
200extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
201
202/**
203 * ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable
204 * @kt: minuend
205 * @nsec: the scalar nsec value to subtract
206 *
207 * Return: The subtraction of @nsec from @kt in ktime_t format.
208 */
209extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec);
210
211/**
212 * timespec_to_ktime - convert a timespec to ktime_t format
213 * @ts: the timespec variable to convert
214 *
215 * Return: A ktime_t variable with the converted timespec value.
216 */
217static inline ktime_t timespec_to_ktime(const struct timespec ts)
218{
219 return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec,
220 .nsec = (s32)ts.tv_nsec } };
221}
222
223/**
224 * timeval_to_ktime - convert a timeval to ktime_t format
225 * @tv: the timeval variable to convert
226 *
227 * Return: A ktime_t variable with the converted timeval value.
228 */
229static inline ktime_t timeval_to_ktime(const struct timeval tv)
230{
231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
232 .nsec = (s32)(tv.tv_usec *
233 NSEC_PER_USEC) } };
234}
235
236/**
237 * ktime_to_timespec - convert a ktime_t variable to timespec format
238 * @kt: the ktime_t variable to convert
239 *
240 * Return: The timespec representation of the ktime value.
241 */
242static inline struct timespec ktime_to_timespec(const ktime_t kt)
243{
244 return (struct timespec) { .tv_sec = (time_t) kt.tv.sec,
245 .tv_nsec = (long) kt.tv.nsec };
246}
247
248/**
249 * ktime_to_timeval - convert a ktime_t variable to timeval format
250 * @kt: the ktime_t variable to convert
251 *
252 * Return: The timeval representation of the ktime value.
253 */
254static inline struct timeval ktime_to_timeval(const ktime_t kt)
255{
256 return (struct timeval) {
257 .tv_sec = (time_t) kt.tv.sec,
258 .tv_usec = (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC) };
259}
260
261/**
262 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
263 * @kt: the ktime_t variable to convert
264 *
265 * Return: The scalar nanoseconds representation of @kt.
266 */
267static inline s64 ktime_to_ns(const ktime_t kt)
268{
269 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
270}
271
272#endif /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
273 110
274/** 111/**
275 * ktime_equal - Compares two ktime_t variables to see if they are equal 112 * ktime_equal - Compares two ktime_t variables to see if they are equal
@@ -328,16 +165,20 @@ static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2)
328 return ktime_compare(cmp1, cmp2) < 0; 165 return ktime_compare(cmp1, cmp2) < 0;
329} 166}
330 167
168#if BITS_PER_LONG < 64
169extern u64 ktime_divns(const ktime_t kt, s64 div);
170#else /* BITS_PER_LONG < 64 */
171# define ktime_divns(kt, div) (u64)((kt).tv64 / (div))
172#endif
173
331static inline s64 ktime_to_us(const ktime_t kt) 174static inline s64 ktime_to_us(const ktime_t kt)
332{ 175{
333 struct timeval tv = ktime_to_timeval(kt); 176 return ktime_divns(kt, NSEC_PER_USEC);
334 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
335} 177}
336 178
337static inline s64 ktime_to_ms(const ktime_t kt) 179static inline s64 ktime_to_ms(const ktime_t kt)
338{ 180{
339 struct timeval tv = ktime_to_timeval(kt); 181 return ktime_divns(kt, NSEC_PER_MSEC);
340 return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC;
341} 182}
342 183
343static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) 184static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
@@ -381,6 +222,25 @@ static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
381 } 222 }
382} 223}
383 224
225/**
226 * ktime_to_timespec64_cond - convert a ktime_t variable to timespec64
227 * format only if the variable contains data
228 * @kt: the ktime_t variable to convert
229 * @ts: the timespec variable to store the result in
230 *
231 * Return: %true if there was a successful conversion, %false if kt was 0.
232 */
233static inline __must_check bool ktime_to_timespec64_cond(const ktime_t kt,
234 struct timespec64 *ts)
235{
236 if (kt.tv64) {
237 *ts = ktime_to_timespec64(kt);
238 return true;
239 } else {
240 return false;
241 }
242}
243
384/* 244/*
385 * The resolution of the clocks. The resolution value is returned in 245 * The resolution of the clocks. The resolution value is returned in
386 * the clock_getres() system call to give application programmers an 246 * the clock_getres() system call to give application programmers an
@@ -390,12 +250,6 @@ static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
390#define LOW_RES_NSEC TICK_NSEC 250#define LOW_RES_NSEC TICK_NSEC
391#define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC } 251#define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC }
392 252
393/* Get the monotonic time in timespec format: */
394extern void ktime_get_ts(struct timespec *ts);
395
396/* Get the real (wall-) time in timespec format: */
397#define ktime_get_real_ts(ts) getnstimeofday(ts)
398
399static inline ktime_t ns_to_ktime(u64 ns) 253static inline ktime_t ns_to_ktime(u64 ns)
400{ 254{
401 static const ktime_t ktime_zero = { .tv64 = 0 }; 255 static const ktime_t ktime_zero = { .tv64 = 0 };
@@ -410,4 +264,6 @@ static inline ktime_t ms_to_ktime(u64 ms)
410 return ktime_add_ms(ktime_zero, ms); 264 return ktime_add_ms(ktime_zero, ms);
411} 265}
412 266
267# include <linux/timekeeping.h>
268
413#endif 269#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ec4e3bd83d47..a4c33b34fe3f 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -325,24 +325,7 @@ struct kvm_kernel_irq_routing_entry {
325 struct hlist_node link; 325 struct hlist_node link;
326}; 326};
327 327
328#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING 328struct kvm_irq_routing_table;
329
330struct kvm_irq_routing_table {
331 int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
332 struct kvm_kernel_irq_routing_entry *rt_entries;
333 u32 nr_rt_entries;
334 /*
335 * Array indexed by gsi. Each entry contains list of irq chips
336 * the gsi is connected to.
337 */
338 struct hlist_head map[0];
339};
340
341#else
342
343struct kvm_irq_routing_table {};
344
345#endif
346 329
347#ifndef KVM_PRIVATE_MEM_SLOTS 330#ifndef KVM_PRIVATE_MEM_SLOTS
348#define KVM_PRIVATE_MEM_SLOTS 0 331#define KVM_PRIVATE_MEM_SLOTS 0
@@ -401,11 +384,12 @@ struct kvm {
401 struct mutex irq_lock; 384 struct mutex irq_lock;
402#ifdef CONFIG_HAVE_KVM_IRQCHIP 385#ifdef CONFIG_HAVE_KVM_IRQCHIP
403 /* 386 /*
404 * Update side is protected by irq_lock and, 387 * Update side is protected by irq_lock.
405 * if configured, irqfds.lock.
406 */ 388 */
407 struct kvm_irq_routing_table __rcu *irq_routing; 389 struct kvm_irq_routing_table __rcu *irq_routing;
408 struct hlist_head mask_notifier_list; 390 struct hlist_head mask_notifier_list;
391#endif
392#ifdef CONFIG_HAVE_KVM_IRQFD
409 struct hlist_head irq_ack_notifier_list; 393 struct hlist_head irq_ack_notifier_list;
410#endif 394#endif
411 395
@@ -455,7 +439,7 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
455int __must_check vcpu_load(struct kvm_vcpu *vcpu); 439int __must_check vcpu_load(struct kvm_vcpu *vcpu);
456void vcpu_put(struct kvm_vcpu *vcpu); 440void vcpu_put(struct kvm_vcpu *vcpu);
457 441
458#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING 442#ifdef CONFIG_HAVE_KVM_IRQFD
459int kvm_irqfd_init(void); 443int kvm_irqfd_init(void);
460void kvm_irqfd_exit(void); 444void kvm_irqfd_exit(void);
461#else 445#else
@@ -602,7 +586,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
602 unsigned int ioctl, unsigned long arg); 586 unsigned int ioctl, unsigned long arg);
603int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf); 587int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf);
604 588
605int kvm_dev_ioctl_check_extension(long ext); 589int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
606 590
607int kvm_get_dirty_log(struct kvm *kvm, 591int kvm_get_dirty_log(struct kvm *kvm,
608 struct kvm_dirty_log *log, int *is_dirty); 592 struct kvm_dirty_log *log, int *is_dirty);
@@ -752,6 +736,10 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
752void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, 736void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
753 bool mask); 737 bool mask);
754 738
739int kvm_irq_map_gsi(struct kvm *kvm,
740 struct kvm_kernel_irq_routing_entry *entries, int gsi);
741int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin);
742
755int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, 743int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
756 bool line_status); 744 bool line_status);
757int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); 745int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
@@ -942,28 +930,27 @@ int kvm_set_irq_routing(struct kvm *kvm,
942 const struct kvm_irq_routing_entry *entries, 930 const struct kvm_irq_routing_entry *entries,
943 unsigned nr, 931 unsigned nr,
944 unsigned flags); 932 unsigned flags);
945int kvm_set_routing_entry(struct kvm_irq_routing_table *rt, 933int kvm_set_routing_entry(struct kvm_kernel_irq_routing_entry *e,
946 struct kvm_kernel_irq_routing_entry *e,
947 const struct kvm_irq_routing_entry *ue); 934 const struct kvm_irq_routing_entry *ue);
948void kvm_free_irq_routing(struct kvm *kvm); 935void kvm_free_irq_routing(struct kvm *kvm);
949 936
950int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
951
952#else 937#else
953 938
954static inline void kvm_free_irq_routing(struct kvm *kvm) {} 939static inline void kvm_free_irq_routing(struct kvm *kvm) {}
955 940
956#endif 941#endif
957 942
943int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
944
958#ifdef CONFIG_HAVE_KVM_EVENTFD 945#ifdef CONFIG_HAVE_KVM_EVENTFD
959 946
960void kvm_eventfd_init(struct kvm *kvm); 947void kvm_eventfd_init(struct kvm *kvm);
961int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 948int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
962 949
963#ifdef CONFIG_HAVE_KVM_IRQCHIP 950#ifdef CONFIG_HAVE_KVM_IRQFD
964int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args); 951int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
965void kvm_irqfd_release(struct kvm *kvm); 952void kvm_irqfd_release(struct kvm *kvm);
966void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *); 953void kvm_irq_routing_update(struct kvm *);
967#else 954#else
968static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) 955static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
969{ 956{
@@ -985,10 +972,8 @@ static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
985static inline void kvm_irqfd_release(struct kvm *kvm) {} 972static inline void kvm_irqfd_release(struct kvm *kvm) {}
986 973
987#ifdef CONFIG_HAVE_KVM_IRQCHIP 974#ifdef CONFIG_HAVE_KVM_IRQCHIP
988static inline void kvm_irq_routing_update(struct kvm *kvm, 975static inline void kvm_irq_routing_update(struct kvm *kvm)
989 struct kvm_irq_routing_table *irq_rt)
990{ 976{
991 rcu_assign_pointer(kvm->irq_routing, irq_rt);
992} 977}
993#endif 978#endif
994 979
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0287ab296689..6a599dce7f9d 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -15,7 +15,6 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/timer.h>
19#include <linux/workqueue.h> 18#include <linux/workqueue.h>
20 19
21struct device; 20struct device;
@@ -63,11 +62,13 @@ struct led_classdev {
63 unsigned long *delay_off); 62 unsigned long *delay_off);
64 63
65 struct device *dev; 64 struct device *dev;
65 const struct attribute_group **groups;
66
66 struct list_head node; /* LED Device list */ 67 struct list_head node; /* LED Device list */
67 const char *default_trigger; /* Trigger to use */ 68 const char *default_trigger; /* Trigger to use */
68 69
69 unsigned long blink_delay_on, blink_delay_off; 70 unsigned long blink_delay_on, blink_delay_off;
70 struct timer_list blink_timer; 71 struct delayed_work blink_work;
71 int blink_brightness; 72 int blink_brightness;
72 73
73 struct work_struct set_brightness_work; 74 struct work_struct set_brightness_work;
diff --git a/include/linux/list.h b/include/linux/list.h
index ef9594171062..cbbb96fcead9 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -654,15 +654,15 @@ static inline void hlist_add_before(struct hlist_node *n,
654 *(n->pprev) = n; 654 *(n->pprev) = n;
655} 655}
656 656
657static inline void hlist_add_after(struct hlist_node *n, 657static inline void hlist_add_behind(struct hlist_node *n,
658 struct hlist_node *next) 658 struct hlist_node *prev)
659{ 659{
660 next->next = n->next; 660 n->next = prev->next;
661 n->next = next; 661 prev->next = n;
662 next->pprev = &n->next; 662 n->pprev = &prev->next;
663 663
664 if(next->next) 664 if (n->next)
665 next->next->pprev = &next->next; 665 n->next->pprev = &n->next;
666} 666}
667 667
668/* after that we'll appear to be on some hlist and hlist_del will work */ 668/* after that we'll appear to be on some hlist and hlist_del will work */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index b660e05b63d4..e8cc45307f8f 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -249,7 +249,7 @@ phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
249/* 249/*
250 * Set the allocation direction to bottom-up or top-down. 250 * Set the allocation direction to bottom-up or top-down.
251 */ 251 */
252static inline void memblock_set_bottom_up(bool enable) 252static inline void __init memblock_set_bottom_up(bool enable)
253{ 253{
254 memblock.bottom_up = enable; 254 memblock.bottom_up = enable;
255} 255}
@@ -264,7 +264,7 @@ static inline bool memblock_bottom_up(void)
264 return memblock.bottom_up; 264 return memblock.bottom_up;
265} 265}
266#else 266#else
267static inline void memblock_set_bottom_up(bool enable) {} 267static inline void __init memblock_set_bottom_up(bool enable) {}
268static inline bool memblock_bottom_up(void) { return false; } 268static inline bool memblock_bottom_up(void) { return false; }
269#endif 269#endif
270 270
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index eb65d29516ca..e0752d204d9e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -54,39 +54,20 @@ struct mem_cgroup_reclaim_cookie {
54}; 54};
55 55
56#ifdef CONFIG_MEMCG 56#ifdef CONFIG_MEMCG
57/* 57int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
58 * All "charge" functions with gfp_mask should use GFP_KERNEL or 58 gfp_t gfp_mask, struct mem_cgroup **memcgp);
59 * (gfp_mask & GFP_RECLAIM_MASK). In current implementatin, memcg doesn't 59void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg,
60 * alloc memory but reclaims memory from all available zones. So, "where I want 60 bool lrucare);
61 * memory from" bits of gfp_mask has no meaning. So any bits of that field is 61void mem_cgroup_cancel_charge(struct page *page, struct mem_cgroup *memcg);
62 * available but adding a rule is better. charge functions' gfp_mask should 62void mem_cgroup_uncharge(struct page *page);
63 * be set to GFP_KERNEL or gfp_mask & GFP_RECLAIM_MASK for avoiding ambiguous 63void mem_cgroup_uncharge_list(struct list_head *page_list);
64 * codes.
65 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
66 */
67 64
68extern int mem_cgroup_charge_anon(struct page *page, struct mm_struct *mm, 65void mem_cgroup_migrate(struct page *oldpage, struct page *newpage,
69 gfp_t gfp_mask); 66 bool lrucare);
70/* for swap handling */
71extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
72 struct page *page, gfp_t mask, struct mem_cgroup **memcgp);
73extern void mem_cgroup_commit_charge_swapin(struct page *page,
74 struct mem_cgroup *memcg);
75extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
76
77extern int mem_cgroup_charge_file(struct page *page, struct mm_struct *mm,
78 gfp_t gfp_mask);
79 67
80struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); 68struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
81struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *); 69struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *);
82 70
83/* For coalescing uncharge for reducing memcg' overhead*/
84extern void mem_cgroup_uncharge_start(void);
85extern void mem_cgroup_uncharge_end(void);
86
87extern void mem_cgroup_uncharge_page(struct page *page);
88extern void mem_cgroup_uncharge_cache_page(struct page *page);
89
90bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, 71bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
91 struct mem_cgroup *memcg); 72 struct mem_cgroup *memcg);
92bool task_in_mem_cgroup(struct task_struct *task, 73bool task_in_mem_cgroup(struct task_struct *task,
@@ -113,12 +94,6 @@ bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
113 94
114extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg); 95extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg);
115 96
116extern void
117mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
118 struct mem_cgroup **memcgp);
119extern void mem_cgroup_end_migration(struct mem_cgroup *memcg,
120 struct page *oldpage, struct page *newpage, bool migration_ok);
121
122struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *, 97struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
123 struct mem_cgroup *, 98 struct mem_cgroup *,
124 struct mem_cgroup_reclaim_cookie *); 99 struct mem_cgroup_reclaim_cookie *);
@@ -133,8 +108,6 @@ unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list);
133void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int); 108void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int);
134extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 109extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
135 struct task_struct *p); 110 struct task_struct *p);
136extern void mem_cgroup_replace_page_cache(struct page *oldpage,
137 struct page *newpage);
138 111
139static inline void mem_cgroup_oom_enable(void) 112static inline void mem_cgroup_oom_enable(void)
140{ 113{
@@ -233,46 +206,36 @@ void mem_cgroup_print_bad_page(struct page *page);
233#else /* CONFIG_MEMCG */ 206#else /* CONFIG_MEMCG */
234struct mem_cgroup; 207struct mem_cgroup;
235 208
236static inline int mem_cgroup_charge_anon(struct page *page, 209static inline int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
237 struct mm_struct *mm, gfp_t gfp_mask) 210 gfp_t gfp_mask,
238{ 211 struct mem_cgroup **memcgp)
239 return 0;
240}
241
242static inline int mem_cgroup_charge_file(struct page *page,
243 struct mm_struct *mm, gfp_t gfp_mask)
244{
245 return 0;
246}
247
248static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
249 struct page *page, gfp_t gfp_mask, struct mem_cgroup **memcgp)
250{ 212{
213 *memcgp = NULL;
251 return 0; 214 return 0;
252} 215}
253 216
254static inline void mem_cgroup_commit_charge_swapin(struct page *page, 217static inline void mem_cgroup_commit_charge(struct page *page,
255 struct mem_cgroup *memcg) 218 struct mem_cgroup *memcg,
256{ 219 bool lrucare)
257}
258
259static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg)
260{ 220{
261} 221}
262 222
263static inline void mem_cgroup_uncharge_start(void) 223static inline void mem_cgroup_cancel_charge(struct page *page,
224 struct mem_cgroup *memcg)
264{ 225{
265} 226}
266 227
267static inline void mem_cgroup_uncharge_end(void) 228static inline void mem_cgroup_uncharge(struct page *page)
268{ 229{
269} 230}
270 231
271static inline void mem_cgroup_uncharge_page(struct page *page) 232static inline void mem_cgroup_uncharge_list(struct list_head *page_list)
272{ 233{
273} 234}
274 235
275static inline void mem_cgroup_uncharge_cache_page(struct page *page) 236static inline void mem_cgroup_migrate(struct page *oldpage,
237 struct page *newpage,
238 bool lrucare)
276{ 239{
277} 240}
278 241
@@ -311,17 +274,6 @@ static inline struct cgroup_subsys_state
311 return NULL; 274 return NULL;
312} 275}
313 276
314static inline void
315mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
316 struct mem_cgroup **memcgp)
317{
318}
319
320static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg,
321 struct page *oldpage, struct page *newpage, bool migration_ok)
322{
323}
324
325static inline struct mem_cgroup * 277static inline struct mem_cgroup *
326mem_cgroup_iter(struct mem_cgroup *root, 278mem_cgroup_iter(struct mem_cgroup *root,
327 struct mem_cgroup *prev, 279 struct mem_cgroup *prev,
@@ -417,10 +369,6 @@ static inline
417void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 369void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
418{ 370{
419} 371}
420static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
421 struct page *newpage)
422{
423}
424#endif /* CONFIG_MEMCG */ 372#endif /* CONFIG_MEMCG */
425 373
426#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM) 374#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 010d125bffbf..d9524c49d767 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -26,11 +26,12 @@ enum {
26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO, 26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
27}; 27};
28 28
29/* Types for control the zone type of onlined memory */ 29/* Types for control the zone type of onlined and offlined memory */
30enum { 30enum {
31 ONLINE_KEEP, 31 MMOP_OFFLINE = -1,
32 ONLINE_KERNEL, 32 MMOP_ONLINE_KEEP,
33 ONLINE_MOVABLE, 33 MMOP_ONLINE_KERNEL,
34 MMOP_ONLINE_MOVABLE,
34}; 35};
35 36
36/* 37/*
@@ -258,6 +259,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
258extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, 259extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
259 void *arg, int (*func)(struct memory_block *, void *)); 260 void *arg, int (*func)(struct memory_block *, void *));
260extern int add_memory(int nid, u64 start, u64 size); 261extern int add_memory(int nid, u64 start, u64 size);
262extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default);
261extern int arch_add_memory(int nid, u64 start, u64 size); 263extern int arch_add_memory(int nid, u64 start, u64 size);
262extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 264extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
263extern bool is_memblock_offlined(struct memory_block *mem); 265extern bool is_memblock_offlined(struct memory_block *mem);
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 4e7fe7417fc9..9475fee2bfc5 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -505,6 +505,7 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
505void ab8500_override_turn_on_stat(u8 mask, u8 set); 505void ab8500_override_turn_on_stat(u8 mask, u8 set);
506 506
507#ifdef CONFIG_AB8500_DEBUG 507#ifdef CONFIG_AB8500_DEBUG
508extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
508void ab8500_dump_all_banks(struct device *dev); 509void ab8500_dump_all_banks(struct device *dev);
509void ab8500_debug_register_interrupt(int line); 510void ab8500_debug_register_interrupt(int line);
510#else 511#else
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 6d9371f88875..f34723f7663c 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -18,7 +18,7 @@
18#include <linux/regulator/consumer.h> 18#include <linux/regulator/consumer.h>
19#include <linux/mfd/arizona/pdata.h> 19#include <linux/mfd/arizona/pdata.h>
20 20
21#define ARIZONA_MAX_CORE_SUPPLIES 3 21#define ARIZONA_MAX_CORE_SUPPLIES 2
22 22
23enum arizona_type { 23enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
@@ -46,8 +46,8 @@ enum arizona_type {
46#define ARIZONA_IRQ_DSP_IRQ6 17 46#define ARIZONA_IRQ_DSP_IRQ6 17
47#define ARIZONA_IRQ_DSP_IRQ7 18 47#define ARIZONA_IRQ_DSP_IRQ7 18
48#define ARIZONA_IRQ_DSP_IRQ8 19 48#define ARIZONA_IRQ_DSP_IRQ8 19
49#define ARIZONA_IRQ_SPK_SHUTDOWN_WARN 20 49#define ARIZONA_IRQ_SPK_OVERHEAT_WARN 20
50#define ARIZONA_IRQ_SPK_SHUTDOWN 21 50#define ARIZONA_IRQ_SPK_OVERHEAT 21
51#define ARIZONA_IRQ_MICDET 22 51#define ARIZONA_IRQ_MICDET 22
52#define ARIZONA_IRQ_HPDET 23 52#define ARIZONA_IRQ_HPDET 23
53#define ARIZONA_IRQ_WSEQ_DONE 24 53#define ARIZONA_IRQ_WSEQ_DONE 24
@@ -78,8 +78,31 @@ enum arizona_type {
78#define ARIZONA_IRQ_FLL1_CLOCK_OK 49 78#define ARIZONA_IRQ_FLL1_CLOCK_OK 49
79#define ARIZONA_IRQ_MICD_CLAMP_RISE 50 79#define ARIZONA_IRQ_MICD_CLAMP_RISE 50
80#define ARIZONA_IRQ_MICD_CLAMP_FALL 51 80#define ARIZONA_IRQ_MICD_CLAMP_FALL 51
81 81#define ARIZONA_IRQ_HP3R_DONE 52
82#define ARIZONA_NUM_IRQ 52 82#define ARIZONA_IRQ_HP3L_DONE 53
83#define ARIZONA_IRQ_HP2R_DONE 54
84#define ARIZONA_IRQ_HP2L_DONE 55
85#define ARIZONA_IRQ_HP1R_DONE 56
86#define ARIZONA_IRQ_HP1L_DONE 57
87#define ARIZONA_IRQ_ISRC3_CFG_ERR 58
88#define ARIZONA_IRQ_DSP_SHARED_WR_COLL 59
89#define ARIZONA_IRQ_SPK_SHUTDOWN 60
90#define ARIZONA_IRQ_SPK1R_SHORT 61
91#define ARIZONA_IRQ_SPK1L_SHORT 62
92#define ARIZONA_IRQ_HP3R_SC_NEG 63
93#define ARIZONA_IRQ_HP3R_SC_POS 64
94#define ARIZONA_IRQ_HP3L_SC_NEG 65
95#define ARIZONA_IRQ_HP3L_SC_POS 66
96#define ARIZONA_IRQ_HP2R_SC_NEG 67
97#define ARIZONA_IRQ_HP2R_SC_POS 68
98#define ARIZONA_IRQ_HP2L_SC_NEG 69
99#define ARIZONA_IRQ_HP2L_SC_POS 70
100#define ARIZONA_IRQ_HP1R_SC_NEG 71
101#define ARIZONA_IRQ_HP1R_SC_POS 72
102#define ARIZONA_IRQ_HP1L_SC_NEG 73
103#define ARIZONA_IRQ_HP1L_SC_POS 74
104
105#define ARIZONA_NUM_IRQ 75
83 106
84struct snd_soc_dapm_context; 107struct snd_soc_dapm_context;
85 108
@@ -109,7 +132,15 @@ struct arizona {
109 struct mutex clk_lock; 132 struct mutex clk_lock;
110 int clk32k_ref; 133 int clk32k_ref;
111 134
135 bool ctrlif_error;
136
112 struct snd_soc_dapm_context *dapm; 137 struct snd_soc_dapm_context *dapm;
138
139 int tdm_width[ARIZONA_MAX_AIF];
140 int tdm_slots[ARIZONA_MAX_AIF];
141
142 uint16_t dac_comp_coeff;
143 uint8_t dac_comp_enabled;
113}; 144};
114 145
115int arizona_clk32k_enable(struct arizona *arizona); 146int arizona_clk32k_enable(struct arizona *arizona);
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 12a5c135c746..4578c72c9b86 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -127,6 +127,9 @@ struct arizona_pdata {
127 /** Internal pull on GPIO5 is disabled when used for jack detection */ 127 /** Internal pull on GPIO5 is disabled when used for jack detection */
128 bool jd_gpio5_nopull; 128 bool jd_gpio5_nopull;
129 129
130 /** set to true if jackdet contact opens on insert */
131 bool jd_invert;
132
130 /** Use the headphone detect circuit to identify the accessory */ 133 /** Use the headphone detect circuit to identify the accessory */
131 bool hpdet_acc_id; 134 bool hpdet_acc_id;
132 135
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 7204d8138b24..dbd23c36de21 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -878,22 +878,26 @@
878#define ARIZONA_INTERRUPT_STATUS_3 0xD02 878#define ARIZONA_INTERRUPT_STATUS_3 0xD02
879#define ARIZONA_INTERRUPT_STATUS_4 0xD03 879#define ARIZONA_INTERRUPT_STATUS_4 0xD03
880#define ARIZONA_INTERRUPT_STATUS_5 0xD04 880#define ARIZONA_INTERRUPT_STATUS_5 0xD04
881#define ARIZONA_INTERRUPT_STATUS_6 0xD05
881#define ARIZONA_INTERRUPT_STATUS_1_MASK 0xD08 882#define ARIZONA_INTERRUPT_STATUS_1_MASK 0xD08
882#define ARIZONA_INTERRUPT_STATUS_2_MASK 0xD09 883#define ARIZONA_INTERRUPT_STATUS_2_MASK 0xD09
883#define ARIZONA_INTERRUPT_STATUS_3_MASK 0xD0A 884#define ARIZONA_INTERRUPT_STATUS_3_MASK 0xD0A
884#define ARIZONA_INTERRUPT_STATUS_4_MASK 0xD0B 885#define ARIZONA_INTERRUPT_STATUS_4_MASK 0xD0B
885#define ARIZONA_INTERRUPT_STATUS_5_MASK 0xD0C 886#define ARIZONA_INTERRUPT_STATUS_5_MASK 0xD0C
887#define ARIZONA_INTERRUPT_STATUS_6_MASK 0xD0D
886#define ARIZONA_INTERRUPT_CONTROL 0xD0F 888#define ARIZONA_INTERRUPT_CONTROL 0xD0F
887#define ARIZONA_IRQ2_STATUS_1 0xD10 889#define ARIZONA_IRQ2_STATUS_1 0xD10
888#define ARIZONA_IRQ2_STATUS_2 0xD11 890#define ARIZONA_IRQ2_STATUS_2 0xD11
889#define ARIZONA_IRQ2_STATUS_3 0xD12 891#define ARIZONA_IRQ2_STATUS_3 0xD12
890#define ARIZONA_IRQ2_STATUS_4 0xD13 892#define ARIZONA_IRQ2_STATUS_4 0xD13
891#define ARIZONA_IRQ2_STATUS_5 0xD14 893#define ARIZONA_IRQ2_STATUS_5 0xD14
894#define ARIZONA_IRQ2_STATUS_6 0xD15
892#define ARIZONA_IRQ2_STATUS_1_MASK 0xD18 895#define ARIZONA_IRQ2_STATUS_1_MASK 0xD18
893#define ARIZONA_IRQ2_STATUS_2_MASK 0xD19 896#define ARIZONA_IRQ2_STATUS_2_MASK 0xD19
894#define ARIZONA_IRQ2_STATUS_3_MASK 0xD1A 897#define ARIZONA_IRQ2_STATUS_3_MASK 0xD1A
895#define ARIZONA_IRQ2_STATUS_4_MASK 0xD1B 898#define ARIZONA_IRQ2_STATUS_4_MASK 0xD1B
896#define ARIZONA_IRQ2_STATUS_5_MASK 0xD1C 899#define ARIZONA_IRQ2_STATUS_5_MASK 0xD1C
900#define ARIZONA_IRQ2_STATUS_6_MASK 0xD1D
897#define ARIZONA_IRQ2_CONTROL 0xD1F 901#define ARIZONA_IRQ2_CONTROL 0xD1F
898#define ARIZONA_INTERRUPT_RAW_STATUS_2 0xD20 902#define ARIZONA_INTERRUPT_RAW_STATUS_2 0xD20
899#define ARIZONA_INTERRUPT_RAW_STATUS_3 0xD21 903#define ARIZONA_INTERRUPT_RAW_STATUS_3 0xD21
@@ -902,6 +906,7 @@
902#define ARIZONA_INTERRUPT_RAW_STATUS_6 0xD24 906#define ARIZONA_INTERRUPT_RAW_STATUS_6 0xD24
903#define ARIZONA_INTERRUPT_RAW_STATUS_7 0xD25 907#define ARIZONA_INTERRUPT_RAW_STATUS_7 0xD25
904#define ARIZONA_INTERRUPT_RAW_STATUS_8 0xD26 908#define ARIZONA_INTERRUPT_RAW_STATUS_8 0xD26
909#define ARIZONA_INTERRUPT_RAW_STATUS_9 0xD28
905#define ARIZONA_IRQ_PIN_STATUS 0xD40 910#define ARIZONA_IRQ_PIN_STATUS 0xD40
906#define ARIZONA_ADSP2_IRQ0 0xD41 911#define ARIZONA_ADSP2_IRQ0 0xD41
907#define ARIZONA_AOD_WKUP_AND_TRIG 0xD50 912#define ARIZONA_AOD_WKUP_AND_TRIG 0xD50
@@ -4691,14 +4696,14 @@
4691/* 4696/*
4692 * R3330 (0xD02) - Interrupt Status 3 4697 * R3330 (0xD02) - Interrupt Status 3
4693 */ 4698 */
4694#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1 0x8000 /* SPK_SHUTDOWN_WARN_EINT1 */ 4699#define ARIZONA_SPK_OVERHEAT_WARN_EINT1 0x8000 /* SPK_OVERHEAT_WARN_EINT1 */
4695#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_MASK 0x8000 /* SPK_SHUTDOWN_WARN_EINT1 */ 4700#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_MASK 0x8000 /* SPK_OVERHEAD_WARN_EINT1 */
4696#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_SHIFT 15 /* SPK_SHUTDOWN_WARN_EINT1 */ 4701#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_SHIFT 15 /* SPK_OVERHEAT_WARN_EINT1 */
4697#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_WARN_EINT1 */ 4702#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_WIDTH 1 /* SPK_OVERHEAT_WARN_EINT1 */
4698#define ARIZONA_SPK_SHUTDOWN_EINT1 0x4000 /* SPK_SHUTDOWN_EINT1 */ 4703#define ARIZONA_SPK_OVERHEAT_EINT1 0x4000 /* SPK_OVERHEAT_EINT1 */
4699#define ARIZONA_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* SPK_SHUTDOWN_EINT1 */ 4704#define ARIZONA_SPK_OVERHEAT_EINT1_MASK 0x4000 /* SPK_OVERHEAT_EINT1 */
4700#define ARIZONA_SPK_SHUTDOWN_EINT1_SHIFT 14 /* SPK_SHUTDOWN_EINT1 */ 4705#define ARIZONA_SPK_OVERHEAT_EINT1_SHIFT 14 /* SPK_OVERHEAT_EINT1 */
4701#define ARIZONA_SPK_SHUTDOWN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_EINT1 */ 4706#define ARIZONA_SPK_OVERHEAT_EINT1_WIDTH 1 /* SPK_OVERHEAT_EINT1 */
4702#define ARIZONA_HPDET_EINT1 0x2000 /* HPDET_EINT1 */ 4707#define ARIZONA_HPDET_EINT1 0x2000 /* HPDET_EINT1 */
4703#define ARIZONA_HPDET_EINT1_MASK 0x2000 /* HPDET_EINT1 */ 4708#define ARIZONA_HPDET_EINT1_MASK 0x2000 /* HPDET_EINT1 */
4704#define ARIZONA_HPDET_EINT1_SHIFT 13 /* HPDET_EINT1 */ 4709#define ARIZONA_HPDET_EINT1_SHIFT 13 /* HPDET_EINT1 */
@@ -4795,6 +4800,77 @@
4795#define ARIZONA_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* ISRC2_CFG_ERR_EINT1 */ 4800#define ARIZONA_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* ISRC2_CFG_ERR_EINT1 */
4796#define ARIZONA_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* ISRC2_CFG_ERR_EINT1 */ 4801#define ARIZONA_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* ISRC2_CFG_ERR_EINT1 */
4797#define ARIZONA_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */ 4802#define ARIZONA_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */
4803#define ARIZONA_HP3R_DONE_EINT1 0x0020 /* HP3R_DONE_EINT1 */
4804#define ARIZONA_HP3R_DONE_EINT1_MASK 0x0020 /* HP3R_DONE_EINT1 */
4805#define ARIZONA_HP3R_DONE_EINT1_SHIFT 5 /* HP3R_DONE_EINT1 */
4806#define ARIZONA_HP3R_DONE_EINT1_WIDTH 1 /* HP3R_DONE_EINT1 */
4807#define ARIZONA_HP3L_DONE_EINT1 0x0010 /* HP3L_DONE_EINT1 */
4808#define ARIZONA_HP3L_DONE_EINT1_MASK 0x0010 /* HP3L_DONE_EINT1 */
4809#define ARIZONA_HP3L_DONE_EINT1_SHIFT 4 /* HP3L_DONE_EINT1 */
4810#define ARIZONA_HP3L_DONE_EINT1_WIDTH 1 /* HP3L_DONE_EINT1 */
4811#define ARIZONA_HP2R_DONE_EINT1 0x0008 /* HP2R_DONE_EINT1 */
4812#define ARIZONA_HP2R_DONE_EINT1_MASK 0x0008 /* HP2R_DONE_EINT1 */
4813#define ARIZONA_HP2R_DONE_EINT1_SHIFT 3 /* HP2R_DONE_EINT1 */
4814#define ARIZONA_HP2R_DONE_EINT1_WIDTH 1 /* HP2R_DONE_EINT1 */
4815#define ARIZONA_HP2L_DONE_EINT1 0x0004 /* HP2L_DONE_EINT1 */
4816#define ARIZONA_HP2L_DONE_EINT1_MASK 0x0004 /* HP2L_DONE_EINT1 */
4817#define ARIZONA_HP2L_DONE_EINT1_SHIFT 2 /* HP2L_DONE_EINT1 */
4818#define ARIZONA_HP2L_DONE_EINT1_WIDTH 1 /* HP2L_DONE_EINT1 */
4819#define ARIZONA_HP1R_DONE_EINT1 0x0002 /* HP1R_DONE_EINT1 */
4820#define ARIZONA_HP1R_DONE_EINT1_MASK 0x0002 /* HP1R_DONE_EINT1 */
4821#define ARIZONA_HP1R_DONE_EINT1_SHIFT 1 /* HP1R_DONE_EINT1 */
4822#define ARIZONA_HP1R_DONE_EINT1_WIDTH 1 /* HP1R_DONE_EINT1 */
4823#define ARIZONA_HP1L_DONE_EINT1 0x0001 /* HP1L_DONE_EINT1 */
4824#define ARIZONA_HP1L_DONE_EINT1_MASK 0x0001 /* HP1L_DONE_EINT1 */
4825#define ARIZONA_HP1L_DONE_EINT1_SHIFT 0 /* HP1L_DONE_EINT1 */
4826#define ARIZONA_HP1L_DONE_EINT1_WIDTH 1 /* HP1L_DONE_EINT1 */
4827
4828/*
4829 * R3331 (0xD03) - Interrupt Status 4 (Alternate layout)
4830 *
4831 * Alternate layout used on later devices, note only fields that have moved
4832 * are specified
4833 */
4834#define ARIZONA_V2_AIF3_ERR_EINT1 0x8000 /* AIF3_ERR_EINT1 */
4835#define ARIZONA_V2_AIF3_ERR_EINT1_MASK 0x8000 /* AIF3_ERR_EINT1 */
4836#define ARIZONA_V2_AIF3_ERR_EINT1_SHIFT 15 /* AIF3_ERR_EINT1 */
4837#define ARIZONA_V2_AIF3_ERR_EINT1_WIDTH 1 /* AIF3_ERR_EINT1 */
4838#define ARIZONA_V2_AIF2_ERR_EINT1 0x4000 /* AIF2_ERR_EINT1 */
4839#define ARIZONA_V2_AIF2_ERR_EINT1_MASK 0x4000 /* AIF2_ERR_EINT1 */
4840#define ARIZONA_V2_AIF2_ERR_EINT1_SHIFT 14 /* AIF2_ERR_EINT1 */
4841#define ARIZONA_V2_AIF2_ERR_EINT1_WIDTH 1 /* AIF2_ERR_EINT1 */
4842#define ARIZONA_V2_AIF1_ERR_EINT1 0x2000 /* AIF1_ERR_EINT1 */
4843#define ARIZONA_V2_AIF1_ERR_EINT1_MASK 0x2000 /* AIF1_ERR_EINT1 */
4844#define ARIZONA_V2_AIF1_ERR_EINT1_SHIFT 13 /* AIF1_ERR_EINT1 */
4845#define ARIZONA_V2_AIF1_ERR_EINT1_WIDTH 1 /* AIF1_ERR_EINT1 */
4846#define ARIZONA_V2_CTRLIF_ERR_EINT1 0x1000 /* CTRLIF_ERR_EINT1 */
4847#define ARIZONA_V2_CTRLIF_ERR_EINT1_MASK 0x1000 /* CTRLIF_ERR_EINT1 */
4848#define ARIZONA_V2_CTRLIF_ERR_EINT1_SHIFT 12 /* CTRLIF_ERR_EINT1 */
4849#define ARIZONA_V2_CTRLIF_ERR_EINT1_WIDTH 1 /* CTRLIF_ERR_EINT1 */
4850#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1 0x0800 /* MIXER_DROPPED_SAMPLE_EINT1 */
4851#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_MASK 0x0800 /* MIXER_DROPPED_SAMPLE_EINT1 */
4852#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_SHIFT 11 /* MIXER_DROPPED_SAMPLE_EINT1 */
4853#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_WIDTH 1 /* MIXER_DROPPED_SAMPLE_EINT1 */
4854#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1 0x0400 /* ASYNC_CLK_ENA_LOW_EINT1 */
4855#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_MASK 0x0400 /* ASYNC_CLK_ENA_LOW_EINT1 */
4856#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_SHIFT 10 /* ASYNC_CLK_ENA_LOW_EINT1 */
4857#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_WIDTH 1 /* ASYNC_CLK_ENA_LOW_EINT1 */
4858#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1 0x0200 /* SYSCLK_ENA_LOW_EINT1 */
4859#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_MASK 0x0200 /* SYSCLK_ENA_LOW_EINT1 */
4860#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_SHIFT 9 /* SYSCLK_ENA_LOW_EINT1 */
4861#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_WIDTH 1 /* SYSCLK_ENA_LOW_EINT1 */
4862#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1 0x0100 /* ISRC1_CFG_ERR_EINT1 */
4863#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_MASK 0x0100 /* ISRC1_CFG_ERR_EINT1 */
4864#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_SHIFT 8 /* ISRC1_CFG_ERR_EINT1 */
4865#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_WIDTH 1 /* ISRC1_CFG_ERR_EINT1 */
4866#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1 0x0080 /* ISRC2_CFG_ERR_EINT1 */
4867#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_MASK 0x0080 /* ISRC2_CFG_ERR_EINT1 */
4868#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_SHIFT 7 /* ISRC2_CFG_ERR_EINT1 */
4869#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */
4870#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1 0x0040 /* ISRC3_CFG_ERR_EINT1 */
4871#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_MASK 0x0040 /* ISRC3_CFG_ERR_EINT1 */
4872#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_SHIFT 6 /* ISRC3_CFG_ERR_EINT1 */
4873#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_WIDTH 1 /* ISRC3_CFG_ERR_EINT1 */
4798 4874
4799/* 4875/*
4800 * R3332 (0xD04) - Interrupt Status 5 4876 * R3332 (0xD04) - Interrupt Status 5
@@ -4821,6 +4897,85 @@
4821#define ARIZONA_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* FLL1_CLOCK_OK_EINT1 */ 4897#define ARIZONA_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* FLL1_CLOCK_OK_EINT1 */
4822 4898
4823/* 4899/*
4900 * R3332 (0xD05) - Interrupt Status 5 (Alternate layout)
4901 *
4902 * Alternate layout used on later devices, note only fields that have moved
4903 * are specified
4904 */
4905#define ARIZONA_V2_ASRC_CFG_ERR_EINT1 0x0008 /* ASRC_CFG_ERR_EINT1 */
4906#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_MASK 0x0008 /* ASRC_CFG_ERR_EINT1 */
4907#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_SHIFT 3 /* ASRC_CFG_ERR_EINT1 */
4908#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_WIDTH 1 /* ASRC_CFG_ERR_EINT1 */
4909
4910/*
4911 * R3333 (0xD05) - Interrupt Status 6
4912 */
4913#define ARIZONA_DSP_SHARED_WR_COLL_EINT1 0x8000 /* DSP_SHARED_WR_COLL_EINT1 */
4914#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_MASK 0x8000 /* DSP_SHARED_WR_COLL_EINT1 */
4915#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_SHIFT 15 /* DSP_SHARED_WR_COLL_EINT1 */
4916#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_WIDTH 1 /* DSP_SHARED_WR_COLL_EINT1 */
4917#define ARIZONA_SPK_SHUTDOWN_EINT1 0x4000 /* SPK_SHUTDOWN_EINT1 */
4918#define ARIZONA_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* SPK_SHUTDOWN_EINT1 */
4919#define ARIZONA_SPK_SHUTDOWN_EINT1_SHIFT 14 /* SPK_SHUTDOWN_EINT1 */
4920#define ARIZONA_SPK_SHUTDOWN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_EINT1 */
4921#define ARIZONA_SPK1R_SHORT_EINT1 0x2000 /* SPK1R_SHORT_EINT1 */
4922#define ARIZONA_SPK1R_SHORT_EINT1_MASK 0x2000 /* SPK1R_SHORT_EINT1 */
4923#define ARIZONA_SPK1R_SHORT_EINT1_SHIFT 13 /* SPK1R_SHORT_EINT1 */
4924#define ARIZONA_SPK1R_SHORT_EINT1_WIDTH 1 /* SPK1R_SHORT_EINT1 */
4925#define ARIZONA_SPK1L_SHORT_EINT1 0x1000 /* SPK1L_SHORT_EINT1 */
4926#define ARIZONA_SPK1L_SHORT_EINT1_MASK 0x1000 /* SPK1L_SHORT_EINT1 */
4927#define ARIZONA_SPK1L_SHORT_EINT1_SHIFT 12 /* SPK1L_SHORT_EINT1 */
4928#define ARIZONA_SPK1L_SHORT_EINT1_WIDTH 1 /* SPK1L_SHORT_EINT1 */
4929#define ARIZONA_HP3R_SC_NEG_EINT1 0x0800 /* HP3R_SC_NEG_EINT1 */
4930#define ARIZONA_HP3R_SC_NEG_EINT1_MASK 0x0800 /* HP3R_SC_NEG_EINT1 */
4931#define ARIZONA_HP3R_SC_NEG_EINT1_SHIFT 11 /* HP3R_SC_NEG_EINT1 */
4932#define ARIZONA_HP3R_SC_NEG_EINT1_WIDTH 1 /* HP3R_SC_NEG_EINT1 */
4933#define ARIZONA_HP3R_SC_POS_EINT1 0x0400 /* HP3R_SC_POS_EINT1 */
4934#define ARIZONA_HP3R_SC_POS_EINT1_MASK 0x0400 /* HP3R_SC_POS_EINT1 */
4935#define ARIZONA_HP3R_SC_POS_EINT1_SHIFT 10 /* HP3R_SC_POS_EINT1 */
4936#define ARIZONA_HP3R_SC_POS_EINT1_WIDTH 1 /* HP3R_SC_POS_EINT1 */
4937#define ARIZONA_HP3L_SC_NEG_EINT1 0x0200 /* HP3L_SC_NEG_EINT1 */
4938#define ARIZONA_HP3L_SC_NEG_EINT1_MASK 0x0200 /* HP3L_SC_NEG_EINT1 */
4939#define ARIZONA_HP3L_SC_NEG_EINT1_SHIFT 9 /* HP3L_SC_NEG_EINT1 */
4940#define ARIZONA_HP3L_SC_NEG_EINT1_WIDTH 1 /* HP3L_SC_NEG_EINT1 */
4941#define ARIZONA_HP3L_SC_POS_EINT1 0x0100 /* HP3L_SC_POS_EINT1 */
4942#define ARIZONA_HP3L_SC_POS_EINT1_MASK 0x0100 /* HP3L_SC_POS_EINT1 */
4943#define ARIZONA_HP3L_SC_POS_EINT1_SHIFT 8 /* HP3L_SC_POS_EINT1 */
4944#define ARIZONA_HP3L_SC_POS_EINT1_WIDTH 1 /* HP3L_SC_POS_EINT1 */
4945#define ARIZONA_HP2R_SC_NEG_EINT1 0x0080 /* HP2R_SC_NEG_EINT1 */
4946#define ARIZONA_HP2R_SC_NEG_EINT1_MASK 0x0080 /* HP2R_SC_NEG_EINT1 */
4947#define ARIZONA_HP2R_SC_NEG_EINT1_SHIFT 7 /* HP2R_SC_NEG_EINT1 */
4948#define ARIZONA_HP2R_SC_NEG_EINT1_WIDTH 1 /* HP2R_SC_NEG_EINT1 */
4949#define ARIZONA_HP2R_SC_POS_EINT1 0x0040 /* HP2R_SC_POS_EINT1 */
4950#define ARIZONA_HP2R_SC_POS_EINT1_MASK 0x0040 /* HP2R_SC_POS_EINT1 */
4951#define ARIZONA_HP2R_SC_POS_EINT1_SHIFT 6 /* HP2R_SC_POS_EINT1 */
4952#define ARIZONA_HP2R_SC_POS_EINT1_WIDTH 1 /* HP2R_SC_POS_EINT1 */
4953#define ARIZONA_HP2L_SC_NEG_EINT1 0x0020 /* HP2L_SC_NEG_EINT1 */
4954#define ARIZONA_HP2L_SC_NEG_EINT1_MASK 0x0020 /* HP2L_SC_NEG_EINT1 */
4955#define ARIZONA_HP2L_SC_NEG_EINT1_SHIFT 5 /* HP2L_SC_NEG_EINT1 */
4956#define ARIZONA_HP2L_SC_NEG_EINT1_WIDTH 1 /* HP2L_SC_NEG_EINT1 */
4957#define ARIZONA_HP2L_SC_POS_EINT1 0x0010 /* HP2L_SC_POS_EINT1 */
4958#define ARIZONA_HP2L_SC_POS_EINT1_MASK 0x0010 /* HP2L_SC_POS_EINT1 */
4959#define ARIZONA_HP2L_SC_POS_EINT1_SHIFT 4 /* HP2L_SC_POS_EINT1 */
4960#define ARIZONA_HP2L_SC_POS_EINT1_WIDTH 1 /* HP2L_SC_POS_EINT1 */
4961#define ARIZONA_HP1R_SC_NEG_EINT1 0x0008 /* HP1R_SC_NEG_EINT1 */
4962#define ARIZONA_HP1R_SC_NEG_EINT1_MASK 0x0008 /* HP1R_SC_NEG_EINT1 */
4963#define ARIZONA_HP1R_SC_NEG_EINT1_SHIFT 3 /* HP1R_SC_NEG_EINT1 */
4964#define ARIZONA_HP1R_SC_NEG_EINT1_WIDTH 1 /* HP1R_SC_NEG_EINT1 */
4965#define ARIZONA_HP1R_SC_POS_EINT1 0x0004 /* HP1R_SC_POS_EINT1 */
4966#define ARIZONA_HP1R_SC_POS_EINT1_MASK 0x0004 /* HP1R_SC_POS_EINT1 */
4967#define ARIZONA_HP1R_SC_POS_EINT1_SHIFT 2 /* HP1R_SC_POS_EINT1 */
4968#define ARIZONA_HP1R_SC_POS_EINT1_WIDTH 1 /* HP1R_SC_POS_EINT1 */
4969#define ARIZONA_HP1L_SC_NEG_EINT1 0x0002 /* HP1L_SC_NEG_EINT1 */
4970#define ARIZONA_HP1L_SC_NEG_EINT1_MASK 0x0002 /* HP1L_SC_NEG_EINT1 */
4971#define ARIZONA_HP1L_SC_NEG_EINT1_SHIFT 1 /* HP1L_SC_NEG_EINT1 */
4972#define ARIZONA_HP1L_SC_NEG_EINT1_WIDTH 1 /* HP1L_SC_NEG_EINT1 */
4973#define ARIZONA_HP1L_SC_POS_EINT1 0x0001 /* HP1L_SC_POS_EINT1 */
4974#define ARIZONA_HP1L_SC_POS_EINT1_MASK 0x0001 /* HP1L_SC_POS_EINT1 */
4975#define ARIZONA_HP1L_SC_POS_EINT1_SHIFT 0 /* HP1L_SC_POS_EINT1 */
4976#define ARIZONA_HP1L_SC_POS_EINT1_WIDTH 1 /* HP1L_SC_POS_EINT1 */
4977
4978/*
4824 * R3336 (0xD08) - Interrupt Status 1 Mask 4979 * R3336 (0xD08) - Interrupt Status 1 Mask
4825 */ 4980 */
4826#define ARIZONA_IM_GP4_EINT1 0x0008 /* IM_GP4_EINT1 */ 4981#define ARIZONA_IM_GP4_EINT1 0x0008 /* IM_GP4_EINT1 */
@@ -4859,14 +5014,14 @@
4859/* 5014/*
4860 * R3338 (0xD0A) - Interrupt Status 3 Mask 5015 * R3338 (0xD0A) - Interrupt Status 3 Mask
4861 */ 5016 */
4862#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5017#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4863#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_MASK 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5018#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_MASK 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4864#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_SHIFT 15 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5019#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_SHIFT 15 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4865#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5020#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_WIDTH 1 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4866#define ARIZONA_IM_SPK_SHUTDOWN_EINT1 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */ 5021#define ARIZONA_IM_SPK_OVERHEAT_EINT1 0x4000 /* IM_SPK_OVERHEAT_EINT1 */
4867#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */ 5022#define ARIZONA_IM_SPK_OVERHEAT_EINT1_MASK 0x4000 /* IM_SPK_OVERHEAT_EINT1 */
4868#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT1 */ 5023#define ARIZONA_IM_SPK_OVERHEAT_EINT1_SHIFT 14 /* IM_SPK_OVERHEAT_EINT1 */
4869#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT1 */ 5024#define ARIZONA_IM_SPK_OVERHEAT_EINT1_WIDTH 1 /* IM_SPK_OVERHEAT_EINT1 */
4870#define ARIZONA_IM_HPDET_EINT1 0x2000 /* IM_HPDET_EINT1 */ 5025#define ARIZONA_IM_HPDET_EINT1 0x2000 /* IM_HPDET_EINT1 */
4871#define ARIZONA_IM_HPDET_EINT1_MASK 0x2000 /* IM_HPDET_EINT1 */ 5026#define ARIZONA_IM_HPDET_EINT1_MASK 0x2000 /* IM_HPDET_EINT1 */
4872#define ARIZONA_IM_HPDET_EINT1_SHIFT 13 /* IM_HPDET_EINT1 */ 5027#define ARIZONA_IM_HPDET_EINT1_SHIFT 13 /* IM_HPDET_EINT1 */
@@ -4963,6 +5118,77 @@
4963#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT1 */ 5118#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT1 */
4964#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT1 */ 5119#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT1 */
4965#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */ 5120#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */
5121#define ARIZONA_IM_HP3R_DONE_EINT1 0x0020 /* IM_HP3R_DONE_EINT1 */
5122#define ARIZONA_IM_HP3R_DONE_EINT1_MASK 0x0020 /* IM_HP3R_DONE_EINT1 */
5123#define ARIZONA_IM_HP3R_DONE_EINT1_SHIFT 5 /* IM_HP3R_DONE_EINT1 */
5124#define ARIZONA_IM_HP3R_DONE_EINT1_WIDTH 1 /* IM_HP3R_DONE_EINT1 */
5125#define ARIZONA_IM_HP3L_DONE_EINT1 0x0010 /* IM_HP3L_DONE_EINT1 */
5126#define ARIZONA_IM_HP3L_DONE_EINT1_MASK 0x0010 /* IM_HP3L_DONE_EINT1 */
5127#define ARIZONA_IM_HP3L_DONE_EINT1_SHIFT 4 /* IM_HP3L_DONE_EINT1 */
5128#define ARIZONA_IM_HP3L_DONE_EINT1_WIDTH 1 /* IM_HP3L_DONE_EINT1 */
5129#define ARIZONA_IM_HP2R_DONE_EINT1 0x0008 /* IM_HP2R_DONE_EINT1 */
5130#define ARIZONA_IM_HP2R_DONE_EINT1_MASK 0x0008 /* IM_HP2R_DONE_EINT1 */
5131#define ARIZONA_IM_HP2R_DONE_EINT1_SHIFT 3 /* IM_HP2R_DONE_EINT1 */
5132#define ARIZONA_IM_HP2R_DONE_EINT1_WIDTH 1 /* IM_HP2R_DONE_EINT1 */
5133#define ARIZONA_IM_HP2L_DONE_EINT1 0x0004 /* IM_HP2L_DONE_EINT1 */
5134#define ARIZONA_IM_HP2L_DONE_EINT1_MASK 0x0004 /* IM_HP2L_DONE_EINT1 */
5135#define ARIZONA_IM_HP2L_DONE_EINT1_SHIFT 2 /* IM_HP2L_DONE_EINT1 */
5136#define ARIZONA_IM_HP2L_DONE_EINT1_WIDTH 1 /* IM_HP2L_DONE_EINT1 */
5137#define ARIZONA_IM_HP1R_DONE_EINT1 0x0002 /* IM_HP1R_DONE_EINT1 */
5138#define ARIZONA_IM_HP1R_DONE_EINT1_MASK 0x0002 /* IM_HP1R_DONE_EINT1 */
5139#define ARIZONA_IM_HP1R_DONE_EINT1_SHIFT 1 /* IM_HP1R_DONE_EINT1 */
5140#define ARIZONA_IM_HP1R_DONE_EINT1_WIDTH 1 /* IM_HP1R_DONE_EINT1 */
5141#define ARIZONA_IM_HP1L_DONE_EINT1 0x0001 /* IM_HP1L_DONE_EINT1 */
5142#define ARIZONA_IM_HP1L_DONE_EINT1_MASK 0x0001 /* IM_HP1L_DONE_EINT1 */
5143#define ARIZONA_IM_HP1L_DONE_EINT1_SHIFT 0 /* IM_HP1L_DONE_EINT1 */
5144#define ARIZONA_IM_HP1L_DONE_EINT1_WIDTH 1 /* IM_HP1L_DONE_EINT1 */
5145
5146/*
5147 * R3339 (0xD0B) - Interrupt Status 4 Mask (Alternate layout)
5148 *
5149 * Alternate layout used on later devices, note only fields that have moved
5150 * are specified
5151 */
5152#define ARIZONA_V2_IM_AIF3_ERR_EINT1 0x8000 /* IM_AIF3_ERR_EINT1 */
5153#define ARIZONA_V2_IM_AIF3_ERR_EINT1_MASK 0x8000 /* IM_AIF3_ERR_EINT1 */
5154#define ARIZONA_V2_IM_AIF3_ERR_EINT1_SHIFT 15 /* IM_AIF3_ERR_EINT1 */
5155#define ARIZONA_V2_IM_AIF3_ERR_EINT1_WIDTH 1 /* IM_AIF3_ERR_EINT1 */
5156#define ARIZONA_V2_IM_AIF2_ERR_EINT1 0x4000 /* IM_AIF2_ERR_EINT1 */
5157#define ARIZONA_V2_IM_AIF2_ERR_EINT1_MASK 0x4000 /* IM_AIF2_ERR_EINT1 */
5158#define ARIZONA_V2_IM_AIF2_ERR_EINT1_SHIFT 14 /* IM_AIF2_ERR_EINT1 */
5159#define ARIZONA_V2_IM_AIF2_ERR_EINT1_WIDTH 1 /* IM_AIF2_ERR_EINT1 */
5160#define ARIZONA_V2_IM_AIF1_ERR_EINT1 0x2000 /* IM_AIF1_ERR_EINT1 */
5161#define ARIZONA_V2_IM_AIF1_ERR_EINT1_MASK 0x2000 /* IM_AIF1_ERR_EINT1 */
5162#define ARIZONA_V2_IM_AIF1_ERR_EINT1_SHIFT 13 /* IM_AIF1_ERR_EINT1 */
5163#define ARIZONA_V2_IM_AIF1_ERR_EINT1_WIDTH 1 /* IM_AIF1_ERR_EINT1 */
5164#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1 0x1000 /* IM_CTRLIF_ERR_EINT1 */
5165#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_MASK 0x1000 /* IM_CTRLIF_ERR_EINT1 */
5166#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_SHIFT 12 /* IM_CTRLIF_ERR_EINT1 */
5167#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_WIDTH 1 /* IM_CTRLIF_ERR_EINT1 */
5168#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5169#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_MASK 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5170#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_SHIFT 11 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5171#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_WIDTH 1 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5172#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5173#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_MASK 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5174#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_SHIFT 10 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5175#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_WIDTH 1 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5176#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1 0x0200 /* IM_SYSCLK_ENA_LOW_EINT1 */
5177#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_MASK 0x0200 /* IM_SYSCLK_ENA_LOW_EINT1 */
5178#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_SHIFT 9 /* IM_SYSCLK_ENA_LOW_EINT1 */
5179#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_WIDTH 1 /* IM_SYSCLK_ENA_LOW_EINT1 */
5180#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1 0x0100 /* IM_ISRC1_CFG_ERR_EINT1 */
5181#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_MASK 0x0100 /* IM_ISRC1_CFG_ERR_EINT1 */
5182#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_SHIFT 8 /* IM_ISRC1_CFG_ERR_EINT1 */
5183#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC1_CFG_ERR_EINT1 */
5184#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1 0x0080 /* IM_ISRC2_CFG_ERR_EINT1 */
5185#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0080 /* IM_ISRC2_CFG_ERR_EINT1 */
5186#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_SHIFT 7 /* IM_ISRC2_CFG_ERR_EINT1 */
5187#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */
5188#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1 0x0040 /* IM_ISRC3_CFG_ERR_EINT1 */
5189#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC3_CFG_ERR_EINT1 */
5190#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC3_CFG_ERR_EINT1 */
5191#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC3_CFG_ERR_EINT1 */
4966 5192
4967/* 5193/*
4968 * R3340 (0xD0C) - Interrupt Status 5 Mask 5194 * R3340 (0xD0C) - Interrupt Status 5 Mask
@@ -4989,6 +5215,85 @@
4989#define ARIZONA_IM_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT1 */ 5215#define ARIZONA_IM_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT1 */
4990 5216
4991/* 5217/*
5218 * R3340 (0xD0C) - Interrupt Status 5 Mask (Alternate layout)
5219 *
5220 * Alternate layout used on later devices, note only fields that have moved
5221 * are specified
5222 */
5223#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1 0x0008 /* IM_ASRC_CFG_ERR_EINT1 */
5224#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_MASK 0x0008 /* IM_ASRC_CFG_ERR_EINT1 */
5225#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_SHIFT 3 /* IM_ASRC_CFG_ERR_EINT1 */
5226#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_WIDTH 1 /* IM_ASRC_CFG_ERR_EINT1 */
5227
5228/*
5229 * R3341 (0xD0D) - Interrupt Status 6 Mask
5230 */
5231#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5232#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_MASK 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5233#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_SHIFT 15 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5234#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_WIDTH 1 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5235#define ARIZONA_IM_SPK_SHUTDOWN_EINT1 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */
5236#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */
5237#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT1 */
5238#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT1 */
5239#define ARIZONA_IM_SPK1R_SHORT_EINT1 0x2000 /* IM_SPK1R_SHORT_EINT1 */
5240#define ARIZONA_IM_SPK1R_SHORT_EINT1_MASK 0x2000 /* IM_SPK1R_SHORT_EINT1 */
5241#define ARIZONA_IM_SPK1R_SHORT_EINT1_SHIFT 13 /* IM_SPK1R_SHORT_EINT1 */
5242#define ARIZONA_IM_SPK1R_SHORT_EINT1_WIDTH 1 /* IM_SPK1R_SHORT_EINT1 */
5243#define ARIZONA_IM_SPK1L_SHORT_EINT1 0x1000 /* IM_SPK1L_SHORT_EINT1 */
5244#define ARIZONA_IM_SPK1L_SHORT_EINT1_MASK 0x1000 /* IM_SPK1L_SHORT_EINT1 */
5245#define ARIZONA_IM_SPK1L_SHORT_EINT1_SHIFT 12 /* IM_SPK1L_SHORT_EINT1 */
5246#define ARIZONA_IM_SPK1L_SHORT_EINT1_WIDTH 1 /* IM_SPK1L_SHORT_EINT1 */
5247#define ARIZONA_IM_HP3R_SC_NEG_EINT1 0x0800 /* IM_HP3R_SC_NEG_EINT1 */
5248#define ARIZONA_IM_HP3R_SC_NEG_EINT1_MASK 0x0800 /* IM_HP3R_SC_NEG_EINT1 */
5249#define ARIZONA_IM_HP3R_SC_NEG_EINT1_SHIFT 11 /* IM_HP3R_SC_NEG_EINT1 */
5250#define ARIZONA_IM_HP3R_SC_NEG_EINT1_WIDTH 1 /* IM_HP3R_SC_NEG_EINT1 */
5251#define ARIZONA_IM_HP3R_SC_POS_EINT1 0x0400 /* IM_HP3R_SC_POS_EINT1 */
5252#define ARIZONA_IM_HP3R_SC_POS_EINT1_MASK 0x0400 /* IM_HP3R_SC_POS_EINT1 */
5253#define ARIZONA_IM_HP3R_SC_POS_EINT1_SHIFT 10 /* IM_HP3R_SC_POS_EINT1 */
5254#define ARIZONA_IM_HP3R_SC_POS_EINT1_WIDTH 1 /* IM_HP3R_SC_POS_EINT1 */
5255#define ARIZONA_IM_HP3L_SC_NEG_EINT1 0x0200 /* IM_HP3L_SC_NEG_EINT1 */
5256#define ARIZONA_IM_HP3L_SC_NEG_EINT1_MASK 0x0200 /* IM_HP3L_SC_NEG_EINT1 */
5257#define ARIZONA_IM_HP3L_SC_NEG_EINT1_SHIFT 9 /* IM_HP3L_SC_NEG_EINT1 */
5258#define ARIZONA_IM_HP3L_SC_NEG_EINT1_WIDTH 1 /* IM_HP3L_SC_NEG_EINT1 */
5259#define ARIZONA_IM_HP3L_SC_POS_EINT1 0x0100 /* IM_HP3L_SC_POS_EINT1 */
5260#define ARIZONA_IM_HP3L_SC_POS_EINT1_MASK 0x0100 /* IM_HP3L_SC_POS_EINT1 */
5261#define ARIZONA_IM_HP3L_SC_POS_EINT1_SHIFT 8 /* IM_HP3L_SC_POS_EINT1 */
5262#define ARIZONA_IM_HP3L_SC_POS_EINT1_WIDTH 1 /* IM_HP3L_SC_POS_EINT1 */
5263#define ARIZONA_IM_HP2R_SC_NEG_EINT1 0x0080 /* IM_HP2R_SC_NEG_EINT1 */
5264#define ARIZONA_IM_HP2R_SC_NEG_EINT1_MASK 0x0080 /* IM_HP2R_SC_NEG_EINT1 */
5265#define ARIZONA_IM_HP2R_SC_NEG_EINT1_SHIFT 7 /* IM_HP2R_SC_NEG_EINT1 */
5266#define ARIZONA_IM_HP2R_SC_NEG_EINT1_WIDTH 1 /* IM_HP2R_SC_NEG_EINT1 */
5267#define ARIZONA_IM_HP2R_SC_POS_EINT1 0x0040 /* IM_HP2R_SC_POS_EINT1 */
5268#define ARIZONA_IM_HP2R_SC_POS_EINT1_MASK 0x0040 /* IM_HP2R_SC_POS_EINT1 */
5269#define ARIZONA_IM_HP2R_SC_POS_EINT1_SHIFT 6 /* IM_HP2R_SC_POS_EINT1 */
5270#define ARIZONA_IM_HP2R_SC_POS_EINT1_WIDTH 1 /* IM_HP2R_SC_POS_EINT1 */
5271#define ARIZONA_IM_HP2L_SC_NEG_EINT1 0x0020 /* IM_HP2L_SC_NEG_EINT1 */
5272#define ARIZONA_IM_HP2L_SC_NEG_EINT1_MASK 0x0020 /* IM_HP2L_SC_NEG_EINT1 */
5273#define ARIZONA_IM_HP2L_SC_NEG_EINT1_SHIFT 5 /* IM_HP2L_SC_NEG_EINT1 */
5274#define ARIZONA_IM_HP2L_SC_NEG_EINT1_WIDTH 1 /* IM_HP2L_SC_NEG_EINT1 */
5275#define ARIZONA_IM_HP2L_SC_POS_EINT1 0x0010 /* IM_HP2L_SC_POS_EINT1 */
5276#define ARIZONA_IM_HP2L_SC_POS_EINT1_MASK 0x0010 /* IM_HP2L_SC_POS_EINT1 */
5277#define ARIZONA_IM_HP2L_SC_POS_EINT1_SHIFT 4 /* IM_HP2L_SC_POS_EINT1 */
5278#define ARIZONA_IM_HP2L_SC_POS_EINT1_WIDTH 1 /* IM_HP2L_SC_POS_EINT1 */
5279#define ARIZONA_IM_HP1R_SC_NEG_EINT1 0x0008 /* IM_HP1R_SC_NEG_EINT1 */
5280#define ARIZONA_IM_HP1R_SC_NEG_EINT1_MASK 0x0008 /* IM_HP1R_SC_NEG_EINT1 */
5281#define ARIZONA_IM_HP1R_SC_NEG_EINT1_SHIFT 3 /* IM_HP1R_SC_NEG_EINT1 */
5282#define ARIZONA_IM_HP1R_SC_NEG_EINT1_WIDTH 1 /* IM_HP1R_SC_NEG_EINT1 */
5283#define ARIZONA_IM_HP1R_SC_POS_EINT1 0x0004 /* IM_HP1R_SC_POS_EINT1 */
5284#define ARIZONA_IM_HP1R_SC_POS_EINT1_MASK 0x0004 /* IM_HP1R_SC_POS_EINT1 */
5285#define ARIZONA_IM_HP1R_SC_POS_EINT1_SHIFT 2 /* IM_HP1R_SC_POS_EINT1 */
5286#define ARIZONA_IM_HP1R_SC_POS_EINT1_WIDTH 1 /* IM_HP1R_SC_POS_EINT1 */
5287#define ARIZONA_IM_HP1L_SC_NEG_EINT1 0x0002 /* IM_HP1L_SC_NEG_EINT1 */
5288#define ARIZONA_IM_HP1L_SC_NEG_EINT1_MASK 0x0002 /* IM_HP1L_SC_NEG_EINT1 */
5289#define ARIZONA_IM_HP1L_SC_NEG_EINT1_SHIFT 1 /* IM_HP1L_SC_NEG_EINT1 */
5290#define ARIZONA_IM_HP1L_SC_NEG_EINT1_WIDTH 1 /* IM_HP1L_SC_NEG_EINT1 */
5291#define ARIZONA_IM_HP1L_SC_POS_EINT1 0x0001 /* IM_HP1L_SC_POS_EINT1 */
5292#define ARIZONA_IM_HP1L_SC_POS_EINT1_MASK 0x0001 /* IM_HP1L_SC_POS_EINT1 */
5293#define ARIZONA_IM_HP1L_SC_POS_EINT1_SHIFT 0 /* IM_HP1L_SC_POS_EINT1 */
5294#define ARIZONA_IM_HP1L_SC_POS_EINT1_WIDTH 1 /* IM_HP1L_SC_POS_EINT1 */
5295
5296/*
4992 * R3343 (0xD0F) - Interrupt Control 5297 * R3343 (0xD0F) - Interrupt Control
4993 */ 5298 */
4994#define ARIZONA_IM_IRQ1 0x0001 /* IM_IRQ1 */ 5299#define ARIZONA_IM_IRQ1 0x0001 /* IM_IRQ1 */
@@ -5035,14 +5340,14 @@
5035/* 5340/*
5036 * R3346 (0xD12) - IRQ2 Status 3 5341 * R3346 (0xD12) - IRQ2 Status 3
5037 */ 5342 */
5038#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2 0x8000 /* SPK_SHUTDOWN_WARN_EINT2 */ 5343#define ARIZONA_SPK_OVERHEAT_WARN_EINT2 0x8000 /* SPK_OVERHEAT_WARN_EINT2 */
5039#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_MASK 0x8000 /* SPK_SHUTDOWN_WARN_EINT2 */ 5344#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_MASK 0x8000 /* SPK_OVERHEAT_WARN_EINT2 */
5040#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_SHIFT 15 /* SPK_SHUTDOWN_WARN_EINT2 */ 5345#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_SHIFT 15 /* SPK_OVERHEAT_WARN_EINT2 */
5041#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_WARN_EINT2 */ 5346#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_WIDTH 1 /* SPK_OVERHEAT_WARN_EINT2 */
5042#define ARIZONA_SPK_SHUTDOWN_EINT2 0x4000 /* SPK_SHUTDOWN_EINT2 */ 5347#define ARIZONA_SPK_OVERHEAT_EINT2 0x4000 /* SPK_OVERHEAT_EINT2 */
5043#define ARIZONA_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* SPK_SHUTDOWN_EINT2 */ 5348#define ARIZONA_SPK_OVERHEAT_EINT2_MASK 0x4000 /* SPK_OVERHEAT_EINT2 */
5044#define ARIZONA_SPK_SHUTDOWN_EINT2_SHIFT 14 /* SPK_SHUTDOWN_EINT2 */ 5349#define ARIZONA_SPK_OVERHEAT_EINT2_SHIFT 14 /* SPK_OVERHEAT_EINT2 */
5045#define ARIZONA_SPK_SHUTDOWN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_EINT2 */ 5350#define ARIZONA_SPK_OVERHEAT_EINT2_WIDTH 1 /* SPK_OVERHEAT_EINT2 */
5046#define ARIZONA_HPDET_EINT2 0x2000 /* HPDET_EINT2 */ 5351#define ARIZONA_HPDET_EINT2 0x2000 /* HPDET_EINT2 */
5047#define ARIZONA_HPDET_EINT2_MASK 0x2000 /* HPDET_EINT2 */ 5352#define ARIZONA_HPDET_EINT2_MASK 0x2000 /* HPDET_EINT2 */
5048#define ARIZONA_HPDET_EINT2_SHIFT 13 /* HPDET_EINT2 */ 5353#define ARIZONA_HPDET_EINT2_SHIFT 13 /* HPDET_EINT2 */
@@ -5139,6 +5444,77 @@
5139#define ARIZONA_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* ISRC2_CFG_ERR_EINT2 */ 5444#define ARIZONA_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* ISRC2_CFG_ERR_EINT2 */
5140#define ARIZONA_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* ISRC2_CFG_ERR_EINT2 */ 5445#define ARIZONA_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* ISRC2_CFG_ERR_EINT2 */
5141#define ARIZONA_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */ 5446#define ARIZONA_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */
5447#define ARIZONA_HP3R_DONE_EINT2 0x0020 /* HP3R_DONE_EINT2 */
5448#define ARIZONA_HP3R_DONE_EINT2_MASK 0x0020 /* HP3R_DONE_EINT2 */
5449#define ARIZONA_HP3R_DONE_EINT2_SHIFT 5 /* HP3R_DONE_EINT2 */
5450#define ARIZONA_HP3R_DONE_EINT2_WIDTH 1 /* HP3R_DONE_EINT2 */
5451#define ARIZONA_HP3L_DONE_EINT2 0x0010 /* HP3L_DONE_EINT2 */
5452#define ARIZONA_HP3L_DONE_EINT2_MASK 0x0010 /* HP3L_DONE_EINT2 */
5453#define ARIZONA_HP3L_DONE_EINT2_SHIFT 4 /* HP3L_DONE_EINT2 */
5454#define ARIZONA_HP3L_DONE_EINT2_WIDTH 1 /* HP3L_DONE_EINT2 */
5455#define ARIZONA_HP2R_DONE_EINT2 0x0008 /* HP2R_DONE_EINT2 */
5456#define ARIZONA_HP2R_DONE_EINT2_MASK 0x0008 /* HP2R_DONE_EINT2 */
5457#define ARIZONA_HP2R_DONE_EINT2_SHIFT 3 /* HP2R_DONE_EINT2 */
5458#define ARIZONA_HP2R_DONE_EINT2_WIDTH 1 /* HP2R_DONE_EINT2 */
5459#define ARIZONA_HP2L_DONE_EINT2 0x0004 /* HP2L_DONE_EINT2 */
5460#define ARIZONA_HP2L_DONE_EINT2_MASK 0x0004 /* HP2L_DONE_EINT2 */
5461#define ARIZONA_HP2L_DONE_EINT2_SHIFT 2 /* HP2L_DONE_EINT2 */
5462#define ARIZONA_HP2L_DONE_EINT2_WIDTH 1 /* HP2L_DONE_EINT2 */
5463#define ARIZONA_HP1R_DONE_EINT2 0x0002 /* HP1R_DONE_EINT2 */
5464#define ARIZONA_HP1R_DONE_EINT2_MASK 0x0002 /* HP1R_DONE_EINT2 */
5465#define ARIZONA_HP1R_DONE_EINT2_SHIFT 1 /* HP1R_DONE_EINT2 */
5466#define ARIZONA_HP1R_DONE_EINT2_WIDTH 1 /* HP1R_DONE_EINT2 */
5467#define ARIZONA_HP1L_DONE_EINT2 0x0001 /* HP1L_DONE_EINT2 */
5468#define ARIZONA_HP1L_DONE_EINT2_MASK 0x0001 /* HP1L_DONE_EINT2 */
5469#define ARIZONA_HP1L_DONE_EINT2_SHIFT 0 /* HP1L_DONE_EINT2 */
5470#define ARIZONA_HP1L_DONE_EINT2_WIDTH 1 /* HP1L_DONE_EINT2 */
5471
5472/*
5473 * R3347 (0xD13) - IRQ2 Status 4 (Alternate layout)
5474 *
5475 * Alternate layout used on later devices, note only fields that have moved
5476 * are specified
5477 */
5478#define ARIZONA_V2_AIF3_ERR_EINT2 0x8000 /* AIF3_ERR_EINT2 */
5479#define ARIZONA_V2_AIF3_ERR_EINT2_MASK 0x8000 /* AIF3_ERR_EINT2 */
5480#define ARIZONA_V2_AIF3_ERR_EINT2_SHIFT 15 /* AIF3_ERR_EINT2 */
5481#define ARIZONA_V2_AIF3_ERR_EINT2_WIDTH 1 /* AIF3_ERR_EINT2 */
5482#define ARIZONA_V2_AIF2_ERR_EINT2 0x4000 /* AIF2_ERR_EINT2 */
5483#define ARIZONA_V2_AIF2_ERR_EINT2_MASK 0x4000 /* AIF2_ERR_EINT2 */
5484#define ARIZONA_V2_AIF2_ERR_EINT2_SHIFT 14 /* AIF2_ERR_EINT2 */
5485#define ARIZONA_V2_AIF2_ERR_EINT2_WIDTH 1 /* AIF2_ERR_EINT2 */
5486#define ARIZONA_V2_AIF1_ERR_EINT2 0x2000 /* AIF1_ERR_EINT2 */
5487#define ARIZONA_V2_AIF1_ERR_EINT2_MASK 0x2000 /* AIF1_ERR_EINT2 */
5488#define ARIZONA_V2_AIF1_ERR_EINT2_SHIFT 13 /* AIF1_ERR_EINT2 */
5489#define ARIZONA_V2_AIF1_ERR_EINT2_WIDTH 1 /* AIF1_ERR_EINT2 */
5490#define ARIZONA_V2_CTRLIF_ERR_EINT2 0x1000 /* CTRLIF_ERR_EINT2 */
5491#define ARIZONA_V2_CTRLIF_ERR_EINT2_MASK 0x1000 /* CTRLIF_ERR_EINT2 */
5492#define ARIZONA_V2_CTRLIF_ERR_EINT2_SHIFT 12 /* CTRLIF_ERR_EINT2 */
5493#define ARIZONA_V2_CTRLIF_ERR_EINT2_WIDTH 1 /* CTRLIF_ERR_EINT2 */
5494#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2 0x0800 /* MIXER_DROPPED_SAMPLE_EINT2 */
5495#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_MASK 0x0800 /* MIXER_DROPPED_SAMPLE_EINT2 */
5496#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_SHIFT 11 /* MIXER_DROPPED_SAMPLE_EINT2 */
5497#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_WIDTH 1 /* MIXER_DROPPED_SAMPLE_EINT2 */
5498#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2 0x0400 /* ASYNC_CLK_ENA_LOW_EINT2 */
5499#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_MASK 0x0400 /* ASYNC_CLK_ENA_LOW_EINT2 */
5500#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_SHIFT 10 /* ASYNC_CLK_ENA_LOW_EINT2 */
5501#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_WIDTH 1 /* ASYNC_CLK_ENA_LOW_EINT2 */
5502#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2 0x0200 /* SYSCLK_ENA_LOW_EINT2 */
5503#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_MASK 0x0200 /* SYSCLK_ENA_LOW_EINT2 */
5504#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_SHIFT 9 /* SYSCLK_ENA_LOW_EINT2 */
5505#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_WIDTH 1 /* SYSCLK_ENA_LOW_EINT2 */
5506#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2 0x0100 /* ISRC1_CFG_ERR_EINT2 */
5507#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_MASK 0x0100 /* ISRC1_CFG_ERR_EINT2 */
5508#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_SHIFT 8 /* ISRC1_CFG_ERR_EINT2 */
5509#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_WIDTH 1 /* ISRC1_CFG_ERR_EINT2 */
5510#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2 0x0080 /* ISRC2_CFG_ERR_EINT2 */
5511#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_MASK 0x0080 /* ISRC2_CFG_ERR_EINT2 */
5512#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_SHIFT 7 /* ISRC2_CFG_ERR_EINT2 */
5513#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */
5514#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2 0x0040 /* ISRC3_CFG_ERR_EINT2 */
5515#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_MASK 0x0040 /* ISRC3_CFG_ERR_EINT2 */
5516#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_SHIFT 6 /* ISRC3_CFG_ERR_EINT2 */
5517#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_WIDTH 1 /* ISRC3_CFG_ERR_EINT2 */
5142 5518
5143/* 5519/*
5144 * R3348 (0xD14) - IRQ2 Status 5 5520 * R3348 (0xD14) - IRQ2 Status 5
@@ -5165,6 +5541,85 @@
5165#define ARIZONA_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* FLL1_CLOCK_OK_EINT2 */ 5541#define ARIZONA_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* FLL1_CLOCK_OK_EINT2 */
5166 5542
5167/* 5543/*
5544 * R3348 (0xD14) - IRQ2 Status 5 (Alternate layout)
5545 *
5546 * Alternate layout used on later devices, note only fields that have moved
5547 * are specified
5548 */
5549#define ARIZONA_V2_ASRC_CFG_ERR_EINT2 0x0008 /* ASRC_CFG_ERR_EINT2 */
5550#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_MASK 0x0008 /* ASRC_CFG_ERR_EINT2 */
5551#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_SHIFT 3 /* ASRC_CFG_ERR_EINT2 */
5552#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_WIDTH 1 /* ASRC_CFG_ERR_EINT2 */
5553
5554/*
5555 * R3349 (0xD15) - IRQ2 Status 6
5556 */
5557#define ARIZONA_DSP_SHARED_WR_COLL_EINT2 0x8000 /* DSP_SHARED_WR_COLL_EINT2 */
5558#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_MASK 0x8000 /* DSP_SHARED_WR_COLL_EINT2 */
5559#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_SHIFT 15 /* DSP_SHARED_WR_COLL_EINT2 */
5560#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_WIDTH 1 /* DSP_SHARED_WR_COLL_EINT2 */
5561#define ARIZONA_SPK_SHUTDOWN_EINT2 0x4000 /* SPK_SHUTDOWN_EINT2 */
5562#define ARIZONA_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* SPK_SHUTDOWN_EINT2 */
5563#define ARIZONA_SPK_SHUTDOWN_EINT2_SHIFT 14 /* SPK_SHUTDOWN_EINT2 */
5564#define ARIZONA_SPK_SHUTDOWN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_EINT2 */
5565#define ARIZONA_SPK1R_SHORT_EINT2 0x2000 /* SPK1R_SHORT_EINT2 */
5566#define ARIZONA_SPK1R_SHORT_EINT2_MASK 0x2000 /* SPK1R_SHORT_EINT2 */
5567#define ARIZONA_SPK1R_SHORT_EINT2_SHIFT 13 /* SPK1R_SHORT_EINT2 */
5568#define ARIZONA_SPK1R_SHORT_EINT2_WIDTH 1 /* SPK1R_SHORT_EINT2 */
5569#define ARIZONA_SPK1L_SHORT_EINT2 0x1000 /* SPK1L_SHORT_EINT2 */
5570#define ARIZONA_SPK1L_SHORT_EINT2_MASK 0x1000 /* SPK1L_SHORT_EINT2 */
5571#define ARIZONA_SPK1L_SHORT_EINT2_SHIFT 12 /* SPK1L_SHORT_EINT2 */
5572#define ARIZONA_SPK1L_SHORT_EINT2_WIDTH 1 /* SPK1L_SHORT_EINT2 */
5573#define ARIZONA_HP3R_SC_NEG_EINT2 0x0800 /* HP3R_SC_NEG_EINT2 */
5574#define ARIZONA_HP3R_SC_NEG_EINT2_MASK 0x0800 /* HP3R_SC_NEG_EINT2 */
5575#define ARIZONA_HP3R_SC_NEG_EINT2_SHIFT 11 /* HP3R_SC_NEG_EINT2 */
5576#define ARIZONA_HP3R_SC_NEG_EINT2_WIDTH 1 /* HP3R_SC_NEG_EINT2 */
5577#define ARIZONA_HP3R_SC_POS_EINT2 0x0400 /* HP3R_SC_POS_EINT2 */
5578#define ARIZONA_HP3R_SC_POS_EINT2_MASK 0x0400 /* HP3R_SC_POS_EINT2 */
5579#define ARIZONA_HP3R_SC_POS_EINT2_SHIFT 10 /* HP3R_SC_POS_EINT2 */
5580#define ARIZONA_HP3R_SC_POS_EINT2_WIDTH 1 /* HP3R_SC_POS_EINT2 */
5581#define ARIZONA_HP3L_SC_NEG_EINT2 0x0200 /* HP3L_SC_NEG_EINT2 */
5582#define ARIZONA_HP3L_SC_NEG_EINT2_MASK 0x0200 /* HP3L_SC_NEG_EINT2 */
5583#define ARIZONA_HP3L_SC_NEG_EINT2_SHIFT 9 /* HP3L_SC_NEG_EINT2 */
5584#define ARIZONA_HP3L_SC_NEG_EINT2_WIDTH 1 /* HP3L_SC_NEG_EINT2 */
5585#define ARIZONA_HP3L_SC_POS_EINT2 0x0100 /* HP3L_SC_POS_EINT2 */
5586#define ARIZONA_HP3L_SC_POS_EINT2_MASK 0x0100 /* HP3L_SC_POS_EINT2 */
5587#define ARIZONA_HP3L_SC_POS_EINT2_SHIFT 8 /* HP3L_SC_POS_EINT2 */
5588#define ARIZONA_HP3L_SC_POS_EINT2_WIDTH 1 /* HP3L_SC_POS_EINT2 */
5589#define ARIZONA_HP2R_SC_NEG_EINT2 0x0080 /* HP2R_SC_NEG_EINT2 */
5590#define ARIZONA_HP2R_SC_NEG_EINT2_MASK 0x0080 /* HP2R_SC_NEG_EINT2 */
5591#define ARIZONA_HP2R_SC_NEG_EINT2_SHIFT 7 /* HP2R_SC_NEG_EINT2 */
5592#define ARIZONA_HP2R_SC_NEG_EINT2_WIDTH 1 /* HP2R_SC_NEG_EINT2 */
5593#define ARIZONA_HP2R_SC_POS_EINT2 0x0040 /* HP2R_SC_POS_EINT2 */
5594#define ARIZONA_HP2R_SC_POS_EINT2_MASK 0x0040 /* HP2R_SC_POS_EINT2 */
5595#define ARIZONA_HP2R_SC_POS_EINT2_SHIFT 6 /* HP2R_SC_POS_EINT2 */
5596#define ARIZONA_HP2R_SC_POS_EINT2_WIDTH 1 /* HP2R_SC_POS_EINT2 */
5597#define ARIZONA_HP2L_SC_NEG_EINT2 0x0020 /* HP2L_SC_NEG_EINT2 */
5598#define ARIZONA_HP2L_SC_NEG_EINT2_MASK 0x0020 /* HP2L_SC_NEG_EINT2 */
5599#define ARIZONA_HP2L_SC_NEG_EINT2_SHIFT 5 /* HP2L_SC_NEG_EINT2 */
5600#define ARIZONA_HP2L_SC_NEG_EINT2_WIDTH 1 /* HP2L_SC_NEG_EINT2 */
5601#define ARIZONA_HP2L_SC_POS_EINT2 0x0010 /* HP2L_SC_POS_EINT2 */
5602#define ARIZONA_HP2L_SC_POS_EINT2_MASK 0x0010 /* HP2L_SC_POS_EINT2 */
5603#define ARIZONA_HP2L_SC_POS_EINT2_SHIFT 4 /* HP2L_SC_POS_EINT2 */
5604#define ARIZONA_HP2L_SC_POS_EINT2_WIDTH 1 /* HP2L_SC_POS_EINT2 */
5605#define ARIZONA_HP1R_SC_NEG_EINT2 0x0008 /* HP1R_SC_NEG_EINT2 */
5606#define ARIZONA_HP1R_SC_NEG_EINT2_MASK 0x0008 /* HP1R_SC_NEG_EINT2 */
5607#define ARIZONA_HP1R_SC_NEG_EINT2_SHIFT 3 /* HP1R_SC_NEG_EINT2 */
5608#define ARIZONA_HP1R_SC_NEG_EINT2_WIDTH 1 /* HP1R_SC_NEG_EINT2 */
5609#define ARIZONA_HP1R_SC_POS_EINT2 0x0004 /* HP1R_SC_POS_EINT2 */
5610#define ARIZONA_HP1R_SC_POS_EINT2_MASK 0x0004 /* HP1R_SC_POS_EINT2 */
5611#define ARIZONA_HP1R_SC_POS_EINT2_SHIFT 2 /* HP1R_SC_POS_EINT2 */
5612#define ARIZONA_HP1R_SC_POS_EINT2_WIDTH 1 /* HP1R_SC_POS_EINT2 */
5613#define ARIZONA_HP1L_SC_NEG_EINT2 0x0002 /* HP1L_SC_NEG_EINT2 */
5614#define ARIZONA_HP1L_SC_NEG_EINT2_MASK 0x0002 /* HP1L_SC_NEG_EINT2 */
5615#define ARIZONA_HP1L_SC_NEG_EINT2_SHIFT 1 /* HP1L_SC_NEG_EINT2 */
5616#define ARIZONA_HP1L_SC_NEG_EINT2_WIDTH 1 /* HP1L_SC_NEG_EINT2 */
5617#define ARIZONA_HP1L_SC_POS_EINT2 0x0001 /* HP1L_SC_POS_EINT2 */
5618#define ARIZONA_HP1L_SC_POS_EINT2_MASK 0x0001 /* HP1L_SC_POS_EINT2 */
5619#define ARIZONA_HP1L_SC_POS_EINT2_SHIFT 0 /* HP1L_SC_POS_EINT2 */
5620#define ARIZONA_HP1L_SC_POS_EINT2_WIDTH 1 /* HP1L_SC_POS_EINT2 */
5621
5622/*
5168 * R3352 (0xD18) - IRQ2 Status 1 Mask 5623 * R3352 (0xD18) - IRQ2 Status 1 Mask
5169 */ 5624 */
5170#define ARIZONA_IM_GP4_EINT2 0x0008 /* IM_GP4_EINT2 */ 5625#define ARIZONA_IM_GP4_EINT2 0x0008 /* IM_GP4_EINT2 */
@@ -5203,14 +5658,14 @@
5203/* 5658/*
5204 * R3354 (0xD1A) - IRQ2 Status 3 Mask 5659 * R3354 (0xD1A) - IRQ2 Status 3 Mask
5205 */ 5660 */
5206#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5661#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5207#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_MASK 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5662#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_MASK 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5208#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_SHIFT 15 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5663#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_SHIFT 15 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5209#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5664#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_WIDTH 1 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5210#define ARIZONA_IM_SPK_SHUTDOWN_EINT2 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */ 5665#define ARIZONA_IM_SPK_OVERHEAT_EINT2 0x4000 /* IM_SPK_OVERHEAT_EINT2 */
5211#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */ 5666#define ARIZONA_IM_SPK_OVERHEAT_EINT2_MASK 0x4000 /* IM_SPK_OVERHEAT_EINT2 */
5212#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT2 */ 5667#define ARIZONA_IM_SPK_OVERHEAT_EINT2_SHIFT 14 /* IM_SPK_OVERHEAT_EINT2 */
5213#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT2 */ 5668#define ARIZONA_IM_SPK_OVERHEAT_EINT2_WIDTH 1 /* IM_SPK_OVERHEAT_EINT2 */
5214#define ARIZONA_IM_HPDET_EINT2 0x2000 /* IM_HPDET_EINT2 */ 5669#define ARIZONA_IM_HPDET_EINT2 0x2000 /* IM_HPDET_EINT2 */
5215#define ARIZONA_IM_HPDET_EINT2_MASK 0x2000 /* IM_HPDET_EINT2 */ 5670#define ARIZONA_IM_HPDET_EINT2_MASK 0x2000 /* IM_HPDET_EINT2 */
5216#define ARIZONA_IM_HPDET_EINT2_SHIFT 13 /* IM_HPDET_EINT2 */ 5671#define ARIZONA_IM_HPDET_EINT2_SHIFT 13 /* IM_HPDET_EINT2 */
@@ -5307,6 +5762,77 @@
5307#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT2 */ 5762#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT2 */
5308#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT2 */ 5763#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT2 */
5309#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */ 5764#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */
5765#define ARIZONA_IM_HP3R_DONE_EINT2 0x0020 /* IM_HP3R_DONE_EINT2 */
5766#define ARIZONA_IM_HP3R_DONE_EINT2_MASK 0x0020 /* IM_HP3R_DONE_EINT2 */
5767#define ARIZONA_IM_HP3R_DONE_EINT2_SHIFT 5 /* IM_HP3R_DONE_EINT2 */
5768#define ARIZONA_IM_HP3R_DONE_EINT2_WIDTH 1 /* IM_HP3R_DONE_EINT2 */
5769#define ARIZONA_IM_HP3L_DONE_EINT2 0x0010 /* IM_HP3L_DONE_EINT2 */
5770#define ARIZONA_IM_HP3L_DONE_EINT2_MASK 0x0010 /* IM_HP3L_DONE_EINT2 */
5771#define ARIZONA_IM_HP3L_DONE_EINT2_SHIFT 4 /* IM_HP3L_DONE_EINT2 */
5772#define ARIZONA_IM_HP3L_DONE_EINT2_WIDTH 1 /* IM_HP3L_DONE_EINT2 */
5773#define ARIZONA_IM_HP2R_DONE_EINT2 0x0008 /* IM_HP2R_DONE_EINT2 */
5774#define ARIZONA_IM_HP2R_DONE_EINT2_MASK 0x0008 /* IM_HP2R_DONE_EINT2 */
5775#define ARIZONA_IM_HP2R_DONE_EINT2_SHIFT 3 /* IM_HP2R_DONE_EINT2 */
5776#define ARIZONA_IM_HP2R_DONE_EINT2_WIDTH 1 /* IM_HP2R_DONE_EINT2 */
5777#define ARIZONA_IM_HP2L_DONE_EINT2 0x0004 /* IM_HP2L_DONE_EINT2 */
5778#define ARIZONA_IM_HP2L_DONE_EINT2_MASK 0x0004 /* IM_HP2L_DONE_EINT2 */
5779#define ARIZONA_IM_HP2L_DONE_EINT2_SHIFT 2 /* IM_HP2L_DONE_EINT2 */
5780#define ARIZONA_IM_HP2L_DONE_EINT2_WIDTH 1 /* IM_HP2L_DONE_EINT2 */
5781#define ARIZONA_IM_HP1R_DONE_EINT2 0x0002 /* IM_HP1R_DONE_EINT2 */
5782#define ARIZONA_IM_HP1R_DONE_EINT2_MASK 0x0002 /* IM_HP1R_DONE_EINT2 */
5783#define ARIZONA_IM_HP1R_DONE_EINT2_SHIFT 1 /* IM_HP1R_DONE_EINT2 */
5784#define ARIZONA_IM_HP1R_DONE_EINT2_WIDTH 1 /* IM_HP1R_DONE_EINT2 */
5785#define ARIZONA_IM_HP1L_DONE_EINT2 0x0001 /* IM_HP1L_DONE_EINT2 */
5786#define ARIZONA_IM_HP1L_DONE_EINT2_MASK 0x0001 /* IM_HP1L_DONE_EINT2 */
5787#define ARIZONA_IM_HP1L_DONE_EINT2_SHIFT 0 /* IM_HP1L_DONE_EINT2 */
5788#define ARIZONA_IM_HP1L_DONE_EINT2_WIDTH 1 /* IM_HP1L_DONE_EINT2 */
5789
5790/*
5791 * R3355 (0xD1B) - IRQ2 Status 4 Mask (Alternate layout)
5792 *
5793 * Alternate layout used on later devices, note only fields that have moved
5794 * are specified
5795 */
5796#define ARIZONA_V2_IM_AIF3_ERR_EINT2 0x8000 /* IM_AIF3_ERR_EINT2 */
5797#define ARIZONA_V2_IM_AIF3_ERR_EINT2_MASK 0x8000 /* IM_AIF3_ERR_EINT2 */
5798#define ARIZONA_V2_IM_AIF3_ERR_EINT2_SHIFT 15 /* IM_AIF3_ERR_EINT2 */
5799#define ARIZONA_V2_IM_AIF3_ERR_EINT2_WIDTH 1 /* IM_AIF3_ERR_EINT2 */
5800#define ARIZONA_V2_IM_AIF2_ERR_EINT2 0x4000 /* IM_AIF2_ERR_EINT2 */
5801#define ARIZONA_V2_IM_AIF2_ERR_EINT2_MASK 0x4000 /* IM_AIF2_ERR_EINT2 */
5802#define ARIZONA_V2_IM_AIF2_ERR_EINT2_SHIFT 14 /* IM_AIF2_ERR_EINT2 */
5803#define ARIZONA_V2_IM_AIF2_ERR_EINT2_WIDTH 1 /* IM_AIF2_ERR_EINT2 */
5804#define ARIZONA_V2_IM_AIF1_ERR_EINT2 0x2000 /* IM_AIF1_ERR_EINT2 */
5805#define ARIZONA_V2_IM_AIF1_ERR_EINT2_MASK 0x2000 /* IM_AIF1_ERR_EINT2 */
5806#define ARIZONA_V2_IM_AIF1_ERR_EINT2_SHIFT 13 /* IM_AIF1_ERR_EINT2 */
5807#define ARIZONA_V2_IM_AIF1_ERR_EINT2_WIDTH 1 /* IM_AIF1_ERR_EINT2 */
5808#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2 0x1000 /* IM_CTRLIF_ERR_EINT2 */
5809#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_MASK 0x1000 /* IM_CTRLIF_ERR_EINT2 */
5810#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_SHIFT 12 /* IM_CTRLIF_ERR_EINT2 */
5811#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_WIDTH 1 /* IM_CTRLIF_ERR_EINT2 */
5812#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5813#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_MASK 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5814#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_SHIFT 11 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5815#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_WIDTH 1 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5816#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5817#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_MASK 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5818#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_SHIFT 10 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5819#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_WIDTH 1 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5820#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2 0x0200 /* IM_SYSCLK_ENA_LOW_EINT2 */
5821#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_MASK 0x0200 /* IM_SYSCLK_ENA_LOW_EINT2 */
5822#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_SHIFT 9 /* IM_SYSCLK_ENA_LOW_EINT2 */
5823#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_WIDTH 1 /* IM_SYSCLK_ENA_LOW_EINT2 */
5824#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2 0x0100 /* IM_ISRC1_CFG_ERR_EINT2 */
5825#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_MASK 0x0100 /* IM_ISRC1_CFG_ERR_EINT2 */
5826#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_SHIFT 8 /* IM_ISRC1_CFG_ERR_EINT2 */
5827#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC1_CFG_ERR_EINT2 */
5828#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2 0x0080 /* IM_ISRC2_CFG_ERR_EINT2 */
5829#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0080 /* IM_ISRC2_CFG_ERR_EINT2 */
5830#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_SHIFT 7 /* IM_ISRC2_CFG_ERR_EINT2 */
5831#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */
5832#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2 0x0040 /* IM_ISRC3_CFG_ERR_EINT2 */
5833#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC3_CFG_ERR_EINT2 */
5834#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC3_CFG_ERR_EINT2 */
5835#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC3_CFG_ERR_EINT2 */
5310 5836
5311/* 5837/*
5312 * R3356 (0xD1C) - IRQ2 Status 5 Mask 5838 * R3356 (0xD1C) - IRQ2 Status 5 Mask
@@ -5334,6 +5860,85 @@
5334#define ARIZONA_IM_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT2 */ 5860#define ARIZONA_IM_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT2 */
5335 5861
5336/* 5862/*
5863 * R3340 (0xD0C) - Interrupt Status 5 Mask (Alternate layout)
5864 *
5865 * Alternate layout used on later devices, note only fields that have moved
5866 * are specified
5867 */
5868#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2 0x0008 /* IM_ASRC_CFG_ERR_EINT2 */
5869#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_MASK 0x0008 /* IM_ASRC_CFG_ERR_EINT2 */
5870#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_SHIFT 3 /* IM_ASRC_CFG_ERR_EINT2 */
5871#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_WIDTH 1 /* IM_ASRC_CFG_ERR_EINT2 */
5872
5873/*
5874 * R3357 (0xD1D) - IRQ2 Status 6 Mask
5875 */
5876#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5877#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_MASK 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5878#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_SHIFT 15 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5879#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_WIDTH 1 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5880#define ARIZONA_IM_SPK_SHUTDOWN_EINT2 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */
5881#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */
5882#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT2 */
5883#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT2 */
5884#define ARIZONA_IM_SPK1R_SHORT_EINT2 0x2000 /* IM_SPK1R_SHORT_EINT2 */
5885#define ARIZONA_IM_SPK1R_SHORT_EINT2_MASK 0x2000 /* IM_SPK1R_SHORT_EINT2 */
5886#define ARIZONA_IM_SPK1R_SHORT_EINT2_SHIFT 13 /* IM_SPK1R_SHORT_EINT2 */
5887#define ARIZONA_IM_SPK1R_SHORT_EINT2_WIDTH 1 /* IM_SPK1R_SHORT_EINT2 */
5888#define ARIZONA_IM_SPK1L_SHORT_EINT2 0x1000 /* IM_SPK1L_SHORT_EINT2 */
5889#define ARIZONA_IM_SPK1L_SHORT_EINT2_MASK 0x1000 /* IM_SPK1L_SHORT_EINT2 */
5890#define ARIZONA_IM_SPK1L_SHORT_EINT2_SHIFT 12 /* IM_SPK1L_SHORT_EINT2 */
5891#define ARIZONA_IM_SPK1L_SHORT_EINT2_WIDTH 1 /* IM_SPK1L_SHORT_EINT2 */
5892#define ARIZONA_IM_HP3R_SC_NEG_EINT2 0x0800 /* IM_HP3R_SC_NEG_EINT2 */
5893#define ARIZONA_IM_HP3R_SC_NEG_EINT2_MASK 0x0800 /* IM_HP3R_SC_NEG_EINT2 */
5894#define ARIZONA_IM_HP3R_SC_NEG_EINT2_SHIFT 11 /* IM_HP3R_SC_NEG_EINT2 */
5895#define ARIZONA_IM_HP3R_SC_NEG_EINT2_WIDTH 1 /* IM_HP3R_SC_NEG_EINT2 */
5896#define ARIZONA_IM_HP3R_SC_POS_EINT2 0x0400 /* IM_HP3R_SC_POS_EINT2 */
5897#define ARIZONA_IM_HP3R_SC_POS_EINT2_MASK 0x0400 /* IM_HP3R_SC_POS_EINT2 */
5898#define ARIZONA_IM_HP3R_SC_POS_EINT2_SHIFT 10 /* IM_HP3R_SC_POS_EINT2 */
5899#define ARIZONA_IM_HP3R_SC_POS_EINT2_WIDTH 1 /* IM_HP3R_SC_POS_EINT2 */
5900#define ARIZONA_IM_HP3L_SC_NEG_EINT2 0x0200 /* IM_HP3L_SC_NEG_EINT2 */
5901#define ARIZONA_IM_HP3L_SC_NEG_EINT2_MASK 0x0200 /* IM_HP3L_SC_NEG_EINT2 */
5902#define ARIZONA_IM_HP3L_SC_NEG_EINT2_SHIFT 9 /* IM_HP3L_SC_NEG_EINT2 */
5903#define ARIZONA_IM_HP3L_SC_NEG_EINT2_WIDTH 1 /* IM_HP3L_SC_NEG_EINT2 */
5904#define ARIZONA_IM_HP3L_SC_POS_EINT2 0x0100 /* IM_HP3L_SC_POS_EINT2 */
5905#define ARIZONA_IM_HP3L_SC_POS_EINT2_MASK 0x0100 /* IM_HP3L_SC_POS_EINT2 */
5906#define ARIZONA_IM_HP3L_SC_POS_EINT2_SHIFT 8 /* IM_HP3L_SC_POS_EINT2 */
5907#define ARIZONA_IM_HP3L_SC_POS_EINT2_WIDTH 1 /* IM_HP3L_SC_POS_EINT2 */
5908#define ARIZONA_IM_HP2R_SC_NEG_EINT2 0x0080 /* IM_HP2R_SC_NEG_EINT2 */
5909#define ARIZONA_IM_HP2R_SC_NEG_EINT2_MASK 0x0080 /* IM_HP2R_SC_NEG_EINT2 */
5910#define ARIZONA_IM_HP2R_SC_NEG_EINT2_SHIFT 7 /* IM_HP2R_SC_NEG_EINT2 */
5911#define ARIZONA_IM_HP2R_SC_NEG_EINT2_WIDTH 1 /* IM_HP2R_SC_NEG_EINT2 */
5912#define ARIZONA_IM_HP2R_SC_POS_EINT2 0x0040 /* IM_HP2R_SC_POS_EINT2 */
5913#define ARIZONA_IM_HP2R_SC_POS_EINT2_MASK 0x0040 /* IM_HP2R_SC_POS_EINT2 */
5914#define ARIZONA_IM_HP2R_SC_POS_EINT2_SHIFT 6 /* IM_HP2R_SC_POS_EINT2 */
5915#define ARIZONA_IM_HP2R_SC_POS_EINT2_WIDTH 1 /* IM_HP2R_SC_POS_EINT2 */
5916#define ARIZONA_IM_HP2L_SC_NEG_EINT2 0x0020 /* IM_HP2L_SC_NEG_EINT2 */
5917#define ARIZONA_IM_HP2L_SC_NEG_EINT2_MASK 0x0020 /* IM_HP2L_SC_NEG_EINT2 */
5918#define ARIZONA_IM_HP2L_SC_NEG_EINT2_SHIFT 5 /* IM_HP2L_SC_NEG_EINT2 */
5919#define ARIZONA_IM_HP2L_SC_NEG_EINT2_WIDTH 1 /* IM_HP2L_SC_NEG_EINT2 */
5920#define ARIZONA_IM_HP2L_SC_POS_EINT2 0x0010 /* IM_HP2L_SC_POS_EINT2 */
5921#define ARIZONA_IM_HP2L_SC_POS_EINT2_MASK 0x0010 /* IM_HP2L_SC_POS_EINT2 */
5922#define ARIZONA_IM_HP2L_SC_POS_EINT2_SHIFT 4 /* IM_HP2L_SC_POS_EINT2 */
5923#define ARIZONA_IM_HP2L_SC_POS_EINT2_WIDTH 1 /* IM_HP2L_SC_POS_EINT2 */
5924#define ARIZONA_IM_HP1R_SC_NEG_EINT2 0x0008 /* IM_HP1R_SC_NEG_EINT2 */
5925#define ARIZONA_IM_HP1R_SC_NEG_EINT2_MASK 0x0008 /* IM_HP1R_SC_NEG_EINT2 */
5926#define ARIZONA_IM_HP1R_SC_NEG_EINT2_SHIFT 3 /* IM_HP1R_SC_NEG_EINT2 */
5927#define ARIZONA_IM_HP1R_SC_NEG_EINT2_WIDTH 1 /* IM_HP1R_SC_NEG_EINT2 */
5928#define ARIZONA_IM_HP1R_SC_POS_EINT2 0x0004 /* IM_HP1R_SC_POS_EINT2 */
5929#define ARIZONA_IM_HP1R_SC_POS_EINT2_MASK 0x0004 /* IM_HP1R_SC_POS_EINT2 */
5930#define ARIZONA_IM_HP1R_SC_POS_EINT2_SHIFT 2 /* IM_HP1R_SC_POS_EINT2 */
5931#define ARIZONA_IM_HP1R_SC_POS_EINT2_WIDTH 1 /* IM_HP1R_SC_POS_EINT2 */
5932#define ARIZONA_IM_HP1L_SC_NEG_EINT2 0x0002 /* IM_HP1L_SC_NEG_EINT2 */
5933#define ARIZONA_IM_HP1L_SC_NEG_EINT2_MASK 0x0002 /* IM_HP1L_SC_NEG_EINT2 */
5934#define ARIZONA_IM_HP1L_SC_NEG_EINT2_SHIFT 1 /* IM_HP1L_SC_NEG_EINT2 */
5935#define ARIZONA_IM_HP1L_SC_NEG_EINT2_WIDTH 1 /* IM_HP1L_SC_NEG_EINT2 */
5936#define ARIZONA_IM_HP1L_SC_POS_EINT2 0x0001 /* IM_HP1L_SC_POS_EINT2 */
5937#define ARIZONA_IM_HP1L_SC_POS_EINT2_MASK 0x0001 /* IM_HP1L_SC_POS_EINT2 */
5938#define ARIZONA_IM_HP1L_SC_POS_EINT2_SHIFT 0 /* IM_HP1L_SC_POS_EINT2 */
5939#define ARIZONA_IM_HP1L_SC_POS_EINT2_WIDTH 1 /* IM_HP1L_SC_POS_EINT2 */
5940
5941/*
5337 * R3359 (0xD1F) - IRQ2 Control 5942 * R3359 (0xD1F) - IRQ2 Control
5338 */ 5943 */
5339#define ARIZONA_IM_IRQ2 0x0001 /* IM_IRQ2 */ 5944#define ARIZONA_IM_IRQ2 0x0001 /* IM_IRQ2 */
@@ -5360,14 +5965,14 @@
5360/* 5965/*
5361 * R3361 (0xD21) - Interrupt Raw Status 3 5966 * R3361 (0xD21) - Interrupt Raw Status 3
5362 */ 5967 */
5363#define ARIZONA_SPK_SHUTDOWN_WARN_STS 0x8000 /* SPK_SHUTDOWN_WARN_STS */ 5968#define ARIZONA_SPK_OVERHEAT_WARN_STS 0x8000 /* SPK_OVERHEAT_WARN_STS */
5364#define ARIZONA_SPK_SHUTDOWN_WARN_STS_MASK 0x8000 /* SPK_SHUTDOWN_WARN_STS */ 5969#define ARIZONA_SPK_OVERHEAT_WARN_STS_MASK 0x8000 /* SPK_OVERHEAT_WARN_STS */
5365#define ARIZONA_SPK_SHUTDOWN_WARN_STS_SHIFT 15 /* SPK_SHUTDOWN_WARN_STS */ 5970#define ARIZONA_SPK_OVERHEAT_WARN_STS_SHIFT 15 /* SPK_OVERHEAT_WARN_STS */
5366#define ARIZONA_SPK_SHUTDOWN_WARN_STS_WIDTH 1 /* SPK_SHUTDOWN_WARN_STS */ 5971#define ARIZONA_SPK_OVERHEAT_WARN_STS_WIDTH 1 /* SPK_OVERHEAT_WARN_STS */
5367#define ARIZONA_SPK_SHUTDOWN_STS 0x4000 /* SPK_SHUTDOWN_STS */ 5972#define ARIZONA_SPK_OVERHEAT_STS 0x4000 /* SPK_OVERHEAT_STS */
5368#define ARIZONA_SPK_SHUTDOWN_STS_MASK 0x4000 /* SPK_SHUTDOWN_STS */ 5973#define ARIZONA_SPK_OVERHEAT_STS_MASK 0x4000 /* SPK_OVERHEAT_STS */
5369#define ARIZONA_SPK_SHUTDOWN_STS_SHIFT 14 /* SPK_SHUTDOWN_STS */ 5974#define ARIZONA_SPK_OVERHEAT_STS_SHIFT 14 /* SPK_OVERHEAT_STS */
5370#define ARIZONA_SPK_SHUTDOWN_STS_WIDTH 1 /* SPK_SHUTDOWN_STS */ 5975#define ARIZONA_SPK_OVERHEAT_STS_WIDTH 1 /* SPK_OVERHEAT_STS */
5371#define ARIZONA_HPDET_STS 0x2000 /* HPDET_STS */ 5976#define ARIZONA_HPDET_STS 0x2000 /* HPDET_STS */
5372#define ARIZONA_HPDET_STS_MASK 0x2000 /* HPDET_STS */ 5977#define ARIZONA_HPDET_STS_MASK 0x2000 /* HPDET_STS */
5373#define ARIZONA_HPDET_STS_SHIFT 13 /* HPDET_STS */ 5978#define ARIZONA_HPDET_STS_SHIFT 13 /* HPDET_STS */
@@ -5464,6 +6069,30 @@
5464#define ARIZONA_ISRC2_CFG_ERR_STS_MASK 0x0040 /* ISRC2_CFG_ERR_STS */ 6069#define ARIZONA_ISRC2_CFG_ERR_STS_MASK 0x0040 /* ISRC2_CFG_ERR_STS */
5465#define ARIZONA_ISRC2_CFG_ERR_STS_SHIFT 6 /* ISRC2_CFG_ERR_STS */ 6070#define ARIZONA_ISRC2_CFG_ERR_STS_SHIFT 6 /* ISRC2_CFG_ERR_STS */
5466#define ARIZONA_ISRC2_CFG_ERR_STS_WIDTH 1 /* ISRC2_CFG_ERR_STS */ 6071#define ARIZONA_ISRC2_CFG_ERR_STS_WIDTH 1 /* ISRC2_CFG_ERR_STS */
6072#define ARIZONA_HP3R_DONE_STS 0x0020 /* HP3R_DONE_STS */
6073#define ARIZONA_HP3R_DONE_STS_MASK 0x0020 /* HP3R_DONE_STS */
6074#define ARIZONA_HP3R_DONE_STS_SHIFT 5 /* HP3R_DONE_STS */
6075#define ARIZONA_HP3R_DONE_STS_WIDTH 1 /* HP3R_DONE_STS */
6076#define ARIZONA_HP3L_DONE_STS 0x0010 /* HP3L_DONE_STS */
6077#define ARIZONA_HP3L_DONE_STS_MASK 0x0010 /* HP3L_DONE_STS */
6078#define ARIZONA_HP3L_DONE_STS_SHIFT 4 /* HP3L_DONE_STS */
6079#define ARIZONA_HP3L_DONE_STS_WIDTH 1 /* HP3L_DONE_STS */
6080#define ARIZONA_HP2R_DONE_STS 0x0008 /* HP2R_DONE_STS */
6081#define ARIZONA_HP2R_DONE_STS_MASK 0x0008 /* HP2R_DONE_STS */
6082#define ARIZONA_HP2R_DONE_STS_SHIFT 3 /* HP2R_DONE_STS */
6083#define ARIZONA_HP2R_DONE_STS_WIDTH 1 /* HP2R_DONE_STS */
6084#define ARIZONA_HP2L_DONE_STS 0x0004 /* HP2L_DONE_STS */
6085#define ARIZONA_HP2L_DONE_STS_MASK 0x0004 /* HP2L_DONE_STS */
6086#define ARIZONA_HP2L_DONE_STS_SHIFT 2 /* HP2L_DONE_STS */
6087#define ARIZONA_HP2L_DONE_STS_WIDTH 1 /* HP2L_DONE_STS */
6088#define ARIZONA_HP1R_DONE_STS 0x0002 /* HP1R_DONE_STS */
6089#define ARIZONA_HP1R_DONE_STS_MASK 0x0002 /* HP1R_DONE_STS */
6090#define ARIZONA_HP1R_DONE_STS_SHIFT 1 /* HP1R_DONE_STS */
6091#define ARIZONA_HP1R_DONE_STS_WIDTH 1 /* HP1R_DONE_STS */
6092#define ARIZONA_HP1L_DONE_STS 0x0001 /* HP1L_DONE_STS */
6093#define ARIZONA_HP1L_DONE_STS_MASK 0x0001 /* HP1L_DONE_STS */
6094#define ARIZONA_HP1L_DONE_STS_SHIFT 0 /* HP1L_DONE_STS */
6095#define ARIZONA_HP1L_DONE_STS_WIDTH 1 /* HP1L_DONE_STS */
5467 6096
5468/* 6097/*
5469 * R3363 (0xD23) - Interrupt Raw Status 5 6098 * R3363 (0xD23) - Interrupt Raw Status 5
@@ -5580,6 +6209,10 @@
5580#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_MASK 0x0008 /* ADSP2_1_OVERCLOCKED_STS */ 6209#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_MASK 0x0008 /* ADSP2_1_OVERCLOCKED_STS */
5581#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_SHIFT 3 /* ADSP2_1_OVERCLOCKED_STS */ 6210#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_SHIFT 3 /* ADSP2_1_OVERCLOCKED_STS */
5582#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_WIDTH 1 /* ADSP2_1_OVERCLOCKED_STS */ 6211#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_WIDTH 1 /* ADSP2_1_OVERCLOCKED_STS */
6212#define ARIZONA_ISRC3_OVERCLOCKED_STS 0x0004 /* ISRC3_OVERCLOCKED_STS */
6213#define ARIZONA_ISRC3_OVERCLOCKED_STS_MASK 0x0004 /* ISRC3_OVERCLOCKED_STS */
6214#define ARIZONA_ISRC3_OVERCLOCKED_STS_SHIFT 2 /* ISRC3_OVERCLOCKED_STS */
6215#define ARIZONA_ISRC3_OVERCLOCKED_STS_WIDTH 1 /* ISRC3_OVERCLOCKED_STS */
5583#define ARIZONA_ISRC2_OVERCLOCKED_STS 0x0002 /* ISRC2_OVERCLOCKED_STS */ 6216#define ARIZONA_ISRC2_OVERCLOCKED_STS 0x0002 /* ISRC2_OVERCLOCKED_STS */
5584#define ARIZONA_ISRC2_OVERCLOCKED_STS_MASK 0x0002 /* ISRC2_OVERCLOCKED_STS */ 6217#define ARIZONA_ISRC2_OVERCLOCKED_STS_MASK 0x0002 /* ISRC2_OVERCLOCKED_STS */
5585#define ARIZONA_ISRC2_OVERCLOCKED_STS_SHIFT 1 /* ISRC2_OVERCLOCKED_STS */ 6218#define ARIZONA_ISRC2_OVERCLOCKED_STS_SHIFT 1 /* ISRC2_OVERCLOCKED_STS */
@@ -5604,6 +6237,10 @@
5604#define ARIZONA_AIF1_UNDERCLOCKED_STS_MASK 0x0100 /* AIF1_UNDERCLOCKED_STS */ 6237#define ARIZONA_AIF1_UNDERCLOCKED_STS_MASK 0x0100 /* AIF1_UNDERCLOCKED_STS */
5605#define ARIZONA_AIF1_UNDERCLOCKED_STS_SHIFT 8 /* AIF1_UNDERCLOCKED_STS */ 6238#define ARIZONA_AIF1_UNDERCLOCKED_STS_SHIFT 8 /* AIF1_UNDERCLOCKED_STS */
5606#define ARIZONA_AIF1_UNDERCLOCKED_STS_WIDTH 1 /* AIF1_UNDERCLOCKED_STS */ 6239#define ARIZONA_AIF1_UNDERCLOCKED_STS_WIDTH 1 /* AIF1_UNDERCLOCKED_STS */
6240#define ARIZONA_ISRC3_UNDERCLOCKED_STS 0x0080 /* ISRC3_UNDERCLOCKED_STS */
6241#define ARIZONA_ISRC3_UNDERCLOCKED_STS_MASK 0x0080 /* ISRC3_UNDERCLOCKED_STS */
6242#define ARIZONA_ISRC3_UNDERCLOCKED_STS_SHIFT 7 /* ISRC3_UNDERCLOCKED_STS */
6243#define ARIZONA_ISRC3_UNDERCLOCKED_STS_WIDTH 1 /* ISRC3_UNDERCLOCKED_STS */
5607#define ARIZONA_ISRC2_UNDERCLOCKED_STS 0x0040 /* ISRC2_UNDERCLOCKED_STS */ 6244#define ARIZONA_ISRC2_UNDERCLOCKED_STS 0x0040 /* ISRC2_UNDERCLOCKED_STS */
5608#define ARIZONA_ISRC2_UNDERCLOCKED_STS_MASK 0x0040 /* ISRC2_UNDERCLOCKED_STS */ 6245#define ARIZONA_ISRC2_UNDERCLOCKED_STS_MASK 0x0040 /* ISRC2_UNDERCLOCKED_STS */
5609#define ARIZONA_ISRC2_UNDERCLOCKED_STS_SHIFT 6 /* ISRC2_UNDERCLOCKED_STS */ 6246#define ARIZONA_ISRC2_UNDERCLOCKED_STS_SHIFT 6 /* ISRC2_UNDERCLOCKED_STS */
@@ -5634,6 +6271,74 @@
5634#define ARIZONA_MIXER_UNDERCLOCKED_STS_WIDTH 1 /* MIXER_UNDERCLOCKED_STS */ 6271#define ARIZONA_MIXER_UNDERCLOCKED_STS_WIDTH 1 /* MIXER_UNDERCLOCKED_STS */
5635 6272
5636/* 6273/*
6274 * R3368 (0xD28) - Interrupt Raw Status 9
6275 */
6276#define ARIZONA_DSP_SHARED_WR_COLL_STS 0x8000 /* DSP_SHARED_WR_COLL_STS */
6277#define ARIZONA_DSP_SHARED_WR_COLL_STS_MASK 0x8000 /* DSP_SHARED_WR_COLL_STS */
6278#define ARIZONA_DSP_SHARED_WR_COLL_STS_SHIFT 15 /* DSP_SHARED_WR_COLL_STS */
6279#define ARIZONA_DSP_SHARED_WR_COLL_STS_WIDTH 1 /* DSP_SHARED_WR_COLL_STS */
6280#define ARIZONA_SPK_SHUTDOWN_STS 0x4000 /* SPK_SHUTDOWN_STS */
6281#define ARIZONA_SPK_SHUTDOWN_STS_MASK 0x4000 /* SPK_SHUTDOWN_STS */
6282#define ARIZONA_SPK_SHUTDOWN_STS_SHIFT 14 /* SPK_SHUTDOWN_STS */
6283#define ARIZONA_SPK_SHUTDOWN_STS_WIDTH 1 /* SPK_SHUTDOWN_STS */
6284#define ARIZONA_SPK1R_SHORT_STS 0x2000 /* SPK1R_SHORT_STS */
6285#define ARIZONA_SPK1R_SHORT_STS_MASK 0x2000 /* SPK1R_SHORT_STS */
6286#define ARIZONA_SPK1R_SHORT_STS_SHIFT 13 /* SPK1R_SHORT_STS */
6287#define ARIZONA_SPK1R_SHORT_STS_WIDTH 1 /* SPK1R_SHORT_STS */
6288#define ARIZONA_SPK1L_SHORT_STS 0x1000 /* SPK1L_SHORT_STS */
6289#define ARIZONA_SPK1L_SHORT_STS_MASK 0x1000 /* SPK1L_SHORT_STS */
6290#define ARIZONA_SPK1L_SHORT_STS_SHIFT 12 /* SPK1L_SHORT_STS */
6291#define ARIZONA_SPK1L_SHORT_STS_WIDTH 1 /* SPK1L_SHORT_STS */
6292#define ARIZONA_HP3R_SC_NEG_STS 0x0800 /* HP3R_SC_NEG_STS */
6293#define ARIZONA_HP3R_SC_NEG_STS_MASK 0x0800 /* HP3R_SC_NEG_STS */
6294#define ARIZONA_HP3R_SC_NEG_STS_SHIFT 11 /* HP3R_SC_NEG_STS */
6295#define ARIZONA_HP3R_SC_NEG_STS_WIDTH 1 /* HP3R_SC_NEG_STS */
6296#define ARIZONA_HP3R_SC_POS_STS 0x0400 /* HP3R_SC_POS_STS */
6297#define ARIZONA_HP3R_SC_POS_STS_MASK 0x0400 /* HP3R_SC_POS_STS */
6298#define ARIZONA_HP3R_SC_POS_STS_SHIFT 10 /* HP3R_SC_POS_STS */
6299#define ARIZONA_HP3R_SC_POS_STS_WIDTH 1 /* HP3R_SC_POS_STS */
6300#define ARIZONA_HP3L_SC_NEG_STS 0x0200 /* HP3L_SC_NEG_STS */
6301#define ARIZONA_HP3L_SC_NEG_STS_MASK 0x0200 /* HP3L_SC_NEG_STS */
6302#define ARIZONA_HP3L_SC_NEG_STS_SHIFT 9 /* HP3L_SC_NEG_STS */
6303#define ARIZONA_HP3L_SC_NEG_STS_WIDTH 1 /* HP3L_SC_NEG_STS */
6304#define ARIZONA_HP3L_SC_POS_STS 0x0100 /* HP3L_SC_POS_STS */
6305#define ARIZONA_HP3L_SC_POS_STS_MASK 0x0100 /* HP3L_SC_POS_STS */
6306#define ARIZONA_HP3L_SC_POS_STS_SHIFT 8 /* HP3L_SC_POS_STS */
6307#define ARIZONA_HP3L_SC_POS_STS_WIDTH 1 /* HP3L_SC_POS_STS */
6308#define ARIZONA_HP2R_SC_NEG_STS 0x0080 /* HP2R_SC_NEG_STS */
6309#define ARIZONA_HP2R_SC_NEG_STS_MASK 0x0080 /* HP2R_SC_NEG_STS */
6310#define ARIZONA_HP2R_SC_NEG_STS_SHIFT 7 /* HP2R_SC_NEG_STS */
6311#define ARIZONA_HP2R_SC_NEG_STS_WIDTH 1 /* HP2R_SC_NEG_STS */
6312#define ARIZONA_HP2R_SC_POS_STS 0x0040 /* HP2R_SC_POS_STS */
6313#define ARIZONA_HP2R_SC_POS_STS_MASK 0x0040 /* HP2R_SC_POS_STS */
6314#define ARIZONA_HP2R_SC_POS_STS_SHIFT 6 /* HP2R_SC_POS_STS */
6315#define ARIZONA_HP2R_SC_POS_STS_WIDTH 1 /* HP2R_SC_POS_STS */
6316#define ARIZONA_HP2L_SC_NEG_STS 0x0020 /* HP2L_SC_NEG_STS */
6317#define ARIZONA_HP2L_SC_NEG_STS_MASK 0x0020 /* HP2L_SC_NEG_STS */
6318#define ARIZONA_HP2L_SC_NEG_STS_SHIFT 5 /* HP2L_SC_NEG_STS */
6319#define ARIZONA_HP2L_SC_NEG_STS_WIDTH 1 /* HP2L_SC_NEG_STS */
6320#define ARIZONA_HP2L_SC_POS_STS 0x0010 /* HP2L_SC_POS_STS */
6321#define ARIZONA_HP2L_SC_POS_STS_MASK 0x0010 /* HP2L_SC_POS_STS */
6322#define ARIZONA_HP2L_SC_POS_STS_SHIFT 4 /* HP2L_SC_POS_STS */
6323#define ARIZONA_HP2L_SC_POS_STS_WIDTH 1 /* HP2L_SC_POS_STS */
6324#define ARIZONA_HP1R_SC_NEG_STS 0x0008 /* HP1R_SC_NEG_STS */
6325#define ARIZONA_HP1R_SC_NEG_STS_MASK 0x0008 /* HP1R_SC_NEG_STS */
6326#define ARIZONA_HP1R_SC_NEG_STS_SHIFT 3 /* HP1R_SC_NEG_STS */
6327#define ARIZONA_HP1R_SC_NEG_STS_WIDTH 1 /* HP1R_SC_NEG_STS */
6328#define ARIZONA_HP1R_SC_POS_STS 0x0004 /* HP1R_SC_POS_STS */
6329#define ARIZONA_HP1R_SC_POS_STS_MASK 0x0004 /* HP1R_SC_POS_STS */
6330#define ARIZONA_HP1R_SC_POS_STS_SHIFT 2 /* HP1R_SC_POS_STS */
6331#define ARIZONA_HP1R_SC_POS_STS_WIDTH 1 /* HP1R_SC_POS_STS */
6332#define ARIZONA_HP1L_SC_NEG_STS 0x0002 /* HP1L_SC_NEG_STS */
6333#define ARIZONA_HP1L_SC_NEG_STS_MASK 0x0002 /* HP1L_SC_NEG_STS */
6334#define ARIZONA_HP1L_SC_NEG_STS_SHIFT 1 /* HP1L_SC_NEG_STS */
6335#define ARIZONA_HP1L_SC_NEG_STS_WIDTH 1 /* HP1L_SC_NEG_STS */
6336#define ARIZONA_HP1L_SC_POS_STS 0x0001 /* HP1L_SC_POS_STS */
6337#define ARIZONA_HP1L_SC_POS_STS_MASK 0x0001 /* HP1L_SC_POS_STS */
6338#define ARIZONA_HP1L_SC_POS_STS_SHIFT 0 /* HP1L_SC_POS_STS */
6339#define ARIZONA_HP1L_SC_POS_STS_WIDTH 1 /* HP1L_SC_POS_STS */
6340
6341/*
5637 * R3392 (0xD40) - IRQ Pin Status 6342 * R3392 (0xD40) - IRQ Pin Status
5638 */ 6343 */
5639#define ARIZONA_IRQ2_STS 0x0002 /* IRQ2_STS */ 6344#define ARIZONA_IRQ2_STS 0x0002 /* IRQ2_STS */
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 887ef4f7bef7..fcbe9d129a9d 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -16,7 +16,9 @@
16#ifndef __LINUX_MFD_CROS_EC_H 16#ifndef __LINUX_MFD_CROS_EC_H
17#define __LINUX_MFD_CROS_EC_H 17#define __LINUX_MFD_CROS_EC_H
18 18
19#include <linux/notifier.h>
19#include <linux/mfd/cros_ec_commands.h> 20#include <linux/mfd/cros_ec_commands.h>
21#include <linux/mutex.h>
20 22
21/* 23/*
22 * Command interface between EC and AP, for LPC, I2C and SPI interfaces. 24 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
@@ -33,83 +35,76 @@ enum {
33 EC_MSG_TX_PROTO_BYTES, 35 EC_MSG_TX_PROTO_BYTES,
34}; 36};
35 37
36/** 38/*
37 * struct cros_ec_msg - A message sent to the EC, and its reply
38 *
39 * @version: Command version number (often 0) 39 * @version: Command version number (often 0)
40 * @cmd: Command to send (EC_CMD_...) 40 * @command: Command to send (EC_CMD_...)
41 * @out_buf: Outgoing payload (to EC) 41 * @outdata: Outgoing data to EC
42 * @outlen: Outgoing length 42 * @outsize: Outgoing length in bytes
43 * @in_buf: Incoming payload (from EC) 43 * @indata: Where to put the incoming data from EC
44 * @in_len: Incoming length 44 * @insize: Max number of bytes to accept from EC
45 * @result: EC's response to the command (separate from communication failure)
45 */ 46 */
46struct cros_ec_msg { 47struct cros_ec_command {
47 u8 version; 48 uint32_t version;
48 u8 cmd; 49 uint32_t command;
49 uint8_t *out_buf; 50 uint8_t *outdata;
50 int out_len; 51 uint32_t outsize;
51 uint8_t *in_buf; 52 uint8_t *indata;
52 int in_len; 53 uint32_t insize;
54 uint32_t result;
53}; 55};
54 56
55/** 57/**
56 * struct cros_ec_device - Information about a ChromeOS EC device 58 * struct cros_ec_device - Information about a ChromeOS EC device
57 * 59 *
58 * @name: Name of this EC interface 60 * @ec_name: name of EC device (e.g. 'chromeos-ec')
61 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
62 * @dev: Device pointer
63 * @was_wake_device: true if this device was set to wake the system from
64 * sleep at the last suspend
65 * @cmd_xfer: send command to EC and get response
66 * Returns the number of bytes received if the communication succeeded, but
67 * that doesn't mean the EC was happy with the command. The caller
68 * should check msg.result for the EC's result code.
69 *
59 * @priv: Private data 70 * @priv: Private data
60 * @irq: Interrupt to use 71 * @irq: Interrupt to use
61 * @din: input buffer (from EC) 72 * @din: input buffer (for data from EC)
62 * @dout: output buffer (to EC) 73 * @dout: output buffer (for data to EC)
63 * \note 74 * \note
64 * These two buffers will always be dword-aligned and include enough 75 * These two buffers will always be dword-aligned and include enough
65 * space for up to 7 word-alignment bytes also, so we can ensure that 76 * space for up to 7 word-alignment bytes also, so we can ensure that
66 * the body of the message is always dword-aligned (64-bit). 77 * the body of the message is always dword-aligned (64-bit).
67 *
68 * We use this alignment to keep ARM and x86 happy. Probably word 78 * We use this alignment to keep ARM and x86 happy. Probably word
69 * alignment would be OK, there might be a small performance advantage 79 * alignment would be OK, there might be a small performance advantage
70 * to using dword. 80 * to using dword.
71 * @din_size: size of din buffer 81 * @din_size: size of din buffer to allocate (zero to use static din)
72 * @dout_size: size of dout buffer 82 * @dout_size: size of dout buffer to allocate (zero to use static dout)
73 * @command_send: send a command
74 * @command_recv: receive a command
75 * @ec_name: name of EC device (e.g. 'chromeos-ec')
76 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
77 * @parent: pointer to parent device (e.g. i2c or spi device) 83 * @parent: pointer to parent device (e.g. i2c or spi device)
78 * @dev: Device pointer
79 * dev_lock: Lock to prevent concurrent access
80 * @wake_enabled: true if this device can wake the system from sleep 84 * @wake_enabled: true if this device can wake the system from sleep
81 * @was_wake_device: true if this device was set to wake the system from 85 * @lock: one transaction at a time
82 * sleep at the last suspend
83 * @event_notifier: interrupt event notifier for transport devices
84 */ 86 */
85struct cros_ec_device { 87struct cros_ec_device {
86 const char *name; 88
89 /* These are used by other drivers that want to talk to the EC */
90 const char *ec_name;
91 const char *phys_name;
92 struct device *dev;
93 bool was_wake_device;
94 struct class *cros_class;
95 int (*cmd_xfer)(struct cros_ec_device *ec,
96 struct cros_ec_command *msg);
97
98 /* These are used to implement the platform-specific interface */
87 void *priv; 99 void *priv;
88 int irq; 100 int irq;
89 uint8_t *din; 101 uint8_t *din;
90 uint8_t *dout; 102 uint8_t *dout;
91 int din_size; 103 int din_size;
92 int dout_size; 104 int dout_size;
93 int (*command_send)(struct cros_ec_device *ec,
94 uint16_t cmd, void *out_buf, int out_len);
95 int (*command_recv)(struct cros_ec_device *ec,
96 uint16_t cmd, void *in_buf, int in_len);
97 int (*command_sendrecv)(struct cros_ec_device *ec,
98 uint16_t cmd, void *out_buf, int out_len,
99 void *in_buf, int in_len);
100 int (*command_xfer)(struct cros_ec_device *ec,
101 struct cros_ec_msg *msg);
102
103 const char *ec_name;
104 const char *phys_name;
105 struct device *parent; 105 struct device *parent;
106
107 /* These are --private-- fields - do not assign */
108 struct device *dev;
109 struct mutex dev_lock;
110 bool wake_enabled; 106 bool wake_enabled;
111 bool was_wake_device; 107 struct mutex lock;
112 struct blocking_notifier_head event_notifier;
113}; 108};
114 109
115/** 110/**
@@ -143,13 +138,24 @@ int cros_ec_resume(struct cros_ec_device *ec_dev);
143 * @msg: Message to write 138 * @msg: Message to write
144 */ 139 */
145int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, 140int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
146 struct cros_ec_msg *msg); 141 struct cros_ec_command *msg);
142
143/**
144 * cros_ec_check_result - Check ec_msg->result
145 *
146 * This is used by ChromeOS EC drivers to check the ec_msg->result for
147 * errors and to warn about them.
148 *
149 * @ec_dev: EC device
150 * @msg: Message to check
151 */
152int cros_ec_check_result(struct cros_ec_device *ec_dev,
153 struct cros_ec_command *msg);
147 154
148/** 155/**
149 * cros_ec_remove - Remove a ChromeOS EC 156 * cros_ec_remove - Remove a ChromeOS EC
150 * 157 *
151 * Call this to deregister a ChromeOS EC. After this you should call 158 * Call this to deregister a ChromeOS EC, then clean up any private data.
152 * cros_ec_free().
153 * 159 *
154 * @ec_dev: Device to register 160 * @ec_dev: Device to register
155 * @return 0 if ok, -ve on error 161 * @return 0 if ok, -ve on error
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 00a9aac5d1e8..b92a3262f8f6 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -34,7 +34,8 @@ enum da9063_models {
34}; 34};
35 35
36enum da9063_variant_codes { 36enum da9063_variant_codes {
37 PMIC_DA9063_BB = 0x5 37 PMIC_DA9063_AD = 0x3,
38 PMIC_DA9063_BB = 0x5,
38}; 39};
39 40
40/* Interrupts */ 41/* Interrupts */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
index 09a85c699da1..2e0ba6d5fbc3 100644
--- a/include/linux/mfd/da9063/registers.h
+++ b/include/linux/mfd/da9063/registers.h
@@ -104,16 +104,27 @@
104#define DA9063_REG_COUNT_D 0x43 104#define DA9063_REG_COUNT_D 0x43
105#define DA9063_REG_COUNT_MO 0x44 105#define DA9063_REG_COUNT_MO 0x44
106#define DA9063_REG_COUNT_Y 0x45 106#define DA9063_REG_COUNT_Y 0x45
107#define DA9063_REG_ALARM_S 0x46 107
108#define DA9063_REG_ALARM_MI 0x47 108#define DA9063_AD_REG_ALARM_MI 0x46
109#define DA9063_REG_ALARM_H 0x48 109#define DA9063_AD_REG_ALARM_H 0x47
110#define DA9063_REG_ALARM_D 0x49 110#define DA9063_AD_REG_ALARM_D 0x48
111#define DA9063_REG_ALARM_MO 0x4A 111#define DA9063_AD_REG_ALARM_MO 0x49
112#define DA9063_REG_ALARM_Y 0x4B 112#define DA9063_AD_REG_ALARM_Y 0x4A
113#define DA9063_REG_SECOND_A 0x4C 113#define DA9063_AD_REG_SECOND_A 0x4B
114#define DA9063_REG_SECOND_B 0x4D 114#define DA9063_AD_REG_SECOND_B 0x4C
115#define DA9063_REG_SECOND_C 0x4E 115#define DA9063_AD_REG_SECOND_C 0x4D
116#define DA9063_REG_SECOND_D 0x4F 116#define DA9063_AD_REG_SECOND_D 0x4E
117
118#define DA9063_BB_REG_ALARM_S 0x46
119#define DA9063_BB_REG_ALARM_MI 0x47
120#define DA9063_BB_REG_ALARM_H 0x48
121#define DA9063_BB_REG_ALARM_D 0x49
122#define DA9063_BB_REG_ALARM_MO 0x4A
123#define DA9063_BB_REG_ALARM_Y 0x4B
124#define DA9063_BB_REG_SECOND_A 0x4C
125#define DA9063_BB_REG_SECOND_B 0x4D
126#define DA9063_BB_REG_SECOND_C 0x4E
127#define DA9063_BB_REG_SECOND_D 0x4F
117 128
118/* Sequencer Control Registers */ 129/* Sequencer Control Registers */
119#define DA9063_REG_SEQ 0x81 130#define DA9063_REG_SEQ 0x81
@@ -223,37 +234,67 @@
223#define DA9063_REG_CONFIG_J 0x10F 234#define DA9063_REG_CONFIG_J 0x10F
224#define DA9063_REG_CONFIG_K 0x110 235#define DA9063_REG_CONFIG_K 0x110
225#define DA9063_REG_CONFIG_L 0x111 236#define DA9063_REG_CONFIG_L 0x111
226#define DA9063_REG_CONFIG_M 0x112 237
227#define DA9063_REG_CONFIG_N 0x113 238#define DA9063_AD_REG_MON_REG_1 0x112
228 239#define DA9063_AD_REG_MON_REG_2 0x113
229#define DA9063_REG_MON_REG_1 0x114 240#define DA9063_AD_REG_MON_REG_3 0x114
230#define DA9063_REG_MON_REG_2 0x115 241#define DA9063_AD_REG_MON_REG_4 0x115
231#define DA9063_REG_MON_REG_3 0x116 242#define DA9063_AD_REG_MON_REG_5 0x116
232#define DA9063_REG_MON_REG_4 0x117 243#define DA9063_AD_REG_MON_REG_6 0x117
233#define DA9063_REG_MON_REG_5 0x11E 244#define DA9063_AD_REG_TRIM_CLDR 0x118
234#define DA9063_REG_MON_REG_6 0x11F 245
235#define DA9063_REG_TRIM_CLDR 0x120 246#define DA9063_AD_REG_GP_ID_0 0x119
247#define DA9063_AD_REG_GP_ID_1 0x11A
248#define DA9063_AD_REG_GP_ID_2 0x11B
249#define DA9063_AD_REG_GP_ID_3 0x11C
250#define DA9063_AD_REG_GP_ID_4 0x11D
251#define DA9063_AD_REG_GP_ID_5 0x11E
252#define DA9063_AD_REG_GP_ID_6 0x11F
253#define DA9063_AD_REG_GP_ID_7 0x120
254#define DA9063_AD_REG_GP_ID_8 0x121
255#define DA9063_AD_REG_GP_ID_9 0x122
256#define DA9063_AD_REG_GP_ID_10 0x123
257#define DA9063_AD_REG_GP_ID_11 0x124
258#define DA9063_AD_REG_GP_ID_12 0x125
259#define DA9063_AD_REG_GP_ID_13 0x126
260#define DA9063_AD_REG_GP_ID_14 0x127
261#define DA9063_AD_REG_GP_ID_15 0x128
262#define DA9063_AD_REG_GP_ID_16 0x129
263#define DA9063_AD_REG_GP_ID_17 0x12A
264#define DA9063_AD_REG_GP_ID_18 0x12B
265#define DA9063_AD_REG_GP_ID_19 0x12C
266
267#define DA9063_BB_REG_CONFIG_M 0x112
268#define DA9063_BB_REG_CONFIG_N 0x113
269
270#define DA9063_BB_REG_MON_REG_1 0x114
271#define DA9063_BB_REG_MON_REG_2 0x115
272#define DA9063_BB_REG_MON_REG_3 0x116
273#define DA9063_BB_REG_MON_REG_4 0x117
274#define DA9063_BB_REG_MON_REG_5 0x11E
275#define DA9063_BB_REG_MON_REG_6 0x11F
276#define DA9063_BB_REG_TRIM_CLDR 0x120
236/* General Purpose Registers */ 277/* General Purpose Registers */
237#define DA9063_REG_GP_ID_0 0x121 278#define DA9063_BB_REG_GP_ID_0 0x121
238#define DA9063_REG_GP_ID_1 0x122 279#define DA9063_BB_REG_GP_ID_1 0x122
239#define DA9063_REG_GP_ID_2 0x123 280#define DA9063_BB_REG_GP_ID_2 0x123
240#define DA9063_REG_GP_ID_3 0x124 281#define DA9063_BB_REG_GP_ID_3 0x124
241#define DA9063_REG_GP_ID_4 0x125 282#define DA9063_BB_REG_GP_ID_4 0x125
242#define DA9063_REG_GP_ID_5 0x126 283#define DA9063_BB_REG_GP_ID_5 0x126
243#define DA9063_REG_GP_ID_6 0x127 284#define DA9063_BB_REG_GP_ID_6 0x127
244#define DA9063_REG_GP_ID_7 0x128 285#define DA9063_BB_REG_GP_ID_7 0x128
245#define DA9063_REG_GP_ID_8 0x129 286#define DA9063_BB_REG_GP_ID_8 0x129
246#define DA9063_REG_GP_ID_9 0x12A 287#define DA9063_BB_REG_GP_ID_9 0x12A
247#define DA9063_REG_GP_ID_10 0x12B 288#define DA9063_BB_REG_GP_ID_10 0x12B
248#define DA9063_REG_GP_ID_11 0x12C 289#define DA9063_BB_REG_GP_ID_11 0x12C
249#define DA9063_REG_GP_ID_12 0x12D 290#define DA9063_BB_REG_GP_ID_12 0x12D
250#define DA9063_REG_GP_ID_13 0x12E 291#define DA9063_BB_REG_GP_ID_13 0x12E
251#define DA9063_REG_GP_ID_14 0x12F 292#define DA9063_BB_REG_GP_ID_14 0x12F
252#define DA9063_REG_GP_ID_15 0x130 293#define DA9063_BB_REG_GP_ID_15 0x130
253#define DA9063_REG_GP_ID_16 0x131 294#define DA9063_BB_REG_GP_ID_16 0x131
254#define DA9063_REG_GP_ID_17 0x132 295#define DA9063_BB_REG_GP_ID_17 0x132
255#define DA9063_REG_GP_ID_18 0x133 296#define DA9063_BB_REG_GP_ID_18 0x133
256#define DA9063_REG_GP_ID_19 0x134 297#define DA9063_BB_REG_GP_ID_19 0x134
257 298
258/* Chip ID and variant */ 299/* Chip ID and variant */
259#define DA9063_REG_CHIP_ID 0x181 300#define DA9063_REG_CHIP_ID 0x181
@@ -404,10 +445,10 @@
404/* DA9063_REG_CONTROL_B (addr=0x0F) */ 445/* DA9063_REG_CONTROL_B (addr=0x0F) */
405#define DA9063_CHG_SEL 0x01 446#define DA9063_CHG_SEL 0x01
406#define DA9063_WATCHDOG_PD 0x02 447#define DA9063_WATCHDOG_PD 0x02
407#define DA9063_RESET_BLINKING 0x04 448#define DA9063_BB_RESET_BLINKING 0x04
408#define DA9063_NRES_MODE 0x08 449#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10 450#define DA9063_NONKEY_LOCK 0x10
410#define DA9063_BUCK_SLOWSTART 0x80 451#define DA9063_BB_BUCK_SLOWSTART 0x80
411 452
412/* DA9063_REG_CONTROL_C (addr=0x10) */ 453/* DA9063_REG_CONTROL_C (addr=0x10) */
413#define DA9063_DEBOUNCING_MASK 0x07 454#define DA9063_DEBOUNCING_MASK 0x07
@@ -467,7 +508,7 @@
467#define DA9063_GPADC_PAUSE 0x02 508#define DA9063_GPADC_PAUSE 0x02
468#define DA9063_PMIF_DIS 0x04 509#define DA9063_PMIF_DIS 0x04
469#define DA9063_HS2WIRE_DIS 0x08 510#define DA9063_HS2WIRE_DIS 0x08
470#define DA9063_CLDR_PAUSE 0x10 511#define DA9063_BB_CLDR_PAUSE 0x10
471#define DA9063_BBAT_DIS 0x20 512#define DA9063_BBAT_DIS 0x20
472#define DA9063_OUT_32K_PAUSE 0x40 513#define DA9063_OUT_32K_PAUSE 0x40
473#define DA9063_PMCONT_DIS 0x80 514#define DA9063_PMCONT_DIS 0x80
@@ -844,7 +885,7 @@
844#define DA9063_MONITOR 0x40 885#define DA9063_MONITOR 0x40
845 886
846/* DA9063_REG_ALARM_S (addr=0x46) */ 887/* DA9063_REG_ALARM_S (addr=0x46) */
847#define DA9063_ALARM_S_MASK 0x3F 888#define DA9063_BB_ALARM_S_MASK 0x3F
848#define DA9063_ALARM_STATUS_ALARM 0x80 889#define DA9063_ALARM_STATUS_ALARM 0x80
849#define DA9063_ALARM_STATUS_TICK 0x40 890#define DA9063_ALARM_STATUS_TICK 0x40
850/* DA9063_REG_ALARM_MI (addr=0x47) */ 891/* DA9063_REG_ALARM_MI (addr=0x47) */
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
new file mode 100644
index 000000000000..abcbfcf32d10
--- /dev/null
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -0,0 +1,30 @@
1/*
2 * intel_soc_pmic.h - Intel SoC PMIC Driver
3 *
4 * Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
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 version
8 * 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * Author: Yang, Bin <bin.yang@intel.com>
16 * Author: Zhu, Lejun <lejun.zhu@linux.intel.com>
17 */
18
19#ifndef __INTEL_SOC_PMIC_H__
20#define __INTEL_SOC_PMIC_H__
21
22#include <linux/regmap.h>
23
24struct intel_soc_pmic {
25 int irq;
26 struct regmap *regmap;
27 struct regmap_irq_chip_data *irq_chip_data;
28};
29
30#endif /* __INTEL_SOC_PMIC_H__ */
diff --git a/include/linux/mfd/max77686-private.h b/include/linux/mfd/max77686-private.h
index 8c75a9c8dfab..960b92ad450d 100644
--- a/include/linux/mfd/max77686-private.h
+++ b/include/linux/mfd/max77686-private.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max77686-private.h - Voltage regulator driver for the Maxim 77686 2 * max77686-private.h - Voltage regulator driver for the Maxim 77686/802
3 * 3 *
4 * Copyright (C) 2012 Samsung Electrnoics 4 * Copyright (C) 2012 Samsung Electrnoics
5 * Chiwoong Byun <woong.byun@samsung.com> 5 * Chiwoong Byun <woong.byun@samsung.com>
@@ -28,6 +28,7 @@
28 28
29#define MAX77686_REG_INVALID (0xff) 29#define MAX77686_REG_INVALID (0xff)
30 30
31/* MAX77686 PMIC registers */
31enum max77686_pmic_reg { 32enum max77686_pmic_reg {
32 MAX77686_REG_DEVICE_ID = 0x00, 33 MAX77686_REG_DEVICE_ID = 0x00,
33 MAX77686_REG_INTSRC = 0x01, 34 MAX77686_REG_INTSRC = 0x01,
@@ -181,8 +182,209 @@ enum max77686_rtc_reg {
181 MAX77686_ALARM2_DATE = 0x1B, 182 MAX77686_ALARM2_DATE = 0x1B,
182}; 183};
183 184
184#define MAX77686_IRQSRC_PMIC (0) 185/* MAX77802 PMIC registers */
185#define MAX77686_IRQSRC_RTC (1 << 0) 186enum max77802_pmic_reg {
187 MAX77802_REG_DEVICE_ID = 0x00,
188 MAX77802_REG_INTSRC = 0x01,
189 MAX77802_REG_INT1 = 0x02,
190 MAX77802_REG_INT2 = 0x03,
191
192 MAX77802_REG_INT1MSK = 0x04,
193 MAX77802_REG_INT2MSK = 0x05,
194
195 MAX77802_REG_STATUS1 = 0x06,
196 MAX77802_REG_STATUS2 = 0x07,
197
198 MAX77802_REG_PWRON = 0x08,
199 /* Reserved: 0x09 */
200 MAX77802_REG_MRSTB = 0x0A,
201 MAX77802_REG_EPWRHOLD = 0x0B,
202 /* Reserved: 0x0C-0x0D */
203 MAX77802_REG_BOOSTCTRL = 0x0E,
204 MAX77802_REG_BOOSTOUT = 0x0F,
205
206 MAX77802_REG_BUCK1CTRL = 0x10,
207 MAX77802_REG_BUCK1DVS1 = 0x11,
208 MAX77802_REG_BUCK1DVS2 = 0x12,
209 MAX77802_REG_BUCK1DVS3 = 0x13,
210 MAX77802_REG_BUCK1DVS4 = 0x14,
211 MAX77802_REG_BUCK1DVS5 = 0x15,
212 MAX77802_REG_BUCK1DVS6 = 0x16,
213 MAX77802_REG_BUCK1DVS7 = 0x17,
214 MAX77802_REG_BUCK1DVS8 = 0x18,
215 /* Reserved: 0x19 */
216 MAX77802_REG_BUCK2CTRL1 = 0x1A,
217 MAX77802_REG_BUCK2CTRL2 = 0x1B,
218 MAX77802_REG_BUCK2PHTRAN = 0x1C,
219 MAX77802_REG_BUCK2DVS1 = 0x1D,
220 MAX77802_REG_BUCK2DVS2 = 0x1E,
221 MAX77802_REG_BUCK2DVS3 = 0x1F,
222 MAX77802_REG_BUCK2DVS4 = 0x20,
223 MAX77802_REG_BUCK2DVS5 = 0x21,
224 MAX77802_REG_BUCK2DVS6 = 0x22,
225 MAX77802_REG_BUCK2DVS7 = 0x23,
226 MAX77802_REG_BUCK2DVS8 = 0x24,
227 /* Reserved: 0x25-0x26 */
228 MAX77802_REG_BUCK3CTRL1 = 0x27,
229 MAX77802_REG_BUCK3DVS1 = 0x28,
230 MAX77802_REG_BUCK3DVS2 = 0x29,
231 MAX77802_REG_BUCK3DVS3 = 0x2A,
232 MAX77802_REG_BUCK3DVS4 = 0x2B,
233 MAX77802_REG_BUCK3DVS5 = 0x2C,
234 MAX77802_REG_BUCK3DVS6 = 0x2D,
235 MAX77802_REG_BUCK3DVS7 = 0x2E,
236 MAX77802_REG_BUCK3DVS8 = 0x2F,
237 /* Reserved: 0x30-0x36 */
238 MAX77802_REG_BUCK4CTRL1 = 0x37,
239 MAX77802_REG_BUCK4DVS1 = 0x38,
240 MAX77802_REG_BUCK4DVS2 = 0x39,
241 MAX77802_REG_BUCK4DVS3 = 0x3A,
242 MAX77802_REG_BUCK4DVS4 = 0x3B,
243 MAX77802_REG_BUCK4DVS5 = 0x3C,
244 MAX77802_REG_BUCK4DVS6 = 0x3D,
245 MAX77802_REG_BUCK4DVS7 = 0x3E,
246 MAX77802_REG_BUCK4DVS8 = 0x3F,
247 /* Reserved: 0x40 */
248 MAX77802_REG_BUCK5CTRL = 0x41,
249 MAX77802_REG_BUCK5OUT = 0x42,
250 /* Reserved: 0x43 */
251 MAX77802_REG_BUCK6CTRL = 0x44,
252 MAX77802_REG_BUCK6DVS1 = 0x45,
253 MAX77802_REG_BUCK6DVS2 = 0x46,
254 MAX77802_REG_BUCK6DVS3 = 0x47,
255 MAX77802_REG_BUCK6DVS4 = 0x48,
256 MAX77802_REG_BUCK6DVS5 = 0x49,
257 MAX77802_REG_BUCK6DVS6 = 0x4A,
258 MAX77802_REG_BUCK6DVS7 = 0x4B,
259 MAX77802_REG_BUCK6DVS8 = 0x4C,
260 /* Reserved: 0x4D */
261 MAX77802_REG_BUCK7CTRL = 0x4E,
262 MAX77802_REG_BUCK7OUT = 0x4F,
263 /* Reserved: 0x50 */
264 MAX77802_REG_BUCK8CTRL = 0x51,
265 MAX77802_REG_BUCK8OUT = 0x52,
266 /* Reserved: 0x53 */
267 MAX77802_REG_BUCK9CTRL = 0x54,
268 MAX77802_REG_BUCK9OUT = 0x55,
269 /* Reserved: 0x56 */
270 MAX77802_REG_BUCK10CTRL = 0x57,
271 MAX77802_REG_BUCK10OUT = 0x58,
272
273 /* Reserved: 0x59-0x5F */
274
275 MAX77802_REG_LDO1CTRL1 = 0x60,
276 MAX77802_REG_LDO2CTRL1 = 0x61,
277 MAX77802_REG_LDO3CTRL1 = 0x62,
278 MAX77802_REG_LDO4CTRL1 = 0x63,
279 MAX77802_REG_LDO5CTRL1 = 0x64,
280 MAX77802_REG_LDO6CTRL1 = 0x65,
281 MAX77802_REG_LDO7CTRL1 = 0x66,
282 MAX77802_REG_LDO8CTRL1 = 0x67,
283 MAX77802_REG_LDO9CTRL1 = 0x68,
284 MAX77802_REG_LDO10CTRL1 = 0x69,
285 MAX77802_REG_LDO11CTRL1 = 0x6A,
286 MAX77802_REG_LDO12CTRL1 = 0x6B,
287 MAX77802_REG_LDO13CTRL1 = 0x6C,
288 MAX77802_REG_LDO14CTRL1 = 0x6D,
289 MAX77802_REG_LDO15CTRL1 = 0x6E,
290 /* Reserved: 0x6F */
291 MAX77802_REG_LDO17CTRL1 = 0x70,
292 MAX77802_REG_LDO18CTRL1 = 0x71,
293 MAX77802_REG_LDO19CTRL1 = 0x72,
294 MAX77802_REG_LDO20CTRL1 = 0x73,
295 MAX77802_REG_LDO21CTRL1 = 0x74,
296 MAX77802_REG_LDO22CTRL1 = 0x75,
297 MAX77802_REG_LDO23CTRL1 = 0x76,
298 MAX77802_REG_LDO24CTRL1 = 0x77,
299 MAX77802_REG_LDO25CTRL1 = 0x78,
300 MAX77802_REG_LDO26CTRL1 = 0x79,
301 MAX77802_REG_LDO27CTRL1 = 0x7A,
302 MAX77802_REG_LDO28CTRL1 = 0x7B,
303 MAX77802_REG_LDO29CTRL1 = 0x7C,
304 MAX77802_REG_LDO30CTRL1 = 0x7D,
305 /* Reserved: 0x7E */
306 MAX77802_REG_LDO32CTRL1 = 0x7F,
307 MAX77802_REG_LDO33CTRL1 = 0x80,
308 MAX77802_REG_LDO34CTRL1 = 0x81,
309 MAX77802_REG_LDO35CTRL1 = 0x82,
310 /* Reserved: 0x83-0x8F */
311 MAX77802_REG_LDO1CTRL2 = 0x90,
312 MAX77802_REG_LDO2CTRL2 = 0x91,
313 MAX77802_REG_LDO3CTRL2 = 0x92,
314 MAX77802_REG_LDO4CTRL2 = 0x93,
315 MAX77802_REG_LDO5CTRL2 = 0x94,
316 MAX77802_REG_LDO6CTRL2 = 0x95,
317 MAX77802_REG_LDO7CTRL2 = 0x96,
318 MAX77802_REG_LDO8CTRL2 = 0x97,
319 MAX77802_REG_LDO9CTRL2 = 0x98,
320 MAX77802_REG_LDO10CTRL2 = 0x99,
321 MAX77802_REG_LDO11CTRL2 = 0x9A,
322 MAX77802_REG_LDO12CTRL2 = 0x9B,
323 MAX77802_REG_LDO13CTRL2 = 0x9C,
324 MAX77802_REG_LDO14CTRL2 = 0x9D,
325 MAX77802_REG_LDO15CTRL2 = 0x9E,
326 /* Reserved: 0x9F */
327 MAX77802_REG_LDO17CTRL2 = 0xA0,
328 MAX77802_REG_LDO18CTRL2 = 0xA1,
329 MAX77802_REG_LDO19CTRL2 = 0xA2,
330 MAX77802_REG_LDO20CTRL2 = 0xA3,
331 MAX77802_REG_LDO21CTRL2 = 0xA4,
332 MAX77802_REG_LDO22CTRL2 = 0xA5,
333 MAX77802_REG_LDO23CTRL2 = 0xA6,
334 MAX77802_REG_LDO24CTRL2 = 0xA7,
335 MAX77802_REG_LDO25CTRL2 = 0xA8,
336 MAX77802_REG_LDO26CTRL2 = 0xA9,
337 MAX77802_REG_LDO27CTRL2 = 0xAA,
338 MAX77802_REG_LDO28CTRL2 = 0xAB,
339 MAX77802_REG_LDO29CTRL2 = 0xAC,
340 MAX77802_REG_LDO30CTRL2 = 0xAD,
341 /* Reserved: 0xAE */
342 MAX77802_REG_LDO32CTRL2 = 0xAF,
343 MAX77802_REG_LDO33CTRL2 = 0xB0,
344 MAX77802_REG_LDO34CTRL2 = 0xB1,
345 MAX77802_REG_LDO35CTRL2 = 0xB2,
346 /* Reserved: 0xB3 */
347
348 MAX77802_REG_BBAT_CHG = 0xB4,
349 MAX77802_REG_32KHZ = 0xB5,
350
351 MAX77802_REG_PMIC_END = 0xB6,
352};
353
354enum max77802_rtc_reg {
355 MAX77802_RTC_INT = 0xC0,
356 MAX77802_RTC_INTM = 0xC1,
357 MAX77802_RTC_CONTROLM = 0xC2,
358 MAX77802_RTC_CONTROL = 0xC3,
359 MAX77802_RTC_UPDATE0 = 0xC4,
360 MAX77802_RTC_UPDATE1 = 0xC5,
361 MAX77802_WTSR_SMPL_CNTL = 0xC6,
362 MAX77802_RTC_SEC = 0xC7,
363 MAX77802_RTC_MIN = 0xC8,
364 MAX77802_RTC_HOUR = 0xC9,
365 MAX77802_RTC_WEEKDAY = 0xCA,
366 MAX77802_RTC_MONTH = 0xCB,
367 MAX77802_RTC_YEAR = 0xCC,
368 MAX77802_RTC_DATE = 0xCD,
369 MAX77802_RTC_AE1 = 0xCE,
370 MAX77802_ALARM1_SEC = 0xCF,
371 MAX77802_ALARM1_MIN = 0xD0,
372 MAX77802_ALARM1_HOUR = 0xD1,
373 MAX77802_ALARM1_WEEKDAY = 0xD2,
374 MAX77802_ALARM1_MONTH = 0xD3,
375 MAX77802_ALARM1_YEAR = 0xD4,
376 MAX77802_ALARM1_DATE = 0xD5,
377 MAX77802_RTC_AE2 = 0xD6,
378 MAX77802_ALARM2_SEC = 0xD7,
379 MAX77802_ALARM2_MIN = 0xD8,
380 MAX77802_ALARM2_HOUR = 0xD9,
381 MAX77802_ALARM2_WEEKDAY = 0xDA,
382 MAX77802_ALARM2_MONTH = 0xDB,
383 MAX77802_ALARM2_YEAR = 0xDC,
384 MAX77802_ALARM2_DATE = 0xDD,
385
386 MAX77802_RTC_END = 0xDF,
387};
186 388
187enum max77686_irq_source { 389enum max77686_irq_source {
188 PMIC_INT1 = 0, 390 PMIC_INT1 = 0,
@@ -205,30 +407,46 @@ enum max77686_irq {
205 MAX77686_PMICIRQ_140C, 407 MAX77686_PMICIRQ_140C,
206 MAX77686_PMICIRQ_120C, 408 MAX77686_PMICIRQ_120C,
207 409
208 MAX77686_RTCIRQ_RTC60S, 410 MAX77686_RTCIRQ_RTC60S = 0,
209 MAX77686_RTCIRQ_RTCA1, 411 MAX77686_RTCIRQ_RTCA1,
210 MAX77686_RTCIRQ_RTCA2, 412 MAX77686_RTCIRQ_RTCA2,
211 MAX77686_RTCIRQ_SMPL, 413 MAX77686_RTCIRQ_SMPL,
212 MAX77686_RTCIRQ_RTC1S, 414 MAX77686_RTCIRQ_RTC1S,
213 MAX77686_RTCIRQ_WTSR, 415 MAX77686_RTCIRQ_WTSR,
214
215 MAX77686_IRQ_NR,
216}; 416};
217 417
418#define MAX77686_INT1_PWRONF_MSK BIT(0)
419#define MAX77686_INT1_PWRONR_MSK BIT(1)
420#define MAX77686_INT1_JIGONBF_MSK BIT(2)
421#define MAX77686_INT1_JIGONBR_MSK BIT(3)
422#define MAX77686_INT1_ACOKBF_MSK BIT(4)
423#define MAX77686_INT1_ACOKBR_MSK BIT(5)
424#define MAX77686_INT1_ONKEY1S_MSK BIT(6)
425#define MAX77686_INT1_MRSTB_MSK BIT(7)
426
427#define MAX77686_INT2_140C_MSK BIT(0)
428#define MAX77686_INT2_120C_MSK BIT(1)
429
430#define MAX77686_RTCINT_RTC60S_MSK BIT(0)
431#define MAX77686_RTCINT_RTCA1_MSK BIT(1)
432#define MAX77686_RTCINT_RTCA2_MSK BIT(2)
433#define MAX77686_RTCINT_SMPL_MSK BIT(3)
434#define MAX77686_RTCINT_RTC1S_MSK BIT(4)
435#define MAX77686_RTCINT_WTSR_MSK BIT(5)
436
218struct max77686_dev { 437struct max77686_dev {
219 struct device *dev; 438 struct device *dev;
220 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ 439 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
221 struct i2c_client *rtc; /* slave addr 0x0c */ 440 struct i2c_client *rtc; /* slave addr 0x0c */
222 441
223 int type; 442 unsigned long type;
224 443
225 struct regmap *regmap; /* regmap for mfd */ 444 struct regmap *regmap; /* regmap for mfd */
226 struct regmap *rtc_regmap; /* regmap for rtc */ 445 struct regmap *rtc_regmap; /* regmap for rtc */
227 446 struct regmap_irq_chip_data *irq_data;
228 struct irq_domain *irq_domain; 447 struct regmap_irq_chip_data *rtc_irq_data;
229 448
230 int irq; 449 int irq;
231 int irq_gpio;
232 bool wakeup; 450 bool wakeup;
233 struct mutex irqlock; 451 struct mutex irqlock;
234 int irq_masks_cur[MAX77686_IRQ_GROUP_NR]; 452 int irq_masks_cur[MAX77686_IRQ_GROUP_NR];
@@ -237,6 +455,7 @@ struct max77686_dev {
237 455
238enum max77686_types { 456enum max77686_types {
239 TYPE_MAX77686, 457 TYPE_MAX77686,
458 TYPE_MAX77802,
240}; 459};
241 460
242extern int max77686_irq_init(struct max77686_dev *max77686); 461extern int max77686_irq_init(struct max77686_dev *max77686);
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
index 46c0f320ed76..7e6dc4b2b795 100644
--- a/include/linux/mfd/max77686.h
+++ b/include/linux/mfd/max77686.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max77686.h - Driver for the Maxim 77686 2 * max77686.h - Driver for the Maxim 77686/802
3 * 3 *
4 * Copyright (C) 2012 Samsung Electrnoics 4 * Copyright (C) 2012 Samsung Electrnoics
5 * Chiwoong Byun <woong.byun@samsung.com> 5 * Chiwoong Byun <woong.byun@samsung.com>
@@ -71,6 +71,54 @@ enum max77686_regulators {
71 MAX77686_REG_MAX, 71 MAX77686_REG_MAX,
72}; 72};
73 73
74/* MAX77802 regulator IDs */
75enum max77802_regulators {
76 MAX77802_BUCK1 = 0,
77 MAX77802_BUCK2,
78 MAX77802_BUCK3,
79 MAX77802_BUCK4,
80 MAX77802_BUCK5,
81 MAX77802_BUCK6,
82 MAX77802_BUCK7,
83 MAX77802_BUCK8,
84 MAX77802_BUCK9,
85 MAX77802_BUCK10,
86 MAX77802_LDO1,
87 MAX77802_LDO2,
88 MAX77802_LDO3,
89 MAX77802_LDO4,
90 MAX77802_LDO5,
91 MAX77802_LDO6,
92 MAX77802_LDO7,
93 MAX77802_LDO8,
94 MAX77802_LDO9,
95 MAX77802_LDO10,
96 MAX77802_LDO11,
97 MAX77802_LDO12,
98 MAX77802_LDO13,
99 MAX77802_LDO14,
100 MAX77802_LDO15,
101 MAX77802_LDO17,
102 MAX77802_LDO18,
103 MAX77802_LDO19,
104 MAX77802_LDO20,
105 MAX77802_LDO21,
106 MAX77802_LDO23,
107 MAX77802_LDO24,
108 MAX77802_LDO25,
109 MAX77802_LDO26,
110 MAX77802_LDO27,
111 MAX77802_LDO28,
112 MAX77802_LDO29,
113 MAX77802_LDO30,
114 MAX77802_LDO32,
115 MAX77802_LDO33,
116 MAX77802_LDO34,
117 MAX77802_LDO35,
118
119 MAX77802_REG_MAX,
120};
121
74struct max77686_regulator_data { 122struct max77686_regulator_data {
75 int id; 123 int id;
76 struct regulator_init_data *initdata; 124 struct regulator_init_data *initdata;
@@ -83,14 +131,19 @@ enum max77686_opmode {
83 MAX77686_OPMODE_STANDBY, 131 MAX77686_OPMODE_STANDBY,
84}; 132};
85 133
134enum max77802_opmode {
135 MAX77802_OPMODE_OFF,
136 MAX77802_OPMODE_STANDBY,
137 MAX77802_OPMODE_LP,
138 MAX77802_OPMODE_NORMAL,
139};
140
86struct max77686_opmode_data { 141struct max77686_opmode_data {
87 int id; 142 int id;
88 int mode; 143 int mode;
89}; 144};
90 145
91struct max77686_platform_data { 146struct max77686_platform_data {
92 /* IRQ */
93 int irq_gpio;
94 int ono; 147 int ono;
95 int wakeup; 148 int wakeup;
96 149
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 3e050b933dd0..c466ff3e16b8 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -262,6 +262,41 @@ enum max77693_irq_source {
262 MAX77693_IRQ_GROUP_NR, 262 MAX77693_IRQ_GROUP_NR,
263}; 263};
264 264
265#define LED_IRQ_FLED2_OPEN BIT(0)
266#define LED_IRQ_FLED2_SHORT BIT(1)
267#define LED_IRQ_FLED1_OPEN BIT(2)
268#define LED_IRQ_FLED1_SHORT BIT(3)
269#define LED_IRQ_MAX_FLASH BIT(4)
270
271#define TOPSYS_IRQ_T120C_INT BIT(0)
272#define TOPSYS_IRQ_T140C_INT BIT(1)
273#define TOPSYS_IRQ_LOWSYS_INT BIT(3)
274
275#define CHG_IRQ_BYP_I BIT(0)
276#define CHG_IRQ_THM_I BIT(2)
277#define CHG_IRQ_BAT_I BIT(3)
278#define CHG_IRQ_CHG_I BIT(4)
279#define CHG_IRQ_CHGIN_I BIT(6)
280
281#define MUIC_IRQ_INT1_ADC BIT(0)
282#define MUIC_IRQ_INT1_ADC_LOW BIT(1)
283#define MUIC_IRQ_INT1_ADC_ERR BIT(2)
284#define MUIC_IRQ_INT1_ADC1K BIT(3)
285
286#define MUIC_IRQ_INT2_CHGTYP BIT(0)
287#define MUIC_IRQ_INT2_CHGDETREUN BIT(1)
288#define MUIC_IRQ_INT2_DCDTMR BIT(2)
289#define MUIC_IRQ_INT2_DXOVP BIT(3)
290#define MUIC_IRQ_INT2_VBVOLT BIT(4)
291#define MUIC_IRQ_INT2_VIDRM BIT(5)
292
293#define MUIC_IRQ_INT3_EOC BIT(0)
294#define MUIC_IRQ_INT3_CGMBC BIT(1)
295#define MUIC_IRQ_INT3_OVP BIT(2)
296#define MUIC_IRQ_INT3_MBCCHG_ERR BIT(3)
297#define MUIC_IRQ_INT3_CHG_ENABLED BIT(4)
298#define MUIC_IRQ_INT3_BAT_DET BIT(5)
299
265enum max77693_irq { 300enum max77693_irq {
266 /* PMIC - FLASH */ 301 /* PMIC - FLASH */
267 MAX77693_LED_IRQ_FLED2_OPEN, 302 MAX77693_LED_IRQ_FLED2_OPEN,
@@ -282,6 +317,10 @@ enum max77693_irq {
282 MAX77693_CHG_IRQ_CHG_I, 317 MAX77693_CHG_IRQ_CHG_I,
283 MAX77693_CHG_IRQ_CHGIN_I, 318 MAX77693_CHG_IRQ_CHGIN_I,
284 319
320 MAX77693_IRQ_NR,
321};
322
323enum max77693_irq_muic {
285 /* MUIC INT1 */ 324 /* MUIC INT1 */
286 MAX77693_MUIC_IRQ_INT1_ADC, 325 MAX77693_MUIC_IRQ_INT1_ADC,
287 MAX77693_MUIC_IRQ_INT1_ADC_LOW, 326 MAX77693_MUIC_IRQ_INT1_ADC_LOW,
@@ -304,7 +343,7 @@ enum max77693_irq {
304 MAX77693_MUIC_IRQ_INT3_CHG_ENABLED, 343 MAX77693_MUIC_IRQ_INT3_CHG_ENABLED,
305 MAX77693_MUIC_IRQ_INT3_BAT_DET, 344 MAX77693_MUIC_IRQ_INT3_BAT_DET,
306 345
307 MAX77693_IRQ_NR, 346 MAX77693_MUIC_IRQ_NR,
308}; 347};
309 348
310struct max77693_dev { 349struct max77693_dev {
@@ -319,7 +358,10 @@ struct max77693_dev {
319 struct regmap *regmap_muic; 358 struct regmap *regmap_muic;
320 struct regmap *regmap_haptic; 359 struct regmap *regmap_haptic;
321 360
322 struct irq_domain *irq_domain; 361 struct regmap_irq_chip_data *irq_data_led;
362 struct regmap_irq_chip_data *irq_data_topsys;
363 struct regmap_irq_chip_data *irq_data_charger;
364 struct regmap_irq_chip_data *irq_data_muic;
323 365
324 int irq; 366 int irq;
325 int irq_gpio; 367 int irq_gpio;
@@ -332,14 +374,6 @@ enum max77693_types {
332 TYPE_MAX77693, 374 TYPE_MAX77693,
333}; 375};
334 376
335extern int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest);
336extern int max77693_bulk_read(struct regmap *map, u8 reg, int count,
337 u8 *buf);
338extern int max77693_write_reg(struct regmap *map, u8 reg, u8 value);
339extern int max77693_bulk_write(struct regmap *map, u8 reg, int count,
340 u8 *buf);
341extern int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask);
342
343extern int max77693_irq_init(struct max77693_dev *max77686); 377extern int max77693_irq_init(struct max77693_dev *max77686);
344extern void max77693_irq_exit(struct max77693_dev *max77686); 378extern void max77693_irq_exit(struct max77693_dev *max77686);
345extern int max77693_irq_resume(struct max77693_dev *max77686); 379extern int max77693_irq_resume(struct max77693_dev *max77686);
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index a8eeda773a7b..4ff6137d8d67 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -86,6 +86,5 @@
86#define MC13783_IRQ_HSL 43 86#define MC13783_IRQ_HSL 43
87#define MC13783_IRQ_ALSPTH 44 87#define MC13783_IRQ_ALSPTH 44
88#define MC13783_IRQ_AHSSHORT 45 88#define MC13783_IRQ_AHSSHORT 45
89#define MC13783_NUM_IRQ MC13XXX_NUM_IRQ
90 89
91#endif /* ifndef __LINUX_MFD_MC13783_H */ 90#endif /* ifndef __LINUX_MFD_MC13783_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index d63b1d309106..638222e43e48 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -23,15 +23,10 @@ int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset,
23 23
24int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq, 24int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq,
25 irq_handler_t handler, const char *name, void *dev); 25 irq_handler_t handler, const char *name, void *dev);
26int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
27 irq_handler_t handler, const char *name, void *dev);
28int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev); 26int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev);
29 27
30int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
31int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
32int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq, 28int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq,
33 int *enabled, int *pending); 29 int *enabled, int *pending);
34int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq);
35 30
36int mc13xxx_get_flags(struct mc13xxx *mc13xxx); 31int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
37 32
@@ -39,6 +34,22 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
39 unsigned int mode, unsigned int channel, 34 unsigned int mode, unsigned int channel,
40 u8 ato, bool atox, unsigned int *sample); 35 u8 ato, bool atox, unsigned int *sample);
41 36
37/* Deprecated calls */
38static inline int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq)
39{
40 return 0;
41}
42
43static inline int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
44 irq_handler_t handler,
45 const char *name, void *dev)
46{
47 return mc13xxx_irq_request(mc13xxx, irq, handler, name, dev);
48}
49
50int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
51int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
52
42#define MC13783_AUDIO_RX0 36 53#define MC13783_AUDIO_RX0 36
43#define MC13783_AUDIO_RX1 37 54#define MC13783_AUDIO_RX1 37
44#define MC13783_AUDIO_TX 38 55#define MC13783_AUDIO_TX 38
@@ -68,8 +79,6 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
68#define MC13XXX_IRQ_THWARNH 37 79#define MC13XXX_IRQ_THWARNH 37
69#define MC13XXX_IRQ_CLK 38 80#define MC13XXX_IRQ_CLK 38
70 81
71#define MC13XXX_NUM_IRQ 46
72
73struct regulator_init_data; 82struct regulator_init_data;
74 83
75struct mc13xxx_regulator_init_data { 84struct mc13xxx_regulator_init_data {
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 3420e09e2e20..fb0390a1a498 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -30,6 +30,8 @@
30#define PALMAS_CHIP_ID 0xC035 30#define PALMAS_CHIP_ID 0xC035
31#define PALMAS_CHIP_CHARGER_ID 0xC036 31#define PALMAS_CHIP_CHARGER_ID 0xC036
32 32
33#define TPS65917_RESERVED -1
34
33#define is_palmas(a) (((a) == PALMAS_CHIP_OLD_ID) || \ 35#define is_palmas(a) (((a) == PALMAS_CHIP_OLD_ID) || \
34 ((a) == PALMAS_CHIP_ID)) 36 ((a) == PALMAS_CHIP_ID))
35#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) 37#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID)
@@ -51,6 +53,8 @@ struct palmas_pmic;
51struct palmas_gpadc; 53struct palmas_gpadc;
52struct palmas_resource; 54struct palmas_resource;
53struct palmas_usb; 55struct palmas_usb;
56struct palmas_pmic_driver_data;
57struct palmas_pmic_platform_data;
54 58
55enum palmas_usb_state { 59enum palmas_usb_state {
56 PALMAS_USB_STATE_DISCONNECT, 60 PALMAS_USB_STATE_DISCONNECT,
@@ -74,6 +78,8 @@ struct palmas {
74 struct mutex irq_lock; 78 struct mutex irq_lock;
75 struct regmap_irq_chip_data *irq_data; 79 struct regmap_irq_chip_data *irq_data;
76 80
81 struct palmas_pmic_driver_data *pmic_ddata;
82
77 /* Child Devices */ 83 /* Child Devices */
78 struct palmas_pmic *pmic; 84 struct palmas_pmic *pmic;
79 struct palmas_gpadc *gpadc; 85 struct palmas_gpadc *gpadc;
@@ -86,6 +92,46 @@ struct palmas {
86 u8 pwm_muxed; 92 u8 pwm_muxed;
87}; 93};
88 94
95#define PALMAS_EXT_REQ (PALMAS_EXT_CONTROL_ENABLE1 | \
96 PALMAS_EXT_CONTROL_ENABLE2 | \
97 PALMAS_EXT_CONTROL_NSLEEP)
98
99struct palmas_sleep_requestor_info {
100 int id;
101 int reg_offset;
102 int bit_pos;
103};
104
105struct palmas_regs_info {
106 char *name;
107 char *sname;
108 u8 vsel_addr;
109 u8 ctrl_addr;
110 u8 tstep_addr;
111 int sleep_id;
112};
113
114struct palmas_pmic_driver_data {
115 int smps_start;
116 int smps_end;
117 int ldo_begin;
118 int ldo_end;
119 int max_reg;
120 struct palmas_regs_info *palmas_regs_info;
121 struct of_regulator_match *palmas_matches;
122 struct palmas_sleep_requestor_info *sleep_req_info;
123 int (*smps_register)(struct palmas_pmic *pmic,
124 struct palmas_pmic_driver_data *ddata,
125 struct palmas_pmic_platform_data *pdata,
126 const char *pdev_name,
127 struct regulator_config config);
128 int (*ldo_register)(struct palmas_pmic *pmic,
129 struct palmas_pmic_driver_data *ddata,
130 struct palmas_pmic_platform_data *pdata,
131 const char *pdev_name,
132 struct regulator_config config);
133};
134
89struct palmas_gpadc_platform_data { 135struct palmas_gpadc_platform_data {
90 /* Channel 3 current source is only enabled during conversion */ 136 /* Channel 3 current source is only enabled during conversion */
91 int ch3_current; 137 int ch3_current;
@@ -184,6 +230,27 @@ enum palmas_regulators {
184 PALMAS_NUM_REGS, 230 PALMAS_NUM_REGS,
185}; 231};
186 232
233enum tps65917_regulators {
234 /* SMPS regulators */
235 TPS65917_REG_SMPS1,
236 TPS65917_REG_SMPS2,
237 TPS65917_REG_SMPS3,
238 TPS65917_REG_SMPS4,
239 TPS65917_REG_SMPS5,
240 /* LDO regulators */
241 TPS65917_REG_LDO1,
242 TPS65917_REG_LDO2,
243 TPS65917_REG_LDO3,
244 TPS65917_REG_LDO4,
245 TPS65917_REG_LDO5,
246 TPS65917_REG_REGEN1,
247 TPS65917_REG_REGEN2,
248 TPS65917_REG_REGEN3,
249
250 /* Total number of regulators */
251 TPS65917_NUM_REGS,
252};
253
187/* External controll signal name */ 254/* External controll signal name */
188enum { 255enum {
189 PALMAS_EXT_CONTROL_ENABLE1 = 0x1, 256 PALMAS_EXT_CONTROL_ENABLE1 = 0x1,
@@ -228,6 +295,24 @@ enum palmas_external_requestor_id {
228 PALMAS_EXTERNAL_REQSTR_ID_MAX, 295 PALMAS_EXTERNAL_REQSTR_ID_MAX,
229}; 296};
230 297
298enum tps65917_external_requestor_id {
299 TPS65917_EXTERNAL_REQSTR_ID_REGEN1,
300 TPS65917_EXTERNAL_REQSTR_ID_REGEN2,
301 TPS65917_EXTERNAL_REQSTR_ID_REGEN3,
302 TPS65917_EXTERNAL_REQSTR_ID_SMPS1,
303 TPS65917_EXTERNAL_REQSTR_ID_SMPS2,
304 TPS65917_EXTERNAL_REQSTR_ID_SMPS3,
305 TPS65917_EXTERNAL_REQSTR_ID_SMPS4,
306 TPS65917_EXTERNAL_REQSTR_ID_SMPS5,
307 TPS65917_EXTERNAL_REQSTR_ID_LDO1,
308 TPS65917_EXTERNAL_REQSTR_ID_LDO2,
309 TPS65917_EXTERNAL_REQSTR_ID_LDO3,
310 TPS65917_EXTERNAL_REQSTR_ID_LDO4,
311 TPS65917_EXTERNAL_REQSTR_ID_LDO5,
312 /* Last entry */
313 TPS65917_EXTERNAL_REQSTR_ID_MAX,
314};
315
231struct palmas_pmic_platform_data { 316struct palmas_pmic_platform_data {
232 /* An array of pointers to regulator init data indexed by regulator 317 /* An array of pointers to regulator init data indexed by regulator
233 * ID 318 * ID
@@ -349,6 +434,48 @@ struct palmas_gpadc_result {
349 434
350#define PALMAS_MAX_CHANNELS 16 435#define PALMAS_MAX_CHANNELS 16
351 436
437/* Define the tps65917 IRQ numbers */
438enum tps65917_irqs {
439 /* INT1 registers */
440 TPS65917_RESERVED1,
441 TPS65917_PWRON_IRQ,
442 TPS65917_LONG_PRESS_KEY_IRQ,
443 TPS65917_RESERVED2,
444 TPS65917_PWRDOWN_IRQ,
445 TPS65917_HOTDIE_IRQ,
446 TPS65917_VSYS_MON_IRQ,
447 TPS65917_RESERVED3,
448 /* INT2 registers */
449 TPS65917_RESERVED4,
450 TPS65917_OTP_ERROR_IRQ,
451 TPS65917_WDT_IRQ,
452 TPS65917_RESERVED5,
453 TPS65917_RESET_IN_IRQ,
454 TPS65917_FSD_IRQ,
455 TPS65917_SHORT_IRQ,
456 TPS65917_RESERVED6,
457 /* INT3 registers */
458 TPS65917_GPADC_AUTO_0_IRQ,
459 TPS65917_GPADC_AUTO_1_IRQ,
460 TPS65917_GPADC_EOC_SW_IRQ,
461 TPS65917_RESREVED6,
462 TPS65917_RESERVED7,
463 TPS65917_RESERVED8,
464 TPS65917_RESERVED9,
465 TPS65917_VBUS_IRQ,
466 /* INT4 registers */
467 TPS65917_GPIO_0_IRQ,
468 TPS65917_GPIO_1_IRQ,
469 TPS65917_GPIO_2_IRQ,
470 TPS65917_GPIO_3_IRQ,
471 TPS65917_GPIO_4_IRQ,
472 TPS65917_GPIO_5_IRQ,
473 TPS65917_GPIO_6_IRQ,
474 TPS65917_RESERVED10,
475 /* Total Number IRQs */
476 TPS65917_NUM_IRQ,
477};
478
352/* Define the palmas IRQ numbers */ 479/* Define the palmas IRQ numbers */
353enum palmas_irqs { 480enum palmas_irqs {
354 /* INT1 registers */ 481 /* INT1 registers */
@@ -400,6 +527,7 @@ struct palmas_pmic {
400 527
401 int smps123; 528 int smps123;
402 int smps457; 529 int smps457;
530 int smps12;
403 531
404 int range[PALMAS_REG_SMPS10_OUT1]; 532 int range[PALMAS_REG_SMPS10_OUT1];
405 unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1]; 533 unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1];
@@ -2871,6 +2999,715 @@ enum usb_irq_events {
2871#define PALMAS_GPADC_TRIM15 0x0E 2999#define PALMAS_GPADC_TRIM15 0x0E
2872#define PALMAS_GPADC_TRIM16 0x0F 3000#define PALMAS_GPADC_TRIM16 0x0F
2873 3001
3002/* TPS65917 Interrupt registers */
3003
3004/* Registers for function INTERRUPT */
3005#define TPS65917_INT1_STATUS 0x00
3006#define TPS65917_INT1_MASK 0x01
3007#define TPS65917_INT1_LINE_STATE 0x02
3008#define TPS65917_INT2_STATUS 0x05
3009#define TPS65917_INT2_MASK 0x06
3010#define TPS65917_INT2_LINE_STATE 0x07
3011#define TPS65917_INT3_STATUS 0x0A
3012#define TPS65917_INT3_MASK 0x0B
3013#define TPS65917_INT3_LINE_STATE 0x0C
3014#define TPS65917_INT4_STATUS 0x0F
3015#define TPS65917_INT4_MASK 0x10
3016#define TPS65917_INT4_LINE_STATE 0x11
3017#define TPS65917_INT4_EDGE_DETECT1 0x12
3018#define TPS65917_INT4_EDGE_DETECT2 0x13
3019#define TPS65917_INT_CTRL 0x14
3020
3021/* Bit definitions for INT1_STATUS */
3022#define TPS65917_INT1_STATUS_VSYS_MON 0x40
3023#define TPS65917_INT1_STATUS_VSYS_MON_SHIFT 0x06
3024#define TPS65917_INT1_STATUS_HOTDIE 0x20
3025#define TPS65917_INT1_STATUS_HOTDIE_SHIFT 0x05
3026#define TPS65917_INT1_STATUS_PWRDOWN 0x10
3027#define TPS65917_INT1_STATUS_PWRDOWN_SHIFT 0x04
3028#define TPS65917_INT1_STATUS_LONG_PRESS_KEY 0x04
3029#define TPS65917_INT1_STATUS_LONG_PRESS_KEY_SHIFT 0x02
3030#define TPS65917_INT1_STATUS_PWRON 0x02
3031#define TPS65917_INT1_STATUS_PWRON_SHIFT 0x01
3032
3033/* Bit definitions for INT1_MASK */
3034#define TPS65917_INT1_MASK_VSYS_MON 0x40
3035#define TPS65917_INT1_MASK_VSYS_MON_SHIFT 0x06
3036#define TPS65917_INT1_MASK_HOTDIE 0x20
3037#define TPS65917_INT1_MASK_HOTDIE_SHIFT 0x05
3038#define TPS65917_INT1_MASK_PWRDOWN 0x10
3039#define TPS65917_INT1_MASK_PWRDOWN_SHIFT 0x04
3040#define TPS65917_INT1_MASK_LONG_PRESS_KEY 0x04
3041#define TPS65917_INT1_MASK_LONG_PRESS_KEY_SHIFT 0x02
3042#define TPS65917_INT1_MASK_PWRON 0x02
3043#define TPS65917_INT1_MASK_PWRON_SHIFT 0x01
3044
3045/* Bit definitions for INT1_LINE_STATE */
3046#define TPS65917_INT1_LINE_STATE_VSYS_MON 0x40
3047#define TPS65917_INT1_LINE_STATE_VSYS_MON_SHIFT 0x06
3048#define TPS65917_INT1_LINE_STATE_HOTDIE 0x20
3049#define TPS65917_INT1_LINE_STATE_HOTDIE_SHIFT 0x05
3050#define TPS65917_INT1_LINE_STATE_PWRDOWN 0x10
3051#define TPS65917_INT1_LINE_STATE_PWRDOWN_SHIFT 0x04
3052#define TPS65917_INT1_LINE_STATE_LONG_PRESS_KEY 0x04
3053#define TPS65917_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 0x02
3054#define TPS65917_INT1_LINE_STATE_PWRON 0x02
3055#define TPS65917_INT1_LINE_STATE_PWRON_SHIFT 0x01
3056
3057/* Bit definitions for INT2_STATUS */
3058#define TPS65917_INT2_STATUS_SHORT 0x40
3059#define TPS65917_INT2_STATUS_SHORT_SHIFT 0x06
3060#define TPS65917_INT2_STATUS_FSD 0x20
3061#define TPS65917_INT2_STATUS_FSD_SHIFT 0x05
3062#define TPS65917_INT2_STATUS_RESET_IN 0x10
3063#define TPS65917_INT2_STATUS_RESET_IN_SHIFT 0x04
3064#define TPS65917_INT2_STATUS_WDT 0x04
3065#define TPS65917_INT2_STATUS_WDT_SHIFT 0x02
3066#define TPS65917_INT2_STATUS_OTP_ERROR 0x02
3067#define TPS65917_INT2_STATUS_OTP_ERROR_SHIFT 0x01
3068
3069/* Bit definitions for INT2_MASK */
3070#define TPS65917_INT2_MASK_SHORT 0x40
3071#define TPS65917_INT2_MASK_SHORT_SHIFT 0x06
3072#define TPS65917_INT2_MASK_FSD 0x20
3073#define TPS65917_INT2_MASK_FSD_SHIFT 0x05
3074#define TPS65917_INT2_MASK_RESET_IN 0x10
3075#define TPS65917_INT2_MASK_RESET_IN_SHIFT 0x04
3076#define TPS65917_INT2_MASK_WDT 0x04
3077#define TPS65917_INT2_MASK_WDT_SHIFT 0x02
3078#define TPS65917_INT2_MASK_OTP_ERROR_TIMER 0x02
3079#define TPS65917_INT2_MASK_OTP_ERROR_SHIFT 0x01
3080
3081/* Bit definitions for INT2_LINE_STATE */
3082#define TPS65917_INT2_LINE_STATE_SHORT 0x40
3083#define TPS65917_INT2_LINE_STATE_SHORT_SHIFT 0x06
3084#define TPS65917_INT2_LINE_STATE_FSD 0x20
3085#define TPS65917_INT2_LINE_STATE_FSD_SHIFT 0x05
3086#define TPS65917_INT2_LINE_STATE_RESET_IN 0x10
3087#define TPS65917_INT2_LINE_STATE_RESET_IN_SHIFT 0x04
3088#define TPS65917_INT2_LINE_STATE_WDT 0x04
3089#define TPS65917_INT2_LINE_STATE_WDT_SHIFT 0x02
3090#define TPS65917_INT2_LINE_STATE_OTP_ERROR 0x02
3091#define TPS65917_INT2_LINE_STATE_OTP_ERROR_SHIFT 0x01
3092
3093/* Bit definitions for INT3_STATUS */
3094#define TPS65917_INT3_STATUS_VBUS 0x80
3095#define TPS65917_INT3_STATUS_VBUS_SHIFT 0x07
3096#define TPS65917_INT3_STATUS_GPADC_EOC_SW 0x04
3097#define TPS65917_INT3_STATUS_GPADC_EOC_SW_SHIFT 0x02
3098#define TPS65917_INT3_STATUS_GPADC_AUTO_1 0x02
3099#define TPS65917_INT3_STATUS_GPADC_AUTO_1_SHIFT 0x01
3100#define TPS65917_INT3_STATUS_GPADC_AUTO_0 0x01
3101#define TPS65917_INT3_STATUS_GPADC_AUTO_0_SHIFT 0x00
3102
3103/* Bit definitions for INT3_MASK */
3104#define TPS65917_INT3_MASK_VBUS 0x80
3105#define TPS65917_INT3_MASK_VBUS_SHIFT 0x07
3106#define TPS65917_INT3_MASK_GPADC_EOC_SW 0x04
3107#define TPS65917_INT3_MASK_GPADC_EOC_SW_SHIFT 0x02
3108#define TPS65917_INT3_MASK_GPADC_AUTO_1 0x02
3109#define TPS65917_INT3_MASK_GPADC_AUTO_1_SHIFT 0x01
3110#define TPS65917_INT3_MASK_GPADC_AUTO_0 0x01
3111#define TPS65917_INT3_MASK_GPADC_AUTO_0_SHIFT 0x00
3112
3113/* Bit definitions for INT3_LINE_STATE */
3114#define TPS65917_INT3_LINE_STATE_VBUS 0x80
3115#define TPS65917_INT3_LINE_STATE_VBUS_SHIFT 0x07
3116#define TPS65917_INT3_LINE_STATE_GPADC_EOC_SW 0x04
3117#define TPS65917_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 0x02
3118#define TPS65917_INT3_LINE_STATE_GPADC_AUTO_1 0x02
3119#define TPS65917_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 0x01
3120#define TPS65917_INT3_LINE_STATE_GPADC_AUTO_0 0x01
3121#define TPS65917_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0x00
3122
3123/* Bit definitions for INT4_STATUS */
3124#define TPS65917_INT4_STATUS_GPIO_6 0x40
3125#define TPS65917_INT4_STATUS_GPIO_6_SHIFT 0x06
3126#define TPS65917_INT4_STATUS_GPIO_5 0x20
3127#define TPS65917_INT4_STATUS_GPIO_5_SHIFT 0x05
3128#define TPS65917_INT4_STATUS_GPIO_4 0x10
3129#define TPS65917_INT4_STATUS_GPIO_4_SHIFT 0x04
3130#define TPS65917_INT4_STATUS_GPIO_3 0x08
3131#define TPS65917_INT4_STATUS_GPIO_3_SHIFT 0x03
3132#define TPS65917_INT4_STATUS_GPIO_2 0x04
3133#define TPS65917_INT4_STATUS_GPIO_2_SHIFT 0x02
3134#define TPS65917_INT4_STATUS_GPIO_1 0x02
3135#define TPS65917_INT4_STATUS_GPIO_1_SHIFT 0x01
3136#define TPS65917_INT4_STATUS_GPIO_0 0x01
3137#define TPS65917_INT4_STATUS_GPIO_0_SHIFT 0x00
3138
3139/* Bit definitions for INT4_MASK */
3140#define TPS65917_INT4_MASK_GPIO_6 0x40
3141#define TPS65917_INT4_MASK_GPIO_6_SHIFT 0x06
3142#define TPS65917_INT4_MASK_GPIO_5 0x20
3143#define TPS65917_INT4_MASK_GPIO_5_SHIFT 0x05
3144#define TPS65917_INT4_MASK_GPIO_4 0x10
3145#define TPS65917_INT4_MASK_GPIO_4_SHIFT 0x04
3146#define TPS65917_INT4_MASK_GPIO_3 0x08
3147#define TPS65917_INT4_MASK_GPIO_3_SHIFT 0x03
3148#define TPS65917_INT4_MASK_GPIO_2 0x04
3149#define TPS65917_INT4_MASK_GPIO_2_SHIFT 0x02
3150#define TPS65917_INT4_MASK_GPIO_1 0x02
3151#define TPS65917_INT4_MASK_GPIO_1_SHIFT 0x01
3152#define TPS65917_INT4_MASK_GPIO_0 0x01
3153#define TPS65917_INT4_MASK_GPIO_0_SHIFT 0x00
3154
3155/* Bit definitions for INT4_LINE_STATE */
3156#define TPS65917_INT4_LINE_STATE_GPIO_6 0x40
3157#define TPS65917_INT4_LINE_STATE_GPIO_6_SHIFT 0x06
3158#define TPS65917_INT4_LINE_STATE_GPIO_5 0x20
3159#define TPS65917_INT4_LINE_STATE_GPIO_5_SHIFT 0x05
3160#define TPS65917_INT4_LINE_STATE_GPIO_4 0x10
3161#define TPS65917_INT4_LINE_STATE_GPIO_4_SHIFT 0x04
3162#define TPS65917_INT4_LINE_STATE_GPIO_3 0x08
3163#define TPS65917_INT4_LINE_STATE_GPIO_3_SHIFT 0x03
3164#define TPS65917_INT4_LINE_STATE_GPIO_2 0x04
3165#define TPS65917_INT4_LINE_STATE_GPIO_2_SHIFT 0x02
3166#define TPS65917_INT4_LINE_STATE_GPIO_1 0x02
3167#define TPS65917_INT4_LINE_STATE_GPIO_1_SHIFT 0x01
3168#define TPS65917_INT4_LINE_STATE_GPIO_0 0x01
3169#define TPS65917_INT4_LINE_STATE_GPIO_0_SHIFT 0x00
3170
3171/* Bit definitions for INT4_EDGE_DETECT1 */
3172#define TPS65917_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80
3173#define TPS65917_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 0x07
3174#define TPS65917_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40
3175#define TPS65917_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 0x06
3176#define TPS65917_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20
3177#define TPS65917_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 0x05
3178#define TPS65917_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10
3179#define TPS65917_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 0x04
3180#define TPS65917_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08
3181#define TPS65917_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 0x03
3182#define TPS65917_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04
3183#define TPS65917_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 0x02
3184#define TPS65917_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02
3185#define TPS65917_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 0x01
3186#define TPS65917_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01
3187#define TPS65917_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0x00
3188
3189/* Bit definitions for INT4_EDGE_DETECT2 */
3190#define TPS65917_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20
3191#define TPS65917_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 0x05
3192#define TPS65917_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10
3193#define TPS65917_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 0x04
3194#define TPS65917_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08
3195#define TPS65917_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 0x03
3196#define TPS65917_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04
3197#define TPS65917_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 0x02
3198#define TPS65917_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02
3199#define TPS65917_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 0x01
3200#define TPS65917_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01
3201#define TPS65917_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0x00
3202
3203/* Bit definitions for INT_CTRL */
3204#define TPS65917_INT_CTRL_INT_PENDING 0x04
3205#define TPS65917_INT_CTRL_INT_PENDING_SHIFT 0x02
3206#define TPS65917_INT_CTRL_INT_CLEAR 0x01
3207#define TPS65917_INT_CTRL_INT_CLEAR_SHIFT 0x00
3208
3209/* TPS65917 SMPS Registers */
3210
3211/* Registers for function SMPS */
3212#define TPS65917_SMPS1_CTRL 0x00
3213#define TPS65917_SMPS1_FORCE 0x02
3214#define TPS65917_SMPS1_VOLTAGE 0x03
3215#define TPS65917_SMPS2_CTRL 0x04
3216#define TPS65917_SMPS2_FORCE 0x06
3217#define TPS65917_SMPS2_VOLTAGE 0x07
3218#define TPS65917_SMPS3_CTRL 0x0C
3219#define TPS65917_SMPS3_FORCE 0x0E
3220#define TPS65917_SMPS3_VOLTAGE 0x0F
3221#define TPS65917_SMPS4_CTRL 0x10
3222#define TPS65917_SMPS4_VOLTAGE 0x13
3223#define TPS65917_SMPS5_CTRL 0x18
3224#define TPS65917_SMPS5_VOLTAGE 0x1B
3225#define TPS65917_SMPS_CTRL 0x24
3226#define TPS65917_SMPS_PD_CTRL 0x25
3227#define TPS65917_SMPS_THERMAL_EN 0x27
3228#define TPS65917_SMPS_THERMAL_STATUS 0x28
3229#define TPS65917_SMPS_SHORT_STATUS 0x29
3230#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN 0x2A
3231#define TPS65917_SMPS_POWERGOOD_MASK1 0x2B
3232#define TPS65917_SMPS_POWERGOOD_MASK2 0x2C
3233
3234/* Bit definitions for SMPS1_CTRL */
3235#define TPS65917_SMPS1_CTRL_WR_S 0x80
3236#define TPS65917_SMPS1_CTRL_WR_S_SHIFT 0x07
3237#define TPS65917_SMPS1_CTRL_ROOF_FLOOR_EN 0x40
3238#define TPS65917_SMPS1_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3239#define TPS65917_SMPS1_CTRL_STATUS_MASK 0x30
3240#define TPS65917_SMPS1_CTRL_STATUS_SHIFT 0x04
3241#define TPS65917_SMPS1_CTRL_MODE_SLEEP_MASK 0x0C
3242#define TPS65917_SMPS1_CTRL_MODE_SLEEP_SHIFT 0x02
3243#define TPS65917_SMPS1_CTRL_MODE_ACTIVE_MASK 0x03
3244#define TPS65917_SMPS1_CTRL_MODE_ACTIVE_SHIFT 0x00
3245
3246/* Bit definitions for SMPS1_FORCE */
3247#define TPS65917_SMPS1_FORCE_CMD 0x80
3248#define TPS65917_SMPS1_FORCE_CMD_SHIFT 0x07
3249#define TPS65917_SMPS1_FORCE_VSEL_MASK 0x7F
3250#define TPS65917_SMPS1_FORCE_VSEL_SHIFT 0x00
3251
3252/* Bit definitions for SMPS1_VOLTAGE */
3253#define TPS65917_SMPS1_VOLTAGE_RANGE 0x80
3254#define TPS65917_SMPS1_VOLTAGE_RANGE_SHIFT 0x07
3255#define TPS65917_SMPS1_VOLTAGE_VSEL_MASK 0x7F
3256#define TPS65917_SMPS1_VOLTAGE_VSEL_SHIFT 0x00
3257
3258/* Bit definitions for SMPS2_CTRL */
3259#define TPS65917_SMPS2_CTRL_WR_S 0x80
3260#define TPS65917_SMPS2_CTRL_WR_S_SHIFT 0x07
3261#define TPS65917_SMPS2_CTRL_ROOF_FLOOR_EN 0x40
3262#define TPS65917_SMPS2_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3263#define TPS65917_SMPS2_CTRL_STATUS_MASK 0x30
3264#define TPS65917_SMPS2_CTRL_STATUS_SHIFT 0x04
3265#define TPS65917_SMPS2_CTRL_MODE_SLEEP_MASK 0x0C
3266#define TPS65917_SMPS2_CTRL_MODE_SLEEP_SHIFT 0x02
3267#define TPS65917_SMPS2_CTRL_MODE_ACTIVE_MASK 0x03
3268#define TPS65917_SMPS2_CTRL_MODE_ACTIVE_SHIFT 0x00
3269
3270/* Bit definitions for SMPS2_FORCE */
3271#define TPS65917_SMPS2_FORCE_CMD 0x80
3272#define TPS65917_SMPS2_FORCE_CMD_SHIFT 0x07
3273#define TPS65917_SMPS2_FORCE_VSEL_MASK 0x7F
3274#define TPS65917_SMPS2_FORCE_VSEL_SHIFT 0x00
3275
3276/* Bit definitions for SMPS2_VOLTAGE */
3277#define TPS65917_SMPS2_VOLTAGE_RANGE 0x80
3278#define TPS65917_SMPS2_VOLTAGE_RANGE_SHIFT 0x07
3279#define TPS65917_SMPS2_VOLTAGE_VSEL_MASK 0x7F
3280#define TPS65917_SMPS2_VOLTAGE_VSEL_SHIFT 0x00
3281
3282/* Bit definitions for SMPS3_CTRL */
3283#define TPS65917_SMPS3_CTRL_WR_S 0x80
3284#define TPS65917_SMPS3_CTRL_WR_S_SHIFT 0x07
3285#define TPS65917_SMPS3_CTRL_ROOF_FLOOR_EN 0x40
3286#define TPS65917_SMPS3_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3287#define TPS65917_SMPS3_CTRL_STATUS_MASK 0x30
3288#define TPS65917_SMPS3_CTRL_STATUS_SHIFT 0x04
3289#define TPS65917_SMPS3_CTRL_MODE_SLEEP_MASK 0x0C
3290#define TPS65917_SMPS3_CTRL_MODE_SLEEP_SHIFT 0x02
3291#define TPS65917_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03
3292#define TPS65917_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0x00
3293
3294/* Bit definitions for SMPS3_FORCE */
3295#define TPS65917_SMPS3_FORCE_CMD 0x80
3296#define TPS65917_SMPS3_FORCE_CMD_SHIFT 0x07
3297#define TPS65917_SMPS3_FORCE_VSEL_MASK 0x7F
3298#define TPS65917_SMPS3_FORCE_VSEL_SHIFT 0x00
3299
3300/* Bit definitions for SMPS3_VOLTAGE */
3301#define TPS65917_SMPS3_VOLTAGE_RANGE 0x80
3302#define TPS65917_SMPS3_VOLTAGE_RANGE_SHIFT 0x07
3303#define TPS65917_SMPS3_VOLTAGE_VSEL_MASK 0x7F
3304#define TPS65917_SMPS3_VOLTAGE_VSEL_SHIFT 0x00
3305
3306/* Bit definitions for SMPS4_CTRL */
3307#define TPS65917_SMPS4_CTRL_WR_S 0x80
3308#define TPS65917_SMPS4_CTRL_WR_S_SHIFT 0x07
3309#define TPS65917_SMPS4_CTRL_ROOF_FLOOR_EN 0x40
3310#define TPS65917_SMPS4_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3311#define TPS65917_SMPS4_CTRL_STATUS_MASK 0x30
3312#define TPS65917_SMPS4_CTRL_STATUS_SHIFT 0x04
3313#define TPS65917_SMPS4_CTRL_MODE_SLEEP_MASK 0x0C
3314#define TPS65917_SMPS4_CTRL_MODE_SLEEP_SHIFT 0x02
3315#define TPS65917_SMPS4_CTRL_MODE_ACTIVE_MASK 0x03
3316#define TPS65917_SMPS4_CTRL_MODE_ACTIVE_SHIFT 0x00
3317
3318/* Bit definitions for SMPS4_VOLTAGE */
3319#define TPS65917_SMPS4_VOLTAGE_RANGE 0x80
3320#define TPS65917_SMPS4_VOLTAGE_RANGE_SHIFT 0x07
3321#define TPS65917_SMPS4_VOLTAGE_VSEL_MASK 0x7F
3322#define TPS65917_SMPS4_VOLTAGE_VSEL_SHIFT 0x00
3323
3324/* Bit definitions for SMPS5_CTRL */
3325#define TPS65917_SMPS5_CTRL_WR_S 0x80
3326#define TPS65917_SMPS5_CTRL_WR_S_SHIFT 0x07
3327#define TPS65917_SMPS5_CTRL_ROOF_FLOOR_EN 0x40
3328#define TPS65917_SMPS5_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3329#define TPS65917_SMPS5_CTRL_STATUS_MASK 0x30
3330#define TPS65917_SMPS5_CTRL_STATUS_SHIFT 0x04
3331#define TPS65917_SMPS5_CTRL_MODE_SLEEP_MASK 0x0C
3332#define TPS65917_SMPS5_CTRL_MODE_SLEEP_SHIFT 0x02
3333#define TPS65917_SMPS5_CTRL_MODE_ACTIVE_MASK 0x03
3334#define TPS65917_SMPS5_CTRL_MODE_ACTIVE_SHIFT 0x00
3335
3336/* Bit definitions for SMPS5_VOLTAGE */
3337#define TPS65917_SMPS5_VOLTAGE_RANGE 0x80
3338#define TPS65917_SMPS5_VOLTAGE_RANGE_SHIFT 0x07
3339#define TPS65917_SMPS5_VOLTAGE_VSEL_MASK 0x7F
3340#define TPS65917_SMPS5_VOLTAGE_VSEL_SHIFT 0x00
3341
3342/* Bit definitions for SMPS_CTRL */
3343#define TPS65917_SMPS_CTRL_SMPS1_SMPS12_EN 0x10
3344#define TPS65917_SMPS_CTRL_SMPS1_SMPS12_EN_SHIFT 0x04
3345#define TPS65917_SMPS_CTRL_SMPS12_PHASE_CTRL 0x03
3346#define TPS65917_SMPS_CTRL_SMPS12_PHASE_CTRL_SHIFT 0x00
3347
3348/* Bit definitions for SMPS_PD_CTRL */
3349#define TPS65917_SMPS_PD_CTRL_SMPS5 0x40
3350#define TPS65917_SMPS_PD_CTRL_SMPS5_SHIFT 0x06
3351#define TPS65917_SMPS_PD_CTRL_SMPS4 0x10
3352#define TPS65917_SMPS_PD_CTRL_SMPS4_SHIFT 0x04
3353#define TPS65917_SMPS_PD_CTRL_SMPS3 0x08
3354#define TPS65917_SMPS_PD_CTRL_SMPS3_SHIFT 0x03
3355#define TPS65917_SMPS_PD_CTRL_SMPS2 0x02
3356#define TPS65917_SMPS_PD_CTRL_SMPS2_SHIFT 0x01
3357#define TPS65917_SMPS_PD_CTRL_SMPS1 0x01
3358#define TPS65917_SMPS_PD_CTRL_SMPS1_SHIFT 0x00
3359
3360/* Bit definitions for SMPS_THERMAL_EN */
3361#define TPS65917_SMPS_THERMAL_EN_SMPS5 0x40
3362#define TPS65917_SMPS_THERMAL_EN_SMPS5_SHIFT 0x06
3363#define TPS65917_SMPS_THERMAL_EN_SMPS3 0x08
3364#define TPS65917_SMPS_THERMAL_EN_SMPS3_SHIFT 0x03
3365#define TPS65917_SMPS_THERMAL_EN_SMPS12 0x01
3366#define TPS65917_SMPS_THERMAL_EN_SMPS12_SHIFT 0x00
3367
3368/* Bit definitions for SMPS_THERMAL_STATUS */
3369#define TPS65917_SMPS_THERMAL_STATUS_SMPS5 0x40
3370#define TPS65917_SMPS_THERMAL_STATUS_SMPS5_SHIFT 0x06
3371#define TPS65917_SMPS_THERMAL_STATUS_SMPS3 0x08
3372#define TPS65917_SMPS_THERMAL_STATUS_SMPS3_SHIFT 0x03
3373#define TPS65917_SMPS_THERMAL_STATUS_SMPS12 0x01
3374#define TPS65917_SMPS_THERMAL_STATUS_SMPS12_SHIFT 0x00
3375
3376/* Bit definitions for SMPS_SHORT_STATUS */
3377#define TPS65917_SMPS_SHORT_STATUS_SMPS5 0x40
3378#define TPS65917_SMPS_SHORT_STATUS_SMPS5_SHIFT 0x06
3379#define TPS65917_SMPS_SHORT_STATUS_SMPS4 0x10
3380#define TPS65917_SMPS_SHORT_STATUS_SMPS4_SHIFT 0x04
3381#define TPS65917_SMPS_SHORT_STATUS_SMPS3 0x08
3382#define TPS65917_SMPS_SHORT_STATUS_SMPS3_SHIFT 0x03
3383#define TPS65917_SMPS_SHORT_STATUS_SMPS2 0x02
3384#define TPS65917_SMPS_SHORT_STATUS_SMPS2_SHIFT 0x01
3385#define TPS65917_SMPS_SHORT_STATUS_SMPS1 0x01
3386#define TPS65917_SMPS_SHORT_STATUS_SMPS1_SHIFT 0x00
3387
3388/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */
3389#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS5 0x40
3390#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS5_SHIFT 0x06
3391#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS4 0x10
3392#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS4_SHIFT 0x04
3393#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x08
3394#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 0x03
3395#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS2 0x02
3396#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS2_SHIFT 0x01
3397#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS1 0x01
3398#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS1_SHIFT 0x00
3399
3400/* Bit definitions for SMPS_POWERGOOD_MASK1 */
3401#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS5 0x40
3402#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS5_SHIFT 0x06
3403#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS4 0x10
3404#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS4_SHIFT 0x04
3405#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS3 0x08
3406#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 0x03
3407#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS2 0x02
3408#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS2_SHIFT 0x01
3409#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS1 0x01
3410#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS1_SHIFT 0x00
3411
3412/* Bit definitions for SMPS_POWERGOOD_MASK2 */
3413#define TPS65917_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80
3414#define TPS65917_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 0x07
3415#define TPS65917_SMPS_POWERGOOD_MASK2_OVC_ALARM_SHIFT 0x10
3416#define TPS65917_SMPS_POWERGOOD_MASK2_OVC_ALARM 0x04
3417
3418/* Bit definitions for SMPS_PLL_CTRL */
3419
3420#define TPS65917_SMPS_PLL_CTRL_PLL_EN_PLL_BYPASS_SHIFT 0x08
3421#define TPS65917_SMPS_PLL_CTRL_PLL_PLL_EN_BYPASS 0x03
3422#define TPS65917_SMPS_PLL_CTRL_PLL_PLL_BYPASS_CLK_SHIFT 0x04
3423#define TPS65917_SMPS_PLL_CTRL_PLL_PLL_BYPASS_CLK 0x02
3424
3425/* Registers for function LDO */
3426#define TPS65917_LDO1_CTRL 0x00
3427#define TPS65917_LDO1_VOLTAGE 0x01
3428#define TPS65917_LDO2_CTRL 0x02
3429#define TPS65917_LDO2_VOLTAGE 0x03
3430#define TPS65917_LDO3_CTRL 0x04
3431#define TPS65917_LDO3_VOLTAGE 0x05
3432#define TPS65917_LDO4_CTRL 0x0E
3433#define TPS65917_LDO4_VOLTAGE 0x0F
3434#define TPS65917_LDO5_CTRL 0x12
3435#define TPS65917_LDO5_VOLTAGE 0x13
3436#define TPS65917_LDO_PD_CTRL1 0x1B
3437#define TPS65917_LDO_PD_CTRL2 0x1C
3438#define TPS65917_LDO_SHORT_STATUS1 0x1D
3439#define TPS65917_LDO_SHORT_STATUS2 0x1E
3440#define TPS65917_LDO_PD_CTRL3 0x2D
3441#define TPS65917_LDO_SHORT_STATUS3 0x2E
3442
3443/* Bit definitions for LDO1_CTRL */
3444#define TPS65917_LDO1_CTRL_WR_S 0x80
3445#define TPS65917_LDO1_CTRL_WR_S_SHIFT 0x07
3446#define TPS65917_LDO1_CTRL_BYPASS_EN 0x40
3447#define TPS65917_LDO1_CTRL_BYPASS_EN_SHIFT 0x06
3448#define TPS65917_LDO1_CTRL_STATUS 0x10
3449#define TPS65917_LDO1_CTRL_STATUS_SHIFT 0x04
3450#define TPS65917_LDO1_CTRL_MODE_SLEEP 0x04
3451#define TPS65917_LDO1_CTRL_MODE_SLEEP_SHIFT 0x02
3452#define TPS65917_LDO1_CTRL_MODE_ACTIVE 0x01
3453#define TPS65917_LDO1_CTRL_MODE_ACTIVE_SHIFT 0x00
3454
3455/* Bit definitions for LDO1_VOLTAGE */
3456#define TPS65917_LDO1_VOLTAGE_VSEL_MASK 0x2F
3457#define TPS65917_LDO1_VOLTAGE_VSEL_SHIFT 0x00
3458
3459/* Bit definitions for LDO2_CTRL */
3460#define TPS65917_LDO2_CTRL_WR_S 0x80
3461#define TPS65917_LDO2_CTRL_WR_S_SHIFT 0x07
3462#define TPS65917_LDO2_CTRL_BYPASS_EN 0x40
3463#define TPS65917_LDO2_CTRL_BYPASS_EN_SHIFT 0x06
3464#define TPS65917_LDO2_CTRL_STATUS 0x10
3465#define TPS65917_LDO2_CTRL_STATUS_SHIFT 0x04
3466#define TPS65917_LDO2_CTRL_MODE_SLEEP 0x04
3467#define TPS65917_LDO2_CTRL_MODE_SLEEP_SHIFT 0x02
3468#define TPS65917_LDO2_CTRL_MODE_ACTIVE 0x01
3469#define TPS65917_LDO2_CTRL_MODE_ACTIVE_SHIFT 0x00
3470
3471/* Bit definitions for LDO2_VOLTAGE */
3472#define TPS65917_LDO2_VOLTAGE_VSEL_MASK 0x2F
3473#define TPS65917_LDO2_VOLTAGE_VSEL_SHIFT 0x00
3474
3475/* Bit definitions for LDO3_CTRL */
3476#define TPS65917_LDO3_CTRL_WR_S 0x80
3477#define TPS65917_LDO3_CTRL_WR_S_SHIFT 0x07
3478#define TPS65917_LDO3_CTRL_STATUS 0x10
3479#define TPS65917_LDO3_CTRL_STATUS_SHIFT 0x04
3480#define TPS65917_LDO3_CTRL_MODE_SLEEP 0x04
3481#define TPS65917_LDO3_CTRL_MODE_SLEEP_SHIFT 0x02
3482#define TPS65917_LDO3_CTRL_MODE_ACTIVE 0x01
3483#define TPS65917_LDO3_CTRL_MODE_ACTIVE_SHIFT 0x00
3484
3485/* Bit definitions for LDO3_VOLTAGE */
3486#define TPS65917_LDO3_VOLTAGE_VSEL_MASK 0x2F
3487#define TPS65917_LDO3_VOLTAGE_VSEL_SHIFT 0x00
3488
3489/* Bit definitions for LDO4_CTRL */
3490#define TPS65917_LDO4_CTRL_WR_S 0x80
3491#define TPS65917_LDO4_CTRL_WR_S_SHIFT 0x07
3492#define TPS65917_LDO4_CTRL_STATUS 0x10
3493#define TPS65917_LDO4_CTRL_STATUS_SHIFT 0x04
3494#define TPS65917_LDO4_CTRL_MODE_SLEEP 0x04
3495#define TPS65917_LDO4_CTRL_MODE_SLEEP_SHIFT 0x02
3496#define TPS65917_LDO4_CTRL_MODE_ACTIVE 0x01
3497#define TPS65917_LDO4_CTRL_MODE_ACTIVE_SHIFT 0x00
3498
3499/* Bit definitions for LDO4_VOLTAGE */
3500#define TPS65917_LDO4_VOLTAGE_VSEL_MASK 0x2F
3501#define TPS65917_LDO4_VOLTAGE_VSEL_SHIFT 0x00
3502
3503/* Bit definitions for LDO5_CTRL */
3504#define TPS65917_LDO5_CTRL_WR_S 0x80
3505#define TPS65917_LDO5_CTRL_WR_S_SHIFT 0x07
3506#define TPS65917_LDO5_CTRL_STATUS 0x10
3507#define TPS65917_LDO5_CTRL_STATUS_SHIFT 0x04
3508#define TPS65917_LDO5_CTRL_MODE_SLEEP 0x04
3509#define TPS65917_LDO5_CTRL_MODE_SLEEP_SHIFT 0x02
3510#define TPS65917_LDO5_CTRL_MODE_ACTIVE 0x01
3511#define TPS65917_LDO5_CTRL_MODE_ACTIVE_SHIFT 0x00
3512
3513/* Bit definitions for LDO5_VOLTAGE */
3514#define TPS65917_LDO5_VOLTAGE_VSEL_MASK 0x2F
3515#define TPS65917_LDO5_VOLTAGE_VSEL_SHIFT 0x00
3516
3517/* Bit definitions for LDO_PD_CTRL1 */
3518#define TPS65917_LDO_PD_CTRL1_LDO4 0x80
3519#define TPS65917_LDO_PD_CTRL1_LDO4_SHIFT 0x07
3520#define TPS65917_LDO_PD_CTRL1_LDO2 0x02
3521#define TPS65917_LDO_PD_CTRL1_LDO2_SHIFT 0x01
3522#define TPS65917_LDO_PD_CTRL1_LDO1 0x01
3523#define TPS65917_LDO_PD_CTRL1_LDO1_SHIFT 0x00
3524
3525/* Bit definitions for LDO_PD_CTRL2 */
3526#define TPS65917_LDO_PD_CTRL2_LDO3 0x04
3527#define TPS65917_LDO_PD_CTRL2_LDO3_SHIFT 0x02
3528#define TPS65917_LDO_PD_CTRL2_LDO5 0x02
3529#define TPS65917_LDO_PD_CTRL2_LDO5_SHIFT 0x01
3530
3531/* Bit definitions for LDO_PD_CTRL3 */
3532#define TPS65917_LDO_PD_CTRL2_LDOVANA 0x80
3533#define TPS65917_LDO_PD_CTRL2_LDOVANA_SHIFT 0x07
3534
3535/* Bit definitions for LDO_SHORT_STATUS1 */
3536#define TPS65917_LDO_SHORT_STATUS1_LDO4 0x80
3537#define TPS65917_LDO_SHORT_STATUS1_LDO4_SHIFT 0x07
3538#define TPS65917_LDO_SHORT_STATUS1_LDO2 0x02
3539#define TPS65917_LDO_SHORT_STATUS1_LDO2_SHIFT 0x01
3540#define TPS65917_LDO_SHORT_STATUS1_LDO1 0x01
3541#define TPS65917_LDO_SHORT_STATUS1_LDO1_SHIFT 0x00
3542
3543/* Bit definitions for LDO_SHORT_STATUS2 */
3544#define TPS65917_LDO_SHORT_STATUS2_LDO3 0x04
3545#define TPS65917_LDO_SHORT_STATUS2_LDO3_SHIFT 0x02
3546#define TPS65917_LDO_SHORT_STATUS2_LDO5 0x02
3547#define TPS65917_LDO_SHORT_STATUS2_LDO5_SHIFT 0x01
3548
3549/* Bit definitions for LDO_SHORT_STATUS2 */
3550#define TPS65917_LDO_SHORT_STATUS2_LDOVANA 0x80
3551#define TPS65917_LDO_SHORT_STATUS2_LDOVANA_SHIFT 0x07
3552
3553/* Bit definitions for REGEN1_CTRL */
3554#define TPS65917_REGEN1_CTRL_STATUS 0x10
3555#define TPS65917_REGEN1_CTRL_STATUS_SHIFT 0x04
3556#define TPS65917_REGEN1_CTRL_MODE_SLEEP 0x04
3557#define TPS65917_REGEN1_CTRL_MODE_SLEEP_SHIFT 0x02
3558#define TPS65917_REGEN1_CTRL_MODE_ACTIVE 0x01
3559#define TPS65917_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0x00
3560
3561/* Bit definitions for PLLEN_CTRL */
3562#define TPS65917_PLLEN_CTRL_STATUS 0x10
3563#define TPS65917_PLLEN_CTRL_STATUS_SHIFT 0x04
3564#define TPS65917_PLLEN_CTRL_MODE_SLEEP 0x04
3565#define TPS65917_PLLEN_CTRL_MODE_SLEEP_SHIFT 0x02
3566#define TPS65917_PLLEN_CTRL_MODE_ACTIVE 0x01
3567#define TPS65917_PLLEN_CTRL_MODE_ACTIVE_SHIFT 0x00
3568
3569/* Bit definitions for REGEN2_CTRL */
3570#define TPS65917_REGEN2_CTRL_STATUS 0x10
3571#define TPS65917_REGEN2_CTRL_STATUS_SHIFT 0x04
3572#define TPS65917_REGEN2_CTRL_MODE_SLEEP 0x04
3573#define TPS65917_REGEN2_CTRL_MODE_SLEEP_SHIFT 0x02
3574#define TPS65917_REGEN2_CTRL_MODE_ACTIVE 0x01
3575#define TPS65917_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0x00
3576
3577/* Bit definitions for NSLEEP_RES_ASSIGN */
3578#define TPS65917_NSLEEP_RES_ASSIGN_PLL_EN 0x08
3579#define TPS65917_NSLEEP_RES_ASSIGN_PLL_EN_SHIFT 0x03
3580#define TPS65917_NSLEEP_RES_ASSIGN_REGEN3 0x04
3581#define TPS65917_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 0x02
3582#define TPS65917_NSLEEP_RES_ASSIGN_REGEN2 0x02
3583#define TPS65917_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 0x01
3584#define TPS65917_NSLEEP_RES_ASSIGN_REGEN1 0x01
3585#define TPS65917_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0x00
3586
3587/* Bit definitions for NSLEEP_SMPS_ASSIGN */
3588#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS5 0x40
3589#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS5_SHIFT 0x06
3590#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS4 0x10
3591#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS4_SHIFT 0x04
3592#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS3 0x08
3593#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 0x03
3594#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS2 0x02
3595#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS2_SHIFT 0x01
3596#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS1 0x01
3597#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS1_SHIFT 0x00
3598
3599/* Bit definitions for NSLEEP_LDO_ASSIGN1 */
3600#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO4 0x80
3601#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 0x07
3602#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO2 0x02
3603#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 0x01
3604#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO1 0x01
3605#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0x00
3606
3607/* Bit definitions for NSLEEP_LDO_ASSIGN2 */
3608#define TPS65917_NSLEEP_LDO_ASSIGN2_LDO3 0x04
3609#define TPS65917_NSLEEP_LDO_ASSIGN2_LDO3_SHIFT 0x02
3610#define TPS65917_NSLEEP_LDO_ASSIGN2_LDO5 0x02
3611#define TPS65917_NSLEEP_LDO_ASSIGN2_LDO5_SHIFT 0x01
3612
3613/* Bit definitions for ENABLE1_RES_ASSIGN */
3614#define TPS65917_ENABLE1_RES_ASSIGN_PLLEN 0x08
3615#define TPS65917_ENABLE1_RES_ASSIGN_PLLEN_SHIFT 0x03
3616#define TPS65917_ENABLE1_RES_ASSIGN_REGEN3 0x04
3617#define TPS65917_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 0x02
3618#define TPS65917_ENABLE1_RES_ASSIGN_REGEN2 0x02
3619#define TPS65917_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 0x01
3620#define TPS65917_ENABLE1_RES_ASSIGN_REGEN1 0x01
3621#define TPS65917_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0x00
3622
3623/* Bit definitions for ENABLE1_SMPS_ASSIGN */
3624#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS5 0x40
3625#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS5_SHIFT 0x06
3626#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS4 0x10
3627#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS4_SHIFT 0x04
3628#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS3 0x08
3629#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 0x03
3630#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS2 0x02
3631#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS2_SHIFT 0x01
3632#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS1 0x01
3633#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS1_SHIFT 0x00
3634
3635/* Bit definitions for ENABLE1_LDO_ASSIGN1 */
3636#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO4 0x80
3637#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 0x07
3638#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO2 0x02
3639#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 0x01
3640#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO1 0x01
3641#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0x00
3642
3643/* Bit definitions for ENABLE1_LDO_ASSIGN2 */
3644#define TPS65917_ENABLE1_LDO_ASSIGN2_LDO3 0x04
3645#define TPS65917_ENABLE1_LDO_ASSIGN2_LDO3_SHIFT 0x02
3646#define TPS65917_ENABLE1_LDO_ASSIGN2_LDO5 0x02
3647#define TPS65917_ENABLE1_LDO_ASSIGN2_LDO5_SHIFT 0x01
3648
3649/* Bit definitions for ENABLE2_RES_ASSIGN */
3650#define TPS65917_ENABLE2_RES_ASSIGN_PLLEN 0x08
3651#define TPS65917_ENABLE2_RES_ASSIGN_PLLEN_SHIFT 0x03
3652#define TPS65917_ENABLE2_RES_ASSIGN_REGEN3 0x04
3653#define TPS65917_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 0x02
3654#define TPS65917_ENABLE2_RES_ASSIGN_REGEN2 0x02
3655#define TPS65917_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 0x01
3656#define TPS65917_ENABLE2_RES_ASSIGN_REGEN1 0x01
3657#define TPS65917_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0x00
3658
3659/* Bit definitions for ENABLE2_SMPS_ASSIGN */
3660#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS5 0x40
3661#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS5_SHIFT 0x06
3662#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS4 0x10
3663#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS4_SHIFT 0x04
3664#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS3 0x08
3665#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 0x03
3666#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS2 0x02
3667#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS2_SHIFT 0x01
3668#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS1 0x01
3669#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS1_SHIFT 0x00
3670
3671/* Bit definitions for ENABLE2_LDO_ASSIGN1 */
3672#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO4 0x80
3673#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 0x07
3674#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO2 0x02
3675#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 0x01
3676#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO1 0x01
3677#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0x00
3678
3679/* Bit definitions for ENABLE2_LDO_ASSIGN2 */
3680#define TPS65917_ENABLE2_LDO_ASSIGN2_LDO3 0x04
3681#define TPS65917_ENABLE2_LDO_ASSIGN2_LDO3_SHIFT 0x02
3682#define TPS65917_ENABLE2_LDO_ASSIGN2_LDO5 0x02
3683#define TPS65917_ENABLE2_LDO_ASSIGN2_LDO5_SHIFT 0x01
3684
3685/* Bit definitions for REGEN3_CTRL */
3686#define TPS65917_REGEN3_CTRL_STATUS 0x10
3687#define TPS65917_REGEN3_CTRL_STATUS_SHIFT 0x04
3688#define TPS65917_REGEN3_CTRL_MODE_SLEEP 0x04
3689#define TPS65917_REGEN3_CTRL_MODE_SLEEP_SHIFT 0x02
3690#define TPS65917_REGEN3_CTRL_MODE_ACTIVE 0x01
3691#define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0x00
3692
3693/* Registers for function RESOURCE */
3694#define TPS65917_REGEN1_CTRL 0x2
3695#define TPS65917_PLLEN_CTRL 0x3
3696#define TPS65917_NSLEEP_RES_ASSIGN 0x6
3697#define TPS65917_NSLEEP_SMPS_ASSIGN 0x7
3698#define TPS65917_NSLEEP_LDO_ASSIGN1 0x8
3699#define TPS65917_NSLEEP_LDO_ASSIGN2 0x9
3700#define TPS65917_ENABLE1_RES_ASSIGN 0xA
3701#define TPS65917_ENABLE1_SMPS_ASSIGN 0xB
3702#define TPS65917_ENABLE1_LDO_ASSIGN1 0xC
3703#define TPS65917_ENABLE1_LDO_ASSIGN2 0xD
3704#define TPS65917_ENABLE2_RES_ASSIGN 0xE
3705#define TPS65917_ENABLE2_SMPS_ASSIGN 0xF
3706#define TPS65917_ENABLE2_LDO_ASSIGN1 0x10
3707#define TPS65917_ENABLE2_LDO_ASSIGN2 0x11
3708#define TPS65917_REGEN2_CTRL 0x12
3709#define TPS65917_REGEN3_CTRL 0x13
3710
2874static inline int palmas_read(struct palmas *palmas, unsigned int base, 3711static inline int palmas_read(struct palmas *palmas, unsigned int base,
2875 unsigned int reg, unsigned int *val) 3712 unsigned int reg, unsigned int *val)
2876{ 3713{
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index a3835976f7c6..74346d5e7899 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -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);
948void 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 count, bool read, int timeout);
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/samsung/core.h b/include/linux/mfd/samsung/core.h
index 47d84242940b..b5f73de81aad 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -21,6 +21,7 @@ enum sec_device_type {
21 S2MPA01, 21 S2MPA01,
22 S2MPS11X, 22 S2MPS11X,
23 S2MPS14X, 23 S2MPS14X,
24 S2MPU02,
24}; 25};
25 26
26/** 27/**
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index 1224f447356b..f35af7361b60 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -129,6 +129,30 @@ enum s2mps14_irq {
129 S2MPS14_IRQ_NR, 129 S2MPS14_IRQ_NR,
130}; 130};
131 131
132enum s2mpu02_irq {
133 S2MPU02_IRQ_PWRONF,
134 S2MPU02_IRQ_PWRONR,
135 S2MPU02_IRQ_JIGONBF,
136 S2MPU02_IRQ_JIGONBR,
137 S2MPU02_IRQ_ACOKBF,
138 S2MPU02_IRQ_ACOKBR,
139 S2MPU02_IRQ_PWRON1S,
140 S2MPU02_IRQ_MRB,
141
142 S2MPU02_IRQ_RTC60S,
143 S2MPU02_IRQ_RTCA1,
144 S2MPU02_IRQ_RTCA0,
145 S2MPU02_IRQ_SMPL,
146 S2MPU02_IRQ_RTC1S,
147 S2MPU02_IRQ_WTSR,
148
149 S2MPU02_IRQ_INT120C,
150 S2MPU02_IRQ_INT140C,
151 S2MPU02_IRQ_TSD,
152
153 S2MPU02_IRQ_NR,
154};
155
132/* Masks for interrupts are the same as in s2mps11 */ 156/* Masks for interrupts are the same as in s2mps11 */
133#define S2MPS14_IRQ_TSD_MASK (1 << 2) 157#define S2MPS14_IRQ_TSD_MASK (1 << 2)
134 158
diff --git a/include/linux/mfd/samsung/s2mpu02.h b/include/linux/mfd/samsung/s2mpu02.h
new file mode 100644
index 000000000000..47ae9bc583a7
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mpu02.h
@@ -0,0 +1,201 @@
1/*
2 * s2mpu02.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_S2MPU02_H
20#define __LINUX_MFD_S2MPU02_H
21
22/* S2MPU02 registers */
23enum S2MPU02_reg {
24 S2MPU02_REG_ID,
25 S2MPU02_REG_INT1,
26 S2MPU02_REG_INT2,
27 S2MPU02_REG_INT3,
28 S2MPU02_REG_INT1M,
29 S2MPU02_REG_INT2M,
30 S2MPU02_REG_INT3M,
31 S2MPU02_REG_ST1,
32 S2MPU02_REG_ST2,
33 S2MPU02_REG_PWRONSRC,
34 S2MPU02_REG_OFFSRC,
35 S2MPU02_REG_BU_CHG,
36 S2MPU02_REG_RTCCTRL,
37 S2MPU02_REG_PMCTRL1,
38 S2MPU02_REG_RSVD1,
39 S2MPU02_REG_RSVD2,
40 S2MPU02_REG_RSVD3,
41 S2MPU02_REG_RSVD4,
42 S2MPU02_REG_RSVD5,
43 S2MPU02_REG_RSVD6,
44 S2MPU02_REG_RSVD7,
45 S2MPU02_REG_WRSTEN,
46 S2MPU02_REG_RSVD8,
47 S2MPU02_REG_RSVD9,
48 S2MPU02_REG_RSVD10,
49 S2MPU02_REG_B1CTRL1,
50 S2MPU02_REG_B1CTRL2,
51 S2MPU02_REG_B2CTRL1,
52 S2MPU02_REG_B2CTRL2,
53 S2MPU02_REG_B3CTRL1,
54 S2MPU02_REG_B3CTRL2,
55 S2MPU02_REG_B4CTRL1,
56 S2MPU02_REG_B4CTRL2,
57 S2MPU02_REG_B5CTRL1,
58 S2MPU02_REG_B5CTRL2,
59 S2MPU02_REG_B5CTRL3,
60 S2MPU02_REG_B5CTRL4,
61 S2MPU02_REG_B5CTRL5,
62 S2MPU02_REG_B6CTRL1,
63 S2MPU02_REG_B6CTRL2,
64 S2MPU02_REG_B7CTRL1,
65 S2MPU02_REG_B7CTRL2,
66 S2MPU02_REG_RAMP1,
67 S2MPU02_REG_RAMP2,
68 S2MPU02_REG_L1CTRL,
69 S2MPU02_REG_L2CTRL1,
70 S2MPU02_REG_L2CTRL2,
71 S2MPU02_REG_L2CTRL3,
72 S2MPU02_REG_L2CTRL4,
73 S2MPU02_REG_L3CTRL,
74 S2MPU02_REG_L4CTRL,
75 S2MPU02_REG_L5CTRL,
76 S2MPU02_REG_L6CTRL,
77 S2MPU02_REG_L7CTRL,
78 S2MPU02_REG_L8CTRL,
79 S2MPU02_REG_L9CTRL,
80 S2MPU02_REG_L10CTRL,
81 S2MPU02_REG_L11CTRL,
82 S2MPU02_REG_L12CTRL,
83 S2MPU02_REG_L13CTRL,
84 S2MPU02_REG_L14CTRL,
85 S2MPU02_REG_L15CTRL,
86 S2MPU02_REG_L16CTRL,
87 S2MPU02_REG_L17CTRL,
88 S2MPU02_REG_L18CTRL,
89 S2MPU02_REG_L19CTRL,
90 S2MPU02_REG_L20CTRL,
91 S2MPU02_REG_L21CTRL,
92 S2MPU02_REG_L22CTRL,
93 S2MPU02_REG_L23CTRL,
94 S2MPU02_REG_L24CTRL,
95 S2MPU02_REG_L25CTRL,
96 S2MPU02_REG_L26CTRL,
97 S2MPU02_REG_L27CTRL,
98 S2MPU02_REG_L28CTRL,
99 S2MPU02_REG_LDODSCH1,
100 S2MPU02_REG_LDODSCH2,
101 S2MPU02_REG_LDODSCH3,
102 S2MPU02_REG_LDODSCH4,
103 S2MPU02_REG_SELMIF,
104 S2MPU02_REG_RSVD11,
105 S2MPU02_REG_RSVD12,
106 S2MPU02_REG_RSVD13,
107 S2MPU02_REG_DVSSEL,
108 S2MPU02_REG_DVSPTR,
109 S2MPU02_REG_DVSDATA,
110};
111
112/* S2MPU02 regulator ids */
113enum S2MPU02_regulators {
114 S2MPU02_LDO1,
115 S2MPU02_LDO2,
116 S2MPU02_LDO3,
117 S2MPU02_LDO4,
118 S2MPU02_LDO5,
119 S2MPU02_LDO6,
120 S2MPU02_LDO7,
121 S2MPU02_LDO8,
122 S2MPU02_LDO9,
123 S2MPU02_LDO10,
124 S2MPU02_LDO11,
125 S2MPU02_LDO12,
126 S2MPU02_LDO13,
127 S2MPU02_LDO14,
128 S2MPU02_LDO15,
129 S2MPU02_LDO16,
130 S2MPU02_LDO17,
131 S2MPU02_LDO18,
132 S2MPU02_LDO19,
133 S2MPU02_LDO20,
134 S2MPU02_LDO21,
135 S2MPU02_LDO22,
136 S2MPU02_LDO23,
137 S2MPU02_LDO24,
138 S2MPU02_LDO25,
139 S2MPU02_LDO26,
140 S2MPU02_LDO27,
141 S2MPU02_LDO28,
142 S2MPU02_BUCK1,
143 S2MPU02_BUCK2,
144 S2MPU02_BUCK3,
145 S2MPU02_BUCK4,
146 S2MPU02_BUCK5,
147 S2MPU02_BUCK6,
148 S2MPU02_BUCK7,
149
150 S2MPU02_REGULATOR_MAX,
151};
152
153/* Regulator constraints for BUCKx */
154#define S2MPU02_BUCK1234_MIN_600MV 600000
155#define S2MPU02_BUCK5_MIN_1081_25MV 1081250
156#define S2MPU02_BUCK6_MIN_1700MV 1700000
157#define S2MPU02_BUCK7_MIN_900MV 900000
158
159#define S2MPU02_BUCK1234_STEP_6_25MV 6250
160#define S2MPU02_BUCK5_STEP_6_25MV 6250
161#define S2MPU02_BUCK6_STEP_2_50MV 2500
162#define S2MPU02_BUCK7_STEP_6_25MV 6250
163
164#define S2MPU02_BUCK1234_START_SEL 0x00
165#define S2MPU02_BUCK5_START_SEL 0x4D
166#define S2MPU02_BUCK6_START_SEL 0x28
167#define S2MPU02_BUCK7_START_SEL 0x30
168
169#define S2MPU02_BUCK_RAMP_DELAY 12500
170
171/* Regulator constraints for different types of LDOx */
172#define S2MPU02_LDO_MIN_900MV 900000
173#define S2MPU02_LDO_MIN_1050MV 1050000
174#define S2MPU02_LDO_MIN_1600MV 1600000
175#define S2MPU02_LDO_STEP_12_5MV 12500
176#define S2MPU02_LDO_STEP_25MV 25000
177#define S2MPU02_LDO_STEP_50MV 50000
178
179#define S2MPU02_LDO_GROUP1_START_SEL 0x8
180#define S2MPU02_LDO_GROUP2_START_SEL 0xA
181#define S2MPU02_LDO_GROUP3_START_SEL 0x10
182
183#define S2MPU02_LDO_VSEL_MASK 0x3F
184#define S2MPU02_BUCK_VSEL_MASK 0xFF
185#define S2MPU02_ENABLE_MASK (0x03 << S2MPU02_ENABLE_SHIFT)
186#define S2MPU02_ENABLE_SHIFT 6
187
188/* On/Off controlled by PWREN */
189#define S2MPU02_ENABLE_SUSPEND (0x01 << S2MPU02_ENABLE_SHIFT)
190#define S2MPU02_DISABLE_SUSPEND (0x11 << S2MPU02_ENABLE_SHIFT)
191#define S2MPU02_LDO_N_VOLTAGES (S2MPU02_LDO_VSEL_MASK + 1)
192#define S2MPU02_BUCK_N_VOLTAGES (S2MPU02_BUCK_VSEL_MASK + 1)
193
194/* RAMP delay for BUCK1234*/
195#define S2MPU02_BUCK1_RAMP_SHIFT 6
196#define S2MPU02_BUCK2_RAMP_SHIFT 4
197#define S2MPU02_BUCK3_RAMP_SHIFT 2
198#define S2MPU02_BUCK4_RAMP_SHIFT 0
199#define S2MPU02_BUCK1234_RAMP_MASK 0x3
200
201#endif /* __LINUX_MFD_S2MPU02_H */
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 16c2335c2856..6483a6fdce59 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -892,7 +892,7 @@ struct tps65910 {
892 struct device *dev; 892 struct device *dev;
893 struct i2c_client *i2c_client; 893 struct i2c_client *i2c_client;
894 struct regmap *regmap; 894 struct regmap *regmap;
895 unsigned int id; 895 unsigned long id;
896 896
897 /* Client devices */ 897 /* Client devices */
898 struct tps65910_pmic *pmic; 898 struct tps65910_pmic *pmic;
diff --git a/include/linux/mic_bus.h b/include/linux/mic_bus.h
new file mode 100644
index 000000000000..d5b5f76d57ef
--- /dev/null
+++ b/include/linux/mic_bus.h
@@ -0,0 +1,110 @@
1/*
2 * Intel MIC Platform Software Stack (MPSS)
3 *
4 * Copyright(c) 2014 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2, as
8 * 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 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Intel MIC Bus driver.
19 *
20 * This implementation is very similar to the the virtio bus driver
21 * implementation @ include/linux/virtio.h.
22 */
23#ifndef _MIC_BUS_H_
24#define _MIC_BUS_H_
25/*
26 * Everything a mbus driver needs to work with any particular mbus
27 * implementation.
28 */
29#include <linux/interrupt.h>
30#include <linux/dma-mapping.h>
31
32struct mbus_device_id {
33 __u32 device;
34 __u32 vendor;
35};
36
37#define MBUS_DEV_DMA_HOST 2
38#define MBUS_DEV_DMA_MIC 3
39#define MBUS_DEV_ANY_ID 0xffffffff
40
41/**
42 * mbus_device - representation of a device using mbus
43 * @mmio_va: virtual address of mmio space
44 * @hw_ops: the hardware ops supported by this device.
45 * @id: the device type identification (used to match it with a driver).
46 * @dev: underlying device.
47 * be used to communicate with.
48 * @index: unique position on the mbus bus
49 */
50struct mbus_device {
51 void __iomem *mmio_va;
52 struct mbus_hw_ops *hw_ops;
53 struct mbus_device_id id;
54 struct device dev;
55 int index;
56};
57
58/**
59 * mbus_driver - operations for a mbus I/O driver
60 * @driver: underlying device driver (populate name and owner).
61 * @id_table: the ids serviced by this driver.
62 * @probe: the function to call when a device is found. Returns 0 or -errno.
63 * @remove: the function to call when a device is removed.
64 */
65struct mbus_driver {
66 struct device_driver driver;
67 const struct mbus_device_id *id_table;
68 int (*probe)(struct mbus_device *dev);
69 void (*scan)(struct mbus_device *dev);
70 void (*remove)(struct mbus_device *dev);
71};
72
73/**
74 * struct mic_irq - opaque pointer used as cookie
75 */
76struct mic_irq;
77
78/**
79 * mbus_hw_ops - Hardware operations for accessing a MIC device on the MIC bus.
80 */
81struct mbus_hw_ops {
82 struct mic_irq* (*request_threaded_irq)(struct mbus_device *mbdev,
83 irq_handler_t handler,
84 irq_handler_t thread_fn,
85 const char *name, void *data,
86 int intr_src);
87 void (*free_irq)(struct mbus_device *mbdev,
88 struct mic_irq *cookie, void *data);
89 void (*ack_interrupt)(struct mbus_device *mbdev, int num);
90};
91
92struct mbus_device *
93mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
94 struct mbus_hw_ops *hw_ops, void __iomem *mmio_va);
95void mbus_unregister_device(struct mbus_device *mbdev);
96
97int mbus_register_driver(struct mbus_driver *drv);
98void mbus_unregister_driver(struct mbus_driver *drv);
99
100static inline struct mbus_device *dev_to_mbus(struct device *_dev)
101{
102 return container_of(_dev, struct mbus_device, dev);
103}
104
105static inline struct mbus_driver *drv_to_mbus(struct device_driver *drv)
106{
107 return container_of(drv, struct mbus_driver, driver);
108}
109
110#endif /* _MIC_BUS_H */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 35b51e7af886..e15b1544ea83 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -48,6 +48,17 @@
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_NUM_UP 8
52#define MLX4_NUM_TC 8
53#define MLX4_MAX_100M_UNITS_VAL 255 /*
54 * work around: can't set values
55 * greater then this value when
56 * using 100 Mbps units.
57 */
58#define MLX4_RATELIMIT_100M_UNITS 3 /* 100 Mbps */
59#define MLX4_RATELIMIT_1G_UNITS 4 /* 1 Gbps */
60#define MLX4_RATELIMIT_DEFAULT 0x00ff
61
51#define MLX4_ROCE_MAX_GIDS 128 62#define MLX4_ROCE_MAX_GIDS 128
52#define MLX4_ROCE_PF_GIDS 16 63#define MLX4_ROCE_PF_GIDS 16
53 64
@@ -1243,4 +1254,11 @@ int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port);
1243int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port); 1254int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port);
1244int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, 1255int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
1245 int enable); 1256 int enable);
1257
1258/* Returns true if running in low memory profile (kdump kernel) */
1259static inline bool mlx4_low_memory_profile(void)
1260{
1261 return reset_devices;
1262}
1263
1246#endif /* MLX4_DEVICE_H */ 1264#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 3406cfb1267a..334947151dfc 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -456,9 +456,6 @@ struct mlx5_eqe_cq_err {
456 u8 syndrome; 456 u8 syndrome;
457}; 457};
458 458
459struct mlx5_eqe_dropped_packet {
460};
461
462struct mlx5_eqe_port_state { 459struct mlx5_eqe_port_state {
463 u8 reserved0[8]; 460 u8 reserved0[8];
464 u8 port; 461 u8 port;
@@ -498,7 +495,6 @@ union ev_data {
498 struct mlx5_eqe_comp comp; 495 struct mlx5_eqe_comp comp;
499 struct mlx5_eqe_qp_srq qp_srq; 496 struct mlx5_eqe_qp_srq qp_srq;
500 struct mlx5_eqe_cq_err cq_err; 497 struct mlx5_eqe_cq_err cq_err;
501 struct mlx5_eqe_dropped_packet dp;
502 struct mlx5_eqe_port_state port; 498 struct mlx5_eqe_port_state port;
503 struct mlx5_eqe_gpio gpio; 499 struct mlx5_eqe_gpio gpio;
504 struct mlx5_eqe_congestion cong; 500 struct mlx5_eqe_congestion cong;
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 2bce4aad2570..b88e9b46d957 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -381,8 +381,8 @@ struct mlx5_buf {
381 struct mlx5_buf_list *page_list; 381 struct mlx5_buf_list *page_list;
382 int nbufs; 382 int nbufs;
383 int npages; 383 int npages;
384 int page_shift;
385 int size; 384 int size;
385 u8 page_shift;
386}; 386};
387 387
388struct mlx5_eq { 388struct mlx5_eq {
@@ -543,6 +543,10 @@ struct mlx5_priv {
543 /* protect mkey key part */ 543 /* protect mkey key part */
544 spinlock_t mkey_lock; 544 spinlock_t mkey_lock;
545 u8 mkey_key; 545 u8 mkey_key;
546
547 struct list_head dev_list;
548 struct list_head ctx_list;
549 spinlock_t ctx_lock;
546}; 550};
547 551
548struct mlx5_core_dev { 552struct mlx5_core_dev {
@@ -555,7 +559,7 @@ struct mlx5_core_dev {
555 struct mlx5_init_seg __iomem *iseg; 559 struct mlx5_init_seg __iomem *iseg;
556 void (*event) (struct mlx5_core_dev *dev, 560 void (*event) (struct mlx5_core_dev *dev,
557 enum mlx5_dev_event event, 561 enum mlx5_dev_event event,
558 void *data); 562 unsigned long param);
559 struct mlx5_priv priv; 563 struct mlx5_priv priv;
560 struct mlx5_profile *profile; 564 struct mlx5_profile *profile;
561 atomic_t num_qps; 565 atomic_t num_qps;
@@ -604,8 +608,8 @@ struct mlx5_cmd_work_ent {
604 int page_queue; 608 int page_queue;
605 u8 status; 609 u8 status;
606 u8 token; 610 u8 token;
607 struct timespec ts1; 611 u64 ts1;
608 struct timespec ts2; 612 u64 ts2;
609 u16 op; 613 u16 op;
610}; 614};
611 615
@@ -686,8 +690,6 @@ static inline u32 mlx5_base_mkey(const u32 key)
686 return key & 0xffffff00u; 690 return key & 0xffffff00u;
687} 691}
688 692
689int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev);
690void mlx5_dev_cleanup(struct mlx5_core_dev *dev);
691int mlx5_cmd_init(struct mlx5_core_dev *dev); 693int mlx5_cmd_init(struct mlx5_core_dev *dev);
692void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); 694void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
693void mlx5_cmd_use_events(struct mlx5_core_dev *dev); 695void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
@@ -734,7 +736,7 @@ int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
734int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn); 736int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
735int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); 737int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn);
736int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, 738int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb,
737 u16 opmod, int port); 739 u16 opmod, u8 port);
738void mlx5_pagealloc_init(struct mlx5_core_dev *dev); 740void mlx5_pagealloc_init(struct mlx5_core_dev *dev);
739void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); 741void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
740int mlx5_pagealloc_start(struct mlx5_core_dev *dev); 742int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
@@ -767,7 +769,7 @@ void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev);
767int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in, 769int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
768 int size_in, void *data_out, int size_out, 770 int size_in, void *data_out, int size_out,
769 u16 reg_num, int arg, int write); 771 u16 reg_num, int arg, int write);
770int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps); 772int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
771 773
772int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 774int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
773void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 775void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
@@ -811,9 +813,20 @@ enum {
811 MAX_MR_CACHE_ENTRIES = 16, 813 MAX_MR_CACHE_ENTRIES = 16,
812}; 814};
813 815
816struct mlx5_interface {
817 void * (*add)(struct mlx5_core_dev *dev);
818 void (*remove)(struct mlx5_core_dev *dev, void *context);
819 void (*event)(struct mlx5_core_dev *dev, void *context,
820 enum mlx5_dev_event event, unsigned long param);
821 struct list_head list;
822};
823
824int mlx5_register_interface(struct mlx5_interface *intf);
825void mlx5_unregister_interface(struct mlx5_interface *intf);
826
814struct mlx5_profile { 827struct mlx5_profile {
815 u64 mask; 828 u64 mask;
816 u32 log_max_qp; 829 u8 log_max_qp;
817 struct { 830 struct {
818 int size; 831 int size;
819 int limit; 832 int limit;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e03dd29145a0..8981cc882ed2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2014,13 +2014,20 @@ static inline bool kernel_page_present(struct page *page) { return true; }
2014#endif /* CONFIG_HIBERNATION */ 2014#endif /* CONFIG_HIBERNATION */
2015#endif 2015#endif
2016 2016
2017#ifdef __HAVE_ARCH_GATE_AREA
2017extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm); 2018extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);
2018#ifdef __HAVE_ARCH_GATE_AREA 2019extern int in_gate_area_no_mm(unsigned long addr);
2019int in_gate_area_no_mm(unsigned long addr); 2020extern int in_gate_area(struct mm_struct *mm, unsigned long addr);
2020int in_gate_area(struct mm_struct *mm, unsigned long addr);
2021#else 2021#else
2022int in_gate_area_no_mm(unsigned long addr); 2022static inline struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
2023#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) 2023{
2024 return NULL;
2025}
2026static inline int in_gate_area_no_mm(unsigned long addr) { return 0; }
2027static inline int in_gate_area(struct mm_struct *mm, unsigned long addr)
2028{
2029 return 0;
2030}
2024#endif /* __HAVE_ARCH_GATE_AREA */ 2031#endif /* __HAVE_ARCH_GATE_AREA */
2025 2032
2026#ifdef CONFIG_SYSCTL 2033#ifdef CONFIG_SYSCTL
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 96c5750e3110..6e0b286649f1 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -461,6 +461,7 @@ static inline void mm_init_cpumask(struct mm_struct *mm)
461#ifdef CONFIG_CPUMASK_OFFSTACK 461#ifdef CONFIG_CPUMASK_OFFSTACK
462 mm->cpu_vm_mask_var = &mm->cpumask_allocation; 462 mm->cpu_vm_mask_var = &mm->cpumask_allocation;
463#endif 463#endif
464 cpumask_clear(mm->cpu_vm_mask_var);
464} 465}
465 466
466/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ 467/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
@@ -516,4 +517,12 @@ struct vm_special_mapping
516 struct page **pages; 517 struct page **pages;
517}; 518};
518 519
520enum tlb_flush_reason {
521 TLB_FLUSH_ON_TASK_SWITCH,
522 TLB_REMOTE_SHOOTDOWN,
523 TLB_LOCAL_SHOOTDOWN,
524 TLB_LOCAL_MM_SHOOTDOWN,
525 NR_TLB_FLUSH_REASONS,
526};
527
519#endif /* _LINUX_MM_TYPES_H */ 528#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index edd82a105220..2f348d02f640 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -20,11 +20,13 @@ extern void dump_page_badflags(struct page *page, const char *reason,
20 } while (0) 20 } while (0)
21#define VM_WARN_ON(cond) WARN_ON(cond) 21#define VM_WARN_ON(cond) WARN_ON(cond)
22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) 22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
23#define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
23#else 24#else
24#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) 25#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
25#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) 26#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
26#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) 27#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
27#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) 28#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
29#define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond)
28#endif 30#endif
29 31
30#ifdef CONFIG_DEBUG_VIRTUAL 32#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index deca87452528..27288692241e 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -170,6 +170,8 @@ extern int __mmu_notifier_register(struct mmu_notifier *mn,
170 struct mm_struct *mm); 170 struct mm_struct *mm);
171extern void mmu_notifier_unregister(struct mmu_notifier *mn, 171extern void mmu_notifier_unregister(struct mmu_notifier *mn,
172 struct mm_struct *mm); 172 struct mm_struct *mm);
173extern void mmu_notifier_unregister_no_release(struct mmu_notifier *mn,
174 struct mm_struct *mm);
173extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); 175extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
174extern void __mmu_notifier_release(struct mm_struct *mm); 176extern void __mmu_notifier_release(struct mm_struct *mm);
175extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 177extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
@@ -288,6 +290,10 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
288 set_pte_at(___mm, ___address, __ptep, ___pte); \ 290 set_pte_at(___mm, ___address, __ptep, ___pte); \
289}) 291})
290 292
293extern void mmu_notifier_call_srcu(struct rcu_head *rcu,
294 void (*func)(struct rcu_head *rcu));
295extern void mmu_notifier_synchronize(void);
296
291#else /* CONFIG_MMU_NOTIFIER */ 297#else /* CONFIG_MMU_NOTIFIER */
292 298
293static inline void mmu_notifier_release(struct mm_struct *mm) 299static inline void mmu_notifier_release(struct mm_struct *mm)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6cbd1b6c3d20..318df7051850 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -143,6 +143,7 @@ enum zone_stat_item {
143 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */ 143 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
144 NR_DIRTIED, /* page dirtyings since bootup */ 144 NR_DIRTIED, /* page dirtyings since bootup */
145 NR_WRITTEN, /* page writings since bootup */ 145 NR_WRITTEN, /* page writings since bootup */
146 NR_PAGES_SCANNED, /* pages scanned since last reclaim */
146#ifdef CONFIG_NUMA 147#ifdef CONFIG_NUMA
147 NUMA_HIT, /* allocated in intended node */ 148 NUMA_HIT, /* allocated in intended node */
148 NUMA_MISS, /* allocated in non intended node */ 149 NUMA_MISS, /* allocated in non intended node */
@@ -324,19 +325,12 @@ enum zone_type {
324#ifndef __GENERATING_BOUNDS_H 325#ifndef __GENERATING_BOUNDS_H
325 326
326struct zone { 327struct zone {
327 /* Fields commonly accessed by the page allocator */ 328 /* Read-mostly fields */
328 329
329 /* zone watermarks, access with *_wmark_pages(zone) macros */ 330 /* zone watermarks, access with *_wmark_pages(zone) macros */
330 unsigned long watermark[NR_WMARK]; 331 unsigned long watermark[NR_WMARK];
331 332
332 /* 333 /*
333 * When free pages are below this point, additional steps are taken
334 * when reading the number of free pages to avoid per-cpu counter
335 * drift allowing watermarks to be breached
336 */
337 unsigned long percpu_drift_mark;
338
339 /*
340 * We don't know if the memory that we're going to allocate will be freeable 334 * We don't know if the memory that we're going to allocate will be freeable
341 * or/and it will be released eventually, so to avoid totally wasting several 335 * or/and it will be released eventually, so to avoid totally wasting several
342 * GB of ram we must reserve some of the lower zone memory (otherwise we risk 336 * GB of ram we must reserve some of the lower zone memory (otherwise we risk
@@ -344,41 +338,26 @@ struct zone {
344 * on the higher zones). This array is recalculated at runtime if the 338 * on the higher zones). This array is recalculated at runtime if the
345 * sysctl_lowmem_reserve_ratio sysctl changes. 339 * sysctl_lowmem_reserve_ratio sysctl changes.
346 */ 340 */
347 unsigned long lowmem_reserve[MAX_NR_ZONES]; 341 long lowmem_reserve[MAX_NR_ZONES];
348
349 /*
350 * This is a per-zone reserve of pages that should not be
351 * considered dirtyable memory.
352 */
353 unsigned long dirty_balance_reserve;
354 342
355#ifdef CONFIG_NUMA 343#ifdef CONFIG_NUMA
356 int node; 344 int node;
345#endif
346
357 /* 347 /*
358 * zone reclaim becomes active if more unmapped pages exist. 348 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
349 * this zone's LRU. Maintained by the pageout code.
359 */ 350 */
360 unsigned long min_unmapped_pages; 351 unsigned int inactive_ratio;
361 unsigned long min_slab_pages; 352
362#endif 353 struct pglist_data *zone_pgdat;
363 struct per_cpu_pageset __percpu *pageset; 354 struct per_cpu_pageset __percpu *pageset;
355
364 /* 356 /*
365 * free areas of different sizes 357 * This is a per-zone reserve of pages that should not be
358 * considered dirtyable memory.
366 */ 359 */
367 spinlock_t lock; 360 unsigned long dirty_balance_reserve;
368#if defined CONFIG_COMPACTION || defined CONFIG_CMA
369 /* Set to true when the PG_migrate_skip bits should be cleared */
370 bool compact_blockskip_flush;
371
372 /* pfn where compaction free scanner should start */
373 unsigned long compact_cached_free_pfn;
374 /* pfn where async and sync compaction migration scanner should start */
375 unsigned long compact_cached_migrate_pfn[2];
376#endif
377#ifdef CONFIG_MEMORY_HOTPLUG
378 /* see spanned/present_pages for more description */
379 seqlock_t span_seqlock;
380#endif
381 struct free_area free_area[MAX_ORDER];
382 361
383#ifndef CONFIG_SPARSEMEM 362#ifndef CONFIG_SPARSEMEM
384 /* 363 /*
@@ -388,74 +367,14 @@ struct zone {
388 unsigned long *pageblock_flags; 367 unsigned long *pageblock_flags;
389#endif /* CONFIG_SPARSEMEM */ 368#endif /* CONFIG_SPARSEMEM */
390 369
391#ifdef CONFIG_COMPACTION 370#ifdef CONFIG_NUMA
392 /*
393 * On compaction failure, 1<<compact_defer_shift compactions
394 * are skipped before trying again. The number attempted since
395 * last failure is tracked with compact_considered.
396 */
397 unsigned int compact_considered;
398 unsigned int compact_defer_shift;
399 int compact_order_failed;
400#endif
401
402 ZONE_PADDING(_pad1_)
403
404 /* Fields commonly accessed by the page reclaim scanner */
405 spinlock_t lru_lock;
406 struct lruvec lruvec;
407
408 /* Evictions & activations on the inactive file list */
409 atomic_long_t inactive_age;
410
411 unsigned long pages_scanned; /* since last reclaim */
412 unsigned long flags; /* zone flags, see below */
413
414 /* Zone statistics */
415 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
416
417 /*
418 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
419 * this zone's LRU. Maintained by the pageout code.
420 */
421 unsigned int inactive_ratio;
422
423
424 ZONE_PADDING(_pad2_)
425 /* Rarely used or read-mostly fields */
426
427 /* 371 /*
428 * wait_table -- the array holding the hash table 372 * zone reclaim becomes active if more unmapped pages exist.
429 * wait_table_hash_nr_entries -- the size of the hash table array
430 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
431 *
432 * The purpose of all these is to keep track of the people
433 * waiting for a page to become available and make them
434 * runnable again when possible. The trouble is that this
435 * consumes a lot of space, especially when so few things
436 * wait on pages at a given time. So instead of using
437 * per-page waitqueues, we use a waitqueue hash table.
438 *
439 * The bucket discipline is to sleep on the same queue when
440 * colliding and wake all in that wait queue when removing.
441 * When something wakes, it must check to be sure its page is
442 * truly available, a la thundering herd. The cost of a
443 * collision is great, but given the expected load of the
444 * table, they should be so rare as to be outweighed by the
445 * benefits from the saved space.
446 *
447 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
448 * primary users of these fields, and in mm/page_alloc.c
449 * free_area_init_core() performs the initialization of them.
450 */ 373 */
451 wait_queue_head_t * wait_table; 374 unsigned long min_unmapped_pages;
452 unsigned long wait_table_hash_nr_entries; 375 unsigned long min_slab_pages;
453 unsigned long wait_table_bits; 376#endif /* CONFIG_NUMA */
454 377
455 /*
456 * Discontig memory support fields.
457 */
458 struct pglist_data *zone_pgdat;
459 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ 378 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
460 unsigned long zone_start_pfn; 379 unsigned long zone_start_pfn;
461 380
@@ -500,9 +419,11 @@ struct zone {
500 * adjust_managed_page_count() should be used instead of directly 419 * adjust_managed_page_count() should be used instead of directly
501 * touching zone->managed_pages and totalram_pages. 420 * touching zone->managed_pages and totalram_pages.
502 */ 421 */
422 unsigned long managed_pages;
503 unsigned long spanned_pages; 423 unsigned long spanned_pages;
504 unsigned long present_pages; 424 unsigned long present_pages;
505 unsigned long managed_pages; 425
426 const char *name;
506 427
507 /* 428 /*
508 * Number of MIGRATE_RESEVE page block. To maintain for just 429 * Number of MIGRATE_RESEVE page block. To maintain for just
@@ -510,10 +431,94 @@ struct zone {
510 */ 431 */
511 int nr_migrate_reserve_block; 432 int nr_migrate_reserve_block;
512 433
434#ifdef CONFIG_MEMORY_HOTPLUG
435 /* see spanned/present_pages for more description */
436 seqlock_t span_seqlock;
437#endif
438
513 /* 439 /*
514 * rarely used fields: 440 * wait_table -- the array holding the hash table
441 * wait_table_hash_nr_entries -- the size of the hash table array
442 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
443 *
444 * The purpose of all these is to keep track of the people
445 * waiting for a page to become available and make them
446 * runnable again when possible. The trouble is that this
447 * consumes a lot of space, especially when so few things
448 * wait on pages at a given time. So instead of using
449 * per-page waitqueues, we use a waitqueue hash table.
450 *
451 * The bucket discipline is to sleep on the same queue when
452 * colliding and wake all in that wait queue when removing.
453 * When something wakes, it must check to be sure its page is
454 * truly available, a la thundering herd. The cost of a
455 * collision is great, but given the expected load of the
456 * table, they should be so rare as to be outweighed by the
457 * benefits from the saved space.
458 *
459 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
460 * primary users of these fields, and in mm/page_alloc.c
461 * free_area_init_core() performs the initialization of them.
515 */ 462 */
516 const char *name; 463 wait_queue_head_t *wait_table;
464 unsigned long wait_table_hash_nr_entries;
465 unsigned long wait_table_bits;
466
467 ZONE_PADDING(_pad1_)
468
469 /* Write-intensive fields used from the page allocator */
470 spinlock_t lock;
471
472 /* free areas of different sizes */
473 struct free_area free_area[MAX_ORDER];
474
475 /* zone flags, see below */
476 unsigned long flags;
477
478 ZONE_PADDING(_pad2_)
479
480 /* Write-intensive fields used by page reclaim */
481
482 /* Fields commonly accessed by the page reclaim scanner */
483 spinlock_t lru_lock;
484 struct lruvec lruvec;
485
486 /* Evictions & activations on the inactive file list */
487 atomic_long_t inactive_age;
488
489 /*
490 * When free pages are below this point, additional steps are taken
491 * when reading the number of free pages to avoid per-cpu counter
492 * drift allowing watermarks to be breached
493 */
494 unsigned long percpu_drift_mark;
495
496#if defined CONFIG_COMPACTION || defined CONFIG_CMA
497 /* pfn where compaction free scanner should start */
498 unsigned long compact_cached_free_pfn;
499 /* pfn where async and sync compaction migration scanner should start */
500 unsigned long compact_cached_migrate_pfn[2];
501#endif
502
503#ifdef CONFIG_COMPACTION
504 /*
505 * On compaction failure, 1<<compact_defer_shift compactions
506 * are skipped before trying again. The number attempted since
507 * last failure is tracked with compact_considered.
508 */
509 unsigned int compact_considered;
510 unsigned int compact_defer_shift;
511 int compact_order_failed;
512#endif
513
514#if defined CONFIG_COMPACTION || defined CONFIG_CMA
515 /* Set to true when the PG_migrate_skip bits should be cleared */
516 bool compact_blockskip_flush;
517#endif
518
519 ZONE_PADDING(_pad3_)
520 /* Zone statistics */
521 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
517} ____cacheline_internodealigned_in_smp; 522} ____cacheline_internodealigned_in_smp;
518 523
519typedef enum { 524typedef enum {
@@ -529,6 +534,7 @@ typedef enum {
529 ZONE_WRITEBACK, /* reclaim scanning has recently found 534 ZONE_WRITEBACK, /* reclaim scanning has recently found
530 * many pages under writeback 535 * many pages under writeback
531 */ 536 */
537 ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */
532} zone_flags_t; 538} zone_flags_t;
533 539
534static inline void zone_set_flag(struct zone *zone, zone_flags_t flag) 540static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
@@ -566,6 +572,11 @@ static inline int zone_is_reclaim_locked(const struct zone *zone)
566 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); 572 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
567} 573}
568 574
575static inline int zone_is_fair_depleted(const struct zone *zone)
576{
577 return test_bit(ZONE_FAIR_DEPLETED, &zone->flags);
578}
579
569static inline int zone_is_oom_locked(const struct zone *zone) 580static inline int zone_is_oom_locked(const struct zone *zone)
570{ 581{
571 return test_bit(ZONE_OOM_LOCKED, &zone->flags); 582 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
@@ -872,6 +883,8 @@ static inline int zone_movable_is_highmem(void)
872{ 883{
873#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) 884#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
874 return movable_zone == ZONE_HIGHMEM; 885 return movable_zone == ZONE_HIGHMEM;
886#elif defined(CONFIG_HIGHMEM)
887 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
875#else 888#else
876 return 0; 889 return 0;
877#endif 890#endif
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index b1990c5524e1..494f99e852da 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -381,6 +381,11 @@ extern int param_set_ulong(const char *val, const struct kernel_param *kp);
381extern int param_get_ulong(char *buffer, const struct kernel_param *kp); 381extern int param_get_ulong(char *buffer, const struct kernel_param *kp);
382#define param_check_ulong(name, p) __param_check(name, p, unsigned long) 382#define param_check_ulong(name, p) __param_check(name, p, unsigned long)
383 383
384extern struct kernel_param_ops param_ops_ullong;
385extern int param_set_ullong(const char *val, const struct kernel_param *kp);
386extern int param_get_ullong(char *buffer, const struct kernel_param *kp);
387#define param_check_ullong(name, p) __param_check(name, p, unsigned long long)
388
384extern struct kernel_param_ops param_ops_charp; 389extern struct kernel_param_ops param_ops_charp;
385extern int param_set_charp(const char *val, const struct kernel_param *kp); 390extern int param_set_charp(const char *val, const struct kernel_param *kp);
386extern int param_get_charp(char *buffer, const struct kernel_param *kp); 391extern int param_get_charp(char *buffer, const struct kernel_param *kp);
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 839bac270904..b0c1e6574e7f 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -42,13 +42,20 @@ struct mnt_namespace;
42 * flag, consider how it interacts with shared mounts. 42 * flag, consider how it interacts with shared mounts.
43 */ 43 */
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_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \
46 | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \
47 | MNT_READONLY)
48#define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME )
46 49
47#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \ 50#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
48 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED) 51 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED)
49 52
50#define MNT_INTERNAL 0x4000 53#define MNT_INTERNAL 0x4000
51 54
55#define MNT_LOCK_ATIME 0x040000
56#define MNT_LOCK_NOEXEC 0x080000
57#define MNT_LOCK_NOSUID 0x100000
58#define MNT_LOCK_NODEV 0x200000
52#define MNT_LOCK_READONLY 0x400000 59#define MNT_LOCK_READONLY 0x400000
53#define MNT_LOCKED 0x800000 60#define MNT_LOCKED 0x800000
54#define MNT_DOOMED 0x1000000 61#define MNT_DOOMED 0x1000000
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 92a2f991262a..8103f32f6d87 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -25,7 +25,8 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg);
25struct msi_desc { 25struct msi_desc {
26 struct { 26 struct {
27 __u8 is_msix : 1; 27 __u8 is_msix : 1;
28 __u8 multiple: 3; /* log2 number of messages */ 28 __u8 multiple: 3; /* log2 num of messages allocated */
29 __u8 multi_cap : 3; /* log2 num of messages supported */
29 __u8 maskbit : 1; /* mask-pending bit supported ? */ 30 __u8 maskbit : 1; /* mask-pending bit supported ? */
30 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
31 __u8 pos; /* Location of the msi capability */ 32 __u8 pos; /* Location of the msi capability */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a1b0b4c8fd79..031ff3a9a0bd 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -222,6 +222,7 @@ struct mtd_info {
222 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 222 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
223 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 223 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
224 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 224 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
225 int (*_block_isreserved) (struct mtd_info *mtd, loff_t ofs);
225 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); 226 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs);
226 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); 227 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
227 int (*_suspend) (struct mtd_info *mtd); 228 int (*_suspend) (struct mtd_info *mtd);
@@ -302,6 +303,7 @@ static inline void mtd_sync(struct mtd_info *mtd)
302int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 303int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
303int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 304int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
304int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len); 305int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len);
306int mtd_block_isreserved(struct mtd_info *mtd, loff_t ofs);
305int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs); 307int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs);
306int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs); 308int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs);
307 309
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2f0af2891f0f..3083c53e0270 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -810,6 +810,7 @@ extern struct nand_manufacturers nand_manuf_ids[];
810extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 810extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
811extern int nand_default_bbt(struct mtd_info *mtd); 811extern int nand_default_bbt(struct mtd_info *mtd);
812extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs); 812extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
813extern int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs);
813extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 814extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
814extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 815extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
815 int allowbbt); 816 int allowbbt);
@@ -947,4 +948,56 @@ static inline int jedec_feature(struct nand_chip *chip)
947 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features) 948 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features)
948 : 0; 949 : 0;
949} 950}
951
952/**
953 * struct nand_sdr_timings - SDR NAND chip timings
954 *
955 * This struct defines the timing requirements of a SDR NAND chip.
956 * These informations can be found in every NAND datasheets and the timings
957 * meaning are described in the ONFI specifications:
958 * www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf (chapter 4.15 Timing
959 * Parameters)
960 *
961 * All these timings are expressed in picoseconds.
962 */
963
964struct nand_sdr_timings {
965 u32 tALH_min;
966 u32 tADL_min;
967 u32 tALS_min;
968 u32 tAR_min;
969 u32 tCEA_max;
970 u32 tCEH_min;
971 u32 tCH_min;
972 u32 tCHZ_max;
973 u32 tCLH_min;
974 u32 tCLR_min;
975 u32 tCLS_min;
976 u32 tCOH_min;
977 u32 tCS_min;
978 u32 tDH_min;
979 u32 tDS_min;
980 u32 tFEAT_max;
981 u32 tIR_min;
982 u32 tITC_max;
983 u32 tRC_min;
984 u32 tREA_max;
985 u32 tREH_min;
986 u32 tRHOH_min;
987 u32 tRHW_min;
988 u32 tRHZ_max;
989 u32 tRLOH_min;
990 u32 tRP_min;
991 u32 tRR_min;
992 u64 tRST_max;
993 u32 tWB_max;
994 u32 tWC_min;
995 u32 tWH_min;
996 u32 tWHR_min;
997 u32 tWP_min;
998 u32 tWW_min;
999};
1000
1001/* get timing characteristics from ONFI timing mode. */
1002const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
950#endif /* __LINUX_MTD_NAND_H */ 1003#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 53241842a7ab..9e6294f32ba8 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -34,6 +34,7 @@
34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */ 34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */
35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */ 35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */
36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */ 36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */
37#define SPINOR_OP_RDFSR 0x70 /* Read flag status register */
37 38
38/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */ 39/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
39#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */ 40#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */
@@ -66,6 +67,9 @@
66 67
67#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ 68#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */
68 69
70/* Flag Status Register bits */
71#define FSR_READY 0x80
72
69/* Configuration Register bits. */ 73/* Configuration Register bits. */
70#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ 74#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */
71 75
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 42aa9b9ecd5f..8d5535c58cc2 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -176,8 +176,4 @@ extern void mutex_unlock(struct mutex *lock);
176 176
177extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 177extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
178 178
179#ifndef arch_mutex_cpu_relax
180# define arch_mutex_cpu_relax() cpu_relax()
181#endif
182
183#endif /* __LINUX_MUTEX_H */ 179#endif /* __LINUX_MUTEX_H */
diff --git a/include/linux/mvebu-pmsu.h b/include/linux/mvebu-pmsu.h
new file mode 100644
index 000000000000..b918d07efe23
--- /dev/null
+++ b/include/linux/mvebu-pmsu.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2012 Marvell
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __MVEBU_PMSU_H__
12#define __MVEBU_PMSU_H__
13
14#ifdef CONFIG_MACH_MVEBU_V7
15int mvebu_pmsu_dfs_request(int cpu);
16#else
17static inline int mvebu_pmsu_dfs_request(int cpu) { return -ENODEV; }
18#endif
19
20#endif /* __MVEBU_PMSU_H__ */
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index d99800cbdcf3..dcfdecbfa0b7 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -176,4 +176,12 @@ enum {
176 NETIF_F_HW_VLAN_STAG_RX | \ 176 NETIF_F_HW_VLAN_STAG_RX | \
177 NETIF_F_HW_VLAN_STAG_TX) 177 NETIF_F_HW_VLAN_STAG_TX)
178 178
179#define NETIF_F_GSO_ENCAP_ALL (NETIF_F_GSO_GRE | \
180 NETIF_F_GSO_GRE_CSUM | \
181 NETIF_F_GSO_IPIP | \
182 NETIF_F_GSO_SIT | \
183 NETIF_F_GSO_UDP_TUNNEL | \
184 NETIF_F_GSO_UDP_TUNNEL_CSUM | \
185 NETIF_F_GSO_MPLS)
186
179#endif /* _LINUX_NETDEV_FEATURES_H */ 187#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 66f9a04ec270..38377392d082 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -943,7 +943,8 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
943 * const unsigned char *addr) 943 * const unsigned char *addr)
944 * Deletes the FDB entry from dev coresponding to addr. 944 * Deletes the FDB entry from dev coresponding to addr.
945 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 945 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
946 * struct net_device *dev, int idx) 946 * struct net_device *dev, struct net_device *filter_dev,
947 * int idx)
947 * Used to add FDB entries to dump requests. Implementers should add 948 * Used to add FDB entries to dump requests. Implementers should add
948 * entries to skb and update idx with the number of entries. 949 * entries to skb and update idx with the number of entries.
949 * 950 *
@@ -1114,6 +1115,7 @@ struct net_device_ops {
1114 int (*ndo_fdb_dump)(struct sk_buff *skb, 1115 int (*ndo_fdb_dump)(struct sk_buff *skb,
1115 struct netlink_callback *cb, 1116 struct netlink_callback *cb,
1116 struct net_device *dev, 1117 struct net_device *dev,
1118 struct net_device *filter_dev,
1117 int idx); 1119 int idx);
1118 1120
1119 int (*ndo_bridge_setlink)(struct net_device *dev, 1121 int (*ndo_bridge_setlink)(struct net_device *dev,
@@ -1229,42 +1231,228 @@ enum netdev_priv_flags {
1229#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE 1231#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1230#define IFF_MACVLAN IFF_MACVLAN 1232#define IFF_MACVLAN IFF_MACVLAN
1231 1233
1232/* 1234/**
1233 * The DEVICE structure. 1235 * struct net_device - The DEVICE structure.
1234 * Actually, this whole structure is a big mistake. It mixes I/O 1236 * Actually, this whole structure is a big mistake. It mixes I/O
1235 * data with strictly "high-level" data, and it has to know about 1237 * data with strictly "high-level" data, and it has to know about
1236 * almost every data structure used in the INET module. 1238 * almost every data structure used in the INET module.
1239 *
1240 * @name: This is the first field of the "visible" part of this structure
1241 * (i.e. as seen by users in the "Space.c" file). It is the name
1242 * of the interface.
1243 *
1244 * @name_hlist: Device name hash chain, please keep it close to name[]
1245 * @ifalias: SNMP alias
1246 * @mem_end: Shared memory end
1247 * @mem_start: Shared memory start
1248 * @base_addr: Device I/O address
1249 * @irq: Device IRQ number
1250 *
1251 * @state: Generic network queuing layer state, see netdev_state_t
1252 * @dev_list: The global list of network devices
1253 * @napi_list: List entry, that is used for polling napi devices
1254 * @unreg_list: List entry, that is used, when we are unregistering the
1255 * device, see the function unregister_netdev
1256 * @close_list: List entry, that is used, when we are closing the device
1257 *
1258 * @adj_list: Directly linked devices, like slaves for bonding
1259 * @all_adj_list: All linked devices, *including* neighbours
1260 * @features: Currently active device features
1261 * @hw_features: User-changeable features
1262 *
1263 * @wanted_features: User-requested features
1264 * @vlan_features: Mask of features inheritable by VLAN devices
1265 *
1266 * @hw_enc_features: Mask of features inherited by encapsulating devices
1267 * This field indicates what encapsulation
1268 * offloads the hardware is capable of doing,
1269 * and drivers will need to set them appropriately.
1270 *
1271 * @mpls_features: Mask of features inheritable by MPLS
1272 *
1273 * @ifindex: interface index
1274 * @iflink: unique device identifier
1275 *
1276 * @stats: Statistics struct, which was left as a legacy, use
1277 * rtnl_link_stats64 instead
1278 *
1279 * @rx_dropped: Dropped packets by core network,
1280 * do not use this in drivers
1281 * @tx_dropped: Dropped packets by core network,
1282 * do not use this in drivers
1283 *
1284 * @carrier_changes: Stats to monitor carrier on<->off transitions
1285 *
1286 * @wireless_handlers: List of functions to handle Wireless Extensions,
1287 * instead of ioctl,
1288 * see <net/iw_handler.h> for details.
1289 * @wireless_data: Instance data managed by the core of wireless extensions
1290 *
1291 * @netdev_ops: Includes several pointers to callbacks,
1292 * if one wants to override the ndo_*() functions
1293 * @ethtool_ops: Management operations
1294 * @fwd_ops: Management operations
1295 * @header_ops: Includes callbacks for creating,parsing,rebuilding,etc
1296 * of Layer 2 headers.
1297 *
1298 * @flags: Interface flags (a la BSD)
1299 * @priv_flags: Like 'flags' but invisible to userspace,
1300 * see if.h for the definitions
1301 * @gflags: Global flags ( kept as legacy )
1302 * @padded: How much padding added by alloc_netdev()
1303 * @operstate: RFC2863 operstate
1304 * @link_mode: Mapping policy to operstate
1305 * @if_port: Selectable AUI, TP, ...
1306 * @dma: DMA channel
1307 * @mtu: Interface MTU value
1308 * @type: Interface hardware type
1309 * @hard_header_len: Hardware header length
1310 *
1311 * @needed_headroom: Extra headroom the hardware may need, but not in all
1312 * cases can this be guaranteed
1313 * @needed_tailroom: Extra tailroom the hardware may need, but not in all
1314 * cases can this be guaranteed. Some cases also use
1315 * LL_MAX_HEADER instead to allocate the skb
1316 *
1317 * interface address info:
1318 *
1319 * @perm_addr: Permanent hw address
1320 * @addr_assign_type: Hw address assignment type
1321 * @addr_len: Hardware address length
1322 * @neigh_priv_len; Used in neigh_alloc(),
1323 * initialized only in atm/clip.c
1324 * @dev_id: Used to differentiate devices that share
1325 * the same link layer address
1326 * @dev_port: Used to differentiate devices that share
1327 * the same function
1328 * @addr_list_lock: XXX: need comments on this one
1329 * @uc: unicast mac addresses
1330 * @mc: multicast mac addresses
1331 * @dev_addrs: list of device hw addresses
1332 * @queues_kset: Group of all Kobjects in the Tx and RX queues
1333 * @uc_promisc: Counter, that indicates, that promiscuous mode
1334 * has been enabled due to the need to listen to
1335 * additional unicast addresses in a device that
1336 * does not implement ndo_set_rx_mode()
1337 * @promiscuity: Number of times, the NIC is told to work in
1338 * Promiscuous mode, if it becomes 0 the NIC will
1339 * exit from working in Promiscuous mode
1340 * @allmulti: Counter, enables or disables allmulticast mode
1341 *
1342 * @vlan_info: VLAN info
1343 * @dsa_ptr: dsa specific data
1344 * @tipc_ptr: TIPC specific data
1345 * @atalk_ptr: AppleTalk link
1346 * @ip_ptr: IPv4 specific data
1347 * @dn_ptr: DECnet specific data
1348 * @ip6_ptr: IPv6 specific data
1349 * @ax25_ptr: AX.25 specific data
1350 * @ieee80211_ptr: IEEE 802.11 specific data, assign before registering
1351 *
1352 * @last_rx: Time of last Rx
1353 * @dev_addr: Hw address (before bcast,
1354 * because most packets are unicast)
1355 *
1356 * @_rx: Array of RX queues
1357 * @num_rx_queues: Number of RX queues
1358 * allocated at register_netdev() time
1359 * @real_num_rx_queues: Number of RX queues currently active in device
1360 *
1361 * @rx_handler: handler for received packets
1362 * @rx_handler_data: XXX: need comments on this one
1363 * @ingress_queue: XXX: need comments on this one
1364 * @broadcast: hw bcast address
1365 *
1366 * @_tx: Array of TX queues
1367 * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time
1368 * @real_num_tx_queues: Number of TX queues currently active in device
1369 * @qdisc: Root qdisc from userspace point of view
1370 * @tx_queue_len: Max frames per queue allowed
1371 * @tx_global_lock: XXX: need comments on this one
1372 *
1373 * @xps_maps: XXX: need comments on this one
1374 *
1375 * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
1376 * indexed by RX queue number. Assigned by driver.
1377 * This must only be set if the ndo_rx_flow_steer
1378 * operation is defined
1379 *
1380 * @trans_start: Time (in jiffies) of last Tx
1381 * @watchdog_timeo: Represents the timeout that is used by
1382 * the watchdog ( see dev_watchdog() )
1383 * @watchdog_timer: List of timers
1384 *
1385 * @pcpu_refcnt: Number of references to this device
1386 * @todo_list: Delayed register/unregister
1387 * @index_hlist: Device index hash chain
1388 * @link_watch_list: XXX: need comments on this one
1389 *
1390 * @reg_state: Register/unregister state machine
1391 * @dismantle: Device is going to be freed
1392 * @rtnl_link_state: This enum represents the phases of creating
1393 * a new link
1394 *
1395 * @destructor: Called from unregister,
1396 * can be used to call free_netdev
1397 * @npinfo: XXX: need comments on this one
1398 * @nd_net: Network namespace this network device is inside
1399 *
1400 * @ml_priv: Mid-layer private
1401 * @lstats: Loopback statistics
1402 * @tstats: Tunnel statistics
1403 * @dstats: Dummy statistics
1404 * @vstats: Virtual ethernet statistics
1405 *
1406 * @garp_port: GARP
1407 * @mrp_port: MRP
1408 *
1409 * @dev: Class/net/name entry
1410 * @sysfs_groups: Space for optional device, statistics and wireless
1411 * sysfs groups
1412 *
1413 * @sysfs_rx_queue_group: Space for optional per-rx queue attributes
1414 * @rtnl_link_ops: Rtnl_link_ops
1415 *
1416 * @gso_max_size: Maximum size of generic segmentation offload
1417 * @gso_max_segs: Maximum number of segments that can be passed to the
1418 * NIC for GSO
1419 *
1420 * @dcbnl_ops: Data Center Bridging netlink ops
1421 * @num_tc: Number of traffic classes in the net device
1422 * @tc_to_txq: XXX: need comments on this one
1423 * @prio_tc_map XXX: need comments on this one
1424 *
1425 * @fcoe_ddp_xid: Max exchange id for FCoE LRO by ddp
1426 *
1427 * @priomap: XXX: need comments on this one
1428 * @phydev: Physical device may attach itself
1429 * for hardware timestamping
1430 *
1431 * @qdisc_tx_busylock: XXX: need comments on this one
1432 *
1433 * @group: The group, that the device belongs to
1434 * @pm_qos_req: Power Management QoS object
1237 * 1435 *
1238 * FIXME: cleanup struct net_device such that network protocol info 1436 * FIXME: cleanup struct net_device such that network protocol info
1239 * moves out. 1437 * moves out.
1240 */ 1438 */
1241 1439
1242struct net_device { 1440struct net_device {
1243
1244 /*
1245 * This is the first field of the "visible" part of this structure
1246 * (i.e. as seen by users in the "Space.c" file). It is the name
1247 * of the interface.
1248 */
1249 char name[IFNAMSIZ]; 1441 char name[IFNAMSIZ];
1250
1251 /* device name hash chain, please keep it close to name[] */
1252 struct hlist_node name_hlist; 1442 struct hlist_node name_hlist;
1253
1254 /* snmp alias */
1255 char *ifalias; 1443 char *ifalias;
1256
1257 /* 1444 /*
1258 * I/O specific fields 1445 * I/O specific fields
1259 * FIXME: Merge these and struct ifmap into one 1446 * FIXME: Merge these and struct ifmap into one
1260 */ 1447 */
1261 unsigned long mem_end; /* shared mem end */ 1448 unsigned long mem_end;
1262 unsigned long mem_start; /* shared mem start */ 1449 unsigned long mem_start;
1263 unsigned long base_addr; /* device I/O address */ 1450 unsigned long base_addr;
1264 int irq; /* device IRQ number */ 1451 int irq;
1265 1452
1266 /* 1453 /*
1267 * Some hardware also needs these fields, but they are not 1454 * Some hardware also needs these fields (state,dev_list,
1455 * napi_list,unreg_list,close_list) but they are not
1268 * part of the usual set specified in Space.c. 1456 * part of the usual set specified in Space.c.
1269 */ 1457 */
1270 1458
@@ -1275,110 +1463,80 @@ struct net_device {
1275 struct list_head unreg_list; 1463 struct list_head unreg_list;
1276 struct list_head close_list; 1464 struct list_head close_list;
1277 1465
1278 /* directly linked devices, like slaves for bonding */
1279 struct { 1466 struct {
1280 struct list_head upper; 1467 struct list_head upper;
1281 struct list_head lower; 1468 struct list_head lower;
1282 } adj_list; 1469 } adj_list;
1283 1470
1284 /* all linked devices, *including* neighbours */
1285 struct { 1471 struct {
1286 struct list_head upper; 1472 struct list_head upper;
1287 struct list_head lower; 1473 struct list_head lower;
1288 } all_adj_list; 1474 } all_adj_list;
1289 1475
1290
1291 /* currently active device features */
1292 netdev_features_t features; 1476 netdev_features_t features;
1293 /* user-changeable features */
1294 netdev_features_t hw_features; 1477 netdev_features_t hw_features;
1295 /* user-requested features */
1296 netdev_features_t wanted_features; 1478 netdev_features_t wanted_features;
1297 /* mask of features inheritable by VLAN devices */
1298 netdev_features_t vlan_features; 1479 netdev_features_t vlan_features;
1299 /* mask of features inherited by encapsulating devices
1300 * This field indicates what encapsulation offloads
1301 * the hardware is capable of doing, and drivers will
1302 * need to set them appropriately.
1303 */
1304 netdev_features_t hw_enc_features; 1480 netdev_features_t hw_enc_features;
1305 /* mask of fetures inheritable by MPLS */
1306 netdev_features_t mpls_features; 1481 netdev_features_t mpls_features;
1307 1482
1308 /* Interface index. Unique device identifier */
1309 int ifindex; 1483 int ifindex;
1310 int iflink; 1484 int iflink;
1311 1485
1312 struct net_device_stats stats; 1486 struct net_device_stats stats;
1313 1487
1314 /* dropped packets by core network, Do not use this in drivers */
1315 atomic_long_t rx_dropped; 1488 atomic_long_t rx_dropped;
1316 atomic_long_t tx_dropped; 1489 atomic_long_t tx_dropped;
1317 1490
1318 /* Stats to monitor carrier on<->off transitions */
1319 atomic_t carrier_changes; 1491 atomic_t carrier_changes;
1320 1492
1321#ifdef CONFIG_WIRELESS_EXT 1493#ifdef CONFIG_WIRELESS_EXT
1322 /* List of functions to handle Wireless Extensions (instead of ioctl).
1323 * See <net/iw_handler.h> for details. Jean II */
1324 const struct iw_handler_def * wireless_handlers; 1494 const struct iw_handler_def * wireless_handlers;
1325 /* Instance data managed by the core of Wireless Extensions. */
1326 struct iw_public_data * wireless_data; 1495 struct iw_public_data * wireless_data;
1327#endif 1496#endif
1328 /* Management operations */
1329 const struct net_device_ops *netdev_ops; 1497 const struct net_device_ops *netdev_ops;
1330 const struct ethtool_ops *ethtool_ops; 1498 const struct ethtool_ops *ethtool_ops;
1331 const struct forwarding_accel_ops *fwd_ops; 1499 const struct forwarding_accel_ops *fwd_ops;
1332 1500
1333 /* Hardware header description */
1334 const struct header_ops *header_ops; 1501 const struct header_ops *header_ops;
1335 1502
1336 unsigned int flags; /* interface flags (a la BSD) */ 1503 unsigned int flags;
1337 unsigned int priv_flags; /* Like 'flags' but invisible to userspace. 1504 unsigned int priv_flags;
1338 * See if.h for definitions. */ 1505
1339 unsigned short gflags; 1506 unsigned short gflags;
1340 unsigned short padded; /* How much padding added by alloc_netdev() */ 1507 unsigned short padded;
1341 1508
1342 unsigned char operstate; /* RFC2863 operstate */ 1509 unsigned char operstate;
1343 unsigned char link_mode; /* mapping policy to operstate */ 1510 unsigned char link_mode;
1344 1511
1345 unsigned char if_port; /* Selectable AUI, TP,..*/ 1512 unsigned char if_port;
1346 unsigned char dma; /* DMA channel */ 1513 unsigned char dma;
1347 1514
1348 unsigned int mtu; /* interface MTU value */ 1515 unsigned int mtu;
1349 unsigned short type; /* interface hardware type */ 1516 unsigned short type;
1350 unsigned short hard_header_len; /* hardware hdr length */ 1517 unsigned short hard_header_len;
1351 1518
1352 /* extra head- and tailroom the hardware may need, but not in all cases
1353 * can this be guaranteed, especially tailroom. Some cases also use
1354 * LL_MAX_HEADER instead to allocate the skb.
1355 */
1356 unsigned short needed_headroom; 1519 unsigned short needed_headroom;
1357 unsigned short needed_tailroom; 1520 unsigned short needed_tailroom;
1358 1521
1359 /* Interface address info. */ 1522 /* Interface address info. */
1360 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 1523 unsigned char perm_addr[MAX_ADDR_LEN];
1361 unsigned char addr_assign_type; /* hw address assignment type */ 1524 unsigned char addr_assign_type;
1362 unsigned char addr_len; /* hardware address length */ 1525 unsigned char addr_len;
1363 unsigned short neigh_priv_len; 1526 unsigned short neigh_priv_len;
1364 unsigned short dev_id; /* Used to differentiate devices 1527 unsigned short dev_id;
1365 * that share the same link 1528 unsigned short dev_port;
1366 * layer address
1367 */
1368 unsigned short dev_port; /* Used to differentiate
1369 * devices that share the same
1370 * function
1371 */
1372 spinlock_t addr_list_lock; 1529 spinlock_t addr_list_lock;
1373 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1530 struct netdev_hw_addr_list uc;
1374 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1531 struct netdev_hw_addr_list mc;
1375 struct netdev_hw_addr_list dev_addrs; /* list of device 1532 struct netdev_hw_addr_list dev_addrs;
1376 * hw addresses 1533
1377 */
1378#ifdef CONFIG_SYSFS 1534#ifdef CONFIG_SYSFS
1379 struct kset *queues_kset; 1535 struct kset *queues_kset;
1380#endif 1536#endif
1381 1537
1538 unsigned char name_assign_type;
1539
1382 bool uc_promisc; 1540 bool uc_promisc;
1383 unsigned int promiscuity; 1541 unsigned int promiscuity;
1384 unsigned int allmulti; 1542 unsigned int allmulti;
@@ -1387,40 +1545,34 @@ struct net_device {
1387 /* Protocol specific pointers */ 1545 /* Protocol specific pointers */
1388 1546
1389#if IS_ENABLED(CONFIG_VLAN_8021Q) 1547#if IS_ENABLED(CONFIG_VLAN_8021Q)
1390 struct vlan_info __rcu *vlan_info; /* VLAN info */ 1548 struct vlan_info __rcu *vlan_info;
1391#endif 1549#endif
1392#if IS_ENABLED(CONFIG_NET_DSA) 1550#if IS_ENABLED(CONFIG_NET_DSA)
1393 struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ 1551 struct dsa_switch_tree *dsa_ptr;
1394#endif 1552#endif
1395#if IS_ENABLED(CONFIG_TIPC) 1553#if IS_ENABLED(CONFIG_TIPC)
1396 struct tipc_bearer __rcu *tipc_ptr; /* TIPC specific data */ 1554 struct tipc_bearer __rcu *tipc_ptr;
1397#endif 1555#endif
1398 void *atalk_ptr; /* AppleTalk link */ 1556 void *atalk_ptr;
1399 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1557 struct in_device __rcu *ip_ptr;
1400 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ 1558 struct dn_dev __rcu *dn_ptr;
1401 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ 1559 struct inet6_dev __rcu *ip6_ptr;
1402 void *ax25_ptr; /* AX.25 specific data */ 1560 void *ax25_ptr;
1403 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1561 struct wireless_dev *ieee80211_ptr;
1404 assign before registering */
1405 1562
1406/* 1563/*
1407 * Cache lines mostly used on receive path (including eth_type_trans()) 1564 * Cache lines mostly used on receive path (including eth_type_trans())
1408 */ 1565 */
1409 unsigned long last_rx; /* Time of last Rx */ 1566 unsigned long last_rx;
1410 1567
1411 /* Interface address info used in eth_type_trans() */ 1568 /* Interface address info used in eth_type_trans() */
1412 unsigned char *dev_addr; /* hw address, (before bcast 1569 unsigned char *dev_addr;
1413 because most packets are
1414 unicast) */
1415 1570
1416 1571
1417#ifdef CONFIG_SYSFS 1572#ifdef CONFIG_SYSFS
1418 struct netdev_rx_queue *_rx; 1573 struct netdev_rx_queue *_rx;
1419 1574
1420 /* Number of RX queues allocated at register_netdev() time */
1421 unsigned int num_rx_queues; 1575 unsigned int num_rx_queues;
1422
1423 /* Number of RX queues currently active in device */
1424 unsigned int real_num_rx_queues; 1576 unsigned int real_num_rx_queues;
1425 1577
1426#endif 1578#endif
@@ -1429,33 +1581,23 @@ struct net_device {
1429 void __rcu *rx_handler_data; 1581 void __rcu *rx_handler_data;
1430 1582
1431 struct netdev_queue __rcu *ingress_queue; 1583 struct netdev_queue __rcu *ingress_queue;
1432 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 1584 unsigned char broadcast[MAX_ADDR_LEN];
1433 1585
1434 1586
1435/* 1587/*
1436 * Cache lines mostly used on transmit path 1588 * Cache lines mostly used on transmit path
1437 */ 1589 */
1438 struct netdev_queue *_tx ____cacheline_aligned_in_smp; 1590 struct netdev_queue *_tx ____cacheline_aligned_in_smp;
1439
1440 /* Number of TX queues allocated at alloc_netdev_mq() time */
1441 unsigned int num_tx_queues; 1591 unsigned int num_tx_queues;
1442
1443 /* Number of TX queues currently active in device */
1444 unsigned int real_num_tx_queues; 1592 unsigned int real_num_tx_queues;
1445
1446 /* root qdisc from userspace point of view */
1447 struct Qdisc *qdisc; 1593 struct Qdisc *qdisc;
1448 1594 unsigned long tx_queue_len;
1449 unsigned long tx_queue_len; /* Max frames per queue allowed */
1450 spinlock_t tx_global_lock; 1595 spinlock_t tx_global_lock;
1451 1596
1452#ifdef CONFIG_XPS 1597#ifdef CONFIG_XPS
1453 struct xps_dev_maps __rcu *xps_maps; 1598 struct xps_dev_maps __rcu *xps_maps;
1454#endif 1599#endif
1455#ifdef CONFIG_RFS_ACCEL 1600#ifdef CONFIG_RFS_ACCEL
1456 /* CPU reverse-mapping for RX completion interrupts, indexed
1457 * by RX queue number. Assigned by driver. This must only be
1458 * set if the ndo_rx_flow_steer operation is defined. */
1459 struct cpu_rmap *rx_cpu_rmap; 1601 struct cpu_rmap *rx_cpu_rmap;
1460#endif 1602#endif
1461 1603
@@ -1465,22 +1607,17 @@ struct net_device {
1465 * trans_start here is expensive for high speed devices on SMP, 1607 * trans_start here is expensive for high speed devices on SMP,
1466 * please use netdev_queue->trans_start instead. 1608 * please use netdev_queue->trans_start instead.
1467 */ 1609 */
1468 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 1610 unsigned long trans_start;
1469 1611
1470 int watchdog_timeo; /* used by dev_watchdog() */ 1612 int watchdog_timeo;
1471 struct timer_list watchdog_timer; 1613 struct timer_list watchdog_timer;
1472 1614
1473 /* Number of references to this device */
1474 int __percpu *pcpu_refcnt; 1615 int __percpu *pcpu_refcnt;
1475
1476 /* delayed register/unregister */
1477 struct list_head todo_list; 1616 struct list_head todo_list;
1478 /* device index hash chain */
1479 struct hlist_node index_hlist;
1480 1617
1618 struct hlist_node index_hlist;
1481 struct list_head link_watch_list; 1619 struct list_head link_watch_list;
1482 1620
1483 /* register/unregister state machine */
1484 enum { NETREG_UNINITIALIZED=0, 1621 enum { NETREG_UNINITIALIZED=0,
1485 NETREG_REGISTERED, /* completed register_netdevice */ 1622 NETREG_REGISTERED, /* completed register_netdevice */
1486 NETREG_UNREGISTERING, /* called unregister_netdevice */ 1623 NETREG_UNREGISTERING, /* called unregister_netdevice */
@@ -1489,14 +1626,13 @@ struct net_device {
1489 NETREG_DUMMY, /* dummy device for NAPI poll */ 1626 NETREG_DUMMY, /* dummy device for NAPI poll */
1490 } reg_state:8; 1627 } reg_state:8;
1491 1628
1492 bool dismantle; /* device is going do be freed */ 1629 bool dismantle;
1493 1630
1494 enum { 1631 enum {
1495 RTNL_LINK_INITIALIZED, 1632 RTNL_LINK_INITIALIZED,
1496 RTNL_LINK_INITIALIZING, 1633 RTNL_LINK_INITIALIZING,
1497 } rtnl_link_state:16; 1634 } rtnl_link_state:16;
1498 1635
1499 /* Called from unregister, can be used to call free_netdev */
1500 void (*destructor)(struct net_device *dev); 1636 void (*destructor)(struct net_device *dev);
1501 1637
1502#ifdef CONFIG_NETPOLL 1638#ifdef CONFIG_NETPOLL
@@ -1504,31 +1640,25 @@ struct net_device {
1504#endif 1640#endif
1505 1641
1506#ifdef CONFIG_NET_NS 1642#ifdef CONFIG_NET_NS
1507 /* Network namespace this network device is inside */
1508 struct net *nd_net; 1643 struct net *nd_net;
1509#endif 1644#endif
1510 1645
1511 /* mid-layer private */ 1646 /* mid-layer private */
1512 union { 1647 union {
1513 void *ml_priv; 1648 void *ml_priv;
1514 struct pcpu_lstats __percpu *lstats; /* loopback stats */ 1649 struct pcpu_lstats __percpu *lstats;
1515 struct pcpu_sw_netstats __percpu *tstats; 1650 struct pcpu_sw_netstats __percpu *tstats;
1516 struct pcpu_dstats __percpu *dstats; /* dummy stats */ 1651 struct pcpu_dstats __percpu *dstats;
1517 struct pcpu_vstats __percpu *vstats; /* veth stats */ 1652 struct pcpu_vstats __percpu *vstats;
1518 }; 1653 };
1519 /* GARP */ 1654
1520 struct garp_port __rcu *garp_port; 1655 struct garp_port __rcu *garp_port;
1521 /* MRP */
1522 struct mrp_port __rcu *mrp_port; 1656 struct mrp_port __rcu *mrp_port;
1523 1657
1524 /* class/net/name entry */ 1658 struct device dev;
1525 struct device dev;
1526 /* space for optional device, statistics, and wireless sysfs groups */
1527 const struct attribute_group *sysfs_groups[4]; 1659 const struct attribute_group *sysfs_groups[4];
1528 /* space for optional per-rx queue attributes */
1529 const struct attribute_group *sysfs_rx_queue_group; 1660 const struct attribute_group *sysfs_rx_queue_group;
1530 1661
1531 /* rtnetlink link ops */
1532 const struct rtnl_link_ops *rtnl_link_ops; 1662 const struct rtnl_link_ops *rtnl_link_ops;
1533 1663
1534 /* for setting kernel sock attribute on TCP connection setup */ 1664 /* for setting kernel sock attribute on TCP connection setup */
@@ -1538,7 +1668,6 @@ struct net_device {
1538 u16 gso_max_segs; 1668 u16 gso_max_segs;
1539 1669
1540#ifdef CONFIG_DCB 1670#ifdef CONFIG_DCB
1541 /* Data Center Bridging netlink ops */
1542 const struct dcbnl_rtnl_ops *dcbnl_ops; 1671 const struct dcbnl_rtnl_ops *dcbnl_ops;
1543#endif 1672#endif
1544 u8 num_tc; 1673 u8 num_tc;
@@ -1546,20 +1675,14 @@ struct net_device {
1546 u8 prio_tc_map[TC_BITMASK + 1]; 1675 u8 prio_tc_map[TC_BITMASK + 1];
1547 1676
1548#if IS_ENABLED(CONFIG_FCOE) 1677#if IS_ENABLED(CONFIG_FCOE)
1549 /* max exchange id for FCoE LRO by ddp */
1550 unsigned int fcoe_ddp_xid; 1678 unsigned int fcoe_ddp_xid;
1551#endif 1679#endif
1552#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) 1680#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
1553 struct netprio_map __rcu *priomap; 1681 struct netprio_map __rcu *priomap;
1554#endif 1682#endif
1555 /* phy device may attach itself for hardware timestamping */
1556 struct phy_device *phydev; 1683 struct phy_device *phydev;
1557
1558 struct lock_class_key *qdisc_tx_busylock; 1684 struct lock_class_key *qdisc_tx_busylock;
1559
1560 /* group the device belongs to */
1561 int group; 1685 int group;
1562
1563 struct pm_qos_request pm_qos_req; 1686 struct pm_qos_request pm_qos_req;
1564}; 1687};
1565#define to_net_dev(d) container_of(d, struct net_device, dev) 1688#define to_net_dev(d) container_of(d, struct net_device, dev)
@@ -2486,7 +2609,7 @@ static inline int netif_set_xps_queue(struct net_device *dev,
2486 * as a distribution range limit for the returned value. 2609 * as a distribution range limit for the returned value.
2487 */ 2610 */
2488static inline u16 skb_tx_hash(const struct net_device *dev, 2611static inline u16 skb_tx_hash(const struct net_device *dev,
2489 const struct sk_buff *skb) 2612 struct sk_buff *skb)
2490{ 2613{
2491 return __skb_tx_hash(dev, skb, dev->real_num_tx_queues); 2614 return __skb_tx_hash(dev, skb, dev->real_num_tx_queues);
2492} 2615}
@@ -2987,13 +3110,15 @@ void ether_setup(struct net_device *dev);
2987 3110
2988/* Support for loadable net-drivers */ 3111/* Support for loadable net-drivers */
2989struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, 3112struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
3113 unsigned char name_assign_type,
2990 void (*setup)(struct net_device *), 3114 void (*setup)(struct net_device *),
2991 unsigned int txqs, unsigned int rxqs); 3115 unsigned int txqs, unsigned int rxqs);
2992#define alloc_netdev(sizeof_priv, name, setup) \ 3116#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
2993 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 3117 alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1)
2994 3118
2995#define alloc_netdev_mq(sizeof_priv, name, setup, count) \ 3119#define alloc_netdev_mq(sizeof_priv, name, name_assign_type, setup, count) \
2996 alloc_netdev_mqs(sizeof_priv, name, setup, count, count) 3120 alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, count, \
3121 count)
2997 3122
2998int register_netdev(struct net_device *dev); 3123int register_netdev(struct net_device *dev);
2999void unregister_netdev(struct net_device *dev); 3124void unregister_netdev(struct net_device *dev);
@@ -3377,11 +3502,26 @@ extern struct pernet_operations __net_initdata loopback_net_ops;
3377 3502
3378static inline const char *netdev_name(const struct net_device *dev) 3503static inline const char *netdev_name(const struct net_device *dev)
3379{ 3504{
3380 if (dev->reg_state != NETREG_REGISTERED) 3505 if (!dev->name[0] || strchr(dev->name, '%'))
3381 return "(unregistered net_device)"; 3506 return "(unnamed net_device)";
3382 return dev->name; 3507 return dev->name;
3383} 3508}
3384 3509
3510static inline const char *netdev_reg_state(const struct net_device *dev)
3511{
3512 switch (dev->reg_state) {
3513 case NETREG_UNINITIALIZED: return " (uninitialized)";
3514 case NETREG_REGISTERED: return "";
3515 case NETREG_UNREGISTERING: return " (unregistering)";
3516 case NETREG_UNREGISTERED: return " (unregistered)";
3517 case NETREG_RELEASED: return " (released)";
3518 case NETREG_DUMMY: return " (dummy)";
3519 }
3520
3521 WARN_ONCE(1, "%s: unknown reg_state %d\n", dev->name, dev->reg_state);
3522 return " (unknown)";
3523}
3524
3385__printf(3, 4) 3525__printf(3, 4)
3386int netdev_printk(const char *level, const struct net_device *dev, 3526int netdev_printk(const char *level, const struct net_device *dev,
3387 const char *format, ...); 3527 const char *format, ...);
@@ -3438,7 +3578,8 @@ do { \
3438 * file/line information and a backtrace. 3578 * file/line information and a backtrace.
3439 */ 3579 */
3440#define netdev_WARN(dev, format, args...) \ 3580#define netdev_WARN(dev, format, args...) \
3441 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args) 3581 WARN(1, "netdevice: %s%s\n" format, netdev_name(dev), \
3582 netdev_reg_state(dev), ##args)
3442 3583
3443/* netif printk helpers, similar to netdev_printk */ 3584/* netif printk helpers, similar to netdev_printk */
3444 3585
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 447775ee2c4b..1d2a6ab6b8bb 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -63,4 +63,8 @@ extern int proc_dowatchdog(struct ctl_table *, int ,
63 void __user *, size_t *, loff_t *); 63 void __user *, size_t *, loff_t *);
64#endif 64#endif
65 65
66#ifdef CONFIG_HAVE_ACPI_APEI_NMI
67#include <asm/nmi.h>
68#endif
69
66#endif 70#endif
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 58b9a02c38d2..83a6aeda899d 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -430,7 +430,15 @@ static inline int num_node_state(enum node_states state)
430 for_each_node_mask((__node), node_states[__state]) 430 for_each_node_mask((__node), node_states[__state])
431 431
432#define first_online_node first_node(node_states[N_ONLINE]) 432#define first_online_node first_node(node_states[N_ONLINE])
433#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) 433#define first_memory_node first_node(node_states[N_MEMORY])
434static inline int next_online_node(int nid)
435{
436 return next_node(nid, node_states[N_ONLINE]);
437}
438static inline int next_memory_node(int nid)
439{
440 return next_node(nid, node_states[N_MEMORY]);
441}
434 442
435extern int nr_node_ids; 443extern int nr_node_ids;
436extern int nr_online_nodes; 444extern int nr_online_nodes;
@@ -471,6 +479,7 @@ static inline int num_node_state(enum node_states state)
471 for ( (node) = 0; (node) == 0; (node) = 1) 479 for ( (node) = 0; (node) == 0; (node) = 1)
472 480
473#define first_online_node 0 481#define first_online_node 0
482#define first_memory_node 0
474#define next_online_node(nid) (MAX_NUMNODES) 483#define next_online_node(nid) (MAX_NUMNODES)
475#define nr_node_ids 1 484#define nr_node_ids 1
476#define nr_online_nodes 1 485#define nr_online_nodes 1
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index b4ec59d159ac..35fa08fd7739 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -40,32 +40,28 @@ extern struct nsproxy init_nsproxy;
40 * the namespaces access rules are: 40 * the namespaces access rules are:
41 * 41 *
42 * 1. only current task is allowed to change tsk->nsproxy pointer or 42 * 1. only current task is allowed to change tsk->nsproxy pointer or
43 * any pointer on the nsproxy itself 43 * any pointer on the nsproxy itself. Current must hold the task_lock
44 * when changing tsk->nsproxy.
44 * 45 *
45 * 2. when accessing (i.e. reading) current task's namespaces - no 46 * 2. when accessing (i.e. reading) current task's namespaces - no
46 * precautions should be taken - just dereference the pointers 47 * precautions should be taken - just dereference the pointers
47 * 48 *
48 * 3. the access to other task namespaces is performed like this 49 * 3. the access to other task namespaces is performed like this
49 * rcu_read_lock(); 50 * task_lock(task);
50 * nsproxy = task_nsproxy(tsk); 51 * nsproxy = task->nsproxy;
51 * if (nsproxy != NULL) { 52 * if (nsproxy != NULL) {
52 * / * 53 * / *
53 * * work with the namespaces here 54 * * work with the namespaces here
54 * * e.g. get the reference on one of them 55 * * e.g. get the reference on one of them
55 * * / 56 * * /
56 * } / * 57 * } / *
57 * * NULL task_nsproxy() means that this task is 58 * * NULL task->nsproxy means that this task is
58 * * almost dead (zombie) 59 * * almost dead (zombie)
59 * * / 60 * * /
60 * rcu_read_unlock(); 61 * task_unlock(task);
61 * 62 *
62 */ 63 */
63 64
64static inline struct nsproxy *task_nsproxy(struct task_struct *tsk)
65{
66 return rcu_dereference(tsk->nsproxy);
67}
68
69int copy_namespaces(unsigned long flags, struct task_struct *tsk); 65int copy_namespaces(unsigned long flags, struct task_struct *tsk);
70void exit_task_namespaces(struct task_struct *tsk); 66void exit_task_namespaces(struct task_struct *tsk);
71void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); 67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index c13b8782a4eb..fb7b7221e063 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -109,7 +109,12 @@ static inline bool of_dma_is_coherent(struct device_node *np)
109extern int of_address_to_resource(struct device_node *dev, int index, 109extern int of_address_to_resource(struct device_node *dev, int index,
110 struct resource *r); 110 struct resource *r);
111void __iomem *of_iomap(struct device_node *node, int index); 111void __iomem *of_iomap(struct device_node *node, int index);
112void __iomem *of_io_request_and_map(struct device_node *device,
113 int index, char *name);
112#else 114#else
115
116#include <linux/io.h>
117
113static inline int of_address_to_resource(struct device_node *dev, int index, 118static inline int of_address_to_resource(struct device_node *dev, int index,
114 struct resource *r) 119 struct resource *r)
115{ 120{
@@ -120,6 +125,12 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
120{ 125{
121 return NULL; 126 return NULL;
122} 127}
128
129static inline void __iomem *of_io_request_and_map(struct device_node *device,
130 int index, char *name)
131{
132 return IOMEM_ERR_PTR(-EINVAL);
133}
123#endif 134#endif
124 135
125#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) 136#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
diff --git a/include/linux/oid_registry.h b/include/linux/oid_registry.h
index 6926db724258..c2bbf672b84e 100644
--- a/include/linux/oid_registry.h
+++ b/include/linux/oid_registry.h
@@ -52,9 +52,15 @@ enum OID {
52 OID_md4, /* 1.2.840.113549.2.4 */ 52 OID_md4, /* 1.2.840.113549.2.4 */
53 OID_md5, /* 1.2.840.113549.2.5 */ 53 OID_md5, /* 1.2.840.113549.2.5 */
54 54
55 OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */ 55 /* Microsoft Authenticode & Software Publishing */
56 OID_msIndirectData, /* 1.3.6.1.4.1.311.2.1.4 */
57 OID_msPeImageDataObjId, /* 1.3.6.1.4.1.311.2.1.15 */
58 OID_msIndividualSPKeyPurpose, /* 1.3.6.1.4.1.311.2.1.21 */
56 OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */ 59 OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */
60
61 OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */
57 OID_sha1, /* 1.3.14.3.2.26 */ 62 OID_sha1, /* 1.3.14.3.2.26 */
63 OID_sha256, /* 2.16.840.1.101.3.4.2.1 */
58 64
59 /* Distinguished Name attribute IDs [RFC 2256] */ 65 /* Distinguished Name attribute IDs [RFC 2256] */
60 OID_commonName, /* 2.5.4.3 */ 66 OID_commonName, /* 2.5.4.3 */
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 88e6ea4a5d36..6f06f8bc612c 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -130,6 +130,7 @@
130#define IS_WORD_16 BIT(0xd) 130#define IS_WORD_16 BIT(0xd)
131#define ENABLE_16XX_MODE BIT(0xe) 131#define ENABLE_16XX_MODE BIT(0xe)
132#define HS_CHANNELS_RESERVED BIT(0xf) 132#define HS_CHANNELS_RESERVED BIT(0xf)
133#define DMA_ENGINE_HANDLE_IRQ BIT(0x10)
133 134
134/* Defines for DMA Capabilities */ 135/* Defines for DMA Capabilities */
135#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18) 136#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18)
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h
index cac78de09c07..c1aede46718b 100644
--- a/include/linux/omap-iommu.h
+++ b/include/linux/omap-iommu.h
@@ -10,41 +10,8 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#ifndef _INTEL_IOMMU_H_ 13#ifndef _OMAP_IOMMU_H_
14#define _INTEL_IOMMU_H_ 14#define _OMAP_IOMMU_H_
15
16struct iovm_struct {
17 struct omap_iommu *iommu; /* iommu object which this belongs to */
18 u32 da_start; /* area definition */
19 u32 da_end;
20 u32 flags; /* IOVMF_: see below */
21 struct list_head list; /* linked in ascending order */
22 const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */
23 void *va; /* mpu side mapped address */
24};
25
26#define MMU_RAM_ENDIAN_SHIFT 9
27#define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT)
28#define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT)
29#define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE
30#define MMU_RAM_ELSZ_SHIFT 7
31#define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8
32
33struct iommu_domain;
34
35extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
36extern u32
37omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
38 const struct sg_table *sgt, u32 flags);
39extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
40 struct device *dev, u32 da);
41extern u32
42omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev,
43 u32 da, size_t bytes, u32 flags);
44extern void
45omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
46 const u32 da);
47extern void *omap_da_to_va(struct device *dev, u32 da);
48 15
49extern void omap_iommu_save_ctx(struct device *dev); 16extern void omap_iommu_save_ctx(struct device *dev);
50extern void omap_iommu_restore_ctx(struct device *dev); 17extern void omap_iommu_restore_ctx(struct device *dev);
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 4cd62677feb9..647395a1a550 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -55,8 +55,8 @@ extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
55 struct mem_cgroup *memcg, nodemask_t *nodemask, 55 struct mem_cgroup *memcg, nodemask_t *nodemask,
56 const char *message); 56 const char *message);
57 57
58extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 58extern bool oom_zonelist_trylock(struct zonelist *zonelist, gfp_t gfp_flags);
59extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 59extern void oom_zonelist_unlock(struct zonelist *zonelist, gfp_t gfp_flags);
60 60
61extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, 61extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
62 int order, const nodemask_t *nodemask); 62 int order, const nodemask_t *nodemask);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 8304959ad336..e1f5fcd79792 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -171,13 +171,12 @@ static inline int __TestClearPage##uname(struct page *page) \
171#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ 171#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname) 172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
173 173
174#define PAGEFLAG_FALSE(uname) \
175static inline int Page##uname(const struct page *page) \
176 { return 0; }
177
178#define TESTSCFLAG(uname, lname) \ 174#define TESTSCFLAG(uname, lname) \
179 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) 175 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
180 176
177#define TESTPAGEFLAG_FALSE(uname) \
178static inline int Page##uname(const struct page *page) { return 0; }
179
181#define SETPAGEFLAG_NOOP(uname) \ 180#define SETPAGEFLAG_NOOP(uname) \
182static inline void SetPage##uname(struct page *page) { } 181static inline void SetPage##uname(struct page *page) { }
183 182
@@ -187,12 +186,21 @@ static inline void ClearPage##uname(struct page *page) { }
187#define __CLEARPAGEFLAG_NOOP(uname) \ 186#define __CLEARPAGEFLAG_NOOP(uname) \
188static inline void __ClearPage##uname(struct page *page) { } 187static inline void __ClearPage##uname(struct page *page) { }
189 188
189#define TESTSETFLAG_FALSE(uname) \
190static inline int TestSetPage##uname(struct page *page) { return 0; }
191
190#define TESTCLEARFLAG_FALSE(uname) \ 192#define TESTCLEARFLAG_FALSE(uname) \
191static inline int TestClearPage##uname(struct page *page) { return 0; } 193static inline int TestClearPage##uname(struct page *page) { return 0; }
192 194
193#define __TESTCLEARFLAG_FALSE(uname) \ 195#define __TESTCLEARFLAG_FALSE(uname) \
194static inline int __TestClearPage##uname(struct page *page) { return 0; } 196static inline int __TestClearPage##uname(struct page *page) { return 0; }
195 197
198#define PAGEFLAG_FALSE(uname) TESTPAGEFLAG_FALSE(uname) \
199 SETPAGEFLAG_NOOP(uname) CLEARPAGEFLAG_NOOP(uname)
200
201#define TESTSCFLAG_FALSE(uname) \
202 TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname)
203
196struct page; /* forward declaration */ 204struct page; /* forward declaration */
197 205
198TESTPAGEFLAG(Locked, locked) 206TESTPAGEFLAG(Locked, locked)
@@ -248,7 +256,6 @@ PAGEFLAG_FALSE(HighMem)
248PAGEFLAG(SwapCache, swapcache) 256PAGEFLAG(SwapCache, swapcache)
249#else 257#else
250PAGEFLAG_FALSE(SwapCache) 258PAGEFLAG_FALSE(SwapCache)
251 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
252#endif 259#endif
253 260
254PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 261PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
@@ -258,8 +265,8 @@ PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
258PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 265PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
259 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) 266 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked)
260#else 267#else
261PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) 268PAGEFLAG_FALSE(Mlocked) __CLEARPAGEFLAG_NOOP(Mlocked)
262 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) 269 TESTSCFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
263#endif 270#endif
264 271
265#ifdef CONFIG_ARCH_USES_PG_UNCACHED 272#ifdef CONFIG_ARCH_USES_PG_UNCACHED
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 777a524716db..5c831f1eca79 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -3,17 +3,15 @@
3 3
4enum { 4enum {
5 /* flags for mem_cgroup */ 5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ 6 PCG_USED = 0x01, /* This page is charged to a memcg */
7 PCG_USED, /* this object is in use. */ 7 PCG_MEM = 0x02, /* This page holds a memory charge */
8 PCG_MIGRATION, /* under page migration */ 8 PCG_MEMSW = 0x04, /* This page holds a memory+swap charge */
9 __NR_PCG_FLAGS,
10}; 9};
11 10
12#ifndef __GENERATING_BOUNDS_H 11struct pglist_data;
13#include <generated/bounds.h>
14 12
15#ifdef CONFIG_MEMCG 13#ifdef CONFIG_MEMCG
16#include <linux/bit_spinlock.h> 14struct mem_cgroup;
17 15
18/* 16/*
19 * Page Cgroup can be considered as an extended mem_map. 17 * Page Cgroup can be considered as an extended mem_map.
@@ -27,65 +25,30 @@ struct page_cgroup {
27 struct mem_cgroup *mem_cgroup; 25 struct mem_cgroup *mem_cgroup;
28}; 26};
29 27
30void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 28extern void pgdat_page_cgroup_init(struct pglist_data *pgdat);
31 29
32#ifdef CONFIG_SPARSEMEM 30#ifdef CONFIG_SPARSEMEM
33static inline void __init page_cgroup_init_flatmem(void) 31static inline void page_cgroup_init_flatmem(void)
34{ 32{
35} 33}
36extern void __init page_cgroup_init(void); 34extern void page_cgroup_init(void);
37#else 35#else
38void __init page_cgroup_init_flatmem(void); 36extern void page_cgroup_init_flatmem(void);
39static inline void __init page_cgroup_init(void) 37static inline void page_cgroup_init(void)
40{ 38{
41} 39}
42#endif 40#endif
43 41
44struct page_cgroup *lookup_page_cgroup(struct page *page); 42struct page_cgroup *lookup_page_cgroup(struct page *page);
45struct page *lookup_cgroup_page(struct page_cgroup *pc);
46
47#define TESTPCGFLAG(uname, lname) \
48static inline int PageCgroup##uname(struct page_cgroup *pc) \
49 { return test_bit(PCG_##lname, &pc->flags); }
50
51#define SETPCGFLAG(uname, lname) \
52static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
53 { set_bit(PCG_##lname, &pc->flags); }
54
55#define CLEARPCGFLAG(uname, lname) \
56static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
57 { clear_bit(PCG_##lname, &pc->flags); }
58
59#define TESTCLEARPCGFLAG(uname, lname) \
60static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
61 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
62
63TESTPCGFLAG(Used, USED)
64CLEARPCGFLAG(Used, USED)
65SETPCGFLAG(Used, USED)
66
67SETPCGFLAG(Migration, MIGRATION)
68CLEARPCGFLAG(Migration, MIGRATION)
69TESTPCGFLAG(Migration, MIGRATION)
70 43
71static inline void lock_page_cgroup(struct page_cgroup *pc) 44static inline int PageCgroupUsed(struct page_cgroup *pc)
72{ 45{
73 /* 46 return !!(pc->flags & PCG_USED);
74 * Don't take this lock in IRQ context.
75 * This lock is for pc->mem_cgroup, USED, MIGRATION
76 */
77 bit_spin_lock(PCG_LOCK, &pc->flags);
78} 47}
79 48#else /* !CONFIG_MEMCG */
80static inline void unlock_page_cgroup(struct page_cgroup *pc)
81{
82 bit_spin_unlock(PCG_LOCK, &pc->flags);
83}
84
85#else /* CONFIG_MEMCG */
86struct page_cgroup; 49struct page_cgroup;
87 50
88static inline void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat) 51static inline void pgdat_page_cgroup_init(struct pglist_data *pgdat)
89{ 52{
90} 53}
91 54
@@ -98,10 +61,9 @@ static inline void page_cgroup_init(void)
98{ 61{
99} 62}
100 63
101static inline void __init page_cgroup_init_flatmem(void) 64static inline void page_cgroup_init_flatmem(void)
102{ 65{
103} 66}
104
105#endif /* CONFIG_MEMCG */ 67#endif /* CONFIG_MEMCG */
106 68
107#include <linux/swap.h> 69#include <linux/swap.h>
@@ -140,6 +102,4 @@ static inline void swap_cgroup_swapoff(int type)
140 102
141#endif /* CONFIG_MEMCG_SWAP */ 103#endif /* CONFIG_MEMCG_SWAP */
142 104
143#endif /* !__GENERATING_BOUNDS_H */
144
145#endif /* __LINUX_PAGE_CGROUP_H */ 105#endif /* __LINUX_PAGE_CGROUP_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index e1474ae18c88..3df8c7db7a4e 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -484,6 +484,9 @@ static inline int lock_page_killable(struct page *page)
484/* 484/*
485 * lock_page_or_retry - Lock the page, unless this would block and the 485 * lock_page_or_retry - Lock the page, unless this would block and the
486 * caller indicated that it can handle a retry. 486 * caller indicated that it can handle a retry.
487 *
488 * Return value and mmap_sem implications depend on flags; see
489 * __lock_page_or_retry().
487 */ 490 */
488static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, 491static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
489 unsigned int flags) 492 unsigned int flags)
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 637a608ded0b..64dacb7288a6 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -11,12 +11,17 @@
11#include <linux/acpi.h> 11#include <linux/acpi.h>
12 12
13#ifdef CONFIG_ACPI 13#ifdef CONFIG_ACPI
14extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev, 14extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev);
15 struct pci_bus *pci_bus); 15static inline acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev)
16extern acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev); 16{
17 return acpi_remove_pm_notifier(dev);
18}
17extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, 19extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
18 struct pci_dev *pci_dev); 20 struct pci_dev *pci_dev);
19extern acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev); 21static inline acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev)
22{
23 return acpi_remove_pm_notifier(dev);
24}
20extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle); 25extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle);
21 26
22static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 27static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 466bcd111d85..61978a460841 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -978,6 +978,8 @@ int pci_try_reset_slot(struct pci_slot *slot);
978int pci_probe_reset_bus(struct pci_bus *bus); 978int pci_probe_reset_bus(struct pci_bus *bus);
979int pci_reset_bus(struct pci_bus *bus); 979int pci_reset_bus(struct pci_bus *bus);
980int pci_try_reset_bus(struct pci_bus *bus); 980int pci_try_reset_bus(struct pci_bus *bus);
981void pci_reset_secondary_bus(struct pci_dev *dev);
982void pcibios_reset_secondary_bus(struct pci_dev *dev);
981void pci_reset_bridge_secondary_bus(struct pci_dev *dev); 983void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
982void pci_update_resource(struct pci_dev *dev, int resno); 984void pci_update_resource(struct pci_dev *dev, int resno);
983int __must_check pci_assign_resource(struct pci_dev *dev, int i); 985int __must_check pci_assign_resource(struct pci_dev *dev, int i);
@@ -1186,7 +1188,6 @@ int pci_msix_vec_count(struct pci_dev *dev);
1186int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); 1188int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1187void pci_msix_shutdown(struct pci_dev *dev); 1189void pci_msix_shutdown(struct pci_dev *dev);
1188void pci_disable_msix(struct pci_dev *dev); 1190void pci_disable_msix(struct pci_dev *dev);
1189void msi_remove_pci_irq_vectors(struct pci_dev *dev);
1190void pci_restore_msi_state(struct pci_dev *dev); 1191void pci_restore_msi_state(struct pci_dev *dev);
1191int pci_msi_enabled(void); 1192int pci_msi_enabled(void);
1192int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); 1193int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
@@ -1217,7 +1218,6 @@ static inline int pci_enable_msix(struct pci_dev *dev,
1217{ return -ENOSYS; } 1218{ return -ENOSYS; }
1218static inline void pci_msix_shutdown(struct pci_dev *dev) { } 1219static inline void pci_msix_shutdown(struct pci_dev *dev) { }
1219static inline void pci_disable_msix(struct pci_dev *dev) { } 1220static inline void pci_disable_msix(struct pci_dev *dev) { }
1220static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) { }
1221static inline void pci_restore_msi_state(struct pci_dev *dev) { } 1221static inline void pci_restore_msi_state(struct pci_dev *dev) { }
1222static inline int pci_msi_enabled(void) { return 0; } 1222static inline int pci_msi_enabled(void) { return 0; }
1223static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, 1223static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec,
@@ -1477,8 +1477,9 @@ enum pci_fixup_pass {
1477 pci_fixup_final, /* Final phase of device fixups */ 1477 pci_fixup_final, /* Final phase of device fixups */
1478 pci_fixup_enable, /* pci_enable_device() time */ 1478 pci_fixup_enable, /* pci_enable_device() time */
1479 pci_fixup_resume, /* pci_device_resume() */ 1479 pci_fixup_resume, /* pci_device_resume() */
1480 pci_fixup_suspend, /* pci_device_suspend */ 1480 pci_fixup_suspend, /* pci_device_suspend() */
1481 pci_fixup_resume_early, /* pci_device_resume_early() */ 1481 pci_fixup_resume_early, /* pci_device_resume_early() */
1482 pci_fixup_suspend_late, /* pci_device_suspend_late() */
1482}; 1483};
1483 1484
1484/* Anonymous variables would be nice... */ 1485/* Anonymous variables would be nice... */
@@ -1519,6 +1520,11 @@ enum pci_fixup_pass {
1519 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1520 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1520 suspend##hook, vendor, device, class, \ 1521 suspend##hook, vendor, device, class, \
1521 class_shift, hook) 1522 class_shift, hook)
1523#define DECLARE_PCI_FIXUP_CLASS_SUSPEND_LATE(vendor, device, class, \
1524 class_shift, hook) \
1525 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \
1526 suspend_late##hook, vendor, device, \
1527 class, class_shift, hook)
1522 1528
1523#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1529#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
1524 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1530 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
@@ -1544,6 +1550,10 @@ enum pci_fixup_pass {
1544 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1550 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1545 suspend##hook, vendor, device, \ 1551 suspend##hook, vendor, device, \
1546 PCI_ANY_ID, 0, hook) 1552 PCI_ANY_ID, 0, hook)
1553#define DECLARE_PCI_FIXUP_SUSPEND_LATE(vendor, device, hook) \
1554 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \
1555 suspend_late##hook, vendor, device, \
1556 PCI_ANY_ID, 0, hook)
1547 1557
1548#ifdef CONFIG_PCI_QUIRKS 1558#ifdef CONFIG_PCI_QUIRKS
1549void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1559void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7fa31731c854..6ed0bb73a864 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -6,6 +6,8 @@
6 * Do not add new entries to this file unless the definitions 6 * Do not add new entries to this file unless the definitions
7 * are shared between multiple drivers. 7 * are shared between multiple drivers.
8 */ 8 */
9#ifndef _LINUX_PCI_IDS_H
10#define _LINUX_PCI_IDS_H
9 11
10/* Device classes and subclasses */ 12/* Device classes and subclasses */
11 13
@@ -2968,3 +2970,5 @@
2968#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 2970#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
2969 2971
2970#define PCI_VENDOR_ID_OCZ 0x1b85 2972#define PCI_VENDOR_ID_OCZ 0x1b85
2973
2974#endif /* _LINUX_PCI_IDS_H */
diff --git a/include/linux/pe.h b/include/linux/pe.h
new file mode 100644
index 000000000000..e170b95e763b
--- /dev/null
+++ b/include/linux/pe.h
@@ -0,0 +1,448 @@
1/*
2 * Copyright 2011 Red Hat, Inc.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Author(s): Peter Jones <pjones@redhat.com>
18 */
19#ifndef __LINUX_PE_H
20#define __LINUX_PE_H
21
22#include <linux/types.h>
23
24#define MZ_MAGIC 0x5a4d /* "MZ" */
25
26struct mz_hdr {
27 uint16_t magic; /* MZ_MAGIC */
28 uint16_t lbsize; /* size of last used block */
29 uint16_t blocks; /* pages in file, 0x3 */
30 uint16_t relocs; /* relocations */
31 uint16_t hdrsize; /* header size in "paragraphs" */
32 uint16_t min_extra_pps; /* .bss */
33 uint16_t max_extra_pps; /* runtime limit for the arena size */
34 uint16_t ss; /* relative stack segment */
35 uint16_t sp; /* initial %sp register */
36 uint16_t checksum; /* word checksum */
37 uint16_t ip; /* initial %ip register */
38 uint16_t cs; /* initial %cs relative to load segment */
39 uint16_t reloc_table_offset; /* offset of the first relocation */
40 uint16_t overlay_num; /* overlay number. set to 0. */
41 uint16_t reserved0[4]; /* reserved */
42 uint16_t oem_id; /* oem identifier */
43 uint16_t oem_info; /* oem specific */
44 uint16_t reserved1[10]; /* reserved */
45 uint32_t peaddr; /* address of pe header */
46 char message[64]; /* message to print */
47};
48
49struct mz_reloc {
50 uint16_t offset;
51 uint16_t segment;
52};
53
54#define PE_MAGIC 0x00004550 /* "PE\0\0" */
55#define PE_OPT_MAGIC_PE32 0x010b
56#define PE_OPT_MAGIC_PE32_ROM 0x0107
57#define PE_OPT_MAGIC_PE32PLUS 0x020b
58
59/* machine type */
60#define IMAGE_FILE_MACHINE_UNKNOWN 0x0000
61#define IMAGE_FILE_MACHINE_AM33 0x01d3
62#define IMAGE_FILE_MACHINE_AMD64 0x8664
63#define IMAGE_FILE_MACHINE_ARM 0x01c0
64#define IMAGE_FILE_MACHINE_ARMV7 0x01c4
65#define IMAGE_FILE_MACHINE_EBC 0x0ebc
66#define IMAGE_FILE_MACHINE_I386 0x014c
67#define IMAGE_FILE_MACHINE_IA64 0x0200
68#define IMAGE_FILE_MACHINE_M32R 0x9041
69#define IMAGE_FILE_MACHINE_MIPS16 0x0266
70#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
71#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
72#define IMAGE_FILE_MACHINE_POWERPC 0x01f0
73#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
74#define IMAGE_FILE_MACHINE_R4000 0x0166
75#define IMAGE_FILE_MACHINE_SH3 0x01a2
76#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
77#define IMAGE_FILE_MACHINE_SH3E 0x01a4
78#define IMAGE_FILE_MACHINE_SH4 0x01a6
79#define IMAGE_FILE_MACHINE_SH5 0x01a8
80#define IMAGE_FILE_MACHINE_THUMB 0x01c2
81#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
82
83/* flags */
84#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
85#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
86#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
87#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
88#define IMAGE_FILE_AGGRESSIVE_WS_TRIM 0x0010
89#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
90#define IMAGE_FILE_16BIT_MACHINE 0x0040
91#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
92#define IMAGE_FILE_32BIT_MACHINE 0x0100
93#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
94#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
95#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
96#define IMAGE_FILE_SYSTEM 0x1000
97#define IMAGE_FILE_DLL 0x2000
98#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
99#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
100
101struct pe_hdr {
102 uint32_t magic; /* PE magic */
103 uint16_t machine; /* machine type */
104 uint16_t sections; /* number of sections */
105 uint32_t timestamp; /* time_t */
106 uint32_t symbol_table; /* symbol table offset */
107 uint32_t symbols; /* number of symbols */
108 uint16_t opt_hdr_size; /* size of optional header */
109 uint16_t flags; /* flags */
110};
111
112#define IMAGE_FILE_OPT_ROM_MAGIC 0x107
113#define IMAGE_FILE_OPT_PE32_MAGIC 0x10b
114#define IMAGE_FILE_OPT_PE32_PLUS_MAGIC 0x20b
115
116#define IMAGE_SUBSYSTEM_UNKNOWN 0
117#define IMAGE_SUBSYSTEM_NATIVE 1
118#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
119#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
120#define IMAGE_SUBSYSTEM_POSIX_CUI 7
121#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
122#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
123#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
124#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
125#define IMAGE_SUBSYSTEM_EFI_ROM_IMAGE 13
126#define IMAGE_SUBSYSTEM_XBOX 14
127
128#define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE 0x0040
129#define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY 0x0080
130#define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT 0x0100
131#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
132#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
133#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
134#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
135#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
136
137/* the fact that pe32 isn't padded where pe32+ is 64-bit means union won't
138 * work right. vomit. */
139struct pe32_opt_hdr {
140 /* "standard" header */
141 uint16_t magic; /* file type */
142 uint8_t ld_major; /* linker major version */
143 uint8_t ld_minor; /* linker minor version */
144 uint32_t text_size; /* size of text section(s) */
145 uint32_t data_size; /* size of data section(s) */
146 uint32_t bss_size; /* size of bss section(s) */
147 uint32_t entry_point; /* file offset of entry point */
148 uint32_t code_base; /* relative code addr in ram */
149 uint32_t data_base; /* relative data addr in ram */
150 /* "windows" header */
151 uint32_t image_base; /* preferred load address */
152 uint32_t section_align; /* alignment in bytes */
153 uint32_t file_align; /* file alignment in bytes */
154 uint16_t os_major; /* major OS version */
155 uint16_t os_minor; /* minor OS version */
156 uint16_t image_major; /* major image version */
157 uint16_t image_minor; /* minor image version */
158 uint16_t subsys_major; /* major subsystem version */
159 uint16_t subsys_minor; /* minor subsystem version */
160 uint32_t win32_version; /* reserved, must be 0 */
161 uint32_t image_size; /* image size */
162 uint32_t header_size; /* header size rounded up to
163 file_align */
164 uint32_t csum; /* checksum */
165 uint16_t subsys; /* subsystem */
166 uint16_t dll_flags; /* more flags! */
167 uint32_t stack_size_req;/* amt of stack requested */
168 uint32_t stack_size; /* amt of stack required */
169 uint32_t heap_size_req; /* amt of heap requested */
170 uint32_t heap_size; /* amt of heap required */
171 uint32_t loader_flags; /* reserved, must be 0 */
172 uint32_t data_dirs; /* number of data dir entries */
173};
174
175struct pe32plus_opt_hdr {
176 uint16_t magic; /* file type */
177 uint8_t ld_major; /* linker major version */
178 uint8_t ld_minor; /* linker minor version */
179 uint32_t text_size; /* size of text section(s) */
180 uint32_t data_size; /* size of data section(s) */
181 uint32_t bss_size; /* size of bss section(s) */
182 uint32_t entry_point; /* file offset of entry point */
183 uint32_t code_base; /* relative code addr in ram */
184 /* "windows" header */
185 uint64_t image_base; /* preferred load address */
186 uint32_t section_align; /* alignment in bytes */
187 uint32_t file_align; /* file alignment in bytes */
188 uint16_t os_major; /* major OS version */
189 uint16_t os_minor; /* minor OS version */
190 uint16_t image_major; /* major image version */
191 uint16_t image_minor; /* minor image version */
192 uint16_t subsys_major; /* major subsystem version */
193 uint16_t subsys_minor; /* minor subsystem version */
194 uint32_t win32_version; /* reserved, must be 0 */
195 uint32_t image_size; /* image size */
196 uint32_t header_size; /* header size rounded up to
197 file_align */
198 uint32_t csum; /* checksum */
199 uint16_t subsys; /* subsystem */
200 uint16_t dll_flags; /* more flags! */
201 uint64_t stack_size_req;/* amt of stack requested */
202 uint64_t stack_size; /* amt of stack required */
203 uint64_t heap_size_req; /* amt of heap requested */
204 uint64_t heap_size; /* amt of heap required */
205 uint32_t loader_flags; /* reserved, must be 0 */
206 uint32_t data_dirs; /* number of data dir entries */
207};
208
209struct data_dirent {
210 uint32_t virtual_address; /* relative to load address */
211 uint32_t size;
212};
213
214struct data_directory {
215 struct data_dirent exports; /* .edata */
216 struct data_dirent imports; /* .idata */
217 struct data_dirent resources; /* .rsrc */
218 struct data_dirent exceptions; /* .pdata */
219 struct data_dirent certs; /* certs */
220 struct data_dirent base_relocations; /* .reloc */
221 struct data_dirent debug; /* .debug */
222 struct data_dirent arch; /* reservered */
223 struct data_dirent global_ptr; /* global pointer reg. Size=0 */
224 struct data_dirent tls; /* .tls */
225 struct data_dirent load_config; /* load configuration structure */
226 struct data_dirent bound_imports; /* no idea */
227 struct data_dirent import_addrs; /* import address table */
228 struct data_dirent delay_imports; /* delay-load import table */
229 struct data_dirent clr_runtime_hdr; /* .cor (object only) */
230 struct data_dirent reserved;
231};
232
233struct section_header {
234 char name[8]; /* name or "/12\0" string tbl offset */
235 uint32_t virtual_size; /* size of loaded section in ram */
236 uint32_t virtual_address; /* relative virtual address */
237 uint32_t raw_data_size; /* size of the section */
238 uint32_t data_addr; /* file pointer to first page of sec */
239 uint32_t relocs; /* file pointer to relocation entries */
240 uint32_t line_numbers; /* line numbers! */
241 uint16_t num_relocs; /* number of relocations */
242 uint16_t num_lin_numbers; /* srsly. */
243 uint32_t flags;
244};
245
246/* they actually defined 0x00000000 as well, but I think we'll skip that one. */
247#define IMAGE_SCN_RESERVED_0 0x00000001
248#define IMAGE_SCN_RESERVED_1 0x00000002
249#define IMAGE_SCN_RESERVED_2 0x00000004
250#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* don't pad - obsolete */
251#define IMAGE_SCN_RESERVED_3 0x00000010
252#define IMAGE_SCN_CNT_CODE 0x00000020 /* .text */
253#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* .data */
254#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
255#define IMAGE_SCN_LNK_OTHER 0x00000100 /* reserved */
256#define IMAGE_SCN_LNK_INFO 0x00000200 /* .drectve comments */
257#define IMAGE_SCN_RESERVED_4 0x00000400
258#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* .o only - scn to be rm'd*/
259#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* .o only - COMDAT data */
260#define IMAGE_SCN_RESERVED_5 0x00002000 /* spec omits this */
261#define IMAGE_SCN_RESERVED_6 0x00004000 /* spec omits this */
262#define IMAGE_SCN_GPREL 0x00008000 /* global pointer referenced data */
263/* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
264#define IMAGE_SCN_MEM_PURGEABLE 0x00010000 /* reserved for "future" use */
265#define IMAGE_SCN_16BIT 0x00020000 /* reserved for "future" use */
266#define IMAGE_SCN_LOCKED 0x00040000 /* reserved for "future" use */
267#define IMAGE_SCN_PRELOAD 0x00080000 /* reserved for "future" use */
268/* and here they just stuck a 1-byte integer in the middle of a bitfield */
269#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 /* it does what it says on the box */
270#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
271#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
272#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
273#define IMAGE_SCN_ALIGN_16BYTES 0x00500000
274#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
275#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
276#define IMAGE_SCN_ALIGN_128BYTES 0x00800000
277#define IMAGE_SCN_ALIGN_256BYTES 0x00900000
278#define IMAGE_SCN_ALIGN_512BYTES 0x00a00000
279#define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
280#define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
281#define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
282#define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
283#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
284#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
285#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* cannot be cached */
286#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* not pageable */
287#define IMAGE_SCN_MEM_SHARED 0x10000000 /* can be shared */
288#define IMAGE_SCN_MEM_EXECUTE 0x20000000 /* can be executed as code */
289#define IMAGE_SCN_MEM_READ 0x40000000 /* readable */
290#define IMAGE_SCN_MEM_WRITE 0x80000000 /* writeable */
291
292enum x64_coff_reloc_type {
293 IMAGE_REL_AMD64_ABSOLUTE = 0,
294 IMAGE_REL_AMD64_ADDR64,
295 IMAGE_REL_AMD64_ADDR32,
296 IMAGE_REL_AMD64_ADDR32N,
297 IMAGE_REL_AMD64_REL32,
298 IMAGE_REL_AMD64_REL32_1,
299 IMAGE_REL_AMD64_REL32_2,
300 IMAGE_REL_AMD64_REL32_3,
301 IMAGE_REL_AMD64_REL32_4,
302 IMAGE_REL_AMD64_REL32_5,
303 IMAGE_REL_AMD64_SECTION,
304 IMAGE_REL_AMD64_SECREL,
305 IMAGE_REL_AMD64_SECREL7,
306 IMAGE_REL_AMD64_TOKEN,
307 IMAGE_REL_AMD64_SREL32,
308 IMAGE_REL_AMD64_PAIR,
309 IMAGE_REL_AMD64_SSPAN32,
310};
311
312enum arm_coff_reloc_type {
313 IMAGE_REL_ARM_ABSOLUTE,
314 IMAGE_REL_ARM_ADDR32,
315 IMAGE_REL_ARM_ADDR32N,
316 IMAGE_REL_ARM_BRANCH2,
317 IMAGE_REL_ARM_BRANCH1,
318 IMAGE_REL_ARM_SECTION,
319 IMAGE_REL_ARM_SECREL,
320};
321
322enum sh_coff_reloc_type {
323 IMAGE_REL_SH3_ABSOLUTE,
324 IMAGE_REL_SH3_DIRECT16,
325 IMAGE_REL_SH3_DIRECT32,
326 IMAGE_REL_SH3_DIRECT8,
327 IMAGE_REL_SH3_DIRECT8_WORD,
328 IMAGE_REL_SH3_DIRECT8_LONG,
329 IMAGE_REL_SH3_DIRECT4,
330 IMAGE_REL_SH3_DIRECT4_WORD,
331 IMAGE_REL_SH3_DIRECT4_LONG,
332 IMAGE_REL_SH3_PCREL8_WORD,
333 IMAGE_REL_SH3_PCREL8_LONG,
334 IMAGE_REL_SH3_PCREL12_WORD,
335 IMAGE_REL_SH3_STARTOF_SECTION,
336 IMAGE_REL_SH3_SIZEOF_SECTION,
337 IMAGE_REL_SH3_SECTION,
338 IMAGE_REL_SH3_SECREL,
339 IMAGE_REL_SH3_DIRECT32_NB,
340 IMAGE_REL_SH3_GPREL4_LONG,
341 IMAGE_REL_SH3_TOKEN,
342 IMAGE_REL_SHM_PCRELPT,
343 IMAGE_REL_SHM_REFLO,
344 IMAGE_REL_SHM_REFHALF,
345 IMAGE_REL_SHM_RELLO,
346 IMAGE_REL_SHM_RELHALF,
347 IMAGE_REL_SHM_PAIR,
348 IMAGE_REL_SHM_NOMODE,
349};
350
351enum ppc_coff_reloc_type {
352 IMAGE_REL_PPC_ABSOLUTE,
353 IMAGE_REL_PPC_ADDR64,
354 IMAGE_REL_PPC_ADDR32,
355 IMAGE_REL_PPC_ADDR24,
356 IMAGE_REL_PPC_ADDR16,
357 IMAGE_REL_PPC_ADDR14,
358 IMAGE_REL_PPC_REL24,
359 IMAGE_REL_PPC_REL14,
360 IMAGE_REL_PPC_ADDR32N,
361 IMAGE_REL_PPC_SECREL,
362 IMAGE_REL_PPC_SECTION,
363 IMAGE_REL_PPC_SECREL16,
364 IMAGE_REL_PPC_REFHI,
365 IMAGE_REL_PPC_REFLO,
366 IMAGE_REL_PPC_PAIR,
367 IMAGE_REL_PPC_SECRELLO,
368 IMAGE_REL_PPC_GPREL,
369 IMAGE_REL_PPC_TOKEN,
370};
371
372enum x86_coff_reloc_type {
373 IMAGE_REL_I386_ABSOLUTE,
374 IMAGE_REL_I386_DIR16,
375 IMAGE_REL_I386_REL16,
376 IMAGE_REL_I386_DIR32,
377 IMAGE_REL_I386_DIR32NB,
378 IMAGE_REL_I386_SEG12,
379 IMAGE_REL_I386_SECTION,
380 IMAGE_REL_I386_SECREL,
381 IMAGE_REL_I386_TOKEN,
382 IMAGE_REL_I386_SECREL7,
383 IMAGE_REL_I386_REL32,
384};
385
386enum ia64_coff_reloc_type {
387 IMAGE_REL_IA64_ABSOLUTE,
388 IMAGE_REL_IA64_IMM14,
389 IMAGE_REL_IA64_IMM22,
390 IMAGE_REL_IA64_IMM64,
391 IMAGE_REL_IA64_DIR32,
392 IMAGE_REL_IA64_DIR64,
393 IMAGE_REL_IA64_PCREL21B,
394 IMAGE_REL_IA64_PCREL21M,
395 IMAGE_REL_IA64_PCREL21F,
396 IMAGE_REL_IA64_GPREL22,
397 IMAGE_REL_IA64_LTOFF22,
398 IMAGE_REL_IA64_SECTION,
399 IMAGE_REL_IA64_SECREL22,
400 IMAGE_REL_IA64_SECREL64I,
401 IMAGE_REL_IA64_SECREL32,
402 IMAGE_REL_IA64_DIR32NB,
403 IMAGE_REL_IA64_SREL14,
404 IMAGE_REL_IA64_SREL22,
405 IMAGE_REL_IA64_SREL32,
406 IMAGE_REL_IA64_UREL32,
407 IMAGE_REL_IA64_PCREL60X,
408 IMAGE_REL_IA64_PCREL60B,
409 IMAGE_REL_IA64_PCREL60F,
410 IMAGE_REL_IA64_PCREL60I,
411 IMAGE_REL_IA64_PCREL60M,
412 IMAGE_REL_IA64_IMMGPREL6,
413 IMAGE_REL_IA64_TOKEN,
414 IMAGE_REL_IA64_GPREL32,
415 IMAGE_REL_IA64_ADDEND,
416};
417
418struct coff_reloc {
419 uint32_t virtual_address;
420 uint32_t symbol_table_index;
421 union {
422 enum x64_coff_reloc_type x64_type;
423 enum arm_coff_reloc_type arm_type;
424 enum sh_coff_reloc_type sh_type;
425 enum ppc_coff_reloc_type ppc_type;
426 enum x86_coff_reloc_type x86_type;
427 enum ia64_coff_reloc_type ia64_type;
428 uint16_t data;
429 };
430};
431
432/*
433 * Definitions for the contents of the certs data block
434 */
435#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
436#define WIN_CERT_TYPE_EFI_OKCS115 0x0EF0
437#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
438
439#define WIN_CERT_REVISION_1_0 0x0100
440#define WIN_CERT_REVISION_2_0 0x0200
441
442struct win_certificate {
443 uint32_t length;
444 uint16_t revision;
445 uint16_t cert_type;
446};
447
448#endif /* __LINUX_PE_H */
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index dec01d6c3f80..cfd56046ecec 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -1,6 +1,40 @@
1/*
2 * linux/percpu-defs.h - basic definitions for percpu areas
3 *
4 * DO NOT INCLUDE DIRECTLY OUTSIDE PERCPU IMPLEMENTATION PROPER.
5 *
6 * This file is separate from linux/percpu.h to avoid cyclic inclusion
7 * dependency from arch header files. Only to be included from
8 * asm/percpu.h.
9 *
10 * This file includes macros necessary to declare percpu sections and
11 * variables, and definitions of percpu accessors and operations. It
12 * should provide enough percpu features to arch header files even when
13 * they can only include asm/percpu.h to avoid cyclic inclusion dependency.
14 */
15
1#ifndef _LINUX_PERCPU_DEFS_H 16#ifndef _LINUX_PERCPU_DEFS_H
2#define _LINUX_PERCPU_DEFS_H 17#define _LINUX_PERCPU_DEFS_H
3 18
19#ifdef CONFIG_SMP
20
21#ifdef MODULE
22#define PER_CPU_SHARED_ALIGNED_SECTION ""
23#define PER_CPU_ALIGNED_SECTION ""
24#else
25#define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned"
26#define PER_CPU_ALIGNED_SECTION "..shared_aligned"
27#endif
28#define PER_CPU_FIRST_SECTION "..first"
29
30#else
31
32#define PER_CPU_SHARED_ALIGNED_SECTION ""
33#define PER_CPU_ALIGNED_SECTION "..shared_aligned"
34#define PER_CPU_FIRST_SECTION ""
35
36#endif
37
4/* 38/*
5 * Base implementations of per-CPU variable declarations and definitions, where 39 * Base implementations of per-CPU variable declarations and definitions, where
6 * the section in which the variable is to be placed is provided by the 40 * the section in which the variable is to be placed is provided by the
@@ -19,19 +53,6 @@
19 __attribute__((section(".discard"), unused)) 53 __attribute__((section(".discard"), unused))
20 54
21/* 55/*
22 * Macro which verifies @ptr is a percpu pointer without evaluating
23 * @ptr. This is to be used in percpu accessors to verify that the
24 * input parameter is a percpu pointer.
25 *
26 * + 0 is required in order to convert the pointer type from a
27 * potential array type to a pointer to a single item of the array.
28 */
29#define __verify_pcpu_ptr(ptr) do { \
30 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
31 (void)__vpp_verify; \
32} while (0)
33
34/*
35 * s390 and alpha modules require percpu variables to be defined as 56 * s390 and alpha modules require percpu variables to be defined as
36 * weak to force the compiler to generate GOT based external 57 * weak to force the compiler to generate GOT based external
37 * references for them. This is necessary because percpu sections 58 * references for them. This is necessary because percpu sections
@@ -164,4 +185,337 @@
164#define EXPORT_PER_CPU_SYMBOL_GPL(var) 185#define EXPORT_PER_CPU_SYMBOL_GPL(var)
165#endif 186#endif
166 187
188/*
189 * Accessors and operations.
190 */
191#ifndef __ASSEMBLY__
192
193/*
194 * __verify_pcpu_ptr() verifies @ptr is a percpu pointer without evaluating
195 * @ptr and is invoked once before a percpu area is accessed by all
196 * accessors and operations. This is performed in the generic part of
197 * percpu and arch overrides don't need to worry about it; however, if an
198 * arch wants to implement an arch-specific percpu accessor or operation,
199 * it may use __verify_pcpu_ptr() to verify the parameters.
200 *
201 * + 0 is required in order to convert the pointer type from a
202 * potential array type to a pointer to a single item of the array.
203 */
204#define __verify_pcpu_ptr(ptr) \
205do { \
206 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
207 (void)__vpp_verify; \
208} while (0)
209
210#ifdef CONFIG_SMP
211
212/*
213 * Add an offset to a pointer but keep the pointer as-is. Use RELOC_HIDE()
214 * to prevent the compiler from making incorrect assumptions about the
215 * pointer value. The weird cast keeps both GCC and sparse happy.
216 */
217#define SHIFT_PERCPU_PTR(__p, __offset) \
218 RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
219
220#define per_cpu_ptr(ptr, cpu) \
221({ \
222 __verify_pcpu_ptr(ptr); \
223 SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \
224})
225
226#define raw_cpu_ptr(ptr) \
227({ \
228 __verify_pcpu_ptr(ptr); \
229 arch_raw_cpu_ptr(ptr); \
230})
231
232#ifdef CONFIG_DEBUG_PREEMPT
233#define this_cpu_ptr(ptr) \
234({ \
235 __verify_pcpu_ptr(ptr); \
236 SHIFT_PERCPU_PTR(ptr, my_cpu_offset); \
237})
238#else
239#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
240#endif
241
242#else /* CONFIG_SMP */
243
244#define VERIFY_PERCPU_PTR(__p) \
245({ \
246 __verify_pcpu_ptr(__p); \
247 (typeof(*(__p)) __kernel __force *)(__p); \
248})
249
250#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
251#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
252#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
253
254#endif /* CONFIG_SMP */
255
256#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var)))
258#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
259
260/* keep until we have removed all uses of __this_cpu_ptr */
261#define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
262
263/*
264 * Must be an lvalue. Since @var must be a simple identifier,
265 * we force a syntax error here if it isn't.
266 */
267#define get_cpu_var(var) \
268(*({ \
269 preempt_disable(); \
270 this_cpu_ptr(&var); \
271}))
272
273/*
274 * The weird & is necessary because sparse considers (void)(var) to be
275 * a direct dereference of percpu variable (var).
276 */
277#define put_cpu_var(var) \
278do { \
279 (void)&(var); \
280 preempt_enable(); \
281} while (0)
282
283#define get_cpu_ptr(var) \
284({ \
285 preempt_disable(); \
286 this_cpu_ptr(var); \
287})
288
289#define put_cpu_ptr(var) \
290do { \
291 (void)(var); \
292 preempt_enable(); \
293} while (0)
294
295/*
296 * Branching function to split up a function into a set of functions that
297 * are called for different scalar sizes of the objects handled.
298 */
299
300extern void __bad_size_call_parameter(void);
301
302#ifdef CONFIG_DEBUG_PREEMPT
303extern void __this_cpu_preempt_check(const char *op);
304#else
305static inline void __this_cpu_preempt_check(const char *op) { }
306#endif
307
308#define __pcpu_size_call_return(stem, variable) \
309({ \
310 typeof(variable) pscr_ret__; \
311 __verify_pcpu_ptr(&(variable)); \
312 switch(sizeof(variable)) { \
313 case 1: pscr_ret__ = stem##1(variable); break; \
314 case 2: pscr_ret__ = stem##2(variable); break; \
315 case 4: pscr_ret__ = stem##4(variable); break; \
316 case 8: pscr_ret__ = stem##8(variable); break; \
317 default: \
318 __bad_size_call_parameter(); break; \
319 } \
320 pscr_ret__; \
321})
322
323#define __pcpu_size_call_return2(stem, variable, ...) \
324({ \
325 typeof(variable) pscr2_ret__; \
326 __verify_pcpu_ptr(&(variable)); \
327 switch(sizeof(variable)) { \
328 case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
329 case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \
330 case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \
331 case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \
332 default: \
333 __bad_size_call_parameter(); break; \
334 } \
335 pscr2_ret__; \
336})
337
338/*
339 * Special handling for cmpxchg_double. cmpxchg_double is passed two
340 * percpu variables. The first has to be aligned to a double word
341 * boundary and the second has to follow directly thereafter.
342 * We enforce this on all architectures even if they don't support
343 * a double cmpxchg instruction, since it's a cheap requirement, and it
344 * avoids breaking the requirement for architectures with the instruction.
345 */
346#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
347({ \
348 bool pdcrb_ret__; \
349 __verify_pcpu_ptr(&(pcp1)); \
350 BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
351 VM_BUG_ON((unsigned long)(&(pcp1)) % (2 * sizeof(pcp1))); \
352 VM_BUG_ON((unsigned long)(&(pcp2)) != \
353 (unsigned long)(&(pcp1)) + sizeof(pcp1)); \
354 switch(sizeof(pcp1)) { \
355 case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
356 case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
357 case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
358 case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
359 default: \
360 __bad_size_call_parameter(); break; \
361 } \
362 pdcrb_ret__; \
363})
364
365#define __pcpu_size_call(stem, variable, ...) \
366do { \
367 __verify_pcpu_ptr(&(variable)); \
368 switch(sizeof(variable)) { \
369 case 1: stem##1(variable, __VA_ARGS__);break; \
370 case 2: stem##2(variable, __VA_ARGS__);break; \
371 case 4: stem##4(variable, __VA_ARGS__);break; \
372 case 8: stem##8(variable, __VA_ARGS__);break; \
373 default: \
374 __bad_size_call_parameter();break; \
375 } \
376} while (0)
377
378/*
379 * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
380 *
381 * Optimized manipulation for memory allocated through the per cpu
382 * allocator or for addresses of per cpu variables.
383 *
384 * These operation guarantee exclusivity of access for other operations
385 * on the *same* processor. The assumption is that per cpu data is only
386 * accessed by a single processor instance (the current one).
387 *
388 * The arch code can provide optimized implementation by defining macros
389 * for certain scalar sizes. F.e. provide this_cpu_add_2() to provide per
390 * cpu atomic operations for 2 byte sized RMW actions. If arch code does
391 * not provide operations for a scalar size then the fallback in the
392 * generic code will be used.
393 *
394 * cmpxchg_double replaces two adjacent scalars at once. The first two
395 * parameters are per cpu variables which have to be of the same size. A
396 * truth value is returned to indicate success or failure (since a double
397 * register result is difficult to handle). There is very limited hardware
398 * support for these operations, so only certain sizes may work.
399 */
400
401/*
402 * Operations for contexts where we do not want to do any checks for
403 * preemptions. Unless strictly necessary, always use [__]this_cpu_*()
404 * instead.
405 *
406 * If there is no other protection through preempt disable and/or disabling
407 * interupts then one of these RMW operations can show unexpected behavior
408 * because the execution thread was rescheduled on another processor or an
409 * interrupt occurred and the same percpu variable was modified from the
410 * interrupt context.
411 */
412#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)
413#define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, pcp, val)
414#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
415#define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, pcp, val)
416#define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, pcp, val)
417#define raw_cpu_add_return(pcp, val) __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
418#define raw_cpu_xchg(pcp, nval) __pcpu_size_call_return2(raw_cpu_xchg_, pcp, nval)
419#define raw_cpu_cmpxchg(pcp, oval, nval) \
420 __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
421#define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
422 __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)
423
424#define raw_cpu_sub(pcp, val) raw_cpu_add(pcp, -(val))
425#define raw_cpu_inc(pcp) raw_cpu_add(pcp, 1)
426#define raw_cpu_dec(pcp) raw_cpu_sub(pcp, 1)
427#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
428#define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1)
429#define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1)
430
431/*
432 * Operations for contexts that are safe from preemption/interrupts. These
433 * operations verify that preemption is disabled.
434 */
435#define __this_cpu_read(pcp) \
436({ \
437 __this_cpu_preempt_check("read"); \
438 raw_cpu_read(pcp); \
439})
440
441#define __this_cpu_write(pcp, val) \
442({ \
443 __this_cpu_preempt_check("write"); \
444 raw_cpu_write(pcp, val); \
445})
446
447#define __this_cpu_add(pcp, val) \
448({ \
449 __this_cpu_preempt_check("add"); \
450 raw_cpu_add(pcp, val); \
451})
452
453#define __this_cpu_and(pcp, val) \
454({ \
455 __this_cpu_preempt_check("and"); \
456 raw_cpu_and(pcp, val); \
457})
458
459#define __this_cpu_or(pcp, val) \
460({ \
461 __this_cpu_preempt_check("or"); \
462 raw_cpu_or(pcp, val); \
463})
464
465#define __this_cpu_add_return(pcp, val) \
466({ \
467 __this_cpu_preempt_check("add_return"); \
468 raw_cpu_add_return(pcp, val); \
469})
470
471#define __this_cpu_xchg(pcp, nval) \
472({ \
473 __this_cpu_preempt_check("xchg"); \
474 raw_cpu_xchg(pcp, nval); \
475})
476
477#define __this_cpu_cmpxchg(pcp, oval, nval) \
478({ \
479 __this_cpu_preempt_check("cmpxchg"); \
480 raw_cpu_cmpxchg(pcp, oval, nval); \
481})
482
483#define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
484({ __this_cpu_preempt_check("cmpxchg_double"); \
485 raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2); \
486})
487
488#define __this_cpu_sub(pcp, val) __this_cpu_add(pcp, -(typeof(pcp))(val))
489#define __this_cpu_inc(pcp) __this_cpu_add(pcp, 1)
490#define __this_cpu_dec(pcp) __this_cpu_sub(pcp, 1)
491#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
492#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
493#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
494
495/*
496 * Operations with implied preemption protection. These operations can be
497 * used without worrying about preemption. Note that interrupts may still
498 * occur while an operation is in progress and if the interrupt modifies
499 * the variable too then RMW actions may not be reliable.
500 */
501#define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, pcp)
502#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
503#define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val)
504#define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, pcp, val)
505#define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, pcp, val)
506#define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
507#define this_cpu_xchg(pcp, nval) __pcpu_size_call_return2(this_cpu_xchg_, pcp, nval)
508#define this_cpu_cmpxchg(pcp, oval, nval) \
509 __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
510#define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
511 __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)
512
513#define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val))
514#define this_cpu_inc(pcp) this_cpu_add(pcp, 1)
515#define this_cpu_dec(pcp) this_cpu_sub(pcp, 1)
516#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
517#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
518#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
519
520#endif /* __ASSEMBLY__ */
167#endif /* _LINUX_PERCPU_DEFS_H */ 521#endif /* _LINUX_PERCPU_DEFS_H */
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 5d8920e23073..3dfbf237cd8f 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -57,11 +57,9 @@ struct percpu_ref {
57 atomic_t count; 57 atomic_t count;
58 /* 58 /*
59 * The low bit of the pointer indicates whether the ref is in percpu 59 * The low bit of the pointer indicates whether the ref is in percpu
60 * mode; if set, then get/put will manipulate the atomic_t (this is a 60 * mode; if set, then get/put will manipulate the atomic_t.
61 * hack because we need to keep the pointer around for
62 * percpu_ref_kill_rcu())
63 */ 61 */
64 unsigned __percpu *pcpu_count; 62 unsigned long pcpu_count_ptr;
65 percpu_ref_func_t *release; 63 percpu_ref_func_t *release;
66 percpu_ref_func_t *confirm_kill; 64 percpu_ref_func_t *confirm_kill;
67 struct rcu_head rcu; 65 struct rcu_head rcu;
@@ -69,7 +67,8 @@ struct percpu_ref {
69 67
70int __must_check percpu_ref_init(struct percpu_ref *ref, 68int __must_check percpu_ref_init(struct percpu_ref *ref,
71 percpu_ref_func_t *release); 69 percpu_ref_func_t *release);
72void percpu_ref_cancel_init(struct percpu_ref *ref); 70void percpu_ref_reinit(struct percpu_ref *ref);
71void percpu_ref_exit(struct percpu_ref *ref);
73void percpu_ref_kill_and_confirm(struct percpu_ref *ref, 72void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
74 percpu_ref_func_t *confirm_kill); 73 percpu_ref_func_t *confirm_kill);
75 74
@@ -88,12 +87,28 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
88 return percpu_ref_kill_and_confirm(ref, NULL); 87 return percpu_ref_kill_and_confirm(ref, NULL);
89} 88}
90 89
91#define PCPU_STATUS_BITS 2
92#define PCPU_STATUS_MASK ((1 << PCPU_STATUS_BITS) - 1)
93#define PCPU_REF_PTR 0
94#define PCPU_REF_DEAD 1 90#define PCPU_REF_DEAD 1
95 91
96#define REF_STATUS(count) (((unsigned long) count) & PCPU_STATUS_MASK) 92/*
93 * Internal helper. Don't use outside percpu-refcount proper. The
94 * function doesn't return the pointer and let the caller test it for NULL
95 * because doing so forces the compiler to generate two conditional
96 * branches as it can't assume that @ref->pcpu_count is not NULL.
97 */
98static inline bool __pcpu_ref_alive(struct percpu_ref *ref,
99 unsigned __percpu **pcpu_countp)
100{
101 unsigned long pcpu_ptr = ACCESS_ONCE(ref->pcpu_count_ptr);
102
103 /* paired with smp_store_release() in percpu_ref_reinit() */
104 smp_read_barrier_depends();
105
106 if (unlikely(pcpu_ptr & PCPU_REF_DEAD))
107 return false;
108
109 *pcpu_countp = (unsigned __percpu *)pcpu_ptr;
110 return true;
111}
97 112
98/** 113/**
99 * percpu_ref_get - increment a percpu refcount 114 * percpu_ref_get - increment a percpu refcount
@@ -107,9 +122,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
107 122
108 rcu_read_lock_sched(); 123 rcu_read_lock_sched();
109 124
110 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 125 if (__pcpu_ref_alive(ref, &pcpu_count))
111
112 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
113 this_cpu_inc(*pcpu_count); 126 this_cpu_inc(*pcpu_count);
114 else 127 else
115 atomic_inc(&ref->count); 128 atomic_inc(&ref->count);
@@ -133,9 +146,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
133 146
134 rcu_read_lock_sched(); 147 rcu_read_lock_sched();
135 148
136 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 149 if (__pcpu_ref_alive(ref, &pcpu_count)) {
137
138 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
139 this_cpu_inc(*pcpu_count); 150 this_cpu_inc(*pcpu_count);
140 ret = true; 151 ret = true;
141 } else { 152 } else {
@@ -168,9 +179,7 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
168 179
169 rcu_read_lock_sched(); 180 rcu_read_lock_sched();
170 181
171 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 182 if (__pcpu_ref_alive(ref, &pcpu_count)) {
172
173 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
174 this_cpu_inc(*pcpu_count); 183 this_cpu_inc(*pcpu_count);
175 ret = true; 184 ret = true;
176 } 185 }
@@ -193,9 +202,7 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
193 202
194 rcu_read_lock_sched(); 203 rcu_read_lock_sched();
195 204
196 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 205 if (__pcpu_ref_alive(ref, &pcpu_count))
197
198 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
199 this_cpu_dec(*pcpu_count); 206 this_cpu_dec(*pcpu_count);
200 else if (unlikely(atomic_dec_and_test(&ref->count))) 207 else if (unlikely(atomic_dec_and_test(&ref->count)))
201 ref->release(ref); 208 ref->release(ref);
@@ -203,4 +210,19 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
203 rcu_read_unlock_sched(); 210 rcu_read_unlock_sched();
204} 211}
205 212
213/**
214 * percpu_ref_is_zero - test whether a percpu refcount reached zero
215 * @ref: percpu_ref to test
216 *
217 * Returns %true if @ref reached zero.
218 */
219static inline bool percpu_ref_is_zero(struct percpu_ref *ref)
220{
221 unsigned __percpu *pcpu_count;
222
223 if (__pcpu_ref_alive(ref, &pcpu_count))
224 return false;
225 return !atomic_read(&ref->count);
226}
227
206#endif 228#endif
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 8419053d0f2e..6f61b61b7996 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -23,32 +23,6 @@
23 PERCPU_MODULE_RESERVE) 23 PERCPU_MODULE_RESERVE)
24#endif 24#endif
25 25
26/*
27 * Must be an lvalue. Since @var must be a simple identifier,
28 * we force a syntax error here if it isn't.
29 */
30#define get_cpu_var(var) (*({ \
31 preempt_disable(); \
32 this_cpu_ptr(&var); }))
33
34/*
35 * The weird & is necessary because sparse considers (void)(var) to be
36 * a direct dereference of percpu variable (var).
37 */
38#define put_cpu_var(var) do { \
39 (void)&(var); \
40 preempt_enable(); \
41} while (0)
42
43#define get_cpu_ptr(var) ({ \
44 preempt_disable(); \
45 this_cpu_ptr(var); })
46
47#define put_cpu_ptr(var) do { \
48 (void)(var); \
49 preempt_enable(); \
50} while (0)
51
52/* minimum unit size, also is the maximum supported allocation size */ 26/* minimum unit size, also is the maximum supported allocation size */
53#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10) 27#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10)
54 28
@@ -140,17 +114,6 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size,
140 pcpu_fc_populate_pte_fn_t populate_pte_fn); 114 pcpu_fc_populate_pte_fn_t populate_pte_fn);
141#endif 115#endif
142 116
143/*
144 * Use this to get to a cpu's version of the per-cpu object
145 * dynamically allocated. Non-atomic access to the current CPU's
146 * version should probably be combined with get_cpu()/put_cpu().
147 */
148#ifdef CONFIG_SMP
149#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)))
150#else
151#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); })
152#endif
153
154extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); 117extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align);
155extern bool is_kernel_percpu_address(unsigned long addr); 118extern bool is_kernel_percpu_address(unsigned long addr);
156 119
@@ -166,640 +129,4 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166#define alloc_percpu(type) \ 129#define alloc_percpu(type) \
167 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 130 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
168 131
169/*
170 * Branching function to split up a function into a set of functions that
171 * are called for different scalar sizes of the objects handled.
172 */
173
174extern void __bad_size_call_parameter(void);
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
182#define __pcpu_size_call_return(stem, variable) \
183({ typeof(variable) pscr_ret__; \
184 __verify_pcpu_ptr(&(variable)); \
185 switch(sizeof(variable)) { \
186 case 1: pscr_ret__ = stem##1(variable);break; \
187 case 2: pscr_ret__ = stem##2(variable);break; \
188 case 4: pscr_ret__ = stem##4(variable);break; \
189 case 8: pscr_ret__ = stem##8(variable);break; \
190 default: \
191 __bad_size_call_parameter();break; \
192 } \
193 pscr_ret__; \
194})
195
196#define __pcpu_size_call_return2(stem, variable, ...) \
197({ \
198 typeof(variable) pscr2_ret__; \
199 __verify_pcpu_ptr(&(variable)); \
200 switch(sizeof(variable)) { \
201 case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
202 case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \
203 case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \
204 case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \
205 default: \
206 __bad_size_call_parameter(); break; \
207 } \
208 pscr2_ret__; \
209})
210
211/*
212 * Special handling for cmpxchg_double. cmpxchg_double is passed two
213 * percpu variables. The first has to be aligned to a double word
214 * boundary and the second has to follow directly thereafter.
215 * We enforce this on all architectures even if they don't support
216 * a double cmpxchg instruction, since it's a cheap requirement, and it
217 * avoids breaking the requirement for architectures with the instruction.
218 */
219#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
220({ \
221 bool pdcrb_ret__; \
222 __verify_pcpu_ptr(&pcp1); \
223 BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
224 VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \
225 VM_BUG_ON((unsigned long)(&pcp2) != \
226 (unsigned long)(&pcp1) + sizeof(pcp1)); \
227 switch(sizeof(pcp1)) { \
228 case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
229 case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
230 case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
231 case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
232 default: \
233 __bad_size_call_parameter(); break; \
234 } \
235 pdcrb_ret__; \
236})
237
238#define __pcpu_size_call(stem, variable, ...) \
239do { \
240 __verify_pcpu_ptr(&(variable)); \
241 switch(sizeof(variable)) { \
242 case 1: stem##1(variable, __VA_ARGS__);break; \
243 case 2: stem##2(variable, __VA_ARGS__);break; \
244 case 4: stem##4(variable, __VA_ARGS__);break; \
245 case 8: stem##8(variable, __VA_ARGS__);break; \
246 default: \
247 __bad_size_call_parameter();break; \
248 } \
249} while (0)
250
251/*
252 * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
253 *
254 * Optimized manipulation for memory allocated through the per cpu
255 * allocator or for addresses of per cpu variables.
256 *
257 * These operation guarantee exclusivity of access for other operations
258 * on the *same* processor. The assumption is that per cpu data is only
259 * accessed by a single processor instance (the current one).
260 *
261 * The first group is used for accesses that must be done in a
262 * preemption safe way since we know that the context is not preempt
263 * safe. Interrupts may occur. If the interrupt modifies the variable
264 * too then RMW actions will not be reliable.
265 *
266 * The arch code can provide optimized functions in two ways:
267 *
268 * 1. Override the function completely. F.e. define this_cpu_add().
269 * The arch must then ensure that the various scalar format passed
270 * are handled correctly.
271 *
272 * 2. Provide functions for certain scalar sizes. F.e. provide
273 * this_cpu_add_2() to provide per cpu atomic operations for 2 byte
274 * sized RMW actions. If arch code does not provide operations for
275 * a scalar size then the fallback in the generic code will be
276 * used.
277 */
278
279#define _this_cpu_generic_read(pcp) \
280({ typeof(pcp) ret__; \
281 preempt_disable(); \
282 ret__ = *this_cpu_ptr(&(pcp)); \
283 preempt_enable(); \
284 ret__; \
285})
286
287#ifndef this_cpu_read
288# ifndef this_cpu_read_1
289# define this_cpu_read_1(pcp) _this_cpu_generic_read(pcp)
290# endif
291# ifndef this_cpu_read_2
292# define this_cpu_read_2(pcp) _this_cpu_generic_read(pcp)
293# endif
294# ifndef this_cpu_read_4
295# define this_cpu_read_4(pcp) _this_cpu_generic_read(pcp)
296# endif
297# ifndef this_cpu_read_8
298# define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp)
299# endif
300# define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, (pcp))
301#endif
302
303#define _this_cpu_generic_to_op(pcp, val, op) \
304do { \
305 unsigned long flags; \
306 raw_local_irq_save(flags); \
307 *raw_cpu_ptr(&(pcp)) op val; \
308 raw_local_irq_restore(flags); \
309} while (0)
310
311#ifndef this_cpu_write
312# ifndef this_cpu_write_1
313# define this_cpu_write_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
314# endif
315# ifndef this_cpu_write_2
316# define this_cpu_write_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
317# endif
318# ifndef this_cpu_write_4
319# define this_cpu_write_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
320# endif
321# ifndef this_cpu_write_8
322# define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
323# endif
324# define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, (pcp), (val))
325#endif
326
327#ifndef this_cpu_add
328# ifndef this_cpu_add_1
329# define this_cpu_add_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
330# endif
331# ifndef this_cpu_add_2
332# define this_cpu_add_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
333# endif
334# ifndef this_cpu_add_4
335# define this_cpu_add_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
336# endif
337# ifndef this_cpu_add_8
338# define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
339# endif
340# define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, (pcp), (val))
341#endif
342
343#ifndef this_cpu_sub
344# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val))
345#endif
346
347#ifndef this_cpu_inc
348# define this_cpu_inc(pcp) this_cpu_add((pcp), 1)
349#endif
350
351#ifndef this_cpu_dec
352# define this_cpu_dec(pcp) this_cpu_sub((pcp), 1)
353#endif
354
355#ifndef this_cpu_and
356# ifndef this_cpu_and_1
357# define this_cpu_and_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
358# endif
359# ifndef this_cpu_and_2
360# define this_cpu_and_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
361# endif
362# ifndef this_cpu_and_4
363# define this_cpu_and_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
364# endif
365# ifndef this_cpu_and_8
366# define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
367# endif
368# define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, (pcp), (val))
369#endif
370
371#ifndef this_cpu_or
372# ifndef this_cpu_or_1
373# define this_cpu_or_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
374# endif
375# ifndef this_cpu_or_2
376# define this_cpu_or_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
377# endif
378# ifndef this_cpu_or_4
379# define this_cpu_or_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
380# endif
381# ifndef this_cpu_or_8
382# define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
383# endif
384# define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
385#endif
386
387#define _this_cpu_generic_add_return(pcp, val) \
388({ \
389 typeof(pcp) ret__; \
390 unsigned long flags; \
391 raw_local_irq_save(flags); \
392 raw_cpu_add(pcp, val); \
393 ret__ = raw_cpu_read(pcp); \
394 raw_local_irq_restore(flags); \
395 ret__; \
396})
397
398#ifndef this_cpu_add_return
399# ifndef this_cpu_add_return_1
400# define this_cpu_add_return_1(pcp, val) _this_cpu_generic_add_return(pcp, val)
401# endif
402# ifndef this_cpu_add_return_2
403# define this_cpu_add_return_2(pcp, val) _this_cpu_generic_add_return(pcp, val)
404# endif
405# ifndef this_cpu_add_return_4
406# define this_cpu_add_return_4(pcp, val) _this_cpu_generic_add_return(pcp, val)
407# endif
408# ifndef this_cpu_add_return_8
409# define this_cpu_add_return_8(pcp, val) _this_cpu_generic_add_return(pcp, val)
410# endif
411# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
412#endif
413
414#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
415#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
416#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
417
418#define _this_cpu_generic_xchg(pcp, nval) \
419({ typeof(pcp) ret__; \
420 unsigned long flags; \
421 raw_local_irq_save(flags); \
422 ret__ = raw_cpu_read(pcp); \
423 raw_cpu_write(pcp, nval); \
424 raw_local_irq_restore(flags); \
425 ret__; \
426})
427
428#ifndef this_cpu_xchg
429# ifndef this_cpu_xchg_1
430# define this_cpu_xchg_1(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
431# endif
432# ifndef this_cpu_xchg_2
433# define this_cpu_xchg_2(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
434# endif
435# ifndef this_cpu_xchg_4
436# define this_cpu_xchg_4(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
437# endif
438# ifndef this_cpu_xchg_8
439# define this_cpu_xchg_8(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
440# endif
441# define this_cpu_xchg(pcp, nval) \
442 __pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval)
443#endif
444
445#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \
446({ \
447 typeof(pcp) ret__; \
448 unsigned long flags; \
449 raw_local_irq_save(flags); \
450 ret__ = raw_cpu_read(pcp); \
451 if (ret__ == (oval)) \
452 raw_cpu_write(pcp, nval); \
453 raw_local_irq_restore(flags); \
454 ret__; \
455})
456
457#ifndef this_cpu_cmpxchg
458# ifndef this_cpu_cmpxchg_1
459# define this_cpu_cmpxchg_1(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
460# endif
461# ifndef this_cpu_cmpxchg_2
462# define this_cpu_cmpxchg_2(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
463# endif
464# ifndef this_cpu_cmpxchg_4
465# define this_cpu_cmpxchg_4(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
466# endif
467# ifndef this_cpu_cmpxchg_8
468# define this_cpu_cmpxchg_8(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
469# endif
470# define this_cpu_cmpxchg(pcp, oval, nval) \
471 __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
472#endif
473
474/*
475 * cmpxchg_double replaces two adjacent scalars at once. The first
476 * two parameters are per cpu variables which have to be of the same
477 * size. A truth value is returned to indicate success or failure
478 * (since a double register result is difficult to handle). There is
479 * very limited hardware support for these operations, so only certain
480 * sizes may work.
481 */
482#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
483({ \
484 int ret__; \
485 unsigned long flags; \
486 raw_local_irq_save(flags); \
487 ret__ = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \
488 oval1, oval2, nval1, nval2); \
489 raw_local_irq_restore(flags); \
490 ret__; \
491})
492
493#ifndef this_cpu_cmpxchg_double
494# ifndef this_cpu_cmpxchg_double_1
495# define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
496 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
497# endif
498# ifndef this_cpu_cmpxchg_double_2
499# define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
500 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
501# endif
502# ifndef this_cpu_cmpxchg_double_4
503# define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
504 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
505# endif
506# ifndef this_cpu_cmpxchg_double_8
507# define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
508 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
509# endif
510# define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
511 __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
512#endif
513
514/*
515 * Generic percpu operations for contexts where we do not want to do
516 * any checks for preemptiosn.
517 *
518 * If there is no other protection through preempt disable and/or
519 * disabling interupts then one of these RMW operations can show unexpected
520 * behavior because the execution thread was rescheduled on another processor
521 * or an interrupt occurred and the same percpu variable was modified from
522 * the interrupt context.
523 */
524#ifndef raw_cpu_read
525# ifndef raw_cpu_read_1
526# define raw_cpu_read_1(pcp) (*raw_cpu_ptr(&(pcp)))
527# endif
528# ifndef raw_cpu_read_2
529# define raw_cpu_read_2(pcp) (*raw_cpu_ptr(&(pcp)))
530# endif
531# ifndef raw_cpu_read_4
532# define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))
533# endif
534# ifndef raw_cpu_read_8
535# define raw_cpu_read_8(pcp) (*raw_cpu_ptr(&(pcp)))
536# endif
537# define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, (pcp))
538#endif
539
540#define raw_cpu_generic_to_op(pcp, val, op) \
541do { \
542 *raw_cpu_ptr(&(pcp)) op val; \
543} while (0)
544
545
546#ifndef raw_cpu_write
547# ifndef raw_cpu_write_1
548# define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
549# endif
550# ifndef raw_cpu_write_2
551# define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
552# endif
553# ifndef raw_cpu_write_4
554# define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
555# endif
556# ifndef raw_cpu_write_8
557# define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
558# endif
559# define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, (pcp), (val))
560#endif
561
562#ifndef raw_cpu_add
563# ifndef raw_cpu_add_1
564# define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
565# endif
566# ifndef raw_cpu_add_2
567# define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
568# endif
569# ifndef raw_cpu_add_4
570# define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
571# endif
572# ifndef raw_cpu_add_8
573# define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
574# endif
575# define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, (pcp), (val))
576#endif
577
578#ifndef raw_cpu_sub
579# define raw_cpu_sub(pcp, val) raw_cpu_add((pcp), -(val))
580#endif
581
582#ifndef raw_cpu_inc
583# define raw_cpu_inc(pcp) raw_cpu_add((pcp), 1)
584#endif
585
586#ifndef raw_cpu_dec
587# define raw_cpu_dec(pcp) raw_cpu_sub((pcp), 1)
588#endif
589
590#ifndef raw_cpu_and
591# ifndef raw_cpu_and_1
592# define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
593# endif
594# ifndef raw_cpu_and_2
595# define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
596# endif
597# ifndef raw_cpu_and_4
598# define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
599# endif
600# ifndef raw_cpu_and_8
601# define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
602# endif
603# define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, (pcp), (val))
604#endif
605
606#ifndef raw_cpu_or
607# ifndef raw_cpu_or_1
608# define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
609# endif
610# ifndef raw_cpu_or_2
611# define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
612# endif
613# ifndef raw_cpu_or_4
614# define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
615# endif
616# ifndef raw_cpu_or_8
617# define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
618# endif
619# define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, (pcp), (val))
620#endif
621
622#define raw_cpu_generic_add_return(pcp, val) \
623({ \
624 raw_cpu_add(pcp, val); \
625 raw_cpu_read(pcp); \
626})
627
628#ifndef raw_cpu_add_return
629# ifndef raw_cpu_add_return_1
630# define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val)
631# endif
632# ifndef raw_cpu_add_return_2
633# define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val)
634# endif
635# ifndef raw_cpu_add_return_4
636# define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val)
637# endif
638# ifndef raw_cpu_add_return_8
639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
640# endif
641# define raw_cpu_add_return(pcp, val) \
642 __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
643#endif
644
645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
646#define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1)
647#define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1)
648
649#define raw_cpu_generic_xchg(pcp, nval) \
650({ typeof(pcp) ret__; \
651 ret__ = raw_cpu_read(pcp); \
652 raw_cpu_write(pcp, nval); \
653 ret__; \
654})
655
656#ifndef raw_cpu_xchg
657# ifndef raw_cpu_xchg_1
658# define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
659# endif
660# ifndef raw_cpu_xchg_2
661# define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
662# endif
663# ifndef raw_cpu_xchg_4
664# define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
665# endif
666# ifndef raw_cpu_xchg_8
667# define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
668# endif
669# define raw_cpu_xchg(pcp, nval) \
670 __pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval)
671#endif
672
673#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
674({ \
675 typeof(pcp) ret__; \
676 ret__ = raw_cpu_read(pcp); \
677 if (ret__ == (oval)) \
678 raw_cpu_write(pcp, nval); \
679 ret__; \
680})
681
682#ifndef raw_cpu_cmpxchg
683# ifndef raw_cpu_cmpxchg_1
684# define raw_cpu_cmpxchg_1(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
685# endif
686# ifndef raw_cpu_cmpxchg_2
687# define raw_cpu_cmpxchg_2(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
688# endif
689# ifndef raw_cpu_cmpxchg_4
690# define raw_cpu_cmpxchg_4(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
691# endif
692# ifndef raw_cpu_cmpxchg_8
693# define raw_cpu_cmpxchg_8(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
694# endif
695# define raw_cpu_cmpxchg(pcp, oval, nval) \
696 __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
697#endif
698
699#define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
700({ \
701 int __ret = 0; \
702 if (raw_cpu_read(pcp1) == (oval1) && \
703 raw_cpu_read(pcp2) == (oval2)) { \
704 raw_cpu_write(pcp1, (nval1)); \
705 raw_cpu_write(pcp2, (nval2)); \
706 __ret = 1; \
707 } \
708 (__ret); \
709})
710
711#ifndef raw_cpu_cmpxchg_double
712# ifndef raw_cpu_cmpxchg_double_1
713# define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
714 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
715# endif
716# ifndef raw_cpu_cmpxchg_double_2
717# define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
718 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
719# endif
720# ifndef raw_cpu_cmpxchg_double_4
721# define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
722 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
723# endif
724# ifndef raw_cpu_cmpxchg_double_8
725# define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
726 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
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
801# define __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)))
803#endif
804
805#endif /* __LINUX_PERCPU_H */ 132#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 68041446c450..ed39956b5613 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -545,6 +545,24 @@ struct phy_driver {
545 */ 545 */
546 void (*link_change_notify)(struct phy_device *dev); 546 void (*link_change_notify)(struct phy_device *dev);
547 547
548 /* A function provided by a phy specific driver to override the
549 * the PHY driver framework support for reading a MMD register
550 * from the PHY. If not supported, return -1. This function is
551 * optional for PHY specific drivers, if not provided then the
552 * default MMD read function is used by the PHY framework.
553 */
554 int (*read_mmd_indirect)(struct phy_device *dev, int ptrad,
555 int devnum, int regnum);
556
557 /* A function provided by a phy specific driver to override the
558 * the PHY driver framework support for writing a MMD register
559 * from the PHY. This function is optional for PHY specific drivers,
560 * if not provided then the default MMD read function is used by
561 * the PHY framework.
562 */
563 void (*write_mmd_indirect)(struct phy_device *dev, int ptrad,
564 int devnum, int regnum, u32 val);
565
548 struct device_driver driver; 566 struct device_driver driver;
549}; 567};
550#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 568#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
diff --git a/include/linux/phy/omap_control_phy.h b/include/linux/phy/omap_control_phy.h
index 5450403c7546..e9e6cfbfbb58 100644
--- a/include/linux/phy/omap_control_phy.h
+++ b/include/linux/phy/omap_control_phy.h
@@ -23,6 +23,7 @@ enum 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 */
26 OMAP_CTRL_TYPE_PCIE, /* RX TX control of ACSPCIE */
26 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */ 27 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
27 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ 28 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
28}; 29};
@@ -33,6 +34,7 @@ struct omap_control_phy {
33 u32 __iomem *otghs_control; 34 u32 __iomem *otghs_control;
34 u32 __iomem *power; 35 u32 __iomem *power;
35 u32 __iomem *power_aux; 36 u32 __iomem *power_aux;
37 u32 __iomem *pcie_pcs;
36 38
37 struct clk *sys_clk; 39 struct clk *sys_clk;
38 40
@@ -63,6 +65,9 @@ enum omap_control_usb_mode {
63#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3 65#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0 66#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
65 67
68#define OMAP_CTRL_PCIE_PCS_MASK 0xff
69#define OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT 0x8
70
66#define OMAP_CTRL_USB2_PHY_PD BIT(28) 71#define OMAP_CTRL_USB2_PHY_PD BIT(28)
67 72
68#define AM437X_CTRL_USB2_PHY_PD BIT(0) 73#define AM437X_CTRL_USB2_PHY_PD BIT(0)
@@ -74,6 +79,7 @@ enum omap_control_usb_mode {
74void omap_control_phy_power(struct device *dev, int on); 79void omap_control_phy_power(struct device *dev, int on);
75void omap_control_usb_set_mode(struct device *dev, 80void omap_control_usb_set_mode(struct device *dev,
76 enum omap_control_usb_mode mode); 81 enum omap_control_usb_mode mode);
82void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay);
77#else 83#else
78 84
79static inline void omap_control_phy_power(struct device *dev, int on) 85static inline void omap_control_phy_power(struct device *dev, int on)
@@ -84,6 +90,10 @@ static inline void omap_control_usb_set_mode(struct device *dev,
84 enum omap_control_usb_mode mode) 90 enum omap_control_usb_mode mode)
85{ 91{
86} 92}
93
94static inline void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay)
95{
96}
87#endif 97#endif
88 98
89#endif /* __OMAP_CONTROL_PHY_H__ */ 99#endif /* __OMAP_CONTROL_PHY_H__ */
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 2760744cb2a7..8cb6f815475b 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -18,6 +18,7 @@
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/pm_runtime.h> 20#include <linux/pm_runtime.h>
21#include <linux/regulator/consumer.h>
21 22
22struct phy; 23struct phy;
23 24
@@ -65,6 +66,7 @@ struct phy {
65 int init_count; 66 int init_count;
66 int power_count; 67 int power_count;
67 struct phy_attrs attrs; 68 struct phy_attrs attrs;
69 struct regulator *pwr;
68}; 70};
69 71
70/** 72/**
@@ -156,9 +158,10 @@ void devm_phy_put(struct device *dev, struct phy *phy);
156struct phy *of_phy_get(struct device_node *np, const char *con_id); 158struct phy *of_phy_get(struct device_node *np, const char *con_id);
157struct phy *of_phy_simple_xlate(struct device *dev, 159struct phy *of_phy_simple_xlate(struct device *dev,
158 struct of_phandle_args *args); 160 struct of_phandle_args *args);
159struct phy *phy_create(struct device *dev, const struct phy_ops *ops, 161struct phy *phy_create(struct device *dev, struct device_node *node,
160 struct phy_init_data *init_data); 162 const struct phy_ops *ops,
161struct phy *devm_phy_create(struct device *dev, 163 struct phy_init_data *init_data);
164struct phy *devm_phy_create(struct device *dev, struct device_node *node,
162 const struct phy_ops *ops, struct phy_init_data *init_data); 165 const struct phy_ops *ops, struct phy_init_data *init_data);
163void phy_destroy(struct phy *phy); 166void phy_destroy(struct phy *phy);
164void devm_phy_destroy(struct device *dev, struct phy *phy); 167void devm_phy_destroy(struct device *dev, struct phy *phy);
@@ -297,13 +300,17 @@ static inline struct phy *of_phy_simple_xlate(struct device *dev,
297} 300}
298 301
299static inline struct phy *phy_create(struct device *dev, 302static inline struct phy *phy_create(struct device *dev,
300 const struct phy_ops *ops, struct phy_init_data *init_data) 303 struct device_node *node,
304 const struct phy_ops *ops,
305 struct phy_init_data *init_data)
301{ 306{
302 return ERR_PTR(-ENOSYS); 307 return ERR_PTR(-ENOSYS);
303} 308}
304 309
305static inline struct phy *devm_phy_create(struct device *dev, 310static inline struct phy *devm_phy_create(struct device *dev,
306 const struct phy_ops *ops, struct phy_init_data *init_data) 311 struct device_node *node,
312 const struct phy_ops *ops,
313 struct phy_init_data *init_data)
307{ 314{
308 return ERR_PTR(-ENOSYS); 315 return ERR_PTR(-ENOSYS);
309} 316}
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 7246ef3d4455..1997ffc295a7 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -33,6 +33,7 @@ struct pid_namespace {
33#ifdef CONFIG_PROC_FS 33#ifdef CONFIG_PROC_FS
34 struct vfsmount *proc_mnt; 34 struct vfsmount *proc_mnt;
35 struct dentry *proc_self; 35 struct dentry *proc_self;
36 struct dentry *proc_thread_self;
36#endif 37#endif
37#ifdef CONFIG_BSD_PROCESS_ACCT 38#ifdef CONFIG_BSD_PROCESS_ACCT
38 struct bsd_acct_struct *bacct; 39 struct bsd_acct_struct *bacct;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index c15395031cb3..3097aafbeb24 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -70,8 +70,6 @@ struct pinmux_ops {
70 unsigned * const num_groups); 70 unsigned * const num_groups);
71 int (*enable) (struct pinctrl_dev *pctldev, unsigned func_selector, 71 int (*enable) (struct pinctrl_dev *pctldev, unsigned func_selector,
72 unsigned group_selector); 72 unsigned group_selector);
73 void (*disable) (struct pinctrl_dev *pctldev, unsigned func_selector,
74 unsigned group_selector);
75 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 73 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
76 struct pinctrl_gpio_range *range, 74 struct pinctrl_gpio_range *range,
77 unsigned offset); 75 unsigned offset);
diff --git a/include/linux/platform_data/ad7291.h b/include/linux/platform_data/ad7291.h
new file mode 100644
index 000000000000..bbd89fa51188
--- /dev/null
+++ b/include/linux/platform_data/ad7291.h
@@ -0,0 +1,12 @@
1#ifndef __IIO_AD7291_H__
2#define __IIO_AD7291_H__
3
4/**
5 * struct ad7291_platform_data - AD7291 platform data
6 * @use_external_ref: Whether to use an external or internal reference voltage
7 */
8struct ad7291_platform_data {
9 bool use_external_ref;
10};
11
12#endif
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index 709c6f7e2f8c..a6591c693ebb 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -15,15 +15,6 @@
15#define S3C64XX_AC97_GPE 1 15#define S3C64XX_AC97_GPE 1
16extern void s3c64xx_ac97_setup_gpio(int); 16extern void s3c64xx_ac97_setup_gpio(int);
17 17
18/*
19 * The machine init code calls s5p*_spdif_setup_gpio with
20 * one of these defines in order to select appropriate bank
21 * of GPIO for S/PDIF pins
22 */
23#define S5PC100_SPDIF_GPD 0
24#define S5PC100_SPDIF_GPG3 1
25extern void s5pc100_spdif_setup_gpio(int);
26
27struct samsung_i2s { 18struct samsung_i2s {
28/* If the Primary DAI has 5.1 Channels */ 19/* If the Primary DAI has 5.1 Channels */
29#define QUIRK_PRI_6CHAN (1 << 0) 20#define QUIRK_PRI_6CHAN (1 << 0)
diff --git a/include/linux/platform_data/ata-samsung_cf.h b/include/linux/platform_data/ata-samsung_cf.h
index c2049e3d7444..748e71642c4a 100644
--- a/include/linux/platform_data/ata-samsung_cf.h
+++ b/include/linux/platform_data/ata-samsung_cf.h
@@ -29,7 +29,6 @@ extern void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata);
29 29
30/* architecture-specific IDE configuration */ 30/* architecture-specific IDE configuration */
31extern void s3c64xx_ide_setup_gpio(void); 31extern void s3c64xx_ide_setup_gpio(void);
32extern void s5pc100_ide_setup_gpio(void);
33extern void s5pv210_ide_setup_gpio(void); 32extern void s5pv210_ide_setup_gpio(void);
34 33
35#endif /*__ATA_SAMSUNG_CF_H */ 34#endif /*__ATA_SAMSUNG_CF_H */
diff --git a/include/linux/platform_data/camera-mx1.h b/include/linux/platform_data/camera-mx1.h
deleted file mode 100644
index 4fd6c70314b4..000000000000
--- a/include/linux/platform_data/camera-mx1.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * mx1_camera.h - i.MX1/i.MXL camera driver header file
3 *
4 * Copyright (c) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (C) 2009, Darius Augulis <augulis.darius@gmail.com>
6 *
7 * Based on PXA camera.h file:
8 * Copyright (C) 2003, Intel Corporation
9 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __ASM_ARCH_CAMERA_H_
17#define __ASM_ARCH_CAMERA_H_
18
19#define MX1_CAMERA_DATA_HIGH 1
20#define MX1_CAMERA_PCLK_RISING 2
21#define MX1_CAMERA_VSYNC_HIGH 4
22
23extern unsigned char mx1_camera_sof_fiq_start, mx1_camera_sof_fiq_end;
24
25/**
26 * struct mx1_camera_pdata - i.MX1/i.MXL camera platform data
27 * @mclk_10khz: master clock frequency in 10kHz units
28 * @flags: MX1 camera platform flags
29 */
30struct mx1_camera_pdata {
31 unsigned long mclk_10khz;
32 unsigned long flags;
33};
34
35#endif /* __ASM_ARCH_CAMERA_H_ */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index bcbc6c3c14c0..d05542aafa3e 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -50,6 +50,7 @@ enum imx_dma_prio {
50 50
51struct imx_dma_data { 51struct imx_dma_data {
52 int dma_request; /* DMA request line */ 52 int dma_request; /* DMA request line */
53 int dma_request2; /* secondary DMA request line */
53 enum sdma_peripheral_type peripheral_type; 54 enum sdma_peripheral_type peripheral_type;
54 int priority; 55 int priority;
55}; 56};
diff --git a/include/linux/platform_data/dsp-omap.h b/include/linux/platform_data/dsp-omap.h
deleted file mode 100644
index 5927709b1908..000000000000
--- a/include/linux/platform_data/dsp-omap.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef __OMAP_DSP_H__
2#define __OMAP_DSP_H__
3
4#include <linux/types.h>
5
6struct omap_dsp_platform_data {
7 void (*dsp_set_min_opp) (u8 opp_id);
8 u8 (*dsp_get_opp) (void);
9 void (*cpu_set_freq) (unsigned long f);
10 unsigned long (*cpu_get_freq) (void);
11 unsigned long mpu_speed[6];
12
13 /* functions to write and read PRCM registers */
14 void (*dsp_prm_write)(u32, s16 , u16);
15 u32 (*dsp_prm_read)(s16 , u16);
16 u32 (*dsp_prm_rmw_bits)(u32, u32, s16, s16);
17 void (*dsp_cm_write)(u32, s16 , u16);
18 u32 (*dsp_cm_read)(s16 , u16);
19 u32 (*dsp_cm_rmw_bits)(u32, u32, s16, s16);
20
21 void (*set_bootaddr)(u32);
22 void (*set_bootmode)(u8);
23
24 phys_addr_t phys_mempool_base;
25 phys_addr_t phys_mempool_size;
26};
27
28#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
29extern void omap_dsp_reserve_sdram_memblock(void);
30#else
31static inline void omap_dsp_reserve_sdram_memblock(void) { }
32#endif
33
34#endif
diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h
index 5b429c43a297..54a0a9582fad 100644
--- a/include/linux/platform_data/iommu-omap.h
+++ b/include/linux/platform_data/iommu-omap.h
@@ -31,14 +31,10 @@ struct omap_iommu_arch_data {
31 31
32/** 32/**
33 * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod 33 * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod
34 * @da_start: device address where the va space starts.
35 * @da_end: device address where the va space ends.
36 * @nr_tlb_entries: number of entries supported by the translation 34 * @nr_tlb_entries: number of entries supported by the translation
37 * look-aside buffer (TLB). 35 * look-aside buffer (TLB).
38 */ 36 */
39struct omap_mmu_dev_attr { 37struct omap_mmu_dev_attr {
40 u32 da_start;
41 u32 da_end;
42 int nr_tlb_entries; 38 int nr_tlb_entries;
43}; 39};
44 40
@@ -46,8 +42,6 @@ struct iommu_platform_data {
46 const char *name; 42 const char *name;
47 const char *reset_name; 43 const char *reset_name;
48 int nr_tlb_entries; 44 int nr_tlb_entries;
49 u32 da_start;
50 u32 da_end;
51 45
52 int (*assert_reset)(struct platform_device *pdev, const char *name); 46 int (*assert_reset)(struct platform_device *pdev, const char *name);
53 int (*deassert_reset)(struct platform_device *pdev, const char *name); 47 int (*deassert_reset)(struct platform_device *pdev, const char *name);
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h
index c7285b575462..0a6de4ca4930 100644
--- a/include/linux/platform_data/ntc_thermistor.h
+++ b/include/linux/platform_data/ntc_thermistor.h
@@ -26,6 +26,7 @@ struct iio_channel;
26enum ntc_thermistor_type { 26enum ntc_thermistor_type {
27 TYPE_NCPXXWB473, 27 TYPE_NCPXXWB473,
28 TYPE_NCPXXWL333, 28 TYPE_NCPXXWL333,
29 TYPE_B57330V2103,
29}; 30};
30 31
31struct ntc_thermistor_platform_data { 32struct ntc_thermistor_platform_data {
diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st21nfcb.h
new file mode 100644
index 000000000000..2d11f1f5efab
--- /dev/null
+++ b/include/linux/platform_data/st21nfcb.h
@@ -0,0 +1,32 @@
1/*
2 * Driver include for the ST21NFCB NFC chip.
3 *
4 * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions 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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef _ST21NFCB_NCI_H_
20#define _ST21NFCB_NCI_H_
21
22#include <linux/i2c.h>
23
24#define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci"
25
26struct st21nfcb_nfc_platform_data {
27 unsigned int gpio_irq;
28 unsigned int gpio_reset;
29 unsigned int irq_polarity;
30};
31
32#endif /* _ST21NFCA_HCI_H_ */
diff --git a/include/linux/platform_data/usb-ehci-mxc.h b/include/linux/platform_data/usb-ehci-mxc.h
index 7eb9d1329671..157e71f79f99 100644
--- a/include/linux/platform_data/usb-ehci-mxc.h
+++ b/include/linux/platform_data/usb-ehci-mxc.h
@@ -1,46 +1,6 @@
1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H 1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H
2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H 2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H
3 3
4/* values for portsc field */
5#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
6#define MXC_EHCI_FORCE_FS (1 << 24)
7#define MXC_EHCI_UTMI_8BIT (0 << 28)
8#define MXC_EHCI_UTMI_16BIT (1 << 28)
9#define MXC_EHCI_SERIAL (1 << 29)
10#define MXC_EHCI_MODE_UTMI (0 << 30)
11#define MXC_EHCI_MODE_PHILIPS (1 << 30)
12#define MXC_EHCI_MODE_ULPI (2 << 30)
13#define MXC_EHCI_MODE_SERIAL (3 << 30)
14
15/* values for flags field */
16#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
17#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
18#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
19#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
20#define MXC_EHCI_INTERFACE_MASK (0xf)
21
22#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
23#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
24#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
25#define MXC_EHCI_TTL_ENABLED (1 << 8)
26
27#define MXC_EHCI_INTERNAL_PHY (1 << 9)
28#define MXC_EHCI_IPPUE_DOWN (1 << 10)
29#define MXC_EHCI_IPPUE_UP (1 << 11)
30#define MXC_EHCI_WAKEUP_ENABLED (1 << 12)
31#define MXC_EHCI_ITC_NO_THRESHOLD (1 << 13)
32
33#define MXC_USBCTRL_OFFSET 0
34#define MXC_USB_PHY_CTR_FUNC_OFFSET 0x8
35#define MXC_USB_PHY_CTR_FUNC2_OFFSET 0xc
36#define MXC_USBH2CTRL_OFFSET 0x14
37
38#define MX5_USBOTHER_REGS_OFFSET 0x800
39
40/* USB_PHY_CTRL_FUNC2*/
41#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK 0x3
42#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_SHIFT 0
43
44struct mxc_usbh_platform_data { 4struct mxc_usbh_platform_data {
45 int (*init)(struct platform_device *pdev); 5 int (*init)(struct platform_device *pdev);
46 int (*exit)(struct platform_device *pdev); 6 int (*exit)(struct platform_device *pdev);
@@ -49,11 +9,5 @@ struct mxc_usbh_platform_data {
49 struct usb_phy *otg; 9 struct usb_phy *otg;
50}; 10};
51 11
52int mx51_initialize_usb_hw(int port, unsigned int flags);
53int mx25_initialize_usb_hw(int port, unsigned int flags);
54int mx31_initialize_usb_hw(int port, unsigned int flags);
55int mx35_initialize_usb_hw(int port, unsigned int flags);
56int mx27_initialize_usb_hw(int port, unsigned int flags);
57
58#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */ 12#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */
59 13
diff --git a/include/linux/platform_data/usb-imx_udc.h b/include/linux/platform_data/usb-imx_udc.h
deleted file mode 100644
index be273371f34a..000000000000
--- a/include/linux/platform_data/usb-imx_udc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MXC_USB
16#define __ASM_ARCH_MXC_USB
17
18struct imxusb_platform_data {
19 int (*init)(struct device *);
20 void (*exit)(struct device *);
21};
22
23#endif /* __ASM_ARCH_MXC_USB */
diff --git a/include/linux/platform_data/video-clcd-versatile.h b/include/linux/platform_data/video-clcd-versatile.h
new file mode 100644
index 000000000000..09ccf182af4d
--- /dev/null
+++ b/include/linux/platform_data/video-clcd-versatile.h
@@ -0,0 +1,27 @@
1#ifndef PLAT_CLCD_H
2#define PLAT_CLCD_H
3
4#ifdef CONFIG_PLAT_VERSATILE_CLCD
5struct clcd_panel *versatile_clcd_get_panel(const char *);
6int versatile_clcd_setup_dma(struct clcd_fb *, unsigned long);
7int versatile_clcd_mmap_dma(struct clcd_fb *, struct vm_area_struct *);
8void versatile_clcd_remove_dma(struct clcd_fb *);
9#else
10static inline struct clcd_panel *versatile_clcd_get_panel(const char *s)
11{
12 return NULL;
13}
14static inline int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
15{
16 return -ENODEV;
17}
18static inline int versatile_clcd_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vm)
19{
20 return -ENODEV;
21}
22static inline void versatile_clcd_remove_dma(struct clcd_fb *fb)
23{
24}
25#endif
26
27#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 16f6654082dd..153d303af7eb 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -28,6 +28,7 @@ struct platform_device {
28 struct resource *resource; 28 struct resource *resource;
29 29
30 const struct platform_device_id *id_entry; 30 const struct platform_device_id *id_entry;
31 char *driver_override; /* Driver name to force a match */
31 32
32 /* MFD cell pointer */ 33 /* MFD cell pointer */
33 struct mfd_cell *mfd_cell; 34 struct mfd_cell *mfd_cell;
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 43fd6716f662..367f49b9a1c9 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -24,11 +24,20 @@
24#define RPM_AUTO 0x08 /* Use autosuspend_delay */ 24#define RPM_AUTO 0x08 /* Use autosuspend_delay */
25 25
26#ifdef CONFIG_PM 26#ifdef CONFIG_PM
27extern struct workqueue_struct *pm_wq;
28
29static inline bool queue_pm_work(struct work_struct *work)
30{
31 return queue_work(pm_wq, work);
32}
33
27extern int pm_generic_runtime_suspend(struct device *dev); 34extern int pm_generic_runtime_suspend(struct device *dev);
28extern int pm_generic_runtime_resume(struct device *dev); 35extern int pm_generic_runtime_resume(struct device *dev);
29extern int pm_runtime_force_suspend(struct device *dev); 36extern int pm_runtime_force_suspend(struct device *dev);
30extern int pm_runtime_force_resume(struct device *dev); 37extern int pm_runtime_force_resume(struct device *dev);
31#else 38#else
39static inline bool queue_pm_work(struct work_struct *work) { return false; }
40
32static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 41static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
33static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 42static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
34static inline int pm_runtime_force_suspend(struct device *dev) { return 0; } 43static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
@@ -37,8 +46,6 @@ static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
37 46
38#ifdef CONFIG_PM_RUNTIME 47#ifdef CONFIG_PM_RUNTIME
39 48
40extern struct workqueue_struct *pm_wq;
41
42extern int __pm_runtime_idle(struct device *dev, int rpmflags); 49extern int __pm_runtime_idle(struct device *dev, int rpmflags);
43extern int __pm_runtime_suspend(struct device *dev, int rpmflags); 50extern int __pm_runtime_suspend(struct device *dev, int rpmflags);
44extern int __pm_runtime_resume(struct device *dev, int rpmflags); 51extern int __pm_runtime_resume(struct device *dev, int rpmflags);
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f2b76aeaf4e4..f3dea41dbcd2 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -120,6 +120,7 @@ enum power_supply_property {
120 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, 120 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
121 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, 121 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT,
122 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, 122 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
123 POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
123 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 124 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
124 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 125 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
125 POWER_SUPPLY_PROP_ENERGY_FULL, 126 POWER_SUPPLY_PROP_ENERGY_FULL,
@@ -131,6 +132,8 @@ enum power_supply_property {
131 POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */ 132 POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */
132 POWER_SUPPLY_PROP_CAPACITY_LEVEL, 133 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
133 POWER_SUPPLY_PROP_TEMP, 134 POWER_SUPPLY_PROP_TEMP,
135 POWER_SUPPLY_PROP_TEMP_MAX,
136 POWER_SUPPLY_PROP_TEMP_MIN,
134 POWER_SUPPLY_PROP_TEMP_ALERT_MIN, 137 POWER_SUPPLY_PROP_TEMP_ALERT_MIN,
135 POWER_SUPPLY_PROP_TEMP_ALERT_MAX, 138 POWER_SUPPLY_PROP_TEMP_ALERT_MAX,
136 POWER_SUPPLY_PROP_TEMP_AMBIENT, 139 POWER_SUPPLY_PROP_TEMP_AMBIENT,
@@ -142,6 +145,7 @@ enum power_supply_property {
142 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 145 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
143 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
144 POWER_SUPPLY_PROP_SCOPE, 147 POWER_SUPPLY_PROP_SCOPE,
148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
145 /* Properties of type `const char *' */ 149 /* Properties of type `const char *' */
146 POWER_SUPPLY_PROP_MODEL_NAME, 150 POWER_SUPPLY_PROP_MODEL_NAME,
147 POWER_SUPPLY_PROP_MANUFACTURER, 151 POWER_SUPPLY_PROP_MANUFACTURER,
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 319ff7e53efb..0990997a5304 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -31,7 +31,7 @@ static inline const char *printk_skip_level(const char *buffer)
31} 31}
32 32
33/* printk's without a loglevel use this.. */ 33/* printk's without a loglevel use this.. */
34#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL 34#define MESSAGE_LOGLEVEL_DEFAULT CONFIG_MESSAGE_LOGLEVEL_DEFAULT
35 35
36/* We show everything that is MORE important than this.. */ 36/* We show everything that is MORE important than this.. */
37#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ 37#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
index 7dfed71d76a6..159c987b1853 100644
--- a/include/linux/ptp_classify.h
+++ b/include/linux/ptp_classify.h
@@ -33,8 +33,8 @@
33#define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */ 33#define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */
34#define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */ 34#define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */
35#define PTP_CLASS_L2 0x30 /* event in a L2 packet */ 35#define PTP_CLASS_L2 0x30 /* event in a L2 packet */
36#define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged L2 packet */ 36#define PTP_CLASS_PMASK 0x30 /* mask for the packet type field */
37#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */ 37#define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged packet */
38 38
39#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) 39#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4)
40#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 */
@@ -54,7 +54,6 @@
54#define IP6_HLEN 40 54#define IP6_HLEN 40
55#define UDP_HLEN 8 55#define UDP_HLEN 8
56#define OFF_IHL 14 56#define OFF_IHL 14
57#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN)
58#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) 57#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2)
59 58
60#if defined(CONFIG_NET_PTP_CLASSIFY) 59#if defined(CONFIG_NET_PTP_CLASSIFY)
diff --git a/include/linux/ras.h b/include/linux/ras.h
new file mode 100644
index 000000000000..2aceeafd6fe5
--- /dev/null
+++ b/include/linux/ras.h
@@ -0,0 +1,14 @@
1#ifndef __RAS_H__
2#define __RAS_H__
3
4#ifdef CONFIG_DEBUG_FS
5int ras_userspace_consumers(void);
6void ras_debugfs_init(void);
7int ras_add_daemon_trace(void);
8#else
9static inline int ras_userspace_consumers(void) { return 0; }
10static inline void ras_debugfs_init(void) { return; }
11static inline int ras_add_daemon_trace(void) { return 0; }
12#endif
13
14#endif
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 8183b46fbaa2..372ad5e0dcb8 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -432,9 +432,9 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
432} 432}
433 433
434/** 434/**
435 * hlist_add_after_rcu 435 * hlist_add_behind_rcu
436 * @prev: the existing element to add the new element after.
437 * @n: the new element to add to the hash list. 436 * @n: the new element to add to the hash list.
437 * @prev: the existing element to add the new element after.
438 * 438 *
439 * Description: 439 * Description:
440 * Adds the specified element to the specified hlist 440 * Adds the specified element to the specified hlist
@@ -449,8 +449,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
449 * hlist_for_each_entry_rcu(), used to prevent memory-consistency 449 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
450 * problems on Alpha CPUs. 450 * problems on Alpha CPUs.
451 */ 451 */
452static inline void hlist_add_after_rcu(struct hlist_node *prev, 452static inline void hlist_add_behind_rcu(struct hlist_node *n,
453 struct hlist_node *n) 453 struct hlist_node *prev)
454{ 454{
455 n->next = prev->next; 455 n->next = prev->next;
456 n->pprev = &prev->next; 456 n->pprev = &prev->next;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 6a94cc8b1ca0..d231aa17b1d7 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -826,15 +826,14 @@ static inline void rcu_preempt_sleep_check(void)
826 * read-side critical section that would block in a !PREEMPT kernel. 826 * read-side critical section that would block in a !PREEMPT kernel.
827 * But if you want the full story, read on! 827 * But if you want the full story, read on!
828 * 828 *
829 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU), it 829 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU),
830 * is illegal to block while in an RCU read-side critical section. In 830 * it is illegal to block while in an RCU read-side critical section.
831 * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU) 831 * In preemptible RCU implementations (TREE_PREEMPT_RCU) in CONFIG_PREEMPT
832 * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may 832 * kernel builds, RCU read-side critical sections may be preempted,
833 * be preempted, but explicit blocking is illegal. Finally, in preemptible 833 * but explicit blocking is illegal. Finally, in preemptible RCU
834 * RCU implementations in real-time (with -rt patchset) kernel builds, 834 * implementations in real-time (with -rt patchset) kernel builds, RCU
835 * RCU read-side critical sections may be preempted and they may also 835 * read-side critical sections may be preempted and they may also block, but
836 * block, but only when acquiring spinlocks that are subject to priority 836 * only when acquiring spinlocks that are subject to priority inheritance.
837 * inheritance.
838 */ 837 */
839static inline void rcu_read_lock(void) 838static inline void rcu_read_lock(void)
840{ 839{
@@ -858,6 +857,34 @@ static inline void rcu_read_lock(void)
858/** 857/**
859 * rcu_read_unlock() - marks the end of an RCU read-side critical section. 858 * rcu_read_unlock() - marks the end of an RCU read-side critical section.
860 * 859 *
860 * In most situations, rcu_read_unlock() is immune from deadlock.
861 * However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
862 * is responsible for deboosting, which it does via rt_mutex_unlock().
863 * Unfortunately, this function acquires the scheduler's runqueue and
864 * priority-inheritance spinlocks. This means that deadlock could result
865 * if the caller of rcu_read_unlock() already holds one of these locks or
866 * any lock that is ever acquired while holding them.
867 *
868 * That said, RCU readers are never priority boosted unless they were
869 * preempted. Therefore, one way to avoid deadlock is to make sure
870 * that preemption never happens within any RCU read-side critical
871 * section whose outermost rcu_read_unlock() is called with one of
872 * rt_mutex_unlock()'s locks held. Such preemption can be avoided in
873 * a number of ways, for example, by invoking preempt_disable() before
874 * critical section's outermost rcu_read_lock().
875 *
876 * Given that the set of locks acquired by rt_mutex_unlock() might change
877 * at any time, a somewhat more future-proofed approach is to make sure
878 * that that preemption never happens within any RCU read-side critical
879 * section whose outermost rcu_read_unlock() is called with irqs disabled.
880 * This approach relies on the fact that rt_mutex_unlock() currently only
881 * acquires irq-disabled locks.
882 *
883 * The second of these two approaches is best in most situations,
884 * however, the first approach can also be useful, at least to those
885 * developers willing to keep abreast of the set of locks acquired by
886 * rt_mutex_unlock().
887 *
861 * See rcu_read_lock() for more information. 888 * See rcu_read_lock() for more information.
862 */ 889 */
863static inline void rcu_read_unlock(void) 890static inline void rcu_read_unlock(void)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 7b0e4b425cdf..c5ed83f49c4e 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -396,6 +396,7 @@ void regmap_exit(struct regmap *map);
396int regmap_reinit_cache(struct regmap *map, 396int regmap_reinit_cache(struct regmap *map,
397 const struct regmap_config *config); 397 const struct regmap_config *config);
398struct regmap *dev_get_regmap(struct device *dev, const char *name); 398struct regmap *dev_get_regmap(struct device *dev, const char *name);
399struct device *regmap_get_device(struct regmap *map);
399int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 400int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
400int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); 401int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
401int regmap_raw_write(struct regmap *map, unsigned int reg, 402int regmap_raw_write(struct regmap *map, unsigned int reg,
@@ -729,6 +730,12 @@ static inline struct regmap *dev_get_regmap(struct device *dev,
729 return NULL; 730 return NULL;
730} 731}
731 732
733static inline struct device *regmap_get_device(struct regmap *map)
734{
735 WARN_ONCE(1, "regmap API is disabled");
736 return NULL;
737}
738
732#endif 739#endif
733 740
734#endif 741#endif
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 75307447cef9..d8ecefaf63ca 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -322,18 +322,4 @@ struct ab8500_regulator_platform_data {
322 struct regulator_init_data *ext_regulator; 322 struct regulator_init_data *ext_regulator;
323}; 323};
324 324
325#ifdef CONFIG_REGULATOR_AB8500_DEBUG
326int ab8500_regulator_debug_init(struct platform_device *pdev);
327int ab8500_regulator_debug_exit(struct platform_device *pdev);
328#else
329static inline int ab8500_regulator_debug_init(struct platform_device *pdev)
330{
331 return 0;
332}
333static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)
334{
335 return 0;
336}
337#endif
338
339#endif 325#endif
diff --git a/include/linux/regulator/act8865.h b/include/linux/regulator/act8865.h
index 49206c1b4905..b6c4909b33af 100644
--- a/include/linux/regulator/act8865.h
+++ b/include/linux/regulator/act8865.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * act8865.h -- Voltage regulation for the active-semi act8865 2 * act8865.h -- Voltage regulation for active-semi act88xx PMUs
3 * 3 *
4 * Copyright (C) 2013 Atmel Corporation. 4 * Copyright (C) 2013 Atmel Corporation.
5 * 5 *
@@ -29,6 +29,27 @@ enum {
29 ACT8865_REG_NUM, 29 ACT8865_REG_NUM,
30}; 30};
31 31
32enum {
33 ACT8846_ID_REG1,
34 ACT8846_ID_REG2,
35 ACT8846_ID_REG3,
36 ACT8846_ID_REG4,
37 ACT8846_ID_REG5,
38 ACT8846_ID_REG6,
39 ACT8846_ID_REG7,
40 ACT8846_ID_REG8,
41 ACT8846_ID_REG9,
42 ACT8846_ID_REG10,
43 ACT8846_ID_REG11,
44 ACT8846_ID_REG12,
45 ACT8846_REG_NUM,
46};
47
48enum {
49 ACT8865,
50 ACT8846,
51};
52
32/** 53/**
33 * act8865_regulator_data - regulator data 54 * act8865_regulator_data - regulator data
34 * @id: regulator id 55 * @id: regulator id
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 14ec18d5e18b..f8a8733068a7 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -37,6 +37,7 @@
37 37
38struct device; 38struct device;
39struct notifier_block; 39struct notifier_block;
40struct regmap;
40 41
41/* 42/*
42 * Regulator operating modes. 43 * Regulator operating modes.
@@ -215,6 +216,13 @@ int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
215 216
216int regulator_allow_bypass(struct regulator *regulator, bool allow); 217int regulator_allow_bypass(struct regulator *regulator, bool allow);
217 218
219struct regmap *regulator_get_regmap(struct regulator *regulator);
220int regulator_get_hardware_vsel_register(struct regulator *regulator,
221 unsigned *vsel_reg,
222 unsigned *vsel_mask);
223int regulator_list_hardware_vsel(struct regulator *regulator,
224 unsigned selector);
225
218/* regulator notifier block */ 226/* regulator notifier block */
219int regulator_register_notifier(struct regulator *regulator, 227int regulator_register_notifier(struct regulator *regulator,
220 struct notifier_block *nb); 228 struct notifier_block *nb);
@@ -457,6 +465,24 @@ static inline int regulator_allow_bypass(struct regulator *regulator,
457 return 0; 465 return 0;
458} 466}
459 467
468static inline struct regmap *regulator_get_regmap(struct regulator *regulator)
469{
470 return ERR_PTR(-EOPNOTSUPP);
471}
472
473static inline int regulator_get_hardware_vsel_register(struct regulator *regulator,
474 unsigned *vsel_reg,
475 unsigned *vsel_mask)
476{
477 return -EOPNOTSUPP;
478}
479
480static inline int regulator_list_hardware_vsel(struct regulator *regulator,
481 unsigned selector)
482{
483 return -EOPNOTSUPP;
484}
485
460static inline int regulator_register_notifier(struct regulator *regulator, 486static inline int regulator_register_notifier(struct regulator *regulator,
461 struct notifier_block *nb) 487 struct notifier_block *nb)
462{ 488{
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
new file mode 100644
index 000000000000..0981ce0e72cc
--- /dev/null
+++ b/include/linux/regulator/da9211.h
@@ -0,0 +1,32 @@
1/*
2 * da9211.h - Regulator device driver for DA9211
3 * Copyright (C) 2014 Dialog Semiconductor Ltd.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 */
15
16#ifndef __LINUX_REGULATOR_DA9211_H
17#define __LINUX_REGULATOR_DA9211_H
18
19#include <linux/regulator/machine.h>
20
21#define DA9211_MAX_REGULATORS 2
22
23struct da9211_pdata {
24 /*
25 * Number of buck
26 * 1 : 4 phase 1 buck
27 * 2 : 2 phase 2 buck
28 */
29 int num_buck;
30 struct regulator_init_data *init_data;
31};
32#endif
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
index 813dae960ebd..5a0b64cf68b4 100644
--- a/include/linux/reservation.h
+++ b/include/linux/reservation.h
@@ -6,7 +6,7 @@
6 * Copyright (C) 2012 Texas Instruments 6 * Copyright (C) 2012 Texas Instruments
7 * 7 *
8 * Authors: 8 * Authors:
9 * Rob Clark <rob.clark@linaro.org> 9 * Rob Clark <robdclark@gmail.com>
10 * Maarten Lankhorst <maarten.lankhorst@canonical.com> 10 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 * Thomas Hellstrom <thellstrom-at-vmware-dot-com> 11 * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
12 * 12 *
@@ -40,23 +40,103 @@
40#define _LINUX_RESERVATION_H 40#define _LINUX_RESERVATION_H
41 41
42#include <linux/ww_mutex.h> 42#include <linux/ww_mutex.h>
43#include <linux/fence.h>
44#include <linux/slab.h>
45#include <linux/seqlock.h>
46#include <linux/rcupdate.h>
43 47
44extern struct ww_class reservation_ww_class; 48extern struct ww_class reservation_ww_class;
49extern struct lock_class_key reservation_seqcount_class;
50extern const char reservation_seqcount_string[];
51
52struct reservation_object_list {
53 struct rcu_head rcu;
54 u32 shared_count, shared_max;
55 struct fence __rcu *shared[];
56};
45 57
46struct reservation_object { 58struct reservation_object {
47 struct ww_mutex lock; 59 struct ww_mutex lock;
60 seqcount_t seq;
61
62 struct fence __rcu *fence_excl;
63 struct reservation_object_list __rcu *fence;
64 struct reservation_object_list *staged;
48}; 65};
49 66
67#define reservation_object_held(obj) lockdep_is_held(&(obj)->lock.base)
68#define reservation_object_assert_held(obj) \
69 lockdep_assert_held(&(obj)->lock.base)
70
50static inline void 71static inline void
51reservation_object_init(struct reservation_object *obj) 72reservation_object_init(struct reservation_object *obj)
52{ 73{
53 ww_mutex_init(&obj->lock, &reservation_ww_class); 74 ww_mutex_init(&obj->lock, &reservation_ww_class);
75
76 __seqcount_init(&obj->seq, reservation_seqcount_string, &reservation_seqcount_class);
77 RCU_INIT_POINTER(obj->fence, NULL);
78 RCU_INIT_POINTER(obj->fence_excl, NULL);
79 obj->staged = NULL;
54} 80}
55 81
56static inline void 82static inline void
57reservation_object_fini(struct reservation_object *obj) 83reservation_object_fini(struct reservation_object *obj)
58{ 84{
85 int i;
86 struct reservation_object_list *fobj;
87 struct fence *excl;
88
89 /*
90 * This object should be dead and all references must have
91 * been released to it, so no need to be protected with rcu.
92 */
93 excl = rcu_dereference_protected(obj->fence_excl, 1);
94 if (excl)
95 fence_put(excl);
96
97 fobj = rcu_dereference_protected(obj->fence, 1);
98 if (fobj) {
99 for (i = 0; i < fobj->shared_count; ++i)
100 fence_put(rcu_dereference_protected(fobj->shared[i], 1));
101
102 kfree(fobj);
103 }
104 kfree(obj->staged);
105
59 ww_mutex_destroy(&obj->lock); 106 ww_mutex_destroy(&obj->lock);
60} 107}
61 108
109static inline struct reservation_object_list *
110reservation_object_get_list(struct reservation_object *obj)
111{
112 return rcu_dereference_protected(obj->fence,
113 reservation_object_held(obj));
114}
115
116static inline struct fence *
117reservation_object_get_excl(struct reservation_object *obj)
118{
119 return rcu_dereference_protected(obj->fence_excl,
120 reservation_object_held(obj));
121}
122
123int reservation_object_reserve_shared(struct reservation_object *obj);
124void reservation_object_add_shared_fence(struct reservation_object *obj,
125 struct fence *fence);
126
127void reservation_object_add_excl_fence(struct reservation_object *obj,
128 struct fence *fence);
129
130int reservation_object_get_fences_rcu(struct reservation_object *obj,
131 struct fence **pfence_excl,
132 unsigned *pshared_count,
133 struct fence ***pshared);
134
135long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
136 bool wait_all, bool intr,
137 unsigned long timeout);
138
139bool reservation_object_test_signaled_rcu(struct reservation_object *obj,
140 bool test_all);
141
62#endif /* _LINUX_RESERVATION_H */ 142#endif /* _LINUX_RESERVATION_H */
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
new file mode 100644
index 000000000000..9cda293c867d
--- /dev/null
+++ b/include/linux/rhashtable.h
@@ -0,0 +1,213 @@
1/*
2 * Resizable, Scalable, Concurrent Hash Table
3 *
4 * Copyright (c) 2014 Thomas Graf <tgraf@suug.ch>
5 * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net>
6 *
7 * Based on the following paper by Josh Triplett, Paul E. McKenney
8 * and Jonathan Walpole:
9 * https://www.usenix.org/legacy/event/atc11/tech/final_files/Triplett.pdf
10 *
11 * Code partially derived from nft_hash
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
18#ifndef _LINUX_RHASHTABLE_H
19#define _LINUX_RHASHTABLE_H
20
21#include <linux/rculist.h>
22
23struct rhash_head {
24 struct rhash_head *next;
25};
26
27#define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL)
28
29struct bucket_table {
30 size_t size;
31 struct rhash_head __rcu *buckets[];
32};
33
34typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed);
35typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 seed);
36
37struct rhashtable;
38
39/**
40 * struct rhashtable_params - Hash table construction parameters
41 * @nelem_hint: Hint on number of elements, should be 75% of desired size
42 * @key_len: Length of key
43 * @key_offset: Offset of key in struct to be hashed
44 * @head_offset: Offset of rhash_head in struct to be hashed
45 * @hash_rnd: Seed to use while hashing
46 * @max_shift: Maximum number of shifts while expanding
47 * @hashfn: Function to hash key
48 * @obj_hashfn: Function to hash object
49 * @grow_decision: If defined, may return true if table should expand
50 * @shrink_decision: If defined, may return true if table should shrink
51 * @mutex_is_held: Must return true if protecting mutex is held
52 */
53struct rhashtable_params {
54 size_t nelem_hint;
55 size_t key_len;
56 size_t key_offset;
57 size_t head_offset;
58 u32 hash_rnd;
59 size_t max_shift;
60 rht_hashfn_t hashfn;
61 rht_obj_hashfn_t obj_hashfn;
62 bool (*grow_decision)(const struct rhashtable *ht,
63 size_t new_size);
64 bool (*shrink_decision)(const struct rhashtable *ht,
65 size_t new_size);
66 int (*mutex_is_held)(void);
67};
68
69/**
70 * struct rhashtable - Hash table handle
71 * @tbl: Bucket table
72 * @nelems: Number of elements in table
73 * @shift: Current size (1 << shift)
74 * @p: Configuration parameters
75 */
76struct rhashtable {
77 struct bucket_table __rcu *tbl;
78 size_t nelems;
79 size_t shift;
80 struct rhashtable_params p;
81};
82
83#ifdef CONFIG_PROVE_LOCKING
84int lockdep_rht_mutex_is_held(const struct rhashtable *ht);
85#else
86static inline int lockdep_rht_mutex_is_held(const struct rhashtable *ht)
87{
88 return 1;
89}
90#endif /* CONFIG_PROVE_LOCKING */
91
92int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params);
93
94u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len);
95u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr);
96
97void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t);
98bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t);
99void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
100 struct rhash_head **pprev, gfp_t flags);
101
102bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size);
103bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size);
104
105int rhashtable_expand(struct rhashtable *ht, gfp_t flags);
106int rhashtable_shrink(struct rhashtable *ht, gfp_t flags);
107
108void *rhashtable_lookup(const struct rhashtable *ht, const void *key);
109void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash,
110 bool (*compare)(void *, void *), void *arg);
111
112void rhashtable_destroy(const struct rhashtable *ht);
113
114#define rht_dereference(p, ht) \
115 rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht))
116
117#define rht_dereference_rcu(p, ht) \
118 rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht))
119
120/* Internal, use rht_obj() instead */
121#define rht_entry(ptr, type, member) container_of(ptr, type, member)
122#define rht_entry_safe(ptr, type, member) \
123({ \
124 typeof(ptr) __ptr = (ptr); \
125 __ptr ? rht_entry(__ptr, type, member) : NULL; \
126})
127#define rht_entry_safe_rcu(ptr, type, member) \
128({ \
129 typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \
130 __ptr ? container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member) : NULL; \
131})
132
133#define rht_next_entry_safe(pos, ht, member) \
134({ \
135 pos ? rht_entry_safe(rht_dereference((pos)->member.next, ht), \
136 typeof(*(pos)), member) : NULL; \
137})
138
139/**
140 * rht_for_each - iterate over hash chain
141 * @pos: &struct rhash_head to use as a loop cursor.
142 * @head: head of the hash chain (struct rhash_head *)
143 * @ht: pointer to your struct rhashtable
144 */
145#define rht_for_each(pos, head, ht) \
146 for (pos = rht_dereference(head, ht); \
147 pos; \
148 pos = rht_dereference((pos)->next, ht))
149
150/**
151 * rht_for_each_entry - iterate over hash chain of given type
152 * @pos: type * to use as a loop cursor.
153 * @head: head of the hash chain (struct rhash_head *)
154 * @ht: pointer to your struct rhashtable
155 * @member: name of the rhash_head within the hashable struct.
156 */
157#define rht_for_each_entry(pos, head, ht, member) \
158 for (pos = rht_entry_safe(rht_dereference(head, ht), \
159 typeof(*(pos)), member); \
160 pos; \
161 pos = rht_next_entry_safe(pos, ht, member))
162
163/**
164 * rht_for_each_entry_safe - safely iterate over hash chain of given type
165 * @pos: type * to use as a loop cursor.
166 * @n: type * to use for temporary next object storage
167 * @head: head of the hash chain (struct rhash_head *)
168 * @ht: pointer to your struct rhashtable
169 * @member: name of the rhash_head within the hashable struct.
170 *
171 * This hash chain list-traversal primitive allows for the looped code to
172 * remove the loop cursor from the list.
173 */
174#define rht_for_each_entry_safe(pos, n, head, ht, member) \
175 for (pos = rht_entry_safe(rht_dereference(head, ht), \
176 typeof(*(pos)), member), \
177 n = rht_next_entry_safe(pos, ht, member); \
178 pos; \
179 pos = n, \
180 n = rht_next_entry_safe(pos, ht, member))
181
182/**
183 * rht_for_each_rcu - iterate over rcu hash chain
184 * @pos: &struct rhash_head to use as a loop cursor.
185 * @head: head of the hash chain (struct rhash_head *)
186 * @ht: pointer to your struct rhashtable
187 *
188 * This hash chain list-traversal primitive may safely run concurrently with
189 * the _rcu fkht mutation primitives such as rht_insert() as long as the
190 * traversal is guarded by rcu_read_lock().
191 */
192#define rht_for_each_rcu(pos, head, ht) \
193 for (pos = rht_dereference_rcu(head, ht); \
194 pos; \
195 pos = rht_dereference_rcu((pos)->next, ht))
196
197/**
198 * rht_for_each_entry_rcu - iterate over rcu hash chain of given type
199 * @pos: type * to use as a loop cursor.
200 * @head: head of the hash chain (struct rhash_head *)
201 * @member: name of the rhash_head within the hashable struct.
202 *
203 * This hash chain list-traversal primitive may safely run concurrently with
204 * the _rcu fkht mutation primitives such as rht_insert() as long as the
205 * traversal is guarded by rcu_read_lock().
206 */
207#define rht_for_each_entry_rcu(pos, head, member) \
208 for (pos = rht_entry_safe_rcu(head, typeof(*(pos)), member); \
209 pos; \
210 pos = rht_entry_safe_rcu((pos)->member.next, \
211 typeof(*(pos)), member))
212
213#endif /* _LINUX_RHASHTABLE_H */
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 5059994fe297..9fc2f213e74f 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -384,11 +384,16 @@ void rio_dev_put(struct rio_dev *);
384 384
385#ifdef CONFIG_RAPIDIO_DMA_ENGINE 385#ifdef CONFIG_RAPIDIO_DMA_ENGINE
386extern struct dma_chan *rio_request_dma(struct rio_dev *rdev); 386extern struct dma_chan *rio_request_dma(struct rio_dev *rdev);
387extern struct dma_chan *rio_request_mport_dma(struct rio_mport *mport);
387extern void rio_release_dma(struct dma_chan *dchan); 388extern void rio_release_dma(struct dma_chan *dchan);
388extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg( 389extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(
389 struct rio_dev *rdev, struct dma_chan *dchan, 390 struct rio_dev *rdev, struct dma_chan *dchan,
390 struct rio_dma_data *data, 391 struct rio_dma_data *data,
391 enum dma_transfer_direction direction, unsigned long flags); 392 enum dma_transfer_direction direction, unsigned long flags);
393extern struct dma_async_tx_descriptor *rio_dma_prep_xfer(
394 struct dma_chan *dchan, u16 destid,
395 struct rio_dma_data *data,
396 enum dma_transfer_direction direction, unsigned long flags);
392#endif 397#endif
393 398
394/** 399/**
diff --git a/include/linux/rndis.h b/include/linux/rndis.h
index 0c8dc7195cdb..93c0a64aefa6 100644
--- a/include/linux/rndis.h
+++ b/include/linux/rndis.h
@@ -65,6 +65,7 @@
65#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 65#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
66#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION 66#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
67#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L 67#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L
68#define RNDIS_STATUS_NETWORK_CHANGE 0x40010018
68 69
69#define RNDIS_STATUS_NOT_RESETTABLE 0x80010001 70#define RNDIS_STATUS_NOT_RESETTABLE 0x80010001
70#define RNDIS_STATUS_SOFT_ERRORS 0x80010003 71#define RNDIS_STATUS_SOFT_ERRORS 0x80010003
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 3aed8d737e1a..1abba5ce2a2f 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -90,11 +90,9 @@ extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
90extern void rt_mutex_destroy(struct rt_mutex *lock); 90extern void rt_mutex_destroy(struct rt_mutex *lock);
91 91
92extern void rt_mutex_lock(struct rt_mutex *lock); 92extern void rt_mutex_lock(struct rt_mutex *lock);
93extern int rt_mutex_lock_interruptible(struct rt_mutex *lock, 93extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
94 int detect_deadlock);
95extern int rt_mutex_timed_lock(struct rt_mutex *lock, 94extern int rt_mutex_timed_lock(struct rt_mutex *lock,
96 struct hrtimer_sleeper *timeout, 95 struct hrtimer_sleeper *timeout);
97 int detect_deadlock);
98 96
99extern int rt_mutex_trylock(struct rt_mutex *lock); 97extern int rt_mutex_trylock(struct rt_mutex *lock);
100 98
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 953937ea5233..167bae7bdfa4 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -78,6 +78,7 @@ extern void __rtnl_unlock(void);
78extern int ndo_dflt_fdb_dump(struct sk_buff *skb, 78extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
79 struct netlink_callback *cb, 79 struct netlink_callback *cb,
80 struct net_device *dev, 80 struct net_device *dev,
81 struct net_device *filter_dev,
81 int idx); 82 int idx);
82extern int ndo_dflt_fdb_add(struct ndmsg *ndm, 83extern int ndo_dflt_fdb_add(struct ndmsg *ndm,
83 struct nlattr *tb[], 84 struct nlattr *tb[],
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index a964f7285600..ed8f9e70df9b 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -136,7 +136,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
136static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, 136static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
137 struct scatterlist *sgl) 137 struct scatterlist *sgl)
138{ 138{
139#ifndef ARCH_HAS_SG_CHAIN 139#ifndef CONFIG_ARCH_HAS_SG_CHAIN
140 BUG(); 140 BUG();
141#endif 141#endif
142 142
@@ -229,10 +229,10 @@ void sg_init_one(struct scatterlist *, const void *, unsigned int);
229typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t); 229typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t);
230typedef void (sg_free_fn)(struct scatterlist *, unsigned int); 230typedef void (sg_free_fn)(struct scatterlist *, unsigned int);
231 231
232void __sg_free_table(struct sg_table *, unsigned int, sg_free_fn *); 232void __sg_free_table(struct sg_table *, unsigned int, bool, sg_free_fn *);
233void sg_free_table(struct sg_table *); 233void sg_free_table(struct sg_table *);
234int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t, 234int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int,
235 sg_alloc_fn *); 235 struct scatterlist *, gfp_t, sg_alloc_fn *);
236int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); 236int sg_alloc_table(struct sg_table *, unsigned int, gfp_t);
237int sg_alloc_table_from_pages(struct sg_table *sgt, 237int sg_alloc_table_from_pages(struct sg_table *sgt,
238 struct page **pages, unsigned int n_pages, 238 struct page **pages, unsigned int n_pages,
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0376b054a0d0..857ba40426ba 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -33,6 +33,7 @@ struct sched_param {
33 33
34#include <linux/smp.h> 34#include <linux/smp.h>
35#include <linux/sem.h> 35#include <linux/sem.h>
36#include <linux/shm.h>
36#include <linux/signal.h> 37#include <linux/signal.h>
37#include <linux/compiler.h> 38#include <linux/compiler.h>
38#include <linux/completion.h> 39#include <linux/completion.h>
@@ -813,7 +814,7 @@ struct task_delay_info {
813 * associated with the operation is added to XXX_delay. 814 * associated with the operation is added to XXX_delay.
814 * XXX_delay contains the accumulated delay time in nanoseconds. 815 * XXX_delay contains the accumulated delay time in nanoseconds.
815 */ 816 */
816 struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */ 817 u64 blkio_start; /* Shared by blkio, swapin */
817 u64 blkio_delay; /* wait for sync block io completion */ 818 u64 blkio_delay; /* wait for sync block io completion */
818 u64 swapin_delay; /* wait for swapin block io completion */ 819 u64 swapin_delay; /* wait for swapin block io completion */
819 u32 blkio_count; /* total count of the number of sync block */ 820 u32 blkio_count; /* total count of the number of sync block */
@@ -821,7 +822,7 @@ struct task_delay_info {
821 u32 swapin_count; /* total count of the number of swapin block */ 822 u32 swapin_count; /* total count of the number of swapin block */
822 /* io operations performed */ 823 /* io operations performed */
823 824
824 struct timespec freepages_start, freepages_end; 825 u64 freepages_start;
825 u64 freepages_delay; /* wait for memory reclaim */ 826 u64 freepages_delay; /* wait for memory reclaim */
826 u32 freepages_count; /* total count of memory reclaim */ 827 u32 freepages_count; /* total count of memory reclaim */
827}; 828};
@@ -1270,9 +1271,6 @@ struct task_struct {
1270#ifdef CONFIG_TREE_PREEMPT_RCU 1271#ifdef CONFIG_TREE_PREEMPT_RCU
1271 struct rcu_node *rcu_blocked_node; 1272 struct rcu_node *rcu_blocked_node;
1272#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 1273#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1273#ifdef CONFIG_RCU_BOOST
1274 struct rt_mutex *rcu_boost_mutex;
1275#endif /* #ifdef CONFIG_RCU_BOOST */
1276 1274
1277#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1275#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1278 struct sched_info sched_info; 1276 struct sched_info sched_info;
@@ -1307,13 +1305,12 @@ struct task_struct {
1307 * execve */ 1305 * execve */
1308 unsigned in_iowait:1; 1306 unsigned in_iowait:1;
1309 1307
1310 /* task may not gain privileges */
1311 unsigned no_new_privs:1;
1312
1313 /* Revert to default priority/policy when forking */ 1308 /* Revert to default priority/policy when forking */
1314 unsigned sched_reset_on_fork:1; 1309 unsigned sched_reset_on_fork:1;
1315 unsigned sched_contributes_to_load:1; 1310 unsigned sched_contributes_to_load:1;
1316 1311
1312 unsigned long atomic_flags; /* Flags needing atomic access. */
1313
1317 pid_t pid; 1314 pid_t pid;
1318 pid_t tgid; 1315 pid_t tgid;
1319 1316
@@ -1367,8 +1364,8 @@ struct task_struct {
1367 } vtime_snap_whence; 1364 } vtime_snap_whence;
1368#endif 1365#endif
1369 unsigned long nvcsw, nivcsw; /* context switch counts */ 1366 unsigned long nvcsw, nivcsw; /* context switch counts */
1370 struct timespec start_time; /* monotonic time */ 1367 u64 start_time; /* monotonic time in nsec */
1371 struct timespec real_start_time; /* boot based time */ 1368 u64 real_start_time; /* boot based time in nsec */
1372/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ 1369/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
1373 unsigned long min_flt, maj_flt; 1370 unsigned long min_flt, maj_flt;
1374 1371
@@ -1389,6 +1386,7 @@ struct task_struct {
1389#ifdef CONFIG_SYSVIPC 1386#ifdef CONFIG_SYSVIPC
1390/* ipc stuff */ 1387/* ipc stuff */
1391 struct sysv_sem sysvsem; 1388 struct sysv_sem sysvsem;
1389 struct sysv_shm sysvshm;
1392#endif 1390#endif
1393#ifdef CONFIG_DETECT_HUNG_TASK 1391#ifdef CONFIG_DETECT_HUNG_TASK
1394/* hung task detection */ 1392/* hung task detection */
@@ -1440,8 +1438,6 @@ struct task_struct {
1440 struct rb_node *pi_waiters_leftmost; 1438 struct rb_node *pi_waiters_leftmost;
1441 /* Deadlock detection and priority inheritance handling */ 1439 /* Deadlock detection and priority inheritance handling */
1442 struct rt_mutex_waiter *pi_blocked_on; 1440 struct rt_mutex_waiter *pi_blocked_on;
1443 /* Top pi_waiters task */
1444 struct task_struct *pi_top_task;
1445#endif 1441#endif
1446 1442
1447#ifdef CONFIG_DEBUG_MUTEXES 1443#ifdef CONFIG_DEBUG_MUTEXES
@@ -1634,12 +1630,6 @@ struct task_struct {
1634 unsigned long trace_recursion; 1630 unsigned long trace_recursion;
1635#endif /* CONFIG_TRACING */ 1631#endif /* CONFIG_TRACING */
1636#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */ 1632#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */
1637 struct memcg_batch_info {
1638 int do_batch; /* incremented when batch uncharge started */
1639 struct mem_cgroup *memcg; /* target memcg of uncharge */
1640 unsigned long nr_pages; /* uncharged usage */
1641 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1642 } memcg_batch;
1643 unsigned int memcg_kmem_skip_account; 1633 unsigned int memcg_kmem_skip_account;
1644 struct memcg_oom_info { 1634 struct memcg_oom_info {
1645 struct mem_cgroup *memcg; 1635 struct mem_cgroup *memcg;
@@ -1967,6 +1957,19 @@ static inline void memalloc_noio_restore(unsigned int flags)
1967 current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags; 1957 current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags;
1968} 1958}
1969 1959
1960/* Per-process atomic flags. */
1961#define PFA_NO_NEW_PRIVS 0x00000001 /* May not gain new privileges. */
1962
1963static inline bool task_no_new_privs(struct task_struct *p)
1964{
1965 return test_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags);
1966}
1967
1968static inline void task_set_no_new_privs(struct task_struct *p)
1969{
1970 set_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags);
1971}
1972
1970/* 1973/*
1971 * task->jobctl flags 1974 * task->jobctl flags
1972 */ 1975 */
@@ -2009,9 +2012,6 @@ static inline void rcu_copy_process(struct task_struct *p)
2009#ifdef CONFIG_TREE_PREEMPT_RCU 2012#ifdef CONFIG_TREE_PREEMPT_RCU
2010 p->rcu_blocked_node = NULL; 2013 p->rcu_blocked_node = NULL;
2011#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 2014#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
2012#ifdef CONFIG_RCU_BOOST
2013 p->rcu_boost_mutex = NULL;
2014#endif /* #ifdef CONFIG_RCU_BOOST */
2015 INIT_LIST_HEAD(&p->rcu_node_entry); 2015 INIT_LIST_HEAD(&p->rcu_node_entry);
2016} 2016}
2017 2017
@@ -2360,8 +2360,10 @@ static inline int on_sig_stack(unsigned long sp)
2360 2360
2361static inline int sas_ss_flags(unsigned long sp) 2361static inline int sas_ss_flags(unsigned long sp)
2362{ 2362{
2363 return (current->sas_ss_size == 0 ? SS_DISABLE 2363 if (!current->sas_ss_size)
2364 : on_sig_stack(sp) ? SS_ONSTACK : 0); 2364 return SS_DISABLE;
2365
2366 return on_sig_stack(sp) ? SS_ONSTACK : 0;
2365} 2367}
2366 2368
2367static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig) 2369static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
@@ -2788,7 +2790,7 @@ static inline bool __must_check current_set_polling_and_test(void)
2788 2790
2789 /* 2791 /*
2790 * Polling state must be visible before we test NEED_RESCHED, 2792 * Polling state must be visible before we test NEED_RESCHED,
2791 * paired by resched_task() 2793 * paired by resched_curr()
2792 */ 2794 */
2793 smp_mb__after_atomic(); 2795 smp_mb__after_atomic();
2794 2796
@@ -2806,7 +2808,7 @@ static inline bool __must_check current_clr_polling_and_test(void)
2806 2808
2807 /* 2809 /*
2808 * Polling state must be visible before we test NEED_RESCHED, 2810 * Polling state must be visible before we test NEED_RESCHED,
2809 * paired by resched_task() 2811 * paired by resched_curr()
2810 */ 2812 */
2811 smp_mb__after_atomic(); 2813 smp_mb__after_atomic();
2812 2814
@@ -2838,7 +2840,7 @@ static inline void current_clr_polling(void)
2838 * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also 2840 * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also
2839 * fold. 2841 * fold.
2840 */ 2842 */
2841 smp_mb(); /* paired with resched_task() */ 2843 smp_mb(); /* paired with resched_curr() */
2842 2844
2843 preempt_fold_need_resched(); 2845 preempt_fold_need_resched();
2844} 2846}
@@ -2963,15 +2965,10 @@ static inline void inc_syscw(struct task_struct *tsk)
2963 2965
2964#ifdef CONFIG_MEMCG 2966#ifdef CONFIG_MEMCG
2965extern void mm_update_next_owner(struct mm_struct *mm); 2967extern void mm_update_next_owner(struct mm_struct *mm);
2966extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
2967#else 2968#else
2968static inline void mm_update_next_owner(struct mm_struct *mm) 2969static inline void mm_update_next_owner(struct mm_struct *mm)
2969{ 2970{
2970} 2971}
2971
2972static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2973{
2974}
2975#endif /* CONFIG_MEMCG */ 2972#endif /* CONFIG_MEMCG */
2976 2973
2977static inline unsigned long task_rlimit(const struct task_struct *tsk, 2974static inline unsigned long task_rlimit(const struct task_struct *tsk,
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 4054b0994071..5d586a45a319 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -3,6 +3,8 @@
3 3
4#include <uapi/linux/seccomp.h> 4#include <uapi/linux/seccomp.h>
5 5
6#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC)
7
6#ifdef CONFIG_SECCOMP 8#ifdef CONFIG_SECCOMP
7 9
8#include <linux/thread_info.h> 10#include <linux/thread_info.h>
@@ -14,11 +16,11 @@ struct seccomp_filter;
14 * 16 *
15 * @mode: indicates one of the valid values above for controlled 17 * @mode: indicates one of the valid values above for controlled
16 * system calls available to a process. 18 * system calls available to a process.
17 * @filter: The metadata and ruleset for determining what system calls 19 * @filter: must always point to a valid seccomp-filter or NULL as it is
18 * are allowed for a task. 20 * accessed without locking during system call entry.
19 * 21 *
20 * @filter must only be accessed from the context of current as there 22 * @filter must only be accessed from the context of current as there
21 * is no locking. 23 * is no read locking.
22 */ 24 */
23struct seccomp { 25struct seccomp {
24 int mode; 26 int mode;
diff --git a/include/linux/security.h b/include/linux/security.h
index 9c6b9722ff48..623f90e5f38d 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -702,6 +702,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
702 * @inode points to the inode to use as a reference. 702 * @inode points to the inode to use as a reference.
703 * The current task must be the one that nominated @inode. 703 * The current task must be the one that nominated @inode.
704 * Return 0 if successful. 704 * Return 0 if successful.
705 * @kernel_fw_from_file:
706 * Load firmware from userspace (not called for built-in firmware).
707 * @file contains the file structure pointing to the file containing
708 * the firmware to load. This argument will be NULL if the firmware
709 * was loaded via the uevent-triggered blob-based interface exposed
710 * by CONFIG_FW_LOADER_USER_HELPER.
711 * @buf pointer to buffer containing firmware contents.
712 * @size length of the firmware contents.
713 * Return 0 if permission is granted.
705 * @kernel_module_request: 714 * @kernel_module_request:
706 * Ability to trigger the kernel to automatically upcall to userspace for 715 * Ability to trigger the kernel to automatically upcall to userspace for
707 * userspace to load a kernel module with the given name. 716 * userspace to load a kernel module with the given name.
@@ -1565,6 +1574,7 @@ struct security_operations {
1565 void (*cred_transfer)(struct cred *new, const struct cred *old); 1574 void (*cred_transfer)(struct cred *new, const struct cred *old);
1566 int (*kernel_act_as)(struct cred *new, u32 secid); 1575 int (*kernel_act_as)(struct cred *new, u32 secid);
1567 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1576 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1577 int (*kernel_fw_from_file)(struct file *file, char *buf, size_t size);
1568 int (*kernel_module_request)(char *kmod_name); 1578 int (*kernel_module_request)(char *kmod_name);
1569 int (*kernel_module_from_file)(struct file *file); 1579 int (*kernel_module_from_file)(struct file *file);
1570 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1580 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
@@ -1837,6 +1847,7 @@ int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1837void security_transfer_creds(struct cred *new, const struct cred *old); 1847void security_transfer_creds(struct cred *new, const struct cred *old);
1838int security_kernel_act_as(struct cred *new, u32 secid); 1848int security_kernel_act_as(struct cred *new, u32 secid);
1839int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1849int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1850int security_kernel_fw_from_file(struct file *file, char *buf, size_t size);
1840int security_kernel_module_request(char *kmod_name); 1851int security_kernel_module_request(char *kmod_name);
1841int security_kernel_module_from_file(struct file *file); 1852int security_kernel_module_from_file(struct file *file);
1842int security_task_fix_setuid(struct cred *new, const struct cred *old, 1853int security_task_fix_setuid(struct cred *new, const struct cred *old,
@@ -2363,6 +2374,12 @@ static inline int security_kernel_create_files_as(struct cred *cred,
2363 return 0; 2374 return 0;
2364} 2375}
2365 2376
2377static inline int security_kernel_fw_from_file(struct file *file,
2378 char *buf, size_t size)
2379{
2380 return 0;
2381}
2382
2366static inline int security_kernel_module_request(char *kmod_name) 2383static inline int security_kernel_module_request(char *kmod_name)
2367{ 2384{
2368 return 0; 2385 return 0;
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 535f158977b9..cc359636cfa3 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -117,6 +117,22 @@ repeat:
117} 117}
118 118
119/** 119/**
120 * raw_read_seqcount - Read the raw seqcount
121 * @s: pointer to seqcount_t
122 * Returns: count to be passed to read_seqcount_retry
123 *
124 * raw_read_seqcount opens a read critical section of the given
125 * seqcount without any lockdep checking and without checking or
126 * masking the LSB. Calling code is responsible for handling that.
127 */
128static inline unsigned raw_read_seqcount(const seqcount_t *s)
129{
130 unsigned ret = ACCESS_ONCE(s->sequence);
131 smp_rmb();
132 return ret;
133}
134
135/**
120 * raw_read_seqcount_begin - start seq-read critical section w/o lockdep 136 * raw_read_seqcount_begin - start seq-read critical section w/o lockdep
121 * @s: pointer to seqcount_t 137 * @s: pointer to seqcount_t
122 * Returns: count to be passed to read_seqcount_retry 138 * Returns: count to be passed to read_seqcount_retry
@@ -164,8 +180,6 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
164static inline unsigned raw_seqcount_begin(const seqcount_t *s) 180static inline unsigned raw_seqcount_begin(const seqcount_t *s)
165{ 181{
166 unsigned ret = ACCESS_ONCE(s->sequence); 182 unsigned ret = ACCESS_ONCE(s->sequence);
167
168 seqcount_lockdep_reader_access(s);
169 smp_rmb(); 183 smp_rmb();
170 return ret & ~1; 184 return ret & ~1;
171} 185}
@@ -220,6 +234,17 @@ static inline void raw_write_seqcount_end(seqcount_t *s)
220} 234}
221 235
222/* 236/*
237 * raw_write_seqcount_latch - redirect readers to even/odd copy
238 * @s: pointer to seqcount_t
239 */
240static inline void raw_write_seqcount_latch(seqcount_t *s)
241{
242 smp_wmb(); /* prior stores before incrementing "sequence" */
243 s->sequence++;
244 smp_wmb(); /* increment "sequence" before following stores */
245}
246
247/*
223 * Sequence counter only version assumes that callers are using their 248 * Sequence counter only version assumes that callers are using their
224 * own mutexing. 249 * own mutexing.
225 */ 250 */
diff --git a/include/linux/seqno-fence.h b/include/linux/seqno-fence.h
new file mode 100644
index 000000000000..3d6003de4b0d
--- /dev/null
+++ b/include/linux/seqno-fence.h
@@ -0,0 +1,116 @@
1/*
2 * seqno-fence, using a dma-buf to synchronize fencing
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Copyright (C) 2012 Canonical Ltd
6 * Authors:
7 * Rob Clark <robdclark@gmail.com>
8 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 */
19
20#ifndef __LINUX_SEQNO_FENCE_H
21#define __LINUX_SEQNO_FENCE_H
22
23#include <linux/fence.h>
24#include <linux/dma-buf.h>
25
26enum seqno_fence_condition {
27 SEQNO_FENCE_WAIT_GEQUAL,
28 SEQNO_FENCE_WAIT_NONZERO
29};
30
31struct seqno_fence {
32 struct fence base;
33
34 const struct fence_ops *ops;
35 struct dma_buf *sync_buf;
36 uint32_t seqno_ofs;
37 enum seqno_fence_condition condition;
38};
39
40extern const struct fence_ops seqno_fence_ops;
41
42/**
43 * to_seqno_fence - cast a fence to a seqno_fence
44 * @fence: fence to cast to a seqno_fence
45 *
46 * Returns NULL if the fence is not a seqno_fence,
47 * or the seqno_fence otherwise.
48 */
49static inline struct seqno_fence *
50to_seqno_fence(struct fence *fence)
51{
52 if (fence->ops != &seqno_fence_ops)
53 return NULL;
54 return container_of(fence, struct seqno_fence, base);
55}
56
57/**
58 * seqno_fence_init - initialize a seqno fence
59 * @fence: seqno_fence to initialize
60 * @lock: pointer to spinlock to use for fence
61 * @sync_buf: buffer containing the memory location to signal on
62 * @context: the execution context this fence is a part of
63 * @seqno_ofs: the offset within @sync_buf
64 * @seqno: the sequence # to signal on
65 * @ops: the fence_ops for operations on this seqno fence
66 *
67 * This function initializes a struct seqno_fence with passed parameters,
68 * and takes a reference on sync_buf which is released on fence destruction.
69 *
70 * A seqno_fence is a dma_fence which can complete in software when
71 * enable_signaling is called, but it also completes when
72 * (s32)((sync_buf)[seqno_ofs] - seqno) >= 0 is true
73 *
74 * The seqno_fence will take a refcount on the sync_buf until it's
75 * destroyed, but actual lifetime of sync_buf may be longer if one of the
76 * callers take a reference to it.
77 *
78 * Certain hardware have instructions to insert this type of wait condition
79 * in the command stream, so no intervention from software would be needed.
80 * This type of fence can be destroyed before completed, however a reference
81 * on the sync_buf dma-buf can be taken. It is encouraged to re-use the same
82 * dma-buf for sync_buf, since mapping or unmapping the sync_buf to the
83 * device's vm can be expensive.
84 *
85 * It is recommended for creators of seqno_fence to call fence_signal
86 * before destruction. This will prevent possible issues from wraparound at
87 * time of issue vs time of check, since users can check fence_is_signaled
88 * before submitting instructions for the hardware to wait on the fence.
89 * However, when ops.enable_signaling is not called, it doesn't have to be
90 * done as soon as possible, just before there's any real danger of seqno
91 * wraparound.
92 */
93static inline void
94seqno_fence_init(struct seqno_fence *fence, spinlock_t *lock,
95 struct dma_buf *sync_buf, uint32_t context,
96 uint32_t seqno_ofs, uint32_t seqno,
97 enum seqno_fence_condition cond,
98 const struct fence_ops *ops)
99{
100 BUG_ON(!fence || !sync_buf || !ops);
101 BUG_ON(!ops->wait || !ops->enable_signaling ||
102 !ops->get_driver_name || !ops->get_timeline_name);
103
104 /*
105 * ops is used in fence_init for get_driver_name, so needs to be
106 * initialized first
107 */
108 fence->ops = ops;
109 fence_init(&fence->base, &seqno_fence_ops, lock, context, seqno);
110 get_dma_buf(sync_buf);
111 fence->sync_buf = sync_buf;
112 fence->seqno_ofs = seqno_ofs;
113 fence->condition = cond;
114}
115
116#endif /* __LINUX_SEQNO_FENCE_H */
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index af47a8af6024..f93649e22c43 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -74,8 +74,10 @@ struct uart_8250_port {
74 struct list_head list; /* ports on this IRQ */ 74 struct list_head list; /* ports on this IRQ */
75 unsigned short capabilities; /* port capabilities */ 75 unsigned short capabilities; /* port capabilities */
76 unsigned short bugs; /* port bugs */ 76 unsigned short bugs; /* port bugs */
77 bool fifo_bug; /* min RX trigger if enabled */
77 unsigned int tx_loadsz; /* transmit fifo load size */ 78 unsigned int tx_loadsz; /* transmit fifo load size */
78 unsigned char acr; 79 unsigned char acr;
80 unsigned char fcr;
79 unsigned char ier; 81 unsigned char ier;
80 unsigned char lcr; 82 unsigned char lcr;
81 unsigned char mcr; 83 unsigned char mcr;
@@ -100,6 +102,11 @@ struct uart_8250_port {
100 void (*dl_write)(struct uart_8250_port *, int); 102 void (*dl_write)(struct uart_8250_port *, int);
101}; 103};
102 104
105static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
106{
107 return container_of(up, struct uart_8250_port, port);
108}
109
103int serial8250_register_8250_port(struct uart_8250_port *); 110int serial8250_register_8250_port(struct uart_8250_port *);
104void serial8250_unregister_port(int line); 111void serial8250_unregister_port(int line);
105void serial8250_suspend_port(int line); 112void serial8250_suspend_port(int line);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 5bbb809ee197..cf3a1e789bf5 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -199,6 +199,8 @@ struct uart_port {
199 unsigned char suspended; 199 unsigned char suspended;
200 unsigned char irq_wake; 200 unsigned char irq_wake;
201 unsigned char unused[2]; 201 unsigned char unused[2];
202 struct attribute_group *attr_group; /* port specific attributes */
203 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */
202 void *private_data; /* generic platform data pointer */ 204 void *private_data; /* generic platform data pointer */
203}; 205};
204 206
diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
index 4723bbfa1c26..a6e555cbe05c 100644
--- a/include/linux/sfi_acpi.h
+++ b/include/linux/sfi_acpi.h
@@ -63,8 +63,6 @@
63#include <linux/sfi.h> 63#include <linux/sfi.h>
64 64
65#ifdef CONFIG_SFI 65#ifdef CONFIG_SFI
66#include <acpi/acpi.h> /* FIXME: inclusion should be removed */
67
68extern int sfi_acpi_table_parse(char *signature, char *oem_id, 66extern int sfi_acpi_table_parse(char *signature, char *oem_id,
69 char *oem_table_id, 67 char *oem_table_id,
70 int (*handler)(struct acpi_table_header *)); 68 int (*handler)(struct acpi_table_header *));
@@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature,
78 return sfi_acpi_table_parse(signature, NULL, NULL, handler); 76 return sfi_acpi_table_parse(signature, NULL, NULL, handler);
79} 77}
80#else /* !CONFIG_SFI */ 78#else /* !CONFIG_SFI */
81
82static inline int sfi_acpi_table_parse(char *signature, char *oem_id, 79static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
83 char *oem_table_id, 80 char *oem_table_id,
84 int (*handler)(struct acpi_table_header *)) 81 int (*handler)(struct acpi_table_header *))
diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h
index 8e1e036d6d45..64638b058076 100644
--- a/include/linux/sh_timer.h
+++ b/include/linux/sh_timer.h
@@ -2,11 +2,6 @@
2#define __SH_TIMER_H__ 2#define __SH_TIMER_H__
3 3
4struct sh_timer_config { 4struct sh_timer_config {
5 char *name;
6 long channel_offset;
7 int timer_bit;
8 unsigned long clockevent_rating;
9 unsigned long clocksource_rating;
10 unsigned int channels_mask; 5 unsigned int channels_mask;
11}; 6};
12 7
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 57d77709fbe2..6fb801686ad6 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_SHM_H_ 1#ifndef _LINUX_SHM_H_
2#define _LINUX_SHM_H_ 2#define _LINUX_SHM_H_
3 3
4#include <linux/list.h>
4#include <asm/page.h> 5#include <asm/page.h>
5#include <uapi/linux/shm.h> 6#include <uapi/linux/shm.h>
6#include <asm/shmparam.h> 7#include <asm/shmparam.h>
@@ -20,6 +21,7 @@ struct shmid_kernel /* private to the kernel */
20 21
21 /* The task created the shm object. NULL if the task is dead. */ 22 /* The task created the shm object. NULL if the task is dead. */
22 struct task_struct *shm_creator; 23 struct task_struct *shm_creator;
24 struct list_head shm_clist; /* list by creator */
23}; 25};
24 26
25/* shm_mode upper byte flags */ 27/* shm_mode upper byte flags */
@@ -44,11 +46,20 @@ struct shmid_kernel /* private to the kernel */
44#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) 46#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
45 47
46#ifdef CONFIG_SYSVIPC 48#ifdef CONFIG_SYSVIPC
49struct sysv_shm {
50 struct list_head shm_clist;
51};
52
47long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, 53long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
48 unsigned long shmlba); 54 unsigned long shmlba);
49extern int is_file_shm_hugepages(struct file *file); 55int is_file_shm_hugepages(struct file *file);
50extern void exit_shm(struct task_struct *task); 56void exit_shm(struct task_struct *task);
57#define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
51#else 58#else
59struct sysv_shm {
60 /* empty */
61};
62
52static inline long do_shmat(int shmid, char __user *shmaddr, 63static inline long do_shmat(int shmid, char __user *shmaddr,
53 int shmflg, unsigned long *addr, 64 int shmflg, unsigned long *addr,
54 unsigned long shmlba) 65 unsigned long shmlba)
@@ -62,6 +73,9 @@ static inline int is_file_shm_hugepages(struct file *file)
62static inline void exit_shm(struct task_struct *task) 73static inline void exit_shm(struct task_struct *task)
63{ 74{
64} 75}
76static inline void shm_init_task(struct task_struct *task)
77{
78}
65#endif 79#endif
66 80
67#endif /* _LINUX_SHM_H_ */ 81#endif /* _LINUX_SHM_H_ */
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 4d1771c2d29f..50777b5b1e4c 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -1,6 +1,7 @@
1#ifndef __SHMEM_FS_H 1#ifndef __SHMEM_FS_H
2#define __SHMEM_FS_H 2#define __SHMEM_FS_H
3 3
4#include <linux/file.h>
4#include <linux/swap.h> 5#include <linux/swap.h>
5#include <linux/mempolicy.h> 6#include <linux/mempolicy.h>
6#include <linux/pagemap.h> 7#include <linux/pagemap.h>
@@ -11,6 +12,7 @@
11 12
12struct shmem_inode_info { 13struct shmem_inode_info {
13 spinlock_t lock; 14 spinlock_t lock;
15 unsigned int seals; /* shmem seals */
14 unsigned long flags; 16 unsigned long flags;
15 unsigned long alloced; /* data pages alloced to file */ 17 unsigned long alloced; /* data pages alloced to file */
16 union { 18 union {
@@ -65,4 +67,19 @@ static inline struct page *shmem_read_mapping_page(
65 mapping_gfp_mask(mapping)); 67 mapping_gfp_mask(mapping));
66} 68}
67 69
70#ifdef CONFIG_TMPFS
71
72extern int shmem_add_seals(struct file *file, unsigned int seals);
73extern int shmem_get_seals(struct file *file);
74extern long shmem_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
75
76#else
77
78static inline long shmem_fcntl(struct file *f, unsigned int c, unsigned long a)
79{
80 return -EINVAL;
81}
82
83#endif
84
68#endif 85#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index c9e65360c49a..750196fcc0a5 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -280,9 +280,8 @@ struct ksignal {
280 int sig; 280 int sig;
281}; 281};
282 282
283extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 283extern int get_signal(struct ksignal *ksig);
284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); 284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
285extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
286extern void exit_signals(struct task_struct *tsk); 285extern void exit_signals(struct task_struct *tsk);
287extern void kernel_sigaction(int, __sighandler_t); 286extern void kernel_sigaction(int, __sighandler_t);
288 287
@@ -301,18 +300,6 @@ static inline void disallow_signal(int sig)
301 kernel_sigaction(sig, SIG_IGN); 300 kernel_sigaction(sig, SIG_IGN);
302} 301}
303 302
304/*
305 * Eventually that'll replace get_signal_to_deliver(); macro for now,
306 * to avoid nastiness with include order.
307 */
308#define get_signal(ksig) \
309({ \
310 struct ksignal *p = (ksig); \
311 p->sig = get_signal_to_deliver(&p->info, &p->ka, \
312 signal_pt_regs(), NULL);\
313 p->sig > 0; \
314})
315
316extern struct kmem_cache *sighand_cachep; 303extern struct kmem_cache *sighand_cachep;
317 304
318int unhandled_signal(struct task_struct *tsk, int sig); 305int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ec89301ada41..11c270551d25 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -112,8 +112,7 @@
112#define CHECKSUM_COMPLETE 2 112#define CHECKSUM_COMPLETE 2
113#define CHECKSUM_PARTIAL 3 113#define CHECKSUM_PARTIAL 3
114 114
115#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 115#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
116 ~(SMP_CACHE_BYTES - 1))
117#define SKB_WITH_OVERHEAD(X) \ 116#define SKB_WITH_OVERHEAD(X) \
118 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) 117 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
119#define SKB_MAX_ORDER(X, ORDER) \ 118#define SKB_MAX_ORDER(X, ORDER) \
@@ -211,18 +210,9 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
211 * struct skb_shared_hwtstamps - hardware time stamps 210 * struct skb_shared_hwtstamps - hardware time stamps
212 * @hwtstamp: hardware time stamp transformed into duration 211 * @hwtstamp: hardware time stamp transformed into duration
213 * since arbitrary point in time 212 * since arbitrary point in time
214 * @syststamp: hwtstamp transformed to system time base
215 * 213 *
216 * Software time stamps generated by ktime_get_real() are stored in 214 * Software time stamps generated by ktime_get_real() are stored in
217 * skb->tstamp. The relation between the different kinds of time 215 * skb->tstamp.
218 * stamps is as follows:
219 *
220 * syststamp and tstamp can be compared against each other in
221 * arbitrary combinations. The accuracy of a
222 * syststamp/tstamp/"syststamp from other device" comparison is
223 * limited by the accuracy of the transformation into system time
224 * base. This depends on the device driver and its underlying
225 * hardware.
226 * 216 *
227 * hwtstamps can only be compared against other hwtstamps from 217 * hwtstamps can only be compared against other hwtstamps from
228 * the same device. 218 * the same device.
@@ -232,7 +222,6 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
232 */ 222 */
233struct skb_shared_hwtstamps { 223struct skb_shared_hwtstamps {
234 ktime_t hwtstamp; 224 ktime_t hwtstamp;
235 ktime_t syststamp;
236}; 225};
237 226
238/* Definitions for tx_flags in struct skb_shared_info */ 227/* Definitions for tx_flags in struct skb_shared_info */
@@ -240,7 +229,7 @@ enum {
240 /* generate hardware time stamp */ 229 /* generate hardware time stamp */
241 SKBTX_HW_TSTAMP = 1 << 0, 230 SKBTX_HW_TSTAMP = 1 << 0,
242 231
243 /* generate software time stamp */ 232 /* generate software time stamp when queueing packet to NIC */
244 SKBTX_SW_TSTAMP = 1 << 1, 233 SKBTX_SW_TSTAMP = 1 << 1,
245 234
246 /* device driver is going to provide hardware time stamp */ 235 /* device driver is going to provide hardware time stamp */
@@ -258,8 +247,19 @@ enum {
258 * all frags to avoid possible bad checksum 247 * all frags to avoid possible bad checksum
259 */ 248 */
260 SKBTX_SHARED_FRAG = 1 << 5, 249 SKBTX_SHARED_FRAG = 1 << 5,
250
251 /* generate software time stamp when entering packet scheduling */
252 SKBTX_SCHED_TSTAMP = 1 << 6,
253
254 /* generate software timestamp on peer data acknowledgment */
255 SKBTX_ACK_TSTAMP = 1 << 7,
261}; 256};
262 257
258#define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | \
259 SKBTX_SCHED_TSTAMP | \
260 SKBTX_ACK_TSTAMP)
261#define SKBTX_ANY_TSTAMP (SKBTX_HW_TSTAMP | SKBTX_ANY_SW_TSTAMP)
262
263/* 263/*
264 * The callback notifies userspace to release buffers when skb DMA is done in 264 * The callback notifies userspace to release buffers when skb DMA is done in
265 * lower device, the skb last reference should be 0 when calling this. 265 * lower device, the skb last reference should be 0 when calling this.
@@ -286,6 +286,7 @@ struct skb_shared_info {
286 unsigned short gso_type; 286 unsigned short gso_type;
287 struct sk_buff *frag_list; 287 struct sk_buff *frag_list;
288 struct skb_shared_hwtstamps hwtstamps; 288 struct skb_shared_hwtstamps hwtstamps;
289 u32 tskey;
289 __be32 ip6_frag_id; 290 __be32 ip6_frag_id;
290 291
291 /* 292 /*
@@ -455,6 +456,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
455 * @ooo_okay: allow the mapping of a socket to a queue to be changed 456 * @ooo_okay: allow the mapping of a socket to a queue to be changed
456 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport 457 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
457 * ports. 458 * ports.
459 * @sw_hash: indicates hash was computed in software stack
458 * @wifi_acked_valid: wifi_acked was set 460 * @wifi_acked_valid: wifi_acked was set
459 * @wifi_acked: whether frame was acked on wifi or not 461 * @wifi_acked: whether frame was acked on wifi or not
460 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 462 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
@@ -562,6 +564,7 @@ struct sk_buff {
562 __u8 pfmemalloc:1; 564 __u8 pfmemalloc:1;
563 __u8 ooo_okay:1; 565 __u8 ooo_okay:1;
564 __u8 l4_hash:1; 566 __u8 l4_hash:1;
567 __u8 sw_hash:1;
565 __u8 wifi_acked_valid:1; 568 __u8 wifi_acked_valid:1;
566 __u8 wifi_acked:1; 569 __u8 wifi_acked:1;
567 __u8 no_fcs:1; 570 __u8 no_fcs:1;
@@ -575,7 +578,7 @@ struct sk_buff {
575 __u8 encap_hdr_csum:1; 578 __u8 encap_hdr_csum:1;
576 __u8 csum_valid:1; 579 __u8 csum_valid:1;
577 __u8 csum_complete_sw:1; 580 __u8 csum_complete_sw:1;
578 /* 3/5 bit hole (depending on ndisc_nodetype presence) */ 581 /* 2/4 bit hole (depending on ndisc_nodetype presence) */
579 kmemcheck_bitfield_end(flags2); 582 kmemcheck_bitfield_end(flags2);
580 583
581#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 584#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -830,13 +833,14 @@ static inline void
830skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) 833skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type)
831{ 834{
832 skb->l4_hash = (type == PKT_HASH_TYPE_L4); 835 skb->l4_hash = (type == PKT_HASH_TYPE_L4);
836 skb->sw_hash = 0;
833 skb->hash = hash; 837 skb->hash = hash;
834} 838}
835 839
836void __skb_get_hash(struct sk_buff *skb); 840void __skb_get_hash(struct sk_buff *skb);
837static inline __u32 skb_get_hash(struct sk_buff *skb) 841static inline __u32 skb_get_hash(struct sk_buff *skb)
838{ 842{
839 if (!skb->l4_hash) 843 if (!skb->l4_hash && !skb->sw_hash)
840 __skb_get_hash(skb); 844 __skb_get_hash(skb);
841 845
842 return skb->hash; 846 return skb->hash;
@@ -850,6 +854,7 @@ static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
850static inline void skb_clear_hash(struct sk_buff *skb) 854static inline void skb_clear_hash(struct sk_buff *skb)
851{ 855{
852 skb->hash = 0; 856 skb->hash = 0;
857 skb->sw_hash = 0;
853 skb->l4_hash = 0; 858 skb->l4_hash = 0;
854} 859}
855 860
@@ -862,6 +867,7 @@ static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
862static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) 867static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
863{ 868{
864 to->hash = from->hash; 869 to->hash = from->hash;
870 to->sw_hash = from->sw_hash;
865 to->l4_hash = from->l4_hash; 871 to->l4_hash = from->l4_hash;
866}; 872};
867 873
@@ -2697,6 +2703,10 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
2697void skb_complete_tx_timestamp(struct sk_buff *skb, 2703void skb_complete_tx_timestamp(struct sk_buff *skb,
2698 struct skb_shared_hwtstamps *hwtstamps); 2704 struct skb_shared_hwtstamps *hwtstamps);
2699 2705
2706void __skb_tstamp_tx(struct sk_buff *orig_skb,
2707 struct skb_shared_hwtstamps *hwtstamps,
2708 struct sock *sk, int tstype);
2709
2700/** 2710/**
2701 * skb_tstamp_tx - queue clone of skb with send time stamps 2711 * skb_tstamp_tx - queue clone of skb with send time stamps
2702 * @orig_skb: the original outgoing packet 2712 * @orig_skb: the original outgoing packet
@@ -3005,7 +3015,7 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
3005 return skb->queue_mapping != 0; 3015 return skb->queue_mapping != 0;
3006} 3016}
3007 3017
3008u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb, 3018u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
3009 unsigned int num_tx_queues); 3019 unsigned int num_tx_queues);
3010 3020
3011static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 3021static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
diff --git a/include/linux/spi/cc2520.h b/include/linux/spi/cc2520.h
new file mode 100644
index 000000000000..85b8ee67e937
--- /dev/null
+++ b/include/linux/spi/cc2520.h
@@ -0,0 +1,26 @@
1/* Header file for cc2520 radio driver
2 *
3 * Copyright (C) 2014 Varka Bhadram <varkab@cdac.in>
4 * Md.Jamal Mohiuddin <mjmohiuddin@cdac.in>
5 * P Sowjanya <sowjanyap@cdac.in>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 */
13
14#ifndef __CC2520_H
15#define __CC2520_H
16
17struct cc2520_platform_data {
18 int fifo;
19 int fifop;
20 int cca;
21 int sfd;
22 int reset;
23 int vreg;
24};
25
26#endif
diff --git a/include/linux/spi/sh_msiof.h b/include/linux/spi/sh_msiof.h
index 2e8db3d2d2e5..88a14d81c49e 100644
--- a/include/linux/spi/sh_msiof.h
+++ b/include/linux/spi/sh_msiof.h
@@ -5,6 +5,8 @@ struct sh_msiof_spi_info {
5 int tx_fifo_override; 5 int tx_fifo_override;
6 int rx_fifo_override; 6 int rx_fifo_override;
7 u16 num_chipselect; 7 u16 num_chipselect;
8 unsigned int dma_tx_id;
9 unsigned int dma_rx_id;
8}; 10};
9 11
10#endif /* __SPI_SH_MSIOF_H__ */ 12#endif /* __SPI_SH_MSIOF_H__ */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index f9f931c89e3e..f7b9100686c3 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -345,6 +345,43 @@
345#define SSB_SPROM4_TXPID5GH2_SHIFT 0 345#define SSB_SPROM4_TXPID5GH2_SHIFT 0
346#define SSB_SPROM4_TXPID5GH3 0xFF00 346#define SSB_SPROM4_TXPID5GH3 0xFF00
347#define SSB_SPROM4_TXPID5GH3_SHIFT 8 347#define SSB_SPROM4_TXPID5GH3_SHIFT 8
348
349/* There are 4 blocks with power info sharing the same layout */
350#define SSB_SPROM4_PWR_INFO_CORE0 0x0080
351#define SSB_SPROM4_PWR_INFO_CORE1 0x00AE
352#define SSB_SPROM4_PWR_INFO_CORE2 0x00DC
353#define SSB_SPROM4_PWR_INFO_CORE3 0x010A
354
355#define SSB_SPROM4_2G_MAXP_ITSSI 0x00 /* 2 GHz ITSSI and 2 GHz Max Power */
356#define SSB_SPROM4_2G_MAXP 0x00FF
357#define SSB_SPROM4_2G_ITSSI 0xFF00
358#define SSB_SPROM4_2G_ITSSI_SHIFT 8
359#define SSB_SPROM4_2G_PA_0 0x02 /* 2 GHz power amp */
360#define SSB_SPROM4_2G_PA_1 0x04
361#define SSB_SPROM4_2G_PA_2 0x06
362#define SSB_SPROM4_2G_PA_3 0x08
363#define SSB_SPROM4_5G_MAXP_ITSSI 0x0A /* 5 GHz ITSSI and 5.3 GHz Max Power */
364#define SSB_SPROM4_5G_MAXP 0x00FF
365#define SSB_SPROM4_5G_ITSSI 0xFF00
366#define SSB_SPROM4_5G_ITSSI_SHIFT 8
367#define SSB_SPROM4_5GHL_MAXP 0x0C /* 5.2 GHz and 5.8 GHz Max Power */
368#define SSB_SPROM4_5GH_MAXP 0x00FF
369#define SSB_SPROM4_5GL_MAXP 0xFF00
370#define SSB_SPROM4_5GL_MAXP_SHIFT 8
371#define SSB_SPROM4_5G_PA_0 0x0E /* 5.3 GHz power amp */
372#define SSB_SPROM4_5G_PA_1 0x10
373#define SSB_SPROM4_5G_PA_2 0x12
374#define SSB_SPROM4_5G_PA_3 0x14
375#define SSB_SPROM4_5GL_PA_0 0x16 /* 5.2 GHz power amp */
376#define SSB_SPROM4_5GL_PA_1 0x18
377#define SSB_SPROM4_5GL_PA_2 0x1A
378#define SSB_SPROM4_5GL_PA_3 0x1C
379#define SSB_SPROM4_5GH_PA_0 0x1E /* 5.8 GHz power amp */
380#define SSB_SPROM4_5GH_PA_1 0x20
381#define SSB_SPROM4_5GH_PA_2 0x22
382#define SSB_SPROM4_5GH_PA_3 0x24
383
384/* TODO: Make it deprecated */
348#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */ 385#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */
349#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 386#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
350#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 387#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 6f27d4f957bd..cd63851b57f2 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -112,6 +112,8 @@ struct plat_stmmacenet_data {
112 int riwt_off; 112 int riwt_off;
113 int max_speed; 113 int max_speed;
114 int maxmtu; 114 int maxmtu;
115 int multicast_filter_bins;
116 int unicast_filter_entries;
115 void (*fix_mac_speed)(void *priv, unsigned int speed); 117 void (*fix_mac_speed)(void *priv, unsigned int speed);
116 void (*bus_setup)(void __iomem *ioaddr); 118 void (*bus_setup)(void __iomem *ioaddr);
117 void *(*setup)(struct platform_device *pdev); 119 void *(*setup)(struct platform_device *pdev);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index ad7dbe2cfecd..1a8959944c5f 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -236,7 +236,7 @@ void * rpc_malloc(struct rpc_task *, size_t);
236void rpc_free(void *); 236void rpc_free(void *);
237int rpciod_up(void); 237int rpciod_up(void);
238void rpciod_down(void); 238void rpciod_down(void);
239int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 239int __rpc_wait_for_completion_task(struct rpc_task *task, wait_bit_action_f *);
240#ifdef RPC_DEBUG 240#ifdef RPC_DEBUG
241struct net; 241struct net;
242void rpc_show_tasks(struct net *); 242void rpc_show_tasks(struct net *);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 1bc7cd05b22e..cf61ecd148e0 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -236,7 +236,7 @@ struct svc_rqst {
236 struct svc_cred rq_cred; /* auth info */ 236 struct svc_cred rq_cred; /* auth info */
237 void * rq_xprt_ctxt; /* transport specific context ptr */ 237 void * rq_xprt_ctxt; /* transport specific context ptr */
238 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 238 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
239 int rq_usedeferral; /* use deferral */ 239 bool rq_usedeferral; /* use deferral */
240 240
241 size_t rq_xprt_hlen; /* xprt header len */ 241 size_t rq_xprt_hlen; /* xprt header len */
242 struct xdr_buf rq_arg; 242 struct xdr_buf rq_arg;
@@ -277,7 +277,7 @@ struct svc_rqst {
277 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ 277 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
278 int rq_cachetype; 278 int rq_cachetype;
279 struct svc_cacherep * rq_cacherep; /* cache info */ 279 struct svc_cacherep * rq_cacherep; /* cache info */
280 int rq_splice_ok; /* turned off in gss privacy 280 bool rq_splice_ok; /* turned off in gss privacy
281 * to prevent encrypting page 281 * to prevent encrypting page
282 * cache pages */ 282 * cache pages */
283 wait_queue_head_t rq_wait; /* synchronization */ 283 wait_queue_head_t rq_wait; /* synchronization */
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index 5cf99a016368..975da754c778 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -174,8 +174,7 @@ struct svcxprt_rdma {
174 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */ 174 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */
175#define RPCRDMA_ORD (64/4) 175#define RPCRDMA_ORD (64/4)
176#define RPCRDMA_SQ_DEPTH_MULT 8 176#define RPCRDMA_SQ_DEPTH_MULT 8
177#define RPCRDMA_MAX_THREADS 16 177#define RPCRDMA_MAX_REQUESTS 32
178#define RPCRDMA_MAX_REQUESTS 16
179#define RPCRDMA_MAX_REQ_SIZE 4096 178#define RPCRDMA_MAX_REQ_SIZE 4096
180 179
181/* svc_rdma_marshal.c */ 180/* svc_rdma_marshal.c */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 7235040a19b2..ce6e4182a5b2 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -25,6 +25,7 @@ struct svc_xprt_ops {
25 void (*xpo_detach)(struct svc_xprt *); 25 void (*xpo_detach)(struct svc_xprt *);
26 void (*xpo_free)(struct svc_xprt *); 26 void (*xpo_free)(struct svc_xprt *);
27 int (*xpo_secure_port)(struct svc_rqst *); 27 int (*xpo_secure_port)(struct svc_rqst *);
28 void (*xpo_adjust_wspace)(struct svc_xprt *);
28}; 29};
29 30
30struct svc_xprt_class { 31struct svc_xprt_class {
@@ -33,6 +34,7 @@ struct svc_xprt_class {
33 struct svc_xprt_ops *xcl_ops; 34 struct svc_xprt_ops *xcl_ops;
34 struct list_head xcl_list; 35 struct list_head xcl_list;
35 u32 xcl_max_payload; 36 u32 xcl_max_payload;
37 int xcl_ident;
36}; 38};
37 39
38/* 40/*
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 4bdbee80eede..1b72060f093a 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -311,7 +311,6 @@ extern void lru_add_page_tail(struct page *page, struct page *page_tail,
311 struct lruvec *lruvec, struct list_head *head); 311 struct lruvec *lruvec, struct list_head *head);
312extern void activate_page(struct page *); 312extern void activate_page(struct page *);
313extern void mark_page_accessed(struct page *); 313extern void mark_page_accessed(struct page *);
314extern void init_page_accessed(struct page *page);
315extern void lru_add_drain(void); 314extern void lru_add_drain(void);
316extern void lru_add_drain_cpu(int cpu); 315extern void lru_add_drain_cpu(int cpu);
317extern void lru_add_drain_all(void); 316extern void lru_add_drain_all(void);
@@ -321,6 +320,9 @@ extern void swap_setup(void);
321 320
322extern void add_page_to_unevictable_list(struct page *page); 321extern void add_page_to_unevictable_list(struct page *page);
323 322
323extern void lru_cache_add_active_or_unevictable(struct page *page,
324 struct vm_area_struct *vma);
325
324/* linux/mm/vmscan.c */ 326/* linux/mm/vmscan.c */
325extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 327extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
326 gfp_t gfp_mask, nodemask_t *mask); 328 gfp_t gfp_mask, nodemask_t *mask);
@@ -379,9 +381,13 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
379} 381}
380#endif 382#endif
381#ifdef CONFIG_MEMCG_SWAP 383#ifdef CONFIG_MEMCG_SWAP
382extern void mem_cgroup_uncharge_swap(swp_entry_t ent); 384extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry);
385extern void mem_cgroup_uncharge_swap(swp_entry_t entry);
383#else 386#else
384static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) 387static inline void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
388{
389}
390static inline void mem_cgroup_uncharge_swap(swp_entry_t entry)
385{ 391{
386} 392}
387#endif 393#endif
@@ -441,7 +447,7 @@ extern void swap_shmem_alloc(swp_entry_t);
441extern int swap_duplicate(swp_entry_t); 447extern int swap_duplicate(swp_entry_t);
442extern int swapcache_prepare(swp_entry_t); 448extern int swapcache_prepare(swp_entry_t);
443extern void swap_free(swp_entry_t); 449extern void swap_free(swp_entry_t);
444extern void swapcache_free(swp_entry_t, struct page *page); 450extern void swapcache_free(swp_entry_t);
445extern int free_swap_and_cache(swp_entry_t); 451extern int free_swap_and_cache(swp_entry_t);
446extern int swap_type_of(dev_t, sector_t, struct block_device **); 452extern int swap_type_of(dev_t, sector_t, struct block_device **);
447extern unsigned int count_swap_pages(int, int); 453extern unsigned int count_swap_pages(int, int);
@@ -505,7 +511,7 @@ static inline void swap_free(swp_entry_t swp)
505{ 511{
506} 512}
507 513
508static inline void swapcache_free(swp_entry_t swp, struct page *page) 514static inline void swapcache_free(swp_entry_t swp)
509{ 515{
510} 516}
511 517
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b0881a0ed322..0f86d85a9ce4 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -317,6 +317,10 @@ asmlinkage long sys_restart_syscall(void);
317asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, 317asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
318 struct kexec_segment __user *segments, 318 struct kexec_segment __user *segments,
319 unsigned long flags); 319 unsigned long flags);
320asmlinkage long sys_kexec_file_load(int kernel_fd, int initrd_fd,
321 unsigned long cmdline_len,
322 const char __user *cmdline_ptr,
323 unsigned long flags);
320 324
321asmlinkage long sys_exit(int error_code); 325asmlinkage long sys_exit(int error_code);
322asmlinkage long sys_exit_group(int error_code); 326asmlinkage long sys_exit_group(int error_code);
@@ -802,6 +806,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags,
802asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); 806asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
803asmlinkage long sys_eventfd(unsigned int count); 807asmlinkage long sys_eventfd(unsigned int count);
804asmlinkage long sys_eventfd2(unsigned int count, int flags); 808asmlinkage long sys_eventfd2(unsigned int count, int flags);
809asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
805asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); 810asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
806asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int); 811asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
807asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *, 812asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
@@ -866,4 +871,9 @@ asmlinkage long sys_process_vm_writev(pid_t pid,
866asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, 871asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
867 unsigned long idx1, unsigned long idx2); 872 unsigned long idx1, unsigned long idx2);
868asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags); 873asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags);
874asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
875 const char __user *uargs);
876asmlinkage long sys_getrandom(char __user *buf, size_t count,
877 unsigned int flags);
878
869#endif 879#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 14a8ff2de11e..b7361f831226 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -34,8 +34,6 @@ struct ctl_table_root;
34struct ctl_table_header; 34struct ctl_table_header;
35struct ctl_dir; 35struct ctl_dir;
36 36
37typedef struct ctl_table ctl_table;
38
39typedef int proc_handler (struct ctl_table *ctl, int write, 37typedef int proc_handler (struct ctl_table *ctl, int write,
40 void __user *buffer, size_t *lenp, loff_t *ppos); 38 void __user *buffer, size_t *lenp, loff_t *ppos);
41 39
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index a0513210798f..fa5258f322e7 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -111,10 +111,7 @@ struct tcp_request_sock_ops;
111 111
112struct tcp_request_sock { 112struct tcp_request_sock {
113 struct inet_request_sock req; 113 struct inet_request_sock req;
114#ifdef CONFIG_TCP_MD5SIG
115 /* Only used by TCP MD5 Signature so far. */
116 const struct tcp_request_sock_ops *af_specific; 114 const struct tcp_request_sock_ops *af_specific;
117#endif
118 struct sock *listener; /* needed for TFO */ 115 struct sock *listener; /* needed for TFO */
119 u32 rcv_isn; 116 u32 rcv_isn;
120 u32 snt_isn; 117 u32 snt_isn;
diff --git a/include/linux/tegra-cpuidle.h b/include/linux/tegra-cpuidle.h
deleted file mode 100644
index 9c6286bbf662..000000000000
--- a/include/linux/tegra-cpuidle.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef __LINUX_TEGRA_CPUIDLE_H__
15#define __LINUX_TEGRA_CPUIDLE_H__
16
17#ifdef CONFIG_CPU_IDLE
18void tegra_cpuidle_pcie_irqs_in_use(void);
19#else
20static inline void tegra_cpuidle_pcie_irqs_in_use(void)
21{
22}
23#endif
24
25#endif
diff --git a/include/linux/tegra-powergate.h b/include/linux/tegra-powergate.h
deleted file mode 100644
index 46f0a07812b4..000000000000
--- a/include/linux/tegra-powergate.h
+++ /dev/null
@@ -1,134 +0,0 @@
1/*
2 * Copyright (c) 2010 Google, Inc
3 *
4 * Author:
5 * Colin Cross <ccross@google.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef _MACH_TEGRA_POWERGATE_H_
19#define _MACH_TEGRA_POWERGATE_H_
20
21struct clk;
22struct reset_control;
23
24#define TEGRA_POWERGATE_CPU 0
25#define TEGRA_POWERGATE_3D 1
26#define TEGRA_POWERGATE_VENC 2
27#define TEGRA_POWERGATE_PCIE 3
28#define TEGRA_POWERGATE_VDEC 4
29#define TEGRA_POWERGATE_L2 5
30#define TEGRA_POWERGATE_MPE 6
31#define TEGRA_POWERGATE_HEG 7
32#define TEGRA_POWERGATE_SATA 8
33#define TEGRA_POWERGATE_CPU1 9
34#define TEGRA_POWERGATE_CPU2 10
35#define TEGRA_POWERGATE_CPU3 11
36#define TEGRA_POWERGATE_CELP 12
37#define TEGRA_POWERGATE_3D1 13
38#define TEGRA_POWERGATE_CPU0 14
39#define TEGRA_POWERGATE_C0NC 15
40#define TEGRA_POWERGATE_C1NC 16
41#define TEGRA_POWERGATE_SOR 17
42#define TEGRA_POWERGATE_DIS 18
43#define TEGRA_POWERGATE_DISB 19
44#define TEGRA_POWERGATE_XUSBA 20
45#define TEGRA_POWERGATE_XUSBB 21
46#define TEGRA_POWERGATE_XUSBC 22
47#define TEGRA_POWERGATE_VIC 23
48#define TEGRA_POWERGATE_IRAM 24
49
50#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
51
52#define TEGRA_IO_RAIL_CSIA 0
53#define TEGRA_IO_RAIL_CSIB 1
54#define TEGRA_IO_RAIL_DSI 2
55#define TEGRA_IO_RAIL_MIPI_BIAS 3
56#define TEGRA_IO_RAIL_PEX_BIAS 4
57#define TEGRA_IO_RAIL_PEX_CLK1 5
58#define TEGRA_IO_RAIL_PEX_CLK2 6
59#define TEGRA_IO_RAIL_USB0 9
60#define TEGRA_IO_RAIL_USB1 10
61#define TEGRA_IO_RAIL_USB2 11
62#define TEGRA_IO_RAIL_USB_BIAS 12
63#define TEGRA_IO_RAIL_NAND 13
64#define TEGRA_IO_RAIL_UART 14
65#define TEGRA_IO_RAIL_BB 15
66#define TEGRA_IO_RAIL_AUDIO 17
67#define TEGRA_IO_RAIL_HSIC 19
68#define TEGRA_IO_RAIL_COMP 22
69#define TEGRA_IO_RAIL_HDMI 28
70#define TEGRA_IO_RAIL_PEX_CNTRL 32
71#define TEGRA_IO_RAIL_SDMMC1 33
72#define TEGRA_IO_RAIL_SDMMC3 34
73#define TEGRA_IO_RAIL_SDMMC4 35
74#define TEGRA_IO_RAIL_CAM 36
75#define TEGRA_IO_RAIL_RES 37
76#define TEGRA_IO_RAIL_HV 38
77#define TEGRA_IO_RAIL_DSIB 39
78#define TEGRA_IO_RAIL_DSIC 40
79#define TEGRA_IO_RAIL_DSID 41
80#define TEGRA_IO_RAIL_CSIE 44
81#define TEGRA_IO_RAIL_LVDS 57
82#define TEGRA_IO_RAIL_SYS_DDC 58
83
84#ifdef CONFIG_ARCH_TEGRA
85int tegra_powergate_is_powered(int id);
86int tegra_powergate_power_on(int id);
87int tegra_powergate_power_off(int id);
88int tegra_powergate_remove_clamping(int id);
89
90/* Must be called with clk disabled, and returns with clk enabled */
91int tegra_powergate_sequence_power_up(int id, struct clk *clk,
92 struct reset_control *rst);
93
94int tegra_io_rail_power_on(int id);
95int tegra_io_rail_power_off(int id);
96#else
97static inline int tegra_powergate_is_powered(int id)
98{
99 return -ENOSYS;
100}
101
102static inline int tegra_powergate_power_on(int id)
103{
104 return -ENOSYS;
105}
106
107static inline int tegra_powergate_power_off(int id)
108{
109 return -ENOSYS;
110}
111
112static inline int tegra_powergate_remove_clamping(int id)
113{
114 return -ENOSYS;
115}
116
117static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk,
118 struct reset_control *rst)
119{
120 return -ENOSYS;
121}
122
123static inline int tegra_io_rail_power_on(int id)
124{
125 return -ENOSYS;
126}
127
128static inline int tegra_io_rail_power_off(int id)
129{
130 return -ENOSYS;
131}
132#endif
133
134#endif /* _MACH_TEGRA_POWERGATE_H_ */
diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
deleted file mode 100644
index 95f611d78f3a..000000000000
--- a/include/linux/tegra-soc.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __LINUX_TEGRA_SOC_H_
18#define __LINUX_TEGRA_SOC_H_
19
20u32 tegra_read_chipid(void);
21
22#endif /* __LINUX_TEGRA_SOC_H_ */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b84773cb9f4c..059052306831 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -12,6 +12,7 @@
12#include <linux/hrtimer.h> 12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h> 13#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h> 14#include <linux/cpumask.h>
15#include <linux/sched.h>
15 16
16#ifdef CONFIG_GENERIC_CLOCKEVENTS 17#ifdef CONFIG_GENERIC_CLOCKEVENTS
17 18
@@ -162,6 +163,7 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
162#ifdef CONFIG_NO_HZ_FULL 163#ifdef CONFIG_NO_HZ_FULL
163extern bool tick_nohz_full_running; 164extern bool tick_nohz_full_running;
164extern cpumask_var_t tick_nohz_full_mask; 165extern cpumask_var_t tick_nohz_full_mask;
166extern cpumask_var_t housekeeping_mask;
165 167
166static inline bool tick_nohz_full_enabled(void) 168static inline bool tick_nohz_full_enabled(void)
167{ 169{
@@ -181,7 +183,13 @@ static inline bool tick_nohz_full_cpu(int cpu)
181 183
182extern void tick_nohz_init(void); 184extern void tick_nohz_init(void);
183extern void __tick_nohz_full_check(void); 185extern void __tick_nohz_full_check(void);
184extern void tick_nohz_full_kick(void); 186extern void tick_nohz_full_kick_cpu(int cpu);
187
188static inline void tick_nohz_full_kick(void)
189{
190 tick_nohz_full_kick_cpu(smp_processor_id());
191}
192
185extern void tick_nohz_full_kick_all(void); 193extern void tick_nohz_full_kick_all(void);
186extern void __tick_nohz_task_switch(struct task_struct *tsk); 194extern void __tick_nohz_task_switch(struct task_struct *tsk);
187#else 195#else
@@ -189,11 +197,30 @@ static inline void tick_nohz_init(void) { }
189static inline bool tick_nohz_full_enabled(void) { return false; } 197static inline bool tick_nohz_full_enabled(void) { return false; }
190static inline bool tick_nohz_full_cpu(int cpu) { return false; } 198static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void __tick_nohz_full_check(void) { } 199static inline void __tick_nohz_full_check(void) { }
200static inline void tick_nohz_full_kick_cpu(int cpu) { }
192static inline void tick_nohz_full_kick(void) { } 201static inline void tick_nohz_full_kick(void) { }
193static inline void tick_nohz_full_kick_all(void) { } 202static inline void tick_nohz_full_kick_all(void) { }
194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { } 203static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
195#endif 204#endif
196 205
206static inline bool is_housekeeping_cpu(int cpu)
207{
208#ifdef CONFIG_NO_HZ_FULL
209 if (tick_nohz_full_enabled())
210 return cpumask_test_cpu(cpu, housekeeping_mask);
211#endif
212 return true;
213}
214
215static inline void housekeeping_affine(struct task_struct *t)
216{
217#ifdef CONFIG_NO_HZ_FULL
218 if (tick_nohz_full_enabled())
219 set_cpus_allowed_ptr(t, housekeeping_mask);
220
221#endif
222}
223
197static inline void tick_nohz_full_check(void) 224static inline void tick_nohz_full_check(void)
198{ 225{
199 if (tick_nohz_full_enabled()) 226 if (tick_nohz_full_enabled())
diff --git a/include/linux/time.h b/include/linux/time.h
index d5d229b2e5af..8c42cf8d2444 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -4,19 +4,10 @@
4# include <linux/cache.h> 4# include <linux/cache.h>
5# include <linux/seqlock.h> 5# include <linux/seqlock.h>
6# include <linux/math64.h> 6# include <linux/math64.h>
7#include <uapi/linux/time.h> 7# include <linux/time64.h>
8 8
9extern struct timezone sys_tz; 9extern struct timezone sys_tz;
10 10
11/* Parameters used to convert the timespec values: */
12#define MSEC_PER_SEC 1000L
13#define USEC_PER_MSEC 1000L
14#define NSEC_PER_USEC 1000L
15#define NSEC_PER_MSEC 1000000L
16#define USEC_PER_SEC 1000000L
17#define NSEC_PER_SEC 1000000000L
18#define FSEC_PER_SEC 1000000000000000LL
19
20#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) 11#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
21 12
22static inline int timespec_equal(const struct timespec *a, 13static inline int timespec_equal(const struct timespec *a,
@@ -84,13 +75,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
84 return ts_delta; 75 return ts_delta;
85} 76}
86 77
87#define KTIME_MAX ((s64)~((u64)1 << 63))
88#if (BITS_PER_LONG == 64)
89# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
90#else
91# define KTIME_SEC_MAX LONG_MAX
92#endif
93
94/* 78/*
95 * Returns true if the timespec is norm, false if denorm: 79 * Returns true if the timespec is norm, false if denorm:
96 */ 80 */
@@ -115,27 +99,7 @@ static inline bool timespec_valid_strict(const struct timespec *ts)
115 return true; 99 return true;
116} 100}
117 101
118extern bool persistent_clock_exist; 102extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
119
120static inline bool has_persistent_clock(void)
121{
122 return persistent_clock_exist;
123}
124
125extern void read_persistent_clock(struct timespec *ts);
126extern void read_boot_clock(struct timespec *ts);
127extern int persistent_clock_is_local;
128extern int update_persistent_clock(struct timespec now);
129void timekeeping_init(void);
130extern int timekeeping_suspended;
131
132unsigned long get_seconds(void);
133struct timespec current_kernel_time(void);
134struct timespec __current_kernel_time(void); /* does not take xtime_lock */
135struct timespec get_monotonic_coarse(void);
136void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
137 struct timespec *wtom, struct timespec *sleep);
138void timekeeping_inject_sleeptime(struct timespec *delta);
139 103
140#define CURRENT_TIME (current_kernel_time()) 104#define CURRENT_TIME (current_kernel_time())
141#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) 105#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
@@ -153,33 +117,14 @@ void timekeeping_inject_sleeptime(struct timespec *delta);
153extern u32 (*arch_gettimeoffset)(void); 117extern u32 (*arch_gettimeoffset)(void);
154#endif 118#endif
155 119
156extern void do_gettimeofday(struct timeval *tv);
157extern int do_settimeofday(const struct timespec *tv);
158extern int do_sys_settimeofday(const struct timespec *tv,
159 const struct timezone *tz);
160#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
161extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
162struct itimerval; 120struct itimerval;
163extern int do_setitimer(int which, struct itimerval *value, 121extern int do_setitimer(int which, struct itimerval *value,
164 struct itimerval *ovalue); 122 struct itimerval *ovalue);
165extern unsigned int alarm_setitimer(unsigned int seconds);
166extern int do_getitimer(int which, struct itimerval *value); 123extern int do_getitimer(int which, struct itimerval *value);
167extern int __getnstimeofday(struct timespec *tv);
168extern void getnstimeofday(struct timespec *tv);
169extern void getrawmonotonic(struct timespec *ts);
170extern void getnstime_raw_and_real(struct timespec *ts_raw,
171 struct timespec *ts_real);
172extern void getboottime(struct timespec *ts);
173extern void monotonic_to_bootbased(struct timespec *ts);
174extern void get_monotonic_boottime(struct timespec *ts);
175 124
176extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 125extern unsigned int alarm_setitimer(unsigned int seconds);
177extern int timekeeping_valid_for_hres(void); 126
178extern u64 timekeeping_max_deferment(void); 127extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
179extern int timekeeping_inject_offset(struct timespec *ts);
180extern s32 timekeeping_get_tai_offset(void);
181extern void timekeeping_set_tai_offset(s32 tai_offset);
182extern void timekeeping_clocktai(struct timespec *ts);
183 128
184struct tms; 129struct tms;
185extern void do_sys_times(struct tms *); 130extern void do_sys_times(struct tms *);
diff --git a/include/linux/time64.h b/include/linux/time64.h
new file mode 100644
index 000000000000..a3831478d9cf
--- /dev/null
+++ b/include/linux/time64.h
@@ -0,0 +1,190 @@
1#ifndef _LINUX_TIME64_H
2#define _LINUX_TIME64_H
3
4#include <uapi/linux/time.h>
5
6typedef __s64 time64_t;
7
8/*
9 * This wants to go into uapi/linux/time.h once we agreed about the
10 * userspace interfaces.
11 */
12#if __BITS_PER_LONG == 64
13# define timespec64 timespec
14#else
15struct timespec64 {
16 time64_t tv_sec; /* seconds */
17 long tv_nsec; /* nanoseconds */
18};
19#endif
20
21/* Parameters used to convert the timespec values: */
22#define MSEC_PER_SEC 1000L
23#define USEC_PER_MSEC 1000L
24#define NSEC_PER_USEC 1000L
25#define NSEC_PER_MSEC 1000000L
26#define USEC_PER_SEC 1000000L
27#define NSEC_PER_SEC 1000000000L
28#define FSEC_PER_SEC 1000000000000000LL
29
30/* Located here for timespec[64]_valid_strict */
31#define KTIME_MAX ((s64)~((u64)1 << 63))
32#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
33
34#if __BITS_PER_LONG == 64
35
36static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
37{
38 return ts64;
39}
40
41static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
42{
43 return ts;
44}
45
46# define timespec64_equal timespec_equal
47# define timespec64_compare timespec_compare
48# define set_normalized_timespec64 set_normalized_timespec
49# define timespec64_add_safe timespec_add_safe
50# define timespec64_add timespec_add
51# define timespec64_sub timespec_sub
52# define timespec64_valid timespec_valid
53# define timespec64_valid_strict timespec_valid_strict
54# define timespec64_to_ns timespec_to_ns
55# define ns_to_timespec64 ns_to_timespec
56# define timespec64_add_ns timespec_add_ns
57
58#else
59
60static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
61{
62 struct timespec ret;
63
64 ret.tv_sec = (time_t)ts64.tv_sec;
65 ret.tv_nsec = ts64.tv_nsec;
66 return ret;
67}
68
69static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
70{
71 struct timespec64 ret;
72
73 ret.tv_sec = ts.tv_sec;
74 ret.tv_nsec = ts.tv_nsec;
75 return ret;
76}
77
78static inline int timespec64_equal(const struct timespec64 *a,
79 const struct timespec64 *b)
80{
81 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
82}
83
84/*
85 * lhs < rhs: return <0
86 * lhs == rhs: return 0
87 * lhs > rhs: return >0
88 */
89static inline int timespec64_compare(const struct timespec64 *lhs, const struct timespec64 *rhs)
90{
91 if (lhs->tv_sec < rhs->tv_sec)
92 return -1;
93 if (lhs->tv_sec > rhs->tv_sec)
94 return 1;
95 return lhs->tv_nsec - rhs->tv_nsec;
96}
97
98extern void set_normalized_timespec64(struct timespec64 *ts, time64_t sec, s64 nsec);
99
100/*
101 * timespec64_add_safe assumes both values are positive and checks for
102 * overflow. It will return TIME_T_MAX if the returned value would be
103 * smaller then either of the arguments.
104 */
105extern struct timespec64 timespec64_add_safe(const struct timespec64 lhs,
106 const struct timespec64 rhs);
107
108
109static inline struct timespec64 timespec64_add(struct timespec64 lhs,
110 struct timespec64 rhs)
111{
112 struct timespec64 ts_delta;
113 set_normalized_timespec64(&ts_delta, lhs.tv_sec + rhs.tv_sec,
114 lhs.tv_nsec + rhs.tv_nsec);
115 return ts_delta;
116}
117
118/*
119 * sub = lhs - rhs, in normalized form
120 */
121static inline struct timespec64 timespec64_sub(struct timespec64 lhs,
122 struct timespec64 rhs)
123{
124 struct timespec64 ts_delta;
125 set_normalized_timespec64(&ts_delta, lhs.tv_sec - rhs.tv_sec,
126 lhs.tv_nsec - rhs.tv_nsec);
127 return ts_delta;
128}
129
130/*
131 * Returns true if the timespec64 is norm, false if denorm:
132 */
133static inline bool timespec64_valid(const struct timespec64 *ts)
134{
135 /* Dates before 1970 are bogus */
136 if (ts->tv_sec < 0)
137 return false;
138 /* Can't have more nanoseconds then a second */
139 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC)
140 return false;
141 return true;
142}
143
144static inline bool timespec64_valid_strict(const struct timespec64 *ts)
145{
146 if (!timespec64_valid(ts))
147 return false;
148 /* Disallow values that could overflow ktime_t */
149 if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
150 return false;
151 return true;
152}
153
154/**
155 * timespec64_to_ns - Convert timespec64 to nanoseconds
156 * @ts: pointer to the timespec64 variable to be converted
157 *
158 * Returns the scalar nanosecond representation of the timespec64
159 * parameter.
160 */
161static inline s64 timespec64_to_ns(const struct timespec64 *ts)
162{
163 return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
164}
165
166/**
167 * ns_to_timespec64 - Convert nanoseconds to timespec64
168 * @nsec: the nanoseconds value to be converted
169 *
170 * Returns the timespec64 representation of the nsec parameter.
171 */
172extern struct timespec64 ns_to_timespec64(const s64 nsec);
173
174/**
175 * timespec64_add_ns - Adds nanoseconds to a timespec64
176 * @a: pointer to timespec64 to be incremented
177 * @ns: unsigned nanoseconds value to be added
178 *
179 * This must always be inlined because its used from the x86-64 vdso,
180 * which cannot call other kernel functions.
181 */
182static __always_inline void timespec64_add_ns(struct timespec64 *a, u64 ns)
183{
184 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
185 a->tv_nsec = ns;
186}
187
188#endif
189
190#endif /* _LINUX_TIME64_H */
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index c1825eb436ed..95640dcd1899 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -10,77 +10,100 @@
10#include <linux/jiffies.h> 10#include <linux/jiffies.h>
11#include <linux/time.h> 11#include <linux/time.h>
12 12
13/* Structure holding internal timekeeping values. */ 13/**
14struct timekeeper { 14 * struct tk_read_base - base structure for timekeeping readout
15 /* Current clocksource used for timekeeping. */ 15 * @clock: Current clocksource used for timekeeping.
16 * @read: Read function of @clock
17 * @mask: Bitmask for two's complement subtraction of non 64bit clocks
18 * @cycle_last: @clock cycle value at last update
19 * @mult: NTP adjusted multiplier for scaled math conversion
20 * @shift: Shift value for scaled math conversion
21 * @xtime_nsec: Shifted (fractional) nano seconds offset for readout
22 * @base_mono: ktime_t (nanoseconds) base time for readout
23 *
24 * This struct has size 56 byte on 64 bit. Together with a seqcount it
25 * occupies a single 64byte cache line.
26 *
27 * The struct is separate from struct timekeeper as it is also used
28 * for a fast NMI safe accessor to clock monotonic.
29 */
30struct tk_read_base {
16 struct clocksource *clock; 31 struct clocksource *clock;
17 /* NTP adjusted clock multiplier */ 32 cycle_t (*read)(struct clocksource *cs);
33 cycle_t mask;
34 cycle_t cycle_last;
18 u32 mult; 35 u32 mult;
19 /* The shift value of the current clocksource. */
20 u32 shift; 36 u32 shift;
21 /* Number of clock cycles in one NTP interval. */ 37 u64 xtime_nsec;
38 ktime_t base_mono;
39};
40
41/**
42 * struct timekeeper - Structure holding internal timekeeping values.
43 * @tkr: The readout base structure
44 * @xtime_sec: Current CLOCK_REALTIME time in seconds
45 * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset
46 * @offs_real: Offset clock monotonic -> clock realtime
47 * @offs_boot: Offset clock monotonic -> clock boottime
48 * @offs_tai: Offset clock monotonic -> clock tai
49 * @tai_offset: The current UTC to TAI offset in seconds
50 * @base_raw: Monotonic raw base time in ktime_t format
51 * @raw_time: Monotonic raw base time in timespec64 format
52 * @cycle_interval: Number of clock cycles in one NTP interval
53 * @xtime_interval: Number of clock shifted nano seconds in one NTP
54 * interval.
55 * @xtime_remainder: Shifted nano seconds left over when rounding
56 * @cycle_interval
57 * @raw_interval: Raw nano seconds accumulated per NTP interval.
58 * @ntp_error: Difference between accumulated time and NTP time in ntp
59 * shifted nano seconds.
60 * @ntp_error_shift: Shift conversion between clock shifted nano seconds and
61 * ntp shifted nano seconds.
62 *
63 * Note: For timespec(64) based interfaces wall_to_monotonic is what
64 * we need to add to xtime (or xtime corrected for sub jiffie times)
65 * to get to monotonic time. Monotonic is pegged at zero at system
66 * boot time, so wall_to_monotonic will be negative, however, we will
67 * ALWAYS keep the tv_nsec part positive so we can use the usual
68 * normalization.
69 *
70 * wall_to_monotonic is moved after resume from suspend for the
71 * monotonic time not to jump. We need to add total_sleep_time to
72 * wall_to_monotonic to get the real boot based time offset.
73 *
74 * wall_to_monotonic is no longer the boot time, getboottime must be
75 * used instead.
76 */
77struct timekeeper {
78 struct tk_read_base tkr;
79 u64 xtime_sec;
80 struct timespec64 wall_to_monotonic;
81 ktime_t offs_real;
82 ktime_t offs_boot;
83 ktime_t offs_tai;
84 s32 tai_offset;
85 ktime_t base_raw;
86 struct timespec64 raw_time;
87
88 /* The following members are for timekeeping internal use */
22 cycle_t cycle_interval; 89 cycle_t cycle_interval;
23 /* Last cycle value (also stored in clock->cycle_last) */
24 cycle_t cycle_last;
25 /* Number of clock shifted nano seconds in one NTP interval. */
26 u64 xtime_interval; 90 u64 xtime_interval;
27 /* shifted nano seconds left over when rounding cycle_interval */
28 s64 xtime_remainder; 91 s64 xtime_remainder;
29 /* Raw nano seconds accumulated per NTP interval. */
30 u32 raw_interval; 92 u32 raw_interval;
31 93 /* The ntp_tick_length() value currently being used.
32 /* Current CLOCK_REALTIME time in seconds */ 94 * This cached copy ensures we consistently apply the tick
33 u64 xtime_sec; 95 * length for an entire tick, as ntp_tick_length may change
34 /* Clock shifted nano seconds */ 96 * mid-tick, and we don't want to apply that new value to
35 u64 xtime_nsec; 97 * the tick in progress.
36 98 */
99 u64 ntp_tick;
37 /* Difference between accumulated time and NTP time in ntp 100 /* Difference between accumulated time and NTP time in ntp
38 * shifted nano seconds. */ 101 * shifted nano seconds. */
39 s64 ntp_error; 102 s64 ntp_error;
40 /* Shift conversion between clock shifted nano seconds and
41 * ntp shifted nano seconds. */
42 u32 ntp_error_shift; 103 u32 ntp_error_shift;
43 104 u32 ntp_err_mult;
44 /*
45 * wall_to_monotonic is what we need to add to xtime (or xtime corrected
46 * for sub jiffie times) to get to monotonic time. Monotonic is pegged
47 * at zero at system boot time, so wall_to_monotonic will be negative,
48 * however, we will ALWAYS keep the tv_nsec part positive so we can use
49 * the usual normalization.
50 *
51 * wall_to_monotonic is moved after resume from suspend for the
52 * monotonic time not to jump. We need to add total_sleep_time to
53 * wall_to_monotonic to get the real boot based time offset.
54 *
55 * - wall_to_monotonic is no longer the boot time, getboottime must be
56 * used instead.
57 */
58 struct timespec wall_to_monotonic;
59 /* Offset clock monotonic -> clock realtime */
60 ktime_t offs_real;
61 /* time spent in suspend */
62 struct timespec total_sleep_time;
63 /* Offset clock monotonic -> clock boottime */
64 ktime_t offs_boot;
65 /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
66 struct timespec raw_time;
67 /* The current UTC to TAI offset in seconds */
68 s32 tai_offset;
69 /* Offset clock monotonic -> clock tai */
70 ktime_t offs_tai;
71
72}; 105};
73 106
74static inline struct timespec tk_xtime(struct timekeeper *tk)
75{
76 struct timespec ts;
77
78 ts.tv_sec = tk->xtime_sec;
79 ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift);
80 return ts;
81}
82
83
84#ifdef CONFIG_GENERIC_TIME_VSYSCALL 107#ifdef CONFIG_GENERIC_TIME_VSYSCALL
85 108
86extern void update_vsyscall(struct timekeeper *tk); 109extern void update_vsyscall(struct timekeeper *tk);
@@ -89,17 +112,10 @@ extern void update_vsyscall_tz(void);
89#elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD) 112#elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD)
90 113
91extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm, 114extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm,
92 struct clocksource *c, u32 mult); 115 struct clocksource *c, u32 mult,
116 cycle_t cycle_last);
93extern void update_vsyscall_tz(void); 117extern void update_vsyscall_tz(void);
94 118
95static inline void update_vsyscall(struct timekeeper *tk)
96{
97 struct timespec xt;
98
99 xt = tk_xtime(tk);
100 update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult);
101}
102
103#else 119#else
104 120
105static inline void update_vsyscall(struct timekeeper *tk) 121static inline void update_vsyscall(struct timekeeper *tk)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
new file mode 100644
index 000000000000..1caa6b04fdc5
--- /dev/null
+++ b/include/linux/timekeeping.h
@@ -0,0 +1,209 @@
1#ifndef _LINUX_TIMEKEEPING_H
2#define _LINUX_TIMEKEEPING_H
3
4/* Included from linux/ktime.h */
5
6void timekeeping_init(void);
7extern int timekeeping_suspended;
8
9/*
10 * Get and set timeofday
11 */
12extern void do_gettimeofday(struct timeval *tv);
13extern int do_settimeofday(const struct timespec *tv);
14extern int do_sys_settimeofday(const struct timespec *tv,
15 const struct timezone *tz);
16
17/*
18 * Kernel time accessors
19 */
20unsigned long get_seconds(void);
21struct timespec current_kernel_time(void);
22/* does not take xtime_lock */
23struct timespec __current_kernel_time(void);
24
25/*
26 * timespec based interfaces
27 */
28struct timespec get_monotonic_coarse(void);
29extern void getrawmonotonic(struct timespec *ts);
30extern void ktime_get_ts64(struct timespec64 *ts);
31
32extern int __getnstimeofday64(struct timespec64 *tv);
33extern void getnstimeofday64(struct timespec64 *tv);
34
35#if BITS_PER_LONG == 64
36static inline int __getnstimeofday(struct timespec *ts)
37{
38 return __getnstimeofday64(ts);
39}
40
41static inline void getnstimeofday(struct timespec *ts)
42{
43 getnstimeofday64(ts);
44}
45
46static inline void ktime_get_ts(struct timespec *ts)
47{
48 ktime_get_ts64(ts);
49}
50
51static inline void ktime_get_real_ts(struct timespec *ts)
52{
53 getnstimeofday64(ts);
54}
55
56#else
57static inline int __getnstimeofday(struct timespec *ts)
58{
59 struct timespec64 ts64;
60 int ret = __getnstimeofday64(&ts64);
61
62 *ts = timespec64_to_timespec(ts64);
63 return ret;
64}
65
66static inline void getnstimeofday(struct timespec *ts)
67{
68 struct timespec64 ts64;
69
70 getnstimeofday64(&ts64);
71 *ts = timespec64_to_timespec(ts64);
72}
73
74static inline void ktime_get_ts(struct timespec *ts)
75{
76 struct timespec64 ts64;
77
78 ktime_get_ts64(&ts64);
79 *ts = timespec64_to_timespec(ts64);
80}
81
82static inline void ktime_get_real_ts(struct timespec *ts)
83{
84 struct timespec64 ts64;
85
86 getnstimeofday64(&ts64);
87 *ts = timespec64_to_timespec(ts64);
88}
89#endif
90
91extern void getboottime(struct timespec *ts);
92
93#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
94#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
95
96/*
97 * ktime_t based interfaces
98 */
99
100enum tk_offsets {
101 TK_OFFS_REAL,
102 TK_OFFS_BOOT,
103 TK_OFFS_TAI,
104 TK_OFFS_MAX,
105};
106
107extern ktime_t ktime_get(void);
108extern ktime_t ktime_get_with_offset(enum tk_offsets offs);
109extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs);
110extern ktime_t ktime_get_raw(void);
111
112/**
113 * ktime_get_real - get the real (wall-) time in ktime_t format
114 */
115static inline ktime_t ktime_get_real(void)
116{
117 return ktime_get_with_offset(TK_OFFS_REAL);
118}
119
120/**
121 * ktime_get_boottime - Returns monotonic time since boot in ktime_t format
122 *
123 * This is similar to CLOCK_MONTONIC/ktime_get, but also includes the
124 * time spent in suspend.
125 */
126static inline ktime_t ktime_get_boottime(void)
127{
128 return ktime_get_with_offset(TK_OFFS_BOOT);
129}
130
131/**
132 * ktime_get_clocktai - Returns the TAI time of day in ktime_t format
133 */
134static inline ktime_t ktime_get_clocktai(void)
135{
136 return ktime_get_with_offset(TK_OFFS_TAI);
137}
138
139/**
140 * ktime_mono_to_real - Convert monotonic time to clock realtime
141 */
142static inline ktime_t ktime_mono_to_real(ktime_t mono)
143{
144 return ktime_mono_to_any(mono, TK_OFFS_REAL);
145}
146
147static inline u64 ktime_get_ns(void)
148{
149 return ktime_to_ns(ktime_get());
150}
151
152static inline u64 ktime_get_real_ns(void)
153{
154 return ktime_to_ns(ktime_get_real());
155}
156
157static inline u64 ktime_get_boot_ns(void)
158{
159 return ktime_to_ns(ktime_get_boottime());
160}
161
162static inline u64 ktime_get_raw_ns(void)
163{
164 return ktime_to_ns(ktime_get_raw());
165}
166
167extern u64 ktime_get_mono_fast_ns(void);
168
169/*
170 * Timespec interfaces utilizing the ktime based ones
171 */
172static inline void get_monotonic_boottime(struct timespec *ts)
173{
174 *ts = ktime_to_timespec(ktime_get_boottime());
175}
176
177static inline void timekeeping_clocktai(struct timespec *ts)
178{
179 *ts = ktime_to_timespec(ktime_get_clocktai());
180}
181
182/*
183 * RTC specific
184 */
185extern void timekeeping_inject_sleeptime(struct timespec *delta);
186
187/*
188 * PPS accessor
189 */
190extern void getnstime_raw_and_real(struct timespec *ts_raw,
191 struct timespec *ts_real);
192
193/*
194 * Persistent clock related interfaces
195 */
196extern bool persistent_clock_exist;
197extern int persistent_clock_is_local;
198
199static inline bool has_persistent_clock(void)
200{
201 return persistent_clock_exist;
202}
203
204extern void read_persistent_clock(struct timespec *ts);
205extern void read_boot_clock(struct timespec *ts);
206extern int update_persistent_clock(struct timespec now);
207
208
209#endif
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
index d3b57fa12225..bd36ce431e32 100644
--- a/include/linux/timerfd.h
+++ b/include/linux/timerfd.h
@@ -11,6 +11,9 @@
11/* For O_CLOEXEC and O_NONBLOCK */ 11/* For O_CLOEXEC and O_NONBLOCK */
12#include <linux/fcntl.h> 12#include <linux/fcntl.h>
13 13
14/* For _IO helpers */
15#include <linux/ioctl.h>
16
14/* 17/*
15 * CAREFUL: Check include/asm-generic/fcntl.h when defining 18 * CAREFUL: Check include/asm-generic/fcntl.h when defining
16 * new flags, since they might collide with O_* ones. We want 19 * new flags, since they might collide with O_* ones. We want
@@ -29,4 +32,6 @@
29/* Flags for timerfd_settime. */ 32/* Flags for timerfd_settime. */
30#define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET) 33#define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)
31 34
35#define TFD_IOC_SET_TICKS _IOW('T', 0, u64)
36
32#endif /* _LINUX_TIMERFD_H */ 37#endif /* _LINUX_TIMERFD_H */
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index fff1d0976f80..8350c538b486 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -39,6 +39,9 @@ struct tpm_class_ops {
39 int (*send) (struct tpm_chip *chip, u8 *buf, size_t len); 39 int (*send) (struct tpm_chip *chip, u8 *buf, size_t len);
40 void (*cancel) (struct tpm_chip *chip); 40 void (*cancel) (struct tpm_chip *chip);
41 u8 (*status) (struct tpm_chip *chip); 41 u8 (*status) (struct tpm_chip *chip);
42 bool (*update_timeouts)(struct tpm_chip *chip,
43 unsigned long *timeout_cap);
44
42}; 45};
43 46
44#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) 47#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE)
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index 136116924d8d..ea6c9dea79e3 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -25,6 +25,21 @@ trace_seq_init(struct trace_seq *s)
25 s->full = 0; 25 s->full = 0;
26} 26}
27 27
28/**
29 * trace_seq_buffer_ptr - return pointer to next location in buffer
30 * @s: trace sequence descriptor
31 *
32 * Returns the pointer to the buffer where the next write to
33 * the buffer will happen. This is useful to save the location
34 * that is about to be written to and then return the result
35 * of that write.
36 */
37static inline unsigned char *
38trace_seq_buffer_ptr(struct trace_seq *s)
39{
40 return s->buffer + s->len;
41}
42
28/* 43/*
29 * Currently only defined when tracing is enabled. 44 * Currently only defined when tracing is enabled.
30 */ 45 */
@@ -36,14 +51,13 @@ int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
36extern int 51extern int
37trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); 52trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
38extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); 53extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
39extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, 54extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
40 size_t cnt); 55 int cnt);
41extern int trace_seq_puts(struct trace_seq *s, const char *str); 56extern int trace_seq_puts(struct trace_seq *s, const char *str);
42extern int trace_seq_putc(struct trace_seq *s, unsigned char c); 57extern int trace_seq_putc(struct trace_seq *s, unsigned char c);
43extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len); 58extern int trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len);
44extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 59extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
45 size_t len); 60 unsigned int len);
46extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
47extern int trace_seq_path(struct trace_seq *s, const struct path *path); 61extern int trace_seq_path(struct trace_seq *s, const struct path *path);
48 62
49extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, 63extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
@@ -71,8 +85,8 @@ static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
71{ 85{
72 return 0; 86 return 0;
73} 87}
74static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, 88static inline int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
75 size_t cnt) 89 int cnt)
76{ 90{
77 return 0; 91 return 0;
78} 92}
@@ -85,19 +99,15 @@ static inline int trace_seq_putc(struct trace_seq *s, unsigned char c)
85 return 0; 99 return 0;
86} 100}
87static inline int 101static inline int
88trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len) 102trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len)
89{ 103{
90 return 0; 104 return 0;
91} 105}
92static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 106static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
93 size_t len) 107 unsigned int len)
94{ 108{
95 return 0; 109 return 0;
96} 110}
97static inline void *trace_seq_reserve(struct trace_seq *s, size_t len)
98{
99 return NULL;
100}
101static inline int trace_seq_path(struct trace_seq *s, const struct path *path) 111static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
102{ 112{
103 return 0; 113 return 0;
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6f8ab7da27c4..84d497297c5f 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -133,10 +133,6 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
133 133
134/** 134/**
135 * tracehook_signal_handler - signal handler setup is complete 135 * tracehook_signal_handler - signal handler setup is complete
136 * @sig: number of signal being delivered
137 * @info: siginfo_t of signal being delivered
138 * @ka: sigaction setting that chose the handler
139 * @regs: user register state
140 * @stepping: nonzero if debugger single-step or block-step in use 136 * @stepping: nonzero if debugger single-step or block-step in use
141 * 137 *
142 * Called by the arch code after a signal handler has been set up. 138 * Called by the arch code after a signal handler has been set up.
@@ -146,9 +142,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
146 * Called without locks, shortly before returning to user mode 142 * Called without locks, shortly before returning to user mode
147 * (or handling more signals). 143 * (or handling more signals).
148 */ 144 */
149static inline void tracehook_signal_handler(int sig, siginfo_t *info, 145static inline void tracehook_signal_handler(int stepping)
150 const struct k_sigaction *ka,
151 struct pt_regs *regs, int stepping)
152{ 146{
153 if (stepping) 147 if (stepping)
154 ptrace_notify(SIGTRAP); 148 ptrace_notify(SIGTRAP);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1c3316a47d7e..84132942902a 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -477,13 +477,11 @@ extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
477 unsigned int cmd, unsigned long arg); 477 unsigned int cmd, unsigned long arg);
478extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 478extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
479extern void tty_default_fops(struct file_operations *fops); 479extern void tty_default_fops(struct file_operations *fops);
480extern struct tty_struct *alloc_tty_struct(void); 480extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx);
481extern int tty_alloc_file(struct file *file); 481extern int tty_alloc_file(struct file *file);
482extern void tty_add_file(struct tty_struct *tty, struct file *file); 482extern void tty_add_file(struct tty_struct *tty, struct file *file);
483extern void tty_free_file(struct file *file); 483extern void tty_free_file(struct file *file);
484extern void free_tty_struct(struct tty_struct *tty); 484extern void free_tty_struct(struct tty_struct *tty);
485extern void initialize_tty_struct(struct tty_struct *tty,
486 struct tty_driver *driver, int idx);
487extern void deinitialize_tty_struct(struct tty_struct *tty); 485extern void deinitialize_tty_struct(struct tty_struct *tty);
488extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); 486extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
489extern int tty_release(struct inode *inode, struct file *filp); 487extern int tty_release(struct inode *inode, struct file *filp);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 756a60989294..e48c608a8fa8 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -35,14 +35,14 @@
35 * This routine is mandatory; if this routine is not filled in, 35 * This routine is mandatory; if this routine is not filled in,
36 * the attempted open will fail with ENODEV. 36 * the attempted open will fail with ENODEV.
37 * 37 *
38 * Required method. 38 * Required method. Called with tty lock held.
39 * 39 *
40 * void (*close)(struct tty_struct * tty, struct file * filp); 40 * void (*close)(struct tty_struct * tty, struct file * filp);
41 * 41 *
42 * This routine is called when a particular tty device is closed. 42 * This routine is called when a particular tty device is closed.
43 * Note: called even if the corresponding open() failed. 43 * Note: called even if the corresponding open() failed.
44 * 44 *
45 * Required method. 45 * Required method. Called with tty lock held.
46 * 46 *
47 * void (*shutdown)(struct tty_struct * tty); 47 * void (*shutdown)(struct tty_struct * tty);
48 * 48 *
@@ -172,6 +172,8 @@
172 * 172 *
173 * Optional: 173 * Optional:
174 * 174 *
175 * Called with tty lock held.
176 *
175 * int (*break_ctl)(struct tty_struct *tty, int state); 177 * int (*break_ctl)(struct tty_struct *tty, int state);
176 * 178 *
177 * This optional routine requests the tty driver to turn on or 179 * This optional routine requests the tty driver to turn on or
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 7373203140e7..c330f5ef42cf 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -386,6 +386,21 @@ struct usb_composite_driver {
386 386
387extern int usb_composite_probe(struct usb_composite_driver *driver); 387extern int usb_composite_probe(struct usb_composite_driver *driver);
388extern void usb_composite_unregister(struct usb_composite_driver *driver); 388extern void usb_composite_unregister(struct usb_composite_driver *driver);
389
390/**
391 * module_usb_composite_driver() - Helper macro for registering a USB gadget
392 * composite driver
393 * @__usb_composite_driver: usb_composite_driver struct
394 *
395 * Helper macro for USB gadget composite drivers which do not do anything
396 * special in module init/exit. This eliminates a lot of boilerplate. Each
397 * module may only use this macro once, and calling it replaces module_init()
398 * and module_exit()
399 */
400#define module_usb_composite_driver(__usb_composite_driver) \
401 module_driver(__usb_composite_driver, usb_composite_probe, \
402 usb_composite_unregister)
403
389extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); 404extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
390extern int composite_dev_prepare(struct usb_composite_driver *composite, 405extern int composite_dev_prepare(struct usb_composite_driver *composite,
391 struct usb_composite_dev *cdev); 406 struct usb_composite_dev *cdev);
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 52f944dfe2fd..55a17b188daa 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -30,4 +30,15 @@
30 descriptor */ 30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040 31#define USB_QUIRK_DELAY_INIT 0x00000040
32 32
33/*
34 * For high speed and super speed interupt endpoints, the USB 2.0 and
35 * USB 3.0 spec require the interval in microframes
36 * (1 microframe = 125 microseconds) to be calculated as
37 * interval = 2 ^ (bInterval-1).
38 *
39 * Devices with this quirk report their bInterval as the result of this
40 * calculation instead of the exponent variable used in the calculation.
41 */
42#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL 0x00000080
43
33#endif /* __LINUX_USB_QUIRKS_H */ 44#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index e452ba6ec6bd..d5952bb66752 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -153,6 +153,9 @@ struct renesas_usbhs_driver_param {
153 */ 153 */
154 int pio_dma_border; /* default is 64byte */ 154 int pio_dma_border; /* default is 64byte */
155 155
156 u32 type;
157 u32 enable_gpio;
158
156 /* 159 /*
157 * option: 160 * option:
158 */ 161 */
@@ -160,6 +163,9 @@ struct renesas_usbhs_driver_param {
160 u32 has_sudmac:1; /* for SUDMAC */ 163 u32 has_sudmac:1; /* for SUDMAC */
161}; 164};
162 165
166#define USBHS_TYPE_R8A7790 1
167#define USBHS_TYPE_R8A7791 2
168
163/* 169/*
164 * option: 170 * option:
165 * 171 *
diff --git a/include/linux/usb/usb338x.h b/include/linux/usb/usb338x.h
new file mode 100644
index 000000000000..f92eb635b9d3
--- /dev/null
+++ b/include/linux/usb/usb338x.h
@@ -0,0 +1,199 @@
1/*
2 * USB 338x super/high/full speed USB device controller.
3 * Unlike many such controllers, this one talks PCI.
4 *
5 * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
6 * Copyright (C) 2003 David Brownell
7 * Copyright (C) 2014 Ricardo Ribalda - Qtechnology/AS
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 as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20
21#ifndef __LINUX_USB_USB338X_H
22#define __LINUX_USB_USB338X_H
23
24#include <linux/usb/net2280.h>
25
26/*
27 * Extra defined bits for net2280 registers
28 */
29#define SCRATCH 0x0b
30
31#define DEFECT7374_FSM_FIELD 28
32#define SUPER_SPEED 8
33#define DMA_REQUEST_OUTSTANDING 5
34#define DMA_PAUSE_DONE_INTERRUPT 26
35#define SET_ISOCHRONOUS_DELAY 24
36#define SET_SEL 22
37#define SUPER_SPEED_MODE 8
38
39/*ep_cfg*/
40#define MAX_BURST_SIZE 24
41#define EP_FIFO_BYTE_COUNT 16
42#define IN_ENDPOINT_ENABLE 14
43#define IN_ENDPOINT_TYPE 12
44#define OUT_ENDPOINT_ENABLE 10
45#define OUT_ENDPOINT_TYPE 8
46
47struct usb338x_usb_ext_regs {
48 u32 usbclass;
49#define DEVICE_PROTOCOL 16
50#define DEVICE_SUB_CLASS 8
51#define DEVICE_CLASS 0
52 u32 ss_sel;
53#define U2_SYSTEM_EXIT_LATENCY 8
54#define U1_SYSTEM_EXIT_LATENCY 0
55 u32 ss_del;
56#define U2_DEVICE_EXIT_LATENCY 8
57#define U1_DEVICE_EXIT_LATENCY 0
58 u32 usb2lpm;
59#define USB_L1_LPM_HIRD 2
60#define USB_L1_LPM_REMOTE_WAKE 1
61#define USB_L1_LPM_SUPPORT 0
62 u32 usb3belt;
63#define BELT_MULTIPLIER 10
64#define BEST_EFFORT_LATENCY_TOLERANCE 0
65 u32 usbctl2;
66#define LTM_ENABLE 7
67#define U2_ENABLE 6
68#define U1_ENABLE 5
69#define FUNCTION_SUSPEND 4
70#define USB3_CORE_ENABLE 3
71#define USB2_CORE_ENABLE 2
72#define SERIAL_NUMBER_STRING_ENABLE 0
73 u32 in_timeout;
74#define GPEP3_TIMEOUT 19
75#define GPEP2_TIMEOUT 18
76#define GPEP1_TIMEOUT 17
77#define GPEP0_TIMEOUT 16
78#define GPEP3_TIMEOUT_VALUE 13
79#define GPEP3_TIMEOUT_ENABLE 12
80#define GPEP2_TIMEOUT_VALUE 9
81#define GPEP2_TIMEOUT_ENABLE 8
82#define GPEP1_TIMEOUT_VALUE 5
83#define GPEP1_TIMEOUT_ENABLE 4
84#define GPEP0_TIMEOUT_VALUE 1
85#define GPEP0_TIMEOUT_ENABLE 0
86 u32 isodelay;
87#define ISOCHRONOUS_DELAY 0
88} __packed;
89
90struct usb338x_fifo_regs {
91 /* offset 0x0500, 0x0520, 0x0540, 0x0560, 0x0580 */
92 u32 ep_fifo_size_base;
93#define IN_FIFO_BASE_ADDRESS 22
94#define IN_FIFO_SIZE 16
95#define OUT_FIFO_BASE_ADDRESS 6
96#define OUT_FIFO_SIZE 0
97 u32 ep_fifo_out_wrptr;
98 u32 ep_fifo_out_rdptr;
99 u32 ep_fifo_in_wrptr;
100 u32 ep_fifo_in_rdptr;
101 u32 unused[3];
102} __packed;
103
104
105/* Link layer */
106struct usb338x_ll_regs {
107 /* offset 0x700 */
108 u32 ll_ltssm_ctrl1;
109 u32 ll_ltssm_ctrl2;
110 u32 ll_ltssm_ctrl3;
111 u32 unused[2];
112 u32 ll_general_ctrl0;
113 u32 ll_general_ctrl1;
114#define PM_U3_AUTO_EXIT 29
115#define PM_U2_AUTO_EXIT 28
116#define PM_U1_AUTO_EXIT 27
117#define PM_FORCE_U2_ENTRY 26
118#define PM_FORCE_U1_ENTRY 25
119#define PM_LGO_COLLISION_SEND_LAU 24
120#define PM_DIR_LINK_REJECT 23
121#define PM_FORCE_LINK_ACCEPT 22
122#define PM_DIR_ENTRY_U3 20
123#define PM_DIR_ENTRY_U2 19
124#define PM_DIR_ENTRY_U1 18
125#define PM_U2_ENABLE 17
126#define PM_U1_ENABLE 16
127#define SKP_THRESHOLD_ADJUST_FMW 8
128#define RESEND_DPP_ON_LRTY_FMW 7
129#define DL_BIT_VALUE_FMW 6
130#define FORCE_DL_BIT 5
131 u32 ll_general_ctrl2;
132#define SELECT_INVERT_LANE_POLARITY 7
133#define FORCE_INVERT_LANE_POLARITY 6
134 u32 ll_general_ctrl3;
135 u32 ll_general_ctrl4;
136 u32 ll_error_gen;
137} __packed;
138
139struct usb338x_ll_lfps_regs {
140 /* offset 0x748 */
141 u32 ll_lfps_5;
142#define TIMER_LFPS_6US 16
143 u32 ll_lfps_6;
144#define TIMER_LFPS_80US 0
145} __packed;
146
147struct usb338x_ll_tsn_regs {
148 /* offset 0x77C */
149 u32 ll_tsn_counters_2;
150#define HOT_TX_NORESET_TS2 24
151 u32 ll_tsn_counters_3;
152#define HOT_RX_RESET_TS2 0
153} __packed;
154
155struct usb338x_ll_chi_regs {
156 /* offset 0x79C */
157 u32 ll_tsn_chicken_bit;
158#define RECOVERY_IDLE_TO_RECOVER_FMW 3
159} __packed;
160
161/* protocol layer */
162struct usb338x_pl_regs {
163 /* offset 0x800 */
164 u32 pl_reg_1;
165 u32 pl_reg_2;
166 u32 pl_reg_3;
167 u32 pl_reg_4;
168 u32 pl_ep_ctrl;
169 /* Protocol Layer Endpoint Control*/
170#define PL_EP_CTRL 0x810
171#define ENDPOINT_SELECT 0
172 /* [4:0] */
173#define EP_INITIALIZED 16
174#define SEQUENCE_NUMBER_RESET 17
175#define CLEAR_ACK_ERROR_CODE 20
176 u32 pl_reg_6;
177 u32 pl_reg_7;
178 u32 pl_reg_8;
179 u32 pl_ep_status_1;
180 /* Protocol Layer Endpoint Status 1*/
181#define PL_EP_STATUS_1 0x820
182#define STATE 16
183#define ACK_GOOD_NORMAL 0x11
184#define ACK_GOOD_MORE_ACKS_TO_COME 0x16
185 u32 pl_ep_status_2;
186 u32 pl_ep_status_3;
187 /* Protocol Layer Endpoint Status 3*/
188#define PL_EP_STATUS_3 0x828
189#define SEQUENCE_NUMBER 0
190 u32 pl_ep_status_4;
191 /* Protocol Layer Endpoint Status 4*/
192#define PL_EP_STATUS_4 0x82c
193 u32 pl_ep_cfg_4;
194 /* Protocol Layer Endpoint Configuration 4*/
195#define PL_EP_CFG_4 0x830
196#define NON_CTRL_IN_TOLERATE_BAD_DIR 6
197} __packed;
198
199#endif /* __LINUX_USB_USB338X_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 0662e98fef72..26088feb6608 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -148,6 +148,9 @@ struct driver_info {
148 struct sk_buff *(*tx_fixup)(struct usbnet *dev, 148 struct sk_buff *(*tx_fixup)(struct usbnet *dev,
149 struct sk_buff *skb, gfp_t flags); 149 struct sk_buff *skb, gfp_t flags);
150 150
151 /* recover from timeout */
152 void (*recover)(struct usbnet *dev);
153
151 /* early initialization code, can sleep. This is for minidrivers 154 /* early initialization code, can sleep. This is for minidrivers
152 * having 'subminidrivers' that need to do extra initialization 155 * having 'subminidrivers' that need to do extra initialization
153 * right after minidriver have initialized hardware. */ 156 * right after minidriver have initialized hardware. */
diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h
new file mode 100644
index 000000000000..376654b5b0f7
--- /dev/null
+++ b/include/linux/usb/xhci_pdriver.h
@@ -0,0 +1,27 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful, but
7 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9 * for more details.
10 *
11 */
12
13#ifndef __USB_CORE_XHCI_PDRIVER_H
14#define __USB_CORE_XHCI_PDRIVER_H
15
16/**
17 * struct usb_xhci_pdata - platform_data for generic xhci platform driver
18 *
19 * @usb3_lpm_capable: determines if this xhci platform supports USB3
20 * LPM capability
21 *
22 */
23struct usb_xhci_pdata {
24 unsigned usb3_lpm_capable:1;
25};
26
27#endif /* __USB_CORE_XHCI_PDRIVER_H */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 4836ba3c1cd8..e95372654f09 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -57,9 +57,9 @@ static inline void put_user_ns(struct user_namespace *ns)
57} 57}
58 58
59struct seq_operations; 59struct seq_operations;
60extern struct seq_operations proc_uid_seq_operations; 60extern const struct seq_operations proc_uid_seq_operations;
61extern struct seq_operations proc_gid_seq_operations; 61extern const struct seq_operations proc_gid_seq_operations;
62extern struct seq_operations proc_projid_seq_operations; 62extern const struct seq_operations proc_projid_seq_operations;
63extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *); 63extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
64extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *); 64extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
65extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *); 65extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *);
diff --git a/include/linux/verify_pefile.h b/include/linux/verify_pefile.h
new file mode 100644
index 000000000000..ac34819214f9
--- /dev/null
+++ b/include/linux/verify_pefile.h
@@ -0,0 +1,18 @@
1/* Signed PE file verification
2 *
3 * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_VERIFY_PEFILE_H
13#define _LINUX_VERIFY_PEFILE_H
14
15extern int verify_pefile_signature(const void *pebuf, unsigned pelen,
16 struct key *trusted_keyring, bool *_trusted);
17
18#endif /* _LINUX_VERIFY_PEFILE_H */
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 8ec980b5e3af..25a0fbd4b998 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -98,4 +98,27 @@ extern int vfio_external_user_iommu_id(struct vfio_group *group);
98extern long vfio_external_check_extension(struct vfio_group *group, 98extern long vfio_external_check_extension(struct vfio_group *group,
99 unsigned long arg); 99 unsigned long arg);
100 100
101#ifdef CONFIG_EEH
102extern int vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
103extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
104extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
105 unsigned int cmd,
106 unsigned long arg);
107#else
108static inline int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
109{
110 return 0;
111}
112
113static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
114{
115}
116
117static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
118 unsigned int cmd,
119 unsigned long arg)
120{
121 return -ENOTTY;
122}
123#endif /* CONFIG_EEH */
101#endif /* VFIO_H */ 124#endif /* VFIO_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4b8a89189a29..b87696fdf06a 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -113,7 +113,7 @@ extern struct vm_struct *remove_vm_area(const void *addr);
113extern struct vm_struct *find_vm_area(const void *addr); 113extern struct vm_struct *find_vm_area(const void *addr);
114 114
115extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 115extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
116 struct page ***pages); 116 struct page **pages);
117#ifdef CONFIG_MMU 117#ifdef CONFIG_MMU
118extern int map_kernel_range_noflush(unsigned long start, unsigned long size, 118extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
119 pgprot_t prot, struct page **pages); 119 pgprot_t prot, struct page **pages);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index bd68819f0815..6fb1ba5f9b2f 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -25,6 +25,7 @@ struct wait_bit_key {
25 void *flags; 25 void *flags;
26 int bit_nr; 26 int bit_nr;
27#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
28 unsigned long private;
28}; 29};
29 30
30struct wait_bit_queue { 31struct wait_bit_queue {
@@ -141,18 +142,19 @@ __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old)
141 list_del(&old->task_list); 142 list_del(&old->task_list);
142} 143}
143 144
145typedef int wait_bit_action_f(struct wait_bit_key *);
144void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 146void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
145void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 147void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
146void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 148void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); 149void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr);
148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 150void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
149void __wake_up_bit(wait_queue_head_t *, void *, int); 151void __wake_up_bit(wait_queue_head_t *, void *, int);
150int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 152int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_action_f *, unsigned);
151int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 153int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_action_f *, unsigned);
152void wake_up_bit(void *, int); 154void wake_up_bit(void *, int);
153void wake_up_atomic_t(atomic_t *); 155void wake_up_atomic_t(atomic_t *);
154int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned); 156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned);
155int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned); 157int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned);
156int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned); 158int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
157wait_queue_head_t *bit_waitqueue(void *, int); 159wait_queue_head_t *bit_waitqueue(void *, int);
158 160
@@ -854,11 +856,14 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
854 (wait)->flags = 0; \ 856 (wait)->flags = 0; \
855 } while (0) 857 } while (0)
856 858
859
860extern int bit_wait(struct wait_bit_key *);
861extern int bit_wait_io(struct wait_bit_key *);
862
857/** 863/**
858 * wait_on_bit - wait for a bit to be cleared 864 * wait_on_bit - wait for a bit to be cleared
859 * @word: the word being waited on, a kernel virtual address 865 * @word: the word being waited on, a kernel virtual address
860 * @bit: the bit of the word being waited on 866 * @bit: the bit of the word being waited on
861 * @action: the function used to sleep, which may take special actions
862 * @mode: the task state to sleep in 867 * @mode: the task state to sleep in
863 * 868 *
864 * There is a standard hashed waitqueue table for generic use. This 869 * There is a standard hashed waitqueue table for generic use. This
@@ -867,9 +872,62 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
867 * call wait_on_bit() in threads waiting for the bit to clear. 872 * call wait_on_bit() in threads waiting for the bit to clear.
868 * One uses wait_on_bit() where one is waiting for the bit to clear, 873 * One uses wait_on_bit() where one is waiting for the bit to clear,
869 * but has no intention of setting it. 874 * but has no intention of setting it.
875 * Returned value will be zero if the bit was cleared, or non-zero
876 * if the process received a signal and the mode permitted wakeup
877 * on that signal.
878 */
879static inline int
880wait_on_bit(void *word, int bit, unsigned mode)
881{
882 if (!test_bit(bit, word))
883 return 0;
884 return out_of_line_wait_on_bit(word, bit,
885 bit_wait,
886 mode);
887}
888
889/**
890 * wait_on_bit_io - wait for a bit to be cleared
891 * @word: the word being waited on, a kernel virtual address
892 * @bit: the bit of the word being waited on
893 * @mode: the task state to sleep in
894 *
895 * Use the standard hashed waitqueue table to wait for a bit
896 * to be cleared. This is similar to wait_on_bit(), but calls
897 * io_schedule() instead of schedule() for the actual waiting.
898 *
899 * Returned value will be zero if the bit was cleared, or non-zero
900 * if the process received a signal and the mode permitted wakeup
901 * on that signal.
902 */
903static inline int
904wait_on_bit_io(void *word, int bit, unsigned mode)
905{
906 if (!test_bit(bit, word))
907 return 0;
908 return out_of_line_wait_on_bit(word, bit,
909 bit_wait_io,
910 mode);
911}
912
913/**
914 * wait_on_bit_action - wait for a bit to be cleared
915 * @word: the word being waited on, a kernel virtual address
916 * @bit: the bit of the word being waited on
917 * @action: the function used to sleep, which may take special actions
918 * @mode: the task state to sleep in
919 *
920 * Use the standard hashed waitqueue table to wait for a bit
921 * to be cleared, and allow the waiting action to be specified.
922 * This is like wait_on_bit() but allows fine control of how the waiting
923 * is done.
924 *
925 * Returned value will be zero if the bit was cleared, or non-zero
926 * if the process received a signal and the mode permitted wakeup
927 * on that signal.
870 */ 928 */
871static inline int 929static inline int
872wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) 930wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
873{ 931{
874 if (!test_bit(bit, word)) 932 if (!test_bit(bit, word))
875 return 0; 933 return 0;
@@ -880,7 +938,6 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
880 * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it 938 * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it
881 * @word: the word being waited on, a kernel virtual address 939 * @word: the word being waited on, a kernel virtual address
882 * @bit: the bit of the word being waited on 940 * @bit: the bit of the word being waited on
883 * @action: the function used to sleep, which may take special actions
884 * @mode: the task state to sleep in 941 * @mode: the task state to sleep in
885 * 942 *
886 * There is a standard hashed waitqueue table for generic use. This 943 * There is a standard hashed waitqueue table for generic use. This
@@ -891,9 +948,61 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
891 * wait_on_bit() in threads waiting to be able to set the bit. 948 * wait_on_bit() in threads waiting to be able to set the bit.
892 * One uses wait_on_bit_lock() where one is waiting for the bit to 949 * One uses wait_on_bit_lock() where one is waiting for the bit to
893 * clear with the intention of setting it, and when done, clearing it. 950 * clear with the intention of setting it, and when done, clearing it.
951 *
952 * Returns zero if the bit was (eventually) found to be clear and was
953 * set. Returns non-zero if a signal was delivered to the process and
954 * the @mode allows that signal to wake the process.
955 */
956static inline int
957wait_on_bit_lock(void *word, int bit, unsigned mode)
958{
959 if (!test_and_set_bit(bit, word))
960 return 0;
961 return out_of_line_wait_on_bit_lock(word, bit, bit_wait, mode);
962}
963
964/**
965 * wait_on_bit_lock_io - wait for a bit to be cleared, when wanting to set it
966 * @word: the word being waited on, a kernel virtual address
967 * @bit: the bit of the word being waited on
968 * @mode: the task state to sleep in
969 *
970 * Use the standard hashed waitqueue table to wait for a bit
971 * to be cleared and then to atomically set it. This is similar
972 * to wait_on_bit(), but calls io_schedule() instead of schedule()
973 * for the actual waiting.
974 *
975 * Returns zero if the bit was (eventually) found to be clear and was
976 * set. Returns non-zero if a signal was delivered to the process and
977 * the @mode allows that signal to wake the process.
978 */
979static inline int
980wait_on_bit_lock_io(void *word, int bit, unsigned mode)
981{
982 if (!test_and_set_bit(bit, word))
983 return 0;
984 return out_of_line_wait_on_bit_lock(word, bit, bit_wait_io, mode);
985}
986
987/**
988 * wait_on_bit_lock_action - wait for a bit to be cleared, when wanting to set it
989 * @word: the word being waited on, a kernel virtual address
990 * @bit: the bit of the word being waited on
991 * @action: the function used to sleep, which may take special actions
992 * @mode: the task state to sleep in
993 *
994 * Use the standard hashed waitqueue table to wait for a bit
995 * to be cleared and then to set it, and allow the waiting action
996 * to be specified.
997 * This is like wait_on_bit() but allows fine control of how the waiting
998 * is done.
999 *
1000 * Returns zero if the bit was (eventually) found to be clear and was
1001 * set. Returns non-zero if a signal was delivered to the process and
1002 * the @mode allows that signal to wake the process.
894 */ 1003 */
895static inline int 1004static inline int
896wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode) 1005wait_on_bit_lock_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
897{ 1006{
898 if (!test_and_set_bit(bit, word)) 1007 if (!test_and_set_bit(bit, word))
899 return 0; 1008 return 0;
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 5777c13849ba..a219be961c0a 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -90,7 +90,6 @@ struct writeback_control {
90 * fs/fs-writeback.c 90 * fs/fs-writeback.c
91 */ 91 */
92struct bdi_writeback; 92struct bdi_writeback;
93int inode_wait(void *);
94void writeback_inodes_sb(struct super_block *, enum wb_reason reason); 93void writeback_inodes_sb(struct super_block *, enum wb_reason reason);
95void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, 94void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
96 enum wb_reason reason); 95 enum wb_reason reason);
@@ -105,7 +104,7 @@ void inode_wait_for_writeback(struct inode *inode);
105static inline void wait_on_inode(struct inode *inode) 104static inline void wait_on_inode(struct inode *inode)
106{ 105{
107 might_sleep(); 106 might_sleep();
108 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); 107 wait_on_bit(&inode->i_state, __I_NEW, TASK_UNINTERRUPTIBLE);
109} 108}
110 109
111/* 110/*
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
index 13af0d450bf6..f9d41a6e361f 100644
--- a/include/linux/zbud.h
+++ b/include/linux/zbud.h
@@ -11,7 +11,7 @@ struct zbud_ops {
11 11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops); 12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool); 13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, unsigned int size, gfp_t gfp, 14int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp,
15 unsigned long *handle); 15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle); 16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries); 17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 9c5a6b4de0a3..92dbbd3f6c75 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -83,11 +83,11 @@ struct internal_state;
83 83
84typedef struct z_stream_s { 84typedef struct z_stream_s {
85 const Byte *next_in; /* next input byte */ 85 const Byte *next_in; /* next input byte */
86 uInt avail_in; /* number of bytes available at next_in */ 86 uLong avail_in; /* number of bytes available at next_in */
87 uLong total_in; /* total nb of input bytes read so far */ 87 uLong total_in; /* total nb of input bytes read so far */
88 88
89 Byte *next_out; /* next output byte should be put there */ 89 Byte *next_out; /* next output byte should be put there */
90 uInt avail_out; /* remaining free space at next_out */ 90 uLong avail_out; /* remaining free space at next_out */
91 uLong total_out; /* total nb of bytes output so far */ 91 uLong total_out; /* total nb of bytes output so far */
92 92
93 char *msg; /* last error message, NULL if no error */ 93 char *msg; /* last error message, NULL if no error */
@@ -493,64 +493,6 @@ extern int deflateInit2 (z_streamp strm,
493 method). msg is set to null if there is no error message. deflateInit2 does 493 method). msg is set to null if there is no error message. deflateInit2 does
494 not perform any compression: this will be done by deflate(). 494 not perform any compression: this will be done by deflate().
495*/ 495*/
496
497#if 0
498extern int zlib_deflateSetDictionary (z_streamp strm,
499 const Byte *dictionary,
500 uInt dictLength);
501#endif
502/*
503 Initializes the compression dictionary from the given byte sequence
504 without producing any compressed output. This function must be called
505 immediately after deflateInit, deflateInit2 or deflateReset, before any
506 call of deflate. The compressor and decompressor must use exactly the same
507 dictionary (see inflateSetDictionary).
508
509 The dictionary should consist of strings (byte sequences) that are likely
510 to be encountered later in the data to be compressed, with the most commonly
511 used strings preferably put towards the end of the dictionary. Using a
512 dictionary is most useful when the data to be compressed is short and can be
513 predicted with good accuracy; the data can then be compressed better than
514 with the default empty dictionary.
515
516 Depending on the size of the compression data structures selected by
517 deflateInit or deflateInit2, a part of the dictionary may in effect be
518 discarded, for example if the dictionary is larger than the window size in
519 deflate or deflate2. Thus the strings most likely to be useful should be
520 put at the end of the dictionary, not at the front.
521
522 Upon return of this function, strm->adler is set to the Adler32 value
523 of the dictionary; the decompressor may later use this value to determine
524 which dictionary has been used by the compressor. (The Adler32 value
525 applies to the whole dictionary even if only a subset of the dictionary is
526 actually used by the compressor.)
527
528 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
529 parameter is invalid (such as NULL dictionary) or the stream state is
530 inconsistent (for example if deflate has already been called for this stream
531 or if the compression method is bsort). deflateSetDictionary does not
532 perform any compression: this will be done by deflate().
533*/
534
535#if 0
536extern int zlib_deflateCopy (z_streamp dest, z_streamp source);
537#endif
538
539/*
540 Sets the destination stream as a complete copy of the source stream.
541
542 This function can be useful when several compression strategies will be
543 tried, for example when there are several ways of pre-processing the input
544 data with a filter. The streams that will be discarded should then be freed
545 by calling deflateEnd. Note that deflateCopy duplicates the internal
546 compression state which can be quite large, so this strategy is slow and
547 can consume lots of memory.
548
549 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
550 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
551 (such as zalloc being NULL). msg is left unchanged in both source and
552 destination.
553*/
554 496
555extern int zlib_deflateReset (z_streamp strm); 497extern int zlib_deflateReset (z_streamp strm);
556/* 498/*
@@ -568,27 +510,6 @@ static inline unsigned long deflateBound(unsigned long s)
568 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; 510 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
569} 511}
570 512
571#if 0
572extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
573#endif
574/*
575 Dynamically update the compression level and compression strategy. The
576 interpretation of level and strategy is as in deflateInit2. This can be
577 used to switch between compression and straight copy of the input data, or
578 to switch to a different kind of input data requiring a different
579 strategy. If the compression level is changed, the input available so far
580 is compressed with the old level (and may be flushed); the new level will
581 take effect only at the next call of deflate().
582
583 Before the call of deflateParams, the stream state must be set as for
584 a call of deflate(), since the currently available input may have to
585 be compressed and flushed. In particular, strm->avail_out must be non-zero.
586
587 deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
588 stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
589 if strm->avail_out was zero.
590*/
591
592/* 513/*
593extern int inflateInit2 (z_streamp strm, int windowBits); 514extern int inflateInit2 (z_streamp strm, int windowBits);
594 515
@@ -631,45 +552,6 @@ extern int inflateInit2 (z_streamp strm, int windowBits);
631 and avail_out are unchanged.) 552 and avail_out are unchanged.)
632*/ 553*/
633 554
634extern int zlib_inflateSetDictionary (z_streamp strm,
635 const Byte *dictionary,
636 uInt dictLength);
637/*
638 Initializes the decompression dictionary from the given uncompressed byte
639 sequence. This function must be called immediately after a call of inflate,
640 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
641 can be determined from the adler32 value returned by that call of inflate.
642 The compressor and decompressor must use exactly the same dictionary (see
643 deflateSetDictionary). For raw inflate, this function can be called
644 immediately after inflateInit2() or inflateReset() and before any call of
645 inflate() to set the dictionary. The application must insure that the
646 dictionary that was used for compression is provided.
647
648 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
649 parameter is invalid (such as NULL dictionary) or the stream state is
650 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
651 expected one (incorrect adler32 value). inflateSetDictionary does not
652 perform any decompression: this will be done by subsequent calls of
653 inflate().
654*/
655
656#if 0
657extern int zlib_inflateSync (z_streamp strm);
658#endif
659/*
660 Skips invalid compressed data until a full flush point (see above the
661 description of deflate with Z_FULL_FLUSH) can be found, or until all
662 available input is skipped. No output is provided.
663
664 inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
665 if no more input was provided, Z_DATA_ERROR if no flush point has been found,
666 or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
667 case, the application may save the current current value of total_in which
668 indicates where valid compressed data was found. In the error case, the
669 application may repeatedly call inflateSync, providing more input each time,
670 until success or end of the input data.
671*/
672
673extern int zlib_inflateReset (z_streamp strm); 555extern int zlib_inflateReset (z_streamp strm);
674/* 556/*
675 This function is equivalent to inflateEnd followed by inflateInit, 557 This function is equivalent to inflateEnd followed by inflateInit,
diff --git a/include/linux/zpool.h b/include/linux/zpool.h
new file mode 100644
index 000000000000..f14bd75f08b3
--- /dev/null
+++ b/include/linux/zpool.h
@@ -0,0 +1,106 @@
1/*
2 * zpool memory storage api
3 *
4 * Copyright (C) 2014 Dan Streetman
5 *
6 * This is a common frontend for the zbud and zsmalloc memory
7 * storage pool implementations. Typically, this is used to
8 * store compressed memory.
9 */
10
11#ifndef _ZPOOL_H_
12#define _ZPOOL_H_
13
14struct zpool;
15
16struct zpool_ops {
17 int (*evict)(struct zpool *pool, unsigned long handle);
18};
19
20/*
21 * Control how a handle is mapped. It will be ignored if the
22 * implementation does not support it. Its use is optional.
23 * Note that this does not refer to memory protection, it
24 * refers to how the memory will be copied in/out if copying
25 * is necessary during mapping; read-write is the safest as
26 * it copies the existing memory in on map, and copies the
27 * changed memory back out on unmap. Write-only does not copy
28 * in the memory and should only be used for initialization.
29 * If in doubt, use ZPOOL_MM_DEFAULT which is read-write.
30 */
31enum zpool_mapmode {
32 ZPOOL_MM_RW, /* normal read-write mapping */
33 ZPOOL_MM_RO, /* read-only (no copy-out at unmap time) */
34 ZPOOL_MM_WO, /* write-only (no copy-in at map time) */
35
36 ZPOOL_MM_DEFAULT = ZPOOL_MM_RW
37};
38
39struct zpool *zpool_create_pool(char *type, gfp_t gfp, struct zpool_ops *ops);
40
41char *zpool_get_type(struct zpool *pool);
42
43void zpool_destroy_pool(struct zpool *pool);
44
45int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp,
46 unsigned long *handle);
47
48void zpool_free(struct zpool *pool, unsigned long handle);
49
50int zpool_shrink(struct zpool *pool, unsigned int pages,
51 unsigned int *reclaimed);
52
53void *zpool_map_handle(struct zpool *pool, unsigned long handle,
54 enum zpool_mapmode mm);
55
56void zpool_unmap_handle(struct zpool *pool, unsigned long handle);
57
58u64 zpool_get_total_size(struct zpool *pool);
59
60
61/**
62 * struct zpool_driver - driver implementation for zpool
63 * @type: name of the driver.
64 * @list: entry in the list of zpool drivers.
65 * @create: create a new pool.
66 * @destroy: destroy a pool.
67 * @malloc: allocate mem from a pool.
68 * @free: free mem from a pool.
69 * @shrink: shrink the pool.
70 * @map: map a handle.
71 * @unmap: unmap a handle.
72 * @total_size: get total size of a pool.
73 *
74 * This is created by a zpool implementation and registered
75 * with zpool.
76 */
77struct zpool_driver {
78 char *type;
79 struct module *owner;
80 atomic_t refcount;
81 struct list_head list;
82
83 void *(*create)(gfp_t gfp, struct zpool_ops *ops);
84 void (*destroy)(void *pool);
85
86 int (*malloc)(void *pool, size_t size, gfp_t gfp,
87 unsigned long *handle);
88 void (*free)(void *pool, unsigned long handle);
89
90 int (*shrink)(void *pool, unsigned int pages,
91 unsigned int *reclaimed);
92
93 void *(*map)(void *pool, unsigned long handle,
94 enum zpool_mapmode mm);
95 void (*unmap)(void *pool, unsigned long handle);
96
97 u64 (*total_size)(void *pool);
98};
99
100void zpool_register_driver(struct zpool_driver *driver);
101
102int zpool_unregister_driver(struct zpool_driver *driver);
103
104int zpool_evict(void *pool, unsigned long handle);
105
106#endif