From patchwork Sun Mar 22 22:44:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 1259783 X-Patchwork-Delegate: sbabic@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=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=benettiengineering.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=aruba.it header.i=@aruba.it header.a=rsa-sha256 header.s=a1 header.b=dnY6sgog; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 48lt0B23zxz9sPJ for ; Mon, 23 Mar 2020 09:46:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9382181843; Sun, 22 Mar 2020 23:45:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=benettiengineering.com 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=aruba.it header.i=@aruba.it header.b="dnY6sgog"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E057E812A8; Sun, 22 Mar 2020 23:44:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from smtpcmd0871.aruba.it (smtpcmd0871.aruba.it [62.149.156.71]) by phobos.denx.de (Postfix) with ESMTP id 59276811FC for ; Sun, 22 Mar 2020 23:44:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=benettiengineering.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=giulio.benetti@benettiengineering.com Received: from ubuntu.localdomain ([146.241.70.103]) by smtpcmd08.ad.aruba.it with bizsmtp id Hakc220082DhmGq01akd9C; Sun, 22 Mar 2020 23:44:38 +0100 From: Giulio Benetti To: Stefano Babic Cc: Fabio Estevam , uboot-imx@nxp.com, Lukasz Majewski , Anatolij Gustschin , Simon Glass , Daniel Schwierzeck , u-boot@lists.denx.de, Giulio Benetti Subject: [PATCH v2 04/19] clk: imx: clk-imxrt1050: add set_parent() callback Date: Sun, 22 Mar 2020 23:44:20 +0100 Message-Id: <20200322224435.114512-5-giulio.benetti@benettiengineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200322224435.114512-1-giulio.benetti@benettiengineering.com> References: <20200322224435.114512-1-giulio.benetti@benettiengineering.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aruba.it; s=a1; t=1584917078; bh=9Z7IpHN2zHseBLMazs40973fhQThsXkT1VIL7Ow0iZw=; h=From:To:Subject:Date:MIME-Version; b=dnY6sgogD2n5DkeuumITSctUMOR8zMxnnlwnQl1XTUW7cvaAaQWiV3FZ1DavnADhy PbEQcIM9i0rUz1DFJWREolMNqEA3aBKm9/guh3cD0oEHUF31CRs8Xz1Lpgp6oI7/ck Ktu8tGSodlgRe2156YL3HYGfkonaM1jP/ZNPaoeXyCBSRRYp7x8wshSlsbH6AJyT8N 6xr3c9i4YvAvlsX2OLEHur51H8fla0LuXYnxY/Fu4QS4yLNmJ9gmq8RaaWVr/ejRDm KB/uoXhjri+/fLKPLRH+BemoZ1qhtxWmKVCvQpwwrrw6wmpyGJuypUAJxWV29wVL6X 4EJynJ2umOYZQ== 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 Need to add set_parent() callback to allow dts assigned-clock-parents to work so let's add it accordingly. Signed-off-by: Giulio Benetti --- V1->V2: * introduce patch to allow clock's parent setting in dts to work --- drivers/clk/imx/clk-imxrt1050.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c index bb12644605..329f4580c5 100644 --- a/drivers/clk/imx/clk-imxrt1050.c +++ b/drivers/clk/imx/clk-imxrt1050.c @@ -71,11 +71,30 @@ static int imxrt1050_clk_enable(struct clk *clk) return __imxrt1050_clk_enable(clk, 1); } +static int imxrt1050_clk_set_parent(struct clk *clk, struct clk *parent) +{ + struct clk *c, *cp; + int ret; + + debug("%s(#%lu), parent: %lu\n", __func__, clk->id, parent->id); + + ret = clk_get_by_id(clk->id, &c); + if (ret) + return ret; + + ret = clk_get_by_id(parent->id, &cp); + if (ret) + return ret; + + return clk_set_parent(c, cp); +} + static struct clk_ops imxrt1050_clk_ops = { .set_rate = imxrt1050_clk_set_rate, .get_rate = imxrt1050_clk_get_rate, .enable = imxrt1050_clk_enable, .disable = imxrt1050_clk_disable, + .set_parent = imxrt1050_clk_set_parent, }; static const char * const pll_ref_sels[] = {"osc", "dummy", };