[kernel] r22683 - in dists/jessie/linux/debian: . patches patches/bugfix/arm patches/features/all/musb

Ben Hutchings benh at moszumanska.debian.org
Sun May 24 04:38:54 UTC 2015


Author: benh
Date: Sun May 24 04:38:53 2015
New Revision: 22683

Log:
[armhf] musb: Backport upstream changes to support multiplatform configuration properly (Closes: #773400)

Added:
   dists/jessie/linux/debian/patches/features/all/musb/
   dists/jessie/linux/debian/patches/features/all/musb/0001-usb-musb-add-function-pointers-for-io-access-functio.patch
   dists/jessie/linux/debian/patches/features/all/musb/0002-usb-musb-populate-new-io-functions-for-tusb6010.patch
   dists/jessie/linux/debian/patches/features/all/musb/0003-usb-musb-populate-new-io-functions-for-blackfin.patch
   dists/jessie/linux/debian/patches/features/all/musb/0004-usb-musb-change-to-use-new-io-access.patch
   dists/jessie/linux/debian/patches/features/all/musb/0005-usb-musb-change-end-point-selection-to-use-new-io-ac.patch
   dists/jessie/linux/debian/patches/features/all/musb/0006-usb-musb-pass-fifo_mode-in-platform-data.patch
   dists/jessie/linux/debian/patches/features/all/musb/0007-usb-musb-allow-multiple-glue-layers-to-be-built-in.patch
   dists/jessie/linux/debian/patches/features/all/musb/0008-usb-musb-use-is_enabled-for-tusb6010.patch
   dists/jessie/linux/debian/patches/features/all/musb/0009-usb-musb-fix-order-of-conditions-for-assigning-end-p.patch
Deleted:
   dists/jessie/linux/debian/patches/bugfix/arm/omap-musb-choice.patch
Modified:
   dists/jessie/linux/debian/changelog
   dists/jessie/linux/debian/patches/series

Modified: dists/jessie/linux/debian/changelog
==============================================================================
--- dists/jessie/linux/debian/changelog	Sat May 23 17:26:17 2015	(r22682)
+++ dists/jessie/linux/debian/changelog	Sun May 24 04:38:53 2015	(r22683)
@@ -173,6 +173,8 @@
     (regression in 3.16.7-ckt11)
   * cdc_ncm: Fix tx_bytes statistics (regression in 3.16.7-ckt11)
   * [x86] e1000e: Add support for Sunrise Point (i219) (Closes: #784546)
+  * [armhf] musb: Backport upstream changes to support multiplatform
+    configuration properly (Closes: #773400)
 
   [ Ian Campbell ]
   * [armhf] Enable support for Freescale SNVS RTC. (Closes: #782364)

Added: dists/jessie/linux/debian/patches/features/all/musb/0001-usb-musb-add-function-pointers-for-io-access-functio.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0001-usb-musb-add-function-pointers-for-io-access-functio.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,125 @@
+From: Tony Lindgren <tony at atomide.com>
+Date: Mon, 24 Nov 2014 11:04:59 -0800
+Subject: [1/8] usb: musb: Add function pointers for IO access functions
+Origin: https://git.kernel.org/linus/5450ac88dcf09b258d0404b45316583806799ef4
+Bug-Debian: https://bugs.debian.org/773400
+
+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 at atomide.com>
+Signed-off-by: Felipe Balbi <balbi at ti.com>
+---
+ drivers/usb/musb/musb_core.h | 40 ++++++++++++++++++++++++++++++++++++++++
+ drivers/usb/musb/musb_io.h   | 18 ++++++++++++++++++
+ 2 files changed, 58 insertions(+)
+
+--- 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);
+ 	void	(*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;
+ 
+--- 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 */

Added: dists/jessie/linux/debian/patches/features/all/musb/0002-usb-musb-populate-new-io-functions-for-tusb6010.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0002-usb-musb-populate-new-io-functions-for-tusb6010.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,75 @@
+From: Tony Lindgren <tony at atomide.com>
+Date: Mon, 24 Nov 2014 11:05:00 -0800
+Subject: [2/8] usb: musb: Populate new IO functions for tusb6010
+Origin: https://git.kernel.org/linus/9d506fc6d2cdafdec5ce605036f5eeec9fd59657
+Bug-Debian: https://bugs.debian.org/773400
+
+Let's populate the new IO functions for tusb6010 but not use
+them yet.
+
+Signed-off-by: Tony Lindgren <tony at atomide.com>
+Signed-off-by: Felipe Balbi <balbi at ti.com>
+---
+ drivers/usb/musb/tusb6010.c | 41 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 41 insertions(+)
+
+--- a/drivers/usb/musb/tusb6010.c
++++ b/drivers/usb/musb/tusb6010.c
+@@ -125,6 +125,41 @@ static void tusb_wbus_quirk(struct musb
+ 	}
+ }
+ 
++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.
+@@ -1134,9 +1169,15 @@ static int tusb_musb_exit(struct musb *m
+ }
+ 
+ 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,
+ 

Added: dists/jessie/linux/debian/patches/features/all/musb/0003-usb-musb-populate-new-io-functions-for-blackfin.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0003-usb-musb-populate-new-io-functions-for-blackfin.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,76 @@
+From: Tony Lindgren <tony at atomide.com>
+Date: Mon, 24 Nov 2014 11:05:01 -0800
+Subject: [3/8] usb: musb: Populate new IO functions for blackfin
+Origin: https://git.kernel.org/linus/cc92f6818f6e771d02ab5025262760d1a21aae95
+Bug-Debian: https://bugs.debian.org/773400
+
+Populate new IO functions for blackfin
+
+Cc: Bryan Wu <cooloney at gmail.com>
+Signed-off-by: Tony Lindgren <tony at atomide.com>
+Signed-off-by: Felipe Balbi <balbi at ti.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 f23ce40b..ed1524a 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,
+ 

Added: dists/jessie/linux/debian/patches/features/all/musb/0004-usb-musb-change-to-use-new-io-access.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0004-usb-musb-change-to-use-new-io-access.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,442 @@
+From: Tony Lindgren <tony at atomide.com>
+Date: Mon, 24 Nov 2014 11:05:02 -0800
+Subject: [4/8] usb: musb: Change to use new IO access
+Origin: https://git.kernel.org/linus/1b40fc57a517878cf4c2e16ce29cc9a066dc1064
+Bug-Debian: https://bugs.debian.org/773400
+
+Change to use new IO access. This allows us to build in multiple
+MUSB glue layers.
+
+[ balbi at ti.com : switch to EXPORT_SYMBOL_GPL()
+	fix long lines ]
+
+Cc: Fabio Baltieri <fabio.baltieri at linaro.org>
+Cc: Lee Jones <lee.jones at linaro.org>
+Cc: Linus Walleij <linus.walleij at linaro.org>
+Signed-off-by: Tony Lindgren <tony at atomide.com>
+Signed-off-by: Felipe Balbi <balbi at ti.com>
+---
+ drivers/usb/musb/am35x.c     |   3 +-
+ drivers/usb/musb/blackfin.c  |   8 +--
+ drivers/usb/musb/musb_core.c | 143 ++++++++++++++++++++++++++++++++++++++-----
+ 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, 146 insertions(+), 120 deletions(-)
+
+--- a/drivers/usb/musb/am35x.c
++++ b/drivers/usb/musb/am35x.c
+@@ -407,7 +407,7 @@ static int am35x_musb_exit(struct 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;
+@@ -440,6 +440,7 @@ static const struct musb_platform_ops am
+ 	.init		= am35x_musb_init,
+ 	.exit		= am35x_musb_exit,
+ 
++	.read_fifo	= am35x_read_fifo,
+ 	.enable		= am35x_musb_enable,
+ 	.disable	= am35x_musb_disable,
+ 
+--- a/drivers/usb/musb/blackfin.c
++++ b/drivers/usb/musb/blackfin.c
+@@ -71,7 +71,7 @@ static void binf_writel(void __iomem *ad
+ /*
+  * 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 *
+ /*
+  * 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 bf
+ 	.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,
+ 
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -225,12 +225,46 @@ static struct usb_phy_io_ops musb_ulpi_a
+ 
+ /*-------------------------------------------------------------------------*/
+ 
+-#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;
+@@ -271,11 +305,10 @@ void musb_write_fifo(struct musb_hw_ep *
+ 	}
+ }
+ 
+-#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;
+@@ -313,10 +346,40 @@ void musb_read_fifo(struct musb_hw_ep *h
+ 		ioread8_rep(fifo, dst, len);
+ 	}
+ }
+-#endif
+ 
+-#endif	/* normal PIO */
++/*
++ * Old style IO functions
++ */
++u8 (*musb_readb)(const void __iomem *addr, unsigned offset);
++EXPORT_SYMBOL_GPL(musb_readb);
++
++void (*musb_writeb)(void __iomem *addr, unsigned offset, u8 data);
++EXPORT_SYMBOL_GPL(musb_writeb);
++
++u16 (*musb_readw)(const void __iomem *addr, unsigned offset);
++EXPORT_SYMBOL_GPL(musb_readw);
+ 
++void (*musb_writew)(void __iomem *addr, unsigned offset, u16 data);
++EXPORT_SYMBOL_GPL(musb_writew);
++
++u32 (*musb_readl)(const void __iomem *addr, unsigned offset);
++EXPORT_SYMBOL_GPL(musb_readl);
++
++void (*musb_writel)(void __iomem *addr, unsigned offset, u32 data);
++EXPORT_SYMBOL_GPL(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,22 @@ static int musb_core_init(u16 musb_type,
+ 	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 (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);
++			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;
+@@ -1907,6 +1975,18 @@ musb_init_controller(struct device *dev,
+ 	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;
++
+ 	/* We need musb_read/write functions initialized for PM */
+ 	pm_runtime_use_autosuspend(musb->controller);
+ 	pm_runtime_set_autosuspend_delay(musb->controller, 200);
+@@ -1934,6 +2014,37 @@ musb_init_controller(struct device *dev,
+ 		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;
+--- 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
+--- a/drivers/usb/musb/musb_regs.h
++++ b/drivers/usb/musb/musb_regs.h
+@@ -233,14 +233,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
+  */
+@@ -473,10 +465,6 @@ static inline u8  musb_read_txhubport(vo
+ #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
+  */
+--- a/drivers/usb/musb/tusb6010.c
++++ b/drivers/usb/musb/tusb6010.c
+@@ -207,7 +207,7 @@ static inline void tusb_fifo_read_unalig
+ 	}
+ }
+ 
+-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;
+@@ -257,7 +257,7 @@ void musb_write_fifo(struct musb_hw_ep *
+ 		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;
+@@ -1176,8 +1176,8 @@ static const struct musb_platform_ops tu
+ 	.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,
+ 
+--- a/drivers/usb/musb/ux500_dma.c
++++ b/drivers/usb/musb/ux500_dma.c
+@@ -91,9 +91,9 @@ static bool ux500_configure_channel(stru
+ 	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%llu, len=%d is_tx=%d\n",

Added: dists/jessie/linux/debian/patches/features/all/musb/0005-usb-musb-change-end-point-selection-to-use-new-io-ac.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0005-usb-musb-change-end-point-selection-to-use-new-io-ac.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,293 @@
+From: Tony Lindgren <tony at atomide.com>
+Date: Mon, 24 Nov 2014 11:05:03 -0800
+Subject: [5/8] usb: musb: Change end point selection to use new IO access
+Origin: https://git.kernel.org/linus/d026e9c76aac3632af174cf02d5c94defa5e6026
+Bug-Debian: https://bugs.debian.org/773400
+
+This allows the endpoints to work when multiple MUSB glue
+layers are built in.
+
+Cc: Fabio Baltieri <fabio.baltieri at linaro.org>
+Cc: Lee Jones <lee.jones at linaro.org>
+Cc: Lars-Peter Clausen <lars at metafoo.de>
+Acked-by: Linus Walleij <linus.walleij at linaro.org>
+Acked-by: Apelete Seketeli <apelete at seketeli.net>
+Signed-off-by: Tony Lindgren <tony at atomide.com>
+Signed-off-by: Felipe Balbi <balbi at ti.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(-)
+
+--- a/drivers/usb/musb/am35x.c
++++ b/drivers/usb/musb/am35x.c
+@@ -437,6 +437,7 @@ static void am35x_read_fifo(struct musb_
+ }
+ 
+ static const struct musb_platform_ops am35x_ops = {
++	.quirks		= MUSB_INDEXED_EP,
+ 	.init		= am35x_musb_init,
+ 	.exit		= am35x_musb_exit,
+ 
+--- a/drivers/usb/musb/da8xx.c
++++ b/drivers/usb/musb/da8xx.c
+@@ -458,6 +458,7 @@ static int da8xx_musb_exit(struct musb *
+ }
+ 
+ static const struct musb_platform_ops da8xx_ops = {
++	.quirks		= MUSB_INDEXED_EP,
+ 	.init		= da8xx_musb_init,
+ 	.exit		= da8xx_musb_exit,
+ 
+--- a/drivers/usb/musb/jz4740.c
++++ b/drivers/usb/musb/jz4740.c
+@@ -104,6 +104,7 @@ static int jz4740_musb_exit(struct musb
+ }
+ 
+ static const struct musb_platform_ops jz4740_musb_ops = {
++	.quirks		= MUSB_INDEXED_EP,
+ 	.init		= jz4740_musb_init,
+ 	.exit		= jz4740_musb_exit,
+ };
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -230,6 +230,27 @@ static u32 musb_default_fifo_offset(u8 e
+ 	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);
+@@ -1537,7 +1558,7 @@ static int musb_core_init(u16 musb_type,
+ 		}
+ #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;
+@@ -2017,6 +2038,21 @@ musb_init_controller(struct device *dev,
+ 	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
+--- 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(str
+ 	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;
+--- a/drivers/usb/musb/musb_dsps.c
++++ b/drivers/usb/musb/musb_dsps.c
+@@ -546,6 +546,7 @@ static void dsps_musb_reset(struct musb
+ }
+ 
+ static struct musb_platform_ops dsps_ops = {
++	.quirks		= MUSB_INDEXED_EP,
+ 	.init		= dsps_musb_init,
+ 	.exit		= dsps_musb_exit,
+ 
+--- 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
+--- a/drivers/usb/musb/musb_regs.h
++++ b/drivers/usb/musb/musb_regs.h
+@@ -280,19 +280,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
+ 
+--- a/drivers/usb/musb/musbhsdma.c
++++ b/drivers/usb/musb/musbhsdma.c
+@@ -195,6 +195,7 @@ static int dma_channel_abort(struct dma_
+ {
+ 	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_
+ 
+ 	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_
+ 			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(in
+ 					    (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;
+ 
+--- a/drivers/usb/musb/tusb6010.c
++++ b/drivers/usb/musb/tusb6010.c
+@@ -130,6 +130,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.
+  */
+@@ -1173,6 +1184,8 @@ static const struct musb_platform_ops tu
+ 	.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,
+--- a/drivers/usb/musb/ux500.c
++++ b/drivers/usb/musb/ux500.c
+@@ -188,6 +188,7 @@ static int ux500_musb_exit(struct musb *
+ }
+ 
+ static const struct musb_platform_ops ux500_ops = {
++	.quirks		= MUSB_INDEXED_EP,
+ 	.init		= ux500_musb_init,
+ 	.exit		= ux500_musb_exit,
+ 

Added: dists/jessie/linux/debian/patches/features/all/musb/0006-usb-musb-pass-fifo_mode-in-platform-data.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0006-usb-musb-pass-fifo_mode-in-platform-data.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,101 @@
+From: Tony Lindgren <tony at atomide.com>
+Date: Mon, 24 Nov 2014 11:05:04 -0800
+Subject: [6/8] usb: musb: Pass fifo_mode in platform data
+Origin: https://git.kernel.org/linus/8a77f05aa39be879535f22a9757e703581fa1392
+Bug-Debian: https://bugs.debian.org/773400
+
+This allows setting the correct fifo_mode when multiple
+MUSB glue layers are built-in.
+
+Cc: Fabio Baltieri <fabio.baltieri at linaro.org>
+Cc: Lee Jones <lee.jones at linaro.org>
+Cc: Linus Walleij <linus.walleij at linaro.org>
+Cc: Lars-Peter Clausen <lars at metafoo.de>
+Acked-by: Apelete Seketeli <apelete at seketeli.net>
+Signed-off-by: Tony Lindgren <tony at atomide.com>
+Signed-off-by: Felipe Balbi <balbi at ti.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(-)
+
+--- a/drivers/usb/musb/blackfin.c
++++ b/drivers/usb/musb/blackfin.c
+@@ -474,6 +474,7 @@ static const struct musb_platform_ops bf
+ 	.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,
+--- a/drivers/usb/musb/da8xx.c
++++ b/drivers/usb/musb/da8xx.c
+@@ -462,6 +462,7 @@ static const struct musb_platform_ops da
+ 	.init		= da8xx_musb_init,
+ 	.exit		= da8xx_musb_exit,
+ 
++	.fifo_mode	= 2,
+ 	.enable		= da8xx_musb_enable,
+ 	.disable	= da8xx_musb_disable,
+ 
+--- a/drivers/usb/musb/jz4740.c
++++ b/drivers/usb/musb/jz4740.c
+@@ -105,6 +105,7 @@ static int jz4740_musb_exit(struct 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,
+ };
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -1116,21 +1116,7 @@ static void musb_shutdown(struct platfor
+  * 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);
+@@ -2053,6 +2039,11 @@ musb_init_controller(struct device *dev,
+ 		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
+--- a/drivers/usb/musb/ux500.c
++++ b/drivers/usb/musb/ux500.c
+@@ -191,6 +191,7 @@ static const struct musb_platform_ops ux
+ 	.quirks		= MUSB_INDEXED_EP,
+ 	.init		= ux500_musb_init,
+ 	.exit		= ux500_musb_exit,
++	.fifo_mode	= 5,
+ 
+ 	.set_vbus	= ux500_musb_set_vbus,
+ };

Added: dists/jessie/linux/debian/patches/features/all/musb/0007-usb-musb-allow-multiple-glue-layers-to-be-built-in.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0007-usb-musb-allow-multiple-glue-layers-to-be-built-in.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,38 @@
+From: Tony Lindgren <tony at atomide.com>
+Date: Mon, 24 Nov 2014 11:05:05 -0800
+Subject: [7/8] usb: musb: Allow multiple glue layers to be built in
+Origin: https://git.kernel.org/linus/82c02f58ba3a1ee0a067c0f90513e826d6152ba6
+Bug-Debian: https://bugs.debian.org/773400
+
+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 at atomide.com>
+Signed-off-by: Felipe Balbi <balbi at ti.com>
+---
+ 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
+-
+ config USB_MUSB_AM335X_CHILD
+ 	tristate
+ 

Added: dists/jessie/linux/debian/patches/features/all/musb/0008-usb-musb-use-is_enabled-for-tusb6010.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0008-usb-musb-use-is_enabled-for-tusb6010.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,76 @@
+From: Tony Lindgren <tony at atomide.com>
+Date: Mon, 24 Nov 2014 11:05:06 -0800
+Subject: [8/8] usb: musb: Use IS_ENABLED for tusb6010
+Origin: https://git.kernel.org/linus/ebf3992061db1f7b3aa093f37fb308acc74fbc82
+Bug-Debian: https://bugs.debian.org/773400
+
+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 at atomide.com>
+Signed-off-by: Felipe Balbi <balbi at ti.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(-)
+
+--- 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_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);
+--- 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;
+--- a/drivers/usb/musb/musb_regs.h
++++ b/drivers/usb/musb/musb_regs.h
+@@ -280,10 +280,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
+ 

Added: dists/jessie/linux/debian/patches/features/all/musb/0009-usb-musb-fix-order-of-conditions-for-assigning-end-p.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/musb/0009-usb-musb-fix-order-of-conditions-for-assigning-end-p.patch	Sun May 24 04:38:53 2015	(r22683)
@@ -0,0 +1,45 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Sun, 24 May 2015 04:21:46 +0100
+Subject: USB: musb: Fix order of conditions for assigning end point operations
+Bug-Debian: https://bugs.debian.org/773400
+
+Currently we always assign one of the two common implementations of
+ep_offset and ep_select operations, overwriting any platform-specific
+implementations.
+
+Fixes: d026e9c76aac ("usb: musb: Change end point selection to use new IO access")
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+ drivers/usb/musb/musb_core.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -2024,13 +2024,7 @@ musb_init_controller(struct device *dev,
+ 	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 */
++	/* Most 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;
+@@ -2039,6 +2033,12 @@ musb_init_controller(struct device *dev,
+ 		musb->io.ep_select = musb_flat_ep_select;
+ 	}
+ 
++	/* At least tusb6010 has its 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;
++
+ 	if (musb->ops->fifo_mode)
+ 		fifo_mode = musb->ops->fifo_mode;
+ 	else

Modified: dists/jessie/linux/debian/patches/series
==============================================================================
--- dists/jessie/linux/debian/patches/series	Sat May 23 17:26:17 2015	(r22682)
+++ dists/jessie/linux/debian/patches/series	Sun May 24 04:38:53 2015	(r22683)
@@ -64,7 +64,6 @@
 bugfix/all/access_once/0013-kernel-Change-ASSIGN_ONCE-val-x-to-WRITE_ONCE-x-val.patch
 
 # Arch bug fixes
-bugfix/arm/omap-musb-choice.patch
 bugfix/mips/disable-advansys.patch
 bugfix/arm/ixp4xx_iobe.patch
 bugfix/m68k/ethernat-kconfig.patch
@@ -591,6 +590,17 @@
 features/all/e1000e/0003-e1000e-remove-calls-to-ioremap-unmap-for-nvm-addr.patch
 features/all/e1000e/0004-e1000e-nvm-write-protect-access-removed-from-spt-hw.patch
 
+# Make musb multiplatform compatible
+features/all/musb/0001-usb-musb-add-function-pointers-for-io-access-functio.patch
+features/all/musb/0002-usb-musb-populate-new-io-functions-for-tusb6010.patch
+features/all/musb/0003-usb-musb-populate-new-io-functions-for-blackfin.patch
+features/all/musb/0004-usb-musb-change-to-use-new-io-access.patch
+features/all/musb/0005-usb-musb-change-end-point-selection-to-use-new-io-ac.patch
+features/all/musb/0006-usb-musb-pass-fifo_mode-in-platform-data.patch
+features/all/musb/0007-usb-musb-allow-multiple-glue-layers-to-be-built-in.patch
+features/all/musb/0008-usb-musb-use-is_enabled-for-tusb6010.patch
+features/all/musb/0009-usb-musb-fix-order-of-conditions-for-assigning-end-p.patch
+
 # Fix ABI changes
 debian/of-fix-abi-changes.patch
 debian/iovec-fix-abi-change-in-3.16.7-ckt1.patch



More information about the Kernel-svn-changes mailing list