/* i2c_set_bus_speed - set i2c bus speed @speed: bus speed (in HZ)  */
int i2c_set_bus_speed(unsigned int speed)
/* i2c_set_bus_speed - set i2c bus speed @speed: bus speed (in HZ)  */
int i2c_set_bus_speed(unsigned int speed)
{
	u16 clkdiv = I2C_SPEED_TO_DUTY(speed);
	if (clkdiv < I2C_DUTY_MAX || clkdiv > I2C_DUTY_MIN)
		return -1;
	bfin_write_TWI_CLKDIV((clkdiv << 8) | (clkdiv & 0xff));
	bfin_write_TWI_MASTER_CTL(speed > 100000 ? FAST : 0);
	return 0;
}