Skip to content

Commit

Permalink
spi: cadence: Init HW after reading devicetree attributes
Browse files Browse the repository at this point in the history
This will make it possible to use the settings specified in the devicetree
to configure the hardware.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Paul Cercueil authored and Mark Brown committed Nov 28, 2014
1 parent f114040 commit 3cc2910
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions drivers/spi/spi-cadence.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,17 @@ static int cdns_spi_probe(struct platform_device *pdev)
goto clk_dis_apb;
}

ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs);
if (ret < 0)
master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS;
else
master->num_chipselect = num_cs;

ret = of_property_read_u32(pdev->dev.of_node, "is-decoded-cs",
&xspi->is_decoded_cs);
if (ret < 0)
xspi->is_decoded_cs = 0;

/* SPI controller initializations */
cdns_spi_init_hw(xspi);

Expand All @@ -534,19 +545,6 @@ static int cdns_spi_probe(struct platform_device *pdev)
goto remove_master;
}

ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs);

if (ret < 0)
master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS;
else
master->num_chipselect = num_cs;

ret = of_property_read_u32(pdev->dev.of_node, "is-decoded-cs",
&xspi->is_decoded_cs);

if (ret < 0)
xspi->is_decoded_cs = 0;

master->prepare_transfer_hardware = cdns_prepare_transfer_hardware;
master->prepare_message = cdns_prepare_message;
master->transfer_one = cdns_transfer_one;
Expand Down

0 comments on commit 3cc2910

Please sign in to comment.