* rtc-twl: catch22 in 2.6.37 and 2.6.38 when clock was never set @ 2011-04-04 14:29 Alexander Holler 2011-04-05 10:14 ` Alexander Holler 0 siblings, 1 reply; 12+ messages in thread From: Alexander Holler @ 2011-04-04 14:29 UTC (permalink / raw) To: linux-kernel; +Cc: linux-omap Hello, it just happened here that the rechargeable backup battery for the RTC on a TPS65950 run out off power, because of some days while the device wasn't powered. Afterwards I couldn't read or set the clock with hwclock using a kernel 2.6.37.n or 2.6.38.n. I don't have a fix, but I think I've analyzed the problem and can offer a (bad) workaround. What happens is the following: When trying to read or set the clock with hwclock, the driver (rtc-twl) starts an alarm, but the irq for the alarm will never get called. The result is that a select in hwclock times out (for both operations, read or set). Because I had this clock running before, I've got the idea to try one of those old OMAP-kernels (2.6.32-angstrom) using the same userland. And with that kernel I could set the clock. Using 2.6.37 or 2.6.38 afterwards, hwclock did function again, both read an set are working. So it looks like there is a catch22 in kernels >=2.6.37 (I haven't tested .33-.36): When the clock was never set, the alarm(-irq) doesn't work, so hwclock doesn't work, so one can't set the clock. Regards, Alexander Holler ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: rtc-twl: catch22 in 2.6.37 and 2.6.38 when clock was never set 2011-04-04 14:29 rtc-twl: catch22 in 2.6.37 and 2.6.38 when clock was never set Alexander Holler @ 2011-04-05 10:14 ` Alexander Holler 2011-04-05 13:40 ` [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC Alexander Holler 2011-05-31 10:28 ` rtc-twl: catch22 in 2.6.37 and 2.6.38 when clock was never set Tony Lindgren 0 siblings, 2 replies; 12+ messages in thread From: Alexander Holler @ 2011-04-05 10:14 UTC (permalink / raw) To: linux-kernel; +Cc: linux-omap Hello, Am 04.04.2011 16:29, schrieb Alexander Holler: > it just happened here that the rechargeable backup battery for the RTC > on a TPS65950 run out off power, because of some days while the device > wasn't powered. > > Afterwards I couldn't read or set the clock with hwclock using a kernel > 2.6.37.n or 2.6.38.n. > > I don't have a fix, but I think I've analyzed the problem and can offer > a (bad) workaround. > > What happens is the following: > > When trying to read or set the clock with hwclock, the driver (rtc-twl) > starts an alarm, but the irq for the alarm will never get called. The > result is that a select in hwclock times out (for both operations, read > or set). > > Because I had this clock running before, I've got the idea to try one of > those old OMAP-kernels (2.6.32-angstrom) using the same userland. > And with that kernel I could set the clock. > Using 2.6.37 or 2.6.38 afterwards, hwclock did function again, both read > an set are working. > > So it looks like there is a catch22 in kernels >=2.6.37 (I haven't > tested .33-.36): > > When the clock was never set, the alarm(-irq) doesn't work, so hwclock > doesn't work, so one can't set the clock. It turns out that the missing/wrong initialization of the msecure line is the problem which disabled setting the clock. After doing that through a quick hack, I could set the clock. I'm using a BeagleBoard C4, but I can't find any msecure initialization for other boards too. What happened with those patches? E.g. those: http://www.mail-archive.com/linux-omap@vger.kernel.org/msg16125.html Regards, Alexander ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-04-05 10:14 ` Alexander Holler @ 2011-04-05 13:40 ` Alexander Holler 2011-05-31 10:29 ` Tony Lindgren 2011-05-31 10:28 ` rtc-twl: catch22 in 2.6.37 and 2.6.38 when clock was never set Tony Lindgren 1 sibling, 1 reply; 12+ messages in thread From: Alexander Holler @ 2011-04-05 13:40 UTC (permalink / raw) To: linux-arm-kernel; +Cc: linux-omap, Alexander Holler Without msecure beeing high it isn't possible to set (or start) the RTC. Tested with a BeagleBoard C4. Signed-off-by: Alexander Holler <holler@ahsoftware.de> --- 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 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-04-05 13:40 ` [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC Alexander Holler @ 2011-05-31 10:29 ` Tony Lindgren 2011-06-07 8:01 ` Alexander Holler 0 siblings, 1 reply; 12+ messages in thread From: Tony Lindgren @ 2011-05-31 10:29 UTC (permalink / raw) To: Alexander Holler; +Cc: linux-arm-kernel, linux-omap * Alexander Holler <holler@ahsoftware.de> [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 <holler@ahsoftware.de> > --- > 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 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-omap" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-05-31 10:29 ` Tony Lindgren @ 2011-06-07 8:01 ` Alexander Holler 2011-06-07 9:50 ` Igor Grinberg 0 siblings, 1 reply; 12+ messages in thread From: Alexander Holler @ 2011-06-07 8:01 UTC (permalink / raw) To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap Am 31.05.2011 12:29, schrieb Tony Lindgren: > * Alexander Holler<holler@ahsoftware.de> [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<holler@ahsoftware.de> >> --- >> 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); + 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); -- 1.7.3.4 Regards, Alexander Holler ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-06-07 8:01 ` Alexander Holler @ 2011-06-07 9:50 ` Igor Grinberg 2011-06-07 11:15 ` Alexander Holler 0 siblings, 1 reply; 12+ messages in thread From: Igor Grinberg @ 2011-06-07 9:50 UTC (permalink / raw) To: Alexander Holler; +Cc: Tony Lindgren, linux-arm-kernel, linux-omap On 06/07/11 11:01, Alexander Holler wrote: > Am 31.05.2011 12:29, schrieb Tony Lindgren: >> * Alexander Holler<holler@ahsoftware.de> [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<holler@ahsoftware.de> >>> --- >>> 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. > + 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); -- Regards, Igor. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-06-07 9:50 ` Igor Grinberg @ 2011-06-07 11:15 ` Alexander Holler 2011-06-08 21:57 ` Igor Grinberg 0 siblings, 1 reply; 12+ messages in thread From: Alexander Holler @ 2011-06-07 11:15 UTC (permalink / raw) To: Igor Grinberg; +Cc: Tony Lindgren, linux-arm-kernel, linux-omap 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<holler@ahsoftware.de> [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<holler@ahsoftware.de> >>>> --- >>>> 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. > >> + 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); > Regards, Alexander ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-06-07 11:15 ` Alexander Holler @ 2011-06-08 21:57 ` Igor Grinberg 2011-06-09 0:21 ` Alexander Holler 0 siblings, 1 reply; 12+ messages in thread From: Igor Grinberg @ 2011-06-08 21:57 UTC (permalink / raw) To: Alexander Holler; +Cc: Tony Lindgren, linux-arm-kernel, linux-omap 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<holler@ahsoftware.de> [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<holler@ahsoftware.de> >>>>> --- >>>>> 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? What about gpio_request_one()? To conform with the rest of the file and mach-omap2/*. -- Regards, Igor. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-06-08 21:57 ` Igor Grinberg @ 2011-06-09 0:21 ` Alexander Holler 2011-06-09 7:40 ` Igor Grinberg 0 siblings, 1 reply; 12+ messages in thread From: Alexander Holler @ 2011-06-09 0:21 UTC (permalink / raw) To: Igor Grinberg; +Cc: Tony Lindgren, linux-arm-kernel, linux-omap 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<holler@ahsoftware.de> [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<holler@ahsoftware.de> >>>>>> --- >>>>>> 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 <holler@ahsoftware.de> 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 <holler@ahsoftware.de> --- 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); -- 1.7.3.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-06-09 0:21 ` Alexander Holler @ 2011-06-09 7:40 ` Igor Grinberg 2011-06-09 9:23 ` Alexander Holler 0 siblings, 1 reply; 12+ messages in thread From: Igor Grinberg @ 2011-06-09 7:40 UTC (permalink / raw) To: Alexander Holler; +Cc: Tony Lindgren, linux-arm-kernel, linux-omap On 06/09/11 03:21, Alexander Holler wrote: > 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<holler@ahsoftware.de> [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<holler@ahsoftware.de> >>>>>>> --- >>>>>>> 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. I see. Is the new patch version somehow provides better functionality? You configure the gpio for output, this means that the pin is actually driven and not just relies on internal pullup (which can vary from chip to chip). I know nothing about that msecure stuff, but may be it is better to drive the pin, then just configuring the mux (enabling internal pullup)... >> 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. The original patch version is already in Linus' tree, so this one will not apply as it is. If you decide it is better then the original one, then it must be rebased. Otherwise, looks OK. > Regards, > > Alexander > > > From: Alexander Holler <holler@ahsoftware.de> > 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 <holler@ahsoftware.de> > --- > 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); -- Regards, Igor. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC 2011-06-09 7:40 ` Igor Grinberg @ 2011-06-09 9:23 ` Alexander Holler 0 siblings, 0 replies; 12+ messages in thread From: Alexander Holler @ 2011-06-09 9:23 UTC (permalink / raw) To: Igor Grinberg; +Cc: Tony Lindgren, linux-arm-kernel, linux-omap Hello, Am 09.06.2011 09:40, schrieb Igor Grinberg: > On 06/09/11 03:21, Alexander Holler wrote: > I see. Is the new patch version somehow provides better functionality? > You configure the gpio for output, this means that the pin is actually driven > and not just relies on internal pullup (which can vary from chip to chip). > I know nothing about that msecure stuff, but may be it is better to drive the pin, > then just configuring the mux (enabling internal pullup)... Just using the internal pullup was enough with my BeagleBoard C4. >> Below is an updated version. The gpio_export() might be removed too. > > The original patch version is already in Linus' tree, so this one will not apply as it is. > If you decide it is better then the original one, then it must be rebased. > Otherwise, looks OK. I'm fine with either version, so no new patch is necessary. ;) Regards, Alexander ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: rtc-twl: catch22 in 2.6.37 and 2.6.38 when clock was never set 2011-04-05 10:14 ` Alexander Holler 2011-04-05 13:40 ` [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC Alexander Holler @ 2011-05-31 10:28 ` Tony Lindgren 1 sibling, 0 replies; 12+ messages in thread From: Tony Lindgren @ 2011-05-31 10:28 UTC (permalink / raw) To: Alexander Holler; +Cc: linux-kernel, linux-omap * Alexander Holler <holler@ahsoftware.de> [110405 03:11]: > Hello, > > Am 04.04.2011 16:29, schrieb Alexander Holler: > > >it just happened here that the rechargeable backup battery for the RTC > >on a TPS65950 run out off power, because of some days while the device > >wasn't powered. > > > >Afterwards I couldn't read or set the clock with hwclock using a kernel > >2.6.37.n or 2.6.38.n. > > > >I don't have a fix, but I think I've analyzed the problem and can offer > >a (bad) workaround. > > > >What happens is the following: > > > >When trying to read or set the clock with hwclock, the driver (rtc-twl) > >starts an alarm, but the irq for the alarm will never get called. The > >result is that a select in hwclock times out (for both operations, read > >or set). > > > >Because I had this clock running before, I've got the idea to try one of > >those old OMAP-kernels (2.6.32-angstrom) using the same userland. > >And with that kernel I could set the clock. > >Using 2.6.37 or 2.6.38 afterwards, hwclock did function again, both read > >an set are working. > > > >So it looks like there is a catch22 in kernels >=2.6.37 (I haven't > >tested .33-.36): > > > >When the clock was never set, the alarm(-irq) doesn't work, so hwclock > >doesn't work, so one can't set the clock. > > It turns out that the missing/wrong initialization of the msecure > line is the problem which disabled setting the clock. After doing > that through a quick hack, I could set the clock. > > I'm using a BeagleBoard C4, but I can't find any msecure > initialization for other boards too. > > What happened with those patches? E.g. those: > > http://www.mail-archive.com/linux-omap@vger.kernel.org/msg16125.html Looks like these need reposting. Maybe worth doing generic omap RTC init code though? Tony ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-06-09 9:23 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-04-04 14:29 rtc-twl: catch22 in 2.6.37 and 2.6.38 when clock was never set Alexander Holler 2011-04-05 10:14 ` Alexander Holler 2011-04-05 13:40 ` [PATCH] arm: omap3: beagle: Ensure msecure is mux'd to be able to set the RTC Alexander Holler 2011-05-31 10:29 ` Tony Lindgren 2011-06-07 8:01 ` Alexander Holler 2011-06-07 9:50 ` Igor Grinberg 2011-06-07 11:15 ` Alexander Holler 2011-06-08 21:57 ` Igor Grinberg 2011-06-09 0:21 ` Alexander Holler 2011-06-09 7:40 ` Igor Grinberg 2011-06-09 9:23 ` Alexander Holler 2011-05-31 10:28 ` rtc-twl: catch22 in 2.6.37 and 2.6.38 when clock was never set Tony Lindgren
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).