From patchwork Tue Feb 13 13:27:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shradha Todi X-Patchwork-Id: 200439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp568774dyb; Tue, 13 Feb 2024 06:20:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVsdLNmz/nZETD8idwZr9OMxmQmFgBWwS9jrEWo9OQH0hI/+QkHPFeUp/ZN/AuArouG5DkAlau0eqSJ/7H+RMlP/SDXrg== X-Google-Smtp-Source: AGHT+IEhNXYw3brZY5bLjdpqTYP6LE9ThUQPAz6y2wsjU7FlUTsXBxivNE72n9LNqajZeqg9j92W X-Received: by 2002:a05:6a21:1645:b0:19e:a353:81b0 with SMTP id no5-20020a056a21164500b0019ea35381b0mr8620861pzb.11.1707834049288; Tue, 13 Feb 2024 06:20:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707834049; cv=pass; d=google.com; s=arc-20160816; b=ox6FjT9Vn7+raSGB7jpx6f/XVlHAa67/7tq5z6Y/53AgLb/DevpcGP/QSFARddxxXF Uj27mOKEWDIr/khYOSeHaACIG5Sau//KUt5eF9RhDxmM3YsB+ysQxEjxLUSz1U0apkoq Sw09m7jIFcsrV8i6c5Hu01N3yva5S/CNxRLsXEzfI7RaTaTiLcx4k/FP+4Fdgudb6XiC YDJ9QLgUlFmLJpFnLBakvAFRyEMh9lz0GC6E+t9xK5cpUmcdi4G1m0szsQ0a38MAjAS4 /Sq1jKoAEatBx+ut9VgmnUJR1sxTT7H2wh/PUBBS4TmEBwk6H7x/46V3jitgZ8Yh6FAk hUrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :dlp-filter:cms-type:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=3zGQ1oxr7yCITgN88Ri0vXnCSaCy2H7gBnROLiuaNKE=; fh=6K4YuDdpmS1uwK2yw4oIHhrgJ2X5jfrqu3SuEwja1HU=; b=MxCbmjNI6pqEkiupCg1bBX1s3g2KOG7XBFu80OKG5aWDXLHu7oX+HTacpawuzo9jex 2JLjD+gfoUdz8nbcZTIuUO+iTETUkPdCwn0Y/g0i8Zf40gMRSkXcMLnogLCbXrdvMPbU PVdbN8nxSkzGaYwUwMW+ucJiRNO0PlP7h+w2IR2jU2qP5G16z2141+x6Nq7ON2DwsFc4 rmgvJC9Y9YzMf+9whjaWKgARFZW6t9L2480a8Nj8n1Uum/Bs5ORYZ14zToL2vwGRSbQ1 Vv55+ruPSd4a/YdPFmiAOHH7v9PeOgfxr3/PHS5RjWrrVu5MzzYhivGKFcQVqG4B6Hj8 vEjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QYy0ycTT; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-63656-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63656-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com X-Forwarded-Encrypted: i=2; AJvYcCWY9oHkRG83Kqrrs4kp4kJ2gXRuWpsqCBfwspqeAIsmqCCcuodtd4eA/tMYeVfUOTIN2htGBflc9cDuooFjnKuMFEeFvQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h62-20020a638341000000b005dc892e61d3si677570pge.657.2024.02.13.06.20.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 06:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63656-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QYy0ycTT; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-63656-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63656-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C1C5328B22C for ; Tue, 13 Feb 2024 14:20:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C165B58129; Tue, 13 Feb 2024 14:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="QYy0ycTT" Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 093EF57866 for ; Tue, 13 Feb 2024 14:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707833983; cv=none; b=KlDU+PzgIr66aGf/y2Ql95HG4m+Tl25yeEC7/sYC86jRDOF//PsdVrmvGjlZDBs6Xy+2NPrUHX3s8sOJC2tWdReNgq2dMMgC1thC7RPnsHyCj0xSAciTqR60NqSnfZsNIKfEBwL55racwvzejWYFfKbIfTVoujIjJvffUkYma4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707833983; c=relaxed/simple; bh=zbzPPSabaMhS5zlq5Te5dWZ0Y9LqScaRObnVnALmG+M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:Content-Type: References; b=qWfRClg0xLLuCb0pO+paDYYa/IxwcMrTce+rEmnlLnuwi/YnDI8yF67bkbQuqJX9rQgq7cRVZ/OjBKH7ss2e1xiiNbibG9D+B+9530oQDkIASpVEj+zZLGrDQNGhrRLe0si7Z3AkBN5STWBx8vfjx8+9llnrPNvbfqIF9FLwA8g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=QYy0ycTT; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20240213141939epoutp04dd88ec8886d9d99c8c1f00cfc3702be6~zcfSasKjJ0385503855epoutp04w for ; Tue, 13 Feb 2024 14:19:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20240213141939epoutp04dd88ec8886d9d99c8c1f00cfc3702be6~zcfSasKjJ0385503855epoutp04w DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1707833979; bh=3zGQ1oxr7yCITgN88Ri0vXnCSaCy2H7gBnROLiuaNKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYy0ycTTnJSC2wb0ZT+uLYpkTOpkHeuHXhWDqvDBYh2HHDux2vDizlhwsDWPGBfvU ed8RydOX23quFDtfxC7du6pdm9n8viEsJF9RMCND5ou6KK2ZrKYgOjYQr8wPm3ruQs TeNcN5u1VC+4PQQRoy3rTbgPUmsr8/tcDzsx77Zw= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20240213141938epcas5p4e0c9e26267f337bed876ee3a4c904970~zcfRyELnd0084600846epcas5p4f; Tue, 13 Feb 2024 14:19:38 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.181]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4TZ3P40Nh7z4x9Pv; Tue, 13 Feb 2024 14:19:36 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id A8.A4.19369.77A7BC56; Tue, 13 Feb 2024 23:19:35 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20240213132806epcas5p43e394aea91c61797a8cc3a901e0cf574~zbyR5q_xn2842628426epcas5p4f; Tue, 13 Feb 2024 13:28:06 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240213132806epsmtrp28cf7afb7c47021231d8ee5626e4ca975~zbyR4h1T_2153621536epsmtrp2T; Tue, 13 Feb 2024 13:28:06 +0000 (GMT) X-AuditID: b6c32a50-c99ff70000004ba9-94-65cb7a777f6b Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 77.C1.08755.56E6BC56; Tue, 13 Feb 2024 22:28:05 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240213132803epsmtip1037fa163159be1ef1651bb5ca5bdbe8c~zbyPK56ms1216112161epsmtip1S; Tue, 13 Feb 2024 13:28:03 +0000 (GMT) From: Shradha Todi To: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: mturquette@baylibre.com, sboyd@kernel.org, jingoohan1@gmail.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com, linux@armlinux.org.uk, m.szyprowski@samsung.com, manivannan.sadhasivam@linaro.org, pankaj.dubey@samsung.com, gost.dev@samsung.com, Shradha Todi Subject: [PATCH v5 1/2] clk: Provide managed helper to get and enable bulk clocks Date: Tue, 13 Feb 2024 18:57:50 +0530 Message-Id: <20240213132751.46813-2-shradha.t@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240213132751.46813-1-shradha.t@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOJsWRmVeSWpSXmKPExsWy7bCmhm551elUg+8rrC0ezNvGZrGkKcPi 5oGdTBYrvsxkt9j7eiu7RUPPb1aLTY+vsVp87LnHanF51xw2i7PzjrNZzDi/j8ni0NS9jBYt f1pYLNYeuctucbelk9Xi4ilXi0Vbv7Bb/N+zg93i37WNLBa9h2sdRDwuX7vI7PH+Riu7x85Z d9k9Fmwq9di0qpPN4861PWweT65MZ/LYvKTeo2/LKkaPz5vkAriism0yUhNTUosUUvOS81My 89JtlbyD453jTc0MDHUNLS3MlRTyEnNTbZVcfAJ03TJzgH5TUihLzCkFCgUkFhcr6dvZFOWX lqQqZOQXl9gqpRak5BSYFOgVJ+YWl+al6+WlllgZGhgYmQIVJmRnLJ+/gbFgv1TFwiXLGRsY n4p2MXJySAiYSLTPf8/WxcjFISSwh1Hif9McRgjnE6PElNf/mSGcb4wSE8/OY4ZpOdHYwQhi CwnsZZRoXWoCUdTKJLHz82dWkASbgJZE49cusG4RgcWM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/LYvKTeo2/LKkaPz5vkAriiuGxSUnMyy1KL9O0SuDKW z9/AWLBfqmLhkuWMDYxPRbsYOTkkBEwkTjR2MHYxcnEICexmlLg/8S4jREJS4vPFdUwQtrDE yn/P2SGKmpkk3mx5ww6SYBPQkmj82sUMkhARWM4o8fPkU7AOZoEeZokDrSFdjBwcwgKBEgc7 DEHCLAKqEh9WHgMr4RWwktjwZxczxAJ5idUbDoDZnALWEge2P2QFsYWAava0r2WawMi3gJFh FaNkakFxbnpusWGBYV5quV5xYm5xaV66XnJ+7iZGcIRoae5g3L7qg94hRiYOxkOMEhzMSiK8 l2acSBXiTUmsrEotyo8vKs1JLT7EKM3BoiTOK/6iN0VIID2xJDU7NbUgtQgmy8TBKdXAtH3S 12hPj8VeX40fviou0Etb+neGwRfj+19eWBavi2s3TOjnPjXjwPQj155d4f3qH3E5J4Tp0OY0 G9UTbrx3z/DsVHB8/0Stt8/Qr7x5ZnxwaJxFm4vD3F/Pn59ZlPbmTWyzquWq5+Zrrf5fM4nh b9bq2Opv2CZacF1Rl1NYSXlH7GL2olO7mDy+fNy+tmXi4Qd/HJoyFP70zt+ZumRLi1eH5fbv HV3zu2XeXro2M89pztqXTa1rWdj8VzCfkV096ah8xEQel809tnzbjm57//BHwUSnDwIxrcmH /U/Mkq9dOkf9zOuYa4yvnM3W71+wSOHDE+60aUfPCpc1isw7uUxrWtjFiIthOx5sLhFc36rE UpyRaKjFXFScCAArY9pa/wIAAA== X-CMS-MailID: 20240213132806epcas5p43e394aea91c61797a8cc3a901e0cf574 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240213132806epcas5p43e394aea91c61797a8cc3a901e0cf574 References: <20240213132751.46813-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790793795944125366 X-GMAIL-MSGID: 1790793795944125366 Provide a managed devm_clk_bulk* wrapper to get and enable all bulk clocks in order to simplify drivers that keeps all clocks enabled for the time of driver operation. Suggested-by: Marek Szyprowski Reviewed-by: Alim Akhtar Signed-off-by: Shradha Todi Reviewed-by: Manivannan Sadhasivam --- drivers/clk/clk-devres.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/clk.h | 23 +++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c index 4fb4fd4b06bd..cbbd2cc339c3 100644 --- a/drivers/clk/clk-devres.c +++ b/drivers/clk/clk-devres.c @@ -182,6 +182,46 @@ int __must_check devm_clk_bulk_get_all(struct device *dev, } EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all); +static void devm_clk_bulk_release_all_enable(struct device *dev, void *res) +{ + struct clk_bulk_devres *devres = res; + + clk_bulk_disable_unprepare(devres->num_clks, devres->clks); + clk_bulk_put_all(devres->num_clks, devres->clks); +} + +int __must_check devm_clk_bulk_get_all_enable(struct device *dev, + struct clk_bulk_data **clks) +{ + struct clk_bulk_devres *devres; + int ret; + + devres = devres_alloc(devm_clk_bulk_release_all_enable, + sizeof(*devres), GFP_KERNEL); + if (!devres) + return -ENOMEM; + + ret = clk_bulk_get_all(dev, &devres->clks); + if (ret > 0) { + *clks = devres->clks; + devres->num_clks = ret; + } else { + devres_free(devres); + return ret; + } + + ret = clk_bulk_prepare_enable(devres->num_clks, *clks); + if (!ret) { + devres_add(dev, devres); + } else { + clk_bulk_put_all(devres->num_clks, devres->clks); + devres_free(devres); + } + + return ret; +} +EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all_enable); + static int devm_clk_match(struct device *dev, void *res, void *data) { struct clk **c = res; diff --git a/include/linux/clk.h b/include/linux/clk.h index 1ef013324237..85a9330d5a5a 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -438,6 +438,22 @@ int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks, int __must_check devm_clk_bulk_get_all(struct device *dev, struct clk_bulk_data **clks); +/** + * devm_clk_bulk_get_all_enable - Get and enable all clocks of the consumer (managed) + * @dev: device for clock "consumer" + * @clks: pointer to the clk_bulk_data table of consumer + * + * Returns success (0) or negative errno. + * + * This helper function allows drivers to get all clocks of the + * consumer and enables them in one operation with management. + * The clks will automatically be disabled and freed when the device + * is unbound. + */ + +int __must_check devm_clk_bulk_get_all_enable(struct device *dev, + struct clk_bulk_data **clks); + /** * devm_clk_get - lookup and obtain a managed reference to a clock producer. * @dev: device for clock "consumer" @@ -960,6 +976,13 @@ static inline int __must_check devm_clk_bulk_get_all(struct device *dev, return 0; } +static inline int __must_check devm_clk_bulk_get_all_enable(struct device *dev, + struct clk_bulk_data **clks) +{ + + return 0; +} + static inline struct clk *devm_get_clk_from_child(struct device *dev, struct device_node *np, const char *con_id) { From patchwork Tue Feb 13 13:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shradha Todi X-Patchwork-Id: 200438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp568702dyb; Tue, 13 Feb 2024 06:20:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXhIf2Kr1v5CKonuQ8VJdNDvRTORa1QDCZN2iLZd8SdWYw11UUr4cTR9r36vk0/lviX8oR/AY3cokw9Rm4355ybnxCfTw== X-Google-Smtp-Source: AGHT+IHS3IlYGfaTN9kdbijQKz4hwpbB1WaJ8LLroM5zeb/RNrHhkJ69TqTPVo+RtP4M7lh18E2e X-Received: by 2002:a05:620a:a97:b0:785:9459:742e with SMTP id v23-20020a05620a0a9700b007859459742emr7932975qkg.62.1707834043256; Tue, 13 Feb 2024 06:20:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707834043; cv=pass; d=google.com; s=arc-20160816; b=BK+o+XcY9OzV2zVtbcxgGv5umaXqbGLWSTM/6BOTwBYmkqQPtWQ/3nbvvUgx/QhTns tmoq2lQSCT9Vis0fxUtUGuPUj2onMMNEQDLrxi56Fq0hxp9+BB4zSqE3hsF9XbiGDAVP dC/ToUL5LgtddFygXBV7hU6093s+jCb0Vu9aXXAbxHGhwMpkCtHLCeaMHG3lk/XkWPzR QG6C3BGtGllH4MdfNquHAChbBB8iycrTx5ElLp0OumpgOglT/K7UBiDSqR5v2vd4iaki WJloSr3pyvKMVorNP0X87QNDgbo5ZfJiej3hVZUId6NUoRe8XwxppFOaYThs7KTd1A1w E0Dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :dlp-filter:cms-type:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=6WcEEEJAqHt6H76Re3bajB+WXdTeFoCOJ/3X3ukJOi4=; fh=nBbQb35oFHfWWFDvzCz+jmOpDt2lxD0p+MJq+l9mMno=; b=twxqqytq6V7cfaGcA3GOd5ezByACmH4GZjC4lpoQ7u/h66QUbu0r49FsYn4SBWmz5G nwsG9sryBljhplz5u6o89Gzh2piFXaMTSnB82MLWaVmKVbKGkRDxFVCGsmmL6IS0mSmb 1Bib6C8Xb6vmmMfbIU0TEqe6GSY4Gpy6YuSnHOx/ne2t0+sJoAeyGYTVl/hBrAs5qmGO 1d4bvQCg3mXMoFvXNeqv5+uakJJvoR2InwFmRCNmwKa7B+F7s1/f1VUlJcnwCC//otyW PhgHXR4kLLrAPpkm1HFrESqtoS/12f9844BIL2KY+uKgx3hPHWXa2qCcvFgcmM+34H0v AIlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lUjzLLll; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-63658-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63658-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com X-Forwarded-Encrypted: i=2; AJvYcCU+AqaJ1lgzU0MWZFWoFfEHJYW16l1gXI1t7P/BPp0DN4aCy8gun2aKhnR3PTUIayTBGA70x1i5/alPk/k+8i4vOUbu5g== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id qr8-20020a05620a390800b00783ff745819si9173076qkn.531.2024.02.13.06.20.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 06:20:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63658-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lUjzLLll; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-63658-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63658-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 66FA51C2667B for ; Tue, 13 Feb 2024 14:20:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E5B65789B; Tue, 13 Feb 2024 14:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="lUjzLLll" Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D487B56767 for ; Tue, 13 Feb 2024 14:19:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707834001; cv=none; b=BBCf/lW8gpDPyr6RxEuwk0TKNd3ivVJtIDl3xUIOml9UJcEaeL57HpBONtcSBGmlPC1Gm0NiQTywLB+dtueMeABcirMG5mgLHZKH4WdRRUOqtCIWYe+8LFljAqp13uXBjWHbKLkBSoGw+q7+e4rDM3VoK81rICceuqsMwjsSgQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707834001; c=relaxed/simple; bh=uQSuDcenC7QtjyHuVyxBlW7jEkPTOEKNuzZhMEq78rI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:Content-Type: References; b=js6/3zDUoMpp/CQplFu0RdU69HVVaUmZJO9zXnmrcrCS8w9mzC4/ZspdCETerAjewPjK5WBukLXZbPPuc8C6aiJkmgLIRWPkrzVI6aLzK8/lyxBueCn51sB1E8z5KOKhliddyVT52ptAkxkmJourBMlsIv3e5ery8CRPSRYpEWc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=lUjzLLll; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20240213141951epoutp03d3d4c73358bf96e2c7e035db995b8bf8~zcfd0QBqw2439224392epoutp03D for ; Tue, 13 Feb 2024 14:19:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20240213141951epoutp03d3d4c73358bf96e2c7e035db995b8bf8~zcfd0QBqw2439224392epoutp03D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1707833991; bh=6WcEEEJAqHt6H76Re3bajB+WXdTeFoCOJ/3X3ukJOi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lUjzLLllEbt5hLzMDqZuhBOhCHDvFZXph+4racqD0KdWgvuHD0RsC2LTBcQndyEFR rw+KBNXnVeylA3IOarUVp2Sslvgj5yjWlOiEvdKyi3quKiUO+wyy3rm4HH7wWSuGIa 4m23HstdWC5kgQhdPZifPTALW0iI2d58IXOJH7K0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20240213141950epcas5p24bb732a6a445248187071a09f9f76557~zcfdHHhaX1407914079epcas5p21; Tue, 13 Feb 2024 14:19:50 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.182]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4TZ3PJ3zwBz4x9Py; Tue, 13 Feb 2024 14:19:48 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F1.A0.08567.48A7BC56; Tue, 13 Feb 2024 23:19:48 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20240213132810epcas5p22316ffa73fd9b86923f3f741c3a9101e~zbyV4N2g70267302673epcas5p2u; Tue, 13 Feb 2024 13:28:10 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240213132810epsmtrp15cf320889fa76294275e2af1a8dc4d1d~zbyV2GciM1855118551epsmtrp1i; Tue, 13 Feb 2024 13:28:10 +0000 (GMT) X-AuditID: b6c32a44-617fd70000002177-cb-65cb7a848369 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id DE.94.08817.A6E6BC56; Tue, 13 Feb 2024 22:28:10 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240213132807epsmtip18b778dcc9bea4d489adc8ca6108282d4~zbyTGh4kq1216112161epsmtip1T; Tue, 13 Feb 2024 13:28:07 +0000 (GMT) From: Shradha Todi To: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: mturquette@baylibre.com, sboyd@kernel.org, jingoohan1@gmail.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com, linux@armlinux.org.uk, m.szyprowski@samsung.com, manivannan.sadhasivam@linaro.org, pankaj.dubey@samsung.com, gost.dev@samsung.com, Shradha Todi Subject: [PATCH v5 2/2] PCI: exynos: Adapt to clk_bulk_* APIs Date: Tue, 13 Feb 2024 18:57:51 +0530 Message-Id: <20240213132751.46813-3-shradha.t@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240213132751.46813-1-shradha.t@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WTf0xbVRTHc99rX1si+uhg3tXYdWUyh4G1UuotgpiMmbdoGBlqzIzBF3gC oX2tfa0OFiPIDwcBNsgGdRswkUWKwqBshUFBwhBYzfid8iOCkiGRNZmRITOAYGmL/ve55/s9 99x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9ZqPbWn4L/P5u9/3ViqneZU Sbrf8Jlet+DcIs8L7RtDt1xc/ze6uF06/c6sExNPNzQ9XHflp/cVobrpUWbfbLq9Lh5SYinO SDTUYi4qTgQAhx5/0gADAAA= X-CMS-MailID: 20240213132810epcas5p22316ffa73fd9b86923f3f741c3a9101e X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240213132810epcas5p22316ffa73fd9b86923f3f741c3a9101e References: <20240213132751.46813-1-shradha.t@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790793789833954840 X-GMAIL-MSGID: 1790793789833954840 There is no need to hardcode the clock info in the driver as driver can rely on the devicetree to supply the clocks required for the functioning of the peripheral. Get rid of the static clock info and obtain the platform supplied clocks. All the clocks supplied is obtained and enabled using the devm_clk_bulk_get_all_enable() API. Reviewed-by: Manivannan Sadhasivam Reviewed-by: Alim Akhtar Signed-off-by: Shradha Todi --- drivers/pci/controller/dwc/pci-exynos.c | 54 ++----------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c index ec5611005566..3234eb5be1fb 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -54,43 +54,11 @@ struct exynos_pcie { struct dw_pcie pci; void __iomem *elbi_base; - struct clk *clk; - struct clk *bus_clk; + struct clk_bulk_data *clks; struct phy *phy; struct regulator_bulk_data supplies[2]; }; -static int exynos_pcie_init_clk_resources(struct exynos_pcie *ep) -{ - struct device *dev = ep->pci.dev; - int ret; - - ret = clk_prepare_enable(ep->clk); - if (ret) { - dev_err(dev, "cannot enable pcie rc clock"); - return ret; - } - - ret = clk_prepare_enable(ep->bus_clk); - if (ret) { - dev_err(dev, "cannot enable pcie bus clock"); - goto err_bus_clk; - } - - return 0; - -err_bus_clk: - clk_disable_unprepare(ep->clk); - - return ret; -} - -static void exynos_pcie_deinit_clk_resources(struct exynos_pcie *ep) -{ - clk_disable_unprepare(ep->bus_clk); - clk_disable_unprepare(ep->clk); -} - static void exynos_pcie_writel(void __iomem *base, u32 val, u32 reg) { writel(val, base + reg); @@ -332,17 +300,9 @@ static int exynos_pcie_probe(struct platform_device *pdev) if (IS_ERR(ep->elbi_base)) return PTR_ERR(ep->elbi_base); - ep->clk = devm_clk_get(dev, "pcie"); - if (IS_ERR(ep->clk)) { - dev_err(dev, "Failed to get pcie rc clock\n"); - return PTR_ERR(ep->clk); - } - - ep->bus_clk = devm_clk_get(dev, "pcie_bus"); - if (IS_ERR(ep->bus_clk)) { - dev_err(dev, "Failed to get pcie bus clock\n"); - return PTR_ERR(ep->bus_clk); - } + ret = devm_clk_bulk_get_all_enable(dev, &ep->clks); + if (ret < 0) + return ret; ep->supplies[0].supply = "vdd18"; ep->supplies[1].supply = "vdd10"; @@ -351,10 +311,6 @@ static int exynos_pcie_probe(struct platform_device *pdev) if (ret) return ret; - ret = exynos_pcie_init_clk_resources(ep); - if (ret) - return ret; - ret = regulator_bulk_enable(ARRAY_SIZE(ep->supplies), ep->supplies); if (ret) return ret; @@ -369,7 +325,6 @@ static int exynos_pcie_probe(struct platform_device *pdev) fail_probe: phy_exit(ep->phy); - exynos_pcie_deinit_clk_resources(ep); regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies); return ret; @@ -383,7 +338,6 @@ static int __exit exynos_pcie_remove(struct platform_device *pdev) exynos_pcie_assert_core_reset(ep); phy_power_off(ep->phy); phy_exit(ep->phy); - exynos_pcie_deinit_clk_resources(ep); regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies); return 0;