Lines Matching refs:flash
45 static void mchp23k256_addr2cmd(struct mchp23k256_flash *flash, in mchp23k256_addr2cmd() argument
55 for (i = flash->caps->addr_width; i > 0; i--, addr >>= 8) in mchp23k256_addr2cmd()
59 static int mchp23k256_cmdsz(struct mchp23k256_flash *flash) in mchp23k256_cmdsz() argument
61 return 1 + flash->caps->addr_width; in mchp23k256_cmdsz()
67 struct mchp23k256_flash *flash = to_mchp23k256_flash(mtd); in mchp23k256_write() local
76 mchp23k256_addr2cmd(flash, to, command); in mchp23k256_write()
79 transfer[0].len = mchp23k256_cmdsz(flash); in mchp23k256_write()
86 mutex_lock(&flash->lock); in mchp23k256_write()
88 ret = spi_sync(flash->spi, &message); in mchp23k256_write()
90 mutex_unlock(&flash->lock); in mchp23k256_write()
104 struct mchp23k256_flash *flash = to_mchp23k256_flash(mtd); in mchp23k256_read() local
114 mchp23k256_addr2cmd(flash, from, command); in mchp23k256_read()
117 transfer[0].len = mchp23k256_cmdsz(flash); in mchp23k256_read()
124 mutex_lock(&flash->lock); in mchp23k256_read()
126 ret = spi_sync(flash->spi, &message); in mchp23k256_read()
128 mutex_unlock(&flash->lock); in mchp23k256_read()
173 struct mchp23k256_flash *flash; in mchp23k256_probe() local
177 flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); in mchp23k256_probe()
178 if (!flash) in mchp23k256_probe()
181 flash->spi = spi; in mchp23k256_probe()
182 mutex_init(&flash->lock); in mchp23k256_probe()
183 spi_set_drvdata(spi, flash); in mchp23k256_probe()
191 flash->caps = of_device_get_match_data(&spi->dev); in mchp23k256_probe()
192 if (!flash->caps) in mchp23k256_probe()
193 flash->caps = &mchp23k256_caps; in mchp23k256_probe()
195 mtd_set_of_node(&flash->mtd, spi->dev.of_node); in mchp23k256_probe()
196 flash->mtd.dev.parent = &spi->dev; in mchp23k256_probe()
197 flash->mtd.type = MTD_RAM; in mchp23k256_probe()
198 flash->mtd.flags = MTD_CAP_RAM; in mchp23k256_probe()
199 flash->mtd.writesize = 1; in mchp23k256_probe()
200 flash->mtd.size = flash->caps->size; in mchp23k256_probe()
201 flash->mtd._read = mchp23k256_read; in mchp23k256_probe()
202 flash->mtd._write = mchp23k256_write; in mchp23k256_probe()
204 err = mtd_device_register(&flash->mtd, data ? data->parts : NULL, in mchp23k256_probe()
214 struct mchp23k256_flash *flash = spi_get_drvdata(spi); in mchp23k256_remove() local
216 return mtd_device_unregister(&flash->mtd); in mchp23k256_remove()