diff mbox

[1/2] spi: cadence: Init HW after reading devicetree attributes

Message ID 1417101138-2619-1-git-send-email-lars@metafoo.de (mailing list archive)
State Accepted
Commit 3cc291061ce542edff7a0f7127a654e9d05ee559
Headers show

Commit Message

Lars-Peter Clausen Nov. 27, 2014, 3:12 p.m. UTC
From: Paul Cercueil <paul.cercueil@analog.com>

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>
---
 drivers/spi/spi-cadence.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

Comments

Michal Simek Nov. 28, 2014, 7:52 a.m. UTC | #1
On 11/27/2014 04:12 PM, Lars-Peter Clausen wrote:
> From: Paul Cercueil <paul.cercueil@analog.com>
> 
> 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>
> ---
>  drivers/spi/spi-cadence.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
> index 7b811e3..2404937 100644
> --- a/drivers/spi/spi-cadence.c
> +++ b/drivers/spi/spi-cadence.c
> @@ -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);
>  
> @@ -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;
> 

That's reasonable patch to do without any functional impact now.

Reviewed-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown Nov. 28, 2014, 11:42 a.m. UTC | #2
On Thu, Nov 27, 2014 at 04:12:17PM +0100, Lars-Peter Clausen wrote:
> From: Paul Cercueil <paul.cercueil@analog.com>
> 
> This will make it possible to use the settings specified in the devicetree
> to configure the hardware.

Applied both, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
index 7b811e3..2404937 100644
--- a/drivers/spi/spi-cadence.c
+++ b/drivers/spi/spi-cadence.c
@@ -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);
 
@@ -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;