Skip to content

Commit

Permalink
Merge tag 'spi-fix-v6.15-rc4' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/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()
  • Loading branch information
Linus Torvalds committed May 2, 2025
2 parents b6a218f + 4426e6b commit 95d3481
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
19 changes: 7 additions & 12 deletions Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,18 @@ properties:
enum:
- snps,dw-apb-ssi
- snps,dwc-ssi-1.01a
- description: Microsemi Ocelot/Jaguar2 SoC SPI Controller
items:
- enum:
- mscc,ocelot-spi
- mscc,jaguar2-spi
- const: snps,dw-apb-ssi
- description: Microchip Sparx5 SoC SPI Controller
const: microchip,sparx5-spi
- description: Amazon Alpine SPI Controller
const: amazon,alpine-dw-apb-ssi
- description: Renesas RZ/N1 SPI Controller
- description: Vendor controllers which use snps,dw-apb-ssi as fallback
items:
- const: renesas,rzn1-spi
- enum:
- mscc,ocelot-spi
- mscc,jaguar2-spi
- renesas,rzn1-spi
- sophgo,sg2042-spi
- thead,th1520-spi
- const: snps,dw-apb-ssi
- description: Intel Keem Bay SPI Controller
const: intel,keembay-ssi
Expand All @@ -88,10 +87,6 @@ properties:
- renesas,r9a06g032-spi # RZ/N1D
- renesas,r9a06g033-spi # RZ/N1S
- const: renesas,rzn1-spi # RZ/N1
- description: T-HEAD TH1520 SoC SPI Controller
items:
- const: thead,th1520-spi
- const: snps,dw-apb-ssi

reg:
minItems: 1
Expand Down
6 changes: 5 additions & 1 deletion drivers/spi/spi-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,11 @@ u64 spi_mem_calc_op_duration(struct spi_mem_op *op)
ns_per_cycles = 1000000000 / op->max_freq;
ncycles += ((op->cmd.nbytes * 8) / op->cmd.buswidth) / (op->cmd.dtr ? 2 : 1);
ncycles += ((op->addr.nbytes * 8) / op->addr.buswidth) / (op->addr.dtr ? 2 : 1);
ncycles += ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1);

/* Dummy bytes are optional for some SPI flash memory operations */
if (op->dummy.nbytes)
ncycles += ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1);

ncycles += ((op->data.nbytes * 8) / op->data.buswidth) / (op->data.dtr ? 2 : 1);

return ncycles * ns_per_cycles;
Expand Down
5 changes: 2 additions & 3 deletions drivers/spi/spi-qpic-snand.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static void qcom_spi_set_read_loc_first(struct qcom_nand_controller *snandc,
else if (reg == NAND_READ_LOCATION_1)
snandc->regs->read_location1 = locreg_val;
else if (reg == NAND_READ_LOCATION_2)
snandc->regs->read_location1 = locreg_val;
snandc->regs->read_location2 = locreg_val;
else if (reg == NAND_READ_LOCATION_3)
snandc->regs->read_location3 = locreg_val;
}
Expand Down Expand Up @@ -1307,8 +1307,7 @@ static int qcom_spi_send_cmdaddr(struct qcom_nand_controller *snandc,
snandc->qspi->addr1 = cpu_to_le32(s_op.addr1_reg << 16);
snandc->qspi->addr2 = cpu_to_le32(s_op.addr2_reg);
snandc->qspi->cmd = cpu_to_le32(cmd);
qcom_spi_block_erase(snandc);
return 0;
return qcom_spi_block_erase(snandc);
default:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/spi/spi-stm32-ospi.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,10 @@ static int stm32_ospi_probe(struct platform_device *pdev)
err_pm_enable:
pm_runtime_force_suspend(ospi->dev);
mutex_destroy(&ospi->lock);
if (ospi->dma_chtx)
dma_release_channel(ospi->dma_chtx);
if (ospi->dma_chrx)
dma_release_channel(ospi->dma_chrx);

return ret;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/spi/spi-tegra114.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,9 +728,9 @@ static int tegra_spi_set_hw_cs_timing(struct spi_device *spi)
u32 inactive_cycles;
u8 cs_state;

if (setup->unit != SPI_DELAY_UNIT_SCK ||
hold->unit != SPI_DELAY_UNIT_SCK ||
inactive->unit != SPI_DELAY_UNIT_SCK) {
if ((setup->unit && setup->unit != SPI_DELAY_UNIT_SCK) ||
(hold->unit && hold->unit != SPI_DELAY_UNIT_SCK) ||
(inactive->unit && inactive->unit != SPI_DELAY_UNIT_SCK)) {
dev_err(&spi->dev,
"Invalid delay unit %d, should be SPI_DELAY_UNIT_SCK\n",
SPI_DELAY_UNIT_SCK);
Expand Down

0 comments on commit 95d3481

Please sign in to comment.