[[PATCH,v2] 2/8] sunxi: musb: Add fifo config for H3

Message ID 1515168960-18960-3-git-send-email-jun.nie@linaro.org
State New
Headers show
Series
  • [[PATCH,v2] 2/8] sunxi: musb: Add fifo config for H3
Related show

Commit Message

Jun Nie Jan. 5, 2018, 4:15 p.m.
Add fifo config for H3 as H3 differ with other SoC
on ep number.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
---
 drivers/usb/musb-new/sunxi.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Jagan Teki Jan. 25, 2018, 1:05 p.m. | #1
On Fri, Jan 5, 2018 at 9:45 PM, Jun Nie <jun.nie@linaro.org> wrote:
> Add fifo config for H3 as H3 differ with other SoC
> on ep number.
>
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> Reviewed-by: Jagan Teki <jagan@openedev.com>
> ---
>  drivers/usb/musb-new/sunxi.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
> index 7ee44ea..0005c1e 100644
> --- a/drivers/usb/musb-new/sunxi.c
> +++ b/drivers/usb/musb-new/sunxi.c
> @@ -290,10 +290,42 @@ static const struct musb_platform_ops sunxi_musb_ops = {
>         .disable        = sunxi_musb_disable,
>  };
>
> +#if defined(CONFIG_MACH_SUN8I_H3)
> +static struct musb_fifo_cfg sunxi_musb_fifo_config[] = {
> +       { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
> +       { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 512, },
> +       { .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 3, .style = FIFO_RX, .maxpacket = 512, },
> +       { .hw_ep_num = 4, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 4, .style = FIFO_RX, .maxpacket = 512, },
> +};
> +#else
> +static struct musb_fifo_cfg sunxi_musb_fifo_config[] = {
> +       { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
> +       { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 512, },
> +       { .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 3, .style = FIFO_RX, .maxpacket = 512, },
> +       { .hw_ep_num = 4, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 4, .style = FIFO_RX, .maxpacket = 512, },
> +       { .hw_ep_num = 5, .style = FIFO_TX, .maxpacket = 512, },
> +       { .hw_ep_num = 5, .style = FIFO_RX, .maxpacket = 512, },
> +};
> +#endif
> +
>  static struct musb_hdrc_config musb_config = {
> +       .fifo_cfg       = sunxi_musb_fifo_config,
> +       .fifo_cfg_size  = ARRAY_SIZE(sunxi_musb_fifo_config),
>         .multipoint     = 1,
>         .dyn_fifo       = 1,
> +#if defined(CONFIG_MACH_SUN8I_H3)
>         .num_eps        = 6,
> +#else
> +       .num_eps        = 5,
> +#endif

This is incorrect, H3 has 5 ep's and rest have 6

Patch

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 7ee44ea..0005c1e 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -290,10 +290,42 @@  static const struct musb_platform_ops sunxi_musb_ops = {
 	.disable	= sunxi_musb_disable,
 };
 
+#if defined(CONFIG_MACH_SUN8I_H3)
+static struct musb_fifo_cfg sunxi_musb_fifo_config[] = {
+	{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
+	{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 512, },
+	{ .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 3, .style = FIFO_RX, .maxpacket = 512, },
+	{ .hw_ep_num = 4, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 4, .style = FIFO_RX, .maxpacket = 512, },
+};
+#else
+static struct musb_fifo_cfg sunxi_musb_fifo_config[] = {
+	{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
+	{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 512, },
+	{ .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 3, .style = FIFO_RX, .maxpacket = 512, },
+	{ .hw_ep_num = 4, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 4, .style = FIFO_RX, .maxpacket = 512, },
+	{ .hw_ep_num = 5, .style = FIFO_TX, .maxpacket = 512, },
+	{ .hw_ep_num = 5, .style = FIFO_RX, .maxpacket = 512, },
+};
+#endif
+
 static struct musb_hdrc_config musb_config = {
+	.fifo_cfg	= sunxi_musb_fifo_config,
+	.fifo_cfg_size	= ARRAY_SIZE(sunxi_musb_fifo_config),
 	.multipoint     = 1,
 	.dyn_fifo       = 1,
+#if defined(CONFIG_MACH_SUN8I_H3)
 	.num_eps        = 6,
+#else
+	.num_eps        = 5,
+#endif
 	.ram_bits       = 11,
 };