Skip to content

Commit 30eb2e6

Browse files
miquelraynalbroonie
authored andcommitted
spi: zynqmp-gqspi: Support per spi-mem operation frequency switches
Every ->exec_op() call correctly configures the spi bus speed to the maximum allowed frequency for the memory using the constant spi default parameter. Since we can now have per-operation constraints, let's use the value that comes from the spi-mem operation structure instead. In case there is no specific limitation for this operation, the default spi device value will be given anyway. The per-operation frequency capability is thus advertised to the spi-mem core. Cc: Michal Simek <michal.simek@amd.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20241224-winbond-6-11-rc1-quad-support-v2-17-ad218dbc406f@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 9a68f6c commit 30eb2e6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/spi/spi-zynqmp-gqspi.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ static inline u32 zynqmp_qspi_selectspimode(struct zynqmp_qspi *xqspi,
535535
* zynqmp_qspi_config_op - Configure QSPI controller for specified
536536
* transfer
537537
* @xqspi: Pointer to the zynqmp_qspi structure
538-
* @qspi: Pointer to the spi_device structure
538+
* @op: The memory operation to execute
539539
*
540540
* Sets the operational mode of QSPI controller for the next QSPI transfer and
541541
* sets the requested clock frequency.
@@ -553,12 +553,12 @@ static inline u32 zynqmp_qspi_selectspimode(struct zynqmp_qspi *xqspi,
553553
* frequency supported by controller.
554554
*/
555555
static int zynqmp_qspi_config_op(struct zynqmp_qspi *xqspi,
556-
struct spi_device *qspi)
556+
const struct spi_mem_op *op)
557557
{
558558
ulong clk_rate;
559559
u32 config_reg, req_speed_hz, baud_rate_val = 0;
560560

561-
req_speed_hz = qspi->max_speed_hz;
561+
req_speed_hz = op->max_freq;
562562

563563
if (xqspi->speed_hz != req_speed_hz) {
564564
xqspi->speed_hz = req_speed_hz;
@@ -1072,7 +1072,7 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem,
10721072
op->dummy.buswidth, op->data.buswidth);
10731073

10741074
mutex_lock(&xqspi->op_lock);
1075-
zynqmp_qspi_config_op(xqspi, mem->spi);
1075+
zynqmp_qspi_config_op(xqspi, op);
10761076
zynqmp_qspi_chipselect(mem->spi, false);
10771077
genfifoentry |= xqspi->genfifocs;
10781078
genfifoentry |= xqspi->genfifobus;
@@ -1224,6 +1224,10 @@ static const struct spi_controller_mem_ops zynqmp_qspi_mem_ops = {
12241224
.exec_op = zynqmp_qspi_exec_op,
12251225
};
12261226

1227+
static const struct spi_controller_mem_caps zynqmp_qspi_mem_caps = {
1228+
.per_op_freq = true,
1229+
};
1230+
12271231
/**
12281232
* zynqmp_qspi_probe - Probe method for the QSPI driver
12291233
* @pdev: Pointer to the platform_device structure
@@ -1333,6 +1337,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
13331337

13341338
ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
13351339
ctlr->mem_ops = &zynqmp_qspi_mem_ops;
1340+
ctlr->mem_caps = &zynqmp_qspi_mem_caps;
13361341
ctlr->setup = zynqmp_qspi_setup_op;
13371342
ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
13381343
ctlr->dev.of_node = np;

0 commit comments

Comments
 (0)