aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/amba/bus.h9
-rw-r--r--include/linux/coresight-pmu.h39
-rw-r--r--include/linux/coresight.h34
-rw-r--r--include/linux/davinci_emac.h4
-rw-r--r--include/linux/eeprom_93xx46.h9
-rw-r--r--include/linux/hyperv.h96
-rw-r--r--include/linux/memory.h11
-rw-r--r--include/linux/mfd/palmas.h3
-rw-r--r--include/linux/nvmem-provider.h5
-rw-r--r--include/linux/platform_data/at24.h10
-rw-r--r--include/linux/spi/eeprom.h2
-rw-r--r--include/linux/stm.h10
-rw-r--r--include/linux/vmw_vmci_defs.h43
13 files changed, 243 insertions, 32 deletions
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 9006c4e75cf7..3d8dcdd1aeae 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -163,4 +163,13 @@ struct amba_device name##_device = { \
163#define module_amba_driver(__amba_drv) \ 163#define module_amba_driver(__amba_drv) \
164 module_driver(__amba_drv, amba_driver_register, amba_driver_unregister) 164 module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
165 165
166/*
167 * builtin_amba_driver() - Helper macro for drivers that don't do anything
168 * special in driver initcall. This eliminates a lot of boilerplate. Each
169 * driver may only use this macro once, and calling it replaces the instance
170 * device_initcall().
171 */
172#define builtin_amba_driver(__amba_drv) \
173 builtin_driver(__amba_drv, amba_driver_register)
174
166#endif 175#endif
diff --git a/include/linux/coresight-pmu.h b/include/linux/coresight-pmu.h
new file mode 100644
index 000000000000..7d410260661b
--- /dev/null
+++ b/include/linux/coresight-pmu.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright(C) 2015 Linaro Limited. All rights reserved.
3 * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef _LINUX_CORESIGHT_PMU_H
19#define _LINUX_CORESIGHT_PMU_H
20
21#define CORESIGHT_ETM_PMU_NAME "cs_etm"
22#define CORESIGHT_ETM_PMU_SEED 0x10
23
24/* ETMv3.5/PTM's ETMCR config bit */
25#define ETM_OPT_CYCACC 12
26#define ETM_OPT_TS 28
27
28static inline int coresight_get_trace_id(int cpu)
29{
30 /*
31 * A trace ID of value 0 is invalid, so let's start at some
32 * random value that fits in 7 bits and go from there. Since
33 * the common convention is to have data trace IDs be I(N) + 1,
34 * set instruction trace IDs as a function of the CPU number.
35 */
36 return (CORESIGHT_ETM_PMU_SEED + (cpu * 2));
37}
38
39#endif
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index a7cabfa23b55..385d62e64abb 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -14,6 +14,7 @@
14#define _LINUX_CORESIGHT_H 14#define _LINUX_CORESIGHT_H
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/perf_event.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
18 19
19/* Peripheral id registers (0xFD0-0xFEC) */ 20/* Peripheral id registers (0xFD0-0xFEC) */
@@ -152,7 +153,6 @@ struct coresight_connection {
152 by @coresight_ops. 153 by @coresight_ops.
153 * @dev: The device entity associated to this component. 154 * @dev: The device entity associated to this component.
154 * @refcnt: keep track of what is in use. 155 * @refcnt: keep track of what is in use.
155 * @path_link: link of current component into the path being enabled.
156 * @orphan: true if the component has connections that haven't been linked. 156 * @orphan: true if the component has connections that haven't been linked.
157 * @enable: 'true' if component is currently part of an active path. 157 * @enable: 'true' if component is currently part of an active path.
158 * @activated: 'true' only if a _sink_ has been activated. A sink can be 158 * @activated: 'true' only if a _sink_ has been activated. A sink can be
@@ -168,7 +168,6 @@ struct coresight_device {
168 const struct coresight_ops *ops; 168 const struct coresight_ops *ops;
169 struct device dev; 169 struct device dev;
170 atomic_t *refcnt; 170 atomic_t *refcnt;
171 struct list_head path_link;
172 bool orphan; 171 bool orphan;
173 bool enable; /* true only if configured as part of a path */ 172 bool enable; /* true only if configured as part of a path */
174 bool activated; /* true only if a sink is part of a path */ 173 bool activated; /* true only if a sink is part of a path */
@@ -183,12 +182,29 @@ struct coresight_device {
183/** 182/**
184 * struct coresight_ops_sink - basic operations for a sink 183 * struct coresight_ops_sink - basic operations for a sink
185 * Operations available for sinks 184 * Operations available for sinks
186 * @enable: enables the sink. 185 * @enable: enables the sink.
187 * @disable: disables the sink. 186 * @disable: disables the sink.
187 * @alloc_buffer: initialises perf's ring buffer for trace collection.
188 * @free_buffer: release memory allocated in @get_config.
189 * @set_buffer: initialises buffer mechanic before a trace session.
190 * @reset_buffer: finalises buffer mechanic after a trace session.
191 * @update_buffer: update buffer pointers after a trace session.
188 */ 192 */
189struct coresight_ops_sink { 193struct coresight_ops_sink {
190 int (*enable)(struct coresight_device *csdev); 194 int (*enable)(struct coresight_device *csdev, u32 mode);
191 void (*disable)(struct coresight_device *csdev); 195 void (*disable)(struct coresight_device *csdev);
196 void *(*alloc_buffer)(struct coresight_device *csdev, int cpu,
197 void **pages, int nr_pages, bool overwrite);
198 void (*free_buffer)(void *config);
199 int (*set_buffer)(struct coresight_device *csdev,
200 struct perf_output_handle *handle,
201 void *sink_config);
202 unsigned long (*reset_buffer)(struct coresight_device *csdev,
203 struct perf_output_handle *handle,
204 void *sink_config, bool *lost);
205 void (*update_buffer)(struct coresight_device *csdev,
206 struct perf_output_handle *handle,
207 void *sink_config);
192}; 208};
193 209
194/** 210/**
@@ -205,14 +221,18 @@ struct coresight_ops_link {
205/** 221/**
206 * struct coresight_ops_source - basic operations for a source 222 * struct coresight_ops_source - basic operations for a source
207 * Operations available for sources. 223 * Operations available for sources.
224 * @cpu_id: returns the value of the CPU number this component
225 * is associated to.
208 * @trace_id: returns the value of the component's trace ID as known 226 * @trace_id: returns the value of the component's trace ID as known
209 to the HW. 227 * to the HW.
210 * @enable: enables tracing for a source. 228 * @enable: enables tracing for a source.
211 * @disable: disables tracing for a source. 229 * @disable: disables tracing for a source.
212 */ 230 */
213struct coresight_ops_source { 231struct coresight_ops_source {
232 int (*cpu_id)(struct coresight_device *csdev);
214 int (*trace_id)(struct coresight_device *csdev); 233 int (*trace_id)(struct coresight_device *csdev);
215 int (*enable)(struct coresight_device *csdev); 234 int (*enable)(struct coresight_device *csdev,
235 struct perf_event_attr *attr, u32 mode);
216 void (*disable)(struct coresight_device *csdev); 236 void (*disable)(struct coresight_device *csdev);
217}; 237};
218 238
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h
index 542888504994..05b97144d342 100644
--- a/include/linux/davinci_emac.h
+++ b/include/linux/davinci_emac.h
@@ -12,7 +12,7 @@
12#define _LINUX_DAVINCI_EMAC_H 12#define _LINUX_DAVINCI_EMAC_H
13 13
14#include <linux/if_ether.h> 14#include <linux/if_ether.h>
15#include <linux/memory.h> 15#include <linux/nvmem-consumer.h>
16 16
17struct mdio_platform_data { 17struct mdio_platform_data {
18 unsigned long bus_freq; 18 unsigned long bus_freq;
@@ -46,5 +46,5 @@ enum {
46 EMAC_VERSION_2, /* DM646x */ 46 EMAC_VERSION_2, /* DM646x */
47}; 47};
48 48
49void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context); 49void davinci_get_mac_addr(struct nvmem_device *nvmem, void *context);
50#endif 50#endif
diff --git a/include/linux/eeprom_93xx46.h b/include/linux/eeprom_93xx46.h
index 06791811e49d..885f587a3555 100644
--- a/include/linux/eeprom_93xx46.h
+++ b/include/linux/eeprom_93xx46.h
@@ -3,16 +3,25 @@
3 * platform description for 93xx46 EEPROMs. 3 * platform description for 93xx46 EEPROMs.
4 */ 4 */
5 5
6struct gpio_desc;
7
6struct eeprom_93xx46_platform_data { 8struct eeprom_93xx46_platform_data {
7 unsigned char flags; 9 unsigned char flags;
8#define EE_ADDR8 0x01 /* 8 bit addr. cfg */ 10#define EE_ADDR8 0x01 /* 8 bit addr. cfg */
9#define EE_ADDR16 0x02 /* 16 bit addr. cfg */ 11#define EE_ADDR16 0x02 /* 16 bit addr. cfg */
10#define EE_READONLY 0x08 /* forbid writing */ 12#define EE_READONLY 0x08 /* forbid writing */
11 13
14 unsigned int quirks;
15/* Single word read transfers only; no sequential read. */
16#define EEPROM_93XX46_QUIRK_SINGLE_WORD_READ (1 << 0)
17/* Instructions such as EWEN are (addrlen + 2) in length. */
18#define EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH (1 << 1)
19
12 /* 20 /*
13 * optional hooks to control additional logic 21 * optional hooks to control additional logic
14 * before and after spi transfer. 22 * before and after spi transfer.
15 */ 23 */
16 void (*prepare)(void *); 24 void (*prepare)(void *);
17 void (*finish)(void *); 25 void (*finish)(void *);
26 struct gpio_desc *select;
18}; 27};
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 753dbad0bf94..aa0fadce9308 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -235,6 +235,7 @@ struct vmbus_channel_offer {
235#define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100 235#define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100
236#define VMBUS_CHANNEL_PARENT_OFFER 0x200 236#define VMBUS_CHANNEL_PARENT_OFFER 0x200
237#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400 237#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400
238#define VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER 0x2000
238 239
239struct vmpacket_descriptor { 240struct vmpacket_descriptor {
240 u16 type; 241 u16 type;
@@ -391,6 +392,10 @@ enum vmbus_channel_message_type {
391 CHANNELMSG_VERSION_RESPONSE = 15, 392 CHANNELMSG_VERSION_RESPONSE = 15,
392 CHANNELMSG_UNLOAD = 16, 393 CHANNELMSG_UNLOAD = 16,
393 CHANNELMSG_UNLOAD_RESPONSE = 17, 394 CHANNELMSG_UNLOAD_RESPONSE = 17,
395 CHANNELMSG_18 = 18,
396 CHANNELMSG_19 = 19,
397 CHANNELMSG_20 = 20,
398 CHANNELMSG_TL_CONNECT_REQUEST = 21,
394 CHANNELMSG_COUNT 399 CHANNELMSG_COUNT
395}; 400};
396 401
@@ -561,6 +566,13 @@ struct vmbus_channel_initiate_contact {
561 u64 monitor_page2; 566 u64 monitor_page2;
562} __packed; 567} __packed;
563 568
569/* Hyper-V socket: guest's connect()-ing to host */
570struct vmbus_channel_tl_connect_request {
571 struct vmbus_channel_message_header header;
572 uuid_le guest_endpoint_id;
573 uuid_le host_service_id;
574} __packed;
575
564struct vmbus_channel_version_response { 576struct vmbus_channel_version_response {
565 struct vmbus_channel_message_header header; 577 struct vmbus_channel_message_header header;
566 u8 version_supported; 578 u8 version_supported;
@@ -633,6 +645,32 @@ enum hv_signal_policy {
633 HV_SIGNAL_POLICY_EXPLICIT, 645 HV_SIGNAL_POLICY_EXPLICIT,
634}; 646};
635 647
648enum vmbus_device_type {
649 HV_IDE = 0,
650 HV_SCSI,
651 HV_FC,
652 HV_NIC,
653 HV_ND,
654 HV_PCIE,
655 HV_FB,
656 HV_KBD,
657 HV_MOUSE,
658 HV_KVP,
659 HV_TS,
660 HV_HB,
661 HV_SHUTDOWN,
662 HV_FCOPY,
663 HV_BACKUP,
664 HV_DM,
665 HV_UNKOWN,
666};
667
668struct vmbus_device {
669 u16 dev_type;
670 uuid_le guid;
671 bool perf_device;
672};
673
636struct vmbus_channel { 674struct vmbus_channel {
637 /* Unique channel id */ 675 /* Unique channel id */
638 int id; 676 int id;
@@ -728,6 +766,12 @@ struct vmbus_channel {
728 void (*sc_creation_callback)(struct vmbus_channel *new_sc); 766 void (*sc_creation_callback)(struct vmbus_channel *new_sc);
729 767
730 /* 768 /*
769 * Channel rescind callback. Some channels (the hvsock ones), need to
770 * register a callback which is invoked in vmbus_onoffer_rescind().
771 */
772 void (*chn_rescind_callback)(struct vmbus_channel *channel);
773
774 /*
731 * The spinlock to protect the structure. It is being used to protect 775 * The spinlock to protect the structure. It is being used to protect
732 * test-and-set access to various attributes of the structure as well 776 * test-and-set access to various attributes of the structure as well
733 * as all sc_list operations. 777 * as all sc_list operations.
@@ -767,8 +811,30 @@ struct vmbus_channel {
767 * signaling control. 811 * signaling control.
768 */ 812 */
769 enum hv_signal_policy signal_policy; 813 enum hv_signal_policy signal_policy;
814 /*
815 * On the channel send side, many of the VMBUS
816 * device drivers explicity serialize access to the
817 * outgoing ring buffer. Give more control to the
818 * VMBUS device drivers in terms how to serialize
819 * accesss to the outgoing ring buffer.
820 * The default behavior will be to aquire the
821 * ring lock to preserve the current behavior.
822 */
823 bool acquire_ring_lock;
824
770}; 825};
771 826
827static inline void set_channel_lock_state(struct vmbus_channel *c, bool state)
828{
829 c->acquire_ring_lock = state;
830}
831
832static inline bool is_hvsock_channel(const struct vmbus_channel *c)
833{
834 return !!(c->offermsg.offer.chn_flags &
835 VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER);
836}
837
772static inline void set_channel_signal_state(struct vmbus_channel *c, 838static inline void set_channel_signal_state(struct vmbus_channel *c,
773 enum hv_signal_policy policy) 839 enum hv_signal_policy policy)
774{ 840{
@@ -790,6 +856,12 @@ static inline void *get_per_channel_state(struct vmbus_channel *c)
790 return c->per_channel_state; 856 return c->per_channel_state;
791} 857}
792 858
859static inline void set_channel_pending_send_size(struct vmbus_channel *c,
860 u32 size)
861{
862 c->outbound.ring_buffer->pending_send_sz = size;
863}
864
793void vmbus_onmessage(void *context); 865void vmbus_onmessage(void *context);
794 866
795int vmbus_request_offers(void); 867int vmbus_request_offers(void);
@@ -801,6 +873,9 @@ int vmbus_request_offers(void);
801void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel, 873void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,
802 void (*sc_cr_cb)(struct vmbus_channel *new_sc)); 874 void (*sc_cr_cb)(struct vmbus_channel *new_sc));
803 875
876void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel,
877 void (*chn_rescind_cb)(struct vmbus_channel *));
878
804/* 879/*
805 * Retrieve the (sub) channel on which to send an outgoing request. 880 * Retrieve the (sub) channel on which to send an outgoing request.
806 * When a primary channel has multiple sub-channels, we choose a 881 * When a primary channel has multiple sub-channels, we choose a
@@ -940,6 +1015,20 @@ extern void vmbus_ontimer(unsigned long data);
940struct hv_driver { 1015struct hv_driver {
941 const char *name; 1016 const char *name;
942 1017
1018 /*
1019 * A hvsock offer, which has a VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER
1020 * channel flag, actually doesn't mean a synthetic device because the
1021 * offer's if_type/if_instance can change for every new hvsock
1022 * connection.
1023 *
1024 * However, to facilitate the notification of new-offer/rescind-offer
1025 * from vmbus driver to hvsock driver, we can handle hvsock offer as
1026 * a special vmbus device, and hence we need the below flag to
1027 * indicate if the driver is the hvsock driver or not: we need to
1028 * specially treat the hvosck offer & driver in vmbus_match().
1029 */
1030 bool hvsock;
1031
943 /* the device type supported by this driver */ 1032 /* the device type supported by this driver */
944 uuid_le dev_type; 1033 uuid_le dev_type;
945 const struct hv_vmbus_device_id *id_table; 1034 const struct hv_vmbus_device_id *id_table;
@@ -959,6 +1048,8 @@ struct hv_device {
959 1048
960 /* the device instance id of this device */ 1049 /* the device instance id of this device */
961 uuid_le dev_instance; 1050 uuid_le dev_instance;
1051 u16 vendor_id;
1052 u16 device_id;
962 1053
963 struct device device; 1054 struct device device;
964 1055
@@ -994,6 +1085,8 @@ int __must_check __vmbus_driver_register(struct hv_driver *hv_driver,
994 const char *mod_name); 1085 const char *mod_name);
995void vmbus_driver_unregister(struct hv_driver *hv_driver); 1086void vmbus_driver_unregister(struct hv_driver *hv_driver);
996 1087
1088void vmbus_hvsock_device_unregister(struct vmbus_channel *channel);
1089
997int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, 1090int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
998 resource_size_t min, resource_size_t max, 1091 resource_size_t min, resource_size_t max,
999 resource_size_t size, resource_size_t align, 1092 resource_size_t size, resource_size_t align,
@@ -1158,6 +1251,7 @@ u64 hv_do_hypercall(u64 control, void *input, void *output);
1158 1251
1159struct hv_util_service { 1252struct hv_util_service {
1160 u8 *recv_buffer; 1253 u8 *recv_buffer;
1254 void *channel;
1161 void (*util_cb)(void *); 1255 void (*util_cb)(void *);
1162 int (*util_init)(struct hv_util_service *); 1256 int (*util_init)(struct hv_util_service *);
1163 void (*util_deinit)(void); 1257 void (*util_deinit)(void);
@@ -1242,4 +1336,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid);
1242 1336
1243extern __u32 vmbus_proto_version; 1337extern __u32 vmbus_proto_version;
1244 1338
1339int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id,
1340 const uuid_le *shv_host_servie_id);
1245#endif /* _HYPERV_H */ 1341#endif /* _HYPERV_H */
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 82730adba950..093607f90b91 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -140,17 +140,6 @@ extern struct memory_block *find_memory_block(struct mem_section *);
140#endif 140#endif
141 141
142/* 142/*
143 * 'struct memory_accessor' is a generic interface to provide
144 * in-kernel access to persistent memory such as i2c or SPI EEPROMs
145 */
146struct memory_accessor {
147 ssize_t (*read)(struct memory_accessor *, char *buf, off_t offset,
148 size_t count);
149 ssize_t (*write)(struct memory_accessor *, const char *buf,
150 off_t offset, size_t count);
151};
152
153/*
154 * Kernel text modification mutex, used for code patching. Users of this lock 143 * Kernel text modification mutex, used for code patching. Users of this lock
155 * can sleep. 144 * can sleep.
156 */ 145 */
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index c800dbc42079..5c9a1d44c125 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -580,7 +580,9 @@ struct palmas_usb {
580 int vbus_irq; 580 int vbus_irq;
581 581
582 int gpio_id_irq; 582 int gpio_id_irq;
583 int gpio_vbus_irq;
583 struct gpio_desc *id_gpiod; 584 struct gpio_desc *id_gpiod;
585 struct gpio_desc *vbus_gpiod;
584 unsigned long sw_debounce_jiffies; 586 unsigned long sw_debounce_jiffies;
585 struct delayed_work wq_detectid; 587 struct delayed_work wq_detectid;
586 588
@@ -589,6 +591,7 @@ struct palmas_usb {
589 bool enable_vbus_detection; 591 bool enable_vbus_detection;
590 bool enable_id_detection; 592 bool enable_id_detection;
591 bool enable_gpio_id_detection; 593 bool enable_gpio_id_detection;
594 bool enable_gpio_vbus_detection;
592}; 595};
593 596
594#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) 597#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 0b68caff1b3c..a4fcc90b0f20 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -23,6 +23,10 @@ struct nvmem_config {
23 const struct nvmem_cell_info *cells; 23 const struct nvmem_cell_info *cells;
24 int ncells; 24 int ncells;
25 bool read_only; 25 bool read_only;
26 bool root_only;
27 /* To be only used by old driver/misc/eeprom drivers */
28 bool compat;
29 struct device *base_dev;
26}; 30};
27 31
28#if IS_ENABLED(CONFIG_NVMEM) 32#if IS_ENABLED(CONFIG_NVMEM)
@@ -43,5 +47,4 @@ static inline int nvmem_unregister(struct nvmem_device *nvmem)
43} 47}
44 48
45#endif /* CONFIG_NVMEM */ 49#endif /* CONFIG_NVMEM */
46
47#endif /* ifndef _LINUX_NVMEM_PROVIDER_H */ 50#endif /* ifndef _LINUX_NVMEM_PROVIDER_H */
diff --git a/include/linux/platform_data/at24.h b/include/linux/platform_data/at24.h
index c42aa89d34ee..dc9a13e5acda 100644
--- a/include/linux/platform_data/at24.h
+++ b/include/linux/platform_data/at24.h
@@ -9,7 +9,7 @@
9#define _LINUX_AT24_H 9#define _LINUX_AT24_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/memory.h> 12#include <linux/nvmem-consumer.h>
13 13
14/** 14/**
15 * struct at24_platform_data - data to set up at24 (generic eeprom) driver 15 * struct at24_platform_data - data to set up at24 (generic eeprom) driver
@@ -17,7 +17,7 @@
17 * @page_size: number of byte which can be written in one go 17 * @page_size: number of byte which can be written in one go
18 * @flags: tunable options, check AT24_FLAG_* defines 18 * @flags: tunable options, check AT24_FLAG_* defines
19 * @setup: an optional callback invoked after eeprom is probed; enables kernel 19 * @setup: an optional callback invoked after eeprom is probed; enables kernel
20 code to access eeprom via memory_accessor, see example 20 code to access eeprom via nvmem, see example
21 * @context: optional parameter passed to setup() 21 * @context: optional parameter passed to setup()
22 * 22 *
23 * If you set up a custom eeprom type, please double-check the parameters. 23 * If you set up a custom eeprom type, please double-check the parameters.
@@ -26,13 +26,13 @@
26 * 26 *
27 * An example in pseudo code for a setup() callback: 27 * An example in pseudo code for a setup() callback:
28 * 28 *
29 * void get_mac_addr(struct memory_accessor *mem_acc, void *context) 29 * void get_mac_addr(struct mvmem_device *nvmem, void *context)
30 * { 30 * {
31 * u8 *mac_addr = ethernet_pdata->mac_addr; 31 * u8 *mac_addr = ethernet_pdata->mac_addr;
32 * off_t offset = context; 32 * off_t offset = context;
33 * 33 *
34 * // Read MAC addr from EEPROM 34 * // Read MAC addr from EEPROM
35 * if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN) 35 * if (nvmem_device_read(nvmem, offset, ETH_ALEN, mac_addr) == ETH_ALEN)
36 * pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); 36 * pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
37 * } 37 * }
38 * 38 *
@@ -48,7 +48,7 @@ struct at24_platform_data {
48#define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */ 48#define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */
49#define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */ 49#define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */
50 50
51 void (*setup)(struct memory_accessor *, void *context); 51 void (*setup)(struct nvmem_device *nvmem, void *context);
52 void *context; 52 void *context;
53}; 53};
54 54
diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h
index 403e007aef68..e34e169f9dcb 100644
--- a/include/linux/spi/eeprom.h
+++ b/include/linux/spi/eeprom.h
@@ -30,8 +30,6 @@ struct spi_eeprom {
30 */ 30 */
31#define EE_INSTR_BIT3_IS_ADDR 0x0010 31#define EE_INSTR_BIT3_IS_ADDR 0x0010
32 32
33 /* for exporting this chip's data to other kernel code */
34 void (*setup)(struct memory_accessor *mem, void *context);
35 void *context; 33 void *context;
36}; 34};
37 35
diff --git a/include/linux/stm.h b/include/linux/stm.h
index 9d0083d364e6..1a79ed8e43da 100644
--- a/include/linux/stm.h
+++ b/include/linux/stm.h
@@ -67,6 +67,16 @@ struct stm_device;
67 * description. That is, the lowest master that can be allocated to software 67 * description. That is, the lowest master that can be allocated to software
68 * writers is @sw_start and data from this writer will appear is @sw_start 68 * writers is @sw_start and data from this writer will appear is @sw_start
69 * master in the STP stream. 69 * master in the STP stream.
70 *
71 * The @packet callback should adhere to the following rules:
72 * 1) it must return the number of bytes it consumed from the payload;
73 * 2) therefore, if it sent a packet that does not have payload (like FLAG),
74 * it must return zero;
75 * 3) if it does not support the requested packet type/flag combination,
76 * it must return -ENOTSUPP.
77 *
78 * The @unlink callback is called when there are no more active writers so
79 * that the master/channel can be quiesced.
70 */ 80 */
71struct stm_data { 81struct stm_data {
72 const char *name; 82 const char *name;
diff --git a/include/linux/vmw_vmci_defs.h b/include/linux/vmw_vmci_defs.h
index 65ac54c61c18..1bd31a38c51e 100644
--- a/include/linux/vmw_vmci_defs.h
+++ b/include/linux/vmw_vmci_defs.h
@@ -734,6 +734,41 @@ static inline void *vmci_event_data_payload(struct vmci_event_data *ev_data)
734} 734}
735 735
736/* 736/*
737 * Helper to read a value from a head or tail pointer. For X86_32, the
738 * pointer is treated as a 32bit value, since the pointer value
739 * never exceeds a 32bit value in this case. Also, doing an
740 * atomic64_read on X86_32 uniprocessor systems may be implemented
741 * as a non locked cmpxchg8b, that may end up overwriting updates done
742 * by the VMCI device to the memory location. On 32bit SMP, the lock
743 * prefix will be used, so correctness isn't an issue, but using a
744 * 64bit operation still adds unnecessary overhead.
745 */
746static inline u64 vmci_q_read_pointer(atomic64_t *var)
747{
748#if defined(CONFIG_X86_32)
749 return atomic_read((atomic_t *)var);
750#else
751 return atomic64_read(var);
752#endif
753}
754
755/*
756 * Helper to set the value of a head or tail pointer. For X86_32, the
757 * pointer is treated as a 32bit value, since the pointer value
758 * never exceeds a 32bit value in this case. On 32bit SMP, using a
759 * locked cmpxchg8b adds unnecessary overhead.
760 */
761static inline void vmci_q_set_pointer(atomic64_t *var,
762 u64 new_val)
763{
764#if defined(CONFIG_X86_32)
765 return atomic_set((atomic_t *)var, (u32)new_val);
766#else
767 return atomic64_set(var, new_val);
768#endif
769}
770
771/*
737 * Helper to add a given offset to a head or tail pointer. Wraps the 772 * Helper to add a given offset to a head or tail pointer. Wraps the
738 * value of the pointer around the max size of the queue. 773 * value of the pointer around the max size of the queue.
739 */ 774 */
@@ -741,14 +776,14 @@ static inline void vmci_qp_add_pointer(atomic64_t *var,
741 size_t add, 776 size_t add,
742 u64 size) 777 u64 size)
743{ 778{
744 u64 new_val = atomic64_read(var); 779 u64 new_val = vmci_q_read_pointer(var);
745 780
746 if (new_val >= size - add) 781 if (new_val >= size - add)
747 new_val -= size; 782 new_val -= size;
748 783
749 new_val += add; 784 new_val += add;
750 785
751 atomic64_set(var, new_val); 786 vmci_q_set_pointer(var, new_val);
752} 787}
753 788
754/* 789/*
@@ -758,7 +793,7 @@ static inline u64
758vmci_q_header_producer_tail(const struct vmci_queue_header *q_header) 793vmci_q_header_producer_tail(const struct vmci_queue_header *q_header)
759{ 794{
760 struct vmci_queue_header *qh = (struct vmci_queue_header *)q_header; 795 struct vmci_queue_header *qh = (struct vmci_queue_header *)q_header;
761 return atomic64_read(&qh->producer_tail); 796 return vmci_q_read_pointer(&qh->producer_tail);
762} 797}
763 798
764/* 799/*
@@ -768,7 +803,7 @@ static inline u64
768vmci_q_header_consumer_head(const struct vmci_queue_header *q_header) 803vmci_q_header_consumer_head(const struct vmci_queue_header *q_header)
769{ 804{
770 struct vmci_queue_header *qh = (struct vmci_queue_header *)q_header; 805 struct vmci_queue_header *qh = (struct vmci_queue_header *)q_header;
771 return atomic64_read(&qh->consumer_head); 806 return vmci_q_read_pointer(&qh->consumer_head);
772} 807}
773 808
774/* 809/*