From patchwork Fri Feb 3 06:09:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13127032 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 75E63C636D7 for ; Fri, 3 Feb 2023 06:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ASpxcKG6WqUf7LQHb0BuVdbVSIw/c+pJlPrglC4ldoI=; b=EMnkLm0f8KZnRQ EDRz+IZO0zh4RkHm5qs+Ea5c2yjKxNA+S+VUPfvq2E67oPDP/VYnTQy1bGAnTK/KM/kVaijBSFifC 3UQ01DJJxjcrK7SXojVHQSz68JvSfKhY/ibkxB5KAFJiomEAfkPEfc6Gyv/zsMzx+Fkk2dfPPYkvs UZsyaqs7+z/DCZmaJdEg6Yg/4ipLlTOmONlC+LGp6rmfyHu43YgfQ4tXVyYsFW6cWVLom4oHHW6UR ShOsftdrtVJecK/TvcB4SVUZGNxlrl27FeweyB0E5jAeU0PgdVpByTBefB74hr/0X9Skv3qX7ndGU 73dmtkC1TowlJUroCWkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNpGl-000VXB-Kl; Fri, 03 Feb 2023 06:09:56 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNpG0-000VEh-5r for linux-arm-kernel@lists.infradead.org; Fri, 03 Feb 2023 06:09:09 +0000 Received: by mail-oi1-x230.google.com with SMTP id c15so3208902oic.8 for ; Thu, 02 Feb 2023 22:09:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZFGVK/R7IvXJOW0JsMc8GEWmuVlJkiZ67MQd9wzMPas=; b=f0lvHe+RIZvGMkZgAgwmx4KWkCK8Zp2/njSt24OxDyyvDxYCbuU0NB9H1p+yJaaWaC R39D0bvTg9tZI5OMnUlRROenCJ3zbi5yCRr8gu3E6BJqHVFR14wHLR3TB3sK0rKjLH3M jaMGlcn4dA0BcMl5zGDe0S4Cqimu2CUGQDE2ri3Ddy9cA4Ajj1+wFi5o6kjJ8v1PCuQ6 6rhN3Vgs3RPulsjgWxlP4jEnghopSIoqgqPzYMA27MNLILBSkoMTBzXQb7vrSdDtyCIt doPnT9HRvNAIibc1HFN392CohVYLs6cbUtaPcQS7CLPLSyZbON6vm0211k5nzFcNEmQ8 OtiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZFGVK/R7IvXJOW0JsMc8GEWmuVlJkiZ67MQd9wzMPas=; b=3n0dZZW97eeRL7SYzf01vkKoydXLvrq2urtsQtuBUaKHyfRG5p69T3LV5MhRqwLtoy kzN+W8lrt+6Jt3Yh9eN1rJ6/Hjlqyretp1anJns8amQATIPA+rvwQuixNnTTfHzaOFhW Ivm5LGG7kTDTUGwmpyzH3/ZvKxDjk0+OVy835F444W/2ibBe4zaOEfqq7xvD73aHDFLT Tf28b6W2+HoESeFsyj7QcxXK52jYNLx/83SEKoYEWtDyZzCxQttBhwET5tZbD4IrMBeM +KcXBhhUi+fh03XhShdOrWziVgGxxymhwrrSNZOqbU5qEnNHGJ5SexchWbq3YbcwlQfS l4kw== X-Gm-Message-State: AO0yUKUGqVVdsXuV4YognJslbKgblJmCzWdvvBwtBVYE7XmcDJnqWTsJ awRLia1bTeYxXlTb5IHvwW9ujw== X-Google-Smtp-Source: AK7set+hV484I96OKvacApzyMi+v5hfOAHMNKGNJFQ9Su+QkLejUQN0sLqyh94gC3wT3nxzXwkVYVg== X-Received: by 2002:a05:6808:2021:b0:378:976a:9cb5 with SMTP id q33-20020a056808202100b00378976a9cb5mr6123598oiw.0.1675404546859; Thu, 02 Feb 2023 22:09:06 -0800 (PST) Received: from localhost ([136.49.140.41]) by smtp.gmail.com with ESMTPSA id l18-20020a056830055200b00684152e9ff2sm781235otb.0.2023.02.02.22.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 22:09:06 -0800 (PST) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi Cc: Tomasz Figa , Alim Akhtar , Chanho Park , David Virag , Sumit Semwal , Michael Turquette , Stephen Boyd , linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] clk: samsung: Extract parent clock enabling to common function Date: Fri, 3 Feb 2023 00:09:23 -0600 Message-Id: <20230203060924.8257-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203060924.8257-1-semen.protsenko@linaro.org> References: <20230203060924.8257-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230202_220908_238580_E244B0BF X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Extract parent clock enabling from exynos_arm64_register_cmu() to dedicated function. No functional change. No functional change. Signed-off-by: Sam Protsenko --- drivers/clk/samsung/clk-exynos-arm64.c | 53 +++++++++++++++++--------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos-arm64.c b/drivers/clk/samsung/clk-exynos-arm64.c index b921b9a1134a..361663223a24 100644 --- a/drivers/clk/samsung/clk-exynos-arm64.c +++ b/drivers/clk/samsung/clk-exynos-arm64.c @@ -56,6 +56,41 @@ static void __init exynos_arm64_init_clocks(struct device_node *np, iounmap(reg_base); } +/** + * exynos_arm64_enable_bus_clk - Enable parent clock of specified CMU + * + * @dev: Device object; may be NULL if this function is not being + * called from platform driver probe function + * @np: CMU device tree node + * @cmu: CMU data + * + * Keep CMU parent clock running (needed for CMU registers access). + * + * Return: 0 on success or negative error code on failure. + */ +static int __init exynos_arm64_enable_bus_clk(struct device *dev, + struct device_node *np, const struct samsung_cmu_info *cmu) +{ + struct clk *parent_clk; + + if (!cmu->clk_name) + return 0; + + if (dev) + parent_clk = clk_get(dev, cmu->clk_name); + else + parent_clk = of_clk_get_by_name(np, cmu->clk_name); + + if (IS_ERR(parent_clk)) { + pr_err("%s: could not find bus clock %s; err = %ld\n", + __func__, cmu->clk_name, PTR_ERR(parent_clk)); + return PTR_ERR(parent_clk); + } + + clk_prepare_enable(parent_clk); + return 0; +} + /** * exynos_arm64_register_cmu - Register specified Exynos CMU domain * @dev: Device object; may be NULL if this function is not being @@ -72,23 +107,7 @@ static void __init exynos_arm64_init_clocks(struct device_node *np, void __init exynos_arm64_register_cmu(struct device *dev, struct device_node *np, const struct samsung_cmu_info *cmu) { - /* Keep CMU parent clock running (needed for CMU registers access) */ - if (cmu->clk_name) { - struct clk *parent_clk; - - if (dev) - parent_clk = clk_get(dev, cmu->clk_name); - else - parent_clk = of_clk_get_by_name(np, cmu->clk_name); - - if (IS_ERR(parent_clk)) { - pr_err("%s: could not find bus clock %s; err = %ld\n", - __func__, cmu->clk_name, PTR_ERR(parent_clk)); - } else { - clk_prepare_enable(parent_clk); - } - } - + exynos_arm64_enable_bus_clk(dev, np, cmu); exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs); samsung_cmu_register_one(np, cmu); }