• Wolfgang Grandegger's avatar
    i2c: i2c-mpc: make I2C bus speed configurable · f2bd5efe
    Wolfgang Grandegger authored
    This patch makes the I2C bus speed configurable by using the I2C node
    property "clock-frequency". If the property is not defined, the old
    fixed clock settings will be used for backward comptibility.
    
    The generic I2C clock properties, especially the CPU-specific source
    clock pre-scaler are defined via the OF match table:
    
      static const struct of_device_id mpc_i2c_of_match[] = {
    	...
    	{.compatible = "fsl,mpc8543-i2c",
    	 .data = &(struct fsl_i2c_match_data) {
    			.setclock = mpc_i2c_setclock_8xxx,
    			.prescaler = 2,
    		},
    	},
    
    The "data" field defines the relevant I2C setclock function and the
    relevant pre-scaler for the I2C source clock frequency.
    
    It uses arch-specific tables and functions to determine resonable
    Freqency Divider Register (fdr) values for MPC83xx, MPC85xx, MPC86xx,
    MPC5200 and MPC5200B.
    
    The i2c->flags field and the corresponding FSL_I2C_DEV_* definitions
    have been removed as they are obsolete.
    Signed-off-by: default avatarWolfgang Grandegger <wg@grandegger.com>
    Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
    f2bd5efe
i2c-mpc.c 16.1 KB