Message ID | 20240315183921.375751-6-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | New, archived |
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: > The RZ/G2L family SoCs has 10 PIPE buffers compared to 16 pipe buffers on > RZ/A2M. Update the pipe configuration for RZ/G2L family SoCs and use > family SoC specific compatible to handle this difference. > > Added SoC specific compatible to OF table to avoid ABI breakage with old > DTB. To optimize memory usage the SoC specific compatible will be removed > later. > > The pipe configuration of RZ/G2L is same as the default one, so reuse the > common table by renaming usbhs_default_pipe[]->usbhs_rcar_default_pipe[] > and changing static qualifier to global to fill the pipe configuration > data. > > Signed-off-by: Huy Nguyen <huy.nguyen.wh@renesas.com> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > --- > v2->v3: > * Updated commit description > * Dropped usbhsc_rzg2l_pipe[] and reusing the default_pipe[]. Thanks for the update! > --- a/drivers/usb/renesas_usbhs/common.c > +++ b/drivers/usb/renesas_usbhs/common.c > @@ -363,8 +363,8 @@ static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv) > * platform default param > */ > > -/* commonly used on old SH-Mobile SoCs */ > -static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { > +/* commonly used on old SH-Mobile and RZ/G2L family SoCs */ > +struct renesas_usbhs_driver_pipe_config usbhsc_rcar_default_pipe[] = { So why rename this to have "rcar" in the name? 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:25 AM > Subject: Re: [PATCH v3 5/7] usb: renesas_usbhs: Update usbhs pipe configuration for RZ/G2L family > > Hi Biju, > > On Fri, Mar 15, 2024 at 7:39 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > The RZ/G2L family SoCs has 10 PIPE buffers compared to 16 pipe buffers > > on RZ/A2M. Update the pipe configuration for RZ/G2L family SoCs and > > use family SoC specific compatible to handle this difference. > > > > Added SoC specific compatible to OF table to avoid ABI breakage with > > old DTB. To optimize memory usage the SoC specific compatible will be > > removed later. > > > > The pipe configuration of RZ/G2L is same as the default one, so reuse > > the common table by renaming > > usbhs_default_pipe[]->usbhs_rcar_default_pipe[] > > and changing static qualifier to global to fill the pipe configuration > > data. > > > > Signed-off-by: Huy Nguyen <huy.nguyen.wh@renesas.com> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > --- > > v2->v3: > > * Updated commit description > > * Dropped usbhsc_rzg2l_pipe[] and reusing the default_pipe[]. > > Thanks for the update! > > > --- a/drivers/usb/renesas_usbhs/common.c > > +++ b/drivers/usb/renesas_usbhs/common.c > > @@ -363,8 +363,8 @@ static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv) > > * platform default param > > */ > > > > -/* commonly used on old SH-Mobile SoCs */ -static struct > > renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { > > +/* commonly used on old SH-Mobile and RZ/G2L family SoCs */ struct > > +renesas_usbhs_driver_pipe_config usbhsc_rcar_default_pipe[] = { > > So why rename this to have "rcar" in the name? Oops, it is not used by R-Car, but used by old SH SoCs and RZ/G2L As this structure becomes global now, Will use usbhsc_rzg2l_default_pipe[] instead?? Or Will make this as static like current driver and drop filling pipe configs in info and use .has_new_pipe_configs to zero for devices using usbhsc_default_pipe[]?? Cheers, Biju
Hi Biju, On Mon, Mar 18, 2024 at 10:46 AM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > From: Geert Uytterhoeven <geert@linux-m68k.org> > > On Fri, Mar 15, 2024 at 7:39 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > > The RZ/G2L family SoCs has 10 PIPE buffers compared to 16 pipe buffers > > > on RZ/A2M. Update the pipe configuration for RZ/G2L family SoCs and > > > use family SoC specific compatible to handle this difference. > > > > > > Added SoC specific compatible to OF table to avoid ABI breakage with > > > old DTB. To optimize memory usage the SoC specific compatible will be > > > removed later. > > > > > > The pipe configuration of RZ/G2L is same as the default one, so reuse > > > the common table by renaming > > > usbhs_default_pipe[]->usbhs_rcar_default_pipe[] > > > and changing static qualifier to global to fill the pipe configuration > > > data. > > > > > > Signed-off-by: Huy Nguyen <huy.nguyen.wh@renesas.com> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > > --- > > > v2->v3: > > > * Updated commit description > > > * Dropped usbhsc_rzg2l_pipe[] and reusing the default_pipe[]. > > > > Thanks for the update! > > > > > --- a/drivers/usb/renesas_usbhs/common.c > > > +++ b/drivers/usb/renesas_usbhs/common.c > > > @@ -363,8 +363,8 @@ static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv) > > > * platform default param > > > */ > > > > > > -/* commonly used on old SH-Mobile SoCs */ -static struct > > > renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { > > > +/* commonly used on old SH-Mobile and RZ/G2L family SoCs */ struct > > > +renesas_usbhs_driver_pipe_config usbhsc_rcar_default_pipe[] = { > > > > So why rename this to have "rcar" in the name? > > Oops, it is not used by R-Car, but used by old SH SoCs and RZ/G2L > As this structure becomes global now, Will use usbhsc_rzg2l_default_pipe[] instead?? > > Or > > Will make this as static like current driver and drop filling pipe configs in info and > use .has_new_pipe_configs to zero for devices using usbhsc_default_pipe[]?? I think just using .has_new_pipe_configs is the simplest solution. Gr{oetje,eeting}s, Geert
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 013bc1583610..3c67cd9c4406 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -363,8 +363,8 @@ static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv) * platform default param */ -/* commonly used on old SH-Mobile SoCs */ -static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { +/* commonly used on old SH-Mobile and RZ/G2L family SoCs */ +struct renesas_usbhs_driver_pipe_config usbhsc_rcar_default_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), @@ -565,6 +565,18 @@ static const struct of_device_id usbhs_of_match[] = { .compatible = "renesas,usbhs-r8a77995", .data = &usbhs_rcar_gen3_with_pll_plat_info, }, + { + .compatible = "renesas,usbhs-r9a07g043", + .data = &usbhs_rzg2l_plat_info, + }, + { + .compatible = "renesas,usbhs-r9a07g044", + .data = &usbhs_rzg2l_plat_info, + }, + { + .compatible = "renesas,usbhs-r9a07g054", + .data = &usbhs_rzg2l_plat_info, + }, { .compatible = "renesas,rcar-gen2-usbhs", .data = &usbhs_rcar_gen2_plat_info, @@ -581,6 +593,10 @@ static const struct of_device_id usbhs_of_match[] = { .compatible = "renesas,rza2-usbhs", .data = &usbhs_rza2_plat_info, }, + { + .compatible = "renesas,rzg2l-usbhs", + .data = &usbhs_rzg2l_plat_info, + }, { }, }; MODULE_DEVICE_TABLE(of, usbhs_of_match); @@ -642,8 +658,8 @@ static int usbhs_probe(struct platform_device *pdev) 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); + priv->dparam.pipe_configs = usbhsc_rcar_default_pipe; + priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_rcar_default_pipe); } if (!priv->dparam.pio_dma_border) priv->dparam.pio_dma_border = 64; /* 64byte */ diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index f6f527ca9b45..6b4b6f43d823 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h @@ -343,6 +343,7 @@ 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_default_pipe[]; extern struct renesas_usbhs_driver_pipe_config usbhsc_rcar_pipe[]; #endif /* RENESAS_USB_DRIVER_H */ diff --git a/drivers/usb/renesas_usbhs/rza.h b/drivers/usb/renesas_usbhs/rza.h index a29b75fef057..8b879aa34a20 100644 --- a/drivers/usb/renesas_usbhs/rza.h +++ b/drivers/usb/renesas_usbhs/rza.h @@ -3,3 +3,4 @@ extern const struct renesas_usbhs_platform_info usbhs_rza1_plat_info; extern const struct renesas_usbhs_platform_info usbhs_rza2_plat_info; +extern const struct renesas_usbhs_platform_info usbhs_rzg2l_plat_info; diff --git a/drivers/usb/renesas_usbhs/rza2.c b/drivers/usb/renesas_usbhs/rza2.c index f6660628eea9..de96c226c826 100644 --- a/drivers/usb/renesas_usbhs/rza2.c +++ b/drivers/usb/renesas_usbhs/rza2.c @@ -72,3 +72,18 @@ const struct renesas_usbhs_platform_info usbhs_rza2_plat_info = { .cfifo_byte_addr = 1, }, }; + +const struct renesas_usbhs_platform_info usbhs_rzg2l_plat_info = { + .platform_callback = { + .hardware_init = usbhs_rza2_hardware_init, + .hardware_exit = usbhs_rza2_hardware_exit, + .power_ctrl = usbhs_rza2_power_ctrl, + .get_id = usbhs_get_id_as_gadget, + }, + .driver_param = { + .pipe_configs = usbhsc_rcar_default_pipe, + .pipe_size = 10, + .has_cnen = 1, + .cfifo_byte_addr = 1, + }, +};