From patchwork Sat May 2 15:58:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1281696 X-Patchwork-Delegate: lukma@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2014 header.b=bS/oJbgA; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Dv264q78z9sSk for ; Sun, 3 May 2020 01:59:26 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DA39781E10; Sat, 2 May 2020 17:59:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.b="bS/oJbgA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB28B81D54; Sat, 2 May 2020 17:59:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FROM,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from libero.it (smtp-33.italiaonline.it [213.209.10.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0D82B81D54 for ; Sat, 2 May 2020 17:59:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from localhost.localdomain ([5.90.75.117]) by smtp-33.iol.local with ESMTPA id UuXZj5cpMrZwsUuXjjObYM; Sat, 02 May 2020 17:59:07 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014; t=1588435147; bh=64nUrvV8XPFFH8TD76rsITHIzZVdeNV89418FPTPces=; h=From; b=bS/oJbgAWi5dB9bxCejaol7qXltbNNZMg6AgQYEMr4TEPNs/p/SBoKOhGfVPZJ7Dy omuqOdg+EY/ux6Qye4FtRjJELC6Af7fWlJ20z43ltNNEm+yoUwQ27pq3iJtvF2HfrA q8f5eKg426ZnEkq6+7zcx7hmxRc1sOBvXjCUNOjYf2obPl8/IN/fpV4UQDWSFmmHxb MNuk/cLM9remAlNQFykUs/UiOA1aD0l99r7KkjTNwudNbpD+kcJ4/NX36+qPeuHjG/ ErgDevj0hfqyeqTdpiqHlaRZEp7NdC8uQCczIroCy6XG0fEoKyo8CEbtVP33rNDMdU IN+uwYNkjVkGQ== X-CNFS-Analysis: v=2.3 cv=ANbu9Azk c=1 sm=1 tr=0 a=5s//uFzt2f5/EBH7ijzGNA==:117 a=5s//uFzt2f5/EBH7ijzGNA==:17 a=knRkELuPiPvcvLzOWRQA:9 a=pHzHmUro8NiASowvMSCR:22 a=n87TN5wuljxrRezIQYnT:22 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Dario Binacchi , Lukasz Majewski Subject: [PATCH 1/4] clk: ccf: mux: change include order Date: Sat, 2 May 2020 17:58:31 +0200 Message-Id: <20200502155834.27481-2-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200502155834.27481-1-dariobin@libero.it> References: <20200502155834.27481-1-dariobin@libero.it> X-CMAE-Envelope: MS4wfB1blgpUDf9Y3IcAtINcoOb82DBMpoe3mccqEpF4gBZPGl9Kjc1uU5UQOXkNLUNay5QnH7b6XTsgHe6oljlhUFFMBn7MGqIiOcr/+4CWGMTkXNA+SIVs 9sAF7MefFTgtDWyr3u1d8f2MHCg1WaRy+S7BFTBUY7cQpBaWmoPwo+UFl+OQejQfT/VDtsEJ8rySKQmeeAGe3WhjU1RwIOSWa3XkJWujeKmnuMhE4MR2epdu X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Apply u-boot coding style on include files order. Signed-off-by: Dario Binacchi --- drivers/clk/clk-mux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index b9d2ae6778..9511a80fe3 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -22,15 +22,15 @@ */ #include -#include -#include +#include #include #include #include +#include +#include #include -#include -#include "clk.h" #include +#include "clk.h" #define UBOOT_DM_CLK_CCF_MUX "ccf_clk_mux" From patchwork Sat May 2 15:58:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1281697 X-Patchwork-Delegate: lukma@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2014 header.b=GxMLdeQZ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Dv2G4mQVz9sRf for ; Sun, 3 May 2020 01:59:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C826381E25; Sat, 2 May 2020 17:59:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.b="GxMLdeQZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 11D8681E1D; Sat, 2 May 2020 17:59:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FROM,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from libero.it (smtp-33.italiaonline.it [213.209.10.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8A3EC81DF0 for ; Sat, 2 May 2020 17:59:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from localhost.localdomain ([5.90.75.117]) by smtp-33.iol.local with ESMTPA id UuXZj5cpMrZwsUuXnjObbF; Sat, 02 May 2020 17:59:11 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014; t=1588435151; bh=+gusRWJGWlE5T6/oS061Sxmf3V4W53ZjNGWS+Q3552w=; h=From; b=GxMLdeQZo4QCwjZD5sOZWk2N7DQraz3txdfUm5RbODmRfjV3RCzflYl5anuzlSXN0 Hf1axLJLkY7oHuln45I8FKQP6wQNm/nMbKYEFMX0CuFGwwUqm0wQo+8P3x6mQLPC33 T4BqNU6wVPQcL32/Kn2EUOC+qeC72tWtDq+4uIQqmLjt3WzO2TfqraI0zY54Cv3hfw ABkuW1vFbkSSC6tcDMXeU+cK3y3frozcopkinsNQfWxA5jlse+VVXwXoTLH3tkxRr3 nNr4YWe0GqPhffCixWO/o33dUwgcOg3YvN5fiuzs++0P07z2jc5n495haezyP5rx9p ljM5OaiR7VikA== X-CNFS-Analysis: v=2.3 cv=ANbu9Azk c=1 sm=1 tr=0 a=5s//uFzt2f5/EBH7ijzGNA==:117 a=5s//uFzt2f5/EBH7ijzGNA==:17 a=YCRnM0zLkuzDtrswjIMA:9 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Dario Binacchi , Lukasz Majewski Subject: [PATCH 2/4] clk: ccf: mux: fix typo Date: Sat, 2 May 2020 17:58:32 +0200 Message-Id: <20200502155834.27481-3-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200502155834.27481-1-dariobin@libero.it> References: <20200502155834.27481-1-dariobin@libero.it> X-CMAE-Envelope: MS4wfL07fA1ElFj9Adc4tRLKuuq3+5IICfoCHstTRC7yhxLzbtBiLh1Ab9XFZMmX7srwlbCjbySZzM/HF1vHwnM5Nx5rLuhB5SFweHHHyDTYrp4CElvM1IlV 9QXUmUTWgsLVEYhc4P15JJnbGdMf0RmsOdd/f+I16xkpduekYsHgXrZBwO6C+uyFU6v5XECTxzcwoPiNBZrbeiUtkeyy367Rsy9sk4++kLKqq80f/eQiP5Xa X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Close the opening bracket. Signed-off-by: Dario Binacchi --- drivers/clk/clk-mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 9511a80fe3..6264b63900 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -193,7 +193,7 @@ struct clk *clk_hw_register_mux_table(struct device *dev, const char *name, * Read the current mux setup - so we assign correct parent. * * Changing parent would require changing internals of udevice struct - * for the corresponding clock (to do that define .set_parent() method. + * for the corresponding clock (to do that define .set_parent() method). */ ret = clk_register(clk, UBOOT_DM_CLK_CCF_MUX, name, parent_names[clk_mux_get_parent(clk)]); From patchwork Sat May 2 15:58:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1281698 X-Patchwork-Delegate: lukma@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2014 header.b=qC74zzVY; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Dv2S4LTLz9sRf for ; Sun, 3 May 2020 01:59:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F70D81E18; Sat, 2 May 2020 17:59:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.b="qC74zzVY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDF4A81E20; Sat, 2 May 2020 17:59:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FROM,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from libero.it (smtp-33.italiaonline.it [213.209.10.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6EA9A81E17 for ; Sat, 2 May 2020 17:59:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from localhost.localdomain ([5.90.75.117]) by smtp-33.iol.local with ESMTPA id UuXZj5cpMrZwsUuXojObcd; Sat, 02 May 2020 17:59:13 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014; t=1588435153; bh=nZOYzbCec8ctV3w6tVlvhPcYV2nYUFSq5tSX8737dXk=; h=From; b=qC74zzVYaIXSjxrqbMn/QA8FEj2p1evynmPjyT3ZduSd6RTZRHmqOdWG4LS+RpfQO I2fcu28rGxDS//Sw5/ExESruVN/8Fw+2hjXMsTkNaqKvuny7GfRR5YuFFqipQ960Xr v4vCBURI5L4Bh2eltl4KdmdPoVthZHJUlL0t8Xdimk7HcBzjRWyZKy7ATMK9A3UiGp KQ2AS8MPpq6cSo8EI4q6hWLdKkgbvpK5MwzJNe47ANDED+Yuq06KWPUFUoLgFdJHXM QeWiamt2wxntAklH9b4vsRnkjmyWZkL2d66E3kjbpX0YXqRVpuHCIS1uzKhbAP6nye wXyecl7VTUGjw== X-CNFS-Analysis: v=2.3 cv=ANbu9Azk c=1 sm=1 tr=0 a=5s//uFzt2f5/EBH7ijzGNA==:117 a=5s//uFzt2f5/EBH7ijzGNA==:17 a=x8DDfxDrzwGj3e_RbWYA:9 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Dario Binacchi , Lukasz Majewski Subject: [PATCH 3/4] clk: ccf: mux: fix access to the sandbox register Date: Sat, 2 May 2020 17:58:33 +0200 Message-Id: <20200502155834.27481-4-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200502155834.27481-1-dariobin@libero.it> References: <20200502155834.27481-1-dariobin@libero.it> X-CMAE-Envelope: MS4wfDHp4qgjXdAK7uVk0+KL3Ck9Nr2MJX2ixUgiDQTmFtFKyYSCZ6mkMDg/u02KGEZ2Y4s7HQadcZ/BZEV5qzjdqZEQN4I8eS/uo1uPWw5cTplBdRD8EoTI JR7RNDPgtKREk34QO3aKQmigxef45bvagrATvOjwJ0HI/A6IkgYPe/qxnF0ys/HcO96V4cliib0pUdONvDeGpMy/ivRhMAz+H+q5te98ZEj/nFvfbDefNHw5 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean The tests developed for the mux clock are run on the sandbox. They don't call the clk_mux_set_parent routine and therefore they do not detect this error. Signed-off-by: Dario Binacchi --- drivers/clk/clk-mux.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 6264b63900..8f85e84ae9 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -134,12 +134,20 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent) if (mux->flags & CLK_MUX_HIWORD_MASK) { reg = mux->mask << (mux->shift + 16); } else { +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + reg = mux->io_mux_val; +#else reg = readl(mux->reg); +#endif reg &= ~(mux->mask << mux->shift); } val = val << mux->shift; reg |= val; +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + mux->io_mux_val = reg; +#else writel(reg, mux->reg); +#endif return 0; } From patchwork Sat May 2 15:58:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1281699 X-Patchwork-Delegate: lukma@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2014 header.b=IWd1pS4D; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Dv2g0cywz9sRf for ; Sun, 3 May 2020 01:59:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9490081E22; Sat, 2 May 2020 17:59:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.b="IWd1pS4D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8582281E18; Sat, 2 May 2020 17:59:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FROM,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from libero.it (smtp-33.italiaonline.it [213.209.10.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ACF4481E1E for ; Sat, 2 May 2020 17:59:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from localhost.localdomain ([5.90.75.117]) by smtp-33.iol.local with ESMTPA id UuXZj5cpMrZwsUuXrjObeA; Sat, 02 May 2020 17:59:15 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014; t=1588435155; bh=RDjo4Wiph1OXcz3bCYyE/fodN0K8/ZhmboEH59V7OVw=; h=From; b=IWd1pS4DYTuWU8J5NbLx8HpduOiYBa/MnONMNgPw1V8Rdwl+52y5A/gUCgf+DMDtL 2y+ivLVyTJ51iO8daTRkdHLzxw21HQO12iFlZO9MrtQmUSejRLqzqNPfVSinr4exXv 6FQVItTSyx/MSmxMvTSOUzyL3wZgKjM78YD8Jqn6Dw1vzYfLHo4jVoRcrO8zh1Va1B nNzKvS1laC5FWU/nD9oeqdIDX7m4zGgLqCZFwAFs/XVYNEug+75zMUq4W6FFy1wGOD wjZXvPwdHfDQLVL9ha21uQucB9LCqNlJo+rS+a8LbQX+3tfmRVUfc9ky4/5Ryn/kFx eTDUcDF83rL7g== X-CNFS-Analysis: v=2.3 cv=ANbu9Azk c=1 sm=1 tr=0 a=5s//uFzt2f5/EBH7ijzGNA==:117 a=5s//uFzt2f5/EBH7ijzGNA==:17 a=g-850U7pSUD1QzQCJlwA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Dario Binacchi , Lukasz Majewski , Simon Glass Subject: [PATCH 4/4] clk: ccf: mux: change the get_rate helper Date: Sat, 2 May 2020 17:58:34 +0200 Message-Id: <20200502155834.27481-5-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200502155834.27481-1-dariobin@libero.it> References: <20200502155834.27481-1-dariobin@libero.it> X-CMAE-Envelope: MS4wfLUjsm3IP6y+zthJg/OZD0hBb8hgYZ7Q9zCeRVboaBL2SF3D3EtaxzSqJvWd6NsCiFNCe77FtFlVa+pmGldJoR+vHvWDKd8coNwZMab+El0jd0gcakw2 grJfIk/skjduAhbfo356AoSyTsmdEq4tJUtzKhk5tKNPkyWMUNHR67wky69arbw84pPH9upq27UIZ1kS+/9Xi4itR16YSi/pZ5OKm6irfcvbbiADj1dfggHQ TokdDxRUuHWm6863k+sXYA== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean The previous version of the get_rate helper does not work if the mux clock parent is changed after the probe. This error has not been detected because this condition has not been tested. The error occurs because the set_parent helper does not change the parent of the clock device but only the clock selection register. Since changing the parent of a probed device can be tricky, the new version of the get_rate helper provides the rate of the selected clock and not that of the parent. Signed-off-by: Dario Binacchi Reviewed-by: Simon Glass --- drivers/clk/clk-mux.c | 26 +++++++++++++++++++++++++- test/dm/clk_ccf.c | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 8f85e84ae9..1f2dab647f 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -152,8 +152,32 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent) return 0; } +static ulong clk_mux_get_rate(struct clk *clk) +{ + struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ? + dev_get_clk_ptr(clk->dev) : clk); + struct udevice *parent; + struct clk *pclk; + int err, index; + + index = clk_mux_get_parent(clk); + if (index >= mux->num_parents) + return -EFAULT; + + err = uclass_get_device_by_name(UCLASS_CLK, mux->parent_names[index], + &parent); + if (err) + return err; + + pclk = dev_get_clk_ptr(parent); + if (!pclk) + return -ENODEV; + + return clk_get_rate(pclk); +} + const struct clk_ops clk_mux_ops = { - .get_rate = clk_generic_get_rate, + .get_rate = clk_mux_get_rate, .set_parent = clk_mux_set_parent, }; diff --git a/test/dm/clk_ccf.c b/test/dm/clk_ccf.c index ae3a4d8a76..bf99776ac1 100644 --- a/test/dm/clk_ccf.c +++ b/test/dm/clk_ccf.c @@ -46,6 +46,18 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) rate = clk_get_parent_rate(clk); ut_asserteq(rate, 60000000); + rate = clk_get_rate(clk); + ut_asserteq(rate, 60000000); + + ret = clk_get_by_id(SANDBOX_CLK_PLL3_80M, &pclk); + ut_assertok(ret); + + ret = clk_set_parent(clk, pclk); + ut_assertok(ret); + + rate = clk_get_rate(clk); + ut_asserteq(rate, 80000000); + ret = clk_get_by_id(SANDBOX_CLK_USDHC2_SEL, &clk); ut_assertok(ret); ut_asserteq_str("usdhc2_sel", clk->dev->name); @@ -56,6 +68,18 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) pclk = clk_get_parent(clk); ut_asserteq_str("pll3_80m", pclk->dev->name); + rate = clk_get_rate(clk); + ut_asserteq(rate, 80000000); + + ret = clk_get_by_id(SANDBOX_CLK_PLL3_60M, &pclk); + ut_assertok(ret); + + ret = clk_set_parent(clk, pclk); + ut_assertok(ret); + + rate = clk_get_rate(clk); + ut_asserteq(rate, 60000000); + /* Test the composite of CCF */ ret = clk_get_by_id(SANDBOX_CLK_I2C, &clk); ut_assertok(ret);