From 0b17f9b3f1e37f67ea6b0ef75743a68cf7a95c6e Mon Sep 17 00:00:00 2001 From: Jon Lin Date: Fri, 24 Sep 2021 15:10:19 +0800 Subject: [PATCH] spi: rockchip: Fix error in getting num-cs property Get num-cs u32 from dts of_node property rather than u16. Change-Id: I265c8c696f1ff884ce6e7690d9c886a2ed1bd267 Signed-off-by: Jon Lin --- drivers/spi/spi-rockchip.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 4575ebda1bd0..3f70423698ca 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -753,7 +753,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) struct spi_controller *ctlr; struct resource *mem; struct device_node *np = pdev->dev.of_node; - u32 rsd_nsecs; + u32 rsd_nsecs, num_cs; bool slave_mode; struct pinctrl *pinctrl = NULL; @@ -862,8 +862,9 @@ static int rockchip_spi_probe(struct platform_device *pdev) * rk spi0 has two native cs, spi1..5 one cs only * if num-cs is missing in the dts, default to 1 */ - if (of_property_read_u16(np, "num-cs", &ctlr->num_chipselect)) - ctlr->num_chipselect = 1; + if (of_property_read_u32(np, "num-cs", &num_cs)) + num_cs = 1; + ctlr->num_chipselect = num_cs; ctlr->use_gpio_descriptors = true; } ctlr->dev.of_node = pdev->dev.of_node;