Lines Matching +full:slave +full:- +full:mode

4  * SPDX-License-Identifier: Apache-2.0
20 #include "i2c-priv.h"
38 #define RCAR_I2C_ICSCR 0x00 /* Slave Control Register */
40 #define RCAR_I2C_ICSIER 0x10 /* Slave IRQ Enable */
42 #define RCAR_I2C_ICSSR 0x08 /* Slave Status */
45 #define RCAR_I2C_ICSAR 0x1c /* Slave Address Register */
81 return sys_read32(config->reg_addr + offs); in i2c_rcar_read()
87 sys_write32(value, config->reg_addr + offs); in i2c_rcar_write()
92 const struct i2c_rcar_cfg *config = dev->config; in i2c_rcar_isr()
93 struct i2c_rcar_data *data = dev->data; in i2c_rcar_isr()
95 if (((i2c_rcar_read(config, RCAR_I2C_ICMSR)) & data->status_mask) == in i2c_rcar_isr()
96 data->status_mask) { in i2c_rcar_isr()
97 k_sem_give(&data->int_sem); in i2c_rcar_isr()
104 const struct i2c_rcar_cfg *config = dev->config; in i2c_rcar_wait_for_state()
105 struct i2c_rcar_data *data = dev->data; in i2c_rcar_wait_for_state()
107 data->status_mask = mask; in i2c_rcar_wait_for_state()
110 k_sem_reset(&data->int_sem); in i2c_rcar_wait_for_state()
116 return k_sem_take(&data->int_sem, K_USEC(MAX_WAIT_US)); in i2c_rcar_wait_for_state()
121 const struct i2c_rcar_cfg *config = dev->config; in i2c_rcar_finish()
141 const struct i2c_rcar_cfg *config = dev->config; in i2c_rcar_set_addr()
143 /* Set slave address & transfer mode */ in i2c_rcar_set_addr()
150 /* Wait for address & transfer mode to be transmitted */ in i2c_rcar_set_addr()
160 const struct i2c_rcar_cfg *config = dev->config; in i2c_rcar_transfer_msg()
164 if ((msg->flags & I2C_MSG_RW_MASK) == I2C_MSG_READ) { in i2c_rcar_transfer_msg()
168 for (i = 0; i < msg->len; i++) { in i2c_rcar_transfer_msg()
169 if (msg->len - 1 == i) { in i2c_rcar_transfer_msg()
185 msg->buf[i] = i2c_rcar_read(config, RCAR_I2C_ICRXD_ICTXD) & 0xff; in i2c_rcar_transfer_msg()
189 for (i = 0; i < msg->len; i++) { in i2c_rcar_transfer_msg()
190 i2c_rcar_write(config, RCAR_I2C_ICRXD_ICTXD, msg->buf[i]); in i2c_rcar_transfer_msg()
214 const struct i2c_rcar_cfg *config = dev->config; in i2c_rcar_transfer()
228 return -EIO; in i2c_rcar_transfer()
232 /* We are not supporting 10-bit addressing */ in i2c_rcar_transfer()
233 if ((msgs->flags & I2C_MSG_ADDR_10_BITS) == I2C_MSG_ADDR_10_BITS) { in i2c_rcar_transfer()
234 return -ENOTSUP; in i2c_rcar_transfer()
237 /* Send slave address */ in i2c_rcar_transfer()
238 if (i2c_rcar_set_addr(dev, addr, !!(msgs->flags & I2C_MSG_READ))) { in i2c_rcar_transfer()
239 return -EIO; /* No ACK received */ in i2c_rcar_transfer()
243 if (msgs->len) { in i2c_rcar_transfer()
251 if ((msgs->flags & I2C_MSG_STOP) == I2C_MSG_STOP) { in i2c_rcar_transfer()
260 num_msgs--; in i2c_rcar_transfer()
269 const struct i2c_rcar_cfg *config = dev->config; in i2c_rcar_configure()
272 /* We only support Master mode */ in i2c_rcar_configure()
274 return -ENOTSUP; in i2c_rcar_configure()
277 /* We are not supporting 10-bit addressing */ in i2c_rcar_configure()
279 return -ENOTSUP; in i2c_rcar_configure()
294 return -ENOTSUP; in i2c_rcar_configure()
300 /* Reset slave mode */ in i2c_rcar_configure()
306 /* Reset master mode */ in i2c_rcar_configure()
317 const struct i2c_rcar_cfg *config = dev->config; in i2c_rcar_init()
318 struct i2c_rcar_data *data = dev->data; in i2c_rcar_init()
322 k_sem_init(&data->int_sem, 0, 1); in i2c_rcar_init()
324 if (!device_is_ready(config->clock_dev)) { in i2c_rcar_init()
325 return -ENODEV; in i2c_rcar_init()
328 ret = clock_control_on(config->clock_dev, in i2c_rcar_init()
329 (clock_control_subsys_t)&config->mod_clk); in i2c_rcar_init()
335 bitrate_cfg = i2c_map_dt_bitrate(config->bitrate); in i2c_rcar_init()
342 config->init_func(dev); in i2c_rcar_init()