From patchwork Tue Jan 6 15:54:34 2015
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 425720
Return-Path:
X-Original-To: incoming-dt@patchwork.ozlabs.org
Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by ozlabs.org (Postfix) with ESMTP id 420F41400DE
for ;
Wed, 7 Jan 2015 02:55:13 +1100 (AEDT)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1756008AbbAFPyv (ORCPT
);
Tue, 6 Jan 2015 10:54:51 -0500
Received: from metis.ext.pengutronix.de ([92.198.50.35]:42617 "EHLO
metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1755594AbbAFPyu (ORCPT
); Tue, 6 Jan 2015 10:54:50 -0500
Received: from dude.hi.4.pengutronix.de ([10.1.0.7]
helo=dude.pengutronix.de.)
by metis.ext.pengutronix.de with esmtp (Exim 4.72)
(envelope-from )
id 1Y8WSv-0003qr-6x; Tue, 06 Jan 2015 16:54:41 +0100
From: Philipp Zabel
To: Rob Herring , Lee Jones ,
Arnd Bergmann
Cc: Pawel Moll , Mark Rutland ,
Flora Fu , linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, kernel@pengutronix.de,
Philipp Zabel
Subject: [PATCH v3] mfd: syscon: add child device support
Date: Tue, 6 Jan 2015 16:54:34 +0100
Message-Id: <1420559674-9772-1-git-send-email-p.zabel@pengutronix.de>
X-Mailer: git-send-email 2.1.4
X-SA-Exim-Connect-IP: 10.1.0.7
X-SA-Exim-Mail-From: p.zabel@pengutronix.de
X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de);
SAEximRunCond expanded to false
X-PTX-Original-Recipient: devicetree@vger.kernel.org
Sender: devicetree-owner@vger.kernel.org
Precedence: bulk
List-ID:
X-Mailing-List: devicetree@vger.kernel.org
For devices which have a complete register for themselves, it is possible to
place them next to the syscon device with overlapping reg ranges. The same is
not possible for devices which only occupy bitfields in registers shared with
other users.
For devices that are completely controlled by bitfields in the syscon address
range, such as multiplexers or voltage regulators, allow to put child devices
into the syscon device node.
Signed-off-by: Philipp Zabel
Tested-by: Flora Fu
---
Changes since v2:
- Added Tested-by: Flora Fu
---
Documentation/devicetree/bindings/mfd/syscon.txt | 13 +++++++++++++
drivers/mfd/syscon.c | 3 +++
2 files changed, 16 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt
index fe8150b..0c6b497 100644
--- a/Documentation/devicetree/bindings/mfd/syscon.txt
+++ b/Documentation/devicetree/bindings/mfd/syscon.txt
@@ -9,12 +9,25 @@ using a specific compatible value), interrogate the node (or associated
OS driver) to determine the location of the registers, and access the
registers directly.
+Optionally, devices that are controlled exclusively through syscon registers,
+or even bitfields in shared syscon registers, can also be added as child nodes
+to the syscon device node. These devices can implicitly assume their parent
+node is a syscon provider without referencing it explicitly via phandle.
+In this case, the syscon node should have #address-cells = <1> and
+#size-cells = <0> or <1> and no ranges property.
+
Required properties:
- compatible: Should contain "syscon".
- reg: the register region can be accessed from syscon
+Optional properties:
+- #address-cells: Should be 1.
+- #size-cells: Should be 0 or 1.
+
Examples:
gpr: iomuxc-gpr@020e0000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
compatible = "fsl,imx6q-iomuxc-gpr", "syscon";
reg = <0x020e0000 0x38>;
};
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 176bf0f..d2280d6 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -208,6 +208,9 @@ static int syscon_probe(struct platform_device *pdev)
dev_dbg(dev, "regmap %pR registered\n", res);
+ if (!of_device_is_compatible(pdev->dev.of_node, "simple-bus"))
+ of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
+
return 0;
}