Skip to content

Commit b7cc281

Browse files
committed
spi: Merge up fixes
Silly add/add conflict in the Cadence QuadSPI driver.
2 parents a17162f + 25fb0e7 commit b7cc281

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

drivers/spi/spi-aspeed-smc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static ssize_t aspeed_spi_read_user(struct aspeed_spi_chip *chip,
239239

240240
ret = aspeed_spi_send_cmd_addr(chip, op->addr.nbytes, offset, op->cmd.opcode);
241241
if (ret < 0)
242-
return ret;
242+
goto stop_user;
243243

244244
if (op->dummy.buswidth && op->dummy.nbytes) {
245245
for (i = 0; i < op->dummy.nbytes / op->dummy.buswidth; i++)
@@ -249,8 +249,9 @@ static ssize_t aspeed_spi_read_user(struct aspeed_spi_chip *chip,
249249
aspeed_spi_set_io_mode(chip, io_mode);
250250

251251
aspeed_spi_read_from_ahb(buf, chip->ahb_base, len);
252+
stop_user:
252253
aspeed_spi_stop_user(chip);
253-
return 0;
254+
return ret;
254255
}
255256

256257
static ssize_t aspeed_spi_write_user(struct aspeed_spi_chip *chip,
@@ -261,10 +262,11 @@ static ssize_t aspeed_spi_write_user(struct aspeed_spi_chip *chip,
261262
aspeed_spi_start_user(chip);
262263
ret = aspeed_spi_send_cmd_addr(chip, op->addr.nbytes, op->addr.val, op->cmd.opcode);
263264
if (ret < 0)
264-
return ret;
265+
goto stop_user;
265266
aspeed_spi_write_to_ahb(chip->ahb_base, op->data.buf.out, op->data.nbytes);
267+
stop_user:
266268
aspeed_spi_stop_user(chip);
267-
return 0;
269+
return ret;
268270
}
269271

270272
/* support for 1-1-1, 1-1-2 or 1-1-4 */

drivers/spi/spi-cadence-quadspi.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ static_assert(CQSPI_MAX_CHIPSELECT <= SPI_CS_CNT_MAX);
4545
#define CQSPI_RD_NO_IRQ BIT(6)
4646
#define CQSPI_DMA_SET_MASK BIT(7)
4747
#define CQSPI_SUPPORT_DEVICE_RESET BIT(8)
48+
#define CQSPI_DISABLE_STIG_MODE BIT(9)
4849

4950
/* Capabilities */
5051
#define CQSPI_SUPPORTS_OCTAL BIT(0)
@@ -105,6 +106,7 @@ struct cqspi_st {
105106
bool apb_ahb_hazard;
106107

107108
bool is_jh7110; /* Flag for StarFive JH7110 SoC */
109+
bool disable_stig_mode;
108110

109111
const struct cqspi_driver_platdata *ddata;
110112
};
@@ -1439,7 +1441,8 @@ static int cqspi_mem_process(struct spi_mem *mem, const struct spi_mem_op *op)
14391441
* reads, prefer STIG mode for such small reads.
14401442
*/
14411443
if (!op->addr.nbytes ||
1442-
op->data.nbytes <= CQSPI_STIG_DATA_LEN_MAX)
1444+
(op->data.nbytes <= CQSPI_STIG_DATA_LEN_MAX &&
1445+
!cqspi->disable_stig_mode))
14431446
return cqspi_command_read(f_pdata, op);
14441447

14451448
return cqspi_read(f_pdata, op);
@@ -1903,6 +1906,8 @@ static int cqspi_probe(struct platform_device *pdev)
19031906
if (ret)
19041907
goto probe_reset_failed;
19051908
}
1909+
if (ddata->quirks & CQSPI_DISABLE_STIG_MODE)
1910+
cqspi->disable_stig_mode = true;
19061911

19071912
if (ddata->quirks & CQSPI_DMA_SET_MASK) {
19081913
ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
@@ -2068,7 +2073,8 @@ static const struct cqspi_driver_platdata intel_lgm_qspi = {
20682073
static const struct cqspi_driver_platdata socfpga_qspi = {
20692074
.quirks = CQSPI_DISABLE_DAC_MODE
20702075
| CQSPI_NO_SUPPORT_WR_COMPLETION
2071-
| CQSPI_SLOW_SRAM,
2076+
| CQSPI_SLOW_SRAM
2077+
| CQSPI_DISABLE_STIG_MODE,
20722078
};
20732079

20742080
static const struct cqspi_driver_platdata versal_ospi = {

drivers/spi/spi-rockchip.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,20 @@ static void rockchip_spi_set_cs(struct spi_device *spi, bool enable)
241241
struct spi_controller *ctlr = spi->controller;
242242
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
243243
bool cs_asserted = spi->mode & SPI_CS_HIGH ? enable : !enable;
244+
bool cs_actual;
245+
246+
/*
247+
* SPI subsystem tries to avoid no-op calls that would break the PM
248+
* refcount below. It can't however for the first time it is used.
249+
* To detect this case we read it here and bail out early for no-ops.
250+
*/
251+
if (spi_get_csgpiod(spi, 0))
252+
cs_actual = !!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SER) & 1);
253+
else
254+
cs_actual = !!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SER) &
255+
BIT(spi_get_chipselect(spi, 0)));
256+
if (unlikely(cs_actual == cs_asserted))
257+
return;
244258

245259
if (cs_asserted) {
246260
/* Keep things powered as long as CS is asserted */

0 commit comments

Comments
 (0)