Lines Matching +full:i2c +full:- +full:slave +full:- +full:addr
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
65 while (counter--) { in pcf_wait_byte()
91 if (sc->pcf_started) { in pcf_stop_locked()
95 sc->pcf_started = 0; in pcf_stop_locked()
111 } while (k--); in pcf_noack()
117 pcf_repeated_start(device_t dev, u_char slave, int timeout) in pcf_repeated_start() argument
124 device_printf(dev, " >> repeated start for slave %#x\n", in pcf_repeated_start()
125 (unsigned)slave); in pcf_repeated_start()
130 /* set slave address to PCF. Last bit (LSB) must be set correctly in pcf_repeated_start()
132 pcf_set_S0(sc, slave); in pcf_repeated_start()
157 pcf_start(device_t dev, u_char slave, int timeout) in pcf_start() argument
164 device_printf(dev, " >> start for slave %#x\n", (unsigned)slave); in pcf_start()
174 /* set slave address to PCF. Last bit (LSB) must be set correctly in pcf_start()
176 pcf_set_S0(sc, slave); in pcf_start()
181 sc->pcf_started = 1; in pcf_start()
224 char data, status, addr; in pcf_intr() local
242 iicbus_intr(sc->iicbus, INTR_ERROR, &error); in pcf_intr()
250 switch(sc->pcf_slave_mode) { in pcf_intr()
257 sc->pcf_slave_mode = SLAVE_RECEIVER; in pcf_intr()
259 iicbus_intr(sc->iicbus, INTR_NOACK, NULL); in pcf_intr()
264 iicbus_intr(sc->iicbus, INTR_TRANSMIT, &data); in pcf_intr()
271 addr = pcf_get_S0(sc); in pcf_intr()
274 iicbus_intr(sc->iicbus, INTR_GENERAL, &addr); in pcf_intr()
276 iicbus_intr(sc->iicbus, INTR_START, &addr); in pcf_intr()
278 if (addr & LSB) { in pcf_intr()
279 sc->pcf_slave_mode = SLAVE_TRANSMITTER; in pcf_intr()
282 iicbus_intr(sc->iicbus, INTR_TRANSMIT, &data); in pcf_intr()
297 iicbus_intr(sc->iicbus, INTR_STOP, NULL); in pcf_intr()
304 iicbus_intr(sc->iicbus, INTR_RECEIVE, &data); in pcf_intr()
309 panic("%s: unknown slave mode (%d)!", __func__, in pcf_intr()
310 sc->pcf_slave_mode); in pcf_intr()
322 sc->pcf_slave_mode = SLAVE_RECEIVER; in pcf_intr()
329 pcf_rst_card(device_t dev, u_char speed, u_char addr, u_char *oldaddr) in pcf_rst_card() argument
335 *oldaddr = sc->pcf_addr; in pcf_rst_card()
338 if (!addr) in pcf_rst_card()
339 sc->pcf_addr = PCF_DEFAULT_ADDR; in pcf_rst_card()
341 sc->pcf_addr = addr; in pcf_rst_card()
346 pcf_set_S0(sc, sc->pcf_addr >> 1); in pcf_rst_card()
371 sc->pcf_slave_mode = SLAVE_RECEIVER; in pcf_rst_card()
403 len --; in pcf_write()
451 /* ok, last data byte already in S0, no I2C activity in pcf_read()
462 len --; in pcf_read()