Merge branch 'spi-5.1' into spi-5.2 for stm32
This commit is contained in:
commit
3949ba3b37
@ -1501,7 +1501,7 @@ static int spi_imx_transfer(struct spi_device *spi,
|
||||
|
||||
/* flush rxfifo before transfer */
|
||||
while (spi_imx->devtype_data->rx_available(spi_imx))
|
||||
spi_imx->rx(spi_imx);
|
||||
readl(spi_imx->base + MXC_CSPIRXDATA);
|
||||
|
||||
if (spi_imx->slave_mode)
|
||||
return spi_imx_pio_transfer_slave(spi, transfer);
|
||||
|
@ -271,7 +271,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size)
|
||||
/* Sets parity, interrupt mask */
|
||||
rspi_write8(rspi, 0x00, RSPI_SPCR2);
|
||||
|
||||
/* Sets SPCMD */
|
||||
/* Resets sequencer */
|
||||
rspi_write8(rspi, 0, RSPI_SPSCR);
|
||||
rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size);
|
||||
rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0);
|
||||
|
||||
@ -315,7 +316,8 @@ static int rspi_rz_set_config_register(struct rspi_data *rspi, int access_size)
|
||||
rspi_write8(rspi, 0x00, RSPI_SSLND);
|
||||
rspi_write8(rspi, 0x00, RSPI_SPND);
|
||||
|
||||
/* Sets SPCMD */
|
||||
/* Resets sequencer */
|
||||
rspi_write8(rspi, 0, RSPI_SPSCR);
|
||||
rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size);
|
||||
rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0);
|
||||
|
||||
@ -366,7 +368,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size)
|
||||
/* Sets buffer to allow normal operation */
|
||||
rspi_write8(rspi, 0x00, QSPI_SPBFCR);
|
||||
|
||||
/* Sets SPCMD */
|
||||
/* Resets sequencer */
|
||||
rspi_write8(rspi, 0, RSPI_SPSCR);
|
||||
rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0);
|
||||
|
||||
/* Sets RSPI mode */
|
||||
@ -868,28 +871,6 @@ static int qspi_transfer_one(struct spi_controller *ctlr,
|
||||
}
|
||||
}
|
||||
|
||||
static int rspi_setup(struct spi_device *spi)
|
||||
{
|
||||
struct rspi_data *rspi = spi_controller_get_devdata(spi->controller);
|
||||
|
||||
rspi->max_speed_hz = spi->max_speed_hz;
|
||||
|
||||
rspi->spcmd = SPCMD_SSLKP;
|
||||
if (spi->mode & SPI_CPOL)
|
||||
rspi->spcmd |= SPCMD_CPOL;
|
||||
if (spi->mode & SPI_CPHA)
|
||||
rspi->spcmd |= SPCMD_CPHA;
|
||||
|
||||
/* CMOS output mode and MOSI signal from previous transfer */
|
||||
rspi->sppcr = 0;
|
||||
if (spi->mode & SPI_LOOP)
|
||||
rspi->sppcr |= SPPCR_SPLP;
|
||||
|
||||
set_config_register(rspi, 8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u16 qspi_transfer_mode(const struct spi_transfer *xfer)
|
||||
{
|
||||
if (xfer->tx_buf)
|
||||
@ -959,8 +940,24 @@ static int rspi_prepare_message(struct spi_controller *ctlr,
|
||||
struct spi_message *msg)
|
||||
{
|
||||
struct rspi_data *rspi = spi_controller_get_devdata(ctlr);
|
||||
struct spi_device *spi = msg->spi;
|
||||
int ret;
|
||||
|
||||
rspi->max_speed_hz = spi->max_speed_hz;
|
||||
|
||||
rspi->spcmd = SPCMD_SSLKP;
|
||||
if (spi->mode & SPI_CPOL)
|
||||
rspi->spcmd |= SPCMD_CPOL;
|
||||
if (spi->mode & SPI_CPHA)
|
||||
rspi->spcmd |= SPCMD_CPHA;
|
||||
|
||||
/* CMOS output mode and MOSI signal from previous transfer */
|
||||
rspi->sppcr = 0;
|
||||
if (spi->mode & SPI_LOOP)
|
||||
rspi->sppcr |= SPPCR_SPLP;
|
||||
|
||||
set_config_register(rspi, 8);
|
||||
|
||||
if (msg->spi->mode &
|
||||
(SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD)) {
|
||||
/* Setup sequencer for messages with multiple transfer modes */
|
||||
@ -1267,7 +1264,6 @@ static int rspi_probe(struct platform_device *pdev)
|
||||
init_waitqueue_head(&rspi->wait);
|
||||
|
||||
ctlr->bus_num = pdev->id;
|
||||
ctlr->setup = rspi_setup;
|
||||
ctlr->auto_runtime_pm = true;
|
||||
ctlr->transfer_one = ops->transfer_one;
|
||||
ctlr->prepare_message = rspi_prepare_message;
|
||||
|
@ -76,7 +76,6 @@
|
||||
#define QSPI_PSMAR 0x28
|
||||
#define QSPI_PIR 0x2c
|
||||
#define QSPI_LPTR 0x30
|
||||
#define LPTR_DFT_TIMEOUT 0x10
|
||||
|
||||
#define STM32_QSPI_MAX_MMAP_SZ SZ_256M
|
||||
#define STM32_QSPI_MAX_NORCHIP 2
|
||||
@ -372,8 +371,7 @@ static int stm32_qspi_setup(struct spi_device *spi)
|
||||
flash->presc = presc;
|
||||
|
||||
mutex_lock(&qspi->lock);
|
||||
writel_relaxed(LPTR_DFT_TIMEOUT, qspi->io_base + QSPI_LPTR);
|
||||
cr = FIELD_PREP(CR_FTHRES_MASK, 3) | CR_TCEN | CR_SSHIFT | CR_EN;
|
||||
cr = FIELD_PREP(CR_FTHRES_MASK, 3) | CR_SSHIFT | CR_EN;
|
||||
writel_relaxed(cr, qspi->io_base + QSPI_CR);
|
||||
|
||||
/* set dcr fsize to max address */
|
||||
|
@ -1039,6 +1039,8 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
|
||||
if (max_tx || max_rx) {
|
||||
list_for_each_entry(xfer, &msg->transfers,
|
||||
transfer_list) {
|
||||
if (!xfer->len)
|
||||
continue;
|
||||
if (!xfer->tx_buf)
|
||||
xfer->tx_buf = ctlr->dummy_tx;
|
||||
if (!xfer->rx_buf)
|
||||
|
Loading…
Reference in New Issue
Block a user