Lines Matching refs:prescale
406 int prescale; in ocores_init() local
414 prescale = (bus->ip_clk_khz / (5 * bus->bus_clk_khz)) - 1; in ocores_init()
415 prescale = clamp(prescale, 0, 0xffff); in ocores_init()
417 diff = bus->ip_clk_khz / (5 * (prescale + 1)) - bus->bus_clk_khz; in ocores_init()
424 oc_setreg(bus, OCI2C_PRELOW, prescale & 0xff); in ocores_init()
425 oc_setreg(bus, OCI2C_PREHIGH, prescale >> 8); in ocores_init()
474 int prescale; in ocores_i2c_set_bus_speed() local
481 prescale = (bus->ip_clk_khz / (5 * speed)) - 1; in ocores_i2c_set_bus_speed()
482 prescale = clamp(prescale, 0, 0xffff); in ocores_i2c_set_bus_speed()
484 diff = bus->ip_clk_khz / (5 * (prescale + 1)) - speed; in ocores_i2c_set_bus_speed()
491 oc_setreg(bus, OCI2C_PRELOW, prescale & 0xff); in ocores_i2c_set_bus_speed()
492 oc_setreg(bus, OCI2C_PREHIGH, prescale >> 8); in ocores_i2c_set_bus_speed()