Commit 6825fbc4 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'next-i2c' of git://git.fluff.org/bjdooks/linux

* 'next-i2c' of git://git.fluff.org/bjdooks/linux: (25 commits)
  i2c-pnx: Map I2C adapter number to platform ID number
  i2c-omap: OMAP3: PM: (re)init for every transfer to support off-mode
  i2c-designware: i2c_dw_handle_tx_abort: Use dev_dbg() for NOACK cases
  i2c-designware: Cosmetic cleanups
  i2c-designware: Tx abort cleanups
  i2c-designware: Skip RX_FULL and TX_EMPTY bits on tx abort errors
  i2c-designware: i2c_dw_xfer_msg: Fix error handling procedures
  i2c-designware: Disable TX_EMPTY when all i2c_msg msgs has been processed
  i2c-designware: Process all i2c_msg messages in the interrupt handler
  i2c-designware: i2c_dw_read: Remove redundant target address checker
  i2c-designware: i2c_dw_func: Set I2C_FUNC_SMBUS_foo bits
  i2c-designware: Initialize byte count variables just prior to being used
  i2c-designware: i2c_dw_xfer_msg: Introduce a local "buf" pointer
  i2c-designware: Divide i2c_dw_xfer_msg into two functions
  i2c-designware: Enable RX_FULL interrupt
  i2c-designware: Set Tx/Rx FIFO threshold levels
  i2c-designware: Process i2c_msg messages in the interrupt handler
  i2c-designware: i2c_dw_xfer_msg: Fix i2c_msg search bug
  i2c-designware: Improved _HCNT/_LCNT calculation
  i2c-designware: Remove an useless local variable "num"
  ...
parents 6bb951a0 155a4931
This diff is collapsed.
...@@ -178,6 +178,12 @@ struct omap_i2c_dev { ...@@ -178,6 +178,12 @@ struct omap_i2c_dev {
unsigned b_hw:1; /* bad h/w fixes */ unsigned b_hw:1; /* bad h/w fixes */
unsigned idle:1; unsigned idle:1;
u16 iestate; /* Saved interrupt register */ u16 iestate; /* Saved interrupt register */
u16 pscstate;
u16 scllstate;
u16 sclhstate;
u16 bufstate;
u16 syscstate;
u16 westate;
}; };
static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
...@@ -230,8 +236,17 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev) ...@@ -230,8 +236,17 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
clk_enable(dev->iclk); clk_enable(dev->iclk);
clk_enable(dev->fclk); clk_enable(dev->fclk);
if (cpu_is_omap34xx()) {
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev->sclhstate);
omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev->bufstate);
omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, dev->syscstate);
omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
}
dev->idle = 0; dev->idle = 0;
if (dev->iestate)
omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate); omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
} }
...@@ -258,7 +273,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev) ...@@ -258,7 +273,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
static int omap_i2c_init(struct omap_i2c_dev *dev) static int omap_i2c_init(struct omap_i2c_dev *dev)
{ {
u16 psc = 0, scll = 0, sclh = 0; u16 psc = 0, scll = 0, sclh = 0, buf = 0;
u16 fsscll = 0, fssclh = 0, hsscll = 0, hssclh = 0; u16 fsscll = 0, fssclh = 0, hsscll = 0, hssclh = 0;
unsigned long fclk_rate = 12000000; unsigned long fclk_rate = 12000000;
unsigned long timeout; unsigned long timeout;
...@@ -287,24 +302,22 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) ...@@ -287,24 +302,22 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
SYSC_AUTOIDLE_MASK); SYSC_AUTOIDLE_MASK);
} else if (dev->rev >= OMAP_I2C_REV_ON_3430) { } else if (dev->rev >= OMAP_I2C_REV_ON_3430) {
u32 v; dev->syscstate = SYSC_AUTOIDLE_MASK;
dev->syscstate |= SYSC_ENAWAKEUP_MASK;
v = SYSC_AUTOIDLE_MASK; dev->syscstate |= (SYSC_IDLEMODE_SMART <<
v |= SYSC_ENAWAKEUP_MASK;
v |= (SYSC_IDLEMODE_SMART <<
__ffs(SYSC_SIDLEMODE_MASK)); __ffs(SYSC_SIDLEMODE_MASK));
v |= (SYSC_CLOCKACTIVITY_FCLK << dev->syscstate |= (SYSC_CLOCKACTIVITY_FCLK <<
__ffs(SYSC_CLOCKACTIVITY_MASK)); __ffs(SYSC_CLOCKACTIVITY_MASK));
omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, v); omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
dev->syscstate);
/* /*
* Enabling all wakup sources to stop I2C freezing on * Enabling all wakup sources to stop I2C freezing on
* WFI instruction. * WFI instruction.
* REVISIT: Some wkup sources might not be needed. * REVISIT: Some wkup sources might not be needed.
*/ */
omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate = OMAP_I2C_WE_ALL;
OMAP_I2C_WE_ALL); omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
} }
} }
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
...@@ -394,23 +407,28 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) ...@@ -394,23 +407,28 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, scll); omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, scll);
omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, sclh); omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, sclh);
if (dev->fifo_size) if (dev->fifo_size) {
/* Note: setup required fifo size - 1 */ /* Note: setup required fifo size - 1. RTRSH and XTRSH */
omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, buf = (dev->fifo_size - 1) << 8 | OMAP_I2C_BUF_RXFIF_CLR |
(dev->fifo_size - 1) << 8 | /* RTRSH */ (dev->fifo_size - 1) | OMAP_I2C_BUF_TXFIF_CLR;
OMAP_I2C_BUF_RXFIF_CLR | omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, buf);
(dev->fifo_size - 1) | /* XTRSH */ }
OMAP_I2C_BUF_TXFIF_CLR);
/* Take the I2C module out of reset: */ /* Take the I2C module out of reset: */
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN); omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
/* Enable interrupts */ /* Enable interrupts */
omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate = (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY |
(OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY |
OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK | OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK |
OMAP_I2C_IE_AL) | ((dev->fifo_size) ? OMAP_I2C_IE_AL) | ((dev->fifo_size) ?
(OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0)); (OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
if (cpu_is_omap34xx()) {
dev->pscstate = psc;
dev->scllstate = scll;
dev->sclhstate = sclh;
dev->bufstate = buf;
}
return 0; return 0;
} }
......
...@@ -638,7 +638,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev) ...@@ -638,7 +638,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
/* Register this adapter with the I2C subsystem */ /* Register this adapter with the I2C subsystem */
i2c_pnx->adapter->dev.parent = &pdev->dev; i2c_pnx->adapter->dev.parent = &pdev->dev;
ret = i2c_add_adapter(i2c_pnx->adapter); i2c_pnx->adapter->nr = pdev->id;
ret = i2c_add_numbered_adapter(i2c_pnx->adapter);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "I2C: Failed to add bus\n"); dev_err(&pdev->dev, "I2C: Failed to add bus\n");
goto out_irq; goto out_irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment