From patchwork Mon Mar 21 11:10:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 647721 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2LBAbJ2013548 for ; Mon, 21 Mar 2011 11:10:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752774Ab1CULKg (ORCPT ); Mon, 21 Mar 2011 07:10:36 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:51850 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850Ab1CULKd (ORCPT ); Mon, 21 Mar 2011 07:10:33 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p2LBAScR018465 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Mar 2011 06:10:30 -0500 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 p2LBAPjh012849; Mon, 21 Mar 2011 16:40:25 +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 p2LBAPQf012830; Mon, 21 Mar 2011 16:40:25 +0530 Received: (from a0131687@localhost) by linfarm476.india.ti.com (8.12.11/8.12.11/Submit) id p2LBAPi5012828; Mon, 21 Mar 2011 16:40:25 +0530 From: Rajendra Nayak To: linux-omap@vger.kernel.org Cc: paul@pwsan.com, b-cousson@ti.com, Rajendra Nayak Subject: [RFC 3/3] OMAP3: omap_device: Add support to associate a device with an initiator Date: Mon, 21 Mar 2011 16:40:23 +0530 Message-Id: <1300705823-12784-4-git-send-email-rnayak@ti.com> X-Mailer: git-send-email 1.5.6.6 In-Reply-To: <1300705823-12784-3-git-send-email-rnayak@ti.com> References: <1300705823-12784-1-git-send-email-rnayak@ti.com> <1300705823-12784-2-git-send-email-rnayak@ti.com> <1300705823-12784-3-git-send-email-rnayak@ti.com> 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]); Mon, 21 Mar 2011 11:10:38 +0000 (UTC) diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index 9bbda9a..0cd05d2 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c @@ -662,6 +662,60 @@ int omap_device_shutdown(struct platform_device *pdev) return ret; } +static int omap_device_add_initiator_user(struct platform_device *pdev, + u8 init_id) +{ + int i; + struct omap_device *od; + + od = _find_by_pdev(pdev); + + if (od->_state != OMAP_DEVICE_STATE_ENABLED) + return -EINVAL; + + for (i = 0; i < od->hwmods_cnt; i++) + omap_hwmod_add_initiator_user(od->hwmods[i], init_id); + + return 0; +} + +inline int omap_device_add_mpu_user(struct platform_device *pdev) +{ + return omap_device_add_initiator_user(pdev, OMAP_INIT_MPU); +} + +inline int omap_device_add_iva_user(struct platform_device *pdev) +{ + return omap_device_add_initiator_user(pdev, OMAP_INIT_IVA); +} + +static int omap_device_del_initiator_user(struct platform_device *pdev, + u8 init_id) +{ + int i; + struct omap_device *od; + + od = _find_by_pdev(pdev); + + if (od->_state == OMAP_DEVICE_STATE_ENABLED) + return -EINVAL; + + for (i = 0; i < od->hwmods_cnt; i++) + omap_hwmod_del_initiator_user(od->hwmods[i], init_id); + + return 0; +} + +inline int omap_device_del_mpu_user(struct platform_device *pdev) +{ + return omap_device_del_initiator_user(pdev, OMAP_INIT_MPU); +} + +inline int omap_device_del_iva_user(struct platform_device *pdev) +{ + return omap_device_del_initiator_user(pdev, OMAP_INIT_IVA); +} + /** * omap_device_align_pm_lat - activate/deactivate device to match wakeup lat lim * @od: struct omap_device *