Skip to content

Commit 9382df0

Browse files
Jon Linbroonie
authored andcommitted
spi: rockchip: Fix error in getting num-cs property
Get num-cs u32 from dts of_node property rather than u16. Signed-off-by: Jon Lin <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220216014028.8123-2-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent ab38244 commit 9382df0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/spi/spi-rockchip.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
654654
struct spi_controller *ctlr;
655655
struct resource *mem;
656656
struct device_node *np = pdev->dev.of_node;
657-
u32 rsd_nsecs;
657+
u32 rsd_nsecs, num_cs;
658658
bool slave_mode;
659659

660660
slave_mode = of_property_read_bool(np, "spi-slave");
@@ -764,8 +764,9 @@ static int rockchip_spi_probe(struct platform_device *pdev)
764764
* rk spi0 has two native cs, spi1..5 one cs only
765765
* if num-cs is missing in the dts, default to 1
766766
*/
767-
if (of_property_read_u16(np, "num-cs", &ctlr->num_chipselect))
768-
ctlr->num_chipselect = 1;
767+
if (of_property_read_u32(np, "num-cs", &num_cs))
768+
num_cs = 1;
769+
ctlr->num_chipselect = num_cs;
769770
ctlr->use_gpio_descriptors = true;
770771
}
771772
ctlr->dev.of_node = pdev->dev.of_node;

0 commit comments

Comments
 (0)