diff mbox

[U-Boot,04/55] dm: i2c: Move definitions to the top of the header file

Message ID 1435882592-487-5-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass July 3, 2015, 12:15 a.m. UTC
Move the flags and struct definitions higher in the file so that we can
reference them with functions declared in the driver model section.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/i2c.h | 86 +++++++++++++++++++++++++++++------------------------------
 1 file changed, 43 insertions(+), 43 deletions(-)

Comments

Heiko Schocher July 3, 2015, 6:55 a.m. UTC | #1
Hello Simon,

Am 03.07.2015 um 02:15 schrieb Simon Glass:
> Move the flags and struct definitions higher in the file so that we can
> reference them with functions declared in the driver model section.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   include/i2c.h | 86 +++++++++++++++++++++++++++++------------------------------
>   1 file changed, 43 insertions(+), 43 deletions(-)


Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
>
> diff --git a/include/i2c.h b/include/i2c.h
> index e1ad8d8..4c0e263 100644
> --- a/include/i2c.h
> +++ b/include/i2c.h
> @@ -74,6 +74,49 @@ struct dm_i2c_bus {
>   	int speed_hz;
>   };
>
> +/*
> + * Not all of these flags are implemented in the U-Boot API
> + */
> +enum dm_i2c_msg_flags {
> +	I2C_M_TEN		= 0x0010, /* ten-bit chip address */
> +	I2C_M_RD		= 0x0001, /* read data, from slave to master */
> +	I2C_M_STOP		= 0x8000, /* send stop after this message */
> +	I2C_M_NOSTART		= 0x4000, /* no start before this message */
> +	I2C_M_REV_DIR_ADDR	= 0x2000, /* invert polarity of R/W bit */
> +	I2C_M_IGNORE_NAK	= 0x1000, /* continue after NAK */
> +	I2C_M_NO_RD_ACK		= 0x0800, /* skip the Ack bit on reads */
> +	I2C_M_RECV_LEN		= 0x0400, /* length is first received byte */
> +};
> +
> +/**
> + * struct i2c_msg - an I2C message
> + *
> + * @addr:	Slave address
> + * @flags:	Flags (see enum dm_i2c_msg_flags)
> + * @len:	Length of buffer in bytes, may be 0 for a probe
> + * @buf:	Buffer to send/receive, or NULL if no data
> + */
> +struct i2c_msg {
> +	uint addr;
> +	uint flags;
> +	uint len;
> +	u8 *buf;
> +};
> +
> +/**
> + * struct i2c_msg_list - a list of I2C messages
> + *
> + * This is called i2c_rdwr_ioctl_data in Linux but the name does not seem
> + * appropriate in U-Boot.
> + *
> + * @msg:	Pointer to i2c_msg array
> + * @nmsgs:	Number of elements in the array
> + */
> +struct i2c_msg_list {
> +	struct i2c_msg *msgs;
> +	uint nmsgs;
> +};
> +
>   /**
>    * dm_i2c_read() - read bytes from an I2C chip
>    *
> @@ -294,49 +337,6 @@ void i2c_reg_write(uint8_t addr, uint8_t reg, uint8_t val);
>
>   #endif
>
> -/*
> - * Not all of these flags are implemented in the U-Boot API
> - */
> -enum dm_i2c_msg_flags {
> -	I2C_M_TEN		= 0x0010, /* ten-bit chip address */
> -	I2C_M_RD		= 0x0001, /* read data, from slave to master */
> -	I2C_M_STOP		= 0x8000, /* send stop after this message */
> -	I2C_M_NOSTART		= 0x4000, /* no start before this message */
> -	I2C_M_REV_DIR_ADDR	= 0x2000, /* invert polarity of R/W bit */
> -	I2C_M_IGNORE_NAK	= 0x1000, /* continue after NAK */
> -	I2C_M_NO_RD_ACK		= 0x0800, /* skip the Ack bit on reads */
> -	I2C_M_RECV_LEN		= 0x0400, /* length is first received byte */
> -};
> -
> -/**
> - * struct i2c_msg - an I2C message
> - *
> - * @addr:	Slave address
> - * @flags:	Flags (see enum dm_i2c_msg_flags)
> - * @len:	Length of buffer in bytes, may be 0 for a probe
> - * @buf:	Buffer to send/receive, or NULL if no data
> - */
> -struct i2c_msg {
> -	uint addr;
> -	uint flags;
> -	uint len;
> -	u8 *buf;
> -};
> -
> -/**
> - * struct i2c_msg_list - a list of I2C messages
> - *
> - * This is called i2c_rdwr_ioctl_data in Linux but the name does not seem
> - * appropriate in U-Boot.
> - *
> - * @msg:	Pointer to i2c_msg array
> - * @nmsgs:	Number of elements in the array
> - */
> -struct i2c_msg_list {
> -	struct i2c_msg *msgs;
> -	uint nmsgs;
> -};
> -
>   /**
>    * struct dm_i2c_ops - driver operations for I2C uclass
>    *
>
Simon Glass July 27, 2015, 11:28 p.m. UTC | #2
On 3 July 2015 at 00:55, Heiko Schocher denx <hs@denx.de> wrote:
> Hello Simon,
>
> Am 03.07.2015 um 02:15 schrieb Simon Glass:
>>
>> Move the flags and struct definitions higher in the file so that we can
>> reference them with functions declared in the driver model section.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>   include/i2c.h | 86
>> +++++++++++++++++++++++++++++------------------------------
>>   1 file changed, 43 insertions(+), 43 deletions(-)
>
>
>
> Acked-by: Heiko Schocher <hs@denx.de>
>

Applied to u-boot-dm.
diff mbox

Patch

diff --git a/include/i2c.h b/include/i2c.h
index e1ad8d8..4c0e263 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -74,6 +74,49 @@  struct dm_i2c_bus {
 	int speed_hz;
 };
 
+/*
+ * Not all of these flags are implemented in the U-Boot API
+ */
+enum dm_i2c_msg_flags {
+	I2C_M_TEN		= 0x0010, /* ten-bit chip address */
+	I2C_M_RD		= 0x0001, /* read data, from slave to master */
+	I2C_M_STOP		= 0x8000, /* send stop after this message */
+	I2C_M_NOSTART		= 0x4000, /* no start before this message */
+	I2C_M_REV_DIR_ADDR	= 0x2000, /* invert polarity of R/W bit */
+	I2C_M_IGNORE_NAK	= 0x1000, /* continue after NAK */
+	I2C_M_NO_RD_ACK		= 0x0800, /* skip the Ack bit on reads */
+	I2C_M_RECV_LEN		= 0x0400, /* length is first received byte */
+};
+
+/**
+ * struct i2c_msg - an I2C message
+ *
+ * @addr:	Slave address
+ * @flags:	Flags (see enum dm_i2c_msg_flags)
+ * @len:	Length of buffer in bytes, may be 0 for a probe
+ * @buf:	Buffer to send/receive, or NULL if no data
+ */
+struct i2c_msg {
+	uint addr;
+	uint flags;
+	uint len;
+	u8 *buf;
+};
+
+/**
+ * struct i2c_msg_list - a list of I2C messages
+ *
+ * This is called i2c_rdwr_ioctl_data in Linux but the name does not seem
+ * appropriate in U-Boot.
+ *
+ * @msg:	Pointer to i2c_msg array
+ * @nmsgs:	Number of elements in the array
+ */
+struct i2c_msg_list {
+	struct i2c_msg *msgs;
+	uint nmsgs;
+};
+
 /**
  * dm_i2c_read() - read bytes from an I2C chip
  *
@@ -294,49 +337,6 @@  void i2c_reg_write(uint8_t addr, uint8_t reg, uint8_t val);
 
 #endif
 
-/*
- * Not all of these flags are implemented in the U-Boot API
- */
-enum dm_i2c_msg_flags {
-	I2C_M_TEN		= 0x0010, /* ten-bit chip address */
-	I2C_M_RD		= 0x0001, /* read data, from slave to master */
-	I2C_M_STOP		= 0x8000, /* send stop after this message */
-	I2C_M_NOSTART		= 0x4000, /* no start before this message */
-	I2C_M_REV_DIR_ADDR	= 0x2000, /* invert polarity of R/W bit */
-	I2C_M_IGNORE_NAK	= 0x1000, /* continue after NAK */
-	I2C_M_NO_RD_ACK		= 0x0800, /* skip the Ack bit on reads */
-	I2C_M_RECV_LEN		= 0x0400, /* length is first received byte */
-};
-
-/**
- * struct i2c_msg - an I2C message
- *
- * @addr:	Slave address
- * @flags:	Flags (see enum dm_i2c_msg_flags)
- * @len:	Length of buffer in bytes, may be 0 for a probe
- * @buf:	Buffer to send/receive, or NULL if no data
- */
-struct i2c_msg {
-	uint addr;
-	uint flags;
-	uint len;
-	u8 *buf;
-};
-
-/**
- * struct i2c_msg_list - a list of I2C messages
- *
- * This is called i2c_rdwr_ioctl_data in Linux but the name does not seem
- * appropriate in U-Boot.
- *
- * @msg:	Pointer to i2c_msg array
- * @nmsgs:	Number of elements in the array
- */
-struct i2c_msg_list {
-	struct i2c_msg *msgs;
-	uint nmsgs;
-};
-
 /**
  * struct dm_i2c_ops - driver operations for I2C uclass
  *