From patchwork Tue May 1 17:47:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Ramirez Luna X-Patchwork-Id: 8322 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3945623E00 for ; Tue, 1 May 2012 17:47:54 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id F41A1A185B0 for ; Tue, 1 May 2012 17:47:53 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id l4so2590101yen.11 for ; Tue, 01 May 2012 10:47:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=evG4QywVkjqz6+Q3a+H+OXkntc1B4TEbkqCbG2E8rYw=; b=Z0chQ6lZMhfTtHZIAlrqD2bnmOwEeWrU8K5AJRQm/eROlCPtEc4Q/P65wFpzHoIFiz qR2nJ5MDCbIL9S0bHk5e/DnpqyxtHR05CwRBPFrblTZZzPPH7X9d+XlEMv65fE+e70Z6 vVG4CYH1Qa2sQiCJIsY8CxU1bC97D0XGxWKyf9JEPYSS0FVN+ZiE8j+PBqXgr8J7RsZR UWMe17tfseAp3wo6wC27mYR1saPTe1VzhQPJPOaQ6qaDxbfbCFXkKm+/TwjY91K5oqgU i74Tf90qkA/099NXI7eGqT5YMn2y3taaHPsyibFpqyu6cW30py5Tkinuy955HFK/WD9p KE0w== Received: by 10.50.217.230 with SMTP id pb6mr2799136igc.1.1335894473670; Tue, 01 May 2012 10:47:53 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp195698ibt; Tue, 1 May 2012 10:47:53 -0700 (PDT) Received: by 10.60.7.200 with SMTP id l8mr28183176oea.52.1335894472992; Tue, 01 May 2012 10:47:52 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id k10si7219871oeb.2.2012.05.01.10.47.52 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 May 2012 10:47:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.178 is neither permitted nor denied by best guess record for domain of omar.luna@linaro.org) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.178 is neither permitted nor denied by best guess record for domain of omar.luna@linaro.org) smtp.mail=omar.luna@linaro.org Received: by mail-ob0-f178.google.com with SMTP id eq6so4210136obc.37 for ; Tue, 01 May 2012 10:47:52 -0700 (PDT) Received: by 10.182.52.105 with SMTP id s9mr8713381obo.48.1335894472642; Tue, 01 May 2012 10:47:52 -0700 (PDT) Received: from localhost.localdomain (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id t5sm17008213oef.10.2012.05.01.10.47.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 May 2012 10:47:52 -0700 (PDT) From: Omar Ramirez Luna To: Benoit Cousson , devicetree-discuss@lists.ozlabs.org Cc: Grant Likely , Rob Herring , Rob Landley , Russell King , Tony Lindgren , Omar Ramirez Luna , linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, patches@linaro.org, linaro-dev@lists.linaro.org Subject: [PATCH 1/2] OMAP: mailbox: add device tree support Date: Tue, 1 May 2012 12:47:39 -0500 Message-Id: <1335894460-19941-2-git-send-email-omar.luna@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1335894460-19941-1-git-send-email-omar.luna@linaro.org> References: <1335894460-19941-1-git-send-email-omar.luna@linaro.org> X-Gm-Message-State: ALoCoQnwnGZM1W0xyI/GIlsX34QtgkU55+Jr8axpJpXC7/0whoksB1hc4/No83dugcwnAuiPUyTv Adapt driver to use DT if provided. Signed-off-by: Omar Ramirez Luna --- .../devicetree/bindings/arm/omap/mailbox.txt | 9 +++++++++ arch/arm/mach-omap2/devices.c | 3 +++ arch/arm/mach-omap2/mailbox.c | 12 ++++++++++++ 3 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/omap/mailbox.txt diff --git a/Documentation/devicetree/bindings/arm/omap/mailbox.txt b/Documentation/devicetree/bindings/arm/omap/mailbox.txt new file mode 100644 index 0000000..c57c0d5 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/omap/mailbox.txt @@ -0,0 +1,9 @@ +OMAP Mailbox module + +Required properties: + compatible : should be "ti,omap2-mailbox" for OMAP2 mailbox + compatible : should be "ti,omap3-mailbox" for OMAP3 mailbox + compatible : should be "ti,omap4-mailbox" for OMAP4 mailbox + +Optional properties: + None diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index e433603..7a78063 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -281,6 +281,9 @@ static inline void __init omap_init_mbox(void) struct omap_hwmod *oh; struct platform_device *pdev; + if (of_have_populated_dt()) + return; + oh = omap_hwmod_lookup("mailbox"); if (!oh) { pr_err("%s: unable to find hwmod\n", __func__); diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index 415a6f1..7cf12ca 100644 --- a/arch/arm/mach-omap2/mailbox.c +++ b/arch/arm/mach-omap2/mailbox.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -402,11 +403,22 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev) return 0; } +#if defined(CONFIG_OF) +static const struct of_device_id omap_mailbox_of_match[] = { + { .compatible = "ti,omap2-mailbox" }, + { .compatible = "ti,omap3-mailbox" }, + { .compatible = "ti,omap4-mailbox" }, + {}, +}; +MODULE_DEVICE_TABLE(of, omap_mailbox_of_match); +#endif + static struct platform_driver omap2_mbox_driver = { .probe = omap2_mbox_probe, .remove = __devexit_p(omap2_mbox_remove), .driver = { .name = "omap-mailbox", + .of_match_table = of_match_ptr(omap_mailbox_of_match), }, };