All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Allow multiple MUSB glue layers to be built in
@ 2014-11-24 19:04 Tony Lindgren
  2014-11-24 19:05 ` [PATCH 2/8] usb: musb: Populate new IO functions for tusb6010 Tony Lindgren
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:04 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-omap

Hi all,

I noticed MUSB did not work for me as loadable modules and it was
because of the iffdeffery that breaks things with multiple glue
layers enabled as loadable modules.

I've set up function pointers for the PIO functions that now allow
building in multiple glue layers as modules or built-in.

Note that this series still does not sort out the DMA related issues,
I have a series in works for that too. But that will take some more
debugging.

So far this has been tested to work on omap3, am335x and tusb6010.

Regards,

Tony


Tony Lindgren (8):
  usb: musb: Add function pointers for IO access functions
  usb: musb: Populate new IO functions for tusb6010
  usb: musb: Populate new IO functions for blackfin
  usb: musb: Change to use new IO access
  usb: musb: Change end point selection to use new IO access
  usb: musb: Pass fifo_mode in platform data
  usb: musb: Allow multiple glue layers to be built in
  usb: musb: Use IS_ENABLED for tusb6010

 drivers/usb/musb/Kconfig     |   5 +-
 drivers/usb/musb/am35x.c     |   4 +-
 drivers/usb/musb/blackfin.c  |  48 ++++++++++-
 drivers/usb/musb/da8xx.c     |   2 +
 drivers/usb/musb/jz4740.c    |   2 +
 drivers/usb/musb/musb_core.c | 199 ++++++++++++++++++++++++++++++++++++-------
 drivers/usb/musb/musb_core.h |  86 ++++++++++---------
 drivers/usb/musb/musb_dsps.c |   1 +
 drivers/usb/musb/musb_io.h   | 106 ++++++-----------------
 drivers/usb/musb/musb_regs.h |  26 ------
 drivers/usb/musb/musbhsdma.c |   7 +-
 drivers/usb/musb/tusb6010.c  |  58 ++++++++++++-
 drivers/usb/musb/ux500.c     |   2 +
 drivers/usb/musb/ux500_dma.c |   4 +-
 14 files changed, 356 insertions(+), 194 deletions(-)

-- 
2.1.3


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/8] usb: musb: Add function pointers for IO access functions
       [not found] ` <1416855906-13931-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2014-11-24 19:04   ` Tony Lindgren
  2014-11-24 19:05   ` [PATCH 4/8] usb: musb: Change to use new IO access Tony Lindgren
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:04 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA

MUSB currently breaks badly if we try to build in support
for multiple platforms. This also happens if done as loadable
modules, which is not nice for distros.

Let's fix the issue by adding new struct musb_io for the IO
access functions that the platform code can populate. Note
that we don't want to use the current ops as that's really
platform_data and and set as a const.

This should allow eventually adding function pointers also
for the DMA code to struct musb_io, but that's a whole
different set of patches. For now, let's just fix the PIO
access.

Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/usb/musb/musb_core.h | 40 ++++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/musb_io.h   | 18 ++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 414e57a..7c7f38c 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -173,8 +173,25 @@ enum musb_g_ep0_state {
 
 /******************************** TYPES *************************************/
 
+struct musb_io;
+
 /**
  * struct musb_platform_ops - Operations passed to musb_core by HW glue layer
+ * @quirks:	flags for platform specific quirks
+ * @enable:	enable device
+ * @disable:	disable device
+ * @ep_offset:	returns the end point offset
+ * @ep_select:	selects the specified end point
+ * @fifo_mode:	sets the fifo mode
+ * @fifo_offset: returns the fifo offset
+ * @readb:	read 8 bits
+ * @writeb:	write 8 bits
+ * @readw:	read 16 bits
+ * @writew:	write 16 bits
+ * @readl:	read 32 bits
+ * @writel:	write 32 bits
+ * @read_fifo:	reads the fifo
+ * @write_fifo:	writes to fifo
  * @init:	turns on clocks, sets up platform-specific registers, etc
  * @exit:	undoes @init
  * @set_mode:	forcefully changes operating mode
@@ -184,12 +201,34 @@ enum musb_g_ep0_state {
  * @adjust_channel_params: pre check for standard dma channel_program func
  */
 struct musb_platform_ops {
+
+#define MUSB_DMA_UX500		BIT(6)
+#define MUSB_DMA_CPPI41		BIT(5)
+#define MUSB_DMA_CPPI		BIT(4)
+#define MUSB_DMA_TUSB_OMAP	BIT(3)
+#define MUSB_DMA_INVENTRA	BIT(2)
+#define MUSB_IN_TUSB		BIT(1)
+#define MUSB_INDEXED_EP		BIT(0)
+	u32	quirks;
+
 	int	(*init)(struct musb *musb);
 	int	(*exit)(struct musb *musb);
 
 	void	(*enable)(struct musb *musb);
 	void	(*disable)(struct musb *musb);
 
+	u32	(*ep_offset)(u8 epnum, u16 offset);
+	void	(*ep_select)(void __iomem *mbase, u8 epnum);
+	u16	fifo_mode;
+	u32	(*fifo_offset)(u8 epnum);
+	u8	(*readb)(const void __iomem *addr, unsigned offset);
+	void	(*writeb)(void __iomem *addr, unsigned offset, u8 data);
+	u16	(*readw)(const void __iomem *addr, unsigned offset);
+	void	(*writew)(void __iomem *addr, unsigned offset, u16 data);
+	u32	(*readl)(const void __iomem *addr, unsigned offset);
+	void	(*writel)(void __iomem *addr, unsigned offset, u32 data);
+	void	(*read_fifo)(struct musb_hw_ep *hw_ep, u16 len, u8 *buf);
+	void	(*write_fifo)(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf);
 	int	(*set_mode)(struct musb *musb, u8 mode);
 	void	(*try_idle)(struct musb *musb, unsigned long timeout);
 	int	(*reset)(struct musb *musb);
@@ -292,6 +331,7 @@ struct musb {
 	/* device lock */
 	spinlock_t		lock;
 
+	struct musb_io		io;
 	const struct musb_platform_ops *ops;
 	struct musb_context_registers context;
 
diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h
index eebeed7..46c01c8 100644
--- a/drivers/usb/musb/musb_io.h
+++ b/drivers/usb/musb/musb_io.h
@@ -37,6 +37,24 @@
 
 #include <linux/io.h>
 
+/**
+ * struct musb_io - IO functions for MUSB
+ * @quirks:	platform specific flags
+ * @ep_offset:	platform specific function to get end point offset
+ * @ep_select:	platform specific function to select end point
+ * @fifo_offset: platform specific function to get fifo offset
+ * @read_fifo:	platform specific function to read fifo
+ * @write_fifo:	platform specific function to write fifo
+ */
+struct musb_io {
+	u32	quirks;
+	u32	(*ep_offset)(u8 epnum, u16 offset);
+	void	(*ep_select)(void __iomem *mbase, u8 epnum);
+	u32	(*fifo_offset)(u8 epnum);
+	void	(*read_fifo)(struct musb_hw_ep *hw_ep, u16 len, u8 *buf);
+	void	(*write_fifo)(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf);
+};
+
 #ifndef CONFIG_BLACKFIN
 
 /* NOTE:  these offsets are all in bytes */
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/8] usb: musb: Populate new IO functions for tusb6010
  2014-11-24 19:04 [PATCH 0/8] Allow multiple MUSB glue layers to be built in Tony Lindgren
@ 2014-11-24 19:05 ` Tony Lindgren
  2014-11-24 19:05 ` [PATCH 3/8] usb: musb: Populate new IO functions for blackfin Tony Lindgren
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:05 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-omap

Let's populate the new IO functions for tusb6010 but not use
them yet.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/musb/tusb6010.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 2daa779..996ea21 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -126,6 +126,41 @@ static void tusb_wbus_quirk(struct musb *musb, int enabled)
 	}
 }
 
+static u32 tusb_fifo_offset(u8 epnum)
+{
+	return 0x200 + (epnum * 0x20);
+}
+
+/*
+ * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum.
+ */
+static u8 tusb_readb(const void __iomem *addr, unsigned offset)
+{
+	u16 tmp;
+	u8 val;
+
+	tmp = __raw_readw(addr + (offset & ~1));
+	if (offset & 1)
+		val = (tmp >> 8);
+	else
+		val = tmp & 0xff;
+
+	return val;
+}
+
+static void tusb_writeb(void __iomem *addr, unsigned offset, u8 data)
+{
+	u16 tmp;
+
+	tmp = __raw_readw(addr + (offset & ~1));
+	if (offset & 1)
+		tmp = (data << 8) | (tmp & 0xff);
+	else
+		tmp = (tmp & 0xff00) | data;
+
+	__raw_writew(tmp, addr + (offset & ~1));
+}
+
 /*
  * TUSB 6010 may use a parallel bus that doesn't support byte ops;
  * so both loading and unloading FIFOs need explicit byte counts.
@@ -1135,9 +1170,15 @@ static int tusb_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops tusb_ops = {
+	.quirks		= MUSB_IN_TUSB,
 	.init		= tusb_musb_init,
 	.exit		= tusb_musb_exit,
 
+	.fifo_offset	= tusb_fifo_offset,
+	.readb		= tusb_readb,
+	.writeb		= tusb_writeb,
+	.read_fifo	= musb_read_fifo,
+	.write_fifo	= musb_write_fifo,
 	.enable		= tusb_musb_enable,
 	.disable	= tusb_musb_disable,
 
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/8] usb: musb: Populate new IO functions for blackfin
  2014-11-24 19:04 [PATCH 0/8] Allow multiple MUSB glue layers to be built in Tony Lindgren
  2014-11-24 19:05 ` [PATCH 2/8] usb: musb: Populate new IO functions for tusb6010 Tony Lindgren
@ 2014-11-24 19:05 ` Tony Lindgren
       [not found] ` <1416855906-13931-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  2014-11-24 19:05 ` [PATCH 8/8] usb: musb: Use IS_ENABLED for tusb6010 Tony Lindgren
  3 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:05 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-omap, Bryan Wu

Populate new IO functions for blackfin

Cc: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/musb/blackfin.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index ac4422b..8b5ad57 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -33,6 +33,41 @@ struct bfin_glue {
 };
 #define glue_to_musb(g)		platform_get_drvdata(g->musb)
 
+static u32 bfin_fifo_offset(u8 epnum)
+{
+	return USB_OFFSET(USB_EP0_FIFO) + (epnum * 8);
+}
+
+static u8 bfin_readb(const void __iomem *addr, unsigned offset)
+{
+	return (u8)(bfin_read16(addr + offset));
+}
+
+static u16 bfin_readw(const void __iomem *addr, unsigned offset)
+{
+	return bfin_read16(addr + offset);
+}
+
+static u32 bfin_readl(const void __iomem *addr, unsigned offset)
+{
+	return (u32)(bfin_read16(addr + offset));
+}
+
+static void bfin_writeb(void __iomem *addr, unsigned offset, u8 data)
+{
+	bfin_write16(addr + offset, (u16)data);
+}
+
+static void bfin_writew(void __iomem *addr, unsigned offset, u16 data)
+{
+	bfin_write16(addr + offset, data);
+}
+
+static void binf_writel(void __iomem *addr, unsigned offset, u32 data)
+{
+	bfin_write16(addr + offset, (u16)data);
+}
+
 /*
  * Load an endpoint's FIFO
  */
@@ -433,6 +468,14 @@ static const struct musb_platform_ops bfin_ops = {
 	.init		= bfin_musb_init,
 	.exit		= bfin_musb_exit,
 
+	.readb		= bfin_readb,
+	.writeb		= bfin_writeb,
+	.readw		= bfin_readw,
+	.writew		= bfin_writew,
+	.readl		= bfin_readl,
+	.writel		= bfin_writel,
+	.read_fifo	= musb_read_fifo,
+	.write_fifo	= musb_write_fifo,
 	.enable		= bfin_musb_enable,
 	.disable	= bfin_musb_disable,
 
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/8] usb: musb: Change to use new IO access
       [not found] ` <1416855906-13931-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  2014-11-24 19:04   ` [PATCH 1/8] usb: musb: Add function pointers for IO access functions Tony Lindgren
@ 2014-11-24 19:05   ` Tony Lindgren
  2014-11-24 19:12     ` Felipe Balbi
       [not found]     ` <1416855906-13931-5-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  2014-11-24 19:05   ` [PATCH 5/8] usb: musb: Change end point selection " Tony Lindgren
                     ` (2 subsequent siblings)
  4 siblings, 2 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:05 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Fabio Baltieri, Lee Jones,
	Linus Walleij

Change to use new IO access. This allows us to build in multiple
MUSB glue layers.

Cc: Fabio Baltieri <fabio.baltieri-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/usb/musb/am35x.c     |   3 +-
 drivers/usb/musb/blackfin.c  |   8 +--
 drivers/usb/musb/musb_core.c | 140 ++++++++++++++++++++++++++++++++++++++-----
 drivers/usb/musb/musb_io.h   |  88 +++------------------------
 drivers/usb/musb/musb_regs.h |  12 ----
 drivers/usb/musb/tusb6010.c  |   8 +--
 drivers/usb/musb/ux500_dma.c |   4 +-
 7 files changed, 143 insertions(+), 120 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index a2735df..13d1d77 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -408,7 +408,7 @@ static int am35x_musb_exit(struct musb *musb)
 }
 
 /* AM35x supports only 32bit read operation */
-void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
+static void am35x_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
 {
 	void __iomem *fifo = hw_ep->fifo;
 	u32		val;
@@ -441,6 +441,7 @@ static const struct musb_platform_ops am35x_ops = {
 	.init		= am35x_musb_init,
 	.exit		= am35x_musb_exit,
 
+	.read_fifo	= am35x_read_fifo,
 	.enable		= am35x_musb_enable,
 	.disable	= am35x_musb_disable,
 
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 8b5ad57..c55fcfd 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -71,7 +71,7 @@ static void binf_writel(void __iomem *addr, unsigned offset, u32 data)
 /*
  * Load an endpoint's FIFO
  */
-void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
+static void bfin_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 {
 	struct musb *musb = hw_ep->musb;
 	void __iomem *fifo = hw_ep->fifo;
@@ -135,7 +135,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 /*
  * Unload an endpoint's FIFO
  */
-void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
+static void bfin_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
 {
 	struct musb *musb = hw_ep->musb;
 	void __iomem *fifo = hw_ep->fifo;
@@ -474,8 +474,8 @@ static const struct musb_platform_ops bfin_ops = {
 	.writew		= bfin_writew,
 	.readl		= bfin_readl,
 	.writel		= bfin_writel,
-	.read_fifo	= musb_read_fifo,
-	.write_fifo	= musb_write_fifo,
+	.read_fifo	= bfin_read_fifo,
+	.write_fifo	= bfin_write_fifo,
 	.enable		= bfin_musb_enable,
 	.disable	= bfin_musb_disable,
 
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index b841ee0..2fbe149 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -224,12 +224,46 @@ static struct usb_phy_io_ops musb_ulpi_access = {
 
 /*-------------------------------------------------------------------------*/
 
-#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_BLACKFIN)
+static u32 musb_default_fifo_offset(u8 epnum)
+{
+	return 0x20 + (epnum * 4);
+}
+
+static u8 musb_default_readb(const void __iomem *addr, unsigned offset)
+{
+	return __raw_readb(addr + offset);
+}
+
+static void musb_default_writeb(void __iomem *addr, unsigned offset, u8 data)
+{
+	__raw_writeb(data, addr + offset);
+}
+
+static u16 musb_default_readw(const void __iomem *addr, unsigned offset)
+{
+	return __raw_readw(addr + offset);
+}
+
+static void musb_default_writew(void __iomem *addr, unsigned offset, u16 data)
+{
+	__raw_writew(data, addr + offset);
+}
+
+static u32 musb_default_readl(const void __iomem *addr, unsigned offset)
+{
+	return __raw_readl(addr + offset);
+}
+
+static void musb_default_writel(void __iomem *addr, unsigned offset, u32 data)
+{
+	__raw_writel(data, addr + offset);
+}
 
 /*
  * Load an endpoint's FIFO
  */
-void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
+static void musb_default_write_fifo(struct musb_hw_ep *hw_ep, u16 len,
+				    const u8 *src)
 {
 	struct musb *musb = hw_ep->musb;
 	void __iomem *fifo = hw_ep->fifo;
@@ -270,11 +304,10 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 	}
 }
 
-#if !defined(CONFIG_USB_MUSB_AM35X)
 /*
  * Unload an endpoint's FIFO
  */
-void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
+static void musb_default_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
 {
 	struct musb *musb = hw_ep->musb;
 	void __iomem *fifo = hw_ep->fifo;
@@ -312,10 +345,40 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
 		ioread8_rep(fifo, dst, len);
 	}
 }
-#endif
 
-#endif	/* normal PIO */
+/*
+ * Old style IO functions
+ */
+u8 (*musb_readb)(const void __iomem *addr, unsigned offset);
+EXPORT_SYMBOL(musb_readb);
+
+void (*musb_writeb)(void __iomem *addr, unsigned offset, u8 data);
+EXPORT_SYMBOL(musb_writeb);
 
+u16 (*musb_readw)(const void __iomem *addr, unsigned offset);
+EXPORT_SYMBOL(musb_readw);
+
+void (*musb_writew)(void __iomem *addr, unsigned offset, u16 data);
+EXPORT_SYMBOL(musb_writew);
+
+u32 (*musb_readl)(const void __iomem *addr, unsigned offset);
+EXPORT_SYMBOL(musb_readl);
+
+void (*musb_writel)(void __iomem *addr, unsigned offset, u32 data);
+EXPORT_SYMBOL(musb_writel);
+
+/*
+ * New style IO functions
+ */
+void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
+{
+	return hw_ep->musb->io.read_fifo(hw_ep, len, dst);
+}
+
+void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
+{
+	return hw_ep->musb->io.write_fifo(hw_ep, len, src);
+}
 
 /*-------------------------------------------------------------------------*/
 
@@ -1456,17 +1519,19 @@ static int musb_core_init(u16 musb_type, struct musb *musb)
 	for (i = 0; i < musb->nr_endpoints; i++) {
 		struct musb_hw_ep	*hw_ep = musb->endpoints + i;
 
-		hw_ep->fifo = MUSB_FIFO_OFFSET(i) + mbase;
+		hw_ep->fifo = musb->io.fifo_offset(i) + mbase;
 #if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE)
-		hw_ep->fifo_async = musb->async + 0x400 + MUSB_FIFO_OFFSET(i);
-		hw_ep->fifo_sync = musb->sync + 0x400 + MUSB_FIFO_OFFSET(i);
-		hw_ep->fifo_sync_va =
-			musb->sync_va + 0x400 + MUSB_FIFO_OFFSET(i);
-
-		if (i == 0)
-			hw_ep->conf = mbase - 0x400 + TUSB_EP0_CONF;
-		else
-			hw_ep->conf = mbase + 0x400 + (((i - 1) & 0xf) << 2);
+		if (musb->io.quirks & MUSB_IN_TUSB) {
+			hw_ep->fifo_async = musb->async + 0x400 + musb->io.fifo_offset(i);
+			hw_ep->fifo_sync = musb->sync + 0x400 + musb->io.fifo_offset(i);
+			hw_ep->fifo_sync_va =
+				musb->sync_va + 0x400 + musb->io.fifo_offset(i);
+
+			if (i == 0)
+				hw_ep->conf = mbase - 0x400 + TUSB_EP0_CONF;
+			else
+				hw_ep->conf = mbase + 0x400 + (((i - 1) & 0xf) << 2);
+		}
 #endif
 
 		hw_ep->regs = MUSB_EP_OFFSET(i, 0) + mbase;
@@ -1903,6 +1968,18 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 	musb->ops = plat->platform_ops;
 	musb->port_mode = plat->mode;
 
+	/*
+	 * Initialize the default IO functions. At least omap2430 needs
+	 * these early. We initialize the platform specific IO functions
+	 * later on.
+	 */
+	musb_readb = musb_default_readb;
+	musb_writeb = musb_default_writeb;
+	musb_readw = musb_default_readw;
+	musb_writew = musb_default_writew;
+	musb_readl = musb_default_readl;
+	musb_writel = musb_default_writel;
+
 	/* The musb_platform_init() call:
 	 *   - adjusts musb->mregs
 	 *   - sets the musb->isr
@@ -1924,6 +2001,37 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 		goto fail2;
 	}
 
+	if (musb->ops->quirks)
+		musb->io.quirks = musb->ops->quirks;
+
+	if (musb->ops->fifo_offset)
+		musb->io.fifo_offset = musb->ops->fifo_offset;
+	else
+		musb->io.fifo_offset = musb_default_fifo_offset;
+
+	if (musb->ops->readb)
+		musb_readb = musb->ops->readb;
+	if (musb->ops->writeb)
+		musb_writeb = musb->ops->writeb;
+	if (musb->ops->readw)
+		musb_readw = musb->ops->readw;
+	if (musb->ops->writew)
+		musb_writew = musb->ops->writew;
+	if (musb->ops->readl)
+		musb_readl = musb->ops->readl;
+	if (musb->ops->writel)
+		musb_writel = musb->ops->writel;
+
+	if (musb->ops->read_fifo)
+		musb->io.read_fifo = musb->ops->read_fifo;
+	else
+		musb->io.read_fifo = musb_default_read_fifo;
+
+	if (musb->ops->write_fifo)
+		musb->io.write_fifo = musb->ops->write_fifo;
+	else
+		musb->io.write_fifo = musb_default_write_fifo;
+
 	if (!musb->xceiv->io_ops) {
 		musb->xceiv->io_dev = musb->controller;
 		musb->xceiv->io_priv = musb->mregs;
diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h
index 46c01c8..14aa217 100644
--- a/drivers/usb/musb/musb_io.h
+++ b/drivers/usb/musb/musb_io.h
@@ -55,86 +55,12 @@ struct musb_io {
 	void	(*write_fifo)(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf);
 };
 
-#ifndef CONFIG_BLACKFIN
-
-/* NOTE:  these offsets are all in bytes */
-
-static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
-	{ return __raw_readw(addr + offset); }
-
-static inline u32 musb_readl(const void __iomem *addr, unsigned offset)
-	{ return __raw_readl(addr + offset); }
-
-
-static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data)
-	{ __raw_writew(data, addr + offset); }
-
-static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
-	{ __raw_writel(data, addr + offset); }
-
-
-#if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE)
-
-/*
- * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum.
- */
-static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
-{
-	u16 tmp;
-	u8 val;
-
-	tmp = __raw_readw(addr + (offset & ~1));
-	if (offset & 1)
-		val = (tmp >> 8);
-	else
-		val = tmp & 0xff;
-
-	return val;
-}
-
-static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
-{
-	u16 tmp;
-
-	tmp = __raw_readw(addr + (offset & ~1));
-	if (offset & 1)
-		tmp = (data << 8) | (tmp & 0xff);
-	else
-		tmp = (tmp & 0xff00) | data;
-
-	__raw_writew(tmp, addr + (offset & ~1));
-}
-
-#else
-
-static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
-	{ return __raw_readb(addr + offset); }
-
-static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
-	{ __raw_writeb(data, addr + offset); }
-
-#endif	/* CONFIG_USB_MUSB_TUSB6010 */
-
-#else
-
-static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
-	{ return (u8) (bfin_read16(addr + offset)); }
-
-static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
-	{ return bfin_read16(addr + offset); }
-
-static inline u32 musb_readl(const void __iomem *addr, unsigned offset)
-	{ return (u32) (bfin_read16(addr + offset)); }
-
-static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
-	{ bfin_write16(addr + offset, (u16) data); }
-
-static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data)
-	{ bfin_write16(addr + offset, data); }
-
-static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
-	{ bfin_write16(addr + offset, (u16) data); }
-
-#endif /* CONFIG_BLACKFIN */
+/* Do not add new entries here, add them the struct musb_io instead */
+extern u8 (*musb_readb)(const void __iomem *addr, unsigned offset);
+extern void (*musb_writeb)(void __iomem *addr, unsigned offset, u8 data);
+extern u16 (*musb_readw)(const void __iomem *addr, unsigned offset);
+extern void (*musb_writew)(void __iomem *addr, unsigned offset, u16 data);
+extern u32 (*musb_readl)(const void __iomem *addr, unsigned offset);
+extern void (*musb_writel)(void __iomem *addr, unsigned offset, u32 data);
 
 #endif
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
index 37122a4..b2b1f73 100644
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
@@ -239,14 +239,6 @@
 #define MUSB_INDEX		0x0E	/* 8 bit */
 #define MUSB_TESTMODE		0x0F	/* 8 bit */
 
-/* Get offset for a given FIFO from musb->mregs */
-#if defined(CONFIG_USB_MUSB_TUSB6010) ||	\
-	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
-#define MUSB_FIFO_OFFSET(epnum)	(0x200 + ((epnum) * 0x20))
-#else
-#define MUSB_FIFO_OFFSET(epnum)	(0x20 + ((epnum) * 4))
-#endif
-
 /*
  * Additional Control Registers
  */
@@ -480,10 +472,6 @@ static inline u8  musb_read_txhubport(void __iomem *mbase, u8 epnum)
 #define MUSB_INDEX		USB_OFFSET(USB_INDEX)	/* 8 bit */
 #define MUSB_TESTMODE		USB_OFFSET(USB_TESTMODE)/* 8 bit */
 
-/* Get offset for a given FIFO from musb->mregs */
-#define MUSB_FIFO_OFFSET(epnum)	\
-	(USB_OFFSET(USB_EP0_FIFO) + ((epnum) * 8))
-
 /*
  * Additional Control Registers
  */
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 996ea21..38efebc 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -208,7 +208,7 @@ static inline void tusb_fifo_read_unaligned(void __iomem *fifo,
 	}
 }
 
-void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf)
+static void tusb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf)
 {
 	struct musb *musb = hw_ep->musb;
 	void __iomem	*ep_conf = hw_ep->conf;
@@ -258,7 +258,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf)
 		tusb_fifo_write_unaligned(fifo, buf, len);
 }
 
-void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
+static void tusb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
 {
 	struct musb *musb = hw_ep->musb;
 	void __iomem	*ep_conf = hw_ep->conf;
@@ -1177,8 +1177,8 @@ static const struct musb_platform_ops tusb_ops = {
 	.fifo_offset	= tusb_fifo_offset,
 	.readb		= tusb_readb,
 	.writeb		= tusb_writeb,
-	.read_fifo	= musb_read_fifo,
-	.write_fifo	= musb_write_fifo,
+	.read_fifo	= tusb_read_fifo,
+	.write_fifo	= tusb_write_fifo,
 	.enable		= tusb_musb_enable,
 	.disable	= tusb_musb_disable,
 
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index 221faed..ff70f64 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -91,9 +91,9 @@ static bool ux500_configure_channel(struct dma_channel *channel,
 	struct scatterlist sg;
 	struct dma_slave_config slave_conf;
 	enum dma_slave_buswidth addr_width;
-	dma_addr_t usb_fifo_addr = (MUSB_FIFO_OFFSET(hw_ep->epnum) +
-					ux500_channel->controller->phy_base);
 	struct musb *musb = ux500_channel->controller->private_data;
+	dma_addr_t usb_fifo_addr = (musb->io.fifo_offset(hw_ep->epnum) +
+					ux500_channel->controller->phy_base);
 
 	dev_dbg(musb->controller,
 		"packet_sz=%d, mode=%d, dma_addr=0x%llx, len=%d is_tx=%d\n",
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 5/8] usb: musb: Change end point selection to use new IO access
       [not found] ` <1416855906-13931-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  2014-11-24 19:04   ` [PATCH 1/8] usb: musb: Add function pointers for IO access functions Tony Lindgren
  2014-11-24 19:05   ` [PATCH 4/8] usb: musb: Change to use new IO access Tony Lindgren
@ 2014-11-24 19:05   ` Tony Lindgren
  2014-11-24 23:38     ` Apelete Seketeli
  2014-11-28 13:50     ` Linus Walleij
  2014-11-24 19:05   ` [PATCH 6/8] usb: musb: Pass fifo_mode in platform data Tony Lindgren
  2014-11-24 19:05   ` [PATCH 7/8] usb: musb: Allow multiple glue layers to be built in Tony Lindgren
  4 siblings, 2 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:05 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Fabio Baltieri, Lee Jones,
	Linus Walleij, Apelete Seketeli, Lars-Peter Clausen

This allows the endpoints to work when multiple MUSB glue
layers are built in.

Cc: Fabio Baltieri <fabio.baltieri-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Apelete Seketeli <apelete-fIDRvF7C5ezk1uMJSBkQmQ@public.gmane.org>
Cc: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 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 {
+		musb->io.ep_offset = musb_flat_ep_offset;
+		musb->io.ep_select = musb_flat_ep_select;
+	}
+
 	if (musb->ops->fifo_offset)
 		musb->io.fifo_offset = musb->ops->fifo_offset;
 	else
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 7c7f38c..02f62cb 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -124,41 +124,6 @@ enum musb_g_ep0_state {
 #define OTG_TIME_A_AIDL_BDIS	200		/* min 200 msec */
 #define OTG_TIME_B_ASE0_BRST	100		/* min 3.125 ms */
 
-
-/*************************** REGISTER ACCESS ********************************/
-
-/* Endpoint registers (other than dynfifo setup) can be accessed either
- * directly with the "flat" model, or after setting up an index register.
- */
-
-#if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_SOC_OMAP2430) \
-		|| defined(CONFIG_SOC_OMAP3430) || defined(CONFIG_BLACKFIN) \
-		|| defined(CONFIG_ARCH_OMAP4)
-/* REVISIT indexed access seemed to
- * misbehave (on DaVinci) for at least peripheral IN ...
- */
-#define	MUSB_FLAT_REG
-#endif
-
-/* TUSB mapping: "flat" plus ep0 special cases */
-#if defined(CONFIG_USB_MUSB_TUSB6010) || \
-	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
-#define musb_ep_select(_mbase, _epnum) \
-	musb_writeb((_mbase), MUSB_INDEX, (_epnum))
-#define	MUSB_EP_OFFSET			MUSB_TUSB_OFFSET
-
-/* "flat" mapping: each endpoint has its own i/o address */
-#elif	defined(MUSB_FLAT_REG)
-#define musb_ep_select(_mbase, _epnum)	(((void)(_mbase)), ((void)(_epnum)))
-#define	MUSB_EP_OFFSET			MUSB_FLAT_OFFSET
-
-/* "indexed" mapping: INDEX register controls register bank select */
-#else
-#define musb_ep_select(_mbase, _epnum) \
-	musb_writeb((_mbase), MUSB_INDEX, (_epnum))
-#define	MUSB_EP_OFFSET			MUSB_INDEXED_OFFSET
-#endif
-
 /****************************** FUNCTIONS ********************************/
 
 #define MUSB_HST_MODE(_musb)\
@@ -514,7 +479,7 @@ static inline int musb_read_fifosize(struct musb *musb,
 	u8 reg = 0;
 
 	/* read from core using indexed model */
-	reg = musb_readb(mbase, MUSB_EP_OFFSET(epnum, MUSB_FIFOSIZE));
+	reg = musb_readb(mbase, musb->io.ep_offset(epnum, MUSB_FIFOSIZE));
 	/* 0's returned when no more endpoints */
 	if (!reg)
 		return -ENODEV;
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 48bc09e..b7f2efc 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -636,6 +636,7 @@ static int dsps_musb_reset(struct musb *musb)
 }
 
 static struct musb_platform_ops dsps_ops = {
+	.quirks		= MUSB_INDEXED_EP,
 	.init		= dsps_musb_init,
 	.exit		= dsps_musb_exit,
 
diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h
index 14aa217..8a57a6f 100644
--- a/drivers/usb/musb/musb_io.h
+++ b/drivers/usb/musb/musb_io.h
@@ -37,6 +37,8 @@
 
 #include <linux/io.h>
 
+#define musb_ep_select(_mbase, _epnum)	musb->io.ep_select((_mbase), (_epnum))
+
 /**
  * struct musb_io - IO functions for MUSB
  * @quirks:	platform specific flags
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
index b2b1f73..92b4c3d 100644
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
@@ -287,19 +287,8 @@
 #define MUSB_FIFOSIZE		0x0F
 #define MUSB_CONFIGDATA		MUSB_FIFOSIZE	/* Re-used for EP0 */
 
-/* Offsets to endpoint registers in indexed model (using INDEX register) */
-#define MUSB_INDEXED_OFFSET(_epnum, _offset)	\
-	(0x10 + (_offset))
-
-/* Offsets to endpoint registers in flat models */
-#define MUSB_FLAT_OFFSET(_epnum, _offset)	\
-	(0x100 + (0x10*(_epnum)) + (_offset))
-
 #if defined(CONFIG_USB_MUSB_TUSB6010) ||	\
 	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
-/* TUSB6010 EP0 configuration register is special */
-#define MUSB_TUSB_OFFSET(_epnum, _offset)	\
-	(0x10 + _offset)
 #include "tusb6010.h"		/* Needed "only" for TUSB_EP0_CONF */
 #endif
 
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
index e8e9f9a..ab7ec09 100644
--- a/drivers/usb/musb/musbhsdma.c
+++ b/drivers/usb/musb/musbhsdma.c
@@ -195,6 +195,7 @@ static int dma_channel_abort(struct dma_channel *channel)
 {
 	struct musb_dma_channel *musb_channel = channel->private_data;
 	void __iomem *mbase = musb_channel->controller->base;
+	struct musb *musb = musb_channel->controller->private_data;
 
 	u8 bchannel = musb_channel->idx;
 	int offset;
@@ -202,7 +203,7 @@ static int dma_channel_abort(struct dma_channel *channel)
 
 	if (channel->status == MUSB_DMA_STATUS_BUSY) {
 		if (musb_channel->transmit) {
-			offset = MUSB_EP_OFFSET(musb_channel->epnum,
+			offset = musb->io.ep_offset(musb_channel->epnum,
 						MUSB_TXCSR);
 
 			/*
@@ -215,7 +216,7 @@ static int dma_channel_abort(struct dma_channel *channel)
 			csr &= ~MUSB_TXCSR_DMAMODE;
 			musb_writew(mbase, offset, csr);
 		} else {
-			offset = MUSB_EP_OFFSET(musb_channel->epnum,
+			offset = musb->io.ep_offset(musb_channel->epnum,
 						MUSB_RXCSR);
 
 			csr = musb_readw(mbase, offset);
@@ -326,7 +327,7 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)
 					    (musb_channel->max_packet_sz - 1)))
 				    ) {
 					u8  epnum  = musb_channel->epnum;
-					int offset = MUSB_EP_OFFSET(epnum,
+					int offset = musb->io.ep_offset(epnum,
 								    MUSB_TXCSR);
 					u16 txcsr;
 
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 38efebc..fe69bad 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -131,6 +131,17 @@ static u32 tusb_fifo_offset(u8 epnum)
 	return 0x200 + (epnum * 0x20);
 }
 
+static u32 tusb_ep_offset(u8 epnum, u16 offset)
+{
+	return 0x10 + offset;
+}
+
+/* TUSB mapping: "flat" plus ep0 special cases */
+static void tusb_ep_select(void __iomem *mbase, u8 epnum)
+{
+	musb_writeb(mbase, MUSB_INDEX, epnum);
+}
+
 /*
  * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum.
  */
@@ -1174,6 +1185,8 @@ static const struct musb_platform_ops tusb_ops = {
 	.init		= tusb_musb_init,
 	.exit		= tusb_musb_exit,
 
+	.ep_offset	= tusb_ep_offset,
+	.ep_select	= tusb_ep_select,
 	.fifo_offset	= tusb_fifo_offset,
 	.readb		= tusb_readb,
 	.writeb		= tusb_writeb,
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index dc666e9..c170501 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -188,6 +188,7 @@ static int ux500_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops ux500_ops = {
+	.quirks		= MUSB_INDEXED_EP,
 	.init		= ux500_musb_init,
 	.exit		= ux500_musb_exit,
 
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 6/8] usb: musb: Pass fifo_mode in platform data
       [not found] ` <1416855906-13931-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
                     ` (2 preceding siblings ...)
  2014-11-24 19:05   ` [PATCH 5/8] usb: musb: Change end point selection " Tony Lindgren
@ 2014-11-24 19:05   ` Tony Lindgren
  2014-11-24 23:40     ` Apelete Seketeli
  2014-11-28 13:40     ` Linus Walleij
  2014-11-24 19:05   ` [PATCH 7/8] usb: musb: Allow multiple glue layers to be built in Tony Lindgren
  4 siblings, 2 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:05 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Fabio Baltieri, Lee Jones,
	Linus Walleij, Apelete Seketeli, Lars-Peter Clausen

This allows setting the correct fifo_mode when multiple
MUSB glue layers are built-in.

Cc: Fabio Baltieri <fabio.baltieri-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Apelete Seketeli <apelete-fIDRvF7C5ezk1uMJSBkQmQ@public.gmane.org>
Cc: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 7/8] usb: musb: Allow multiple glue layers to be built in
       [not found] ` <1416855906-13931-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
                     ` (3 preceding siblings ...)
  2014-11-24 19:05   ` [PATCH 6/8] usb: musb: Pass fifo_mode in platform data Tony Lindgren
@ 2014-11-24 19:05   ` Tony Lindgren
  4 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:05 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA

There's no reason any longer to keep it as a choice now that
the IO access has been fixed.

Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/usb/musb/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 06cc5d6..9d68372 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -58,8 +58,7 @@ config USB_MUSB_DUAL_ROLE
 
 endchoice
 
-choice
-	prompt "Platform Glue Layer"
+comment "Platform Glue Layer"
 
 config USB_MUSB_DAVINCI
 	tristate "DaVinci"
@@ -101,8 +100,6 @@ config USB_MUSB_JZ4740
 	depends on USB_MUSB_GADGET
 	depends on USB_OTG_BLACKLIST_HUB
 
-endchoice

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 8/8] usb: musb: Use IS_ENABLED for tusb6010
  2014-11-24 19:04 [PATCH 0/8] Allow multiple MUSB glue layers to be built in Tony Lindgren
                   ` (2 preceding siblings ...)
       [not found] ` <1416855906-13931-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2014-11-24 19:05 ` Tony Lindgren
  3 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:05 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-omap

This removes the ifdef clutter a bit and saves few lines.

It also makes it easier to detect the remaining places
where we have conditional building of code done based
on if defined for things like DMA.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/musb/musb_core.c | 2 +-
 drivers/usb/musb/musb_core.h | 9 +++------
 drivers/usb/musb/musb_regs.h | 3 ---
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0875365..0f44676 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1527,7 +1527,7 @@ static int musb_core_init(u16 musb_type, struct musb *musb)
 		struct musb_hw_ep	*hw_ep = musb->endpoints + i;
 
 		hw_ep->fifo = musb->io.fifo_offset(i) + mbase;
-#if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE)
+#if IS_ENABLED(CONFIG_USB_MUSB_TUSB6010)
 		if (musb->io.quirks & MUSB_IN_TUSB) {
 			hw_ep->fifo_async = musb->async + 0x400 + musb->io.fifo_offset(i);
 			hw_ep->fifo_sync = musb->sync + 0x400 + musb->io.fifo_offset(i);
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 02f62cb..841476c 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -216,8 +216,7 @@ struct musb_hw_ep {
 	void __iomem		*fifo;
 	void __iomem		*regs;
 
-#if defined(CONFIG_USB_MUSB_TUSB6010) || \
-	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
+#if IS_ENABLED(CONFIG_USB_MUSB_TUSB6010)
 	void __iomem		*conf;
 #endif
 
@@ -234,8 +233,7 @@ struct musb_hw_ep {
 	struct dma_channel	*tx_channel;
 	struct dma_channel	*rx_channel;
 
-#if defined(CONFIG_USB_MUSB_TUSB6010) || \
-	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
+#if IS_ENABLED(CONFIG_USB_MUSB_TUSB6010)
 	/* TUSB has "asynchronous" and "synchronous" dma modes */
 	dma_addr_t		fifo_async;
 	dma_addr_t		fifo_sync;
@@ -339,8 +337,7 @@ struct musb {
 	void __iomem		*ctrl_base;
 	void __iomem		*mregs;
 
-#if defined(CONFIG_USB_MUSB_TUSB6010) || \
-	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
+#if IS_ENABLED(CONFIG_USB_MUSB_TUSB6010)
 	dma_addr_t		async;
 	dma_addr_t		sync;
 	void __iomem		*sync_va;
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
index 92b4c3d..11f0be0 100644
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
@@ -287,10 +287,7 @@
 #define MUSB_FIFOSIZE		0x0F
 #define MUSB_CONFIGDATA		MUSB_FIFOSIZE	/* Re-used for EP0 */
 
-#if defined(CONFIG_USB_MUSB_TUSB6010) ||	\
-	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
 #include "tusb6010.h"		/* Needed "only" for TUSB_EP0_CONF */
-#endif
 
 #define MUSB_TXCSR_MODE			0x2000
 
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/8] usb: musb: Change to use new IO access
  2014-11-24 19:05   ` [PATCH 4/8] usb: musb: Change to use new IO access Tony Lindgren
@ 2014-11-24 19:12     ` Felipe Balbi
  2014-11-24 19:26       ` Tony Lindgren
       [not found]     ` <1416855906-13931-5-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  1 sibling, 1 reply; 18+ messages in thread
From: Felipe Balbi @ 2014-11-24 19:12 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Felipe Balbi, linux-usb, linux-omap, Fabio Baltieri, Lee Jones,
	Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

On Mon, Nov 24, 2014 at 11:05:02AM -0800, Tony Lindgren wrote:
> @@ -312,10 +345,40 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
>  		ioread8_rep(fifo, dst, len);
>  	}
>  }
> -#endif
>  
> -#endif	/* normal PIO */
> +/*
> + * Old style IO functions
> + */
> +u8 (*musb_readb)(const void __iomem *addr, unsigned offset);
> +EXPORT_SYMBOL(musb_readb);
> +
> +void (*musb_writeb)(void __iomem *addr, unsigned offset, u8 data);
> +EXPORT_SYMBOL(musb_writeb);
>  
> +u16 (*musb_readw)(const void __iomem *addr, unsigned offset);
> +EXPORT_SYMBOL(musb_readw);
> +
> +void (*musb_writew)(void __iomem *addr, unsigned offset, u16 data);
> +EXPORT_SYMBOL(musb_writew);
> +
> +u32 (*musb_readl)(const void __iomem *addr, unsigned offset);
> +EXPORT_SYMBOL(musb_readl);
> +
> +void (*musb_writel)(void __iomem *addr, unsigned offset, u32 data);
> +EXPORT_SYMBOL(musb_writel);

let's make all these _GPL()

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/8] usb: musb: Change to use new IO access
  2014-11-24 19:12     ` Felipe Balbi
@ 2014-11-24 19:26       ` Tony Lindgren
  0 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 19:26 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb, linux-omap, Fabio Baltieri, Lee Jones, Linus Walleij

* Felipe Balbi <balbi@ti.com> [141124 11:13]:
> On Mon, Nov 24, 2014 at 11:05:02AM -0800, Tony Lindgren wrote:
> > @@ -312,10 +345,40 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
> >  		ioread8_rep(fifo, dst, len);
> >  	}
> >  }
> > -#endif
> >  
> > -#endif	/* normal PIO */
> > +/*
> > + * Old style IO functions
> > + */
> > +u8 (*musb_readb)(const void __iomem *addr, unsigned offset);
> > +EXPORT_SYMBOL(musb_readb);
> > +
> > +void (*musb_writeb)(void __iomem *addr, unsigned offset, u8 data);
> > +EXPORT_SYMBOL(musb_writeb);
> >  
> > +u16 (*musb_readw)(const void __iomem *addr, unsigned offset);
> > +EXPORT_SYMBOL(musb_readw);
> > +
> > +void (*musb_writew)(void __iomem *addr, unsigned offset, u16 data);
> > +EXPORT_SYMBOL(musb_writew);
> > +
> > +u32 (*musb_readl)(const void __iomem *addr, unsigned offset);
> > +EXPORT_SYMBOL(musb_readl);
> > +
> > +void (*musb_writel)(void __iomem *addr, unsigned offset, u32 data);
> > +EXPORT_SYMBOL(musb_writel);
> 
> let's make all these _GPL()

Sure.

Tony


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/8] usb: musb: Change end point selection to use new IO access
  2014-11-24 19:05   ` [PATCH 5/8] usb: musb: Change end point selection " Tony Lindgren
@ 2014-11-24 23:38     ` Apelete Seketeli
  2014-11-24 23:52       ` Tony Lindgren
  2014-11-28 13:50     ` Linus Walleij
  1 sibling, 1 reply; 18+ messages in thread
From: Apelete Seketeli @ 2014-11-24 23:38 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Felipe Balbi, linux-usb, linux-omap, Fabio Baltieri, Lee Jones,
	Linus Walleij, Lars-Peter Clausen

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 <apelete@seketeli.net>

> Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Apelete Seketeli <apelete@seketeli.net>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  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 {
> +		musb->io.ep_offset = musb_flat_ep_offset;
> +		musb->io.ep_select = musb_flat_ep_select;
> +	}
> +
>  	if (musb->ops->fifo_offset)
>  		musb->io.fifo_offset = musb->ops->fifo_offset;
>  	else
> diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
> index 7c7f38c..02f62cb 100644
> --- a/drivers/usb/musb/musb_core.h
> +++ b/drivers/usb/musb/musb_core.h
> @@ -124,41 +124,6 @@ enum musb_g_ep0_state {
>  #define OTG_TIME_A_AIDL_BDIS	200		/* min 200 msec */
>  #define OTG_TIME_B_ASE0_BRST	100		/* min 3.125 ms */
>  
> -
> -/*************************** REGISTER ACCESS ********************************/
> -
> -/* Endpoint registers (other than dynfifo setup) can be accessed either
> - * directly with the "flat" model, or after setting up an index register.
> - */
> -
> -#if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_SOC_OMAP2430) \
> -		|| defined(CONFIG_SOC_OMAP3430) || defined(CONFIG_BLACKFIN) \
> -		|| defined(CONFIG_ARCH_OMAP4)
> -/* REVISIT indexed access seemed to
> - * misbehave (on DaVinci) for at least peripheral IN ...
> - */
> -#define	MUSB_FLAT_REG
> -#endif
> -
> -/* TUSB mapping: "flat" plus ep0 special cases */
> -#if defined(CONFIG_USB_MUSB_TUSB6010) || \
> -	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
> -#define musb_ep_select(_mbase, _epnum) \
> -	musb_writeb((_mbase), MUSB_INDEX, (_epnum))
> -#define	MUSB_EP_OFFSET			MUSB_TUSB_OFFSET
> -
> -/* "flat" mapping: each endpoint has its own i/o address */
> -#elif	defined(MUSB_FLAT_REG)
> -#define musb_ep_select(_mbase, _epnum)	(((void)(_mbase)), ((void)(_epnum)))
> -#define	MUSB_EP_OFFSET			MUSB_FLAT_OFFSET
> -
> -/* "indexed" mapping: INDEX register controls register bank select */
> -#else
> -#define musb_ep_select(_mbase, _epnum) \
> -	musb_writeb((_mbase), MUSB_INDEX, (_epnum))
> -#define	MUSB_EP_OFFSET			MUSB_INDEXED_OFFSET
> -#endif
> -
>  /****************************** FUNCTIONS ********************************/
>  
>  #define MUSB_HST_MODE(_musb)\
> @@ -514,7 +479,7 @@ static inline int musb_read_fifosize(struct musb *musb,
>  	u8 reg = 0;
>  
>  	/* read from core using indexed model */
> -	reg = musb_readb(mbase, MUSB_EP_OFFSET(epnum, MUSB_FIFOSIZE));
> +	reg = musb_readb(mbase, musb->io.ep_offset(epnum, MUSB_FIFOSIZE));
>  	/* 0's returned when no more endpoints */
>  	if (!reg)
>  		return -ENODEV;
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 48bc09e..b7f2efc 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -636,6 +636,7 @@ static int dsps_musb_reset(struct musb *musb)
>  }
>  
>  static struct musb_platform_ops dsps_ops = {
> +	.quirks		= MUSB_INDEXED_EP,
>  	.init		= dsps_musb_init,
>  	.exit		= dsps_musb_exit,
>  
> diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h
> index 14aa217..8a57a6f 100644
> --- a/drivers/usb/musb/musb_io.h
> +++ b/drivers/usb/musb/musb_io.h
> @@ -37,6 +37,8 @@
>  
>  #include <linux/io.h>
>  
> +#define musb_ep_select(_mbase, _epnum)	musb->io.ep_select((_mbase), (_epnum))
> +
>  /**
>   * struct musb_io - IO functions for MUSB
>   * @quirks:	platform specific flags
> diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
> index b2b1f73..92b4c3d 100644
> --- a/drivers/usb/musb/musb_regs.h
> +++ b/drivers/usb/musb/musb_regs.h
> @@ -287,19 +287,8 @@
>  #define MUSB_FIFOSIZE		0x0F
>  #define MUSB_CONFIGDATA		MUSB_FIFOSIZE	/* Re-used for EP0 */
>  
> -/* Offsets to endpoint registers in indexed model (using INDEX register) */
> -#define MUSB_INDEXED_OFFSET(_epnum, _offset)	\
> -	(0x10 + (_offset))
> -
> -/* Offsets to endpoint registers in flat models */
> -#define MUSB_FLAT_OFFSET(_epnum, _offset)	\
> -	(0x100 + (0x10*(_epnum)) + (_offset))
> -
>  #if defined(CONFIG_USB_MUSB_TUSB6010) ||	\
>  	defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
> -/* TUSB6010 EP0 configuration register is special */
> -#define MUSB_TUSB_OFFSET(_epnum, _offset)	\
> -	(0x10 + _offset)
>  #include "tusb6010.h"		/* Needed "only" for TUSB_EP0_CONF */
>  #endif
>  
> diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
> index e8e9f9a..ab7ec09 100644
> --- a/drivers/usb/musb/musbhsdma.c
> +++ b/drivers/usb/musb/musbhsdma.c
> @@ -195,6 +195,7 @@ static int dma_channel_abort(struct dma_channel *channel)
>  {
>  	struct musb_dma_channel *musb_channel = channel->private_data;
>  	void __iomem *mbase = musb_channel->controller->base;
> +	struct musb *musb = musb_channel->controller->private_data;
>  
>  	u8 bchannel = musb_channel->idx;
>  	int offset;
> @@ -202,7 +203,7 @@ static int dma_channel_abort(struct dma_channel *channel)
>  
>  	if (channel->status == MUSB_DMA_STATUS_BUSY) {
>  		if (musb_channel->transmit) {
> -			offset = MUSB_EP_OFFSET(musb_channel->epnum,
> +			offset = musb->io.ep_offset(musb_channel->epnum,
>  						MUSB_TXCSR);
>  
>  			/*
> @@ -215,7 +216,7 @@ static int dma_channel_abort(struct dma_channel *channel)
>  			csr &= ~MUSB_TXCSR_DMAMODE;
>  			musb_writew(mbase, offset, csr);
>  		} else {
> -			offset = MUSB_EP_OFFSET(musb_channel->epnum,
> +			offset = musb->io.ep_offset(musb_channel->epnum,
>  						MUSB_RXCSR);
>  
>  			csr = musb_readw(mbase, offset);
> @@ -326,7 +327,7 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)
>  					    (musb_channel->max_packet_sz - 1)))
>  				    ) {
>  					u8  epnum  = musb_channel->epnum;
> -					int offset = MUSB_EP_OFFSET(epnum,
> +					int offset = musb->io.ep_offset(epnum,
>  								    MUSB_TXCSR);
>  					u16 txcsr;
>  
> diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
> index 38efebc..fe69bad 100644
> --- a/drivers/usb/musb/tusb6010.c
> +++ b/drivers/usb/musb/tusb6010.c
> @@ -131,6 +131,17 @@ static u32 tusb_fifo_offset(u8 epnum)
>  	return 0x200 + (epnum * 0x20);
>  }
>  
> +static u32 tusb_ep_offset(u8 epnum, u16 offset)
> +{
> +	return 0x10 + offset;
> +}
> +
> +/* TUSB mapping: "flat" plus ep0 special cases */
> +static void tusb_ep_select(void __iomem *mbase, u8 epnum)
> +{
> +	musb_writeb(mbase, MUSB_INDEX, epnum);
> +}
> +
>  /*
>   * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum.
>   */
> @@ -1174,6 +1185,8 @@ static const struct musb_platform_ops tusb_ops = {
>  	.init		= tusb_musb_init,
>  	.exit		= tusb_musb_exit,
>  
> +	.ep_offset	= tusb_ep_offset,
> +	.ep_select	= tusb_ep_select,
>  	.fifo_offset	= tusb_fifo_offset,
>  	.readb		= tusb_readb,
>  	.writeb		= tusb_writeb,
> diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
> index dc666e9..c170501 100644
> --- a/drivers/usb/musb/ux500.c
> +++ b/drivers/usb/musb/ux500.c
> @@ -188,6 +188,7 @@ static int ux500_musb_exit(struct musb *musb)
>  }
>  
>  static const struct musb_platform_ops ux500_ops = {
> +	.quirks		= MUSB_INDEXED_EP,
>  	.init		= ux500_musb_init,
>  	.exit		= ux500_musb_exit,
>  
> -- 
> 2.1.3
> 

-- 
        Apelete

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 6/8] usb: musb: Pass fifo_mode in platform data
  2014-11-24 19:05   ` [PATCH 6/8] usb: musb: Pass fifo_mode in platform data Tony Lindgren
@ 2014-11-24 23:40     ` Apelete Seketeli
  2014-11-28 13:40     ` Linus Walleij
  1 sibling, 0 replies; 18+ messages in thread
From: Apelete Seketeli @ 2014-11-24 23:40 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Felipe Balbi, linux-usb, linux-omap, Fabio Baltieri, Lee Jones,
	Linus Walleij, Lars-Peter Clausen

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 <apelete@seketeli.net>

> Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Apelete Seketeli <apelete@seketeli.net>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/8] usb: musb: Change end point selection to use new IO access
  2014-11-24 23:38     ` Apelete Seketeli
@ 2014-11-24 23:52       ` Tony Lindgren
  2014-11-25 15:02         ` Lars-Peter Clausen
  0 siblings, 1 reply; 18+ messages in thread
From: Tony Lindgren @ 2014-11-24 23:52 UTC (permalink / raw)
  To: Apelete Seketeli
  Cc: Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Fabio Baltieri, Lee Jones,
	Linus Walleij, Lars-Peter Clausen

* Apelete Seketeli <apelete-fIDRvF7C5ezk1uMJSBkQmQ@public.gmane.org> [141124 15:40]:
> 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.

Great that's good to hear and thanks for testing.

Doing the DMA patches here right now.. For the DMA, I've set up
JZ4740 to use the MUSB_DMA_INVENTRA option by default, is that OK
or do you have some other DMA hardware on it?

If MUSB_DMA_INVENTRA does not work, and you don't have other DMA
hardware on it, we can pass MUSB_DMA_INVENTRA and leave the DMA
function pointers empty, and then the driver will bail out during
init unless the option for CONFIG_MUSB_PIO_ONLY is set.

Just that I could not figure out if that's the one to use grepping
the *_defconfig files.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/8] usb: musb: Change to use new IO access
       [not found]     ` <1416855906-13931-5-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2014-11-25  9:46       ` Linus Walleij
  0 siblings, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2014-11-25  9:46 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA, Linux-OMAP,
	Fabio Baltieri, Lee Jones

On Mon, Nov 24, 2014 at 8:05 PM, Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote:

> Change to use new IO access. This allows us to build in multiple
> MUSB glue layers.
>
> Cc: Fabio Baltieri <fabio.baltieri-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/8] usb: musb: Change end point selection to use new IO access
  2014-11-24 23:52       ` Tony Lindgren
@ 2014-11-25 15:02         ` Lars-Peter Clausen
  0 siblings, 0 replies; 18+ messages in thread
From: Lars-Peter Clausen @ 2014-11-25 15:02 UTC (permalink / raw)
  To: Tony Lindgren, Apelete Seketeli
  Cc: Felipe Balbi, linux-usb, linux-omap, Fabio Baltieri, Lee Jones,
	Linus Walleij

On 11/25/2014 12:52 AM, Tony Lindgren wrote:
> * Apelete Seketeli <apelete@seketeli.net> [141124 15:40]:
>> 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.
>
> Great that's good to hear and thanks for testing.
>
> Doing the DMA patches here right now.. For the DMA, I've set up
> JZ4740 to use the MUSB_DMA_INVENTRA option by default, is that OK
> or do you have some other DMA hardware on it?
>
> If MUSB_DMA_INVENTRA does not work, and you don't have other DMA
> hardware on it, we can pass MUSB_DMA_INVENTRA and leave the DMA
> function pointers empty, and then the driver will bail out during
> init unless the option for CONFIG_MUSB_PIO_ONLY is set.

Yea... so according to the datasheet there is no DMA support, or at least it 
is not documented in the datasheet's description of the USB core. There is a 
vendor driver for the core which has ifdefs to enable DMA which looks like 
MUSB_DMA_INVENTRA, but I think we never really go that to work too well. So 
the current configuration is to use only PIO.

- Lars


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 6/8] usb: musb: Pass fifo_mode in platform data
  2014-11-24 19:05   ` [PATCH 6/8] usb: musb: Pass fifo_mode in platform data Tony Lindgren
  2014-11-24 23:40     ` Apelete Seketeli
@ 2014-11-28 13:40     ` Linus Walleij
  1 sibling, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2014-11-28 13:40 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Felipe Balbi, linux-usb, Linux-OMAP, Fabio Baltieri, Lee Jones,
	Apelete Seketeli, Lars-Peter Clausen

On Mon, Nov 24, 2014 at 8:05 PM, Tony Lindgren <tony@atomide.com> wrote:

> This allows setting the correct fifo_mode when multiple
> MUSB glue layers are built-in.
>
> Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Apelete Seketeli <apelete@seketeli.net>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/8] usb: musb: Change end point selection to use new IO access
  2014-11-24 19:05   ` [PATCH 5/8] usb: musb: Change end point selection " Tony Lindgren
  2014-11-24 23:38     ` Apelete Seketeli
@ 2014-11-28 13:50     ` Linus Walleij
  1 sibling, 0 replies; 18+ messages in thread
From: Linus Walleij @ 2014-11-28 13:50 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Felipe Balbi, linux-usb, Linux-OMAP, Fabio Baltieri, Lee Jones,
	Apelete Seketeli, Lars-Peter Clausen

On Mon, Nov 24, 2014 at 8:05 PM, Tony Lindgren <tony@atomide.com> wrote:

> This allows the endpoints to work when multiple MUSB glue
> layers are built in.
>
> Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Apelete Seketeli <apelete@seketeli.net>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-11-28 13:50 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-24 19:04 [PATCH 0/8] Allow multiple MUSB glue layers to be built in Tony Lindgren
2014-11-24 19:05 ` [PATCH 2/8] usb: musb: Populate new IO functions for tusb6010 Tony Lindgren
2014-11-24 19:05 ` [PATCH 3/8] usb: musb: Populate new IO functions for blackfin Tony Lindgren
     [not found] ` <1416855906-13931-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2014-11-24 19:04   ` [PATCH 1/8] usb: musb: Add function pointers for IO access functions Tony Lindgren
2014-11-24 19:05   ` [PATCH 4/8] usb: musb: Change to use new IO access Tony Lindgren
2014-11-24 19:12     ` Felipe Balbi
2014-11-24 19:26       ` Tony Lindgren
     [not found]     ` <1416855906-13931-5-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2014-11-25  9:46       ` Linus Walleij
2014-11-24 19:05   ` [PATCH 5/8] usb: musb: Change end point selection " Tony Lindgren
2014-11-24 23:38     ` Apelete Seketeli
2014-11-24 23:52       ` Tony Lindgren
2014-11-25 15:02         ` Lars-Peter Clausen
2014-11-28 13:50     ` Linus Walleij
2014-11-24 19:05   ` [PATCH 6/8] usb: musb: Pass fifo_mode in platform data Tony Lindgren
2014-11-24 23:40     ` Apelete Seketeli
2014-11-28 13:40     ` Linus Walleij
2014-11-24 19:05   ` [PATCH 7/8] usb: musb: Allow multiple glue layers to be built in Tony Lindgren
2014-11-24 19:05 ` [PATCH 8/8] usb: musb: Use IS_ENABLED for tusb6010 Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.