Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 272447
b: refs/heads/master
c: 18c4089
h: refs/heads/master
i:
  272445: b80ebff
  272443: 9650e7e
  272439: 0c62694
  272431: b9c7876
  272415: 4be6788
  272383: b59ddc0
v: v3
  • Loading branch information
Jean-Hugues Deschenes authored and Ben Dooks committed Oct 29, 2011
1 parent 52c22e2 commit dba8da0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 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: 4ff895bc8b90e30ff8e89ca7bc6666b229c77e5d
refs/heads/master: 18c4089e6cd6b3052895481628f478ba8351ac00
17 changes: 15 additions & 2 deletions trunk/drivers/i2c/busses/i2c-designware.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/swab.h>

/*
* Registers offset
Expand Down Expand Up @@ -193,6 +194,7 @@ static char *abort_sources[] = {
* @status: i2c master status, one of STATUS_*
* @abort_source: copy of the TX_ABRT_SOURCE register
* @irq: interrupt number for the i2c master
* @swab: true if the instantiated IP is of different endianess
* @adapter: i2c subsystem adapter node
* @tx_fifo_depth: depth of the hardware tx fifo
* @rx_fifo_depth: depth of the hardware rx fifo
Expand All @@ -216,18 +218,27 @@ struct dw_i2c_dev {
unsigned int status;
u32 abort_source;
int irq;
int swab;
struct i2c_adapter adapter;
unsigned int tx_fifo_depth;
unsigned int rx_fifo_depth;
};

static u32 dw_readl(struct dw_i2c_dev *dev, int offset)
{
return readl(dev->base + offset);
u32 value = readl(dev->base + offset);

if (dev->swab)
return swab32(value);
else
return value;
}

static void dw_writel(struct dw_i2c_dev *dev, u32 b, int offset)
{
if (dev->swab)
b = swab32(b);

writel(b, dev->base + offset);
}

Expand Down Expand Up @@ -760,7 +771,9 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
}

reg = dw_readl(dev, DW_IC_COMP_TYPE);
if (reg != 0x44570140) {
if (reg == ___constant_swab32(0x44570140))
dev->swab = 1;
else if (reg != 0x44570140) {
dev_err(&pdev->dev, "Unknown Synopsys component type: "
"0x%08x\n", reg);
r = -ENODEV;
Expand Down

0 comments on commit dba8da0

Please sign in to comment.