diff options
| -rw-r--r-- | Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt | 18 | ||||
| -rw-r--r-- | drivers/spi/spi-armada-3700.c | 8 | ||||
| -rw-r--r-- | drivers/spi/spi-atmel.c | 2 | ||||
| -rw-r--r-- | drivers/spi/spi-rspi.c | 4 | ||||
| -rw-r--r-- | drivers/spi/spi-sun4i.c | 2 | ||||
| -rw-r--r-- | drivers/spi/spi-xilinx.c | 11 | ||||
| -rw-r--r-- | include/linux/spi/spi.h | 2 |
7 files changed, 36 insertions, 11 deletions
diff --git a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt index 5bf13960f7f4..e3c48b20b1a6 100644 --- a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt +++ b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt | |||
| @@ -12,24 +12,30 @@ Required properties: | |||
| 12 | - "fsl,imx53-ecspi" for SPI compatible with the one integrated on i.MX53 and later Soc | 12 | - "fsl,imx53-ecspi" for SPI compatible with the one integrated on i.MX53 and later Soc |
| 13 | - reg : Offset and length of the register set for the device | 13 | - reg : Offset and length of the register set for the device |
| 14 | - interrupts : Should contain CSPI/eCSPI interrupt | 14 | - interrupts : Should contain CSPI/eCSPI interrupt |
| 15 | - cs-gpios : Specifies the gpio pins to be used for chipselects. | ||
| 16 | - clocks : Clock specifiers for both ipg and per clocks. | 15 | - clocks : Clock specifiers for both ipg and per clocks. |
| 17 | - clock-names : Clock names should include both "ipg" and "per" | 16 | - clock-names : Clock names should include both "ipg" and "per" |
| 18 | See the clock consumer binding, | 17 | See the clock consumer binding, |
| 19 | Documentation/devicetree/bindings/clock/clock-bindings.txt | 18 | Documentation/devicetree/bindings/clock/clock-bindings.txt |
| 20 | - dmas: DMA specifiers for tx and rx dma. See the DMA client binding, | ||
| 21 | Documentation/devicetree/bindings/dma/dma.txt | ||
| 22 | - dma-names: DMA request names should include "tx" and "rx" if present. | ||
| 23 | 19 | ||
| 24 | Obsolete properties: | 20 | Recommended properties: |
| 25 | - fsl,spi-num-chipselects : Contains the number of the chipselect | 21 | - cs-gpios : GPIOs to use as chip selects, see spi-bus.txt. While the native chip |
| 22 | select lines can be used, they appear to always generate a pulse between each | ||
| 23 | word of a transfer. Most use cases will require GPIO based chip selects to | ||
| 24 | generate a valid transaction. | ||
| 26 | 25 | ||
| 27 | Optional properties: | 26 | Optional properties: |
| 27 | - num-cs : Number of total chip selects, see spi-bus.txt. | ||
| 28 | - dmas: DMA specifiers for tx and rx dma. See the DMA client binding, | ||
| 29 | Documentation/devicetree/bindings/dma/dma.txt. | ||
| 30 | - dma-names: DMA request names, if present, should include "tx" and "rx". | ||
| 28 | - fsl,spi-rdy-drctl: Integer, representing the value of DRCTL, the register | 31 | - fsl,spi-rdy-drctl: Integer, representing the value of DRCTL, the register |
| 29 | controlling the SPI_READY handling. Note that to enable the DRCTL consideration, | 32 | controlling the SPI_READY handling. Note that to enable the DRCTL consideration, |
| 30 | the SPI_READY mode-flag needs to be set too. | 33 | the SPI_READY mode-flag needs to be set too. |
| 31 | Valid values are: 0 (disabled), 1 (edge-triggered burst) and 2 (level-triggered burst). | 34 | Valid values are: 0 (disabled), 1 (edge-triggered burst) and 2 (level-triggered burst). |
| 32 | 35 | ||
| 36 | Obsolete properties: | ||
| 37 | - fsl,spi-num-chipselects : Contains the number of the chipselect | ||
| 38 | |||
| 33 | Example: | 39 | Example: |
| 34 | 40 | ||
| 35 | ecspi@70010000 { | 41 | ecspi@70010000 { |
diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c index 77fe55ce790c..d65345312527 100644 --- a/drivers/spi/spi-armada-3700.c +++ b/drivers/spi/spi-armada-3700.c | |||
| @@ -79,6 +79,7 @@ | |||
| 79 | #define A3700_SPI_BYTE_LEN BIT(5) | 79 | #define A3700_SPI_BYTE_LEN BIT(5) |
| 80 | #define A3700_SPI_CLK_PRESCALE BIT(0) | 80 | #define A3700_SPI_CLK_PRESCALE BIT(0) |
| 81 | #define A3700_SPI_CLK_PRESCALE_MASK (0x1f) | 81 | #define A3700_SPI_CLK_PRESCALE_MASK (0x1f) |
| 82 | #define A3700_SPI_CLK_EVEN_OFFS (0x10) | ||
| 82 | 83 | ||
| 83 | #define A3700_SPI_WFIFO_THRS_BIT 28 | 84 | #define A3700_SPI_WFIFO_THRS_BIT 28 |
| 84 | #define A3700_SPI_RFIFO_THRS_BIT 24 | 85 | #define A3700_SPI_RFIFO_THRS_BIT 24 |
| @@ -220,6 +221,13 @@ static void a3700_spi_clock_set(struct a3700_spi *a3700_spi, | |||
| 220 | 221 | ||
| 221 | prescale = DIV_ROUND_UP(clk_get_rate(a3700_spi->clk), speed_hz); | 222 | prescale = DIV_ROUND_UP(clk_get_rate(a3700_spi->clk), speed_hz); |
| 222 | 223 | ||
| 224 | /* For prescaler values over 15, we can only set it by steps of 2. | ||
| 225 | * Starting from A3700_SPI_CLK_EVEN_OFFS, we set values from 0 up to | ||
| 226 | * 30. We only use this range from 16 to 30. | ||
| 227 | */ | ||
| 228 | if (prescale > 15) | ||
| 229 | prescale = A3700_SPI_CLK_EVEN_OFFS + DIV_ROUND_UP(prescale, 2); | ||
| 230 | |||
| 223 | val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); | 231 | val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); |
| 224 | val = val & ~A3700_SPI_CLK_PRESCALE_MASK; | 232 | val = val & ~A3700_SPI_CLK_PRESCALE_MASK; |
| 225 | 233 | ||
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index f95da364c283..669470971023 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
| @@ -1661,12 +1661,12 @@ static int atmel_spi_remove(struct platform_device *pdev) | |||
| 1661 | pm_runtime_get_sync(&pdev->dev); | 1661 | pm_runtime_get_sync(&pdev->dev); |
| 1662 | 1662 | ||
| 1663 | /* reset the hardware and block queue progress */ | 1663 | /* reset the hardware and block queue progress */ |
| 1664 | spin_lock_irq(&as->lock); | ||
| 1665 | if (as->use_dma) { | 1664 | if (as->use_dma) { |
| 1666 | atmel_spi_stop_dma(master); | 1665 | atmel_spi_stop_dma(master); |
| 1667 | atmel_spi_release_dma(master); | 1666 | atmel_spi_release_dma(master); |
| 1668 | } | 1667 | } |
| 1669 | 1668 | ||
| 1669 | spin_lock_irq(&as->lock); | ||
| 1670 | spi_writel(as, CR, SPI_BIT(SWRST)); | 1670 | spi_writel(as, CR, SPI_BIT(SWRST)); |
| 1671 | spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ | 1671 | spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ |
| 1672 | spi_readl(as, SR); | 1672 | spi_readl(as, SR); |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 2ce875764ca6..0835a8d88fb8 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
| @@ -377,8 +377,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size) | |||
| 377 | /* Sets SPCMD */ | 377 | /* Sets SPCMD */ |
| 378 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); | 378 | rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
| 379 | 379 | ||
| 380 | /* Enables SPI function in master mode */ | 380 | /* Sets RSPI mode */ |
| 381 | rspi_write8(rspi, SPCR_SPE | SPCR_MSTR, RSPI_SPCR); | 381 | rspi_write8(rspi, SPCR_MSTR, RSPI_SPCR); |
| 382 | 382 | ||
| 383 | return 0; | 383 | return 0; |
| 384 | } | 384 | } |
diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index c5cd635c28f3..41410031f8e9 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c | |||
| @@ -525,7 +525,7 @@ err_free_master: | |||
| 525 | 525 | ||
| 526 | static int sun4i_spi_remove(struct platform_device *pdev) | 526 | static int sun4i_spi_remove(struct platform_device *pdev) |
| 527 | { | 527 | { |
| 528 | pm_runtime_disable(&pdev->dev); | 528 | pm_runtime_force_suspend(&pdev->dev); |
| 529 | 529 | ||
| 530 | return 0; | 530 | return 0; |
| 531 | } | 531 | } |
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index bc7100b93dfc..e0b9fe1d0e37 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
| @@ -271,6 +271,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
| 271 | while (remaining_words) { | 271 | while (remaining_words) { |
| 272 | int n_words, tx_words, rx_words; | 272 | int n_words, tx_words, rx_words; |
| 273 | u32 sr; | 273 | u32 sr; |
| 274 | int stalled; | ||
| 274 | 275 | ||
| 275 | n_words = min(remaining_words, xspi->buffer_size); | 276 | n_words = min(remaining_words, xspi->buffer_size); |
| 276 | 277 | ||
| @@ -299,7 +300,17 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
| 299 | 300 | ||
| 300 | /* Read out all the data from the Rx FIFO */ | 301 | /* Read out all the data from the Rx FIFO */ |
| 301 | rx_words = n_words; | 302 | rx_words = n_words; |
| 303 | stalled = 10; | ||
| 302 | while (rx_words) { | 304 | while (rx_words) { |
| 305 | if (rx_words == n_words && !(stalled--) && | ||
| 306 | !(sr & XSPI_SR_TX_EMPTY_MASK) && | ||
| 307 | (sr & XSPI_SR_RX_EMPTY_MASK)) { | ||
| 308 | dev_err(&spi->dev, | ||
| 309 | "Detected stall. Check C_SPI_MODE and C_SPI_MEMORY\n"); | ||
| 310 | xspi_init_hw(xspi); | ||
| 311 | return -EIO; | ||
| 312 | } | ||
| 313 | |||
| 303 | if ((sr & XSPI_SR_TX_EMPTY_MASK) && (rx_words > 1)) { | 314 | if ((sr & XSPI_SR_TX_EMPTY_MASK) && (rx_words > 1)) { |
| 304 | xilinx_spi_rx(xspi); | 315 | xilinx_spi_rx(xspi); |
| 305 | rx_words--; | 316 | rx_words--; |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 7b2170bfd6e7..bc6bb325d1bf 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -126,7 +126,7 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, | |||
| 126 | * for that name. This appears in the sysfs "modalias" attribute | 126 | * for that name. This appears in the sysfs "modalias" attribute |
| 127 | * for driver coldplugging, and in uevents used for hotplugging | 127 | * for driver coldplugging, and in uevents used for hotplugging |
| 128 | * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when | 128 | * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when |
| 129 | * when not using a GPIO line) | 129 | * not using a GPIO line) |
| 130 | * | 130 | * |
| 131 | * @statistics: statistics for the spi_device | 131 | * @statistics: statistics for the spi_device |
| 132 | * | 132 | * |
