Lines Matching +full:no +full:- +full:read +full:- +full:rollover

1 // SPDX-License-Identifier: GPL-2.0
11 * are wrong ... no idea why.
76 mutex_lock(&flash->lock); in mchp48l640_read_status()
77 ret = spi_write_then_read(flash->spi, &cmd[0], 1, &cmd[1], 1); in mchp48l640_read_status()
78 mutex_unlock(&flash->lock); in mchp48l640_read_status()
81 dev_dbg(&flash->spi->dev, "read status ret: %d status: %x", ret, *status); in mchp48l640_read_status()
94 dev_dbg(&flash->spi->dev, "read status ret: %d bit: %x %sset status: %x", in mchp48l640_waitforbit()
110 dev_err(&flash->spi->dev, "Timeout waiting for bit %x %s set in status register.", in mchp48l640_waitforbit()
112 return -ETIMEDOUT; in mchp48l640_waitforbit()
125 mutex_lock(&flash->lock); in mchp48l640_write_prepare()
126 ret = spi_write(flash->spi, cmd, 1); in mchp48l640_write_prepare()
127 mutex_unlock(&flash->lock); in mchp48l640_write_prepare()
130 dev_err(&flash->spi->dev, "write %sable failed ret: %d", in mchp48l640_write_prepare()
133 dev_dbg(&flash->spi->dev, "write %sable success ret: %d", in mchp48l640_write_prepare()
153 mutex_lock(&flash->lock); in mchp48l640_set_mode()
154 ret = spi_write(flash->spi, cmd, 2); in mchp48l640_set_mode()
155 mutex_unlock(&flash->lock); in mchp48l640_set_mode()
157 dev_err(&flash->spi->dev, "Could not set continuous mode ret: %d", ret); in mchp48l640_set_mode()
177 return -ENOMEM; in mchp48l640_write_page()
187 mutex_lock(&flash->lock); in mchp48l640_write_page()
190 ret = spi_write(flash->spi, cmd, cmdlen + len); in mchp48l640_write_page()
191 mutex_unlock(&flash->lock); in mchp48l640_write_page()
205 dev_err(&flash->spi->dev, "write fail with: %d", ret); in mchp48l640_write_page()
217 size_t page_sz = flash->caps->page_size; in mchp48l640_write()
220 * we set PRO bit (page rollover), but writing length > page size in mchp48l640_write()
224 ws = min((len - wlen), page_sz); in mchp48l640_write()
245 return -ENOMEM; in mchp48l640_read_page()
251 mutex_lock(&flash->lock); in mchp48l640_read_page()
253 ret = spi_write_then_read(flash->spi, cmd, cmdlen, buf, len); in mchp48l640_read_page()
254 mutex_unlock(&flash->lock); in mchp48l640_read_page()
263 dev_err(&flash->spi->dev, "read fail with: %d", ret); in mchp48l640_read_page()
275 size_t page_sz = flash->caps->page_size; in mchp48l640_read()
278 * we set PRO bit (page rollover), but if read length > page size in mchp48l640_read()
282 ws = min((len - wlen), page_sz); in mchp48l640_read()
305 flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); in mchp48l640_probe()
307 return -ENOMEM; in mchp48l640_probe()
309 flash->spi = spi; in mchp48l640_probe()
310 mutex_init(&flash->lock); in mchp48l640_probe()
321 data = dev_get_platdata(&spi->dev); in mchp48l640_probe()
323 flash->caps = of_device_get_match_data(&spi->dev); in mchp48l640_probe()
324 if (!flash->caps) in mchp48l640_probe()
325 flash->caps = &mchp48l640_caps; in mchp48l640_probe()
327 mtd_set_of_node(&flash->mtd, spi->dev.of_node); in mchp48l640_probe()
328 flash->mtd.dev.parent = &spi->dev; in mchp48l640_probe()
329 flash->mtd.type = MTD_RAM; in mchp48l640_probe()
330 flash->mtd.flags = MTD_CAP_RAM; in mchp48l640_probe()
331 flash->mtd.writesize = flash->caps->page_size; in mchp48l640_probe()
332 flash->mtd.size = flash->caps->size; in mchp48l640_probe()
333 flash->mtd._read = mchp48l640_read; in mchp48l640_probe()
334 flash->mtd._write = mchp48l640_write; in mchp48l640_probe()
336 err = mtd_device_register(&flash->mtd, data ? data->parts : NULL, in mchp48l640_probe()
337 data ? data->nr_parts : 0); in mchp48l640_probe()
348 WARN_ON(mtd_device_unregister(&flash->mtd)); in mchp48l640_remove()