From patchwork Sun Mar 24 16:43:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10867533 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EB5D1575 for ; Sun, 24 Mar 2019 16:44:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29AB423B24 for ; Sun, 24 Mar 2019 16:44:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18AB029150; Sun, 24 Mar 2019 16:44:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8ECD2848D for ; Sun, 24 Mar 2019 16:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QmHxfwi/OiQINH79YYCs5m65IhhsxP4zEIUGxOs5mJ8=; b=sHLIjxXxTBqdTT mXrCX7IOoYB07MuTMlK729MG+qHkLLeGd1JY5ucU1ddsRtOuOcWzzkjK2sZHKLW2eYRyTqwuJnEqv QDfEWtcRffe6iS2/R1vDKAdXoKN2FFXkyY0yTbTFNyVX6yogWBRy4Ra6Zz1O2ay1HHz7sCSqSl+8y qsD9teqPvS1HViTCyAhu4hEUaUFn8Vm+K6XFVoeGEKcjYu8WjXbCRrrnHvWEhRJ+crQNoJlH3oora NYMNV/d0qj4lAm7Dq+k75zpntE8VmL5whOJI18T3WaDY9kS0bV4nTbAwogwGsPF30a1zcF+uDoBzA WIC2paEGRu5jG1ixR6eA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h86EC-0007tg-IS; Sun, 24 Mar 2019 16:44:08 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h86Dn-0007Tq-MD; Sun, 24 Mar 2019 16:43:48 +0000 Received: by mail-wr1-x444.google.com with SMTP id k11so37192wro.5; Sun, 24 Mar 2019 09:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BzekSxk7r2M+F/v0AiDgvjTXBQnuIPdQBLE4FKZ4rcY=; b=cxNkdU1SuhlTGonSFiTwVBnJmN2gDmtOQqdl+yo/LQuneGR8mB5NSv/+/uBY6jClNl aumplSyUpFv+DmJs9OfOXzlppiaWZSm50+NVNmCWmpEun65BRQmF/qgsFaw51Mv3QSwf cwiq4GtV0bopYMTHizTcPRarTviwVQzpjhH1O5RxhhzdPvVYvJyXFE/nXaokdqVb90uY 8G74PBAlzvrH3AqcSRP7CBMz7hokWUQ6YmAHr46FOfPZQJiOpOKYv/9FT6+jGM/RtW9N YOIBubB13WVTwYIlKUtA02Az1bV9h+VZqaXV3H/eCmy14sNnPnAPjK+Bmrez7Z3AuPzj 3YVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BzekSxk7r2M+F/v0AiDgvjTXBQnuIPdQBLE4FKZ4rcY=; b=dUkRXBZdhOfEoDx7QvsyDGx79nv7qYBqpzVUD5NCiUMjj+jkbFzq07XzohjyGXX1y/ j5QogO+zxpVnVf31A6i6nL4ejAeUE87HAO4RW3O4R6tISu39PbrZPAk9MazIeDHqmWVN RQHbXAckwgnkJodNAxG1IfZ8vpf/AzVLmGFh1sMxL+lQqAh8APAcJ88nEqWQcxTbLIUX tmB/eDO3m1e8R+SRiribL4HDEpSLW44egAW6U5pE8OrcPAUwI2ztlxc/Fb18S8yFPkeN tULgofunnNIJ+Ievq9DYoF07DXaen/7yOeftLnXsH/y0jlAGSZVQCz1tIMd+zSlHH9nx 6jHQ== X-Gm-Message-State: APjAAAVHv6T4A64UyuTm6DJ/6Ys9uDI5zWpKEHJJFnwfMnP2CmCaYklo o6tgs3VsRNJURh8r5agsw+o= X-Google-Smtp-Source: APXvYqyua+Lde3zbJ9f7AkAVMKdXWUppEWos3RKcGbqQNVdvlk4+cw6k/TLebKe/z3005IgfRK7+zg== X-Received: by 2002:a5d:6883:: with SMTP id h3mr12675106wru.215.1553445818635; Sun, 24 Mar 2019 09:43:38 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD7399900428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:dc:d739:9900:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id v16sm19042461wru.76.2019.03.24.09.43.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 09:43:37 -0700 (PDT) From: Martin Blumenstingl To: narmstrong@baylibre.com, jbrunet@baylibre.com, linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org Subject: [PATCH 1/1] clk: meson: pll: fix rounding and setting a rate that matches precisely Date: Sun, 24 Mar 2019 17:43:27 +0100 Message-Id: <20190324164327.22590-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190324164327.22590-1-martin.blumenstingl@googlemail.com> References: <20190324164327.22590-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190324_094343_729237_C2BA65D8 X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sboyd@kernel.org, Martin Blumenstingl , mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Make meson_clk_pll_is_better() consider a rate that precisely matches the requested rate to be better than any previous rate (which was smaller than the current). Prior to commit 8eed1db1adec6a ("clk: meson: pll: update driver for the g12a") meson_clk_get_pll_settings() returned early (before calling meson_clk_pll_is_better()) if the rate from the current iteration matches the requested rate precisely. After this commit meson_clk_pll_is_better() is called unconditionally. This requires meson_clk_pll_is_better() to work with the case where "now == rate". This fixes a hang during boot on Meson8b / Odroid-C1 for me. Fixes: 8eed1db1adec6a ("clk: meson: pll: update driver for the g12a") Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet --- drivers/clk/meson/clk-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 41e16dd7272a..7a14ac9b2fec 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -120,7 +120,7 @@ static bool meson_clk_pll_is_better(unsigned long rate, return true; } else { /* Round down */ - if (now < rate && best < now) + if (now <= rate && best < now) return true; }