Skip to content

Commit 889254f

Browse files
Jon Lingregkh
authored andcommitted
spi: rockchip: Fix error in getting num-cs property
[ Upstream commit 9382df0 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4fb9be6 commit 889254f

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
@@ -636,7 +636,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
636636
struct spi_controller *ctlr;
637637
struct resource *mem;
638638
struct device_node *np = pdev->dev.of_node;
639-
u32 rsd_nsecs;
639+
u32 rsd_nsecs, num_cs;
640640
bool slave_mode;
641641

642642
slave_mode = of_property_read_bool(np, "spi-slave");
@@ -744,8 +744,9 @@ static int rockchip_spi_probe(struct platform_device *pdev)
744744
* rk spi0 has two native cs, spi1..5 one cs only
745745
* if num-cs is missing in the dts, default to 1
746746
*/
747-
if (of_property_read_u16(np, "num-cs", &ctlr->num_chipselect))
748-
ctlr->num_chipselect = 1;
747+
if (of_property_read_u32(np, "num-cs", &num_cs))
748+
num_cs = 1;
749+
ctlr->num_chipselect = num_cs;
749750
ctlr->use_gpio_descriptors = true;
750751
}
751752
ctlr->dev.of_node = pdev->dev.of_node;

0 commit comments

Comments
 (0)