Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3967699ybz; Mon, 4 May 2020 13:08:52 -0700 (PDT) X-Google-Smtp-Source: APiQypKQIk+P8oDmfkKkUdihcltNeK3r+24ca281GB3LYMphIhTew1mu0rbJKTzESojoU/X3o7tn X-Received: by 2002:a17:907:361:: with SMTP id rs1mr16695202ejb.228.1588622932262; Mon, 04 May 2020 13:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588622932; cv=none; d=google.com; s=arc-20160816; b=EVFESz8lCyUi+gs7x0CQ0YF7/Wb0EWYXbZEchoouB4AvOtKQwhnWsz9w1BtkETrz6o PadGNfO3/vpJuQKpHfojdFv4OiMBXjpkDJVmmtNjal6SKHvoxMPkGGbQM7Zxd+TUVjSU rDwtMA44DRnsJKWOkausHIy9e1Z076T7DX11+VrsRGKkIboIkPPq4Ozny/NE/BRcWONw +4RTFz7kyGZolQcJndK5qCs60XJYu9RqyJrli6xZe/9A2Uz2n35yDiojJAlX20SPKLYE mvLHKD8PF2dt9nDELCqPkygyowV9lXs0rUb6YE/Ne9yX9Ggqbkp4nfAflgzb1haXI8kT jXIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zt17zOM/ld0QpHoFrA3b6XmQ8q8DllYWZFqXDHVXEcE=; b=A5CVP5oEtp9+4egzfoNT3/KdrYccdRRk5rYvwUDvFiTyHCv98C2K7f1WAn2NnFhlWb DOe0/s0b6lIijQNDMxSkBge/HJKtQFGzBhZCYyIXOG+ylxg4N3CcNT26MUE1f3cGwkS5 tvVOqY3Ma4GnCmfcIFOPZF8Qeo/71+BctqYk6wpPWO/UjiOb91NNA+dJJA8cBLEHmJJi wu++Tgz1+gzl91RMIRntXwcZrrjXnvoN56+y69GRxP4LA2xPbMCAa80X0fX16iAGFyjF 3Wz4YLYbs+7LKIF75DnyimbBtHssbJ/6z1jQFAPpJLdfKNm55EkSo4PDrqd/YwOpNu2R bqQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd5si19696edb.34.2020.05.04.13.08.28; Mon, 04 May 2020 13:08:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726930AbgEDUGY (ORCPT + 99 others); Mon, 4 May 2020 16:06:24 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:35319 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbgEDUGX (ORCPT ); Mon, 4 May 2020 16:06:23 -0400 X-Originating-IP: 86.202.105.35 Received: from localhost (lfbn-lyo-1-9-35.w86-202.abo.wanadoo.fr [86.202.105.35]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 5622DFF808; Mon, 4 May 2020 20:06:19 +0000 (UTC) Date: Mon, 4 May 2020 22:06:18 +0200 From: Alexandre Belloni To: =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Ludovic Desroches , Michael Turquette , Nicolas Ferre , Rob Herring , Stephen Boyd , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 3/3] clk: at91: allow setting all PMC clock parents via DT Message-ID: <20200504200618.GJ34497@piout.net> References: <74a5cd94fb7fb0058d905d83f192a4cc85fa6b5b.1588622158.git.mirq-linux@rere.qmqm.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <74a5cd94fb7fb0058d905d83f192a4cc85fa6b5b.1588622158.git.mirq-linux@rere.qmqm.pl> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Your v5 and my review on v4 just crossed. My comment still holds On 04/05/2020 21:58:44+0200, Michał Mirosław wrote: > We need to have clocks accessible via phandle to select them > as peripheral clock parent using assigned-clock-parents in DT. > Add support for PLLACK/PLLBCK/AUDIOPLLCK clocks where available. > > Signed-off-by: Michał Mirosław > --- > v2: rebase to clk/clk-at91 branch > v3: no changes > v4: extend to whole family > v5: fix copy-and-paste bugs for SAMA5D3/4 > --- > drivers/clk/at91/at91rm9200.c | 6 +++++- > drivers/clk/at91/at91sam9260.c | 6 +++++- > drivers/clk/at91/at91sam9g45.c | 4 +++- > drivers/clk/at91/at91sam9n12.c | 6 +++++- > drivers/clk/at91/at91sam9rl.c | 4 +++- > drivers/clk/at91/at91sam9x5.c | 4 +++- > drivers/clk/at91/sam9x60.c | 4 +++- > drivers/clk/at91/sama5d2.c | 6 +++++- > drivers/clk/at91/sama5d3.c | 4 +++- > drivers/clk/at91/sama5d4.c | 4 +++- > include/dt-bindings/clock/at91.h | 3 +++ > 11 files changed, 41 insertions(+), 10 deletions(-) > > diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c > index 8da88e9a95d8..38bdb4981315 100644 > --- a/drivers/clk/at91/at91rm9200.c > +++ b/drivers/clk/at91/at91rm9200.c > @@ -98,7 +98,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) > if (IS_ERR(regmap)) > return; > > - at91rm9200_pmc = pmc_data_allocate(PMC_MAIN + 1, > + at91rm9200_pmc = pmc_data_allocate(PMC_PLLBCK + 1, > nck(at91rm9200_systemck), > nck(at91rm9200_periphck), 0, 4); > if (!at91rm9200_pmc) > @@ -123,12 +123,16 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + at91rm9200_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1, > &at91rm9200_pll_layout, > &rm9200_pll_characteristics); > if (IS_ERR(hw)) > goto err_free; > > + at91rm9200_pmc->chws[PMC_PLLBCK] = hw; > + > parent_names[0] = slowxtal_name; > parent_names[1] = "mainck"; > parent_names[2] = "pllack"; > diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c > index 7e5ff252fffc..6d0723aa8b13 100644 > --- a/drivers/clk/at91/at91sam9260.c > +++ b/drivers/clk/at91/at91sam9260.c > @@ -352,7 +352,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, > if (IS_ERR(regmap)) > return; > > - at91sam9260_pmc = pmc_data_allocate(PMC_MAIN + 1, > + at91sam9260_pmc = pmc_data_allocate(PMC_PLLBCK + 1, > ndck(data->sck, data->num_sck), > ndck(data->pck, data->num_pck), > 0, data->num_progck); > @@ -399,12 +399,16 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, > if (IS_ERR(hw)) > goto err_free; > > + at91sam9260_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1, > data->pllb_layout, > data->pllb_characteristics); > if (IS_ERR(hw)) > goto err_free; > > + at91sam9260_pmc->chws[PMC_PLLBCK] = hw; > + > parent_names[0] = slck_name; > parent_names[1] = "mainck"; > parent_names[2] = "pllack"; > diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c > index 5d18eb04c218..9873b583c260 100644 > --- a/drivers/clk/at91/at91sam9g45.c > +++ b/drivers/clk/at91/at91sam9g45.c > @@ -115,7 +115,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) > if (IS_ERR(regmap)) > return; > > - at91sam9g45_pmc = pmc_data_allocate(PMC_MAIN + 1, > + at91sam9g45_pmc = pmc_data_allocate(PMC_PLLACK + 1, > nck(at91sam9g45_systemck), > nck(at91sam9g45_periphck), 0, 2); > if (!at91sam9g45_pmc) > @@ -143,6 +143,8 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + at91sam9g45_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); > if (IS_ERR(hw)) > goto err_free; > diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c > index 3a2564c2f724..630dc5d87171 100644 > --- a/drivers/clk/at91/at91sam9n12.c > +++ b/drivers/clk/at91/at91sam9n12.c > @@ -128,7 +128,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) > if (IS_ERR(regmap)) > return; > > - at91sam9n12_pmc = pmc_data_allocate(PMC_MAIN + 1, > + at91sam9n12_pmc = pmc_data_allocate(PMC_PLLBCK + 1, > nck(at91sam9n12_systemck), 31, 0, 2); > if (!at91sam9n12_pmc) > return; > @@ -162,11 +162,15 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + at91sam9n12_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1, > &at91rm9200_pll_layout, &pllb_characteristics); > if (IS_ERR(hw)) > goto err_free; > > + at91sam9n12_pmc->chws[PMC_PLLBCK] = hw; > + > parent_names[0] = slck_name; > parent_names[1] = "mainck"; > parent_names[2] = "plladivck"; > diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c > index bcf07f6a0e0e..0d1cc44b056f 100644 > --- a/drivers/clk/at91/at91sam9rl.c > +++ b/drivers/clk/at91/at91sam9rl.c > @@ -87,7 +87,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) > if (IS_ERR(regmap)) > return; > > - at91sam9rl_pmc = pmc_data_allocate(PMC_MAIN + 1, > + at91sam9rl_pmc = pmc_data_allocate(PMC_PLLACK + 1, > nck(at91sam9rl_systemck), > nck(at91sam9rl_periphck), 0, 2); > if (!at91sam9rl_pmc) > @@ -105,6 +105,8 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + at91sam9rl_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); > if (IS_ERR(hw)) > goto err_free; > diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c > index f13756b407e2..0ce3da080287 100644 > --- a/drivers/clk/at91/at91sam9x5.c > +++ b/drivers/clk/at91/at91sam9x5.c > @@ -150,7 +150,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, > if (IS_ERR(regmap)) > return; > > - at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1, > + at91sam9x5_pmc = pmc_data_allocate(PMC_PLLACK + 1, > nck(at91sam9x5_systemck), 31, 0, 2); > if (!at91sam9x5_pmc) > return; > @@ -184,6 +184,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, > if (IS_ERR(hw)) > goto err_free; > > + at91sam9x5_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); > if (IS_ERR(hw)) > goto err_free; > diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c > index db14e0427c7f..3e20aa68259f 100644 > --- a/drivers/clk/at91/sam9x60.c > +++ b/drivers/clk/at91/sam9x60.c > @@ -182,7 +182,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) > if (IS_ERR(regmap)) > return; > > - sam9x60_pmc = pmc_data_allocate(PMC_MAIN + 1, > + sam9x60_pmc = pmc_data_allocate(PMC_PLLACK + 1, > nck(sam9x60_systemck), > nck(sam9x60_periphck), > nck(sam9x60_gck), 8); > @@ -214,6 +214,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + sam9x60_pmc->chws[PMC_PLLACK] = hw; > + > hw = sam9x60_clk_register_pll(regmap, &pmc_pll_lock, "upllck", > "main_osc", 1, &upll_characteristics); > if (IS_ERR(hw)) > diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c > index ae5e83cadb3d..b3fa2291ccd8 100644 > --- a/drivers/clk/at91/sama5d2.c > +++ b/drivers/clk/at91/sama5d2.c > @@ -166,7 +166,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) > if (IS_ERR(regmap)) > return; > > - sama5d2_pmc = pmc_data_allocate(PMC_I2S1_MUX + 1, > + sama5d2_pmc = pmc_data_allocate(PMC_AUDIOPLLCK + 1, > nck(sama5d2_systemck), > nck(sama5d2_periph32ck), > nck(sama5d2_gck), 3); > @@ -202,6 +202,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + sama5d2_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_audio_pll_frac(regmap, "audiopll_fracck", > "mainck"); > if (IS_ERR(hw)) > @@ -217,6 +219,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + sama5d2_pmc->chws[PMC_AUDIOPLLCK] = hw; > + > regmap_sfr = syscon_regmap_lookup_by_compatible("atmel,sama5d2-sfr"); > if (IS_ERR(regmap_sfr)) > regmap_sfr = NULL; > diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c > index 507eef6797f1..5e4e44dd4c37 100644 > --- a/drivers/clk/at91/sama5d3.c > +++ b/drivers/clk/at91/sama5d3.c > @@ -125,7 +125,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) > if (IS_ERR(regmap)) > return; > > - sama5d3_pmc = pmc_data_allocate(PMC_MAIN + 1, > + sama5d3_pmc = pmc_data_allocate(PMC_PLLACK + 1, > nck(sama5d3_systemck), > nck(sama5d3_periphck), 0, 3); > if (!sama5d3_pmc) > @@ -158,6 +158,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + sama5d3_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); > if (IS_ERR(hw)) > goto err_free; > diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c > index 80692902b4e4..662ff5fa6e98 100644 > --- a/drivers/clk/at91/sama5d4.c > +++ b/drivers/clk/at91/sama5d4.c > @@ -140,7 +140,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) > if (IS_ERR(regmap)) > return; > > - sama5d4_pmc = pmc_data_allocate(PMC_MCK2 + 1, > + sama5d4_pmc = pmc_data_allocate(PMC_PLLACK + 1, > nck(sama5d4_systemck), > nck(sama5d4_periph32ck), 0, 3); > if (!sama5d4_pmc) > @@ -173,6 +173,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np) > if (IS_ERR(hw)) > goto err_free; > > + sama5d4_pmc->chws[PMC_PLLACK] = hw; > + > hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck"); > if (IS_ERR(hw)) > goto err_free; > diff --git a/include/dt-bindings/clock/at91.h b/include/dt-bindings/clock/at91.h > index c3f4aa6a2d29..adcf608b41fa 100644 > --- a/include/dt-bindings/clock/at91.h > +++ b/include/dt-bindings/clock/at91.h > @@ -21,6 +21,9 @@ > #define PMC_MCK2 4 > #define PMC_I2S0_MUX 5 > #define PMC_I2S1_MUX 6 > +#define PMC_PLLACK 7 > +#define PMC_PLLBCK 8 > +#define PMC_AUDIOPLLCK 8 /* SAMA5D2-only, no PLLB there */ > > #ifndef AT91_PMC_MOSCS > #define AT91_PMC_MOSCS 0 /* MOSCS Flag */ > -- > 2.20.1 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com