Skip to content

Commit

Permalink
I2C: OMAP2+: address confused probed version naming
Browse files Browse the repository at this point in the history
The driver reflects the confusion that probed I2C revision
from the hardware of 0x40 means it is on an OMAP4430.

However, you will probe the same 0x40 ID on an OMAP3530.  So
this patch changes the name to reflect that.

It also clarifies that the original name OMAP_I2C_REV_2 is
referring to some ancient OMAP1 revision number, not to be
confused with the IP revisions this patch series introduces.

Similarly the term "rev" is used in the ancient OMAP1 ISR,
the term is changed to use omap1 instead.

Cc: patches@linaro.org
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kevin Hilman <khilman@ti.com>
  • Loading branch information
Andy Green authored and Ben Dooks committed Oct 29, 2011
1 parent 6314f09 commit 4e80f72
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions drivers/i2c/busses/i2c-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
#include <linux/pm_runtime.h>

/* I2C controller revisions */
#define OMAP_I2C_REV_2 0x20
#define OMAP_I2C_OMAP1_REV_2 0x20

/* I2C controller revisions present on specific hardware */
#define OMAP_I2C_REV_ON_2430 0x36
#define OMAP_I2C_REV_ON_3430 0x3C
#define OMAP_I2C_REV_ON_4430 0x40
#define OMAP_I2C_REV_ON_3530_4430 0x40

/* timeout waiting for the controller to respond */
#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000))
Expand Down Expand Up @@ -314,7 +314,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
else
omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);

if (dev->rev < OMAP_I2C_REV_2) {
if (dev->rev < OMAP_I2C_OMAP1_REV_2) {
iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
} else {
omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
Expand All @@ -336,7 +336,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
unsigned long internal_clk = 0;
struct clk *fclk;

if (dev->rev >= OMAP_I2C_REV_2) {
if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
/* Disable I2C controller before soft reset */
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) &
Expand Down Expand Up @@ -379,7 +379,9 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
* REVISIT: Some wkup sources might not be needed.
*/
dev->westate = OMAP_I2C_WE_ALL;
omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
if (dev->rev < OMAP_I2C_REV_ON_3530_4430)
omap_i2c_write_reg(dev, OMAP_I2C_WE_REG,
dev->westate);
}
}
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
Expand Down Expand Up @@ -721,7 +723,7 @@ static inline void i2c_omap_errata_i207(struct omap_i2c_dev *dev, u16 stat)
#ifdef CONFIG_ARCH_OMAP15XX

static irqreturn_t
omap_i2c_rev1_isr(int this_irq, void *dev_id)
omap_i2c_omap1_isr(int this_irq, void *dev_id)
{
struct omap_i2c_dev *dev = dev_id;
u16 iv, w;
Expand Down Expand Up @@ -775,7 +777,7 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
return IRQ_HANDLED;
}
#else
#define omap_i2c_rev1_isr NULL
#define omap_i2c_omap1_isr NULL
#endif

/*
Expand Down Expand Up @@ -1060,7 +1062,7 @@ omap_i2c_probe(struct platform_device *pdev)
* size. This is to ensure that we can handle the status on int
* call back latencies.
*/
if (dev->rev >= OMAP_I2C_REV_ON_4430) {
if (dev->rev >= OMAP_I2C_REV_ON_3530_4430) {
dev->fifo_size = 0;
dev->b_hw = 0; /* Disable hardware fixes */
} else {
Expand All @@ -1076,7 +1078,8 @@ omap_i2c_probe(struct platform_device *pdev)
/* reset ASAP, clearing any IRQs */
omap_i2c_init(dev);

isr = (dev->rev < OMAP_I2C_REV_2) ? omap_i2c_rev1_isr : omap_i2c_isr;
isr = (dev->rev < OMAP_I2C_OMAP1_REV_2) ? omap_i2c_omap1_isr :
omap_i2c_isr;
r = request_irq(dev->irq, isr, 0, pdev->name, dev);

if (r) {
Expand Down

0 comments on commit 4e80f72

Please sign in to comment.