Message ID | 20240315183921.375751-5-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | Fix USB pipe configuration for RZ/G2L | expand |
Hi Biju, On Fri, Mar 15, 2024 at 7:39 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > Drop has_new_pipe_configs variable from struct renesas_usbhs_driver_param > and use info for getting device pipe configuration data by renaming > usbhs_new_pipe[]->usbhs_rcar_pipe[] and changing the static qualifier to > global so that struct renesas_usbhs_platform_info can be filled by > respective devices. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > --- > v3: > * New patch Thanks for your patch! > drivers/usb/renesas_usbhs/common.c | 9 ++++----- > drivers/usb/renesas_usbhs/common.h | 2 ++ > drivers/usb/renesas_usbhs/rcar2.c | 3 ++- > drivers/usb/renesas_usbhs/rcar3.c | 6 ++++-- > drivers/usb/renesas_usbhs/rza.c | 3 ++- > drivers/usb/renesas_usbhs/rza2.c | 3 ++- > include/linux/usb/renesas_usbhs.h | 1 - > 7 files changed, 16 insertions(+), 11 deletions(-) Do you need this patch, now RZ/V2H can just set .has_new_pipe_configs to zero? Gr{oetje,eeting}s, Geert
Hi Geert, Thanks for the feedback. > -----Original Message----- > From: Geert Uytterhoeven <geert@linux-m68k.org> > Sent: Monday, March 18, 2024 9:22 AM > Subject: Re: [PATCH v3 4/7] usb: renesas_usbhs: Drop has_new_pipe_configs from struct > renesas_usbhs_driver_param > > Hi Biju, > > On Fri, Mar 15, 2024 at 7:39 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > Drop has_new_pipe_configs variable from struct > > renesas_usbhs_driver_param and use info for getting device pipe > > configuration data by renaming usbhs_new_pipe[]->usbhs_rcar_pipe[] and > > changing the static qualifier to global so that struct > > renesas_usbhs_platform_info can be filled by respective devices. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > --- > > v3: > > * New patch > > Thanks for your patch > > > drivers/usb/renesas_usbhs/common.c | 9 ++++----- > > drivers/usb/renesas_usbhs/common.h | 2 ++ > > drivers/usb/renesas_usbhs/rcar2.c | 3 ++- > > drivers/usb/renesas_usbhs/rcar3.c | 6 ++++-- > > drivers/usb/renesas_usbhs/rza.c | 3 ++- > > drivers/usb/renesas_usbhs/rza2.c | 3 ++- > > include/linux/usb/renesas_usbhs.h | 1 - > > 7 files changed, 16 insertions(+), 11 deletions(-) > > Do you need this patch, now RZ/V2H can just set .has_new_pipe_configs to zero? RZ/V2H has similar configs with RZ/G2L and Old SH SoC's. So, you mean just set . has_new_pipe_configs to zero for devices using usbhsc_default_pipe[]?? Cheers, Biju
Hi Biju, On Mon, Mar 18, 2024 at 10:33 AM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > -----Original Message----- > > From: Geert Uytterhoeven <geert@linux-m68k.org> > > Sent: Monday, March 18, 2024 9:22 AM > > Subject: Re: [PATCH v3 4/7] usb: renesas_usbhs: Drop has_new_pipe_configs from struct > > renesas_usbhs_driver_param > > > > Hi Biju, > > > > On Fri, Mar 15, 2024 at 7:39 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > > Drop has_new_pipe_configs variable from struct > > > renesas_usbhs_driver_param and use info for getting device pipe > > > configuration data by renaming usbhs_new_pipe[]->usbhs_rcar_pipe[] and > > > changing the static qualifier to global so that struct > > > renesas_usbhs_platform_info can be filled by respective devices. > > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > > --- > > > v3: > > > * New patch > > > > Thanks for your patch > > > > > drivers/usb/renesas_usbhs/common.c | 9 ++++----- > > > drivers/usb/renesas_usbhs/common.h | 2 ++ > > > drivers/usb/renesas_usbhs/rcar2.c | 3 ++- > > > drivers/usb/renesas_usbhs/rcar3.c | 6 ++++-- > > > drivers/usb/renesas_usbhs/rza.c | 3 ++- > > > drivers/usb/renesas_usbhs/rza2.c | 3 ++- > > > include/linux/usb/renesas_usbhs.h | 1 - > > > 7 files changed, 16 insertions(+), 11 deletions(-) > > > > Do you need this patch, now RZ/V2H can just set .has_new_pipe_configs to zero? > > RZ/V2H has similar configs with RZ/G2L and Old SH SoC's. Sorry, I meant RZ/G2L (the RZ variants are starting to run around inside my brain like cockroaches... ;-) > So, you mean just set . has_new_pipe_configs to zero > for devices using usbhsc_default_pipe[]?? Exactly. Wouldn't that be sufficient? Now I have a better understanding of what renesas_usbhs_driver_pipe_config does, the only thing that matters is how many entries you have, right? So .has_new_pipe_configs = false means 10 entries, true means 16 entries. Hence if .probe() knows the number of entries, it can pick a suitable table. As long as there are only two tables, the boolean .has_new_pipe_configs is fine. If we ever need more tables, the boolean can be replaced by a numerical value. Gr{oetje,eeting}s, Geert
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 177fa3144a47..013bc1583610 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -378,7 +378,7 @@ static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { }; /* commonly used on newer SH-Mobile and R-Car SoCs */ -static struct renesas_usbhs_driver_pipe_config usbhsc_new_pipe[] = { +struct renesas_usbhs_driver_pipe_config usbhsc_rcar_pipe[] = { RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true), @@ -639,10 +639,9 @@ static int usbhs_probe(struct platform_device *pdev) priv->pfunc = &info->platform_callback; /* set default param if platform doesn't have */ - if (usbhs_get_dparam(priv, has_new_pipe_configs)) { - priv->dparam.pipe_configs = usbhsc_new_pipe; - priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_new_pipe); - } else if (!priv->dparam.pipe_configs) { + priv->dparam.pipe_configs = info->driver_param.pipe_configs; + priv->dparam.pipe_size = info->driver_param.pipe_size; + if (!priv->dparam.pipe_configs) { priv->dparam.pipe_configs = usbhsc_default_pipe; priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe); } diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index 3fb5bc94dc0d..f6f527ca9b45 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h @@ -343,4 +343,6 @@ struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev); #define usbhs_priv_to_dev(priv) (&priv->pdev->dev) #define usbhs_priv_to_lock(priv) (&priv->lock) +extern struct renesas_usbhs_driver_pipe_config usbhsc_rcar_pipe[]; + #endif /* RENESAS_USB_DRIVER_H */ diff --git a/drivers/usb/renesas_usbhs/rcar2.c b/drivers/usb/renesas_usbhs/rcar2.c index 52756fc2ac9c..170584f8de74 100644 --- a/drivers/usb/renesas_usbhs/rcar2.c +++ b/drivers/usb/renesas_usbhs/rcar2.c @@ -69,7 +69,8 @@ const struct renesas_usbhs_platform_info usbhs_rcar_gen2_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, .has_usb_dmac = 1, - .has_new_pipe_configs = 1, }, }; diff --git a/drivers/usb/renesas_usbhs/rcar3.c b/drivers/usb/renesas_usbhs/rcar3.c index c181b2a0b9d3..da5c013cfd07 100644 --- a/drivers/usb/renesas_usbhs/rcar3.c +++ b/drivers/usb/renesas_usbhs/rcar3.c @@ -101,9 +101,10 @@ const struct renesas_usbhs_platform_info usbhs_rcar_gen3_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, .has_usb_dmac = 1, .multi_clks = 1, - .has_new_pipe_configs = 1, }, }; @@ -113,8 +114,9 @@ const struct renesas_usbhs_platform_info usbhs_rcar_gen3_with_pll_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, .has_usb_dmac = 1, .multi_clks = 1, - .has_new_pipe_configs = 1, }, }; diff --git a/drivers/usb/renesas_usbhs/rza.c b/drivers/usb/renesas_usbhs/rza.c index 97b5217c5a90..91c1971c3949 100644 --- a/drivers/usb/renesas_usbhs/rza.c +++ b/drivers/usb/renesas_usbhs/rza.c @@ -51,6 +51,7 @@ const struct renesas_usbhs_platform_info usbhs_rza1_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { - .has_new_pipe_configs = 1, + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, }, }; diff --git a/drivers/usb/renesas_usbhs/rza2.c b/drivers/usb/renesas_usbhs/rza2.c index f079817250bb..f6660628eea9 100644 --- a/drivers/usb/renesas_usbhs/rza2.c +++ b/drivers/usb/renesas_usbhs/rza2.c @@ -66,8 +66,9 @@ const struct renesas_usbhs_platform_info usbhs_rza2_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, .has_cnen = 1, .cfifo_byte_addr = 1, - .has_new_pipe_configs = 1, }, }; diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index 372898d9eeb0..41f58cfbd876 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h @@ -169,7 +169,6 @@ struct renesas_usbhs_driver_param { u32 cfifo_byte_addr:1; /* CFIFO is byte addressable */ #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */ u32 multi_clks:1; - u32 has_new_pipe_configs:1; }; /*
Drop has_new_pipe_configs variable from struct renesas_usbhs_driver_param and use info for getting device pipe configuration data by renaming usbhs_new_pipe[]->usbhs_rcar_pipe[] and changing the static qualifier to global so that struct renesas_usbhs_platform_info can be filled by respective devices. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- v3: * New patch --- drivers/usb/renesas_usbhs/common.c | 9 ++++----- drivers/usb/renesas_usbhs/common.h | 2 ++ drivers/usb/renesas_usbhs/rcar2.c | 3 ++- drivers/usb/renesas_usbhs/rcar3.c | 6 ++++-- drivers/usb/renesas_usbhs/rza.c | 3 ++- drivers/usb/renesas_usbhs/rza2.c | 3 ++- include/linux/usb/renesas_usbhs.h | 1 - 7 files changed, 16 insertions(+), 11 deletions(-)