From patchwork Fri May 14 15:01:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 99634 X-Patchwork-Delegate: hiroshi.doyu@nokia.com 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 o4EF2TfX031871 for ; Fri, 14 May 2010 15:02:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755874Ab0ENPC1 (ORCPT ); Fri, 14 May 2010 11:02:27 -0400 Received: from mail-ew0-f216.google.com ([209.85.219.216]:44846 "EHLO mail-ew0-f216.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755631Ab0ENPC0 (ORCPT ); Fri, 14 May 2010 11:02:26 -0400 Received: by mail-ew0-f216.google.com with SMTP id 8so902320ewy.28 for ; Fri, 14 May 2010 08:02:25 -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=/qG81ZTlTWqQJiFjEF5gE7VHgtEmkDxLcp5m40z4Y4E=; b=qgmuzBTQL1VY4cLMyIPD3OrJO97y0C5w5cZh/lfHfYrgK3ofrZHa0augfmaHUTK8/z b21awdtsaVkkzs2Sg6TlaRIY9Froo6qeCQgDeE7biLCz0hF1ZxGH7kSGSXw9kH3IFmMH NpC3Ni4ozScaefrnRXwZjH5oyM4c2icSmAvRg= 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=RyCVjLxVPtmPcUZBomkU7MkXlQVI0nYb5+QzuyLB+P3bhDLtbTLneTw2/V0j20mmHL JHfQf9HFUd574PLWdvFlMvm/2gMpqmiid/4k8SW9j3VTX7Z4GNLNsv2J9Nm+L9Zxp1Ml TjmAbd0fpAwtq2Upnu9D/ilsy6aP+zDiEQTNw= Received: by 10.213.75.204 with SMTP id z12mr753891ebj.16.1273849342750; Fri, 14 May 2010 08:02:22 -0700 (PDT) Received: from localhost ([192.100.124.156]) by mx.google.com with ESMTPS id 13sm1304082ewy.5.2010.05.14.08.02.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 14 May 2010 08:02:22 -0700 (PDT) From: Felipe Contreras To: linux-omap Cc: linux-arm , Hiroshi Doyu , Tony Lindgren , Russell King , Felipe Contreras Subject: [PATCH v2 10/17] omap: mailbox: move more stuff to omap_mbox_init() Date: Fri, 14 May 2010 18:01:43 +0300 Message-Id: <1273849310-32169-11-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1273849310-32169-1-git-send-email-felipe.contreras@gmail.com> References: <1273849310-32169-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]); Fri, 14 May 2010 15:02:29 +0000 (UTC) diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c index 25f1f89..8c1b83f 100644 --- a/arch/arm/mach-omap1/mailbox.c +++ b/arch/arm/mach-omap1/mailbox.c @@ -169,14 +169,6 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev) res = pdev->resource; - mbox_base = ioremap(res[0].start, resource_size(&res[0])); - if (!mbox_base) - return -ENOMEM; - - list = omap1_mboxes; - - list[0]->irq = res[1].start; - for (i = 0; list[i]; i++) { ret = omap_mbox_register(&pdev->dev, list[i]); if (ret) @@ -187,7 +179,6 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev) err_out: while (i--) omap_mbox_unregister(list[i]); - iounmap(mbox_base); return ret; } @@ -198,7 +189,6 @@ static int __devexit omap1_mbox_remove(struct platform_device *pdev) for (i = 0; list[i]; i++) omap_mbox_unregister(list[i]); - iounmap(mbox_base); return 0; } @@ -222,14 +212,20 @@ static int __init omap1_mbox_init(void) else if (cpu_is_omap15xx()) { res = omap1_mbox_resources; num = ARRAY_SIZE(omap1_mbox_resources); + list = omap1_mboxes; + res[1].end += 0x23; + list[0]->irq = res[1].start; } #endif #if defined(CONFIG_ARCH_OMAP16XX) else if (cpu_is_omap16xx()) { res = omap1_mbox_resources; num = ARRAY_SIZE(omap1_mbox_resources); + list = omap1_mboxes; + res[1].end += 0x2f; + list[0]->irq = res[1].start; } #endif else { @@ -251,6 +247,12 @@ static int __init omap1_mbox_init(void) if (err) goto err_out; + mbox_base = ioremap(res[0].start, resource_size(&res[0])); + if (!mbox_base) { + platform_device_put(pdev); + return -ENOMEM; + } + return platform_driver_register(&omap1_mbox_driver); err_out: @@ -260,6 +262,7 @@ err_out: static void __exit omap1_mbox_exit(void) { platform_driver_unregister(&omap1_mbox_driver); + iounmap(mbox_base); } module_init(omap1_mbox_init); diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index 59e85fd..4f3b84e 100644 --- a/arch/arm/mach-omap2/mailbox.c +++ b/arch/arm/mach-omap2/mailbox.c @@ -448,35 +448,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev) res = pdev->resource; - mbox_base = ioremap(res[0].start, resource_size(&res[0])); - if (!mbox_base) - return -ENOMEM; - - if (false); -#if defined(CONFIG_ARCH_OMAP3430) - else if (cpu_is_omap3430()) { - list = omap3_mboxes; - - list[0]->irq = res[1].start; - } -#endif -#if defined(CONFIG_ARCH_OMAP2420) - else if (cpu_is_omap2420()) { - list = omap2_mboxes; - - list[0]->irq = res[1].start; - list[1]->irq = res[2].start; - } -#endif -#if defined(CONFIG_ARCH_OMAP4) - else if (cpu_is_omap44xx()) { - list = omap4_mboxes; - - list[0]->irq = res[1].start; - list[1]->irq = res[1].start; - } -#endif - for (i = 0; list[i]; i++) { ret = omap_mbox_register(&pdev->dev, list[i]); if (ret) @@ -487,7 +458,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev) err_out: while (i--) omap_mbox_unregister(list[i]); - iounmap(mbox_base); return ret; } @@ -498,7 +468,6 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev) for (i = 0; list[i]; i++) omap_mbox_unregister(list[i]); - iounmap(mbox_base); return 0; } @@ -522,18 +491,29 @@ static int __init omap2_mbox_init(void) else if (cpu_is_omap3430()) { res = omap3_mbox_resources; num = ARRAY_SIZE(omap3_mbox_resources); + list = omap3_mboxes; + + list[0]->irq = res[1].start; } #endif #if defined(CONFIG_ARCH_OMAP2420) else if (cpu_is_omap2420()) { res = omap2_mbox_resources; num = ARRAY_SIZE(omap2_mbox_resources); + list = omap2_mboxes; + + list[0]->irq = res[1].start; + list[1]->irq = res[2].start; } #endif #if defined(CONFIG_ARCH_OMAP4) else if (cpu_is_omap44xx()) { res = omap4_mbox_resources; num = ARRAY_SIZE(omap4_mbox_resources); + list = omap4_mboxes; + + list[0]->irq = res[1].start; + list[1]->irq = res[1].start; } #endif else { @@ -555,6 +535,12 @@ static int __init omap2_mbox_init(void) if (err) goto err_out; + mbox_base = ioremap(res[0].start, resource_size(&res[0])); + if (!mbox_base) { + platform_device_put(pdev); + return -ENOMEM; + } + return platform_driver_register(&omap2_mbox_driver); err_out: @@ -564,6 +550,7 @@ err_out: static void __exit omap2_mbox_exit(void) { platform_driver_unregister(&omap2_mbox_driver); + iounmap(mbox_base); } module_init(omap2_mbox_init);