Commit 4c15e32a authored by Ivan T. Ivanov's avatar Ivan T. Ivanov Committed by Luis Henriques

spi: qup: Fix cs-num DT property parsing

commit 12cb89e3 upstream.

num-cs is 32 bit property, don't read just upper 16 bits.

Fixes: 4a8573ab (spi: qup: Remove chip select function)
Signed-off-by: default avatarIvan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 7eac556e
...@@ -486,7 +486,7 @@ static int spi_qup_probe(struct platform_device *pdev) ...@@ -486,7 +486,7 @@ static int spi_qup_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct device *dev; struct device *dev;
void __iomem *base; void __iomem *base;
u32 data, max_freq, iomode; u32 data, max_freq, iomode, num_cs;
int ret, irq, size; int ret, irq, size;
dev = &pdev->dev; dev = &pdev->dev;
...@@ -547,10 +547,11 @@ static int spi_qup_probe(struct platform_device *pdev) ...@@ -547,10 +547,11 @@ static int spi_qup_probe(struct platform_device *pdev)
} }
/* use num-cs unless not present or out of range */ /* use num-cs unless not present or out of range */
if (of_property_read_u16(dev->of_node, "num-cs", if (of_property_read_u32(dev->of_node, "num-cs", &num_cs) ||
&master->num_chipselect) || num_cs > SPI_NUM_CHIPSELECTS)
(master->num_chipselect > SPI_NUM_CHIPSELECTS))
master->num_chipselect = SPI_NUM_CHIPSELECTS; master->num_chipselect = SPI_NUM_CHIPSELECTS;
else
master->num_chipselect = num_cs;
master->bus_num = pdev->id; master->bus_num = pdev->id;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment