Skip to content

Commit

Permalink
spi: qup: Fix cs-num DT property parsing
Browse files Browse the repository at this point in the history
num-cs is 32 bit property, don't read just upper 16 bits.

Fixes: 4a8573a (spi: qup: Remove chip select function)
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
  • Loading branch information
Ivan T. Ivanov authored and Mark Brown committed Mar 7, 2015
1 parent c517d83 commit 12cb89e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/spi/spi-qup.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ static int spi_qup_probe(struct platform_device *pdev)
struct resource *res;
struct device *dev;
void __iomem *base;
u32 max_freq, iomode;
u32 max_freq, iomode, num_cs;
int ret, irq, size;

dev = &pdev->dev;
Expand Down Expand Up @@ -550,10 +550,11 @@ static int spi_qup_probe(struct platform_device *pdev)
}

/* use num-cs unless not present or out of range */
if (of_property_read_u16(dev->of_node, "num-cs",
&master->num_chipselect) ||
(master->num_chipselect > SPI_NUM_CHIPSELECTS))
if (of_property_read_u32(dev->of_node, "num-cs", &num_cs) ||
num_cs > SPI_NUM_CHIPSELECTS)
master->num_chipselect = SPI_NUM_CHIPSELECTS;
else
master->num_chipselect = num_cs;

master->bus_num = pdev->id;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
Expand Down

0 comments on commit 12cb89e

Please sign in to comment.