Lines Matching +full:fast +full:- +full:clk

1 /*-
36 * Calls to DELAY() are needed per Application Note AN-179 "TWSI Software
61 #include <dev/clk/clk.h>
99 { "marvell,mv64xxx-i2c", true },
100 { "marvell,mv78230-i2c", true },
138 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) in mv_twsi_probe()
145 #define ABSSUB(a,b) (((a) > (b)) ? (a) - (b) : (b) - (a))
150 uint64_t clk; in mv_twsi_cal_baud_rate() local
157 clk_get_freq(sc->clk_core, &clk); in mv_twsi_cal_baud_rate()
161 cur = TWSI_BAUD_RATE_RAW(clk,m,n); in mv_twsi_cal_baud_rate()
170 rate->raw = TWSI_BAUD_RATE_RAW(clk, m0, n0); in mv_twsi_cal_baud_rate()
171 rate->param = TWSI_BAUD_RATE_PARAM(m0, n0); in mv_twsi_cal_baud_rate()
172 rate->m = m0; in mv_twsi_cal_baud_rate()
173 rate->n = n0; in mv_twsi_cal_baud_rate()
183 sc->dev = dev; in mv_twsi_attach()
186 error = clk_get_by_ofw_index(dev, 0, 0, &sc->clk_core); in mv_twsi_attach()
191 error = clk_enable(sc->clk_core); in mv_twsi_attach()
197 if (clk_get_by_ofw_index(dev, 0, 1, &sc->clk_reg) == 0) { in mv_twsi_attach()
198 error = clk_enable(sc->clk_reg); in mv_twsi_attach()
205 mv_twsi_cal_baud_rate(sc, TWSI_BAUD_RATE_SLOW, &sc->baud_rate[IIC_SLOW]); in mv_twsi_attach()
206 mv_twsi_cal_baud_rate(sc, TWSI_BAUD_RATE_FAST, &sc->baud_rate[IIC_FAST]); in mv_twsi_attach()
210 " %" PRIu32 " kHz (M=%d, N=%d) for fast.\n", in mv_twsi_attach()
211 sc->baud_rate[IIC_SLOW].raw / 1000, in mv_twsi_attach()
212 sc->baud_rate[IIC_SLOW].m, in mv_twsi_attach()
213 sc->baud_rate[IIC_SLOW].n, in mv_twsi_attach()
214 sc->baud_rate[IIC_FAST].raw / 1000, in mv_twsi_attach()
215 sc->baud_rate[IIC_FAST].m, in mv_twsi_attach()
216 sc->baud_rate[IIC_FAST].n); in mv_twsi_attach()
218 sc->reg_data = TWSI_DATA; in mv_twsi_attach()
219 sc->reg_slave_addr = TWSI_ADDR; in mv_twsi_attach()
220 sc->reg_slave_ext_addr = TWSI_XADDR; in mv_twsi_attach()
221 sc->reg_control = TWSI_CNTR; in mv_twsi_attach()
222 sc->reg_status = TWSI_STAT; in mv_twsi_attach()
223 sc->reg_baud_rate = TWSI_BAUD_RATE; in mv_twsi_attach()
224 sc->reg_soft_reset = TWSI_SRST; in mv_twsi_attach()