Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1052307imm; Fri, 12 Oct 2018 10:55:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV62i6+3YSVlNWB1b6gihuTiOUs8ZM7H0ASBRwl2b1fuZ3FMPAZuvMkcHl7JXGwIAj3olzM+b X-Received: by 2002:a62:14ce:: with SMTP id 197-v6mr7101926pfu.50.1539366950901; Fri, 12 Oct 2018 10:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539366950; cv=none; d=google.com; s=arc-20160816; b=hwhs0X2CGktmemGgHZcYy2MEoRZWTMISoRAUnlMgJLQhJtwxFU7X2RC/wlzz57L1pg clcq+NVUZI371siREU6IkEUpGuc3CHtQbM/so2Lx0/GPIRAOYg32c4JSBOncZ8vdbFAr S2KYK4IDi9O86BmOUN9hn8CYWrSzZUETpPgmb7nlPBhyV7KE7pZmOlIKjOMlOU2tY92z h/XUL/H3eWOPG6+YcfvGEgFP5FKECJ71TMRcqzVZQI0E4XXKsqOtk0GWaLH/eVi0J6tg b2dcVUF5hHvvnGq7/ucElGsyc1X7ts5kQZCcy7+DYxeDO93A7JQihfJYGufZZ3bODdAB Np9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature; bh=4NlVJEM5MGg+RI2+pyXaa0Y2u3TiMt09w6g79Je8/MQ=; b=W7errdEOgEhbx99Bxzc1Hv8RRotjCnrgWs1sshySr9fnc7gnhhicKwIgn8DS8EvoIT FoURPjPLqjpp9uP1zY5VU8S+Qci2y5+WhIeNw9ONXV0PsB9/S8I0QlmcHCBD+BiiK589 3Ggnn6FxLAaCUZdvs82UoEw2V5rLqdJhXHbO5K7LRQw3Ntii6V3Bjzr3mvz6OVMyz/Qq cOSlDmgeqnLoDhAVIZnvWyFidIVXoBfpQ88pfDmKVawTqvAu3iSM56YMBcPiVOeVOiIK aG8Nkp6PK98ywVoazS+XE9OHmxbgb63tH4KYvUtX6lP6vKpzRarEwPLe2xqW8IYmPJfi Hiqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Cx7+jb0+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si1838541pls.35.2018.10.12.10.55.35; Fri, 12 Oct 2018 10:55:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Cx7+jb0+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726960AbeJMB1C (ORCPT + 99 others); Fri, 12 Oct 2018 21:27:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:36082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbeJMB1C (ORCPT ); Fri, 12 Oct 2018 21:27:02 -0400 Received: from localhost (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 521892077C; Fri, 12 Oct 2018 17:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539366804; bh=dEYbNONSKBvuOQkevEa86ChpTfk8xvzr5l2a4w2Z31Q=; h=To:From:In-Reply-To:Cc:References:Subject:Date:From; b=Cx7+jb0+RDv+OGwctjogP/yteW490Mi0uI/dulbpkwhJtf2dQZJEz+1NBLlNGQOi+ PkkG3PY7iC3dgCeS36qQl/XR15VJiNvceuNGTusG3IgenSnMicAFf9gdmWdr8u73s4 cq7CLEqYkAn04lmM2BK9iz+xz5moNlOuzLMoML1k= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Matthias Brugger , Rob Herring , Stephen Boyd , Weiyi Lu From: Stephen Boyd In-Reply-To: <20180920095727.11868-5-weiyi.lu@mediatek.com> Cc: James Liao , Fan Chen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-clk@vger.kernel.org, srv_heupstream@mediatek.com, Weiyi Lu References: <20180920095727.11868-1-weiyi.lu@mediatek.com> <20180920095727.11868-5-weiyi.lu@mediatek.com> Message-ID: <153936680359.5275.14901579706860255114@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: Re: [PATCH v1 3/3] clk: mediatek: mt2712: add pll reference support Date: Fri, 12 Oct 2018 10:53:23 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Weiyi Lu (2018-09-20 02:57:27) > For some MT2712 projects, audpll could select another reference > clock source if there exists an extra Crystal Oscillators than > the default clk26m XTAL. > Declare with the property "mediatek,refclk-aud" to switch > the audpll reference clock. > And also support to modify the reference clock of all PLL with > property "mediatek,refclk" instead of the default source "clk26m". > = > Signed-off-by: Weiyi Lu > --- > diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk= -mt2712.c > index e36f4aab634d..2a4db1718089 100644 > --- a/drivers/clk/mediatek/clk-mt2712.c > +++ b/drivers/clk/mediatek/clk-mt2712.c [...] > + size_t i; > + u32 r; > + > + base =3D of_iomap(node, 0); > + if (base) { > + sel_addr =3D base + 0x40; > + } else { > + pr_err("%s(): ioremap failed\n", __func__); > + return; > + } Nitpick: Write this as base =3D of_iomap(); if (!base) return; sel_addr =3D base + 0x40; > + > + rc =3D of_parse_phandle_with_args(node, "mediatek,refclk", > + "#clock-cells", 0, &refclk); > + if (!rc) { > + of_property_read_string(refclk.np, "clock-output-names", > + &refclk_name); > + for (i =3D 0; i < num_plls; i++) > + plls[i].parent_name =3D refclk_name; Use of_clk_parent_fill()? > + } > + > + rc =3D of_parse_phandle_with_args(node, "mediatek,refclk-aud", > + "#clock-cells", 0, &refclk_aud); This is odd. Is this a custom 'clocks' property? What's going on here? Why can't we use assigned clock parents for this? > + if (!rc) { > + of_property_read_string(refclk_aud.np, "clock-output-name= s", > + &refclk_aud_name); > + if (strcmp(refclk_name, refclk_aud_name)) { > + plls[CLK_APMIXED_APLL1].parent_name =3D refclk_au= d_name; > + plls[CLK_APMIXED_APLL2].parent_name =3D refclk_au= d_name; > + r =3D readl(sel_addr) | 0x60000; > + } else { > + r =3D readl(sel_addr) & ~0x60000; > + } > + > + writel(r, sel_addr); > + } > +} > +