i2c: mv64xxx: refactor initialization for new msgs
We now have a central place to put this code to. Tested-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
b0200abeba
commit
485ecdf1f4
1 changed files with 6 additions and 10 deletions
|
@ -178,11 +178,6 @@ mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data,
|
||||||
{
|
{
|
||||||
u32 dir = 0;
|
u32 dir = 0;
|
||||||
|
|
||||||
drv_data->msg = msg;
|
|
||||||
drv_data->byte_posn = 0;
|
|
||||||
drv_data->bytes_left = msg->len;
|
|
||||||
drv_data->aborting = 0;
|
|
||||||
drv_data->rc = 0;
|
|
||||||
drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK |
|
drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK |
|
||||||
MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN;
|
MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN;
|
||||||
|
|
||||||
|
@ -208,11 +203,6 @@ static int mv64xxx_i2c_offload_msg(struct mv64xxx_i2c_data *drv_data)
|
||||||
if (!drv_data->offload_enabled)
|
if (!drv_data->offload_enabled)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
drv_data->msg = msg;
|
|
||||||
drv_data->byte_posn = 0;
|
|
||||||
drv_data->bytes_left = msg->len;
|
|
||||||
drv_data->aborting = 0;
|
|
||||||
drv_data->rc = 0;
|
|
||||||
/* Only regular transactions can be offloaded */
|
/* Only regular transactions can be offloaded */
|
||||||
if ((msg->flags & ~(I2C_M_TEN | I2C_M_RD)) != 0)
|
if ((msg->flags & ~(I2C_M_TEN | I2C_M_RD)) != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -423,6 +413,12 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
|
||||||
|
|
||||||
static void mv64xxx_i2c_send_start(struct mv64xxx_i2c_data *drv_data)
|
static void mv64xxx_i2c_send_start(struct mv64xxx_i2c_data *drv_data)
|
||||||
{
|
{
|
||||||
|
drv_data->msg = drv_data->msgs;
|
||||||
|
drv_data->byte_posn = 0;
|
||||||
|
drv_data->bytes_left = drv_data->msg->len;
|
||||||
|
drv_data->aborting = 0;
|
||||||
|
drv_data->rc = 0;
|
||||||
|
|
||||||
/* Can we offload this msg ? */
|
/* Can we offload this msg ? */
|
||||||
if (mv64xxx_i2c_offload_msg(drv_data) < 0) {
|
if (mv64xxx_i2c_offload_msg(drv_data) < 0) {
|
||||||
/* No, switch to standard path */
|
/* No, switch to standard path */
|
||||||
|
|
Loading…
Add table
Reference in a new issue