From: Marek Vasut Date: Sun, 28 Jan 2018 17:35:20 +0100 Subject: [U-Boot] [PATCH v3 02/30] sunxi: musb: Add fifo config for H3 In-Reply-To: <1517156391-11353-3-git-send-email-jagan@amarulasolutions.com> References: <1517156391-11353-1-git-send-email-jagan@amarulasolutions.com> <1517156391-11353-3-git-send-email-jagan@amarulasolutions.com> Message-ID: <89b7dabc-86a3-c16c-e376-677b6eada883@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 01/28/2018 05:19 PM, Jagan Teki wrote: > From: Jun Nie > > Add fifo config for H3 as H3 differ with other SoC > on ep number. > > Signed-off-by: Jun Nie > Reviewed-by: Jagan Teki > [jagan: fixed num_eps for H3] > Signed-off-by: Jagan Teki > Cc: Marek Vasut > --- > 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 aedc24b..46c8bd2 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, }, > +}; Ugh, each and every two entries are the same except for style being either RX/TX . And each tuple differs only in hw_ep_num . Generate that with some sane macro ... Moreover, the driver is DT capable, use that to discern different SoCs and DO NOT ADD MORE IFDEFs . > +#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 = 5, > +#else > .num_eps = 6, > +#endif > .ram_bits = 11, > }; > > -- Best regards, Marek Vasut