Thread (1 message) 1 message, 1 author, 2014-03-14
DORMANTno replies

[PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS

From: Hou Zhiqiang <hidden>
Date: 2014-03-14 09:35:57
Also in: linux-spi
Subsystem: spi subsystem, the rest · Maintainers: Mark Brown, Linus Torvalds

Possibly related (same subject, not in this thread)

Get the spi_master's bus_num from DTS to make the spi_master's name
static. So "mtdparts=spi.bus_num.chip_select:..." in cmdline can be
used to asign mtd partions of spi flash.

Signed-off-by: Hou Zhiqiang <redacted>
---
 drivers/spi/spi-fsl-lib.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c
index 0b75f26..f5f0307b 100644
--- a/drivers/spi/spi-fsl-lib.c
+++ b/drivers/spi/spi-fsl-lib.c
@@ -198,7 +198,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 = kzalloc(sizeof(*pinfo), GFP_KERNEL);
 	if (!pinfo)
@@ -207,8 +207,12 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
 	pdata = &pinfo->pdata;
 	dev->platform_data = pdata;
 
-	/* Allocate bus num dynamically. */
-	pdata->bus_num = -1;
+	ret = of_property_read_u32(np, "bus-num", &bus_num);
+	if (ret < 0) {
+		/* Allocate bus num dynamically. */
+		bus_num = -1;
+	}
+	pdata->bus_num = bus_num;
 
 #ifdef CONFIG_FSL_SOC
 	/* SPI controller is either clocked from QE or SoC clock. */
-- 
1.8.5


--
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help