Received: by 10.192.165.156 with SMTP id m28csp1075269imm; Wed, 11 Apr 2018 11:58:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx49c7T/XkGVofPWPZVBCgDMPQv0LNPYZmmDZ9RF+2EHiGHluNvtHhfbyB02LsuuoVyT+pQxU X-Received: by 10.101.100.212 with SMTP id t20mr4410965pgv.112.1523473123104; Wed, 11 Apr 2018 11:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523473123; cv=none; d=google.com; s=arc-20160816; b=Pm1ISNgOIU719TBKxYMDUoIEIoFmSGm9CM9IEeBsIY7UlRgsRk4SKtRZQpXkBVu8eO LGY6uSt/o71U3ZHyq8X3R0XQuIaXgUQLIMz25minQ4wuD//j2rzbqnTxIktA4CLEqfrH iboI4xci8BJ1ejFzdhCdqRfPuFnEeWXOcJ8pZyhG0Ehwc4z73GzHc7YrZ0JAVpZRgw8H xqv+h5nCzmrR4lX+Me0dMQYkzefgQRlkoMawOYdAZ0J8ibCRYiThGK309mPSpdPAaEE9 Y/XPOPtLCpvlPRoKXaXZaL3B1n1E0jy3JNc7pljdCeWk/aDIZ/N0DyqiAWmSqsKZfb9u hoBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tbFYusftbOENpBQhbsk0bXpyveLWbfI3Iw7WYj0NI6Q=; b=NWG+kxFu9La31iZtzkFBYbPRrx0nGQv0YW1J4+hf7MQ5tldYtNuRNNqx94kQvlK47l EqGkgITfqX6ts0GJbWtdwG+JBdJaAonGo8FqfG60aa4FhuaPcv8Xsn5YWyEB9D9hN042 Y3agURGcGB8pSPFMkpz1c3yWVyvi9qHv8pkQzaRaYJJRHkwpmQ9eviEMaK28dj+laCXa ouqnh1VaDqzn7Jyt/x0WEnwg5fNoxcQwBGryROTig5ux4CN4Y2ykpBzMblqop1wy7jpl Prf25iT4A0qWBztRIL8kG/36R1VmwLRFDqKmKBmkcPBr1aywhVI4iJdOXjp3BO/mUAiL GdmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12-v6si1696348plo.55.2018.04.11.11.58.06; Wed, 11 Apr 2018 11:58:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933529AbeDKSyd (ORCPT + 99 others); Wed, 11 Apr 2018 14:54:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34484 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932610AbeDKSy2 (ORCPT ); Wed, 11 Apr 2018 14:54:28 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 784A699F; Wed, 11 Apr 2018 18:54:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Sasha Levin Subject: [PATCH 4.9 046/310] clk: renesas: rcar-gen2: Fix PLL0 on R-Car V2H and E2 Date: Wed, 11 Apr 2018 20:33:05 +0200 Message-Id: <20180411183624.235222875@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Geert Uytterhoeven [ Upstream commit b7c563c489e94417efbad68d057ea5d2030ae44c ] R-Car V2H and E2 do not have the PLL0CR register, but use a fixed multiplier (depending on mode pins) and divider. This corrects the clock rate of "pll0" (PLL0 VCO after post divider) on R-Car V2H and E2 from 1.5 GHz to 1 GHz. Inspired by Sergei Shtylyov's work for the common R-Car Gen2 and RZ/G Clock Pulse Generator support core. Fixes: 7c4163aae3d8e5b9 ("ARM: dts: r8a7792: initial SoC device tree") Fixes: 0dce5454d5c25858 ("ARM: shmobile: Initial r8a7794 SoC device tree") Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/clk/renesas/clk-rcar-gen2.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) --- a/drivers/clk/renesas/clk-rcar-gen2.c +++ b/drivers/clk/renesas/clk-rcar-gen2.c @@ -271,11 +271,14 @@ struct cpg_pll_config { unsigned int extal_div; unsigned int pll1_mult; unsigned int pll3_mult; + unsigned int pll0_mult; /* For R-Car V2H and E2 only */ }; static const struct cpg_pll_config cpg_pll_configs[8] __initconst = { - { 1, 208, 106 }, { 1, 208, 88 }, { 1, 156, 80 }, { 1, 156, 66 }, - { 2, 240, 122 }, { 2, 240, 102 }, { 2, 208, 106 }, { 2, 208, 88 }, + { 1, 208, 106, 200 }, { 1, 208, 88, 200 }, + { 1, 156, 80, 150 }, { 1, 156, 66, 150 }, + { 2, 240, 122, 230 }, { 2, 240, 102, 230 }, + { 2, 208, 106, 200 }, { 2, 208, 88, 200 }, }; /* SDHI divisors */ @@ -297,6 +300,12 @@ static const struct clk_div_table cpg_sd static u32 cpg_mode __initdata; +static const char * const pll0_mult_match[] = { + "renesas,r8a7792-cpg-clocks", + "renesas,r8a7794-cpg-clocks", + NULL +}; + static struct clk * __init rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, const struct cpg_pll_config *config, @@ -317,9 +326,15 @@ rcar_gen2_cpg_register_clock(struct devi * clock implementation and we currently have no need to change * the multiplier value. */ - u32 value = clk_readl(cpg->reg + CPG_PLL0CR); + if (of_device_compatible_match(np, pll0_mult_match)) { + /* R-Car V2H and E2 do not have PLL0CR */ + mult = config->pll0_mult; + div = 3; + } else { + u32 value = clk_readl(cpg->reg + CPG_PLL0CR); + mult = ((value >> 24) & ((1 << 7) - 1)) + 1; + } parent_name = "main"; - mult = ((value >> 24) & ((1 << 7) - 1)) + 1; } else if (!strcmp(name, "pll1")) { parent_name = "main"; mult = config->pll1_mult / 2;