Lines Matching +full:no +full:- +full:read +full:- +full:rollover
1 // SPDX-License-Identifier: GPL-2.0
11 * are wrong ... no idea why.
78 mutex_lock(&flash->lock); in mchp48l640_read_status()
79 ret = spi_write_then_read(flash->spi, &cmd[0], 1, &cmd[1], 1); in mchp48l640_read_status()
80 mutex_unlock(&flash->lock); in mchp48l640_read_status()
83 dev_dbg(&flash->spi->dev, "read status ret: %d status: %x", ret, *status); in mchp48l640_read_status()
96 dev_dbg(&flash->spi->dev, "read status ret: %d bit: %x %sset status: %x", in mchp48l640_waitforbit()
112 dev_err(&flash->spi->dev, "Timeout waiting for bit %x %s set in status register.", in mchp48l640_waitforbit()
114 return -ETIMEDOUT; in mchp48l640_waitforbit()
127 mutex_lock(&flash->lock); in mchp48l640_write_prepare()
128 ret = spi_write(flash->spi, cmd, 1); in mchp48l640_write_prepare()
129 mutex_unlock(&flash->lock); in mchp48l640_write_prepare()
132 dev_err(&flash->spi->dev, "write %s failed ret: %d", in mchp48l640_write_prepare()
135 dev_dbg(&flash->spi->dev, "write %s success ret: %d", in mchp48l640_write_prepare()
155 mutex_lock(&flash->lock); in mchp48l640_set_mode()
156 ret = spi_write(flash->spi, cmd, 2); in mchp48l640_set_mode()
157 mutex_unlock(&flash->lock); in mchp48l640_set_mode()
159 dev_err(&flash->spi->dev, "Could not set continuous mode ret: %d", ret); in mchp48l640_set_mode()
179 return -ENOMEM; in mchp48l640_write_page()
189 mutex_lock(&flash->lock); in mchp48l640_write_page()
192 ret = spi_write(flash->spi, cmd, cmdlen + len); in mchp48l640_write_page()
193 mutex_unlock(&flash->lock); in mchp48l640_write_page()
199 if (flash->caps->auto_disable_wel) { in mchp48l640_write_page()
213 dev_err(&flash->spi->dev, "write fail with: %d", ret); in mchp48l640_write_page()
225 size_t page_sz = flash->caps->page_size; in mchp48l640_write()
228 * we set PRO bit (page rollover), but writing length > page size in mchp48l640_write()
232 ws = min((len - wlen), page_sz); in mchp48l640_write()
253 return -ENOMEM; in mchp48l640_read_page()
259 mutex_lock(&flash->lock); in mchp48l640_read_page()
261 ret = spi_write_then_read(flash->spi, cmd, cmdlen, buf, len); in mchp48l640_read_page()
262 mutex_unlock(&flash->lock); in mchp48l640_read_page()
271 dev_err(&flash->spi->dev, "read fail with: %d", ret); in mchp48l640_read_page()
283 size_t page_sz = flash->caps->page_size; in mchp48l640_read()
286 * we set PRO bit (page rollover), but if read length > page size in mchp48l640_read()
290 ws = min((len - wlen), page_sz); in mchp48l640_read()
320 flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); in mchp48l640_probe()
322 return -ENOMEM; in mchp48l640_probe()
324 flash->spi = spi; in mchp48l640_probe()
325 mutex_init(&flash->lock); in mchp48l640_probe()
336 data = dev_get_platdata(&spi->dev); in mchp48l640_probe()
338 flash->caps = of_device_get_match_data(&spi->dev); in mchp48l640_probe()
339 if (!flash->caps) in mchp48l640_probe()
340 flash->caps = &mchp48l640_caps; in mchp48l640_probe()
342 mtd_set_of_node(&flash->mtd, spi->dev.of_node); in mchp48l640_probe()
343 flash->mtd.dev.parent = &spi->dev; in mchp48l640_probe()
344 flash->mtd.type = MTD_RAM; in mchp48l640_probe()
345 flash->mtd.flags = MTD_CAP_RAM; in mchp48l640_probe()
346 flash->mtd.writesize = flash->caps->page_size; in mchp48l640_probe()
347 flash->mtd.size = flash->caps->size; in mchp48l640_probe()
348 flash->mtd._read = mchp48l640_read; in mchp48l640_probe()
349 flash->mtd._write = mchp48l640_write; in mchp48l640_probe()
351 err = mtd_device_register(&flash->mtd, data ? data->parts : NULL, in mchp48l640_probe()
352 data ? data->nr_parts : 0); in mchp48l640_probe()
363 WARN_ON(mtd_device_unregister(&flash->mtd)); in mchp48l640_remove()