From patchwork Mon May 4 22:37:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 11527681 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D435C1392 for ; Mon, 4 May 2020 22:38:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F85320663 for ; Mon, 4 May 2020 22:38:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NRUAQEzp"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="jlKKm/Zz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F85320663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rere.qmqm.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:To:MIME-Version:Subject:From:References :In-Reply-To:Message-Id:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sfC+UBa0A0Rxm9Z7D1b9qt/lm2h9jAfq18jc+4wwW7Q=; b=NRUAQEzprnjhn2 mLJpw61BJR+UF1SnFvu6zmHAQdytKBw+kCJOlRjkoEVozXDZFh09CkapyhD3Oj/DhsqAkRNeCa0to FctHgJVzT3VdOjAA1DtshGj59YIjOr6aqIb8415ztwlbNIz/op1sjb8/91dRBQVJDqdehuaemR+ke pG3HDj/HKOf1qsYBpuOThE8LjPgtDUUwW9fF0Z5a1dqU0fwuE50EO2KuheP+VdZmcXZgD7Xt4CXA1 Y5sENFLMEw8bxzwhp6NvYOodtwGxVxPQT2y5BjWTqfxwa8OPNEedPazcSbW17oy9WuenPFVaSTzs3 URKiaV1CshqddgvatUMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVjix-00025W-NL; Mon, 04 May 2020 22:38:07 +0000 Received: from rere.qmqm.pl ([91.227.64.183]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVjio-0001v8-4a for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 22:38:00 +0000 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 49GHn04M5bzGj; Tue, 5 May 2020 00:37:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1588631876; bh=npQ0DTlpSjRU1SyUzwVllQOv+WDnVy+8TJXDCM73dlU=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=jlKKm/ZzmR65sBx/ORn0DhE3tYRzPZywLXLKayE/ntBiivnWXDoO5vOBTGtaq6jeW x22DQi6n6iDOigrslFk3xRrm3VbFm069IVJBQ0Zm0qB+Em9B3XPvS+KgaM1zP5Jnur +HiDtXC0doRMmlt3HCP9O+Tv2Lq+x1LzLJCrZV2CLSc1Au9HttIwrf+iYEPOsThCdp QtELsxKSltJpbUEUDTicVtu8ZmnpTM+izZmNpGjXigHAMrPLBwCUeszzJvuNl9x5yh KIsa4eOeFWvsYiO75Y/xSuu7qgaKbkbO+q9U4gP1tTReqoADdMMqBRGBqIwCn53E69 BVYnZMLfIX7aA== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at mail Date: Tue, 05 May 2020 00:37:56 +0200 Message-Id: In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v7 1/3] clk: at91: optimize pmc data allocation MIME-Version: 1.0 To: Alexandre Belloni , Ludovic Desroches , Michael Turquette , Nicolas Ferre , Rob Herring , Stephen Boyd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_153758_507613_CFF990C3 X-CRM114-Status: GOOD ( 14.20 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Alloc whole data structure in one block. This makes the code shorter, more efficient and easier to extend in following patch. Signed-off-by: Michał Mirosław Acked-by: Alexandre Belloni --- v2: rebase and update to clk/clk-at91 branch v3: use struct_size() and C99 trailing array as suggested by Stephen Boyd v4: fixed sign-off v5: no changes v6: no changes v7: pull all pmc_data_free() from second patch (a rebase artifact) --- drivers/clk/at91/at91rm9200.c | 2 +- drivers/clk/at91/at91sam9260.c | 2 +- drivers/clk/at91/at91sam9g45.c | 2 +- drivers/clk/at91/at91sam9n12.c | 2 +- drivers/clk/at91/at91sam9rl.c | 2 +- drivers/clk/at91/at91sam9x5.c | 2 +- drivers/clk/at91/pmc.c | 34 ++++++++-------------------------- drivers/clk/at91/pmc.h | 3 ++- drivers/clk/at91/sam9x60.c | 2 +- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama5d3.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 12 files changed, 20 insertions(+), 37 deletions(-) diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c index c44a431b6c97..6f4e1151553d 100644 --- a/drivers/clk/at91/at91rm9200.c +++ b/drivers/clk/at91/at91rm9200.c @@ -187,7 +187,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) return; err_free: - pmc_data_free(at91rm9200_pmc); + kfree(at91rm9200_pmc); } /* * While the TCB can be used as the clocksource, the system timer is most likely diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c index a9d4234758d7..946f03a09858 100644 --- a/drivers/clk/at91/at91sam9260.c +++ b/drivers/clk/at91/at91sam9260.c @@ -462,7 +462,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, return; err_free: - pmc_data_free(at91sam9260_pmc); + kfree(at91sam9260_pmc); } static void __init at91sam9260_pmc_setup(struct device_node *np) diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c index 38a7d2d2df0c..53e8252b8a63 100644 --- a/drivers/clk/at91/at91sam9g45.c +++ b/drivers/clk/at91/at91sam9g45.c @@ -210,7 +210,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) return; err_free: - pmc_data_free(at91sam9g45_pmc); + kfree(at91sam9g45_pmc); } /* * The TCB is used as the clocksource so its clock is needed early. This means diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c index 8bb39d2ba84b..f3ae1cd3cb8d 100644 --- a/drivers/clk/at91/at91sam9n12.c +++ b/drivers/clk/at91/at91sam9n12.c @@ -228,7 +228,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) return; err_free: - pmc_data_free(at91sam9n12_pmc); + kfree(at91sam9n12_pmc); } /* * The TCB is used as the clocksource so its clock is needed early. This means diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c index 77fe83a73bf4..cc739d214ae3 100644 --- a/drivers/clk/at91/at91sam9rl.c +++ b/drivers/clk/at91/at91sam9rl.c @@ -166,6 +166,6 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) return; err_free: - pmc_data_free(at91sam9rl_pmc); + kfree(at91sam9rl_pmc); } CLK_OF_DECLARE_DRIVER(at91sam9rl_pmc, "atmel,at91sam9rl-pmc", at91sam9rl_pmc_setup); diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 086cf0b4955c..aac99d699568 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -278,7 +278,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, return; err_free: - pmc_data_free(at91sam9x5_pmc); + kfree(at91sam9x5_pmc); } static void __init at91sam9g15_pmc_setup(struct device_node *np) diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index b71515acdec1..ac46ea1b9fda 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -76,48 +76,30 @@ struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data) return ERR_PTR(-EINVAL); } -void pmc_data_free(struct pmc_data *pmc_data) -{ - kfree(pmc_data->chws); - kfree(pmc_data->shws); - kfree(pmc_data->phws); - kfree(pmc_data->ghws); -} - struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, unsigned int nperiph, unsigned int ngck) { - struct pmc_data *pmc_data = kzalloc(sizeof(*pmc_data), GFP_KERNEL); + unsigned int num_clks = ncore + nsystem + nperiph + ngck; + struct pmc_data *pmc_data; + pmc_data = kzalloc(struct_size(pmc_data, hwtable, num_clks), + GFP_KERNEL); if (!pmc_data) return NULL; pmc_data->ncore = ncore; - pmc_data->chws = kcalloc(ncore, sizeof(struct clk_hw *), GFP_KERNEL); - if (!pmc_data->chws) - goto err; + pmc_data->chws = pmc_data->hwtable; pmc_data->nsystem = nsystem; - pmc_data->shws = kcalloc(nsystem, sizeof(struct clk_hw *), GFP_KERNEL); - if (!pmc_data->shws) - goto err; + pmc_data->shws = pmc_data->chws + ncore; pmc_data->nperiph = nperiph; - pmc_data->phws = kcalloc(nperiph, sizeof(struct clk_hw *), GFP_KERNEL); - if (!pmc_data->phws) - goto err; + pmc_data->phws = pmc_data->shws + nsystem; pmc_data->ngck = ngck; - pmc_data->ghws = kcalloc(ngck, sizeof(struct clk_hw *), GFP_KERNEL); - if (!pmc_data->ghws) - goto err; + pmc_data->ghws = pmc_data->phws + nperiph; return pmc_data; - -err: - pmc_data_free(pmc_data); - - return NULL; } #ifdef CONFIG_PM diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 9b8db9cdcda5..fc3ef772b9d9 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -24,6 +24,8 @@ struct pmc_data { struct clk_hw **phws; unsigned int ngck; struct clk_hw **ghws; + + struct clk_hw *hwtable[]; }; struct clk_range { @@ -95,7 +97,6 @@ struct clk_pcr_layout { #define nck(a) (a[ARRAY_SIZE(a) - 1].id + 1) struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, unsigned int nperiph, unsigned int ngck); -void pmc_data_free(struct pmc_data *pmc_data); int of_at91_get_clk_range(struct device_node *np, const char *propname, struct clk_range *range); diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c index cc19e8fb83be..a7d4f648db26 100644 --- a/drivers/clk/at91/sam9x60.c +++ b/drivers/clk/at91/sam9x60.c @@ -299,7 +299,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) return; err_free: - pmc_data_free(sam9x60_pmc); + kfree(sam9x60_pmc); } /* Some clks are used for a clocksource */ CLK_OF_DECLARE(sam9x60_pmc, "microchip,sam9x60-pmc", sam9x60_pmc_setup); diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index ff7e3f727082..b2560670e5af 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -350,6 +350,6 @@ static void __init sama5d2_pmc_setup(struct device_node *np) return; err_free: - pmc_data_free(sama5d2_pmc); + kfree(sama5d2_pmc); } CLK_OF_DECLARE_DRIVER(sama5d2_pmc, "atmel,sama5d2-pmc", sama5d2_pmc_setup); diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 88506f909c08..914e6f225510 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -231,7 +231,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) return; err_free: - pmc_data_free(sama5d3_pmc); + kfree(sama5d3_pmc); } /* * The TCB is used as the clocksource so its clock is needed early. This means diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index a6dee4a3b6e4..4ca9a4619500 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -267,6 +267,6 @@ static void __init sama5d4_pmc_setup(struct device_node *np) return; err_free: - pmc_data_free(sama5d4_pmc); + kfree(sama5d4_pmc); } CLK_OF_DECLARE_DRIVER(sama5d4_pmc, "atmel,sama5d4-pmc", sama5d4_pmc_setup); From patchwork Mon May 4 22:37:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 11527685 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AD431392 for ; Mon, 4 May 2020 22:38:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4B46B20663 for ; Mon, 4 May 2020 22:38:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y5iNQmws"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="Ji333Otr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B46B20663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rere.qmqm.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:To:MIME-Version:Subject:From:References :In-Reply-To:Message-Id:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LH+UNU2nW88vxJgmqOJ/9ejbWCET28Hb1iVmC+bJeng=; b=Y5iNQmwscQJBFL a4oN7ZbVhsJwGe3OqfVBtI7+YYGFyPTPZk19yIefunZK1I3m16wi9Ljr1GkIlodRmWrqsnREQFkS/ 5RzFPrv0sLI36TGt89NV5TDMJ60JIUrigtz+VtR1t1YjFW/wAWrJqBV26OZ98fBTv7KQxUsE6KFfy vOBOD0+LRXPktzNmk141qszA5tChF8hcjgh3mylTU139NRZ6Kb9Vb/EV2KoN4J21biix4rvHPtz2a iUsCTv0mupP8/om75Ita0uSm+rZHM8OIYXIB8jSjAXiig2I2gByjiJND7aMh87XRZpYmdQVKcoo/M FaqHtmzBrLe6vsH1FEvw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVjjO-0002Zr-RL; Mon, 04 May 2020 22:38:34 +0000 Received: from rere.qmqm.pl ([91.227.64.183]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVjio-0001v9-O1 for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 22:38:01 +0000 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 49GHn06SJnzHm; Tue, 5 May 2020 00:37:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1588631876; bh=PhipMKkVAuB02s31MTIFNoqzeH1P9lTruiM0jA6TTGQ=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=Ji333Otr9mGyQ8LhrmGgm/02NVRev1C75U77wFWvURtUWcMXywGbl9Zprct5szbGG ITEpgChwoCfO3ECpHCWLEGmiXGIp1Q3+REvcHy7/m1h/zrzoQwMa0Of5f5pIA0obg3 9nHJ7RXnew/AZ67DMLVfSDrRLlnTd9c3vZJqJnDrVD3Mzts9FgqZv75a73cBUd2wfu +KMfRhHqG/Q0Daz8TSWSAlbhNkD77euAHzHVwRARDTicB8szupTZUlvnUz7dKci/QG eMFIBfR8v028EqF2Ql0hhEz1pt+aly6FsyKKUSUiUCBEyfhdJYZ+oTnvaboRdNSjwz OgVJz/mYhmhLA== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at mail Date: Tue, 05 May 2020 00:37:56 +0200 Message-Id: <0054532c00163ddf405dad658b32f0d7d97fcc8e.1588630999.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v7 2/3] clk: at91: allow setting PCKx parent via DT MIME-Version: 1.0 To: Alexandre Belloni , Ludovic Desroches , Michael Turquette , Nicolas Ferre , Rob Herring , Stephen Boyd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_153759_118595_37801B05 X-CRM114-Status: GOOD ( 12.16 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This exposes PROGx clocks for use in assigned-clocks DeviceTree property for selecting PCKx parent clock. Signed-off-by: Michał Mirosław Acked-by: Alexandre Belloni --- v2: rebase and update to clk/clk-at91 branch v3: rebase v4: no changes v5: no changes v6: no changes v7: push all pmc_data_free() to first patch (fix a rebase artifact) --- drivers/clk/at91/at91rm9200.c | 4 +++- drivers/clk/at91/at91sam9260.c | 5 ++++- drivers/clk/at91/at91sam9g45.c | 4 +++- drivers/clk/at91/at91sam9n12.c | 4 +++- drivers/clk/at91/at91sam9rl.c | 4 +++- drivers/clk/at91/at91sam9x5.c | 4 +++- drivers/clk/at91/pmc.c | 12 ++++++++++-- drivers/clk/at91/pmc.h | 5 ++++- drivers/clk/at91/sam9x60.c | 4 +++- drivers/clk/at91/sama5d2.c | 4 +++- drivers/clk/at91/sama5d3.c | 4 +++- drivers/clk/at91/sama5d4.c | 4 +++- include/dt-bindings/clock/at91.h | 1 + 13 files changed, 46 insertions(+), 13 deletions(-) diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c index 6f4e1151553d..8da88e9a95d8 100644 --- a/drivers/clk/at91/at91rm9200.c +++ b/drivers/clk/at91/at91rm9200.c @@ -100,7 +100,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) at91rm9200_pmc = pmc_data_allocate(PMC_MAIN + 1, nck(at91rm9200_systemck), - nck(at91rm9200_periphck), 0); + nck(at91rm9200_periphck), 0, 4); if (!at91rm9200_pmc) return; @@ -159,6 +159,8 @@ static void __init at91rm9200_pmc_setup(struct device_node *np) &at91rm9200_programmable_layout); if (IS_ERR(hw)) goto err_free; + + at91rm9200_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) { diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c index 946f03a09858..7e5ff252fffc 100644 --- a/drivers/clk/at91/at91sam9260.c +++ b/drivers/clk/at91/at91sam9260.c @@ -354,7 +354,8 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, at91sam9260_pmc = pmc_data_allocate(PMC_MAIN + 1, ndck(data->sck, data->num_sck), - ndck(data->pck, data->num_pck), 0); + ndck(data->pck, data->num_pck), + 0, data->num_progck); if (!at91sam9260_pmc) return; @@ -434,6 +435,8 @@ static void __init at91sam926x_pmc_setup(struct device_node *np, &at91rm9200_programmable_layout); if (IS_ERR(hw)) goto err_free; + + at91sam9260_pmc->pchws[i] = hw; } for (i = 0; i < data->num_sck; i++) { diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c index 53e8252b8a63..5d18eb04c218 100644 --- a/drivers/clk/at91/at91sam9g45.c +++ b/drivers/clk/at91/at91sam9g45.c @@ -117,7 +117,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) at91sam9g45_pmc = pmc_data_allocate(PMC_MAIN + 1, nck(at91sam9g45_systemck), - nck(at91sam9g45_periphck), 0); + nck(at91sam9g45_periphck), 0, 2); if (!at91sam9g45_pmc) return; @@ -182,6 +182,8 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) &at91sam9g45_programmable_layout); if (IS_ERR(hw)) goto err_free; + + at91sam9g45_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) { diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c index f3ae1cd3cb8d..3a2564c2f724 100644 --- a/drivers/clk/at91/at91sam9n12.c +++ b/drivers/clk/at91/at91sam9n12.c @@ -129,7 +129,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) return; at91sam9n12_pmc = pmc_data_allocate(PMC_MAIN + 1, - nck(at91sam9n12_systemck), 31, 0); + nck(at91sam9n12_systemck), 31, 0, 2); if (!at91sam9n12_pmc) return; @@ -198,6 +198,8 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) &at91sam9x5_programmable_layout); if (IS_ERR(hw)) goto err_free; + + at91sam9n12_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) { diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c index cc739d214ae3..bcf07f6a0e0e 100644 --- a/drivers/clk/at91/at91sam9rl.c +++ b/drivers/clk/at91/at91sam9rl.c @@ -89,7 +89,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) at91sam9rl_pmc = pmc_data_allocate(PMC_MAIN + 1, nck(at91sam9rl_systemck), - nck(at91sam9rl_periphck), 0); + nck(at91sam9rl_periphck), 0, 2); if (!at91sam9rl_pmc) return; @@ -138,6 +138,8 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np) &at91rm9200_programmable_layout); if (IS_ERR(hw)) goto err_free; + + at91sam9rl_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) { diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index aac99d699568..f13756b407e2 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -151,7 +151,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, return; at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1, - nck(at91sam9x5_systemck), 31, 0); + nck(at91sam9x5_systemck), 31, 0, 2); if (!at91sam9x5_pmc) return; @@ -227,6 +227,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np, &at91sam9x5_programmable_layout); if (IS_ERR(hw)) goto err_free; + + at91sam9x5_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) { diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index ac46ea1b9fda..8a1577e2c2fd 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -67,6 +67,10 @@ struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data) if (idx < pmc_data->ngck) return pmc_data->ghws[idx]; break; + case PMC_TYPE_PROGRAMMABLE: + if (idx < pmc_data->npck) + return pmc_data->pchws[idx]; + break; default: break; } @@ -77,9 +81,10 @@ struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data) } struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, - unsigned int nperiph, unsigned int ngck) + unsigned int nperiph, unsigned int ngck, + unsigned int npck) { - unsigned int num_clks = ncore + nsystem + nperiph + ngck; + unsigned int num_clks = ncore + nsystem + nperiph + ngck + npck; struct pmc_data *pmc_data; pmc_data = kzalloc(struct_size(pmc_data, hwtable, num_clks), @@ -99,6 +104,9 @@ struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, pmc_data->ngck = ngck; pmc_data->ghws = pmc_data->phws + nperiph; + pmc_data->npck = npck; + pmc_data->pchws = pmc_data->ghws + ngck; + return pmc_data; } diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index fc3ef772b9d9..df616f2937e7 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -24,6 +24,8 @@ struct pmc_data { struct clk_hw **phws; unsigned int ngck; struct clk_hw **ghws; + unsigned int npck; + struct clk_hw **pchws; struct clk_hw *hwtable[]; }; @@ -96,7 +98,8 @@ struct clk_pcr_layout { #define ndck(a, s) (a[s - 1].id + 1) #define nck(a) (a[ARRAY_SIZE(a) - 1].id + 1) struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, - unsigned int nperiph, unsigned int ngck); + unsigned int nperiph, unsigned int ngck, + unsigned int npck); int of_at91_get_clk_range(struct device_node *np, const char *propname, struct clk_range *range); diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c index a7d4f648db26..db14e0427c7f 100644 --- a/drivers/clk/at91/sam9x60.c +++ b/drivers/clk/at91/sam9x60.c @@ -185,7 +185,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) sam9x60_pmc = pmc_data_allocate(PMC_MAIN + 1, nck(sam9x60_systemck), nck(sam9x60_periphck), - nck(sam9x60_gck)); + nck(sam9x60_gck), 8); if (!sam9x60_pmc) return; @@ -255,6 +255,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np) &sam9x60_programmable_layout); if (IS_ERR(hw)) goto err_free; + + sam9x60_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(sam9x60_systemck); i++) { diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index b2560670e5af..ae5e83cadb3d 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -169,7 +169,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) sama5d2_pmc = pmc_data_allocate(PMC_I2S1_MUX + 1, nck(sama5d2_systemck), nck(sama5d2_periph32ck), - nck(sama5d2_gck)); + nck(sama5d2_gck), 3); if (!sama5d2_pmc) return; @@ -267,6 +267,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np) &sama5d2_programmable_layout); if (IS_ERR(hw)) goto err_free; + + sama5d2_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(sama5d2_systemck); i++) { diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 914e6f225510..507eef6797f1 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -127,7 +127,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) sama5d3_pmc = pmc_data_allocate(PMC_MAIN + 1, nck(sama5d3_systemck), - nck(sama5d3_periphck), 0); + nck(sama5d3_periphck), 0, 3); if (!sama5d3_pmc) return; @@ -201,6 +201,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np) &at91sam9x5_programmable_layout); if (IS_ERR(hw)) goto err_free; + + sama5d3_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(sama5d3_systemck); i++) { diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 4ca9a4619500..80692902b4e4 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -142,7 +142,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np) sama5d4_pmc = pmc_data_allocate(PMC_MCK2 + 1, nck(sama5d4_systemck), - nck(sama5d4_periph32ck), 0); + nck(sama5d4_periph32ck), 0, 3); if (!sama5d4_pmc) return; @@ -224,6 +224,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np) &at91sam9x5_programmable_layout); if (IS_ERR(hw)) goto err_free; + + sama5d4_pmc->pchws[i] = hw; } for (i = 0; i < ARRAY_SIZE(sama5d4_systemck); i++) { diff --git a/include/dt-bindings/clock/at91.h b/include/dt-bindings/clock/at91.h index 38b5554153c8..c3f4aa6a2d29 100644 --- a/include/dt-bindings/clock/at91.h +++ b/include/dt-bindings/clock/at91.h @@ -12,6 +12,7 @@ #define PMC_TYPE_SYSTEM 1 #define PMC_TYPE_PERIPHERAL 2 #define PMC_TYPE_GCK 3 +#define PMC_TYPE_PROGRAMMABLE 4 #define PMC_SLOW 0 #define PMC_MCK 1 From patchwork Mon May 4 22:37:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 11527683 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 355531392 for ; Mon, 4 May 2020 22:38:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 022EF20663 for ; Mon, 4 May 2020 22:38:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YcATrrqy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="YqVMpoOI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 022EF20663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rere.qmqm.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:To:MIME-Version:Subject:From:References :In-Reply-To:Message-Id:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i4NzuzTDuuHxw8BJORdsaW2WyIlpkCWPmFS1ki3hN6E=; b=YcATrrqyjX7GVt rcW7gVgervOG1nUkP9VpsUyG0eiCPoXtZIxAVxlAPYBo6TKUwjEp3MiN8xBQpr7193W2FpyCfZO1w njR9TAhPsEyjdMIHp9LnLSD9jeOC9gzxXRZGFvf2KmeS6zrKtDV//e1CiZZRCIhNdy92IN9o3GZOd 5X2WFOlmG9+gu5wnbvxfSu0zwbDN7YZvBeymtnpIVpDMJDge0WYRGHfdk2R9wyDNWi0/5jd+dizws y+D5RSslr5UpIOq6mbk1VNvg8ihMLUQ+vP9O1P+JgA4PXRDtm+JpUGwYSuu1V7ruC8ocguz5Dv5nY vy2BJOhSefek2dkELwRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVjjB-0002Kr-As; Mon, 04 May 2020 22:38:21 +0000 Received: from rere.qmqm.pl ([91.227.64.183]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVjip-0001vB-AW for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 22:38:01 +0000 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 49GHn14BJXzKc; Tue, 5 May 2020 00:37:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1588631877; bh=vLx1Xz+sVIE1nUQTfmbe/LKbf1KmxNBQ5oGQOEhrzGI=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=YqVMpoOIeEHijxgDeCc6WsaBR2TxRm9zSkTnkm4GOLe1E3vSCGK5QJcW2YtLRnEmW fWBgruysoXx17wrU1uN3DvRSR70/9bZwOQAM7R7k7imFyr5+N0qiCVo9KuuvAh0E8I nSBlA0PqQx6Gg2CS4Ok2ZfgcD7ZTYaosFbWrabEqgoIxg/kcTM44h584xOPeACUF61 MTuS+R0X/c974LG2T01oan+fgw3peixM0mFHGmX11bF2P5Pla8fMgzMJVKtodurN7q I08WzPYFJmKfwEstkJCaWBpmc2o3N4Pgw0d3y8iNbJJ68SVd4PYLe4ft197LjiesZx DM9m7ra9B4Ftw== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at mail Date: Tue, 05 May 2020 00:37:57 +0200 Message-Id: In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v7 3/3] clk: at91: allow setting all PMC clock parents via DT MIME-Version: 1.0 To: Michael Turquette , Stephen Boyd , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Rob Herring X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_153759_691164_C3E5CD72 X-CRM114-Status: UNSURE ( 9.34 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 Acked-by: Alexandre Belloni --- v2: rebase to clk/clk-at91 branch v3: no changes v4: extend to whole family v5: fix copy-and-paste bugs for SAMA5D3/4 v6: make AUDIOPLL's id separate to PLLB v7: no changes --- 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..eba17106608b 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 9 #ifndef AT91_PMC_MOSCS #define AT91_PMC_MOSCS 0 /* MOSCS Flag */