summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/i2c.c
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2015-04-09 16:01:31 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2015-04-10 11:17:20 +0200
commit453bbea807345db3faab8f4a432b4b1b2b245a27 (patch)
tree379ffb586fbbcb7f3c30e3db987bee7ed248e758 /drivers/staging/greybus/i2c.c
parentb0235b2263406728a0b6ee8b13be22f07507812d (diff)
greybus: Move briged phy structure definitions into gpbridge.h
In order to facilitate re-use of the gpio, i2c, pwm and i2s structures, split them out of independent files and add them into a shared gpbridge.h This will be a prereq to sharing these headers w/ gbsim. Cc: Alex Elder <alex.elder@linaro.org> Cc: Greg Kroah-Hartman <gregkh@google.com> CC: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/i2c.c')
-rw-r--r--drivers/staging/greybus/i2c.c57
1 files changed, 2 insertions, 55 deletions
diff --git a/drivers/staging/greybus/i2c.c b/drivers/staging/greybus/i2c.c
index 84d20e54ae9b..6fdbf1167ecb 100644
--- a/drivers/staging/greybus/i2c.c
+++ b/drivers/staging/greybus/i2c.c
@@ -13,6 +13,8 @@
#include <linux/i2c.h>
#include "greybus.h"
+#include "gpbridge.h"
+
struct gb_i2c_device {
struct gb_connection *connection;
@@ -26,61 +28,6 @@ struct gb_i2c_device {
struct i2c_adapter adapter;
};
-/* Version of the Greybus i2c protocol we support */
-#define GB_I2C_VERSION_MAJOR 0x00
-#define GB_I2C_VERSION_MINOR 0x01
-
-/* Greybus i2c request types */
-#define GB_I2C_TYPE_INVALID 0x00
-#define GB_I2C_TYPE_PROTOCOL_VERSION 0x01
-#define GB_I2C_TYPE_FUNCTIONALITY 0x02
-#define GB_I2C_TYPE_TIMEOUT 0x03
-#define GB_I2C_TYPE_RETRIES 0x04
-#define GB_I2C_TYPE_TRANSFER 0x05
-#define GB_I2C_TYPE_RESPONSE 0x80 /* OR'd with rest */
-
-#define GB_I2C_RETRIES_DEFAULT 3
-#define GB_I2C_TIMEOUT_DEFAULT 1000 /* milliseconds */
-
-/* functionality request has no payload */
-struct gb_i2c_functionality_response {
- __le32 functionality;
-};
-
-struct gb_i2c_timeout_request {
- __le16 msec;
-};
-/* timeout response has no payload */
-
-struct gb_i2c_retries_request {
- __u8 retries;
-};
-/* retries response has no payload */
-
-/*
- * Outgoing data immediately follows the op count and ops array.
- * The data for each write (master -> slave) op in the array is sent
- * in order, with no (e.g. pad) bytes separating them.
- *
- * Short reads cause the entire transfer request to fail So response
- * payload consists only of bytes read, and the number of bytes is
- * exactly what was specified in the corresponding op. Like
- * outgoing data, the incoming data is in order and contiguous.
- */
-struct gb_i2c_transfer_op {
- __le16 addr;
- __le16 flags;
- __le16 size;
-};
-
-struct gb_i2c_transfer_request {
- __le16 op_count;
- struct gb_i2c_transfer_op ops[0]; /* op_count of these */
-};
-struct gb_i2c_transfer_response {
- __u8 data[0]; /* inbound data */
-};
-
/* Define get_version() routine */
define_get_version(gb_i2c_device, I2C);