- 18 1月, 2020 2 次提交
-
-
由 Michael Walle 提交于
The commit 7b678c69 ("mtd: spi-nor: Merge spansion Quad Enable methods") forgot to actually set the QE bit in some cases. Thus this breaks quad mode accesses to flashes which support readback of the status register-2. Fix it. Fixes: 7b678c69 ("mtd: spi-nor: Merge spansion Quad Enable methods") Signed-off-by: NMichael Walle <michael@walle.cc> Reviewed-by: NTudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Vignesh Raghavendra 提交于
mtd->size is still unassigned when running spansion_post_sfdp_fixups() hook, therefore use nor->params.size to determine the size of flash device. This makes sure that 4-byte addressing opcodes are used on Spansion flashes that are larger than 16MiB and don't have SFDP 4BAIT table populated. Fixes: 92094ebc ("mtd: spi-nor: Add spansion_post_sfdp_fixups()") Signed-off-by: NVignesh Raghavendra <vigneshr@ti.com> Reviewed-by: NTudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
- 10 1月, 2020 1 次提交
-
-
由 Tudor Ambarus 提交于
Micron flashes do not support 16 bit writes on the Status Register. According to micron datasheets, when using the Write Status Register (01h) command, the chip select should be driven LOW and held LOW until the eighth bit of the last data byte has been latched in, after which it must be driven HIGH. If CS is not driven HIGH, the command is not executed, flag status register error bits are not set, and the write enable latch remains set to 1. This fixes the lock operations on micron flashes. Reported-by: NJohn Garry <john.garry@huawei.com> Fixes: 39d1e334 ("mtd: spi-nor: Fix clearing of QE bit on lock()/unlock()") Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Tested-by: NJohn Garry <john.garry@huawei.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
- 12 11月, 2019 5 次提交
-
-
由 Sagar Shrikant Kadam 提交于
Set the default Quad Enable method for ISSI flashes. Used for ISSI flashes (IS25WP256D-JMLE) that do not support SFDP tables and can not determine the Quad Enable method by parsing BFPT. Based on code originally written by Wesley Terpstra <wesley@sifive.com> and/or Palmer Dabbelt <palmer@sifive.com> https://github.com/riscv/riscv-linux/commit/c94e267766d62bc9a669611c3d0c8ed5ea26569bSigned-off-by: NSagar Shrikant Kadam <sagar.kadam@sifive.com> [tudor.ambarus@microchip.com: - rebase, split and adapt for latest spi-nor/next, - use PMC CFI ID for ISSI. According to JEP106BA, "Programmable Micro Corp" changed its name to Integrated Silicon Solution (ISSI)] Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Sagar Shrikant Kadam 提交于
Update the spi_nor_id table for is25wp256 (32MB) device from ISSI, present on HiFive Unleashed dev board (Rev: A00). Use the post bfpt fixup hook for the is25wp256 device, as done for the is25lp256 device to overwrite the wrong address width advertised by BFPT. Signed-off-by: NSagar Shrikant Kadam <sagar.kadam@sifive.com> [tudor.ambarus@microchip.com: rebase, split and adapt for latest spi-nor/next] Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Manivannan Sadhasivam 提交于
Add MTD support for w25q256jw SPI NOR chip from Winbond. This chip supports dual/quad I/O mode with 512 blocks of memory organized in 64KB sectors. In addition to this, there is also small 4KB sectors available for flexibility. The device has been validated using Thor96 board. Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tudor Ambarus <tudor.ambarus@microchip.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Brian Norris <computersforpeace@gmail.com> Cc: Miquel Raynal <miquel.raynal@bootlin.com> Cc: Richard Weinberger <richard@nod.at> Cc: Vignesh Raghavendra <vigneshr@ti.com> Cc: linux-mtd@lists.infradead.org Signed-off-by: NDarshak Patel <darshak.patel@einfochips.com> [Mani: cleaned up for upstream] Signed-off-by: NManivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com>
-
由 Tudor Ambarus 提交于
When the controller is not under the SPI-MEM interface it may implement the optional controller_ops->erase() method. nor->spimem and nor->controller_ops are mutually exclusive. Move the nor->controller_ops->erase != NULL check as an 'else if' case to nor->spimem, in order to avoid the nor->controller_ops != NULL check. Reported-by: NDan Carpenter <dan.carpenter@oracle.com> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Expand the spi_nor_check() to make sure that nor->spimem and nor->controller_ops are mutually exclusive. Fixes: b35b9a10 ("mtd: spi-nor: Move m25p80 code in spi-nor.c") Reported-by: NDan Carpenter <dan.carpenter@oracle.com> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
- 11 11月, 2019 6 次提交
-
-
由 Tudor Ambarus 提交于
Rename macronix_quad_enable() to a generic name: spi_nor_sr1_bit6_quad_enable(). Prepend "spi_nor_" to "sr2_bit7_quad_enable". All SPI NOR generic methods should be prepended by "spi_nor_". Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
Merge spansion_no_read_cr_quad_enable() spansion_read_cr_quad_enable() into spi_nor_sr2_bit1_quad_enable(). Reduce code duplication by introducing spi_nor_write_16bit_cr_and_check(). The Configuration Register contains bits that can be updated in future: FREEZE, CMP. Provide a generic method that allows updating all bits of the Configuration Register. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
JEDEC Basic Flash Parameter Table, 15th DWORD, bits 22:20, refers to this bit as "bit 1 of the status register 2". Rename the macro accordingly. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
Test that all the bits from Status Register 1 and Status Register 2 were written correctly. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
spi_nor_unlock() unlocks blocks of memory or the entire flash memory array, if requested. clear_sr_bp() unlocks the entire flash memory array at boot time. This calls for some unification, clear_sr_bp() is just an optimization for the case when the unlock request covers the entire flash size. Get rid of clear_sr_bp() and introduce spi_nor_unlock_all(), which is just a call to spi_nor_unlock() for the entire flash memory array. This fixes a bug that was present in spi_nor_spansion_clear_sr_bp(). When the QE bit was zero, we used the Write Status (01h) command with one data byte, which might cleared the Status Register 2. We now always use the Write Status (01h) command with two data bytes when SNOR_F_HAS_16BIT_SR is set, to avoid clearing the Status Register 2. The SNOR_F_NO_READ_CR case is treated as well. When the flash doesn't support the CR Read command, we make an assumption about the value of the QE bit. In spi_nor_init(), call spi_nor_quad_enable() first, then spi_nor_unlock_all(), so that at the spi_nor_unlock_all() time we can be sure the QE bit has value one, because of the previous call to spi_nor_quad_enable(). Get rid of the MFR handling and implement specific manufacturer default_init() fixup hooks. Note that this changes a bit the logic for the SNOR_MFR_ATMEL, SNOR_MFR_INTEL and SNOR_MFR_SST cases. Before this patch, the Atmel, Intel and SST chips did not set the locking ops, but unlocked the entire flash at boot time, while now they are setting the locking ops to stm_locking_ops. This should work, since the disable of the block protection at the boot time used the same Status Register bits to unlock the flash, as in the stm_locking_ops case. Suggested-by: NBoris Brezillon <boris.brezillon@collabora.com> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
Make sure that when doing a lock() or an unlock() operation we don't clear the QE bit from Status Register 2. JESD216 revB or later offers information about the *default* Status Register commands to use (see BFPT DWORDS[15], bits 22:20). In this standard, Status Register 1 refers to the first data byte transferred on a Read Status (05h) or Write Status (01h) command. Status register 2 refers to the byte read using instruction 35h. Status register 2 is the second byte transferred in a Write Status (01h) command. Industry naming and definitions of these Status Registers may differ. The definitions are described in JESD216B, BFPT DWORDS[15], bits 22:20. There are cases in which writing only one byte to the Status Register 1 has the side-effect of clearing Status Register 2 and implicitly the Quad Enable bit. This side-effect is hit just by the BFPT_DWORD15_QER_SR2_BIT1_BUGGY and BFPT_DWORD15_QER_SR2_BIT1 cases. Suggested-by: NBoris Brezillon <boris.brezillon@collabora.com> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
- 07 11月, 2019 12 次提交
-
-
由 Tudor Ambarus 提交于
Demystify where the EIO error occurs. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
Check that all the bits written in the write_sr_and_check() method match the status_new received value. Failing to write the other bits is dangerous too, extend the check. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
When the Read-Modify-Write-Read-Back Quad Enable methods failed on the Read-Back, they returned -EINVAL. Since this is an I/O error, return -EIO. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
Drop the default spansion_quad_enable() method and replace it with spansion_read_cr_quad_enable(). The function was buggy, it didn't care about the previous values of the Status and Configuration Registers. spansion_read_cr_quad_enable() is a Read-Modify-Write-Check function that keeps track of what were the previous values of the Status and Configuration Registers. In terms of instruction types sent to the flash, the only difference between the spansion_quad_enable() and spansion_read_cr_quad_enable() is that the later calls spi_nor_read_sr(). We can safely assume that all flashes support spi_nor_read_sr(), because all flashes call it in spi_nor_sr_ready(). The transition from spansion_quad_enable() to spansion_read_cr_quad_enable() will not affect anybody, drop the buggy code. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
Document all the Register Operations. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
Merge static int spi_nor_write_sr(struct spi_nor *nor, u8 val) static int spi_nor_write_sr_cr(struct spi_nor *nor, const u8 *sr_cr) into static int spi_nor_write_sr(struct spi_nor *nor, const u8 *sr, size_t len) The Status Register can be written with one or two bytes. Merge the two functions to avoid code duplication. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Avoid duplicating code by moving the calls to spi_nor_write_enable() and spi_nor_wait_till_ready() inside the Write Status Register methods. Move spi_nor_write_sr() to avoid forward declaration of spi_nor_wait_till_ready(). Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
spi_nor_clear_sr() and spi_nor_clear_fsr() are called just in case of errors. The callers didn't check their return value, make them of type void. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Rename 'sst_write_err' label to 'out' as it is no longer generic for all the errors in the sst_write() method, and may introduce confusion. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Check for the return vales of each Register Operation. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
Spare the callers of printing debug messages by themselves. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
由 Tudor Ambarus 提交于
What most users care about is "my dev is not working properly". All low level information should be discovered when activating the debug traces. Keep error messages just for the following cases: - when the SR/FSR report program or erase fails, or attempts of modifying a protected sector, - when the JEDEC ID is not recognized, - when the resume() call fails, - when the spi_nor_check() fails. Suggested-by: NBoris Brezillon <boris.brezillon@collabora.com> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NVignesh Raghavendra <vigneshr@ti.com>
-
- 02 11月, 2019 3 次提交
-
-
由 Sergei Shtylyov 提交于
spi_nor_read_raw() assigns the result of 'ssize_t spi_nor_read_data()' to the 'int ret' variable, while 'ssize_t' is a 64-bit type and *int* is a 32-bit type on the 64-bit machines. This silent truncation isn't really valid, so fix up the variable's type. Fixes: f384b352 ("mtd: spi-nor: parse Serial Flash Discoverable Parameters (SFDP) tables") Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com>
-
由 Sergei Shtylyov 提交于
spi_nor_read() assigns the result of 'ssize_t spi_nor_read_data()' to the 'int ret' variable, while 'ssize_t' is a 64-bit type and *int* is a 32-bit type on the 64-bit machines. This silent truncation isn't really valid, so fix up the variable's type. Fixes: 59451e12 ("mtd: spi-nor: change return value of read/write") Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com>
-
由 Tudor Ambarus 提交于
Print identifying information about struct device. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
- 01 11月, 2019 11 次提交
-
-
由 Tudor Ambarus 提交于
Constify the data to write to the Status Register. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
In case the write of the first byte failed, retlen was incorrectly incremented to *retlen += actual; on the exit path. retlen should be incremented when actual data was written to the flash. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Drop the error messages from the callers, since the callees already print an error message in case of failure. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Let the callers pass the pointer to the DMA-able buffer where the value of the Configuration Register will be written. This way we avoid the casts between int and u8, which can be confusing. Callers stop compare the return value of spi_nor_read_cr() with negative, spi_nor_read_cr() returns 0 on success and -errno otherwise. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Let the callers pass the pointer to the DMA-able buffer where the value of the Flag Status Register will be written. This way we avoid the casts between int and u8, which can be confusing. Caller stops compare the return value of spi_nor_read_fsr() with negative, spi_nor_read_fsr() returns 0 on success and -errno otherwise. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Let the callers pass the pointer to the DMA-able buffer where the value of the Status Register will be written. This way we avoid the casts between int and u8, which can be confusing. Callers stop compare the return value of spi_nor_read_sr() with negative, spi_nor_read_sr() returns 0 on success and -errno otherwise. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Do not overwrite the error numbers received the Register Operations methods. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
ret is already of type int. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
spi_mem_exec_op() nor->controller_ops->write_reg() nor->controller_ops->read_reg() spi_nor_wait_till_ready() Return 0 on success, -errno otherwise. Stop compare with negative and compare with zero in all the register operations methods. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Group all register methods up in the file, to avoid forward declarations. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-
由 Tudor Ambarus 提交于
Two new lines, one after another, drop one. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: NBoris Brezillon <boris.brezillon@collabora.com>
-