Commit 741b31df authored by Mark Brown's avatar Mark Brown

spi: Merge up fixes

We need the fixes to apply new changes to the Cirrus drivers.
parents 78b05172 df75470b
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <linux/units.h> #include <linux/units.h>
#define CS42L43_FIFO_SIZE 16 #define CS42L43_FIFO_SIZE 16
#define CS42L43_SPI_ROOT_HZ (40 * HZ_PER_MHZ) #define CS42L43_SPI_ROOT_HZ 49152000
#define CS42L43_SPI_MAX_LENGTH 65532 #define CS42L43_SPI_MAX_LENGTH 65532
enum cs42l43_spi_cmd { enum cs42l43_spi_cmd {
...@@ -54,7 +54,7 @@ static const struct software_node ampr = { ...@@ -54,7 +54,7 @@ static const struct software_node ampr = {
static struct spi_board_info ampl_info = { static struct spi_board_info ampl_info = {
.modalias = "cs35l56", .modalias = "cs35l56",
.max_speed_hz = 20 * HZ_PER_MHZ, .max_speed_hz = 11 * HZ_PER_MHZ,
.chip_select = 0, .chip_select = 0,
.mode = SPI_MODE_0, .mode = SPI_MODE_0,
.swnode = &ampl, .swnode = &ampl,
...@@ -62,7 +62,7 @@ static struct spi_board_info ampl_info = { ...@@ -62,7 +62,7 @@ static struct spi_board_info ampl_info = {
static struct spi_board_info ampr_info = { static struct spi_board_info ampr_info = {
.modalias = "cs35l56", .modalias = "cs35l56",
.max_speed_hz = 20 * HZ_PER_MHZ, .max_speed_hz = 11 * HZ_PER_MHZ,
.chip_select = 1, .chip_select = 1,
.mode = SPI_MODE_0, .mode = SPI_MODE_0,
.swnode = &ampr, .swnode = &ampr,
......
...@@ -660,18 +660,8 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, ...@@ -660,18 +660,8 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
ctrl |= (spi_imx->target_burst * 8 - 1) ctrl |= (spi_imx->target_burst * 8 - 1)
<< MX51_ECSPI_CTRL_BL_OFFSET; << MX51_ECSPI_CTRL_BL_OFFSET;
else { else {
if (spi_imx->usedma) {
ctrl |= (spi_imx->bits_per_word - 1) ctrl |= (spi_imx->bits_per_word - 1)
<< MX51_ECSPI_CTRL_BL_OFFSET; << MX51_ECSPI_CTRL_BL_OFFSET;
} else {
if (spi_imx->count >= MX51_ECSPI_CTRL_MAX_BURST)
ctrl |= (MX51_ECSPI_CTRL_MAX_BURST * BITS_PER_BYTE - 1)
<< MX51_ECSPI_CTRL_BL_OFFSET;
else
ctrl |= (spi_imx->count / DIV_ROUND_UP(spi_imx->bits_per_word,
BITS_PER_BYTE) * spi_imx->bits_per_word - 1)
<< MX51_ECSPI_CTRL_BL_OFFSET;
}
} }
/* set clock speed */ /* set clock speed */
......
...@@ -349,7 +349,7 @@ static int stm32_qspi_wait_poll_status(struct stm32_qspi *qspi) ...@@ -349,7 +349,7 @@ static int stm32_qspi_wait_poll_status(struct stm32_qspi *qspi)
static int stm32_qspi_get_mode(u8 buswidth) static int stm32_qspi_get_mode(u8 buswidth)
{ {
if (buswidth == 4) if (buswidth >= 4)
return CCR_BUSWIDTH_4; return CCR_BUSWIDTH_4;
return buswidth; return buswidth;
...@@ -653,9 +653,7 @@ static int stm32_qspi_setup(struct spi_device *spi) ...@@ -653,9 +653,7 @@ static int stm32_qspi_setup(struct spi_device *spi)
return -EINVAL; return -EINVAL;
mode = spi->mode & (SPI_TX_OCTAL | SPI_RX_OCTAL); mode = spi->mode & (SPI_TX_OCTAL | SPI_RX_OCTAL);
if ((mode == SPI_TX_OCTAL || mode == SPI_RX_OCTAL) || if (mode && gpiod_count(qspi->dev, "cs") == -ENOENT) {
((mode == (SPI_TX_OCTAL | SPI_RX_OCTAL)) &&
gpiod_count(qspi->dev, "cs") == -ENOENT)) {
dev_err(qspi->dev, "spi-rx-bus-width\\/spi-tx-bus-width\\/cs-gpios\n"); dev_err(qspi->dev, "spi-rx-bus-width\\/spi-tx-bus-width\\/cs-gpios\n");
dev_err(qspi->dev, "configuration not supported\n"); dev_err(qspi->dev, "configuration not supported\n");
...@@ -676,10 +674,10 @@ static int stm32_qspi_setup(struct spi_device *spi) ...@@ -676,10 +674,10 @@ static int stm32_qspi_setup(struct spi_device *spi)
qspi->cr_reg = CR_APMS | 3 << CR_FTHRES_SHIFT | CR_SSHIFT | CR_EN; qspi->cr_reg = CR_APMS | 3 << CR_FTHRES_SHIFT | CR_SSHIFT | CR_EN;
/* /*
* Dual flash mode is only enable in case SPI_TX_OCTAL and SPI_TX_OCTAL * Dual flash mode is only enable in case SPI_TX_OCTAL or SPI_RX_OCTAL
* are both set in spi->mode and "cs-gpios" properties is found in DT * is set in spi->mode and "cs-gpios" properties is found in DT
*/ */
if (mode == (SPI_TX_OCTAL | SPI_RX_OCTAL)) { if (mode) {
qspi->cr_reg |= CR_DFM; qspi->cr_reg |= CR_DFM;
dev_dbg(qspi->dev, "Dual flash mode enable"); dev_dbg(qspi->dev, "Dual flash mode enable");
} }
......
...@@ -689,11 +689,13 @@ static int __spi_add_device(struct spi_device *spi) ...@@ -689,11 +689,13 @@ static int __spi_add_device(struct spi_device *spi)
* Make sure that multiple logical CS doesn't map to the same physical CS. * Make sure that multiple logical CS doesn't map to the same physical CS.
* For example, spi->chip_select[0] != spi->chip_select[1] and so on. * For example, spi->chip_select[0] != spi->chip_select[1] and so on.
*/ */
if (!spi_controller_is_target(ctlr)) {
for (idx = 0; idx < SPI_CS_CNT_MAX; idx++) { for (idx = 0; idx < SPI_CS_CNT_MAX; idx++) {
status = spi_dev_check_cs(dev, spi, idx, spi, idx + 1); status = spi_dev_check_cs(dev, spi, idx, spi, idx + 1);
if (status) if (status)
return status; return status;
} }
}
/* Set the bus ID string */ /* Set the bus ID string */
spi_dev_set_name(spi); spi_dev_set_name(spi);
...@@ -4132,7 +4134,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) ...@@ -4132,7 +4134,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
return -EINVAL; return -EINVAL;
if (xfer->tx_nbits != SPI_NBITS_SINGLE && if (xfer->tx_nbits != SPI_NBITS_SINGLE &&
xfer->tx_nbits != SPI_NBITS_DUAL && xfer->tx_nbits != SPI_NBITS_DUAL &&
xfer->tx_nbits != SPI_NBITS_QUAD) xfer->tx_nbits != SPI_NBITS_QUAD &&
xfer->tx_nbits != SPI_NBITS_OCTAL)
return -EINVAL; return -EINVAL;
if ((xfer->tx_nbits == SPI_NBITS_DUAL) && if ((xfer->tx_nbits == SPI_NBITS_DUAL) &&
!(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD))) !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD)))
...@@ -4147,7 +4150,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) ...@@ -4147,7 +4150,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
return -EINVAL; return -EINVAL;
if (xfer->rx_nbits != SPI_NBITS_SINGLE && if (xfer->rx_nbits != SPI_NBITS_SINGLE &&
xfer->rx_nbits != SPI_NBITS_DUAL && xfer->rx_nbits != SPI_NBITS_DUAL &&
xfer->rx_nbits != SPI_NBITS_QUAD) xfer->rx_nbits != SPI_NBITS_QUAD &&
xfer->rx_nbits != SPI_NBITS_OCTAL)
return -EINVAL; return -EINVAL;
if ((xfer->rx_nbits == SPI_NBITS_DUAL) && if ((xfer->rx_nbits == SPI_NBITS_DUAL) &&
!(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD))) !(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD)))
......
...@@ -1088,12 +1088,13 @@ struct spi_transfer { ...@@ -1088,12 +1088,13 @@ struct spi_transfer {
unsigned dummy_data:1; unsigned dummy_data:1;
unsigned cs_off:1; unsigned cs_off:1;
unsigned cs_change:1; unsigned cs_change:1;
unsigned tx_nbits:3; unsigned tx_nbits:4;
unsigned rx_nbits:3; unsigned rx_nbits:4;
unsigned timestamped:1; unsigned timestamped:1;
#define SPI_NBITS_SINGLE 0x01 /* 1-bit transfer */ #define SPI_NBITS_SINGLE 0x01 /* 1-bit transfer */
#define SPI_NBITS_DUAL 0x02 /* 2-bit transfer */ #define SPI_NBITS_DUAL 0x02 /* 2-bit transfer */
#define SPI_NBITS_QUAD 0x04 /* 4-bit transfer */ #define SPI_NBITS_QUAD 0x04 /* 4-bit transfer */
#define SPI_NBITS_OCTAL 0x08 /* 8-bit transfer */
u8 bits_per_word; u8 bits_per_word;
struct spi_delay delay; struct spi_delay delay;
struct spi_delay cs_change_delay; struct spi_delay cs_change_delay;
......
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