[linux-yocto] [PATCH 61/70] Acp34xx: disable device when enabled set to 0 in dts

Paul Butler butler.paul at gmail.com
Mon Jun 10 18:46:24 PDT 2013


From: Jiang Lu <lu.jiang at windriver.com>

In APM mode, uboot of ACP34xx involves "enabled" property to partition
system resources among the OS groups.

For the peripheral belongs to other OS groups, kernel will get enabled=0
in device node.

This patch disables the devices with "enabled = 0" in dts.

Signed-off-by: Jiang Lu <lu.jiang at windriver.com>
---
 drivers/i2c/busses/acp3400-i2c.c       | 8 ++++++++
 drivers/mtd/nand/lsi_acp_nand.c        | 4 ++--
 drivers/net/ethernet/lsi/lsi_acp_net.c | 5 +++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/acp3400-i2c.c b/drivers/i2c/busses/acp3400-i2c.c
index 4a536db..de4eff6 100644
--- a/drivers/i2c/busses/acp3400-i2c.c
+++ b/drivers/i2c/busses/acp3400-i2c.c
@@ -427,6 +427,14 @@ static int acp34xx_i2c_probe(struct platform_device *dev)
 
 	struct acp3400_i2c *i2c;
 	int result = -ENODEV;
+	const u32 *field;
+
+	if (!np)
+		return -ENODEV;
+
+	field = of_get_property(np, "enabled", NULL);
+	if (!field || (field && (0 == *field)))
+		return -EINVAL;
 
 	i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
 	if (!i2c)
diff --git a/drivers/mtd/nand/lsi_acp_nand.c b/drivers/mtd/nand/lsi_acp_nand.c
index eb9943a..c3165d9 100644
--- a/drivers/mtd/nand/lsi_acp_nand.c
+++ b/drivers/mtd/nand/lsi_acp_nand.c
@@ -3489,9 +3489,9 @@ lsi_nand_init(void)
 
 		enabled = of_get_property(np, "enabled", NULL);
 
-		if (NULL == enabled) {
+		if (!enabled || (enabled && (0 == *enabled))) {
 			printk("ACP NAND Controller Isn't Enabled.\n");
-			return -1;
+			return -ENODEV;
 		}
 
 		reg = of_get_property(np, "reg", &reglen);
diff --git a/drivers/net/ethernet/lsi/lsi_acp_net.c b/drivers/net/ethernet/lsi/lsi_acp_net.c
index 39671cc..21153bf 100644
--- a/drivers/net/ethernet/lsi/lsi_acp_net.c
+++ b/drivers/net/ethernet/lsi/lsi_acp_net.c
@@ -1767,6 +1767,11 @@ static int __devinit appnic_probe_config_dt(struct net_device *dev,
 	if (!np)
 		return -ENODEV;
 
+	field = of_get_property(np, "enabled", NULL);
+
+	if (!field || (field && (0 == *field)))
+		return -EINVAL;
+
 	field = of_get_property(np, "reg", NULL);
 
 	if (!field) {
-- 
1.8.3




More information about the linux-yocto mailing list