Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2117106ybg; Sun, 27 Oct 2019 11:24:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwt/n7cf8Ai1F19XXUBfcbV7pBKQVSs8b0Ja6WXTdPkUsgH2ck7eXgQF/vbhiGO9jPKqkEm X-Received: by 2002:a17:906:d972:: with SMTP id rp18mr13300840ejb.179.1572200697985; Sun, 27 Oct 2019 11:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572200697; cv=none; d=google.com; s=arc-20160816; b=UUwrtHaB2jDm+f0+P2fMmyZhVVqYIDRNpUMy2O3x5XCIkJpyu+g3GlkL2G/0hLB8BA CfJRbXsROlUU4B/TB4RvHdEVeqduYd3JA4OsApxLE+MMjsPVdNjpiHNl7fn4dN/61ULG 9i+Hg2mhasi9xoZVHibJQLFVx627ZWOJKvPtFLWj7r8/BFhuArDIFkE/Oe+kiZ1EIsir TN0du0F4MF+F0LctRX+DbuMmdKsmvMTex2Lx9ayMeDGOMij3yLzpdUZzW4+A1eSh/KBx eZBPkmQ0zV9ErDdN5Ua+UaeRtMU0gPoh04+kzZnqrHJ2jl2uyzoRddbm5rsiTXXm+/SJ wMlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bQ1b11JrQMPNCzMJaz+y6q1nSpUtkZ5R8/joJD6Qz18=; b=P5xiJTG7E6M1cyqyEqKdrtwgI3bXGrunaqKM38uS/KzEEmamC0QnPgzWjtuT8d1Ebv 7TxaEgNS9y2jKfwIXjPR+VrfxfFCRigl89B5PyTefqCnbva59Ynk1I5JqkRWpa2kjIqg if785mCoTLU/yHMWlyeCwvwjECI1s1p1ogLu5AATA/+uHSjANGb5oRqOS1NeQ+Ikrzo/ 4RmwWF/fcHhuPAZHmOpOChy3p0mt9TFlm4OrhZpETW19K0auPdeJp32km/1EoZ3O1jXG IliPyqYwrI47//jK5FgdfXuVFIV/fTKjRWf5fsatBgcuuwgWJoo2p5oDggBKzgRAszXj 4v2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=Y8fcd9UW; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c57si6311889edc.386.2019.10.27.11.24.35; Sun, 27 Oct 2019 11:24:57 -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=@googlemail.com header.s=20161025 header.b=Y8fcd9UW; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727704AbfJ0QST (ORCPT + 99 others); Sun, 27 Oct 2019 12:18:19 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40519 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727668AbfJ0QST (ORCPT ); Sun, 27 Oct 2019 12:18:19 -0400 Received: by mail-wr1-f66.google.com with SMTP id o28so7367722wro.7; Sun, 27 Oct 2019 09:18:17 -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=bQ1b11JrQMPNCzMJaz+y6q1nSpUtkZ5R8/joJD6Qz18=; b=Y8fcd9UWEz8ZhI1HAXrUApECbzToLMV/0EZ4fsDzW1oo4Ol5ePz6Mm0IxAvoezYzkd s2HnNydcCJv30Wka6Ei4vvbv3sGYXS3vGn+EIkzxzyoLPVuQLSHdgpH1Wt2d4Z/B8BdC vwy9UVXLVY+1ivTt5j5Mrczx1aYKocrKk/+TbT1TbTqnhFBbm4pt41AwNWMWy/2loU6R 8MwwkEwMHjYrTq9P+STJ9fu5Khe5PQf3VSDGkdNDMRq8nQGh21rnLrjwEztWyVtuhWfP 6ktxynw0Cn3bBFAzb+sXi8HpEnJ81eQ/yyXQHCve4AtjTzyGmCGDpVzZGdFqSRzriwA7 Sz5A== 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=bQ1b11JrQMPNCzMJaz+y6q1nSpUtkZ5R8/joJD6Qz18=; b=Rr/pFyba/EcsSziZ9hOPFcOPbPMVQLkQU0xEg85FHmUvY2rO6NUPNtOxxBtU0ACpLV eWhZaJ8AveDxAScrzcKAbIAOpaY66wogtS0mB15ffssXz00wWGeZO/wC3H5WsTNGckU9 Vx27S4u3XbsorDVQtOxuiLEw09YIbEfv1vmIPfi/bee0aPkC1pUsLfK46dbHoHGa/Gpl NZ2SeEYqGBDRjBrD5VhjDSxWj3saX/BZJ5stLiMuYiV3rTgY2rGAPq7CvPPoZ5GNDV5Z Q3d0KXaZOwQp50M+Jt61c2+b3QCMs5WDYBBJX2kVlDISO/Sfw4ry3ndD7Lr/FK64n5R2 YvrA== X-Gm-Message-State: APjAAAWK1N3LzTxHtYLgN8JrhBm59oaOock/WqM8T+llyY7FVHwxerHK I5CqeSjaFMNE5ls2QaJDkIs7+Zlb94UEpg== X-Received: by 2002:adf:dec7:: with SMTP id i7mr2473253wrn.134.1572193096993; Sun, 27 Oct 2019 09:18:16 -0700 (PDT) Received: from localhost.localdomain (p200300F133D01300428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:33d0:1300:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id j14sm9585014wrj.35.2019.10.27.09.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2019 09:18:16 -0700 (PDT) From: Martin Blumenstingl To: narmstrong@baylibre.com, jbrunet@baylibre.com, linux-amlogic@lists.infradead.org, khilman@baylibre.com Cc: robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Martin Blumenstingl Subject: [PATCH v2 4/5] clk: meson: meson8b: don't register the XTAL clock when provided via OF Date: Sun, 27 Oct 2019 17:18:04 +0100 Message-Id: <20191027161805.1176321-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027161805.1176321-1-martin.blumenstingl@googlemail.com> References: <20191027161805.1176321-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The XTAL clock is an actual crystal on the PCB. Thus the meson8b clock driver should not register the XTAL clock - instead it should be provided via .dts and then passed to the clock controller. Skip the registration of the XTAL clock if a parent clock is provided via OF. Fall back to registering the XTAL clock if this is not the case to keep support for old .dtbs. Signed-off-by: Martin Blumenstingl --- drivers/clk/meson/meson8b.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index b785b67baf2b..70ac6755607e 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3682,10 +3682,16 @@ static void __init meson8b_clkc_init_common(struct device_node *np, meson8b_clk_regmaps[i]->map = map; /* - * register all clks - * CLKID_UNUSED = 0, so skip it and start with CLKID_XTAL = 1 + * always skip CLKID_UNUSED and also skip XTAL if the .dtb provides the + * XTAL clock as input. */ - for (i = CLKID_XTAL; i < CLK_NR_CLKS; i++) { + if (!IS_ERR(of_clk_get_by_name(np, "xtal"))) + i = CLKID_PLL_FIXED; + else + i = CLKID_XTAL; + + /* register all clks */ + for (; i < CLK_NR_CLKS; i++) { /* array might be sparse */ if (!clk_hw_onecell_data->hws[i]) continue; -- 2.23.0