Lines Matching +full:tx +full:- +full:inst +full:- +full:mode

4  * SPDX-License-Identifier: Apache-2.0
32 #define EEPROM_MB85RSXX_SLEEP 0xB9U /* Sleep Mode */
64 const struct eeprom_mb85rsxx_config *config = dev->config; in eeprom_mb85rsxx_read()
65 struct eeprom_mb85rsxx_data *data = dev->data; in eeprom_mb85rsxx_read()
70 if (offset + len > config->size) { in eeprom_mb85rsxx_read()
72 return -EINVAL; in eeprom_mb85rsxx_read()
88 const struct spi_buf_set tx = { in eeprom_mb85rsxx_read() local
107 k_mutex_lock(&data->lock, K_FOREVER); in eeprom_mb85rsxx_read()
109 err = spi_transceive_dt(&config->spi, &tx, &rx); in eeprom_mb85rsxx_read()
111 k_mutex_unlock(&data->lock); in eeprom_mb85rsxx_read()
122 const struct eeprom_mb85rsxx_config *config = dev->config; in eeprom_mb85rsxx_wren()
128 const struct spi_buf_set tx = { in eeprom_mb85rsxx_wren() local
133 return spi_write_dt(&config->spi, &tx); in eeprom_mb85rsxx_wren()
138 const struct eeprom_mb85rsxx_config *config = dev->config; in eeprom_mb85rsxx_wrdi()
144 const struct spi_buf_set tx = { in eeprom_mb85rsxx_wrdi() local
149 return spi_write_dt(&config->spi, &tx); in eeprom_mb85rsxx_wrdi()
155 const struct eeprom_mb85rsxx_config *config = dev->config; in eeprom_mb85rsxx_write()
156 struct eeprom_mb85rsxx_data *data = dev->data; in eeprom_mb85rsxx_write()
161 if (config->readonly) { in eeprom_mb85rsxx_write()
162 LOG_ERR("attempt to write to read-only device"); in eeprom_mb85rsxx_write()
163 return -EACCES; in eeprom_mb85rsxx_write()
166 if (offset + len > config->size) { in eeprom_mb85rsxx_write()
168 return -EINVAL; in eeprom_mb85rsxx_write()
186 const struct spi_buf_set tx = { in eeprom_mb85rsxx_write() local
191 k_mutex_lock(&data->lock, K_FOREVER); in eeprom_mb85rsxx_write()
196 k_mutex_unlock(&data->lock); in eeprom_mb85rsxx_write()
200 err = spi_write_dt(&config->spi, &tx); in eeprom_mb85rsxx_write()
203 k_mutex_unlock(&data->lock); in eeprom_mb85rsxx_write()
212 k_mutex_unlock(&data->lock); in eeprom_mb85rsxx_write()
219 const struct eeprom_mb85rsxx_config *config = dev->config; in eeprom_mb85rsxx_size()
221 return config->size; in eeprom_mb85rsxx_size()
226 const struct eeprom_mb85rsxx_config *config = dev->config; in eeprom_mb85rsxx_rdid()
227 struct eeprom_mb85rsxx_data *data = dev->data; in eeprom_mb85rsxx_rdid()
236 const struct spi_buf_set tx = { in eeprom_mb85rsxx_rdid() local
254 k_mutex_lock(&data->lock, K_FOREVER); in eeprom_mb85rsxx_rdid()
255 err = spi_transceive_dt(&config->spi, &tx, &rx); in eeprom_mb85rsxx_rdid()
256 k_mutex_unlock(&data->lock); in eeprom_mb85rsxx_rdid()
269 return -EIO; in eeprom_mb85rsxx_rdid()
278 const struct eeprom_mb85rsxx_config *config = dev->config; in eeprom_mb85rsxx_init()
279 struct eeprom_mb85rsxx_data *data = dev->data; in eeprom_mb85rsxx_init()
282 k_mutex_init(&data->lock); in eeprom_mb85rsxx_init()
284 if (!spi_is_ready_dt(&config->spi)) { in eeprom_mb85rsxx_init()
286 return -EINVAL; in eeprom_mb85rsxx_init()
304 #define MB85RSXX_INIT(inst) \ argument
305 static struct eeprom_mb85rsxx_data eeprom_mb85rsxx_data_##inst; \
307 static const struct eeprom_mb85rsxx_config eeprom_mb85rsxx_config_##inst = { \
309 inst, SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8), 0), \
310 .size = DT_INST_PROP(inst, size), \
311 .readonly = DT_INST_PROP(inst, read_only), \
314 DEVICE_DT_INST_DEFINE(inst, eeprom_mb85rsxx_init, NULL, &eeprom_mb85rsxx_data_##inst, \
315 &eeprom_mb85rsxx_config_##inst, POST_KERNEL, \