diff options
author | 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> | 2022-04-23 22:38:43 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-04-25 14:00:49 +0100 |
commit | e64e9ad267ca22ee3db6f9d7a02dc8400a23d4c8 (patch) | |
tree | f4a6f2d533a3a1cda6c0a3308a461988af78d70c /drivers/spi/spi-ingenic.c | |
parent | cc470d55343056d6b2a5c32e10e0aad06f324078 (diff) | |
download | linux-stable-e64e9ad267ca22ee3db6f9d7a02dc8400a23d4c8.tar.gz linux-stable-e64e9ad267ca22ee3db6f9d7a02dc8400a23d4c8.tar.bz2 linux-stable-e64e9ad267ca22ee3db6f9d7a02dc8400a23d4c8.zip |
spi: ingenic: Add support for use GPIO as chip select line.
Add support for using GPIOs as chip select lines on Ingenic SoCs.
Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/1650724725-93758-2-git-send-email-zhouyanjie@wanyeetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-ingenic.c')
-rw-r--r-- | drivers/spi/spi-ingenic.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/spi/spi-ingenic.c b/drivers/spi/spi-ingenic.c index 03077a7e11c8..e5faae54a957 100644 --- a/drivers/spi/spi-ingenic.c +++ b/drivers/spi/spi-ingenic.c @@ -380,7 +380,7 @@ static int spi_ingenic_probe(struct platform_device *pdev) struct spi_controller *ctlr; struct ingenic_spi *priv; void __iomem *base; - int ret; + int num_cs, ret; pdata = of_device_get_match_data(dev); if (!pdata) { @@ -416,6 +416,9 @@ static int spi_ingenic_probe(struct platform_device *pdev) if (IS_ERR(priv->flen_field)) return PTR_ERR(priv->flen_field); + if (device_property_read_u32(dev, "num-cs", &num_cs)) + num_cs = 2; + platform_set_drvdata(pdev, ctlr); ctlr->prepare_transfer_hardware = spi_ingenic_prepare_hardware; @@ -429,7 +432,9 @@ static int spi_ingenic_probe(struct platform_device *pdev) ctlr->bits_per_word_mask = pdata->bits_per_word_mask; ctlr->min_speed_hz = 7200; ctlr->max_speed_hz = 54000000; - ctlr->num_chipselect = 2; + ctlr->use_gpio_descriptors = true; + ctlr->max_native_cs = 2; + ctlr->num_chipselect = num_cs; ctlr->dev.of_node = pdev->dev.of_node; if (spi_ingenic_request_dma(ctlr, dev)) |