From patchwork Thu Jun 9 00:21:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Holler X-Patchwork-Id: 862902 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p590M8Ik031122 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 9 Jun 2011 00:22:29 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QUT0Y-0006wC-Jj; Thu, 09 Jun 2011 00:21:58 +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 1QUT0Y-00062n-64; Thu, 09 Jun 2011 00:21:58 +0000 Received: from h1446028.stratoserver.net ([85.214.92.142] helo=mail.ahsoftware.de) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QUT0T-00062T-P8 for linux-arm-kernel@lists.infradead.org; Thu, 09 Jun 2011 00:21:55 +0000 Received: by mail.ahsoftware.de (Postfix, from userid 65534) id 93333434312; Thu, 9 Jun 2011 02:21:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.ahsoftware.de X-Spam-Level: X-Spam-Status: No, score=-101.0 required=5.0 tests=ALL_TRUSTED, USER_IN_WHITELIST autolearn=disabled version=3.3.1 Received: from eiche.ahsoftware (p57B21592.dip0.t-ipconnect.de [87.178.21.146]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.ahsoftware.de (Postfix) with ESMTPSA id 442C3434312 for ; Thu, 9 Jun 2011 02:21:46 +0200 (CEST) Received: by eiche.ahsoftware (Postfix, from userid 65534) id 62FE83FD5D; Thu, 9 Jun 2011 02:21:44 +0200 (CEST) Received: from [192.168.208.6] (unknown [192.168.208.6]) by eiche.ahsoftware (Postfix) with ESMTP id 0611C3FCA7; Thu, 9 Jun 2011 00:21:03 +0000 (UTC) Message-ID: <4DF0120E.5030204@ahsoftware.de> Date: Thu, 09 Jun 2011 02:21:34 +0200 From: Alexander Holler User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b13pre) Gecko/20110501 Thunderbird/3.3a3 MIME-Version: 1.0 To: Igor Grinberg Subject: Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC References: <4D9AEB76.2060509@ahsoftware.de> <1302010808-3065-1-git-send-email-holler@ahsoftware.de> <20110531102903.GU11352@atomide.com> <4DEDDAF6.2070505@ahsoftware.de> <4DEDF451.1080604@compulab.co.il> <4DEE0858.2020308@ahsoftware.de> <4DEFF035.4070004@compulab.co.il> In-Reply-To: <4DEFF035.4070004@compulab.co.il> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110608_202154_146430_E51221E5 X-CRM114-Status: GOOD ( 27.99 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- Cc: Tony Lindgren , 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 (demeter1.kernel.org [140.211.167.41]); Thu, 09 Jun 2011 00:22:38 +0000 (UTC) On 08.06.2011 23:57, Igor Grinberg wrote: > On 06/07/11 14:15, Alexander Holler wrote: > >> Am 07.06.2011 11:50, schrieb Igor Grinberg: >>> On 06/07/11 11:01, Alexander Holler wrote: >>> >>>> Am 31.05.2011 12:29, schrieb Tony Lindgren: >>>>> * Alexander Holler [110405 06:38]: >>>>>> Without msecure beeing high it isn't possible to set (or start) >>>>>> the RTC. >>>>>> >>>>>> Tested with a BeagleBoard C4. >>>>> >>>>> Adding this into fixes. >>>>> >>>>> Tony >>>>> >>>>>> Signed-off-by: Alexander Holler >>>>>> --- >>>>>> arch/arm/mach-omap2/board-omap3beagle.c | 3 +++ >>>>>> 1 files changed, 3 insertions(+), 0 deletions(-) >>>>>> >>>>>> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c >>>>>> index 46d814a..ebe3a7e 100644 >>>>>> --- a/arch/arm/mach-omap2/board-omap3beagle.c >>>>>> +++ b/arch/arm/mach-omap2/board-omap3beagle.c >>>>>> @@ -628,6 +628,9 @@ static void __init omap3_beagle_init(void) >>>>>> usb_ehci_init(&ehci_pdata); >>>>>> omap3beagle_flash_init(); >>>>>> >>>>>> + /* Ensure msecure is mux'd to be able to set the RTC. */ >>>>>> + omap_mux_init_signal("sys_drm_msecure", OMAP_PIN_OFF_OUTPUT_HIGH); >>>>>> + >>>>>> /* Ensure SDRC pins are mux'd for self-refresh */ >>>>>> omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); >>>>>> omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); >>>>>> -- >>>>>> 1.7.3.4 >>>>>> >>>> >>>> I've later switched to the following patch which muxes msecure as GPIO (the drm-mode isn't explained in the TRM) and also exports the GPIO, so root could easily switch it to prevent modifications on the RTC. >>>> >>>> (Warning, either my clipboard or the version of Thunderbird I'm currently using replaces the tabs with spaces in the pasted patch and I'm currently too lazy to search a workaround). >>>> >>>> --- >>>> arch/arm/mach-omap2/board-omap3beagle.c | 6 ++++++ >>>> 1 files changed, 6 insertions(+), 0 deletions(-) >>>> >>>> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c >>>> index 33007fd..24b4417 100644 >>>> --- a/arch/arm/mach-omap2/board-omap3beagle.c >>>> +++ b/arch/arm/mach-omap2/board-omap3beagle.c >>>> @@ -673,6 +673,12 @@ static void __init omap3_beagle_init(void) >>>> usbhs_init(&usbhs_bdata); >>>> omap3beagle_flash_init(); >>>> >>>> + /* Ensure msecure is high to be able to set the RTC. */ >>>> + omap_mux_init_signal("gpio_22", OMAP_PIN_OFF_OUTPUT_HIGH); >>>> + gpio_request(22, "msecure"); >>>> + gpio_direction_output(22, true); >>> >>> Can this be gpio_request_one() instead, please? >>> Also, it will be nice to make a define for the magic 22. >> >> You need the "gpio_22" in the mux_init, so using a define would imho introduce a potential source for an error, at least when the define would not be anywhere near the "gpio_22" and someone would forget change the string too, when he changes the define. So I don't think a define adds much value there. > > Why not leave "sys_drm_msecure" for mux_init, or does it make troubles on XM? There is nothing wrong with the small patch which uses sys_drm_msecure. It's short and does everything which is needed to use the RTC. I've posted the solution with the use of the GPIO-mode only as an alternative because the drm-mode isn't explained in the TRM (I assume one has to sign a NDA to get more informations on that). So it is not obvious what my first patch does. Using sys_drm_msecure works because it seems to be always off, at least on the BeagleBoards. The additional functionality in my second patch to turn off possible modifications on the RTC through switching the GPIO is most likely just an educational feature, I don't think someone will ever use that. I don't have any preferences which solution will end in the kernel, I just wanted to offer the second one too. > What about gpio_request_one()? To conform with the rest of the file and mach-omap2/*. Below is an updated version. The gpio_export() might be removed too. Regards, Alexander From: Alexander Holler Date: Thu, 19 May 2011 11:42:05 +0200 Subject: [PATCH v3] arm: omap3: beagle: Ensure msecure is mux'd and high to be able to set the RTC Without msecure beeing high it isn't possible to set (or start) the RTC. Tested with a BeagleBoard C4. Signed-off-by: Alexander Holler --- arch/arm/mach-omap2/board-omap3beagle.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 33007fd..4c9e26e 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -673,6 +673,11 @@ static void __init omap3_beagle_init(void) usbhs_init(&usbhs_bdata); omap3beagle_flash_init(); + /* Ensure msecure is high to be able to set the RTC. */ + omap_mux_init_signal("gpio_22", OMAP_PIN_OFF_OUTPUT_HIGH); + gpio_request_one(22, GPIOF_OUT_INIT_HIGH, "msecure"); + gpio_export(22, false); + /* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);