From: b-cousson@ti.com (Cousson, Benoit)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/7] omap: mailbox: add omap_device latency information
Date: Sat, 06 Nov 2010 14:09:54 -0400 [thread overview]
Message-ID: <4CD599F2.40205@ti.com> (raw)
In-Reply-To: <1289006244-27147-6-git-send-email-omar.ramirez@ti.com>
On 11/5/2010 9:17 PM, Ramirez Luna, Omar wrote:
> From: Felipe Contreras<felipe.contreras@gmail.com>
>
> So that we can enable the main clock.
Why not going directly to the runtime PM interface? It will save you
some effort, because most of this code is useless with runtime PM.
Moreover, even without runtime PM, you should not need at all the
SYSCONFIG stuff you still have in this driver.
36 /* SYSCONFIG: register bit definition */
37 #define AUTOIDLE (1 << 0)
38 #define SOFTRESET (1 << 1)
39 #define SMARTIDLE (2 << 3)
40 #define OMAP4_SOFTRESET (1 << 0)
41 #define OMAP4_NOIDLE (1 << 2)
42 #define OMAP4_SMARTIDLE (2 << 2)
That patch seems to me the perfect place to get rid of that.
Thanks,
Benoit
>
> Signed-off-by: Felipe Contreras<felipe.contreras@gmail.com>
> Signed-off-by: Omar Ramirez Luna<omar.ramirez@ti.com>
> ---
> arch/arm/mach-omap2/devices.c | 18 ++++++++++++++++--
> arch/arm/mach-omap2/mailbox.c | 21 +++++++++------------
> arch/arm/plat-omap/include/plat/mailbox.h | 6 ++++++
> 3 files changed, 31 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> index d977572..dafc23a 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -29,6 +29,7 @@
> #include<plat/dma.h>
> #include<plat/omap_hwmod.h>
> #include<plat/omap_device.h>
> +#include<plat/mailbox.h>
>
> #include "mux.h"
> #include "control.h"
> @@ -141,10 +142,19 @@ 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,
> + .deactivate_func = omap_device_enable_clocks,
> + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> + },
> +};
> +
> static inline void omap_init_mbox(void)
> {
> struct omap_hwmod *oh;
> struct omap_device *od;
> + struct omap_mbox_platform_data pdata;
>
> oh = omap_hwmod_lookup("mailbox");
> if (!oh) {
> @@ -152,10 +162,14 @@ static inline void omap_init_mbox(void)
> return;
> }
>
> + pdata.device_enable = omap_device_enable;
> + pdata.device_disable = omap_device_idle;
> +
> od = omap_device_build("omap-mailbox", -1, oh,
> - NULL, 0,
> - NULL, 0,
> + &pdata, sizeof(pdata),
> + mbox_latencies, ARRAY_SIZE(mbox_latencies),
> 0);
> +
> if (!od) {
> pr_err("%s: could not build device\n", __func__);
> return;
> diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
> index 40ddeca..bf598a3 100644
> --- a/arch/arm/mach-omap2/mailbox.c
> +++ b/arch/arm/mach-omap2/mailbox.c
> @@ -52,6 +52,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;
> @@ -70,8 +71,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);
>
> @@ -90,14 +89,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);
> @@ -143,9 +138,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 */
> @@ -427,6 +422,8 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
> if (!mbox_base)
> return -ENOMEM;
>
> + mbox_pdev = pdev;
> +
> ret = omap_mbox_register(&pdev->dev, list);
> if (ret) {
> iounmap(mbox_base);
> diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h
> index 9976565..59443b1 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)
> @@ -59,6 +60,11 @@ struct omap_mbox {
> void *priv;
> };
>
> +struct omap_mbox_platform_data {
> + 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);
> void omap_mbox_init_seq(struct omap_mbox *);
>
next prev parent reply other threads:[~2010-11-06 18:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-06 1:17 [PATCH v2 0/7] omap: mailbox: hwmod support and dependent cleanup patches Omar Ramirez Luna
2010-11-06 1:17 ` [PATCH v2 1/7] OMAP2: hwmod data: add mailbox data Omar Ramirez Luna
2010-11-06 17:08 ` Cousson, Benoit
2010-11-07 14:27 ` Ramirez Luna, Omar
2010-11-06 1:17 ` [PATCH v2 2/7] OMAP3: " Omar Ramirez Luna
2010-11-06 1:17 ` [PATCH v2 3/7] OMAP4: " Omar Ramirez Luna
2010-11-06 17:18 ` Cousson, Benoit
2010-11-07 15:07 ` Ramirez Luna, Omar
2010-11-08 8:56 ` Cousson, Benoit
2010-11-08 16:55 ` Ramirez Luna, Omar
2010-11-06 1:17 ` [PATCH v2 4/7] omap: mailbox: initial hwmod support Omar Ramirez Luna
2010-11-06 17:44 ` Cousson, Benoit
2010-11-06 1:17 ` [PATCH v2 5/7] omap: mailbox: add omap_device latency information Omar Ramirez Luna
2010-11-06 18:09 ` Cousson, Benoit [this message]
2010-11-06 1:17 ` [PATCH v2 6/7] omap: mailbox: fix detection for previously supported chips Omar Ramirez Luna
2010-11-06 18:11 ` Cousson, Benoit
2010-11-07 15:15 ` Ramirez Luna, Omar
2010-11-07 21:05 ` Felipe Contreras
2010-11-08 16:05 ` Ramirez Luna, Omar
2010-11-08 21:43 ` Cousson, Benoit
2010-11-06 1:17 ` [PATCH v2 7/7] omap: mailbox: remove unreachable return Omar Ramirez Luna
2010-11-06 18:21 ` Cousson, Benoit
2010-11-07 15:18 ` Ramirez Luna, Omar
2010-11-06 18:32 ` [PATCH v2 0/7] omap: mailbox: hwmod support and dependent cleanup patches Cousson, Benoit
2010-11-07 15:19 ` Ramirez Luna, Omar
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=4CD599F2.40205@ti.com \
--to=b-cousson@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).