spi: atmel-quadspi: Fix AHB memory accesses
Subsystems (3)
cover spi: atmel-quadspi: Fix AHB memory accesses
Starting with the move of the atmel-quadspi driver under SPI,
the following error could be seen when mounting a 16MByte ubifs:
UBIFS error (ubi0:0 pid 1893): check_lpt_type.constprop.6: invalid type (15) in LPT node type
1/4 fixes AHB accesses. The rest of the patches are small optimizations. Tested on both sama5d2 and sam9x60.
Tudor Ambarus (4):
spi: atmel-quadspi: Fix AHB memory accesses
spi: atmel-quadspi: Drop superfluous set of QSPI_IFR_APBTFRTYP_READ
spi: atmel-quadspi: Write QSPI_IAR only when needed
spi: atmel-quadspi: Move common code outside of if else
drivers/spi/atmel-quadspi.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/4 spi: atmel-quadspi: Fix AHB memory accesses
Following error was seen when mounting a 16MByte ubifs:
UBIFS error (ubi0:0 pid 1893): check_lpt_type.constprop.6: invalid type (15) in LPT node type
QSPI_IFR.TFRTYP was not set correctly. When data transfer is enabled and one wants to access the serial memory through AHB in order to:
- read in the serial memory, but not a memory data, for example a JEDEC-ID, QSPI_IFR.TFRTYP must be written to '0' (both sama5d2 and sam9x60).
- read in the serial memory, and particularly a memory data, TFRTYP must be written to '1' (both sama5d2 and sam9x60).
- write in the serial memory, but not a memory data, for example writing the configuration or the QSPI_SR, TFRTYP must be written to '2' for sama5d2 and to '0' for sam9x60.
- write in the serial memory in particular to program a memory data, TFRTYP must be written to '3' for sama5d2 and to '1' for sam9x60.
Fix the setting of the QSPI_IFR.TFRTYP field.
--- drivers/spi/atmel-quadspi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/spi/atmel-quadspi.c +7 -3
@@ -365,10 +365,14 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq,if (dummy_cycles) ifr |=QSPI_IFR_NBDUM (dummy_cycles); -/* Set data enable */ -if (op->data.nbytes) +/* Set data enable and data transfer type. */ +if (op->data.nbytes) { ifr |=QSPI_IFR_DATAEN ; +if (op->addr.nbytes) + ifr |=QSPI_IFR_TFRTYP_MEM ; + } +/* * If the QSPI controller is set in regular SPI mode, set it in * Serial Memory Mode (SMM).
@@ -393,7 +397,7 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq,atmel_qspi_write (icr, aq,QSPI_WICR );atmel_qspi_write (ifr, aq,QSPI_IFR ); }else { -if (op->data.dir ==SPI_MEM_DATA_OUT ) +if (op->data.nbytes && op->data.dir ==SPI_MEM_DATA_OUT ) ifr |=QSPI_IFR_SAMA5D2_WRITE_TRSFR ;/* Set QSPI Instruction Frame registers */
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/4 spi: atmel-quadspi: Drop superfluous set of QSPI_IFR_APBTFRTYP_READ
In reply to Tudor AmbarusThat bit describes the APB transfer type. We are writing serial memory registers via AHB acesses, that bit does not make sense in the current context.
--- drivers/spi/atmel-quadspi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/spi/atmel-quadspi.c +0 -3
@@ -386,9 +386,6 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, (void )atmel_qspi_read (aq,QSPI_SR );if (aq->caps->has_ricr) { -if (!op->addr.nbytes && op->data.dir ==SPI_MEM_DATA_IN ) - ifr |=QSPI_IFR_APBTFRTYP_READ ; -/* Set QSPI Instruction Frame registers */ atmel_qspi_write (iar, aq,QSPI_IAR );if (op->data.dir ==SPI_MEM_DATA_IN )
Signature · 1 line
2.25.1
PATCH 3/4 spi: atmel-quadspi: Write QSPI_IAR only when needed
In reply to Tudor AmbarusThe address must be written in QSPI_IAR only when we have a instruction frame with address but no data.
--- drivers/spi/atmel-quadspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/atmel-quadspi.c +4 -4
@@ -385,9 +385,11 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq,/* Clear pending interrupts */ (void )atmel_qspi_read (aq,QSPI_SR ); -if (aq->caps->has_ricr) { -/* Set QSPI Instruction Frame registers */ +/* Set QSPI Instruction Frame registers. */ +if (op->addr.nbytes && !op->data.nbytes)atmel_qspi_write (iar, aq,QSPI_IAR ); + +if (aq->caps->has_ricr) {if (op->data.dir ==SPI_MEM_DATA_IN )atmel_qspi_write (icr, aq,QSPI_RICR );else
@@ -397,8 +399,6 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq,if (op->data.nbytes && op->data.dir ==SPI_MEM_DATA_OUT ) ifr |=QSPI_IFR_SAMA5D2_WRITE_TRSFR ; -/* Set QSPI Instruction Frame registers */ -atmel_qspi_write (iar, aq,QSPI_IAR );atmel_qspi_write (icr, aq,QSPI_ICR );atmel_qspi_write (ifr, aq,QSPI_IFR ); }
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 4/4 spi: atmel-quadspi: Move common code outside of if else
In reply to Tudor AmbarusQSPI_IFR is set as the last QSPI Instruction Frame register regardless of the sama5d2 or sam9x60 version of the IP. Move the writing of QSPI_IFR outside of the IP specific code.
--- drivers/spi/atmel-quadspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/atmel-quadspi.c +2 -2
@@ -394,15 +394,15 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq,atmel_qspi_write (icr, aq,QSPI_RICR ); elseatmel_qspi_write (icr ,aq ,QSPI_WICR ); -atmel_qspi_write (ifr, aq,QSPI_IFR ); }else {if (op->data.nbytes && op->data.dir ==SPI_MEM_DATA_OUT ) ifr |=QSPI_IFR_SAMA5D2_WRITE_TRSFR ;atmel_qspi_write (icr, aq,QSPI_ICR ); -atmel_qspi_write (ifr, aq,QSPI_IFR ); } +atmel_qspi_write (ifr, aq,QSPI_IFR ); +return 0 ; }
Signature · 1 line
2.25.1
Mark Brown
maintainerQuoted 8 lines · Tudor Ambarus
Starting with the move of the atmel-quadspi driver under SPI,
the following error could be seen when mounting a 16MByte ubifs:
UBIFS error (ubi0:0 pid 1893): check_lpt_type.constprop.6: invalid type (15) in LPT node type1/4 fixes AHB accesses. The rest of the patches are small optimizations. Tested on both sama5d2 and sam9x60.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/4] spi: atmel-quadspi: Fix AHB memory accesses
commit: cac8c821059639b015586abf61623c62cc549a13
[2/4] spi: atmel-quadspi: Drop superfluous set of QSPI_IFR_APBTFRTYP_READ
commit: a6ff3a784ff9975dc77676827a2f448203511d19
[3/4] spi: atmel-quadspi: Write QSPI_IAR only when needed
commit: d00364b6a60475cd75fd07e847ad6f955952638b
[4/4] spi: atmel-quadspi: Move common code outside of if else
commit: c066efb07d1e8b801ea9d0727119958c9904e63dAll being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark