linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Stefan Wahren <stefan.wahren@i2se.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-spi@vger.kernel.org, Mark Brown <broonie@kernel.org>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	Martin Sperl <kernel@martin.sperl.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 4.9 111/251] spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios
Date: Thu, 16 Jan 2020 12:34:20 -0500	[thread overview]
Message-ID: <20200116173641.22137-71-sashal@kernel.org> (raw)
In-Reply-To: <20200116173641.22137-1-sashal@kernel.org>

From: Martin Sperl <kernel@martin.sperl.org>

[ Upstream commit 509c583620e9053e43d611bf1614fc3d3abafa96 ]

The original driver by default defines num_chipselects as -1.
This actually allicates an array of 65535 entries in
of_spi_register_master.

There is a side-effect for buggy device trees that (contrary to
dt-binding documentation) have no cs-gpio defined.

This mode was never supported by the driver due to limitations
of native cs and additional code complexity and is explicitly
not stated to be implemented.

To keep backwards compatibility with such buggy DTs we limit
the number of chip_selects to 1, as for all practical purposes
it is only ever realistic to use a single chip select in
native cs mode without negative side-effects.

Fixes: 1ea29b39f4c812ec ("spi: bcm2835aux: add bcm2835 auxiliary spi device...")
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/spi/spi-bcm2835aux.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
index 5c89bbb05441..e075712c501e 100644
--- a/drivers/spi/spi-bcm2835aux.c
+++ b/drivers/spi/spi-bcm2835aux.c
@@ -416,7 +416,18 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, master);
 	master->mode_bits = (SPI_CPOL | SPI_CS_HIGH | SPI_NO_CS);
 	master->bits_per_word_mask = SPI_BPW_MASK(8);
-	master->num_chipselect = -1;
+	/* even though the driver never officially supported native CS
+	 * allow a single native CS for legacy DT support purposes when
+	 * no cs-gpio is configured.
+	 * Known limitations for native cs are:
+	 * * multiple chip-selects: cs0-cs2 are all simultaniously asserted
+	 *     whenever there is a transfer -  this even includes SPI_NO_CS
+	 * * SPI_CS_HIGH: is ignores - cs are always asserted low
+	 * * cs_change: cs is deasserted after each spi_transfer
+	 * * cs_delay_usec: cs is always deasserted one SCK cycle after
+	 *     a spi_transfer
+	 */
+	master->num_chipselect = 1;
 	master->transfer_one = bcm2835aux_spi_transfer_one;
 	master->handle_err = bcm2835aux_spi_handle_err;
 	master->prepare_message = bcm2835aux_spi_prepare_message;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-01-16 18:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 17:33 [PATCH AUTOSEL 4.9 041/251] media: s5p-jpeg: Correct step and max values for V4L2_CID_JPEG_RESTART_INTERVAL Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 043/251] ASoC: imx-sgtl5000: put of nodes if finding codec fails Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 046/251] clk: sunxi-ng: sun8i-a23: Enable PLL-MIPI LDOs when ungating it Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 050/251] ARM: dts: lpc32xx: add required clocks property to keypad device node Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 051/251] ARM: dts: lpc32xx: reparent keypad controller to SIC1 Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 052/251] ARM: dts: lpc32xx: fix ARM PrimeCell LCD controller variant Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 053/251] ARM: dts: lpc32xx: fix ARM PrimeCell LCD controller clocks property Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 054/251] ARM: dts: lpc32xx: phy3250: fix SD card regulator voltage Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 058/251] thermal: mediatek: fix register index error Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 085/251] clocksource/drivers/sun5i: Fail gracefully when clock rate is unavailable Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 086/251] clocksource/drivers/exynos_mct: Fix error path in timer resources initialization Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 087/251] mmc: sdhci-brcmstb: handle mmc_of_parse() errors during probe Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 088/251] ARM: 8847/1: pm: fix HYP/SVC mode mismatch when MCPM is used Sasha Levin
2020-01-16 17:33 ` [PATCH AUTOSEL 4.9 089/251] ARM: 8848/1: virt: Align GIC version check with arm64 counterpart Sasha Levin
2020-01-16 17:34 ` [PATCH AUTOSEL 4.9 104/251] ARM: OMAP2+: Fix potentially uninitialized return value for _setup_reset() Sasha Levin
2020-01-16 17:34 ` [PATCH AUTOSEL 4.9 110/251] soc/fsl/qe: Fix an error code in qe_pin_request() Sasha Levin
2020-01-16 17:34 ` Sasha Levin [this message]
2020-01-16 17:34 ` [PATCH AUTOSEL 4.9 114/251] ARM: pxa: ssp: Fix "WARNING: invalid free of devm_ allocated data" Sasha Levin
2020-01-16 17:34 ` [PATCH AUTOSEL 4.9 118/251] ARM: dts: ls1021: Fix SGMII PCS link remaining down after PHY disconnect Sasha Levin
2020-01-16 17:34 ` [PATCH AUTOSEL 4.9 138/251] pwm: meson: Don't disable PWM when setting duty repeatedly Sasha Levin
2020-01-16 17:34 ` [PATCH AUTOSEL 4.9 139/251] ARM: riscpc: fix lack of keyboard interrupts after irq conversion Sasha Levin
2020-01-16 17:34 ` [PATCH AUTOSEL 4.9 146/251] serial: stm32: fix transmit_chars when tx is stopped Sasha Levin
2020-01-16 17:35 ` [PATCH AUTOSEL 4.9 184/251] ASoC: sun4i-i2s: RX and TX counter registers are swapped Sasha Levin
2020-01-16 17:35 ` [PATCH AUTOSEL 4.9 205/251] net: stmmac: dwmac-meson8b: Fix signedness bug in probe Sasha Levin
2020-01-16 17:35 ` [PATCH AUTOSEL 4.9 207/251] net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse() Sasha Levin
2020-01-16 17:35 ` [PATCH AUTOSEL 4.9 210/251] net: stmmac: gmac4+: Not all Unicast addresses may be available Sasha Levin
2020-01-16 17:36 ` [PATCH AUTOSEL 4.9 214/251] net: stmmac: fix length of PTP clock's name string Sasha Levin
2020-01-16 17:36 ` [PATCH AUTOSEL 4.9 218/251] dmaengine: imx-sdma: fix size check for sdma script_number Sasha Levin
2020-01-16 17:36 ` [PATCH AUTOSEL 4.9 224/251] mt7601u: fix bbp version check in mt7601u_wait_bbp_ready Sasha Levin
2020-01-16 17:36 ` [PATCH AUTOSEL 4.9 229/251] spi: atmel: fix handling of cs_change set on non-last xfer Sasha Levin
2020-01-16 17:36 ` [PATCH AUTOSEL 4.9 232/251] clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume Sasha Levin
2020-01-16 17:36 ` [PATCH AUTOSEL 4.9 235/251] media: exynos4-is: Fix recursive locking in isp_video_release() Sasha Levin
2020-01-16 17:36 ` [PATCH AUTOSEL 4.9 240/251] tty: serial: imx: use the sg count from dma_map_sg Sasha Levin
2020-01-16 17:36 ` [PATCH AUTOSEL 4.9 249/251] arm64: dts: juno: Fix UART frequency Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200116173641.22137-71-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=broonie@kernel.org \
    --cc=kernel@martin.sperl.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).