From patchwork Thu Jul 1 22:23:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 109765 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o61MOHlo030248 for ; Thu, 1 Jul 2010 22:24:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933527Ab0GAWXo (ORCPT ); Thu, 1 Jul 2010 18:23:44 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:49802 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759822Ab0GAWXm (ORCPT ); Thu, 1 Jul 2010 18:23:42 -0400 Received: by mail-bw0-f46.google.com with SMTP id 1so1212780bwz.19 for ; Thu, 01 Jul 2010 15:23:41 -0700 (PDT) Received: by 10.204.81.74 with SMTP id w10mr124016bkk.79.1278023021403; Thu, 01 Jul 2010 15:23:41 -0700 (PDT) Received: from localhost.localdomain (93-173-171-226.bb.netvision.net.il [93.173.171.226]) by mx.google.com with ESMTPS id s34sm141464bkk.13.2010.07.01.15.23.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 01 Jul 2010 15:23:40 -0700 (PDT) From: Ohad Ben-Cohen To: Cc: Kanigeri Hari , Ohad Ben-Cohen Subject: [RFC 5/6] omap: add remoteproc device(s) Date: Fri, 2 Jul 2010 01:23:13 +0300 Message-Id: <1278022994-28476-6-git-send-email-ohad@wizery.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1278022994-28476-1-git-send-email-ohad@wizery.com> References: <1278022994-28476-1-git-send-email-ohad@wizery.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]); Thu, 01 Jul 2010 22:24:19 +0000 (UTC) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 18ad931..d365db6 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -26,9 +27,13 @@ #include #include #include +#include #include "mux.h" +#include +#include + #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) static struct resource cam_resources[] = { @@ -136,6 +141,86 @@ static inline void omap_init_camera(void) } #endif +#if defined(CONFIG_OMAP_REMOTE_PROC) || defined(CONFIG_OMAP_REMOTE_PROC_MODULE) +static struct omap_device_pm_latency omap_rproc_latency[] = { + { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .deactivate_lat = 1, + .activate_lat = 1, + }, +}; + +static struct omap_rproc_platform_data *omap_get_remoteproc_data(void) +{ + struct omap_rproc_platform_data *rproc_data = NULL; + + if (cpu_is_omap3430() || cpu_is_omap3630()) + rproc_data = omap3_get_rproc_data(); + else if (cpu_is_omap44xx()) + rproc_data = omap4_get_rproc_data(); + else + pr_err("%s: platform not supported\n", __func__); + + return rproc_data; +} + +int omap_get_num_of_remoteproc(void) +{ + int num = -1; + + if (cpu_is_omap3430() || cpu_is_omap3630()) + num = omap3_get_rproc_data_size(); + else if (cpu_is_omap44xx()) + num = omap4_get_rproc_data_size(); + else + pr_err("%s: platform not supported\n", __func__); + + return num; +} +EXPORT_SYMBOL(omap_get_num_of_remoteproc); + +static inline void omap_init_rproc(void) +{ + struct omap_hwmod *oh; + struct omap_device *od; + struct omap_device_pm_latency *ohl; + char *oh_name, *pdev_name; + int ohl_cnt = 0, i; + int rproc_data_size; + struct omap_rproc_platform_data *rproc_data; + + pdev_name = "omap-rproc"; + ohl = omap_rproc_latency; + ohl_cnt = ARRAY_SIZE(omap_rproc_latency); + + rproc_data = omap_get_remoteproc_data(); + rproc_data_size = omap_get_num_of_remoteproc(); + if (rproc_data == NULL || rproc_data_size <= 0) { + pr_err("%s: platform not supported\n", __func__); + return; + } + + for (i = 0; i < rproc_data_size; i++) { + oh_name = rproc_data[i].oh_name; + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + pr_err("%s: could not look up %s\n", __func__, oh_name); + continue; + } + + od = omap_device_build(pdev_name, i, oh, + &rproc_data[i], + sizeof(struct omap_rproc_platform_data), + ohl, ohl_cnt); + WARN(IS_ERR(od), "Could not build omap_device for %s %s\n", + pdev_name, oh_name); + } +} +#else +static inline void omap_init_rproc(void) { } +#endif /* CONFIG_OMAP_REMOTE_PROC */ + #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) #define MBOX_REG_SIZE 0x120 @@ -773,6 +858,7 @@ static int __init omap2_init_devices(void) omap_hsmmc_reset(); omap_init_camera(); omap_init_mbox(); + omap_init_rproc(); omap_init_mcspi(); omap_hdq_init(); omap_init_sti();