Commit 3949ba3b authored by Mark Brown's avatar Mark Brown

Merge branch 'spi-5.1' into spi-5.2 for stm32

parents 6d850281 5356c2c7
...@@ -1501,7 +1501,7 @@ static int spi_imx_transfer(struct spi_device *spi, ...@@ -1501,7 +1501,7 @@ static int spi_imx_transfer(struct spi_device *spi,
/* flush rxfifo before transfer */ /* flush rxfifo before transfer */
while (spi_imx->devtype_data->rx_available(spi_imx)) 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) if (spi_imx->slave_mode)
return spi_imx_pio_transfer_slave(spi, transfer); 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) ...@@ -271,7 +271,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size)
/* Sets parity, interrupt mask */ /* Sets parity, interrupt mask */
rspi_write8(rspi, 0x00, RSPI_SPCR2); 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->spcmd |= SPCMD_SPB_8_TO_16(access_size);
rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); 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) ...@@ -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_SSLND);
rspi_write8(rspi, 0x00, RSPI_SPND); 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->spcmd |= SPCMD_SPB_8_TO_16(access_size);
rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0);
...@@ -366,7 +368,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size) ...@@ -366,7 +368,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size)
/* Sets buffer to allow normal operation */ /* Sets buffer to allow normal operation */
rspi_write8(rspi, 0x00, QSPI_SPBFCR); rspi_write8(rspi, 0x00, QSPI_SPBFCR);
/* Sets SPCMD */ /* Resets sequencer */
rspi_write8(rspi, 0, RSPI_SPSCR);
rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0);
/* Sets RSPI mode */ /* Sets RSPI mode */
...@@ -868,28 +871,6 @@ static int qspi_transfer_one(struct spi_controller *ctlr, ...@@ -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) static u16 qspi_transfer_mode(const struct spi_transfer *xfer)
{ {
if (xfer->tx_buf) if (xfer->tx_buf)
...@@ -959,8 +940,24 @@ static int rspi_prepare_message(struct spi_controller *ctlr, ...@@ -959,8 +940,24 @@ static int rspi_prepare_message(struct spi_controller *ctlr,
struct spi_message *msg) struct spi_message *msg)
{ {
struct rspi_data *rspi = spi_controller_get_devdata(ctlr); struct rspi_data *rspi = spi_controller_get_devdata(ctlr);
struct spi_device *spi = msg->spi;
int ret; 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 & if (msg->spi->mode &
(SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD)) { (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD)) {
/* Setup sequencer for messages with multiple transfer modes */ /* Setup sequencer for messages with multiple transfer modes */
...@@ -1267,7 +1264,6 @@ static int rspi_probe(struct platform_device *pdev) ...@@ -1267,7 +1264,6 @@ static int rspi_probe(struct platform_device *pdev)
init_waitqueue_head(&rspi->wait); init_waitqueue_head(&rspi->wait);
ctlr->bus_num = pdev->id; ctlr->bus_num = pdev->id;
ctlr->setup = rspi_setup;
ctlr->auto_runtime_pm = true; ctlr->auto_runtime_pm = true;
ctlr->transfer_one = ops->transfer_one; ctlr->transfer_one = ops->transfer_one;
ctlr->prepare_message = rspi_prepare_message; ctlr->prepare_message = rspi_prepare_message;
......
...@@ -76,7 +76,6 @@ ...@@ -76,7 +76,6 @@
#define QSPI_PSMAR 0x28 #define QSPI_PSMAR 0x28
#define QSPI_PIR 0x2c #define QSPI_PIR 0x2c
#define QSPI_LPTR 0x30 #define QSPI_LPTR 0x30
#define LPTR_DFT_TIMEOUT 0x10
#define STM32_QSPI_MAX_MMAP_SZ SZ_256M #define STM32_QSPI_MAX_MMAP_SZ SZ_256M
#define STM32_QSPI_MAX_NORCHIP 2 #define STM32_QSPI_MAX_NORCHIP 2
...@@ -372,8 +371,7 @@ static int stm32_qspi_setup(struct spi_device *spi) ...@@ -372,8 +371,7 @@ static int stm32_qspi_setup(struct spi_device *spi)
flash->presc = presc; flash->presc = presc;
mutex_lock(&qspi->lock); mutex_lock(&qspi->lock);
writel_relaxed(LPTR_DFT_TIMEOUT, qspi->io_base + QSPI_LPTR); cr = FIELD_PREP(CR_FTHRES_MASK, 3) | CR_SSHIFT | CR_EN;
cr = FIELD_PREP(CR_FTHRES_MASK, 3) | CR_TCEN | CR_SSHIFT | CR_EN;
writel_relaxed(cr, qspi->io_base + QSPI_CR); writel_relaxed(cr, qspi->io_base + QSPI_CR);
/* set dcr fsize to max address */ /* set dcr fsize to max address */
......
...@@ -1039,6 +1039,8 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) ...@@ -1039,6 +1039,8 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
if (max_tx || max_rx) { if (max_tx || max_rx) {
list_for_each_entry(xfer, &msg->transfers, list_for_each_entry(xfer, &msg->transfers,
transfer_list) { transfer_list) {
if (!xfer->len)
continue;
if (!xfer->tx_buf) if (!xfer->tx_buf)
xfer->tx_buf = ctlr->dummy_tx; xfer->tx_buf = ctlr->dummy_tx;
if (!xfer->rx_buf) if (!xfer->rx_buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment