Re: [PATCH 6/8] usb: musb: Pass fifo_mode in platform data
Hi Tony, Thanks for this one too. On Mon, Nov-24-2014 at 11:05:04 AM -0800, Tony Lindgren wrote: > This allows setting the correct fifo_mode when multiple > MUSB glue layers are built-in. Applied on top of 3.18-rc6 mainline and tested successfully on JZ4740. Been able to use ethernet-over-usb to access the internet on device. No issue as far as I'm concerned. Acked-by: Apelete Seketeli > Cc: Fabio Baltieri > Cc: Lee Jones > Cc: Linus Walleij > Cc: Apelete Seketeli > Cc: Lars-Peter Clausen > Signed-off-by: Tony Lindgren > --- > drivers/usb/musb/blackfin.c | 1 + > drivers/usb/musb/da8xx.c | 1 + > drivers/usb/musb/jz4740.c| 1 + > drivers/usb/musb/musb_core.c | 21 ++--- > drivers/usb/musb/ux500.c | 1 + > 5 files changed, 10 insertions(+), 15 deletions(-) > > diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c > index c55fcfd..b8442b9 100644 > --- a/drivers/usb/musb/blackfin.c > +++ b/drivers/usb/musb/blackfin.c > @@ -474,6 +474,7 @@ static const struct musb_platform_ops bfin_ops = { > .writew = bfin_writew, > .readl = bfin_readl, > .writel = bfin_writel, > + .fifo_mode = 2, > .read_fifo = bfin_read_fifo, > .write_fifo = bfin_write_fifo, > .enable = bfin_musb_enable, > diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c > index c9079c8..5f9b486 100644 > --- a/drivers/usb/musb/da8xx.c > +++ b/drivers/usb/musb/da8xx.c > @@ -462,6 +462,7 @@ static const struct musb_platform_ops da8xx_ops = { > .init = da8xx_musb_init, > .exit = da8xx_musb_exit, > > + .fifo_mode = 2, > .enable = da8xx_musb_enable, > .disable= da8xx_musb_disable, > > diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c > index 40e9874..bb7b263 100644 > --- a/drivers/usb/musb/jz4740.c > +++ b/drivers/usb/musb/jz4740.c > @@ -107,6 +107,7 @@ static int jz4740_musb_exit(struct musb *musb) > > static const struct musb_platform_ops jz4740_musb_ops = { > .quirks = MUSB_INDEXED_EP, > + .fifo_mode = 2, > .init = jz4740_musb_init, > .exit = jz4740_musb_exit, > }; > diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > index 48ddc82..0875365 100644 > --- a/drivers/usb/musb/musb_core.c > +++ b/drivers/usb/musb/musb_core.c > @@ -1116,21 +1116,7 @@ static void musb_shutdown(struct platform_device *pdev) > * We don't currently use dynamic fifo setup capability to do anything > * more than selecting one of a bunch of predefined configurations. > */ > -#if defined(CONFIG_USB_MUSB_TUSB6010)\ > - || defined(CONFIG_USB_MUSB_TUSB6010_MODULE) \ > - || defined(CONFIG_USB_MUSB_OMAP2PLUS) \ > - || defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE)\ > - || defined(CONFIG_USB_MUSB_AM35X) \ > - || defined(CONFIG_USB_MUSB_AM35X_MODULE)\ > - || defined(CONFIG_USB_MUSB_DSPS)\ > - || defined(CONFIG_USB_MUSB_DSPS_MODULE) > -static ushort fifo_mode = 4; > -#elif defined(CONFIG_USB_MUSB_UX500) \ > - || defined(CONFIG_USB_MUSB_UX500_MODULE) > -static ushort fifo_mode = 5; > -#else > -static ushort fifo_mode = 2; > -#endif > +static ushort fifo_mode; > > /* "modprobe ... fifo_mode=1" etc */ > module_param(fifo_mode, ushort, 0); > @@ -2040,6 +2026,11 @@ musb_init_controller(struct device *dev, int nIrq, > void __iomem *ctrl) > musb->io.ep_select = musb_flat_ep_select; > } > > + if (musb->ops->fifo_mode) > + fifo_mode = musb->ops->fifo_mode; > + else > + fifo_mode = 4; > + > if (musb->ops->fifo_offset) > musb->io.fifo_offset = musb->ops->fifo_offset; > else > diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c > index c170501..c372518 100644 > --- a/drivers/usb/musb/ux500.c > +++ b/drivers/usb/musb/ux500.c > @@ -191,6 +191,7 @@ static const struct musb_platform_ops ux500_ops = { > .quirks = MUSB_INDEXED_EP, > .init = ux500_musb_init, > .exit = ux500_musb_exit, > + .fifo_mode = 5, > > .set_vbus = ux500_musb_set_vbus, > }; > -- > 2.1.3 > -- Apelete -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/8] usb: musb: Change end point selection to use new IO access
Hi Tony, Thanks for the patch. On Mon, Nov-24-2014 at 11:05:03 AM -0800, Tony Lindgren wrote: > This allows the endpoints to work when multiple MUSB glue > layers are built in. Applied on top of 3.18-rc6 mainline and tested successfully on JZ4740. Been able to use ethernet-over-usb to access the internet on device. No issue as far as I'm concerned. Acked-by: Apelete Seketeli > Cc: Fabio Baltieri > Cc: Lee Jones > Cc: Linus Walleij > Cc: Apelete Seketeli > Cc: Lars-Peter Clausen > Signed-off-by: Tony Lindgren > --- > drivers/usb/musb/am35x.c | 1 + > drivers/usb/musb/da8xx.c | 1 + > drivers/usb/musb/jz4740.c| 1 + > drivers/usb/musb/musb_core.c | 38 +- > drivers/usb/musb/musb_core.h | 37 + > drivers/usb/musb/musb_dsps.c | 1 + > drivers/usb/musb/musb_io.h | 2 ++ > drivers/usb/musb/musb_regs.h | 11 --- > drivers/usb/musb/musbhsdma.c | 7 --- > drivers/usb/musb/tusb6010.c | 13 + > drivers/usb/musb/ux500.c | 1 + > 11 files changed, 62 insertions(+), 51 deletions(-) > > diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c > index 13d1d77..1ea4a67 100644 > --- a/drivers/usb/musb/am35x.c > +++ b/drivers/usb/musb/am35x.c > @@ -438,6 +438,7 @@ static void am35x_read_fifo(struct musb_hw_ep *hw_ep, u16 > len, u8 *dst) > } > > static const struct musb_platform_ops am35x_ops = { > + .quirks = MUSB_INDEXED_EP, > .init = am35x_musb_init, > .exit = am35x_musb_exit, > > diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c > index 058775e..c9079c8 100644 > --- a/drivers/usb/musb/da8xx.c > +++ b/drivers/usb/musb/da8xx.c > @@ -458,6 +458,7 @@ static int da8xx_musb_exit(struct musb *musb) > } > > static const struct musb_platform_ops da8xx_ops = { > + .quirks = MUSB_INDEXED_EP, > .init = da8xx_musb_init, > .exit = da8xx_musb_exit, > > diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c > index d118729..40e9874 100644 > --- a/drivers/usb/musb/jz4740.c > +++ b/drivers/usb/musb/jz4740.c > @@ -106,6 +106,7 @@ static int jz4740_musb_exit(struct musb *musb) > } > > static const struct musb_platform_ops jz4740_musb_ops = { > + .quirks = MUSB_INDEXED_EP, > .init = jz4740_musb_init, > .exit = jz4740_musb_exit, > }; > diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > index 2fbe149..48ddc82 100644 > --- a/drivers/usb/musb/musb_core.c > +++ b/drivers/usb/musb/musb_core.c > @@ -229,6 +229,27 @@ static u32 musb_default_fifo_offset(u8 epnum) > return 0x20 + (epnum * 4); > } > > +/* "flat" mapping: each endpoint has its own i/o address */ > +static void musb_flat_ep_select(void __iomem *mbase, u8 epnum) > +{ > +} > + > +static u32 musb_flat_ep_offset(u8 epnum, u16 offset) > +{ > + return 0x100 + (0x10 * epnum) + offset; > +} > + > +/* "indexed" mapping: INDEX register controls register bank select */ > +static void musb_indexed_ep_select(void __iomem *mbase, u8 epnum) > +{ > + musb_writeb(mbase, MUSB_INDEX, epnum); > +} > + > +static u32 musb_indexed_ep_offset(u8 epnum, u16 offset) > +{ > + return 0x10 + offset; > +} > + > static u8 musb_default_readb(const void __iomem *addr, unsigned offset) > { > return __raw_readb(addr + offset); > @@ -1534,7 +1555,7 @@ static int musb_core_init(u16 musb_type, struct musb > *musb) > } > #endif > > - hw_ep->regs = MUSB_EP_OFFSET(i, 0) + mbase; > + hw_ep->regs = musb->io.ep_offset(i, 0) + mbase; > hw_ep->target_regs = musb_read_target_reg_base(i, mbase); > hw_ep->rx_reinit = 1; > hw_ep->tx_reinit = 1; > @@ -2004,6 +2025,21 @@ musb_init_controller(struct device *dev, int nIrq, > void __iomem *ctrl) > if (musb->ops->quirks) > musb->io.quirks = musb->ops->quirks; > > + /* At least tusb6010 has it's own offsets.. */ > + if (musb->ops->ep_offset) > + musb->io.ep_offset = musb->ops->ep_offset; > + if (musb->ops->ep_select) > + musb->io.ep_select = musb->ops->ep_select; > + > + /* ..and some devices use indexed offset or flat offset */ > + if (musb->io.quirks & MUSB_INDEXED_EP) { > + musb->io.ep_offset = musb_indexed_ep_offset; > + musb->io.ep_select = musb_indexed_ep_select; > + } else { > +