spi/mpc5121: register spi child devices of spi node
diff mbox

Message ID 1280185178-5002-1-git-send-email-agust@denx.de
State Superseded
Headers show

Commit Message

Anatolij Gustschin July 26, 2010, 10:59 p.m. UTC
None

Patch
diff mbox

diff --git a/drivers/spi/mpc512x_psc_spi.c b/drivers/spi/mpc512x_psc_spi.c
index c8d69fc..39e5faf 100644
--- a/drivers/spi/mpc512x_psc_spi.c
+++ b/drivers/spi/mpc512x_psc_spi.c
@@ -27,6 +27,7 @@ 
 #include <linux/clk.h>
 #include <linux/spi/spi.h>
 #include <linux/fsl_devices.h>
+#include <linux/of_spi.h>
 #include <asm/mpc52xx_psc.h>
 
 struct mpc512x_psc_spi {
@@ -511,6 +512,7 @@  static int __devinit mpc512x_psc_spi_of_probe(struct of_device *op,
 	const u32 *regaddr_p;
 	u64 regaddr64, size64;
 	s16 id = -1;
+	int ret;
 
 	regaddr_p = of_get_address(op->dev.of_node, 0, &size64, NULL);
 	if (!regaddr_p) {
@@ -533,8 +535,14 @@  static int __devinit mpc512x_psc_spi_of_probe(struct of_device *op,
 		id = *psc_nump;
 	}
 
-	return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,
+	ret = mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,
 				irq_of_parse_and_map(op->dev.of_node, 0), id);
+
+	if (!ret)
+		of_register_spi_devices(dev_get_drvdata(&op->dev),
+					op->dev.of_node);
+
+	return ret;
 }
 
 static int __devexit mpc512x_psc_spi_of_remove(struct of_device *op)