Lines Matching full:setup
138 * @sudat_min: Min data setup time (ns)
157 * struct stm32_i2c_setup - private I2C timing setup parameters
179 * @scldel: Data setup time
196 struct stm32_i2c_setup *setup; member
486 static int stm32_i2c_compute_solutions(struct stm32_i2c_setup *setup, in stm32_i2c_compute_solutions() argument
492 setup->clock_src); in stm32_i2c_compute_solutions()
498 af_delay_min = setup->analog_filter ? in stm32_i2c_compute_solutions()
500 af_delay_max = setup->analog_filter ? in stm32_i2c_compute_solutions()
503 sdadel_min = setup->fall_time - i2c_specs[setup->speed].hddat_min - in stm32_i2c_compute_solutions()
504 af_delay_min - (setup->dnf + 3) * i2cclk; in stm32_i2c_compute_solutions()
506 sdadel_max = i2c_specs[setup->speed].vddat_max - setup->rise_time - in stm32_i2c_compute_solutions()
507 af_delay_max - (setup->dnf + 4) * i2cclk; in stm32_i2c_compute_solutions()
509 scldel_min = setup->rise_time + i2c_specs[setup->speed].sudat_min; in stm32_i2c_compute_solutions()
556 static int stm32_i2c_choose_solution(struct stm32_i2c_setup *setup, in stm32_i2c_choose_solution() argument
562 setup->speed_freq); in stm32_i2c_choose_solution()
565 setup->clock_src); in stm32_i2c_choose_solution()
574 af_delay_min = setup->analog_filter ? in stm32_i2c_choose_solution()
576 dnf_delay = setup->dnf * i2cclk; in stm32_i2c_choose_solution()
579 clk_max = STM32_NSEC_PER_SEC / i2c_specs[setup->speed].rate_min; in stm32_i2c_choose_solution()
580 clk_min = STM32_NSEC_PER_SEC / i2c_specs[setup->speed].rate_max; in stm32_i2c_choose_solution()
597 if ((tscl_l < i2c_specs[setup->speed].l_min) || in stm32_i2c_choose_solution()
606 setup->rise_time + setup->fall_time; in stm32_i2c_choose_solution()
609 (tscl_h >= i2c_specs[setup->speed].h_min) && in stm32_i2c_choose_solution()
637 struct stm32_i2c_setup *setup, in stm32_i2c_compute_timing() argument
644 if (setup->speed >= STM32_I2C_SPEED_END) { in stm32_i2c_compute_timing()
646 setup->speed, STM32_I2C_SPEED_END - 1); in stm32_i2c_compute_timing()
650 if ((setup->rise_time > i2c_specs[setup->speed].rise_max) || in stm32_i2c_compute_timing()
651 (setup->fall_time > i2c_specs[setup->speed].fall_max)) { in stm32_i2c_compute_timing()
654 setup->rise_time, i2c_specs[setup->speed].rise_max, in stm32_i2c_compute_timing()
655 setup->fall_time, i2c_specs[setup->speed].fall_max); in stm32_i2c_compute_timing()
659 if (setup->dnf > STM32_I2C_DNF_MAX) { in stm32_i2c_compute_timing()
661 setup->dnf, STM32_I2C_DNF_MAX); in stm32_i2c_compute_timing()
665 if (setup->speed_freq > i2c_specs[setup->speed].rate) { in stm32_i2c_compute_timing()
667 setup->speed_freq, i2c_specs[setup->speed].rate); in stm32_i2c_compute_timing()
672 ret = stm32_i2c_compute_solutions(setup, &solutions); in stm32_i2c_compute_timing()
676 ret = stm32_i2c_choose_solution(setup, &solutions, output); in stm32_i2c_compute_timing()
698 struct stm32_i2c_setup *setup = i2c_priv->setup; in stm32_i2c_setup_timing() local
701 setup->speed = i2c_priv->speed; in stm32_i2c_setup_timing()
702 setup->speed_freq = i2c_specs[setup->speed].rate; in stm32_i2c_setup_timing()
703 setup->clock_src = clk_get_rate(&i2c_priv->clk); in stm32_i2c_setup_timing()
705 if (!setup->clock_src) { in stm32_i2c_setup_timing()
711 ret = stm32_i2c_compute_timing(i2c_priv, setup, timing); in stm32_i2c_setup_timing()
717 setup->speed = i2c_priv->speed; in stm32_i2c_setup_timing()
718 setup->speed_freq = in stm32_i2c_setup_timing()
719 i2c_specs[setup->speed].rate; in stm32_i2c_setup_timing()
721 __func__, i2c_specs[setup->speed].rate); in stm32_i2c_setup_timing()
734 setup->speed, setup->speed_freq, setup->clock_src); in stm32_i2c_setup_timing()
736 setup->rise_time, setup->fall_time); in stm32_i2c_setup_timing()
738 setup->analog_filter ? "On" : "Off", setup->dnf); in stm32_i2c_setup_timing()
766 if (i2c_priv->setup->analog_filter) in stm32_i2c_hw_config()
841 i2c_priv->setup = (struct stm32_i2c_setup *)dev_get_driver_data(dev); in stm32_ofdata_to_platdata()
842 if (!i2c_priv->setup) in stm32_ofdata_to_platdata()
847 i2c_priv->setup->rise_time = rise_time; in stm32_ofdata_to_platdata()
851 i2c_priv->setup->fall_time = fall_time; in stm32_ofdata_to_platdata()