spi: Add Flag to Enable Slave Select with GPIO Chip Select.
PATCH v3 2/2 spi: dw: Set GPIO_SS flag to toggle Slave Select on GPIO CS
In reply to [email protected]From: Thor Thayer <[email protected]>
The Designware SPI master requires slave selection before the transfer can begin [1].
This patch uses the new master flag to indicate both the GPIO CS and the internal chip select should be used.
Tested On:
Altera CycloneV development kit
Compile tested for build errors on x86_64 (allyesconfigs)
[1] DesignWare dw_apb_ssi Databook, Version 3.20a (page 39)
---
v3 Use SPI_MASTER_GPIO_SS
--- drivers/spi/spi-dw.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-dw.c +1 -0
@@ -502,6 +502,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) master->handle_err = dw_spi_handle_err; master->max_speed_hz = dws->max_freq; master->dev.of_node = dev->of_node; + master->flags =SPI_MASTER_GPIO_SS ;/* Basic HW init */ spi_hw_init (dev, dws);
Signature · 1 line
1.7.9.5
PATCH v3 1/2 spi: Add Flag to Enable Slave Select with GPIO Chip Select.
From: Thor Thayer <[email protected]>
Some SPI masters require slave selection before the transfer can begin [1]. The SPI framework currently selects the chip using either 1) the internal CS mechanism or 2) the GPIO CS, but not both.
This patch adds a new master->flags define to indicate both the GPIO CS and the internal chip select mechanism should be used.
Tested On:
Altera CycloneV development kit
Compile tested for build errors on x86_64 (allyesconfigs)
[1] DesignWare dw_apb_ssi Databook, Version 3.20a (page 39)
---
v2 Move changes to SPI framework based on maintainer comments
Add a new SPI master boolean variable.
v3 Change boolean variable to master->flags based on comments
--- drivers/spi/spi.c | 9 +++++++-- include/linux/spi/spi.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/spi/spi.c +7 -2
@@ -697,10 +697,15 @@ static void spi_set_cs(struct spi_device *spi, bool enable)if (spi->mode &SPI_CS_HIGH ) enable = !enable; -if (gpio_is_valid (spi->cs_gpio)) +if (gpio_is_valid (spi->cs_gpio)) {gpio_set_value (spi->cs_gpio, !enable); -else if (spi->master->set_cs) +/* Some SPI masters need both GPIO CS & slave_select */ +if ((spi->master->flags &SPI_MASTER_GPIO_SS ) && + spi->master->set_cs) + spi->master->set_cs (spi, !enable); + }else if (spi->master->set_cs) { spi->master->set_cs (spi, !enable); + } }#ifdef CONFIG_HAS_DMA
include/linux/spi/spi.h +1 -0
@@ -442,6 +442,7 @@ struct spi_master {#define SPI_MASTER_NO_TX BIT(2)/* can't do buffer write */ #define SPI_MASTER_MUST_RX BIT(3)/* requires rx */ #define SPI_MASTER_MUST_TX BIT(4)/* requires tx */ +#define SPI_MASTER_GPIO_SS BIT(5)/* GPIO CS must select slave */ /* * on some hardware transfer / message size may be constrained
Signature · 1 line
1.7.9.5
Mark Brown
maintainerApplied "spi: Add Flag to Enable Slave Select with GPIO Chip Select." to the spi tree
The patch
spi: Add Flag to Enable Slave Select with GPIO Chip Select.
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
6b1576aa875347c6454d911a2e001138c2cec7d5Mon Sep 17 00:00:00 2001
From: Thor Thayer <[email protected]>
Date: Mon, 10 Oct 2016 09:25:24 -0500
Subject: [PATCH] spi: Add Flag to Enable Slave Select with GPIO Chip Select.
Some SPI masters require slave selection before the transfer can begin [1]. The SPI framework currently selects the chip using either 1) the internal CS mechanism or 2) the GPIO CS, but not both.
This patch adds a new master->flags define to indicate both the GPIO CS and the internal chip select mechanism should be used.
Tested On:
Altera CycloneV development kit
Compile tested for build errors on x86_64 (allyesconfigs)
[1] DesignWare dw_apb_ssi Databook, Version 3.20a (page 39)
--- drivers/spi/spi.c | 9 +++++++-- include/linux/spi/spi.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/spi/spi.c +7 -2
@@ -697,10 +697,15 @@ static void spi_set_cs(struct spi_device *spi, bool enable)if (spi->mode &SPI_CS_HIGH ) enable = !enable; -if (gpio_is_valid (spi->cs_gpio)) +if (gpio_is_valid (spi->cs_gpio)) {gpio_set_value (spi->cs_gpio, !enable); -else if (spi->master->set_cs) +/* Some SPI masters need both GPIO CS & slave_select */ +if ((spi->master->flags &SPI_MASTER_GPIO_SS ) && + spi->master->set_cs) + spi->master->set_cs (spi, !enable); + }else if (spi->master->set_cs) { spi->master->set_cs (spi, !enable); + } }#ifdef CONFIG_HAS_DMA
include/linux/spi/spi.h +1 -0
@@ -442,6 +442,7 @@ struct spi_master {#define SPI_MASTER_NO_TX BIT(2)/* can't do buffer write */ #define SPI_MASTER_MUST_RX BIT(3)/* requires rx */ #define SPI_MASTER_MUST_TX BIT(4)/* requires tx */ +#define SPI_MASTER_GPIO_SS BIT(5)/* GPIO CS must select slave */ /* * on some hardware transfer / message size may be constrained
Signature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerApplied "spi: dw: Set GPIO_SS flag to toggle Slave Select on GPIO CS" to the spi tree
In reply to [email protected]The patch
spi: dw: Set GPIO_SS flag to toggle Slave Select on GPIO CS
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
80b444e57948ea4bd5a89fb1f8c404ddab6c1973Mon Sep 17 00:00:00 2001
From: Thor Thayer <[email protected]>
Date: Mon, 10 Oct 2016 09:25:25 -0500
Subject: [PATCH] spi: dw: Set GPIO_SS flag to toggle Slave Select on GPIO CS
The Designware SPI master requires slave selection before the transfer can begin [1].
This patch uses the new master flag to indicate both the GPIO CS and the internal chip select should be used.
Tested On:
Altera CycloneV development kit
Compile tested for build errors on x86_64 (allyesconfigs)
[1] DesignWare dw_apb_ssi Databook, Version 3.20a (page 39)
--- drivers/spi/spi-dw.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-dw.c +1 -0
@@ -502,6 +502,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) master->handle_err = dw_spi_handle_err; master->max_speed_hz = dws->max_freq; master->dev.of_node = dev->of_node; + master->flags =SPI_MASTER_GPIO_SS ;/* Basic HW init */ spi_hw_init (dev, dws);
Signature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html