From: b-cousson@ti.com (Cousson, Benoit)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] OMAP3 and 4 I2C use cpu type consistently for new register availability
Date: Thu, 3 Mar 2011 22:45:25 +0100 [thread overview]
Message-ID: <4D700BF5.8090308@ti.com> (raw)
In-Reply-To: <20110303135044.30648.27273.stgit@otae.warmcat.com>
On 3/3/2011 2:50 PM, Andy Green wrote:
> The driver makes the choice about which register layout to
> use based on cpu, however it then tries to use the probed
> peripheral unit version register to decide whether to access
> registers that only exist in the 4430 unit.
>
> Unfortunately, the unit with the smaller register map on the
> OMAP3530 has the same peripheral unit version number, leading
> the OMAP3530 to dereference the register map beyond the bounds
> of its array, and then to access a 'random' register offset taken
> from whatever happens to be sitting beyond the register map
> array, as reported here
>
> https://bugs.launchpad.net/linux-linaro/+bug/645324
>
> This patch makes both the choice of register map and the decision
> to use a register only present in the larger map both do so based
> on cpu type, which correctly reflects register availability.
>
> Cc: patches at linaro.org
> Reported-by: Peter Maydell<peter.maydell@linaro.org>
> Signed-off-by: Andy Green<andy.green@linaro.org>
> ---
>
> drivers/i2c/busses/i2c-omap.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index e09c62d..c82e1bb5 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -309,7 +309,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
> pdata = pdev->dev.platform_data;
>
> dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
> - if (dev->rev>= OMAP_I2C_REV_ON_4430)
> + if (cpu_is_omap44xx())
As explained before, you should not add any cpu_is_XXX in the driver.
That rev field is the way to go, except that it should be populated
using hwmod data information instead of inaccurate I2C register revision
field.
Regards,
Benoit
next prev parent reply other threads:[~2011-03-03 21:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 13:50 [PATCH 0/4] OMAP 3 and 4 i2c fixes Andy Green
2011-03-03 13:50 ` [PATCH 1/4] OMAP3 and 4 hwmod I2C units only allow 16 bit access Andy Green
2011-03-03 17:42 ` Cousson, Benoit
2011-03-03 17:56 ` Andy Green
2011-03-03 20:40 ` Cousson, Benoit
2011-03-04 8:33 ` Andy Green
2011-03-04 10:05 ` Cousson, Benoit
2011-03-04 15:20 ` Cousson, Benoit
2011-03-03 13:50 ` [PATCH 2/4] OMAP3 I2C document why cpu type and not peripheral unit ID used to probe Andy Green
2011-03-03 21:12 ` Cousson, Benoit
2011-03-04 8:25 ` Andy Green
2011-03-03 13:50 ` [PATCH 3/4] OMAP3 and 4 i2c mark extended reg enums as extended only Andy Green
2011-03-03 21:33 ` Cousson, Benoit
2011-03-04 8:32 ` Andy Green
2011-03-04 10:05 ` Cousson, Benoit
2011-03-03 13:50 ` [PATCH 4/4] OMAP3 and 4 I2C use cpu type consistently for new register availability Andy Green
2011-03-03 21:45 ` Cousson, Benoit [this message]
2011-03-03 21:55 ` [PATCH 0/4] OMAP 3 and 4 i2c fixes Cousson, Benoit
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=4D700BF5.8090308@ti.com \
--to=b-cousson@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).