public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: "Sverdlin, Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@nokia.com>
To: "Adamski,
	Krzysztof (Nokia - PL/Wroclaw)" <krzysztof.adamski@nokia.com>,
	Wolfram Sang <wsa@the-dreams.de>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Tobias Jordan <Tobias.Jordan@elektrobit.com>,
	Peter Rosin <peda@axentia.se>
Subject: Re: [PATCH 1/3] i2c-axxia: dedicated function to set client addr
Date: Tue, 11 Dec 2018 12:00:15 +0000	[thread overview]
Message-ID: <d20df4a6-72b7-ba84-a170-38fd4d6af892@nokia.com> (raw)
In-Reply-To: <120bc3dbc7fad29807ff9f7c74575a66e6da15a6.1544453688.git.krzysztof.adamski@nokia.com>

Hi!

On 10/12/2018 16:00, Adamski, Krzysztof (Nokia - PL/Wroclaw) wrote:
> This patch moves configuration of hardware registers used for setting
> i2c client address to separate function. It is preparatory change for
> next commit.

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>

> Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
> ---
>  drivers/i2c/busses/i2c-axxia.c | 29 ++++++++++++++++++-----------
>  1 file changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c
> index 51d34959709b..d37caf694fbf 100644
> --- a/drivers/i2c/busses/i2c-axxia.c
> +++ b/drivers/i2c/busses/i2c-axxia.c
> @@ -337,17 +337,9 @@ static irqreturn_t axxia_i2c_isr(int irq, void *_dev)
>  	return IRQ_HANDLED;
>  }
>  
> -static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg)
> +static void axxia_i2c_set_addr(struct axxia_i2c_dev *idev, struct i2c_msg *msg)
>  {
> -	u32 int_mask = MST_STATUS_ERR | MST_STATUS_SNS;
> -	u32 rx_xfer, tx_xfer;
>  	u32 addr_1, addr_2;
> -	unsigned long time_left;
> -	unsigned int wt_value;
> -
> -	idev->msg = msg;
> -	idev->msg_xfrd = 0;
> -	reinit_completion(&idev->msg_complete);
>  
>  	if (i2c_m_ten(msg)) {
>  		/* 10-bit address
> @@ -367,6 +359,23 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg)
>  		addr_2 = 0;
>  	}
>  
> +	writel(addr_1, idev->base + MST_ADDR_1);
> +	writel(addr_2, idev->base + MST_ADDR_2);
> +}
> +
> +static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg)
> +{
> +	u32 int_mask = MST_STATUS_ERR | MST_STATUS_SNS;
> +	u32 rx_xfer, tx_xfer;
> +	unsigned long time_left;
> +	unsigned int wt_value;
> +
> +	idev->msg = msg;
> +	idev->msg_xfrd = 0;
> +	reinit_completion(&idev->msg_complete);
> +
> +	axxia_i2c_set_addr(idev, msg);
> +
>  	if (i2c_m_rd(msg)) {
>  		/* I2C read transfer */
>  		rx_xfer = i2c_m_recv_len(msg) ? I2C_SMBUS_BLOCK_MAX : msg->len;
> @@ -379,8 +388,6 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg)
>  
>  	writel(rx_xfer, idev->base + MST_RX_XFER);
>  	writel(tx_xfer, idev->base + MST_TX_XFER);
> -	writel(addr_1, idev->base + MST_ADDR_1);
> -	writel(addr_2, idev->base + MST_ADDR_2);
>  
>  	if (i2c_m_rd(msg))
>  		int_mask |= MST_STATUS_RFL;

-- 
Best regards,
Alexander Sverdlin.

  reply	other threads:[~2018-12-11 12:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 15:00 [PATCH 0/3] i2c-axxia: support Sequence command Adamski, Krzysztof (Nokia - PL/Wroclaw)
2018-12-10 15:00 ` [PATCH 1/3] i2c-axxia: dedicated function to set client addr Adamski, Krzysztof (Nokia - PL/Wroclaw)
2018-12-11 12:00   ` Sverdlin, Alexander (Nokia - DE/Ulm) [this message]
2018-12-11 20:05   ` Wolfram Sang
2018-12-10 15:01 ` [PATCH 2/3] i2c-axxia: check for error conditions first Adamski, Krzysztof (Nokia - PL/Wroclaw)
2018-12-11 12:02   ` Sverdlin, Alexander (Nokia - DE/Ulm)
2018-12-11 20:05   ` Wolfram Sang
2018-12-10 15:05 ` [PATCH 3/3] i2c-axxia: support sequence command mode Adamski, Krzysztof (Nokia - PL/Wroclaw)
2018-12-11 12:05   ` Sverdlin, Alexander (Nokia - DE/Ulm)
2018-12-11 20:04   ` Wolfram Sang
2018-12-13 12:09     ` [PATCH v2] i2c: axxia: " Adamski, Krzysztof (Nokia - PL/Wroclaw)
2018-12-13 12:45       ` Sverdlin, Alexander (Nokia - DE/Ulm)
2018-12-17 22:31       ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d20df4a6-72b7-ba84-a170-38fd4d6af892@nokia.com \
    --to=alexander.sverdlin@nokia.com \
    --cc=Tobias.Jordan@elektrobit.com \
    --cc=krzysztof.adamski@nokia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=peda@axentia.se \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox