From patchwork Fri Sep 2 11:43:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit Cousson X-Patchwork-Id: 1121742 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p82BiGpW016752 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 2 Sep 2011 11:44:37 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QzSAC-0001Ql-A4; Fri, 02 Sep 2011 11:44:00 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QzSAB-0006gQ-RL; Fri, 02 Sep 2011 11:43:59 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QzSA7-0006g7-2Q for linux-arm-kernel@lists.infradead.org; Fri, 02 Sep 2011 11:43:56 +0000 Received: from dlep36.itg.ti.com ([157.170.170.91]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p82BhqJJ031302 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Sep 2011 06:43:52 -0500 Received: from dlep26.itg.ti.com (smtp-le.itg.ti.com [157.170.170.27]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id p82Bhqt3013663; Fri, 2 Sep 2011 06:43:52 -0500 (CDT) Received: from DLEE74.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id p82Bhp3t021676; Fri, 2 Sep 2011 06:43:52 -0500 (CDT) Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Fri, 2 Sep 2011 06:43:51 -0500 Received: from [137.167.125.104] (cnc0919096.emea.dhcp.ti.com [137.167.125.104]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id p82BhniF018556; Fri, 2 Sep 2011 06:43:50 -0500 Message-ID: <4E60C174.50604@ti.com> Date: Fri, 2 Sep 2011 13:43:48 +0200 From: "Cousson, Benoit" Organization: Texas Instruments User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1 MIME-Version: 1.0 To: Tony Lindgren Subject: Re: [PATCH 6/7] OMAP3: board-dt: Add generic board file for DT support References: <1314897912-18178-1-git-send-email-b-cousson@ti.com> <1314897912-18178-7-git-send-email-b-cousson@ti.com> <20110902080944.GP3548@atomide.com> <4E609800.9090402@ti.com> <20110902104330.GR3548@atomide.com> In-Reply-To: <20110902104330.GR3548@atomide.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110902_074355_253613_7998C3E4 X-CRM114-Status: GOOD ( 29.81 ) X-Spam-Score: -2.8 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [198.47.26.152 listed in list.dnswl.org] Cc: "grant.likely@secretlab.ca" , "G, Manjunath Kondaiah" , "devicetree-discuss@lists.ozlabs.org" , "linux-omap@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 02 Sep 2011 11:44:38 +0000 (UTC) On 9/2/2011 12:43 PM, Tony Lindgren wrote: > * Cousson, Benoit [110902 11:13]: >> Hi Tony, >> >> On 9/2/2011 10:09 AM, Tony Lindgren wrote: >>> Hi, >>> >>> * Benoit Cousson [110901 19:52]: >>>> Create an OMAP3 generic board to start the DT migration. >>> >>> I don't think this needs to be SoC specific, we can add multiple >>> DT_MACHINE_START entries into a single file. So it should be >>> just board-omap-dt.c. >> >> I do agree, it should not, I made that comment into the >> board-omap4-dt.c, but for the moment we still have dedicated OMAP >> specifics stuff at board level, like the map_io. > > Well map_io can also be set in DT_MACHINE_START. For most part > it already is generic like omap3_map_io and omap4_map_io. > So that should not stop anything. OK, I think I was trying to be a little bit more extreme, meaning only one omap_map_io for every OMAPs. Then, inside omap_map_io we can use the DT compatible information to retrieve the proper OMAPs revision and thus use the proper init table. Whereas in your case you are still relying on the various DT_MACHINE entries to detect which OMAP revision is used. It looks to me that relying on several DT_MACHINE_START to identify a SoC version is a little bit more a hack. I will let the device-tree experts answering that question :-) For my point of view, using DT compatible in the various place where the OMAP revision is important, might allow a finer granularity. >> I have an other series that make the map_io DT aware to get rid of >> that, but it still not finalized. > > Hmm maybe take a look again? We've already sorted out quite a bit > of the init stuff over past few merge windows. If there's still > something blocking that, let's clear it out ASAP. Now that I understand your approach, it is fine. Please find below an example of what I was trying to achieve, and why that point was an issue. The clear advantage of your method is that not further effort will be require for this part. At least for the moment. >> My goal was have a single DT_MACHINE_START for every OMAPs. >> But, meanwhile, if you prefer one file with many board descriptors, >> that's fine. > > Yes that's better. We should only need a separate DT_MACHINE_START > for major SoC variants. OK, I'll try that. Thanks, Benoit --- From a8edcd113b6fa38620dae11bcbb55daa84dfb07c Mon Sep 17 00:00:00 2001 From: Benoit Cousson Date: Mon, 22 Aug 2011 11:10:38 +0200 Subject: [PATCH] OMAP2+: Add a common method to init globals using DT compatible Thanks to the DT root node compatible information, we can extract the compatible SoC and use it to select the proper globals. Create a common omap2_set_globals API that can be used by every OMAP2+ platforms. Signed-off-by: Benoit Cousson Cc: Tony Lindgren --- arch/arm/mach-omap2/common.c | 73 ++++++++++++++++++++++++++++++ arch/arm/plat-omap/include/plat/common.h | 1 + 2 files changed, 74 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c index 3f20cbb..ee5a225 100644 --- a/arch/arm/mach-omap2/common.c +++ b/arch/arm/mach-omap2/common.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -140,3 +141,75 @@ void __init omap2_set_globals_443x(void) } #endif +#ifdef CONFIG_OF +/* + * DT method to get the proper globals configuration + */ +static const struct of_device_id omap_soc_match[] = { +#if defined(CONFIG_ARCH_OMAP4) + { + .compatible = "ti,omap4", + .data = &omap4_globals, + }, +#endif +#if defined(CONFIG_ARCH_OMAP3) + { + .compatible = "ti,omap3", + .data = &omap3_globals, + }, +#endif +#if defined(CONFIG_SOC_OMAP2430) + { + .compatible = "ti,omap2430", + .data = &omap243x_globals, + }, +#endif +#if defined(CONFIG_SOC_OMAP2420) + { + .compatible = "ti,omap2420", + .data = &omap242x_globals, + }, +#endif + {}, +}; + +/* Helper to find the proper of_device_id from a FDT */ +static __init const struct of_device_id *_fdt_match_node( + const struct of_device_id *matches, + int fdt_node) +{ + unsigned int score = 0; + + if (!matches) + return NULL; + + while (matches->compatible[0]) { + score = of_flat_dt_is_compatible(fdt_node, matches->compatible); + if (score > 0) + return matches; + matches++; + } + return NULL; +} + +void __init omap2_set_globals(void) +{ + unsigned long fdt_root; + const struct of_device_id *match; + + /* the DT is still flat at map_io time... */ + fdt_root = of_get_flat_dt_root(); + match = _fdt_match_node(omap_soc_match, fdt_root); + if (!match) { + pr_err("%s(): Cannot initialize the platform globals data\n", + __func__); + } + + pr_info("%s(): %s\n", __func__, match->compatible); + + omap2_set_globals_tap(match->data); + omap2_set_globals_sdrc(match->data); + omap2_set_globals_control(match->data); + omap2_set_globals_prcm(match->data); +} +#endif diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h index 4564cc6..fb79269 100644 --- a/arch/arm/plat-omap/include/plat/common.h +++ b/arch/arm/plat-omap/include/plat/common.h @@ -67,6 +67,7 @@ void omap2_set_globals_243x(void); void omap2_set_globals_3xxx(void); void omap2_set_globals_443x(void); void omap2_set_globals_ti816x(void); +void omap2_set_globals(void); /* These get called from omap2_set_globals_xxxx(), do not call these */ void omap2_set_globals_tap(struct omap_globals *);