i2c: designware: Rename accessor_flags to flags
Rename accessor_flags to flags, so that we can use the field for other flags too. This is a preparation patch for adding cherrytrail support to the punit semaphore code. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Tested-by: Takashi Iwai <tiwai@suse.de> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-4-hdegoede@redhat.com
This commit is contained in:
parent
528e649b5c
commit
86524e5402
|
@ -177,13 +177,13 @@ static u32 dw_readl(struct dw_i2c_dev *dev, int offset)
|
||||||
{
|
{
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
if (dev->accessor_flags & ACCESS_16BIT)
|
if (dev->flags & ACCESS_16BIT)
|
||||||
value = readw_relaxed(dev->base + offset) |
|
value = readw_relaxed(dev->base + offset) |
|
||||||
(readw_relaxed(dev->base + offset + 2) << 16);
|
(readw_relaxed(dev->base + offset + 2) << 16);
|
||||||
else
|
else
|
||||||
value = readl_relaxed(dev->base + offset);
|
value = readl_relaxed(dev->base + offset);
|
||||||
|
|
||||||
if (dev->accessor_flags & ACCESS_SWAP)
|
if (dev->flags & ACCESS_SWAP)
|
||||||
return swab32(value);
|
return swab32(value);
|
||||||
else
|
else
|
||||||
return value;
|
return value;
|
||||||
|
@ -191,10 +191,10 @@ static u32 dw_readl(struct dw_i2c_dev *dev, int offset)
|
||||||
|
|
||||||
static void dw_writel(struct dw_i2c_dev *dev, u32 b, int offset)
|
static void dw_writel(struct dw_i2c_dev *dev, u32 b, int offset)
|
||||||
{
|
{
|
||||||
if (dev->accessor_flags & ACCESS_SWAP)
|
if (dev->flags & ACCESS_SWAP)
|
||||||
b = swab32(b);
|
b = swab32(b);
|
||||||
|
|
||||||
if (dev->accessor_flags & ACCESS_16BIT) {
|
if (dev->flags & ACCESS_16BIT) {
|
||||||
writew_relaxed((u16)b, dev->base + offset);
|
writew_relaxed((u16)b, dev->base + offset);
|
||||||
writew_relaxed((u16)(b >> 16), dev->base + offset + 2);
|
writew_relaxed((u16)(b >> 16), dev->base + offset + 2);
|
||||||
} else {
|
} else {
|
||||||
|
@ -339,10 +339,10 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
|
||||||
reg = dw_readl(dev, DW_IC_COMP_TYPE);
|
reg = dw_readl(dev, DW_IC_COMP_TYPE);
|
||||||
if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) {
|
if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) {
|
||||||
/* Configure register endianess access */
|
/* Configure register endianess access */
|
||||||
dev->accessor_flags |= ACCESS_SWAP;
|
dev->flags |= ACCESS_SWAP;
|
||||||
} else if (reg == (DW_IC_COMP_TYPE_VALUE & 0x0000ffff)) {
|
} else if (reg == (DW_IC_COMP_TYPE_VALUE & 0x0000ffff)) {
|
||||||
/* Configure register access mode 16bit */
|
/* Configure register access mode 16bit */
|
||||||
dev->accessor_flags |= ACCESS_16BIT;
|
dev->flags |= ACCESS_16BIT;
|
||||||
} else if (reg != DW_IC_COMP_TYPE_VALUE) {
|
} else if (reg != DW_IC_COMP_TYPE_VALUE) {
|
||||||
dev_err(dev->dev, "Unknown Synopsys component type: "
|
dev_err(dev->dev, "Unknown Synopsys component type: "
|
||||||
"0x%08x\n", reg);
|
"0x%08x\n", reg);
|
||||||
|
@ -926,7 +926,7 @@ static irqreturn_t i2c_dw_isr(int this_irq, void *dev_id)
|
||||||
tx_aborted:
|
tx_aborted:
|
||||||
if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err)
|
if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err)
|
||||||
complete(&dev->cmd_complete);
|
complete(&dev->cmd_complete);
|
||||||
else if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) {
|
else if (unlikely(dev->flags & ACCESS_INTR_MASK)) {
|
||||||
/* workaround to trigger pending interrupt */
|
/* workaround to trigger pending interrupt */
|
||||||
stat = dw_readl(dev, DW_IC_INTR_MASK);
|
stat = dw_readl(dev, DW_IC_INTR_MASK);
|
||||||
i2c_dw_disable_int(dev);
|
i2c_dw_disable_int(dev);
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct dw_i2c_dev {
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
u32 abort_source;
|
u32 abort_source;
|
||||||
int irq;
|
int irq;
|
||||||
u32 accessor_flags;
|
u32 flags;
|
||||||
struct i2c_adapter adapter;
|
struct i2c_adapter adapter;
|
||||||
u32 functionality;
|
u32 functionality;
|
||||||
u32 master_cfg;
|
u32 master_cfg;
|
||||||
|
|
|
@ -112,7 +112,7 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
|
||||||
|
|
||||||
id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);
|
id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);
|
||||||
if (id && id->driver_data)
|
if (id && id->driver_data)
|
||||||
dev->accessor_flags |= (u32)id->driver_data;
|
dev->flags |= (u32)id->driver_data;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue