From patchwork Thu Sep 13 00:08:14 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: 1448841 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 0CABCDF238 for ; Thu, 13 Sep 2012 00:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756162Ab2IMAJm (ORCPT ); Wed, 12 Sep 2012 20:09:42 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:35711 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757433Ab2IMAIl (ORCPT ); Wed, 12 Sep 2012 20:08:41 -0400 Received: by mail-ob0-f174.google.com with SMTP id uo13so3595762obb.19 for ; Wed, 12 Sep 2012 17:08:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=nPwjbv5f6Hrvjl/OC9gIaNz7GbHWC6uzMIWhjNqPLe4=; b=ZkxbISdDVF/bezUyMM5sEc5s6IqzL49so2FbcPSfUgUr/HHP8RgbxsbBBnPGyKIANM HRLwFkt8oqt6vRBves389/mY4OphruTOwvwpp6IJd5wU3hkI3Bl5S9o+7vm/QpEdIwAA GfKPVYvvf2lp5EzJ2PVHfyUrkxqDWQenATFefsXcuIzCdooKDxIhiRV/FwQREX/uRbJu fHzF5L4Em599DUrJQFFzZQ7lJDGN1ARlagBCVu6YqgvFS4DIW1zfeoUye1Be4V7Glfr7 ZT01X7VveHnlz8Oy2Kuq1ussG+gyoKuK5rf8l6dpMbUV1fy6pxIKMRU23ney5OXlTjZr dv+A== Received: by 10.182.174.100 with SMTP id br4mr141570obc.62.1347494921068; Wed, 12 Sep 2012 17:08:41 -0700 (PDT) Received: from uda0273944.am.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id hz6sm21868178obb.1.2012.09.12.17.08.40 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 17:08:40 -0700 (PDT) From: Omar Ramirez Luna To: Tony Lindgren , Benoit Cousson Cc: Russell King , Omar Ramirez Luna , devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Subject: [PATCH v2 1/2] OMAP: mailbox: add device tree support Date: Wed, 12 Sep 2012 19:08:14 -0500 Message-Id: <1347494898-16671-2-git-send-email-omar.luna@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347494898-16671-1-git-send-email-omar.luna@linaro.org> References: <1347494898-16671-1-git-send-email-omar.luna@linaro.org> X-Gm-Message-State: ALoCoQnPYXO0SPVL31B4ppfFEdWagJqWvpCaoEc9S+ntZPg6SUYLQmewYwSjyXpfYOsu+AxFQGlz Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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(+) 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 c00c689..19093fb 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -279,6 +279,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 6875be8..80beadf 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 @@ -400,11 +401,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), }, };