* [PATCH v2 0/2] media: vsp1: Add FCP soft reset procedure
@ 2025-06-16 12:14 Jacopo Mondi
2025-06-16 12:14 ` [PATCH v2 1/2] media: rcar-fcp: Add rcar_fcp_soft_reset() Jacopo Mondi
2025-06-16 12:14 ` [PATCH v2 2/2] media: vsp1: Reset FCP after VSPD Jacopo Mondi
0 siblings, 2 replies; 5+ messages in thread
From: Jacopo Mondi @ 2025-06-16 12:14 UTC (permalink / raw)
To: Laurent Pinchart, Mauro Carvalho Chehab, Kieran Bingham,
Niklas Söderlund
Cc: linux-media, linux-renesas-soc, linux-kernel, Jacopo Mondi,
Laurent Pinchart, Koji Matsuoka, LUU HOAI
Introduce the FCP soft reset procedure as documented in section 62.3.7.3
Reset Operation" of R-Car Gen4 Hardware Manual rev 1.21, and use it to
reset FCPD by upporting patch b4bc2410cd81 ("rcar-fcp: Add FCPVD reset
sequence for VSPD") from Renesas R-Car BSP 3.5.3.
Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
---
Changes in v2:
- Drop VSPX reset
- Reset FCP in vsp1_reset_wpf()
- Apply reset for Gen4 as well
- Link to v1: https://lore.kernel.org/r/20250609-vspx-reset-v1-0-9f17277ff1e2@ideasonboard.com
---
Jacopo Mondi (1):
media: rcar-fcp: Add rcar_fcp_soft_reset()
Koji Matsuoka (1):
media: vsp1: Reset FCP after VSPD
drivers/media/platform/renesas/rcar-fcp.c | 41 ++++++++++++++++++++++++++
drivers/media/platform/renesas/vsp1/vsp1_drv.c | 9 +++++-
include/media/rcar-fcp.h | 5 ++++
3 files changed, 54 insertions(+), 1 deletion(-)
---
base-commit: 4d2c3d70799f5eb210003613766bbd113bbebc1a
change-id: 20250609-vspx-reset-aff11587390c
Best regards,
--
Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 1/2] media: rcar-fcp: Add rcar_fcp_soft_reset() 2025-06-16 12:14 [PATCH v2 0/2] media: vsp1: Add FCP soft reset procedure Jacopo Mondi @ 2025-06-16 12:14 ` Jacopo Mondi 2025-06-18 1:19 ` Laurent Pinchart 2025-06-16 12:14 ` [PATCH v2 2/2] media: vsp1: Reset FCP after VSPD Jacopo Mondi 1 sibling, 1 reply; 5+ messages in thread From: Jacopo Mondi @ 2025-06-16 12:14 UTC (permalink / raw) To: Laurent Pinchart, Mauro Carvalho Chehab, Kieran Bingham, Niklas Söderlund Cc: linux-media, linux-renesas-soc, linux-kernel, Jacopo Mondi, Laurent Pinchart 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 <jacopo.mondi+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- 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/platform/renesas/rcar-fcp.c index cee9bbce4e3affb2467dbc28142e1ab2304bf5b0..584add9f7a803e5ef041589c7c0be7eb8371fe9f 100644 --- a/drivers/media/platform/renesas/rcar-fcp.c +++ b/drivers/media/platform/renesas/rcar-fcp.c @@ -9,6 +9,8 @@ #include <linux/device.h> #include <linux/dma-mapping.h> +#include <linux/io.h> +#include <linux/iopoll.h> #include <linux/list.h> #include <linux/module.h> #include <linux/mod_devicetable.h> @@ -19,14 +21,30 @@ #include <media/rcar-fcp.h> +#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; }; static LIST_HEAD(fcp_devices); static DEFINE_MUTEX(fcp_lock); +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, u32 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); +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 = 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) fcp->dev = &pdev->dev; + fcp->base = 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); pm_runtime_enable(&pdev->dev); diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h index 179240fb163bd2e7cc347e559f99bae943bf0e34..6ac9be9f675e667d6482a5a2483963fa52a0c622 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_node *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 #endif /* __MEDIA_RCAR_FCP_H__ */ -- 2.49.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] media: rcar-fcp: Add rcar_fcp_soft_reset() 2025-06-16 12:14 ` [PATCH v2 1/2] media: rcar-fcp: Add rcar_fcp_soft_reset() Jacopo Mondi @ 2025-06-18 1:19 ` Laurent Pinchart 0 siblings, 0 replies; 5+ messages in thread From: Laurent Pinchart @ 2025-06-18 1:19 UTC (permalink / raw) To: Jacopo Mondi Cc: Mauro Carvalho Chehab, Kieran Bingham, Niklas Söderlund, linux-media, linux-renesas-soc, linux-kernel On Mon, Jun 16, 2025 at 02:14:24PM +0200, Jacopo Mondi wrote: > 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 <jacopo.mondi+renesas@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > --- > 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/platform/renesas/rcar-fcp.c > index cee9bbce4e3affb2467dbc28142e1ab2304bf5b0..584add9f7a803e5ef041589c7c0be7eb8371fe9f 100644 > --- a/drivers/media/platform/renesas/rcar-fcp.c > +++ b/drivers/media/platform/renesas/rcar-fcp.c > @@ -9,6 +9,8 @@ > > #include <linux/device.h> > #include <linux/dma-mapping.h> > +#include <linux/io.h> > +#include <linux/iopoll.h> > #include <linux/list.h> > #include <linux/module.h> > #include <linux/mod_devicetable.h> > @@ -19,14 +21,30 @@ > > #include <media/rcar-fcp.h> > > +#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; > }; > > static LIST_HEAD(fcp_devices); > static DEFINE_MUTEX(fcp_lock); > > +static inline u32 rcar_fcp_read(struct rcar_fcp_device *fcp, u32 reg) > +{ > + return ioread32(fcp->base + reg); > +} This function isn't used, which generates a compilation warning, see https://gitlab.freedesktop.org/linux-media/users/pinchartl/-/jobs/78583977. I will drop it. > + > +static inline void rcar_fcp_write(struct rcar_fcp_device *fcp, u32 reg, u32 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); > > +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 = 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) > > fcp->dev = &pdev->dev; > > + fcp->base = 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); > > pm_runtime_enable(&pdev->dev); > diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h > index 179240fb163bd2e7cc347e559f99bae943bf0e34..6ac9be9f675e667d6482a5a2483963fa52a0c622 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_node *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 > > #endif /* __MEDIA_RCAR_FCP_H__ */ > -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] media: vsp1: Reset FCP after VSPD 2025-06-16 12:14 [PATCH v2 0/2] media: vsp1: Add FCP soft reset procedure Jacopo Mondi 2025-06-16 12:14 ` [PATCH v2 1/2] media: rcar-fcp: Add rcar_fcp_soft_reset() Jacopo Mondi @ 2025-06-16 12:14 ` Jacopo Mondi 2025-06-16 12:58 ` Laurent Pinchart 1 sibling, 1 reply; 5+ messages in thread From: Jacopo Mondi @ 2025-06-16 12:14 UTC (permalink / raw) To: Laurent Pinchart, Mauro Carvalho Chehab, Kieran Bingham, Niklas Söderlund Cc: linux-media, linux-renesas-soc, linux-kernel, Jacopo Mondi, Koji Matsuoka, LUU HOAI From: Koji Matsuoka <koji.matsuoka.xm@renesas.com> 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 <koji.matsuoka.xm@renesas.com> Signed-off-by: LUU HOAI <hoai.luu.ub@renesas.com> Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com> --- 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..49ac3104291a63ca0a47947baaff78ac7ecce3ea 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 *vsp1) int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index) { + u32 version = vsp1->version & VI6_IP_VERSION_MODEL_MASK; unsigned int timeout; + int ret = 0; u32 status; status = vsp1_read(vsp1, VI6_STATUS); @@ -523,7 +526,11 @@ int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index) return -ETIMEDOUT; } - return 0; + if (version == VI6_IP_VERSION_MODEL_VSPD_GEN3 || + version == VI6_IP_VERSION_MODEL_VSPD_GEN4) + ret = rcar_fcp_soft_reset(vsp1->fcp); + + return ret; } static int vsp1_device_init(struct vsp1_device *vsp1) -- 2.49.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] media: vsp1: Reset FCP after VSPD 2025-06-16 12:14 ` [PATCH v2 2/2] media: vsp1: Reset FCP after VSPD Jacopo Mondi @ 2025-06-16 12:58 ` Laurent Pinchart 0 siblings, 0 replies; 5+ messages in thread From: Laurent Pinchart @ 2025-06-16 12:58 UTC (permalink / raw) To: Jacopo Mondi Cc: Mauro Carvalho Chehab, Kieran Bingham, Niklas Söderlund, linux-media, linux-renesas-soc, linux-kernel, Koji Matsuoka, LUU HOAI Hi Jacopo, Thank you for the patch. On Mon, Jun 16, 2025 at 02:14:25PM +0200, Jacopo Mondi wrote: > From: Koji Matsuoka <koji.matsuoka.xm@renesas.com> > > 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 <koji.matsuoka.xm@renesas.com> > Signed-off-by: LUU HOAI <hoai.luu.ub@renesas.com> > Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > --- > 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..49ac3104291a63ca0a47947baaff78ac7ecce3ea 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 *vsp1) > > int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index) > { > + u32 version = vsp1->version & VI6_IP_VERSION_MODEL_MASK; > unsigned int timeout; > + int ret = 0; > u32 status; > > status = vsp1_read(vsp1, VI6_STATUS); > @@ -523,7 +526,11 @@ int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index) > return -ETIMEDOUT; > } > > - return 0; > + if (version == VI6_IP_VERSION_MODEL_VSPD_GEN3 || > + version == VI6_IP_VERSION_MODEL_VSPD_GEN4) > + ret = rcar_fcp_soft_reset(vsp1->fcp); > + > + return ret; > } > > static int vsp1_device_init(struct vsp1_device *vsp1) -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-18 1:19 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-06-16 12:14 [PATCH v2 0/2] media: vsp1: Add FCP soft reset procedure Jacopo Mondi 2025-06-16 12:14 ` [PATCH v2 1/2] media: rcar-fcp: Add rcar_fcp_soft_reset() Jacopo Mondi 2025-06-18 1:19 ` Laurent Pinchart 2025-06-16 12:14 ` [PATCH v2 2/2] media: vsp1: Reset FCP after VSPD Jacopo Mondi 2025-06-16 12:58 ` Laurent Pinchart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®