Skip to content

Commit 26851cf

Browse files
miquelraynalbroonie
authored andcommitted
spi: nxp-fspi: 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: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://patch.msgid.link/20241224-winbond-6-11-rc1-quad-support-v2-12-ad218dbc406f@bootlin.com Signed-off-by: Mark Brown <[email protected]>
1 parent 67707cb commit 26851cf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/spi/spi-nxp-fspi.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,10 @@ static void nxp_fspi_dll_calibration(struct nxp_fspi *f)
705705
* Value for rest of the CS FLSHxxCR0 register would be zero.
706706
*
707707
*/
708-
static void nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi)
708+
static void nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi,
709+
const struct spi_mem_op *op)
709710
{
710-
unsigned long rate = spi->max_speed_hz;
711+
unsigned long rate = op->max_freq;
711712
int ret;
712713
uint64_t size_kb;
713714

@@ -931,7 +932,7 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
931932
FSPI_STS0_ARB_IDLE, 1, POLL_TOUT, true);
932933
WARN_ON(err);
933934

934-
nxp_fspi_select_mem(f, mem->spi);
935+
nxp_fspi_select_mem(f, mem->spi, op);
935936

936937
nxp_fspi_prepare_lut(f, op);
937938
/*
@@ -1149,6 +1150,10 @@ static const struct spi_controller_mem_ops nxp_fspi_mem_ops = {
11491150
.get_name = nxp_fspi_get_name,
11501151
};
11511152

1153+
static const struct spi_controller_mem_caps nxp_fspi_mem_caps = {
1154+
.per_op_freq = true,
1155+
};
1156+
11521157
static int nxp_fspi_probe(struct platform_device *pdev)
11531158
{
11541159
struct spi_controller *ctlr;
@@ -1246,6 +1251,7 @@ static int nxp_fspi_probe(struct platform_device *pdev)
12461251
ctlr->bus_num = -1;
12471252
ctlr->num_chipselect = NXP_FSPI_MAX_CHIPSELECT;
12481253
ctlr->mem_ops = &nxp_fspi_mem_ops;
1254+
ctlr->mem_caps = &nxp_fspi_mem_caps;
12491255

12501256
nxp_fspi_default_setup(f);
12511257

0 commit comments

Comments
 (0)