From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 162B6ECAAD5 for ; Mon, 29 Aug 2022 18:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mgGwba+mPHEKrdSVGrHa3F9ljhZ1+m2+o8C8nKzlYJ8=; b=Et01Za/21nH8eo Re1GxTsOJGgmrywTcdtN6EC5Z8MMq5Qt/8cJupqHukZOt5QxOnO4by63HTtzWGgQRDSkc3yd4Ubbd uyBy0POcFd+IaOEyzeAmd4Gte52kTQMzx6Q0aNHeqvM5Z8QiuiRcaqI+7zKNZ9xvR87RJVC0UR/js pbc5uh78N4CE6EpWsBQR2gxl9iPZKXASS9IYlPV8SE4uDEtAuZ/f+D8pZE+CnMhpK/AJKkJZuR3mb noLUPiADe3MX/ZhsGXTsJT+F3zM5ni9sVpEmwWB7pVUn6XJJw+Dk5IS7N/bof6PayvwhXke+sk8QJ o/D8irY49Q4xFfqWOPZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSjqS-00CKtK-48; Mon, 29 Aug 2022 18:50:48 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSjqN-00CKpp-74; Mon, 29 Aug 2022 18:50:44 +0000 Received: by mail-ej1-x62b.google.com with SMTP id kk26so17491367ejc.11; Mon, 29 Aug 2022 11:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=UsH6vMnY8y4Ttu+isOPB3+ny2RRrwbwy+Fk4xe0xGfI=; b=TmT0ew7t5e/hIFdUh7DJdVohu61lYVG2q2uj4GPamJ7TCX9iLmLjkz6rZKXEyNwKaM biVXEi7r7zrg+s1E9FlSfLyvH5sOJJW2cZmNCbbHOC7iT2M0gnDtCuSWb7pxJtBlX30H lKEOLBfQFTe6T8RQQBv+C+cduk0Vll+PKPT0dbtQZAl9qDBlIEIb/1HuTI09LlW+QEMf m7q5uYXpi6wJnye4k5R3+DNWBO7NYRnfvJn6xZQVnb4ZPygG7UMTHSvzy5GR+OOP1O86 EeJ1ZnT5c4e18eoJGXOLtu+UKR8w1pDrss0Xpejx5yhe8J7da+vURHmrknDRCsirStWZ pwdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=UsH6vMnY8y4Ttu+isOPB3+ny2RRrwbwy+Fk4xe0xGfI=; b=fbKD6NPL1hAiiA7lY/eF8sQW1XXOIs2+B0ECDiDKC+rq44mz5jql82koo5CCfuzkJf IAbI1Ww4HD8MTh0tQlSajWZXqBFzizA7AbMp7ZRq/GrybIpPDctE34J6OACXs0LhYeDM GhOIFDhJDESi3r+sYHKJ8h97hesf9tXVAlhnJ59/hShHpvGEdtoo73bQ3s89t0wWyuQz k52P4LrWxKLkXL5SmsBD88of7H5kF0r+blbk6l0s6PdihUuzkarF74cOtnDbNUHNCgtx 4BeXJLn7V8jOIYHbulKCTfG1q1pmcqVVA4Aexicr1aPmSPZtGqBNHR5qzJWA9dtoDUhz YLuw== X-Gm-Message-State: ACgBeo1ysViAojfRis11PbKC+w+/lQ8TifuHPeif+sKKmNL1rvjK77nQ QdkkSjyNIuSJnCJ5UrV8H5g= X-Google-Smtp-Source: AA6agR5uEzUgvUID6TSoYGZYd6H4sZh0hgxGrmuuPTUhHcGg971+6QsReFBvVZPGiq2Jq003fQalIw== X-Received: by 2002:a17:907:7678:b0:730:e1ad:b128 with SMTP id kk24-20020a170907767800b00730e1adb128mr15019810ejc.67.1661799039523; Mon, 29 Aug 2022 11:50:39 -0700 (PDT) Received: from ?IPV6:2a01:c23:bd96:2400:287c:a714:9c3c:aa54? (dynamic-2a01-0c23-bd96-2400-287c-a714-9c3c-aa54.c23.pool.telefonica.de. [2a01:c23:bd96:2400:287c:a714:9c3c:aa54]) by smtp.googlemail.com with ESMTPSA id lb26-20020a170907785a00b0073bdf71995dsm4803419ejc.139.2022.08.29.11.50.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Aug 2022 11:50:38 -0700 (PDT) Message-ID: Date: Mon, 29 Aug 2022 20:50:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH] clk: meson: pll: adjust timeout in meson_clk_pll_wait_lock() Content-Language: en-US To: Jerome Brunet , Neil Armstrong , Michael Turquette , Stephen Boyd , Kevin Hilman , Martin Blumenstingl Cc: "open list:ARM/Amlogic Meson..." , linux-clk@vger.kernel.org, "linux-arm-kernel@lists.infradead.org" References: <22f1d799-a3bb-3d71-a3fd-f6128b205231@gmail.com> <1jo7w3tlyo.fsf@starbuckisacylon.baylibre.com> From: Heiner Kallweit In-Reply-To: <1jo7w3tlyo.fsf@starbuckisacylon.baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220829_115043_329944_DCE04215 X-CRM114-Status: GOOD ( 16.82 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org On 29.08.2022 11:52, Jerome Brunet wrote: > > On Sun 14 Aug 2022 at 23:29, Heiner Kallweit wrote: > >> Currently we loop over meson_parm_read() up to 24mln times. >> This results in a unpredictable timeout period. In my case >> it's over 5s on a S905X4-based system. Make the timeout >> period predictable and set it to 100ms. >> >> Whilst we're at it: All callers of this function return -EIO >> in case of failure, therefore we can return this value directly >> in the timeout case. > > I'm okay with this change but I'd prefer if one change addressed a > single topic. Please split this out. > OK, I'll send a v2. >> >> Signed-off-by: Heiner Kallweit >> --- >> drivers/clk/meson/clk-pll.c | 15 ++++++--------- >> 1 file changed, 6 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c >> index daa025b6d..d70bee331 100644 >> --- a/drivers/clk/meson/clk-pll.c >> +++ b/drivers/clk/meson/clk-pll.c >> @@ -277,17 +277,17 @@ static int meson_clk_pll_wait_lock(struct clk_hw *hw) >> { >> struct clk_regmap *clk = to_clk_regmap(hw); >> struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); >> - int delay = 24000000; >> + int delay = 5000; >> >> do { >> - /* Is the clock locked now ? */ >> + /* Is the clock locked now ? Time out after 100ms. */ >> if (meson_parm_read(clk->map, &pll->l)) >> return 0; >> >> - delay--; >> - } while (delay > 0); >> + udelay(20); >> + } while (--delay); >> >> - return -ETIMEDOUT; >> + return -EIO; >> } >> >> static int meson_clk_pll_init(struct clk_hw *hw) >> @@ -350,10 +350,7 @@ static int meson_clk_pll_enable(struct clk_hw *hw) >> /* Take the pll out reset */ >> meson_parm_write(clk->map, &pll->rst, 0); >> >> - if (meson_clk_pll_wait_lock(hw)) >> - return -EIO; >> - >> - return 0; >> + return meson_clk_pll_wait_lock(hw); >> } >> >> static void meson_clk_pll_disable(struct clk_hw *hw) > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic