From patchwork Tue Feb 9 03:17:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 77926 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o193HETl019142 for ; Tue, 9 Feb 2010 03:17:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753464Ab0BIDRO (ORCPT ); Mon, 8 Feb 2010 22:17:14 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:44866 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150Ab0BIDRN (ORCPT ); Mon, 8 Feb 2010 22:17:13 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o193H9Bo029016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Feb 2010 21:17:11 -0600 Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o193H24j024823; Tue, 9 Feb 2010 08:47:03 +0530 (IST) Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by linfarm476.india.ti.com (8.12.11/8.12.11) with ESMTP id o193H2R7014431; Tue, 9 Feb 2010 08:47:02 +0530 Received: (from a0393109@localhost) by linfarm476.india.ti.com (8.12.11/8.12.11/Submit) id o193H2sv014412; Tue, 9 Feb 2010 08:47:02 +0530 From: Thara Gopinath To: linux-omap@vger.kernel.org Cc: Thara Gopinath , Paul Walmsley Subject: [PATCH] OMAP: HWMOD: Add support for early device register into omap device layer Date: Tue, 9 Feb 2010 08:47:02 +0530 Message-Id: <1265685422-14351-1-git-send-email-thara@ti.com> X-Mailer: git-send-email 1.5.5 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.3 (demeter.kernel.org [140.211.167.41]); Tue, 09 Feb 2010 03:17:14 +0000 (UTC) diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h index 76d4917..9cc12c2 100644 --- a/arch/arm/plat-omap/include/plat/omap_device.h +++ b/arch/arm/plat-omap/include/plat/omap_device.h @@ -88,15 +88,16 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, struct omap_hwmod *oh, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, - int pm_lats_cnt); + int pm_lats_cnt, int is_early_device); struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, struct omap_hwmod **oh, int oh_cnt, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, - int pm_lats_cnt); + int pm_lats_cnt, int is_early_device); int omap_device_register(struct omap_device *od); +int omap_early_device_register(struct omap_device *od); /* OMAP PM interface */ int omap_device_align_pm_lat(struct platform_device *pdev, diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index 5195dbb..83a97aa 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c @@ -305,6 +305,7 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res) * @pdata_len: amount of memory pointed to by @pdata * @pm_lats: pointer to a omap_device_pm_latency array for this device * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats + * @is_early_device: should the device be registered as an early device or not * * Convenience function for building and registering a single * omap_device record, which in turn builds and registers a @@ -316,7 +317,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, struct omap_hwmod *oh, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, - int pm_lats_cnt) + int pm_lats_cnt, int is_early_device) { struct omap_hwmod *ohs[] = { oh }; @@ -324,7 +325,8 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, return ERR_PTR(-EINVAL); return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata, - pdata_len, pm_lats, pm_lats_cnt); + pdata_len, pm_lats, pm_lats_cnt, + is_early_device); } /** @@ -336,6 +338,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, * @pdata_len: amount of memory pointed to by @pdata * @pm_lats: pointer to a omap_device_pm_latency array for this device * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats + * @is_early_device: should the device be registered as an early device or not * * Convenience function for building and registering an omap_device * subsystem record. Subsystem records consist of multiple @@ -347,7 +350,7 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, struct omap_hwmod **ohs, int oh_cnt, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, - int pm_lats_cnt) + int pm_lats_cnt, int is_early_device) { int ret = -ENOMEM; struct omap_device *od; @@ -403,7 +406,11 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, od->pm_lats = pm_lats; od->pm_lats_cnt = pm_lats_cnt; - ret = omap_device_register(od); + if (is_early_device) + ret = omap_early_device_register(od); + else + ret = omap_device_register(od); + if (ret) goto odbs_exit4; @@ -424,6 +431,24 @@ odbs_exit1: } /** + * omap_early_device_register - register an omap_device as an early platform + * device. + * @od: struct omap_device * to register + * + * Register the omap_device structure. This currently just calls + * platform_early_add_device() on the underlying platform_device. + * Returns 0 by default. + */ +int omap_early_device_register(struct omap_device *od) +{ + struct platform_device *devices[1]; + + devices[0] = &(od->pdev); + early_platform_add_devices(devices, 1); + return 0; +} + +/** * omap_device_register - register an omap_device with one omap_hwmod * @od: struct omap_device * to register *