Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173853
b: refs/heads/master
c: 0774539
h: refs/heads/master
i:
  173851: 540c72a
v: v3
  • Loading branch information
Shinya Kuribayashi authored and Ben Dooks committed Dec 9, 2009
1 parent b9a4c3d commit 89f5a20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c70c5cd37413c3fa3503212d26ffdf6df535c9de
refs/heads/master: 0774539948b23984f1c866135ba307fa2c441d0e
39 changes: 14 additions & 25 deletions trunk/drivers/i2c/busses/i2c-designware.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ static char *abort_sources[] = {
* @dev: driver model device node
* @base: IO registers pointer
* @cmd_complete: tx completion indicator
* @pump_msg: continue in progress transfers
* @lock: protect this struct and IO registers
* @clk: input reference clock
* @cmd_err: run time hadware error code
Expand All @@ -175,7 +174,6 @@ struct dw_i2c_dev {
struct device *dev;
void __iomem *base;
struct completion cmd_complete;
struct tasklet_struct pump_msg;
struct mutex lock;
struct clk *clk;
int cmd_err;
Expand Down Expand Up @@ -325,7 +323,7 @@ static int i2c_dw_wait_bus_not_busy(struct dw_i2c_dev *dev)
/*
* Initiate low level master read/write transaction.
* This function is called from i2c_dw_xfer when starting a transfer.
* This function is also called from dw_i2c_pump_msg to continue a transfer
* This function is also called from i2c_dw_isr to continue a transfer
* that is longer than the size of the TX FIFO.
*/
static void
Expand Down Expand Up @@ -489,10 +487,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)

/* no error */
if (likely(!dev->cmd_err)) {
/* read rx fifo, and disable the adapter */
do {
i2c_dw_read(dev);
} while (dev->status & STATUS_READ_IN_PROGRESS);
/* Disable the adapter */
writel(0, dev->base + DW_IC_ENABLE);
ret = num;
goto done;
Expand Down Expand Up @@ -520,20 +515,6 @@ static u32 i2c_dw_func(struct i2c_adapter *adap)
return I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR;
}

static void dw_i2c_pump_msg(unsigned long data)
{
struct dw_i2c_dev *dev = (struct dw_i2c_dev *) data;
u32 intr_mask;

i2c_dw_read(dev);
i2c_dw_xfer_msg(dev);

intr_mask = DW_IC_INTR_STOP_DET | DW_IC_INTR_TX_ABRT;
if (dev->status & STATUS_WRITE_IN_PROGRESS)
intr_mask |= DW_IC_INTR_TX_EMPTY;
writel(intr_mask, dev->base + DW_IC_INTR_MASK);
}

static u32 i2c_dw_read_clear_intrbits(struct dw_i2c_dev *dev)
{
u32 stat;
Expand Down Expand Up @@ -604,10 +585,19 @@ static irqreturn_t i2c_dw_isr(int this_irq, void *dev_id)
if (stat & DW_IC_INTR_TX_ABRT) {
dev->cmd_err |= DW_IC_ERR_TX_ABRT;
dev->status = STATUS_IDLE;
} else if (stat & DW_IC_INTR_TX_EMPTY)
tasklet_schedule(&dev->pump_msg);
}

if (stat & DW_IC_INTR_TX_EMPTY) {
i2c_dw_read(dev);
i2c_dw_xfer_msg(dev);
}

/*
* No need to modify or disable the interrupt mask here.
* i2c_dw_xfer_msg() will take care of it according to
* the current transmit status.
*/

writel(0, dev->base + DW_IC_INTR_MASK); /* disable interrupts */
if (stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET))
complete(&dev->cmd_complete);

Expand Down Expand Up @@ -653,7 +643,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
}

init_completion(&dev->cmd_complete);
tasklet_init(&dev->pump_msg, dw_i2c_pump_msg, (unsigned long) dev);
mutex_init(&dev->lock);
dev->dev = get_device(&pdev->dev);
dev->irq = irq;
Expand Down

0 comments on commit 89f5a20

Please sign in to comment.