fsl_i2c: Add CONFIG_FSL_I2C_CUSTOM_{DFSR/FDR}
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Thu, 17 Sep 2009 09:07:16 +0000 (11:07 +0200)
committerHeiko Schocher <hs@denx.de>
Mon, 28 Sep 2009 05:35:53 +0000 (07:35 +0200)
Some boards need a higher DFSR value than the spec currently
recommends so give these boards the means to define there own.

For completeness, add CONFIG_FSL_I2C_CUSTOM_FDR too.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
drivers/i2c/fsl_i2c.c

index 56f9680063a2dffe6e25b1e026c5131549176529..0c5f6be23f715c3a884fa198286cdc8870516e99 100644 (file)
@@ -172,14 +172,22 @@ static unsigned int set_i2c_bus_speed(const struct fsl_i2c *dev,
                        u8 fdr;
 #ifdef __PPC__
                        u8 dfsr;
+#ifdef CONFIG_FSL_I2C_CUSTOM_DFSR
+                       dfsr = CONFIG_FSL_I2C_CUSTOM_DFSR;
+#else
                        dfsr = fsl_i2c_speed_map[i].dfsr;
 #endif
+                       writeb(dfsr, &dev->dfsrr);      /* set default filter */
+#endif
+#ifdef CONFIG_FSL_I2C_CUSTOM_FDR
+                       fdr = CONFIG_FSL_I2C_CUSTOM_FDR;
+                       speed = i2c_clk / divider; /* Fake something */
+#else
                        fdr = fsl_i2c_speed_map[i].fdr;
                        speed = i2c_clk / fsl_i2c_speed_map[i].divider;
-                       writeb(fdr, &dev->fdr);         /* set bus speed */
-#ifdef __PPC__
-                       writeb(dfsr, &dev->dfsrr);      /* set default filter */
 #endif
+                       writeb(fdr, &dev->fdr);         /* set bus speed */
+
                        break;
                }