From patchwork Fri Feb 3 06:09:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13127031 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 3F592C61DA4 for ; Fri, 3 Feb 2023 06:10:44 +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=pkFQBzmUM8BJ8pamCdS1N82RbMW4/WTgrimfZ/WeqUw=; b=Oo4vjlUqoagTJ0 0hDd0VcFowieclVlLL5Xrnj2a6wm40s/VXUi0VHuTgonxuEi27UEtthsy8IRufSYofE9vhJkWIXpA 2aSpyf4h9f0ZBR3qLjUIE4+p9X+NY27CzqTb8h3xlXIXBiucwShvydO8+NmqUKJqBQslsvf7s5uYp xXlfOXtP97Od2qTlczpgu5ifTChFH+5P+cFigHz+MJrwhyQO8tZs0Ru7nTyMnZwEOG0D5A6BWS062 ldvj39GfiLP3YosoJsxa1rhx7BSFed+2jgIiagiSllR6tfmVdE8vqIfM/Ed+1zryW5P0wFdzsBWB3 55CdLT0URBZvtSHmi67A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNpGY-000VRt-72; Fri, 03 Feb 2023 06:09:42 +0000 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNpFy-000VDd-39 for linux-arm-kernel@lists.infradead.org; Fri, 03 Feb 2023 06:09:08 +0000 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-169ba826189so5534747fac.2 for ; Thu, 02 Feb 2023 22:09:05 -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=0yDr1A3i4lDIJ+wlIu+l4d4VuNidJwmq/Y1jBeWohDk=; b=K2zByDQKA8e0euNkkSni0gOKbDACnfLRXRi54ui/9SqIbiQ2rFkNElrHR0lY34wKb2 wwn2+EVJXWb4jwCc7S2vXPo4/XydrGvPMYDzKf645rG/18dv81JvvOGT+k/f7HGi0ItW ibdS8Gbopb+eKrbGJNAQE3ClVwDxjzMMBN18HBfvVEtWV+EuJY1lgOTMaNFcFrZsGLwp +miJnlW1xouk3hSK6HoVo94ptseWtxaot4sXMkEoHBwYI+9YkvR1CPb1Yf+26ZGnjPha 901ifJh8+tabdAnXafQ5XsxF/6HjgTLCvG1XbDeg2blQMaSBceEDCOCgrt2+FWBk01q7 1xSQ== 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=0yDr1A3i4lDIJ+wlIu+l4d4VuNidJwmq/Y1jBeWohDk=; b=hbYeTTSD9ig1k/uoiTa6ZpmE0WoZa5ATrdcX9jfa2IpOkb/pU7dTWWz19y4NOAeMcu 4GWx6iRwQZgm8yBDGKkFFPCKvEQfzgcPWpvu9wathfda2bC2sjgmf7e3HgUfxg67OJeD NgmWDNpl5UKoayRjV+NtQ4Lv1x3X7twuAzdCz2gh566JbxR6mQ+9h98v60ATIDTweVm9 zsyhI7sr25pU9gG8CgWyHy6OWqL+5iRcjT0ItyK31AZB0cIevtVluhSpHXJPeLmSzlNK 9YujP/07kUr9MNJS/44w/heyqXnelQ6ouRx5dYvwosrf5IRL1ysnygFaBlOx/1/sTolD xLRg== X-Gm-Message-State: AO0yUKWrLgS3gXFQcF0juaTKDUCnpdEssYUDE0INaDNNNb41bGv5DlVn GArIT05VztjBYgmzoOww4uyiXg== X-Google-Smtp-Source: AK7set9YBh2frMwtpfDlDcpzwrz1BTgBwLN6EiL7cpETUY+zyn/f/f+l47+u+zB5kN7qLYJOme64ng== X-Received: by 2002:a05:6870:4414:b0:169:c27f:abf5 with SMTP id u20-20020a056870441400b00169c27fabf5mr4082876oah.15.1675404544827; Thu, 02 Feb 2023 22:09:04 -0800 (PST) Received: from localhost ([136.49.140.41]) by smtp.gmail.com with ESMTPSA id dt10-20020a0568705a8a00b00163b3472300sm616309oab.2.2023.02.02.22.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 22:09:04 -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 3/6] clk: samsung: Set dev in samsung_clk_init() Date: Fri, 3 Feb 2023 00:09:21 -0600 Message-Id: <20230203060924.8257-4-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_220906_157245_AA294377 X-CRM114-Status: GOOD ( 16.88 ) 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 Some drivers set dev to context in order to implement PM. Make that part of samsung_clk_init() instead of assigning `ctx->dev = dev' separately. No functional change. Signed-off-by: Sam Protsenko --- drivers/clk/samsung/clk-exynos4.c | 2 +- drivers/clk/samsung/clk-exynos4412-isp.c | 3 +-- drivers/clk/samsung/clk-exynos5250.c | 2 +- drivers/clk/samsung/clk-exynos5420.c | 2 +- drivers/clk/samsung/clk-s3c2410.c | 2 +- drivers/clk/samsung/clk-s3c2412.c | 2 +- drivers/clk/samsung/clk-s3c2443.c | 2 +- drivers/clk/samsung/clk-s3c64xx.c | 2 +- drivers/clk/samsung/clk-s5pv210.c | 2 +- drivers/clk/samsung/clk.c | 19 +++++++++++++++---- drivers/clk/samsung/clk.h | 5 +++-- 11 files changed, 27 insertions(+), 16 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c index 7a9994144d72..d7dbb3858347 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c @@ -1251,7 +1251,7 @@ static void __init exynos4_clk_init(struct device_node *np, if (!reg_base) panic("%s: failed to map registers\n", __func__); - ctx = samsung_clk_init(reg_base, CLK_NR_CLKS); + ctx = samsung_clk_init(NULL, reg_base, CLK_NR_CLKS); hws = ctx->clk_data.hws; samsung_clk_of_register_fixed_ext(ctx, exynos4_fixed_rate_ext_clks, diff --git a/drivers/clk/samsung/clk-exynos4412-isp.c b/drivers/clk/samsung/clk-exynos4412-isp.c index 0b6390e04533..1470c15e95da 100644 --- a/drivers/clk/samsung/clk-exynos4412-isp.c +++ b/drivers/clk/samsung/clk-exynos4412-isp.c @@ -121,8 +121,7 @@ static int __init exynos4x12_isp_clk_probe(struct platform_device *pdev) if (!exynos4x12_save_isp) return -ENOMEM; - ctx = samsung_clk_init(reg_base, CLK_NR_ISP_CLKS); - ctx->dev = dev; + ctx = samsung_clk_init(dev, reg_base, CLK_NR_ISP_CLKS); platform_set_drvdata(pdev, ctx); diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index f1cb69aea10e..92fb09922f28 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -797,7 +797,7 @@ static void __init exynos5250_clk_init(struct device_node *np) panic("%s: unable to determine soc\n", __func__); } - ctx = samsung_clk_init(reg_base, CLK_NR_CLKS); + ctx = samsung_clk_init(NULL, reg_base, CLK_NR_CLKS); hws = ctx->clk_data.hws; samsung_clk_of_register_fixed_ext(ctx, exynos5250_fixed_rate_ext_clks, diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 46cac4980be2..1e0cbf762408 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -1587,7 +1587,7 @@ static void __init exynos5x_clk_init(struct device_node *np, exynos5x_soc = soc; - ctx = samsung_clk_init(reg_base, CLK_NR_CLKS); + ctx = samsung_clk_init(NULL, reg_base, CLK_NR_CLKS); hws = ctx->clk_data.hws; samsung_clk_of_register_fixed_ext(ctx, exynos5x_fixed_rate_ext_clks, diff --git a/drivers/clk/samsung/clk-s3c2410.c b/drivers/clk/samsung/clk-s3c2410.c index 8483d4a2be03..a30db5b5b0d3 100644 --- a/drivers/clk/samsung/clk-s3c2410.c +++ b/drivers/clk/samsung/clk-s3c2410.c @@ -332,7 +332,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f, panic("%s: failed to map registers\n", __func__); } - ctx = samsung_clk_init(reg_base, NR_CLKS); + ctx = samsung_clk_init(NULL, reg_base, NR_CLKS); hws = ctx->clk_data.hws; /* Register external clocks only in non-dt cases */ diff --git a/drivers/clk/samsung/clk-s3c2412.c b/drivers/clk/samsung/clk-s3c2412.c index 8f12a40790d4..c4a9abbdd1e8 100644 --- a/drivers/clk/samsung/clk-s3c2412.c +++ b/drivers/clk/samsung/clk-s3c2412.c @@ -216,7 +216,7 @@ void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f, panic("%s: failed to map registers\n", __func__); } - ctx = samsung_clk_init(reg_base, NR_CLKS); + ctx = samsung_clk_init(NULL, reg_base, NR_CLKS); /* Register external clocks only in non-dt cases */ if (!np) diff --git a/drivers/clk/samsung/clk-s3c2443.c b/drivers/clk/samsung/clk-s3c2443.c index 6db8147f0aa2..be0a378d0a92 100644 --- a/drivers/clk/samsung/clk-s3c2443.c +++ b/drivers/clk/samsung/clk-s3c2443.c @@ -353,7 +353,7 @@ void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f, panic("%s: failed to map registers\n", __func__); } - ctx = samsung_clk_init(reg_base, NR_CLKS); + ctx = samsung_clk_init(NULL, reg_base, NR_CLKS); /* Register external clocks only in non-dt cases */ if (!np) diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3c64xx.c index 47e9d19486dc..d27a1f73f077 100644 --- a/drivers/clk/samsung/clk-s3c64xx.c +++ b/drivers/clk/samsung/clk-s3c64xx.c @@ -405,7 +405,7 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f, panic("%s: failed to map registers\n", __func__); } - ctx = samsung_clk_init(reg_base, NR_CLKS); + ctx = samsung_clk_init(NULL, reg_base, NR_CLKS); hws = ctx->clk_data.hws; /* Register external clocks. */ diff --git a/drivers/clk/samsung/clk-s5pv210.c b/drivers/clk/samsung/clk-s5pv210.c index b0ab6bc9d21d..cd85342e4ddb 100644 --- a/drivers/clk/samsung/clk-s5pv210.c +++ b/drivers/clk/samsung/clk-s5pv210.c @@ -743,7 +743,7 @@ static void __init __s5pv210_clk_init(struct device_node *np, struct samsung_clk_provider *ctx; struct clk_hw **hws; - ctx = samsung_clk_init(reg_base, NR_CLKS); + ctx = samsung_clk_init(NULL, reg_base, NR_CLKS); hws = ctx->clk_data.hws; samsung_clk_register_mux(ctx, early_mux_clks, diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index 2436223aac1a..912dfbe5ac20 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -53,9 +53,19 @@ struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump( return rd; } -/* setup the essentials required to support clock lookup using ccf */ -struct samsung_clk_provider * __init samsung_clk_init(void __iomem *base, - unsigned long nr_clks) +/** + * samsung_clk_init() - Create and initialize a clock provider object + * @dev: CMU device to enable runtime PM, or NULL if RPM is not needed + * @base: Start address (mapped) of CMU registers + * @nr_clks: Total clock count to allocate in clock provider object + * + * Setup the essentials required to support clock lookup using Common Clock + * Framework. + * + * Return: Allocated and initialized clock provider object. + */ +struct samsung_clk_provider * __init samsung_clk_init(struct device *dev, + void __iomem *base, unsigned long nr_clks) { struct samsung_clk_provider *ctx; int i; @@ -67,6 +77,7 @@ struct samsung_clk_provider * __init samsung_clk_init(void __iomem *base, for (i = 0; i < nr_clks; ++i) ctx->clk_data.hws[i] = ERR_PTR(-ENOENT); + ctx->dev = dev; ctx->reg_base = base; ctx->clk_data.num = nr_clks; spin_lock_init(&ctx->lock); @@ -341,7 +352,7 @@ struct samsung_clk_provider * __init samsung_cmu_register_one( return NULL; } - ctx = samsung_clk_init(reg_base, cmu->nr_clk_ids); + ctx = samsung_clk_init(NULL, reg_base, cmu->nr_clk_ids); if (cmu->pll_clks) samsung_clk_register_pll(ctx, cmu->pll_clks, cmu->nr_pll_clks); diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index 98753b0e5055..3fd6c0868921 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -16,6 +16,7 @@ /** * struct samsung_clk_provider: information about clock provider * @reg_base: virtual address for the register base. + * @dev: clock provider device needed for runtime PM. * @lock: maintains exclusion between callbacks for a given clock-provider. * @clk_data: holds clock related data like clk_hw* and number of clocks. */ @@ -337,8 +338,8 @@ struct samsung_cmu_info { const char *clk_name; }; -struct samsung_clk_provider *samsung_clk_init(void __iomem *base, - unsigned long nr_clks); +struct samsung_clk_provider *samsung_clk_init(struct device *dev, + void __iomem *base, unsigned long nr_clks); void samsung_clk_of_add_provider(struct device_node *np, struct samsung_clk_provider *ctx); void samsung_clk_of_register_fixed_ext(