Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1436851

Re: [RFC PATCH 2/2] rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq()

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Alim Akhtar <alim.akhtar@samsung.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 2/2] rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq()
Date Tue, 05 Jul 2016 11:00:02 +0200
Message-ID <rRun0-ty-21@gated-at.bofh.it> (permalink)
References <rR9Vg-4SC-11@gated-at.bofh.it> <rR9Vg-4SC-9@gated-at.bofh.it> <rRtKi-g7-29@gated-at.bofh.it>
X-Auditid cbfee68e-f79266d000001428-5e-577b754c2c82
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Brightmail-Tracker H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsVy+t8zY12f0upwg8bDNhYd1xYzWbx5u4bJ 4vULQ4vLu+awWSza+oXdYn9nB6MDm8eTTRcZPfZMPMnmsaX/LrtH35ZVjB6fN8kFsEZx2aSk 5mSWpRbp2yVwZfxddZixYA5PRefLCWwNjI85uxg5OSQETCSOfbnMAmGLSVy4t56ti5GLQ0hg JaPE3M4DLDBFGxZ8ZgWxhQSWMkqcmmQMUfSAUeL+hBfMIAleAS2Jh8+aGEFsFgFViaVNR8Fs NgFtibvTtzB1MXJwiApESDy+IARRLijxY/I9FpCwiECuxNsPBiBhZoEYiUsb1oBNFBaIk1i7 7T0rxKpFjBLdp2eC3cMpoCmx5MJ2dogGW4kF79exQNjyEpvXvGUGaZAQOMUu0fJiByvEPQIS 3yYfAlsmISArsekAM8RfkhIHV9xgmcAoNgvJSbOQjJ2FZOwCRu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MEp1cB4Uv6Dh1VzkHbaxahz PCvqXz7ewtSmO8na/FTp3+zlXSn8a3/NFfvErtm7etvyQr6Fu6vqTixb17VSKOXZpCWBit1l H3XZsm/ZC/2v3Lnj0M5PSyJ0T2y54W/h6MF7/mf713nvV/FWP9pmGHjiwpw1/h3PAlJfKIll itVkvUo2qBEw5p+7v+6eEktxRqKhFnNRcSIAIu5kzfwCAAA=
Dlp-Filter Pass
X-Mtr 20000000000000000@CPGS
X-Cfilter-Loop Reflected
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 40
Organization linux.* mail to news gateway
X-Original-Cc alexandre.belloni@free-electrons.com, javier@osg.samsung.com, pankaj.dubey@samsung.com
X-Original-Date Tue, 05 Jul 2016 14:22:07 +0530
X-Original-Message-ID <577B7537.4080506@samsung.com>
X-Original-References <1467630195-6929-1-git-send-email-alim.akhtar@samsung.com> <1467630195-6929-2-git-send-email-alim.akhtar@samsung.com> <577B6CD9.80605@samsung.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1436851

Show key headers only | View raw



On 07/05/2016 01:46 PM, Krzysztof Kozlowski wrote:
> On 07/04/2016 01:03 PM, Alim Akhtar wrote:
>> As per code flow it is possible that s3c_rtc_setfreq() might get called
>> with rtc clock disabled and in set_freq we perform h/w registers read/write,
>> which might results in a kernel crash while probing rtc driver.
>> Below is one such case:
>> s3c_rtc_probe()
>>      clk_prepare_enable(info->rtc_clk) // rtc clock enabled
>>        s3c_rtc_gettime() // will enable clk if not done, and disable it upon exit
>>          s3c_rtc_setfreq() //then this will be called with clk disabled
>
> The indentation suggests levels of calls (chain) not sequence. This
> should be:
> s3c_rtc_probe()
>    clk_prepare_enable(info->rtc_clk) // rtc clock enabled
>    s3c_rtc_gettime() // will enable clk if not done, and disable it upon exit
>    s3c_rtc_setfreq() //then this will be called with clk disabled
>
>>
>> This patch take cares of such issue by adding s3c_rtc_{enable/disable}_clk in
>> s3c_rtc_setfreq().
>
> What I don't get is that you wrote "it is *possible* that
> s3c_rtc_setfreq() *might* get called". From my understanding this will
> happen always because src_rtc_gettime() always disables the clocks.
>
> Why it does not happen always?
>

Yes, you are right, it is always disabled when reaches s3c_rtc_setfreq().
And I observed a kernel crash while testing on exynos7 platform in 
s3c_rtc_setfreq() because clock was always disabled at this point. And 
this patches fixes this issue.


> Best regards,
> Krzysztof
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 2/2] rtc: s3c: Add s3c_rtc_{enable/disable}_clk in  s3c_rtc_setfreq() Alim Akhtar <alim.akhtar@samsung.com> - 2016-07-04 13:10 +0200
  Re: [RFC PATCH 2/2] rtc: s3c: Add s3c_rtc_{enable/disable}_clk in  s3c_rtc_setfreq() Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-07-05 10:20 +0200
    Re: [RFC PATCH 2/2] rtc: s3c: Add s3c_rtc_{enable/disable}_clk in  s3c_rtc_setfreq() Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-07-05 11:00 +0200
      Re: [RFC PATCH 2/2] rtc: s3c: Add s3c_rtc_{enable/disable}_clk in  s3c_rtc_setfreq() "pankaj.dubey" <pankaj.dubey@samsung.com> - 2016-07-05 11:50 +0200
    Re: [RFC PATCH 2/2] rtc: s3c: Add s3c_rtc_{enable/disable}_clk in  s3c_rtc_setfreq() Alim Akhtar <alim.akhtar@samsung.com> - 2016-07-05 11:00 +0200
      Re: [RFC PATCH 2/2] rtc: s3c: Add s3c_rtc_{enable/disable}_clk in  s3c_rtc_setfreq() "pankaj.dubey" <pankaj.dubey@samsung.com> - 2016-07-05 11:50 +0200

csiph-web