[PATCH] powerpc: fsl_soc: Pre-allocate i2c bus number and pre-register devices.
Scott Wood
scottwood at freescale.com
Fri May 18 01:19:04 EST 2007
A bus number is dynamically allocated, used to register devices
with i2c_register_board_info(), and then passed to the i2c-mpc
driver to use with i2c_add_prenumbered_adapter().
Signed-off-by: Scott Wood <scottwood at freescale.com>
---
This supersedes the "Call of_register_i2c_devices() for fsl-i2c" patch.
arch/powerpc/sysdev/fsl_soc.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index cad1757..4ff0daf 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -26,6 +26,7 @@
#include <linux/fsl_devices.h>
#include <linux/fs_enet_pd.h>
#include <linux/fs_uart_pd.h>
+#include <linux/i2c.h>
#include <asm/system.h>
#include <asm/atomic.h>
@@ -319,7 +320,13 @@ static int __init fsl_i2c_of_init(void)
of_irq_to_resource(np, 0, &r[1]);
- i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
+ ret = i2c_alloc_bus_number();
+ if (ret < 0)
+ goto err;
+
+ of_register_i2c_devices(np, ret);
+
+ i2c_dev = platform_device_register_simple("fsl-i2c", ret, r, 2);
if (IS_ERR(i2c_dev)) {
ret = PTR_ERR(i2c_dev);
goto err;
--
1.5.0.3
More information about the Linuxppc-dev
mailing list