From nobody Thu Oct 9 20:24:37 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 62A8A285C88; Mon, 16 Jun 2025 12:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750076091; cv=none; b=n0FGgo6DXQuvdAPvH5Gb3TCKt2SmR3r6W06F9wOXT/nM+b3iC1jf6IwKtip2T6plcN1wkjf/TGbY7rmEwb8sfgIB5yky9zLWF3FSTKPpF2xuHQm3JOaEPfW6n0VPbH/y3GZdizfHEg8hIpe3LHUG/kTNv63VAY3j3lrSfV0Nc3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750076091; c=relaxed/simple; bh=aGQJ3lWOoYHOcdlt3LXWUsJAQj2gtH3Kjj9P2RbeY+M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CUeih1uSUtU5vVxugTOwoU4uckC1xTryUGf6oHTT9qExCBTAnxZraH77658hDFtI2PROX+EO7t0AyhYrl6vSYngmH4/uAE7Fs9fZbWMAQpCbzBYDONlCaq9+oCQ5xYrn/X1sOYxVWKhcBJJ9XHnS6SuUDsv+jrh/5dcVZL0LdLc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Av5OAFcS; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Av5OAFcS" Received: from [192.168.0.172] (mob-5-90-141-184.net.vodafone.it [5.90.141.184]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DB9DD752; Mon, 16 Jun 2025 14:14:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1750076076; bh=aGQJ3lWOoYHOcdlt3LXWUsJAQj2gtH3Kjj9P2RbeY+M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Av5OAFcSurUWYByUMgq8XAKVZa9544SqKrI5Go00WZApXvwi8dmEsak+LuZVfFtD4 HWMjiynfndrQ80XpTMiT13agiing6JCjzeX98nUfQzyTcLuFpgfre4HoYLT+D3W8yJ jHGahXsyW/2jH8BpiXSu2bxnPrXT6lZHdYq3/qRQ= From: Jacopo Mondi Date: Mon, 16 Jun 2025 14:14:24 +0200 Subject: [PATCH v2 1/2] media: rcar-fcp: Add rcar_fcp_soft_reset() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250616-vspx-reset-v2-1-6cc12ed7e9bb@ideasonboard.com> References: <20250616-vspx-reset-v2-0-6cc12ed7e9bb@ideasonboard.com> In-Reply-To: <20250616-vspx-reset-v2-0-6cc12ed7e9bb@ideasonboard.com> To: Laurent Pinchart , Mauro Carvalho Chehab , Kieran Bingham , =?utf-8?q?Niklas_S=C3=B6derlund?= Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi , Laurent Pinchart X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3740; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=aGQJ3lWOoYHOcdlt3LXWUsJAQj2gtH3Kjj9P2RbeY+M=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoUAqrHdW4LB33VMvdZgaCRYEFBA2iJjE3uNTGM w1w6vqYbk+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaFAKqwAKCRByNAaPFqFW PLygD/48VXMdimLaISdYLzyih0r0KyTIUbjYpsPWQ9yXlZeK3X0j+5oosRTCXe7cmuelBLSwd9W XqhMG5EDnovoIIuy7jNI51uV7Spatj9Wg+tYxskJ0xZF2YNowEqvUyu7n+q8/wQLFKkjsVY+Zca jfU7grF0tETG8A2LzKFjCRqWN03isjoTnyL+/cVScQXD2L0q/WIXGriQljL5K2rtnBp+Zld0w2d TqY9pEMJUlGFKUICKFQCqgqHxpRto41Bm6SraT1mtAo680j3WLOXDZLcED1zEflGFkHktPKPtsK 9C0o/JTTWfn+oNuVSlCrAsfu79PdAOsjlLSena2xaqDauHdk9HpxUq4rrOnwJe2RtZJlTR2trnF etFEqPgdg2ZoAEup0P691crf2ABmcKH0W0tC7BynddXfpztMY5BYYxRyMTNv7Bt3qw3kgjbxEw2 PIVv/zqc/aZH+Do842fu+SsKGST4GgHv8LX/6oyBpuXbA3yfRYJ5B9kMNfrDfY6m/N9rUN/VQ8W +WEQQVrbxLdlRvV8s1A1Vlvgw7zHFaE4tY/tX20uS+LvmCdq2NeDhc+lS+EVLjY1mpI0eTDoWr1 TTrWYUjRJzNGQGByUZ7mPpZrq1XHo+GMQLjAASjdlyzOZJ383USK/dlGIkMJ0Z3M5HduX8S5AqS M6J8OPB0B1ndpgQ== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B Add a function to perform soft reset of the FCP. It is intended to support the correct stop procedure of the VSPX-FCPVX and VSPD-FCPD pairs according to section "62.3.7.3 Reset Operation" of the R-Car Hardware Manual at revision 1.20. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rcar-fcp.c | 41 +++++++++++++++++++++++++++= ++++ include/media/rcar-fcp.h | 5 ++++ 2 files changed, 46 insertions(+) diff --git a/drivers/media/platform/renesas/rcar-fcp.c b/drivers/media/plat= form/renesas/rcar-fcp.c index cee9bbce4e3affb2467dbc28142e1ab2304bf5b0..584add9f7a803e5ef041589c7c0= be7eb8371fe9f 100644 --- a/drivers/media/platform/renesas/rcar-fcp.c +++ b/drivers/media/platform/renesas/rcar-fcp.c @@ -9,6 +9,8 @@ =20 #include #include +#include +#include #include #include #include @@ -19,14 +21,30 @@ =20 #include =20 +#define RCAR_FCP_REG_RST 0x0010 +#define RCAR_FCP_REG_RST_SOFTRST BIT(0) +#define RCAR_FCP_REG_STA 0x0018 +#define RCAR_FCP_REG_STA_ACT BIT(0) + struct rcar_fcp_device { struct list_head list; struct device *dev; + void __iomem *base; }; =20 static LIST_HEAD(fcp_devices); static DEFINE_MUTEX(fcp_lock); =20 +static inline u32 rcar_fcp_read(struct rcar_fcp_device *fcp, u32 reg) +{ + return ioread32(fcp->base + reg); +} + +static inline void rcar_fcp_write(struct rcar_fcp_device *fcp, u32 reg, u3= 2 val) +{ + iowrite32(val, fcp->base + reg); +} + /* -----------------------------------------------------------------------= ------ * Public API */ @@ -117,6 +135,25 @@ void rcar_fcp_disable(struct rcar_fcp_device *fcp) } EXPORT_SYMBOL_GPL(rcar_fcp_disable); =20 +int rcar_fcp_soft_reset(struct rcar_fcp_device *fcp) +{ + u32 value; + int ret; + + if (!fcp) + return 0; + + rcar_fcp_write(fcp, RCAR_FCP_REG_RST, RCAR_FCP_REG_RST_SOFTRST); + ret =3D readl_poll_timeout(fcp->base + RCAR_FCP_REG_STA, + value, !(value & RCAR_FCP_REG_STA_ACT), + 1, 100); + if (ret) + dev_err(fcp->dev, "Failed to soft-reset\n"); + + return ret; +} +EXPORT_SYMBOL_GPL(rcar_fcp_soft_reset); + /* -----------------------------------------------------------------------= ------ * Platform Driver */ @@ -131,6 +168,10 @@ static int rcar_fcp_probe(struct platform_device *pdev) =20 fcp->dev =3D &pdev->dev; =20 + fcp->base =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(fcp->base)) + return PTR_ERR(fcp->base); + dma_set_max_seg_size(fcp->dev, UINT_MAX); =20 pm_runtime_enable(&pdev->dev); diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h index 179240fb163bd2e7cc347e559f99bae943bf0e34..6ac9be9f675e667d6482a5a2483= 963fa52a0c622 100644 --- a/include/media/rcar-fcp.h +++ b/include/media/rcar-fcp.h @@ -18,6 +18,7 @@ void rcar_fcp_put(struct rcar_fcp_device *fcp); struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp); int rcar_fcp_enable(struct rcar_fcp_device *fcp); void rcar_fcp_disable(struct rcar_fcp_device *fcp); +int rcar_fcp_soft_reset(struct rcar_fcp_device *fcp); #else static inline struct rcar_fcp_device *rcar_fcp_get(const struct device_nod= e *np) { @@ -33,6 +34,10 @@ static inline int rcar_fcp_enable(struct rcar_fcp_device= *fcp) return 0; } static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { } +static inline int rcar_fcp_soft_reset(struct rcar_fcp_device *fcp) +{ + return 0; +} #endif =20 #endif /* __MEDIA_RCAR_FCP_H__ */ --=20 2.49.0 From nobody Thu Oct 9 20:24:37 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 16D9F292B3C; Mon, 16 Jun 2025 12:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750076096; cv=none; b=MnaP6DY5sBoxnWCVZZKujddzIw7/6Y0CkKENp2CN5k1sHjzJ1cdIBffRGrSmyzLyrBl8gif3LXK2QYEwtkum7Hdc3gPxKNdKdxUw+4iTrjLZp+pMcRom7+KAFdRvCaUTNKMNGjrFBp6Ur8gTCko52hhkmHEaMXCweuY+Z0fjHHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750076096; c=relaxed/simple; bh=gVw/OKVgytey09K87/+5x7WBm97ScRhjXSwCZK25GSM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FRUV92AOy+1K1NgcQX3bu7Yp9Bb2GrXjBUyyiTiJluYVOzW4uEqfNHmbPt9JpHA7FzdClAbDhM8OfaxqHJeYPOrTCMWVXXIh9kI/lCJMY7edmp1rKMztltSQ8Pt3iXP8rHl7sQIRan8MfSm5YTbcdUkwSDhbKRiOkh7+GyiyYtQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=JM2yFd0X; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JM2yFd0X" Received: from [192.168.0.172] (mob-5-90-141-184.net.vodafone.it [5.90.141.184]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 46AAF22A; Mon, 16 Jun 2025 14:14:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1750076082; bh=gVw/OKVgytey09K87/+5x7WBm97ScRhjXSwCZK25GSM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JM2yFd0XydEOkzQdnyHlGlqmgnxCunH92vphpWhprJPzrUd1Gzh6DY0NT4j1E27xv CXKI0F52wJJkBXFG2YxurdM+s5bZ+nUVlsSp1jnM87/HK/D+z4V/B8RMoYbwhbg5dH RKwl1REqxHAMm6ivj1MvJ+VxCrzYdCiJpY+IPJcc= From: Jacopo Mondi Date: Mon, 16 Jun 2025 14:14:25 +0200 Subject: [PATCH v2 2/2] media: vsp1: Reset FCP after VSPD Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250616-vspx-reset-v2-2-6cc12ed7e9bb@ideasonboard.com> References: <20250616-vspx-reset-v2-0-6cc12ed7e9bb@ideasonboard.com> In-Reply-To: <20250616-vspx-reset-v2-0-6cc12ed7e9bb@ideasonboard.com> To: Laurent Pinchart , Mauro Carvalho Chehab , Kieran Bingham , =?utf-8?q?Niklas_S=C3=B6derlund?= Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi , Koji Matsuoka , LUU HOAI X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1650; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=4EcQzf/0s5fg3bP9dmICaSxK9KXrMChHKISEHqB60NE=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoUAqs7OMq4+2K38LhtzWStbdk9GjeWV6Q92f1S 0P7e64ZqzOJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaFAKrAAKCRByNAaPFqFW PGcXEACxwGJ9jfDC95Nm4hphGqJbtYvvMhefvMwKRnlC/BTSjnlJ4ZE1KKS+Qnc7a++iTBUfjj9 UHF2U7W1mUcljgghFVn34qA4Vwz+U2gVVG8Juxe/9IhGnk4ufz20VUv4lLbaa7DKLidQDa/6VlY oVu2E4xV8bRiI7gz/xDvaVhZcsfCQ6dUYPYJg3ZdZq5DICs5Z3A/aQi9wrN6FKPvx3WJSPVr1Hm iymdzE11o0/pjHIy1mptzcfye+Pu04RcG4+XHBqZtjyZh6TVl/AO7wkocupiY9EHTntWmtHw0Ua dXMui0lPimSjEaZ722mL6pRw8ueJt75PbjPusvrQJgJ3w69Fpf22vbRsTM4esyl6TffhLdtntVy L4zEVjTLi4qG8hX4JNZfuHWe0SuSrbKOApKZxtKNg8qc8RGGkk1yPuDsrFP7B7bW6QKqSXKC7Rp ZKYjwu4+2KuTLSerS04wfV7mR1rcnBRjwwb14aTdb5806ribRQlGbCRWarlhdmEZCpqR/62aXAu 4xJIBEftTvD2t4fgU97pEkyxIGQZ5FjADwpWg7xSJ5bRWVMuCAljJiyq1RLYY1ZpYt1VGOiee0L pzd/BOGfH8cjMiWE9bu70e30sYx2ejfEdqZTl7TqERD1Zl8B9u7Fi3MTPjVX8a9ifpkf3NHgu0/ EP2IS/HUBW9GtwA== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Koji Matsuoka According to the R-Car Gen3 H/W manual v2.40, and R-Car Gen4 H/W manual v1.20, the FCP must be reset after resetting the VSPD, except for the VSPDL. Do so. Signed-off-by: Koji Matsuoka Signed-off-by: LUU HOAI Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/vsp1/vsp1_drv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c b/drivers/media= /platform/renesas/vsp1/vsp1_drv.c index 8270a9d207cb19c3a08911a408f5039d7d2924b6..49ac3104291a63ca0a47947baaf= f78ac7ecce3ea 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c @@ -33,6 +33,7 @@ #include "vsp1_lif.h" #include "vsp1_lut.h" #include "vsp1_pipe.h" +#include "vsp1_regs.h" #include "vsp1_rwpf.h" #include "vsp1_sru.h" #include "vsp1_uds.h" @@ -502,7 +503,9 @@ static int vsp1_create_entities(struct vsp1_device *vsp= 1) =20 int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index) { + u32 version =3D vsp1->version & VI6_IP_VERSION_MODEL_MASK; unsigned int timeout; + int ret =3D 0; u32 status; =20 status =3D vsp1_read(vsp1, VI6_STATUS); @@ -523,7 +526,11 @@ int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned = int index) return -ETIMEDOUT; } =20 - return 0; + if (version =3D=3D VI6_IP_VERSION_MODEL_VSPD_GEN3 || + version =3D=3D VI6_IP_VERSION_MODEL_VSPD_GEN4) + ret =3D rcar_fcp_soft_reset(vsp1->fcp); + + return ret; } =20 static int vsp1_device_init(struct vsp1_device *vsp1) --=20 2.49.0