From patchwork Tue Aug 7 13:37:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 1285951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id DDF1F3FC23 for ; Tue, 7 Aug 2012 14:19:16 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SykZw-0004Mx-3z; Tue, 07 Aug 2012 14:16:12 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SykZs-0004MR-2G for linux-arm-kernel@lists.infradead.org; Tue, 07 Aug 2012 14:16:09 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id q77EG3SA003610; Tue, 7 Aug 2012 09:16:04 -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 q77EG2b4027785; Tue, 7 Aug 2012 19:46:02 +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, 7 Aug 2012 19:46:01 +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 q77EG0lN015816; Tue, 7 Aug 2012 19:46:00 +0530 From: Vaibhav Hiremath To: Subject: [PATCH] ARM: AM33XX: board-generic: Add of_dev_auxdata to fix dev_id for CAN module Date: Tue, 7 Aug 2012 19:07:16 +0530 Message-ID: <1344346636-28072-1-git-send-email-hvaibhav@ti.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Paul Walmsley , Benoit Cousson , Tony Lindgren , Vaibhav Hiremath , Grant Likely , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If the module requires only one clocksource to function, then driver can very well call clk_get() api with "con_id = NULL", clk = clk_get(dev, NULL); And platform code should respect this and return valid clk handle. That means, now the clk_get() api would rely on dev_id, and platform code should either have clk node with matching dev_id (with con_id=NULL) or return dummy clk node. With DT support, we can fix the dev_id for particular module using "struct of_dev_auxdata" to satisfy above clk framework requirement. In case of AM33XX, we required this for the DCAN module, so this patch adds "of_dev_auxdata" for both DCAN_0/1 instances. Signed-off-by: Vaibhav Hiremath Cc: Tony Lindgren Cc: Paul Walmsley Cc: Benoit Cousson Cc: Grant Likely --- This patch is boot tested on BeagleBone platform, and checked for clk_get() return value in d_can module driver. arch/arm/mach-omap2/board-generic.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) -- 1.7.0.4 diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 6f93a20..c9b7903 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -37,11 +37,27 @@ static struct of_device_id omap_dt_match_table[] __initdata = { { } }; +/* + * Lookup table for attaching a specific name and platform_data pointer to + * devices as they get created by of_platform_populate(). Ideally this table + * would not exist, but the current clock implementation depends on some devices + * having a specific name OR to satisfy NULL con_id requirement from driver. + */ +static const struct of_dev_auxdata am33xx_auxdata_lookup[] __initconst = { + OF_DEV_AUXDATA("bosch,d_can", 0x481cc000, "d_can.0", NULL), + OF_DEV_AUXDATA("bosch,d_can", 0x481d0000, "d_can.1", NULL), + { }, +}; + static void __init omap_generic_init(void) { omap_sdrc_init(NULL, NULL); - of_platform_populate(NULL, omap_dt_match_table, NULL, NULL); + if (of_machine_is_compatible("ti,am33xx")) + of_platform_populate(NULL, omap_dt_match_table, + am33xx_auxdata_lookup, NULL); + else + of_platform_populate(NULL, omap_dt_match_table, NULL, NULL); } #ifdef CONFIG_SOC_OMAP2420