Lines Matching refs:spi

94 	struct spi_device	*spi;  member
104 MODULE_DEVICE_TABLE(spi, dataflash_dev_ids);
120 static inline int dataflash_status(struct spi_device *spi) in dataflash_status() argument
125 return spi_w8r8(spi, OP_READ_STATUS); in dataflash_status()
132 static int dataflash_waitready(struct spi_device *spi) in dataflash_waitready() argument
137 status = dataflash_status(spi); in dataflash_waitready()
139 dev_dbg(&spi->dev, "status %d?\n", status); in dataflash_waitready()
158 struct spi_device *spi = priv->spi; in dataflash_erase() local
165 dev_dbg(&spi->dev, "erase addr=0x%llx len 0x%llx\n", in dataflash_erase()
199 dev_dbg(&spi->dev, "ERASE %s: (%x) %x %x %x [%i]\n", in dataflash_erase()
204 status = spi_sync(spi, &msg); in dataflash_erase()
205 (void) dataflash_waitready(spi); in dataflash_erase()
208 dev_err(&spi->dev, "erase %x, err %d\n", in dataflash_erase()
246 dev_dbg(&priv->spi->dev, "read 0x%x..0x%x\n", in dataflash_read()
255 dev_dbg(&priv->spi->dev, "READ: (%x) %x %x %x\n", in dataflash_read()
280 status = spi_sync(priv->spi, &msg); in dataflash_read()
287 dev_dbg(&priv->spi->dev, "read %x..%x --> %d\n", in dataflash_read()
304 struct spi_device *spi = priv->spi; in dataflash_write() local
313 dev_dbg(&spi->dev, "write 0x%x..0x%x\n", in dataflash_write()
331 dev_dbg(&spi->dev, "write @ %i:%i len=%i\n", in dataflash_write()
359 dev_dbg(&spi->dev, "TRANSFER: (%x) %x %x %x\n", in dataflash_write()
362 status = spi_sync(spi, &msg); in dataflash_write()
364 dev_dbg(&spi->dev, "xfer %u -> %d\n", in dataflash_write()
367 (void) dataflash_waitready(priv->spi); in dataflash_write()
377 dev_dbg(&spi->dev, "PROGRAM: (%x) %x %x %x\n", in dataflash_write()
383 status = spi_sync(spi, &msg); in dataflash_write()
386 dev_dbg(&spi->dev, "pgm %u/%u -> %d\n", in dataflash_write()
389 (void) dataflash_waitready(priv->spi); in dataflash_write()
401 dev_dbg(&spi->dev, "COMPARE: (%x) %x %x %x\n", in dataflash_write()
404 status = spi_sync(spi, &msg); in dataflash_write()
406 dev_dbg(&spi->dev, "compare %u -> %d\n", in dataflash_write()
409 status = dataflash_waitready(priv->spi); in dataflash_write()
413 dev_err(&spi->dev, "compare page %u, err %d\n", in dataflash_write()
457 static ssize_t otp_read(struct spi_device *spi, unsigned base, in otp_read() argument
490 dataflash_waitready(spi); in otp_read()
492 status = spi_sync(spi, &m); in otp_read()
510 status = otp_read(priv->spi, 64, buf, from, len); in dataflash_read_fact_otp()
527 status = otp_read(priv->spi, 0, buf, from, len); in dataflash_read_user_otp()
579 dataflash_waitready(priv->spi); in dataflash_write_user_otp()
580 status = spi_sync(priv->spi, &m); in dataflash_write_user_otp()
622 static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages, in add_dataflash_otp() argument
627 struct flash_platform_data *pdata = dev_get_platdata(&spi->dev); in add_dataflash_otp()
636 priv->spi = spi; in add_dataflash_otp()
642 spi->master->bus_num, spi->chip_select, in add_dataflash_otp()
657 device->dev.parent = &spi->dev; in add_dataflash_otp()
658 mtd_set_of_node(device, spi->dev.of_node); in add_dataflash_otp()
663 dev_info(&spi->dev, "%s (%lld KBytes) pagesize %d bytes%s\n", in add_dataflash_otp()
666 spi_set_drvdata(spi, priv); in add_dataflash_otp()
679 static inline int add_dataflash(struct spi_device *spi, char *name, in add_dataflash() argument
682 return add_dataflash_otp(spi, name, nr_pages, pagesize, in add_dataflash()
743 static struct flash_info *jedec_lookup(struct spi_device *spi, in jedec_lookup() argument
756 dev_dbg(&spi->dev, "OTP, sector protect%s\n", in jedec_lookup()
760 status = dataflash_status(spi); in jedec_lookup()
762 dev_dbg(&spi->dev, "status error %d\n", in jedec_lookup()
781 static struct flash_info *jedec_probe(struct spi_device *spi) in jedec_probe() argument
799 ret = spi_write_then_read(spi, &code, 1, id, id_size); in jedec_probe()
801 dev_dbg(&spi->dev, "error %d reading JEDEC ID\n", ret); in jedec_probe()
814 info = jedec_lookup(spi, jedec >> DATAFLASH_SHIFT_EXTID, true); in jedec_probe()
821 info = jedec_lookup(spi, jedec >> DATAFLASH_SHIFT_ID, false); in jedec_probe()
829 dev_warn(&spi->dev, "JEDEC id %016llx not handled\n", jedec); in jedec_probe()
847 static int dataflash_probe(struct spi_device *spi) in dataflash_probe() argument
859 info = jedec_probe(spi); in dataflash_probe()
863 return add_dataflash_otp(spi, info->name, info->nr_pages, in dataflash_probe()
871 status = dataflash_status(spi); in dataflash_probe()
873 dev_dbg(&spi->dev, "status error %d\n", status); in dataflash_probe()
885 status = add_dataflash(spi, "AT45DB011B", 512, 264, 9); in dataflash_probe()
888 status = add_dataflash(spi, "AT45DB021B", 1024, 264, 9); in dataflash_probe()
891 status = add_dataflash(spi, "AT45DB041x", 2048, 264, 9); in dataflash_probe()
894 status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9); in dataflash_probe()
897 status = add_dataflash(spi, "AT45DB161x", 4096, 528, 10); in dataflash_probe()
900 status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10); in dataflash_probe()
904 status = add_dataflash(spi, "AT45DB642x", 8192, 1056, 11); in dataflash_probe()
908 dev_info(&spi->dev, "unsupported device (%x)\n", in dataflash_probe()
914 dev_dbg(&spi->dev, "add_dataflash --> %d\n", status); in dataflash_probe()
919 static int dataflash_remove(struct spi_device *spi) in dataflash_remove() argument
921 struct dataflash *flash = spi_get_drvdata(spi); in dataflash_remove()
924 dev_dbg(&spi->dev, "remove\n"); in dataflash_remove()