Skip to content

Commit 95d3481

Browse files
committed
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()
2 parents b6a218f + 4426e6b commit 95d3481

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,18 @@ properties:
5656
enum:
5757
- snps,dw-apb-ssi
5858
- 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
6559
- description: Microchip Sparx5 SoC SPI Controller
6660
const: microchip,sparx5-spi
6761
- description: Amazon Alpine SPI Controller
6862
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
7064
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
7271
- const: snps,dw-apb-ssi
7372
- description: Intel Keem Bay SPI Controller
7473
const: intel,keembay-ssi
@@ -88,10 +87,6 @@ properties:
8887
- renesas,r9a06g032-spi # RZ/N1D
8988
- renesas,r9a06g033-spi # RZ/N1S
9089
- const: renesas,rzn1-spi # RZ/N1
91-
- description: T-HEAD TH1520 SoC SPI Controller
92-
items:
93-
- const: thead,th1520-spi
94-
- const: snps,dw-apb-ssi
9590

9691
reg:
9792
minItems: 1

drivers/spi/spi-mem.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,11 @@ u64 spi_mem_calc_op_duration(struct spi_mem_op *op)
596596
ns_per_cycles = 1000000000 / op->max_freq;
597597
ncycles += ((op->cmd.nbytes * 8) / op->cmd.buswidth) / (op->cmd.dtr ? 2 : 1);
598598
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+
600604
ncycles += ((op->data.nbytes * 8) / op->data.buswidth) / (op->data.dtr ? 2 : 1);
601605

602606
return ncycles * ns_per_cycles;

drivers/spi/spi-qpic-snand.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void qcom_spi_set_read_loc_first(struct qcom_nand_controller *snandc,
142142
else if (reg == NAND_READ_LOCATION_1)
143143
snandc->regs->read_location1 = locreg_val;
144144
else if (reg == NAND_READ_LOCATION_2)
145-
snandc->regs->read_location1 = locreg_val;
145+
snandc->regs->read_location2 = locreg_val;
146146
else if (reg == NAND_READ_LOCATION_3)
147147
snandc->regs->read_location3 = locreg_val;
148148
}
@@ -1307,8 +1307,7 @@ static int qcom_spi_send_cmdaddr(struct qcom_nand_controller *snandc,
13071307
snandc->qspi->addr1 = cpu_to_le32(s_op.addr1_reg << 16);
13081308
snandc->qspi->addr2 = cpu_to_le32(s_op.addr2_reg);
13091309
snandc->qspi->cmd = cpu_to_le32(cmd);
1310-
qcom_spi_block_erase(snandc);
1311-
return 0;
1310+
return qcom_spi_block_erase(snandc);
13121311
default:
13131312
break;
13141313
}

drivers/spi/spi-stm32-ospi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,10 @@ static int stm32_ospi_probe(struct platform_device *pdev)
960960
err_pm_enable:
961961
pm_runtime_force_suspend(ospi->dev);
962962
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);
963967

964968
return ret;
965969
}

drivers/spi/spi-tegra114.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,9 @@ static int tegra_spi_set_hw_cs_timing(struct spi_device *spi)
728728
u32 inactive_cycles;
729729
u8 cs_state;
730730

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)) {
734734
dev_err(&spi->dev,
735735
"Invalid delay unit %d, should be SPI_DELAY_UNIT_SCK\n",
736736
SPI_DELAY_UNIT_SCK);

0 commit comments

Comments
 (0)