mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
spi: rockchip: Support cs-gpio
1.Add standard cs-gpio support 2.Refer to spi-controller.yaml for details Change-Id: I8f839189038afd77d534d767d938c845aa54fedb Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
@@ -160,7 +160,8 @@
|
||||
*/
|
||||
#define ROCKCHIP_SPI_MAX_TRANLEN 0xffff
|
||||
|
||||
#define ROCKCHIP_SPI_MAX_CS_NUM 2
|
||||
/* 2 for native cs, 2 for cs-gpio */
|
||||
#define ROCKCHIP_SPI_MAX_CS_NUM 4
|
||||
#define ROCKCHIP_SPI_VER2_TYPE1 0x05EC0002
|
||||
#define ROCKCHIP_SPI_VER2_TYPE2 0x00110002
|
||||
|
||||
@@ -247,11 +248,15 @@ static void rockchip_spi_set_cs(struct spi_device *spi, bool enable)
|
||||
/* Keep things powered as long as CS is asserted */
|
||||
pm_runtime_get_sync(rs->dev);
|
||||
|
||||
ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER,
|
||||
BIT(spi->chip_select));
|
||||
if (spi->cs_gpiod)
|
||||
ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, 1);
|
||||
else
|
||||
ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, BIT(spi->chip_select));
|
||||
} else {
|
||||
ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER,
|
||||
BIT(spi->chip_select));
|
||||
if (spi->cs_gpiod)
|
||||
ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, 1);
|
||||
else
|
||||
ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, BIT(spi->chip_select));
|
||||
|
||||
/* Drop reference from when we first asserted CS */
|
||||
pm_runtime_put(rs->dev);
|
||||
|
||||
Reference in New Issue
Block a user