Merge tag 'spi-fix-v6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
"A fairly small pile of fixes, plus one new compatible string addition
to the Synopsis driver for a new platform.

The most notable thing is the fix for divide by zeros in spi-mem if an
operation has no dummy bytes"

* tag 'spi-fix-v6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: tegra114: Don't fail set_cs_timing when delays are zero
spi: spi-qpic-snand: fix NAND_READ_LOCATION_2 register handling
spi: spi-mem: Add fix to avoid divide error
spi: dt-bindings: snps,dw-apb-ssi: Add compatible for SOPHGO SG2042 SoC
spi: dt-bindings: snps,dw-apb-ssi: Merge duplicate compatible entry
spi: spi-qpic-snand: propagate errors from qcom_spi_block_erase()
spi: stm32-ospi: Fix an error handling path in stm32_ospi_probe()

+21 -19
+7 -12
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml
··· 56 56 enum: 57 57 - snps,dw-apb-ssi 58 58 - snps,dwc-ssi-1.01a 59 - - description: Microsemi Ocelot/Jaguar2 SoC SPI Controller 60 - items: 61 - - enum: 62 - - mscc,ocelot-spi 63 - - mscc,jaguar2-spi 64 - - const: snps,dw-apb-ssi 65 59 - description: Microchip Sparx5 SoC SPI Controller 66 60 const: microchip,sparx5-spi 67 61 - description: Amazon Alpine SPI Controller 68 62 const: amazon,alpine-dw-apb-ssi 69 - - description: Renesas RZ/N1 SPI Controller 63 + - description: Vendor controllers which use snps,dw-apb-ssi as fallback 70 64 items: 71 - - const: renesas,rzn1-spi 65 + - enum: 66 + - mscc,ocelot-spi 67 + - mscc,jaguar2-spi 68 + - renesas,rzn1-spi 69 + - sophgo,sg2042-spi 70 + - thead,th1520-spi 72 71 - const: snps,dw-apb-ssi 73 72 - description: Intel Keem Bay SPI Controller 74 73 const: intel,keembay-ssi ··· 87 88 - renesas,r9a06g032-spi # RZ/N1D 88 89 - renesas,r9a06g033-spi # RZ/N1S 89 90 - const: renesas,rzn1-spi # RZ/N1 90 - - description: T-HEAD TH1520 SoC SPI Controller 91 - items: 92 - - const: thead,th1520-spi 93 - - const: snps,dw-apb-ssi 94 91 95 92 reg: 96 93 minItems: 1
+5 -1
drivers/spi/spi-mem.c
··· 596 596 ns_per_cycles = 1000000000 / op->max_freq; 597 597 ncycles += ((op->cmd.nbytes * 8) / op->cmd.buswidth) / (op->cmd.dtr ? 2 : 1); 598 598 ncycles += ((op->addr.nbytes * 8) / op->addr.buswidth) / (op->addr.dtr ? 2 : 1); 599 - ncycles += ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1); 599 + 600 + /* Dummy bytes are optional for some SPI flash memory operations */ 601 + if (op->dummy.nbytes) 602 + ncycles += ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1); 603 + 600 604 ncycles += ((op->data.nbytes * 8) / op->data.buswidth) / (op->data.dtr ? 2 : 1); 601 605 602 606 return ncycles * ns_per_cycles;
+2 -3
drivers/spi/spi-qpic-snand.c
··· 142 142 else if (reg == NAND_READ_LOCATION_1) 143 143 snandc->regs->read_location1 = locreg_val; 144 144 else if (reg == NAND_READ_LOCATION_2) 145 - snandc->regs->read_location1 = locreg_val; 145 + snandc->regs->read_location2 = locreg_val; 146 146 else if (reg == NAND_READ_LOCATION_3) 147 147 snandc->regs->read_location3 = locreg_val; 148 148 } ··· 1307 1307 snandc->qspi->addr1 = cpu_to_le32(s_op.addr1_reg << 16); 1308 1308 snandc->qspi->addr2 = cpu_to_le32(s_op.addr2_reg); 1309 1309 snandc->qspi->cmd = cpu_to_le32(cmd); 1310 - qcom_spi_block_erase(snandc); 1311 - return 0; 1310 + return qcom_spi_block_erase(snandc); 1312 1311 default: 1313 1312 break; 1314 1313 }
+4
drivers/spi/spi-stm32-ospi.c
··· 960 960 err_pm_enable: 961 961 pm_runtime_force_suspend(ospi->dev); 962 962 mutex_destroy(&ospi->lock); 963 + if (ospi->dma_chtx) 964 + dma_release_channel(ospi->dma_chtx); 965 + if (ospi->dma_chrx) 966 + dma_release_channel(ospi->dma_chrx); 963 967 964 968 return ret; 965 969 }
+3 -3
drivers/spi/spi-tegra114.c
··· 728 728 u32 inactive_cycles; 729 729 u8 cs_state; 730 730 731 - if (setup->unit != SPI_DELAY_UNIT_SCK || 732 - hold->unit != SPI_DELAY_UNIT_SCK || 733 - inactive->unit != SPI_DELAY_UNIT_SCK) { 731 + if ((setup->unit && setup->unit != SPI_DELAY_UNIT_SCK) || 732 + (hold->unit && hold->unit != SPI_DELAY_UNIT_SCK) || 733 + (inactive->unit && inactive->unit != SPI_DELAY_UNIT_SCK)) { 734 734 dev_err(&spi->dev, 735 735 "Invalid delay unit %d, should be SPI_DELAY_UNIT_SCK\n", 736 736 SPI_DELAY_UNIT_SCK);