On 02/03/2011 11:19 AM, dirk.brandewie@xxxxxxxxx wrote: > @@ -283,13 +305,27 @@ static u32 i2c_dw_scl_lcnt(u32 ic_clk, u32 tLOW, u32 tf, int offset) > * This function is called during I2C init function, and in case of timeout at > * run time. > */ > -static void i2c_dw_init(struct dw_i2c_dev *dev) > +static int i2c_dw_init(struct dw_i2c_dev *dev) > { > u32 input_clock_khz = clk_get_rate(dev->clk) / 1000; > u32 ic_con, hcnt, lcnt; > + u32 reg; > + > + /* Configure register endianess access */ > + reg = dw_readl(dev, DW_IC_COMP_TYPE); > + if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) { > + dev->swab = 1; > + reg = ___constant_swab32(DW_IC_COMP_TYPE_VALUE); > + } > + > + if (reg != DW_IC_COMP_TYPE_VALUE) { > + dev_err(dev->dev, "Unknown Synopsys component type: " > + "0x%08x\n", reg); > + return -ENODEV; > + } In the original Jean's patch, this 'swab' detection was done early in dw_i2c_probe() funtion, but this patch moved it to i2c_dw_init(), and therefore the function prototype of i2c_dw_init() also changed. I agree with that change itself, so let's make it a separate patch. - it would be nice that such hardware probing/initialization routines are consolidated in one place, - swab detection using the IC_COMP_TYPE register must be performed prior to any other register accesses, - i2c_dw_init() function prototype is also changed to notify dw_i2c_probe() of "Unknown Synopsys component type" error. Shinya -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html