@@ -23,6 +23,7 @@
#include <linux/of_i2c.h>
#include <linux/clk.h>
#include <linux/err.h>
+#include <linux/delay.h>
/* Register defines */
#define MV64XXX_I2C_REG_SLAVE_ADDR 0x00
@@ -103,6 +104,10 @@ struct mv64xxx_i2c_data {
int rc;
u32 freq_m;
u32 freq_n;
+
+/* 5us delay in order to avoid repeated start timing violation */
+ bool mv64xxx_i2c_errata_delay;
+
#if defined(CONFIG_HAVE_CLK)
struct clk *clk;
#endif
@@ -252,6 +257,9 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
writel(drv_data->cntl_bits,
drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
drv_data->block = 0;
+ if (drv_data->mv64xxx_i2c_errata_delay)
+ udelay(5);
+
wake_up(&drv_data->waitq);
break;
@@ -300,6 +308,9 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP,
drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
drv_data->block = 0;
+ if (drv_data->mv64xxx_i2c_errata_delay)
+ udelay(5);
+
wake_up(&drv_data->waitq);
break;
@@ -592,6 +603,9 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
* So hard code the value to 1 second.
*/
drv_data->adapter.timeout = HZ;
+
+ if (of_machine_is_compatible("marvell,armadaxp"))
+ drv_data->mv64xxx_i2c_errata_delay = 1;
out:
return rc;
#endif