From nobody Wed Dec 17 15:42:00 2025 Received: from lelvem-ot02.ext.ti.com (lelvem-ot02.ext.ti.com [198.47.23.235]) (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 A861D1E9B06; Tue, 13 May 2025 05:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.235 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747115273; cv=none; b=G7GPjLKm05o1B2XVNpZmGdjDv/MY2QJSBuj5OOZT/v3l0U80KF/y0kRDSHwR0TZBeC3GoBJCeQcKoV0FCSjMi8az6ZfD2QymSs//vLaNRAFETJ67uncOXvh+B5ZkrhAd4Licv8M/28J024GNg2W1brBnupO0+BhqQtV9E9Oq1SM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747115273; c=relaxed/simple; bh=LYePpIuaUT2Cnoz8Dt+iHLnOMUEuRuQUzZ9t0qMJNY4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AuXOPyHOZcTlZoM0wbpe2hhxz+oMSsmpGYokNVG1vjI1K1RoVjKBRM2+Yoc4TTtuE+GSU8Y9XRMZp4lA+2xiATjv8g3Vpb/pN1/acFU1zysueQENbqzdu0ei+Z073n/lcScqCqtrMg7XYIQUy0chwHK3TFZJxYkmdWQcUnuJjc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=M8ZU4X82; arc=none smtp.client-ip=198.47.23.235 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="M8ZU4X82" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelvem-ot02.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 54D5li0S2987287 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 May 2025 00:47:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1747115264; bh=GSQA7LysnwSzXVakSfe7wQULdMN5JQmPEO4p4jH9FDU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=M8ZU4X82U35ELjO0xHVHEG2S6KYHlt3/IzLOcIEcyBTYVuVbArCv3iPj0TiF1Ima3 Nw9Yf/rLW25fmo6tY7fUi+l12kKLNva4iwku2A4sg2XhawXMyQ3q/Ia3FPvnI6HE88 cJ12mV9dJMNwnYDcxgffU6zo/W9IIxlZRMNdUW5M= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 54D5lirM089136 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 13 May 2025 00:47:44 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 13 May 2025 00:47:44 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 13 May 2025 00:47:44 -0500 Received: from uda0510294.dhcp.ti.com (uda0510294.dhcp.ti.com [172.24.227.151]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 54D5jAqj131001; Tue, 13 May 2025 00:47:40 -0500 From: Beleswar Padhi To: , CC: , , , , , , , , , , Subject: [PATCH v12 36/36] remoteproc: k3: Refactor release_tsp() functions into common driver Date: Tue, 13 May 2025 11:15:10 +0530 Message-ID: <20250513054510.3439842-37-b-padhi@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250513054510.3439842-1-b-padhi@ti.com> References: <20250513054510.3439842-1-b-padhi@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea Content-Type: text/plain; charset="utf-8" The release_tsp() implementations in the TI K3 R5, DSP and M4 remoteproc drivers release the TI-SCI processor control of a remote processor, which is auto triggered upon device removal. Refactor these functions into ti_k3_common.c driver as k3_release_tsp() and use this common function throughout in R5, DSP and M4 drivers. Signed-off-by: Beleswar Padhi Tested-by: Judith Mendez Reviewed-by: Andrew Davis --- v12: Changelog: 1. Carried R/B tag. Link to v11: https://lore.kernel.org/all/20250425104135.830255-36-b-padhi@ti.com/ v11: Changelog: 1. Carried T/B tag. Link to v10: https://lore.kernel.org/all/20250417182001.3903905-34-b-padhi@ti.com/ v10: Changelog: 1. Update commit message to call out changes in a better way. Link to v9: https://lore.kernel.org/all/20250317120622.1746415-27-b-padhi@ti.com/ drivers/remoteproc/ti_k3_common.c | 8 ++++++++ drivers/remoteproc/ti_k3_common.h | 1 + drivers/remoteproc/ti_k3_dsp_remoteproc.c | 9 +-------- drivers/remoteproc/ti_k3_m4_remoteproc.c | 9 +-------- drivers/remoteproc/ti_k3_r5_remoteproc.c | 9 +-------- 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_c= ommon.c index 92da2af2733d9..d5dccc81d4604 100644 --- a/drivers/remoteproc/ti_k3_common.c +++ b/drivers/remoteproc/ti_k3_common.c @@ -539,5 +539,13 @@ int k3_reserved_mem_init(struct k3_rproc *kproc) } EXPORT_SYMBOL_GPL(k3_reserved_mem_init); =20 +void k3_release_tsp(void *data) +{ + struct ti_sci_proc *tsp =3D data; + + ti_sci_proc_release(tsp); +} +EXPORT_SYMBOL_GPL(k3_release_tsp); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("TI K3 common Remoteproc code"); diff --git a/drivers/remoteproc/ti_k3_common.h b/drivers/remoteproc/ti_k3_c= ommon.h index d304755990a94..aee3c28dbe510 100644 --- a/drivers/remoteproc/ti_k3_common.h +++ b/drivers/remoteproc/ti_k3_common.h @@ -114,4 +114,5 @@ int k3_rproc_of_get_memories(struct platform_device *pd= ev, struct k3_rproc *kproc); void k3_mem_release(void *data); int k3_reserved_mem_init(struct k3_rproc *kproc); +void k3_release_tsp(void *data); #endif /* REMOTEPROC_TI_K3_COMMON_H */ diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc= /ti_k3_dsp_remoteproc.c index 45000b68260c1..7a72933bd403b 100644 --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c @@ -66,13 +66,6 @@ static const struct rproc_ops k3_dsp_rproc_ops =3D { .get_loaded_rsc_table =3D k3_get_loaded_rsc_table, }; =20 -static void k3_dsp_release_tsp(void *data) -{ - struct ti_sci_proc *tsp =3D data; - - ti_sci_proc_release(tsp); -} - static int k3_dsp_rproc_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -136,7 +129,7 @@ static int k3_dsp_rproc_probe(struct platform_device *p= dev) dev_err_probe(dev, ret, "ti_sci_proc_request failed\n"); return ret; } - ret =3D devm_add_action_or_reset(dev, k3_dsp_release_tsp, kproc->tsp); + ret =3D devm_add_action_or_reset(dev, k3_release_tsp, kproc->tsp); if (ret) return ret; =20 diff --git a/drivers/remoteproc/ti_k3_m4_remoteproc.c b/drivers/remoteproc/= ti_k3_m4_remoteproc.c index 41bca6b64517a..3a11fd24eb52b 100644 --- a/drivers/remoteproc/ti_k3_m4_remoteproc.c +++ b/drivers/remoteproc/ti_k3_m4_remoteproc.c @@ -21,13 +21,6 @@ #include "ti_sci_proc.h" #include "ti_k3_common.h" =20 -static void k3_m4_release_tsp(void *data) -{ - struct ti_sci_proc *tsp =3D data; - - ti_sci_proc_release(tsp); -} - static const struct rproc_ops k3_m4_rproc_ops =3D { .prepare =3D k3_rproc_prepare, .unprepare =3D k3_rproc_unprepare, @@ -93,7 +86,7 @@ static int k3_m4_rproc_probe(struct platform_device *pdev) ret =3D ti_sci_proc_request(kproc->tsp); if (ret < 0) return dev_err_probe(dev, ret, "ti_sci_proc_request failed\n"); - ret =3D devm_add_action_or_reset(dev, k3_m4_release_tsp, kproc->tsp); + ret =3D devm_add_action_or_reset(dev, k3_release_tsp, kproc->tsp); if (ret) return ret; =20 diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/= ti_k3_r5_remoteproc.c index 3cd8391212f7b..e34c04c135fc9 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -1017,13 +1017,6 @@ static int k3_r5_core_of_get_sram_memories(struct pl= atform_device *pdev, return 0; } =20 -static void k3_r5_release_tsp(void *data) -{ - struct ti_sci_proc *tsp =3D data; - - ti_sci_proc_release(tsp); -} - static int k3_r5_cluster_rproc_init(struct platform_device *pdev) { struct k3_r5_cluster *cluster =3D platform_get_drvdata(pdev); @@ -1109,7 +1102,7 @@ static int k3_r5_cluster_rproc_init(struct platform_d= evice *pdev) goto out; } =20 - ret =3D devm_add_action_or_reset(cdev, k3_r5_release_tsp, kproc->tsp); + ret =3D devm_add_action_or_reset(cdev, k3_release_tsp, kproc->tsp); if (ret) goto out; } --=20 2.34.1