--- zzzz-none-000/linux-3.10.107/drivers/i2c/busses/i2c-designware-core.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/drivers/i2c/busses/i2c-designware-core.c 2021-11-10 11:53:55.000000000 +0000 @@ -25,6 +25,14 @@ * ---------------------------------------------------------------------------- * */ + + +/** + * Some part of this file is modified by Ikanos Communications. + * + * Copyright (C) 2013-2014 Ikanos Communications. + */ + #include #include #include @@ -140,6 +148,12 @@ DW_IC_TX_ABRT_TXDATA_NOACK | \ DW_IC_TX_ABRT_GCALL_NOACK) +#ifdef CONFIG_FUSIV_VX585 +/*IKANOS: adding I2C for vx585*/ +#define VX585_I2C_BASE_ADDR 0xB9070000 +#define FUSIV_I2C_DEBUG 0 +#endif + static char *abort_sources[] = { [ABRT_7B_ADDR_NOACK] = "slave address not acknowledged (7bit mode)", @@ -168,7 +182,9 @@ u32 dw_readl(struct dw_i2c_dev *dev, int offset) { u32 value; - +#ifdef CONFIG_FUSIV_VX585 + value = *(volatile u32 *)(VX585_I2C_BASE_ADDR + offset); +#else if (dev->accessor_flags & ACCESS_16BIT) value = readw(dev->base + offset) | (readw(dev->base + offset + 2) << 16); @@ -178,11 +194,15 @@ if (dev->accessor_flags & ACCESS_SWAP) return swab32(value); else +#endif return value; } void dw_writel(struct dw_i2c_dev *dev, u32 b, int offset) { +#ifdef CONFIG_FUSIV_VX585 + *(volatile u32 *)(VX585_I2C_BASE_ADDR + offset) = b; +#else if (dev->accessor_flags & ACCESS_SWAP) b = swab32(b); @@ -192,6 +212,8 @@ } else { writel(b, dev->base + offset); } + +#endif } static u32 @@ -284,7 +306,11 @@ u32 hcnt, lcnt; u32 reg; +#ifdef CONFIG_FUSIV_VX585 + input_clock_khz = 300 * 1000; +#else input_clock_khz = dev->get_clk_rate_khz(dev); +#endif reg = dw_readl(dev, DW_IC_COMP_TYPE); if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) {