From patchwork Tue Aug 23 05:03:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: manjugk manjugk X-Patchwork-Id: 1087162 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7N4km2n003722 for ; Tue, 23 Aug 2011 04:46:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752251Ab1HWEqs (ORCPT ); Tue, 23 Aug 2011 00:46:48 -0400 Received: from [117.192.64.96] ([117.192.64.96]:48815 "EHLO manju-desktop" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751927Ab1HWEqr (ORCPT ); Tue, 23 Aug 2011 00:46:47 -0400 To: devicetree-discuss@lists.ozlabs.org Date: Tue, 23 Aug 2011 10:03:35 +0500 Subject: [RFC/PATCH v2 07/13] dt: omap: create platform bus for omap devices Envelope-To: devicetree-discuss@lists.ozlabs.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, grant.likely@secretlab.ca References: <1314074021-25186-1-git-send-email-manjugk@ti.com> CC: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, grant.likely@secretlab.ca Message-ID: <1314074021-25186-8-git-send-email-manjugk@ti.com> From: "G, Manjunath Kondaiah" Received: from manju-desktop (Citadel from userid 1000) by manju-desktop; Tue, 23 Aug 2011 10:03:43 +0500 X-Mailer: git-send-email 1.7.4.1 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 23 Aug 2011 04:46:48 +0000 (UTC) The omap devices will use HWMOD for fetching device information hence it needs to be handled seperately during platform bus creation during dt build. Signed-off-by: G, Manjunath Kondaiah --- drivers/of/platform.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index e50ffcb..bd2c089 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -24,6 +24,10 @@ #include #include +#ifdef CONFIG_ARCH_OMAP2PLUS +#include +#endif + const struct of_device_id of_default_bus_match_table[] = { { .compatible = "simple-bus", }, #ifdef CONFIG_ARM_AMBA @@ -544,6 +548,36 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l return NULL; } +static struct omap_device_pm_latency omap_device_latency[] = { + [0] = { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + +int of_omap_device_create(struct device_node *np, const char *name, int id, + void *platform_data, + int pd_size) +{ + struct omap_hwmod *oh; + struct platform_device *pdev; + + oh = omap_hwmod_lookup(name); + if (!oh) { + pr_err("Could not look up %s\n", name); + return -EEXIST; + } + + pdev = omap_device_build_dt(np, name, id, oh, platform_data, + sizeof(platform_data), omap_device_latency, + ARRAY_SIZE(omap_device_latency), 0); + WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name); + + pr_info("DT: omap_device build for %s is successful\n", name); + return PTR_ERR(pdev); +} + /** * of_platform_bus_create() - Create a device for a node and its children. * @bus: device node of the bus to instantiate @@ -565,7 +599,7 @@ static int of_platform_bus_create(struct device_node *bus, struct platform_device *dev; const char *bus_id = NULL; void *platform_data = NULL; - int pd_size; + int pd_size = 0; int id = -1; int rc = 0; @@ -597,6 +631,11 @@ static int of_platform_bus_create(struct device_node *bus, return 0; } + if (of_device_is_compatible(bus, "ti,omap-device")) { + of_omap_device_create(bus, bus_id, id, platform_data, pd_size); + return 0; + } + dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent); /* override the id if auxdata gives an id */