From patchwork Wed Jul 29 14:51:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1338354 X-Patchwork-Delegate: eugen.hristev@microchip.com 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=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=K01WKr7C; 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 4BGxNt39xvz9sRN for ; Thu, 30 Jul 2020 00:53:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DCCAB825A7; Wed, 29 Jul 2020 16:52:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="K01WKr7C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 65CD0825D0; Wed, 29 Jul 2020 16:52:00 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (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 68EF3825BD for ; Wed, 29 Jul 2020 16:51:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1596034315; x=1627570315; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=24A/vxTNrNgUQ4hYL/um3GdYhiedmoEh4LZChIWGST4=; b=K01WKr7CLLN5r72eRWRadERRi6Dg141OJ1wC4rTcXUUiKTdbQRK+z80s YzS0/ikCxpi7Z9OBd16MlK1GS+I13jTTChlHTPv8iUfH8lr4cFeB8dJwS J7G++aTfBOp+3TR1wpEKoXYdTSP6z8SiNent+RIPJclSMrgjOsR5wwO8R ji6ABebccat69OxuYNdqqcXYkwRWhwhmJxro0vEineeAV9vQldhHvxWYi 9OdyVs5htKHHLVNzb/eQYQheM5MTaDM3AGSxceMLf6ZN3W94YYp1UFnqf pL5WrOSuLKp95Bu3TlQOADJDrzq7NJW1KS2yNUrrNQTYQBCb6vn7P3+mU w==; IronPort-SDR: TefCXWnp63moCoA2bQ2rUBt7Wnetijy7IFWWhRf2KAuMb2FAy3j1ies2XIQ9PcKT7qMw3hi9fQ PMXgQGN6Ah4SfsGQQ/R2mCTQiwkP/XUMNWmn+tEzOL3dZXh2xUu6zBdTeWNbimCfLZv4Yxd1WA kuX2H2Rdbye4IWRwTYNpqYWOkwriUDXYVWvs/3LBWevOfpVn8z4KIlFIWQKTTDJ6NXgj75Z/31 8rcBwcN933CAo/3JpttB7wRtRigQS6FRWX9XhcHIZprNcMcRzD5+LgCTd01UkrIclH/wVX7CBM 4ww= X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="85826036" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 29 Jul 2020 07:51:54 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 29 Jul 2020 07:51:52 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 29 Jul 2020 07:51:51 -0700 From: Claudiu Beznea To: , CC: , Subject: [PATCH 04/22] clk: bind clk to new parent device Date: Wed, 29 Jul 2020 17:51:23 +0300 Message-ID: <1596034301-5428-5-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596034301-5428-1-git-send-email-claudiu.beznea@microchip.com> References: <1596034301-5428-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Clock re-parenting is not binding the clock's device to its new parent device, it only calls the clock's ops->set_parent() API. The changes in this commit re-parent the clock device to its new parent so that subsequent operations like clk_get_parent() to point to the proper parent. Signed-off-by: Claudiu Beznea Reviewed-by: Simon Glass --- drivers/clk/clk-uclass.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index aa1f11a27c41..b390a6b01c06 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -511,6 +512,7 @@ ulong clk_set_rate(struct clk *clk, ulong rate) int clk_set_parent(struct clk *clk, struct clk *parent) { const struct clk_ops *ops; + int ret; debug("%s(clk=%p, parent=%p)\n", __func__, clk, parent); if (!clk_valid(clk)) @@ -520,7 +522,14 @@ int clk_set_parent(struct clk *clk, struct clk *parent) if (!ops->set_parent) return -ENOSYS; - return ops->set_parent(clk, parent); + ret = ops->set_parent(clk, parent); + if (ret) + return ret; + + if (CONFIG_IS_ENABLED(CLK_CCF)) + ret = device_reparent(clk->dev, parent->dev); + + return ret; } int clk_enable(struct clk *clk)