From patchwork Sat May 22 17:25:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 101662 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 o4MHPgCx019196 for ; Sat, 22 May 2010 17:25:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755901Ab0EVRZl (ORCPT ); Sat, 22 May 2010 13:25:41 -0400 Received: from fg-out-1718.google.com ([72.14.220.156]:59392 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755868Ab0EVRZk (ORCPT ); Sat, 22 May 2010 13:25:40 -0400 Received: by fg-out-1718.google.com with SMTP id 22so789246fge.1 for ; Sat, 22 May 2010 10:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=+JiQq5J2JAvbSKWcQmzJqr2RAQaYru0GQOyFahaXnA4=; b=KS8imktR+xDOI1VqelgNKg82QsMvfwTRQDKzg+HR13lCdWR6YAXwwhWmbjBZAy5WK5 tPMFJtWk8jLSS2+ntcffWqKEm+KzDlgbwa+CZ/26WzKgcyKDTl4+ZVWFRbXKiRIzreiU rr43w9knU9F9DDQEljnrRjmgJH3jvzEay/XRM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=Vm2Dk0ysQZ/PGItqqoSFqFQ2UdndXXHZNzZScqJkVIjBmMwjT80zDdieKwkGrP1AzQ HYSNjse48MSvX9SRfU+nqznvmfUQryTYeqlw6jwbAM5QSRfCNzbFgVgvgj470dBZjXtW oeDBgQkrE+auMCyk+q46328rb3OsuAnd977jc= Received: by 10.204.15.1 with SMTP id i1mr1010506bka.207.1274549138822; Sat, 22 May 2010 10:25:38 -0700 (PDT) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id 24sm10241573bkr.0.2010.05.22.10.25.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 22 May 2010 10:25:38 -0700 (PDT) From: Felipe Contreras To: linux-omap Cc: Hiroshi Doyu , Kevin Hilman , Paul Walmsley , Ohad Ben-Cohen , Felipe Contreras Subject: [RFC/PATCH 2/2] omap: mailbox: add omap_device latency information Date: Sat, 22 May 2010 20:25:22 +0300 Message-Id: <1274549122-26521-3-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1274549122-26521-1-git-send-email-felipe.contreras@gmail.com> References: <1274549122-26521-1-git-send-email-felipe.contreras@gmail.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.3 (demeter.kernel.org [140.211.167.41]); Sat, 22 May 2010 17:25:42 +0000 (UTC) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 89f6cbc..e6cb1d3 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -139,6 +139,14 @@ static inline void omap_init_camera(void) #endif #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) +static struct omap_device_pm_latency mbox_latencies[] = { + [0] = { .activate_func = omap_device_enable_clocks, + .activate_lat = 50000, /* FIXME random value */ + .deactivate_func = omap_device_enable_clocks, + .deactivate_lat = 50000, /* FIXME random value */ + }, +}; + static inline void omap_init_mbox(void) { struct omap_hwmod *hwmod; @@ -152,10 +160,12 @@ static inline void omap_init_mbox(void) } pdata.base_addr = hwmod->_rt_va; + pdata.device_enable = omap_device_enable; + pdata.device_disable = omap_device_idle; odev = omap_device_build("omap-mailbox", -1, hwmod, &pdata, sizeof(pdata), - NULL, 0, + mbox_latencies, ARRAY_SIZE(mbox_latencies), 0); if (!odev) { pr_err("%s: could not build device\n", __func__); diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index baaaa5a..157a764 100644 --- a/arch/arm/mach-omap2/mailbox.c +++ b/arch/arm/mach-omap2/mailbox.c @@ -53,6 +53,7 @@ #define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / sizeof(u32)) static void __iomem *mbox_base; +static struct platform_device *mbox_pdev; struct omap_mbox2_fifo { unsigned long msg; @@ -71,8 +72,6 @@ struct omap_mbox2_priv { unsigned long irqdisable; }; -static struct clk *mbox_ick_handle; - static void omap2_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq); @@ -91,14 +90,10 @@ static int omap2_mbox_startup(struct omap_mbox *mbox) { u32 l; unsigned long timeout; + struct omap_mbox_platform_data *pdata = mbox_pdev->dev.platform_data; - mbox_ick_handle = clk_get(NULL, "mailboxes_ick"); - if (IS_ERR(mbox_ick_handle)) { - printk(KERN_ERR "Could not get mailboxes_ick: %ld\n", - PTR_ERR(mbox_ick_handle)); - return PTR_ERR(mbox_ick_handle); - } - clk_enable(mbox_ick_handle); + if (pdata->device_enable) + pdata->device_enable(mbox_pdev); if (cpu_is_omap44xx()) { mbox_write_reg(OMAP4_SOFTRESET, MAILBOX_SYSCONFIG); @@ -144,9 +139,9 @@ static int omap2_mbox_startup(struct omap_mbox *mbox) static void omap2_mbox_shutdown(struct omap_mbox *mbox) { - clk_disable(mbox_ick_handle); - clk_put(mbox_ick_handle); - mbox_ick_handle = NULL; + struct omap_mbox_platform_data *pdata = mbox_pdev->dev.platform_data; + if (pdata->device_disable) + pdata->device_disable(mbox_pdev); } /* Mailbox FIFO handle functions */ @@ -423,6 +418,7 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev) } mbox_base = pdata->base_addr; + mbox_pdev = pdev; ret = omap_mbox_register(&pdev->dev, list); if (ret) diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h index 78060bd..a68fdda 100644 --- a/arch/arm/plat-omap/include/plat/mailbox.h +++ b/arch/arm/plat-omap/include/plat/mailbox.h @@ -11,6 +11,7 @@ typedef u32 mbox_msg_t; struct omap_mbox; +struct platform_device; typedef int __bitwise omap_mbox_irq_t; #define IRQ_TX ((__force omap_mbox_irq_t) 1) @@ -61,6 +62,8 @@ struct omap_mbox { struct omap_mbox_platform_data { void __iomem *base_addr; + int (*device_enable)(struct platform_device *pdev); + int (*device_disable)(struct platform_device *pdev); }; int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);