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

1 // SPDX-License-Identifier: GPL-2.0
11 * are wrong ... no idea why.
77 mutex_lock(&flash->lock); in mchp48l640_read_status()
78 ret = spi_write_then_read(flash->spi, &cmd[0], 1, &cmd[1], 1); in mchp48l640_read_status()
79 mutex_unlock(&flash->lock); in mchp48l640_read_status()
82 dev_dbg(&flash->spi->dev, "read status ret: %d status: %x", ret, *status); in mchp48l640_read_status()
95 dev_dbg(&flash->spi->dev, "read status ret: %d bit: %x %sset status: %x", in mchp48l640_waitforbit()
111 dev_err(&flash->spi->dev, "Timeout waiting for bit %x %s set in status register.", in mchp48l640_waitforbit()
113 return -ETIMEDOUT; in mchp48l640_waitforbit()
126 mutex_lock(&flash->lock); in mchp48l640_write_prepare()
127 ret = spi_write(flash->spi, cmd, 1); in mchp48l640_write_prepare()
128 mutex_unlock(&flash->lock); in mchp48l640_write_prepare()
131 dev_err(&flash->spi->dev, "write %sable failed ret: %d", in mchp48l640_write_prepare()
134 dev_dbg(&flash->spi->dev, "write %sable success ret: %d", in mchp48l640_write_prepare()
154 mutex_lock(&flash->lock); in mchp48l640_set_mode()
155 ret = spi_write(flash->spi, cmd, 2); in mchp48l640_set_mode()
156 mutex_unlock(&flash->lock); in mchp48l640_set_mode()
158 dev_err(&flash->spi->dev, "Could not set continuous mode ret: %d", ret); in mchp48l640_set_mode()
178 return -ENOMEM; in mchp48l640_write_page()
188 mutex_lock(&flash->lock); in mchp48l640_write_page()
191 ret = spi_write(flash->spi, cmd, cmdlen + len); in mchp48l640_write_page()
192 mutex_unlock(&flash->lock); in mchp48l640_write_page()
198 if (flash->caps->auto_disable_wel) { in mchp48l640_write_page()
212 dev_err(&flash->spi->dev, "write fail with: %d", ret); in mchp48l640_write_page()
224 size_t page_sz = flash->caps->page_size; in mchp48l640_write()
227 * we set PRO bit (page rollover), but writing length > page size in mchp48l640_write()
231 ws = min((len - wlen), page_sz); in mchp48l640_write()
252 return -ENOMEM; in mchp48l640_read_page()
258 mutex_lock(&flash->lock); in mchp48l640_read_page()
260 ret = spi_write_then_read(flash->spi, cmd, cmdlen, buf, len); in mchp48l640_read_page()
261 mutex_unlock(&flash->lock); in mchp48l640_read_page()
270 dev_err(&flash->spi->dev, "read fail with: %d", ret); in mchp48l640_read_page()
282 size_t page_sz = flash->caps->page_size; in mchp48l640_read()
285 * we set PRO bit (page rollover), but if read length > page size in mchp48l640_read()
289 ws = min((len - wlen), page_sz); in mchp48l640_read()
319 flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); in mchp48l640_probe()
321 return -ENOMEM; in mchp48l640_probe()
323 flash->spi = spi; in mchp48l640_probe()
324 mutex_init(&flash->lock); in mchp48l640_probe()
335 data = dev_get_platdata(&spi->dev); in mchp48l640_probe()
337 flash->caps = of_device_get_match_data(&spi->dev); in mchp48l640_probe()
338 if (!flash->caps) in mchp48l640_probe()
339 flash->caps = &mchp48l640_caps; in mchp48l640_probe()
341 mtd_set_of_node(&flash->mtd, spi->dev.of_node); in mchp48l640_probe()
342 flash->mtd.dev.parent = &spi->dev; in mchp48l640_probe()
343 flash->mtd.type = MTD_RAM; in mchp48l640_probe()
344 flash->mtd.flags = MTD_CAP_RAM; in mchp48l640_probe()
345 flash->mtd.writesize = flash->caps->page_size; in mchp48l640_probe()
346 flash->mtd.size = flash->caps->size; in mchp48l640_probe()
347 flash->mtd._read = mchp48l640_read; in mchp48l640_probe()
348 flash->mtd._write = mchp48l640_write; in mchp48l640_probe()
350 err = mtd_device_register(&flash->mtd, data ? data->parts : NULL, in mchp48l640_probe()
351 data ? data->nr_parts : 0); in mchp48l640_probe()
362 WARN_ON(mtd_device_unregister(&flash->mtd)); in mchp48l640_remove()