From: Vaibhav Hiremath <hvaibhav@ti.com>
To: <netdev@vger.kernel.org>
Cc: <paul@pwsan.com>, <linux-arm-kernel@lists.infradead.org>,
<linux-omap@vger.kernel.org>, Vaibhav Hiremath <hvaibhav@ti.com>,
Mugunthan V N <mugunthanvnm@ti.com>,
Richard Cochran <richardcochran@gmail.com>
Subject: [PATCH 2/4] net: cpsw: Add parent<->child relation support between cpsw and mdio
Date: Mon, 29 Oct 2012 13:51:19 +0530 [thread overview]
Message-ID: <1351498881-32482-4-git-send-email-hvaibhav@ti.com> (raw)
In-Reply-To: <1351498881-32482-1-git-send-email-hvaibhav@ti.com>
CPGMAC SubSystem consist of various sub-modules, like, mdio, cpdma,
cpsw, etc... These sub-modules are also used in some of Davinci family
of devices. Now based on requirement, use-case and available technology
nodes the integration of these sub-modules varies across devices.
So coming back to Linux net driver, currently separate and independent
platform devices & drivers for CPSW and MDIO is implemented. In case of
Davinci they both has separate control, from resources perspective,
like clock.
In case of AM33XX, the resources are shared and only one register
bit-field is provided to control module/clock enable/disable, makes it
difficult to handle common resource.
So the solution here implemented in this patch is,
Create parent<->child relationship between both the drivers, making
CPSW as a parent and MDIO as its child and enumerate all the child nodes
under CPSW module.
Both the drivers will function exactly the way it was operating before,
including runtime-pm functionality. No change is required in MDIO driver
(for that matter to any child driver).
As this is only supported during DT boot, the parent<->child relationship
is created and populated in DT execution flow. The only required change
is inside DTS file, making MDIO as a child to CPSW node.
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Cc: Mugunthan V N <mugunthanvnm@ti.com>
Cc: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/ethernet/ti/cpsw.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index df55e24..fb1a692 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -827,7 +827,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
}
data->mac_control = prop;
- for_each_child_of_node(node, slave_node) {
+ for_each_node_by_name(slave_node, "slave") {
struct cpsw_slave_data *slave_data = data->slave_data + i;
const char *phy_id = NULL;
const void *mac_addr = NULL;
@@ -862,6 +862,14 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
i++;
}
+ /*
+ * Populate all the child nodes here...
+ */
+ ret = of_platform_populate(node, NULL, NULL, &pdev->dev);
+ /* We do not want to force this, as in some cases may not have child */
+ if (ret)
+ pr_warn("Doesn't have any child node\n");
+
return 0;
error_ret:
@@ -895,6 +903,11 @@ static int __devinit cpsw_probe(struct platform_device *pdev)
priv->msg_enable = netif_msg_init(debug_level, CPSW_DEBUG);
priv->rx_packet_max = max(rx_packet_max, 128);
+ /*
+ * This may be required here for child devices.
+ */
+ pm_runtime_enable(&pdev->dev);
+
if (cpsw_probe_dt(&priv->data, pdev)) {
pr_err("cpsw: platform data missing\n");
ret = -ENODEV;
@@ -921,7 +934,6 @@ static int __devinit cpsw_probe(struct platform_device *pdev)
for (i = 0; i < data->slaves; i++)
priv->slaves[i].slave_num = i;
- pm_runtime_enable(&pdev->dev);
priv->clk = clk_get(&pdev->dev, "fck");
if (IS_ERR(priv->clk)) {
dev_err(&pdev->dev, "fck is not found\n");
--
1.7.0.4
next prev parent reply other threads:[~2012-10-29 8:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-29 8:21 # (c) 2007, Joe Perches <joe@perches.com> Vaibhav Hiremath
2012-10-29 8:21 ` [PATCH-V2 0/4] ARM: AM33XX: net: Add DT support to CPGMAC and MDIO driver Vaibhav Hiremath
2012-10-29 8:33 ` Richard Cochran
2012-10-29 8:21 ` [PATCH 1/4] net: davinci_mdio: Fix typo mistake in calling runtime-pm api Vaibhav Hiremath
2012-10-30 21:33 ` Peter Korsgaard
2012-10-29 8:21 ` Vaibhav Hiremath [this message]
2012-10-30 21:34 ` [PATCH 2/4] net: cpsw: Add parent<->child relation support between cpsw and mdio Peter Korsgaard
2012-10-29 8:21 ` [PATCH 3/4] ARM: OMAP3+: hwmod: Add AM33XX HWMOD data for davinci_mdio module Vaibhav Hiremath
2012-10-30 21:35 ` Peter Korsgaard
2012-10-29 8:21 ` [PATCH 4/4] arm/dts: am33xx: Add CPSW and MDIO module nodes for AM33XX Vaibhav Hiremath
2012-10-30 21:35 ` Peter Korsgaard
2012-10-31 15:17 ` Benoit Cousson
2012-10-31 19:52 ` Hiremath, Vaibhav
2012-11-01 7:45 ` Richard Cochran
2012-11-01 9:28 ` Cousson, Benoit
2012-11-03 17:45 ` [PATCH RFC net-next 0/1] Simplify the CPSW DT Richard Cochran
2012-11-03 17:45 ` [PATCH RFC net-next 1/1] cpsw: simplify the setup of the register pointers Richard Cochran
2012-11-02 8:46 ` [PATCH 4/4] arm/dts: am33xx: Add CPSW and MDIO module nodes for AM33XX N, Mugunthan V
2012-11-02 8:56 ` Richard Cochran
2012-11-02 10:42 ` N, Mugunthan V
2012-11-02 15:19 ` Richard Cochran
2012-11-08 12:59 ` Mugunthan V N
2012-10-29 9:25 ` # (c) 2007, Joe Perches <joe@perches.com> Vaibhav Hiremath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351498881-32482-4-git-send-email-hvaibhav@ti.com \
--to=hvaibhav@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=mugunthanvnm@ti.com \
--cc=netdev@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).