From: Tomasz Figa <tomasz.figa@gmail.com>
To: Vasanth Ananthan <vasanthananthan@gmail.com>
Cc: kgene.kim@samsung.com, jgarzik@pobox.com, linux@arm.linux.org.uk,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-ide@vger.kernel.org,
thomas.abraham@linaro.org,
Vasanth Ananthan <vasanth.a@samsung.com>
Subject: Re: [PATCH 4/6] ARM: S3C2410: I2C driver polling mode support
Date: Sat, 13 Oct 2012 00:36:46 +0200 [thread overview]
Message-ID: <3154162.nPBioGgRed@flatron> (raw)
In-Reply-To: <1349783332-18467-5-git-send-email-vasanthananthan@gmail.com>
Hi,
On Tuesday 09 of October 2012 17:18:50 Vasanth Ananthan wrote:
> This patch adds polling mode support for i2c s3c-2410 driver.
> The I2C_SATAPHY controller lacks an interrupt line but the s3c-2410
> driver is interrupt driven. Hence this support is required for
> functioning of the I2C_SATAPHY controller.
>
> Signed-off-by: Vasanth Ananthan <vasanth.a@samsung.com>
> ---
> drivers/i2c/busses/i2c-s3c2410.c | 84
> +++++++++++++++++++++++++++++--------- 1 files changed, 65
> insertions(+), 19 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c
> b/drivers/i2c/busses/i2c-s3c2410.c index 5ae3b02..699b530 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -48,6 +48,7 @@
> #define QUIRK_S3C2440 (1 << 0)
> #define QUIRK_HDMIPHY (1 << 1)
> #define QUIRK_NO_GPIO (1 << 2)
> +#define QUIRK_SATAPHY (1 << 3)
>
> /* i2c controller state */
> enum s3c24xx_i2c_state {
> @@ -102,10 +103,14 @@ static struct platform_device_id
> s3c24xx_driver_ids[] = { };
> MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
>
> +static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long
> iicstat); +
> #ifdef CONFIG_OF
> static const struct of_device_id s3c24xx_i2c_match[] = {
> { .compatible = "samsung,s3c2410-i2c", .data = (void *)0 },
> { .compatible = "samsung,s3c2440-i2c", .data = (void *)QUIRK_S3C2440
> }, + { .compatible = "samsung,s3c2440-sataphy-i2c",
> + .data = (void *)(QUIRK_S3C2440|QUIRK_SATAPHY|QUIRK_NO_GPIO) },
nitpick: Please insert spaces around bitwise OR operators.
> { .compatible = "samsung,s3c2440-hdmiphy-i2c",
> .data = (void *)(QUIRK_S3C2440 | QUIRK_HDMIPHY | QUIRK_NO_GPIO) },
> {},
> @@ -146,7 +151,8 @@ static inline void
> s3c24xx_i2c_master_complete(struct s3c24xx_i2c *i2c, int ret) if (ret)
> i2c->msg_idx = ret;
>
> - wake_up(&i2c->wait);
> + if (!(i2c->quirks & QUIRK_SATAPHY))
> + wake_up(&i2c->wait);
> }
>
> static inline void s3c24xx_i2c_disable_ack(struct s3c24xx_i2c *i2c)
> @@ -184,6 +190,21 @@ static inline void s3c24xx_i2c_enable_irq(struct
> s3c24xx_i2c *i2c) }
>
>
> +static bool is_ack(struct s3c24xx_i2c *i2c)
> +{
> + u32 time_out = i2c->tx_setup;
nitpick: Separate local variable declaration from code with a blank line.
> + while (--time_out) {
> + if (readl(i2c->regs + S3C2410_IICCON)
> + & S3C2410_IICCON_IRQPEND) {
> + if (!(readl(i2c->regs + S3C2410_IICSTAT)
> + & S3C2410_IICSTAT_LASTBIT))
> + return true;
> + }
> + udelay(time_out);
> + }
nitpick: Here a blank line would be fine.
> + return false;
> +}
> +
> /* s3c24xx_i2c_message_start
> *
> * put the start of a message onto the bus
> @@ -227,6 +248,21 @@ static void s3c24xx_i2c_message_start(struct
> s3c24xx_i2c *i2c,
>
> stat |= S3C2410_IICSTAT_START;
> writel(stat, i2c->regs + S3C2410_IICSTAT);
> +
> + if (i2c->quirks & QUIRK_SATAPHY) {
> +
nitpick: Unnecessary blank line.
> + while ((i2c->msg_num != 0) && is_ack(i2c)) {
> +
Same here.
> + i2c_s3c_irq_nextbyte(i2c, stat);
> +
> + stat = readl(i2c->regs + S3C2410_IICSTAT);
> + if (stat & S3C2410_IICSTAT_ARBITR)
> + dev_err(i2c->dev, "deal with arbitration loss\n");
> +
Same here.
> + }
> +
Same here.
> + }
> +
Same here.
> }
>
Best regards,
Tomasz Figa
WARNING: multiple messages have this Message-ID (diff)
From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] ARM: S3C2410: I2C driver polling mode support
Date: Sat, 13 Oct 2012 00:36:46 +0200 [thread overview]
Message-ID: <3154162.nPBioGgRed@flatron> (raw)
In-Reply-To: <1349783332-18467-5-git-send-email-vasanthananthan@gmail.com>
Hi,
On Tuesday 09 of October 2012 17:18:50 Vasanth Ananthan wrote:
> This patch adds polling mode support for i2c s3c-2410 driver.
> The I2C_SATAPHY controller lacks an interrupt line but the s3c-2410
> driver is interrupt driven. Hence this support is required for
> functioning of the I2C_SATAPHY controller.
>
> Signed-off-by: Vasanth Ananthan <vasanth.a@samsung.com>
> ---
> drivers/i2c/busses/i2c-s3c2410.c | 84
> +++++++++++++++++++++++++++++--------- 1 files changed, 65
> insertions(+), 19 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c
> b/drivers/i2c/busses/i2c-s3c2410.c index 5ae3b02..699b530 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -48,6 +48,7 @@
> #define QUIRK_S3C2440 (1 << 0)
> #define QUIRK_HDMIPHY (1 << 1)
> #define QUIRK_NO_GPIO (1 << 2)
> +#define QUIRK_SATAPHY (1 << 3)
>
> /* i2c controller state */
> enum s3c24xx_i2c_state {
> @@ -102,10 +103,14 @@ static struct platform_device_id
> s3c24xx_driver_ids[] = { };
> MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
>
> +static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long
> iicstat); +
> #ifdef CONFIG_OF
> static const struct of_device_id s3c24xx_i2c_match[] = {
> { .compatible = "samsung,s3c2410-i2c", .data = (void *)0 },
> { .compatible = "samsung,s3c2440-i2c", .data = (void *)QUIRK_S3C2440
> }, + { .compatible = "samsung,s3c2440-sataphy-i2c",
> + .data = (void *)(QUIRK_S3C2440|QUIRK_SATAPHY|QUIRK_NO_GPIO) },
nitpick: Please insert spaces around bitwise OR operators.
> { .compatible = "samsung,s3c2440-hdmiphy-i2c",
> .data = (void *)(QUIRK_S3C2440 | QUIRK_HDMIPHY | QUIRK_NO_GPIO) },
> {},
> @@ -146,7 +151,8 @@ static inline void
> s3c24xx_i2c_master_complete(struct s3c24xx_i2c *i2c, int ret) if (ret)
> i2c->msg_idx = ret;
>
> - wake_up(&i2c->wait);
> + if (!(i2c->quirks & QUIRK_SATAPHY))
> + wake_up(&i2c->wait);
> }
>
> static inline void s3c24xx_i2c_disable_ack(struct s3c24xx_i2c *i2c)
> @@ -184,6 +190,21 @@ static inline void s3c24xx_i2c_enable_irq(struct
> s3c24xx_i2c *i2c) }
>
>
> +static bool is_ack(struct s3c24xx_i2c *i2c)
> +{
> + u32 time_out = i2c->tx_setup;
nitpick: Separate local variable declaration from code with a blank line.
> + while (--time_out) {
> + if (readl(i2c->regs + S3C2410_IICCON)
> + & S3C2410_IICCON_IRQPEND) {
> + if (!(readl(i2c->regs + S3C2410_IICSTAT)
> + & S3C2410_IICSTAT_LASTBIT))
> + return true;
> + }
> + udelay(time_out);
> + }
nitpick: Here a blank line would be fine.
> + return false;
> +}
> +
> /* s3c24xx_i2c_message_start
> *
> * put the start of a message onto the bus
> @@ -227,6 +248,21 @@ static void s3c24xx_i2c_message_start(struct
> s3c24xx_i2c *i2c,
>
> stat |= S3C2410_IICSTAT_START;
> writel(stat, i2c->regs + S3C2410_IICSTAT);
> +
> + if (i2c->quirks & QUIRK_SATAPHY) {
> +
nitpick: Unnecessary blank line.
> + while ((i2c->msg_num != 0) && is_ack(i2c)) {
> +
Same here.
> + i2c_s3c_irq_nextbyte(i2c, stat);
> +
> + stat = readl(i2c->regs + S3C2410_IICSTAT);
> + if (stat & S3C2410_IICSTAT_ARBITR)
> + dev_err(i2c->dev, "deal with arbitration loss\n");
> +
Same here.
> + }
> +
Same here.
> + }
> +
Same here.
> }
>
Best regards,
Tomasz Figa
next prev parent reply other threads:[~2012-10-12 22:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 11:48 [PATCH 0/6] Adding support for SATA in EXYNO5 Vasanth Ananthan
2012-10-09 11:48 ` Vasanth Ananthan
2012-10-09 11:48 ` [PATCH 1/6] ARM: EXYNOS5: Clock settings for SATA and SATA PHY Vasanth Ananthan
2012-10-09 11:48 ` Vasanth Ananthan
2012-10-09 11:48 ` [PATCH 2/6] ARM: EXYNOS5: DT Support " Vasanth Ananthan
2012-10-09 11:48 ` Vasanth Ananthan
2012-10-09 18:28 ` Olof Johansson
2012-10-09 18:28 ` Olof Johansson
2012-10-10 8:38 ` Vasanth Ananthan
2012-10-10 8:38 ` Vasanth Ananthan
2012-10-10 9:20 ` Vasanth Ananthan
2012-10-10 9:20 ` Vasanth Ananthan
2012-10-10 16:31 ` Olof Johansson
2012-10-10 16:31 ` Olof Johansson
2012-10-11 6:49 ` Vasanth Ananthan
2012-10-11 6:49 ` Vasanth Ananthan
2012-10-09 11:48 ` [PATCH 3/6] DRIVERS: ATA: SATA PHY utility framework Vasanth Ananthan
2012-10-09 11:48 ` Vasanth Ananthan
2012-10-12 22:30 ` Tomasz Figa
2012-10-12 22:30 ` Tomasz Figa
2012-10-15 9:46 ` Vasanth Ananthan
2012-10-15 9:46 ` Vasanth Ananthan
2012-10-09 11:48 ` [PATCH 4/6] ARM: S3C2410: I2C driver polling mode support Vasanth Ananthan
2012-10-09 11:48 ` Vasanth Ananthan
2012-10-12 22:36 ` Tomasz Figa [this message]
2012-10-12 22:36 ` Tomasz Figa
2012-10-15 8:33 ` Heiko Stübner
2012-10-15 8:33 ` Heiko Stübner
2012-10-09 11:48 ` [PATCH 5/6] ARM: EYNOS5: SATA controller driver Vasanth Ananthan
2012-10-09 11:48 ` Vasanth Ananthan
2012-10-12 22:45 ` Tomasz Figa
2012-10-12 22:45 ` Tomasz Figa
2012-10-09 11:48 ` [PATCH 6/6] ARM: EXYNOS5: SATA PHY " Vasanth Ananthan
2012-10-09 11:48 ` Vasanth Ananthan
2012-10-12 22:50 ` Tomasz Figa
2012-10-12 22:50 ` Tomasz Figa
2012-10-16 6:33 ` Vasanth Ananthan
2012-10-16 6:33 ` Vasanth Ananthan
2012-10-16 10:02 ` Tomasz Figa
2012-10-16 10:02 ` Tomasz Figa
2012-10-17 15:42 ` Tomasz Figa
2012-10-17 15:42 ` Tomasz Figa
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=3154162.nPBioGgRed@flatron \
--to=tomasz.figa@gmail.com \
--cc=jgarzik@pobox.com \
--cc=kgene.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=thomas.abraham@linaro.org \
--cc=vasanth.a@samsung.com \
--cc=vasanthananthan@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.