Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'spi-fix-v4.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
"A bunch of really small fixes here, all driver specific and mostly in
error handling and remove paths.

The most important fixes are for the a3700 clock configuration and a
fix for a nasty stall which could potentially cause data corruption
with the xilinx driver"

* tag 'spi-fix-v4.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: atmel: fixed spin_lock usage inside atmel_spi_remove
spi: sun4i: disable clocks in the remove function
spi: rspi: Do not set SPCR_SPE in qspi_set_config_register()
spi: Fix double "when"
spi: a3700: Fix clk prescaling for coefficient over 15
spi: xilinx: Detect stall with Unknown commands
spi: imx: Update device tree binding documentation

+36 -11
+12 -6
Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt
··· 12 12 - "fsl,imx53-ecspi" for SPI compatible with the one integrated on i.MX53 and later Soc 13 13 - reg : Offset and length of the register set for the device 14 14 - interrupts : Should contain CSPI/eCSPI interrupt 15 - - cs-gpios : Specifies the gpio pins to be used for chipselects. 16 15 - clocks : Clock specifiers for both ipg and per clocks. 17 16 - clock-names : Clock names should include both "ipg" and "per" 18 17 See the clock consumer binding, 19 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: 25 - - fsl,spi-num-chipselects : Contains the number of the chipselect 20 + Recommended properties: 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 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 31 - fsl,spi-rdy-drctl: Integer, representing the value of DRCTL, the register 29 32 controlling the SPI_READY handling. Note that to enable the DRCTL consideration, 30 33 the SPI_READY mode-flag needs to be set too. 31 34 Valid values are: 0 (disabled), 1 (edge-triggered burst) and 2 (level-triggered burst). 35 + 36 + Obsolete properties: 37 + - fsl,spi-num-chipselects : Contains the number of the chipselect 32 38 33 39 Example: 34 40
+8
drivers/spi/spi-armada-3700.c
··· 79 79 #define A3700_SPI_BYTE_LEN BIT(5) 80 80 #define A3700_SPI_CLK_PRESCALE BIT(0) 81 81 #define A3700_SPI_CLK_PRESCALE_MASK (0x1f) 82 + #define A3700_SPI_CLK_EVEN_OFFS (0x10) 82 83 83 84 #define A3700_SPI_WFIFO_THRS_BIT 28 84 85 #define A3700_SPI_RFIFO_THRS_BIT 24 ··· 220 219 u32 prescale; 221 220 222 221 prescale = DIV_ROUND_UP(clk_get_rate(a3700_spi->clk), speed_hz); 222 + 223 + /* For prescaler values over 15, we can only set it by steps of 2. 224 + * Starting from A3700_SPI_CLK_EVEN_OFFS, we set values from 0 up to 225 + * 30. We only use this range from 16 to 30. 226 + */ 227 + if (prescale > 15) 228 + prescale = A3700_SPI_CLK_EVEN_OFFS + DIV_ROUND_UP(prescale, 2); 223 229 224 230 val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); 225 231 val = val & ~A3700_SPI_CLK_PRESCALE_MASK;
+1 -1
drivers/spi/spi-atmel.c
··· 1661 1661 pm_runtime_get_sync(&pdev->dev); 1662 1662 1663 1663 /* reset the hardware and block queue progress */ 1664 - spin_lock_irq(&as->lock); 1665 1664 if (as->use_dma) { 1666 1665 atmel_spi_stop_dma(master); 1667 1666 atmel_spi_release_dma(master); 1668 1667 } 1669 1668 1669 + spin_lock_irq(&as->lock); 1670 1670 spi_writel(as, CR, SPI_BIT(SWRST)); 1671 1671 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ 1672 1672 spi_readl(as, SR);
+2 -2
drivers/spi/spi-rspi.c
··· 377 377 /* Sets SPCMD */ 378 378 rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); 379 379 380 - /* Enables SPI function in master mode */ 381 - rspi_write8(rspi, SPCR_SPE | SPCR_MSTR, RSPI_SPCR); 380 + /* Sets RSPI mode */ 381 + rspi_write8(rspi, SPCR_MSTR, RSPI_SPCR); 382 382 383 383 return 0; 384 384 }
+1 -1
drivers/spi/spi-sun4i.c
··· 525 525 526 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 530 return 0; 531 531 }
+11
drivers/spi/spi-xilinx.c
··· 271 271 while (remaining_words) { 272 272 int n_words, tx_words, rx_words; 273 273 u32 sr; 274 + int stalled; 274 275 275 276 n_words = min(remaining_words, xspi->buffer_size); 276 277 ··· 300 299 301 300 /* Read out all the data from the Rx FIFO */ 302 301 rx_words = n_words; 302 + stalled = 10; 303 303 while (rx_words) { 304 + if (rx_words == n_words && !(stalled--) && 305 + !(sr & XSPI_SR_TX_EMPTY_MASK) && 306 + (sr & XSPI_SR_RX_EMPTY_MASK)) { 307 + dev_err(&spi->dev, 308 + "Detected stall. Check C_SPI_MODE and C_SPI_MEMORY\n"); 309 + xspi_init_hw(xspi); 310 + return -EIO; 311 + } 312 + 304 313 if ((sr & XSPI_SR_TX_EMPTY_MASK) && (rx_words > 1)) { 305 314 xilinx_spi_rx(xspi); 306 315 rx_words--;
+1 -1
include/linux/spi/spi.h
··· 126 126 * for that name. This appears in the sysfs "modalias" attribute 127 127 * for driver coldplugging, and in uevents used for hotplugging 128 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 131 * @statistics: statistics for the spi_device 132 132 *