linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: spi-fsl-spi: Add OF bus-num property
@ 2016-12-19 12:09 Joakim Tjernlund
       [not found] ` <20161219120942.29022-1-joakim.tjernlund-27rvihrghlNWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Joakim Tjernlund @ 2016-12-19 12:09 UTC (permalink / raw)
  To: linux-spi-u79uwXL29TY76Z2rM5mHXA; +Cc: Joakim Tjernlund

Allow OF to specify bus enumeration. This uses the same property
as spi-fsl-dspi.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund-27rvihrghlNWk0Htik3J/w@public.gmane.org>
---
 drivers/spi/spi-fsl-lib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c
index cb35d2f..3b06513 100644
--- a/drivers/spi/spi-fsl-lib.c
+++ b/drivers/spi/spi-fsl-lib.c
@@ -140,7 +140,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
 	struct mpc8xxx_spi_probe_info *pinfo;
 	struct fsl_spi_platform_data *pdata;
 	const void *prop;
-	int ret = -ENOMEM;
+	int ret = -ENOMEM, bus_num;
 
 	pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL);
 	if (!pinfo)
@@ -151,7 +151,9 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
 
 	/* Allocate bus num dynamically. */
 	pdata->bus_num = -1;
-
+	ret = of_property_read_u32(np, "bus-num", &bus_num);
+	if (ret >= 0)
+		pdata->bus_num = bus_num;
 #ifdef CONFIG_FSL_SOC
 	/* SPI controller is either clocked from QE or SoC clock. */
 	pdata->sysclk = get_brgfreq();
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: spi-fsl-spi: Add OF bus-num property
       [not found] ` <20161219120942.29022-1-joakim.tjernlund-27rvihrghlNWk0Htik3J/w@public.gmane.org>
@ 2017-01-13 15:41   ` Joakim Tjernlund
  0 siblings, 0 replies; 2+ messages in thread
From: Joakim Tjernlund @ 2017-01-13 15:41 UTC (permalink / raw)
  To: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Mon, 2016-12-19 at 13:09 +0100, Joakim Tjernlund wrote:
> Allow OF to specify bus enumeration. This uses the same property
> as spi-fsl-dspi.
> 
> Signed-off-by: Joakim Tjernlund <joakim.tjernlund-27rvihrghlNWk0Htik3J/w@public.gmane.org>
> ---

Ping?

>  drivers/spi/spi-fsl-lib.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c
> index cb35d2f..3b06513 100644
> --- a/drivers/spi/spi-fsl-lib.c
> +++ b/drivers/spi/spi-fsl-lib.c
> @@ -140,7 +140,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
>  	struct mpc8xxx_spi_probe_info *pinfo;
>  	struct fsl_spi_platform_data *pdata;
>  	const void *prop;
> -	int ret = -ENOMEM;
> +	int ret = -ENOMEM, bus_num;
>  
>  	pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL);
>  	if (!pinfo)
> @@ -151,7 +151,9 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
>  
>  	/* Allocate bus num dynamically. */
>  	pdata->bus_num = -1;
> -
> +	ret = of_property_read_u32(np, "bus-num", &bus_num);
> +	if (ret >= 0)
> +		pdata->bus_num = bus_num;
>  #ifdef CONFIG_FSL_SOC
>  	/* SPI controller is either clocked from QE or SoC clock. */
>  	pdata->sysclk = get_brgfreq();
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-13 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 12:09 [PATCH] spi: spi-fsl-spi: Add OF bus-num property Joakim Tjernlund
     [not found] ` <20161219120942.29022-1-joakim.tjernlund-27rvihrghlNWk0Htik3J/w@public.gmane.org>
2017-01-13 15:41   ` Joakim Tjernlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).