From patchwork Tue Sep 11 09:56:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Afzal Mohammed X-Patchwork-Id: 1436871 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8CCD5DFAF3 for ; Tue, 11 Sep 2012 09:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754800Ab2IKJ5J (ORCPT ); Tue, 11 Sep 2012 05:57:09 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:47516 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751118Ab2IKJ5I (ORCPT ); Tue, 11 Sep 2012 05:57:08 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8B9v1ed023899; Tue, 11 Sep 2012 04:57:01 -0500 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8B9v0V7014964; Tue, 11 Sep 2012 15:27:00 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Tue, 11 Sep 2012 15:27:00 +0530 Received: from localhost.localdomain (dbdp20.itg.ti.com [172.24.170.38]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8B9v0mb012587; Tue, 11 Sep 2012 15:27:00 +0530 From: Afzal Mohammed To: , , , , CC: Afzal Mohammed Subject: [PATCH v9 2/3] ARM: OMAP2+: gpmc: Adapt to HWMOD Date: Tue, 11 Sep 2012 15:26:59 +0530 Message-ID: <16f0c80689d98fb713f1824ec4df6a12606847e4.1347355380.git.afzal@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Create API for platforms to adapt GPMC to HWMOD Signed-off-by: Afzal Mohammed Reviewed-by: Jon Hunter --- arch/arm/mach-omap2/gpmc.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 055ae8b..5462666 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c @@ -31,10 +31,13 @@ #include #include #include +#include #include "soc.h" #include "common.h" +#define DEVICE_NAME "omap-gpmc" + /* GPMC register offsets */ #define GPMC_REVISION 0x00 #define GPMC_SYSCONFIG 0x10 @@ -898,6 +901,25 @@ static int __init gpmc_init(void) } postcore_initcall(gpmc_init); +static int __init omap_gpmc_init(void) +{ + struct omap_hwmod *oh; + struct platform_device *pdev; + char *oh_name = "gpmc"; + + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + pr_err("Could not look up %s\n", oh_name); + return -ENODEV; + } + + pdev = omap_device_build(DEVICE_NAME, -1, oh, NULL, 0, NULL, 0, 0); + WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); + + return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; +} +postcore_initcall(omap_gpmc_init); + static irqreturn_t gpmc_handle_irq(int irq, void *dev) { int i;