Skip to content

Commit 4850f15

Browse files
james-c-linarobroonie
authored andcommitted
spi: spi-fsl-dspi: Stub out DMA functions
In a later commit we'll use dma_alloc_noncoherent() which isn't stubbed out for builds without CONFIG_DMA_ENGINE and results in the following build error: spi-fsl-dspi.c:(.text+0x644): undefined reference to `dma_free_pages' m68k-linux-ld: spi-fsl-dspi.c:(.text+0x67a): undefined reference to `dma_free_pages' To continue to support devices that only need XSPI mode and so that randconfig builds work, stub out DMA functionality in the DSPI driver. Although older parts of the DMA API have their own stubs, it's intentional that newer parts don't follow the same pattern. Therefore individual drivers should not compile in calls unless CONFIG_DMA_ENGINE is set. Link: https://lore.kernel.org/oe-kbuild-all/202506160036.t9VDxF6p-lkp@intel.com/ Signed-off-by: James Clark <james.clark@linaro.org> Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Message-ID: <20250902-james-nxp-spi-dma-v6-3-f7aa2c5e56e2@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5484440 commit 4850f15

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

drivers/spi/spi-fsl-dspi.c

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ struct fsl_dspi {
373373
void (*dev_to_host)(struct fsl_dspi *dspi, u32 rxdata);
374374
};
375375

376+
static void dspi_setup_accel(struct fsl_dspi *dspi);
377+
376378
static bool is_s32g_dspi(struct fsl_dspi *data)
377379
{
378380
return data->devtype_data == &devtype_data[S32G] ||
@@ -468,6 +470,16 @@ static u32 dspi_pop_tx(struct fsl_dspi *dspi)
468470
return txdata;
469471
}
470472

473+
/* Push one word to the RX buffer from the POPR register (RX FIFO) */
474+
static void dspi_push_rx(struct fsl_dspi *dspi, u32 rxdata)
475+
{
476+
if (!dspi->rx)
477+
return;
478+
dspi->dev_to_host(dspi, rxdata);
479+
}
480+
481+
#if IS_ENABLED(CONFIG_DMA_ENGINE)
482+
471483
/* Prepare one TX FIFO entry (txdata plus cmd) */
472484
static u32 dspi_pop_tx_pushr(struct fsl_dspi *dspi)
473485
{
@@ -481,14 +493,6 @@ static u32 dspi_pop_tx_pushr(struct fsl_dspi *dspi)
481493
return cmd << 16 | data;
482494
}
483495

484-
/* Push one word to the RX buffer from the POPR register (RX FIFO) */
485-
static void dspi_push_rx(struct fsl_dspi *dspi, u32 rxdata)
486-
{
487-
if (!dspi->rx)
488-
return;
489-
dspi->dev_to_host(dspi, rxdata);
490-
}
491-
492496
static void dspi_tx_dma_callback(void *arg)
493497
{
494498
struct fsl_dspi *dspi = arg;
@@ -589,8 +593,6 @@ static int dspi_next_xfer_dma_submit(struct fsl_dspi *dspi)
589593
return 0;
590594
}
591595

592-
static void dspi_setup_accel(struct fsl_dspi *dspi);
593-
594596
static void dspi_dma_xfer(struct fsl_dspi *dspi)
595597
{
596598
struct spi_message *message = dspi->cur_msg;
@@ -722,6 +724,18 @@ static void dspi_release_dma(struct fsl_dspi *dspi)
722724
dma_release_channel(dma->chan_rx);
723725
}
724726
}
727+
#else
728+
static void dspi_dma_xfer(struct fsl_dspi *dspi)
729+
{
730+
dspi->cur_msg->status = -EINVAL;
731+
}
732+
static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
733+
{
734+
dev_err(&dspi->pdev->dev, "DMA support not enabled in kernel\n");
735+
return -EINVAL;
736+
}
737+
static void dspi_release_dma(struct fsl_dspi *dspi) {}
738+
#endif
725739

726740
static void hz_to_spi_baud(char *pbr, char *br, int speed_hz,
727741
unsigned long clkrate, bool mtf_enabled)

0 commit comments

Comments
 (0)