Skip to content

Commit

Permalink
spi: rockchip: Fix error in getting num-cs property
Browse files Browse the repository at this point in the history
[ Upstream commit 9382df0 ]

Get num-cs u32 from dts of_node property rather than u16.

Signed-off-by: Jon Lin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Jon Lin authored and usaleem-ix committed Apr 7, 2022
1 parent 741bbbe commit 6e3fcdb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/spi/spi-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,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;

slave_mode = of_property_read_bool(np, "spi-slave");
Expand Down Expand Up @@ -744,8 +744,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;
Expand Down

0 comments on commit 6e3fcdb

Please sign in to comment.