aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/pci-bridge.h6
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/amba/bus.h8
-rw-r--r--include/linux/atmlec.h7
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/clk.h32
-rw-r--r--include/linux/clkdev.h3
-rw-r--r--include/linux/dcache.h21
-rw-r--r--include/linux/dcbnl.h12
-rw-r--r--include/linux/dccp.h2
-rw-r--r--include/linux/etherdevice.h65
-rw-r--r--include/linux/ethtool.h69
-rw-r--r--include/linux/filter.h7
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/genhd.h6
-rw-r--r--include/linux/hyperv.h27
-rw-r--r--include/linux/i2c/twl.h13
-rw-r--r--include/linux/ibmtr.h373
-rw-r--r--include/linux/ieee80211.h36
-rw-r--r--include/linux/if_arp.h3
-rw-r--r--include/linux/if_ec.h68
-rw-r--r--include/linux/if_link.h5
-rw-r--r--include/linux/if_macvlan.h1
-rw-r--r--include/linux/if_pppol2tp.h28
-rw-r--r--include/linux/if_pppox.h20
-rw-r--r--include/linux/if_team.h67
-rw-r--r--include/linux/if_tr.h103
-rw-r--r--include/linux/in6.h2
-rw-r--r--include/linux/ioport.h7
-rw-r--r--include/linux/ip_vs.h17
-rw-r--r--include/linux/ipx.h2
-rw-r--r--include/linux/l2tp.h19
-rw-r--r--include/linux/mISDNhw.h25
-rw-r--r--include/linux/mISDNif.h16
-rw-r--r--include/linux/mdio-mux.h21
-rw-r--r--include/linux/mfd/da9052/da9052.h1
-rw-r--r--include/linux/mfd/palmas.h2620
-rw-r--r--include/linux/mfd/rc5t583.h29
-rw-r--r--include/linux/mfd/s5m87xx/s5m-core.h1
-rw-r--r--include/linux/mfd/s5m87xx/s5m-pmic.h29
-rw-r--r--include/linux/mfd/tps65090.h13
-rw-r--r--include/linux/mfd/tps6586x.h1
-rw-r--r--include/linux/mfd/wm8994/core.h12
-rw-r--r--include/linux/mlx4/cmd.h4
-rw-r--r--include/linux/mlx4/device.h3
-rw-r--r--include/linux/mlx4/qp.h3
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/neighbour.h3
-rw-r--r--include/linux/net.h23
-rw-r--r--include/linux/netdevice.h52
-rw-r--r--include/linux/netfilter.h6
-rw-r--r--include/linux/netfilter/ipset/ip_set.h54
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h37
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_types.h12
-rw-r--r--include/linux/netfilter/nfnetlink.h2
-rw-r--r--include/linux/netfilter/xt_HMARK.h45
-rw-r--r--include/linux/netfilter/xt_hashlimit.h12
-rw-r--r--include/linux/netfilter_ipv4/Kbuild1
-rw-r--r--include/linux/netfilter_ipv4/ip_queue.h72
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h7
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfc.h1
-rw-r--r--include/linux/nl80211.h44
-rw-r--r--include/linux/nl802154.h20
-rw-r--r--include/linux/of.h51
-rw-r--r--include/linux/of_mdio.h2
-rw-r--r--include/linux/pci.h9
-rw-r--r--include/linux/phy.h4
-rw-r--r--include/linux/pinctrl/consumer.h44
-rw-r--r--include/linux/pinctrl/machine.h7
-rw-r--r--include/linux/pinctrl/pinconf.h6
-rw-r--r--include/linux/pinctrl/pinctrl.h22
-rw-r--r--include/linux/pinctrl/pinmux.h9
-rw-r--r--include/linux/pkt_sched.h81
-rw-r--r--include/linux/platform_data/wiznet.h24
-rw-r--r--include/linux/ptp_clock_kernel.h8
-rw-r--r--include/linux/regmap.h44
-rw-r--r--include/linux/regulator/driver.h73
-rw-r--r--include/linux/regulator/fixed.h7
-rw-r--r--include/linux/regulator/of_regulator.h18
-rw-r--r--include/linux/regulator/tps62360.h6
-rw-r--r--include/linux/regulator/tps65090-regulator.h50
-rw-r--r--include/linux/rndis.h390
-rw-r--r--include/linux/rtnetlink.h4
-rw-r--r--include/linux/skbuff.h115
-rw-r--r--include/linux/sock_diag.h4
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/stmmac.h57
-rw-r--r--include/linux/tcp.h22
-rw-r--r--include/linux/trdevice.h37
-rw-r--r--include/linux/usb/rndis_host.h66
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/virtio_net.h14
-rw-r--r--include/media/soc_camera.h3
-rw-r--r--include/net/addrconf.h20
-rw-r--r--include/net/af_unix.h2
-rw-r--r--include/net/ax25.h10
-rw-r--r--include/net/bluetooth/bluetooth.h1
-rw-r--r--include/net/caif/caif_hsi.h19
-rw-r--r--include/net/caif/cfpkt.h9
-rw-r--r--include/net/cfg80211.h60
-rw-r--r--include/net/codel.h342
-rw-r--r--include/net/compat.h8
-rw-r--r--include/net/dcbnl.h2
-rw-r--r--include/net/dn.h2
-rw-r--r--include/net/dn_fib.h6
-rw-r--r--include/net/dn_route.h4
-rw-r--r--include/net/dst_ops.h2
-rw-r--r--include/net/icmp.h3
-rw-r--r--include/net/ieee802154_netdev.h27
-rw-r--r--include/net/if_inet6.h56
-rw-r--r--include/net/inet6_connection_sock.h2
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--include/net/inet_frag.h3
-rw-r--r--include/net/ip.h20
-rw-r--r--include/net/ip6_route.h4
-rw-r--r--include/net/ip_fib.h4
-rw-r--r--include/net/ip_vs.h105
-rw-r--r--include/net/ipip.h2
-rw-r--r--include/net/ipv6.h39
-rw-r--r--include/net/lapb.h6
-rw-r--r--include/net/llc_c_ev.h2
-rw-r--r--include/net/llc_pdu.h7
-rw-r--r--include/net/mac80211.h171
-rw-r--r--include/net/mac802154.h136
-rw-r--r--include/net/ndisc.h1
-rw-r--r--include/net/neighbour.h5
-rw-r--r--include/net/net_namespace.h21
-rw-r--r--include/net/netfilter/nf_conntrack.h10
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h2
-rw-r--r--include/net/netlink.h169
-rw-r--r--include/net/netns/conntrack.h3
-rw-r--r--include/net/netns/hash.h2
-rw-r--r--include/net/netns/ipv6.h4
-rw-r--r--include/net/nfc/hci.h198
-rw-r--r--include/net/nfc/nfc.h14
-rw-r--r--include/net/nfc/shdlc.h104
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/rawv6.h2
-rw-r--r--include/net/route.h6
-rw-r--r--include/net/rtnetlink.h11
-rw-r--r--include/net/sctp/sctp.h13
-rw-r--r--include/net/sctp/structs.h8
-rw-r--r--include/net/sock.h174
-rw-r--r--include/net/tcp.h116
-rw-r--r--include/net/udp.h6
-rw-r--r--include/net/wimax.h4
-rw-r--r--include/net/wpan-phy.h10
-rw-r--r--include/net/x25.h2
-rw-r--r--include/net/xfrm.h17
-rw-r--r--include/scsi/iscsi_proto.h2
-rw-r--r--include/scsi/sas.h1
-rw-r--r--include/target/target_core_backend.h16
-rw-r--r--include/target/target_core_base.h59
-rw-r--r--include/target/target_core_fabric.h11
-rw-r--r--include/video/vga.h22
160 files changed, 5987 insertions, 1517 deletions
diff --git a/include/asm-generic/pci-bridge.h b/include/asm-generic/pci-bridge.h
index a5b5d5a89a4f..20db2e5a0a69 100644
--- a/include/asm-generic/pci-bridge.h
+++ b/include/asm-generic/pci-bridge.h
@@ -30,6 +30,12 @@ enum {
30 PCI_ENABLE_PROC_DOMAINS = 0x00000010, 30 PCI_ENABLE_PROC_DOMAINS = 0x00000010,
31 /* ... except for domain 0 */ 31 /* ... except for domain 0 */
32 PCI_COMPAT_DOMAIN_0 = 0x00000020, 32 PCI_COMPAT_DOMAIN_0 = 0x00000020,
33
34 /* PCIe downstream ports are bridges that normally lead to only a
35 * device 0, but if this is set, we scan all possible devices, not
36 * just device 0.
37 */
38 PCI_SCAN_ALL_PCIE_DEVS = 0x00000040,
33}; 39};
34 40
35#ifdef CONFIG_PCI 41#ifdef CONFIG_PCI
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 3c9b616c834a..b5d568fa19e8 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -167,7 +167,6 @@ header-y += if_arp.h
167header-y += if_bonding.h 167header-y += if_bonding.h
168header-y += if_bridge.h 168header-y += if_bridge.h
169header-y += if_cablemodem.h 169header-y += if_cablemodem.h
170header-y += if_ec.h
171header-y += if_eql.h 170header-y += if_eql.h
172header-y += if_ether.h 171header-y += if_ether.h
173header-y += if_fc.h 172header-y += if_fc.h
@@ -186,7 +185,6 @@ header-y += if_pppox.h
186header-y += if_slip.h 185header-y += if_slip.h
187header-y += if_strip.h 186header-y += if_strip.h
188header-y += if_team.h 187header-y += if_team.h
189header-y += if_tr.h
190header-y += if_tun.h 188header-y += if_tun.h
191header-y += if_tunnel.h 189header-y += if_tunnel.h
192header-y += if_vlan.h 190header-y += if_vlan.h
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 8d54f79457ba..d36417158d8f 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -63,6 +63,14 @@ struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
63void amba_device_put(struct amba_device *); 63void amba_device_put(struct amba_device *);
64int amba_device_add(struct amba_device *, struct resource *); 64int amba_device_add(struct amba_device *, struct resource *);
65int amba_device_register(struct amba_device *, struct resource *); 65int amba_device_register(struct amba_device *, struct resource *);
66struct amba_device *amba_apb_device_add(struct device *parent, const char *name,
67 resource_size_t base, size_t size,
68 int irq1, int irq2, void *pdata,
69 unsigned int periphid);
70struct amba_device *amba_ahb_device_add(struct device *parent, const char *name,
71 resource_size_t base, size_t size,
72 int irq1, int irq2, void *pdata,
73 unsigned int periphid);
66void amba_device_unregister(struct amba_device *); 74void amba_device_unregister(struct amba_device *);
67struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 75struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
68int amba_request_regions(struct amba_device *, const char *); 76int amba_request_regions(struct amba_device *, const char *);
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index 39c917fd1b96..302791e3ab2b 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -21,13 +21,6 @@
21/* Maximum number of LEC interfaces (tweakable) */ 21/* Maximum number of LEC interfaces (tweakable) */
22#define MAX_LEC_ITF 48 22#define MAX_LEC_ITF 48
23 23
24/*
25 * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
26 * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
27 * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
28 */
29#define NUM_TR_DEVS 8
30
31typedef enum { 24typedef enum {
32 l_set_mac_addr, 25 l_set_mac_addr,
33 l_del_mac_addr, 26 l_del_mac_addr,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2aa24664a5b5..4d4ac24a263e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1,9 +1,10 @@
1#ifndef _LINUX_BLKDEV_H 1#ifndef _LINUX_BLKDEV_H
2#define _LINUX_BLKDEV_H 2#define _LINUX_BLKDEV_H
3 3
4#include <linux/sched.h>
5
4#ifdef CONFIG_BLOCK 6#ifdef CONFIG_BLOCK
5 7
6#include <linux/sched.h>
7#include <linux/major.h> 8#include <linux/major.h>
8#include <linux/genhd.h> 9#include <linux/genhd.h>
9#include <linux/list.h> 10#include <linux/list.h>
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b0252726df61..70cf722ac3af 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -101,6 +101,26 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
101struct clk *clk_get(struct device *dev, const char *id); 101struct clk *clk_get(struct device *dev, const char *id);
102 102
103/** 103/**
104 * devm_clk_get - lookup and obtain a managed reference to a clock producer.
105 * @dev: device for clock "consumer"
106 * @id: clock comsumer ID
107 *
108 * Returns a struct clk corresponding to the clock producer, or
109 * valid IS_ERR() condition containing errno. The implementation
110 * uses @dev and @id to determine the clock consumer, and thereby
111 * the clock producer. (IOW, @id may be identical strings, but
112 * clk_get may return different clock producers depending on @dev.)
113 *
114 * Drivers must assume that the clock source is not enabled.
115 *
116 * devm_clk_get should not be called from within interrupt context.
117 *
118 * The clock will automatically be freed when the device is unbound
119 * from the bus.
120 */
121struct clk *devm_clk_get(struct device *dev, const char *id);
122
123/**
104 * clk_prepare - prepare a clock source 124 * clk_prepare - prepare a clock source
105 * @clk: clock source 125 * @clk: clock source
106 * 126 *
@@ -206,6 +226,18 @@ unsigned long clk_get_rate(struct clk *clk);
206 */ 226 */
207void clk_put(struct clk *clk); 227void clk_put(struct clk *clk);
208 228
229/**
230 * devm_clk_put - "free" a managed clock source
231 * @dev: device used to acuqire the clock
232 * @clk: clock source acquired with devm_clk_get()
233 *
234 * Note: drivers must ensure that all clk_enable calls made on this
235 * clock source are balanced by clk_disable calls prior to calling
236 * this function.
237 *
238 * clk_put should not be called from within interrupt context.
239 */
240void devm_clk_put(struct device *dev, struct clk *clk);
209 241
210/* 242/*
211 * The remaining APIs are optional for machine class support. 243 * The remaining APIs are optional for machine class support.
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
index d9a4fd028c9d..a6a6f603103b 100644
--- a/include/linux/clkdev.h
+++ b/include/linux/clkdev.h
@@ -40,4 +40,7 @@ void clkdev_drop(struct clk_lookup *cl);
40void clkdev_add_table(struct clk_lookup *, size_t); 40void clkdev_add_table(struct clk_lookup *, size_t);
41int clk_add_alias(const char *, const char *, char *, struct device *); 41int clk_add_alias(const char *, const char *, char *, struct device *);
42 42
43int clk_register_clkdev(struct clk *, const char *, const char *, ...);
44int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t);
45
43#endif 46#endif
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 7e11f1418203..094789ff3e9f 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -25,6 +25,13 @@ struct vfsmount;
25 25
26#define IS_ROOT(x) ((x) == (x)->d_parent) 26#define IS_ROOT(x) ((x) == (x)->d_parent)
27 27
28/* The hash is always the low bits of hash_len */
29#ifdef __LITTLE_ENDIAN
30 #define HASH_LEN_DECLARE u32 hash; u32 len;
31#else
32 #define HASH_LEN_DECLARE u32 len; u32 hash;
33#endif
34
28/* 35/*
29 * "quick string" -- eases parameter passing, but more importantly 36 * "quick string" -- eases parameter passing, but more importantly
30 * saves "metadata" about the string (ie length and the hash). 37 * saves "metadata" about the string (ie length and the hash).
@@ -33,11 +40,19 @@ struct vfsmount;
33 * dentry. 40 * dentry.
34 */ 41 */
35struct qstr { 42struct qstr {
36 unsigned int hash; 43 union {
37 unsigned int len; 44 struct {
45 HASH_LEN_DECLARE;
46 };
47 u64 hash_len;
48 };
38 const unsigned char *name; 49 const unsigned char *name;
39}; 50};
40 51
52#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
53#define hashlen_hash(hashlen) ((u32) (hashlen))
54#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
55
41struct dentry_stat_t { 56struct dentry_stat_t {
42 int nr_dentry; 57 int nr_dentry;
43 int nr_unused; 58 int nr_unused;
@@ -282,7 +297,7 @@ extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
282extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 297extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
283extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 298extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
284 const struct qstr *name, 299 const struct qstr *name,
285 unsigned *seq, struct inode **inode); 300 unsigned *seq, struct inode *inode);
286 301
287/** 302/**
288 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok 303 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 65a2562f66b4..6bb43382f3f3 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -67,6 +67,17 @@ struct ieee_ets {
67 __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS]; 67 __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS];
68}; 68};
69 69
70/* This structure contains rate limit extension to the IEEE 802.1Qaz ETS
71 * managed object.
72 * Values are 64 bits long and specified in Kbps to enable usage over both
73 * slow and very fast networks.
74 *
75 * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class
76 */
77struct ieee_maxrate {
78 __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS];
79};
80
70/* This structure contains the IEEE 802.1Qaz PFC managed object 81/* This structure contains the IEEE 802.1Qaz PFC managed object
71 * 82 *
72 * @pfc_cap: Indicates the number of traffic classes on the local device 83 * @pfc_cap: Indicates the number of traffic classes on the local device
@@ -321,6 +332,7 @@ enum ieee_attrs {
321 DCB_ATTR_IEEE_PEER_ETS, 332 DCB_ATTR_IEEE_PEER_ETS,
322 DCB_ATTR_IEEE_PEER_PFC, 333 DCB_ATTR_IEEE_PEER_PFC,
323 DCB_ATTR_IEEE_PEER_APP, 334 DCB_ATTR_IEEE_PEER_APP,
335 DCB_ATTR_IEEE_MAXRATE,
324 __DCB_ATTR_IEEE_MAX 336 __DCB_ATTR_IEEE_MAX
325}; 337};
326#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) 338#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index eaf95a023af4..d16294e2a118 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -549,6 +549,8 @@ static inline const char *dccp_role(const struct sock *sk)
549 return NULL; 549 return NULL;
550} 550}
551 551
552extern void dccp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
553
552#endif /* __KERNEL__ */ 554#endif /* __KERNEL__ */
553 555
554#endif /* _LINUX_DCCP_H */ 556#endif /* _LINUX_DCCP_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 8a1835855faa..3d406e0ede6d 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -18,8 +18,6 @@
18 * as published by the Free Software Foundation; either version 18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version. 19 * 2 of the License, or (at your option) any later version.
20 * 20 *
21 * WARNING: This move may well be temporary. This file will get merged with others RSN.
22 *
23 */ 21 */
24#ifndef _LINUX_ETHERDEVICE_H 22#ifndef _LINUX_ETHERDEVICE_H
25#define _LINUX_ETHERDEVICE_H 23#define _LINUX_ETHERDEVICE_H
@@ -59,7 +57,7 @@ extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
59 * 57 *
60 * Return true if the address is all zeroes. 58 * Return true if the address is all zeroes.
61 */ 59 */
62static inline int is_zero_ether_addr(const u8 *addr) 60static inline bool is_zero_ether_addr(const u8 *addr)
63{ 61{
64 return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); 62 return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
65} 63}
@@ -71,7 +69,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
71 * Return true if the address is a multicast address. 69 * Return true if the address is a multicast address.
72 * By definition the broadcast address is also a multicast address. 70 * By definition the broadcast address is also a multicast address.
73 */ 71 */
74static inline int is_multicast_ether_addr(const u8 *addr) 72static inline bool is_multicast_ether_addr(const u8 *addr)
75{ 73{
76 return 0x01 & addr[0]; 74 return 0x01 & addr[0];
77} 75}
@@ -82,7 +80,7 @@ static inline int is_multicast_ether_addr(const u8 *addr)
82 * 80 *
83 * Return true if the address is a local address. 81 * Return true if the address is a local address.
84 */ 82 */
85static inline int is_local_ether_addr(const u8 *addr) 83static inline bool is_local_ether_addr(const u8 *addr)
86{ 84{
87 return 0x02 & addr[0]; 85 return 0x02 & addr[0];
88} 86}
@@ -93,7 +91,7 @@ static inline int is_local_ether_addr(const u8 *addr)
93 * 91 *
94 * Return true if the address is the broadcast address. 92 * Return true if the address is the broadcast address.
95 */ 93 */
96static inline int is_broadcast_ether_addr(const u8 *addr) 94static inline bool is_broadcast_ether_addr(const u8 *addr)
97{ 95{
98 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff; 96 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
99} 97}
@@ -104,7 +102,7 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
104 * 102 *
105 * Return true if the address is a unicast address. 103 * Return true if the address is a unicast address.
106 */ 104 */
107static inline int is_unicast_ether_addr(const u8 *addr) 105static inline bool is_unicast_ether_addr(const u8 *addr)
108{ 106{
109 return !is_multicast_ether_addr(addr); 107 return !is_multicast_ether_addr(addr);
110} 108}
@@ -118,7 +116,7 @@ static inline int is_unicast_ether_addr(const u8 *addr)
118 * 116 *
119 * Return true if the address is valid. 117 * Return true if the address is valid.
120 */ 118 */
121static inline int is_valid_ether_addr(const u8 *addr) 119static inline bool is_valid_ether_addr(const u8 *addr)
122{ 120{
123 /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to 121 /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
124 * explicitly check for it here. */ 122 * explicitly check for it here. */
@@ -159,7 +157,8 @@ static inline void eth_hw_addr_random(struct net_device *dev)
159 * @addr1: Pointer to a six-byte array containing the Ethernet address 157 * @addr1: Pointer to a six-byte array containing the Ethernet address
160 * @addr2: Pointer other six-byte array containing the Ethernet address 158 * @addr2: Pointer other six-byte array containing the Ethernet address
161 * 159 *
162 * Compare two ethernet addresses, returns 0 if equal 160 * Compare two Ethernet addresses, returns 0 if equal, non-zero otherwise.
161 * Unlike memcmp(), it doesn't return a value suitable for sorting.
163 */ 162 */
164static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) 163static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
165{ 164{
@@ -170,6 +169,18 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
170 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 169 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
171} 170}
172 171
172/**
173 * ether_addr_equal - Compare two Ethernet addresses
174 * @addr1: Pointer to a six-byte array containing the Ethernet address
175 * @addr2: Pointer other six-byte array containing the Ethernet address
176 *
177 * Compare two Ethernet addresses, returns true if equal
178 */
179static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
180{
181 return !compare_ether_addr(addr1, addr2);
182}
183
173static inline unsigned long zap_last_2bytes(unsigned long value) 184static inline unsigned long zap_last_2bytes(unsigned long value)
174{ 185{
175#ifdef __BIG_ENDIAN 186#ifdef __BIG_ENDIAN
@@ -180,34 +191,34 @@ static inline unsigned long zap_last_2bytes(unsigned long value)
180} 191}
181 192
182/** 193/**
183 * compare_ether_addr_64bits - Compare two Ethernet addresses 194 * ether_addr_equal_64bits - Compare two Ethernet addresses
184 * @addr1: Pointer to an array of 8 bytes 195 * @addr1: Pointer to an array of 8 bytes
185 * @addr2: Pointer to an other array of 8 bytes 196 * @addr2: Pointer to an other array of 8 bytes
186 * 197 *
187 * Compare two ethernet addresses, returns 0 if equal. 198 * Compare two Ethernet addresses, returns true if equal, false otherwise.
188 * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional 199 *
189 * branches, and possibly long word memory accesses on CPU allowing cheap 200 * The function doesn't need any conditional branches and possibly uses
190 * unaligned memory reads. 201 * word memory accesses on CPU allowing cheap unaligned memory reads.
191 * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2} 202 * arrays = { byte1, byte2, byte3, byte4, byte5, byte6, pad1, pad2 }
192 * 203 *
193 * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits. 204 * Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits.
194 */ 205 */
195 206
196static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2], 207static inline bool ether_addr_equal_64bits(const u8 addr1[6+2],
197 const u8 addr2[6+2]) 208 const u8 addr2[6+2])
198{ 209{
199#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 210#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
200 unsigned long fold = ((*(unsigned long *)addr1) ^ 211 unsigned long fold = ((*(unsigned long *)addr1) ^
201 (*(unsigned long *)addr2)); 212 (*(unsigned long *)addr2));
202 213
203 if (sizeof(fold) == 8) 214 if (sizeof(fold) == 8)
204 return zap_last_2bytes(fold) != 0; 215 return zap_last_2bytes(fold) == 0;
205 216
206 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^ 217 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^
207 (*(unsigned long *)(addr2 + 4))); 218 (*(unsigned long *)(addr2 + 4)));
208 return fold != 0; 219 return fold == 0;
209#else 220#else
210 return compare_ether_addr(addr1, addr2); 221 return ether_addr_equal(addr1, addr2);
211#endif 222#endif
212} 223}
213 224
@@ -219,23 +230,23 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
219 * Compare passed address with all addresses of the device. Return true if the 230 * Compare passed address with all addresses of the device. Return true if the
220 * address if one of the device addresses. 231 * address if one of the device addresses.
221 * 232 *
222 * Note that this function calls compare_ether_addr_64bits() so take care of 233 * Note that this function calls ether_addr_equal_64bits() so take care of
223 * the right padding. 234 * the right padding.
224 */ 235 */
225static inline bool is_etherdev_addr(const struct net_device *dev, 236static inline bool is_etherdev_addr(const struct net_device *dev,
226 const u8 addr[6 + 2]) 237 const u8 addr[6 + 2])
227{ 238{
228 struct netdev_hw_addr *ha; 239 struct netdev_hw_addr *ha;
229 int res = 1; 240 bool res = false;
230 241
231 rcu_read_lock(); 242 rcu_read_lock();
232 for_each_dev_addr(dev, ha) { 243 for_each_dev_addr(dev, ha) {
233 res = compare_ether_addr_64bits(addr, ha->addr); 244 res = ether_addr_equal_64bits(addr, ha->addr);
234 if (!res) 245 if (res)
235 break; 246 break;
236 } 247 }
237 rcu_read_unlock(); 248 rcu_read_unlock();
238 return !res; 249 return res;
239} 250}
240#endif /* __KERNEL__ */ 251#endif /* __KERNEL__ */
241 252
@@ -244,7 +255,7 @@ static inline bool is_etherdev_addr(const struct net_device *dev,
244 * @a: Pointer to Ethernet header 255 * @a: Pointer to Ethernet header
245 * @b: Pointer to Ethernet header 256 * @b: Pointer to Ethernet header
246 * 257 *
247 * Compare two ethernet headers, returns 0 if equal. 258 * Compare two Ethernet headers, returns 0 if equal.
248 * This assumes that the network header (i.e., IP header) is 4-byte 259 * This assumes that the network header (i.e., IP header) is 4-byte
249 * aligned OR the platform can handle unaligned access. This is the 260 * aligned OR the platform can handle unaligned access. This is the
250 * case for all packets coming into netif_receive_skb or similar 261 * case for all packets coming into netif_receive_skb or similar
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index f5647b59a90e..e17fa7140588 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -137,6 +137,23 @@ struct ethtool_eeprom {
137}; 137};
138 138
139/** 139/**
140 * struct ethtool_modinfo - plugin module eeprom information
141 * @cmd: %ETHTOOL_GMODULEINFO
142 * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
143 * @eeprom_len: Length of the eeprom
144 *
145 * This structure is used to return the information to
146 * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
147 * The type code indicates the eeprom data format
148 */
149struct ethtool_modinfo {
150 __u32 cmd;
151 __u32 type;
152 __u32 eeprom_len;
153 __u32 reserved[8];
154};
155
156/**
140 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates 157 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
141 * @cmd: ETHTOOL_{G,S}COALESCE 158 * @cmd: ETHTOOL_{G,S}COALESCE
142 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after 159 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
@@ -661,12 +678,17 @@ struct ethtool_flash {
661 * %ETHTOOL_SET_DUMP 678 * %ETHTOOL_SET_DUMP
662 * @version: FW version of the dump, filled in by driver 679 * @version: FW version of the dump, filled in by driver
663 * @flag: driver dependent flag for dump setting, filled in by driver during 680 * @flag: driver dependent flag for dump setting, filled in by driver during
664 * get and filled in by ethtool for set operation 681 * get and filled in by ethtool for set operation.
682 * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
683 * firmware dump is disabled.
665 * @len: length of dump data, used as the length of the user buffer on entry to 684 * @len: length of dump data, used as the length of the user buffer on entry to
666 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver 685 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
667 * for %ETHTOOL_GET_DUMP_FLAG command 686 * for %ETHTOOL_GET_DUMP_FLAG command
668 * @data: data collected for get dump data operation 687 * @data: data collected for get dump data operation
669 */ 688 */
689
690#define ETH_FW_DUMP_DISABLE 0
691
670struct ethtool_dump { 692struct ethtool_dump {
671 __u32 cmd; 693 __u32 cmd;
672 __u32 version; 694 __u32 version;
@@ -726,6 +748,29 @@ struct ethtool_sfeatures {
726 struct ethtool_set_features_block features[0]; 748 struct ethtool_set_features_block features[0];
727}; 749};
728 750
751/**
752 * struct ethtool_ts_info - holds a device's timestamping and PHC association
753 * @cmd: command number = %ETHTOOL_GET_TS_INFO
754 * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
755 * @phc_index: device index of the associated PHC, or -1 if there is none
756 * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
757 * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
758 *
759 * The bits in the 'tx_types' and 'rx_filters' fields correspond to
760 * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
761 * respectively. For example, if the device supports HWTSTAMP_TX_ON,
762 * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
763 */
764struct ethtool_ts_info {
765 __u32 cmd;
766 __u32 so_timestamping;
767 __s32 phc_index;
768 __u32 tx_types;
769 __u32 tx_reserved[3];
770 __u32 rx_filters;
771 __u32 rx_reserved[3];
772};
773
729/* 774/*
730 * %ETHTOOL_SFEATURES changes features present in features[].valid to the 775 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
731 * values of corresponding bits in features[].requested. Bits in .requested 776 * values of corresponding bits in features[].requested. Bits in .requested
@@ -788,6 +833,7 @@ struct net_device;
788 833
789/* Some generic methods drivers may use in their ethtool_ops */ 834/* Some generic methods drivers may use in their ethtool_ops */
790u32 ethtool_op_get_link(struct net_device *dev); 835u32 ethtool_op_get_link(struct net_device *dev);
836int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti);
791 837
792/** 838/**
793 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection 839 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
@@ -893,6 +939,12 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
893 * and flag of the device. 939 * and flag of the device.
894 * @get_dump_data: Get dump data. 940 * @get_dump_data: Get dump data.
895 * @set_dump: Set dump specific flags to the device. 941 * @set_dump: Set dump specific flags to the device.
942 * @get_ts_info: Get the time stamping and PTP hardware clock capabilities.
943 * Drivers supporting transmit time stamps in software should set this to
944 * ethtool_op_get_ts_info().
945 * @get_module_info: Get the size and type of the eeprom contained within
946 * a plug-in module.
947 * @get_module_eeprom: Get the eeprom information from the plug-in module
896 * 948 *
897 * All operations are optional (i.e. the function pointer may be set 949 * All operations are optional (i.e. the function pointer may be set
898 * to %NULL) and callers must take this into account. Callers must 950 * to %NULL) and callers must take this into account. Callers must
@@ -954,6 +1006,12 @@ struct ethtool_ops {
954 int (*get_dump_data)(struct net_device *, 1006 int (*get_dump_data)(struct net_device *,
955 struct ethtool_dump *, void *); 1007 struct ethtool_dump *, void *);
956 int (*set_dump)(struct net_device *, struct ethtool_dump *); 1008 int (*set_dump)(struct net_device *, struct ethtool_dump *);
1009 int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
1010 int (*get_module_info)(struct net_device *,
1011 struct ethtool_modinfo *);
1012 int (*get_module_eeprom)(struct net_device *,
1013 struct ethtool_eeprom *, u8 *);
1014
957 1015
958}; 1016};
959#endif /* __KERNEL__ */ 1017#endif /* __KERNEL__ */
@@ -1028,6 +1086,9 @@ struct ethtool_ops {
1028#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ 1086#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
1029#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ 1087#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
1030#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ 1088#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
1089#define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
1090#define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
1091#define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
1031 1092
1032/* compatibility with older code */ 1093/* compatibility with older code */
1033#define SPARC_ETH_GSET ETHTOOL_GSET 1094#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -1177,6 +1238,12 @@ struct ethtool_ops {
1177#define RX_CLS_LOC_FIRST 0xfffffffe 1238#define RX_CLS_LOC_FIRST 0xfffffffe
1178#define RX_CLS_LOC_LAST 0xfffffffd 1239#define RX_CLS_LOC_LAST 0xfffffffd
1179 1240
1241/* EEPROM Standards for plug in modules */
1242#define ETH_MODULE_SFF_8079 0x1
1243#define ETH_MODULE_SFF_8079_LEN 256
1244#define ETH_MODULE_SFF_8472 0x2
1245#define ETH_MODULE_SFF_8472_LEN 512
1246
1180/* Reset flags */ 1247/* Reset flags */
1181/* The reset() operation must clear the flags for the components which 1248/* The reset() operation must clear the flags for the components which
1182 * were actually reset. On successful return, the flags indicate the 1249 * were actually reset. On successful return, the flags indicate the
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 8eeb205f298b..72090994d789 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -126,7 +126,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
126#define SKF_AD_HATYPE 28 126#define SKF_AD_HATYPE 28
127#define SKF_AD_RXHASH 32 127#define SKF_AD_RXHASH 32
128#define SKF_AD_CPU 36 128#define SKF_AD_CPU 36
129#define SKF_AD_MAX 40 129#define SKF_AD_ALU_XOR_X 40
130#define SKF_AD_MAX 44
130#define SKF_NET_OFF (-0x100000) 131#define SKF_NET_OFF (-0x100000)
131#define SKF_LL_OFF (-0x200000) 132#define SKF_LL_OFF (-0x200000)
132 133
@@ -153,6 +154,9 @@ static inline unsigned int sk_filter_len(const struct sk_filter *fp)
153extern int sk_filter(struct sock *sk, struct sk_buff *skb); 154extern int sk_filter(struct sock *sk, struct sk_buff *skb);
154extern unsigned int sk_run_filter(const struct sk_buff *skb, 155extern unsigned int sk_run_filter(const struct sk_buff *skb,
155 const struct sock_filter *filter); 156 const struct sock_filter *filter);
157extern int sk_unattached_filter_create(struct sk_filter **pfp,
158 struct sock_fprog *fprog);
159extern void sk_unattached_filter_destroy(struct sk_filter *fp);
156extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 160extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
157extern int sk_detach_filter(struct sock *sk); 161extern int sk_detach_filter(struct sock *sk);
158extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 162extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
@@ -228,6 +232,7 @@ enum {
228 BPF_S_ANC_HATYPE, 232 BPF_S_ANC_HATYPE,
229 BPF_S_ANC_RXHASH, 233 BPF_S_ANC_RXHASH,
230 BPF_S_ANC_CPU, 234 BPF_S_ANC_CPU,
235 BPF_S_ANC_ALU_XOR_X,
231}; 236};
232 237
233#endif /* __KERNEL__ */ 238#endif /* __KERNEL__ */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8de675523e46..25c40b9f848a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2051,6 +2051,7 @@ extern void unregister_blkdev(unsigned int, const char *);
2051extern struct block_device *bdget(dev_t); 2051extern struct block_device *bdget(dev_t);
2052extern struct block_device *bdgrab(struct block_device *bdev); 2052extern struct block_device *bdgrab(struct block_device *bdev);
2053extern void bd_set_size(struct block_device *, loff_t size); 2053extern void bd_set_size(struct block_device *, loff_t size);
2054extern sector_t blkdev_max_block(struct block_device *bdev);
2054extern void bd_forget(struct inode *inode); 2055extern void bd_forget(struct inode *inode);
2055extern void bdput(struct block_device *); 2056extern void bdput(struct block_device *);
2056extern void invalidate_bdev(struct block_device *); 2057extern void invalidate_bdev(struct block_device *);
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 5f3f3be5af09..176a939d1547 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -179,6 +179,7 @@ enum {
179 TRACE_EVENT_FL_RECORDED_CMD_BIT, 179 TRACE_EVENT_FL_RECORDED_CMD_BIT,
180 TRACE_EVENT_FL_CAP_ANY_BIT, 180 TRACE_EVENT_FL_CAP_ANY_BIT,
181 TRACE_EVENT_FL_NO_SET_FILTER_BIT, 181 TRACE_EVENT_FL_NO_SET_FILTER_BIT,
182 TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
182}; 183};
183 184
184enum { 185enum {
@@ -187,6 +188,7 @@ enum {
187 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), 188 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
188 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), 189 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
189 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 190 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
191 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
190}; 192};
191 193
192struct ftrace_event_call { 194struct ftrace_event_call {
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e61d3192448e..017a7fb5a1fc 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -222,12 +222,6 @@ static inline void part_pack_uuid(const u8 *uuid_str, u8 *to)
222 } 222 }
223} 223}
224 224
225static inline char *part_unpack_uuid(const u8 *uuid, char *out)
226{
227 sprintf(out, "%pU", uuid);
228 return out;
229}
230
231static inline int disk_max_parts(struct gendisk *disk) 225static inline int disk_max_parts(struct gendisk *disk)
232{ 226{
233 if (disk->flags & GENHD_FL_EXT_DEVT) 227 if (disk->flags & GENHD_FL_EXT_DEVT)
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 5852545e6bba..6af8738ae7e9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -274,6 +274,33 @@ struct hv_ring_buffer_debug_info {
274 u32 bytes_avail_towrite; 274 u32 bytes_avail_towrite;
275}; 275};
276 276
277
278/*
279 *
280 * hv_get_ringbuffer_availbytes()
281 *
282 * Get number of bytes available to read and to write to
283 * for the specified ring buffer
284 */
285static inline void
286hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
287 u32 *read, u32 *write)
288{
289 u32 read_loc, write_loc, dsize;
290
291 smp_read_barrier_depends();
292
293 /* Capture the read/write indices before they changed */
294 read_loc = rbi->ring_buffer->read_index;
295 write_loc = rbi->ring_buffer->write_index;
296 dsize = rbi->ring_datasize;
297
298 *write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
299 read_loc - write_loc;
300 *read = dsize - *write;
301}
302
303
277/* 304/*
278 * We use the same version numbering for all Hyper-V modules. 305 * We use the same version numbering for all Hyper-V modules.
279 * 306 *
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 1f90de0cfdbe..3993477103a5 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -171,8 +171,6 @@ static inline int twl_class_is_ ##class(void) \
171TWL_CLASS_IS(4030, TWL4030_CLASS_ID) 171TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
172TWL_CLASS_IS(6030, TWL6030_CLASS_ID) 172TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
173 173
174#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
175
176/* 174/*
177 * Read and write single 8-bit registers 175 * Read and write single 8-bit registers
178 */ 176 */
@@ -746,6 +744,17 @@ struct twl_regulator_driver_data {
746 void *data; 744 void *data;
747 unsigned long features; 745 unsigned long features;
748}; 746};
747/* chip-specific feature flags, for twl_regulator_driver_data.features */
748#define TWL4030_VAUX2 BIT(0) /* pre-5030 voltage ranges */
749#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
750#define TWL5031 BIT(2) /* twl5031 has different registers */
751#define TWL6030_CLASS BIT(3) /* TWL6030 class */
752#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
753#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
754 * but not officially supported.
755 * This flag is necessary to
756 * enable them.
757 */
749 758
750/*----------------------------------------------------------------------*/ 759/*----------------------------------------------------------------------*/
751 760
diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h
deleted file mode 100644
index 06695b74d405..000000000000
--- a/include/linux/ibmtr.h
+++ /dev/null
@@ -1,373 +0,0 @@
1#ifndef __LINUX_IBMTR_H__
2#define __LINUX_IBMTR_H__
3
4/* Definitions for an IBM Token Ring card. */
5/* This file is distributed under the GNU GPL */
6
7/* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */
8
9#define TR_RETRY_INTERVAL (30*HZ) /* 500 on PC = 5 s */
10#define TR_RST_TIME (msecs_to_jiffies(50)) /* 5 on PC = 50 ms */
11#define TR_BUSY_INTERVAL (msecs_to_jiffies(200)) /* 5 on PC = 200 ms */
12#define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */
13
14#define TR_ISA 1
15#define TR_MCA 2
16#define TR_ISAPNP 3
17#define NOTOK 0
18
19#define IBMTR_SHARED_RAM_SIZE 0x10000
20#define IBMTR_IO_EXTENT 4
21#define IBMTR_MAX_ADAPTERS 4
22
23#define CHANNEL_ID 0X1F30
24#define AIP 0X1F00
25#define AIPADAPTYPE 0X1FA0
26#define AIPDATARATE 0X1FA2
27#define AIPEARLYTOKEN 0X1FA4
28#define AIPAVAILSHRAM 0X1FA6
29#define AIPSHRAMPAGE 0X1FA8
30#define AIP4MBDHB 0X1FAA
31#define AIP16MBDHB 0X1FAC
32#define AIPFID 0X1FBA
33
34#define ADAPTRESET 0x1 /* Control Adapter reset (add to base) */
35#define ADAPTRESETREL 0x2 /* Release Adapter from reset ( """) */
36#define ADAPTINTREL 0x3 /* Adapter interrupt release */
37
38#define GLOBAL_INT_ENABLE 0x02f0
39
40/* MMIO bits 0-4 select register */
41#define RRR_EVEN 0x00 /* Shared RAM relocation registers - even and odd */
42/* Used to set the starting address of shared RAM */
43/* Bits 1 through 7 of this register map to bits 13 through 19 of the shared
44 RAM address.*/
45/* ie: 0x02 sets RAM address to ...ato! issy su wazzoo !! GODZILLA!!! */
46#define RRR_ODD 0x01
47/* Bits 2 and 3 of this register can be read to determine shared RAM size */
48/* 00 for 8k, 01 for 16k, 10 for 32k, 11 for 64k */
49#define WRBR_EVEN 0x02 /* Write region base registers - even and odd */
50#define WRBR_ODD 0x03
51#define WWOR_EVEN 0x04 /* Write window open registers - even and odd */
52#define WWOR_ODD 0x05
53#define WWCR_EVEN 0x06 /* Write window close registers - even and odd */
54#define WWCR_ODD 0x07
55
56/* Interrupt status registers - PC system - even and odd */
57#define ISRP_EVEN 0x08
58
59#define TCR_INT 0x10 /* Bit 4 - Timer interrupt. The TVR_EVEN timer has
60 expired. */
61#define ERR_INT 0x08 /* Bit 3 - Error interrupt. The adapter has had an
62 internal error. */
63#define ACCESS_INT 0x04 /* Bit 2 - Access interrupt. You have attempted to
64 write to an invalid area of shared RAM
65 or an invalid register within the MMIO. */
66/* In addition, the following bits within ISRP_EVEN can be turned on or off */
67/* by you to control the interrupt processing: */
68#define INT_ENABLE 0x40 /* Bit 6 - Interrupt enable. If 0, no interrupts will
69 occur. If 1, interrupts will occur normally.
70 Normally set to 1. */
71/* Bit 0 - Primary or alternate adapter. Set to zero if this adapter is the
72 primary adapter, 1 if this adapter is the alternate adapter. */
73
74
75#define ISRP_ODD 0x09
76
77#define ADAP_CHK_INT 0x40 /* Bit 6 - Adapter check. the adapter has
78 encountered a serious problem and has closed
79 itself. Whoa. */
80#define SRB_RESP_INT 0x20 /* Bit 5 - SRB response. The adapter has accepted
81 an SRB request and set the return code within
82 the SRB. */
83#define ASB_FREE_INT 0x10 /* Bit 4 - ASB free. The adapter has read the ASB
84 and this area can be safely reused. This interrupt
85 is only used if your application has set the ASB
86 free request bit in ISRA_ODD or if an error was
87 detected in your response. */
88#define ARB_CMD_INT 0x08 /* Bit 3 - ARB command. The adapter has given you a
89 command for action. The command is located in the
90 ARB area of shared memory. */
91#define SSB_RESP_INT 0x04 /* Bit 2 - SSB response. The adapter has posted a
92 response to your SRB (the response is located in
93 the SSB area of shared memory). */
94/* Bit 1 - Bridge frame forward complete. */
95
96
97
98#define ISRA_EVEN 0x0A /*Interrupt status registers - adapter - even and odd */
99/* Bit 7 - Internal parity error (on adapter's internal bus) */
100/* Bit 6 - Timer interrupt pending */
101/* Bit 5 - Access interrupt (attempt by adapter to access illegal address) */
102/* Bit 4 - Adapter microcode problem (microcode dead-man timer expired) */
103/* Bit 3 - Adapter processor check status */
104/* Bit 2 - Reserved */
105/* Bit 1 - Adapter hardware interrupt mask (prevents internal interrupts) */
106/* Bit 0 - Adapter software interrupt mask (prevents internal software ints) */
107
108#define ISRA_ODD 0x0B
109#define CMD_IN_SRB 0x20 /* Bit 5 - Indicates that you have placed a new
110 command in the SRB and are ready for the adapter to
111 process the command. */
112#define RESP_IN_ASB 0x10 /* Bit 4 - Indicates that you have placed a response
113 (an ASB) in the shared RAM which is available for
114 the adapter's use. */
115/* Bit 3 - Indicates that you are ready to put an SRB in the shared RAM, but
116 that a previous command is still pending. The adapter will then
117 interrupt you when the previous command is completed */
118/* Bit 2 - Indicates that you are ready to put an ASB in the shared RAM, but
119 that a previous ASB is still pending. The adapter will then interrupt
120 you when the previous ASB is copied. */
121#define ARB_FREE 0x2
122#define SSB_FREE 0x1
123
124#define TCR_EVEN 0x0C /* Timer control registers - even and odd */
125#define TCR_ODD 0x0D
126#define TVR_EVEN 0x0E /* Timer value registers - even and odd */
127#define TVR_ODD 0x0F
128#define SRPR_EVEN 0x18 /* Shared RAM paging registers - even and odd */
129#define SRPR_ENABLE_PAGING 0xc0
130#define SRPR_ODD 0x19 /* Not used. */
131#define TOKREAD 0x60
132#define TOKOR 0x40
133#define TOKAND 0x20
134#define TOKWRITE 0x00
135
136/* MMIO bits 5-6 select operation */
137/* 00 is used to write to a register */
138/* 01 is used to bitwise AND a byte with a register */
139/* 10 is used to bitwise OR a byte with a register */
140/* 11 is used to read from a register */
141
142/* MMIO bits 7-8 select area of interest.. see below */
143/* 00 selects attachment control area. */
144/* 01 is reserved. */
145/* 10 selects adapter identification area A containing the adapter encoded
146 address. */
147/* 11 selects the adapter identification area B containing test patterns. */
148
149#define PCCHANNELID 5049434F3631313039393020
150#define MCCHANNELID 4D4152533633583435313820
151
152#define ACA_OFFSET 0x1e00
153#define ACA_SET 0x40
154#define ACA_RESET 0x20
155#define ACA_RW 0x00
156
157#ifdef ENABLE_PAGING
158#define SET_PAGE(x) (writeb((x), ti->mmio + ACA_OFFSET+ ACA_RW + SRPR_EVEN))
159#else
160#define SET_PAGE(x)
161#endif
162
163/* do_tok_int possible values */
164#define FIRST_INT 1
165#define NOT_FIRST 2
166
167typedef enum { CLOSED, OPEN } open_state;
168//staic const char *printstate[] = { "CLOSED","OPEN"};
169
170struct tok_info {
171 unsigned char irq;
172 void __iomem *mmio;
173 unsigned char hw_address[32];
174 unsigned char adapter_type;
175 unsigned char data_rate;
176 unsigned char token_release;
177 unsigned char avail_shared_ram;
178 unsigned char shared_ram_paging;
179 unsigned char turbo;
180 unsigned short dhb_size4mb;
181 unsigned short rbuf_len4;
182 unsigned short rbuf_cnt4;
183 unsigned short maxmtu4;
184 unsigned short dhb_size16mb;
185 unsigned short rbuf_len16;
186 unsigned short rbuf_cnt16;
187 unsigned short maxmtu16;
188 /* Additions by David Morris */
189 unsigned char do_tok_int;
190 wait_queue_head_t wait_for_reset;
191 unsigned char sram_base;
192 /* Additions by Peter De Schrijver */
193 unsigned char page_mask; /* mask to select RAM page to Map*/
194 unsigned char mapped_ram_size; /* size of RAM page */
195 __u32 sram_phys; /* Shared memory base address */
196 void __iomem *sram_virt; /* Shared memory base address */
197 void __iomem *init_srb; /* Initial System Request Block address */
198 void __iomem *srb; /* System Request Block address */
199 void __iomem *ssb; /* System Status Block address */
200 void __iomem *arb; /* Adapter Request Block address */
201 void __iomem *asb; /* Adapter Status Block address */
202 __u8 init_srb_page;
203 __u8 srb_page;
204 __u8 ssb_page;
205 __u8 arb_page;
206 __u8 asb_page;
207 unsigned short exsap_station_id;
208 unsigned short global_int_enable;
209 struct sk_buff *current_skb;
210
211 unsigned char auto_speedsave;
212 open_state open_status, sap_status;
213 enum {MANUAL, AUTOMATIC} open_mode;
214 enum {FAIL, RESTART, REOPEN} open_action;
215 enum {NO, YES} open_failure;
216 unsigned char readlog_pending;
217 unsigned short adapter_int_enable; /* Adapter-specific int enable */
218 struct timer_list tr_timer;
219 unsigned char ring_speed;
220 spinlock_t lock; /* SMP protection */
221};
222
223/* token ring adapter commands */
224#define DIR_INTERRUPT 0x00 /* struct srb_interrupt */
225#define DIR_MOD_OPEN_PARAMS 0x01
226#define DIR_OPEN_ADAPTER 0x03 /* struct dir_open_adapter */
227#define DIR_CLOSE_ADAPTER 0x04
228#define DIR_SET_GRP_ADDR 0x06
229#define DIR_SET_FUNC_ADDR 0x07 /* struct srb_set_funct_addr */
230#define DIR_READ_LOG 0x08 /* struct srb_read_log */
231#define DLC_OPEN_SAP 0x15 /* struct dlc_open_sap */
232#define DLC_CLOSE_SAP 0x16
233#define DATA_LOST 0x20 /* struct asb_rec */
234#define REC_DATA 0x81 /* struct arb_rec_req */
235#define XMIT_DATA_REQ 0x82 /* struct arb_xmit_req */
236#define DLC_STATUS 0x83 /* struct arb_dlc_status */
237#define RING_STAT_CHANGE 0x84 /* struct dlc_open_sap ??? */
238
239/* DIR_OPEN_ADAPTER options */
240#define OPEN_PASS_BCON_MAC 0x0100
241#define NUM_RCV_BUF 2
242#define RCV_BUF_LEN 1024
243#define DHB_LENGTH 2048
244#define NUM_DHB 2
245#define DLC_MAX_SAP 2
246#define DLC_MAX_STA 1
247
248/* DLC_OPEN_SAP options */
249#define MAX_I_FIELD 0x0088
250#define SAP_OPEN_IND_SAP 0x04
251#define SAP_OPEN_PRIORITY 0x20
252#define SAP_OPEN_STATION_CNT 0x1
253#define XMIT_DIR_FRAME 0x0A
254#define XMIT_UI_FRAME 0x0d
255#define XMIT_XID_CMD 0x0e
256#define XMIT_TEST_CMD 0x11
257
258/* srb close return code */
259#define SIGNAL_LOSS 0x8000
260#define HARD_ERROR 0x4000
261#define XMIT_BEACON 0x1000
262#define LOBE_FAULT 0x0800
263#define AUTO_REMOVAL 0x0400
264#define REMOVE_RECV 0x0100
265#define LOG_OVERFLOW 0x0080
266#define RING_RECOVER 0x0020
267
268struct srb_init_response {
269 unsigned char command;
270 unsigned char init_status;
271 unsigned char init_status_2;
272 unsigned char reserved[3];
273 __u16 bring_up_code;
274 __u16 encoded_address;
275 __u16 level_address;
276 __u16 adapter_address;
277 __u16 parms_address;
278 __u16 mac_address;
279};
280
281struct dir_open_adapter {
282 unsigned char command;
283 char reserved[7];
284 __u16 open_options;
285 unsigned char node_address[6];
286 unsigned char group_address[4];
287 unsigned char funct_address[4];
288 __u16 num_rcv_buf;
289 __u16 rcv_buf_len;
290 __u16 dhb_length;
291 unsigned char num_dhb;
292 char reserved2;
293 unsigned char dlc_max_sap;
294 unsigned char dlc_max_sta;
295 unsigned char dlc_max_gsap;
296 unsigned char dlc_max_gmem;
297 unsigned char dlc_t1_tick_1;
298 unsigned char dlc_t2_tick_1;
299 unsigned char dlc_ti_tick_1;
300 unsigned char dlc_t1_tick_2;
301 unsigned char dlc_t2_tick_2;
302 unsigned char dlc_ti_tick_2;
303 unsigned char product_id[18];
304};
305
306struct dlc_open_sap {
307 unsigned char command;
308 unsigned char reserved1;
309 unsigned char ret_code;
310 unsigned char reserved2;
311 __u16 station_id;
312 unsigned char timer_t1;
313 unsigned char timer_t2;
314 unsigned char timer_ti;
315 unsigned char maxout;
316 unsigned char maxin;
317 unsigned char maxout_incr;
318 unsigned char max_retry_count;
319 unsigned char gsap_max_mem;
320 __u16 max_i_field;
321 unsigned char sap_value;
322 unsigned char sap_options;
323 unsigned char station_count;
324 unsigned char sap_gsap_mem;
325 unsigned char gsap[0];
326};
327
328struct srb_xmit {
329 unsigned char command;
330 unsigned char cmd_corr;
331 unsigned char ret_code;
332 unsigned char reserved1;
333 __u16 station_id;
334};
335
336struct arb_rec_req {
337 unsigned char command;
338 unsigned char reserved1[3];
339 __u16 station_id;
340 __u16 rec_buf_addr;
341 unsigned char lan_hdr_len;
342 unsigned char dlc_hdr_len;
343 __u16 frame_len;
344 unsigned char msg_type;
345};
346
347struct asb_rec {
348 unsigned char command;
349 unsigned char reserved1;
350 unsigned char ret_code;
351 unsigned char reserved2;
352 __u16 station_id;
353 __u16 rec_buf_addr;
354};
355
356struct rec_buf {
357 unsigned char reserved1[2];
358 __u16 buf_ptr;
359 unsigned char reserved2;
360 unsigned char receive_fs;
361 __u16 buf_len;
362 unsigned char data[0];
363};
364
365struct srb_set_funct_addr {
366 unsigned char command;
367 unsigned char reserved1;
368 unsigned char ret_code;
369 unsigned char reserved2[3];
370 unsigned char funct_address[4];
371};
372
373#endif
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 210e2c325534..ce9af8918514 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -640,9 +640,9 @@ struct ieee80211_rann_ie {
640 u8 rann_hopcount; 640 u8 rann_hopcount;
641 u8 rann_ttl; 641 u8 rann_ttl;
642 u8 rann_addr[6]; 642 u8 rann_addr[6];
643 u32 rann_seq; 643 __le32 rann_seq;
644 u32 rann_interval; 644 __le32 rann_interval;
645 u32 rann_metric; 645 __le32 rann_metric;
646} __attribute__ ((packed)); 646} __attribute__ ((packed));
647 647
648enum ieee80211_rann_flags { 648enum ieee80211_rann_flags {
@@ -1007,13 +1007,13 @@ enum ieee80211_min_mpdu_spacing {
1007}; 1007};
1008 1008
1009/** 1009/**
1010 * struct ieee80211_ht_info - HT information 1010 * struct ieee80211_ht_operation - HT operation IE
1011 * 1011 *
1012 * This structure is the "HT information element" as 1012 * This structure is the "HT operation element" as
1013 * described in 802.11n D5.0 7.3.2.58 1013 * described in 802.11n-2009 7.3.2.57
1014 */ 1014 */
1015struct ieee80211_ht_info { 1015struct ieee80211_ht_operation {
1016 u8 control_chan; 1016 u8 primary_chan;
1017 u8 ht_param; 1017 u8 ht_param;
1018 __le16 operation_mode; 1018 __le16 operation_mode;
1019 __le16 stbc_param; 1019 __le16 stbc_param;
@@ -1027,8 +1027,6 @@ struct ieee80211_ht_info {
1027#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03 1027#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
1028#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04 1028#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
1029#define IEEE80211_HT_PARAM_RIFS_MODE 0x08 1029#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
1030#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
1031#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
1032 1030
1033/* for operation_mode */ 1031/* for operation_mode */
1034#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003 1032#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
@@ -1301,7 +1299,7 @@ enum ieee80211_eid {
1301 WLAN_EID_EXT_SUPP_RATES = 50, 1299 WLAN_EID_EXT_SUPP_RATES = 50,
1302 1300
1303 WLAN_EID_HT_CAPABILITY = 45, 1301 WLAN_EID_HT_CAPABILITY = 45,
1304 WLAN_EID_HT_INFORMATION = 61, 1302 WLAN_EID_HT_OPERATION = 61,
1305 1303
1306 WLAN_EID_RSN = 48, 1304 WLAN_EID_RSN = 48,
1307 WLAN_EID_MMIE = 76, 1305 WLAN_EID_MMIE = 76,
@@ -1441,6 +1439,18 @@ enum ieee80211_tdls_actioncode {
1441#define WLAN_TDLS_SNAP_RFTYPE 0x2 1439#define WLAN_TDLS_SNAP_RFTYPE 0x2
1442 1440
1443/** 1441/**
1442 * enum - mesh synchronization method identifier
1443 *
1444 * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method
1445 * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method
1446 * that will be specified in a vendor specific information element
1447 */
1448enum {
1449 IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1,
1450 IEEE80211_SYNC_METHOD_VENDOR = 255,
1451};
1452
1453/**
1444 * enum - mesh path selection protocol identifier 1454 * enum - mesh path selection protocol identifier
1445 * 1455 *
1446 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol 1456 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
@@ -1448,7 +1458,7 @@ enum ieee80211_tdls_actioncode {
1448 * be specified in a vendor specific information element 1458 * be specified in a vendor specific information element
1449 */ 1459 */
1450enum { 1460enum {
1451 IEEE80211_PATH_PROTOCOL_HWMP = 0, 1461 IEEE80211_PATH_PROTOCOL_HWMP = 1,
1452 IEEE80211_PATH_PROTOCOL_VENDOR = 255, 1462 IEEE80211_PATH_PROTOCOL_VENDOR = 255,
1453}; 1463};
1454 1464
@@ -1460,7 +1470,7 @@ enum {
1460 * specified in a vendor specific information element 1470 * specified in a vendor specific information element
1461 */ 1471 */
1462enum { 1472enum {
1463 IEEE80211_PATH_METRIC_AIRTIME = 0, 1473 IEEE80211_PATH_METRIC_AIRTIME = 1,
1464 IEEE80211_PATH_METRIC_VENDOR = 255, 1474 IEEE80211_PATH_METRIC_VENDOR = 255,
1465}; 1475};
1466 1476
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 6d722f41ee7c..26cb3c2c5c71 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -82,11 +82,12 @@
82#define ARPHRD_FCPL 786 /* Fibrechannel public loop */ 82#define ARPHRD_FCPL 786 /* Fibrechannel public loop */
83#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ 83#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */
84 /* 787->799 reserved for fibrechannel media types */ 84 /* 787->799 reserved for fibrechannel media types */
85#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ 85/* 800 used to be used for token ring */
86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ 86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89#define ARPHRD_IEEE802154 804 89#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */
90 91
91#define ARPHRD_PHONET 820 /* PhoNet media type */ 92#define ARPHRD_PHONET 820 /* PhoNet media type */
92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
diff --git a/include/linux/if_ec.h b/include/linux/if_ec.h
deleted file mode 100644
index d85f9f48129f..000000000000
--- a/include/linux/if_ec.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/* Definitions for Econet sockets. */
2
3#ifndef __LINUX_IF_EC
4#define __LINUX_IF_EC
5
6/* User visible stuff. Glibc provides its own but libc5 folk will use these */
7
8struct ec_addr {
9 unsigned char station; /* Station number. */
10 unsigned char net; /* Network number. */
11};
12
13struct sockaddr_ec {
14 unsigned short sec_family;
15 unsigned char port; /* Port number. */
16 unsigned char cb; /* Control/flag byte. */
17 unsigned char type; /* Type of message. */
18 struct ec_addr addr;
19 unsigned long cookie;
20};
21
22#define ECTYPE_PACKET_RECEIVED 0 /* Packet received */
23#define ECTYPE_TRANSMIT_STATUS 0x10 /* Transmit completed,
24 low nibble holds status */
25
26#define ECTYPE_TRANSMIT_OK 1
27#define ECTYPE_TRANSMIT_NOT_LISTENING 2
28#define ECTYPE_TRANSMIT_NET_ERROR 3
29#define ECTYPE_TRANSMIT_NO_CLOCK 4
30#define ECTYPE_TRANSMIT_LINE_JAMMED 5
31#define ECTYPE_TRANSMIT_NOT_PRESENT 6
32
33#ifdef __KERNEL__
34
35#define EC_HLEN 6
36
37/* This is what an Econet frame looks like on the wire. */
38struct ec_framehdr {
39 unsigned char dst_stn;
40 unsigned char dst_net;
41 unsigned char src_stn;
42 unsigned char src_net;
43 unsigned char cb;
44 unsigned char port;
45};
46
47struct econet_sock {
48 /* struct sock has to be the first member of econet_sock */
49 struct sock sk;
50 unsigned char cb;
51 unsigned char port;
52 unsigned char station;
53 unsigned char net;
54 unsigned short num;
55};
56
57static inline struct econet_sock *ec_sk(const struct sock *sk)
58{
59 return (struct econet_sock *)sk;
60}
61
62struct ec_device {
63 unsigned char station, net; /* Econet protocol address */
64};
65
66#endif
67
68#endif
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 4b24ff453aee..f715750d0b87 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -138,6 +138,8 @@ enum {
138 IFLA_GROUP, /* Group the device belongs to */ 138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD, 139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */ 140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
141 IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */
142#define IFLA_PROMISCUITY IFLA_PROMISCUITY
141 __IFLA_MAX 143 __IFLA_MAX
142}; 144};
143 145
@@ -253,6 +255,7 @@ struct ifla_vlan_qos_mapping {
253enum { 255enum {
254 IFLA_MACVLAN_UNSPEC, 256 IFLA_MACVLAN_UNSPEC,
255 IFLA_MACVLAN_MODE, 257 IFLA_MACVLAN_MODE,
258 IFLA_MACVLAN_FLAGS,
256 __IFLA_MACVLAN_MAX, 259 __IFLA_MACVLAN_MAX,
257}; 260};
258 261
@@ -265,6 +268,8 @@ enum macvlan_mode {
265 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ 268 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
266}; 269};
267 270
271#define MACVLAN_FLAG_NOPROMISC 1
272
268/* SR-IOV virtual function management section */ 273/* SR-IOV virtual function management section */
269 274
270enum { 275enum {
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index d103dca5c563..f65e8d250f7e 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -60,6 +60,7 @@ struct macvlan_dev {
60 struct net_device *lowerdev; 60 struct net_device *lowerdev;
61 struct macvlan_pcpu_stats __percpu *pcpu_stats; 61 struct macvlan_pcpu_stats __percpu *pcpu_stats;
62 enum macvlan_mode mode; 62 enum macvlan_mode mode;
63 u16 flags;
63 int (*receive)(struct sk_buff *skb); 64 int (*receive)(struct sk_buff *skb);
64 int (*forward)(struct net_device *dev, struct sk_buff *skb); 65 int (*forward)(struct net_device *dev, struct sk_buff *skb);
65 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES]; 66 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES];
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index 23cefa1111bf..b4775418d525 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -19,10 +19,11 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/in.h> 21#include <linux/in.h>
22#include <linux/in6.h>
22#endif 23#endif
23 24
24/* Structure used to connect() the socket to a particular tunnel UDP 25/* Structure used to connect() the socket to a particular tunnel UDP
25 * socket. 26 * socket over IPv4.
26 */ 27 */
27struct pppol2tp_addr { 28struct pppol2tp_addr {
28 __kernel_pid_t pid; /* pid that owns the fd. 29 __kernel_pid_t pid; /* pid that owns the fd.
@@ -35,6 +36,20 @@ struct pppol2tp_addr {
35 __u16 d_tunnel, d_session; /* For sending outgoing packets */ 36 __u16 d_tunnel, d_session; /* For sending outgoing packets */
36}; 37};
37 38
39/* Structure used to connect() the socket to a particular tunnel UDP
40 * socket over IPv6.
41 */
42struct pppol2tpin6_addr {
43 __kernel_pid_t pid; /* pid that owns the fd.
44 * 0 => current */
45 int fd; /* FD of UDP socket to use */
46
47 __u16 s_tunnel, s_session; /* For matching incoming packets */
48 __u16 d_tunnel, d_session; /* For sending outgoing packets */
49
50 struct sockaddr_in6 addr; /* IP address and port to send to */
51};
52
38/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 53/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
39 * bits. So we need a different sockaddr structure. 54 * bits. So we need a different sockaddr structure.
40 */ 55 */
@@ -49,6 +64,17 @@ struct pppol2tpv3_addr {
49 __u32 d_tunnel, d_session; /* For sending outgoing packets */ 64 __u32 d_tunnel, d_session; /* For sending outgoing packets */
50}; 65};
51 66
67struct pppol2tpv3in6_addr {
68 __kernel_pid_t pid; /* pid that owns the fd.
69 * 0 => current */
70 int fd; /* FD of UDP or IP socket to use */
71
72 __u32 s_tunnel, s_session; /* For matching incoming packets */
73 __u32 d_tunnel, d_session; /* For sending outgoing packets */
74
75 struct sockaddr_in6 addr; /* IP address and port to send to */
76};
77
52/* Socket options: 78/* Socket options:
53 * DEBUG - bitmask of debug message categories 79 * DEBUG - bitmask of debug message categories
54 * SENDSEQ - 0 => don't send packets with sequence numbers 80 * SENDSEQ - 0 => don't send packets with sequence numbers
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index b5f927f59f26..09c474c480cd 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -70,7 +70,7 @@ struct sockaddr_pppox {
70 struct pppoe_addr pppoe; 70 struct pppoe_addr pppoe;
71 struct pptp_addr pptp; 71 struct pptp_addr pptp;
72 } sa_addr; 72 } sa_addr;
73} __attribute__((packed)); 73} __packed;
74 74
75/* The use of the above union isn't viable because the size of this 75/* The use of the above union isn't viable because the size of this
76 * struct must stay fixed over time -- applications use sizeof(struct 76 * struct must stay fixed over time -- applications use sizeof(struct
@@ -81,7 +81,13 @@ struct sockaddr_pppol2tp {
81 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ 81 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
82 unsigned int sa_protocol; /* protocol identifier */ 82 unsigned int sa_protocol; /* protocol identifier */
83 struct pppol2tp_addr pppol2tp; 83 struct pppol2tp_addr pppol2tp;
84} __attribute__((packed)); 84} __packed;
85
86struct sockaddr_pppol2tpin6 {
87 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
88 unsigned int sa_protocol; /* protocol identifier */
89 struct pppol2tpin6_addr pppol2tp;
90} __packed;
85 91
86/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 92/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
87 * bits. So we need a different sockaddr structure. 93 * bits. So we need a different sockaddr structure.
@@ -90,7 +96,13 @@ struct sockaddr_pppol2tpv3 {
90 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ 96 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
91 unsigned int sa_protocol; /* protocol identifier */ 97 unsigned int sa_protocol; /* protocol identifier */
92 struct pppol2tpv3_addr pppol2tp; 98 struct pppol2tpv3_addr pppol2tp;
93} __attribute__((packed)); 99} __packed;
100
101struct sockaddr_pppol2tpv3in6 {
102 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
103 unsigned int sa_protocol; /* protocol identifier */
104 struct pppol2tpv3in6_addr pppol2tp;
105} __packed;
94 106
95/********************************************************************* 107/*********************************************************************
96 * 108 *
@@ -140,7 +152,7 @@ struct pppoe_hdr {
140 __be16 sid; 152 __be16 sid;
141 __be16 length; 153 __be16 length;
142 struct pppoe_tag tag[0]; 154 struct pppoe_tag tag[0];
143} __attribute__((packed)); 155} __packed;
144 156
145/* Length of entire PPPoE + PPP header */ 157/* Length of entire PPPoE + PPP header */
146#define PPPOE_SES_HLEN 8 158#define PPPOE_SES_HLEN 8
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 58404b0c5010..8185f57a9c7f 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -28,10 +28,28 @@ struct team;
28 28
29struct team_port { 29struct team_port {
30 struct net_device *dev; 30 struct net_device *dev;
31 struct hlist_node hlist; /* node in hash list */ 31 struct hlist_node hlist; /* node in enabled ports hash list */
32 struct list_head list; /* node in ordinary list */ 32 struct list_head list; /* node in ordinary list */
33 struct team *team; 33 struct team *team;
34 int index; 34 int index; /* index of enabled port. If disabled, it's set to -1 */
35
36 bool linkup; /* either state.linkup or user.linkup */
37
38 struct {
39 bool linkup;
40 u32 speed;
41 u8 duplex;
42 } state;
43
44 /* Values set by userspace */
45 struct {
46 bool linkup;
47 bool linkup_enabled;
48 } user;
49
50 /* Custom gennetlink interface related flags */
51 bool changed;
52 bool removed;
35 53
36 /* 54 /*
37 * A place for storing original values of the device before it 55 * A place for storing original values of the device before it
@@ -42,14 +60,6 @@ struct team_port {
42 unsigned int mtu; 60 unsigned int mtu;
43 } orig; 61 } orig;
44 62
45 bool linkup;
46 u32 speed;
47 u8 duplex;
48
49 /* Custom gennetlink interface related flags */
50 bool changed;
51 bool removed;
52
53 struct rcu_head rcu; 63 struct rcu_head rcu;
54}; 64};
55 65
@@ -68,18 +78,30 @@ struct team_mode_ops {
68enum team_option_type { 78enum team_option_type {
69 TEAM_OPTION_TYPE_U32, 79 TEAM_OPTION_TYPE_U32,
70 TEAM_OPTION_TYPE_STRING, 80 TEAM_OPTION_TYPE_STRING,
81 TEAM_OPTION_TYPE_BINARY,
82 TEAM_OPTION_TYPE_BOOL,
83};
84
85struct team_gsetter_ctx {
86 union {
87 u32 u32_val;
88 const char *str_val;
89 struct {
90 const void *ptr;
91 u32 len;
92 } bin_val;
93 bool bool_val;
94 } data;
95 struct team_port *port;
71}; 96};
72 97
73struct team_option { 98struct team_option {
74 struct list_head list; 99 struct list_head list;
75 const char *name; 100 const char *name;
101 bool per_port;
76 enum team_option_type type; 102 enum team_option_type type;
77 int (*getter)(struct team *team, void *arg); 103 int (*getter)(struct team *team, struct team_gsetter_ctx *ctx);
78 int (*setter)(struct team *team, void *arg); 104 int (*setter)(struct team *team, struct team_gsetter_ctx *ctx);
79
80 /* Custom gennetlink interface related flags */
81 bool changed;
82 bool removed;
83}; 105};
84 106
85struct team_mode { 107struct team_mode {
@@ -103,13 +125,15 @@ struct team {
103 struct mutex lock; /* used for overall locking, e.g. port lists write */ 125 struct mutex lock; /* used for overall locking, e.g. port lists write */
104 126
105 /* 127 /*
106 * port lists with port count 128 * List of enabled ports and their count
107 */ 129 */
108 int port_count; 130 int en_port_count;
109 struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES]; 131 struct hlist_head en_port_hlist[TEAM_PORT_HASHENTRIES];
110 struct list_head port_list; 132
133 struct list_head port_list; /* list of all ports */
111 134
112 struct list_head option_list; 135 struct list_head option_list;
136 struct list_head option_inst_list; /* list of option instances */
113 137
114 const struct team_mode *mode; 138 const struct team_mode *mode;
115 struct team_mode_ops ops; 139 struct team_mode_ops ops;
@@ -119,7 +143,7 @@ struct team {
119static inline struct hlist_head *team_port_index_hash(struct team *team, 143static inline struct hlist_head *team_port_index_hash(struct team *team,
120 int port_index) 144 int port_index)
121{ 145{
122 return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)]; 146 return &team->en_port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
123} 147}
124 148
125static inline struct team_port *team_get_port_by_index(struct team *team, 149static inline struct team_port *team_get_port_by_index(struct team *team,
@@ -216,6 +240,7 @@ enum {
216 TEAM_ATTR_OPTION_TYPE, /* u8 */ 240 TEAM_ATTR_OPTION_TYPE, /* u8 */
217 TEAM_ATTR_OPTION_DATA, /* dynamic */ 241 TEAM_ATTR_OPTION_DATA, /* dynamic */
218 TEAM_ATTR_OPTION_REMOVED, /* flag */ 242 TEAM_ATTR_OPTION_REMOVED, /* flag */
243 TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */
219 244
220 __TEAM_ATTR_OPTION_MAX, 245 __TEAM_ATTR_OPTION_MAX,
221 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, 246 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
deleted file mode 100644
index fc23aeb0f201..000000000000
--- a/include/linux/if_tr.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the Token-Ring IEEE 802.5 interface.
7 *
8 * Version: @(#)if_tr.h 0.0 07/11/94
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org>
12 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
18 */
19#ifndef _LINUX_IF_TR_H
20#define _LINUX_IF_TR_H
21
22#include <linux/types.h>
23#include <asm/byteorder.h> /* For __be16 */
24
25/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble
26 and FCS/CRC (frame check sequence). */
27#define TR_ALEN 6 /* Octets in one token-ring addr */
28#define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc))
29#define AC 0x10
30#define LLC_FRAME 0x40
31
32/* LLC and SNAP constants */
33#define EXTENDED_SAP 0xAA
34#define UI_CMD 0x03
35
36/* This is an Token-Ring frame header. */
37struct trh_hdr {
38 __u8 ac; /* access control field */
39 __u8 fc; /* frame control field */
40 __u8 daddr[TR_ALEN]; /* destination address */
41 __u8 saddr[TR_ALEN]; /* source address */
42 __be16 rcf; /* route control field */
43 __be16 rseg[8]; /* routing registers */
44};
45
46#ifdef __KERNEL__
47#include <linux/skbuff.h>
48
49static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
50{
51 return (struct trh_hdr *)skb_mac_header(skb);
52}
53#endif
54
55/* This is an Token-Ring LLC structure */
56struct trllc {
57 __u8 dsap; /* destination SAP */
58 __u8 ssap; /* source SAP */
59 __u8 llc; /* LLC control field */
60 __u8 protid[3]; /* protocol id */
61 __be16 ethertype; /* ether type field */
62};
63
64/* Token-Ring statistics collection data. */
65struct tr_statistics {
66 unsigned long rx_packets; /* total packets received */
67 unsigned long tx_packets; /* total packets transmitted */
68 unsigned long rx_bytes; /* total bytes received */
69 unsigned long tx_bytes; /* total bytes transmitted */
70 unsigned long rx_errors; /* bad packets received */
71 unsigned long tx_errors; /* packet transmit problems */
72 unsigned long rx_dropped; /* no space in linux buffers */
73 unsigned long tx_dropped; /* no space available in linux */
74 unsigned long multicast; /* multicast packets received */
75 unsigned long transmit_collision;
76
77 /* detailed Token-Ring errors. See IBM Token-Ring Network
78 Architecture for more info */
79
80 unsigned long line_errors;
81 unsigned long internal_errors;
82 unsigned long burst_errors;
83 unsigned long A_C_errors;
84 unsigned long abort_delimiters;
85 unsigned long lost_frames;
86 unsigned long recv_congest_count;
87 unsigned long frame_copied_errors;
88 unsigned long frequency_errors;
89 unsigned long token_errors;
90 unsigned long dummy1;
91};
92
93/* source routing stuff */
94#define TR_RII 0x80
95#define TR_RCF_DIR_BIT 0x80
96#define TR_RCF_LEN_MASK 0x1f00
97#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */
98#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
99#define TR_RCF_FRAME2K 0x20
100#define TR_RCF_BROADCAST_MASK 0xC000
101#define TR_MAXRIFLEN 18
102
103#endif /* _LINUX_IF_TR_H */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 5c83d9e3eb8f..cba469ba11a4 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -142,7 +142,7 @@ struct in6_flowlabel_req {
142/* 142/*
143 * IPv6 TLV options. 143 * IPv6 TLV options.
144 */ 144 */
145#define IPV6_TLV_PAD0 0 145#define IPV6_TLV_PAD1 0
146#define IPV6_TLV_PADN 1 146#define IPV6_TLV_PADN 1
147#define IPV6_TLV_ROUTERALERT 5 147#define IPV6_TLV_ROUTERALERT 5
148#define IPV6_TLV_JUMBO 194 148#define IPV6_TLV_JUMBO 194
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index e885ba23de70..589e0e75efae 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -223,5 +223,12 @@ extern int
223walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 223walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
224 void *arg, int (*func)(unsigned long, unsigned long, void *)); 224 void *arg, int (*func)(unsigned long, unsigned long, void *));
225 225
226/* True if any part of r1 overlaps r2 */
227static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
228{
229 return (r1->start <= r2->end && r1->end >= r2->start);
230}
231
232
226#endif /* __ASSEMBLY__ */ 233#endif /* __ASSEMBLY__ */
227#endif /* _LINUX_IOPORT_H */ 234#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index 4deb3834d62c..8a2d438dc499 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -89,6 +89,7 @@
89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ 89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ 90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
91 91
92/* Initial bits allowed in backup server */
92#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \ 93#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \
93 IP_VS_CONN_F_NOOUTPUT | \ 94 IP_VS_CONN_F_NOOUTPUT | \
94 IP_VS_CONN_F_INACTIVE | \ 95 IP_VS_CONN_F_INACTIVE | \
@@ -97,6 +98,10 @@
97 IP_VS_CONN_F_TEMPLATE \ 98 IP_VS_CONN_F_TEMPLATE \
98 ) 99 )
99 100
101/* Bits allowed to update in backup server */
102#define IP_VS_CONN_F_BACKUP_UPD_MASK (IP_VS_CONN_F_INACTIVE | \
103 IP_VS_CONN_F_SEQ_MASK)
104
100/* Flags that are not sent to backup server start from bit 16 */ 105/* Flags that are not sent to backup server start from bit 16 */
101#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ 106#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */
102 107
@@ -125,8 +130,8 @@ struct ip_vs_service_user {
125 130
126 /* virtual service options */ 131 /* virtual service options */
127 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 132 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
128 unsigned flags; /* virtual service flags */ 133 unsigned int flags; /* virtual service flags */
129 unsigned timeout; /* persistent timeout in sec */ 134 unsigned int timeout; /* persistent timeout in sec */
130 __be32 netmask; /* persistent netmask */ 135 __be32 netmask; /* persistent netmask */
131}; 136};
132 137
@@ -137,7 +142,7 @@ struct ip_vs_dest_user {
137 __be16 port; 142 __be16 port;
138 143
139 /* real server options */ 144 /* real server options */
140 unsigned conn_flags; /* connection flags */ 145 unsigned int conn_flags; /* connection flags */
141 int weight; /* destination weight */ 146 int weight; /* destination weight */
142 147
143 /* thresholds for active connections */ 148 /* thresholds for active connections */
@@ -187,8 +192,8 @@ struct ip_vs_service_entry {
187 192
188 /* service options */ 193 /* service options */
189 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 194 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
190 unsigned flags; /* virtual service flags */ 195 unsigned int flags; /* virtual service flags */
191 unsigned timeout; /* persistent timeout */ 196 unsigned int timeout; /* persistent timeout */
192 __be32 netmask; /* persistent netmask */ 197 __be32 netmask; /* persistent netmask */
193 198
194 /* number of real servers */ 199 /* number of real servers */
@@ -202,7 +207,7 @@ struct ip_vs_service_entry {
202struct ip_vs_dest_entry { 207struct ip_vs_dest_entry {
203 __be32 addr; /* destination address */ 208 __be32 addr; /* destination address */
204 __be16 port; 209 __be16 port;
205 unsigned conn_flags; /* connection flags */ 210 unsigned int conn_flags; /* connection flags */
206 int weight; /* destination weight */ 211 int weight; /* destination weight */
207 212
208 __u32 u_threshold; /* upper threshold */ 213 __u32 u_threshold; /* upper threshold */
diff --git a/include/linux/ipx.h b/include/linux/ipx.h
index 3d48014cdd71..8f0243982eb6 100644
--- a/include/linux/ipx.h
+++ b/include/linux/ipx.h
@@ -38,7 +38,7 @@ struct ipx_interface_definition {
38#define IPX_FRAME_8022 2 38#define IPX_FRAME_8022 2
39#define IPX_FRAME_ETHERII 3 39#define IPX_FRAME_ETHERII 3
40#define IPX_FRAME_8023 4 40#define IPX_FRAME_8023 4
41#define IPX_FRAME_TR_8022 5 /* obsolete */ 41/* obsolete token ring was 5 */
42 unsigned char ipx_special; 42 unsigned char ipx_special;
43#define IPX_SPECIAL_NONE 0 43#define IPX_SPECIAL_NONE 0
44#define IPX_PRIMARY 1 44#define IPX_PRIMARY 1
diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h
index e77d7f9bb246..7eab668f60f3 100644
--- a/include/linux/l2tp.h
+++ b/include/linux/l2tp.h
@@ -11,6 +11,7 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/in6.h>
14#else 15#else
15#include <netinet/in.h> 16#include <netinet/in.h>
16#endif 17#endif
@@ -39,6 +40,22 @@ struct sockaddr_l2tpip {
39 sizeof(__u32)]; 40 sizeof(__u32)];
40}; 41};
41 42
43/**
44 * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets
45 * @l2tp_family: address family number AF_L2TPIP.
46 * @l2tp_addr: protocol specific address information
47 * @l2tp_conn_id: connection id of tunnel
48 */
49struct sockaddr_l2tpip6 {
50 /* The first fields must match struct sockaddr_in6 */
51 __kernel_sa_family_t l2tp_family; /* AF_INET6 */
52 __be16 l2tp_unused; /* INET port number (unused) */
53 __be32 l2tp_flowinfo; /* IPv6 flow information */
54 struct in6_addr l2tp_addr; /* IPv6 address */
55 __u32 l2tp_scope_id; /* scope id (new in RFC2553) */
56 __u32 l2tp_conn_id; /* Connection ID of tunnel */
57};
58
42/***************************************************************************** 59/*****************************************************************************
43 * NETLINK_GENERIC netlink family. 60 * NETLINK_GENERIC netlink family.
44 *****************************************************************************/ 61 *****************************************************************************/
@@ -108,6 +125,8 @@ enum {
108 L2TP_ATTR_MTU, /* u16 */ 125 L2TP_ATTR_MTU, /* u16 */
109 L2TP_ATTR_MRU, /* u16 */ 126 L2TP_ATTR_MRU, /* u16 */
110 L2TP_ATTR_STATS, /* nested */ 127 L2TP_ATTR_STATS, /* nested */
128 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
129 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
111 __L2TP_ATTR_MAX, 130 __L2TP_ATTR_MAX,
112}; 131};
113 132
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index 4af841408fb5..d0752eca9b44 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -72,7 +72,9 @@
72#define FLG_LL_OK 24 72#define FLG_LL_OK 24
73#define FLG_LL_CONN 25 73#define FLG_LL_CONN 25
74#define FLG_DTMFSEND 26 74#define FLG_DTMFSEND 26
75 75#define FLG_TX_EMPTY 27
76/* stop sending received data upstream */
77#define FLG_RX_OFF 28
76/* workq events */ 78/* workq events */
77#define FLG_RECVQUEUE 30 79#define FLG_RECVQUEUE 30
78#define FLG_PHCHANGE 31 80#define FLG_PHCHANGE 31
@@ -135,10 +137,14 @@ extern int create_l1(struct dchannel *, dchannel_l1callback *);
135#define HW_TESTRX_RAW 0x9602 137#define HW_TESTRX_RAW 0x9602
136#define HW_TESTRX_HDLC 0x9702 138#define HW_TESTRX_HDLC 0x9702
137#define HW_TESTRX_OFF 0x9802 139#define HW_TESTRX_OFF 0x9802
140#define HW_TIMER3_IND 0x9902
141#define HW_TIMER3_VALUE 0x9a00
142#define HW_TIMER3_VMASK 0x00FF
138 143
139struct layer1; 144struct layer1;
140extern int l1_event(struct layer1 *, u_int); 145extern int l1_event(struct layer1 *, u_int);
141 146
147#define MISDN_BCH_FILL_SIZE 4
142 148
143struct bchannel { 149struct bchannel {
144 struct mISDNchannel ch; 150 struct mISDNchannel ch;
@@ -150,8 +156,14 @@ struct bchannel {
150 int slot; /* multiport card channel slot */ 156 int slot; /* multiport card channel slot */
151 struct timer_list timer; 157 struct timer_list timer;
152 /* receive data */ 158 /* receive data */
159 u8 fill[MISDN_BCH_FILL_SIZE];
153 struct sk_buff *rx_skb; 160 struct sk_buff *rx_skb;
154 int maxlen; 161 unsigned short maxlen;
162 unsigned short init_maxlen; /* initial value */
163 unsigned short next_maxlen; /* pending value */
164 unsigned short minlen; /* for transparent data */
165 unsigned short init_minlen; /* initial value */
166 unsigned short next_minlen; /* pending value */
155 /* send data */ 167 /* send data */
156 struct sk_buff *next_skb; 168 struct sk_buff *next_skb;
157 struct sk_buff *tx_skb; 169 struct sk_buff *tx_skb;
@@ -163,23 +175,26 @@ struct bchannel {
163 int err_crc; 175 int err_crc;
164 int err_tx; 176 int err_tx;
165 int err_rx; 177 int err_rx;
178 int dropcnt;
166}; 179};
167 180
168extern int mISDN_initdchannel(struct dchannel *, int, void *); 181extern int mISDN_initdchannel(struct dchannel *, int, void *);
169extern int mISDN_initbchannel(struct bchannel *, int); 182extern int mISDN_initbchannel(struct bchannel *, unsigned short,
183 unsigned short);
170extern int mISDN_freedchannel(struct dchannel *); 184extern int mISDN_freedchannel(struct dchannel *);
171extern void mISDN_clear_bchannel(struct bchannel *); 185extern void mISDN_clear_bchannel(struct bchannel *);
172extern int mISDN_freebchannel(struct bchannel *); 186extern int mISDN_freebchannel(struct bchannel *);
187extern int mISDN_ctrl_bchannel(struct bchannel *, struct mISDN_ctrl_req *);
173extern void queue_ch_frame(struct mISDNchannel *, u_int, 188extern void queue_ch_frame(struct mISDNchannel *, u_int,
174 int, struct sk_buff *); 189 int, struct sk_buff *);
175extern int dchannel_senddata(struct dchannel *, struct sk_buff *); 190extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
176extern int bchannel_senddata(struct bchannel *, struct sk_buff *); 191extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
192extern int bchannel_get_rxbuf(struct bchannel *, int);
177extern void recv_Dchannel(struct dchannel *); 193extern void recv_Dchannel(struct dchannel *);
178extern void recv_Echannel(struct dchannel *, struct dchannel *); 194extern void recv_Echannel(struct dchannel *, struct dchannel *);
179extern void recv_Bchannel(struct bchannel *, unsigned int id); 195extern void recv_Bchannel(struct bchannel *, unsigned int, bool);
180extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *); 196extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
181extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *); 197extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
182extern void confirm_Bsend(struct bchannel *bch);
183extern int get_next_bframe(struct bchannel *); 198extern int get_next_bframe(struct bchannel *);
184extern int get_next_dframe(struct dchannel *); 199extern int get_next_dframe(struct dchannel *);
185 200
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index b5e7f2202484..246a3529ecf6 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -37,7 +37,7 @@
37 */ 37 */
38#define MISDN_MAJOR_VERSION 1 38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 1 39#define MISDN_MINOR_VERSION 1
40#define MISDN_RELEASE 21 40#define MISDN_RELEASE 29
41 41
42/* primitives for information exchange 42/* primitives for information exchange
43 * generell format 43 * generell format
@@ -115,6 +115,11 @@
115#define MDL_ERROR_IND 0x1F04 115#define MDL_ERROR_IND 0x1F04
116#define MDL_ERROR_RSP 0x5F04 116#define MDL_ERROR_RSP 0x5F04
117 117
118/* intern layer 2 */
119#define DL_TIMER200_IND 0x7004
120#define DL_TIMER203_IND 0x7304
121#define DL_INTERN_MSG 0x7804
122
118/* DL_INFORMATION_IND types */ 123/* DL_INFORMATION_IND types */
119#define DL_INFO_L2_CONNECT 0x0001 124#define DL_INFO_L2_CONNECT 0x0001
120#define DL_INFO_L2_REMOVED 0x0002 125#define DL_INFO_L2_REMOVED 0x0002
@@ -360,6 +365,7 @@ clear_channelmap(u_int nr, u_char *map)
360#define MISDN_CTRL_LOOP 0x0001 365#define MISDN_CTRL_LOOP 0x0001
361#define MISDN_CTRL_CONNECT 0x0002 366#define MISDN_CTRL_CONNECT 0x0002
362#define MISDN_CTRL_DISCONNECT 0x0004 367#define MISDN_CTRL_DISCONNECT 0x0004
368#define MISDN_CTRL_RX_BUFFER 0x0008
363#define MISDN_CTRL_PCMCONNECT 0x0010 369#define MISDN_CTRL_PCMCONNECT 0x0010
364#define MISDN_CTRL_PCMDISCONNECT 0x0020 370#define MISDN_CTRL_PCMDISCONNECT 0x0020
365#define MISDN_CTRL_SETPEER 0x0040 371#define MISDN_CTRL_SETPEER 0x0040
@@ -367,6 +373,7 @@ clear_channelmap(u_int nr, u_char *map)
367#define MISDN_CTRL_RX_OFF 0x0100 373#define MISDN_CTRL_RX_OFF 0x0100
368#define MISDN_CTRL_FILL_EMPTY 0x0200 374#define MISDN_CTRL_FILL_EMPTY 0x0200
369#define MISDN_CTRL_GETPEER 0x0400 375#define MISDN_CTRL_GETPEER 0x0400
376#define MISDN_CTRL_L1_TIMER3 0x0800
370#define MISDN_CTRL_HW_FEATURES_OP 0x2000 377#define MISDN_CTRL_HW_FEATURES_OP 0x2000
371#define MISDN_CTRL_HW_FEATURES 0x2001 378#define MISDN_CTRL_HW_FEATURES 0x2001
372#define MISDN_CTRL_HFC_OP 0x4000 379#define MISDN_CTRL_HFC_OP 0x4000
@@ -381,6 +388,12 @@ clear_channelmap(u_int nr, u_char *map)
381#define MISDN_CTRL_HFC_WD_INIT 0x4009 388#define MISDN_CTRL_HFC_WD_INIT 0x4009
382#define MISDN_CTRL_HFC_WD_RESET 0x400A 389#define MISDN_CTRL_HFC_WD_RESET 0x400A
383 390
391/* special RX buffer value for MISDN_CTRL_RX_BUFFER request.p1 is the minimum
392 * buffer size request.p2 the maximum. Using MISDN_CTRL_RX_SIZE_IGNORE will
393 * not change the value, but still read back the actual stetting.
394 */
395#define MISDN_CTRL_RX_SIZE_IGNORE -1
396
384/* socket options */ 397/* socket options */
385#define MISDN_TIME_STAMP 0x0001 398#define MISDN_TIME_STAMP 0x0001
386 399
@@ -585,6 +598,7 @@ static inline struct mISDNdevice *dev_to_mISDN(struct device *dev)
585extern void set_channel_address(struct mISDNchannel *, u_int, u_int); 598extern void set_channel_address(struct mISDNchannel *, u_int, u_int);
586extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *); 599extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *);
587extern unsigned short mISDN_clock_get(void); 600extern unsigned short mISDN_clock_get(void);
601extern const char *mISDNDevName4ch(struct mISDNchannel *);
588 602
589#endif /* __KERNEL__ */ 603#endif /* __KERNEL__ */
590#endif /* mISDNIF_H */ 604#endif /* mISDNIF_H */
diff --git a/include/linux/mdio-mux.h b/include/linux/mdio-mux.h
new file mode 100644
index 000000000000..a243dbba8659
--- /dev/null
+++ b/include/linux/mdio-mux.h
@@ -0,0 +1,21 @@
1/*
2 * MDIO bus multiplexer framwork.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2011, 2012 Cavium, Inc.
9 */
10#ifndef __LINUX_MDIO_MUX_H
11#define __LINUX_MDIO_MUX_H
12#include <linux/device.h>
13
14int mdio_mux_init(struct device *dev,
15 int (*switch_fn) (int cur, int desired, void *data),
16 void **mux_handle,
17 void *data);
18
19void mdio_mux_uninit(void *mux_handle);
20
21#endif /* __LINUX_MDIO_MUX_H */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 7ffbd6e9e7fc..8313cd9658e3 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -80,6 +80,7 @@ struct da9052 {
80 struct regmap *regmap; 80 struct regmap *regmap;
81 81
82 int irq_base; 82 int irq_base;
83 struct regmap_irq_chip_data *irq_data;
83 u8 chip_id; 84 u8 chip_id;
84 85
85 int chip_irq; 86 int chip_irq;
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
new file mode 100644
index 000000000000..9cbc642d40ad
--- /dev/null
+++ b/include/linux/mfd/palmas.h
@@ -0,0 +1,2620 @@
1/*
2 * TI Palmas
3 *
4 * Copyright 2011 Texas Instruments Inc.
5 *
6 * Author: Graeme Gregory <gg@slimlogic.co.uk>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __LINUX_MFD_PALMAS_H
16#define __LINUX_MFD_PALMAS_H
17
18#include <linux/usb/otg.h>
19#include <linux/leds.h>
20#include <linux/regmap.h>
21#include <linux/regulator/driver.h>
22
23#define PALMAS_NUM_CLIENTS 3
24
25struct palmas_pmic;
26
27struct palmas {
28 struct device *dev;
29
30 struct i2c_client *i2c_clients[PALMAS_NUM_CLIENTS];
31 struct regmap *regmap[PALMAS_NUM_CLIENTS];
32
33 /* Stored chip id */
34 int id;
35
36 /* IRQ Data */
37 int irq;
38 u32 irq_mask;
39 struct mutex irq_lock;
40 struct regmap_irq_chip_data *irq_data;
41
42 /* Child Devices */
43 struct palmas_pmic *pmic;
44
45 /* GPIO MUXing */
46 u8 gpio_muxed;
47 u8 led_muxed;
48 u8 pwm_muxed;
49};
50
51struct palmas_reg_init {
52 /* warm_rest controls the voltage levels after a warm reset
53 *
54 * 0: reload default values from OTP on warm reset
55 * 1: maintain voltage from VSEL on warm reset
56 */
57 int warm_reset;
58
59 /* roof_floor controls whether the regulator uses the i2c style
60 * of DVS or uses the method where a GPIO or other control method is
61 * attached to the NSLEEP/ENABLE1/ENABLE2 pins
62 *
63 * For SMPS
64 *
65 * 0: i2c selection of voltage
66 * 1: pin selection of voltage.
67 *
68 * For LDO unused
69 */
70 int roof_floor;
71
72 /* sleep_mode is the mode loaded to MODE_SLEEP bits as defined in
73 * the data sheet.
74 *
75 * For SMPS
76 *
77 * 0: Off
78 * 1: AUTO
79 * 2: ECO
80 * 3: Forced PWM
81 *
82 * For LDO
83 *
84 * 0: Off
85 * 1: On
86 */
87 int mode_sleep;
88
89 /* tstep is the timestep loaded to the TSTEP register
90 *
91 * For SMPS
92 *
93 * 0: Jump (no slope control)
94 * 1: 10mV/us
95 * 2: 5mV/us
96 * 3: 2.5mV/us
97 *
98 * For LDO unused
99 */
100 int tstep;
101
102 /* voltage_sel is the bitfield loaded onto the SMPSX_VOLTAGE
103 * register. Set this is the default voltage set in OTP needs
104 * to be overridden.
105 */
106 u8 vsel;
107
108};
109
110struct palmas_pmic_platform_data {
111 /* An array of pointers to regulator init data indexed by regulator
112 * ID
113 */
114 struct regulator_init_data **reg_data;
115
116 /* An array of pointers to structures containing sleep mode and DVS
117 * configuration for regulators indexed by ID
118 */
119 struct palmas_reg_init **reg_init;
120
121 /* use LDO6 for vibrator control */
122 int ldo6_vibrator;
123
124
125};
126
127struct palmas_platform_data {
128 int gpio_base;
129
130 /* bit value to be loaded to the POWER_CTRL register */
131 u8 power_ctrl;
132
133 /*
134 * boolean to select if we want to configure muxing here
135 * then the two value to load into the registers if true
136 */
137 int mux_from_pdata;
138 u8 pad1, pad2;
139
140 struct palmas_pmic_platform_data *pmic_pdata;
141};
142
143/* Define the palmas IRQ numbers */
144enum palmas_irqs {
145 /* INT1 registers */
146 PALMAS_CHARG_DET_N_VBUS_OVV_IRQ,
147 PALMAS_PWRON_IRQ,
148 PALMAS_LONG_PRESS_KEY_IRQ,
149 PALMAS_RPWRON_IRQ,
150 PALMAS_PWRDOWN_IRQ,
151 PALMAS_HOTDIE_IRQ,
152 PALMAS_VSYS_MON_IRQ,
153 PALMAS_VBAT_MON_IRQ,
154 /* INT2 registers */
155 PALMAS_RTC_ALARM_IRQ,
156 PALMAS_RTC_TIMER_IRQ,
157 PALMAS_WDT_IRQ,
158 PALMAS_BATREMOVAL_IRQ,
159 PALMAS_RESET_IN_IRQ,
160 PALMAS_FBI_BB_IRQ,
161 PALMAS_SHORT_IRQ,
162 PALMAS_VAC_ACOK_IRQ,
163 /* INT3 registers */
164 PALMAS_GPADC_AUTO_0_IRQ,
165 PALMAS_GPADC_AUTO_1_IRQ,
166 PALMAS_GPADC_EOC_SW_IRQ,
167 PALMAS_GPADC_EOC_RT_IRQ,
168 PALMAS_ID_OTG_IRQ,
169 PALMAS_ID_IRQ,
170 PALMAS_VBUS_OTG_IRQ,
171 PALMAS_VBUS_IRQ,
172 /* INT4 registers */
173 PALMAS_GPIO_0_IRQ,
174 PALMAS_GPIO_1_IRQ,
175 PALMAS_GPIO_2_IRQ,
176 PALMAS_GPIO_3_IRQ,
177 PALMAS_GPIO_4_IRQ,
178 PALMAS_GPIO_5_IRQ,
179 PALMAS_GPIO_6_IRQ,
180 PALMAS_GPIO_7_IRQ,
181 /* Total Number IRQs */
182 PALMAS_NUM_IRQ,
183};
184
185enum palmas_regulators {
186 /* SMPS regulators */
187 PALMAS_REG_SMPS12,
188 PALMAS_REG_SMPS123,
189 PALMAS_REG_SMPS3,
190 PALMAS_REG_SMPS45,
191 PALMAS_REG_SMPS457,
192 PALMAS_REG_SMPS6,
193 PALMAS_REG_SMPS7,
194 PALMAS_REG_SMPS8,
195 PALMAS_REG_SMPS9,
196 PALMAS_REG_SMPS10,
197 /* LDO regulators */
198 PALMAS_REG_LDO1,
199 PALMAS_REG_LDO2,
200 PALMAS_REG_LDO3,
201 PALMAS_REG_LDO4,
202 PALMAS_REG_LDO5,
203 PALMAS_REG_LDO6,
204 PALMAS_REG_LDO7,
205 PALMAS_REG_LDO8,
206 PALMAS_REG_LDO9,
207 PALMAS_REG_LDOLN,
208 PALMAS_REG_LDOUSB,
209 /* Total number of regulators */
210 PALMAS_NUM_REGS,
211};
212
213struct palmas_pmic {
214 struct palmas *palmas;
215 struct device *dev;
216 struct regulator_desc desc[PALMAS_NUM_REGS];
217 struct regulator_dev *rdev[PALMAS_NUM_REGS];
218 struct mutex mutex;
219
220 int smps123;
221 int smps457;
222
223 int range[PALMAS_REG_SMPS10];
224};
225
226/* defines so we can store the mux settings */
227#define PALMAS_GPIO_0_MUXED (1 << 0)
228#define PALMAS_GPIO_1_MUXED (1 << 1)
229#define PALMAS_GPIO_2_MUXED (1 << 2)
230#define PALMAS_GPIO_3_MUXED (1 << 3)
231#define PALMAS_GPIO_4_MUXED (1 << 4)
232#define PALMAS_GPIO_5_MUXED (1 << 5)
233#define PALMAS_GPIO_6_MUXED (1 << 6)
234#define PALMAS_GPIO_7_MUXED (1 << 7)
235
236#define PALMAS_LED1_MUXED (1 << 0)
237#define PALMAS_LED2_MUXED (1 << 1)
238
239#define PALMAS_PWM1_MUXED (1 << 0)
240#define PALMAS_PWM2_MUXED (1 << 1)
241
242/* helper macro to get correct slave number */
243#define PALMAS_BASE_TO_SLAVE(x) ((x >> 8) - 1)
244#define PALMAS_BASE_TO_REG(x, y) ((x & 0xff) + y)
245
246/* Base addresses of IP blocks in Palmas */
247#define PALMAS_SMPS_DVS_BASE 0x20
248#define PALMAS_RTC_BASE 0x100
249#define PALMAS_VALIDITY_BASE 0x118
250#define PALMAS_SMPS_BASE 0x120
251#define PALMAS_LDO_BASE 0x150
252#define PALMAS_DVFS_BASE 0x180
253#define PALMAS_PMU_CONTROL_BASE 0x1A0
254#define PALMAS_RESOURCE_BASE 0x1D4
255#define PALMAS_PU_PD_OD_BASE 0x1F4
256#define PALMAS_LED_BASE 0x200
257#define PALMAS_INTERRUPT_BASE 0x210
258#define PALMAS_USB_OTG_BASE 0x250
259#define PALMAS_VIBRATOR_BASE 0x270
260#define PALMAS_GPIO_BASE 0x280
261#define PALMAS_USB_BASE 0x290
262#define PALMAS_GPADC_BASE 0x2C0
263#define PALMAS_TRIM_GPADC_BASE 0x3CD
264
265/* Registers for function RTC */
266#define PALMAS_SECONDS_REG 0x0
267#define PALMAS_MINUTES_REG 0x1
268#define PALMAS_HOURS_REG 0x2
269#define PALMAS_DAYS_REG 0x3
270#define PALMAS_MONTHS_REG 0x4
271#define PALMAS_YEARS_REG 0x5
272#define PALMAS_WEEKS_REG 0x6
273#define PALMAS_ALARM_SECONDS_REG 0x8
274#define PALMAS_ALARM_MINUTES_REG 0x9
275#define PALMAS_ALARM_HOURS_REG 0xA
276#define PALMAS_ALARM_DAYS_REG 0xB
277#define PALMAS_ALARM_MONTHS_REG 0xC
278#define PALMAS_ALARM_YEARS_REG 0xD
279#define PALMAS_RTC_CTRL_REG 0x10
280#define PALMAS_RTC_STATUS_REG 0x11
281#define PALMAS_RTC_INTERRUPTS_REG 0x12
282#define PALMAS_RTC_COMP_LSB_REG 0x13
283#define PALMAS_RTC_COMP_MSB_REG 0x14
284#define PALMAS_RTC_RES_PROG_REG 0x15
285#define PALMAS_RTC_RESET_STATUS_REG 0x16
286
287/* Bit definitions for SECONDS_REG */
288#define PALMAS_SECONDS_REG_SEC1_MASK 0x70
289#define PALMAS_SECONDS_REG_SEC1_SHIFT 4
290#define PALMAS_SECONDS_REG_SEC0_MASK 0x0f
291#define PALMAS_SECONDS_REG_SEC0_SHIFT 0
292
293/* Bit definitions for MINUTES_REG */
294#define PALMAS_MINUTES_REG_MIN1_MASK 0x70
295#define PALMAS_MINUTES_REG_MIN1_SHIFT 4
296#define PALMAS_MINUTES_REG_MIN0_MASK 0x0f
297#define PALMAS_MINUTES_REG_MIN0_SHIFT 0
298
299/* Bit definitions for HOURS_REG */
300#define PALMAS_HOURS_REG_PM_NAM 0x80
301#define PALMAS_HOURS_REG_PM_NAM_SHIFT 7
302#define PALMAS_HOURS_REG_HOUR1_MASK 0x30
303#define PALMAS_HOURS_REG_HOUR1_SHIFT 4
304#define PALMAS_HOURS_REG_HOUR0_MASK 0x0f
305#define PALMAS_HOURS_REG_HOUR0_SHIFT 0
306
307/* Bit definitions for DAYS_REG */
308#define PALMAS_DAYS_REG_DAY1_MASK 0x30
309#define PALMAS_DAYS_REG_DAY1_SHIFT 4
310#define PALMAS_DAYS_REG_DAY0_MASK 0x0f
311#define PALMAS_DAYS_REG_DAY0_SHIFT 0
312
313/* Bit definitions for MONTHS_REG */
314#define PALMAS_MONTHS_REG_MONTH1 0x10
315#define PALMAS_MONTHS_REG_MONTH1_SHIFT 4
316#define PALMAS_MONTHS_REG_MONTH0_MASK 0x0f
317#define PALMAS_MONTHS_REG_MONTH0_SHIFT 0
318
319/* Bit definitions for YEARS_REG */
320#define PALMAS_YEARS_REG_YEAR1_MASK 0xf0
321#define PALMAS_YEARS_REG_YEAR1_SHIFT 4
322#define PALMAS_YEARS_REG_YEAR0_MASK 0x0f
323#define PALMAS_YEARS_REG_YEAR0_SHIFT 0
324
325/* Bit definitions for WEEKS_REG */
326#define PALMAS_WEEKS_REG_WEEK_MASK 0x07
327#define PALMAS_WEEKS_REG_WEEK_SHIFT 0
328
329/* Bit definitions for ALARM_SECONDS_REG */
330#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_MASK 0x70
331#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_SHIFT 4
332#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_MASK 0x0f
333#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_SHIFT 0
334
335/* Bit definitions for ALARM_MINUTES_REG */
336#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_MASK 0x70
337#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_SHIFT 4
338#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_MASK 0x0f
339#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_SHIFT 0
340
341/* Bit definitions for ALARM_HOURS_REG */
342#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM 0x80
343#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM_SHIFT 7
344#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_MASK 0x30
345#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_SHIFT 4
346#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_MASK 0x0f
347#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_SHIFT 0
348
349/* Bit definitions for ALARM_DAYS_REG */
350#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_MASK 0x30
351#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_SHIFT 4
352#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_MASK 0x0f
353#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_SHIFT 0
354
355/* Bit definitions for ALARM_MONTHS_REG */
356#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1 0x10
357#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1_SHIFT 4
358#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_MASK 0x0f
359#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_SHIFT 0
360
361/* Bit definitions for ALARM_YEARS_REG */
362#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_MASK 0xf0
363#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_SHIFT 4
364#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_MASK 0x0f
365#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_SHIFT 0
366
367/* Bit definitions for RTC_CTRL_REG */
368#define PALMAS_RTC_CTRL_REG_RTC_V_OPT 0x80
369#define PALMAS_RTC_CTRL_REG_RTC_V_OPT_SHIFT 7
370#define PALMAS_RTC_CTRL_REG_GET_TIME 0x40
371#define PALMAS_RTC_CTRL_REG_GET_TIME_SHIFT 6
372#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER 0x20
373#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER_SHIFT 5
374#define PALMAS_RTC_CTRL_REG_TEST_MODE 0x10
375#define PALMAS_RTC_CTRL_REG_TEST_MODE_SHIFT 4
376#define PALMAS_RTC_CTRL_REG_MODE_12_24 0x08
377#define PALMAS_RTC_CTRL_REG_MODE_12_24_SHIFT 3
378#define PALMAS_RTC_CTRL_REG_AUTO_COMP 0x04
379#define PALMAS_RTC_CTRL_REG_AUTO_COMP_SHIFT 2
380#define PALMAS_RTC_CTRL_REG_ROUND_30S 0x02
381#define PALMAS_RTC_CTRL_REG_ROUND_30S_SHIFT 1
382#define PALMAS_RTC_CTRL_REG_STOP_RTC 0x01
383#define PALMAS_RTC_CTRL_REG_STOP_RTC_SHIFT 0
384
385/* Bit definitions for RTC_STATUS_REG */
386#define PALMAS_RTC_STATUS_REG_POWER_UP 0x80
387#define PALMAS_RTC_STATUS_REG_POWER_UP_SHIFT 7
388#define PALMAS_RTC_STATUS_REG_ALARM 0x40
389#define PALMAS_RTC_STATUS_REG_ALARM_SHIFT 6
390#define PALMAS_RTC_STATUS_REG_EVENT_1D 0x20
391#define PALMAS_RTC_STATUS_REG_EVENT_1D_SHIFT 5
392#define PALMAS_RTC_STATUS_REG_EVENT_1H 0x10
393#define PALMAS_RTC_STATUS_REG_EVENT_1H_SHIFT 4
394#define PALMAS_RTC_STATUS_REG_EVENT_1M 0x08
395#define PALMAS_RTC_STATUS_REG_EVENT_1M_SHIFT 3
396#define PALMAS_RTC_STATUS_REG_EVENT_1S 0x04
397#define PALMAS_RTC_STATUS_REG_EVENT_1S_SHIFT 2
398#define PALMAS_RTC_STATUS_REG_RUN 0x02
399#define PALMAS_RTC_STATUS_REG_RUN_SHIFT 1
400
401/* Bit definitions for RTC_INTERRUPTS_REG */
402#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN 0x10
403#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN_SHIFT 4
404#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM 0x08
405#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM_SHIFT 3
406#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER 0x04
407#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER_SHIFT 2
408#define PALMAS_RTC_INTERRUPTS_REG_EVERY_MASK 0x03
409#define PALMAS_RTC_INTERRUPTS_REG_EVERY_SHIFT 0
410
411/* Bit definitions for RTC_COMP_LSB_REG */
412#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_MASK 0xff
413#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_SHIFT 0
414
415/* Bit definitions for RTC_COMP_MSB_REG */
416#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_MASK 0xff
417#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_SHIFT 0
418
419/* Bit definitions for RTC_RES_PROG_REG */
420#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_MASK 0x3f
421#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_SHIFT 0
422
423/* Bit definitions for RTC_RESET_STATUS_REG */
424#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS 0x01
425#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS_SHIFT 0
426
427/* Registers for function BACKUP */
428#define PALMAS_BACKUP0 0x0
429#define PALMAS_BACKUP1 0x1
430#define PALMAS_BACKUP2 0x2
431#define PALMAS_BACKUP3 0x3
432#define PALMAS_BACKUP4 0x4
433#define PALMAS_BACKUP5 0x5
434#define PALMAS_BACKUP6 0x6
435#define PALMAS_BACKUP7 0x7
436
437/* Bit definitions for BACKUP0 */
438#define PALMAS_BACKUP0_BACKUP_MASK 0xff
439#define PALMAS_BACKUP0_BACKUP_SHIFT 0
440
441/* Bit definitions for BACKUP1 */
442#define PALMAS_BACKUP1_BACKUP_MASK 0xff
443#define PALMAS_BACKUP1_BACKUP_SHIFT 0
444
445/* Bit definitions for BACKUP2 */
446#define PALMAS_BACKUP2_BACKUP_MASK 0xff
447#define PALMAS_BACKUP2_BACKUP_SHIFT 0
448
449/* Bit definitions for BACKUP3 */
450#define PALMAS_BACKUP3_BACKUP_MASK 0xff
451#define PALMAS_BACKUP3_BACKUP_SHIFT 0
452
453/* Bit definitions for BACKUP4 */
454#define PALMAS_BACKUP4_BACKUP_MASK 0xff
455#define PALMAS_BACKUP4_BACKUP_SHIFT 0
456
457/* Bit definitions for BACKUP5 */
458#define PALMAS_BACKUP5_BACKUP_MASK 0xff
459#define PALMAS_BACKUP5_BACKUP_SHIFT 0
460
461/* Bit definitions for BACKUP6 */
462#define PALMAS_BACKUP6_BACKUP_MASK 0xff
463#define PALMAS_BACKUP6_BACKUP_SHIFT 0
464
465/* Bit definitions for BACKUP7 */
466#define PALMAS_BACKUP7_BACKUP_MASK 0xff
467#define PALMAS_BACKUP7_BACKUP_SHIFT 0
468
469/* Registers for function SMPS */
470#define PALMAS_SMPS12_CTRL 0x0
471#define PALMAS_SMPS12_TSTEP 0x1
472#define PALMAS_SMPS12_FORCE 0x2
473#define PALMAS_SMPS12_VOLTAGE 0x3
474#define PALMAS_SMPS3_CTRL 0x4
475#define PALMAS_SMPS3_VOLTAGE 0x7
476#define PALMAS_SMPS45_CTRL 0x8
477#define PALMAS_SMPS45_TSTEP 0x9
478#define PALMAS_SMPS45_FORCE 0xA
479#define PALMAS_SMPS45_VOLTAGE 0xB
480#define PALMAS_SMPS6_CTRL 0xC
481#define PALMAS_SMPS6_TSTEP 0xD
482#define PALMAS_SMPS6_FORCE 0xE
483#define PALMAS_SMPS6_VOLTAGE 0xF
484#define PALMAS_SMPS7_CTRL 0x10
485#define PALMAS_SMPS7_VOLTAGE 0x13
486#define PALMAS_SMPS8_CTRL 0x14
487#define PALMAS_SMPS8_TSTEP 0x15
488#define PALMAS_SMPS8_FORCE 0x16
489#define PALMAS_SMPS8_VOLTAGE 0x17
490#define PALMAS_SMPS9_CTRL 0x18
491#define PALMAS_SMPS9_VOLTAGE 0x1B
492#define PALMAS_SMPS10_CTRL 0x1C
493#define PALMAS_SMPS10_STATUS 0x1F
494#define PALMAS_SMPS_CTRL 0x24
495#define PALMAS_SMPS_PD_CTRL 0x25
496#define PALMAS_SMPS_DITHER_EN 0x26
497#define PALMAS_SMPS_THERMAL_EN 0x27
498#define PALMAS_SMPS_THERMAL_STATUS 0x28
499#define PALMAS_SMPS_SHORT_STATUS 0x29
500#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN 0x2A
501#define PALMAS_SMPS_POWERGOOD_MASK1 0x2B
502#define PALMAS_SMPS_POWERGOOD_MASK2 0x2C
503
504/* Bit definitions for SMPS12_CTRL */
505#define PALMAS_SMPS12_CTRL_WR_S 0x80
506#define PALMAS_SMPS12_CTRL_WR_S_SHIFT 7
507#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN 0x40
508#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN_SHIFT 6
509#define PALMAS_SMPS12_CTRL_STATUS_MASK 0x30
510#define PALMAS_SMPS12_CTRL_STATUS_SHIFT 4
511#define PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK 0x0c
512#define PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT 2
513#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK 0x03
514#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_SHIFT 0
515
516/* Bit definitions for SMPS12_TSTEP */
517#define PALMAS_SMPS12_TSTEP_TSTEP_MASK 0x03
518#define PALMAS_SMPS12_TSTEP_TSTEP_SHIFT 0
519
520/* Bit definitions for SMPS12_FORCE */
521#define PALMAS_SMPS12_FORCE_CMD 0x80
522#define PALMAS_SMPS12_FORCE_CMD_SHIFT 7
523#define PALMAS_SMPS12_FORCE_VSEL_MASK 0x7f
524#define PALMAS_SMPS12_FORCE_VSEL_SHIFT 0
525
526/* Bit definitions for SMPS12_VOLTAGE */
527#define PALMAS_SMPS12_VOLTAGE_RANGE 0x80
528#define PALMAS_SMPS12_VOLTAGE_RANGE_SHIFT 7
529#define PALMAS_SMPS12_VOLTAGE_VSEL_MASK 0x7f
530#define PALMAS_SMPS12_VOLTAGE_VSEL_SHIFT 0
531
532/* Bit definitions for SMPS3_CTRL */
533#define PALMAS_SMPS3_CTRL_WR_S 0x80
534#define PALMAS_SMPS3_CTRL_WR_S_SHIFT 7
535#define PALMAS_SMPS3_CTRL_STATUS_MASK 0x30
536#define PALMAS_SMPS3_CTRL_STATUS_SHIFT 4
537#define PALMAS_SMPS3_CTRL_MODE_SLEEP_MASK 0x0c
538#define PALMAS_SMPS3_CTRL_MODE_SLEEP_SHIFT 2
539#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03
540#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0
541
542/* Bit definitions for SMPS3_VOLTAGE */
543#define PALMAS_SMPS3_VOLTAGE_RANGE 0x80
544#define PALMAS_SMPS3_VOLTAGE_RANGE_SHIFT 7
545#define PALMAS_SMPS3_VOLTAGE_VSEL_MASK 0x7f
546#define PALMAS_SMPS3_VOLTAGE_VSEL_SHIFT 0
547
548/* Bit definitions for SMPS45_CTRL */
549#define PALMAS_SMPS45_CTRL_WR_S 0x80
550#define PALMAS_SMPS45_CTRL_WR_S_SHIFT 7
551#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN 0x40
552#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN_SHIFT 6
553#define PALMAS_SMPS45_CTRL_STATUS_MASK 0x30
554#define PALMAS_SMPS45_CTRL_STATUS_SHIFT 4
555#define PALMAS_SMPS45_CTRL_MODE_SLEEP_MASK 0x0c
556#define PALMAS_SMPS45_CTRL_MODE_SLEEP_SHIFT 2
557#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_MASK 0x03
558#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_SHIFT 0
559
560/* Bit definitions for SMPS45_TSTEP */
561#define PALMAS_SMPS45_TSTEP_TSTEP_MASK 0x03
562#define PALMAS_SMPS45_TSTEP_TSTEP_SHIFT 0
563
564/* Bit definitions for SMPS45_FORCE */
565#define PALMAS_SMPS45_FORCE_CMD 0x80
566#define PALMAS_SMPS45_FORCE_CMD_SHIFT 7
567#define PALMAS_SMPS45_FORCE_VSEL_MASK 0x7f
568#define PALMAS_SMPS45_FORCE_VSEL_SHIFT 0
569
570/* Bit definitions for SMPS45_VOLTAGE */
571#define PALMAS_SMPS45_VOLTAGE_RANGE 0x80
572#define PALMAS_SMPS45_VOLTAGE_RANGE_SHIFT 7
573#define PALMAS_SMPS45_VOLTAGE_VSEL_MASK 0x7f
574#define PALMAS_SMPS45_VOLTAGE_VSEL_SHIFT 0
575
576/* Bit definitions for SMPS6_CTRL */
577#define PALMAS_SMPS6_CTRL_WR_S 0x80
578#define PALMAS_SMPS6_CTRL_WR_S_SHIFT 7
579#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN 0x40
580#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN_SHIFT 6
581#define PALMAS_SMPS6_CTRL_STATUS_MASK 0x30
582#define PALMAS_SMPS6_CTRL_STATUS_SHIFT 4
583#define PALMAS_SMPS6_CTRL_MODE_SLEEP_MASK 0x0c
584#define PALMAS_SMPS6_CTRL_MODE_SLEEP_SHIFT 2
585#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_MASK 0x03
586#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_SHIFT 0
587
588/* Bit definitions for SMPS6_TSTEP */
589#define PALMAS_SMPS6_TSTEP_TSTEP_MASK 0x03
590#define PALMAS_SMPS6_TSTEP_TSTEP_SHIFT 0
591
592/* Bit definitions for SMPS6_FORCE */
593#define PALMAS_SMPS6_FORCE_CMD 0x80
594#define PALMAS_SMPS6_FORCE_CMD_SHIFT 7
595#define PALMAS_SMPS6_FORCE_VSEL_MASK 0x7f
596#define PALMAS_SMPS6_FORCE_VSEL_SHIFT 0
597
598/* Bit definitions for SMPS6_VOLTAGE */
599#define PALMAS_SMPS6_VOLTAGE_RANGE 0x80
600#define PALMAS_SMPS6_VOLTAGE_RANGE_SHIFT 7
601#define PALMAS_SMPS6_VOLTAGE_VSEL_MASK 0x7f
602#define PALMAS_SMPS6_VOLTAGE_VSEL_SHIFT 0
603
604/* Bit definitions for SMPS7_CTRL */
605#define PALMAS_SMPS7_CTRL_WR_S 0x80
606#define PALMAS_SMPS7_CTRL_WR_S_SHIFT 7
607#define PALMAS_SMPS7_CTRL_STATUS_MASK 0x30
608#define PALMAS_SMPS7_CTRL_STATUS_SHIFT 4
609#define PALMAS_SMPS7_CTRL_MODE_SLEEP_MASK 0x0c
610#define PALMAS_SMPS7_CTRL_MODE_SLEEP_SHIFT 2
611#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_MASK 0x03
612#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_SHIFT 0
613
614/* Bit definitions for SMPS7_VOLTAGE */
615#define PALMAS_SMPS7_VOLTAGE_RANGE 0x80
616#define PALMAS_SMPS7_VOLTAGE_RANGE_SHIFT 7
617#define PALMAS_SMPS7_VOLTAGE_VSEL_MASK 0x7f
618#define PALMAS_SMPS7_VOLTAGE_VSEL_SHIFT 0
619
620/* Bit definitions for SMPS8_CTRL */
621#define PALMAS_SMPS8_CTRL_WR_S 0x80
622#define PALMAS_SMPS8_CTRL_WR_S_SHIFT 7
623#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN 0x40
624#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN_SHIFT 6
625#define PALMAS_SMPS8_CTRL_STATUS_MASK 0x30
626#define PALMAS_SMPS8_CTRL_STATUS_SHIFT 4
627#define PALMAS_SMPS8_CTRL_MODE_SLEEP_MASK 0x0c
628#define PALMAS_SMPS8_CTRL_MODE_SLEEP_SHIFT 2
629#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_MASK 0x03
630#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_SHIFT 0
631
632/* Bit definitions for SMPS8_TSTEP */
633#define PALMAS_SMPS8_TSTEP_TSTEP_MASK 0x03
634#define PALMAS_SMPS8_TSTEP_TSTEP_SHIFT 0
635
636/* Bit definitions for SMPS8_FORCE */
637#define PALMAS_SMPS8_FORCE_CMD 0x80
638#define PALMAS_SMPS8_FORCE_CMD_SHIFT 7
639#define PALMAS_SMPS8_FORCE_VSEL_MASK 0x7f
640#define PALMAS_SMPS8_FORCE_VSEL_SHIFT 0
641
642/* Bit definitions for SMPS8_VOLTAGE */
643#define PALMAS_SMPS8_VOLTAGE_RANGE 0x80
644#define PALMAS_SMPS8_VOLTAGE_RANGE_SHIFT 7
645#define PALMAS_SMPS8_VOLTAGE_VSEL_MASK 0x7f
646#define PALMAS_SMPS8_VOLTAGE_VSEL_SHIFT 0
647
648/* Bit definitions for SMPS9_CTRL */
649#define PALMAS_SMPS9_CTRL_WR_S 0x80
650#define PALMAS_SMPS9_CTRL_WR_S_SHIFT 7
651#define PALMAS_SMPS9_CTRL_STATUS_MASK 0x30
652#define PALMAS_SMPS9_CTRL_STATUS_SHIFT 4
653#define PALMAS_SMPS9_CTRL_MODE_SLEEP_MASK 0x0c
654#define PALMAS_SMPS9_CTRL_MODE_SLEEP_SHIFT 2
655#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_MASK 0x03
656#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_SHIFT 0
657
658/* Bit definitions for SMPS9_VOLTAGE */
659#define PALMAS_SMPS9_VOLTAGE_RANGE 0x80
660#define PALMAS_SMPS9_VOLTAGE_RANGE_SHIFT 7
661#define PALMAS_SMPS9_VOLTAGE_VSEL_MASK 0x7f
662#define PALMAS_SMPS9_VOLTAGE_VSEL_SHIFT 0
663
664/* Bit definitions for SMPS10_CTRL */
665#define PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK 0xf0
666#define PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT 4
667#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_MASK 0x0f
668#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_SHIFT 0
669
670/* Bit definitions for SMPS10_STATUS */
671#define PALMAS_SMPS10_STATUS_STATUS_MASK 0x0f
672#define PALMAS_SMPS10_STATUS_STATUS_SHIFT 0
673
674/* Bit definitions for SMPS_CTRL */
675#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN 0x20
676#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN_SHIFT 5
677#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN 0x10
678#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN_SHIFT 4
679#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_MASK 0x0c
680#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_SHIFT 2
681#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_MASK 0x03
682#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_SHIFT 0
683
684/* Bit definitions for SMPS_PD_CTRL */
685#define PALMAS_SMPS_PD_CTRL_SMPS9 0x40
686#define PALMAS_SMPS_PD_CTRL_SMPS9_SHIFT 6
687#define PALMAS_SMPS_PD_CTRL_SMPS8 0x20
688#define PALMAS_SMPS_PD_CTRL_SMPS8_SHIFT 5
689#define PALMAS_SMPS_PD_CTRL_SMPS7 0x10
690#define PALMAS_SMPS_PD_CTRL_SMPS7_SHIFT 4
691#define PALMAS_SMPS_PD_CTRL_SMPS6 0x08
692#define PALMAS_SMPS_PD_CTRL_SMPS6_SHIFT 3
693#define PALMAS_SMPS_PD_CTRL_SMPS45 0x04
694#define PALMAS_SMPS_PD_CTRL_SMPS45_SHIFT 2
695#define PALMAS_SMPS_PD_CTRL_SMPS3 0x02
696#define PALMAS_SMPS_PD_CTRL_SMPS3_SHIFT 1
697#define PALMAS_SMPS_PD_CTRL_SMPS12 0x01
698#define PALMAS_SMPS_PD_CTRL_SMPS12_SHIFT 0
699
700/* Bit definitions for SMPS_THERMAL_EN */
701#define PALMAS_SMPS_THERMAL_EN_SMPS9 0x40
702#define PALMAS_SMPS_THERMAL_EN_SMPS9_SHIFT 6
703#define PALMAS_SMPS_THERMAL_EN_SMPS8 0x20
704#define PALMAS_SMPS_THERMAL_EN_SMPS8_SHIFT 5
705#define PALMAS_SMPS_THERMAL_EN_SMPS6 0x08
706#define PALMAS_SMPS_THERMAL_EN_SMPS6_SHIFT 3
707#define PALMAS_SMPS_THERMAL_EN_SMPS457 0x04
708#define PALMAS_SMPS_THERMAL_EN_SMPS457_SHIFT 2
709#define PALMAS_SMPS_THERMAL_EN_SMPS123 0x01
710#define PALMAS_SMPS_THERMAL_EN_SMPS123_SHIFT 0
711
712/* Bit definitions for SMPS_THERMAL_STATUS */
713#define PALMAS_SMPS_THERMAL_STATUS_SMPS9 0x40
714#define PALMAS_SMPS_THERMAL_STATUS_SMPS9_SHIFT 6
715#define PALMAS_SMPS_THERMAL_STATUS_SMPS8 0x20
716#define PALMAS_SMPS_THERMAL_STATUS_SMPS8_SHIFT 5
717#define PALMAS_SMPS_THERMAL_STATUS_SMPS6 0x08
718#define PALMAS_SMPS_THERMAL_STATUS_SMPS6_SHIFT 3
719#define PALMAS_SMPS_THERMAL_STATUS_SMPS457 0x04
720#define PALMAS_SMPS_THERMAL_STATUS_SMPS457_SHIFT 2
721#define PALMAS_SMPS_THERMAL_STATUS_SMPS123 0x01
722#define PALMAS_SMPS_THERMAL_STATUS_SMPS123_SHIFT 0
723
724/* Bit definitions for SMPS_SHORT_STATUS */
725#define PALMAS_SMPS_SHORT_STATUS_SMPS10 0x80
726#define PALMAS_SMPS_SHORT_STATUS_SMPS10_SHIFT 7
727#define PALMAS_SMPS_SHORT_STATUS_SMPS9 0x40
728#define PALMAS_SMPS_SHORT_STATUS_SMPS9_SHIFT 6
729#define PALMAS_SMPS_SHORT_STATUS_SMPS8 0x20
730#define PALMAS_SMPS_SHORT_STATUS_SMPS8_SHIFT 5
731#define PALMAS_SMPS_SHORT_STATUS_SMPS7 0x10
732#define PALMAS_SMPS_SHORT_STATUS_SMPS7_SHIFT 4
733#define PALMAS_SMPS_SHORT_STATUS_SMPS6 0x08
734#define PALMAS_SMPS_SHORT_STATUS_SMPS6_SHIFT 3
735#define PALMAS_SMPS_SHORT_STATUS_SMPS45 0x04
736#define PALMAS_SMPS_SHORT_STATUS_SMPS45_SHIFT 2
737#define PALMAS_SMPS_SHORT_STATUS_SMPS3 0x02
738#define PALMAS_SMPS_SHORT_STATUS_SMPS3_SHIFT 1
739#define PALMAS_SMPS_SHORT_STATUS_SMPS12 0x01
740#define PALMAS_SMPS_SHORT_STATUS_SMPS12_SHIFT 0
741
742/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */
743#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9 0x40
744#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9_SHIFT 6
745#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8 0x20
746#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8_SHIFT 5
747#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7 0x10
748#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7_SHIFT 4
749#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6 0x08
750#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6_SHIFT 3
751#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45 0x04
752#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45_SHIFT 2
753#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x02
754#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 1
755#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12 0x01
756#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12_SHIFT 0
757
758/* Bit definitions for SMPS_POWERGOOD_MASK1 */
759#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10 0x80
760#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10_SHIFT 7
761#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9 0x40
762#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9_SHIFT 6
763#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8 0x20
764#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8_SHIFT 5
765#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7 0x10
766#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7_SHIFT 4
767#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6 0x08
768#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6_SHIFT 3
769#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45 0x04
770#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45_SHIFT 2
771#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3 0x02
772#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 1
773#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12 0x01
774#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12_SHIFT 0
775
776/* Bit definitions for SMPS_POWERGOOD_MASK2 */
777#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80
778#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 7
779#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7 0x04
780#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7_SHIFT 2
781#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS 0x02
782#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS_SHIFT 1
783#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK 0x01
784#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK_SHIFT 0
785
786/* Registers for function LDO */
787#define PALMAS_LDO1_CTRL 0x0
788#define PALMAS_LDO1_VOLTAGE 0x1
789#define PALMAS_LDO2_CTRL 0x2
790#define PALMAS_LDO2_VOLTAGE 0x3
791#define PALMAS_LDO3_CTRL 0x4
792#define PALMAS_LDO3_VOLTAGE 0x5
793#define PALMAS_LDO4_CTRL 0x6
794#define PALMAS_LDO4_VOLTAGE 0x7
795#define PALMAS_LDO5_CTRL 0x8
796#define PALMAS_LDO5_VOLTAGE 0x9
797#define PALMAS_LDO6_CTRL 0xA
798#define PALMAS_LDO6_VOLTAGE 0xB
799#define PALMAS_LDO7_CTRL 0xC
800#define PALMAS_LDO7_VOLTAGE 0xD
801#define PALMAS_LDO8_CTRL 0xE
802#define PALMAS_LDO8_VOLTAGE 0xF
803#define PALMAS_LDO9_CTRL 0x10
804#define PALMAS_LDO9_VOLTAGE 0x11
805#define PALMAS_LDOLN_CTRL 0x12
806#define PALMAS_LDOLN_VOLTAGE 0x13
807#define PALMAS_LDOUSB_CTRL 0x14
808#define PALMAS_LDOUSB_VOLTAGE 0x15
809#define PALMAS_LDO_CTRL 0x1A
810#define PALMAS_LDO_PD_CTRL1 0x1B
811#define PALMAS_LDO_PD_CTRL2 0x1C
812#define PALMAS_LDO_SHORT_STATUS1 0x1D
813#define PALMAS_LDO_SHORT_STATUS2 0x1E
814
815/* Bit definitions for LDO1_CTRL */
816#define PALMAS_LDO1_CTRL_WR_S 0x80
817#define PALMAS_LDO1_CTRL_WR_S_SHIFT 7
818#define PALMAS_LDO1_CTRL_STATUS 0x10
819#define PALMAS_LDO1_CTRL_STATUS_SHIFT 4
820#define PALMAS_LDO1_CTRL_MODE_SLEEP 0x04
821#define PALMAS_LDO1_CTRL_MODE_SLEEP_SHIFT 2
822#define PALMAS_LDO1_CTRL_MODE_ACTIVE 0x01
823#define PALMAS_LDO1_CTRL_MODE_ACTIVE_SHIFT 0
824
825/* Bit definitions for LDO1_VOLTAGE */
826#define PALMAS_LDO1_VOLTAGE_VSEL_MASK 0x3f
827#define PALMAS_LDO1_VOLTAGE_VSEL_SHIFT 0
828
829/* Bit definitions for LDO2_CTRL */
830#define PALMAS_LDO2_CTRL_WR_S 0x80
831#define PALMAS_LDO2_CTRL_WR_S_SHIFT 7
832#define PALMAS_LDO2_CTRL_STATUS 0x10
833#define PALMAS_LDO2_CTRL_STATUS_SHIFT 4
834#define PALMAS_LDO2_CTRL_MODE_SLEEP 0x04
835#define PALMAS_LDO2_CTRL_MODE_SLEEP_SHIFT 2
836#define PALMAS_LDO2_CTRL_MODE_ACTIVE 0x01
837#define PALMAS_LDO2_CTRL_MODE_ACTIVE_SHIFT 0
838
839/* Bit definitions for LDO2_VOLTAGE */
840#define PALMAS_LDO2_VOLTAGE_VSEL_MASK 0x3f
841#define PALMAS_LDO2_VOLTAGE_VSEL_SHIFT 0
842
843/* Bit definitions for LDO3_CTRL */
844#define PALMAS_LDO3_CTRL_WR_S 0x80
845#define PALMAS_LDO3_CTRL_WR_S_SHIFT 7
846#define PALMAS_LDO3_CTRL_STATUS 0x10
847#define PALMAS_LDO3_CTRL_STATUS_SHIFT 4
848#define PALMAS_LDO3_CTRL_MODE_SLEEP 0x04
849#define PALMAS_LDO3_CTRL_MODE_SLEEP_SHIFT 2
850#define PALMAS_LDO3_CTRL_MODE_ACTIVE 0x01
851#define PALMAS_LDO3_CTRL_MODE_ACTIVE_SHIFT 0
852
853/* Bit definitions for LDO3_VOLTAGE */
854#define PALMAS_LDO3_VOLTAGE_VSEL_MASK 0x3f
855#define PALMAS_LDO3_VOLTAGE_VSEL_SHIFT 0
856
857/* Bit definitions for LDO4_CTRL */
858#define PALMAS_LDO4_CTRL_WR_S 0x80
859#define PALMAS_LDO4_CTRL_WR_S_SHIFT 7
860#define PALMAS_LDO4_CTRL_STATUS 0x10
861#define PALMAS_LDO4_CTRL_STATUS_SHIFT 4
862#define PALMAS_LDO4_CTRL_MODE_SLEEP 0x04
863#define PALMAS_LDO4_CTRL_MODE_SLEEP_SHIFT 2
864#define PALMAS_LDO4_CTRL_MODE_ACTIVE 0x01
865#define PALMAS_LDO4_CTRL_MODE_ACTIVE_SHIFT 0
866
867/* Bit definitions for LDO4_VOLTAGE */
868#define PALMAS_LDO4_VOLTAGE_VSEL_MASK 0x3f
869#define PALMAS_LDO4_VOLTAGE_VSEL_SHIFT 0
870
871/* Bit definitions for LDO5_CTRL */
872#define PALMAS_LDO5_CTRL_WR_S 0x80
873#define PALMAS_LDO5_CTRL_WR_S_SHIFT 7
874#define PALMAS_LDO5_CTRL_STATUS 0x10
875#define PALMAS_LDO5_CTRL_STATUS_SHIFT 4
876#define PALMAS_LDO5_CTRL_MODE_SLEEP 0x04
877#define PALMAS_LDO5_CTRL_MODE_SLEEP_SHIFT 2
878#define PALMAS_LDO5_CTRL_MODE_ACTIVE 0x01
879#define PALMAS_LDO5_CTRL_MODE_ACTIVE_SHIFT 0
880
881/* Bit definitions for LDO5_VOLTAGE */
882#define PALMAS_LDO5_VOLTAGE_VSEL_MASK 0x3f
883#define PALMAS_LDO5_VOLTAGE_VSEL_SHIFT 0
884
885/* Bit definitions for LDO6_CTRL */
886#define PALMAS_LDO6_CTRL_WR_S 0x80
887#define PALMAS_LDO6_CTRL_WR_S_SHIFT 7
888#define PALMAS_LDO6_CTRL_LDO_VIB_EN 0x40
889#define PALMAS_LDO6_CTRL_LDO_VIB_EN_SHIFT 6
890#define PALMAS_LDO6_CTRL_STATUS 0x10
891#define PALMAS_LDO6_CTRL_STATUS_SHIFT 4
892#define PALMAS_LDO6_CTRL_MODE_SLEEP 0x04
893#define PALMAS_LDO6_CTRL_MODE_SLEEP_SHIFT 2
894#define PALMAS_LDO6_CTRL_MODE_ACTIVE 0x01
895#define PALMAS_LDO6_CTRL_MODE_ACTIVE_SHIFT 0
896
897/* Bit definitions for LDO6_VOLTAGE */
898#define PALMAS_LDO6_VOLTAGE_VSEL_MASK 0x3f
899#define PALMAS_LDO6_VOLTAGE_VSEL_SHIFT 0
900
901/* Bit definitions for LDO7_CTRL */
902#define PALMAS_LDO7_CTRL_WR_S 0x80
903#define PALMAS_LDO7_CTRL_WR_S_SHIFT 7
904#define PALMAS_LDO7_CTRL_STATUS 0x10
905#define PALMAS_LDO7_CTRL_STATUS_SHIFT 4
906#define PALMAS_LDO7_CTRL_MODE_SLEEP 0x04
907#define PALMAS_LDO7_CTRL_MODE_SLEEP_SHIFT 2
908#define PALMAS_LDO7_CTRL_MODE_ACTIVE 0x01
909#define PALMAS_LDO7_CTRL_MODE_ACTIVE_SHIFT 0
910
911/* Bit definitions for LDO7_VOLTAGE */
912#define PALMAS_LDO7_VOLTAGE_VSEL_MASK 0x3f
913#define PALMAS_LDO7_VOLTAGE_VSEL_SHIFT 0
914
915/* Bit definitions for LDO8_CTRL */
916#define PALMAS_LDO8_CTRL_WR_S 0x80
917#define PALMAS_LDO8_CTRL_WR_S_SHIFT 7
918#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN 0x40
919#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN_SHIFT 6
920#define PALMAS_LDO8_CTRL_STATUS 0x10
921#define PALMAS_LDO8_CTRL_STATUS_SHIFT 4
922#define PALMAS_LDO8_CTRL_MODE_SLEEP 0x04
923#define PALMAS_LDO8_CTRL_MODE_SLEEP_SHIFT 2
924#define PALMAS_LDO8_CTRL_MODE_ACTIVE 0x01
925#define PALMAS_LDO8_CTRL_MODE_ACTIVE_SHIFT 0
926
927/* Bit definitions for LDO8_VOLTAGE */
928#define PALMAS_LDO8_VOLTAGE_VSEL_MASK 0x3f
929#define PALMAS_LDO8_VOLTAGE_VSEL_SHIFT 0
930
931/* Bit definitions for LDO9_CTRL */
932#define PALMAS_LDO9_CTRL_WR_S 0x80
933#define PALMAS_LDO9_CTRL_WR_S_SHIFT 7
934#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN 0x40
935#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN_SHIFT 6
936#define PALMAS_LDO9_CTRL_STATUS 0x10
937#define PALMAS_LDO9_CTRL_STATUS_SHIFT 4
938#define PALMAS_LDO9_CTRL_MODE_SLEEP 0x04
939#define PALMAS_LDO9_CTRL_MODE_SLEEP_SHIFT 2
940#define PALMAS_LDO9_CTRL_MODE_ACTIVE 0x01
941#define PALMAS_LDO9_CTRL_MODE_ACTIVE_SHIFT 0
942
943/* Bit definitions for LDO9_VOLTAGE */
944#define PALMAS_LDO9_VOLTAGE_VSEL_MASK 0x3f
945#define PALMAS_LDO9_VOLTAGE_VSEL_SHIFT 0
946
947/* Bit definitions for LDOLN_CTRL */
948#define PALMAS_LDOLN_CTRL_WR_S 0x80
949#define PALMAS_LDOLN_CTRL_WR_S_SHIFT 7
950#define PALMAS_LDOLN_CTRL_STATUS 0x10
951#define PALMAS_LDOLN_CTRL_STATUS_SHIFT 4
952#define PALMAS_LDOLN_CTRL_MODE_SLEEP 0x04
953#define PALMAS_LDOLN_CTRL_MODE_SLEEP_SHIFT 2
954#define PALMAS_LDOLN_CTRL_MODE_ACTIVE 0x01
955#define PALMAS_LDOLN_CTRL_MODE_ACTIVE_SHIFT 0
956
957/* Bit definitions for LDOLN_VOLTAGE */
958#define PALMAS_LDOLN_VOLTAGE_VSEL_MASK 0x3f
959#define PALMAS_LDOLN_VOLTAGE_VSEL_SHIFT 0
960
961/* Bit definitions for LDOUSB_CTRL */
962#define PALMAS_LDOUSB_CTRL_WR_S 0x80
963#define PALMAS_LDOUSB_CTRL_WR_S_SHIFT 7
964#define PALMAS_LDOUSB_CTRL_STATUS 0x10
965#define PALMAS_LDOUSB_CTRL_STATUS_SHIFT 4
966#define PALMAS_LDOUSB_CTRL_MODE_SLEEP 0x04
967#define PALMAS_LDOUSB_CTRL_MODE_SLEEP_SHIFT 2
968#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE 0x01
969#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE_SHIFT 0
970
971/* Bit definitions for LDOUSB_VOLTAGE */
972#define PALMAS_LDOUSB_VOLTAGE_VSEL_MASK 0x3f
973#define PALMAS_LDOUSB_VOLTAGE_VSEL_SHIFT 0
974
975/* Bit definitions for LDO_CTRL */
976#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS 0x01
977#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS_SHIFT 0
978
979/* Bit definitions for LDO_PD_CTRL1 */
980#define PALMAS_LDO_PD_CTRL1_LDO8 0x80
981#define PALMAS_LDO_PD_CTRL1_LDO8_SHIFT 7
982#define PALMAS_LDO_PD_CTRL1_LDO7 0x40
983#define PALMAS_LDO_PD_CTRL1_LDO7_SHIFT 6
984#define PALMAS_LDO_PD_CTRL1_LDO6 0x20
985#define PALMAS_LDO_PD_CTRL1_LDO6_SHIFT 5
986#define PALMAS_LDO_PD_CTRL1_LDO5 0x10
987#define PALMAS_LDO_PD_CTRL1_LDO5_SHIFT 4
988#define PALMAS_LDO_PD_CTRL1_LDO4 0x08
989#define PALMAS_LDO_PD_CTRL1_LDO4_SHIFT 3
990#define PALMAS_LDO_PD_CTRL1_LDO3 0x04
991#define PALMAS_LDO_PD_CTRL1_LDO3_SHIFT 2
992#define PALMAS_LDO_PD_CTRL1_LDO2 0x02
993#define PALMAS_LDO_PD_CTRL1_LDO2_SHIFT 1
994#define PALMAS_LDO_PD_CTRL1_LDO1 0x01
995#define PALMAS_LDO_PD_CTRL1_LDO1_SHIFT 0
996
997/* Bit definitions for LDO_PD_CTRL2 */
998#define PALMAS_LDO_PD_CTRL2_LDOUSB 0x04
999#define PALMAS_LDO_PD_CTRL2_LDOUSB_SHIFT 2
1000#define PALMAS_LDO_PD_CTRL2_LDOLN 0x02
1001#define PALMAS_LDO_PD_CTRL2_LDOLN_SHIFT 1
1002#define PALMAS_LDO_PD_CTRL2_LDO9 0x01
1003#define PALMAS_LDO_PD_CTRL2_LDO9_SHIFT 0
1004
1005/* Bit definitions for LDO_SHORT_STATUS1 */
1006#define PALMAS_LDO_SHORT_STATUS1_LDO8 0x80
1007#define PALMAS_LDO_SHORT_STATUS1_LDO8_SHIFT 7
1008#define PALMAS_LDO_SHORT_STATUS1_LDO7 0x40
1009#define PALMAS_LDO_SHORT_STATUS1_LDO7_SHIFT 6
1010#define PALMAS_LDO_SHORT_STATUS1_LDO6 0x20
1011#define PALMAS_LDO_SHORT_STATUS1_LDO6_SHIFT 5
1012#define PALMAS_LDO_SHORT_STATUS1_LDO5 0x10
1013#define PALMAS_LDO_SHORT_STATUS1_LDO5_SHIFT 4
1014#define PALMAS_LDO_SHORT_STATUS1_LDO4 0x08
1015#define PALMAS_LDO_SHORT_STATUS1_LDO4_SHIFT 3
1016#define PALMAS_LDO_SHORT_STATUS1_LDO3 0x04
1017#define PALMAS_LDO_SHORT_STATUS1_LDO3_SHIFT 2
1018#define PALMAS_LDO_SHORT_STATUS1_LDO2 0x02
1019#define PALMAS_LDO_SHORT_STATUS1_LDO2_SHIFT 1
1020#define PALMAS_LDO_SHORT_STATUS1_LDO1 0x01
1021#define PALMAS_LDO_SHORT_STATUS1_LDO1_SHIFT 0
1022
1023/* Bit definitions for LDO_SHORT_STATUS2 */
1024#define PALMAS_LDO_SHORT_STATUS2_LDOVANA 0x08
1025#define PALMAS_LDO_SHORT_STATUS2_LDOVANA_SHIFT 3
1026#define PALMAS_LDO_SHORT_STATUS2_LDOUSB 0x04
1027#define PALMAS_LDO_SHORT_STATUS2_LDOUSB_SHIFT 2
1028#define PALMAS_LDO_SHORT_STATUS2_LDOLN 0x02
1029#define PALMAS_LDO_SHORT_STATUS2_LDOLN_SHIFT 1
1030#define PALMAS_LDO_SHORT_STATUS2_LDO9 0x01
1031#define PALMAS_LDO_SHORT_STATUS2_LDO9_SHIFT 0
1032
1033/* Registers for function PMU_CONTROL */
1034#define PALMAS_DEV_CTRL 0x0
1035#define PALMAS_POWER_CTRL 0x1
1036#define PALMAS_VSYS_LO 0x2
1037#define PALMAS_VSYS_MON 0x3
1038#define PALMAS_VBAT_MON 0x4
1039#define PALMAS_WATCHDOG 0x5
1040#define PALMAS_BOOT_STATUS 0x6
1041#define PALMAS_BATTERY_BOUNCE 0x7
1042#define PALMAS_BACKUP_BATTERY_CTRL 0x8
1043#define PALMAS_LONG_PRESS_KEY 0x9
1044#define PALMAS_OSC_THERM_CTRL 0xA
1045#define PALMAS_BATDEBOUNCING 0xB
1046#define PALMAS_SWOFF_HWRST 0xF
1047#define PALMAS_SWOFF_COLDRST 0x10
1048#define PALMAS_SWOFF_STATUS 0x11
1049#define PALMAS_PMU_CONFIG 0x12
1050#define PALMAS_SPARE 0x14
1051#define PALMAS_PMU_SECONDARY_INT 0x15
1052#define PALMAS_SW_REVISION 0x17
1053#define PALMAS_EXT_CHRG_CTRL 0x18
1054#define PALMAS_PMU_SECONDARY_INT2 0x19
1055
1056/* Bit definitions for DEV_CTRL */
1057#define PALMAS_DEV_CTRL_DEV_STATUS_MASK 0x0c
1058#define PALMAS_DEV_CTRL_DEV_STATUS_SHIFT 2
1059#define PALMAS_DEV_CTRL_SW_RST 0x02
1060#define PALMAS_DEV_CTRL_SW_RST_SHIFT 1
1061#define PALMAS_DEV_CTRL_DEV_ON 0x01
1062#define PALMAS_DEV_CTRL_DEV_ON_SHIFT 0
1063
1064/* Bit definitions for POWER_CTRL */
1065#define PALMAS_POWER_CTRL_ENABLE2_MASK 0x04
1066#define PALMAS_POWER_CTRL_ENABLE2_MASK_SHIFT 2
1067#define PALMAS_POWER_CTRL_ENABLE1_MASK 0x02
1068#define PALMAS_POWER_CTRL_ENABLE1_MASK_SHIFT 1
1069#define PALMAS_POWER_CTRL_NSLEEP_MASK 0x01
1070#define PALMAS_POWER_CTRL_NSLEEP_MASK_SHIFT 0
1071
1072/* Bit definitions for VSYS_LO */
1073#define PALMAS_VSYS_LO_THRESHOLD_MASK 0x1f
1074#define PALMAS_VSYS_LO_THRESHOLD_SHIFT 0
1075
1076/* Bit definitions for VSYS_MON */
1077#define PALMAS_VSYS_MON_ENABLE 0x80
1078#define PALMAS_VSYS_MON_ENABLE_SHIFT 7
1079#define PALMAS_VSYS_MON_THRESHOLD_MASK 0x3f
1080#define PALMAS_VSYS_MON_THRESHOLD_SHIFT 0
1081
1082/* Bit definitions for VBAT_MON */
1083#define PALMAS_VBAT_MON_ENABLE 0x80
1084#define PALMAS_VBAT_MON_ENABLE_SHIFT 7
1085#define PALMAS_VBAT_MON_THRESHOLD_MASK 0x3f
1086#define PALMAS_VBAT_MON_THRESHOLD_SHIFT 0
1087
1088/* Bit definitions for WATCHDOG */
1089#define PALMAS_WATCHDOG_LOCK 0x20
1090#define PALMAS_WATCHDOG_LOCK_SHIFT 5
1091#define PALMAS_WATCHDOG_ENABLE 0x10
1092#define PALMAS_WATCHDOG_ENABLE_SHIFT 4
1093#define PALMAS_WATCHDOG_MODE 0x08
1094#define PALMAS_WATCHDOG_MODE_SHIFT 3
1095#define PALMAS_WATCHDOG_TIMER_MASK 0x07
1096#define PALMAS_WATCHDOG_TIMER_SHIFT 0
1097
1098/* Bit definitions for BOOT_STATUS */
1099#define PALMAS_BOOT_STATUS_BOOT1 0x02
1100#define PALMAS_BOOT_STATUS_BOOT1_SHIFT 1
1101#define PALMAS_BOOT_STATUS_BOOT0 0x01
1102#define PALMAS_BOOT_STATUS_BOOT0_SHIFT 0
1103
1104/* Bit definitions for BATTERY_BOUNCE */
1105#define PALMAS_BATTERY_BOUNCE_BB_DELAY_MASK 0x3f
1106#define PALMAS_BATTERY_BOUNCE_BB_DELAY_SHIFT 0
1107
1108/* Bit definitions for BACKUP_BATTERY_CTRL */
1109#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15 0x80
1110#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15_SHIFT 7
1111#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP 0x40
1112#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP_SHIFT 6
1113#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF 0x20
1114#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF_SHIFT 5
1115#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN 0x10
1116#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN_SHIFT 4
1117#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG 0x08
1118#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG_SHIFT 3
1119#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_MASK 0x06
1120#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_SHIFT 1
1121#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN 0x01
1122#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN_SHIFT 0
1123
1124/* Bit definitions for LONG_PRESS_KEY */
1125#define PALMAS_LONG_PRESS_KEY_LPK_LOCK 0x80
1126#define PALMAS_LONG_PRESS_KEY_LPK_LOCK_SHIFT 7
1127#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR 0x10
1128#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR_SHIFT 4
1129#define PALMAS_LONG_PRESS_KEY_LPK_TIME_MASK 0x0c
1130#define PALMAS_LONG_PRESS_KEY_LPK_TIME_SHIFT 2
1131#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_MASK 0x03
1132#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_SHIFT 0
1133
1134/* Bit definitions for OSC_THERM_CTRL */
1135#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP 0x80
1136#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP_SHIFT 7
1137#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP 0x40
1138#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP_SHIFT 6
1139#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP 0x20
1140#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP_SHIFT 5
1141#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP 0x10
1142#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP_SHIFT 4
1143#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_MASK 0x0c
1144#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_SHIFT 2
1145#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS 0x02
1146#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS_SHIFT 1
1147#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE 0x01
1148#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE_SHIFT 0
1149
1150/* Bit definitions for BATDEBOUNCING */
1151#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS 0x80
1152#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS_SHIFT 7
1153#define PALMAS_BATDEBOUNCING_BINS_DEB_MASK 0x78
1154#define PALMAS_BATDEBOUNCING_BINS_DEB_SHIFT 3
1155#define PALMAS_BATDEBOUNCING_BEXT_DEB_MASK 0x07
1156#define PALMAS_BATDEBOUNCING_BEXT_DEB_SHIFT 0
1157
1158/* Bit definitions for SWOFF_HWRST */
1159#define PALMAS_SWOFF_HWRST_PWRON_LPK 0x80
1160#define PALMAS_SWOFF_HWRST_PWRON_LPK_SHIFT 7
1161#define PALMAS_SWOFF_HWRST_PWRDOWN 0x40
1162#define PALMAS_SWOFF_HWRST_PWRDOWN_SHIFT 6
1163#define PALMAS_SWOFF_HWRST_WTD 0x20
1164#define PALMAS_SWOFF_HWRST_WTD_SHIFT 5
1165#define PALMAS_SWOFF_HWRST_TSHUT 0x10
1166#define PALMAS_SWOFF_HWRST_TSHUT_SHIFT 4
1167#define PALMAS_SWOFF_HWRST_RESET_IN 0x08
1168#define PALMAS_SWOFF_HWRST_RESET_IN_SHIFT 3
1169#define PALMAS_SWOFF_HWRST_SW_RST 0x04
1170#define PALMAS_SWOFF_HWRST_SW_RST_SHIFT 2
1171#define PALMAS_SWOFF_HWRST_VSYS_LO 0x02
1172#define PALMAS_SWOFF_HWRST_VSYS_LO_SHIFT 1
1173#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN 0x01
1174#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN_SHIFT 0
1175
1176/* Bit definitions for SWOFF_COLDRST */
1177#define PALMAS_SWOFF_COLDRST_PWRON_LPK 0x80
1178#define PALMAS_SWOFF_COLDRST_PWRON_LPK_SHIFT 7
1179#define PALMAS_SWOFF_COLDRST_PWRDOWN 0x40
1180#define PALMAS_SWOFF_COLDRST_PWRDOWN_SHIFT 6
1181#define PALMAS_SWOFF_COLDRST_WTD 0x20
1182#define PALMAS_SWOFF_COLDRST_WTD_SHIFT 5
1183#define PALMAS_SWOFF_COLDRST_TSHUT 0x10
1184#define PALMAS_SWOFF_COLDRST_TSHUT_SHIFT 4
1185#define PALMAS_SWOFF_COLDRST_RESET_IN 0x08
1186#define PALMAS_SWOFF_COLDRST_RESET_IN_SHIFT 3
1187#define PALMAS_SWOFF_COLDRST_SW_RST 0x04
1188#define PALMAS_SWOFF_COLDRST_SW_RST_SHIFT 2
1189#define PALMAS_SWOFF_COLDRST_VSYS_LO 0x02
1190#define PALMAS_SWOFF_COLDRST_VSYS_LO_SHIFT 1
1191#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN 0x01
1192#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN_SHIFT 0
1193
1194/* Bit definitions for SWOFF_STATUS */
1195#define PALMAS_SWOFF_STATUS_PWRON_LPK 0x80
1196#define PALMAS_SWOFF_STATUS_PWRON_LPK_SHIFT 7
1197#define PALMAS_SWOFF_STATUS_PWRDOWN 0x40
1198#define PALMAS_SWOFF_STATUS_PWRDOWN_SHIFT 6
1199#define PALMAS_SWOFF_STATUS_WTD 0x20
1200#define PALMAS_SWOFF_STATUS_WTD_SHIFT 5
1201#define PALMAS_SWOFF_STATUS_TSHUT 0x10
1202#define PALMAS_SWOFF_STATUS_TSHUT_SHIFT 4
1203#define PALMAS_SWOFF_STATUS_RESET_IN 0x08
1204#define PALMAS_SWOFF_STATUS_RESET_IN_SHIFT 3
1205#define PALMAS_SWOFF_STATUS_SW_RST 0x04
1206#define PALMAS_SWOFF_STATUS_SW_RST_SHIFT 2
1207#define PALMAS_SWOFF_STATUS_VSYS_LO 0x02
1208#define PALMAS_SWOFF_STATUS_VSYS_LO_SHIFT 1
1209#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN 0x01
1210#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN_SHIFT 0
1211
1212/* Bit definitions for PMU_CONFIG */
1213#define PALMAS_PMU_CONFIG_MULTI_CELL_EN 0x40
1214#define PALMAS_PMU_CONFIG_MULTI_CELL_EN_SHIFT 6
1215#define PALMAS_PMU_CONFIG_SPARE_MASK 0x30
1216#define PALMAS_PMU_CONFIG_SPARE_SHIFT 4
1217#define PALMAS_PMU_CONFIG_SWOFF_DLY_MASK 0x0c
1218#define PALMAS_PMU_CONFIG_SWOFF_DLY_SHIFT 2
1219#define PALMAS_PMU_CONFIG_GATE_RESET_OUT 0x02
1220#define PALMAS_PMU_CONFIG_GATE_RESET_OUT_SHIFT 1
1221#define PALMAS_PMU_CONFIG_AUTODEVON 0x01
1222#define PALMAS_PMU_CONFIG_AUTODEVON_SHIFT 0
1223
1224/* Bit definitions for SPARE */
1225#define PALMAS_SPARE_SPARE_MASK 0xf8
1226#define PALMAS_SPARE_SPARE_SHIFT 3
1227#define PALMAS_SPARE_REGEN3_OD 0x04
1228#define PALMAS_SPARE_REGEN3_OD_SHIFT 2
1229#define PALMAS_SPARE_REGEN2_OD 0x02
1230#define PALMAS_SPARE_REGEN2_OD_SHIFT 1
1231#define PALMAS_SPARE_REGEN1_OD 0x01
1232#define PALMAS_SPARE_REGEN1_OD_SHIFT 0
1233
1234/* Bit definitions for PMU_SECONDARY_INT */
1235#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC 0x80
1236#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC_SHIFT 7
1237#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC 0x40
1238#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC_SHIFT 6
1239#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC 0x20
1240#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC_SHIFT 5
1241#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC 0x10
1242#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC_SHIFT 4
1243#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK 0x08
1244#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK_SHIFT 3
1245#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK 0x04
1246#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK_SHIFT 2
1247#define PALMAS_PMU_SECONDARY_INT_BB_MASK 0x02
1248#define PALMAS_PMU_SECONDARY_INT_BB_MASK_SHIFT 1
1249#define PALMAS_PMU_SECONDARY_INT_FBI_MASK 0x01
1250#define PALMAS_PMU_SECONDARY_INT_FBI_MASK_SHIFT 0
1251
1252/* Bit definitions for SW_REVISION */
1253#define PALMAS_SW_REVISION_SW_REVISION_MASK 0xff
1254#define PALMAS_SW_REVISION_SW_REVISION_SHIFT 0
1255
1256/* Bit definitions for EXT_CHRG_CTRL */
1257#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS 0x80
1258#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS_SHIFT 7
1259#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS 0x40
1260#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS_SHIFT 6
1261#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY 0x08
1262#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY_SHIFT 3
1263#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N 0x04
1264#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N_SHIFT 2
1265#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN 0x02
1266#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN_SHIFT 1
1267#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN 0x01
1268#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN_SHIFT 0
1269
1270/* Bit definitions for PMU_SECONDARY_INT2 */
1271#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC 0x20
1272#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC_SHIFT 5
1273#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC 0x10
1274#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC_SHIFT 4
1275#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK 0x02
1276#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK_SHIFT 1
1277#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK 0x01
1278#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK_SHIFT 0
1279
1280/* Registers for function RESOURCE */
1281#define PALMAS_CLK32KG_CTRL 0x0
1282#define PALMAS_CLK32KGAUDIO_CTRL 0x1
1283#define PALMAS_REGEN1_CTRL 0x2
1284#define PALMAS_REGEN2_CTRL 0x3
1285#define PALMAS_SYSEN1_CTRL 0x4
1286#define PALMAS_SYSEN2_CTRL 0x5
1287#define PALMAS_NSLEEP_RES_ASSIGN 0x6
1288#define PALMAS_NSLEEP_SMPS_ASSIGN 0x7
1289#define PALMAS_NSLEEP_LDO_ASSIGN1 0x8
1290#define PALMAS_NSLEEP_LDO_ASSIGN2 0x9
1291#define PALMAS_ENABLE1_RES_ASSIGN 0xA
1292#define PALMAS_ENABLE1_SMPS_ASSIGN 0xB
1293#define PALMAS_ENABLE1_LDO_ASSIGN1 0xC
1294#define PALMAS_ENABLE1_LDO_ASSIGN2 0xD
1295#define PALMAS_ENABLE2_RES_ASSIGN 0xE
1296#define PALMAS_ENABLE2_SMPS_ASSIGN 0xF
1297#define PALMAS_ENABLE2_LDO_ASSIGN1 0x10
1298#define PALMAS_ENABLE2_LDO_ASSIGN2 0x11
1299#define PALMAS_REGEN3_CTRL 0x12
1300
1301/* Bit definitions for CLK32KG_CTRL */
1302#define PALMAS_CLK32KG_CTRL_STATUS 0x10
1303#define PALMAS_CLK32KG_CTRL_STATUS_SHIFT 4
1304#define PALMAS_CLK32KG_CTRL_MODE_SLEEP 0x04
1305#define PALMAS_CLK32KG_CTRL_MODE_SLEEP_SHIFT 2
1306#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE 0x01
1307#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE_SHIFT 0
1308
1309/* Bit definitions for CLK32KGAUDIO_CTRL */
1310#define PALMAS_CLK32KGAUDIO_CTRL_STATUS 0x10
1311#define PALMAS_CLK32KGAUDIO_CTRL_STATUS_SHIFT 4
1312#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3 0x08
1313#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3_SHIFT 3
1314#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP 0x04
1315#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP_SHIFT 2
1316#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE 0x01
1317#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE_SHIFT 0
1318
1319/* Bit definitions for REGEN1_CTRL */
1320#define PALMAS_REGEN1_CTRL_STATUS 0x10
1321#define PALMAS_REGEN1_CTRL_STATUS_SHIFT 4
1322#define PALMAS_REGEN1_CTRL_MODE_SLEEP 0x04
1323#define PALMAS_REGEN1_CTRL_MODE_SLEEP_SHIFT 2
1324#define PALMAS_REGEN1_CTRL_MODE_ACTIVE 0x01
1325#define PALMAS_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0
1326
1327/* Bit definitions for REGEN2_CTRL */
1328#define PALMAS_REGEN2_CTRL_STATUS 0x10
1329#define PALMAS_REGEN2_CTRL_STATUS_SHIFT 4
1330#define PALMAS_REGEN2_CTRL_MODE_SLEEP 0x04
1331#define PALMAS_REGEN2_CTRL_MODE_SLEEP_SHIFT 2
1332#define PALMAS_REGEN2_CTRL_MODE_ACTIVE 0x01
1333#define PALMAS_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0
1334
1335/* Bit definitions for SYSEN1_CTRL */
1336#define PALMAS_SYSEN1_CTRL_STATUS 0x10
1337#define PALMAS_SYSEN1_CTRL_STATUS_SHIFT 4
1338#define PALMAS_SYSEN1_CTRL_MODE_SLEEP 0x04
1339#define PALMAS_SYSEN1_CTRL_MODE_SLEEP_SHIFT 2
1340#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE 0x01
1341#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE_SHIFT 0
1342
1343/* Bit definitions for SYSEN2_CTRL */
1344#define PALMAS_SYSEN2_CTRL_STATUS 0x10
1345#define PALMAS_SYSEN2_CTRL_STATUS_SHIFT 4
1346#define PALMAS_SYSEN2_CTRL_MODE_SLEEP 0x04
1347#define PALMAS_SYSEN2_CTRL_MODE_SLEEP_SHIFT 2
1348#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE 0x01
1349#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE_SHIFT 0
1350
1351/* Bit definitions for NSLEEP_RES_ASSIGN */
1352#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3 0x40
1353#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 6
1354#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO 0x20
1355#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1356#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG 0x10
1357#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG_SHIFT 4
1358#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2 0x08
1359#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2_SHIFT 3
1360#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1 0x04
1361#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1_SHIFT 2
1362#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2 0x02
1363#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 1
1364#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1 0x01
1365#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0
1366
1367/* Bit definitions for NSLEEP_SMPS_ASSIGN */
1368#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10 0x80
1369#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10_SHIFT 7
1370#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9 0x40
1371#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9_SHIFT 6
1372#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8 0x20
1373#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8_SHIFT 5
1374#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7 0x10
1375#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7_SHIFT 4
1376#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6 0x08
1377#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6_SHIFT 3
1378#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45 0x04
1379#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45_SHIFT 2
1380#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3 0x02
1381#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 1
1382#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12 0x01
1383#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12_SHIFT 0
1384
1385/* Bit definitions for NSLEEP_LDO_ASSIGN1 */
1386#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8 0x80
1387#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8_SHIFT 7
1388#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7 0x40
1389#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7_SHIFT 6
1390#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6 0x20
1391#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6_SHIFT 5
1392#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5 0x10
1393#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5_SHIFT 4
1394#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4 0x08
1395#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 3
1396#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3 0x04
1397#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3_SHIFT 2
1398#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2 0x02
1399#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 1
1400#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1 0x01
1401#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0
1402
1403/* Bit definitions for NSLEEP_LDO_ASSIGN2 */
1404#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB 0x04
1405#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB_SHIFT 2
1406#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN 0x02
1407#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN_SHIFT 1
1408#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9 0x01
1409#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9_SHIFT 0
1410
1411/* Bit definitions for ENABLE1_RES_ASSIGN */
1412#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3 0x40
1413#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 6
1414#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO 0x20
1415#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1416#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG 0x10
1417#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG_SHIFT 4
1418#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2 0x08
1419#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2_SHIFT 3
1420#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1 0x04
1421#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1_SHIFT 2
1422#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2 0x02
1423#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 1
1424#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1 0x01
1425#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0
1426
1427/* Bit definitions for ENABLE1_SMPS_ASSIGN */
1428#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10 0x80
1429#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10_SHIFT 7
1430#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9 0x40
1431#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9_SHIFT 6
1432#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8 0x20
1433#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8_SHIFT 5
1434#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7 0x10
1435#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7_SHIFT 4
1436#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6 0x08
1437#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6_SHIFT 3
1438#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45 0x04
1439#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45_SHIFT 2
1440#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3 0x02
1441#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 1
1442#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12 0x01
1443#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12_SHIFT 0
1444
1445/* Bit definitions for ENABLE1_LDO_ASSIGN1 */
1446#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8 0x80
1447#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8_SHIFT 7
1448#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7 0x40
1449#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7_SHIFT 6
1450#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6 0x20
1451#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6_SHIFT 5
1452#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5 0x10
1453#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5_SHIFT 4
1454#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4 0x08
1455#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 3
1456#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3 0x04
1457#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3_SHIFT 2
1458#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2 0x02
1459#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 1
1460#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1 0x01
1461#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0
1462
1463/* Bit definitions for ENABLE1_LDO_ASSIGN2 */
1464#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB 0x04
1465#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB_SHIFT 2
1466#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN 0x02
1467#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN_SHIFT 1
1468#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9 0x01
1469#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9_SHIFT 0
1470
1471/* Bit definitions for ENABLE2_RES_ASSIGN */
1472#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3 0x40
1473#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 6
1474#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO 0x20
1475#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1476#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG 0x10
1477#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG_SHIFT 4
1478#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2 0x08
1479#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2_SHIFT 3
1480#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1 0x04
1481#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1_SHIFT 2
1482#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2 0x02
1483#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 1
1484#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1 0x01
1485#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0
1486
1487/* Bit definitions for ENABLE2_SMPS_ASSIGN */
1488#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10 0x80
1489#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10_SHIFT 7
1490#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9 0x40
1491#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9_SHIFT 6
1492#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8 0x20
1493#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8_SHIFT 5
1494#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7 0x10
1495#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7_SHIFT 4
1496#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6 0x08
1497#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6_SHIFT 3
1498#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45 0x04
1499#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45_SHIFT 2
1500#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3 0x02
1501#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 1
1502#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12 0x01
1503#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12_SHIFT 0
1504
1505/* Bit definitions for ENABLE2_LDO_ASSIGN1 */
1506#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8 0x80
1507#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8_SHIFT 7
1508#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7 0x40
1509#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7_SHIFT 6
1510#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6 0x20
1511#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6_SHIFT 5
1512#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5 0x10
1513#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5_SHIFT 4
1514#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4 0x08
1515#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 3
1516#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3 0x04
1517#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3_SHIFT 2
1518#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2 0x02
1519#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 1
1520#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1 0x01
1521#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0
1522
1523/* Bit definitions for ENABLE2_LDO_ASSIGN2 */
1524#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB 0x04
1525#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB_SHIFT 2
1526#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN 0x02
1527#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN_SHIFT 1
1528#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9 0x01
1529#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9_SHIFT 0
1530
1531/* Bit definitions for REGEN3_CTRL */
1532#define PALMAS_REGEN3_CTRL_STATUS 0x10
1533#define PALMAS_REGEN3_CTRL_STATUS_SHIFT 4
1534#define PALMAS_REGEN3_CTRL_MODE_SLEEP 0x04
1535#define PALMAS_REGEN3_CTRL_MODE_SLEEP_SHIFT 2
1536#define PALMAS_REGEN3_CTRL_MODE_ACTIVE 0x01
1537#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0
1538
1539/* Registers for function PAD_CONTROL */
1540#define PALMAS_PU_PD_INPUT_CTRL1 0x0
1541#define PALMAS_PU_PD_INPUT_CTRL2 0x1
1542#define PALMAS_PU_PD_INPUT_CTRL3 0x2
1543#define PALMAS_OD_OUTPUT_CTRL 0x4
1544#define PALMAS_POLARITY_CTRL 0x5
1545#define PALMAS_PRIMARY_SECONDARY_PAD1 0x6
1546#define PALMAS_PRIMARY_SECONDARY_PAD2 0x7
1547#define PALMAS_I2C_SPI 0x8
1548#define PALMAS_PU_PD_INPUT_CTRL4 0x9
1549#define PALMAS_PRIMARY_SECONDARY_PAD3 0xA
1550
1551/* Bit definitions for PU_PD_INPUT_CTRL1 */
1552#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40
1553#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD_SHIFT 6
1554#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU 0x20
1555#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU_SHIFT 5
1556#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD 0x10
1557#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD_SHIFT 4
1558#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD 0x04
1559#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD_SHIFT 2
1560#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU 0x02
1561#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU_SHIFT 1
1562
1563/* Bit definitions for PU_PD_INPUT_CTRL2 */
1564#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU 0x20
1565#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU_SHIFT 5
1566#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD 0x10
1567#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD_SHIFT 4
1568#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU 0x08
1569#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU_SHIFT 3
1570#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD 0x04
1571#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD_SHIFT 2
1572#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU 0x02
1573#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU_SHIFT 1
1574#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD 0x01
1575#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD_SHIFT 0
1576
1577/* Bit definitions for PU_PD_INPUT_CTRL3 */
1578#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD 0x40
1579#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD_SHIFT 6
1580#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD 0x10
1581#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD_SHIFT 4
1582#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD 0x04
1583#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD_SHIFT 2
1584#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD 0x01
1585#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD_SHIFT 0
1586
1587/* Bit definitions for OD_OUTPUT_CTRL */
1588#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD 0x80
1589#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD_SHIFT 7
1590#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD 0x40
1591#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD_SHIFT 6
1592#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD 0x20
1593#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD_SHIFT 5
1594#define PALMAS_OD_OUTPUT_CTRL_INT_OD 0x08
1595#define PALMAS_OD_OUTPUT_CTRL_INT_OD_SHIFT 3
1596
1597/* Bit definitions for POLARITY_CTRL */
1598#define PALMAS_POLARITY_CTRL_INT_POLARITY 0x80
1599#define PALMAS_POLARITY_CTRL_INT_POLARITY_SHIFT 7
1600#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY 0x40
1601#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY_SHIFT 6
1602#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY 0x20
1603#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY_SHIFT 5
1604#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY 0x10
1605#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY_SHIFT 4
1606#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY 0x08
1607#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY_SHIFT 3
1608#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY 0x04
1609#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY_SHIFT 2
1610#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY 0x02
1611#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY_SHIFT 1
1612#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY 0x01
1613#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY_SHIFT 0
1614
1615/* Bit definitions for PRIMARY_SECONDARY_PAD1 */
1616#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3 0x80
1617#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3_SHIFT 7
1618#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK 0x60
1619#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT 5
1620#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK 0x18
1621#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT 3
1622#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0 0x04
1623#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0_SHIFT 2
1624#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC 0x02
1625#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC_SHIFT 1
1626#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD 0x01
1627#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD_SHIFT 0
1628
1629/* Bit definitions for PRIMARY_SECONDARY_PAD2 */
1630#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK 0x30
1631#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_SHIFT 4
1632#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6 0x08
1633#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6_SHIFT 3
1634#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK 0x06
1635#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_SHIFT 1
1636#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4 0x01
1637#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4_SHIFT 0
1638
1639/* Bit definitions for I2C_SPI */
1640#define PALMAS_I2C_SPI_I2C2OTP_EN 0x80
1641#define PALMAS_I2C_SPI_I2C2OTP_EN_SHIFT 7
1642#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL 0x40
1643#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL_SHIFT 6
1644#define PALMAS_I2C_SPI_ID_I2C2 0x20
1645#define PALMAS_I2C_SPI_ID_I2C2_SHIFT 5
1646#define PALMAS_I2C_SPI_I2C_SPI 0x10
1647#define PALMAS_I2C_SPI_I2C_SPI_SHIFT 4
1648#define PALMAS_I2C_SPI_ID_I2C1_MASK 0x0f
1649#define PALMAS_I2C_SPI_ID_I2C1_SHIFT 0
1650
1651/* Bit definitions for PU_PD_INPUT_CTRL4 */
1652#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD 0x40
1653#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD_SHIFT 6
1654#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD 0x10
1655#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD_SHIFT 4
1656#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD 0x04
1657#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD_SHIFT 2
1658#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD 0x01
1659#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD_SHIFT 0
1660
1661/* Bit definitions for PRIMARY_SECONDARY_PAD3 */
1662#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2 0x02
1663#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2_SHIFT 1
1664#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1 0x01
1665#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1_SHIFT 0
1666
1667/* Registers for function LED_PWM */
1668#define PALMAS_LED_PERIOD_CTRL 0x0
1669#define PALMAS_LED_CTRL 0x1
1670#define PALMAS_PWM_CTRL1 0x2
1671#define PALMAS_PWM_CTRL2 0x3
1672
1673/* Bit definitions for LED_PERIOD_CTRL */
1674#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_MASK 0x38
1675#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_SHIFT 3
1676#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_MASK 0x07
1677#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_SHIFT 0
1678
1679/* Bit definitions for LED_CTRL */
1680#define PALMAS_LED_CTRL_LED_2_SEQ 0x20
1681#define PALMAS_LED_CTRL_LED_2_SEQ_SHIFT 5
1682#define PALMAS_LED_CTRL_LED_1_SEQ 0x10
1683#define PALMAS_LED_CTRL_LED_1_SEQ_SHIFT 4
1684#define PALMAS_LED_CTRL_LED_2_ON_TIME_MASK 0x0c
1685#define PALMAS_LED_CTRL_LED_2_ON_TIME_SHIFT 2
1686#define PALMAS_LED_CTRL_LED_1_ON_TIME_MASK 0x03
1687#define PALMAS_LED_CTRL_LED_1_ON_TIME_SHIFT 0
1688
1689/* Bit definitions for PWM_CTRL1 */
1690#define PALMAS_PWM_CTRL1_PWM_FREQ_EN 0x02
1691#define PALMAS_PWM_CTRL1_PWM_FREQ_EN_SHIFT 1
1692#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL 0x01
1693#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL_SHIFT 0
1694
1695/* Bit definitions for PWM_CTRL2 */
1696#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_MASK 0xff
1697#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_SHIFT 0
1698
1699/* Registers for function INTERRUPT */
1700#define PALMAS_INT1_STATUS 0x0
1701#define PALMAS_INT1_MASK 0x1
1702#define PALMAS_INT1_LINE_STATE 0x2
1703#define PALMAS_INT1_EDGE_DETECT1_RESERVED 0x3
1704#define PALMAS_INT1_EDGE_DETECT2_RESERVED 0x4
1705#define PALMAS_INT2_STATUS 0x5
1706#define PALMAS_INT2_MASK 0x6
1707#define PALMAS_INT2_LINE_STATE 0x7
1708#define PALMAS_INT2_EDGE_DETECT1_RESERVED 0x8
1709#define PALMAS_INT2_EDGE_DETECT2_RESERVED 0x9
1710#define PALMAS_INT3_STATUS 0xA
1711#define PALMAS_INT3_MASK 0xB
1712#define PALMAS_INT3_LINE_STATE 0xC
1713#define PALMAS_INT3_EDGE_DETECT1_RESERVED 0xD
1714#define PALMAS_INT3_EDGE_DETECT2_RESERVED 0xE
1715#define PALMAS_INT4_STATUS 0xF
1716#define PALMAS_INT4_MASK 0x10
1717#define PALMAS_INT4_LINE_STATE 0x11
1718#define PALMAS_INT4_EDGE_DETECT1 0x12
1719#define PALMAS_INT4_EDGE_DETECT2 0x13
1720#define PALMAS_INT_CTRL 0x14
1721
1722/* Bit definitions for INT1_STATUS */
1723#define PALMAS_INT1_STATUS_VBAT_MON 0x80
1724#define PALMAS_INT1_STATUS_VBAT_MON_SHIFT 7
1725#define PALMAS_INT1_STATUS_VSYS_MON 0x40
1726#define PALMAS_INT1_STATUS_VSYS_MON_SHIFT 6
1727#define PALMAS_INT1_STATUS_HOTDIE 0x20
1728#define PALMAS_INT1_STATUS_HOTDIE_SHIFT 5
1729#define PALMAS_INT1_STATUS_PWRDOWN 0x10
1730#define PALMAS_INT1_STATUS_PWRDOWN_SHIFT 4
1731#define PALMAS_INT1_STATUS_RPWRON 0x08
1732#define PALMAS_INT1_STATUS_RPWRON_SHIFT 3
1733#define PALMAS_INT1_STATUS_LONG_PRESS_KEY 0x04
1734#define PALMAS_INT1_STATUS_LONG_PRESS_KEY_SHIFT 2
1735#define PALMAS_INT1_STATUS_PWRON 0x02
1736#define PALMAS_INT1_STATUS_PWRON_SHIFT 1
1737#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV 0x01
1738#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV_SHIFT 0
1739
1740/* Bit definitions for INT1_MASK */
1741#define PALMAS_INT1_MASK_VBAT_MON 0x80
1742#define PALMAS_INT1_MASK_VBAT_MON_SHIFT 7
1743#define PALMAS_INT1_MASK_VSYS_MON 0x40
1744#define PALMAS_INT1_MASK_VSYS_MON_SHIFT 6
1745#define PALMAS_INT1_MASK_HOTDIE 0x20
1746#define PALMAS_INT1_MASK_HOTDIE_SHIFT 5
1747#define PALMAS_INT1_MASK_PWRDOWN 0x10
1748#define PALMAS_INT1_MASK_PWRDOWN_SHIFT 4
1749#define PALMAS_INT1_MASK_RPWRON 0x08
1750#define PALMAS_INT1_MASK_RPWRON_SHIFT 3
1751#define PALMAS_INT1_MASK_LONG_PRESS_KEY 0x04
1752#define PALMAS_INT1_MASK_LONG_PRESS_KEY_SHIFT 2
1753#define PALMAS_INT1_MASK_PWRON 0x02
1754#define PALMAS_INT1_MASK_PWRON_SHIFT 1
1755#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV 0x01
1756#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV_SHIFT 0
1757
1758/* Bit definitions for INT1_LINE_STATE */
1759#define PALMAS_INT1_LINE_STATE_VBAT_MON 0x80
1760#define PALMAS_INT1_LINE_STATE_VBAT_MON_SHIFT 7
1761#define PALMAS_INT1_LINE_STATE_VSYS_MON 0x40
1762#define PALMAS_INT1_LINE_STATE_VSYS_MON_SHIFT 6
1763#define PALMAS_INT1_LINE_STATE_HOTDIE 0x20
1764#define PALMAS_INT1_LINE_STATE_HOTDIE_SHIFT 5
1765#define PALMAS_INT1_LINE_STATE_PWRDOWN 0x10
1766#define PALMAS_INT1_LINE_STATE_PWRDOWN_SHIFT 4
1767#define PALMAS_INT1_LINE_STATE_RPWRON 0x08
1768#define PALMAS_INT1_LINE_STATE_RPWRON_SHIFT 3
1769#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY 0x04
1770#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 2
1771#define PALMAS_INT1_LINE_STATE_PWRON 0x02
1772#define PALMAS_INT1_LINE_STATE_PWRON_SHIFT 1
1773#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV 0x01
1774#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV_SHIFT 0
1775
1776/* Bit definitions for INT2_STATUS */
1777#define PALMAS_INT2_STATUS_VAC_ACOK 0x80
1778#define PALMAS_INT2_STATUS_VAC_ACOK_SHIFT 7
1779#define PALMAS_INT2_STATUS_SHORT 0x40
1780#define PALMAS_INT2_STATUS_SHORT_SHIFT 6
1781#define PALMAS_INT2_STATUS_FBI_BB 0x20
1782#define PALMAS_INT2_STATUS_FBI_BB_SHIFT 5
1783#define PALMAS_INT2_STATUS_RESET_IN 0x10
1784#define PALMAS_INT2_STATUS_RESET_IN_SHIFT 4
1785#define PALMAS_INT2_STATUS_BATREMOVAL 0x08
1786#define PALMAS_INT2_STATUS_BATREMOVAL_SHIFT 3
1787#define PALMAS_INT2_STATUS_WDT 0x04
1788#define PALMAS_INT2_STATUS_WDT_SHIFT 2
1789#define PALMAS_INT2_STATUS_RTC_TIMER 0x02
1790#define PALMAS_INT2_STATUS_RTC_TIMER_SHIFT 1
1791#define PALMAS_INT2_STATUS_RTC_ALARM 0x01
1792#define PALMAS_INT2_STATUS_RTC_ALARM_SHIFT 0
1793
1794/* Bit definitions for INT2_MASK */
1795#define PALMAS_INT2_MASK_VAC_ACOK 0x80
1796#define PALMAS_INT2_MASK_VAC_ACOK_SHIFT 7
1797#define PALMAS_INT2_MASK_SHORT 0x40
1798#define PALMAS_INT2_MASK_SHORT_SHIFT 6
1799#define PALMAS_INT2_MASK_FBI_BB 0x20
1800#define PALMAS_INT2_MASK_FBI_BB_SHIFT 5
1801#define PALMAS_INT2_MASK_RESET_IN 0x10
1802#define PALMAS_INT2_MASK_RESET_IN_SHIFT 4
1803#define PALMAS_INT2_MASK_BATREMOVAL 0x08
1804#define PALMAS_INT2_MASK_BATREMOVAL_SHIFT 3
1805#define PALMAS_INT2_MASK_WDT 0x04
1806#define PALMAS_INT2_MASK_WDT_SHIFT 2
1807#define PALMAS_INT2_MASK_RTC_TIMER 0x02
1808#define PALMAS_INT2_MASK_RTC_TIMER_SHIFT 1
1809#define PALMAS_INT2_MASK_RTC_ALARM 0x01
1810#define PALMAS_INT2_MASK_RTC_ALARM_SHIFT 0
1811
1812/* Bit definitions for INT2_LINE_STATE */
1813#define PALMAS_INT2_LINE_STATE_VAC_ACOK 0x80
1814#define PALMAS_INT2_LINE_STATE_VAC_ACOK_SHIFT 7
1815#define PALMAS_INT2_LINE_STATE_SHORT 0x40
1816#define PALMAS_INT2_LINE_STATE_SHORT_SHIFT 6
1817#define PALMAS_INT2_LINE_STATE_FBI_BB 0x20
1818#define PALMAS_INT2_LINE_STATE_FBI_BB_SHIFT 5
1819#define PALMAS_INT2_LINE_STATE_RESET_IN 0x10
1820#define PALMAS_INT2_LINE_STATE_RESET_IN_SHIFT 4
1821#define PALMAS_INT2_LINE_STATE_BATREMOVAL 0x08
1822#define PALMAS_INT2_LINE_STATE_BATREMOVAL_SHIFT 3
1823#define PALMAS_INT2_LINE_STATE_WDT 0x04
1824#define PALMAS_INT2_LINE_STATE_WDT_SHIFT 2
1825#define PALMAS_INT2_LINE_STATE_RTC_TIMER 0x02
1826#define PALMAS_INT2_LINE_STATE_RTC_TIMER_SHIFT 1
1827#define PALMAS_INT2_LINE_STATE_RTC_ALARM 0x01
1828#define PALMAS_INT2_LINE_STATE_RTC_ALARM_SHIFT 0
1829
1830/* Bit definitions for INT3_STATUS */
1831#define PALMAS_INT3_STATUS_VBUS 0x80
1832#define PALMAS_INT3_STATUS_VBUS_SHIFT 7
1833#define PALMAS_INT3_STATUS_VBUS_OTG 0x40
1834#define PALMAS_INT3_STATUS_VBUS_OTG_SHIFT 6
1835#define PALMAS_INT3_STATUS_ID 0x20
1836#define PALMAS_INT3_STATUS_ID_SHIFT 5
1837#define PALMAS_INT3_STATUS_ID_OTG 0x10
1838#define PALMAS_INT3_STATUS_ID_OTG_SHIFT 4
1839#define PALMAS_INT3_STATUS_GPADC_EOC_RT 0x08
1840#define PALMAS_INT3_STATUS_GPADC_EOC_RT_SHIFT 3
1841#define PALMAS_INT3_STATUS_GPADC_EOC_SW 0x04
1842#define PALMAS_INT3_STATUS_GPADC_EOC_SW_SHIFT 2
1843#define PALMAS_INT3_STATUS_GPADC_AUTO_1 0x02
1844#define PALMAS_INT3_STATUS_GPADC_AUTO_1_SHIFT 1
1845#define PALMAS_INT3_STATUS_GPADC_AUTO_0 0x01
1846#define PALMAS_INT3_STATUS_GPADC_AUTO_0_SHIFT 0
1847
1848/* Bit definitions for INT3_MASK */
1849#define PALMAS_INT3_MASK_VBUS 0x80
1850#define PALMAS_INT3_MASK_VBUS_SHIFT 7
1851#define PALMAS_INT3_MASK_VBUS_OTG 0x40
1852#define PALMAS_INT3_MASK_VBUS_OTG_SHIFT 6
1853#define PALMAS_INT3_MASK_ID 0x20
1854#define PALMAS_INT3_MASK_ID_SHIFT 5
1855#define PALMAS_INT3_MASK_ID_OTG 0x10
1856#define PALMAS_INT3_MASK_ID_OTG_SHIFT 4
1857#define PALMAS_INT3_MASK_GPADC_EOC_RT 0x08
1858#define PALMAS_INT3_MASK_GPADC_EOC_RT_SHIFT 3
1859#define PALMAS_INT3_MASK_GPADC_EOC_SW 0x04
1860#define PALMAS_INT3_MASK_GPADC_EOC_SW_SHIFT 2
1861#define PALMAS_INT3_MASK_GPADC_AUTO_1 0x02
1862#define PALMAS_INT3_MASK_GPADC_AUTO_1_SHIFT 1
1863#define PALMAS_INT3_MASK_GPADC_AUTO_0 0x01
1864#define PALMAS_INT3_MASK_GPADC_AUTO_0_SHIFT 0
1865
1866/* Bit definitions for INT3_LINE_STATE */
1867#define PALMAS_INT3_LINE_STATE_VBUS 0x80
1868#define PALMAS_INT3_LINE_STATE_VBUS_SHIFT 7
1869#define PALMAS_INT3_LINE_STATE_VBUS_OTG 0x40
1870#define PALMAS_INT3_LINE_STATE_VBUS_OTG_SHIFT 6
1871#define PALMAS_INT3_LINE_STATE_ID 0x20
1872#define PALMAS_INT3_LINE_STATE_ID_SHIFT 5
1873#define PALMAS_INT3_LINE_STATE_ID_OTG 0x10
1874#define PALMAS_INT3_LINE_STATE_ID_OTG_SHIFT 4
1875#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT 0x08
1876#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT_SHIFT 3
1877#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW 0x04
1878#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 2
1879#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1 0x02
1880#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 1
1881#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0 0x01
1882#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0
1883
1884/* Bit definitions for INT4_STATUS */
1885#define PALMAS_INT4_STATUS_GPIO_7 0x80
1886#define PALMAS_INT4_STATUS_GPIO_7_SHIFT 7
1887#define PALMAS_INT4_STATUS_GPIO_6 0x40
1888#define PALMAS_INT4_STATUS_GPIO_6_SHIFT 6
1889#define PALMAS_INT4_STATUS_GPIO_5 0x20
1890#define PALMAS_INT4_STATUS_GPIO_5_SHIFT 5
1891#define PALMAS_INT4_STATUS_GPIO_4 0x10
1892#define PALMAS_INT4_STATUS_GPIO_4_SHIFT 4
1893#define PALMAS_INT4_STATUS_GPIO_3 0x08
1894#define PALMAS_INT4_STATUS_GPIO_3_SHIFT 3
1895#define PALMAS_INT4_STATUS_GPIO_2 0x04
1896#define PALMAS_INT4_STATUS_GPIO_2_SHIFT 2
1897#define PALMAS_INT4_STATUS_GPIO_1 0x02
1898#define PALMAS_INT4_STATUS_GPIO_1_SHIFT 1
1899#define PALMAS_INT4_STATUS_GPIO_0 0x01
1900#define PALMAS_INT4_STATUS_GPIO_0_SHIFT 0
1901
1902/* Bit definitions for INT4_MASK */
1903#define PALMAS_INT4_MASK_GPIO_7 0x80
1904#define PALMAS_INT4_MASK_GPIO_7_SHIFT 7
1905#define PALMAS_INT4_MASK_GPIO_6 0x40
1906#define PALMAS_INT4_MASK_GPIO_6_SHIFT 6
1907#define PALMAS_INT4_MASK_GPIO_5 0x20
1908#define PALMAS_INT4_MASK_GPIO_5_SHIFT 5
1909#define PALMAS_INT4_MASK_GPIO_4 0x10
1910#define PALMAS_INT4_MASK_GPIO_4_SHIFT 4
1911#define PALMAS_INT4_MASK_GPIO_3 0x08
1912#define PALMAS_INT4_MASK_GPIO_3_SHIFT 3
1913#define PALMAS_INT4_MASK_GPIO_2 0x04
1914#define PALMAS_INT4_MASK_GPIO_2_SHIFT 2
1915#define PALMAS_INT4_MASK_GPIO_1 0x02
1916#define PALMAS_INT4_MASK_GPIO_1_SHIFT 1
1917#define PALMAS_INT4_MASK_GPIO_0 0x01
1918#define PALMAS_INT4_MASK_GPIO_0_SHIFT 0
1919
1920/* Bit definitions for INT4_LINE_STATE */
1921#define PALMAS_INT4_LINE_STATE_GPIO_7 0x80
1922#define PALMAS_INT4_LINE_STATE_GPIO_7_SHIFT 7
1923#define PALMAS_INT4_LINE_STATE_GPIO_6 0x40
1924#define PALMAS_INT4_LINE_STATE_GPIO_6_SHIFT 6
1925#define PALMAS_INT4_LINE_STATE_GPIO_5 0x20
1926#define PALMAS_INT4_LINE_STATE_GPIO_5_SHIFT 5
1927#define PALMAS_INT4_LINE_STATE_GPIO_4 0x10
1928#define PALMAS_INT4_LINE_STATE_GPIO_4_SHIFT 4
1929#define PALMAS_INT4_LINE_STATE_GPIO_3 0x08
1930#define PALMAS_INT4_LINE_STATE_GPIO_3_SHIFT 3
1931#define PALMAS_INT4_LINE_STATE_GPIO_2 0x04
1932#define PALMAS_INT4_LINE_STATE_GPIO_2_SHIFT 2
1933#define PALMAS_INT4_LINE_STATE_GPIO_1 0x02
1934#define PALMAS_INT4_LINE_STATE_GPIO_1_SHIFT 1
1935#define PALMAS_INT4_LINE_STATE_GPIO_0 0x01
1936#define PALMAS_INT4_LINE_STATE_GPIO_0_SHIFT 0
1937
1938/* Bit definitions for INT4_EDGE_DETECT1 */
1939#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80
1940#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 7
1941#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40
1942#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 6
1943#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20
1944#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 5
1945#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10
1946#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 4
1947#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08
1948#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 3
1949#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04
1950#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 2
1951#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02
1952#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 1
1953#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01
1954#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0
1955
1956/* Bit definitions for INT4_EDGE_DETECT2 */
1957#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING 0x80
1958#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING_SHIFT 7
1959#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING 0x40
1960#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING_SHIFT 6
1961#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20
1962#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 5
1963#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10
1964#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 4
1965#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08
1966#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 3
1967#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04
1968#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 2
1969#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02
1970#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 1
1971#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01
1972#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0
1973
1974/* Bit definitions for INT_CTRL */
1975#define PALMAS_INT_CTRL_INT_PENDING 0x04
1976#define PALMAS_INT_CTRL_INT_PENDING_SHIFT 2
1977#define PALMAS_INT_CTRL_INT_CLEAR 0x01
1978#define PALMAS_INT_CTRL_INT_CLEAR_SHIFT 0
1979
1980/* Registers for function USB_OTG */
1981#define PALMAS_USB_WAKEUP 0x3
1982#define PALMAS_USB_VBUS_CTRL_SET 0x4
1983#define PALMAS_USB_VBUS_CTRL_CLR 0x5
1984#define PALMAS_USB_ID_CTRL_SET 0x6
1985#define PALMAS_USB_ID_CTRL_CLEAR 0x7
1986#define PALMAS_USB_VBUS_INT_SRC 0x8
1987#define PALMAS_USB_VBUS_INT_LATCH_SET 0x9
1988#define PALMAS_USB_VBUS_INT_LATCH_CLR 0xA
1989#define PALMAS_USB_VBUS_INT_EN_LO_SET 0xB
1990#define PALMAS_USB_VBUS_INT_EN_LO_CLR 0xC
1991#define PALMAS_USB_VBUS_INT_EN_HI_SET 0xD
1992#define PALMAS_USB_VBUS_INT_EN_HI_CLR 0xE
1993#define PALMAS_USB_ID_INT_SRC 0xF
1994#define PALMAS_USB_ID_INT_LATCH_SET 0x10
1995#define PALMAS_USB_ID_INT_LATCH_CLR 0x11
1996#define PALMAS_USB_ID_INT_EN_LO_SET 0x12
1997#define PALMAS_USB_ID_INT_EN_LO_CLR 0x13
1998#define PALMAS_USB_ID_INT_EN_HI_SET 0x14
1999#define PALMAS_USB_ID_INT_EN_HI_CLR 0x15
2000#define PALMAS_USB_OTG_ADP_CTRL 0x16
2001#define PALMAS_USB_OTG_ADP_HIGH 0x17
2002#define PALMAS_USB_OTG_ADP_LOW 0x18
2003#define PALMAS_USB_OTG_ADP_RISE 0x19
2004#define PALMAS_USB_OTG_REVISION 0x1A
2005
2006/* Bit definitions for USB_WAKEUP */
2007#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP 0x01
2008#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP_SHIFT 0
2009
2010/* Bit definitions for USB_VBUS_CTRL_SET */
2011#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS 0x80
2012#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS_SHIFT 7
2013#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG 0x20
2014#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG_SHIFT 5
2015#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC 0x10
2016#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC_SHIFT 4
2017#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK 0x08
2018#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK_SHIFT 3
2019#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP 0x04
2020#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP_SHIFT 2
2021
2022/* Bit definitions for USB_VBUS_CTRL_CLR */
2023#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS 0x80
2024#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS_SHIFT 7
2025#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG 0x20
2026#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG_SHIFT 5
2027#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC 0x10
2028#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC_SHIFT 4
2029#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK 0x08
2030#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK_SHIFT 3
2031#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP 0x04
2032#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP_SHIFT 2
2033
2034/* Bit definitions for USB_ID_CTRL_SET */
2035#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K 0x80
2036#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K_SHIFT 7
2037#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K 0x40
2038#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K_SHIFT 6
2039#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV 0x20
2040#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV_SHIFT 5
2041#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U 0x10
2042#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U_SHIFT 4
2043#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U 0x08
2044#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U_SHIFT 3
2045#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP 0x04
2046#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP_SHIFT 2
2047
2048/* Bit definitions for USB_ID_CTRL_CLEAR */
2049#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K 0x80
2050#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K_SHIFT 7
2051#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K 0x40
2052#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K_SHIFT 6
2053#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV 0x20
2054#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV_SHIFT 5
2055#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U 0x10
2056#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U_SHIFT 4
2057#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U 0x08
2058#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U_SHIFT 3
2059#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP 0x04
2060#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP_SHIFT 2
2061
2062/* Bit definitions for USB_VBUS_INT_SRC */
2063#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD 0x80
2064#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD_SHIFT 7
2065#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB 0x40
2066#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB_SHIFT 6
2067#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS 0x20
2068#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS_SHIFT 5
2069#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD 0x08
2070#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD_SHIFT 3
2071#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD 0x04
2072#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD_SHIFT 2
2073#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD 0x02
2074#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD_SHIFT 1
2075#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END 0x01
2076#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END_SHIFT 0
2077
2078/* Bit definitions for USB_VBUS_INT_LATCH_SET */
2079#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD 0x80
2080#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD_SHIFT 7
2081#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB 0x40
2082#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB_SHIFT 6
2083#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS 0x20
2084#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS_SHIFT 5
2085#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP 0x10
2086#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP_SHIFT 4
2087#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD 0x08
2088#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD_SHIFT 3
2089#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD 0x04
2090#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD_SHIFT 2
2091#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD 0x02
2092#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD_SHIFT 1
2093#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END 0x01
2094#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END_SHIFT 0
2095
2096/* Bit definitions for USB_VBUS_INT_LATCH_CLR */
2097#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD 0x80
2098#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD_SHIFT 7
2099#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB 0x40
2100#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB_SHIFT 6
2101#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS 0x20
2102#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS_SHIFT 5
2103#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP 0x10
2104#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP_SHIFT 4
2105#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD 0x08
2106#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD_SHIFT 3
2107#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD 0x04
2108#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD_SHIFT 2
2109#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD 0x02
2110#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD_SHIFT 1
2111#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END 0x01
2112#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END_SHIFT 0
2113
2114/* Bit definitions for USB_VBUS_INT_EN_LO_SET */
2115#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD 0x80
2116#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD_SHIFT 7
2117#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB 0x40
2118#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB_SHIFT 6
2119#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS 0x20
2120#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS_SHIFT 5
2121#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD 0x08
2122#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD_SHIFT 3
2123#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD 0x04
2124#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD_SHIFT 2
2125#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD 0x02
2126#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD_SHIFT 1
2127#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END 0x01
2128#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END_SHIFT 0
2129
2130/* Bit definitions for USB_VBUS_INT_EN_LO_CLR */
2131#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD 0x80
2132#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD_SHIFT 7
2133#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB 0x40
2134#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB_SHIFT 6
2135#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS 0x20
2136#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS_SHIFT 5
2137#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD 0x08
2138#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD_SHIFT 3
2139#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD 0x04
2140#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD_SHIFT 2
2141#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD 0x02
2142#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD_SHIFT 1
2143#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END 0x01
2144#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END_SHIFT 0
2145
2146/* Bit definitions for USB_VBUS_INT_EN_HI_SET */
2147#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD 0x80
2148#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD_SHIFT 7
2149#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB 0x40
2150#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB_SHIFT 6
2151#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS 0x20
2152#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS_SHIFT 5
2153#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP 0x10
2154#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP_SHIFT 4
2155#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD 0x08
2156#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD_SHIFT 3
2157#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD 0x04
2158#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD_SHIFT 2
2159#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD 0x02
2160#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD_SHIFT 1
2161#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END 0x01
2162#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END_SHIFT 0
2163
2164/* Bit definitions for USB_VBUS_INT_EN_HI_CLR */
2165#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD 0x80
2166#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD_SHIFT 7
2167#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB 0x40
2168#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB_SHIFT 6
2169#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS 0x20
2170#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS_SHIFT 5
2171#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP 0x10
2172#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP_SHIFT 4
2173#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD 0x08
2174#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD_SHIFT 3
2175#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD 0x04
2176#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD_SHIFT 2
2177#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD 0x02
2178#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD_SHIFT 1
2179#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END 0x01
2180#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END_SHIFT 0
2181
2182/* Bit definitions for USB_ID_INT_SRC */
2183#define PALMAS_USB_ID_INT_SRC_ID_FLOAT 0x10
2184#define PALMAS_USB_ID_INT_SRC_ID_FLOAT_SHIFT 4
2185#define PALMAS_USB_ID_INT_SRC_ID_A 0x08
2186#define PALMAS_USB_ID_INT_SRC_ID_A_SHIFT 3
2187#define PALMAS_USB_ID_INT_SRC_ID_B 0x04
2188#define PALMAS_USB_ID_INT_SRC_ID_B_SHIFT 2
2189#define PALMAS_USB_ID_INT_SRC_ID_C 0x02
2190#define PALMAS_USB_ID_INT_SRC_ID_C_SHIFT 1
2191#define PALMAS_USB_ID_INT_SRC_ID_GND 0x01
2192#define PALMAS_USB_ID_INT_SRC_ID_GND_SHIFT 0
2193
2194/* Bit definitions for USB_ID_INT_LATCH_SET */
2195#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT 0x10
2196#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT_SHIFT 4
2197#define PALMAS_USB_ID_INT_LATCH_SET_ID_A 0x08
2198#define PALMAS_USB_ID_INT_LATCH_SET_ID_A_SHIFT 3
2199#define PALMAS_USB_ID_INT_LATCH_SET_ID_B 0x04
2200#define PALMAS_USB_ID_INT_LATCH_SET_ID_B_SHIFT 2
2201#define PALMAS_USB_ID_INT_LATCH_SET_ID_C 0x02
2202#define PALMAS_USB_ID_INT_LATCH_SET_ID_C_SHIFT 1
2203#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND 0x01
2204#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND_SHIFT 0
2205
2206/* Bit definitions for USB_ID_INT_LATCH_CLR */
2207#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT 0x10
2208#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT_SHIFT 4
2209#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A 0x08
2210#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A_SHIFT 3
2211#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B 0x04
2212#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B_SHIFT 2
2213#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C 0x02
2214#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C_SHIFT 1
2215#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND 0x01
2216#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND_SHIFT 0
2217
2218/* Bit definitions for USB_ID_INT_EN_LO_SET */
2219#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT 0x10
2220#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT_SHIFT 4
2221#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A 0x08
2222#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A_SHIFT 3
2223#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B 0x04
2224#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B_SHIFT 2
2225#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C 0x02
2226#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C_SHIFT 1
2227#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND 0x01
2228#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND_SHIFT 0
2229
2230/* Bit definitions for USB_ID_INT_EN_LO_CLR */
2231#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT 0x10
2232#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT_SHIFT 4
2233#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A 0x08
2234#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A_SHIFT 3
2235#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B 0x04
2236#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B_SHIFT 2
2237#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C 0x02
2238#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C_SHIFT 1
2239#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND 0x01
2240#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND_SHIFT 0
2241
2242/* Bit definitions for USB_ID_INT_EN_HI_SET */
2243#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT 0x10
2244#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT_SHIFT 4
2245#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A 0x08
2246#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A_SHIFT 3
2247#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B 0x04
2248#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B_SHIFT 2
2249#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C 0x02
2250#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C_SHIFT 1
2251#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND 0x01
2252#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND_SHIFT 0
2253
2254/* Bit definitions for USB_ID_INT_EN_HI_CLR */
2255#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT 0x10
2256#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT_SHIFT 4
2257#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A 0x08
2258#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A_SHIFT 3
2259#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B 0x04
2260#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B_SHIFT 2
2261#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C 0x02
2262#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C_SHIFT 1
2263#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND 0x01
2264#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND_SHIFT 0
2265
2266/* Bit definitions for USB_OTG_ADP_CTRL */
2267#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN 0x04
2268#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN_SHIFT 2
2269#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_MASK 0x03
2270#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_SHIFT 0
2271
2272/* Bit definitions for USB_OTG_ADP_HIGH */
2273#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_MASK 0xff
2274#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_SHIFT 0
2275
2276/* Bit definitions for USB_OTG_ADP_LOW */
2277#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_MASK 0xff
2278#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_SHIFT 0
2279
2280/* Bit definitions for USB_OTG_ADP_RISE */
2281#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_MASK 0xff
2282#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_SHIFT 0
2283
2284/* Bit definitions for USB_OTG_REVISION */
2285#define PALMAS_USB_OTG_REVISION_OTG_REV 0x01
2286#define PALMAS_USB_OTG_REVISION_OTG_REV_SHIFT 0
2287
2288/* Registers for function VIBRATOR */
2289#define PALMAS_VIBRA_CTRL 0x0
2290
2291/* Bit definitions for VIBRA_CTRL */
2292#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_MASK 0x06
2293#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_SHIFT 1
2294#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL 0x01
2295#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL_SHIFT 0
2296
2297/* Registers for function GPIO */
2298#define PALMAS_GPIO_DATA_IN 0x0
2299#define PALMAS_GPIO_DATA_DIR 0x1
2300#define PALMAS_GPIO_DATA_OUT 0x2
2301#define PALMAS_GPIO_DEBOUNCE_EN 0x3
2302#define PALMAS_GPIO_CLEAR_DATA_OUT 0x4
2303#define PALMAS_GPIO_SET_DATA_OUT 0x5
2304#define PALMAS_PU_PD_GPIO_CTRL1 0x6
2305#define PALMAS_PU_PD_GPIO_CTRL2 0x7
2306#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8
2307
2308/* Bit definitions for GPIO_DATA_IN */
2309#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80
2310#define PALMAS_GPIO_DATA_IN_GPIO_7_IN_SHIFT 7
2311#define PALMAS_GPIO_DATA_IN_GPIO_6_IN 0x40
2312#define PALMAS_GPIO_DATA_IN_GPIO_6_IN_SHIFT 6
2313#define PALMAS_GPIO_DATA_IN_GPIO_5_IN 0x20
2314#define PALMAS_GPIO_DATA_IN_GPIO_5_IN_SHIFT 5
2315#define PALMAS_GPIO_DATA_IN_GPIO_4_IN 0x10
2316#define PALMAS_GPIO_DATA_IN_GPIO_4_IN_SHIFT 4
2317#define PALMAS_GPIO_DATA_IN_GPIO_3_IN 0x08
2318#define PALMAS_GPIO_DATA_IN_GPIO_3_IN_SHIFT 3
2319#define PALMAS_GPIO_DATA_IN_GPIO_2_IN 0x04
2320#define PALMAS_GPIO_DATA_IN_GPIO_2_IN_SHIFT 2
2321#define PALMAS_GPIO_DATA_IN_GPIO_1_IN 0x02
2322#define PALMAS_GPIO_DATA_IN_GPIO_1_IN_SHIFT 1
2323#define PALMAS_GPIO_DATA_IN_GPIO_0_IN 0x01
2324#define PALMAS_GPIO_DATA_IN_GPIO_0_IN_SHIFT 0
2325
2326/* Bit definitions for GPIO_DATA_DIR */
2327#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR 0x80
2328#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR_SHIFT 7
2329#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR 0x40
2330#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR_SHIFT 6
2331#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR 0x20
2332#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR_SHIFT 5
2333#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR 0x10
2334#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR_SHIFT 4
2335#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR 0x08
2336#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR_SHIFT 3
2337#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR 0x04
2338#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR_SHIFT 2
2339#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR 0x02
2340#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR_SHIFT 1
2341#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR 0x01
2342#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR_SHIFT 0
2343
2344/* Bit definitions for GPIO_DATA_OUT */
2345#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT 0x80
2346#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT_SHIFT 7
2347#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT 0x40
2348#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT_SHIFT 6
2349#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT 0x20
2350#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT_SHIFT 5
2351#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT 0x10
2352#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT_SHIFT 4
2353#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT 0x08
2354#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT_SHIFT 3
2355#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT 0x04
2356#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT_SHIFT 2
2357#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT 0x02
2358#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT_SHIFT 1
2359#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT 0x01
2360#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT_SHIFT 0
2361
2362/* Bit definitions for GPIO_DEBOUNCE_EN */
2363#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN 0x80
2364#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN_SHIFT 7
2365#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN 0x40
2366#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN_SHIFT 6
2367#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN 0x20
2368#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN_SHIFT 5
2369#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN 0x10
2370#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN_SHIFT 4
2371#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN 0x08
2372#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN_SHIFT 3
2373#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN 0x04
2374#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN_SHIFT 2
2375#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN 0x02
2376#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN_SHIFT 1
2377#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN 0x01
2378#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN_SHIFT 0
2379
2380/* Bit definitions for GPIO_CLEAR_DATA_OUT */
2381#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT 0x80
2382#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT_SHIFT 7
2383#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT 0x40
2384#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT_SHIFT 6
2385#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT 0x20
2386#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT_SHIFT 5
2387#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT 0x10
2388#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT_SHIFT 4
2389#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT 0x08
2390#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT_SHIFT 3
2391#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT 0x04
2392#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT_SHIFT 2
2393#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT 0x02
2394#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT_SHIFT 1
2395#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT 0x01
2396#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT_SHIFT 0
2397
2398/* Bit definitions for GPIO_SET_DATA_OUT */
2399#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT 0x80
2400#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT_SHIFT 7
2401#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT 0x40
2402#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT_SHIFT 6
2403#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT 0x20
2404#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT_SHIFT 5
2405#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT 0x10
2406#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT_SHIFT 4
2407#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT 0x08
2408#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT_SHIFT 3
2409#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT 0x04
2410#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT_SHIFT 2
2411#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT 0x02
2412#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT_SHIFT 1
2413#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT 0x01
2414#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT_SHIFT 0
2415
2416/* Bit definitions for PU_PD_GPIO_CTRL1 */
2417#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD 0x40
2418#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD_SHIFT 6
2419#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU 0x20
2420#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU_SHIFT 5
2421#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD 0x10
2422#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD_SHIFT 4
2423#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU 0x08
2424#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU_SHIFT 3
2425#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD 0x04
2426#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD_SHIFT 2
2427#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD 0x01
2428#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD_SHIFT 0
2429
2430/* Bit definitions for PU_PD_GPIO_CTRL2 */
2431#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD 0x40
2432#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD_SHIFT 6
2433#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU 0x20
2434#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU_SHIFT 5
2435#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD 0x10
2436#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD_SHIFT 4
2437#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU 0x08
2438#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU_SHIFT 3
2439#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD 0x04
2440#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD_SHIFT 2
2441#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU 0x02
2442#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU_SHIFT 1
2443#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD 0x01
2444#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD_SHIFT 0
2445
2446/* Bit definitions for OD_OUTPUT_GPIO_CTRL */
2447#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD 0x20
2448#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD_SHIFT 5
2449#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD 0x04
2450#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD_SHIFT 2
2451#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD 0x02
2452#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD_SHIFT 1
2453
2454/* Registers for function GPADC */
2455#define PALMAS_GPADC_CTRL1 0x0
2456#define PALMAS_GPADC_CTRL2 0x1
2457#define PALMAS_GPADC_RT_CTRL 0x2
2458#define PALMAS_GPADC_AUTO_CTRL 0x3
2459#define PALMAS_GPADC_STATUS 0x4
2460#define PALMAS_GPADC_RT_SELECT 0x5
2461#define PALMAS_GPADC_RT_CONV0_LSB 0x6
2462#define PALMAS_GPADC_RT_CONV0_MSB 0x7
2463#define PALMAS_GPADC_AUTO_SELECT 0x8
2464#define PALMAS_GPADC_AUTO_CONV0_LSB 0x9
2465#define PALMAS_GPADC_AUTO_CONV0_MSB 0xA
2466#define PALMAS_GPADC_AUTO_CONV1_LSB 0xB
2467#define PALMAS_GPADC_AUTO_CONV1_MSB 0xC
2468#define PALMAS_GPADC_SW_SELECT 0xD
2469#define PALMAS_GPADC_SW_CONV0_LSB 0xE
2470#define PALMAS_GPADC_SW_CONV0_MSB 0xF
2471#define PALMAS_GPADC_THRES_CONV0_LSB 0x10
2472#define PALMAS_GPADC_THRES_CONV0_MSB 0x11
2473#define PALMAS_GPADC_THRES_CONV1_LSB 0x12
2474#define PALMAS_GPADC_THRES_CONV1_MSB 0x13
2475#define PALMAS_GPADC_SMPS_ILMONITOR_EN 0x14
2476#define PALMAS_GPADC_SMPS_VSEL_MONITORING 0x15
2477
2478/* Bit definitions for GPADC_CTRL1 */
2479#define PALMAS_GPADC_CTRL1_RESERVED_MASK 0xc0
2480#define PALMAS_GPADC_CTRL1_RESERVED_SHIFT 6
2481#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_MASK 0x30
2482#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_SHIFT 4
2483#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_MASK 0x0c
2484#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_SHIFT 2
2485#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET 0x02
2486#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET_SHIFT 1
2487#define PALMAS_GPADC_CTRL1_GPADC_FORCE 0x01
2488#define PALMAS_GPADC_CTRL1_GPADC_FORCE_SHIFT 0
2489
2490/* Bit definitions for GPADC_CTRL2 */
2491#define PALMAS_GPADC_CTRL2_RESERVED_MASK 0x06
2492#define PALMAS_GPADC_CTRL2_RESERVED_SHIFT 1
2493
2494/* Bit definitions for GPADC_RT_CTRL */
2495#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY 0x02
2496#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY_SHIFT 1
2497#define PALMAS_GPADC_RT_CTRL_START_POLARITY 0x01
2498#define PALMAS_GPADC_RT_CTRL_START_POLARITY_SHIFT 0
2499
2500/* Bit definitions for GPADC_AUTO_CTRL */
2501#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1 0x80
2502#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1_SHIFT 7
2503#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0 0x40
2504#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0_SHIFT 6
2505#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN 0x20
2506#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN_SHIFT 5
2507#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN 0x10
2508#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN_SHIFT 4
2509#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_MASK 0x0f
2510#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_SHIFT 0
2511
2512/* Bit definitions for GPADC_STATUS */
2513#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE 0x10
2514#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE_SHIFT 4
2515
2516/* Bit definitions for GPADC_RT_SELECT */
2517#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN 0x80
2518#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN_SHIFT 7
2519#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_MASK 0x0f
2520#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_SHIFT 0
2521
2522/* Bit definitions for GPADC_RT_CONV0_LSB */
2523#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_MASK 0xff
2524#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_SHIFT 0
2525
2526/* Bit definitions for GPADC_RT_CONV0_MSB */
2527#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_MASK 0x0f
2528#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_SHIFT 0
2529
2530/* Bit definitions for GPADC_AUTO_SELECT */
2531#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_MASK 0xf0
2532#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_SHIFT 4
2533#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_MASK 0x0f
2534#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_SHIFT 0
2535
2536/* Bit definitions for GPADC_AUTO_CONV0_LSB */
2537#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_MASK 0xff
2538#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_SHIFT 0
2539
2540/* Bit definitions for GPADC_AUTO_CONV0_MSB */
2541#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_MASK 0x0f
2542#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_SHIFT 0
2543
2544/* Bit definitions for GPADC_AUTO_CONV1_LSB */
2545#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_MASK 0xff
2546#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_SHIFT 0
2547
2548/* Bit definitions for GPADC_AUTO_CONV1_MSB */
2549#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_MASK 0x0f
2550#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_SHIFT 0
2551
2552/* Bit definitions for GPADC_SW_SELECT */
2553#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN 0x80
2554#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN_SHIFT 7
2555#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0 0x10
2556#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0_SHIFT 4
2557#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_MASK 0x0f
2558#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_SHIFT 0
2559
2560/* Bit definitions for GPADC_SW_CONV0_LSB */
2561#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_MASK 0xff
2562#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_SHIFT 0
2563
2564/* Bit definitions for GPADC_SW_CONV0_MSB */
2565#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_MASK 0x0f
2566#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_SHIFT 0
2567
2568/* Bit definitions for GPADC_THRES_CONV0_LSB */
2569#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_MASK 0xff
2570#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_SHIFT 0
2571
2572/* Bit definitions for GPADC_THRES_CONV0_MSB */
2573#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL 0x80
2574#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL_SHIFT 7
2575#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_MASK 0x0f
2576#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_SHIFT 0
2577
2578/* Bit definitions for GPADC_THRES_CONV1_LSB */
2579#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_MASK 0xff
2580#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_SHIFT 0
2581
2582/* Bit definitions for GPADC_THRES_CONV1_MSB */
2583#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL 0x80
2584#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL_SHIFT 7
2585#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_MASK 0x0f
2586#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_SHIFT 0
2587
2588/* Bit definitions for GPADC_SMPS_ILMONITOR_EN */
2589#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN 0x20
2590#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN_SHIFT 5
2591#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT 0x10
2592#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT_SHIFT 4
2593#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_MASK 0x0f
2594#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_SHIFT 0
2595
2596/* Bit definitions for GPADC_SMPS_VSEL_MONITORING */
2597#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE 0x80
2598#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE_SHIFT 7
2599#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_MASK 0x7f
2600#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_SHIFT 0
2601
2602/* Registers for function GPADC */
2603#define PALMAS_GPADC_TRIM1 0x0
2604#define PALMAS_GPADC_TRIM2 0x1
2605#define PALMAS_GPADC_TRIM3 0x2
2606#define PALMAS_GPADC_TRIM4 0x3
2607#define PALMAS_GPADC_TRIM5 0x4
2608#define PALMAS_GPADC_TRIM6 0x5
2609#define PALMAS_GPADC_TRIM7 0x6
2610#define PALMAS_GPADC_TRIM8 0x7
2611#define PALMAS_GPADC_TRIM9 0x8
2612#define PALMAS_GPADC_TRIM10 0x9
2613#define PALMAS_GPADC_TRIM11 0xA
2614#define PALMAS_GPADC_TRIM12 0xB
2615#define PALMAS_GPADC_TRIM13 0xC
2616#define PALMAS_GPADC_TRIM14 0xD
2617#define PALMAS_GPADC_TRIM15 0xE
2618#define PALMAS_GPADC_TRIM16 0xF
2619
2620#endif /* __LINUX_MFD_PALMAS_H */
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index 0b64b19d81ab..c42fe92a727d 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -250,6 +250,26 @@ enum {
250 RC5T583_EXT_PWRREQ2_CONTROL = 0x2, 250 RC5T583_EXT_PWRREQ2_CONTROL = 0x2,
251}; 251};
252 252
253enum {
254 RC5T583_REGULATOR_DC0,
255 RC5T583_REGULATOR_DC1,
256 RC5T583_REGULATOR_DC2,
257 RC5T583_REGULATOR_DC3,
258 RC5T583_REGULATOR_LDO0,
259 RC5T583_REGULATOR_LDO1,
260 RC5T583_REGULATOR_LDO2,
261 RC5T583_REGULATOR_LDO3,
262 RC5T583_REGULATOR_LDO4,
263 RC5T583_REGULATOR_LDO5,
264 RC5T583_REGULATOR_LDO6,
265 RC5T583_REGULATOR_LDO7,
266 RC5T583_REGULATOR_LDO8,
267 RC5T583_REGULATOR_LDO9,
268
269 /* Should be last entry */
270 RC5T583_REGULATOR_MAX,
271};
272
253struct rc5t583 { 273struct rc5t583 {
254 struct device *dev; 274 struct device *dev;
255 struct regmap *regmap; 275 struct regmap *regmap;
@@ -273,11 +293,20 @@ struct rc5t583 {
273 * The board specific data is provided through this structure. 293 * The board specific data is provided through this structure.
274 * @irq_base: Irq base number on which this device registers their interrupts. 294 * @irq_base: Irq base number on which this device registers their interrupts.
275 * @enable_shutdown: Enable shutdown through the input pin "shutdown". 295 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
296 * @regulator_deepsleep_slot: The slot number on which device goes to sleep
297 * in device sleep mode.
298 * @regulator_ext_pwr_control: External power request regulator control. The
299 * regulator output enable/disable is controlled by the external
300 * power request input state.
301 * @reg_init_data: Regulator init data.
276 */ 302 */
277 303
278struct rc5t583_platform_data { 304struct rc5t583_platform_data {
279 int irq_base; 305 int irq_base;
280 bool enable_shutdown; 306 bool enable_shutdown;
307 int regulator_deepsleep_slot[RC5T583_REGULATOR_MAX];
308 unsigned long regulator_ext_pwr_control[RC5T583_REGULATOR_MAX];
309 struct regulator_init_data *reg_init_data[RC5T583_REGULATOR_MAX];
281}; 310};
282 311
283static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) 312static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
index a7480b57f92d..21603b42f22f 100644
--- a/include/linux/mfd/s5m87xx/s5m-core.h
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -335,6 +335,7 @@ extern int s5m_reg_update(struct s5m87xx_dev *s5m87xx, u8 reg, u8 val, u8 mask);
335 335
336struct s5m_platform_data { 336struct s5m_platform_data {
337 struct s5m_regulator_data *regulators; 337 struct s5m_regulator_data *regulators;
338 struct s5m_opmode_data *opmode;
338 int device_type; 339 int device_type;
339 int num_regulators; 340 int num_regulators;
340 341
diff --git a/include/linux/mfd/s5m87xx/s5m-pmic.h b/include/linux/mfd/s5m87xx/s5m-pmic.h
index a72a5d27e62e..7c719f20f58a 100644
--- a/include/linux/mfd/s5m87xx/s5m-pmic.h
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -58,6 +58,8 @@ enum s5m8767_regulators {
58 S5M8767_REG_MAX, 58 S5M8767_REG_MAX,
59}; 59};
60 60
61#define S5M8767_ENCTRL_SHIFT 6
62
61/* S5M8763 regulator ids */ 63/* S5M8763 regulator ids */
62enum s5m8763_regulators { 64enum s5m8763_regulators {
63 S5M8763_LDO1, 65 S5M8763_LDO1,
@@ -97,4 +99,31 @@ struct s5m_regulator_data {
97 struct regulator_init_data *initdata; 99 struct regulator_init_data *initdata;
98}; 100};
99 101
102/*
103 * s5m_opmode_data - regulator operation mode data
104 * @id: regulator id
105 * @mode: regulator operation mode
106 */
107struct s5m_opmode_data {
108 int id;
109 int mode;
110};
111
112/*
113 * s5m regulator operation mode
114 * S5M_OPMODE_OFF Regulator always OFF
115 * S5M_OPMODE_ON Regulator always ON
116 * S5M_OPMODE_LOWPOWER Regulator is on in low-power mode
117 * S5M_OPMODE_SUSPEND Regulator is changed by PWREN pin
118 * If PWREN is high, regulator is on
119 * If PWREN is low, regulator is off
120 */
121
122enum s5m_opmode {
123 S5M_OPMODE_OFF,
124 S5M_OPMODE_ON,
125 S5M_OPMODE_LOWPOWER,
126 S5M_OPMODE_SUSPEND,
127};
128
100#endif /* __LINUX_MFD_S5M_PMIC_H */ 129#endif /* __LINUX_MFD_S5M_PMIC_H */
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 38e31c55adbb..6bc31d854626 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -22,6 +22,19 @@
22#ifndef __LINUX_MFD_TPS65090_H 22#ifndef __LINUX_MFD_TPS65090_H
23#define __LINUX_MFD_TPS65090_H 23#define __LINUX_MFD_TPS65090_H
24 24
25#include <linux/irq.h>
26
27struct tps65090 {
28 struct mutex lock;
29 struct device *dev;
30 struct i2c_client *client;
31 struct regmap *rmap;
32 struct irq_chip irq_chip;
33 struct mutex irq_lock;
34 int irq_base;
35 unsigned int id;
36};
37
25struct tps65090_subdev_info { 38struct tps65090_subdev_info {
26 int id; 39 int id;
27 const char *name; 40 const char *name;
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index b19176eab44d..f350fd0ba1df 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -68,6 +68,7 @@ struct tps6586x_subdev_info {
68 int id; 68 int id;
69 const char *name; 69 const char *name;
70 void *platform_data; 70 void *platform_data;
71 struct device_node *of_node;
71}; 72};
72 73
73struct tps6586x_platform_data { 74struct tps6586x_platform_data {
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 9eff2a351ec5..6695c3ec4518 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -17,6 +17,7 @@
17 17
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/regmap.h>
20 21
21enum wm8994_type { 22enum wm8994_type {
22 WM8994 = 0, 23 WM8994 = 0,
@@ -26,7 +27,6 @@ enum wm8994_type {
26 27
27struct regulator_dev; 28struct regulator_dev;
28struct regulator_bulk_data; 29struct regulator_bulk_data;
29struct regmap;
30 30
31#define WM8994_NUM_GPIO_REGS 11 31#define WM8994_NUM_GPIO_REGS 11
32#define WM8994_NUM_LDO_REGS 2 32#define WM8994_NUM_LDO_REGS 2
@@ -94,17 +94,17 @@ static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
94 irq_handler_t handler, const char *name, 94 irq_handler_t handler, const char *name,
95 void *data) 95 void *data)
96{ 96{
97 if (!wm8994->irq_base) 97 if (!wm8994->irq_data)
98 return -EINVAL; 98 return -EINVAL;
99 return request_threaded_irq(wm8994->irq_base + irq, NULL, handler, 99 return request_threaded_irq(regmap_irq_get_virq(wm8994->irq_data, irq),
100 IRQF_TRIGGER_RISING, name, 100 NULL, handler, IRQF_TRIGGER_RISING, name,
101 data); 101 data);
102} 102}
103static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data) 103static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
104{ 104{
105 if (!wm8994->irq_base) 105 if (!wm8994->irq_data)
106 return; 106 return;
107 free_irq(wm8994->irq_base + irq, data); 107 free_irq(regmap_irq_get_virq(wm8994->irq_data, irq), data);
108} 108}
109 109
110int wm8994_irq_init(struct wm8994 *wm8994); 110int wm8994_irq_init(struct wm8994 *wm8994);
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 9958ff2cad3c..1f3860a8a109 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -150,6 +150,10 @@ enum {
150 /* statistics commands */ 150 /* statistics commands */
151 MLX4_CMD_QUERY_IF_STAT = 0X54, 151 MLX4_CMD_QUERY_IF_STAT = 0X54,
152 MLX4_CMD_SET_IF_STAT = 0X55, 152 MLX4_CMD_SET_IF_STAT = 0X55,
153
154 /* set port opcode modifiers */
155 MLX4_SET_PORT_PRIO2TC = 0x8,
156 MLX4_SET_PORT_SCHEDULER = 0x9,
153}; 157};
154 158
155enum { 159enum {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 7f5e8d564e8e..6e27fa99e8b9 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -636,6 +636,9 @@ int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
636 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 636 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
637int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, 637int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
638 u8 promisc); 638 u8 promisc);
639int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc);
640int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw,
641 u8 *pg, u16 *ratelimit);
639int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 642int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
640int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 643int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
641void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); 644void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index bb57d5c58df2..338388ba260a 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -139,7 +139,8 @@ struct mlx4_qp_path {
139 u8 rgid[16]; 139 u8 rgid[16];
140 u8 sched_queue; 140 u8 sched_queue;
141 u8 vlan_index; 141 u8 vlan_index;
142 u8 reserved3[2]; 142 u8 feup;
143 u8 reserved3;
143 u8 reserved4[2]; 144 u8 reserved4[2];
144 u8 dmac[6]; 145 u8 dmac[6];
145}; 146};
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 74aa71bea1e4..7d5c37f24c63 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -896,10 +896,8 @@ int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
896 unsigned long size); 896 unsigned long size);
897void zap_page_range(struct vm_area_struct *vma, unsigned long address, 897void zap_page_range(struct vm_area_struct *vma, unsigned long address,
898 unsigned long size, struct zap_details *); 898 unsigned long size, struct zap_details *);
899void unmap_vmas(struct mmu_gather *tlb, 899void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
900 struct vm_area_struct *start_vma, unsigned long start_addr, 900 unsigned long start, unsigned long end);
901 unsigned long end_addr, unsigned long *nr_accounted,
902 struct zap_details *);
903 901
904/** 902/**
905 * mm_walk - callbacks for walk_page_range 903 * mm_walk - callbacks for walk_page_range
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index b188f68a08c9..275e5d65dcb2 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -33,6 +33,9 @@ enum {
33#define NTF_PROXY 0x08 /* == ATF_PUBL */ 33#define NTF_PROXY 0x08 /* == ATF_PUBL */
34#define NTF_ROUTER 0x80 34#define NTF_ROUTER 0x80
35 35
36#define NTF_SELF 0x02
37#define NTF_MASTER 0x04
38
36/* 39/*
37 * Neighbor Cache Entry States. 40 * Neighbor Cache Entry States.
38 */ 41 */
diff --git a/include/linux/net.h b/include/linux/net.h
index be60c7f5e145..2d7510f38934 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -250,6 +250,29 @@ extern struct socket *sockfd_lookup(int fd, int *err);
250#define sockfd_put(sock) fput(sock->file) 250#define sockfd_put(sock) fput(sock->file)
251extern int net_ratelimit(void); 251extern int net_ratelimit(void);
252 252
253#define net_ratelimited_function(function, ...) \
254do { \
255 if (net_ratelimit()) \
256 function(__VA_ARGS__); \
257} while (0)
258
259#define net_emerg_ratelimited(fmt, ...) \
260 net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
261#define net_alert_ratelimited(fmt, ...) \
262 net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
263#define net_crit_ratelimited(fmt, ...) \
264 net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
265#define net_err_ratelimited(fmt, ...) \
266 net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
267#define net_notice_ratelimited(fmt, ...) \
268 net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
269#define net_warn_ratelimited(fmt, ...) \
270 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
271#define net_info_ratelimited(fmt, ...) \
272 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
273#define net_dbg_ratelimited(fmt, ...) \
274 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
275
253#define net_random() random32() 276#define net_random() random32()
254#define net_srandom(seed) srandom32((__force u32)seed) 277#define net_srandom(seed) srandom32((__force u32)seed)
255 278
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5cbaa20f1659..e7fd468f7126 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -54,6 +54,7 @@
54#include <net/netprio_cgroup.h> 54#include <net/netprio_cgroup.h>
55 55
56#include <linux/netdev_features.h> 56#include <linux/netdev_features.h>
57#include <linux/neighbour.h>
57 58
58struct netpoll_info; 59struct netpoll_info;
59struct device; 60struct device;
@@ -288,7 +289,7 @@ struct hh_cache {
288struct header_ops { 289struct header_ops {
289 int (*create) (struct sk_buff *skb, struct net_device *dev, 290 int (*create) (struct sk_buff *skb, struct net_device *dev,
290 unsigned short type, const void *daddr, 291 unsigned short type, const void *daddr,
291 const void *saddr, unsigned len); 292 const void *saddr, unsigned int len);
292 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 293 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
293 int (*rebuild)(struct sk_buff *skb); 294 int (*rebuild)(struct sk_buff *skb);
294 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 295 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
@@ -905,6 +906,16 @@ struct netdev_fcoe_hbainfo {
905 * feature set might be less than what was returned by ndo_fix_features()). 906 * feature set might be less than what was returned by ndo_fix_features()).
906 * Must return >0 or -errno if it changed dev->features itself. 907 * Must return >0 or -errno if it changed dev->features itself.
907 * 908 *
909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
910 * unsigned char *addr, u16 flags)
911 * Adds an FDB entry to dev for addr.
912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
913 * unsigned char *addr)
914 * Deletes the FDB entry from dev coresponding to addr.
915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
916 * struct net_device *dev, int idx)
917 * Used to add FDB entries to dump requests. Implementers should add
918 * entries to skb and update idx with the number of entries.
908 */ 919 */
909struct net_device_ops { 920struct net_device_ops {
910 int (*ndo_init)(struct net_device *dev); 921 int (*ndo_init)(struct net_device *dev);
@@ -1002,6 +1013,18 @@ struct net_device_ops {
1002 netdev_features_t features); 1013 netdev_features_t features);
1003 int (*ndo_neigh_construct)(struct neighbour *n); 1014 int (*ndo_neigh_construct)(struct neighbour *n);
1004 void (*ndo_neigh_destroy)(struct neighbour *n); 1015 void (*ndo_neigh_destroy)(struct neighbour *n);
1016
1017 int (*ndo_fdb_add)(struct ndmsg *ndm,
1018 struct net_device *dev,
1019 unsigned char *addr,
1020 u16 flags);
1021 int (*ndo_fdb_del)(struct ndmsg *ndm,
1022 struct net_device *dev,
1023 unsigned char *addr);
1024 int (*ndo_fdb_dump)(struct sk_buff *skb,
1025 struct netlink_callback *cb,
1026 struct net_device *dev,
1027 int idx);
1005}; 1028};
1006 1029
1007/* 1030/*
@@ -1132,7 +1155,6 @@ struct net_device {
1132 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1155 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
1133 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ 1156 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */
1134 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ 1157 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */
1135 void *ec_ptr; /* Econet specific data */
1136 void *ax25_ptr; /* AX.25 specific data */ 1158 void *ax25_ptr; /* AX.25 specific data */
1137 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1159 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
1138 assign before registering */ 1160 assign before registering */
@@ -1403,15 +1425,6 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
1403 return 0; 1425 return 0;
1404} 1426}
1405 1427
1406#ifndef CONFIG_NET_NS
1407static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
1408{
1409 skb->dev = dev;
1410}
1411#else /* CONFIG_NET_NS */
1412void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
1413#endif
1414
1415static inline bool netdev_uses_trailer_tags(struct net_device *dev) 1428static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1416{ 1429{
1417#ifdef CONFIG_NET_DSA_TAG_TRAILER 1430#ifdef CONFIG_NET_DSA_TAG_TRAILER
@@ -1486,6 +1499,8 @@ struct napi_gro_cb {
1486 1499
1487 /* Free the skb? */ 1500 /* Free the skb? */
1488 int free; 1501 int free;
1502#define NAPI_GRO_FREE 1
1503#define NAPI_GRO_FREE_STOLEN_HEAD 2
1489}; 1504};
1490 1505
1491#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1506#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1689,7 +1704,7 @@ static inline void *skb_gro_network_header(struct sk_buff *skb)
1689static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1704static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1690 unsigned short type, 1705 unsigned short type,
1691 const void *daddr, const void *saddr, 1706 const void *daddr, const void *saddr,
1692 unsigned len) 1707 unsigned int len)
1693{ 1708{
1694 if (!dev->header_ops || !dev->header_ops->create) 1709 if (!dev->header_ops || !dev->header_ops->create)
1695 return 0; 1710 return 0;
@@ -1740,7 +1755,7 @@ struct softnet_data {
1740 unsigned int input_queue_head; 1755 unsigned int input_queue_head;
1741 unsigned int input_queue_tail; 1756 unsigned int input_queue_tail;
1742#endif 1757#endif
1743 unsigned dropped; 1758 unsigned int dropped;
1744 struct sk_buff_head input_pkt_queue; 1759 struct sk_buff_head input_pkt_queue;
1745 struct napi_struct backlog; 1760 struct napi_struct backlog;
1746}; 1761};
@@ -1925,7 +1940,7 @@ static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
1925} 1940}
1926 1941
1927static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, 1942static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1928 unsigned pkts, unsigned bytes) 1943 unsigned int pkts, unsigned int bytes)
1929{ 1944{
1930#ifdef CONFIG_BQL 1945#ifdef CONFIG_BQL
1931 if (unlikely(!bytes)) 1946 if (unlikely(!bytes))
@@ -1949,7 +1964,7 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1949} 1964}
1950 1965
1951static inline void netdev_completed_queue(struct net_device *dev, 1966static inline void netdev_completed_queue(struct net_device *dev,
1952 unsigned pkts, unsigned bytes) 1967 unsigned int pkts, unsigned int bytes)
1953{ 1968{
1954 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes); 1969 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
1955} 1970}
@@ -2127,7 +2142,6 @@ extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2127extern gro_result_t napi_frags_finish(struct napi_struct *napi, 2142extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2128 struct sk_buff *skb, 2143 struct sk_buff *skb,
2129 gro_result_t ret); 2144 gro_result_t ret);
2130extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
2131extern gro_result_t napi_gro_frags(struct napi_struct *napi); 2145extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2132 2146
2133static inline void napi_free_frags(struct napi_struct *napi) 2147static inline void napi_free_frags(struct napi_struct *napi)
@@ -2144,9 +2158,9 @@ extern void netdev_rx_handler_unregister(struct net_device *dev);
2144extern bool dev_valid_name(const char *name); 2158extern bool dev_valid_name(const char *name);
2145extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2159extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2146extern int dev_ethtool(struct net *net, struct ifreq *); 2160extern int dev_ethtool(struct net *net, struct ifreq *);
2147extern unsigned dev_get_flags(const struct net_device *); 2161extern unsigned int dev_get_flags(const struct net_device *);
2148extern int __dev_change_flags(struct net_device *, unsigned int flags); 2162extern int __dev_change_flags(struct net_device *, unsigned int flags);
2149extern int dev_change_flags(struct net_device *, unsigned); 2163extern int dev_change_flags(struct net_device *, unsigned int);
2150extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); 2164extern void __dev_notify_flags(struct net_device *, unsigned int old_flags);
2151extern int dev_change_name(struct net_device *, const char *); 2165extern int dev_change_name(struct net_device *, const char *);
2152extern int dev_set_alias(struct net_device *, const char *, size_t); 2166extern int dev_set_alias(struct net_device *, const char *, size_t);
@@ -2546,6 +2560,7 @@ extern int dev_addr_init(struct net_device *dev);
2546 2560
2547/* Functions used for unicast addresses handling */ 2561/* Functions used for unicast addresses handling */
2548extern int dev_uc_add(struct net_device *dev, unsigned char *addr); 2562extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
2563extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
2549extern int dev_uc_del(struct net_device *dev, unsigned char *addr); 2564extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
2550extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2565extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2551extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2566extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
@@ -2555,6 +2570,7 @@ extern void dev_uc_init(struct net_device *dev);
2555/* Functions used for multicast addresses handling */ 2570/* Functions used for multicast addresses handling */
2556extern int dev_mc_add(struct net_device *dev, unsigned char *addr); 2571extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
2557extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); 2572extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
2573extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr);
2558extern int dev_mc_del(struct net_device *dev, unsigned char *addr); 2574extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
2559extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); 2575extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
2560extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2576extern int dev_mc_sync(struct net_device *to, struct net_device *from);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 29734be334c1..ff9c84c29b28 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -154,12 +154,6 @@ void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
154int nf_register_sockopt(struct nf_sockopt_ops *reg); 154int nf_register_sockopt(struct nf_sockopt_ops *reg);
155void nf_unregister_sockopt(struct nf_sockopt_ops *reg); 155void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
156 156
157#ifdef CONFIG_SYSCTL
158/* Sysctl registration */
159extern struct ctl_path nf_net_netfilter_sysctl_path[];
160extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
161#endif /* CONFIG_SYSCTL */
162
163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 157extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
164 158
165#if defined(CONFIG_JUMP_LABEL) 159#if defined(CONFIG_JUMP_LABEL)
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 2f8e18a23227..2edc64cab739 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -411,26 +411,32 @@ ip_set_get_h16(const struct nlattr *attr)
411#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED) 411#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED)
412#define ipset_nest_end(skb, start) nla_nest_end(skb, start) 412#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
413 413
414#define NLA_PUT_IPADDR4(skb, type, ipaddr) \ 414static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
415do { \ 415{
416 struct nlattr *__nested = ipset_nest_start(skb, type); \ 416 struct nlattr *__nested = ipset_nest_start(skb, type);
417 \ 417 int ret;
418 if (!__nested) \ 418
419 goto nla_put_failure; \ 419 if (!__nested)
420 NLA_PUT_NET32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); \ 420 return -EMSGSIZE;
421 ipset_nest_end(skb, __nested); \ 421 ret = nla_put_net32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr);
422} while (0) 422 if (!ret)
423 423 ipset_nest_end(skb, __nested);
424#define NLA_PUT_IPADDR6(skb, type, ipaddrptr) \ 424 return ret;
425do { \ 425}
426 struct nlattr *__nested = ipset_nest_start(skb, type); \ 426
427 \ 427static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, const struct in6_addr *ipaddrptr)
428 if (!__nested) \ 428{
429 goto nla_put_failure; \ 429 struct nlattr *__nested = ipset_nest_start(skb, type);
430 NLA_PUT(skb, IPSET_ATTR_IPADDR_IPV6, \ 430 int ret;
431 sizeof(struct in6_addr), ipaddrptr); \ 431
432 ipset_nest_end(skb, __nested); \ 432 if (!__nested)
433} while (0) 433 return -EMSGSIZE;
434 ret = nla_put(skb, IPSET_ATTR_IPADDR_IPV6,
435 sizeof(struct in6_addr), ipaddrptr);
436 if (!ret)
437 ipset_nest_end(skb, __nested);
438 return ret;
439}
434 440
435/* Get address from skbuff */ 441/* Get address from skbuff */
436static inline __be32 442static inline __be32
@@ -472,8 +478,8 @@ union ip_set_name_index {
472 478
473#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ 479#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */
474struct ip_set_req_get_set { 480struct ip_set_req_get_set {
475 unsigned op; 481 unsigned int op;
476 unsigned version; 482 unsigned int version;
477 union ip_set_name_index set; 483 union ip_set_name_index set;
478}; 484};
479 485
@@ -482,8 +488,8 @@ struct ip_set_req_get_set {
482 488
483#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ 489#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
484struct ip_set_req_version { 490struct ip_set_req_version {
485 unsigned op; 491 unsigned int op;
486 unsigned version; 492 unsigned int version;
487}; 493};
488 494
489#endif /*_IP_SET_H */ 495#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index 05a5d72680be..b114d35aea5e 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -99,6 +99,22 @@ struct ip_set_hash {
99#endif 99#endif
100}; 100};
101 101
102static size_t
103htable_size(u8 hbits)
104{
105 size_t hsize;
106
107 /* We must fit both into u32 in jhash and size_t */
108 if (hbits > 31)
109 return 0;
110 hsize = jhash_size(hbits);
111 if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket)
112 < hsize)
113 return 0;
114
115 return hsize * sizeof(struct hbucket) + sizeof(struct htable);
116}
117
102/* Compute htable_bits from the user input parameter hashsize */ 118/* Compute htable_bits from the user input parameter hashsize */
103static u8 119static u8
104htable_bits(u32 hashsize) 120htable_bits(u32 hashsize)
@@ -594,17 +610,20 @@ type_pf_head(struct ip_set *set, struct sk_buff *skb)
594 nested = ipset_nest_start(skb, IPSET_ATTR_DATA); 610 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
595 if (!nested) 611 if (!nested)
596 goto nla_put_failure; 612 goto nla_put_failure;
597 NLA_PUT_NET32(skb, IPSET_ATTR_HASHSIZE, 613 if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE,
598 htonl(jhash_size(h->table->htable_bits))); 614 htonl(jhash_size(h->table->htable_bits))) ||
599 NLA_PUT_NET32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem)); 615 nla_put_net32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem)))
616 goto nla_put_failure;
600#ifdef IP_SET_HASH_WITH_NETMASK 617#ifdef IP_SET_HASH_WITH_NETMASK
601 if (h->netmask != HOST_MASK) 618 if (h->netmask != HOST_MASK &&
602 NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, h->netmask); 619 nla_put_u8(skb, IPSET_ATTR_NETMASK, h->netmask))
620 goto nla_put_failure;
603#endif 621#endif
604 NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)); 622 if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) ||
605 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)); 623 nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
606 if (with_timeout(h->timeout)) 624 (with_timeout(h->timeout) &&
607 NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout)); 625 nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout))))
626 goto nla_put_failure;
608 ipset_nest_end(skb, nested); 627 ipset_nest_end(skb, nested);
609 628
610 return 0; 629 return 0;
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 47923205a4ad..41d9cfa08167 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -30,6 +30,10 @@ ip_set_timeout_uget(struct nlattr *tb)
30{ 30{
31 unsigned int timeout = ip_set_get_h32(tb); 31 unsigned int timeout = ip_set_get_h32(tb);
32 32
33 /* Normalize to fit into jiffies */
34 if (timeout > UINT_MAX/MSEC_PER_SEC)
35 timeout = UINT_MAX/MSEC_PER_SEC;
36
33 /* Userspace supplied TIMEOUT parameter: adjust crazy size */ 37 /* Userspace supplied TIMEOUT parameter: adjust crazy size */
34 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; 38 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
35} 39}
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 0d3dd66322ec..d146872a0b91 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -83,6 +83,10 @@ enum ip_conntrack_status {
83 /* Conntrack is a fake untracked entry */ 83 /* Conntrack is a fake untracked entry */
84 IPS_UNTRACKED_BIT = 12, 84 IPS_UNTRACKED_BIT = 12,
85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), 85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
86
87 /* Conntrack got a helper explicitly attached via CT target. */
88 IPS_HELPER_BIT = 13,
89 IPS_HELPER = (1 << IPS_HELPER_BIT),
86}; 90};
87 91
88/* Connection tracking event types */ 92/* Connection tracking event types */
diff --git a/include/linux/netfilter/nf_conntrack_h323_types.h b/include/linux/netfilter/nf_conntrack_h323_types.h
index f35b6b4801e7..b0821f45fbe4 100644
--- a/include/linux/netfilter/nf_conntrack_h323_types.h
+++ b/include/linux/netfilter/nf_conntrack_h323_types.h
@@ -7,12 +7,12 @@
7 7
8typedef struct TransportAddress_ipAddress { /* SEQUENCE */ 8typedef struct TransportAddress_ipAddress { /* SEQUENCE */
9 int options; /* No use */ 9 int options; /* No use */
10 unsigned ip; 10 unsigned int ip;
11} TransportAddress_ipAddress; 11} TransportAddress_ipAddress;
12 12
13typedef struct TransportAddress_ip6Address { /* SEQUENCE */ 13typedef struct TransportAddress_ip6Address { /* SEQUENCE */
14 int options; /* No use */ 14 int options; /* No use */
15 unsigned ip; 15 unsigned int ip;
16} TransportAddress_ip6Address; 16} TransportAddress_ip6Address;
17 17
18typedef struct TransportAddress { /* CHOICE */ 18typedef struct TransportAddress { /* CHOICE */
@@ -96,12 +96,12 @@ typedef struct DataType { /* CHOICE */
96 96
97typedef struct UnicastAddress_iPAddress { /* SEQUENCE */ 97typedef struct UnicastAddress_iPAddress { /* SEQUENCE */
98 int options; /* No use */ 98 int options; /* No use */
99 unsigned network; 99 unsigned int network;
100} UnicastAddress_iPAddress; 100} UnicastAddress_iPAddress;
101 101
102typedef struct UnicastAddress_iP6Address { /* SEQUENCE */ 102typedef struct UnicastAddress_iP6Address { /* SEQUENCE */
103 int options; /* No use */ 103 int options; /* No use */
104 unsigned network; 104 unsigned int network;
105} UnicastAddress_iP6Address; 105} UnicastAddress_iP6Address;
106 106
107typedef struct UnicastAddress { /* CHOICE */ 107typedef struct UnicastAddress { /* CHOICE */
@@ -698,7 +698,7 @@ typedef struct RegistrationRequest { /* SEQUENCE */
698 } options; 698 } options;
699 RegistrationRequest_callSignalAddress callSignalAddress; 699 RegistrationRequest_callSignalAddress callSignalAddress;
700 RegistrationRequest_rasAddress rasAddress; 700 RegistrationRequest_rasAddress rasAddress;
701 unsigned timeToLive; 701 unsigned int timeToLive;
702} RegistrationRequest; 702} RegistrationRequest;
703 703
704typedef struct RegistrationConfirm_callSignalAddress { /* SEQUENCE OF */ 704typedef struct RegistrationConfirm_callSignalAddress { /* SEQUENCE OF */
@@ -730,7 +730,7 @@ typedef struct RegistrationConfirm { /* SEQUENCE */
730 eRegistrationConfirm_genericData = (1 << 12), 730 eRegistrationConfirm_genericData = (1 << 12),
731 } options; 731 } options;
732 RegistrationConfirm_callSignalAddress callSignalAddress; 732 RegistrationConfirm_callSignalAddress callSignalAddress;
733 unsigned timeToLive; 733 unsigned int timeToLive;
734} RegistrationConfirm; 734} RegistrationConfirm;
735 735
736typedef struct UnregistrationRequest_callSignalAddress { /* SEQUENCE OF */ 736typedef struct UnregistrationRequest_callSignalAddress { /* SEQUENCE OF */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 6fd1f0d07e64..a1048c1587d1 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -80,7 +80,7 @@ extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
80extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); 80extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
81 81
82extern int nfnetlink_has_listeners(struct net *net, unsigned int group); 82extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
83extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, 83extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group,
84 int echo, gfp_t flags); 84 int echo, gfp_t flags);
85extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); 85extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
86extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); 86extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
diff --git a/include/linux/netfilter/xt_HMARK.h b/include/linux/netfilter/xt_HMARK.h
new file mode 100644
index 000000000000..abb1650940d2
--- /dev/null
+++ b/include/linux/netfilter/xt_HMARK.h
@@ -0,0 +1,45 @@
1#ifndef XT_HMARK_H_
2#define XT_HMARK_H_
3
4#include <linux/types.h>
5
6enum {
7 XT_HMARK_SADDR_MASK,
8 XT_HMARK_DADDR_MASK,
9 XT_HMARK_SPI,
10 XT_HMARK_SPI_MASK,
11 XT_HMARK_SPORT,
12 XT_HMARK_DPORT,
13 XT_HMARK_SPORT_MASK,
14 XT_HMARK_DPORT_MASK,
15 XT_HMARK_PROTO_MASK,
16 XT_HMARK_RND,
17 XT_HMARK_MODULUS,
18 XT_HMARK_OFFSET,
19 XT_HMARK_CT,
20 XT_HMARK_METHOD_L3,
21 XT_HMARK_METHOD_L3_4,
22};
23#define XT_HMARK_FLAG(flag) (1 << flag)
24
25union hmark_ports {
26 struct {
27 __u16 src;
28 __u16 dst;
29 } p16;
30 __u32 v32;
31};
32
33struct xt_hmark_info {
34 union nf_inet_addr src_mask;
35 union nf_inet_addr dst_mask;
36 union hmark_ports port_mask;
37 union hmark_ports port_set;
38 __u32 flags;
39 __u16 proto_mask;
40 __u32 hashrnd;
41 __u32 hmodulus;
42 __u32 hoffset; /* Mark offset to start from */
43};
44
45#endif /* XT_HMARK_H_ */
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index b1925b5925e9..c42e52f39f8f 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -6,7 +6,11 @@
6/* timings are in milliseconds. */ 6/* timings are in milliseconds. */
7#define XT_HASHLIMIT_SCALE 10000 7#define XT_HASHLIMIT_SCALE 10000
8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
9 seconds, or one every 59 hours. */ 9 * seconds, or one packet every 59 hours.
10 */
11
12/* packet length accounting is done in 16-byte steps */
13#define XT_HASHLIMIT_BYTE_SHIFT 4
10 14
11/* details of this structure hidden by the implementation */ 15/* details of this structure hidden by the implementation */
12struct xt_hashlimit_htable; 16struct xt_hashlimit_htable;
@@ -17,7 +21,13 @@ enum {
17 XT_HASHLIMIT_HASH_SIP = 1 << 2, 21 XT_HASHLIMIT_HASH_SIP = 1 << 2,
18 XT_HASHLIMIT_HASH_SPT = 1 << 3, 22 XT_HASHLIMIT_HASH_SPT = 1 << 3,
19 XT_HASHLIMIT_INVERT = 1 << 4, 23 XT_HASHLIMIT_INVERT = 1 << 4,
24 XT_HASHLIMIT_BYTES = 1 << 5,
20}; 25};
26#ifdef __KERNEL__
27#define XT_HASHLIMIT_ALL (XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT | \
28 XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT | \
29 XT_HASHLIMIT_INVERT | XT_HASHLIMIT_BYTES)
30#endif
21 31
22struct hashlimit_cfg { 32struct hashlimit_cfg {
23 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 33 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 31f8bec95650..c61b8fb1a9ef 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,4 +1,3 @@
1header-y += ip_queue.h
2header-y += ip_tables.h 1header-y += ip_tables.h
3header-y += ipt_CLUSTERIP.h 2header-y += ipt_CLUSTERIP.h
4header-y += ipt_ECN.h 3header-y += ipt_ECN.h
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h
deleted file mode 100644
index a03507f465f8..000000000000
--- a/include/linux/netfilter_ipv4/ip_queue.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * This is a module which is used for queueing IPv4 packets and
3 * communicating with userspace via netlink.
4 *
5 * (C) 2000 James Morris, this code is GPL.
6 */
7#ifndef _IP_QUEUE_H
8#define _IP_QUEUE_H
9
10#ifdef __KERNEL__
11#ifdef DEBUG_IPQ
12#define QDEBUG(x...) printk(KERN_DEBUG ## x)
13#else
14#define QDEBUG(x...)
15#endif /* DEBUG_IPQ */
16#else
17#include <net/if.h>
18#endif /* ! __KERNEL__ */
19
20/* Messages sent from kernel */
21typedef struct ipq_packet_msg {
22 unsigned long packet_id; /* ID of queued packet */
23 unsigned long mark; /* Netfilter mark value */
24 long timestamp_sec; /* Packet arrival time (seconds) */
25 long timestamp_usec; /* Packet arrvial time (+useconds) */
26 unsigned int hook; /* Netfilter hook we rode in on */
27 char indev_name[IFNAMSIZ]; /* Name of incoming interface */
28 char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */
29 __be16 hw_protocol; /* Hardware protocol (network order) */
30 unsigned short hw_type; /* Hardware type */
31 unsigned char hw_addrlen; /* Hardware address length */
32 unsigned char hw_addr[8]; /* Hardware address */
33 size_t data_len; /* Length of packet data */
34 unsigned char payload[0]; /* Optional packet data */
35} ipq_packet_msg_t;
36
37/* Messages sent from userspace */
38typedef struct ipq_mode_msg {
39 unsigned char value; /* Requested mode */
40 size_t range; /* Optional range of packet requested */
41} ipq_mode_msg_t;
42
43typedef struct ipq_verdict_msg {
44 unsigned int value; /* Verdict to hand to netfilter */
45 unsigned long id; /* Packet ID for this verdict */
46 size_t data_len; /* Length of replacement data */
47 unsigned char payload[0]; /* Optional replacement packet */
48} ipq_verdict_msg_t;
49
50typedef struct ipq_peer_msg {
51 union {
52 ipq_verdict_msg_t verdict;
53 ipq_mode_msg_t mode;
54 } msg;
55} ipq_peer_msg_t;
56
57/* Packet delivery modes */
58enum {
59 IPQ_COPY_NONE, /* Initial mode, packets are dropped */
60 IPQ_COPY_META, /* Copy metadata */
61 IPQ_COPY_PACKET /* Copy metadata + packet (range) */
62};
63#define IPQ_COPY_MAX IPQ_COPY_PACKET
64
65/* Types of messages */
66#define IPQM_BASE 0x10 /* standard netlink messages below this */
67#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */
68#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */
69#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */
70#define IPQM_MAX (IPQM_BASE + 4)
71
72#endif /*_IP_QUEUE_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 1bc898b14a80..08c2cbbaa32b 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -298,9 +298,14 @@ ip6t_ext_hdr(u8 nexthdr)
298 (nexthdr == IPPROTO_DSTOPTS); 298 (nexthdr == IPPROTO_DSTOPTS);
299} 299}
300 300
301enum {
302 IP6T_FH_F_FRAG = (1 << 0),
303 IP6T_FH_F_AUTH = (1 << 1),
304};
305
301/* find specified header and get offset to it */ 306/* find specified header and get offset to it */
302extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 307extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
303 int target, unsigned short *fragoff); 308 int target, unsigned short *fragoff, int *fragflg);
304 309
305#ifdef CONFIG_COMPAT 310#ifdef CONFIG_COMPAT
306#include <net/compat.h> 311#include <net/compat.h>
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index a2092f582a78..0f628ffa420c 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -7,7 +7,7 @@
7#define NETLINK_ROUTE 0 /* Routing/device hook */ 7#define NETLINK_ROUTE 0 /* Routing/device hook */
8#define NETLINK_UNUSED 1 /* Unused number */ 8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */
11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */ 11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 39c1fcf089c0..0ae9b5857c83 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -70,6 +70,7 @@ enum nfc_commands {
70 NFC_EVENT_TARGETS_FOUND, 70 NFC_EVENT_TARGETS_FOUND,
71 NFC_EVENT_DEVICE_ADDED, 71 NFC_EVENT_DEVICE_ADDED,
72 NFC_EVENT_DEVICE_REMOVED, 72 NFC_EVENT_DEVICE_REMOVED,
73 NFC_EVENT_TARGET_LOST,
73/* private: internal use only */ 74/* private: internal use only */
74 __NFC_CMD_AFTER_LAST 75 __NFC_CMD_AFTER_LAST
75}; 76};
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e474f6e780cc..2540e86d99ab 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -548,6 +548,11 @@
548 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether 548 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
549 * No Acknowledgement Policy should be applied. 549 * No Acknowledgement Policy should be applied.
550 * 550 *
551 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
552 * independently of the userspace SME, send this event indicating
553 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with
554 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
555 *
551 * @NL80211_CMD_MAX: highest used command number 556 * @NL80211_CMD_MAX: highest used command number
552 * @__NL80211_CMD_AFTER_LAST: internal use 557 * @__NL80211_CMD_AFTER_LAST: internal use
553 */ 558 */
@@ -689,6 +694,8 @@ enum nl80211_commands {
689 694
690 NL80211_CMD_SET_NOACK_MAP, 695 NL80211_CMD_SET_NOACK_MAP,
691 696
697 NL80211_CMD_CH_SWITCH_NOTIFY,
698
692 /* add new commands above here */ 699 /* add new commands above here */
693 700
694 /* used to define NL80211_CMD_MAX below */ 701 /* used to define NL80211_CMD_MAX below */
@@ -1685,6 +1692,7 @@ enum nl80211_sta_bss_param {
1685 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected 1692 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
1686 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 1693 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
1687 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32) 1694 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
1695 * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64)
1688 * @__NL80211_STA_INFO_AFTER_LAST: internal 1696 * @__NL80211_STA_INFO_AFTER_LAST: internal
1689 * @NL80211_STA_INFO_MAX: highest possible station info attribute 1697 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1690 */ 1698 */
@@ -1708,6 +1716,7 @@ enum nl80211_sta_info {
1708 NL80211_STA_INFO_CONNECTED_TIME, 1716 NL80211_STA_INFO_CONNECTED_TIME,
1709 NL80211_STA_INFO_STA_FLAGS, 1717 NL80211_STA_INFO_STA_FLAGS,
1710 NL80211_STA_INFO_BEACON_LOSS, 1718 NL80211_STA_INFO_BEACON_LOSS,
1719 NL80211_STA_INFO_T_OFFSET,
1711 1720
1712 /* keep last */ 1721 /* keep last */
1713 __NL80211_STA_INFO_AFTER_LAST, 1722 __NL80211_STA_INFO_AFTER_LAST,
@@ -2142,6 +2151,11 @@ enum nl80211_mntr_flags {
2142 * 2151 *
2143 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 2152 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
2144 * 2153 *
2154 * @NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR: maximum number of neighbors
2155 * to synchronize to for 11s default synchronization method (see 11C.12.2.2)
2156 *
2157 * @NL80211_MESHCONF_HT_OPMODE: set mesh HT protection mode.
2158 *
2145 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2159 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
2146 */ 2160 */
2147enum nl80211_meshconf_params { 2161enum nl80211_meshconf_params {
@@ -2166,6 +2180,8 @@ enum nl80211_meshconf_params {
2166 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, 2180 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
2167 NL80211_MESHCONF_FORWARDING, 2181 NL80211_MESHCONF_FORWARDING,
2168 NL80211_MESHCONF_RSSI_THRESHOLD, 2182 NL80211_MESHCONF_RSSI_THRESHOLD,
2183 NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR,
2184 NL80211_MESHCONF_HT_OPMODE,
2169 2185
2170 /* keep last */ 2186 /* keep last */
2171 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2187 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2205,6 +2221,11 @@ enum nl80211_meshconf_params {
2205 * complete (unsecured) mesh peering without the need of a userspace daemon. 2221 * complete (unsecured) mesh peering without the need of a userspace daemon.
2206 * 2222 *
2207 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number 2223 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
2224 *
2225 * @NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC: Enable this option to use a
2226 * vendor specific synchronization method or disable it to use the default
2227 * neighbor offset synchronization
2228 *
2208 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use 2229 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
2209 */ 2230 */
2210enum nl80211_mesh_setup_params { 2231enum nl80211_mesh_setup_params {
@@ -2214,6 +2235,7 @@ enum nl80211_mesh_setup_params {
2214 NL80211_MESH_SETUP_IE, 2235 NL80211_MESH_SETUP_IE,
2215 NL80211_MESH_SETUP_USERSPACE_AUTH, 2236 NL80211_MESH_SETUP_USERSPACE_AUTH,
2216 NL80211_MESH_SETUP_USERSPACE_AMPE, 2237 NL80211_MESH_SETUP_USERSPACE_AMPE,
2238 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
2217 2239
2218 /* keep last */ 2240 /* keep last */
2219 __NL80211_MESH_SETUP_ATTR_AFTER_LAST, 2241 __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
@@ -2223,7 +2245,7 @@ enum nl80211_mesh_setup_params {
2223/** 2245/**
2224 * enum nl80211_txq_attr - TX queue parameter attributes 2246 * enum nl80211_txq_attr - TX queue parameter attributes
2225 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved 2247 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
2226 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*) 2248 * @NL80211_TXQ_ATTR_AC: AC identifier (NL80211_AC_*)
2227 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning 2249 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
2228 * disabled 2250 * disabled
2229 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form 2251 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
@@ -2236,7 +2258,7 @@ enum nl80211_mesh_setup_params {
2236 */ 2258 */
2237enum nl80211_txq_attr { 2259enum nl80211_txq_attr {
2238 __NL80211_TXQ_ATTR_INVALID, 2260 __NL80211_TXQ_ATTR_INVALID,
2239 NL80211_TXQ_ATTR_QUEUE, 2261 NL80211_TXQ_ATTR_AC,
2240 NL80211_TXQ_ATTR_TXOP, 2262 NL80211_TXQ_ATTR_TXOP,
2241 NL80211_TXQ_ATTR_CWMIN, 2263 NL80211_TXQ_ATTR_CWMIN,
2242 NL80211_TXQ_ATTR_CWMAX, 2264 NL80211_TXQ_ATTR_CWMAX,
@@ -2247,13 +2269,21 @@ enum nl80211_txq_attr {
2247 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 2269 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
2248}; 2270};
2249 2271
2250enum nl80211_txq_q { 2272enum nl80211_ac {
2251 NL80211_TXQ_Q_VO, 2273 NL80211_AC_VO,
2252 NL80211_TXQ_Q_VI, 2274 NL80211_AC_VI,
2253 NL80211_TXQ_Q_BE, 2275 NL80211_AC_BE,
2254 NL80211_TXQ_Q_BK 2276 NL80211_AC_BK,
2277 NL80211_NUM_ACS
2255}; 2278};
2256 2279
2280/* backward compat */
2281#define NL80211_TXQ_ATTR_QUEUE NL80211_TXQ_ATTR_AC
2282#define NL80211_TXQ_Q_VO NL80211_AC_VO
2283#define NL80211_TXQ_Q_VI NL80211_AC_VI
2284#define NL80211_TXQ_Q_BE NL80211_AC_BE
2285#define NL80211_TXQ_Q_BK NL80211_AC_BK
2286
2257enum nl80211_channel_type { 2287enum nl80211_channel_type {
2258 NL80211_CHAN_NO_HT, 2288 NL80211_CHAN_NO_HT,
2259 NL80211_CHAN_HT20, 2289 NL80211_CHAN_HT20,
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index 33d9f5175109..5a3db3aa5f17 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -68,6 +68,7 @@ enum {
68 IEEE802154_ATTR_CHANNEL_PAGE_LIST, 68 IEEE802154_ATTR_CHANNEL_PAGE_LIST,
69 69
70 IEEE802154_ATTR_PHY_NAME, 70 IEEE802154_ATTR_PHY_NAME,
71 IEEE802154_ATTR_DEV_TYPE,
71 72
72 __IEEE802154_ATTR_MAX, 73 __IEEE802154_ATTR_MAX,
73}; 74};
@@ -126,4 +127,23 @@ enum {
126 127
127#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) 128#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)
128 129
130enum {
131 __IEEE802154_DEV_INVALID = -1,
132
133 /* TODO:
134 * Nowadays three device types supported by this stack at linux-zigbee
135 * project: WPAN = 0, MONITOR = 1 and SMAC = 2.
136 *
137 * Since this stack implementation exists many years, it's definitely
138 * bad idea to change the assigned values due to they are already used
139 * by third-party userspace software like: iz-tools, wireshark...
140 *
141 * Currently only monitor device is added and initialized by '1' for
142 * compatibility.
143 */
144 IEEE802154_DEV_MONITOR = 1,
145
146 __IEEE802154_DEV_MAX,
147};
148
129#endif 149#endif
diff --git a/include/linux/of.h b/include/linux/of.h
index fa7fb1d97458..2ec1083af7ff 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -193,6 +193,17 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
193 for (child = of_get_next_child(parent, NULL); child != NULL; \ 193 for (child = of_get_next_child(parent, NULL); child != NULL; \
194 child = of_get_next_child(parent, child)) 194 child = of_get_next_child(parent, child))
195 195
196static inline int of_get_child_count(const struct device_node *np)
197{
198 struct device_node *child;
199 int num = 0;
200
201 for_each_child_of_node(np, child)
202 num++;
203
204 return num;
205}
206
196extern struct device_node *of_find_node_with_property( 207extern struct device_node *of_find_node_with_property(
197 struct device_node *from, const char *prop_name); 208 struct device_node *from, const char *prop_name);
198#define for_each_node_with_property(dn, prop_name) \ 209#define for_each_node_with_property(dn, prop_name) \
@@ -259,6 +270,37 @@ extern void of_detach_node(struct device_node *);
259#endif 270#endif
260 271
261#define of_match_ptr(_ptr) (_ptr) 272#define of_match_ptr(_ptr) (_ptr)
273
274/*
275 * struct property *prop;
276 * const __be32 *p;
277 * u32 u;
278 *
279 * of_property_for_each_u32(np, "propname", prop, p, u)
280 * printk("U32 value: %x\n", u);
281 */
282const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
283 u32 *pu);
284#define of_property_for_each_u32(np, propname, prop, p, u) \
285 for (prop = of_find_property(np, propname, NULL), \
286 p = of_prop_next_u32(prop, NULL, &u); \
287 p; \
288 p = of_prop_next_u32(prop, p, &u))
289
290/*
291 * struct property *prop;
292 * const char *s;
293 *
294 * of_property_for_each_string(np, "propname", prop, s)
295 * printk("String value: %s\n", s);
296 */
297const char *of_prop_next_string(struct property *prop, const char *cur);
298#define of_property_for_each_string(np, propname, prop, s) \
299 for (prop = of_find_property(np, propname, NULL), \
300 s = of_prop_next_string(prop, NULL); \
301 s; \
302 s = of_prop_next_string(prop, s))
303
262#else /* CONFIG_OF */ 304#else /* CONFIG_OF */
263 305
264static inline bool of_have_populated_dt(void) 306static inline bool of_have_populated_dt(void)
@@ -269,6 +311,11 @@ static inline bool of_have_populated_dt(void)
269#define for_each_child_of_node(parent, child) \ 311#define for_each_child_of_node(parent, child) \
270 while (0) 312 while (0)
271 313
314static inline int of_get_child_count(const struct device_node *np)
315{
316 return 0;
317}
318
272static inline int of_device_is_compatible(const struct device_node *device, 319static inline int of_device_is_compatible(const struct device_node *device,
273 const char *name) 320 const char *name)
274{ 321{
@@ -349,6 +396,10 @@ static inline int of_machine_is_compatible(const char *compat)
349 396
350#define of_match_ptr(_ptr) NULL 397#define of_match_ptr(_ptr) NULL
351#define of_match_node(_matches, _node) NULL 398#define of_match_node(_matches, _node) NULL
399#define of_property_for_each_u32(np, propname, prop, p, u) \
400 while (0)
401#define of_property_for_each_string(np, propname, prop, s) \
402 while (0)
352#endif /* CONFIG_OF */ 403#endif /* CONFIG_OF */
353 404
354/** 405/**
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 53b94e025c7c..912c27a0f7ee 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -22,4 +22,6 @@ extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
22 void (*hndlr)(struct net_device *), 22 void (*hndlr)(struct net_device *),
23 phy_interface_t iface); 23 phy_interface_t iface);
24 24
25extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
26
25#endif /* __LINUX_OF_MDIO_H */ 27#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e444f5b49118..17b7b5b01b4a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -375,11 +375,18 @@ struct pci_host_bridge_window {
375}; 375};
376 376
377struct pci_host_bridge { 377struct pci_host_bridge {
378 struct list_head list; 378 struct device dev;
379 struct pci_bus *bus; /* root bus */ 379 struct pci_bus *bus; /* root bus */
380 struct list_head windows; /* pci_host_bridge_windows */ 380 struct list_head windows; /* pci_host_bridge_windows */
381 void (*release_fn)(struct pci_host_bridge *);
382 void *release_data;
381}; 383};
382 384
385#define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev)
386void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
387 void (*release_fn)(struct pci_host_bridge *),
388 void *release_data);
389
383/* 390/*
384 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 391 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
385 * to P2P or CardBus bridge windows) go in a table. Additional ones (for 392 * to P2P or CardBus bridge windows) go in a table. Additional ones (for
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 6fe0a37d4abf..c291cae8ce32 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -412,6 +412,9 @@ struct phy_driver {
412 /* Clears up any memory if needed */ 412 /* Clears up any memory if needed */
413 void (*remove)(struct phy_device *phydev); 413 void (*remove)(struct phy_device *phydev);
414 414
415 /* Handles ethtool queries for hardware time stamping. */
416 int (*ts_info)(struct phy_device *phydev, struct ethtool_ts_info *ti);
417
415 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */ 418 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
416 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr); 419 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
417 420
@@ -477,7 +480,6 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
477 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 480 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
478} 481}
479 482
480int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
481struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 483struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
482int phy_device_register(struct phy_device *phy); 484int phy_device_register(struct phy_device *phy);
483int phy_init_hw(struct phy_device *phydev); 485int phy_init_hw(struct phy_device *phydev);
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 191e72688481..6dd96fb45482 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -36,6 +36,9 @@ extern struct pinctrl_state * __must_check pinctrl_lookup_state(
36 const char *name); 36 const char *name);
37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s); 37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
38 38
39extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
40extern void devm_pinctrl_put(struct pinctrl *p);
41
39#else /* !CONFIG_PINCTRL */ 42#else /* !CONFIG_PINCTRL */
40 43
41static inline int pinctrl_request_gpio(unsigned gpio) 44static inline int pinctrl_request_gpio(unsigned gpio)
@@ -79,6 +82,15 @@ static inline int pinctrl_select_state(struct pinctrl *p,
79 return 0; 82 return 0;
80} 83}
81 84
85static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
86{
87 return NULL;
88}
89
90static inline void devm_pinctrl_put(struct pinctrl *p)
91{
92}
93
82#endif /* CONFIG_PINCTRL */ 94#endif /* CONFIG_PINCTRL */
83 95
84static inline struct pinctrl * __must_check pinctrl_get_select( 96static inline struct pinctrl * __must_check pinctrl_get_select(
@@ -113,6 +125,38 @@ static inline struct pinctrl * __must_check pinctrl_get_select_default(
113 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); 125 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
114} 126}
115 127
128static inline struct pinctrl * __must_check devm_pinctrl_get_select(
129 struct device *dev, const char *name)
130{
131 struct pinctrl *p;
132 struct pinctrl_state *s;
133 int ret;
134
135 p = devm_pinctrl_get(dev);
136 if (IS_ERR(p))
137 return p;
138
139 s = pinctrl_lookup_state(p, name);
140 if (IS_ERR(s)) {
141 devm_pinctrl_put(p);
142 return ERR_PTR(PTR_ERR(s));
143 }
144
145 ret = pinctrl_select_state(p, s);
146 if (ret < 0) {
147 devm_pinctrl_put(p);
148 return ERR_PTR(ret);
149 }
150
151 return p;
152}
153
154static inline struct pinctrl * __must_check devm_pinctrl_get_select_default(
155 struct device *dev)
156{
157 return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
158}
159
116#ifdef CONFIG_PINCONF 160#ifdef CONFIG_PINCONF
117 161
118extern int pin_config_get(const char *dev_name, const char *name, 162extern int pin_config_get(const char *dev_name, const char *name,
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index e4d1de742502..7d22ab00343f 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -154,7 +154,7 @@ struct pinctrl_map {
154 154
155extern int pinctrl_register_mappings(struct pinctrl_map const *map, 155extern int pinctrl_register_mappings(struct pinctrl_map const *map,
156 unsigned num_maps); 156 unsigned num_maps);
157 157extern void pinctrl_provide_dummies(void);
158#else 158#else
159 159
160static inline int pinctrl_register_mappings(struct pinctrl_map const *map, 160static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
@@ -163,5 +163,8 @@ static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
163 return 0; 163 return 0;
164} 164}
165 165
166#endif /* !CONFIG_PINMUX */ 166static inline void pinctrl_provide_dummies(void)
167{
168}
169#endif /* !CONFIG_PINCTRL */
167#endif 170#endif
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index ec431f03362d..e7a720104a47 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -25,7 +25,6 @@ struct seq_file;
25 * @pin_config_get: get the config of a certain pin, if the requested config 25 * @pin_config_get: get the config of a certain pin, if the requested config
26 * is not available on this controller this should return -ENOTSUPP 26 * is not available on this controller this should return -ENOTSUPP
27 * and if it is available but disabled it should return -EINVAL 27 * and if it is available but disabled it should return -EINVAL
28 * @pin_config_get: get the config of a certain pin
29 * @pin_config_set: configure an individual pin 28 * @pin_config_set: configure an individual pin
30 * @pin_config_group_get: get configurations for an entire pin group 29 * @pin_config_group_get: get configurations for an entire pin group
31 * @pin_config_group_set: configure all pins in a group 30 * @pin_config_group_set: configure all pins in a group
@@ -33,6 +32,8 @@ struct seq_file;
33 * per-device info for a certain pin in debugfs 32 * per-device info for a certain pin in debugfs
34 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 33 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
35 * per-device info for a certain group in debugfs 34 * per-device info for a certain group in debugfs
35 * @pin_config_config_dbg_show: optional debugfs display hook that will decode
36 * and display a driver's pin configuration parameter
36 */ 37 */
37struct pinconf_ops { 38struct pinconf_ops {
38#ifdef CONFIG_GENERIC_PINCONF 39#ifdef CONFIG_GENERIC_PINCONF
@@ -56,6 +57,9 @@ struct pinconf_ops {
56 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev, 57 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
57 struct seq_file *s, 58 struct seq_file *s,
58 unsigned selector); 59 unsigned selector);
60 void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
61 struct seq_file *s,
62 unsigned long config);
59}; 63};
60 64
61#endif 65#endif
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 4e9f0788c221..3b894a668d32 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -21,9 +21,11 @@
21 21
22struct device; 22struct device;
23struct pinctrl_dev; 23struct pinctrl_dev;
24struct pinctrl_map;
24struct pinmux_ops; 25struct pinmux_ops;
25struct pinconf_ops; 26struct pinconf_ops;
26struct gpio_chip; 27struct gpio_chip;
28struct device_node;
27 29
28/** 30/**
29 * struct pinctrl_pin_desc - boards/machines provide information on their 31 * struct pinctrl_pin_desc - boards/machines provide information on their
@@ -64,17 +66,24 @@ struct pinctrl_gpio_range {
64/** 66/**
65 * struct pinctrl_ops - global pin control operations, to be implemented by 67 * struct pinctrl_ops - global pin control operations, to be implemented by
66 * pin controller drivers. 68 * pin controller drivers.
67 * @list_groups: list the number of selectable named groups available 69 * @get_groups_count: Returns the count of total number of groups registered.
68 * in this pinmux driver, the core will begin on 0 and call this
69 * repeatedly as long as it returns >= 0 to enumerate the groups
70 * @get_group_name: return the group name of the pin group 70 * @get_group_name: return the group name of the pin group
71 * @get_group_pins: return an array of pins corresponding to a certain 71 * @get_group_pins: return an array of pins corresponding to a certain
72 * group selector @pins, and the size of the array in @num_pins 72 * group selector @pins, and the size of the array in @num_pins
73 * @pin_dbg_show: optional debugfs display hook that will provide per-device 73 * @pin_dbg_show: optional debugfs display hook that will provide per-device
74 * info for a certain pin in debugfs 74 * info for a certain pin in debugfs
75 * @dt_node_to_map: parse a device tree "pin configuration node", and create
76 * mapping table entries for it. These are returned through the @map and
77 * @num_maps output parameters. This function is optional, and may be
78 * omitted for pinctrl drivers that do not support device tree.
79 * @dt_free_map: free mapping table entries created via @dt_node_to_map. The
80 * top-level @map pointer must be freed, along with any dynamically
81 * allocated members of the mapping table entries themselves. This
82 * function is optional, and may be omitted for pinctrl drivers that do
83 * not support device tree.
75 */ 84 */
76struct pinctrl_ops { 85struct pinctrl_ops {
77 int (*list_groups) (struct pinctrl_dev *pctldev, unsigned selector); 86 int (*get_groups_count) (struct pinctrl_dev *pctldev);
78 const char *(*get_group_name) (struct pinctrl_dev *pctldev, 87 const char *(*get_group_name) (struct pinctrl_dev *pctldev,
79 unsigned selector); 88 unsigned selector);
80 int (*get_group_pins) (struct pinctrl_dev *pctldev, 89 int (*get_group_pins) (struct pinctrl_dev *pctldev,
@@ -83,6 +92,11 @@ struct pinctrl_ops {
83 unsigned *num_pins); 92 unsigned *num_pins);
84 void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s, 93 void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s,
85 unsigned offset); 94 unsigned offset);
95 int (*dt_node_to_map) (struct pinctrl_dev *pctldev,
96 struct device_node *np_config,
97 struct pinctrl_map **map, unsigned *num_maps);
98 void (*dt_free_map) (struct pinctrl_dev *pctldev,
99 struct pinctrl_map *map, unsigned num_maps);
86}; 100};
87 101
88/** 102/**
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 47e9237edd47..1818dcbdd9ab 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -23,15 +23,14 @@ struct pinctrl_dev;
23/** 23/**
24 * struct pinmux_ops - pinmux operations, to be implemented by pin controller 24 * struct pinmux_ops - pinmux operations, to be implemented by pin controller
25 * drivers that support pinmuxing 25 * drivers that support pinmuxing
26 * @request: called by the core to see if a certain pin can be made available 26 * @request: called by the core to see if a certain pin can be made
27 * available for muxing. This is called by the core to acquire the pins 27 * available for muxing. This is called by the core to acquire the pins
28 * before selecting any actual mux setting across a function. The driver 28 * before selecting any actual mux setting across a function. The driver
29 * is allowed to answer "no" by returning a negative error code 29 * is allowed to answer "no" by returning a negative error code
30 * @free: the reverse function of the request() callback, frees a pin after 30 * @free: the reverse function of the request() callback, frees a pin after
31 * being requested 31 * being requested
32 * @list_functions: list the number of selectable named functions available 32 * @get_functions_count: returns number of selectable named functions available
33 * in this pinmux driver, the core will begin on 0 and call this 33 * in this pinmux driver
34 * repeatedly as long as it returns >= 0 to enumerate mux settings
35 * @get_function_name: return the function name of the muxing selector, 34 * @get_function_name: return the function name of the muxing selector,
36 * called by the core to figure out which mux setting it shall map a 35 * called by the core to figure out which mux setting it shall map a
37 * certain device to 36 * certain device to
@@ -62,7 +61,7 @@ struct pinctrl_dev;
62struct pinmux_ops { 61struct pinmux_ops {
63 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); 62 int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
64 int (*free) (struct pinctrl_dev *pctldev, unsigned offset); 63 int (*free) (struct pinctrl_dev *pctldev, unsigned offset);
65 int (*list_functions) (struct pinctrl_dev *pctldev, unsigned selector); 64 int (*get_functions_count) (struct pinctrl_dev *pctldev);
66 const char *(*get_function_name) (struct pinctrl_dev *pctldev, 65 const char *(*get_function_name) (struct pinctrl_dev *pctldev,
67 unsigned selector); 66 unsigned selector);
68 int (*get_function_groups) (struct pinctrl_dev *pctldev, 67 int (*get_function_groups) (struct pinctrl_dev *pctldev,
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 410b33d014d2..32aef0a439ef 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -509,6 +509,7 @@ enum {
509 TCA_NETEM_CORRUPT, 509 TCA_NETEM_CORRUPT,
510 TCA_NETEM_LOSS, 510 TCA_NETEM_LOSS,
511 TCA_NETEM_RATE, 511 TCA_NETEM_RATE,
512 TCA_NETEM_ECN,
512 __TCA_NETEM_MAX, 513 __TCA_NETEM_MAX,
513}; 514};
514 515
@@ -654,4 +655,84 @@ struct tc_qfq_stats {
654 __u32 lmax; 655 __u32 lmax;
655}; 656};
656 657
658/* CODEL */
659
660enum {
661 TCA_CODEL_UNSPEC,
662 TCA_CODEL_TARGET,
663 TCA_CODEL_LIMIT,
664 TCA_CODEL_INTERVAL,
665 TCA_CODEL_ECN,
666 __TCA_CODEL_MAX
667};
668
669#define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1)
670
671struct tc_codel_xstats {
672 __u32 maxpacket; /* largest packet we've seen so far */
673 __u32 count; /* how many drops we've done since the last time we
674 * entered dropping state
675 */
676 __u32 lastcount; /* count at entry to dropping state */
677 __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */
678 __s32 drop_next; /* time to drop next packet */
679 __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */
680 __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */
681 __u32 dropping; /* are we in dropping state ? */
682};
683
684/* FQ_CODEL */
685
686enum {
687 TCA_FQ_CODEL_UNSPEC,
688 TCA_FQ_CODEL_TARGET,
689 TCA_FQ_CODEL_LIMIT,
690 TCA_FQ_CODEL_INTERVAL,
691 TCA_FQ_CODEL_ECN,
692 TCA_FQ_CODEL_FLOWS,
693 TCA_FQ_CODEL_QUANTUM,
694 __TCA_FQ_CODEL_MAX
695};
696
697#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1)
698
699enum {
700 TCA_FQ_CODEL_XSTATS_QDISC,
701 TCA_FQ_CODEL_XSTATS_CLASS,
702};
703
704struct tc_fq_codel_qd_stats {
705 __u32 maxpacket; /* largest packet we've seen so far */
706 __u32 drop_overlimit; /* number of time max qdisc
707 * packet limit was hit
708 */
709 __u32 ecn_mark; /* number of packets we ECN marked
710 * instead of being dropped
711 */
712 __u32 new_flow_count; /* number of time packets
713 * created a 'new flow'
714 */
715 __u32 new_flows_len; /* count of flows in new list */
716 __u32 old_flows_len; /* count of flows in old list */
717};
718
719struct tc_fq_codel_cl_stats {
720 __s32 deficit;
721 __u32 ldelay; /* in-queue delay seen by most recently
722 * dequeued packet
723 */
724 __u32 count;
725 __u32 lastcount;
726 __u32 dropping;
727 __s32 drop_next;
728};
729
730struct tc_fq_codel_xstats {
731 __u32 type;
732 union {
733 struct tc_fq_codel_qd_stats qdisc_stats;
734 struct tc_fq_codel_cl_stats class_stats;
735 };
736};
737
657#endif 738#endif
diff --git a/include/linux/platform_data/wiznet.h b/include/linux/platform_data/wiznet.h
new file mode 100644
index 000000000000..b5d8c192d84d
--- /dev/null
+++ b/include/linux/platform_data/wiznet.h
@@ -0,0 +1,24 @@
1/*
2 * Ethernet driver for the WIZnet W5x00 chip.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef PLATFORM_DATA_WIZNET_H
8#define PLATFORM_DATA_WIZNET_H
9
10#include <linux/if_ether.h>
11
12struct wiznet_platform_data {
13 int link_gpio;
14 u8 mac_addr[ETH_ALEN];
15};
16
17#ifndef CONFIG_WIZNET_BUS_SHIFT
18#define CONFIG_WIZNET_BUS_SHIFT 0
19#endif
20
21#define W5100_BUS_DIRECT_SIZE (0x8000 << CONFIG_WIZNET_BUS_SHIFT)
22#define W5300_BUS_DIRECT_SIZE (0x0400 << CONFIG_WIZNET_BUS_SHIFT)
23
24#endif /* PLATFORM_DATA_WIZNET_H */
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index dd2e44fba63e..945704c2ed65 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -136,4 +136,12 @@ struct ptp_clock_event {
136extern void ptp_clock_event(struct ptp_clock *ptp, 136extern void ptp_clock_event(struct ptp_clock *ptp,
137 struct ptp_clock_event *event); 137 struct ptp_clock_event *event);
138 138
139/**
140 * ptp_clock_index() - obtain the device index of a PTP clock
141 *
142 * @ptp: The clock obtained from ptp_clock_register().
143 */
144
145extern int ptp_clock_index(struct ptp_clock *ptp);
146
139#endif 147#endif
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a90abb6bfa64..56af22ec9aba 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -46,7 +46,13 @@ struct reg_default {
46/** 46/**
47 * Configuration for the register map of a device. 47 * Configuration for the register map of a device.
48 * 48 *
49 * @name: Optional name of the regmap. Useful when a device has multiple
50 * register regions.
51 *
49 * @reg_bits: Number of bits in a register address, mandatory. 52 * @reg_bits: Number of bits in a register address, mandatory.
53 * @reg_stride: The register address stride. Valid register addresses are a
54 * multiple of this value. If set to 0, a value of 1 will be
55 * used.
50 * @pad_bits: Number of bits of padding between register and value. 56 * @pad_bits: Number of bits of padding between register and value.
51 * @val_bits: Number of bits in a register value, mandatory. 57 * @val_bits: Number of bits in a register value, mandatory.
52 * 58 *
@@ -70,6 +76,9 @@ struct reg_default {
70 * @write_flag_mask: Mask to be set in the top byte of the register when doing 76 * @write_flag_mask: Mask to be set in the top byte of the register when doing
71 * a write. If both read_flag_mask and write_flag_mask are 77 * a write. If both read_flag_mask and write_flag_mask are
72 * empty the regmap_bus default masks are used. 78 * empty the regmap_bus default masks are used.
79 * @use_single_rw: If set, converts the bulk read and write operations into
80 * a series of single read and write operations. This is useful
81 * for device that does not support bulk read and write.
73 * 82 *
74 * @cache_type: The actual cache type. 83 * @cache_type: The actual cache type.
75 * @reg_defaults_raw: Power on reset values for registers (for use with 84 * @reg_defaults_raw: Power on reset values for registers (for use with
@@ -77,7 +86,10 @@ struct reg_default {
77 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw. 86 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
78 */ 87 */
79struct regmap_config { 88struct regmap_config {
89 const char *name;
90
80 int reg_bits; 91 int reg_bits;
92 int reg_stride;
81 int pad_bits; 93 int pad_bits;
82 int val_bits; 94 int val_bits;
83 95
@@ -95,20 +107,25 @@ struct regmap_config {
95 107
96 u8 read_flag_mask; 108 u8 read_flag_mask;
97 u8 write_flag_mask; 109 u8 write_flag_mask;
110
111 bool use_single_rw;
98}; 112};
99 113
100typedef int (*regmap_hw_write)(struct device *dev, const void *data, 114typedef int (*regmap_hw_write)(void *context, const void *data,
101 size_t count); 115 size_t count);
102typedef int (*regmap_hw_gather_write)(struct device *dev, 116typedef int (*regmap_hw_gather_write)(void *context,
103 const void *reg, size_t reg_len, 117 const void *reg, size_t reg_len,
104 const void *val, size_t val_len); 118 const void *val, size_t val_len);
105typedef int (*regmap_hw_read)(struct device *dev, 119typedef int (*regmap_hw_read)(void *context,
106 const void *reg_buf, size_t reg_size, 120 const void *reg_buf, size_t reg_size,
107 void *val_buf, size_t val_size); 121 void *val_buf, size_t val_size);
122typedef void (*regmap_hw_free_context)(void *context);
108 123
109/** 124/**
110 * Description of a hardware bus for the register map infrastructure. 125 * Description of a hardware bus for the register map infrastructure.
111 * 126 *
127 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
128 * to perform locking.
112 * @write: Write operation. 129 * @write: Write operation.
113 * @gather_write: Write operation with split register/value, return -ENOTSUPP 130 * @gather_write: Write operation with split register/value, return -ENOTSUPP
114 * if not implemented on a given device. 131 * if not implemented on a given device.
@@ -118,31 +135,42 @@ typedef int (*regmap_hw_read)(struct device *dev,
118 * a read. 135 * a read.
119 */ 136 */
120struct regmap_bus { 137struct regmap_bus {
138 bool fast_io;
121 regmap_hw_write write; 139 regmap_hw_write write;
122 regmap_hw_gather_write gather_write; 140 regmap_hw_gather_write gather_write;
123 regmap_hw_read read; 141 regmap_hw_read read;
142 regmap_hw_free_context free_context;
124 u8 read_flag_mask; 143 u8 read_flag_mask;
125}; 144};
126 145
127struct regmap *regmap_init(struct device *dev, 146struct regmap *regmap_init(struct device *dev,
128 const struct regmap_bus *bus, 147 const struct regmap_bus *bus,
148 void *bus_context,
129 const struct regmap_config *config); 149 const struct regmap_config *config);
130struct regmap *regmap_init_i2c(struct i2c_client *i2c, 150struct regmap *regmap_init_i2c(struct i2c_client *i2c,
131 const struct regmap_config *config); 151 const struct regmap_config *config);
132struct regmap *regmap_init_spi(struct spi_device *dev, 152struct regmap *regmap_init_spi(struct spi_device *dev,
133 const struct regmap_config *config); 153 const struct regmap_config *config);
154struct regmap *regmap_init_mmio(struct device *dev,
155 void __iomem *regs,
156 const struct regmap_config *config);
134 157
135struct regmap *devm_regmap_init(struct device *dev, 158struct regmap *devm_regmap_init(struct device *dev,
136 const struct regmap_bus *bus, 159 const struct regmap_bus *bus,
160 void *bus_context,
137 const struct regmap_config *config); 161 const struct regmap_config *config);
138struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, 162struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
139 const struct regmap_config *config); 163 const struct regmap_config *config);
140struct regmap *devm_regmap_init_spi(struct spi_device *dev, 164struct regmap *devm_regmap_init_spi(struct spi_device *dev,
141 const struct regmap_config *config); 165 const struct regmap_config *config);
166struct regmap *devm_regmap_init_mmio(struct device *dev,
167 void __iomem *regs,
168 const struct regmap_config *config);
142 169
143void regmap_exit(struct regmap *map); 170void regmap_exit(struct regmap *map);
144int regmap_reinit_cache(struct regmap *map, 171int regmap_reinit_cache(struct regmap *map,
145 const struct regmap_config *config); 172 const struct regmap_config *config);
173struct regmap *dev_get_regmap(struct device *dev, const char *name);
146int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 174int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
147int regmap_raw_write(struct regmap *map, unsigned int reg, 175int regmap_raw_write(struct regmap *map, unsigned int reg,
148 const void *val, size_t val_len); 176 const void *val, size_t val_len);
@@ -191,6 +219,7 @@ struct regmap_irq {
191 * @status_base: Base status register address. 219 * @status_base: Base status register address.
192 * @mask_base: Base mask register address. 220 * @mask_base: Base mask register address.
193 * @ack_base: Base ack address. If zero then the chip is clear on read. 221 * @ack_base: Base ack address. If zero then the chip is clear on read.
222 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
194 * 223 *
195 * @num_regs: Number of registers in each control bank. 224 * @num_regs: Number of registers in each control bank.
196 * @irqs: Descriptors for individual IRQs. Interrupt numbers are 225 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
@@ -203,6 +232,7 @@ struct regmap_irq_chip {
203 unsigned int status_base; 232 unsigned int status_base;
204 unsigned int mask_base; 233 unsigned int mask_base;
205 unsigned int ack_base; 234 unsigned int ack_base;
235 unsigned int irq_reg_stride;
206 236
207 int num_regs; 237 int num_regs;
208 238
@@ -217,6 +247,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
217 struct regmap_irq_chip_data **data); 247 struct regmap_irq_chip_data **data);
218void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); 248void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
219int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 249int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
250int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
220 251
221#else 252#else
222 253
@@ -327,6 +358,13 @@ static inline int regmap_register_patch(struct regmap *map,
327 return -EINVAL; 358 return -EINVAL;
328} 359}
329 360
361static inline struct regmap *dev_get_regmap(struct device *dev,
362 const char *name)
363{
364 WARN_ONCE(1, "regmap API is disabled");
365 return NULL;
366}
367
330#endif 368#endif
331 369
332#endif 370#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index fa8b55b8191c..b0432cc2b169 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -19,6 +19,7 @@
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
21 21
22struct regmap;
22struct regulator_dev; 23struct regulator_dev;
23struct regulator_init_data; 24struct regulator_init_data;
24 25
@@ -45,6 +46,7 @@ enum regulator_status {
45 * The driver should select the voltage closest to min_uV. 46 * The driver should select the voltage closest to min_uV.
46 * @set_voltage_sel: Set the voltage for the regulator using the specified 47 * @set_voltage_sel: Set the voltage for the regulator using the specified
47 * selector. 48 * selector.
49 * @map_voltage: Convert a voltage into a selector
48 * @get_voltage: Return the currently configured voltage for the regulator. 50 * @get_voltage: Return the currently configured voltage for the regulator.
49 * @get_voltage_sel: Return the currently configured voltage selector for the 51 * @get_voltage_sel: Return the currently configured voltage selector for the
50 * regulator. 52 * regulator.
@@ -90,6 +92,7 @@ struct regulator_ops {
90 /* get/set regulator voltage */ 92 /* get/set regulator voltage */
91 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, 93 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV,
92 unsigned *selector); 94 unsigned *selector);
95 int (*map_voltage)(struct regulator_dev *, int min_uV, int max_uV);
93 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector); 96 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector);
94 int (*get_voltage) (struct regulator_dev *); 97 int (*get_voltage) (struct regulator_dev *);
95 int (*get_voltage_sel) (struct regulator_dev *); 98 int (*get_voltage_sel) (struct regulator_dev *);
@@ -148,19 +151,30 @@ enum regulator_type {
148}; 151};
149 152
150/** 153/**
151 * struct regulator_desc - Regulator descriptor 154 * struct regulator_desc - Static regulator descriptor
152 * 155 *
153 * Each regulator registered with the core is described with a structure of 156 * Each regulator registered with the core is described with a
154 * this type. 157 * structure of this type and a struct regulator_config. This
158 * structure contains the non-varying parts of the regulator
159 * description.
155 * 160 *
156 * @name: Identifying name for the regulator. 161 * @name: Identifying name for the regulator.
157 * @supply_name: Identifying the regulator supply 162 * @supply_name: Identifying the regulator supply
158 * @id: Numerical identifier for the regulator. 163 * @id: Numerical identifier for the regulator.
159 * @n_voltages: Number of selectors available for ops.list_voltage().
160 * @ops: Regulator operations table. 164 * @ops: Regulator operations table.
161 * @irq: Interrupt number for the regulator. 165 * @irq: Interrupt number for the regulator.
162 * @type: Indicates if the regulator is a voltage or current regulator. 166 * @type: Indicates if the regulator is a voltage or current regulator.
163 * @owner: Module providing the regulator, used for refcounting. 167 * @owner: Module providing the regulator, used for refcounting.
168 *
169 * @n_voltages: Number of selectors available for ops.list_voltage().
170 *
171 * @min_uV: Voltage given by the lowest selector (if linear mapping)
172 * @uV_step: Voltage increase with each selector (if linear mapping)
173 *
174 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
175 * @vsel_mask: Mask for register bitfield used for selector
176 * @enable_reg: Register for control when using regmap enable/disable ops
177 * @enable_mask: Mask for control when using regmap enable/disable ops
164 */ 178 */
165struct regulator_desc { 179struct regulator_desc {
166 const char *name; 180 const char *name;
@@ -171,6 +185,36 @@ struct regulator_desc {
171 int irq; 185 int irq;
172 enum regulator_type type; 186 enum regulator_type type;
173 struct module *owner; 187 struct module *owner;
188
189 unsigned int min_uV;
190 unsigned int uV_step;
191
192 unsigned int vsel_reg;
193 unsigned int vsel_mask;
194 unsigned int enable_reg;
195 unsigned int enable_mask;
196};
197
198/**
199 * struct regulator_config - Dynamic regulator descriptor
200 *
201 * Each regulator registered with the core is described with a
202 * structure of this type and a struct regulator_desc. This structure
203 * contains the runtime variable parts of the regulator description.
204 *
205 * @dev: struct device for the regulator
206 * @init_data: platform provided init data, passed through by driver
207 * @driver_data: private regulator data
208 * @of_node: OpenFirmware node to parse for device tree bindings (may be
209 * NULL).
210 * @regmap: regmap to use for core regmap helpers
211 */
212struct regulator_config {
213 struct device *dev;
214 const struct regulator_init_data *init_data;
215 void *driver_data;
216 struct device_node *of_node;
217 struct regmap *regmap;
174}; 218};
175 219
176/* 220/*
@@ -184,7 +228,7 @@ struct regulator_desc {
184 * no other direct access). 228 * no other direct access).
185 */ 229 */
186struct regulator_dev { 230struct regulator_dev {
187 struct regulator_desc *desc; 231 const struct regulator_desc *desc;
188 int exclusive; 232 int exclusive;
189 u32 use_count; 233 u32 use_count;
190 u32 open_count; 234 u32 open_count;
@@ -201,6 +245,7 @@ struct regulator_dev {
201 struct device dev; 245 struct device dev;
202 struct regulation_constraints *constraints; 246 struct regulation_constraints *constraints;
203 struct regulator *supply; /* for tree */ 247 struct regulator *supply; /* for tree */
248 struct regmap *regmap;
204 249
205 struct delayed_work disable_work; 250 struct delayed_work disable_work;
206 int deferred_disables; 251 int deferred_disables;
@@ -210,9 +255,9 @@ struct regulator_dev {
210 struct dentry *debugfs; 255 struct dentry *debugfs;
211}; 256};
212 257
213struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 258struct regulator_dev *
214 struct device *dev, const struct regulator_init_data *init_data, 259regulator_register(const struct regulator_desc *regulator_desc,
215 void *driver_data, struct device_node *of_node); 260 const struct regulator_config *config);
216void regulator_unregister(struct regulator_dev *rdev); 261void regulator_unregister(struct regulator_dev *rdev);
217 262
218int regulator_notifier_call_chain(struct regulator_dev *rdev, 263int regulator_notifier_call_chain(struct regulator_dev *rdev,
@@ -224,6 +269,18 @@ int rdev_get_id(struct regulator_dev *rdev);
224 269
225int regulator_mode_to_status(unsigned int); 270int regulator_mode_to_status(unsigned int);
226 271
272int regulator_list_voltage_linear(struct regulator_dev *rdev,
273 unsigned int selector);
274int regulator_map_voltage_linear(struct regulator_dev *rdev,
275 int min_uV, int max_uV);
276int regulator_map_voltage_iterate(struct regulator_dev *rdev,
277 int min_uV, int max_uV);
278int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev);
279int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);
280int regulator_is_enabled_regmap(struct regulator_dev *rdev);
281int regulator_enable_regmap(struct regulator_dev *rdev);
282int regulator_disable_regmap(struct regulator_dev *rdev);
283
227void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 284void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
228 285
229#endif 286#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 936a7d8c11a9..f83f7440b488 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -26,6 +26,12 @@ struct regulator_init_data;
26 * @gpio: GPIO to use for enable control 26 * @gpio: GPIO to use for enable control
27 * set to -EINVAL if not used 27 * set to -EINVAL if not used
28 * @startup_delay: Start-up time in microseconds 28 * @startup_delay: Start-up time in microseconds
29 * @gpio_is_open_drain: Gpio pin is open drain or normal type.
30 * If it is open drain type then HIGH will be set
31 * through PULL-UP with setting gpio as input
32 * and low will be set as gpio-output with driven
33 * to low. For non-open-drain case, the gpio will
34 * will be in output and drive to low/high accordingly.
29 * @enable_high: Polarity of enable GPIO 35 * @enable_high: Polarity of enable GPIO
30 * 1 = Active high, 0 = Active low 36 * 1 = Active high, 0 = Active low
31 * @enabled_at_boot: Whether regulator has been enabled at 37 * @enabled_at_boot: Whether regulator has been enabled at
@@ -43,6 +49,7 @@ struct fixed_voltage_config {
43 int microvolts; 49 int microvolts;
44 int gpio; 50 int gpio;
45 unsigned startup_delay; 51 unsigned startup_delay;
52 unsigned gpio_is_open_drain:1;
46 unsigned enable_high:1; 53 unsigned enable_high:1;
47 unsigned enabled_at_boot:1; 54 unsigned enabled_at_boot:1;
48 struct regulator_init_data *init_data; 55 struct regulator_init_data *init_data;
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
index 769704f296e5..f9217965aaa3 100644
--- a/include/linux/regulator/of_regulator.h
+++ b/include/linux/regulator/of_regulator.h
@@ -6,10 +6,20 @@
6#ifndef __LINUX_OF_REG_H 6#ifndef __LINUX_OF_REG_H
7#define __LINUX_OF_REG_H 7#define __LINUX_OF_REG_H
8 8
9struct of_regulator_match {
10 const char *name;
11 void *driver_data;
12 struct regulator_init_data *init_data;
13 struct device_node *of_node;
14};
15
9#if defined(CONFIG_OF) 16#if defined(CONFIG_OF)
10extern struct regulator_init_data 17extern struct regulator_init_data
11 *of_get_regulator_init_data(struct device *dev, 18 *of_get_regulator_init_data(struct device *dev,
12 struct device_node *node); 19 struct device_node *node);
20extern int of_regulator_match(struct device *dev, struct device_node *node,
21 struct of_regulator_match *matches,
22 unsigned int num_matches);
13#else 23#else
14static inline struct regulator_init_data 24static inline struct regulator_init_data
15 *of_get_regulator_init_data(struct device *dev, 25 *of_get_regulator_init_data(struct device *dev,
@@ -17,6 +27,14 @@ static inline struct regulator_init_data
17{ 27{
18 return NULL; 28 return NULL;
19} 29}
30
31static inline int of_regulator_match(struct device *dev,
32 struct device_node *node,
33 struct of_regulator_match *matches,
34 unsigned int num_matches)
35{
36 return 0;
37}
20#endif /* CONFIG_OF */ 38#endif /* CONFIG_OF */
21 39
22#endif /* __LINUX_OF_REG_H */ 40#endif /* __LINUX_OF_REG_H */
diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h
index 6a5c1b2c751e..a4c49394c497 100644
--- a/include/linux/regulator/tps62360.h
+++ b/include/linux/regulator/tps62360.h
@@ -26,13 +26,10 @@
26#ifndef __LINUX_REGULATOR_TPS62360_H 26#ifndef __LINUX_REGULATOR_TPS62360_H
27#define __LINUX_REGULATOR_TPS62360_H 27#define __LINUX_REGULATOR_TPS62360_H
28 28
29#include <linux/regulator/machine.h>
30
31/* 29/*
32 * struct tps62360_regulator_platform_data - tps62360 regulator platform data. 30 * struct tps62360_regulator_platform_data - tps62360 regulator platform data.
33 * 31 *
34 * @reg_init_data: The regulator init data. 32 * @reg_init_data: The regulator init data.
35 * @en_force_pwm: Enable force pwm or not.
36 * @en_discharge: Enable discharge the output capacitor via internal 33 * @en_discharge: Enable discharge the output capacitor via internal
37 * register. 34 * register.
38 * @en_internal_pulldn: internal pull down enable or not. 35 * @en_internal_pulldn: internal pull down enable or not.
@@ -44,8 +41,7 @@
44 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. 41 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0.
45 */ 42 */
46struct tps62360_regulator_platform_data { 43struct tps62360_regulator_platform_data {
47 struct regulator_init_data reg_init_data; 44 struct regulator_init_data *reg_init_data;
48 bool en_force_pwm;
49 bool en_discharge; 45 bool en_discharge;
50 bool en_internal_pulldn; 46 bool en_internal_pulldn;
51 int vsel0_gpio; 47 int vsel0_gpio;
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
new file mode 100644
index 000000000000..0fa04b64db3e
--- /dev/null
+++ b/include/linux/regulator/tps65090-regulator.h
@@ -0,0 +1,50 @@
1/*
2 * Regulator driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (c) 2012, NVIDIA CORPORATION. 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 it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * 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 __REGULATOR_TPS65090_H
20#define __REGULATOR_TPS65090_H
21
22#include <linux/regulator/machine.h>
23
24#define tps65090_rails(_name) "tps65090_"#_name
25
26enum {
27 TPS65090_ID_DCDC1,
28 TPS65090_ID_DCDC2,
29 TPS65090_ID_DCDC3,
30 TPS65090_ID_FET1,
31 TPS65090_ID_FET2,
32 TPS65090_ID_FET3,
33 TPS65090_ID_FET4,
34 TPS65090_ID_FET5,
35 TPS65090_ID_FET6,
36 TPS65090_ID_FET7,
37};
38
39/*
40 * struct tps65090_regulator_platform_data
41 *
42 * @regulator: The regulator init data.
43 * @slew_rate_uV_per_us: Slew rate microvolt per microsec.
44 */
45
46struct tps65090_regulator_platform_data {
47 struct regulator_init_data regulator;
48};
49
50#endif /* __REGULATOR_TPS65090_H */
diff --git a/include/linux/rndis.h b/include/linux/rndis.h
new file mode 100644
index 000000000000..0c8dc7195cdb
--- /dev/null
+++ b/include/linux/rndis.h
@@ -0,0 +1,390 @@
1/*
2 * Remote Network Driver Interface Specification (RNDIS)
3 * definitions of the magic numbers used by this protocol
4 */
5
6/* Remote NDIS Versions */
7#define RNDIS_MAJOR_VERSION 0x00000001
8#define RNDIS_MINOR_VERSION 0x00000000
9
10/* Device Flags */
11#define RNDIS_DF_CONNECTIONLESS 0x00000001U
12#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U
13#define RNDIS_DF_RAW_DATA 0x00000004U
14
15/*
16 * Codes for "msg_type" field of rndis messages;
17 * only the data channel uses packet messages (maybe batched);
18 * everything else goes on the control channel.
19 */
20#define RNDIS_MSG_COMPLETION 0x80000000
21#define RNDIS_MSG_PACKET 0x00000001 /* 1-N packets */
22#define RNDIS_MSG_INIT 0x00000002
23#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
24#define RNDIS_MSG_HALT 0x00000003
25#define RNDIS_MSG_QUERY 0x00000004
26#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
27#define RNDIS_MSG_SET 0x00000005
28#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
29#define RNDIS_MSG_RESET 0x00000006
30#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
31#define RNDIS_MSG_INDICATE 0x00000007
32#define RNDIS_MSG_KEEPALIVE 0x00000008
33#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
34/*
35 * Reserved message type for private communication between lower-layer host
36 * driver and remote device, if necessary.
37 */
38#define RNDIS_MSG_BUS 0xff000001
39
40/* codes for "status" field of completion messages */
41#define RNDIS_STATUS_SUCCESS 0x00000000
42#define RNDIS_STATUS_PENDING 0x00000103
43
44/* Status codes */
45#define RNDIS_STATUS_NOT_RECOGNIZED 0x00010001
46#define RNDIS_STATUS_NOT_COPIED 0x00010002
47#define RNDIS_STATUS_NOT_ACCEPTED 0x00010003
48#define RNDIS_STATUS_CALL_ACTIVE 0x00010007
49
50#define RNDIS_STATUS_ONLINE 0x40010003
51#define RNDIS_STATUS_RESET_START 0x40010004
52#define RNDIS_STATUS_RESET_END 0x40010005
53#define RNDIS_STATUS_RING_STATUS 0x40010006
54#define RNDIS_STATUS_CLOSED 0x40010007
55#define RNDIS_STATUS_WAN_LINE_UP 0x40010008
56#define RNDIS_STATUS_WAN_LINE_DOWN 0x40010009
57#define RNDIS_STATUS_WAN_FRAGMENT 0x4001000A
58#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000B
59#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000C
60#define RNDIS_STATUS_HARDWARE_LINE_UP 0x4001000D
61#define RNDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E
62#define RNDIS_STATUS_INTERFACE_UP 0x4001000F
63#define RNDIS_STATUS_INTERFACE_DOWN 0x40010010
64#define RNDIS_STATUS_MEDIA_BUSY 0x40010011
65#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
66#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
67#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L
68
69#define RNDIS_STATUS_NOT_RESETTABLE 0x80010001
70#define RNDIS_STATUS_SOFT_ERRORS 0x80010003
71#define RNDIS_STATUS_HARD_ERRORS 0x80010004
72#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005
73
74#define RNDIS_STATUS_FAILURE 0xC0000001
75#define RNDIS_STATUS_RESOURCES 0xC000009A
76#define RNDIS_STATUS_NOT_SUPPORTED 0xc00000BB
77#define RNDIS_STATUS_CLOSING 0xC0010002
78#define RNDIS_STATUS_BAD_VERSION 0xC0010004
79#define RNDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005
80#define RNDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006
81#define RNDIS_STATUS_OPEN_FAILED 0xC0010007
82#define RNDIS_STATUS_DEVICE_FAILED 0xC0010008
83#define RNDIS_STATUS_MULTICAST_FULL 0xC0010009
84#define RNDIS_STATUS_MULTICAST_EXISTS 0xC001000A
85#define RNDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
86#define RNDIS_STATUS_REQUEST_ABORTED 0xC001000C
87#define RNDIS_STATUS_RESET_IN_PROGRESS 0xC001000D
88#define RNDIS_STATUS_CLOSING_INDICATING 0xC001000E
89#define RNDIS_STATUS_INVALID_PACKET 0xC001000F
90#define RNDIS_STATUS_OPEN_LIST_FULL 0xC0010010
91#define RNDIS_STATUS_ADAPTER_NOT_READY 0xC0010011
92#define RNDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012
93#define RNDIS_STATUS_NOT_INDICATING 0xC0010013
94#define RNDIS_STATUS_INVALID_LENGTH 0xC0010014
95#define RNDIS_STATUS_INVALID_DATA 0xC0010015
96#define RNDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016
97#define RNDIS_STATUS_INVALID_OID 0xC0010017
98#define RNDIS_STATUS_ADAPTER_REMOVED 0xC0010018
99#define RNDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019
100#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A
101#define RNDIS_STATUS_FILE_NOT_FOUND 0xC001001B
102#define RNDIS_STATUS_ERROR_READING_FILE 0xC001001C
103#define RNDIS_STATUS_ALREADY_MAPPED 0xC001001D
104#define RNDIS_STATUS_RESOURCE_CONFLICT 0xC001001E
105#define RNDIS_STATUS_NO_CABLE 0xC001001F
106
107#define RNDIS_STATUS_INVALID_SAP 0xC0010020
108#define RNDIS_STATUS_SAP_IN_USE 0xC0010021
109#define RNDIS_STATUS_INVALID_ADDRESS 0xC0010022
110#define RNDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023
111#define RNDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024
112#define RNDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025
113#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026
114#define RNDIS_STATUS_INCOMPATABLE_QOS 0xC0010027
115#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028
116#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029
117
118#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000
119
120/* codes for RNDIS_OID_GEN_PHYSICAL_MEDIUM */
121#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED 0x00000000
122#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN 0x00000001
123#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM 0x00000002
124#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE 0x00000003
125#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE 0x00000004
126#define RNDIS_PHYSICAL_MEDIUM_DSL 0x00000005
127#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL 0x00000006
128#define RNDIS_PHYSICAL_MEDIUM_1394 0x00000007
129#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN 0x00000008
130#define RNDIS_PHYSICAL_MEDIUM_MAX 0x00000009
131
132/* Remote NDIS medium types. */
133#define RNDIS_MEDIUM_UNSPECIFIED 0x00000000
134#define RNDIS_MEDIUM_802_3 0x00000000
135#define RNDIS_MEDIUM_802_5 0x00000001
136#define RNDIS_MEDIUM_FDDI 0x00000002
137#define RNDIS_MEDIUM_WAN 0x00000003
138#define RNDIS_MEDIUM_LOCAL_TALK 0x00000004
139#define RNDIS_MEDIUM_ARCNET_RAW 0x00000006
140#define RNDIS_MEDIUM_ARCNET_878_2 0x00000007
141#define RNDIS_MEDIUM_ATM 0x00000008
142#define RNDIS_MEDIUM_WIRELESS_LAN 0x00000009
143#define RNDIS_MEDIUM_IRDA 0x0000000A
144#define RNDIS_MEDIUM_BPC 0x0000000B
145#define RNDIS_MEDIUM_CO_WAN 0x0000000C
146#define RNDIS_MEDIUM_1394 0x0000000D
147/* Not a real medium, defined as an upper-bound */
148#define RNDIS_MEDIUM_MAX 0x0000000E
149
150/* Remote NDIS medium connection states. */
151#define RNDIS_MEDIA_STATE_CONNECTED 0x00000000
152#define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001
153
154/* packet filter bits used by RNDIS_OID_GEN_CURRENT_PACKET_FILTER */
155#define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
156#define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
157#define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
158#define RNDIS_PACKET_TYPE_BROADCAST 0x00000008
159#define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
160#define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
161#define RNDIS_PACKET_TYPE_SMT 0x00000040
162#define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
163#define RNDIS_PACKET_TYPE_GROUP 0x00001000
164#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
165#define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
166#define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000
167
168/* RNDIS_OID_GEN_MINIPORT_INFO constants */
169#define RNDIS_MINIPORT_BUS_MASTER 0x00000001
170#define RNDIS_MINIPORT_WDM_DRIVER 0x00000002
171#define RNDIS_MINIPORT_SG_LIST 0x00000004
172#define RNDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008
173#define RNDIS_MINIPORT_INDICATES_PACKETS 0x00000010
174#define RNDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020
175#define RNDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040
176#define RNDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080
177#define RNDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100
178#define RNDIS_MINIPORT_IS_NDIS_5 0x00000200
179#define RNDIS_MINIPORT_IS_CO 0x00000400
180#define RNDIS_MINIPORT_DESERIALIZE 0x00000800
181#define RNDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000
182#define RNDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000
183#define RNDIS_MINIPORT_NETBOOT_CARD 0x00004000
184#define RNDIS_MINIPORT_PM_SUPPORTED 0x00008000
185#define RNDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000
186#define RNDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000
187#define RNDIS_MINIPORT_HIDDEN 0x00040000
188#define RNDIS_MINIPORT_SWENUM 0x00080000
189#define RNDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000
190#define RNDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000
191#define RNDIS_MINIPORT_HARDWARE_DEVICE 0x00400000
192#define RNDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000
193#define RNDIS_MINIPORT_64BITS_DMA 0x01000000
194
195#define RNDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
196#define RNDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
197#define RNDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
198#define RNDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
199#define RNDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
200#define RNDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
201#define RNDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
202#define RNDIS_MAC_OPTION_RESERVED 0x80000000
203
204/* Object Identifiers used by NdisRequest Query/Set Information */
205/* General (Required) Objects */
206#define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
207#define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
208#define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
209#define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
210#define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
211#define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
212#define RNDIS_OID_GEN_LINK_SPEED 0x00010107
213#define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
214#define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
215#define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
216#define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
217#define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
218#define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
219#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
220#define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
221#define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
222#define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
223#define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
224#define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
225#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
226#define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
227#define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
228#define RNDIS_OID_GEN_SUPPORTED_GUIDS 0x00010117
229#define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
230#define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
231#define RNDIS_OID_GEN_PHYSICAL_MEDIUM 0x00010202
232#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
233#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
234#define RNDIS_OID_GEN_VLAN_ID 0x0001021C
235
236/* Optional OIDs */
237#define RNDIS_OID_GEN_MEDIA_CAPABILITIES 0x00010201
238
239/* Required statistics OIDs */
240#define RNDIS_OID_GEN_XMIT_OK 0x00020101
241#define RNDIS_OID_GEN_RCV_OK 0x00020102
242#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
243#define RNDIS_OID_GEN_RCV_ERROR 0x00020104
244#define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
245
246/* Optional statistics OIDs */
247#define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
248#define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
249#define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
250#define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
251#define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
252#define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
253#define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
254#define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
255#define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
256#define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
257#define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
258#define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
259
260#define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
261#define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
262
263#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
264#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
265
266#define RNDIS_OID_GEN_NETCARD_LOAD 0x00020211
267#define RNDIS_OID_GEN_DEVICE_PROFILE 0x00020212
268#define RNDIS_OID_GEN_INIT_TIME_MS 0x00020213
269#define RNDIS_OID_GEN_RESET_COUNTS 0x00020214
270#define RNDIS_OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
271#define RNDIS_OID_GEN_FRIENDLY_NAME 0x00020216
272#define RNDIS_OID_GEN_MINIPORT_INFO 0x00020217
273#define RNDIS_OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
274
275/* These are connection-oriented general OIDs. */
276/* These replace the above OIDs for connection-oriented media. */
277#define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
278#define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
279#define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
280#define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
281#define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
282#define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
283#define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
284#define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
285#define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
286#define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
287#define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
288#define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
289#define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
290
291#define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
292#define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
293
294/* These are connection-oriented statistics OIDs. */
295#define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
296#define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
297#define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
298#define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
299#define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
300
301
302#define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
303#define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
304#define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
305#define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
306#define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
307#define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
308
309/* These are objects for Connection-oriented media call-managers. */
310#define RNDIS_OID_CO_ADD_PVC 0xFF000001
311#define RNDIS_OID_CO_DELETE_PVC 0xFF000002
312#define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
313#define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
314#define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
315#define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
316#define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
317#define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
318#define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
319
320/* 802.3 Objects (Ethernet) */
321#define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
322#define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
323#define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
324#define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
325#define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
326
327#define RNDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
328
329#define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
330#define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
331#define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
332
333#define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
334#define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
335#define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
336#define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
337#define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
338#define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
339#define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
340
341#define RNDIS_OID_802_11_BSSID 0x0d010101
342#define RNDIS_OID_802_11_SSID 0x0d010102
343#define RNDIS_OID_802_11_INFRASTRUCTURE_MODE 0x0d010108
344#define RNDIS_OID_802_11_ADD_WEP 0x0d010113
345#define RNDIS_OID_802_11_REMOVE_WEP 0x0d010114
346#define RNDIS_OID_802_11_DISASSOCIATE 0x0d010115
347#define RNDIS_OID_802_11_AUTHENTICATION_MODE 0x0d010118
348#define RNDIS_OID_802_11_PRIVACY_FILTER 0x0d010119
349#define RNDIS_OID_802_11_BSSID_LIST_SCAN 0x0d01011a
350#define RNDIS_OID_802_11_ENCRYPTION_STATUS 0x0d01011b
351#define RNDIS_OID_802_11_ADD_KEY 0x0d01011d
352#define RNDIS_OID_802_11_REMOVE_KEY 0x0d01011e
353#define RNDIS_OID_802_11_ASSOCIATION_INFORMATION 0x0d01011f
354#define RNDIS_OID_802_11_CAPABILITY 0x0d010122
355#define RNDIS_OID_802_11_PMKID 0x0d010123
356#define RNDIS_OID_802_11_NETWORK_TYPES_SUPPORTED 0x0d010203
357#define RNDIS_OID_802_11_NETWORK_TYPE_IN_USE 0x0d010204
358#define RNDIS_OID_802_11_TX_POWER_LEVEL 0x0d010205
359#define RNDIS_OID_802_11_RSSI 0x0d010206
360#define RNDIS_OID_802_11_RSSI_TRIGGER 0x0d010207
361#define RNDIS_OID_802_11_FRAGMENTATION_THRESHOLD 0x0d010209
362#define RNDIS_OID_802_11_RTS_THRESHOLD 0x0d01020a
363#define RNDIS_OID_802_11_SUPPORTED_RATES 0x0d01020e
364#define RNDIS_OID_802_11_CONFIGURATION 0x0d010211
365#define RNDIS_OID_802_11_POWER_MODE 0x0d010216
366#define RNDIS_OID_802_11_BSSID_LIST 0x0d010217
367
368/* Plug and Play capabilities */
369#define RNDIS_OID_PNP_CAPABILITIES 0xFD010100
370#define RNDIS_OID_PNP_SET_POWER 0xFD010101
371#define RNDIS_OID_PNP_QUERY_POWER 0xFD010102
372#define RNDIS_OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
373#define RNDIS_OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
374#define RNDIS_OID_PNP_ENABLE_WAKE_UP 0xFD010106
375
376/* RNDIS_PNP_CAPABILITIES.Flags constants */
377#define RNDIS_DEVICE_WAKE_UP_ENABLE 0x00000001
378#define RNDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
379#define RNDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
380
381#define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
382#define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
383#define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
384#define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
385#define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
386
387#define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
388#define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
389#define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
390#define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 577592ea0ea0..2c1de8982c85 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -801,6 +801,10 @@ rtattr_failure:
801 return table; 801 return table;
802} 802}
803 803
804extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
805 struct netlink_callback *cb,
806 struct net_device *dev,
807 int idx);
804#endif /* __KERNEL__ */ 808#endif /* __KERNEL__ */
805 809
806 810
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 111f26b6e28b..0e501714d47f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -117,11 +117,11 @@ struct nf_conntrack {
117 117
118#ifdef CONFIG_BRIDGE_NETFILTER 118#ifdef CONFIG_BRIDGE_NETFILTER
119struct nf_bridge_info { 119struct nf_bridge_info {
120 atomic_t use; 120 atomic_t use;
121 struct net_device *physindev; 121 unsigned int mask;
122 struct net_device *physoutdev; 122 struct net_device *physindev;
123 unsigned int mask; 123 struct net_device *physoutdev;
124 unsigned long data[32 / sizeof(unsigned long)]; 124 unsigned long data[32 / sizeof(unsigned long)];
125}; 125};
126#endif 126#endif
127 127
@@ -470,7 +470,8 @@ struct sk_buff {
470 __u8 wifi_acked_valid:1; 470 __u8 wifi_acked_valid:1;
471 __u8 wifi_acked:1; 471 __u8 wifi_acked:1;
472 __u8 no_fcs:1; 472 __u8 no_fcs:1;
473 /* 9/11 bit hole (depending on ndisc_nodetype presence) */ 473 __u8 head_frag:1;
474 /* 8/10 bit hole (depending on ndisc_nodetype presence) */
474 kmemcheck_bitfield_end(flags2); 475 kmemcheck_bitfield_end(flags2);
475 476
476#ifdef CONFIG_NET_DMA 477#ifdef CONFIG_NET_DMA
@@ -560,9 +561,15 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
560extern void kfree_skb(struct sk_buff *skb); 561extern void kfree_skb(struct sk_buff *skb);
561extern void consume_skb(struct sk_buff *skb); 562extern void consume_skb(struct sk_buff *skb);
562extern void __kfree_skb(struct sk_buff *skb); 563extern void __kfree_skb(struct sk_buff *skb);
564extern struct kmem_cache *skbuff_head_cache;
565
566extern void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
567extern bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
568 bool *fragstolen, int *delta_truesize);
569
563extern struct sk_buff *__alloc_skb(unsigned int size, 570extern struct sk_buff *__alloc_skb(unsigned int size,
564 gfp_t priority, int fclone, int node); 571 gfp_t priority, int fclone, int node);
565extern struct sk_buff *build_skb(void *data); 572extern struct sk_buff *build_skb(void *data, unsigned int frag_size);
566static inline struct sk_buff *alloc_skb(unsigned int size, 573static inline struct sk_buff *alloc_skb(unsigned int size,
567 gfp_t priority) 574 gfp_t priority)
568{ 575{
@@ -643,11 +650,21 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
643{ 650{
644 return skb->head + skb->end; 651 return skb->head + skb->end;
645} 652}
653
654static inline unsigned int skb_end_offset(const struct sk_buff *skb)
655{
656 return skb->end;
657}
646#else 658#else
647static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) 659static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
648{ 660{
649 return skb->end; 661 return skb->end;
650} 662}
663
664static inline unsigned int skb_end_offset(const struct sk_buff *skb)
665{
666 return skb->end - skb->head;
667}
651#endif 668#endif
652 669
653/* Internal */ 670/* Internal */
@@ -881,10 +898,11 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
881 */ 898 */
882static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_) 899static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
883{ 900{
884 struct sk_buff *list = ((const struct sk_buff *)list_)->next; 901 struct sk_buff *skb = list_->next;
885 if (list == (struct sk_buff *)list_) 902
886 list = NULL; 903 if (skb == (struct sk_buff *)list_)
887 return list; 904 skb = NULL;
905 return skb;
888} 906}
889 907
890/** 908/**
@@ -900,6 +918,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
900 const struct sk_buff_head *list_) 918 const struct sk_buff_head *list_)
901{ 919{
902 struct sk_buff *next = skb->next; 920 struct sk_buff *next = skb->next;
921
903 if (next == (struct sk_buff *)list_) 922 if (next == (struct sk_buff *)list_)
904 next = NULL; 923 next = NULL;
905 return next; 924 return next;
@@ -920,10 +939,12 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
920 */ 939 */
921static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_) 940static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_)
922{ 941{
923 struct sk_buff *list = ((const struct sk_buff *)list_)->prev; 942 struct sk_buff *skb = list_->prev;
924 if (list == (struct sk_buff *)list_) 943
925 list = NULL; 944 if (skb == (struct sk_buff *)list_)
926 return list; 945 skb = NULL;
946 return skb;
947
927} 948}
928 949
929/** 950/**
@@ -1664,31 +1685,11 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1664 kfree_skb(skb); 1685 kfree_skb(skb);
1665} 1686}
1666 1687
1667/** 1688extern void *netdev_alloc_frag(unsigned int fragsz);
1668 * __dev_alloc_skb - allocate an skbuff for receiving
1669 * @length: length to allocate
1670 * @gfp_mask: get_free_pages mask, passed to alloc_skb
1671 *
1672 * Allocate a new &sk_buff and assign it a usage count of one. The
1673 * buffer has unspecified headroom built in. Users should allocate
1674 * the headroom they think they need without accounting for the
1675 * built in space. The built in space is used for optimisations.
1676 *
1677 * %NULL is returned if there is no free memory.
1678 */
1679static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1680 gfp_t gfp_mask)
1681{
1682 struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
1683 if (likely(skb))
1684 skb_reserve(skb, NET_SKB_PAD);
1685 return skb;
1686}
1687
1688extern struct sk_buff *dev_alloc_skb(unsigned int length);
1689 1689
1690extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1690extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1691 unsigned int length, gfp_t gfp_mask); 1691 unsigned int length,
1692 gfp_t gfp_mask);
1692 1693
1693/** 1694/**
1694 * netdev_alloc_skb - allocate an skbuff for rx on a specific device 1695 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
@@ -1704,11 +1705,25 @@ extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1704 * allocates memory it can be called from an interrupt. 1705 * allocates memory it can be called from an interrupt.
1705 */ 1706 */
1706static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, 1707static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1707 unsigned int length) 1708 unsigned int length)
1708{ 1709{
1709 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1710 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1710} 1711}
1711 1712
1713/* legacy helper around __netdev_alloc_skb() */
1714static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1715 gfp_t gfp_mask)
1716{
1717 return __netdev_alloc_skb(NULL, length, gfp_mask);
1718}
1719
1720/* legacy helper around netdev_alloc_skb() */
1721static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1722{
1723 return netdev_alloc_skb(NULL, length);
1724}
1725
1726
1712static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, 1727static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
1713 unsigned int length, gfp_t gfp) 1728 unsigned int length, gfp_t gfp)
1714{ 1729{
@@ -1963,8 +1978,8 @@ static inline int skb_add_data(struct sk_buff *skb,
1963 return -EFAULT; 1978 return -EFAULT;
1964} 1979}
1965 1980
1966static inline int skb_can_coalesce(struct sk_buff *skb, int i, 1981static inline bool skb_can_coalesce(struct sk_buff *skb, int i,
1967 const struct page *page, int off) 1982 const struct page *page, int off)
1968{ 1983{
1969 if (i) { 1984 if (i) {
1970 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; 1985 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1];
@@ -1972,7 +1987,7 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1972 return page == skb_frag_page(frag) && 1987 return page == skb_frag_page(frag) &&
1973 off == frag->page_offset + skb_frag_size(frag); 1988 off == frag->page_offset + skb_frag_size(frag);
1974 } 1989 }
1975 return 0; 1990 return false;
1976} 1991}
1977 1992
1978static inline int __skb_linearize(struct sk_buff *skb) 1993static inline int __skb_linearize(struct sk_buff *skb)
@@ -2552,7 +2567,7 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
2552 return false; 2567 return false;
2553 2568
2554 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD); 2569 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD);
2555 if (skb_end_pointer(skb) - skb->head < skb_size) 2570 if (skb_end_offset(skb) < skb_size)
2556 return false; 2571 return false;
2557 2572
2558 if (skb_shared(skb) || skb_cloned(skb)) 2573 if (skb_shared(skb) || skb_cloned(skb))
@@ -2560,5 +2575,19 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
2560 2575
2561 return true; 2576 return true;
2562} 2577}
2578
2579/**
2580 * skb_head_is_locked - Determine if the skb->head is locked down
2581 * @skb: skb to check
2582 *
2583 * The head on skbs build around a head frag can be removed if they are
2584 * not cloned. This function returns true if the skb head is locked down
2585 * due to either being allocated via kmalloc, or by being a clone with
2586 * multiple references to the head.
2587 */
2588static inline bool skb_head_is_locked(const struct sk_buff *skb)
2589{
2590 return !skb->head_frag || skb_cloned(skb);
2591}
2563#endif /* __KERNEL__ */ 2592#endif /* __KERNEL__ */
2564#endif /* _LINUX_SKBUFF_H */ 2593#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index 251729a47880..db4bae78bda9 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -32,8 +32,8 @@ struct sock_diag_handler {
32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh); 32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh);
33}; 33};
34 34
35int sock_diag_register(struct sock_diag_handler *h); 35int sock_diag_register(const struct sock_diag_handler *h);
36void sock_diag_unregister(struct sock_diag_handler *h); 36void sock_diag_unregister(const struct sock_diag_handler *h);
37 37
38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b84bbd48b874..25d6322fb635 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -68,13 +68,13 @@ struct msghdr {
68 __kernel_size_t msg_iovlen; /* Number of blocks */ 68 __kernel_size_t msg_iovlen; /* Number of blocks */
69 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 69 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
70 __kernel_size_t msg_controllen; /* Length of cmsg list */ 70 __kernel_size_t msg_controllen; /* Length of cmsg list */
71 unsigned msg_flags; 71 unsigned int msg_flags;
72}; 72};
73 73
74/* For recvmmsg/sendmmsg */ 74/* For recvmmsg/sendmmsg */
75struct mmsghdr { 75struct mmsghdr {
76 struct msghdr msg_hdr; 76 struct msghdr msg_hdr;
77 unsigned msg_len; 77 unsigned int msg_len;
78}; 78};
79 79
80/* 80/*
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 0dddc9e42b6b..b69bdb1e08b6 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -28,6 +28,51 @@
28 28
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30 30
31#define STMMAC_RX_COE_NONE 0
32#define STMMAC_RX_COE_TYPE1 1
33#define STMMAC_RX_COE_TYPE2 2
34
35/* Define the macros for CSR clock range parameters to be passed by
36 * platform code.
37 * This could also be configured at run time using CPU freq framework. */
38
39/* MDC Clock Selection define*/
40#define STMMAC_CSR_60_100M 0x0 /* MDC = clk_scr_i/42 */
41#define STMMAC_CSR_100_150M 0x1 /* MDC = clk_scr_i/62 */
42#define STMMAC_CSR_20_35M 0x2 /* MDC = clk_scr_i/16 */
43#define STMMAC_CSR_35_60M 0x3 /* MDC = clk_scr_i/26 */
44#define STMMAC_CSR_150_250M 0x4 /* MDC = clk_scr_i/102 */
45#define STMMAC_CSR_250_300M 0x5 /* MDC = clk_scr_i/122 */
46
47/* The MDC clock could be set higher than the IEEE 802.3
48 * specified frequency limit 0f 2.5 MHz, by programming a clock divider
49 * of value different than the above defined values. The resultant MDIO
50 * clock frequency of 12.5 MHz is applicable for the interfacing chips
51 * supporting higher MDC clocks.
52 * The MDC clock selection macros need to be defined for MDC clock rate
53 * of 12.5 MHz, corresponding to the following selection.
54 */
55#define STMMAC_CSR_I_4 0x8 /* clk_csr_i/4 */
56#define STMMAC_CSR_I_6 0x9 /* clk_csr_i/6 */
57#define STMMAC_CSR_I_8 0xA /* clk_csr_i/8 */
58#define STMMAC_CSR_I_10 0xB /* clk_csr_i/10 */
59#define STMMAC_CSR_I_12 0xC /* clk_csr_i/12 */
60#define STMMAC_CSR_I_14 0xD /* clk_csr_i/14 */
61#define STMMAC_CSR_I_16 0xE /* clk_csr_i/16 */
62#define STMMAC_CSR_I_18 0xF /* clk_csr_i/18 */
63
64/* AXI DMA Burst length suported */
65#define DMA_AXI_BLEN_4 (1 << 1)
66#define DMA_AXI_BLEN_8 (1 << 2)
67#define DMA_AXI_BLEN_16 (1 << 3)
68#define DMA_AXI_BLEN_32 (1 << 4)
69#define DMA_AXI_BLEN_64 (1 << 5)
70#define DMA_AXI_BLEN_128 (1 << 6)
71#define DMA_AXI_BLEN_256 (1 << 7)
72#define DMA_AXI_BLEN_ALL (DMA_AXI_BLEN_4 | DMA_AXI_BLEN_8 | DMA_AXI_BLEN_16 \
73 | DMA_AXI_BLEN_32 | DMA_AXI_BLEN_64 \
74 | DMA_AXI_BLEN_128 | DMA_AXI_BLEN_256)
75
31/* Platfrom data for platform device structure's platform_data field */ 76/* Platfrom data for platform device structure's platform_data field */
32 77
33struct stmmac_mdio_bus_data { 78struct stmmac_mdio_bus_data {
@@ -38,16 +83,25 @@ struct stmmac_mdio_bus_data {
38 int probed_phy_irq; 83 int probed_phy_irq;
39}; 84};
40 85
86struct stmmac_dma_cfg {
87 int pbl;
88 int fixed_burst;
89 int mixed_burst;
90 int burst_len;
91};
92
41struct plat_stmmacenet_data { 93struct plat_stmmacenet_data {
94 char *phy_bus_name;
42 int bus_id; 95 int bus_id;
43 int phy_addr; 96 int phy_addr;
44 int interface; 97 int interface;
45 struct stmmac_mdio_bus_data *mdio_bus_data; 98 struct stmmac_mdio_bus_data *mdio_bus_data;
46 int pbl; 99 struct stmmac_dma_cfg *dma_cfg;
47 int clk_csr; 100 int clk_csr;
48 int has_gmac; 101 int has_gmac;
49 int enh_desc; 102 int enh_desc;
50 int tx_coe; 103 int tx_coe;
104 int rx_coe;
51 int bugged_jumbo; 105 int bugged_jumbo;
52 int pmt; 106 int pmt;
53 int force_sf_dma_mode; 107 int force_sf_dma_mode;
@@ -56,6 +110,7 @@ struct plat_stmmacenet_data {
56 int (*init)(struct platform_device *pdev); 110 int (*init)(struct platform_device *pdev);
57 void (*exit)(struct platform_device *pdev); 111 void (*exit)(struct platform_device *pdev);
58 void *custom_cfg; 112 void *custom_cfg;
113 void *custom_data;
59 void *bsp_priv; 114 void *bsp_priv;
60}; 115};
61#endif 116#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index b6c62d294380..d9b42c5be088 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -106,6 +106,22 @@ enum {
106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ 106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ 107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ 108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
109#define TCP_REPAIR 19 /* TCP sock is under repair right now */
110#define TCP_REPAIR_QUEUE 20
111#define TCP_QUEUE_SEQ 21
112#define TCP_REPAIR_OPTIONS 22
113
114struct tcp_repair_opt {
115 __u32 opt_code;
116 __u32 opt_val;
117};
118
119enum {
120 TCP_NO_QUEUE,
121 TCP_RECV_QUEUE,
122 TCP_SEND_QUEUE,
123 TCP_QUEUES_NR,
124};
109 125
110/* for TCP_INFO socket option */ 126/* for TCP_INFO socket option */
111#define TCPI_OPT_TIMESTAMPS 1 127#define TCPI_OPT_TIMESTAMPS 1
@@ -353,7 +369,11 @@ struct tcp_sock {
353 u8 nonagle : 4,/* Disable Nagle algorithm? */ 369 u8 nonagle : 4,/* Disable Nagle algorithm? */
354 thin_lto : 1,/* Use linear timeouts for thin streams */ 370 thin_lto : 1,/* Use linear timeouts for thin streams */
355 thin_dupack : 1,/* Fast retransmit on first dupack */ 371 thin_dupack : 1,/* Fast retransmit on first dupack */
356 unused : 2; 372 repair : 1,
373 unused : 1;
374 u8 repair_queue;
375 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
376 early_retrans_delayed:1; /* Delayed ER timer installed */
357 377
358/* RTT measurement */ 378/* RTT measurement */
359 u32 srtt; /* smoothed round trip time << 3 */ 379 u32 srtt; /* smoothed round trip time << 3 */
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h
deleted file mode 100644
index bfc84a7aecc5..000000000000
--- a/include/linux/trdevice.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. NET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the Token-ring handlers.
7 *
8 * Version: @(#)eth.h 1.0.4 05/13/93
9 *
10 * Authors: Ross Biro
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * Relocated to include/linux where it belongs by Alan Cox
14 * <gw4pts@gw4pts.ampr.org>
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 *
21 * WARNING: This move may well be temporary. This file will get merged with others RSN.
22 *
23 */
24#ifndef _LINUX_TRDEVICE_H
25#define _LINUX_TRDEVICE_H
26
27
28#include <linux/if_tr.h>
29
30#ifdef __KERNEL__
31extern __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev);
32extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev);
33extern struct net_device *alloc_trdev(int sizeof_priv);
34
35#endif
36
37#endif /* _LINUX_TRDEVICE_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 88fceb718c77..d44ef85db177 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -20,6 +20,8 @@
20#ifndef __LINUX_USB_RNDIS_HOST_H 20#ifndef __LINUX_USB_RNDIS_HOST_H
21#define __LINUX_USB_RNDIS_HOST_H 21#define __LINUX_USB_RNDIS_HOST_H
22 22
23#include <linux/rndis.h>
24
23/* 25/*
24 * CONTROL uses CDC "encapsulated commands" with funky notifications. 26 * CONTROL uses CDC "encapsulated commands" with funky notifications.
25 * - control-out: SEND_ENCAPSULATED 27 * - control-out: SEND_ENCAPSULATED
@@ -49,47 +51,6 @@ struct rndis_msg_hdr {
49 */ 51 */
50#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000) 52#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
51 53
52#define RNDIS_MSG_COMPLETION cpu_to_le32(0x80000000)
53
54/* codes for "msg_type" field of rndis messages;
55 * only the data channel uses packet messages (maybe batched);
56 * everything else goes on the control channel.
57 */
58#define RNDIS_MSG_PACKET cpu_to_le32(0x00000001) /* 1-N packets */
59#define RNDIS_MSG_INIT cpu_to_le32(0x00000002)
60#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
61#define RNDIS_MSG_HALT cpu_to_le32(0x00000003)
62#define RNDIS_MSG_QUERY cpu_to_le32(0x00000004)
63#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
64#define RNDIS_MSG_SET cpu_to_le32(0x00000005)
65#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
66#define RNDIS_MSG_RESET cpu_to_le32(0x00000006)
67#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
68#define RNDIS_MSG_INDICATE cpu_to_le32(0x00000007)
69#define RNDIS_MSG_KEEPALIVE cpu_to_le32(0x00000008)
70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
71
72/* codes for "status" field of completion messages */
73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000)
74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001)
75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015)
76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb)
77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b)
78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c)
79#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION cpu_to_le32(0x40010012)
80
81/* codes for OID_GEN_PHYSICAL_MEDIUM */
82#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000)
83#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN cpu_to_le32(0x00000001)
84#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM cpu_to_le32(0x00000002)
85#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE cpu_to_le32(0x00000003)
86#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE cpu_to_le32(0x00000004)
87#define RNDIS_PHYSICAL_MEDIUM_DSL cpu_to_le32(0x00000005)
88#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL cpu_to_le32(0x00000006)
89#define RNDIS_PHYSICAL_MEDIUM_1394 cpu_to_le32(0x00000007)
90#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN cpu_to_le32(0x00000008)
91#define RNDIS_PHYSICAL_MEDIUM_MAX cpu_to_le32(0x00000009)
92
93struct rndis_data_hdr { 54struct rndis_data_hdr {
94 __le32 msg_type; /* RNDIS_MSG_PACKET */ 55 __le32 msg_type; /* RNDIS_MSG_PACKET */
95 __le32 msg_len; /* rndis_data_hdr + data_len + pad */ 56 __le32 msg_len; /* rndis_data_hdr + data_len + pad */
@@ -222,29 +183,6 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */
222 __le32 status; 183 __le32 status;
223} __attribute__ ((packed)); 184} __attribute__ ((packed));
224 185
225/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
226 * there are gobs more that may optionally be supported. We'll avoid as much
227 * of that mess as possible.
228 */
229#define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101)
230#define OID_GEN_MAXIMUM_FRAME_SIZE cpu_to_le32(0x00010106)
231#define OID_GEN_CURRENT_PACKET_FILTER cpu_to_le32(0x0001010e)
232#define OID_GEN_PHYSICAL_MEDIUM cpu_to_le32(0x00010202)
233
234/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
235#define RNDIS_PACKET_TYPE_DIRECTED cpu_to_le32(0x00000001)
236#define RNDIS_PACKET_TYPE_MULTICAST cpu_to_le32(0x00000002)
237#define RNDIS_PACKET_TYPE_ALL_MULTICAST cpu_to_le32(0x00000004)
238#define RNDIS_PACKET_TYPE_BROADCAST cpu_to_le32(0x00000008)
239#define RNDIS_PACKET_TYPE_SOURCE_ROUTING cpu_to_le32(0x00000010)
240#define RNDIS_PACKET_TYPE_PROMISCUOUS cpu_to_le32(0x00000020)
241#define RNDIS_PACKET_TYPE_SMT cpu_to_le32(0x00000040)
242#define RNDIS_PACKET_TYPE_ALL_LOCAL cpu_to_le32(0x00000080)
243#define RNDIS_PACKET_TYPE_GROUP cpu_to_le32(0x00001000)
244#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL cpu_to_le32(0x00002000)
245#define RNDIS_PACKET_TYPE_FUNCTIONAL cpu_to_le32(0x00004000)
246#define RNDIS_PACKET_TYPE_MAC_FRAME cpu_to_le32(0x00008000)
247
248/* default filter used with RNDIS devices */ 186/* default filter used with RNDIS devices */
249#define RNDIS_DEFAULT_FILTER ( \ 187#define RNDIS_DEFAULT_FILTER ( \
250 RNDIS_PACKET_TYPE_DIRECTED | \ 188 RNDIS_PACKET_TYPE_DIRECTED | \
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 605b0aa8d852..76f439647c4b 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -191,7 +191,8 @@ extern void usbnet_cdc_status(struct usbnet *, struct urb *);
191enum skb_state { 191enum skb_state {
192 illegal = 0, 192 illegal = 0,
193 tx_start, tx_done, 193 tx_start, tx_done,
194 rx_start, rx_done, rx_cleanup 194 rx_start, rx_done, rx_cleanup,
195 unlink_start
195}; 196};
196 197
197struct skb_data { /* skb->cb is one of these */ 198struct skb_data { /* skb->cb is one of these */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 970d5a2a9047..2470f541af50 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -49,8 +49,11 @@
49#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ 49#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */
50#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ 50#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */
51#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ 51#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */
52#define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the
53 * network */
52 54
53#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ 55#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
56#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
54 57
55struct virtio_net_config { 58struct virtio_net_config {
56 /* The config defining mac address (if VIRTIO_NET_F_MAC) */ 59 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
@@ -152,4 +155,15 @@ struct virtio_net_ctrl_mac {
152 #define VIRTIO_NET_CTRL_VLAN_ADD 0 155 #define VIRTIO_NET_CTRL_VLAN_ADD 0
153 #define VIRTIO_NET_CTRL_VLAN_DEL 1 156 #define VIRTIO_NET_CTRL_VLAN_DEL 1
154 157
158/*
159 * Control link announce acknowledgement
160 *
161 * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that
162 * driver has recevied the notification; device would clear the
163 * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives
164 * this command.
165 */
166#define VIRTIO_NET_CTRL_ANNOUNCE 3
167 #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
168
155#endif /* _LINUX_VIRTIO_NET_H */ 169#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index b5c2b6cb0d81..cad374bdcf4b 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -59,7 +59,8 @@ struct soc_camera_device {
59struct soc_camera_host { 59struct soc_camera_host {
60 struct v4l2_device v4l2_dev; 60 struct v4l2_device v4l2_dev;
61 struct list_head list; 61 struct list_head list;
62 unsigned char nr; /* Host number */ 62 struct mutex host_lock; /* Protect during probing */
63 unsigned char nr; /* Host number */
63 void *priv; 64 void *priv;
64 const char *drv_name; 65 const char *drv_name;
65 struct soc_camera_host_ops *ops; 66 struct soc_camera_host_ops *ops;
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 757a17638b1b..f2b801c4b555 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -92,7 +92,7 @@ extern void addrconf_leave_solict(struct inet6_dev *idev,
92 const struct in6_addr *addr); 92 const struct in6_addr *addr);
93 93
94static inline unsigned long addrconf_timeout_fixup(u32 timeout, 94static inline unsigned long addrconf_timeout_fixup(u32 timeout,
95 unsigned unit) 95 unsigned int unit)
96{ 96{
97 if (timeout == 0xffffffff) 97 if (timeout == 0xffffffff)
98 return ~0UL; 98 return ~0UL;
@@ -131,9 +131,9 @@ extern int ipv6_sock_mc_join(struct sock *sk, int ifindex,
131extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, 131extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex,
132 const struct in6_addr *addr); 132 const struct in6_addr *addr);
133extern void ipv6_sock_mc_close(struct sock *sk); 133extern void ipv6_sock_mc_close(struct sock *sk);
134extern int inet6_mc_check(struct sock *sk, 134extern bool inet6_mc_check(struct sock *sk,
135 const struct in6_addr *mc_addr, 135 const struct in6_addr *mc_addr,
136 const struct in6_addr *src_addr); 136 const struct in6_addr *src_addr);
137 137
138extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr); 138extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr);
139extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr); 139extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr);
@@ -146,10 +146,10 @@ extern void ipv6_mc_init_dev(struct inet6_dev *idev);
146extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); 146extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
147extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); 147extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
148 148
149extern int ipv6_chk_mcast_addr(struct net_device *dev, 149extern bool ipv6_chk_mcast_addr(struct net_device *dev,
150 const struct in6_addr *group, 150 const struct in6_addr *group,
151 const struct in6_addr *src_addr); 151 const struct in6_addr *src_addr);
152extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); 152extern bool ipv6_is_mld(struct sk_buff *skb, int nexthdr);
153 153
154extern void addrconf_prefix_rcv(struct net_device *dev, 154extern void addrconf_prefix_rcv(struct net_device *dev,
155 u8 *opt, int len, bool sllao); 155 u8 *opt, int len, bool sllao);
@@ -163,8 +163,8 @@ extern void ipv6_sock_ac_close(struct sock *sk);
163 163
164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); 164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); 165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
166extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, 166extern bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
167 const struct in6_addr *addr); 167 const struct in6_addr *addr);
168 168
169 169
170/* Device notifier */ 170/* Device notifier */
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index ca68e2cef230..2ee33da36a7a 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -22,7 +22,7 @@ extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
22struct unix_address { 22struct unix_address {
23 atomic_t refcnt; 23 atomic_t refcnt;
24 int len; 24 int len;
25 unsigned hash; 25 unsigned int hash;
26 struct sockaddr_un name[0]; 26 struct sockaddr_un name[0];
27}; 27};
28 28
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 94e09d361bb1..5d2352154cf6 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -215,7 +215,7 @@ typedef struct ax25_dev {
215 struct ax25_dev *next; 215 struct ax25_dev *next;
216 struct net_device *dev; 216 struct net_device *dev;
217 struct net_device *forward; 217 struct net_device *forward;
218 struct ctl_table *systable; 218 struct ctl_table_header *sysheader;
219 int values[AX25_MAX_VALUES]; 219 int values[AX25_MAX_VALUES];
220#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER) 220#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
221 ax25_dama_info dama; 221 ax25_dama_info dama;
@@ -441,11 +441,11 @@ extern void ax25_uid_free(void);
441 441
442/* sysctl_net_ax25.c */ 442/* sysctl_net_ax25.c */
443#ifdef CONFIG_SYSCTL 443#ifdef CONFIG_SYSCTL
444extern void ax25_register_sysctl(void); 444extern int ax25_register_dev_sysctl(ax25_dev *ax25_dev);
445extern void ax25_unregister_sysctl(void); 445extern void ax25_unregister_dev_sysctl(ax25_dev *ax25_dev);
446#else 446#else
447static inline void ax25_register_sysctl(void) {}; 447static inline int ax25_register_dev_sysctl(ax25_dev *ax25_dev) { return 0; }
448static inline void ax25_unregister_sysctl(void) {}; 448static inline void ax25_unregister_dev_sysctl(ax25_dev *ax25_dev) {}
449#endif /* CONFIG_SYSCTL */ 449#endif /* CONFIG_SYSCTL */
450 450
451#endif 451#endif
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 262ebd1747d4..a65910bda381 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -191,6 +191,7 @@ struct bt_sock {
191 struct list_head accept_q; 191 struct list_head accept_q;
192 struct sock *parent; 192 struct sock *parent;
193 u32 defer_setup; 193 u32 defer_setup;
194 bool suspended;
194}; 195};
195 196
196struct bt_sock_list { 197struct bt_sock_list {
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 6db8ecf52aa2..439dadc8102f 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -123,12 +123,21 @@ struct cfhsi_rx_state {
123 bool piggy_desc; 123 bool piggy_desc;
124}; 124};
125 125
126/* Priority mapping */
127enum {
128 CFHSI_PRIO_CTL = 0,
129 CFHSI_PRIO_VI,
130 CFHSI_PRIO_VO,
131 CFHSI_PRIO_BEBK,
132 CFHSI_PRIO_LAST,
133};
134
126/* Structure implemented by CAIF HSI drivers. */ 135/* Structure implemented by CAIF HSI drivers. */
127struct cfhsi { 136struct cfhsi {
128 struct caif_dev_common cfdev; 137 struct caif_dev_common cfdev;
129 struct net_device *ndev; 138 struct net_device *ndev;
130 struct platform_device *pdev; 139 struct platform_device *pdev;
131 struct sk_buff_head qhead; 140 struct sk_buff_head qhead[CFHSI_PRIO_LAST];
132 struct cfhsi_drv drv; 141 struct cfhsi_drv drv;
133 struct cfhsi_dev *dev; 142 struct cfhsi_dev *dev;
134 int tx_state; 143 int tx_state;
@@ -151,8 +160,14 @@ struct cfhsi {
151 wait_queue_head_t wake_up_wait; 160 wait_queue_head_t wake_up_wait;
152 wait_queue_head_t wake_down_wait; 161 wait_queue_head_t wake_down_wait;
153 wait_queue_head_t flush_fifo_wait; 162 wait_queue_head_t flush_fifo_wait;
154 struct timer_list timer; 163 struct timer_list inactivity_timer;
155 struct timer_list rx_slowpath_timer; 164 struct timer_list rx_slowpath_timer;
165
166 /* TX aggregation */
167 unsigned long aggregation_timeout;
168 int aggregation_len;
169 struct timer_list aggregation_timer;
170
156 unsigned long bits; 171 unsigned long bits;
157}; 172};
158 173
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
index 6bd200a4754a..83a89ba3005b 100644
--- a/include/net/caif/cfpkt.h
+++ b/include/net/caif/cfpkt.h
@@ -188,11 +188,18 @@ struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt);
188 */ 188 */
189void *cfpkt_tonative(struct cfpkt *pkt); 189void *cfpkt_tonative(struct cfpkt *pkt);
190 190
191
192/* 191/*
193 * Returns packet information for a packet. 192 * Returns packet information for a packet.
194 * pkt Packet to get info from; 193 * pkt Packet to get info from;
195 * @return Packet information 194 * @return Packet information
196 */ 195 */
197struct caif_payload_info *cfpkt_info(struct cfpkt *pkt); 196struct caif_payload_info *cfpkt_info(struct cfpkt *pkt);
197
198/** cfpkt_set_prio - set priority for a CAIF packet.
199 *
200 * @pkt: The CAIF packet to be adjusted.
201 * @prio: one of TC_PRIO_ constants.
202 */
203void cfpkt_set_prio(struct cfpkt *pkt, int prio);
204
198#endif /* CFPKT_H_ */ 205#endif /* CFPKT_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 83d800c31e3c..adb2320bccdf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -521,6 +521,7 @@ struct station_parameters {
521 * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 521 * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
522 * @STATION_INFO_STA_FLAGS: @sta_flags filled 522 * @STATION_INFO_STA_FLAGS: @sta_flags filled
523 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 523 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
524 * @STATION_INFO_T_OFFSET: @t_offset filled
524 */ 525 */
525enum station_info_flags { 526enum station_info_flags {
526 STATION_INFO_INACTIVE_TIME = 1<<0, 527 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -542,7 +543,8 @@ enum station_info_flags {
542 STATION_INFO_CONNECTED_TIME = 1<<16, 543 STATION_INFO_CONNECTED_TIME = 1<<16,
543 STATION_INFO_ASSOC_REQ_IES = 1<<17, 544 STATION_INFO_ASSOC_REQ_IES = 1<<17,
544 STATION_INFO_STA_FLAGS = 1<<18, 545 STATION_INFO_STA_FLAGS = 1<<18,
545 STATION_INFO_BEACON_LOSS_COUNT = 1<<19 546 STATION_INFO_BEACON_LOSS_COUNT = 1<<19,
547 STATION_INFO_T_OFFSET = 1<<20,
546}; 548};
547 549
548/** 550/**
@@ -643,6 +645,7 @@ struct sta_bss_parameters {
643 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 645 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
644 * @sta_flags: station flags mask & values 646 * @sta_flags: station flags mask & values
645 * @beacon_loss_count: Number of times beacon loss event has triggered. 647 * @beacon_loss_count: Number of times beacon loss event has triggered.
648 * @t_offset: Time offset of the station relative to this host.
646 */ 649 */
647struct station_info { 650struct station_info {
648 u32 filled; 651 u32 filled;
@@ -671,6 +674,7 @@ struct station_info {
671 size_t assoc_req_ies_len; 674 size_t assoc_req_ies_len;
672 675
673 u32 beacon_loss_count; 676 u32 beacon_loss_count;
677 s64 t_offset;
674 678
675 /* 679 /*
676 * Note: Add a new enum station_info_flags value for each new field and 680 * Note: Add a new enum station_info_flags value for each new field and
@@ -798,6 +802,8 @@ struct mesh_config {
798 /* ttl used in path selection information elements */ 802 /* ttl used in path selection information elements */
799 u8 element_ttl; 803 u8 element_ttl;
800 bool auto_open_plinks; 804 bool auto_open_plinks;
805 /* neighbor offset synchronization */
806 u32 dot11MeshNbrOffsetMaxNeighbor;
801 /* HWMP parameters */ 807 /* HWMP parameters */
802 u8 dot11MeshHWMPmaxPREQretries; 808 u8 dot11MeshHWMPmaxPREQretries;
803 u32 path_refresh_time; 809 u32 path_refresh_time;
@@ -815,12 +821,14 @@ struct mesh_config {
815 bool dot11MeshGateAnnouncementProtocol; 821 bool dot11MeshGateAnnouncementProtocol;
816 bool dot11MeshForwarding; 822 bool dot11MeshForwarding;
817 s32 rssi_threshold; 823 s32 rssi_threshold;
824 u16 ht_opmode;
818}; 825};
819 826
820/** 827/**
821 * struct mesh_setup - 802.11s mesh setup configuration 828 * struct mesh_setup - 802.11s mesh setup configuration
822 * @mesh_id: the mesh ID 829 * @mesh_id: the mesh ID
823 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 830 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
831 * @sync_method: which synchronization method to use
824 * @path_sel_proto: which path selection protocol to use 832 * @path_sel_proto: which path selection protocol to use
825 * @path_metric: which metric to use 833 * @path_metric: which metric to use
826 * @ie: vendor information elements (optional) 834 * @ie: vendor information elements (optional)
@@ -834,8 +842,9 @@ struct mesh_config {
834struct mesh_setup { 842struct mesh_setup {
835 const u8 *mesh_id; 843 const u8 *mesh_id;
836 u8 mesh_id_len; 844 u8 mesh_id_len;
837 u8 path_sel_proto; 845 u8 sync_method;
838 u8 path_metric; 846 u8 path_sel_proto;
847 u8 path_metric;
839 const u8 *ie; 848 const u8 *ie;
840 u8 ie_len; 849 u8 ie_len;
841 bool is_authenticated; 850 bool is_authenticated;
@@ -845,7 +854,7 @@ struct mesh_setup {
845 854
846/** 855/**
847 * struct ieee80211_txq_params - TX queue parameters 856 * struct ieee80211_txq_params - TX queue parameters
848 * @queue: TX queue identifier (NL80211_TXQ_Q_*) 857 * @ac: AC identifier
849 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 858 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
850 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 859 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
851 * 1..32767] 860 * 1..32767]
@@ -854,7 +863,7 @@ struct mesh_setup {
854 * @aifs: Arbitration interframe space [0..255] 863 * @aifs: Arbitration interframe space [0..255]
855 */ 864 */
856struct ieee80211_txq_params { 865struct ieee80211_txq_params {
857 enum nl80211_txq_q queue; 866 enum nl80211_ac ac;
858 u16 txop; 867 u16 txop;
859 u16 cwmin; 868 u16 cwmin;
860 u16 cwmax; 869 u16 cwmax;
@@ -1336,6 +1345,9 @@ struct cfg80211_gtk_rekey_data {
1336 * be %NULL or contain the enabled Wake-on-Wireless triggers that are 1345 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
1337 * configured for the device. 1346 * configured for the device.
1338 * @resume: wiphy device needs to be resumed 1347 * @resume: wiphy device needs to be resumed
1348 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
1349 * to call device_set_wakeup_enable() to enable/disable wakeup from
1350 * the device.
1339 * 1351 *
1340 * @add_virtual_intf: create a new virtual interface with the given name, 1352 * @add_virtual_intf: create a new virtual interface with the given name,
1341 * must set the struct wireless_dev's iftype. Beware: You must create 1353 * must set the struct wireless_dev's iftype. Beware: You must create
@@ -1503,10 +1515,21 @@ struct cfg80211_gtk_rekey_data {
1503 * later passes to cfg80211_probe_status(). 1515 * later passes to cfg80211_probe_status().
1504 * 1516 *
1505 * @set_noack_map: Set the NoAck Map for the TIDs. 1517 * @set_noack_map: Set the NoAck Map for the TIDs.
1518 *
1519 * @get_et_sset_count: Ethtool API to get string-set count.
1520 * See @ethtool_ops.get_sset_count
1521 *
1522 * @get_et_stats: Ethtool API to get a set of u64 stats.
1523 * See @ethtool_ops.get_ethtool_stats
1524 *
1525 * @get_et_strings: Ethtool API to get a set of strings to describe stats
1526 * and perhaps other supported types of ethtool data-sets.
1527 * See @ethtool_ops.get_strings
1506 */ 1528 */
1507struct cfg80211_ops { 1529struct cfg80211_ops {
1508 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 1530 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
1509 int (*resume)(struct wiphy *wiphy); 1531 int (*resume)(struct wiphy *wiphy);
1532 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
1510 1533
1511 struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, 1534 struct net_device * (*add_virtual_intf)(struct wiphy *wiphy,
1512 char *name, 1535 char *name,
@@ -1698,7 +1721,15 @@ struct cfg80211_ops {
1698 struct net_device *dev, 1721 struct net_device *dev,
1699 u16 noack_map); 1722 u16 noack_map);
1700 1723
1701 struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy); 1724 struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy,
1725 enum nl80211_channel_type *type);
1726
1727 int (*get_et_sset_count)(struct wiphy *wiphy,
1728 struct net_device *dev, int sset);
1729 void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
1730 struct ethtool_stats *stats, u64 *data);
1731 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
1732 u32 sset, u8 *data);
1702}; 1733};
1703 1734
1704/* 1735/*
@@ -1732,10 +1763,6 @@ struct cfg80211_ops {
1732 * hints read the documenation for regulatory_hint_found_beacon() 1763 * hints read the documenation for regulatory_hint_found_beacon()
1733 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 1764 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
1734 * wiphy at all 1765 * wiphy at all
1735 * @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface
1736 * combinations for this device. This flag is used for backward
1737 * compatibility only until all drivers advertise combinations and
1738 * they will always be enforced.
1739 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 1766 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
1740 * by default -- this flag will be set depending on the kernel's default 1767 * by default -- this flag will be set depending on the kernel's default
1741 * on wiphy_new(), but can be changed by the driver if it has a good 1768 * on wiphy_new(), but can be changed by the driver if it has a good
@@ -1780,7 +1807,7 @@ enum wiphy_flags {
1780 WIPHY_FLAG_IBSS_RSN = BIT(8), 1807 WIPHY_FLAG_IBSS_RSN = BIT(8),
1781 WIPHY_FLAG_MESH_AUTH = BIT(10), 1808 WIPHY_FLAG_MESH_AUTH = BIT(10),
1782 WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 1809 WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11),
1783 WIPHY_FLAG_ENFORCE_COMBINATIONS = BIT(12), 1810 /* use hole at 12 */
1784 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 1811 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
1785 WIPHY_FLAG_AP_UAPSD = BIT(14), 1812 WIPHY_FLAG_AP_UAPSD = BIT(14),
1786 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 1813 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
@@ -3343,6 +3370,17 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3343 enum nl80211_channel_type channel_type); 3370 enum nl80211_channel_type channel_type);
3344 3371
3345/* 3372/*
3373 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
3374 * @dev: the device which switched channels
3375 * @freq: new channel frequency (in MHz)
3376 * @type: channel type
3377 *
3378 * Acquires wdev_lock, so must only be called from sleepable driver context!
3379 */
3380void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
3381 enum nl80211_channel_type type);
3382
3383/*
3346 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 3384 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
3347 * @rate: given rate_info to calculate bitrate from 3385 * @rate: given rate_info to calculate bitrate from
3348 * 3386 *
diff --git a/include/net/codel.h b/include/net/codel.h
new file mode 100644
index 000000000000..550debfc2403
--- /dev/null
+++ b/include/net/codel.h
@@ -0,0 +1,342 @@
1#ifndef __NET_SCHED_CODEL_H
2#define __NET_SCHED_CODEL_H
3
4/*
5 * Codel - The Controlled-Delay Active Queue Management algorithm
6 *
7 * Copyright (C) 2011-2012 Kathleen Nichols <nichols@pollere.com>
8 * Copyright (C) 2011-2012 Van Jacobson <van@pollere.net>
9 * Copyright (C) 2012 Michael D. Taht <dave.taht@bufferbloat.net>
10 * Copyright (C) 2012 Eric Dumazet <edumazet@google.com>
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. The names of the authors may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
23 *
24 * Alternatively, provided that this notice is retained in full, this
25 * software may be distributed under the terms of the GNU General
26 * Public License ("GPL") version 2, in which case the provisions of the
27 * GPL apply INSTEAD OF those given above.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
40 * DAMAGE.
41 *
42 */
43
44#include <linux/types.h>
45#include <linux/ktime.h>
46#include <linux/skbuff.h>
47#include <net/pkt_sched.h>
48#include <net/inet_ecn.h>
49#include <linux/reciprocal_div.h>
50
51/* Controlling Queue Delay (CoDel) algorithm
52 * =========================================
53 * Source : Kathleen Nichols and Van Jacobson
54 * http://queue.acm.org/detail.cfm?id=2209336
55 *
56 * Implemented on linux by Dave Taht and Eric Dumazet
57 */
58
59
60/* CoDel uses a 1024 nsec clock, encoded in u32
61 * This gives a range of 2199 seconds, because of signed compares
62 */
63typedef u32 codel_time_t;
64typedef s32 codel_tdiff_t;
65#define CODEL_SHIFT 10
66#define MS2TIME(a) ((a * NSEC_PER_MSEC) >> CODEL_SHIFT)
67
68static inline codel_time_t codel_get_time(void)
69{
70 u64 ns = ktime_to_ns(ktime_get());
71
72 return ns >> CODEL_SHIFT;
73}
74
75#define codel_time_after(a, b) ((s32)(a) - (s32)(b) > 0)
76#define codel_time_after_eq(a, b) ((s32)(a) - (s32)(b) >= 0)
77#define codel_time_before(a, b) ((s32)(a) - (s32)(b) < 0)
78#define codel_time_before_eq(a, b) ((s32)(a) - (s32)(b) <= 0)
79
80/* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */
81struct codel_skb_cb {
82 codel_time_t enqueue_time;
83};
84
85static struct codel_skb_cb *get_codel_cb(const struct sk_buff *skb)
86{
87 qdisc_cb_private_validate(skb, sizeof(struct codel_skb_cb));
88 return (struct codel_skb_cb *)qdisc_skb_cb(skb)->data;
89}
90
91static codel_time_t codel_get_enqueue_time(const struct sk_buff *skb)
92{
93 return get_codel_cb(skb)->enqueue_time;
94}
95
96static void codel_set_enqueue_time(struct sk_buff *skb)
97{
98 get_codel_cb(skb)->enqueue_time = codel_get_time();
99}
100
101static inline u32 codel_time_to_us(codel_time_t val)
102{
103 u64 valns = ((u64)val << CODEL_SHIFT);
104
105 do_div(valns, NSEC_PER_USEC);
106 return (u32)valns;
107}
108
109/**
110 * struct codel_params - contains codel parameters
111 * @target: target queue size (in time units)
112 * @interval: width of moving time window
113 * @ecn: is Explicit Congestion Notification enabled
114 */
115struct codel_params {
116 codel_time_t target;
117 codel_time_t interval;
118 bool ecn;
119};
120
121/**
122 * struct codel_vars - contains codel variables
123 * @count: how many drops we've done since the last time we
124 * entered dropping state
125 * @lastcount: count at entry to dropping state
126 * @dropping: set to true if in dropping state
127 * @rec_inv_sqrt: reciprocal value of sqrt(count) >> 1
128 * @first_above_time: when we went (or will go) continuously above target
129 * for interval
130 * @drop_next: time to drop next packet, or when we dropped last
131 * @ldelay: sojourn time of last dequeued packet
132 */
133struct codel_vars {
134 u32 count;
135 u32 lastcount;
136 bool dropping;
137 u16 rec_inv_sqrt;
138 codel_time_t first_above_time;
139 codel_time_t drop_next;
140 codel_time_t ldelay;
141};
142
143#define REC_INV_SQRT_BITS (8 * sizeof(u16)) /* or sizeof_in_bits(rec_inv_sqrt) */
144/* needed shift to get a Q0.32 number from rec_inv_sqrt */
145#define REC_INV_SQRT_SHIFT (32 - REC_INV_SQRT_BITS)
146
147/**
148 * struct codel_stats - contains codel shared variables and stats
149 * @maxpacket: largest packet we've seen so far
150 * @drop_count: temp count of dropped packets in dequeue()
151 * ecn_mark: number of packets we ECN marked instead of dropping
152 */
153struct codel_stats {
154 u32 maxpacket;
155 u32 drop_count;
156 u32 ecn_mark;
157};
158
159static void codel_params_init(struct codel_params *params)
160{
161 params->interval = MS2TIME(100);
162 params->target = MS2TIME(5);
163 params->ecn = false;
164}
165
166static void codel_vars_init(struct codel_vars *vars)
167{
168 memset(vars, 0, sizeof(*vars));
169}
170
171static void codel_stats_init(struct codel_stats *stats)
172{
173 stats->maxpacket = 256;
174}
175
176/*
177 * http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Iterative_methods_for_reciprocal_square_roots
178 * new_invsqrt = (invsqrt / 2) * (3 - count * invsqrt^2)
179 *
180 * Here, invsqrt is a fixed point number (< 1.0), 32bit mantissa, aka Q0.32
181 */
182static void codel_Newton_step(struct codel_vars *vars)
183{
184 u32 invsqrt = ((u32)vars->rec_inv_sqrt) << REC_INV_SQRT_SHIFT;
185 u32 invsqrt2 = ((u64)invsqrt * invsqrt) >> 32;
186 u64 val = (3LL << 32) - ((u64)vars->count * invsqrt2);
187
188 val >>= 2; /* avoid overflow in following multiply */
189 val = (val * invsqrt) >> (32 - 2 + 1);
190
191 vars->rec_inv_sqrt = val >> REC_INV_SQRT_SHIFT;
192}
193
194/*
195 * CoDel control_law is t + interval/sqrt(count)
196 * We maintain in rec_inv_sqrt the reciprocal value of sqrt(count) to avoid
197 * both sqrt() and divide operation.
198 */
199static codel_time_t codel_control_law(codel_time_t t,
200 codel_time_t interval,
201 u32 rec_inv_sqrt)
202{
203 return t + reciprocal_divide(interval, rec_inv_sqrt << REC_INV_SQRT_SHIFT);
204}
205
206
207static bool codel_should_drop(const struct sk_buff *skb,
208 struct Qdisc *sch,
209 struct codel_vars *vars,
210 struct codel_params *params,
211 struct codel_stats *stats,
212 codel_time_t now)
213{
214 bool ok_to_drop;
215
216 if (!skb) {
217 vars->first_above_time = 0;
218 return false;
219 }
220
221 vars->ldelay = now - codel_get_enqueue_time(skb);
222 sch->qstats.backlog -= qdisc_pkt_len(skb);
223
224 if (unlikely(qdisc_pkt_len(skb) > stats->maxpacket))
225 stats->maxpacket = qdisc_pkt_len(skb);
226
227 if (codel_time_before(vars->ldelay, params->target) ||
228 sch->qstats.backlog <= stats->maxpacket) {
229 /* went below - stay below for at least interval */
230 vars->first_above_time = 0;
231 return false;
232 }
233 ok_to_drop = false;
234 if (vars->first_above_time == 0) {
235 /* just went above from below. If we stay above
236 * for at least interval we'll say it's ok to drop
237 */
238 vars->first_above_time = now + params->interval;
239 } else if (codel_time_after(now, vars->first_above_time)) {
240 ok_to_drop = true;
241 }
242 return ok_to_drop;
243}
244
245typedef struct sk_buff * (*codel_skb_dequeue_t)(struct codel_vars *vars,
246 struct Qdisc *sch);
247
248static struct sk_buff *codel_dequeue(struct Qdisc *sch,
249 struct codel_params *params,
250 struct codel_vars *vars,
251 struct codel_stats *stats,
252 codel_skb_dequeue_t dequeue_func)
253{
254 struct sk_buff *skb = dequeue_func(vars, sch);
255 codel_time_t now;
256 bool drop;
257
258 if (!skb) {
259 vars->dropping = false;
260 return skb;
261 }
262 now = codel_get_time();
263 drop = codel_should_drop(skb, sch, vars, params, stats, now);
264 if (vars->dropping) {
265 if (!drop) {
266 /* sojourn time below target - leave dropping state */
267 vars->dropping = false;
268 } else if (codel_time_after_eq(now, vars->drop_next)) {
269 /* It's time for the next drop. Drop the current
270 * packet and dequeue the next. The dequeue might
271 * take us out of dropping state.
272 * If not, schedule the next drop.
273 * A large backlog might result in drop rates so high
274 * that the next drop should happen now,
275 * hence the while loop.
276 */
277 while (vars->dropping &&
278 codel_time_after_eq(now, vars->drop_next)) {
279 vars->count++; /* dont care of possible wrap
280 * since there is no more divide
281 */
282 codel_Newton_step(vars);
283 if (params->ecn && INET_ECN_set_ce(skb)) {
284 stats->ecn_mark++;
285 vars->drop_next =
286 codel_control_law(vars->drop_next,
287 params->interval,
288 vars->rec_inv_sqrt);
289 goto end;
290 }
291 qdisc_drop(skb, sch);
292 stats->drop_count++;
293 skb = dequeue_func(vars, sch);
294 if (!codel_should_drop(skb, sch,
295 vars, params, stats, now)) {
296 /* leave dropping state */
297 vars->dropping = false;
298 } else {
299 /* and schedule the next drop */
300 vars->drop_next =
301 codel_control_law(vars->drop_next,
302 params->interval,
303 vars->rec_inv_sqrt);
304 }
305 }
306 }
307 } else if (drop) {
308 if (params->ecn && INET_ECN_set_ce(skb)) {
309 stats->ecn_mark++;
310 } else {
311 qdisc_drop(skb, sch);
312 stats->drop_count++;
313
314 skb = dequeue_func(vars, sch);
315 drop = codel_should_drop(skb, sch, vars, params,
316 stats, now);
317 }
318 vars->dropping = true;
319 /* if min went above target close to when we last went below it
320 * assume that the drop rate that controlled the queue on the
321 * last cycle is a good starting point to control it now.
322 */
323 if (codel_time_before(now - vars->drop_next,
324 16 * params->interval)) {
325 vars->count = (vars->count - vars->lastcount) | 1;
326 /* we dont care if rec_inv_sqrt approximation
327 * is not very precise :
328 * Next Newton steps will correct it quadratically.
329 */
330 codel_Newton_step(vars);
331 } else {
332 vars->count = 1;
333 vars->rec_inv_sqrt = ~0U >> REC_INV_SQRT_SHIFT;
334 }
335 vars->lastcount = vars->count;
336 vars->drop_next = codel_control_law(now, params->interval,
337 vars->rec_inv_sqrt);
338 }
339end:
340 return skb;
341}
342#endif
diff --git a/include/net/compat.h b/include/net/compat.h
index a974ae92d182..6e9565324989 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -42,12 +42,12 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
42 42
43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int); 44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int);
45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); 45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned int);
46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
47 unsigned, unsigned); 47 unsigned int, unsigned int);
48extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); 48extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned int);
49extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, 49extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
50 unsigned, unsigned, 50 unsigned int, unsigned int,
51 struct compat_timespec __user *); 51 struct compat_timespec __user *);
52extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 52extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
53extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 53extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index f55c980d8e23..fc5d5dcebb00 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -48,6 +48,8 @@ struct dcbnl_rtnl_ops {
48 /* IEEE 802.1Qaz std */ 48 /* IEEE 802.1Qaz std */
49 int (*ieee_getets) (struct net_device *, struct ieee_ets *); 49 int (*ieee_getets) (struct net_device *, struct ieee_ets *);
50 int (*ieee_setets) (struct net_device *, struct ieee_ets *); 50 int (*ieee_setets) (struct net_device *, struct ieee_ets *);
51 int (*ieee_getmaxrate) (struct net_device *, struct ieee_maxrate *);
52 int (*ieee_setmaxrate) (struct net_device *, struct ieee_maxrate *);
51 int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *); 53 int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *);
52 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); 54 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *);
53 int (*ieee_getapp) (struct net_device *, struct dcb_app *); 55 int (*ieee_getapp) (struct net_device *, struct dcb_app *);
diff --git a/include/net/dn.h b/include/net/dn.h
index 814af0b9387d..c88bf4ebd330 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -199,7 +199,7 @@ static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp)
199 fld->fld_dport = scp->addrrem; 199 fld->fld_dport = scp->addrrem;
200} 200}
201 201
202extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); 202extern unsigned int dn_mss_from_pmtu(struct net_device *dev, int mtu);
203 203
204#define DN_MENUVER_ACC 0x01 204#define DN_MENUVER_ACC 0x01
205#define DN_MENUVER_USR 0x02 205#define DN_MENUVER_USR 0x02
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 782ef7cb4930..1ee9d4bda30d 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -31,7 +31,7 @@ struct dn_fib_res {
31 31
32struct dn_fib_nh { 32struct dn_fib_nh {
33 struct net_device *nh_dev; 33 struct net_device *nh_dev;
34 unsigned nh_flags; 34 unsigned int nh_flags;
35 unsigned char nh_scope; 35 unsigned char nh_scope;
36 int nh_weight; 36 int nh_weight;
37 int nh_power; 37 int nh_power;
@@ -45,7 +45,7 @@ struct dn_fib_info {
45 int fib_treeref; 45 int fib_treeref;
46 atomic_t fib_clntref; 46 atomic_t fib_clntref;
47 int fib_dead; 47 int fib_dead;
48 unsigned fib_flags; 48 unsigned int fib_flags;
49 int fib_protocol; 49 int fib_protocol;
50 __le16 fib_prefsrc; 50 __le16 fib_prefsrc;
51 __u32 fib_priority; 51 __u32 fib_priority;
@@ -140,7 +140,7 @@ extern void dn_fib_table_cleanup(void);
140 */ 140 */
141extern void dn_fib_rules_init(void); 141extern void dn_fib_rules_init(void);
142extern void dn_fib_rules_cleanup(void); 142extern void dn_fib_rules_cleanup(void);
143extern unsigned dnet_addr_type(__le16 addr); 143extern unsigned int dnet_addr_type(__le16 addr);
144extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res); 144extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res);
145 145
146extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 146extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 81712cfa1ddf..c507e05d172f 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -76,8 +76,8 @@ struct dn_route {
76 __le16 rt_src_map; 76 __le16 rt_src_map;
77 __le16 rt_dst_map; 77 __le16 rt_dst_map;
78 78
79 unsigned rt_flags; 79 unsigned int rt_flags;
80 unsigned rt_type; 80 unsigned int rt_type;
81}; 81};
82 82
83static inline bool dn_is_input_route(struct dn_route *rt) 83static inline bool dn_is_input_route(struct dn_route *rt)
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index e1c2ee0eef47..3682a0a076c1 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -12,7 +12,7 @@ struct sk_buff;
12struct dst_ops { 12struct dst_ops {
13 unsigned short family; 13 unsigned short family;
14 __be16 protocol; 14 __be16 protocol;
15 unsigned gc_thresh; 15 unsigned int gc_thresh;
16 16
17 int (*gc)(struct dst_ops *ops); 17 int (*gc)(struct dst_ops *ops);
18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); 18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 75d615649071..9ac2524d1402 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -25,7 +25,7 @@
25 25
26struct icmp_err { 26struct icmp_err {
27 int errno; 27 int errno;
28 unsigned fatal:1; 28 unsigned int fatal:1;
29}; 29};
30 30
31extern const struct icmp_err icmp_err_convert[]; 31extern const struct icmp_err icmp_err_convert[];
@@ -41,7 +41,6 @@ struct net;
41 41
42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43extern int icmp_rcv(struct sk_buff *skb); 43extern int icmp_rcv(struct sk_buff *skb);
44extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
45extern int icmp_init(void); 44extern int icmp_init(void);
46extern void icmp_out_count(struct net *net, unsigned char type); 45extern void icmp_out_count(struct net *net, unsigned char type);
47 46
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 57430555487a..d104c882fc29 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * An interface between IEEE802.15.4 device and rest of the kernel. 2 * An interface between IEEE802.15.4 device and rest of the kernel.
3 * 3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG 4 * Copyright (C) 2007-2012 Siemens AG
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2
@@ -21,11 +21,14 @@
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com> 21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com> 22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
24 */ 25 */
25 26
26#ifndef IEEE802154_NETDEVICE_H 27#ifndef IEEE802154_NETDEVICE_H
27#define IEEE802154_NETDEVICE_H 28#define IEEE802154_NETDEVICE_H
28 29
30#include <net/af_ieee802154.h>
31
29/* 32/*
30 * A control block of skb passed between the ARPHRD_IEEE802154 device 33 * A control block of skb passed between the ARPHRD_IEEE802154 device
31 * and other stack parts. 34 * and other stack parts.
@@ -110,12 +113,26 @@ struct ieee802154_mlme_ops {
110 u8 (*get_bsn)(const struct net_device *dev); 113 u8 (*get_bsn)(const struct net_device *dev);
111}; 114};
112 115
113static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( 116/* The IEEE 802.15.4 standard defines 2 type of the devices:
114 const struct net_device *dev) 117 * - FFD - full functionality device
118 * - RFD - reduce functionality device
119 *
120 * So 2 sets of mlme operations are needed
121 */
122struct ieee802154_reduced_mlme_ops {
123 struct wpan_phy *(*get_phy)(const struct net_device *dev);
124};
125
126static inline struct ieee802154_mlme_ops *
127ieee802154_mlme_ops(const struct net_device *dev)
115{ 128{
116 return dev->ml_priv; 129 return dev->ml_priv;
117} 130}
118 131
119#endif 132static inline struct ieee802154_reduced_mlme_ops *
120 133ieee802154_reduced_mlme_ops(const struct net_device *dev)
134{
135 return dev->ml_priv;
136}
121 137
138#endif
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 51a7031b4aa3..93563221d29a 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -120,7 +120,7 @@ struct ifmcaddr6 {
120 unsigned char mca_crcount; 120 unsigned char mca_crcount;
121 unsigned long mca_sfcount[2]; 121 unsigned long mca_sfcount[2];
122 struct timer_list mca_timer; 122 struct timer_list mca_timer;
123 unsigned mca_flags; 123 unsigned int mca_flags;
124 int mca_users; 124 int mca_users;
125 atomic_t mca_refcnt; 125 atomic_t mca_refcnt;
126 spinlock_t mca_lock; 126 spinlock_t mca_lock;
@@ -209,60 +209,6 @@ static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf)
209 memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); 209 memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32));
210} 210}
211 211
212static inline void ipv6_tr_mc_map(const struct in6_addr *addr, char *buf)
213{
214 /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */
215
216 if (((addr->s6_addr[0] == 0xFF) &&
217 ((addr->s6_addr[1] == 0x01) || (addr->s6_addr[1] == 0x02)) &&
218 (addr->s6_addr16[1] == 0) &&
219 (addr->s6_addr32[1] == 0) &&
220 (addr->s6_addr32[2] == 0) &&
221 (addr->s6_addr16[6] == 0) &&
222 (addr->s6_addr[15] == 1)) ||
223 ((addr->s6_addr[0] == 0xFF) &&
224 (addr->s6_addr[1] == 0x02) &&
225 (addr->s6_addr16[1] == 0) &&
226 (addr->s6_addr32[1] == 0) &&
227 (addr->s6_addr16[4] == 0) &&
228 (addr->s6_addr[10] == 0) &&
229 (addr->s6_addr[11] == 1) &&
230 (addr->s6_addr[12] == 0xff)))
231 {
232 buf[0]=0xC0;
233 buf[1]=0x00;
234 buf[2]=0x01;
235 buf[3]=0x00;
236 buf[4]=0x00;
237 buf[5]=0x00;
238 /* All routers FF0x::2 */
239 } else if ((addr->s6_addr[0] ==0xff) &&
240 ((addr->s6_addr[1] & 0xF0) == 0) &&
241 (addr->s6_addr16[1] == 0) &&
242 (addr->s6_addr32[1] == 0) &&
243 (addr->s6_addr32[2] == 0) &&
244 (addr->s6_addr16[6] == 0) &&
245 (addr->s6_addr[15] == 2))
246 {
247 buf[0]=0xC0;
248 buf[1]=0x00;
249 buf[2]=0x02;
250 buf[3]=0x00;
251 buf[4]=0x00;
252 buf[5]=0x00;
253 } else {
254 unsigned char i ;
255
256 i = addr->s6_addr[15] & 7 ;
257 buf[0]=0xC0;
258 buf[1]=0x00;
259 buf[2]=0x00;
260 buf[3]=0x01 << i ;
261 buf[4]=0x00;
262 buf[5]=0x00;
263 }
264}
265
266static inline void ipv6_arcnet_mc_map(const struct in6_addr *addr, char *buf) 212static inline void ipv6_arcnet_mc_map(const struct in6_addr *addr, char *buf)
267{ 213{
268 buf[0] = 0x00; 214 buf[0] = 0x00;
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 3207e58ee019..1866a676c810 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -23,7 +23,7 @@ struct sock;
23struct sockaddr; 23struct sockaddr;
24 24
25extern int inet6_csk_bind_conflict(const struct sock *sk, 25extern int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb); 26 const struct inet_bind_bucket *tb, bool relax);
27 27
28extern struct dst_entry* inet6_csk_route_req(struct sock *sk, 28extern struct dst_entry* inet6_csk_route_req(struct sock *sk,
29 const struct request_sock *req); 29 const struct request_sock *req);
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index dbf9aab34c82..7d83f90f203f 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -45,6 +45,7 @@ struct inet_connection_sock_af_ops {
45 struct dst_entry *dst); 45 struct dst_entry *dst);
46 struct inet_peer *(*get_peer)(struct sock *sk, bool *release_it); 46 struct inet_peer *(*get_peer)(struct sock *sk, bool *release_it);
47 u16 net_header_len; 47 u16 net_header_len;
48 u16 net_frag_header_len;
48 u16 sockaddr_len; 49 u16 sockaddr_len;
49 int (*setsockopt)(struct sock *sk, int level, int optname, 50 int (*setsockopt)(struct sock *sk, int level, int optname,
50 char __user *optval, unsigned int optlen); 51 char __user *optval, unsigned int optlen);
@@ -60,7 +61,7 @@ struct inet_connection_sock_af_ops {
60#endif 61#endif
61 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 62 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
62 int (*bind_conflict)(const struct sock *sk, 63 int (*bind_conflict)(const struct sock *sk,
63 const struct inet_bind_bucket *tb); 64 const struct inet_bind_bucket *tb, bool relax);
64}; 65};
65 66
66/** inet_connection_sock - INET connection oriented sock 67/** inet_connection_sock - INET connection oriented sock
@@ -245,7 +246,7 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk,
245 const __be32 raddr, 246 const __be32 raddr,
246 const __be32 laddr); 247 const __be32 laddr);
247extern int inet_csk_bind_conflict(const struct sock *sk, 248extern int inet_csk_bind_conflict(const struct sock *sk,
248 const struct inet_bind_bucket *tb); 249 const struct inet_bind_bucket *tb, bool relax);
249extern int inet_csk_get_port(struct sock *sk, unsigned short snum); 250extern int inet_csk_get_port(struct sock *sk, unsigned short snum);
250 251
251extern struct dst_entry* inet_csk_route_req(struct sock *sk, 252extern struct dst_entry* inet_csk_route_req(struct sock *sk,
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 16ff29a7bb30..2431cf83aeca 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -46,8 +46,7 @@ struct inet_frags {
46 void *arg); 46 void *arg);
47 void (*destructor)(struct inet_frag_queue *); 47 void (*destructor)(struct inet_frag_queue *);
48 void (*skb_free)(struct sk_buff *); 48 void (*skb_free)(struct sk_buff *);
49 int (*match)(struct inet_frag_queue *q, 49 bool (*match)(struct inet_frag_queue *q, void *arg);
50 void *arg);
51 void (*frag_expire)(unsigned long data); 50 void (*frag_expire)(unsigned long data);
52}; 51};
53 52
diff --git a/include/net/ip.h b/include/net/ip.h
index b53d65f24f7b..83e0619f59d0 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -141,23 +141,6 @@ static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
141extern int ip4_datagram_connect(struct sock *sk, 141extern int ip4_datagram_connect(struct sock *sk,
142 struct sockaddr *uaddr, int addr_len); 142 struct sockaddr *uaddr, int addr_len);
143 143
144/*
145 * Map a multicast IP onto multicast MAC for type Token Ring.
146 * This conforms to RFC1469 Option 2 Multicasting i.e.
147 * using a functional address to transmit / receive
148 * multicast packets.
149 */
150
151static inline void ip_tr_mc_map(__be32 addr, char *buf)
152{
153 buf[0]=0xC0;
154 buf[1]=0x00;
155 buf[2]=0x00;
156 buf[3]=0x04;
157 buf[4]=0x00;
158 buf[5]=0x00;
159}
160
161struct ip_reply_arg { 144struct ip_reply_arg {
162 struct kvec iov[1]; 145 struct kvec iov[1];
163 int flags; 146 int flags;
@@ -222,9 +205,6 @@ static inline int inet_is_reserved_local_port(int port)
222 205
223extern int sysctl_ip_nonlocal_bind; 206extern int sysctl_ip_nonlocal_bind;
224 207
225extern struct ctl_path net_core_path[];
226extern struct ctl_path net_ipv4_ctl_path[];
227
228/* From inetpeer.c */ 208/* From inetpeer.c */
229extern int inet_peer_threshold; 209extern int inet_peer_threshold;
230extern int inet_peer_minttl; 210extern int inet_peer_minttl;
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 2ad92ca4e6f3..37c1a1ed82c1 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -146,7 +146,7 @@ struct rt6_rtnl_dump_arg {
146 146
147extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); 147extern int rt6_dump_route(struct rt6_info *rt, void *p_arg);
148extern void rt6_ifdown(struct net *net, struct net_device *dev); 148extern void rt6_ifdown(struct net *net, struct net_device *dev);
149extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); 149extern void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
150extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); 150extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
151 151
152 152
@@ -175,7 +175,7 @@ static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
175 spin_unlock(&sk->sk_dst_lock); 175 spin_unlock(&sk->sk_dst_lock);
176} 176}
177 177
178static inline int ipv6_unicast_destination(struct sk_buff *skb) 178static inline bool ipv6_unicast_destination(const struct sk_buff *skb)
179{ 179{
180 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb); 180 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
181 181
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 10422ef14e28..78df0866cc38 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -49,7 +49,7 @@ struct fib_nh {
49 struct net_device *nh_dev; 49 struct net_device *nh_dev;
50 struct hlist_node nh_hash; 50 struct hlist_node nh_hash;
51 struct fib_info *nh_parent; 51 struct fib_info *nh_parent;
52 unsigned nh_flags; 52 unsigned int nh_flags;
53 unsigned char nh_scope; 53 unsigned char nh_scope;
54#ifdef CONFIG_IP_ROUTE_MULTIPATH 54#ifdef CONFIG_IP_ROUTE_MULTIPATH
55 int nh_weight; 55 int nh_weight;
@@ -74,7 +74,7 @@ struct fib_info {
74 struct net *fib_net; 74 struct net *fib_net;
75 int fib_treeref; 75 int fib_treeref;
76 atomic_t fib_clntref; 76 atomic_t fib_clntref;
77 unsigned fib_flags; 77 unsigned int fib_flags;
78 unsigned char fib_dead; 78 unsigned char fib_dead;
79 unsigned char fib_protocol; 79 unsigned char fib_protocol;
80 unsigned char fib_scope; 80 unsigned char fib_scope;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 72522f087375..d6146b4811c2 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -10,7 +10,6 @@
10 10
11#include <asm/types.h> /* for __uXX types */ 11#include <asm/types.h> /* for __uXX types */
12 12
13#include <linux/sysctl.h> /* for ctl_path */
14#include <linux/list.h> /* for struct list_head */ 13#include <linux/list.h> /* for struct list_head */
15#include <linux/spinlock.h> /* for struct rwlock_t */ 14#include <linux/spinlock.h> /* for struct rwlock_t */
16#include <linux/atomic.h> /* for struct atomic_t */ 15#include <linux/atomic.h> /* for struct atomic_t */
@@ -505,6 +504,7 @@ struct ip_vs_conn {
505 * state transition triggerd 504 * state transition triggerd
506 * synchronization 505 * synchronization
507 */ 506 */
507 unsigned long sync_endtime; /* jiffies + sent_retries */
508 508
509 /* Control members */ 509 /* Control members */
510 struct ip_vs_conn *control; /* Master control connection */ 510 struct ip_vs_conn *control; /* Master control connection */
@@ -580,8 +580,8 @@ struct ip_vs_service_user_kern {
580 /* virtual service options */ 580 /* virtual service options */
581 char *sched_name; 581 char *sched_name;
582 char *pe_name; 582 char *pe_name;
583 unsigned flags; /* virtual service flags */ 583 unsigned int flags; /* virtual service flags */
584 unsigned timeout; /* persistent timeout in sec */ 584 unsigned int timeout; /* persistent timeout in sec */
585 u32 netmask; /* persistent netmask */ 585 u32 netmask; /* persistent netmask */
586}; 586};
587 587
@@ -592,7 +592,7 @@ struct ip_vs_dest_user_kern {
592 u16 port; 592 u16 port;
593 593
594 /* real server options */ 594 /* real server options */
595 unsigned conn_flags; /* connection flags */ 595 unsigned int conn_flags; /* connection flags */
596 int weight; /* destination weight */ 596 int weight; /* destination weight */
597 597
598 /* thresholds for active connections */ 598 /* thresholds for active connections */
@@ -616,8 +616,8 @@ struct ip_vs_service {
616 union nf_inet_addr addr; /* IP address for virtual service */ 616 union nf_inet_addr addr; /* IP address for virtual service */
617 __be16 port; /* port number for the service */ 617 __be16 port; /* port number for the service */
618 __u32 fwmark; /* firewall mark of the service */ 618 __u32 fwmark; /* firewall mark of the service */
619 unsigned flags; /* service status flags */ 619 unsigned int flags; /* service status flags */
620 unsigned timeout; /* persistent timeout in ticks */ 620 unsigned int timeout; /* persistent timeout in ticks */
621 __be32 netmask; /* grouping granularity */ 621 __be32 netmask; /* grouping granularity */
622 struct net *net; 622 struct net *net;
623 623
@@ -647,7 +647,7 @@ struct ip_vs_dest {
647 u16 af; /* address family */ 647 u16 af; /* address family */
648 __be16 port; /* port number of the server */ 648 __be16 port; /* port number of the server */
649 union nf_inet_addr addr; /* IP address of the server */ 649 union nf_inet_addr addr; /* IP address of the server */
650 volatile unsigned flags; /* dest status flags */ 650 volatile unsigned int flags; /* dest status flags */
651 atomic_t conn_flags; /* flags to copy to conn */ 651 atomic_t conn_flags; /* flags to copy to conn */
652 atomic_t weight; /* server weight */ 652 atomic_t weight; /* server weight */
653 653
@@ -784,6 +784,16 @@ struct ip_vs_app {
784 void (*timeout_change)(struct ip_vs_app *app, int flags); 784 void (*timeout_change)(struct ip_vs_app *app, int flags);
785}; 785};
786 786
787struct ipvs_master_sync_state {
788 struct list_head sync_queue;
789 struct ip_vs_sync_buff *sync_buff;
790 int sync_queue_len;
791 unsigned int sync_queue_delay;
792 struct task_struct *master_thread;
793 struct delayed_work master_wakeup_work;
794 struct netns_ipvs *ipvs;
795};
796
787/* IPVS in network namespace */ 797/* IPVS in network namespace */
788struct netns_ipvs { 798struct netns_ipvs {
789 int gen; /* Generation */ 799 int gen; /* Generation */
@@ -870,10 +880,15 @@ struct netns_ipvs {
870#endif 880#endif
871 int sysctl_snat_reroute; 881 int sysctl_snat_reroute;
872 int sysctl_sync_ver; 882 int sysctl_sync_ver;
883 int sysctl_sync_ports;
884 int sysctl_sync_qlen_max;
885 int sysctl_sync_sock_size;
873 int sysctl_cache_bypass; 886 int sysctl_cache_bypass;
874 int sysctl_expire_nodest_conn; 887 int sysctl_expire_nodest_conn;
875 int sysctl_expire_quiescent_template; 888 int sysctl_expire_quiescent_template;
876 int sysctl_sync_threshold[2]; 889 int sysctl_sync_threshold[2];
890 unsigned int sysctl_sync_refresh_period;
891 int sysctl_sync_retries;
877 int sysctl_nat_icmp_send; 892 int sysctl_nat_icmp_send;
878 893
879 /* ip_vs_lblc */ 894 /* ip_vs_lblc */
@@ -889,13 +904,11 @@ struct netns_ipvs {
889 spinlock_t est_lock; 904 spinlock_t est_lock;
890 struct timer_list est_timer; /* Estimation timer */ 905 struct timer_list est_timer; /* Estimation timer */
891 /* ip_vs_sync */ 906 /* ip_vs_sync */
892 struct list_head sync_queue;
893 spinlock_t sync_lock; 907 spinlock_t sync_lock;
894 struct ip_vs_sync_buff *sync_buff; 908 struct ipvs_master_sync_state *ms;
895 spinlock_t sync_buff_lock; 909 spinlock_t sync_buff_lock;
896 struct sockaddr_in sync_mcast_addr; 910 struct task_struct **backup_threads;
897 struct task_struct *master_thread; 911 int threads_mask;
898 struct task_struct *backup_thread;
899 int send_mesg_maxlen; 912 int send_mesg_maxlen;
900 int recv_mesg_maxlen; 913 int recv_mesg_maxlen;
901 volatile int sync_state; 914 volatile int sync_state;
@@ -912,6 +925,14 @@ struct netns_ipvs {
912#define DEFAULT_SYNC_THRESHOLD 3 925#define DEFAULT_SYNC_THRESHOLD 3
913#define DEFAULT_SYNC_PERIOD 50 926#define DEFAULT_SYNC_PERIOD 50
914#define DEFAULT_SYNC_VER 1 927#define DEFAULT_SYNC_VER 1
928#define DEFAULT_SYNC_REFRESH_PERIOD (0U * HZ)
929#define DEFAULT_SYNC_RETRIES 0
930#define IPVS_SYNC_WAKEUP_RATE 8
931#define IPVS_SYNC_QLEN_MAX (IPVS_SYNC_WAKEUP_RATE * 4)
932#define IPVS_SYNC_SEND_DELAY (HZ / 50)
933#define IPVS_SYNC_CHECK_PERIOD HZ
934#define IPVS_SYNC_FLUSH_TIME (HZ * 2)
935#define IPVS_SYNC_PORTS_MAX (1 << 6)
915 936
916#ifdef CONFIG_SYSCTL 937#ifdef CONFIG_SYSCTL
917 938
@@ -922,7 +943,17 @@ static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
922 943
923static inline int sysctl_sync_period(struct netns_ipvs *ipvs) 944static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
924{ 945{
925 return ipvs->sysctl_sync_threshold[1]; 946 return ACCESS_ONCE(ipvs->sysctl_sync_threshold[1]);
947}
948
949static inline unsigned int sysctl_sync_refresh_period(struct netns_ipvs *ipvs)
950{
951 return ACCESS_ONCE(ipvs->sysctl_sync_refresh_period);
952}
953
954static inline int sysctl_sync_retries(struct netns_ipvs *ipvs)
955{
956 return ipvs->sysctl_sync_retries;
926} 957}
927 958
928static inline int sysctl_sync_ver(struct netns_ipvs *ipvs) 959static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
@@ -930,6 +961,21 @@ static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
930 return ipvs->sysctl_sync_ver; 961 return ipvs->sysctl_sync_ver;
931} 962}
932 963
964static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
965{
966 return ACCESS_ONCE(ipvs->sysctl_sync_ports);
967}
968
969static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
970{
971 return ipvs->sysctl_sync_qlen_max;
972}
973
974static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs)
975{
976 return ipvs->sysctl_sync_sock_size;
977}
978
933#else 979#else
934 980
935static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) 981static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
@@ -942,18 +988,43 @@ static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
942 return DEFAULT_SYNC_PERIOD; 988 return DEFAULT_SYNC_PERIOD;
943} 989}
944 990
991static inline unsigned int sysctl_sync_refresh_period(struct netns_ipvs *ipvs)
992{
993 return DEFAULT_SYNC_REFRESH_PERIOD;
994}
995
996static inline int sysctl_sync_retries(struct netns_ipvs *ipvs)
997{
998 return DEFAULT_SYNC_RETRIES & 3;
999}
1000
945static inline int sysctl_sync_ver(struct netns_ipvs *ipvs) 1001static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
946{ 1002{
947 return DEFAULT_SYNC_VER; 1003 return DEFAULT_SYNC_VER;
948} 1004}
949 1005
1006static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
1007{
1008 return 1;
1009}
1010
1011static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
1012{
1013 return IPVS_SYNC_QLEN_MAX;
1014}
1015
1016static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs)
1017{
1018 return 0;
1019}
1020
950#endif 1021#endif
951 1022
952/* 1023/*
953 * IPVS core functions 1024 * IPVS core functions
954 * (from ip_vs_core.c) 1025 * (from ip_vs_core.c)
955 */ 1026 */
956extern const char *ip_vs_proto_name(unsigned proto); 1027extern const char *ip_vs_proto_name(unsigned int proto);
957extern void ip_vs_init_hash_table(struct list_head *table, int rows); 1028extern void ip_vs_init_hash_table(struct list_head *table, int rows);
958#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) 1029#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t)))
959 1030
@@ -1014,7 +1085,7 @@ extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
1014 1085
1015struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, 1086struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p,
1016 const union nf_inet_addr *daddr, 1087 const union nf_inet_addr *daddr,
1017 __be16 dport, unsigned flags, 1088 __be16 dport, unsigned int flags,
1018 struct ip_vs_dest *dest, __u32 fwmark); 1089 struct ip_vs_dest *dest, __u32 fwmark);
1019extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 1090extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
1020 1091
@@ -1184,10 +1255,8 @@ extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1184 * IPVS control data and functions (from ip_vs_ctl.c) 1255 * IPVS control data and functions (from ip_vs_ctl.c)
1185 */ 1256 */
1186extern struct ip_vs_stats ip_vs_stats; 1257extern struct ip_vs_stats ip_vs_stats;
1187extern const struct ctl_path net_vs_ctl_path[];
1188extern int sysctl_ip_vs_sync_ver; 1258extern int sysctl_ip_vs_sync_ver;
1189 1259
1190extern void ip_vs_sync_switch_mode(struct net *net, int mode);
1191extern struct ip_vs_service * 1260extern struct ip_vs_service *
1192ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol, 1261ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol,
1193 const union nf_inet_addr *vaddr, __be16 vport); 1262 const union nf_inet_addr *vaddr, __be16 vport);
@@ -1221,7 +1290,7 @@ extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1221extern int start_sync_thread(struct net *net, int state, char *mcast_ifn, 1290extern int start_sync_thread(struct net *net, int state, char *mcast_ifn,
1222 __u8 syncid); 1291 __u8 syncid);
1223extern int stop_sync_thread(struct net *net, int state); 1292extern int stop_sync_thread(struct net *net, int state);
1224extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp); 1293extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1225 1294
1226 1295
1227/* 1296/*
diff --git a/include/net/ipip.h b/include/net/ipip.h
index a32654d52730..a93cf6d7e94b 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -54,8 +54,10 @@ struct ip_tunnel_prl_entry {
54 \ 54 \
55 err = ip_local_out(skb); \ 55 err = ip_local_out(skb); \
56 if (likely(net_xmit_eval(err) == 0)) { \ 56 if (likely(net_xmit_eval(err) == 0)) { \
57 u64_stats_update_begin(&(stats1)->syncp); \
57 (stats1)->tx_bytes += pkt_len; \ 58 (stats1)->tx_bytes += pkt_len; \
58 (stats1)->tx_packets++; \ 59 (stats1)->tx_packets++; \
60 u64_stats_update_end(&(stats1)->syncp); \
59 } else { \ 61 } else { \
60 (stats2)->tx_errors++; \ 62 (stats2)->tx_errors++; \
61 (stats2)->tx_aborted_errors++; \ 63 (stats2)->tx_aborted_errors++; \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index e4170a22fc6f..aecf88436abf 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -113,7 +113,6 @@ struct frag_hdr {
113 113
114/* sysctls */ 114/* sysctls */
115extern int sysctl_mld_max_msf; 115extern int sysctl_mld_max_msf;
116extern struct ctl_path net_ipv6_ctl_path[];
117 116
118#define _DEVINC(net, statname, modifier, idev, field) \ 117#define _DEVINC(net, statname, modifier, idev, field) \
119({ \ 118({ \
@@ -264,7 +263,7 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
264struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 263struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
265 struct ipv6_txoptions *opt); 264 struct ipv6_txoptions *opt);
266 265
267extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); 266extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
268 267
269int ip6_frag_nqueues(struct net *net); 268int ip6_frag_nqueues(struct net *net);
270int ip6_frag_mem(struct net *net); 269int ip6_frag_mem(struct net *net);
@@ -333,8 +332,8 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
333 addr->s6_addr32[3] = w4; 332 addr->s6_addr32[3] = w4;
334} 333}
335 334
336static inline int ipv6_addr_equal(const struct in6_addr *a1, 335static inline bool ipv6_addr_equal(const struct in6_addr *a1,
337 const struct in6_addr *a2) 336 const struct in6_addr *a2)
338{ 337{
339 return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | 338 return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) |
340 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | 339 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) |
@@ -342,27 +341,27 @@ static inline int ipv6_addr_equal(const struct in6_addr *a1,
342 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0; 341 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0;
343} 342}
344 343
345static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, 344static inline bool __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
346 unsigned int prefixlen) 345 unsigned int prefixlen)
347{ 346{
348 unsigned pdw, pbi; 347 unsigned int pdw, pbi;
349 348
350 /* check complete u32 in prefix */ 349 /* check complete u32 in prefix */
351 pdw = prefixlen >> 5; 350 pdw = prefixlen >> 5;
352 if (pdw && memcmp(a1, a2, pdw << 2)) 351 if (pdw && memcmp(a1, a2, pdw << 2))
353 return 0; 352 return false;
354 353
355 /* check incomplete u32 in prefix */ 354 /* check incomplete u32 in prefix */
356 pbi = prefixlen & 0x1f; 355 pbi = prefixlen & 0x1f;
357 if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) 356 if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi))))
358 return 0; 357 return false;
359 358
360 return 1; 359 return true;
361} 360}
362 361
363static inline int ipv6_prefix_equal(const struct in6_addr *a1, 362static inline bool ipv6_prefix_equal(const struct in6_addr *a1,
364 const struct in6_addr *a2, 363 const struct in6_addr *a2,
365 unsigned int prefixlen) 364 unsigned int prefixlen)
366{ 365{
367 return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32, 366 return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32,
368 prefixlen); 367 prefixlen);
@@ -388,21 +387,21 @@ struct ip6_create_arg {
388}; 387};
389 388
390void ip6_frag_init(struct inet_frag_queue *q, void *a); 389void ip6_frag_init(struct inet_frag_queue *q, void *a);
391int ip6_frag_match(struct inet_frag_queue *q, void *a); 390bool ip6_frag_match(struct inet_frag_queue *q, void *a);
392 391
393static inline int ipv6_addr_any(const struct in6_addr *a) 392static inline bool ipv6_addr_any(const struct in6_addr *a)
394{ 393{
395 return (a->s6_addr32[0] | a->s6_addr32[1] | 394 return (a->s6_addr32[0] | a->s6_addr32[1] |
396 a->s6_addr32[2] | a->s6_addr32[3]) == 0; 395 a->s6_addr32[2] | a->s6_addr32[3]) == 0;
397} 396}
398 397
399static inline int ipv6_addr_loopback(const struct in6_addr *a) 398static inline bool ipv6_addr_loopback(const struct in6_addr *a)
400{ 399{
401 return (a->s6_addr32[0] | a->s6_addr32[1] | 400 return (a->s6_addr32[0] | a->s6_addr32[1] |
402 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0; 401 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0;
403} 402}
404 403
405static inline int ipv6_addr_v4mapped(const struct in6_addr *a) 404static inline bool ipv6_addr_v4mapped(const struct in6_addr *a)
406{ 405{
407 return (a->s6_addr32[0] | a->s6_addr32[1] | 406 return (a->s6_addr32[0] | a->s6_addr32[1] |
408 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0; 407 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0;
@@ -412,7 +411,7 @@ static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
412 * Check for a RFC 4843 ORCHID address 411 * Check for a RFC 4843 ORCHID address
413 * (Overlay Routable Cryptographic Hash Identifiers) 412 * (Overlay Routable Cryptographic Hash Identifiers)
414 */ 413 */
415static inline int ipv6_addr_orchid(const struct in6_addr *a) 414static inline bool ipv6_addr_orchid(const struct in6_addr *a)
416{ 415{
417 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); 416 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010);
418} 417}
@@ -560,7 +559,7 @@ extern void ipv6_push_frag_opts(struct sk_buff *skb,
560extern int ipv6_skip_exthdr(const struct sk_buff *, int start, 559extern int ipv6_skip_exthdr(const struct sk_buff *, int start,
561 u8 *nexthdrp, __be16 *frag_offp); 560 u8 *nexthdrp, __be16 *frag_offp);
562 561
563extern int ipv6_ext_hdr(u8 nexthdr); 562extern bool ipv6_ext_hdr(u8 nexthdr);
564 563
565extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 564extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
566 565
@@ -661,8 +660,6 @@ extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
661extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 660extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
662extern int ipv6_sysctl_register(void); 661extern int ipv6_sysctl_register(void);
663extern void ipv6_sysctl_unregister(void); 662extern void ipv6_sysctl_unregister(void);
664extern int ipv6_static_sysctl_register(void);
665extern void ipv6_static_sysctl_unregister(void);
666#endif 663#endif
667 664
668#endif /* _NET_IPV6_H */ 665#endif /* _NET_IPV6_H */
diff --git a/include/net/lapb.h b/include/net/lapb.h
index fd2bf572ee1d..df892a94f2c6 100644
--- a/include/net/lapb.h
+++ b/include/net/lapb.h
@@ -149,4 +149,10 @@ extern int lapb_t1timer_running(struct lapb_cb *lapb);
149 */ 149 */
150#define LAPB_DEBUG 0 150#define LAPB_DEBUG 0
151 151
152#define lapb_dbg(level, fmt, ...) \
153do { \
154 if (level < LAPB_DEBUG) \
155 pr_debug(fmt, ##__VA_ARGS__); \
156} while (0)
157
152#endif 158#endif
diff --git a/include/net/llc_c_ev.h b/include/net/llc_c_ev.h
index 23a409381fa9..6ca3113df39e 100644
--- a/include/net/llc_c_ev.h
+++ b/include/net/llc_c_ev.h
@@ -264,6 +264,6 @@ extern int llc_conn_ev_qlfy_set_status_rst_done(struct sock *sk,
264static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb) 264static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb)
265{ 265{
266 return atomic_read(&sk->sk_rmem_alloc) + skb->truesize < 266 return atomic_read(&sk->sk_rmem_alloc) + skb->truesize <
267 (unsigned)sk->sk_rcvbuf; 267 (unsigned int)sk->sk_rcvbuf;
268} 268}
269#endif /* LLC_C_EV_H */ 269#endif /* LLC_C_EV_H */
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index f57e7d46a453..5a93d13ac95c 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include <linux/if_ether.h> 15#include <linux/if_ether.h>
16#include <linux/if_tr.h>
17 16
18/* Lengths of frame formats */ 17/* Lengths of frame formats */
19#define LLC_PDU_LEN_I 4 /* header and 2 control bytes */ 18#define LLC_PDU_LEN_I 4 /* header and 2 control bytes */
@@ -253,10 +252,6 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
253{ 252{
254 if (skb->protocol == htons(ETH_P_802_2)) 253 if (skb->protocol == htons(ETH_P_802_2))
255 memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN); 254 memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
256 else if (skb->protocol == htons(ETH_P_TR_802_2)) {
257 memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN);
258 *sa &= 0x7F;
259 }
260} 255}
261 256
262/** 257/**
@@ -270,8 +265,6 @@ static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
270{ 265{
271 if (skb->protocol == htons(ETH_P_802_2)) 266 if (skb->protocol == htons(ETH_P_802_2))
272 memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN); 267 memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
273 else if (skb->protocol == htons(ETH_P_TR_802_2))
274 memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN);
275} 268}
276 269
277/** 270/**
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 9210bdc7bd8d..4d6e6c6818d0 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -95,9 +95,11 @@ struct device;
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
96 */ 96 */
97enum ieee80211_max_queues { 97enum ieee80211_max_queues {
98 IEEE80211_MAX_QUEUES = 4, 98 IEEE80211_MAX_QUEUES = 16,
99}; 99};
100 100
101#define IEEE80211_INVAL_HW_QUEUE 0xff
102
101/** 103/**
102 * enum ieee80211_ac_numbers - AC numbers as used in mac80211 104 * enum ieee80211_ac_numbers - AC numbers as used in mac80211
103 * @IEEE80211_AC_VO: voice 105 * @IEEE80211_AC_VO: voice
@@ -244,7 +246,7 @@ enum ieee80211_rssi_event {
244 * @channel_type: Channel type for this BSS -- the hardware might be 246 * @channel_type: Channel type for this BSS -- the hardware might be
245 * configured for HT40+ while this BSS only uses no-HT, for 247 * configured for HT40+ while this BSS only uses no-HT, for
246 * example. 248 * example.
247 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). 249 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
248 * This field is only valid when the channel type is one of the HT types. 250 * This field is only valid when the channel type is one of the HT types.
249 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value 251 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
250 * implies disabled 252 * implies disabled
@@ -522,7 +524,7 @@ struct ieee80211_tx_rate {
522 * 524 *
523 * @flags: transmit info flags, defined above 525 * @flags: transmit info flags, defined above
524 * @band: the band to transmit on (use for checking for races) 526 * @band: the band to transmit on (use for checking for races)
525 * @antenna_sel_tx: antenna to use, 0 for automatic diversity 527 * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
526 * @ack_frame_id: internal frame ID for TX status, used internally 528 * @ack_frame_id: internal frame ID for TX status, used internally
527 * @control: union for control data 529 * @control: union for control data
528 * @status: union for status data 530 * @status: union for status data
@@ -538,7 +540,7 @@ struct ieee80211_tx_info {
538 u32 flags; 540 u32 flags;
539 u8 band; 541 u8 band;
540 542
541 u8 antenna_sel_tx; 543 u8 hw_queue;
542 544
543 u16 ack_frame_id; 545 u16 ack_frame_id;
544 546
@@ -564,7 +566,8 @@ struct ieee80211_tx_info {
564 u8 ampdu_ack_len; 566 u8 ampdu_ack_len;
565 int ack_signal; 567 int ack_signal;
566 u8 ampdu_len; 568 u8 ampdu_len;
567 /* 15 bytes free */ 569 u8 antenna;
570 /* 14 bytes free */
568 } status; 571 } status;
569 struct { 572 struct {
570 struct ieee80211_tx_rate driver_rates[ 573 struct ieee80211_tx_rate driver_rates[
@@ -888,6 +891,8 @@ enum ieee80211_vif_flags {
888 * these need to be set (or cleared) when the interface is added 891 * these need to be set (or cleared) when the interface is added
889 * or, if supported by the driver, the interface type is changed 892 * or, if supported by the driver, the interface type is changed
890 * at runtime, mac80211 will never touch this field 893 * at runtime, mac80211 will never touch this field
894 * @hw_queue: hardware queue for each AC
895 * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
891 * @drv_priv: data area for driver use, will always be aligned to 896 * @drv_priv: data area for driver use, will always be aligned to
892 * sizeof(void *). 897 * sizeof(void *).
893 */ 898 */
@@ -896,7 +901,12 @@ struct ieee80211_vif {
896 struct ieee80211_bss_conf bss_conf; 901 struct ieee80211_bss_conf bss_conf;
897 u8 addr[ETH_ALEN]; 902 u8 addr[ETH_ALEN];
898 bool p2p; 903 bool p2p;
904
905 u8 cab_queue;
906 u8 hw_queue[IEEE80211_NUM_ACS];
907
899 u32 driver_flags; 908 u32 driver_flags;
909
900 /* must be last */ 910 /* must be last */
901 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 911 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
902}; 912};
@@ -1174,6 +1184,15 @@ enum sta_notify_cmd {
1174 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while 1184 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
1175 * being idle (i.e. mac80211 doesn't have to go idle-off during the 1185 * being idle (i.e. mac80211 doesn't have to go idle-off during the
1176 * the scan). 1186 * the scan).
1187 *
1188 * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of
1189 * a virtual monitor interface when monitor interfaces are the only
1190 * active interfaces.
1191 *
1192 * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface
1193 * queue mapping in order to use different queues (not just one per AC)
1194 * for different virtual interfaces. See the doc section on HW queue
1195 * control for more details.
1177 */ 1196 */
1178enum ieee80211_hw_flags { 1197enum ieee80211_hw_flags {
1179 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1198 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1190,13 +1209,13 @@ enum ieee80211_hw_flags {
1190 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, 1209 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
1191 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1210 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
1192 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1211 IEEE80211_HW_MFP_CAPABLE = 1<<13,
1193 /* reuse bit 14 */ 1212 IEEE80211_HW_WANT_MONITOR_VIF = 1<<14,
1194 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, 1213 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
1195 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, 1214 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
1196 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1215 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1197 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1216 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1198 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1217 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1199 /* reuse bit 20 */ 1218 IEEE80211_HW_QUEUE_CONTROL = 1<<20,
1200 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1219 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1201 IEEE80211_HW_AP_LINK_PS = 1<<22, 1220 IEEE80211_HW_AP_LINK_PS = 1<<22,
1202 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1221 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
@@ -1266,6 +1285,9 @@ enum ieee80211_hw_flags {
1266 * @max_tx_aggregation_subframes: maximum number of subframes in an 1285 * @max_tx_aggregation_subframes: maximum number of subframes in an
1267 * aggregate an HT driver will transmit, used by the peer as a 1286 * aggregate an HT driver will transmit, used by the peer as a
1268 * hint to size its reorder buffer. 1287 * hint to size its reorder buffer.
1288 *
1289 * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
1290 * (if %IEEE80211_HW_QUEUE_CONTROL is set)
1269 */ 1291 */
1270struct ieee80211_hw { 1292struct ieee80211_hw {
1271 struct ieee80211_conf conf; 1293 struct ieee80211_conf conf;
@@ -1286,6 +1308,7 @@ struct ieee80211_hw {
1286 u8 max_rate_tries; 1308 u8 max_rate_tries;
1287 u8 max_rx_aggregation_subframes; 1309 u8 max_rx_aggregation_subframes;
1288 u8 max_tx_aggregation_subframes; 1310 u8 max_tx_aggregation_subframes;
1311 u8 offchannel_tx_hw_queue;
1289}; 1312};
1290 1313
1291/** 1314/**
@@ -1694,6 +1717,61 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1694 */ 1717 */
1695 1718
1696/** 1719/**
1720 * DOC: HW queue control
1721 *
1722 * Before HW queue control was introduced, mac80211 only had a single static
1723 * assignment of per-interface AC software queues to hardware queues. This
1724 * was problematic for a few reasons:
1725 * 1) off-channel transmissions might get stuck behind other frames
1726 * 2) multiple virtual interfaces couldn't be handled correctly
1727 * 3) after-DTIM frames could get stuck behind other frames
1728 *
1729 * To solve this, hardware typically uses multiple different queues for all
1730 * the different usages, and this needs to be propagated into mac80211 so it
1731 * won't have the same problem with the software queues.
1732 *
1733 * Therefore, mac80211 now offers the %IEEE80211_HW_QUEUE_CONTROL capability
1734 * flag that tells it that the driver implements its own queue control. To do
1735 * so, the driver will set up the various queues in each &struct ieee80211_vif
1736 * and the offchannel queue in &struct ieee80211_hw. In response, mac80211 will
1737 * use those queue IDs in the hw_queue field of &struct ieee80211_tx_info and
1738 * if necessary will queue the frame on the right software queue that mirrors
1739 * the hardware queue.
1740 * Additionally, the driver has to then use these HW queue IDs for the queue
1741 * management functions (ieee80211_stop_queue() et al.)
1742 *
1743 * The driver is free to set up the queue mappings as needed, multiple virtual
1744 * interfaces may map to the same hardware queues if needed. The setup has to
1745 * happen during add_interface or change_interface callbacks. For example, a
1746 * driver supporting station+station and station+AP modes might decide to have
1747 * 10 hardware queues to handle different scenarios:
1748 *
1749 * 4 AC HW queues for 1st vif: 0, 1, 2, 3
1750 * 4 AC HW queues for 2nd vif: 4, 5, 6, 7
1751 * after-DTIM queue for AP: 8
1752 * off-channel queue: 9
1753 *
1754 * It would then set up the hardware like this:
1755 * hw.offchannel_tx_hw_queue = 9
1756 *
1757 * and the first virtual interface that is added as follows:
1758 * vif.hw_queue[IEEE80211_AC_VO] = 0
1759 * vif.hw_queue[IEEE80211_AC_VI] = 1
1760 * vif.hw_queue[IEEE80211_AC_BE] = 2
1761 * vif.hw_queue[IEEE80211_AC_BK] = 3
1762 * vif.cab_queue = 8 // if AP mode, otherwise %IEEE80211_INVAL_HW_QUEUE
1763 * and the second virtual interface with 4-7.
1764 *
1765 * If queue 6 gets full, for example, mac80211 would only stop the second
1766 * virtual interface's BE queue since virtual interface queues are per AC.
1767 *
1768 * Note that the vif.cab_queue value should be set to %IEEE80211_INVAL_HW_QUEUE
1769 * whenever the queue is not used (i.e. the interface is not in AP mode) if the
1770 * queue could potentially be shared since mac80211 will look at cab_queue when
1771 * a queue is stopped/woken even if the interface is not in AP mode.
1772 */
1773
1774/**
1697 * enum ieee80211_filter_flags - hardware filter flags 1775 * enum ieee80211_filter_flags - hardware filter flags
1698 * 1776 *
1699 * These flags determine what the filter in hardware should be 1777 * These flags determine what the filter in hardware should be
@@ -1780,6 +1858,18 @@ enum ieee80211_frame_release_type {
1780}; 1858};
1781 1859
1782/** 1860/**
1861 * enum ieee80211_rate_control_changed - flags to indicate what changed
1862 *
1863 * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
1864 * to this station changed.
1865 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
1866 */
1867enum ieee80211_rate_control_changed {
1868 IEEE80211_RC_BW_CHANGED = BIT(0),
1869 IEEE80211_RC_SMPS_CHANGED = BIT(1),
1870};
1871
1872/**
1783 * struct ieee80211_ops - callbacks from mac80211 to the driver 1873 * struct ieee80211_ops - callbacks from mac80211 to the driver
1784 * 1874 *
1785 * This structure contains various callbacks that the driver may 1875 * This structure contains various callbacks that the driver may
@@ -1980,6 +2070,14 @@ enum ieee80211_frame_release_type {
1980 * up the list of states. 2070 * up the list of states.
1981 * The callback can sleep. 2071 * The callback can sleep.
1982 * 2072 *
2073 * @sta_rc_update: Notifies the driver of changes to the bitrates that can be
2074 * used to transmit to the station. The changes are advertised with bits
2075 * from &enum ieee80211_rate_control_changed and the values are reflected
2076 * in the station data. This callback should only be used when the driver
2077 * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
2078 * otherwise the rate control algorithm is notified directly.
2079 * Must be atomic.
2080 *
1983 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 2081 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1984 * bursting) for a hardware TX queue. 2082 * bursting) for a hardware TX queue.
1985 * Returns a negative error code on failure. 2083 * Returns a negative error code on failure.
@@ -2125,6 +2223,14 @@ enum ieee80211_frame_release_type {
2125 * The @tids parameter is a bitmap and tells the driver which TIDs the 2223 * The @tids parameter is a bitmap and tells the driver which TIDs the
2126 * frames will be on; it will at most have two bits set. 2224 * frames will be on; it will at most have two bits set.
2127 * This callback must be atomic. 2225 * This callback must be atomic.
2226 *
2227 * @get_et_sset_count: Ethtool API to get string-set count.
2228 *
2229 * @get_et_stats: Ethtool API to get a set of u64 stats.
2230 *
2231 * @get_et_strings: Ethtool API to get a set of strings to describe stats
2232 * and perhaps other supported types of ethtool data-sets.
2233 *
2128 */ 2234 */
2129struct ieee80211_ops { 2235struct ieee80211_ops {
2130 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 2236 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -2135,6 +2241,7 @@ struct ieee80211_ops {
2135#ifdef CONFIG_PM 2241#ifdef CONFIG_PM
2136 int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); 2242 int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
2137 int (*resume)(struct ieee80211_hw *hw); 2243 int (*resume)(struct ieee80211_hw *hw);
2244 void (*set_wakeup)(struct ieee80211_hw *hw, bool enabled);
2138#endif 2245#endif
2139 int (*add_interface)(struct ieee80211_hw *hw, 2246 int (*add_interface)(struct ieee80211_hw *hw,
2140 struct ieee80211_vif *vif); 2247 struct ieee80211_vif *vif);
@@ -2196,8 +2303,12 @@ struct ieee80211_ops {
2196 struct ieee80211_sta *sta, 2303 struct ieee80211_sta *sta,
2197 enum ieee80211_sta_state old_state, 2304 enum ieee80211_sta_state old_state,
2198 enum ieee80211_sta_state new_state); 2305 enum ieee80211_sta_state new_state);
2306 void (*sta_rc_update)(struct ieee80211_hw *hw,
2307 struct ieee80211_vif *vif,
2308 struct ieee80211_sta *sta,
2309 u32 changed);
2199 int (*conf_tx)(struct ieee80211_hw *hw, 2310 int (*conf_tx)(struct ieee80211_hw *hw,
2200 struct ieee80211_vif *vif, u16 queue, 2311 struct ieee80211_vif *vif, u16 ac,
2201 const struct ieee80211_tx_queue_params *params); 2312 const struct ieee80211_tx_queue_params *params);
2202 u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 2313 u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2203 void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2314 void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -2250,6 +2361,15 @@ struct ieee80211_ops {
2250 u16 tids, int num_frames, 2361 u16 tids, int num_frames,
2251 enum ieee80211_frame_release_type reason, 2362 enum ieee80211_frame_release_type reason,
2252 bool more_data); 2363 bool more_data);
2364
2365 int (*get_et_sset_count)(struct ieee80211_hw *hw,
2366 struct ieee80211_vif *vif, int sset);
2367 void (*get_et_stats)(struct ieee80211_hw *hw,
2368 struct ieee80211_vif *vif,
2369 struct ethtool_stats *stats, u64 *data);
2370 void (*get_et_strings)(struct ieee80211_hw *hw,
2371 struct ieee80211_vif *vif,
2372 u32 sset, u8 *data);
2253}; 2373};
2254 2374
2255/** 2375/**
@@ -2844,6 +2964,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
2844 */ 2964 */
2845__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, 2965__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
2846 struct ieee80211_vif *vif, 2966 struct ieee80211_vif *vif,
2967 enum ieee80211_band band,
2847 size_t frame_len, 2968 size_t frame_len,
2848 struct ieee80211_rate *rate); 2969 struct ieee80211_rate *rate);
2849 2970
@@ -3512,19 +3633,6 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
3512/* Rate control API */ 3633/* Rate control API */
3513 3634
3514/** 3635/**
3515 * enum rate_control_changed - flags to indicate which parameter changed
3516 *
3517 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
3518 * changed, rate control algorithm can update its internal state if needed.
3519 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed, the rate
3520 * control algorithm needs to adjust accordingly.
3521 */
3522enum rate_control_changed {
3523 IEEE80211_RC_HT_CHANGED = BIT(0),
3524 IEEE80211_RC_SMPS_CHANGED = BIT(1),
3525};
3526
3527/**
3528 * struct ieee80211_tx_rate_control - rate control information for/from RC algo 3636 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
3529 * 3637 *
3530 * @hw: The hardware the algorithm is invoked for. 3638 * @hw: The hardware the algorithm is invoked for.
@@ -3569,9 +3677,8 @@ struct rate_control_ops {
3569 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, 3677 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
3570 struct ieee80211_sta *sta, void *priv_sta); 3678 struct ieee80211_sta *sta, void *priv_sta);
3571 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, 3679 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
3572 struct ieee80211_sta *sta, 3680 struct ieee80211_sta *sta, void *priv_sta,
3573 void *priv_sta, u32 changed, 3681 u32 changed);
3574 enum nl80211_channel_type oper_chan_type);
3575 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 3682 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
3576 void *priv_sta); 3683 void *priv_sta);
3577 3684
@@ -3706,8 +3813,20 @@ void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
3706 3813
3707void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); 3814void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
3708 3815
3709int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb); 3816int ieee80211_add_srates_ie(struct ieee80211_vif *vif,
3817 struct sk_buff *skb, bool need_basic);
3710 3818
3711int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, 3819int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
3712 struct sk_buff *skb); 3820 struct sk_buff *skb, bool need_basic);
3821
3822/**
3823 * ieee80211_ave_rssi - report the average rssi for the specified interface
3824 *
3825 * @vif: the specified virtual interface
3826 *
3827 * This function return the average rssi value for the requested interface.
3828 * It assumes that the given vif is valid.
3829 */
3830int ieee80211_ave_rssi(struct ieee80211_vif *vif);
3831
3713#endif /* MAC80211_H */ 3832#endif /* MAC80211_H */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
new file mode 100644
index 000000000000..c9f8ab5cc687
--- /dev/null
+++ b/include/net/mac802154.h
@@ -0,0 +1,136 @@
1/*
2 * IEEE802.15.4-2003 specification
3 *
4 * Copyright (C) 2007-2012 Siemens AG
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
8 * 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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19#ifndef NET_MAC802154_H
20#define NET_MAC802154_H
21
22#include <net/af_ieee802154.h>
23
24/* The following flags are used to indicate changed address settings from
25 * the stack to the hardware.
26 */
27
28/* indicates that the Short Address changed */
29#define IEEE802515_AFILT_SADDR_CHANGED 0x00000001
30/* indicates that the IEEE Address changed */
31#define IEEE802515_AFILT_IEEEADDR_CHANGED 0x00000002
32/* indicates that the PAN ID changed */
33#define IEEE802515_AFILT_PANID_CHANGED 0x00000004
34/* indicates that PAN Coordinator status changed */
35#define IEEE802515_AFILT_PANC_CHANGED 0x00000008
36
37struct ieee802154_hw_addr_filt {
38 __le16 pan_id; /* Each independent PAN selects a unique
39 * identifier. This PAN id allows communication
40 * between devices within a network using short
41 * addresses and enables transmissions between
42 * devices across independent networks.
43 */
44 __le16 short_addr;
45 u8 ieee_addr[IEEE802154_ADDR_LEN];
46 u8 pan_coord;
47};
48
49struct ieee802154_dev {
50 /* filled by the driver */
51 int extra_tx_headroom;
52 u32 flags;
53 struct device *parent;
54
55 /* filled by mac802154 core */
56 struct ieee802154_hw_addr_filt hw_filt;
57 void *priv;
58 struct wpan_phy *phy;
59};
60
61/* Checksum is in hardware and is omitted from a packet
62 *
63 * These following flags are used to indicate hardware capabilities to
64 * the stack. Generally, flags here should have their meaning
65 * done in a way that the simplest hardware doesn't need setting
66 * any particular flags. There are some exceptions to this rule,
67 * however, so you are advised to review these flags carefully.
68 */
69
70/* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */
71#define IEEE802154_HW_OMIT_CKSUM 0x00000001
72/* Indicates that receiver will autorespond with ACK frames. */
73#define IEEE802154_HW_AACK 0x00000002
74
75/* struct ieee802154_ops - callbacks from mac802154 to the driver
76 *
77 * This structure contains various callbacks that the driver may
78 * handle or, in some cases, must handle, for example to transmit
79 * a frame.
80 *
81 * start: Handler that 802.15.4 module calls for device initialization.
82 * This function is called before the first interface is attached.
83 *
84 * stop: Handler that 802.15.4 module calls for device cleanup.
85 * This function is called after the last interface is removed.
86 *
87 * xmit: Handler that 802.15.4 module calls for each transmitted frame.
88 * skb cntains the buffer starting from the IEEE 802.15.4 header.
89 * The low-level driver should send the frame based on available
90 * configuration.
91 * This function should return zero or negative errno. Called with
92 * pib_lock held.
93 *
94 * ed: Handler that 802.15.4 module calls for Energy Detection.
95 * This function should place the value for detected energy
96 * (usually device-dependant) in the level pointer and return
97 * either zero or negative errno. Called with pib_lock held.
98 *
99 * set_channel:
100 * Set radio for listening on specific channel.
101 * Set the device for listening on specified channel.
102 * Returns either zero, or negative errno. Called with pib_lock held.
103 *
104 * set_hw_addr_filt:
105 * Set radio for listening on specific address.
106 * Set the device for listening on specified address.
107 * Returns either zero, or negative errno.
108 */
109struct ieee802154_ops {
110 struct module *owner;
111 int (*start)(struct ieee802154_dev *dev);
112 void (*stop)(struct ieee802154_dev *dev);
113 int (*xmit)(struct ieee802154_dev *dev,
114 struct sk_buff *skb);
115 int (*ed)(struct ieee802154_dev *dev, u8 *level);
116 int (*set_channel)(struct ieee802154_dev *dev,
117 int page,
118 int channel);
119 int (*set_hw_addr_filt)(struct ieee802154_dev *dev,
120 struct ieee802154_hw_addr_filt *filt,
121 unsigned long changed);
122 int (*ieee_addr)(struct ieee802154_dev *dev,
123 u8 addr[IEEE802154_ADDR_LEN]);
124};
125
126/* Basic interface to register ieee802154 device */
127struct ieee802154_dev *
128ieee802154_alloc_device(size_t priv_data_lex, struct ieee802154_ops *ops);
129void ieee802154_free_device(struct ieee802154_dev *dev);
130int ieee802154_register_device(struct ieee802154_dev *dev);
131void ieee802154_unregister_device(struct ieee802154_dev *dev);
132
133void ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb,
134 u8 lqi);
135
136#endif /* NET_MAC802154_H */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 6f9c25a76cd1..c02b6ad3f6c5 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -34,6 +34,7 @@ enum {
34 __ND_OPT_ARRAY_MAX, 34 __ND_OPT_ARRAY_MAX,
35 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */ 35 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */
36 ND_OPT_RDNSS = 25, /* RFC5006 */ 36 ND_OPT_RDNSS = 25, /* RFC5006 */
37 ND_OPT_DNSSL = 31, /* RFC6106 */
37 __ND_OPT_MAX 38 __ND_OPT_MAX
38}; 39};
39 40
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 34c996f46181..6cdfeedb650b 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -195,7 +195,6 @@ static inline void *neighbour_priv(const struct neighbour *n)
195#define NEIGH_UPDATE_F_ADMIN 0x80000000 195#define NEIGH_UPDATE_F_ADMIN 0x80000000
196 196
197extern void neigh_table_init(struct neigh_table *tbl); 197extern void neigh_table_init(struct neigh_table *tbl);
198extern void neigh_table_init_no_netlink(struct neigh_table *tbl);
199extern int neigh_table_clear(struct neigh_table *tbl); 198extern int neigh_table_clear(struct neigh_table *tbl);
200extern struct neighbour * neigh_lookup(struct neigh_table *tbl, 199extern struct neighbour * neigh_lookup(struct neigh_table *tbl,
201 const void *pkey, 200 const void *pkey,
@@ -323,7 +322,7 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
323#ifdef CONFIG_BRIDGE_NETFILTER 322#ifdef CONFIG_BRIDGE_NETFILTER
324static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) 323static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
325{ 324{
326 unsigned seq, hh_alen; 325 unsigned int seq, hh_alen;
327 326
328 do { 327 do {
329 seq = read_seqbegin(&hh->hh_lock); 328 seq = read_seqbegin(&hh->hh_lock);
@@ -336,7 +335,7 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
336 335
337static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) 336static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb)
338{ 337{
339 unsigned seq; 338 unsigned int seq;
340 int hh_len; 339 int hh_len;
341 340
342 do { 341 do {
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ee547c149810..ac9195e6a062 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -279,14 +279,25 @@ extern void unregister_pernet_subsys(struct pernet_operations *);
279extern int register_pernet_device(struct pernet_operations *); 279extern int register_pernet_device(struct pernet_operations *);
280extern void unregister_pernet_device(struct pernet_operations *); 280extern void unregister_pernet_device(struct pernet_operations *);
281 281
282struct ctl_path;
283struct ctl_table; 282struct ctl_table;
284struct ctl_table_header; 283struct ctl_table_header;
285 284
286extern struct ctl_table_header *register_net_sysctl_table(struct net *net, 285#ifdef CONFIG_SYSCTL
287 const struct ctl_path *path, struct ctl_table *table); 286extern int net_sysctl_init(void);
288extern struct ctl_table_header *register_net_sysctl_rotable( 287extern struct ctl_table_header *register_net_sysctl(struct net *net,
289 const struct ctl_path *path, struct ctl_table *table); 288 const char *path, struct ctl_table *table);
290extern void unregister_net_sysctl_table(struct ctl_table_header *header); 289extern void unregister_net_sysctl_table(struct ctl_table_header *header);
290#else
291static inline int net_sysctl_init(void) { return 0; }
292static inline struct ctl_table_header *register_net_sysctl(struct net *net,
293 const char *path, struct ctl_table *table)
294{
295 return NULL;
296}
297static inline void unregister_net_sysctl_table(struct ctl_table_header *header)
298{
299}
300#endif
301
291 302
292#endif /* __NET_NET_NAMESPACE_H */ 303#endif /* __NET_NET_NAMESPACE_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index ab86036bbf0c..cce7f6a798bf 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -321,14 +321,8 @@ extern unsigned int nf_conntrack_max;
321extern unsigned int nf_conntrack_hash_rnd; 321extern unsigned int nf_conntrack_hash_rnd;
322void init_nf_conntrack_hash_rnd(void); 322void init_nf_conntrack_hash_rnd(void);
323 323
324#define NF_CT_STAT_INC(net, count) \ 324#define NF_CT_STAT_INC(net, count) __this_cpu_inc((net)->ct.stat->count)
325 __this_cpu_inc((net)->ct.stat->count) 325#define NF_CT_STAT_INC_ATOMIC(net, count) this_cpu_inc((net)->ct.stat->count)
326#define NF_CT_STAT_INC_ATOMIC(net, count) \
327do { \
328 local_bh_disable(); \
329 __this_cpu_inc((net)->ct.stat->count); \
330 local_bh_enable(); \
331} while (0)
332 326
333#define MODULE_ALIAS_NFCT_HELPER(helper) \ 327#define MODULE_ALIAS_NFCT_HELPER(helper) \
334 MODULE_ALIAS("nfct-helper-" helper) 328 MODULE_ALIAS("nfct-helper-" helper)
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 5767dc242dee..1d1889409b9e 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -60,8 +60,8 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
60 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); 60 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
61} 61}
62 62
63extern int nf_conntrack_helper_init(void); 63extern int nf_conntrack_helper_init(struct net *net);
64extern void nf_conntrack_helper_fini(void); 64extern void nf_conntrack_helper_fini(struct net *net);
65 65
66extern int nf_conntrack_broadcast_help(struct sk_buff *skb, 66extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
67 unsigned int protoff, 67 unsigned int protoff,
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index e8010f445ae1..9699c028b74b 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -65,7 +65,7 @@ struct nf_conntrack_l3proto {
65 65
66#ifdef CONFIG_SYSCTL 66#ifdef CONFIG_SYSCTL
67 struct ctl_table_header *ctl_table_header; 67 struct ctl_table_header *ctl_table_header;
68 struct ctl_path *ctl_table_path; 68 const char *ctl_table_path;
69 struct ctl_table *ctl_table; 69 struct ctl_table *ctl_table;
70#endif /* CONFIG_SYSCTL */ 70#endif /* CONFIG_SYSCTL */
71 71
diff --git a/include/net/netlink.h b/include/net/netlink.h
index f394fe5d7641..785f37a3b44e 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -102,20 +102,6 @@
102 * nla_put_flag(skb, type) add flag attribute to skb 102 * nla_put_flag(skb, type) add flag attribute to skb
103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb 103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
104 * 104 *
105 * Exceptions Based Attribute Construction:
106 * NLA_PUT(skb, type, len, data) add attribute to skb
107 * NLA_PUT_U8(skb, type, value) add u8 attribute to skb
108 * NLA_PUT_U16(skb, type, value) add u16 attribute to skb
109 * NLA_PUT_U32(skb, type, value) add u32 attribute to skb
110 * NLA_PUT_U64(skb, type, value) add u64 attribute to skb
111 * NLA_PUT_STRING(skb, type, str) add string attribute to skb
112 * NLA_PUT_FLAG(skb, type) add flag attribute to skb
113 * NLA_PUT_MSECS(skb, type, jiffies) add msecs attribute to skb
114 *
115 * The meaning of these functions is equal to their lower case
116 * variants but they jump to the label nla_put_failure in case
117 * of a failure.
118 *
119 * Nested Attributes Construction: 105 * Nested Attributes Construction:
120 * nla_nest_start(skb, type) start a nested attribute 106 * nla_nest_start(skb, type) start a nested attribute
121 * nla_nest_end(skb, nla) finalize a nested attribute 107 * nla_nest_end(skb, nla) finalize a nested attribute
@@ -772,6 +758,39 @@ static inline int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value)
772} 758}
773 759
774/** 760/**
761 * nla_put_be16 - Add a __be16 netlink attribute to a socket buffer
762 * @skb: socket buffer to add attribute to
763 * @attrtype: attribute type
764 * @value: numeric value
765 */
766static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value)
767{
768 return nla_put(skb, attrtype, sizeof(__be16), &value);
769}
770
771/**
772 * nla_put_net16 - Add 16-bit network byte order netlink attribute to a socket buffer
773 * @skb: socket buffer to add attribute to
774 * @attrtype: attribute type
775 * @value: numeric value
776 */
777static inline int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value)
778{
779 return nla_put_be16(skb, attrtype | NLA_F_NET_BYTEORDER, value);
780}
781
782/**
783 * nla_put_le16 - Add a __le16 netlink attribute to a socket buffer
784 * @skb: socket buffer to add attribute to
785 * @attrtype: attribute type
786 * @value: numeric value
787 */
788static inline int nla_put_le16(struct sk_buff *skb, int attrtype, __le16 value)
789{
790 return nla_put(skb, attrtype, sizeof(__le16), &value);
791}
792
793/**
775 * nla_put_u32 - Add a u32 netlink attribute to a socket buffer 794 * nla_put_u32 - Add a u32 netlink attribute to a socket buffer
776 * @skb: socket buffer to add attribute to 795 * @skb: socket buffer to add attribute to
777 * @attrtype: attribute type 796 * @attrtype: attribute type
@@ -783,7 +802,40 @@ static inline int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value)
783} 802}
784 803
785/** 804/**
786 * nla_put_64 - Add a u64 netlink attribute to a socket buffer 805 * nla_put_be32 - Add a __be32 netlink attribute to a socket buffer
806 * @skb: socket buffer to add attribute to
807 * @attrtype: attribute type
808 * @value: numeric value
809 */
810static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value)
811{
812 return nla_put(skb, attrtype, sizeof(__be32), &value);
813}
814
815/**
816 * nla_put_net32 - Add 32-bit network byte order netlink attribute to a socket buffer
817 * @skb: socket buffer to add attribute to
818 * @attrtype: attribute type
819 * @value: numeric value
820 */
821static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value)
822{
823 return nla_put_be32(skb, attrtype | NLA_F_NET_BYTEORDER, value);
824}
825
826/**
827 * nla_put_le32 - Add a __le32 netlink attribute to a socket buffer
828 * @skb: socket buffer to add attribute to
829 * @attrtype: attribute type
830 * @value: numeric value
831 */
832static inline int nla_put_le32(struct sk_buff *skb, int attrtype, __le32 value)
833{
834 return nla_put(skb, attrtype, sizeof(__le32), &value);
835}
836
837/**
838 * nla_put_u64 - Add a u64 netlink attribute to a socket buffer
787 * @skb: socket buffer to add attribute to 839 * @skb: socket buffer to add attribute to
788 * @attrtype: attribute type 840 * @attrtype: attribute type
789 * @value: numeric value 841 * @value: numeric value
@@ -794,6 +846,39 @@ static inline int nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
794} 846}
795 847
796/** 848/**
849 * nla_put_be64 - Add a __be64 netlink attribute to a socket buffer
850 * @skb: socket buffer to add attribute to
851 * @attrtype: attribute type
852 * @value: numeric value
853 */
854static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
855{
856 return nla_put(skb, attrtype, sizeof(__be64), &value);
857}
858
859/**
860 * nla_put_net64 - Add 64-bit network byte order netlink attribute to a socket buffer
861 * @skb: socket buffer to add attribute to
862 * @attrtype: attribute type
863 * @value: numeric value
864 */
865static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value)
866{
867 return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, value);
868}
869
870/**
871 * nla_put_le64 - Add a __le64 netlink attribute to a socket buffer
872 * @skb: socket buffer to add attribute to
873 * @attrtype: attribute type
874 * @value: numeric value
875 */
876static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value)
877{
878 return nla_put(skb, attrtype, sizeof(__le64), &value);
879}
880
881/**
797 * nla_put_string - Add a string netlink attribute to a socket buffer 882 * nla_put_string - Add a string netlink attribute to a socket buffer
798 * @skb: socket buffer to add attribute to 883 * @skb: socket buffer to add attribute to
799 * @attrtype: attribute type 884 * @attrtype: attribute type
@@ -828,60 +913,6 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
828 return nla_put(skb, attrtype, sizeof(u64), &tmp); 913 return nla_put(skb, attrtype, sizeof(u64), &tmp);
829} 914}
830 915
831#define NLA_PUT(skb, attrtype, attrlen, data) \
832 do { \
833 if (unlikely(nla_put(skb, attrtype, attrlen, data) < 0)) \
834 goto nla_put_failure; \
835 } while(0)
836
837#define NLA_PUT_TYPE(skb, type, attrtype, value) \
838 do { \
839 type __tmp = value; \
840 NLA_PUT(skb, attrtype, sizeof(type), &__tmp); \
841 } while(0)
842
843#define NLA_PUT_U8(skb, attrtype, value) \
844 NLA_PUT_TYPE(skb, u8, attrtype, value)
845
846#define NLA_PUT_U16(skb, attrtype, value) \
847 NLA_PUT_TYPE(skb, u16, attrtype, value)
848
849#define NLA_PUT_LE16(skb, attrtype, value) \
850 NLA_PUT_TYPE(skb, __le16, attrtype, value)
851
852#define NLA_PUT_BE16(skb, attrtype, value) \
853 NLA_PUT_TYPE(skb, __be16, attrtype, value)
854
855#define NLA_PUT_NET16(skb, attrtype, value) \
856 NLA_PUT_BE16(skb, attrtype | NLA_F_NET_BYTEORDER, value)
857
858#define NLA_PUT_U32(skb, attrtype, value) \
859 NLA_PUT_TYPE(skb, u32, attrtype, value)
860
861#define NLA_PUT_BE32(skb, attrtype, value) \
862 NLA_PUT_TYPE(skb, __be32, attrtype, value)
863
864#define NLA_PUT_NET32(skb, attrtype, value) \
865 NLA_PUT_BE32(skb, attrtype | NLA_F_NET_BYTEORDER, value)
866
867#define NLA_PUT_U64(skb, attrtype, value) \
868 NLA_PUT_TYPE(skb, u64, attrtype, value)
869
870#define NLA_PUT_BE64(skb, attrtype, value) \
871 NLA_PUT_TYPE(skb, __be64, attrtype, value)
872
873#define NLA_PUT_NET64(skb, attrtype, value) \
874 NLA_PUT_BE64(skb, attrtype | NLA_F_NET_BYTEORDER, value)
875
876#define NLA_PUT_STRING(skb, attrtype, value) \
877 NLA_PUT(skb, attrtype, strlen(value) + 1, value)
878
879#define NLA_PUT_FLAG(skb, attrtype) \
880 NLA_PUT(skb, attrtype, 0, NULL)
881
882#define NLA_PUT_MSECS(skb, attrtype, jiffies) \
883 NLA_PUT_U64(skb, attrtype, jiffies_to_msecs(jiffies))
884
885/** 916/**
886 * nla_get_u32 - return payload of u32 attribute 917 * nla_get_u32 - return payload of u32 attribute
887 * @nla: u32 netlink attribute 918 * @nla: u32 netlink attribute
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 7a911eca0f18..a053a19870cf 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -26,11 +26,14 @@ struct netns_ct {
26 int sysctl_tstamp; 26 int sysctl_tstamp;
27 int sysctl_checksum; 27 int sysctl_checksum;
28 unsigned int sysctl_log_invalid; /* Log invalid packets */ 28 unsigned int sysctl_log_invalid; /* Log invalid packets */
29 int sysctl_auto_assign_helper;
30 bool auto_assign_helper_warned;
29#ifdef CONFIG_SYSCTL 31#ifdef CONFIG_SYSCTL
30 struct ctl_table_header *sysctl_header; 32 struct ctl_table_header *sysctl_header;
31 struct ctl_table_header *acct_sysctl_header; 33 struct ctl_table_header *acct_sysctl_header;
32 struct ctl_table_header *tstamp_sysctl_header; 34 struct ctl_table_header *tstamp_sysctl_header;
33 struct ctl_table_header *event_sysctl_header; 35 struct ctl_table_header *event_sysctl_header;
36 struct ctl_table_header *helper_sysctl_header;
34#endif 37#endif
35 char *slabname; 38 char *slabname;
36}; 39};
diff --git a/include/net/netns/hash.h b/include/net/netns/hash.h
index 548d78f2cc47..c06ac58ca107 100644
--- a/include/net/netns/hash.h
+++ b/include/net/netns/hash.h
@@ -5,7 +5,7 @@
5 5
6struct net; 6struct net;
7 7
8static inline unsigned net_hash_mix(struct net *net) 8static inline unsigned int net_hash_mix(struct net *net)
9{ 9{
10#ifdef CONFIG_NET_NS 10#ifdef CONFIG_NET_NS
11 /* 11 /*
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 81abfcb2eb4e..b42be53587ba 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -12,7 +12,9 @@ struct ctl_table_header;
12 12
13struct netns_sysctl_ipv6 { 13struct netns_sysctl_ipv6 {
14#ifdef CONFIG_SYSCTL 14#ifdef CONFIG_SYSCTL
15 struct ctl_table_header *table; 15 struct ctl_table_header *hdr;
16 struct ctl_table_header *route_hdr;
17 struct ctl_table_header *icmp_hdr;
16 struct ctl_table_header *frags_hdr; 18 struct ctl_table_header *frags_hdr;
17#endif 19#endif
18 int bindv6only; 20 int bindv6only;
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
new file mode 100644
index 000000000000..aca65a5a9d0d
--- /dev/null
+++ b/include/net/nfc/hci.h
@@ -0,0 +1,198 @@
1/*
2 * Copyright (C) 2011 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License 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 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __NET_HCI_H
21#define __NET_HCI_H
22
23#include <linux/skbuff.h>
24
25#include <net/nfc/nfc.h>
26
27struct nfc_hci_dev;
28
29struct nfc_hci_ops {
30 int (*open) (struct nfc_hci_dev *hdev);
31 void (*close) (struct nfc_hci_dev *hdev);
32 int (*hci_ready) (struct nfc_hci_dev *hdev);
33 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
34 int (*start_poll) (struct nfc_hci_dev *hdev, u32 protocols);
35 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate,
36 struct nfc_target *target);
37 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
38 struct nfc_target *target);
39 int (*data_exchange) (struct nfc_hci_dev *hdev,
40 struct nfc_target *target,
41 struct sk_buff *skb, struct sk_buff **res_skb);
42};
43
44#define NFC_HCI_MAX_CUSTOM_GATES 15
45struct nfc_hci_init_data {
46 u8 gate_count;
47 u8 gates[NFC_HCI_MAX_CUSTOM_GATES];
48 char session_id[9];
49};
50
51typedef int (*xmit) (struct sk_buff *skb, void *cb_data);
52
53#define NFC_HCI_MAX_GATES 256
54
55struct nfc_hci_dev {
56 struct nfc_dev *ndev;
57
58 u32 max_data_link_payload;
59
60 struct mutex msg_tx_mutex;
61
62 struct list_head msg_tx_queue;
63
64 struct workqueue_struct *msg_tx_wq;
65 struct work_struct msg_tx_work;
66
67 struct timer_list cmd_timer;
68 struct hci_msg *cmd_pending_msg;
69
70 struct sk_buff_head rx_hcp_frags;
71
72 struct workqueue_struct *msg_rx_wq;
73 struct work_struct msg_rx_work;
74
75 struct sk_buff_head msg_rx_queue;
76
77 struct nfc_hci_ops *ops;
78
79 struct nfc_hci_init_data init_data;
80
81 void *clientdata;
82
83 u8 gate2pipe[NFC_HCI_MAX_GATES];
84
85 bool poll_started;
86 struct nfc_target *targets;
87 int target_count;
88
89 u8 sw_romlib;
90 u8 sw_patch;
91 u8 sw_flashlib_major;
92 u8 sw_flashlib_minor;
93
94 u8 hw_derivative;
95 u8 hw_version;
96 u8 hw_mpw;
97 u8 hw_software;
98 u8 hw_bsid;
99};
100
101/* hci device allocation */
102struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
103 struct nfc_hci_init_data *init_data,
104 u32 protocols,
105 int tx_headroom,
106 int tx_tailroom,
107 int max_link_payload);
108void nfc_hci_free_device(struct nfc_hci_dev *hdev);
109
110int nfc_hci_register_device(struct nfc_hci_dev *hdev);
111void nfc_hci_unregister_device(struct nfc_hci_dev *hdev);
112
113void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata);
114void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
115
116/* Host IDs */
117#define NFC_HCI_HOST_CONTROLLER_ID 0x00
118#define NFC_HCI_TERMINAL_HOST_ID 0x01
119#define NFC_HCI_UICC_HOST_ID 0x02
120
121/* Host Controller Gates and registry indexes */
122#define NFC_HCI_ADMIN_GATE 0x00
123#define NFC_HCI_ADMIN_SESSION_IDENTITY 0x01
124#define NFC_HCI_ADMIN_MAX_PIPE 0x02
125#define NFC_HCI_ADMIN_WHITELIST 0x03
126#define NFC_HCI_ADMIN_HOST_LIST 0x04
127
128#define NFC_HCI_LOOPBACK_GATE 0x04
129
130#define NFC_HCI_ID_MGMT_GATE 0x05
131#define NFC_HCI_ID_MGMT_VERSION_SW 0x01
132#define NFC_HCI_ID_MGMT_VERSION_HW 0x03
133#define NFC_HCI_ID_MGMT_VENDOR_NAME 0x04
134#define NFC_HCI_ID_MGMT_MODEL_ID 0x05
135#define NFC_HCI_ID_MGMT_HCI_VERSION 0x02
136#define NFC_HCI_ID_MGMT_GATES_LIST 0x06
137
138#define NFC_HCI_LINK_MGMT_GATE 0x06
139#define NFC_HCI_LINK_MGMT_REC_ERROR 0x01
140
141#define NFC_HCI_RF_READER_B_GATE 0x11
142#define NFC_HCI_RF_READER_B_PUPI 0x03
143#define NFC_HCI_RF_READER_B_APPLICATION_DATA 0x04
144#define NFC_HCI_RF_READER_B_AFI 0x02
145#define NFC_HCI_RF_READER_B_HIGHER_LAYER_RESPONSE 0x01
146#define NFC_HCI_RF_READER_B_HIGHER_LAYER_DATA 0x05
147
148#define NFC_HCI_RF_READER_A_GATE 0x13
149#define NFC_HCI_RF_READER_A_UID 0x02
150#define NFC_HCI_RF_READER_A_ATQA 0x04
151#define NFC_HCI_RF_READER_A_APPLICATION_DATA 0x05
152#define NFC_HCI_RF_READER_A_SAK 0x03
153#define NFC_HCI_RF_READER_A_FWI_SFGT 0x06
154#define NFC_HCI_RF_READER_A_DATARATE_MAX 0x01
155
156#define NFC_HCI_TYPE_A_SEL_PROT(x) (((x) & 0x60) >> 5)
157#define NFC_HCI_TYPE_A_SEL_PROT_MIFARE 0
158#define NFC_HCI_TYPE_A_SEL_PROT_ISO14443 1
159#define NFC_HCI_TYPE_A_SEL_PROT_DEP 2
160#define NFC_HCI_TYPE_A_SEL_PROT_ISO14443_DEP 3
161
162/* Generic events */
163#define NFC_HCI_EVT_HCI_END_OF_OPERATION 0x01
164#define NFC_HCI_EVT_POST_DATA 0x02
165#define NFC_HCI_EVT_HOT_PLUG 0x03
166
167/* Reader RF gates events */
168#define NFC_HCI_EVT_READER_REQUESTED 0x10
169#define NFC_HCI_EVT_END_OPERATION 0x11
170
171/* Reader Application gate events */
172#define NFC_HCI_EVT_TARGET_DISCOVERED 0x10
173
174/* receiving messages from lower layer */
175void nfc_hci_resp_received(struct nfc_hci_dev *hdev, u8 result,
176 struct sk_buff *skb);
177void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
178 struct sk_buff *skb);
179void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
180 struct sk_buff *skb);
181void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb);
182
183/* connecting to gates and sending hci instructions */
184int nfc_hci_connect_gate(struct nfc_hci_dev *hdev, u8 dest_host, u8 dest_gate);
185int nfc_hci_disconnect_gate(struct nfc_hci_dev *hdev, u8 gate);
186int nfc_hci_disconnect_all_gates(struct nfc_hci_dev *hdev);
187int nfc_hci_get_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
188 struct sk_buff **skb);
189int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
190 const u8 *param, size_t param_len);
191int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd,
192 const u8 *param, size_t param_len, struct sk_buff **skb);
193int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response,
194 const u8 *param, size_t param_len);
195int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
196 const u8 *param, size_t param_len);
197
198#endif /* __NET_HCI_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index bac070bf3514..9a2505a5b8de 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -62,10 +62,12 @@ struct nfc_ops {
62 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, 62 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx,
63 struct sk_buff *skb, data_exchange_cb_t cb, 63 struct sk_buff *skb, data_exchange_cb_t cb,
64 void *cb_context); 64 void *cb_context);
65 int (*check_presence)(struct nfc_dev *dev, u32 target_idx);
65}; 66};
66 67
67#define NFC_TARGET_IDX_ANY -1 68#define NFC_TARGET_IDX_ANY -1
68#define NFC_MAX_GT_LEN 48 69#define NFC_MAX_GT_LEN 48
70#define NFC_TARGET_IDX_NONE 0xffffffff
69 71
70struct nfc_target { 72struct nfc_target {
71 u32 idx; 73 u32 idx;
@@ -78,6 +80,8 @@ struct nfc_target {
78 u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; 80 u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
79 u8 sensf_res_len; 81 u8 sensf_res_len;
80 u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; 82 u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
83 u8 hci_reader_gate;
84 u8 logical_idx;
81}; 85};
82 86
83struct nfc_genl_data { 87struct nfc_genl_data {
@@ -86,7 +90,8 @@ struct nfc_genl_data {
86}; 90};
87 91
88struct nfc_dev { 92struct nfc_dev {
89 unsigned idx; 93 unsigned int idx;
94 u32 target_next_idx;
90 struct nfc_target *targets; 95 struct nfc_target *targets;
91 int n_targets; 96 int n_targets;
92 int targets_generation; 97 int targets_generation;
@@ -94,7 +99,7 @@ struct nfc_dev {
94 struct device dev; 99 struct device dev;
95 bool dev_up; 100 bool dev_up;
96 bool polling; 101 bool polling;
97 bool remote_activated; 102 u32 activated_target_idx;
98 bool dep_link_up; 103 bool dep_link_up;
99 u32 dep_rf_mode; 104 u32 dep_rf_mode;
100 struct nfc_genl_data genl_data; 105 struct nfc_genl_data genl_data;
@@ -103,6 +108,10 @@ struct nfc_dev {
103 int tx_headroom; 108 int tx_headroom;
104 int tx_tailroom; 109 int tx_tailroom;
105 110
111 struct timer_list check_pres_timer;
112 struct workqueue_struct *check_pres_wq;
113 struct work_struct check_pres_work;
114
106 struct nfc_ops *ops; 115 struct nfc_ops *ops;
107}; 116};
108#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) 117#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
@@ -181,6 +190,7 @@ int nfc_set_remote_general_bytes(struct nfc_dev *dev,
181 190
182int nfc_targets_found(struct nfc_dev *dev, 191int nfc_targets_found(struct nfc_dev *dev,
183 struct nfc_target *targets, int ntargets); 192 struct nfc_target *targets, int ntargets);
193int nfc_target_lost(struct nfc_dev *dev, u32 target_idx);
184 194
185int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, 195int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
186 u8 comm_mode, u8 rf_mode); 196 u8 comm_mode, u8 rf_mode);
diff --git a/include/net/nfc/shdlc.h b/include/net/nfc/shdlc.h
new file mode 100644
index 000000000000..1071987d0408
--- /dev/null
+++ b/include/net/nfc/shdlc.h
@@ -0,0 +1,104 @@
1/*
2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License 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 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __NFC_SHDLC_H
21#define __NFC_SHDLC_H
22
23struct nfc_shdlc;
24
25struct nfc_shdlc_ops {
26 int (*open) (struct nfc_shdlc *shdlc);
27 void (*close) (struct nfc_shdlc *shdlc);
28 int (*hci_ready) (struct nfc_shdlc *shdlc);
29 int (*xmit) (struct nfc_shdlc *shdlc, struct sk_buff *skb);
30 int (*start_poll) (struct nfc_shdlc *shdlc, u32 protocols);
31 int (*target_from_gate) (struct nfc_shdlc *shdlc, u8 gate,
32 struct nfc_target *target);
33 int (*complete_target_discovered) (struct nfc_shdlc *shdlc, u8 gate,
34 struct nfc_target *target);
35 int (*data_exchange) (struct nfc_shdlc *shdlc,
36 struct nfc_target *target,
37 struct sk_buff *skb, struct sk_buff **res_skb);
38};
39
40enum shdlc_state {
41 SHDLC_DISCONNECTED = 0,
42 SHDLC_CONNECTING = 1,
43 SHDLC_NEGOCIATING = 2,
44 SHDLC_CONNECTED = 3
45};
46
47struct nfc_shdlc {
48 struct mutex state_mutex;
49 enum shdlc_state state;
50 int hard_fault;
51
52 struct nfc_hci_dev *hdev;
53
54 wait_queue_head_t *connect_wq;
55 int connect_tries;
56 int connect_result;
57 struct timer_list connect_timer;/* aka T3 in spec 10.6.1 */
58
59 u8 w; /* window size */
60 bool srej_support;
61
62 struct timer_list t1_timer; /* send ack timeout */
63 bool t1_active;
64
65 struct timer_list t2_timer; /* guard/retransmit timeout */
66 bool t2_active;
67
68 int ns; /* next seq num for send */
69 int nr; /* next expected seq num for receive */
70 int dnr; /* oldest sent unacked seq num */
71
72 struct sk_buff_head rcv_q;
73
74 struct sk_buff_head send_q;
75 bool rnr; /* other side is not ready to receive */
76
77 struct sk_buff_head ack_pending_q;
78
79 struct workqueue_struct *sm_wq;
80 struct work_struct sm_work;
81
82 struct nfc_shdlc_ops *ops;
83
84 int client_headroom;
85 int client_tailroom;
86
87 void *clientdata;
88};
89
90void nfc_shdlc_recv_frame(struct nfc_shdlc *shdlc, struct sk_buff *skb);
91
92struct nfc_shdlc *nfc_shdlc_allocate(struct nfc_shdlc_ops *ops,
93 struct nfc_hci_init_data *init_data,
94 u32 protocols,
95 int tx_headroom, int tx_tailroom,
96 int max_link_payload, const char *devname);
97
98void nfc_shdlc_free(struct nfc_shdlc *shdlc);
99
100void nfc_shdlc_set_clientdata(struct nfc_shdlc *shdlc, void *clientdata);
101void *nfc_shdlc_get_clientdata(struct nfc_shdlc *shdlc);
102struct nfc_hci_dev *nfc_shdlc_get_hci_dev(struct nfc_shdlc *shdlc);
103
104#endif /* __NFC_SHDLC_H */
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index fffdc603f4c8..66f5ac370f92 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -107,7 +107,7 @@ extern int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
107/* Calculate maximal size of packet seen by hard_start_xmit 107/* Calculate maximal size of packet seen by hard_start_xmit
108 routine of this device. 108 routine of this device.
109 */ 109 */
110static inline unsigned psched_mtu(const struct net_device *dev) 110static inline unsigned int psched_mtu(const struct net_device *dev)
111{ 111{
112 return dev->mtu + dev->hard_header_len; 112 return dev->mtu + dev->hard_header_len;
113} 113}
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index cf7577234457..e7ea660e4db6 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -5,7 +5,7 @@
5 5
6void raw6_icmp_error(struct sk_buff *, int nexthdr, 6void raw6_icmp_error(struct sk_buff *, int nexthdr,
7 u8 type, u8 code, int inner_offset, __be32); 7 u8 type, u8 code, int inner_offset, __be32);
8int raw6_local_deliver(struct sk_buff *, int); 8bool raw6_local_deliver(struct sk_buff *, int);
9 9
10extern int rawv6_rcv(struct sock *sk, 10extern int rawv6_rcv(struct sock *sk,
11 struct sk_buff *skb); 11 struct sk_buff *skb);
diff --git a/include/net/route.h b/include/net/route.h
index b1c0d5b564c2..ed2b78e2375d 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -50,7 +50,7 @@ struct rtable {
50 __be32 rt_key_src; 50 __be32 rt_key_src;
51 51
52 int rt_genid; 52 int rt_genid;
53 unsigned rt_flags; 53 unsigned int rt_flags;
54 __u16 rt_type; 54 __u16 rt_type;
55 __u8 rt_key_tos; 55 __u8 rt_key_tos;
56 56
@@ -185,8 +185,8 @@ extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph
185 unsigned short new_mtu, struct net_device *dev); 185 unsigned short new_mtu, struct net_device *dev);
186extern void ip_rt_send_redirect(struct sk_buff *skb); 186extern void ip_rt_send_redirect(struct sk_buff *skb);
187 187
188extern unsigned inet_addr_type(struct net *net, __be32 addr); 188extern unsigned int inet_addr_type(struct net *net, __be32 addr);
189extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); 189extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr);
190extern void ip_rt_multicast_event(struct in_device *); 190extern void ip_rt_multicast_event(struct in_device *);
191extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); 191extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
192extern void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); 192extern void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 370293901971..bbcfd0993432 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -41,9 +41,11 @@ static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
41 * @get_size: Function to calculate required room for dumping device 41 * @get_size: Function to calculate required room for dumping device
42 * specific netlink attributes 42 * specific netlink attributes
43 * @fill_info: Function to dump device specific netlink attributes 43 * @fill_info: Function to dump device specific netlink attributes
44 * @get_xstats_size: Function to calculate required room for dumping devic 44 * @get_xstats_size: Function to calculate required room for dumping device
45 * specific statistics 45 * specific statistics
46 * @fill_xstats: Function to dump device specific statistics 46 * @fill_xstats: Function to dump device specific statistics
47 * @get_tx_queues: Function to determine number of transmit queues to create when
48 * creating a new device.
47 */ 49 */
48struct rtnl_link_ops { 50struct rtnl_link_ops {
49 struct list_head list; 51 struct list_head list;
@@ -75,9 +77,8 @@ struct rtnl_link_ops {
75 size_t (*get_xstats_size)(const struct net_device *dev); 77 size_t (*get_xstats_size)(const struct net_device *dev);
76 int (*fill_xstats)(struct sk_buff *skb, 78 int (*fill_xstats)(struct sk_buff *skb,
77 const struct net_device *dev); 79 const struct net_device *dev);
78 int (*get_tx_queues)(struct net *net, struct nlattr *tb[], 80 int (*get_tx_queues)(struct net *net,
79 unsigned int *tx_queues, 81 struct nlattr *tb[]);
80 unsigned int *real_tx_queues);
81}; 82};
82 83
83extern int __rtnl_link_register(struct rtnl_link_ops *ops); 84extern int __rtnl_link_register(struct rtnl_link_ops *ops);
@@ -94,7 +95,7 @@ extern void rtnl_link_unregister(struct rtnl_link_ops *ops);
94 * @fill_link_af: Function to fill IFLA_AF_SPEC with address family 95 * @fill_link_af: Function to fill IFLA_AF_SPEC with address family
95 * specific netlink attributes. 96 * specific netlink attributes.
96 * @get_link_af_size: Function to calculate size of address family specific 97 * @get_link_af_size: Function to calculate size of address family specific
97 * netlink attributes exlusive the container attribute. 98 * netlink attributes.
98 * @validate_link_af: Validate a IFLA_AF_SPEC attribute, must check attr 99 * @validate_link_af: Validate a IFLA_AF_SPEC attribute, must check attr
99 * for invalid configuration settings. 100 * for invalid configuration settings.
100 * @set_link_af: Function to parse a IFLA_AF_SPEC attribute and modify 101 * @set_link_af: Function to parse a IFLA_AF_SPEC attribute and modify
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 6ee44b24864a..a2ef81466b00 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -704,4 +704,17 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr)
704 addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); 704 addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff);
705} 705}
706 706
707/* The cookie is always 0 since this is how it's used in the
708 * pmtu code.
709 */
710static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
711{
712 if (t->dst && !dst_check(t->dst, 0)) {
713 dst_release(t->dst);
714 t->dst = NULL;
715 }
716
717 return t->dst;
718}
719
707#endif /* __net_sctp_h__ */ 720#endif /* __net_sctp_h__ */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 88949a994538..e4652fe58958 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1145,10 +1145,10 @@ struct sctp_outq {
1145 /* Data pending that has never been transmitted. */ 1145 /* Data pending that has never been transmitted. */
1146 struct list_head out_chunk_list; 1146 struct list_head out_chunk_list;
1147 1147
1148 unsigned out_qlen; /* Total length of queued data chunks. */ 1148 unsigned int out_qlen; /* Total length of queued data chunks. */
1149 1149
1150 /* Error of send failed, may used in SCTP_SEND_FAILED event. */ 1150 /* Error of send failed, may used in SCTP_SEND_FAILED event. */
1151 unsigned error; 1151 unsigned int error;
1152 1152
1153 /* These are control chunks we want to send. */ 1153 /* These are control chunks we want to send. */
1154 struct list_head control_chunk_list; 1154 struct list_head control_chunk_list;
@@ -2000,8 +2000,8 @@ void sctp_assoc_update(struct sctp_association *old,
2000__u32 sctp_association_get_next_tsn(struct sctp_association *); 2000__u32 sctp_association_get_next_tsn(struct sctp_association *);
2001 2001
2002void sctp_assoc_sync_pmtu(struct sctp_association *); 2002void sctp_assoc_sync_pmtu(struct sctp_association *);
2003void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned); 2003void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
2004void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); 2004void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
2005void sctp_assoc_set_primary(struct sctp_association *, 2005void sctp_assoc_set_primary(struct sctp_association *,
2006 struct sctp_transport *); 2006 struct sctp_transport *);
2007void sctp_assoc_del_nonprimary_peers(struct sctp_association *, 2007void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
diff --git a/include/net/sock.h b/include/net/sock.h
index 5a0a58ac4126..da931555e000 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -97,7 +97,7 @@ void mem_cgroup_sockets_destroy(struct cgroup *cgrp)
97#else 97#else
98/* Validate arguments and do nothing */ 98/* Validate arguments and do nothing */
99static inline __printf(2, 3) 99static inline __printf(2, 3)
100void SOCK_DEBUG(struct sock *sk, const char *msg, ...) 100void SOCK_DEBUG(const struct sock *sk, const char *msg, ...)
101{ 101{
102} 102}
103#endif 103#endif
@@ -372,11 +372,22 @@ struct sock {
372 void (*sk_data_ready)(struct sock *sk, int bytes); 372 void (*sk_data_ready)(struct sock *sk, int bytes);
373 void (*sk_write_space)(struct sock *sk); 373 void (*sk_write_space)(struct sock *sk);
374 void (*sk_error_report)(struct sock *sk); 374 void (*sk_error_report)(struct sock *sk);
375 int (*sk_backlog_rcv)(struct sock *sk, 375 int (*sk_backlog_rcv)(struct sock *sk,
376 struct sk_buff *skb); 376 struct sk_buff *skb);
377 void (*sk_destruct)(struct sock *sk); 377 void (*sk_destruct)(struct sock *sk);
378}; 378};
379 379
380/*
381 * SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK
382 * or not whether his port will be reused by someone else. SK_FORCE_REUSE
383 * on a socket means that the socket will reuse everybody else's port
384 * without looking at the other's sk_reuse value.
385 */
386
387#define SK_NO_REUSE 0
388#define SK_CAN_REUSE 1
389#define SK_FORCE_REUSE 2
390
380static inline int sk_peek_offset(struct sock *sk, int flags) 391static inline int sk_peek_offset(struct sock *sk, int flags)
381{ 392{
382 if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0)) 393 if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0))
@@ -443,40 +454,40 @@ static inline struct sock *sk_nulls_next(const struct sock *sk)
443 NULL; 454 NULL;
444} 455}
445 456
446static inline int sk_unhashed(const struct sock *sk) 457static inline bool sk_unhashed(const struct sock *sk)
447{ 458{
448 return hlist_unhashed(&sk->sk_node); 459 return hlist_unhashed(&sk->sk_node);
449} 460}
450 461
451static inline int sk_hashed(const struct sock *sk) 462static inline bool sk_hashed(const struct sock *sk)
452{ 463{
453 return !sk_unhashed(sk); 464 return !sk_unhashed(sk);
454} 465}
455 466
456static __inline__ void sk_node_init(struct hlist_node *node) 467static inline void sk_node_init(struct hlist_node *node)
457{ 468{
458 node->pprev = NULL; 469 node->pprev = NULL;
459} 470}
460 471
461static __inline__ void sk_nulls_node_init(struct hlist_nulls_node *node) 472static inline void sk_nulls_node_init(struct hlist_nulls_node *node)
462{ 473{
463 node->pprev = NULL; 474 node->pprev = NULL;
464} 475}
465 476
466static __inline__ void __sk_del_node(struct sock *sk) 477static inline void __sk_del_node(struct sock *sk)
467{ 478{
468 __hlist_del(&sk->sk_node); 479 __hlist_del(&sk->sk_node);
469} 480}
470 481
471/* NB: equivalent to hlist_del_init_rcu */ 482/* NB: equivalent to hlist_del_init_rcu */
472static __inline__ int __sk_del_node_init(struct sock *sk) 483static inline bool __sk_del_node_init(struct sock *sk)
473{ 484{
474 if (sk_hashed(sk)) { 485 if (sk_hashed(sk)) {
475 __sk_del_node(sk); 486 __sk_del_node(sk);
476 sk_node_init(&sk->sk_node); 487 sk_node_init(&sk->sk_node);
477 return 1; 488 return true;
478 } 489 }
479 return 0; 490 return false;
480} 491}
481 492
482/* Grab socket reference count. This operation is valid only 493/* Grab socket reference count. This operation is valid only
@@ -498,9 +509,9 @@ static inline void __sock_put(struct sock *sk)
498 atomic_dec(&sk->sk_refcnt); 509 atomic_dec(&sk->sk_refcnt);
499} 510}
500 511
501static __inline__ int sk_del_node_init(struct sock *sk) 512static inline bool sk_del_node_init(struct sock *sk)
502{ 513{
503 int rc = __sk_del_node_init(sk); 514 bool rc = __sk_del_node_init(sk);
504 515
505 if (rc) { 516 if (rc) {
506 /* paranoid for a while -acme */ 517 /* paranoid for a while -acme */
@@ -511,18 +522,18 @@ static __inline__ int sk_del_node_init(struct sock *sk)
511} 522}
512#define sk_del_node_init_rcu(sk) sk_del_node_init(sk) 523#define sk_del_node_init_rcu(sk) sk_del_node_init(sk)
513 524
514static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) 525static inline bool __sk_nulls_del_node_init_rcu(struct sock *sk)
515{ 526{
516 if (sk_hashed(sk)) { 527 if (sk_hashed(sk)) {
517 hlist_nulls_del_init_rcu(&sk->sk_nulls_node); 528 hlist_nulls_del_init_rcu(&sk->sk_nulls_node);
518 return 1; 529 return true;
519 } 530 }
520 return 0; 531 return false;
521} 532}
522 533
523static __inline__ int sk_nulls_del_node_init_rcu(struct sock *sk) 534static inline bool sk_nulls_del_node_init_rcu(struct sock *sk)
524{ 535{
525 int rc = __sk_nulls_del_node_init_rcu(sk); 536 bool rc = __sk_nulls_del_node_init_rcu(sk);
526 537
527 if (rc) { 538 if (rc) {
528 /* paranoid for a while -acme */ 539 /* paranoid for a while -acme */
@@ -532,40 +543,40 @@ static __inline__ int sk_nulls_del_node_init_rcu(struct sock *sk)
532 return rc; 543 return rc;
533} 544}
534 545
535static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) 546static inline void __sk_add_node(struct sock *sk, struct hlist_head *list)
536{ 547{
537 hlist_add_head(&sk->sk_node, list); 548 hlist_add_head(&sk->sk_node, list);
538} 549}
539 550
540static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list) 551static inline void sk_add_node(struct sock *sk, struct hlist_head *list)
541{ 552{
542 sock_hold(sk); 553 sock_hold(sk);
543 __sk_add_node(sk, list); 554 __sk_add_node(sk, list);
544} 555}
545 556
546static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list) 557static inline void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
547{ 558{
548 sock_hold(sk); 559 sock_hold(sk);
549 hlist_add_head_rcu(&sk->sk_node, list); 560 hlist_add_head_rcu(&sk->sk_node, list);
550} 561}
551 562
552static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 563static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
553{ 564{
554 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); 565 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
555} 566}
556 567
557static __inline__ void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 568static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
558{ 569{
559 sock_hold(sk); 570 sock_hold(sk);
560 __sk_nulls_add_node_rcu(sk, list); 571 __sk_nulls_add_node_rcu(sk, list);
561} 572}
562 573
563static __inline__ void __sk_del_bind_node(struct sock *sk) 574static inline void __sk_del_bind_node(struct sock *sk)
564{ 575{
565 __hlist_del(&sk->sk_bind_node); 576 __hlist_del(&sk->sk_bind_node);
566} 577}
567 578
568static __inline__ void sk_add_bind_node(struct sock *sk, 579static inline void sk_add_bind_node(struct sock *sk,
569 struct hlist_head *list) 580 struct hlist_head *list)
570{ 581{
571 hlist_add_head(&sk->sk_bind_node, list); 582 hlist_add_head(&sk->sk_bind_node, list);
@@ -639,7 +650,7 @@ static inline void sock_reset_flag(struct sock *sk, enum sock_flags flag)
639 __clear_bit(flag, &sk->sk_flags); 650 __clear_bit(flag, &sk->sk_flags);
640} 651}
641 652
642static inline int sock_flag(struct sock *sk, enum sock_flags flag) 653static inline bool sock_flag(const struct sock *sk, enum sock_flags flag)
643{ 654{
644 return test_bit(flag, &sk->sk_flags); 655 return test_bit(flag, &sk->sk_flags);
645} 656}
@@ -654,7 +665,7 @@ static inline void sk_acceptq_added(struct sock *sk)
654 sk->sk_ack_backlog++; 665 sk->sk_ack_backlog++;
655} 666}
656 667
657static inline int sk_acceptq_is_full(struct sock *sk) 668static inline bool sk_acceptq_is_full(const struct sock *sk)
658{ 669{
659 return sk->sk_ack_backlog > sk->sk_max_ack_backlog; 670 return sk->sk_ack_backlog > sk->sk_max_ack_backlog;
660} 671}
@@ -662,19 +673,19 @@ static inline int sk_acceptq_is_full(struct sock *sk)
662/* 673/*
663 * Compute minimal free write space needed to queue new packets. 674 * Compute minimal free write space needed to queue new packets.
664 */ 675 */
665static inline int sk_stream_min_wspace(struct sock *sk) 676static inline int sk_stream_min_wspace(const struct sock *sk)
666{ 677{
667 return sk->sk_wmem_queued >> 1; 678 return sk->sk_wmem_queued >> 1;
668} 679}
669 680
670static inline int sk_stream_wspace(struct sock *sk) 681static inline int sk_stream_wspace(const struct sock *sk)
671{ 682{
672 return sk->sk_sndbuf - sk->sk_wmem_queued; 683 return sk->sk_sndbuf - sk->sk_wmem_queued;
673} 684}
674 685
675extern void sk_stream_write_space(struct sock *sk); 686extern void sk_stream_write_space(struct sock *sk);
676 687
677static inline int sk_stream_memory_free(struct sock *sk) 688static inline bool sk_stream_memory_free(const struct sock *sk)
678{ 689{
679 return sk->sk_wmem_queued < sk->sk_sndbuf; 690 return sk->sk_wmem_queued < sk->sk_sndbuf;
680} 691}
@@ -699,17 +710,19 @@ static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
699 * Do not take into account this skb truesize, 710 * Do not take into account this skb truesize,
700 * to allow even a single big packet to come. 711 * to allow even a single big packet to come.
701 */ 712 */
702static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb) 713static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb,
714 unsigned int limit)
703{ 715{
704 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc); 716 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc);
705 717
706 return qsize > sk->sk_rcvbuf; 718 return qsize > limit;
707} 719}
708 720
709/* The per-socket spinlock must be held here. */ 721/* The per-socket spinlock must be held here. */
710static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) 722static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb,
723 unsigned int limit)
711{ 724{
712 if (sk_rcvqueues_full(sk, skb)) 725 if (sk_rcvqueues_full(sk, skb, limit))
713 return -ENOBUFS; 726 return -ENOBUFS;
714 727
715 __sk_add_backlog(sk, skb); 728 __sk_add_backlog(sk, skb);
@@ -796,26 +809,26 @@ struct module;
796 * transport -> network interface is defined by struct inet_proto 809 * transport -> network interface is defined by struct inet_proto
797 */ 810 */
798struct proto { 811struct proto {
799 void (*close)(struct sock *sk, 812 void (*close)(struct sock *sk,
800 long timeout); 813 long timeout);
801 int (*connect)(struct sock *sk, 814 int (*connect)(struct sock *sk,
802 struct sockaddr *uaddr, 815 struct sockaddr *uaddr,
803 int addr_len); 816 int addr_len);
804 int (*disconnect)(struct sock *sk, int flags); 817 int (*disconnect)(struct sock *sk, int flags);
805 818
806 struct sock * (*accept) (struct sock *sk, int flags, int *err); 819 struct sock * (*accept)(struct sock *sk, int flags, int *err);
807 820
808 int (*ioctl)(struct sock *sk, int cmd, 821 int (*ioctl)(struct sock *sk, int cmd,
809 unsigned long arg); 822 unsigned long arg);
810 int (*init)(struct sock *sk); 823 int (*init)(struct sock *sk);
811 void (*destroy)(struct sock *sk); 824 void (*destroy)(struct sock *sk);
812 void (*shutdown)(struct sock *sk, int how); 825 void (*shutdown)(struct sock *sk, int how);
813 int (*setsockopt)(struct sock *sk, int level, 826 int (*setsockopt)(struct sock *sk, int level,
814 int optname, char __user *optval, 827 int optname, char __user *optval,
815 unsigned int optlen); 828 unsigned int optlen);
816 int (*getsockopt)(struct sock *sk, int level, 829 int (*getsockopt)(struct sock *sk, int level,
817 int optname, char __user *optval, 830 int optname, char __user *optval,
818 int __user *option); 831 int __user *option);
819#ifdef CONFIG_COMPAT 832#ifdef CONFIG_COMPAT
820 int (*compat_setsockopt)(struct sock *sk, 833 int (*compat_setsockopt)(struct sock *sk,
821 int level, 834 int level,
@@ -832,14 +845,14 @@ struct proto {
832 struct msghdr *msg, size_t len); 845 struct msghdr *msg, size_t len);
833 int (*recvmsg)(struct kiocb *iocb, struct sock *sk, 846 int (*recvmsg)(struct kiocb *iocb, struct sock *sk,
834 struct msghdr *msg, 847 struct msghdr *msg,
835 size_t len, int noblock, int flags, 848 size_t len, int noblock, int flags,
836 int *addr_len); 849 int *addr_len);
837 int (*sendpage)(struct sock *sk, struct page *page, 850 int (*sendpage)(struct sock *sk, struct page *page,
838 int offset, size_t size, int flags); 851 int offset, size_t size, int flags);
839 int (*bind)(struct sock *sk, 852 int (*bind)(struct sock *sk,
840 struct sockaddr *uaddr, int addr_len); 853 struct sockaddr *uaddr, int addr_len);
841 854
842 int (*backlog_rcv) (struct sock *sk, 855 int (*backlog_rcv) (struct sock *sk,
843 struct sk_buff *skb); 856 struct sk_buff *skb);
844 857
845 /* Keeping track of sk's, looking them up, and port selection methods. */ 858 /* Keeping track of sk's, looking them up, and port selection methods. */
@@ -1160,7 +1173,7 @@ proto_memory_pressure(struct proto *prot)
1160extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc); 1173extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc);
1161extern int sock_prot_inuse_get(struct net *net, struct proto *proto); 1174extern int sock_prot_inuse_get(struct net *net, struct proto *proto);
1162#else 1175#else
1163static void inline sock_prot_inuse_add(struct net *net, struct proto *prot, 1176static inline void sock_prot_inuse_add(struct net *net, struct proto *prot,
1164 int inc) 1177 int inc)
1165{ 1178{
1166} 1179}
@@ -1247,24 +1260,24 @@ static inline int sk_mem_pages(int amt)
1247 return (amt + SK_MEM_QUANTUM - 1) >> SK_MEM_QUANTUM_SHIFT; 1260 return (amt + SK_MEM_QUANTUM - 1) >> SK_MEM_QUANTUM_SHIFT;
1248} 1261}
1249 1262
1250static inline int sk_has_account(struct sock *sk) 1263static inline bool sk_has_account(struct sock *sk)
1251{ 1264{
1252 /* return true if protocol supports memory accounting */ 1265 /* return true if protocol supports memory accounting */
1253 return !!sk->sk_prot->memory_allocated; 1266 return !!sk->sk_prot->memory_allocated;
1254} 1267}
1255 1268
1256static inline int sk_wmem_schedule(struct sock *sk, int size) 1269static inline bool sk_wmem_schedule(struct sock *sk, int size)
1257{ 1270{
1258 if (!sk_has_account(sk)) 1271 if (!sk_has_account(sk))
1259 return 1; 1272 return true;
1260 return size <= sk->sk_forward_alloc || 1273 return size <= sk->sk_forward_alloc ||
1261 __sk_mem_schedule(sk, size, SK_MEM_SEND); 1274 __sk_mem_schedule(sk, size, SK_MEM_SEND);
1262} 1275}
1263 1276
1264static inline int sk_rmem_schedule(struct sock *sk, int size) 1277static inline bool sk_rmem_schedule(struct sock *sk, int size)
1265{ 1278{
1266 if (!sk_has_account(sk)) 1279 if (!sk_has_account(sk))
1267 return 1; 1280 return true;
1268 return size <= sk->sk_forward_alloc || 1281 return size <= sk->sk_forward_alloc ||
1269 __sk_mem_schedule(sk, size, SK_MEM_RECV); 1282 __sk_mem_schedule(sk, size, SK_MEM_RECV);
1270} 1283}
@@ -1329,7 +1342,7 @@ static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
1329 * Mark both the sk_lock and the sk_lock.slock as a 1342 * Mark both the sk_lock and the sk_lock.slock as a
1330 * per-address-family lock class. 1343 * per-address-family lock class.
1331 */ 1344 */
1332#define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ 1345#define sock_lock_init_class_and_name(sk, sname, skey, name, key) \
1333do { \ 1346do { \
1334 sk->sk_lock.owned = 0; \ 1347 sk->sk_lock.owned = 0; \
1335 init_waitqueue_head(&sk->sk_lock.wq); \ 1348 init_waitqueue_head(&sk->sk_lock.wq); \
@@ -1337,7 +1350,7 @@ do { \
1337 debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ 1350 debug_check_no_locks_freed((void *)&(sk)->sk_lock, \
1338 sizeof((sk)->sk_lock)); \ 1351 sizeof((sk)->sk_lock)); \
1339 lockdep_set_class_and_name(&(sk)->sk_lock.slock, \ 1352 lockdep_set_class_and_name(&(sk)->sk_lock.slock, \
1340 (skey), (sname)); \ 1353 (skey), (sname)); \
1341 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ 1354 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
1342} while (0) 1355} while (0)
1343 1356
@@ -1397,13 +1410,13 @@ extern int sock_setsockopt(struct socket *sock, int level,
1397 unsigned int optlen); 1410 unsigned int optlen);
1398 1411
1399extern int sock_getsockopt(struct socket *sock, int level, 1412extern int sock_getsockopt(struct socket *sock, int level,
1400 int op, char __user *optval, 1413 int op, char __user *optval,
1401 int __user *optlen); 1414 int __user *optlen);
1402extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, 1415extern struct sk_buff *sock_alloc_send_skb(struct sock *sk,
1403 unsigned long size, 1416 unsigned long size,
1404 int noblock, 1417 int noblock,
1405 int *errcode); 1418 int *errcode);
1406extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk, 1419extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
1407 unsigned long header_len, 1420 unsigned long header_len,
1408 unsigned long data_len, 1421 unsigned long data_len,
1409 int noblock, 1422 int noblock,
@@ -1425,7 +1438,7 @@ static inline void sock_update_classid(struct sock *sk)
1425 * Functions to fill in entries in struct proto_ops when a protocol 1438 * Functions to fill in entries in struct proto_ops when a protocol
1426 * does not implement a particular function. 1439 * does not implement a particular function.
1427 */ 1440 */
1428extern int sock_no_bind(struct socket *, 1441extern int sock_no_bind(struct socket *,
1429 struct sockaddr *, int); 1442 struct sockaddr *, int);
1430extern int sock_no_connect(struct socket *, 1443extern int sock_no_connect(struct socket *,
1431 struct sockaddr *, int, int); 1444 struct sockaddr *, int, int);
@@ -1454,7 +1467,7 @@ extern int sock_no_mmap(struct file *file,
1454 struct vm_area_struct *vma); 1467 struct vm_area_struct *vma);
1455extern ssize_t sock_no_sendpage(struct socket *sock, 1468extern ssize_t sock_no_sendpage(struct socket *sock,
1456 struct page *page, 1469 struct page *page,
1457 int offset, size_t size, 1470 int offset, size_t size,
1458 int flags); 1471 int flags);
1459 1472
1460/* 1473/*
@@ -1477,7 +1490,7 @@ extern void sk_common_release(struct sock *sk);
1477/* 1490/*
1478 * Default socket callbacks and setup code 1491 * Default socket callbacks and setup code
1479 */ 1492 */
1480 1493
1481/* Initialise core socket variables */ 1494/* Initialise core socket variables */
1482extern void sock_init_data(struct socket *sock, struct sock *sk); 1495extern void sock_init_data(struct socket *sock, struct sock *sk);
1483 1496
@@ -1677,7 +1690,7 @@ extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1677 1690
1678extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1691extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1679 1692
1680static inline int sk_can_gso(const struct sock *sk) 1693static inline bool sk_can_gso(const struct sock *sk)
1681{ 1694{
1682 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1695 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1683} 1696}
@@ -1794,7 +1807,7 @@ static inline int sk_rmem_alloc_get(const struct sock *sk)
1794 * 1807 *
1795 * Returns true if socket has write or read allocations 1808 * Returns true if socket has write or read allocations
1796 */ 1809 */
1797static inline int sk_has_allocations(const struct sock *sk) 1810static inline bool sk_has_allocations(const struct sock *sk)
1798{ 1811{
1799 return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk); 1812 return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk);
1800} 1813}
@@ -1833,9 +1846,7 @@ static inline int sk_has_allocations(const struct sock *sk)
1833 */ 1846 */
1834static inline bool wq_has_sleeper(struct socket_wq *wq) 1847static inline bool wq_has_sleeper(struct socket_wq *wq)
1835{ 1848{
1836 1849 /* We need to be sure we are in sync with the
1837 /*
1838 * We need to be sure we are in sync with the
1839 * add_wait_queue modifications to the wait queue. 1850 * add_wait_queue modifications to the wait queue.
1840 * 1851 *
1841 * This memory barrier is paired in the sock_poll_wait. 1852 * This memory barrier is paired in the sock_poll_wait.
@@ -1857,22 +1868,21 @@ static inline void sock_poll_wait(struct file *filp,
1857{ 1868{
1858 if (!poll_does_not_wait(p) && wait_address) { 1869 if (!poll_does_not_wait(p) && wait_address) {
1859 poll_wait(filp, wait_address, p); 1870 poll_wait(filp, wait_address, p);
1860 /* 1871 /* We need to be sure we are in sync with the
1861 * We need to be sure we are in sync with the
1862 * socket flags modification. 1872 * socket flags modification.
1863 * 1873 *
1864 * This memory barrier is paired in the wq_has_sleeper. 1874 * This memory barrier is paired in the wq_has_sleeper.
1865 */ 1875 */
1866 smp_mb(); 1876 smp_mb();
1867 } 1877 }
1868} 1878}
1869 1879
1870/* 1880/*
1871 * Queue a received datagram if it will fit. Stream and sequenced 1881 * Queue a received datagram if it will fit. Stream and sequenced
1872 * protocols can't normally use this as they need to fit buffers in 1882 * protocols can't normally use this as they need to fit buffers in
1873 * and play with them. 1883 * and play with them.
1874 * 1884 *
1875 * Inlined as it's very short and called for pretty much every 1885 * Inlined as it's very short and called for pretty much every
1876 * packet ever received. 1886 * packet ever received.
1877 */ 1887 */
1878 1888
@@ -1898,10 +1908,10 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
1898 sk_mem_charge(sk, skb->truesize); 1908 sk_mem_charge(sk, skb->truesize);
1899} 1909}
1900 1910
1901extern void sk_reset_timer(struct sock *sk, struct timer_list* timer, 1911extern void sk_reset_timer(struct sock *sk, struct timer_list *timer,
1902 unsigned long expires); 1912 unsigned long expires);
1903 1913
1904extern void sk_stop_timer(struct sock *sk, struct timer_list* timer); 1914extern void sk_stop_timer(struct sock *sk, struct timer_list *timer);
1905 1915
1906extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 1916extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
1907 1917
@@ -1910,7 +1920,7 @@ extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
1910/* 1920/*
1911 * Recover an error report and clear atomically 1921 * Recover an error report and clear atomically
1912 */ 1922 */
1913 1923
1914static inline int sock_error(struct sock *sk) 1924static inline int sock_error(struct sock *sk)
1915{ 1925{
1916 int err; 1926 int err;
@@ -1926,7 +1936,7 @@ static inline unsigned long sock_wspace(struct sock *sk)
1926 1936
1927 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) { 1937 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
1928 amt = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); 1938 amt = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
1929 if (amt < 0) 1939 if (amt < 0)
1930 amt = 0; 1940 amt = 0;
1931 } 1941 }
1932 return amt; 1942 return amt;
@@ -1970,7 +1980,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
1970/* 1980/*
1971 * Default write policy as shown to user space via poll/select/SIGIO 1981 * Default write policy as shown to user space via poll/select/SIGIO
1972 */ 1982 */
1973static inline int sock_writeable(const struct sock *sk) 1983static inline bool sock_writeable(const struct sock *sk)
1974{ 1984{
1975 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1); 1985 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1);
1976} 1986}
@@ -1980,12 +1990,12 @@ static inline gfp_t gfp_any(void)
1980 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; 1990 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
1981} 1991}
1982 1992
1983static inline long sock_rcvtimeo(const struct sock *sk, int noblock) 1993static inline long sock_rcvtimeo(const struct sock *sk, bool noblock)
1984{ 1994{
1985 return noblock ? 0 : sk->sk_rcvtimeo; 1995 return noblock ? 0 : sk->sk_rcvtimeo;
1986} 1996}
1987 1997
1988static inline long sock_sndtimeo(const struct sock *sk, int noblock) 1998static inline long sock_sndtimeo(const struct sock *sk, bool noblock)
1989{ 1999{
1990 return noblock ? 0 : sk->sk_sndtimeo; 2000 return noblock ? 0 : sk->sk_sndtimeo;
1991} 2001}
@@ -2008,7 +2018,7 @@ extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2008extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, 2018extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2009 struct sk_buff *skb); 2019 struct sk_buff *skb);
2010 2020
2011static __inline__ void 2021static inline void
2012sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 2022sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2013{ 2023{
2014 ktime_t kt = skb->tstamp; 2024 ktime_t kt = skb->tstamp;
@@ -2049,7 +2059,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2049 (1UL << SOCK_RCVTSTAMP) | \ 2059 (1UL << SOCK_RCVTSTAMP) | \
2050 (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \ 2060 (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \
2051 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \ 2061 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \
2052 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \ 2062 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \
2053 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE)) 2063 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE))
2054 2064
2055 if (sk->sk_flags & FLAGS_TS_OR_DROPS) 2065 if (sk->sk_flags & FLAGS_TS_OR_DROPS)
@@ -2078,7 +2088,7 @@ extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
2078 * locked so that the sk_buff queue operation is ok. 2088 * locked so that the sk_buff queue operation is ok.
2079*/ 2089*/
2080#ifdef CONFIG_NET_DMA 2090#ifdef CONFIG_NET_DMA
2081static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early) 2091static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early)
2082{ 2092{
2083 __skb_unlink(skb, &sk->sk_receive_queue); 2093 __skb_unlink(skb, &sk->sk_receive_queue);
2084 if (!copied_early) 2094 if (!copied_early)
@@ -2087,7 +2097,7 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
2087 __skb_queue_tail(&sk->sk_async_wait_queue, skb); 2097 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
2088} 2098}
2089#else 2099#else
2090static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early) 2100static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early)
2091{ 2101{
2092 __skb_unlink(skb, &sk->sk_receive_queue); 2102 __skb_unlink(skb, &sk->sk_receive_queue);
2093 __kfree_skb(skb); 2103 __kfree_skb(skb);
@@ -2134,8 +2144,8 @@ extern void sock_enable_timestamp(struct sock *sk, int flag);
2134extern int sock_get_timestamp(struct sock *, struct timeval __user *); 2144extern int sock_get_timestamp(struct sock *, struct timeval __user *);
2135extern int sock_get_timestampns(struct sock *, struct timespec __user *); 2145extern int sock_get_timestampns(struct sock *, struct timespec __user *);
2136 2146
2137/* 2147/*
2138 * Enable debug/info messages 2148 * Enable debug/info messages
2139 */ 2149 */
2140extern int net_msg_warn; 2150extern int net_msg_warn;
2141#define NETDEBUG(fmt, args...) \ 2151#define NETDEBUG(fmt, args...) \
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f75a04d752cb..e79aa48d9fc1 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -123,7 +123,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
123#endif 123#endif
124#define TCP_RTO_MAX ((unsigned)(120*HZ)) 124#define TCP_RTO_MAX ((unsigned)(120*HZ))
125#define TCP_RTO_MIN ((unsigned)(HZ/5)) 125#define TCP_RTO_MIN ((unsigned)(HZ/5))
126#define TCP_TIMEOUT_INIT ((unsigned)(1*HZ)) /* RFC2988bis initial RTO value */ 126#define TCP_TIMEOUT_INIT ((unsigned)(1*HZ)) /* RFC6298 2.1 initial RTO value */
127#define TCP_TIMEOUT_FALLBACK ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value, now 127#define TCP_TIMEOUT_FALLBACK ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value, now
128 * used as a fallback RTO for the 128 * used as a fallback RTO for the
129 * initial data transmission if no 129 * initial data transmission if no
@@ -252,6 +252,7 @@ extern int sysctl_tcp_max_ssthresh;
252extern int sysctl_tcp_cookie_size; 252extern int sysctl_tcp_cookie_size;
253extern int sysctl_tcp_thin_linear_timeouts; 253extern int sysctl_tcp_thin_linear_timeouts;
254extern int sysctl_tcp_thin_dupack; 254extern int sysctl_tcp_thin_dupack;
255extern int sysctl_tcp_early_retrans;
255 256
256extern atomic_long_t tcp_memory_allocated; 257extern atomic_long_t tcp_memory_allocated;
257extern struct percpu_counter tcp_sockets_allocated; 258extern struct percpu_counter tcp_sockets_allocated;
@@ -262,14 +263,14 @@ extern int tcp_memory_pressure;
262 * and worry about wraparound (automatic with unsigned arithmetic). 263 * and worry about wraparound (automatic with unsigned arithmetic).
263 */ 264 */
264 265
265static inline int before(__u32 seq1, __u32 seq2) 266static inline bool before(__u32 seq1, __u32 seq2)
266{ 267{
267 return (__s32)(seq1-seq2) < 0; 268 return (__s32)(seq1-seq2) < 0;
268} 269}
269#define after(seq2, seq1) before(seq1, seq2) 270#define after(seq2, seq1) before(seq1, seq2)
270 271
271/* is s2<=s1<=s3 ? */ 272/* is s2<=s1<=s3 ? */
272static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) 273static inline bool between(__u32 seq1, __u32 seq2, __u32 seq3)
273{ 274{
274 return seq3 - seq2 >= seq1 - seq2; 275 return seq3 - seq2 >= seq1 - seq2;
275} 276}
@@ -304,7 +305,7 @@ static inline void tcp_synq_overflow(struct sock *sk)
304} 305}
305 306
306/* syncookies: no recent synqueue overflow on this listening socket? */ 307/* syncookies: no recent synqueue overflow on this listening socket? */
307static inline int tcp_synq_no_recent_overflow(const struct sock *sk) 308static inline bool tcp_synq_no_recent_overflow(const struct sock *sk)
308{ 309{
309 unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp; 310 unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
310 return time_after(jiffies, last_overflow + TCP_TIMEOUT_FALLBACK); 311 return time_after(jiffies, last_overflow + TCP_TIMEOUT_FALLBACK);
@@ -366,13 +367,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk,
366#define TCP_ECN_DEMAND_CWR 4 367#define TCP_ECN_DEMAND_CWR 4
367#define TCP_ECN_SEEN 8 368#define TCP_ECN_SEEN 8
368 369
369static __inline__ void
370TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th)
371{
372 if (sysctl_tcp_ecn && th->ece && th->cwr)
373 inet_rsk(req)->ecn_ok = 1;
374}
375
376enum tcp_tw_status { 370enum tcp_tw_status {
377 TCP_TW_SUCCESS = 0, 371 TCP_TW_SUCCESS = 0,
378 TCP_TW_RST = 1, 372 TCP_TW_RST = 1,
@@ -389,12 +383,13 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
389 struct request_sock **prev); 383 struct request_sock **prev);
390extern int tcp_child_process(struct sock *parent, struct sock *child, 384extern int tcp_child_process(struct sock *parent, struct sock *child,
391 struct sk_buff *skb); 385 struct sk_buff *skb);
392extern int tcp_use_frto(struct sock *sk); 386extern bool tcp_use_frto(struct sock *sk);
393extern void tcp_enter_frto(struct sock *sk); 387extern void tcp_enter_frto(struct sock *sk);
394extern void tcp_enter_loss(struct sock *sk, int how); 388extern void tcp_enter_loss(struct sock *sk, int how);
395extern void tcp_clear_retrans(struct tcp_sock *tp); 389extern void tcp_clear_retrans(struct tcp_sock *tp);
396extern void tcp_update_metrics(struct sock *sk); 390extern void tcp_update_metrics(struct sock *sk);
397extern void tcp_close(struct sock *sk, long timeout); 391extern void tcp_close(struct sock *sk, long timeout);
392extern void tcp_init_sock(struct sock *sk);
398extern unsigned int tcp_poll(struct file * file, struct socket *sock, 393extern unsigned int tcp_poll(struct file * file, struct socket *sock,
399 struct poll_table_struct *wait); 394 struct poll_table_struct *wait);
400extern int tcp_getsockopt(struct sock *sk, int level, int optname, 395extern int tcp_getsockopt(struct sock *sk, int level, int optname,
@@ -435,6 +430,9 @@ extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
435 struct request_values *rvp); 430 struct request_values *rvp);
436extern int tcp_disconnect(struct sock *sk, int flags); 431extern int tcp_disconnect(struct sock *sk, int flags);
437 432
433void tcp_connect_init(struct sock *sk);
434void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
435int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size);
438 436
439/* From syncookies.c */ 437/* From syncookies.c */
440extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 438extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
@@ -472,7 +470,7 @@ static inline __u32 cookie_v6_init_sequence(struct sock *sk,
472 470
473extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 471extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
474 int nonagle); 472 int nonagle);
475extern int tcp_may_send_now(struct sock *sk); 473extern bool tcp_may_send_now(struct sock *sk);
476extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 474extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
477extern void tcp_retransmit_timer(struct sock *sk); 475extern void tcp_retransmit_timer(struct sock *sk);
478extern void tcp_xmit_retransmit_queue(struct sock *); 476extern void tcp_xmit_retransmit_queue(struct sock *);
@@ -486,15 +484,17 @@ extern int tcp_write_wakeup(struct sock *);
486extern void tcp_send_fin(struct sock *sk); 484extern void tcp_send_fin(struct sock *sk);
487extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 485extern void tcp_send_active_reset(struct sock *sk, gfp_t priority);
488extern int tcp_send_synack(struct sock *); 486extern int tcp_send_synack(struct sock *);
489extern int tcp_syn_flood_action(struct sock *sk, 487extern bool tcp_syn_flood_action(struct sock *sk,
490 const struct sk_buff *skb, 488 const struct sk_buff *skb,
491 const char *proto); 489 const char *proto);
492extern void tcp_push_one(struct sock *, unsigned int mss_now); 490extern void tcp_push_one(struct sock *, unsigned int mss_now);
493extern void tcp_send_ack(struct sock *sk); 491extern void tcp_send_ack(struct sock *sk);
494extern void tcp_send_delayed_ack(struct sock *sk); 492extern void tcp_send_delayed_ack(struct sock *sk);
495 493
496/* tcp_input.c */ 494/* tcp_input.c */
497extern void tcp_cwnd_application_limited(struct sock *sk); 495extern void tcp_cwnd_application_limited(struct sock *sk);
496extern void tcp_resume_early_retransmit(struct sock *sk);
497extern void tcp_rearm_rto(struct sock *sk);
498 498
499/* tcp_timer.c */ 499/* tcp_timer.c */
500extern void tcp_init_xmit_timers(struct sock *); 500extern void tcp_init_xmit_timers(struct sock *);
@@ -540,8 +540,8 @@ extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
540 540
541extern void tcp_initialize_rcv_mss(struct sock *sk); 541extern void tcp_initialize_rcv_mss(struct sock *sk);
542 542
543extern int tcp_mtu_to_mss(const struct sock *sk, int pmtu); 543extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
544extern int tcp_mss_to_mtu(const struct sock *sk, int mss); 544extern int tcp_mss_to_mtu(struct sock *sk, int mss);
545extern void tcp_mtup_init(struct sock *sk); 545extern void tcp_mtup_init(struct sock *sk);
546extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); 546extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt);
547 547
@@ -609,6 +609,8 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
609 */ 609 */
610extern u32 __tcp_select_window(struct sock *sk); 610extern u32 __tcp_select_window(struct sock *sk);
611 611
612void tcp_send_window_probe(struct sock *sk);
613
612/* TCP timestamps are only 32-bits, this causes a slight 614/* TCP timestamps are only 32-bits, this causes a slight
613 * complication on 64-bit systems since we store a snapshot 615 * complication on 64-bit systems since we store a snapshot
614 * of jiffies in the buffer control blocks below. We decided 616 * of jiffies in the buffer control blocks below. We decided
@@ -645,21 +647,38 @@ struct tcp_skb_cb {
645 __u32 end_seq; /* SEQ + FIN + SYN + datalen */ 647 __u32 end_seq; /* SEQ + FIN + SYN + datalen */
646 __u32 when; /* used to compute rtt's */ 648 __u32 when; /* used to compute rtt's */
647 __u8 tcp_flags; /* TCP header flags. (tcp[13]) */ 649 __u8 tcp_flags; /* TCP header flags. (tcp[13]) */
650
648 __u8 sacked; /* State flags for SACK/FACK. */ 651 __u8 sacked; /* State flags for SACK/FACK. */
649#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */ 652#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */
650#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ 653#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
651#define TCPCB_LOST 0x04 /* SKB is lost */ 654#define TCPCB_LOST 0x04 /* SKB is lost */
652#define TCPCB_TAGBITS 0x07 /* All tag bits */ 655#define TCPCB_TAGBITS 0x07 /* All tag bits */
653 __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */
654 /* 1 byte hole */
655#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ 656#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
656#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) 657#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
657 658
659 __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */
660 /* 1 byte hole */
658 __u32 ack_seq; /* Sequence number ACK'd */ 661 __u32 ack_seq; /* Sequence number ACK'd */
659}; 662};
660 663
661#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) 664#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
662 665
666/* RFC3168 : 6.1.1 SYN packets must not have ECT/ECN bits set
667 *
668 * If we receive a SYN packet with these bits set, it means a network is
669 * playing bad games with TOS bits. In order to avoid possible false congestion
670 * notifications, we disable TCP ECN negociation.
671 */
672static inline void
673TCP_ECN_create_request(struct request_sock *req, const struct sk_buff *skb)
674{
675 const struct tcphdr *th = tcp_hdr(skb);
676
677 if (sysctl_tcp_ecn && th->ece && th->cwr &&
678 INET_ECN_is_not_ect(TCP_SKB_CB(skb)->ip_dsfield))
679 inet_rsk(req)->ecn_ok = 1;
680}
681
663/* Due to TSO, an SKB can be composed of multiple actual 682/* Due to TSO, an SKB can be composed of multiple actual
664 * packets. To keep these tracked properly, we use this. 683 * packets. To keep these tracked properly, we use this.
665 */ 684 */
@@ -775,12 +794,12 @@ static inline int tcp_is_sack(const struct tcp_sock *tp)
775 return tp->rx_opt.sack_ok; 794 return tp->rx_opt.sack_ok;
776} 795}
777 796
778static inline int tcp_is_reno(const struct tcp_sock *tp) 797static inline bool tcp_is_reno(const struct tcp_sock *tp)
779{ 798{
780 return !tcp_is_sack(tp); 799 return !tcp_is_sack(tp);
781} 800}
782 801
783static inline int tcp_is_fack(const struct tcp_sock *tp) 802static inline bool tcp_is_fack(const struct tcp_sock *tp)
784{ 803{
785 return tp->rx_opt.sack_ok & TCP_FACK_ENABLED; 804 return tp->rx_opt.sack_ok & TCP_FACK_ENABLED;
786} 805}
@@ -790,6 +809,21 @@ static inline void tcp_enable_fack(struct tcp_sock *tp)
790 tp->rx_opt.sack_ok |= TCP_FACK_ENABLED; 809 tp->rx_opt.sack_ok |= TCP_FACK_ENABLED;
791} 810}
792 811
812/* TCP early-retransmit (ER) is similar to but more conservative than
813 * the thin-dupack feature. Enable ER only if thin-dupack is disabled.
814 */
815static inline void tcp_enable_early_retrans(struct tcp_sock *tp)
816{
817 tp->do_early_retrans = sysctl_tcp_early_retrans &&
818 !sysctl_tcp_thin_dupack && sysctl_tcp_reordering == 3;
819 tp->early_retrans_delayed = 0;
820}
821
822static inline void tcp_disable_early_retrans(struct tcp_sock *tp)
823{
824 tp->do_early_retrans = 0;
825}
826
793static inline unsigned int tcp_left_out(const struct tcp_sock *tp) 827static inline unsigned int tcp_left_out(const struct tcp_sock *tp)
794{ 828{
795 return tp->sacked_out + tp->lost_out; 829 return tp->sacked_out + tp->lost_out;
@@ -867,7 +901,7 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp)
867{ 901{
868 return tp->snd_una + tp->snd_wnd; 902 return tp->snd_una + tp->snd_wnd;
869} 903}
870extern int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); 904extern bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight);
871 905
872static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, 906static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss,
873 const struct sk_buff *skb) 907 const struct sk_buff *skb)
@@ -910,7 +944,7 @@ static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb)
910 return __skb_checksum_complete(skb); 944 return __skb_checksum_complete(skb);
911} 945}
912 946
913static inline int tcp_checksum_complete(struct sk_buff *skb) 947static inline bool tcp_checksum_complete(struct sk_buff *skb)
914{ 948{
915 return !skb_csum_unnecessary(skb) && 949 return !skb_csum_unnecessary(skb) &&
916 __tcp_checksum_complete(skb); 950 __tcp_checksum_complete(skb);
@@ -940,12 +974,12 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
940 * 974 *
941 * NOTE: is this not too big to inline? 975 * NOTE: is this not too big to inline?
942 */ 976 */
943static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) 977static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb)
944{ 978{
945 struct tcp_sock *tp = tcp_sk(sk); 979 struct tcp_sock *tp = tcp_sk(sk);
946 980
947 if (sysctl_tcp_low_latency || !tp->ucopy.task) 981 if (sysctl_tcp_low_latency || !tp->ucopy.task)
948 return 0; 982 return false;
949 983
950 __skb_queue_tail(&tp->ucopy.prequeue, skb); 984 __skb_queue_tail(&tp->ucopy.prequeue, skb);
951 tp->ucopy.memory += skb->truesize; 985 tp->ucopy.memory += skb->truesize;
@@ -969,7 +1003,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
969 (3 * tcp_rto_min(sk)) / 4, 1003 (3 * tcp_rto_min(sk)) / 4,
970 TCP_RTO_MAX); 1004 TCP_RTO_MAX);
971 } 1005 }
972 return 1; 1006 return true;
973} 1007}
974 1008
975 1009
@@ -1074,28 +1108,28 @@ static inline int tcp_fin_time(const struct sock *sk)
1074 return fin_timeout; 1108 return fin_timeout;
1075} 1109}
1076 1110
1077static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, 1111static inline bool tcp_paws_check(const struct tcp_options_received *rx_opt,
1078 int paws_win) 1112 int paws_win)
1079{ 1113{
1080 if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win) 1114 if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
1081 return 1; 1115 return true;
1082 if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)) 1116 if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
1083 return 1; 1117 return true;
1084 /* 1118 /*
1085 * Some OSes send SYN and SYNACK messages with tsval=0 tsecr=0, 1119 * Some OSes send SYN and SYNACK messages with tsval=0 tsecr=0,
1086 * then following tcp messages have valid values. Ignore 0 value, 1120 * then following tcp messages have valid values. Ignore 0 value,
1087 * or else 'negative' tsval might forbid us to accept their packets. 1121 * or else 'negative' tsval might forbid us to accept their packets.
1088 */ 1122 */
1089 if (!rx_opt->ts_recent) 1123 if (!rx_opt->ts_recent)
1090 return 1; 1124 return true;
1091 return 0; 1125 return false;
1092} 1126}
1093 1127
1094static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt, 1128static inline bool tcp_paws_reject(const struct tcp_options_received *rx_opt,
1095 int rst) 1129 int rst)
1096{ 1130{
1097 if (tcp_paws_check(rx_opt, 0)) 1131 if (tcp_paws_check(rx_opt, 0))
1098 return 0; 1132 return false;
1099 1133
1100 /* RST segments are not recommended to carry timestamp, 1134 /* RST segments are not recommended to carry timestamp,
1101 and, if they do, it is recommended to ignore PAWS because 1135 and, if they do, it is recommended to ignore PAWS because
@@ -1110,8 +1144,8 @@ static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt,
1110 However, we can relax time bounds for RST segments to MSL. 1144 However, we can relax time bounds for RST segments to MSL.
1111 */ 1145 */
1112 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) 1146 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
1113 return 0; 1147 return false;
1114 return 1; 1148 return true;
1115} 1149}
1116 1150
1117static inline void tcp_mib_init(struct net *net) 1151static inline void tcp_mib_init(struct net *net)
@@ -1226,7 +1260,7 @@ extern void tcp_put_md5sig_pool(void);
1226 1260
1227extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); 1261extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *);
1228extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, 1262extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *,
1229 unsigned header_len); 1263 unsigned int header_len);
1230extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1264extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1231 const struct tcp_md5sig_key *key); 1265 const struct tcp_md5sig_key *key);
1232 1266
@@ -1349,7 +1383,7 @@ static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
1349 __skb_unlink(skb, &sk->sk_write_queue); 1383 __skb_unlink(skb, &sk->sk_write_queue);
1350} 1384}
1351 1385
1352static inline int tcp_write_queue_empty(struct sock *sk) 1386static inline bool tcp_write_queue_empty(struct sock *sk)
1353{ 1387{
1354 return skb_queue_empty(&sk->sk_write_queue); 1388 return skb_queue_empty(&sk->sk_write_queue);
1355} 1389}
@@ -1406,7 +1440,7 @@ static inline void tcp_highest_sack_combine(struct sock *sk,
1406/* Determines whether this is a thin stream (which may suffer from 1440/* Determines whether this is a thin stream (which may suffer from
1407 * increased latency). Used to trigger latency-reducing mechanisms. 1441 * increased latency). Used to trigger latency-reducing mechanisms.
1408 */ 1442 */
1409static inline unsigned int tcp_stream_is_thin(struct tcp_sock *tp) 1443static inline bool tcp_stream_is_thin(struct tcp_sock *tp)
1410{ 1444{
1411 return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp); 1445 return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp);
1412} 1446}
diff --git a/include/net/udp.h b/include/net/udp.h
index 5d606d9da9e5..065f379c6503 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -81,7 +81,7 @@ struct udp_table {
81extern struct udp_table udp_table; 81extern struct udp_table udp_table;
82extern void udp_table_init(struct udp_table *, const char *); 82extern void udp_table_init(struct udp_table *, const char *);
83static inline struct udp_hslot *udp_hashslot(struct udp_table *table, 83static inline struct udp_hslot *udp_hashslot(struct udp_table *table,
84 struct net *net, unsigned num) 84 struct net *net, unsigned int num)
85{ 85{
86 return &table->hash[udp_hashfn(net, num, table->mask)]; 86 return &table->hash[udp_hashfn(net, num, table->mask)];
87} 87}
@@ -267,4 +267,8 @@ extern void udp_init(void);
267extern int udp4_ufo_send_check(struct sk_buff *skb); 267extern int udp4_ufo_send_check(struct sk_buff *skb);
268extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, 268extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
269 netdev_features_t features); 269 netdev_features_t features);
270extern void udp_encap_enable(void);
271#if IS_ENABLED(CONFIG_IPV6)
272extern void udpv6_encap_enable(void);
273#endif
270#endif /* _UDP_H */ 274#endif /* _UDP_H */
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 322ff4fbdb4a..bbb74f990cab 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -423,8 +423,8 @@ struct wimax_dev {
423 int (*op_reset)(struct wimax_dev *wimax_dev); 423 int (*op_reset)(struct wimax_dev *wimax_dev);
424 424
425 struct rfkill *rfkill; 425 struct rfkill *rfkill;
426 unsigned rf_hw; 426 unsigned int rf_hw;
427 unsigned rf_sw; 427 unsigned int rf_sw;
428 char name[32]; 428 char name[32];
429 429
430 struct dentry *debugfs_dentry; 430 struct dentry *debugfs_dentry;
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index ff27f1b078d1..b52bda8d13b1 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -25,6 +25,14 @@
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/bug.h> 26#include <linux/bug.h>
27 27
28/* According to the IEEE 802.15.4 stadard the upper most significant bits of
29 * the 32-bit channel bitmaps shall be used as an integer value to specify 32
30 * possible channel pages. The lower 27 bits of the channel bit map shall be
31 * used as a bit mask to specify channel numbers within a channel page.
32 */
33#define WPAN_NUM_CHANNELS 27
34#define WPAN_NUM_PAGES 32
35
28struct wpan_phy { 36struct wpan_phy {
29 struct mutex pib_lock; 37 struct mutex pib_lock;
30 38
@@ -43,7 +51,7 @@ struct wpan_phy {
43 int idx; 51 int idx;
44 52
45 struct net_device *(*add_iface)(struct wpan_phy *phy, 53 struct net_device *(*add_iface)(struct wpan_phy *phy,
46 const char *name); 54 const char *name, int type);
47 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); 55 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
48 56
49 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 57 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
diff --git a/include/net/x25.h b/include/net/x25.h
index a06119a05129..b4a8a8923128 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -305,7 +305,7 @@ static inline void x25_unregister_sysctl(void) {};
305#endif /* CONFIG_SYSCTL */ 305#endif /* CONFIG_SYSCTL */
306 306
307struct x25_skb_cb { 307struct x25_skb_cb {
308 unsigned flags; 308 unsigned int flags;
309}; 309};
310#define X25_SKB_CB(s) ((struct x25_skb_cb *) ((s)->cb)) 310#define X25_SKB_CB(s) ((struct x25_skb_cb *) ((s)->cb))
311 311
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 96239e78e621..e0a55df5bde8 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -886,15 +886,15 @@ __be16 xfrm_flowi_dport(const struct flowi *fl, const union flowi_uli *uli)
886 return port; 886 return port;
887} 887}
888 888
889extern int xfrm_selector_match(const struct xfrm_selector *sel, 889extern bool xfrm_selector_match(const struct xfrm_selector *sel,
890 const struct flowi *fl, 890 const struct flowi *fl,
891 unsigned short family); 891 unsigned short family);
892 892
893#ifdef CONFIG_SECURITY_NETWORK_XFRM 893#ifdef CONFIG_SECURITY_NETWORK_XFRM
894/* If neither has a context --> match 894/* If neither has a context --> match
895 * Otherwise, both must have a context and the sids, doi, alg must match 895 * Otherwise, both must have a context and the sids, doi, alg must match
896 */ 896 */
897static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) 897static inline bool xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
898{ 898{
899 return ((!s1 && !s2) || 899 return ((!s1 && !s2) ||
900 (s1 && s2 && 900 (s1 && s2 &&
@@ -903,9 +903,9 @@ static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ct
903 (s1->ctx_alg == s2->ctx_alg))); 903 (s1->ctx_alg == s2->ctx_alg)));
904} 904}
905#else 905#else
906static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) 906static inline bool xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
907{ 907{
908 return 1; 908 return true;
909} 909}
910#endif 910#endif
911 911
@@ -1682,8 +1682,9 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1682 1682
1683static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m) 1683static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1684{ 1684{
1685 if (m->m | m->v) 1685 if ((m->m | m->v) &&
1686 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); 1686 nla_put(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m))
1687 goto nla_put_failure;
1687 return 0; 1688 return 0;
1688 1689
1689nla_put_failure: 1690nla_put_failure:
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index 988ba06b3ad6..c1260d80ef30 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -661,6 +661,8 @@ struct iscsi_reject {
661 661
662#define ISCSI_DEF_TIME2WAIT 2 662#define ISCSI_DEF_TIME2WAIT 2
663 663
664#define ISCSI_NAME_LEN 224
665
664/************************* RFC 3720 End *****************************/ 666/************************* RFC 3720 End *****************************/
665 667
666#endif /* ISCSI_PROTO_H */ 668#endif /* ISCSI_PROTO_H */
diff --git a/include/scsi/sas.h b/include/scsi/sas.h
index a577a833603d..be3eb0bf1ac0 100644
--- a/include/scsi/sas.h
+++ b/include/scsi/sas.h
@@ -103,6 +103,7 @@ enum sas_dev_type {
103}; 103};
104 104
105enum sas_protocol { 105enum sas_protocol {
106 SAS_PROTOCOL_NONE = 0,
106 SAS_PROTOCOL_SATA = 0x01, 107 SAS_PROTOCOL_SATA = 0x01,
107 SAS_PROTOCOL_SMP = 0x02, 108 SAS_PROTOCOL_SMP = 0x02,
108 SAS_PROTOCOL_STP = 0x04, 109 SAS_PROTOCOL_STP = 0x04,
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 8c9ff1b14396..2d7db85e93ae 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -23,12 +23,11 @@ struct se_subsystem_api {
23 struct se_device *(*create_virtdevice)(struct se_hba *, 23 struct se_device *(*create_virtdevice)(struct se_hba *,
24 struct se_subsystem_dev *, void *); 24 struct se_subsystem_dev *, void *);
25 void (*free_device)(void *); 25 void (*free_device)(void *);
26 int (*transport_complete)(struct se_task *task); 26 int (*transport_complete)(struct se_cmd *cmd, struct scatterlist *);
27 struct se_task *(*alloc_task)(unsigned char *cdb); 27 int (*execute_cmd)(struct se_cmd *, struct scatterlist *, u32,
28 int (*do_task)(struct se_task *); 28 enum dma_data_direction);
29 int (*do_discard)(struct se_device *, sector_t, u32); 29 int (*do_discard)(struct se_device *, sector_t, u32);
30 void (*do_sync_cache)(struct se_task *); 30 void (*do_sync_cache)(struct se_cmd *);
31 void (*free_task)(struct se_task *);
32 ssize_t (*check_configfs_dev_params)(struct se_hba *, 31 ssize_t (*check_configfs_dev_params)(struct se_hba *,
33 struct se_subsystem_dev *); 32 struct se_subsystem_dev *);
34 ssize_t (*set_configfs_dev_params)(struct se_hba *, 33 ssize_t (*set_configfs_dev_params)(struct se_hba *,
@@ -38,7 +37,7 @@ struct se_subsystem_api {
38 u32 (*get_device_rev)(struct se_device *); 37 u32 (*get_device_rev)(struct se_device *);
39 u32 (*get_device_type)(struct se_device *); 38 u32 (*get_device_type)(struct se_device *);
40 sector_t (*get_blocks)(struct se_device *); 39 sector_t (*get_blocks)(struct se_device *);
41 unsigned char *(*get_sense_buffer)(struct se_task *); 40 unsigned char *(*get_sense_buffer)(struct se_cmd *);
42}; 41};
43 42
44int transport_subsystem_register(struct se_subsystem_api *); 43int transport_subsystem_register(struct se_subsystem_api *);
@@ -48,10 +47,7 @@ struct se_device *transport_add_device_to_core_hba(struct se_hba *,
48 struct se_subsystem_api *, struct se_subsystem_dev *, u32, 47 struct se_subsystem_api *, struct se_subsystem_dev *, u32,
49 void *, struct se_dev_limits *, const char *, const char *); 48 void *, struct se_dev_limits *, const char *, const char *);
50 49
51void transport_complete_sync_cache(struct se_cmd *, int); 50void target_complete_cmd(struct se_cmd *, u8);
52void transport_complete_task(struct se_task *, int);
53
54void target_get_task_cdb(struct se_task *, unsigned char *);
55 51
56void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 52void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
57int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 53int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index aaccc5f5fc9f..dc35d8660aa6 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -73,9 +73,8 @@
73/* 73/*
74 * struct se_device->dev_flags 74 * struct se_device->dev_flags
75 */ 75 */
76#define DF_READ_ONLY 0x00000001 76#define DF_SPC2_RESERVATIONS 0x00000001
77#define DF_SPC2_RESERVATIONS 0x00000002 77#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000002
78#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
79 78
80/* struct se_dev_attrib sanity values */ 79/* struct se_dev_attrib sanity values */
81/* Default max_unmap_lba_count */ 80/* Default max_unmap_lba_count */
@@ -141,14 +140,6 @@ enum transport_tpg_type_table {
141 TRANSPORT_TPG_TYPE_DISCOVERY = 1, 140 TRANSPORT_TPG_TYPE_DISCOVERY = 1,
142}; 141};
143 142
144/* struct se_task->task_flags */
145enum se_task_flags {
146 TF_ACTIVE = (1 << 0),
147 TF_SENT = (1 << 1),
148 TF_REQUEST_STOP = (1 << 2),
149 TF_HAS_SENSE = (1 << 3),
150};
151
152/* Special transport agnostic struct se_cmd->t_states */ 143/* Special transport agnostic struct se_cmd->t_states */
153enum transport_state_table { 144enum transport_state_table {
154 TRANSPORT_NO_STATE = 0, 145 TRANSPORT_NO_STATE = 0,
@@ -234,6 +225,7 @@ enum tcm_sense_reason_table {
234enum target_sc_flags_table { 225enum target_sc_flags_table {
235 TARGET_SCF_BIDI_OP = 0x01, 226 TARGET_SCF_BIDI_OP = 0x01,
236 TARGET_SCF_ACK_KREF = 0x02, 227 TARGET_SCF_ACK_KREF = 0x02,
228 TARGET_SCF_UNKNOWN_SIZE = 0x04,
237}; 229};
238 230
239/* fabric independent task management function values */ 231/* fabric independent task management function values */
@@ -338,6 +330,7 @@ struct t10_alua_tg_pt_gp {
338 int tg_pt_gp_alua_access_type; 330 int tg_pt_gp_alua_access_type;
339 int tg_pt_gp_nonop_delay_msecs; 331 int tg_pt_gp_nonop_delay_msecs;
340 int tg_pt_gp_trans_delay_msecs; 332 int tg_pt_gp_trans_delay_msecs;
333 int tg_pt_gp_implict_trans_secs;
341 int tg_pt_gp_pref; 334 int tg_pt_gp_pref;
342 int tg_pt_gp_write_metadata; 335 int tg_pt_gp_write_metadata;
343 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */ 336 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */
@@ -485,23 +478,6 @@ struct se_queue_obj {
485 wait_queue_head_t thread_wq; 478 wait_queue_head_t thread_wq;
486}; 479};
487 480
488struct se_task {
489 unsigned long long task_lba;
490 u32 task_sectors;
491 u32 task_size;
492 struct se_cmd *task_se_cmd;
493 struct scatterlist *task_sg;
494 u32 task_sg_nents;
495 u16 task_flags;
496 u8 task_scsi_status;
497 enum dma_data_direction task_data_direction;
498 struct list_head t_list;
499 struct list_head t_execute_list;
500 struct list_head t_state_list;
501 bool t_state_active;
502 struct completion task_stop_comp;
503};
504
505struct se_tmr_req { 481struct se_tmr_req {
506 /* Task Management function to be performed */ 482 /* Task Management function to be performed */
507 u8 function; 483 u8 function;
@@ -538,6 +514,7 @@ struct se_cmd {
538 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ 514 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
539 unsigned check_release:1; 515 unsigned check_release:1;
540 unsigned cmd_wait_set:1; 516 unsigned cmd_wait_set:1;
517 unsigned unknown_data_length:1;
541 /* See se_cmd_flags_table */ 518 /* See se_cmd_flags_table */
542 u32 se_cmd_flags; 519 u32 se_cmd_flags;
543 u32 se_ordered_id; 520 u32 se_ordered_id;
@@ -565,18 +542,13 @@ struct se_cmd {
565 struct completion cmd_wait_comp; 542 struct completion cmd_wait_comp;
566 struct kref cmd_kref; 543 struct kref cmd_kref;
567 struct target_core_fabric_ops *se_tfo; 544 struct target_core_fabric_ops *se_tfo;
568 int (*execute_task)(struct se_task *); 545 int (*execute_cmd)(struct se_cmd *);
569 void (*transport_complete_callback)(struct se_cmd *); 546 void (*transport_complete_callback)(struct se_cmd *);
570 547
571 unsigned char *t_task_cdb; 548 unsigned char *t_task_cdb;
572 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 549 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
573 unsigned long long t_task_lba; 550 unsigned long long t_task_lba;
574 u32 t_tasks_sg_chained_no;
575 atomic_t t_fe_count; 551 atomic_t t_fe_count;
576 atomic_t t_se_count;
577 atomic_t t_task_cdbs_left;
578 atomic_t t_task_cdbs_ex_left;
579 atomic_t t_task_cdbs_sent;
580 unsigned int transport_state; 552 unsigned int transport_state;
581#define CMD_T_ABORTED (1 << 0) 553#define CMD_T_ABORTED (1 << 0)
582#define CMD_T_ACTIVE (1 << 1) 554#define CMD_T_ACTIVE (1 << 1)
@@ -588,11 +560,12 @@ struct se_cmd {
588#define CMD_T_LUN_STOP (1 << 7) 560#define CMD_T_LUN_STOP (1 << 7)
589#define CMD_T_LUN_FE_STOP (1 << 8) 561#define CMD_T_LUN_FE_STOP (1 << 8)
590#define CMD_T_DEV_ACTIVE (1 << 9) 562#define CMD_T_DEV_ACTIVE (1 << 9)
563#define CMD_T_REQUEST_STOP (1 << 10)
564#define CMD_T_BUSY (1 << 11)
591 spinlock_t t_state_lock; 565 spinlock_t t_state_lock;
592 struct completion t_transport_stop_comp; 566 struct completion t_transport_stop_comp;
593 struct completion transport_lun_fe_stop_comp; 567 struct completion transport_lun_fe_stop_comp;
594 struct completion transport_lun_stop_comp; 568 struct completion transport_lun_stop_comp;
595 struct scatterlist *t_tasks_sg_chained;
596 569
597 struct work_struct work; 570 struct work_struct work;
598 571
@@ -602,10 +575,15 @@ struct se_cmd {
602 struct scatterlist *t_bidi_data_sg; 575 struct scatterlist *t_bidi_data_sg;
603 unsigned int t_bidi_data_nents; 576 unsigned int t_bidi_data_nents;
604 577
605 /* Used for BIDI READ */ 578 struct list_head execute_list;
606 struct list_head t_task_list; 579 struct list_head state_list;
607 u32 t_task_list_num; 580 bool state_active;
581
582 /* old task stop completion, consider merging with some of the above */
583 struct completion task_stop_comp;
608 584
585 /* backend private data */
586 void *priv;
609}; 587};
610 588
611struct se_ua { 589struct se_ua {
@@ -731,7 +709,6 @@ struct se_dev_attrib {
731 u32 hw_block_size; 709 u32 hw_block_size;
732 u32 block_size; 710 u32 block_size;
733 u32 hw_max_sectors; 711 u32 hw_max_sectors;
734 u32 max_sectors;
735 u32 fabric_max_sectors; 712 u32 fabric_max_sectors;
736 u32 optimal_sectors; 713 u32 optimal_sectors;
737 u32 hw_queue_depth; 714 u32 hw_queue_depth;
@@ -829,8 +806,8 @@ struct se_device {
829 struct task_struct *process_thread; 806 struct task_struct *process_thread;
830 struct work_struct qf_work_queue; 807 struct work_struct qf_work_queue;
831 struct list_head delayed_cmd_list; 808 struct list_head delayed_cmd_list;
832 struct list_head execute_task_list; 809 struct list_head execute_list;
833 struct list_head state_task_list; 810 struct list_head state_list;
834 struct list_head qf_cmd_list; 811 struct list_head qf_cmd_list;
835 /* Pointer to associated SE HBA */ 812 /* Pointer to associated SE HBA */
836 struct se_hba *se_hba; 813 struct se_hba *se_hba;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 10c690809601..116959933f46 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -3,12 +3,6 @@
3 3
4struct target_core_fabric_ops { 4struct target_core_fabric_ops {
5 struct configfs_subsystem *tf_subsys; 5 struct configfs_subsystem *tf_subsys;
6 /*
7 * Optional to signal struct se_task->task_sg[] padding entries
8 * for scatterlist chaining using transport_do_task_sg_link(),
9 * disabled by default
10 */
11 bool task_sg_chaining;
12 char *(*get_fabric_name)(void); 6 char *(*get_fabric_name)(void);
13 u8 (*get_fabric_proto_ident)(struct se_portal_group *); 7 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
14 char *(*tpg_get_wwn)(struct se_portal_group *); 8 char *(*tpg_get_wwn)(struct se_portal_group *);
@@ -102,7 +96,7 @@ void __transport_register_session(struct se_portal_group *,
102void transport_register_session(struct se_portal_group *, 96void transport_register_session(struct se_portal_group *,
103 struct se_node_acl *, struct se_session *, void *); 97 struct se_node_acl *, struct se_session *, void *);
104void target_get_session(struct se_session *); 98void target_get_session(struct se_session *);
105int target_put_session(struct se_session *); 99void target_put_session(struct se_session *);
106void transport_free_session(struct se_session *); 100void transport_free_session(struct se_session *);
107void target_put_nacl(struct se_node_acl *); 101void target_put_nacl(struct se_node_acl *);
108void transport_deregister_session_configfs(struct se_session *); 102void transport_deregister_session_configfs(struct se_session *);
@@ -112,7 +106,7 @@ void transport_deregister_session(struct se_session *);
112void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, 106void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
113 struct se_session *, u32, int, int, unsigned char *); 107 struct se_session *, u32, int, int, unsigned char *);
114int transport_lookup_cmd_lun(struct se_cmd *, u32); 108int transport_lookup_cmd_lun(struct se_cmd *, u32);
115int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 109int target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
116void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 110void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
117 unsigned char *, u32, u32, int, int, int); 111 unsigned char *, u32, u32, int, int, int);
118int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, 112int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
@@ -124,7 +118,6 @@ int transport_generic_handle_cdb_map(struct se_cmd *);
124int transport_generic_handle_data(struct se_cmd *); 118int transport_generic_handle_data(struct se_cmd *);
125int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, 119int transport_generic_map_mem_to_cmd(struct se_cmd *cmd,
126 struct scatterlist *, u32, struct scatterlist *, u32); 120 struct scatterlist *, u32, struct scatterlist *, u32);
127void transport_do_task_sg_chain(struct se_cmd *);
128int transport_generic_new_cmd(struct se_cmd *); 121int transport_generic_new_cmd(struct se_cmd *);
129 122
130void transport_generic_process_write(struct se_cmd *); 123void transport_generic_process_write(struct se_cmd *);
diff --git a/include/video/vga.h b/include/video/vga.h
index 2b8691f7d256..cac567f22e62 100644
--- a/include/video/vga.h
+++ b/include/video/vga.h
@@ -19,29 +19,7 @@
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#ifndef CONFIG_AMIGA
23#include <asm/vga.h> 22#include <asm/vga.h>
24#else
25/*
26 * FIXME
27 * Ugh, we don't have PCI space, so map readb() and friends to use Zorro space
28 * for MMIO accesses. This should make cirrusfb work again on Amiga
29 */
30#undef inb_p
31#undef inw_p
32#undef outb_p
33#undef outw
34#undef readb
35#undef writeb
36#undef writew
37#define inb_p(port) 0
38#define inw_p(port) 0
39#define outb_p(port, val) do { } while (0)
40#define outw(port, val) do { } while (0)
41#define readb z_readb
42#define writeb z_writeb
43#define writew z_writew
44#endif
45#include <asm/byteorder.h> 23#include <asm/byteorder.h>
46 24
47 25