Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2876490pxk; Tue, 15 Sep 2020 04:54:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi8fTtlIYHJ+scuCqZkYlIl32vkwOtDtfbsQSE+IDAbeXquxPa+s0wqKr/gulUpIP+28MC X-Received: by 2002:a17:906:6411:: with SMTP id d17mr19254301ejm.93.1600170862574; Tue, 15 Sep 2020 04:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600170862; cv=none; d=google.com; s=arc-20160816; b=FsmiJ0qg1MDKhO0VnqPdkazhODhGaOmkqd1gm1pKc10ElJK/pHsnYkUAvopfKMBItI KBuB5FYGHvQXrSZtEHi48MEPSgp9jGuXp6dfSYpHNDI2E9YPcw/b2PGPrirTJppmzEjV 7q3sSViSkoy9TMTBhEpM7iz5ztcXV51BVYm+i+R72QYjysEOYO8FahCzvMedXgfTT4s9 XZee8dR8XvH0pHf7EKDSNS3I2WGiutu6ALD+f9fRAhoW1aKSnRTBTUa43AZU7D56ylOw jt7ClKToIuJT6rfGlqKBkthuE3URX2uE5zSFVr0Wupolw06guBVQF0rkNAAxe9pf120X /mcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter; bh=4J9mAIGkWCA1iUY60Uc0okRdlJsBdXs932NxjIHX2UM=; b=Usg+6LHWtxLcyoRI2EIUaHBE0xw+7010xDIqMBdglmuwTaoIbvS7WUeUlYPsL2Iqsy RMoJDw00L/KwDHWFBEDo2p1zHrB7sgK8iVTluhipIYO/h/KUmQIdUbzh50bPRG6pUetk ZlBy3dQ8w4SnyisLBN5NAmJuvrkMIcufxe1P3FJixvSh00zGEOr3U+8k1YtW04qzZitF 92H7geK9jh3ITWBlsB5RJkkB/430+Bu5Hi+t2mYHj54tVJY4SssTGF4qYewLJIeCCj0q E1+1bu3IGZjAQiPREroeJMtCF50mR42B+X+58y9t8dU20skKn4juvwEM+0sCBi6I7YSY KD3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=AX0wx8x7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si9061862edt.161.2020.09.15.04.53.59; Tue, 15 Sep 2020 04:54:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=AX0wx8x7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbgIOLr4 (ORCPT + 99 others); Tue, 15 Sep 2020 07:47:56 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:49868 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726368AbgIOLes (ORCPT ); Tue, 15 Sep 2020 07:34:48 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200915113427euoutp02fe53cd8f75f64bcbdd58f4dbcf97861b~08dWMeAcN3049530495euoutp02S for ; Tue, 15 Sep 2020 11:34:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200915113427euoutp02fe53cd8f75f64bcbdd58f4dbcf97861b~08dWMeAcN3049530495euoutp02S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600169667; bh=4J9mAIGkWCA1iUY60Uc0okRdlJsBdXs932NxjIHX2UM=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=AX0wx8x7qNAa7IH7Ec4T+5d5NsC4REGT4JvlmlvK1IOvfk6gR2sNfgXk7kUpm3zpI DqwtU0KlkQ+eHldWi4tZ6n9vVYUWiOP7ZSAjq8TNMxGBcmQ/+b4dME5vdkJNKT80u0 EsLRyPb5XsEgVc8UVlQ00sJNhZzC1eoKRlFvtfgc= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200915113426eucas1p2fa91a99c80c62880366254b0f622ca53~08dV8vQnu1150611506eucas1p2h; Tue, 15 Sep 2020 11:34:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 34.3C.05997.2C6A06F5; Tue, 15 Sep 2020 12:34:26 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200915113426eucas1p1761f07b2bd25b5f31a6840b2b5046838~08dVXd_RU0665806658eucas1p1X; Tue, 15 Sep 2020 11:34:26 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200915113426eusmtrp209aef5c48bc076dedf5081df36b4b384~08dVQ_iPl1124011240eusmtrp2o; Tue, 15 Sep 2020 11:34:26 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-7c-5f60a6c26788 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D8.4D.06314.2C6A06F5; Tue, 15 Sep 2020 12:34:26 +0100 (BST) Received: from [106.210.123.115] (unknown [106.210.123.115]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200915113425eusmtip2c0eec9c762bf9fd235a50a708adb1bd3~08dUoWe4d2553525535eusmtip2Y; Tue, 15 Sep 2020 11:34:25 +0000 (GMT) Subject: Re: [PATCH v3] clk: samsung: Prevent potential endless loop in the PLL set_rate ops To: Chanwoo Choi , tomasz.figa@gmail.com Cc: linux-clk@vger.kernel.org, sboyd@kernel.org, mturquette@baylibre.com, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com, m.szyprowski@samsung.com From: Sylwester Nawrocki Message-ID: Date: Tue, 15 Sep 2020 13:34:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <28cd3eeb-816d-b369-11a9-16cd2c1af87c@samsung.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMKsWRmVeSWpSXmKPExsWy7djP87qHliXEG9w+pGOxccZ6VovrX56z WnzsucdqcXnXHDaLGef3MVmsPXKX3eLiKVeLf9c2slis2vWH0YHT4/2NVnaPnbPusntsWtXJ 5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZh/fMYiq4wVnx+oFLA+MH9i5GTg4JAROJTUcu snUxcnEICaxglNhz5gALSEJI4AujxKTpwRCJz4wSb3dNhOvYc+A5E0RiOaPE5a3rmCGcj4wS 79YeYAWpEhaIk1g+Yy0TiC0iYC+x4dh/VpAiZoGDjBLTWnrBEmwChhK9R/sYQWxeATuJ/p3f mUFsFgFViamv/4HdIQo06NipRywQNYISJ2c+AbM5gYY+fj6TDcRmFhCXuPVkPhOELS+x/e0c sIskBA6xSzyb1s8KcbeLxIEle5kgbGGJV8e3QP0jI/F/53wmiIZmRome3bfZIZwJjBL3jy9g hKiylrhz7hfQOg6gFZoS63fpg5gSAo4SX58yQph8EjfeCkLcwCcxadt0Zogwr0RHmx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UkVcSb2hqaG5h aWhubG5sZqEkztshcDBGSCA9sSQ1OzW1ILUIpo+Jg1OqgTHIMNKe9cyC+Xf1u+6kly5yUlq0 vv9C5gmdAF+JhLNfjCbaLLF48+PDsa8eWlMY/tuqL560633GorSuK/ZT5hx+89naOSiytj16 xxHPXqeNNwvOp74rzNe4sXHX99ApS8LEPq7JVKusFJj8ZjO/gEOvcsrSdYzlMsx9Pyo2PrU3 WMG+2VO9jk2JpTgj0VCLuag4EQDkFb8e2QIAAA== X-CMS-MailID: 20200915113426eucas1p1761f07b2bd25b5f31a6840b2b5046838 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200813095520eucas1p209432599420d62e0e54a5545334c329c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200813095520eucas1p209432599420d62e0e54a5545334c329c References: <20200813095508.7563-1-s.nawrocki@samsung.com> <28cd3eeb-816d-b369-11a9-16cd2c1af87c@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.08.2020 02:46, Chanwoo Choi wrote: > On 8/13/20 6:55 PM, Sylwester Nawrocki wrote: >> In the .set_rate callback for some PLLs there is a loop polling state >> of the PLL lock bit and it may become an endless loop when something >> goes wrong with the PLL. For some PLLs there is already code for polling >> with a timeout but it uses the ktime API, which doesn't work in some >> conditions when the set_rate op is called, in particular during >> initialization of the clk provider before the clocksource initialization >> has completed. Hence the ktime API cannot be used to reliably detect >> the PLL locking timeout. >> >> This patch adds a common helper function for busy waiting on the PLL lock >> bit with timeout detection. >> Signed-off-by: Sylwester Nawrocki >> --- >> Changes for v3: >> - use busy-loop with udelay() instead of ktime API >> Changes for v2: >> - use common readl_relaxed_poll_timeout_atomic() macro >> --- >> drivers/clk/samsung/clk-pll.c | 94 ++++++++++++++++--------------------------- >> 1 file changed, 34 insertions(+), 60 deletions(-) > Thanks. > > Acked-by: Chanwoo Choi Patch applied, thank you for your comments.