[RFC 5/6] ci13xxx_udc: move hw_bank and hw_ep_max inside struct ci13xxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make global variables that are specific for each UDC instance part of
struct ci13xxx.

Signed-off-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
---
 drivers/usb/gadget/ci13xxx_udc.c |  365 +++++++++++++++++++-------------------
 drivers/usb/gadget/ci13xxx_udc.h |   12 ++
 2 files changed, 192 insertions(+), 185 deletions(-)

diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 9da5044..cad06e5 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -134,14 +134,6 @@ static int ffs_nr(u32 x)
 /******************************************************************************
  * HW block
  *****************************************************************************/
-/* register bank descriptor */
-static struct {
-	unsigned      lpm;    /* is LPM? */
-	void __iomem *abs;    /* bus map offset */
-	void __iomem *cap;    /* bus map offset + CAP offset */
-	void __iomem *op;     /* bus map offset + OP offset */
-	size_t        size;   /* bank size */
-} hw_bank;
 
 /* MSM specific */
 #define ABS_AHBBURST        (0x0090UL)
@@ -150,7 +142,7 @@ static struct {
 #define CAP_CAPLENGTH	    (0x000UL)
 #define CAP_HCCPARAMS	    (0x008UL)
 #define CAP_DCCPARAMS	    (0x024UL)
-#define ABS_TESTMODE        (hw_bank.lpm ? 0x0FCUL : 0x138UL)
+#define ABS_TESTMODE        (udc->hw_bank.lpm ? 0x0FCUL : 0x138UL)
 /* offset to CAPLENTGH (addr + data) */
 #define OP_USBCMD	    (0x000UL)
 #define OP_USBSTS	    (0x004UL)
@@ -159,17 +151,14 @@ static struct {
 #define OP_ENDPTLISTADDR    (0x018UL)
 #define OP_PORTSC	    (0x044UL)
 #define OP_DEVLC	    (0x084UL)
-#define OP_USBMODE	    (hw_bank.lpm ? 0x0C8UL : 0x068UL)
-#define OP_ENDPTSETUPSTAT   (hw_bank.lpm ? 0x0D8UL : 0x06CUL)
-#define OP_ENDPTPRIME	    (hw_bank.lpm ? 0x0DCUL : 0x070UL)
-#define OP_ENDPTFLUSH	    (hw_bank.lpm ? 0x0E0UL : 0x074UL)
-#define OP_ENDPTSTAT	    (hw_bank.lpm ? 0x0E4UL : 0x078UL)
-#define OP_ENDPTCOMPLETE    (hw_bank.lpm ? 0x0E8UL : 0x07CUL)
-#define OP_ENDPTCTRL	    (hw_bank.lpm ? 0x0ECUL : 0x080UL)
-#define OP_LAST		    (hw_bank.lpm ? 0x12CUL : 0x0C0UL)
-
-/* maximum number of enpoints: valid only after hw_device_reset() */
-static unsigned hw_ep_max;
+#define OP_USBMODE	    (udc->hw_bank.lpm ? 0x0C8UL : 0x068UL)
+#define OP_ENDPTSETUPSTAT   (udc->hw_bank.lpm ? 0x0D8UL : 0x06CUL)
+#define OP_ENDPTPRIME	    (udc->hw_bank.lpm ? 0x0DCUL : 0x070UL)
+#define OP_ENDPTFLUSH	    (udc->hw_bank.lpm ? 0x0E0UL : 0x074UL)
+#define OP_ENDPTSTAT	    (udc->hw_bank.lpm ? 0x0E4UL : 0x078UL)
+#define OP_ENDPTCOMPLETE    (udc->hw_bank.lpm ? 0x0E8UL : 0x07CUL)
+#define OP_ENDPTCTRL	    (udc->hw_bank.lpm ? 0x0ECUL : 0x080UL)
+#define OP_LAST		    (udc->hw_bank.lpm ? 0x12CUL : 0x0C0UL)
 
 /**
  * hw_ep_bit: calculates the bit number
@@ -183,11 +172,11 @@ static inline int hw_ep_bit(int num, int dir)
 	return num + (dir ? 16 : 0);
 }
 
-static int ep_to_bit(int n)
+static int ep_to_bit(struct ci13xxx *udc, int n)
 {
-	int fill = 16 - hw_ep_max / 2;
+	int fill = 16 - udc->hw_ep_max / 2;
 
-	if (n >= hw_ep_max / 2)
+	if (n >= udc->hw_ep_max / 2)
 		n += fill;
 
 	return n;
@@ -200,9 +189,9 @@ static int ep_to_bit(int n)
  *
  * This function returns register bitfield data
  */
-static u32 hw_cread(u32 addr, u32 mask)
+static u32 hw_cread(struct ci13xxx *udc, u32 addr, u32 mask)
 {
-	return ioread32(addr + hw_bank.cap) & mask;
+	return ioread32(addr + udc->hw_bank.cap) & mask;
 }
 
 /**
@@ -211,10 +200,10 @@ static u32 hw_cread(u32 addr, u32 mask)
  * @mask: bitfield mask
  * @data: new data
  */
-static void hw_cwrite(u32 addr, u32 mask, u32 data)
+static void hw_cwrite(struct ci13xxx *udc, u32 addr, u32 mask, u32 data)
 {
-	iowrite32(hw_cread(addr, ~mask) | (data & mask),
-		  addr + hw_bank.cap);
+	iowrite32(hw_cread(udc, addr, ~mask) | (data & mask),
+		  addr + udc->hw_bank.cap);
 }
 
 /**
@@ -224,9 +213,9 @@ static void hw_cwrite(u32 addr, u32 mask, u32 data)
  *
  * This function returns register bitfield data
  */
-static u32 hw_oread(u32 addr, u32 mask)
+static u32 hw_oread(struct ci13xxx *udc, u32 addr, u32 mask)
 {
-	return ioread32(addr + hw_bank.op) & mask;
+	return ioread32(addr + udc->hw_bank.op) & mask;
 }
 
 /**
@@ -235,10 +224,10 @@ static u32 hw_oread(u32 addr, u32 mask)
  * @mask: bitfield mask
  * @data: new data
  */
-static void hw_owrite(u32 addr, u32 mask, u32 data)
+static void hw_owrite(struct ci13xxx *udc, u32 addr, u32 mask, u32 data)
 {
-	iowrite32(hw_oread(addr, ~mask) | (data & mask),
-		  addr + hw_bank.op);
+	iowrite32(hw_oread(udc, addr, ~mask) | (data & mask),
+		  addr + udc->hw_bank.op);
 }
 
 /**
@@ -248,11 +237,11 @@ static void hw_owrite(u32 addr, u32 mask, u32 data)
  *
  * This function returns register bitfield data
  */
-static u32 hw_otest_and_clear(u32 addr, u32 mask)
+static u32 hw_otest_and_clear(struct ci13xxx *udc, u32 addr, u32 mask)
 {
-	u32 reg = hw_oread(addr, mask);
+	u32 reg = hw_oread(udc, addr, mask);
 
-	iowrite32(reg, addr + hw_bank.op);
+	iowrite32(reg, addr + udc->hw_bank.op);
 	return reg;
 }
 
@@ -264,35 +253,38 @@ static u32 hw_otest_and_clear(u32 addr, u32 mask)
  *
  * This function returns register bitfield data
  */
-static u32 hw_otest_and_write(u32 addr, u32 mask, u32 data)
+static u32 hw_otest_and_write(struct ci13xxx *udc, u32 addr, u32 mask, u32 data)
 {
-	u32 reg = hw_oread(addr, ~0);
+	u32 reg = hw_oread(udc, addr, ~0);
 
-	iowrite32((reg & ~mask) | (data & mask), addr + hw_bank.op);
+	iowrite32((reg & ~mask) | (data & mask), addr + udc->hw_bank.op);
 	return (reg & mask) >> ffs_nr(mask);
 }
 
-static int hw_device_init(void __iomem *base, uintptr_t cap_offset)
+static int hw_device_init(struct ci13xxx *udc, void __iomem *base,
+			  uintptr_t cap_offset)
 {
 	u32 reg;
 
 	/* bank is a module variable */
-	hw_bank.abs = base;
+	udc->hw_bank.abs = base;
 
-	hw_bank.cap = hw_bank.abs;
-	hw_bank.cap += cap_offset;
-	hw_bank.op = hw_bank.cap + ioread8(hw_bank.cap);
+	udc->hw_bank.cap = udc->hw_bank.abs;
+	udc->hw_bank.cap += cap_offset;
+	udc->hw_bank.op = udc->hw_bank.cap + ioread8(udc->hw_bank.cap);
 
-	reg = hw_cread(CAP_HCCPARAMS, HCCPARAMS_LEN) >> ffs_nr(HCCPARAMS_LEN);
-	hw_bank.lpm  = reg;
-	hw_bank.size = hw_bank.op - hw_bank.abs;
-	hw_bank.size += OP_LAST;
-	hw_bank.size /= sizeof(u32);
+	reg = hw_cread(udc, CAP_HCCPARAMS, HCCPARAMS_LEN) >>
+		ffs_nr(HCCPARAMS_LEN);
+	udc->hw_bank.lpm  = reg;
+	udc->hw_bank.size = udc->hw_bank.op - udc->hw_bank.abs;
+	udc->hw_bank.size += OP_LAST;
+	udc->hw_bank.size /= sizeof(u32);
 
-	reg = hw_cread(CAP_DCCPARAMS, DCCPARAMS_DEN) >> ffs_nr(DCCPARAMS_DEN);
-	hw_ep_max = reg * 2;   /* cache hw ENDPT_MAX */
+	reg = hw_cread(udc, CAP_DCCPARAMS, DCCPARAMS_DEN) >>
+		ffs_nr(DCCPARAMS_DEN);
+	udc->hw_ep_max = reg * 2;   /* cache hw ENDPT_MAX */
 
-	if (hw_ep_max == 0 || hw_ep_max > ENDPT_MAX)
+	if (udc->hw_ep_max == 0 || udc->hw_ep_max > ENDPT_MAX)
 		return -ENODEV;
 
 	/* setup lock mode ? */
@@ -312,11 +304,11 @@ static int hw_device_init(void __iomem *base, uintptr_t cap_offset)
 static int hw_device_reset(struct ci13xxx *udc)
 {
 	/* should flush & stop before reset */
-	hw_owrite(OP_ENDPTFLUSH, ~0, ~0);
-	hw_owrite(OP_USBCMD, USBCMD_RS, 0);
+	hw_owrite(udc, OP_ENDPTFLUSH, ~0, ~0);
+	hw_owrite(udc, OP_USBCMD, USBCMD_RS, 0);
 
-	hw_owrite(OP_USBCMD, USBCMD_RST, USBCMD_RST);
-	while (hw_oread(OP_USBCMD, USBCMD_RST))
+	hw_owrite(udc, OP_USBCMD, USBCMD_RST, USBCMD_RST);
+	while (hw_oread(udc, OP_USBCMD, USBCMD_RST))
 		udelay(10);             /* not RTOS friendly */
 
 
@@ -325,16 +317,16 @@ static int hw_device_reset(struct ci13xxx *udc)
 			CI13XXX_CONTROLLER_RESET_EVENT);
 
 	if (udc->udc_driver->flags & CI13XXX_DISABLE_STREAMING)
-		hw_owrite(OP_USBMODE, USBMODE_SDIS, USBMODE_SDIS);
+		hw_owrite(udc, OP_USBMODE, USBMODE_SDIS, USBMODE_SDIS);
 
 	/* USBMODE should be configured step by step */
-	hw_owrite(OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
-	hw_owrite(OP_USBMODE, USBMODE_CM, USBMODE_CM_DEVICE);
-	hw_owrite(OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);  /* HW >= 2.3 */
+	hw_owrite(udc, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
+	hw_owrite(udc, OP_USBMODE, USBMODE_CM, USBMODE_CM_DEVICE);
+	hw_owrite(udc, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);	 /* HW >= 2.3 */
 
-	if (hw_oread(OP_USBMODE, USBMODE_CM) != USBMODE_CM_DEVICE) {
+	if (hw_oread(udc, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DEVICE) {
 		pr_err("cannot enter in device mode");
-		pr_err("lpm = %i", hw_bank.lpm);
+		pr_err("lpm = %i", udc->hw_bank.lpm);
 		return -ENODEV;
 	}
 
@@ -348,17 +340,17 @@ static int hw_device_reset(struct ci13xxx *udc)
  *
  * This function returns an error code
  */
-static int hw_device_state(u32 dma)
+static int hw_device_state(struct ci13xxx *udc, u32 dma)
 {
 	if (dma) {
-		hw_owrite(OP_ENDPTLISTADDR, ~0, dma);
+		hw_owrite(udc, OP_ENDPTLISTADDR, ~0, dma);
 		/* interrupt, error, port change, reset, sleep/suspend */
-		hw_owrite(OP_USBINTR, ~0,
+		hw_owrite(udc, OP_USBINTR, ~0,
 			     USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI);
-		hw_owrite(OP_USBCMD, USBCMD_RS, USBCMD_RS);
+		hw_owrite(udc, OP_USBCMD, USBCMD_RS, USBCMD_RS);
 	} else {
-		hw_owrite(OP_USBCMD, USBCMD_RS, 0);
-		hw_owrite(OP_USBINTR, ~0, 0);
+		hw_owrite(udc, OP_USBCMD, USBCMD_RS, 0);
+		hw_owrite(udc, OP_USBINTR, ~0, 0);
 	}
 	return 0;
 }
@@ -370,16 +362,16 @@ static int hw_device_state(u32 dma)
  *
  * This function returns an error code
  */
-static int hw_ep_flush(int num, int dir)
+static int hw_ep_flush(struct ci13xxx *udc, int num, int dir)
 {
 	int n = hw_ep_bit(num, dir);
 
 	do {
 		/* flush any pending transfer */
-		hw_owrite(OP_ENDPTFLUSH, BIT(n), BIT(n));
-		while (hw_oread(OP_ENDPTFLUSH, BIT(n)))
+		hw_owrite(udc, OP_ENDPTFLUSH, BIT(n), BIT(n));
+		while (hw_oread(udc, OP_ENDPTFLUSH, BIT(n)))
 			cpu_relax();
-	} while (hw_oread(OP_ENDPTSTAT, BIT(n)));
+	} while (hw_oread(udc, OP_ENDPTSTAT, BIT(n)));
 
 	return 0;
 }
@@ -391,10 +383,10 @@ static int hw_ep_flush(int num, int dir)
  *
  * This function returns an error code
  */
-static int hw_ep_disable(int num, int dir)
+static int hw_ep_disable(struct ci13xxx *udc, int num, int dir)
 {
-	hw_ep_flush(num, dir);
-	hw_owrite(OP_ENDPTCTRL + num * sizeof(u32),
+	hw_ep_flush(udc, num, dir);
+	hw_owrite(udc, OP_ENDPTCTRL + num * sizeof(u32),
 		  dir ? ENDPTCTRL_TXE : ENDPTCTRL_RXE, 0);
 	return 0;
 }
@@ -407,7 +399,7 @@ static int hw_ep_disable(int num, int dir)
  *
  * This function returns an error code
  */
-static int hw_ep_enable(int num, int dir, int type)
+static int hw_ep_enable(struct ci13xxx *udc, int num, int dir, int type)
 {
 	u32 mask, data;
 
@@ -430,7 +422,7 @@ static int hw_ep_enable(int num, int dir, int type)
 		mask |= ENDPTCTRL_RXE;  /* enable  */
 		data |= ENDPTCTRL_RXE;
 	}
-	hw_owrite(OP_ENDPTCTRL + num * sizeof(u32), mask, data);
+	hw_owrite(udc, OP_ENDPTCTRL + num * sizeof(u32), mask, data);
 	return 0;
 }
 
@@ -441,11 +433,11 @@ static int hw_ep_enable(int num, int dir, int type)
  *
  * This function returns 1 if endpoint halted
  */
-static int hw_ep_get_halt(int num, int dir)
+static int hw_ep_get_halt(struct ci13xxx *udc, int num, int dir)
 {
 	u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS;
 
-	return hw_oread(OP_ENDPTCTRL + num * sizeof(u32), mask) ? 1 : 0;
+	return hw_oread(udc, OP_ENDPTCTRL + num * sizeof(u32), mask) ? 1 : 0;
 }
 
 /**
@@ -455,10 +447,10 @@ static int hw_ep_get_halt(int num, int dir)
  *
  * This function returns setup status
  */
-static int hw_test_and_clear_setup_status(int n)
+static int hw_test_and_clear_setup_status(struct ci13xxx *udc, int n)
 {
-	n = ep_to_bit(n);
-	return hw_otest_and_clear(OP_ENDPTSETUPSTAT, BIT(n));
+	n = ep_to_bit(udc, n);
+	return hw_otest_and_clear(udc, OP_ENDPTSETUPSTAT, BIT(n));
 }
 
 /**
@@ -469,18 +461,18 @@ static int hw_test_and_clear_setup_status(int n)
  *
  * This function returns an error code
  */
-static int hw_ep_prime(int num, int dir, int is_ctrl)
+static int hw_ep_prime(struct ci13xxx *udc, int num, int dir, int is_ctrl)
 {
 	int n = hw_ep_bit(num, dir);
 
-	if (is_ctrl && dir == RX && hw_oread(OP_ENDPTSETUPSTAT, BIT(num)))
+	if (is_ctrl && dir == RX && hw_oread(udc, OP_ENDPTSETUPSTAT, BIT(num)))
 		return -EAGAIN;
 
-	hw_owrite(OP_ENDPTPRIME, BIT(n), BIT(n));
+	hw_owrite(udc, OP_ENDPTPRIME, BIT(n), BIT(n));
 
-	while (hw_oread(OP_ENDPTPRIME, BIT(n)))
+	while (hw_oread(udc, OP_ENDPTPRIME, BIT(n)))
 		cpu_relax();
-	if (is_ctrl && dir == RX  && hw_oread(OP_ENDPTSETUPSTAT, BIT(num)))
+	if (is_ctrl && dir == RX  && hw_oread(udc, OP_ENDPTSETUPSTAT, BIT(num)))
 		return -EAGAIN;
 
 	/* status shoult be tested according with manual but it doesn't work */
@@ -496,7 +488,7 @@ static int hw_ep_prime(int num, int dir, int is_ctrl)
  *
  * This function returns an error code
  */
-static int hw_ep_set_halt(int num, int dir, int value)
+static int hw_ep_set_halt(struct ci13xxx *udc, int num, int dir, int value)
 {
 	if (value != 0 && value != 1)
 		return -EINVAL;
@@ -507,9 +499,9 @@ static int hw_ep_set_halt(int num, int dir, int value)
 		u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR;
 
 		/* data toggle - reserved for EP0 but it's in ESS */
-		hw_owrite(addr, mask_xs|mask_xr, value ? mask_xs : mask_xr);
-
-	} while (value != hw_ep_get_halt(num, dir));
+		hw_owrite(udc, addr, mask_xs|mask_xr,
+			  value ? mask_xs : mask_xr);
+	} while (value != hw_ep_get_halt(udc, num, dir));
 
 	return 0;
 }
@@ -521,13 +513,13 @@ static int hw_ep_set_halt(int num, int dir, int value)
  *
  * This function returns an error code
  */
-static int hw_intr_clear(int n)
+static int hw_intr_clear(struct ci13xxx *udc, int n)
 {
 	if (n >= REG_BITS)
 		return -EINVAL;
 
-	hw_owrite(OP_USBINTR, BIT(n), 0);
-	hw_owrite(OP_USBSTS,  BIT(n), BIT(n));
+	hw_owrite(udc, OP_USBINTR, BIT(n), 0);
+	hw_owrite(udc, OP_USBSTS,  BIT(n), BIT(n));
 	return 0;
 }
 
@@ -538,15 +530,15 @@ static int hw_intr_clear(int n)
  *
  * This function returns an error code
  */
-static int hw_intr_force(int n)
+static int hw_intr_force(struct ci13xxx *udc, int n)
 {
 	if (n >= REG_BITS)
 		return -EINVAL;
 
-	hw_cwrite(ABS_TESTMODE, TESTMODE_FORCE, TESTMODE_FORCE);
-	hw_owrite(OP_USBINTR,  BIT(n), BIT(n));
-	hw_owrite(OP_USBSTS,   BIT(n), BIT(n));
-	hw_cwrite(ABS_TESTMODE, TESTMODE_FORCE, 0);
+	hw_cwrite(udc, ABS_TESTMODE, TESTMODE_FORCE, TESTMODE_FORCE);
+	hw_owrite(udc, OP_USBINTR,  BIT(n), BIT(n));
+	hw_owrite(udc, OP_USBSTS,   BIT(n), BIT(n));
+	hw_cwrite(udc, ABS_TESTMODE, TESTMODE_FORCE, 0);
 	return 0;
 }
 
@@ -555,10 +547,10 @@ static int hw_intr_force(int n)
  *
  * This function returns true if high speed port
  */
-static int hw_port_is_high_speed(void)
+static int hw_port_is_high_speed(struct ci13xxx *udc)
 {
-	return hw_bank.lpm ? hw_oread(OP_DEVLC, DEVLC_PSPD) :
-		hw_oread(OP_PORTSC, PORTSC_HSP);
+	return udc->hw_bank.lpm ? hw_oread(udc, OP_DEVLC, DEVLC_PSPD) :
+		hw_oread(udc, OP_PORTSC, PORTSC_HSP);
 }
 
 /**
@@ -566,9 +558,9 @@ static int hw_port_is_high_speed(void)
  *
  * This function returns port test mode value
  */
-static u8 hw_port_test_get(void)
+static u8 hw_port_test_get(struct ci13xxx *udc)
 {
-	return hw_oread(OP_PORTSC, PORTSC_PTC) >> ffs_nr(PORTSC_PTC);
+	return hw_oread(udc, OP_PORTSC, PORTSC_PTC) >> ffs_nr(PORTSC_PTC);
 }
 
 /**
@@ -577,14 +569,14 @@ static u8 hw_port_test_get(void)
  *
  * This function returns an error code
  */
-static int hw_port_test_set(u8 mode)
+static int hw_port_test_set(struct ci13xxx *udc, u8 mode)
 {
 	const u8 TEST_MODE_MAX = 7;
 
 	if (mode > TEST_MODE_MAX)
 		return -EINVAL;
 
-	hw_owrite(OP_PORTSC, PORTSC_PTC, mode << ffs_nr(PORTSC_PTC));
+	hw_owrite(udc, OP_PORTSC, PORTSC_PTC, mode << ffs_nr(PORTSC_PTC));
 	return 0;
 }
 
@@ -593,9 +585,9 @@ static int hw_port_test_set(u8 mode)
  *
  * This function returns register data
  */
-static u32 hw_read_intr_enable(void)
+static u32 hw_read_intr_enable(struct ci13xxx *udc)
 {
-	return hw_oread(OP_USBINTR, ~0);
+	return hw_oread(udc, OP_USBINTR, ~0);
 }
 
 /**
@@ -603,9 +595,9 @@ static u32 hw_read_intr_enable(void)
  *
  * This function returns register data
  */
-static u32 hw_read_intr_status(void)
+static u32 hw_read_intr_status(struct ci13xxx *udc)
 {
-	return hw_oread(OP_USBSTS, ~0);
+	return hw_oread(udc, OP_USBSTS, ~0);
 }
 
 /**
@@ -615,15 +607,15 @@ static u32 hw_read_intr_status(void)
  *
  * This function returns number of registers read
  */
-static size_t hw_register_read(u32 *buf, size_t size)
+static size_t hw_register_read(struct ci13xxx *udc, u32 *buf, size_t size)
 {
 	unsigned i;
 
-	if (size > hw_bank.size)
-		size = hw_bank.size;
+	if (size > udc->hw_bank.size)
+		size = udc->hw_bank.size;
 
 	for (i = 0; i < size; i++)
-		buf[i] = hw_cread(i * sizeof(u32), ~0);
+		buf[i] = hw_cread(udc, i * sizeof(u32), ~0);
 
 	return size;
 }
@@ -635,18 +627,18 @@ static size_t hw_register_read(u32 *buf, size_t size)
  *
  * This function returns an error code
  */
-static int hw_register_write(u16 addr, u32 data)
+static int hw_register_write(struct ci13xxx *udc, u16 addr, u32 data)
 {
 	/* align */
 	addr /= sizeof(u32);
 
-	if (addr >= hw_bank.size)
+	if (addr >= udc->hw_bank.size)
 		return -EINVAL;
 
 	/* align */
 	addr *= sizeof(u32);
 
-	hw_cwrite(addr, ~0, data);
+	hw_cwrite(udc, addr, ~0, data);
 	return 0;
 }
 
@@ -657,10 +649,10 @@ static int hw_register_write(u16 addr, u32 data)
  *
  * This function returns complete status
  */
-static int hw_test_and_clear_complete(int n)
+static int hw_test_and_clear_complete(struct ci13xxx *udc, int n)
 {
-	n = ep_to_bit(n);
-	return hw_otest_and_clear(OP_ENDPTCOMPLETE, BIT(n));
+	n = ep_to_bit(udc, n);
+	return hw_otest_and_clear(udc, OP_ENDPTCOMPLETE, BIT(n));
 }
 
 /**
@@ -669,11 +661,11 @@ static int hw_test_and_clear_complete(int n)
  *
  * This function returns active interrutps
  */
-static u32 hw_test_and_clear_intr_active(void)
+static u32 hw_test_and_clear_intr_active(struct ci13xxx *udc)
 {
-	u32 reg = hw_read_intr_status() & hw_read_intr_enable();
+	u32 reg = hw_read_intr_status(udc) & hw_read_intr_enable(udc);
 
-	hw_owrite(OP_USBSTS, ~0, reg);
+	hw_owrite(udc, OP_USBSTS, ~0, reg);
 	return reg;
 }
 
@@ -683,9 +675,9 @@ static u32 hw_test_and_clear_intr_active(void)
  *
  * This function returns guard value
  */
-static int hw_test_and_clear_setup_guard(void)
+static int hw_test_and_clear_setup_guard(struct ci13xxx *udc)
 {
-	return hw_otest_and_write(OP_USBCMD, USBCMD_SUTW, 0);
+	return hw_otest_and_write(udc, OP_USBCMD, USBCMD_SUTW, 0);
 }
 
 /**
@@ -694,9 +686,9 @@ static int hw_test_and_clear_setup_guard(void)
  *
  * This function returns guard value
  */
-static int hw_test_and_set_setup_guard(void)
+static int hw_test_and_set_setup_guard(struct ci13xxx *udc)
 {
-	return hw_otest_and_write(OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW);
+	return hw_otest_and_write(udc, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW);
 }
 
 /**
@@ -705,10 +697,10 @@ static int hw_test_and_set_setup_guard(void)
  *
  * This function returns an error code
  */
-static int hw_usb_set_address(u8 value)
+static int hw_usb_set_address(struct ci13xxx *udc, u8 value)
 {
 	/* advance */
-	hw_owrite(OP_DEVICEADDR, DEVICEADDR_USBADR | DEVICEADDR_USBADRA,
+	hw_owrite(udc, OP_DEVICEADDR, DEVICEADDR_USBADR | DEVICEADDR_USBADRA,
 		  value << ffs_nr(DEVICEADDR_USBADR) | DEVICEADDR_USBADRA);
 	return 0;
 }
@@ -719,21 +711,21 @@ static int hw_usb_set_address(u8 value)
  *
  * This function returns an error code
  */
-static int hw_usb_reset(void)
+static int hw_usb_reset(struct ci13xxx *udc)
 {
-	hw_usb_set_address(0);
+	hw_usb_set_address(udc, 0);
 
 	/* ESS flushes only at end?!? */
-	hw_owrite(OP_ENDPTFLUSH,    ~0, ~0);   /* flush all EPs */
+	hw_owrite(udc, OP_ENDPTFLUSH,    ~0, ~0);   /* flush all EPs */
 
 	/* clear setup token semaphores */
-	hw_owrite(OP_ENDPTSETUPSTAT, 0,  0);   /* writes its content */
+	hw_owrite(udc, OP_ENDPTSETUPSTAT, 0,  0);   /* writes its content */
 
 	/* clear complete status */
-	hw_owrite(OP_ENDPTCOMPLETE,  0,  0);   /* writes its content */
+	hw_owrite(udc, OP_ENDPTCOMPLETE,  0,  0);   /* writes its content */
 
 	/* wait until all bits cleared */
-	while (hw_oread(OP_ENDPTPRIME, ~0))
+	while (hw_oread(udc, OP_ENDPTPRIME, ~0))
 		udelay(10);             /* not RTOS friendly */
 
 	/* reset all endpoints ? */
@@ -1038,9 +1030,9 @@ static ssize_t show_inters(struct device *dev, struct device_attribute *attr,
 	spin_lock_irqsave(udc->lock, flags);
 
 	n += scnprintf(buf + n, PAGE_SIZE - n,
-		       "status = %08x\n", hw_read_intr_status());
+		       "status = %08x\n", hw_read_intr_status(udc));
 	n += scnprintf(buf + n, PAGE_SIZE - n,
-		       "enable = %08x\n", hw_read_intr_enable());
+		       "enable = %08x\n", hw_read_intr_enable(udc));
 
 	n += scnprintf(buf + n, PAGE_SIZE - n, "*test = %d\n",
 		       isr_statistics.test);
@@ -1115,12 +1107,12 @@ static ssize_t store_inters(struct device *dev, struct device_attribute *attr,
 
 	spin_lock_irqsave(udc->lock, flags);
 	if (en) {
-		if (hw_intr_force(bit))
+		if (hw_intr_force(udc, bit))
 			dev_err(dev, "invalid bit number\n");
 		else
 			isr_statistics.test++;
 	} else {
-		if (hw_intr_clear(bit))
+		if (hw_intr_clear(udc, bit))
 			dev_err(dev, "invalid bit number\n");
 	}
 	spin_unlock_irqrestore(udc->lock, flags);
@@ -1149,7 +1141,7 @@ static ssize_t show_port_test(struct device *dev,
 	}
 
 	spin_lock_irqsave(udc->lock, flags);
-	mode = hw_port_test_get();
+	mode = hw_port_test_get(udc);
 	spin_unlock_irqrestore(udc->lock, flags);
 
 	return scnprintf(buf, PAGE_SIZE, "mode = %u\n", mode);
@@ -1180,7 +1172,7 @@ static ssize_t store_port_test(struct device *dev,
 	}
 
 	spin_lock_irqsave(udc->lock, flags);
-	if (hw_port_test_set(mode))
+	if (hw_port_test_set(udc, mode))
 		dev_err(dev, "invalid mode\n");
 	spin_unlock_irqrestore(udc->lock, flags);
 
@@ -1209,9 +1201,10 @@ static ssize_t show_qheads(struct device *dev, struct device_attribute *attr,
 	}
 
 	spin_lock_irqsave(udc->lock, flags);
-	for (i = 0; i < hw_ep_max/2; i++) {
+	for (i = 0; i < udc->hw_ep_max/2; i++) {
 		struct ci13xxx_ep *mEpRx = &udc->ci13xxx_ep[i];
-		struct ci13xxx_ep *mEpTx = &udc->ci13xxx_ep[i + hw_ep_max/2];
+		struct ci13xxx_ep *mEpTx =
+			&udc->ci13xxx_ep[i + udc->hw_ep_max/2];
 		n += scnprintf(buf + n, PAGE_SIZE - n,
 			       "EP=%02i: RX=%08X TX=%08X\n",
 			       i, (u32)mEpRx->qh.dma, (u32)mEpTx->qh.dma);
@@ -1255,7 +1248,7 @@ static ssize_t show_registers(struct device *dev,
 	}
 
 	spin_lock_irqsave(udc->lock, flags);
-	k = hw_register_read(dump, DUMP_ENTRIES);
+	k = hw_register_read(udc, dump, DUMP_ENTRIES);
 	spin_unlock_irqrestore(udc->lock, flags);
 
 	for (i = 0; i < k; i++) {
@@ -1292,7 +1285,7 @@ static ssize_t store_registers(struct device *dev,
 	}
 
 	spin_lock_irqsave(udc->lock, flags);
-	if (hw_register_write(addr, data))
+	if (hw_register_write(udc, addr, data))
 		dev_err(dev, "invalid address range\n");
 	spin_unlock_irqrestore(udc->lock, flags);
 
@@ -1323,15 +1316,15 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr,
 	}
 
 	spin_lock_irqsave(udc->lock, flags);
-	for (i = 0; i < hw_ep_max; i++)
+	for (i = 0; i < udc->hw_ep_max; i++)
 		list_for_each(ptr, &udc->ci13xxx_ep[i].qh.queue)
 		{
 			req = list_entry(ptr, struct ci13xxx_req, queue);
 
 			n += scnprintf(buf + n, PAGE_SIZE - n,
 					"EP=%02i: TD=%08X %s\n",
-					i % hw_ep_max/2, (u32)req->dma,
-					((i < hw_ep_max/2) ? "RX" : "TX"));
+					i % udc->hw_ep_max/2, (u32)req->dma,
+					((i < udc->hw_ep_max/2) ? "RX" : "TX"));
 
 			for (j = 0; j < qSize; j++)
 				n += scnprintf(buf + n, PAGE_SIZE - n,
@@ -1442,6 +1435,7 @@ static inline u8 _usb_addr(struct ci13xxx_ep *ep)
  */
 static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
 {
+	struct ci13xxx *udc = mEp->udc;
 	unsigned i;
 	int ret = 0;
 	unsigned length = mReq->req.length;
@@ -1515,13 +1509,13 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
 		else
 			mReqPrev->ptr->next = mReq->dma & TD_ADDR_MASK;
 		wmb();
-		if (hw_oread(OP_ENDPTPRIME, BIT(n)))
+		if (hw_oread(udc, OP_ENDPTPRIME, BIT(n)))
 			goto done;
 		do {
-			hw_owrite(OP_USBCMD, USBCMD_ATDTW, USBCMD_ATDTW);
-			tmp_stat = hw_oread(OP_ENDPTSTAT, BIT(n));
-		} while (!hw_oread(OP_USBCMD, USBCMD_ATDTW));
-		hw_owrite(OP_USBCMD, USBCMD_ATDTW, 0);
+			hw_owrite(udc, OP_USBCMD, USBCMD_ATDTW, USBCMD_ATDTW);
+			tmp_stat = hw_oread(udc, OP_ENDPTSTAT, BIT(n));
+		} while (!hw_oread(udc, OP_USBCMD, USBCMD_ATDTW));
+		hw_owrite(udc, OP_USBCMD, USBCMD_ATDTW, 0);
 		if (tmp_stat)
 			goto done;
 	}
@@ -1533,7 +1527,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
 
 	wmb();   /* synchronize before ep prime */
 
-	ret = hw_ep_prime(mEp->num, mEp->dir,
+	ret = hw_ep_prime(udc, mEp->num, mEp->dir,
 			   mEp->type == USB_ENDPOINT_XFER_CONTROL);
 done:
 	return ret;
@@ -1604,7 +1598,7 @@ __acquires(mEp->lock)
 	if (mEp == NULL)
 		return -EINVAL;
 
-	hw_ep_flush(mEp->num, mEp->dir);
+	hw_ep_flush(mEp->udc, mEp->num, mEp->dir);
 
 	while (!list_empty(&mEp->qh.queue)) {
 
@@ -1698,7 +1692,7 @@ __acquires(udc->lock)
 	if (retval)
 		goto done;
 
-	retval = hw_usb_reset();
+	retval = hw_usb_reset(udc);
 	if (retval)
 		goto done;
 
@@ -1778,7 +1772,7 @@ __acquires(mEp->lock)
 		dir = (le16_to_cpu(setup->wIndex) & USB_ENDPOINT_DIR_MASK) ?
 			TX : RX;
 		num =  le16_to_cpu(setup->wIndex) & USB_ENDPOINT_NUMBER_MASK;
-		*((u16 *)req->buf) = hw_ep_get_halt(num, dir);
+		*((u16 *)req->buf) = hw_ep_get_halt(udc, num, dir);
 	}
 	/* else do nothing; reserved for future use */
 
@@ -1817,7 +1811,7 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
 
 	spin_lock_irqsave(udc->lock, flags);
 	if (udc->test_mode)
-		hw_port_test_set(udc->test_mode);
+		hw_port_test_set(udc, udc->test_mode);
 	spin_unlock_irqrestore(udc->lock, flags);
 }
 
@@ -1912,7 +1906,7 @@ __acquires(udc->lock)
 		return;
 	}
 
-	for (i = 0; i < hw_ep_max; i++) {
+	for (i = 0; i < udc->hw_ep_max; i++) {
 		struct ci13xxx_ep *mEp  = &udc->ci13xxx_ep[i];
 		int type, num, dir, err = -EINVAL;
 		struct usb_ctrlrequest req;
@@ -1920,7 +1914,7 @@ __acquires(udc->lock)
 		if (mEp->desc == NULL)
 			continue;   /* not configured */
 
-		if (hw_test_and_clear_complete(i)) {
+		if (hw_test_and_clear_complete(udc, i)) {
 			err = isr_tr_complete_low(mEp);
 			if (mEp->type == USB_ENDPOINT_XFER_CONTROL) {
 				if (err > 0)   /* needs status phase */
@@ -1937,7 +1931,7 @@ __acquires(udc->lock)
 		}
 
 		if (mEp->type != USB_ENDPOINT_XFER_CONTROL ||
-		    !hw_test_and_clear_setup_status(i))
+		    !hw_test_and_clear_setup_status(udc, i))
 			continue;
 
 		if (i != 0) {
@@ -1954,9 +1948,9 @@ __acquires(udc->lock)
 
 		/* read_setup_packet */
 		do {
-			hw_test_and_set_setup_guard();
+			hw_test_and_set_setup_guard(udc);
 			memcpy(&req, &mEp->qh.ptr->setup, sizeof(req));
-		} while (!hw_test_and_clear_setup_guard());
+		} while (!hw_test_and_clear_setup_guard(udc));
 
 		type = req.bRequestType;
 
@@ -1975,7 +1969,7 @@ __acquires(udc->lock)
 				dir = num & USB_ENDPOINT_DIR_MASK;
 				num &= USB_ENDPOINT_NUMBER_MASK;
 				if (dir) /* TX */
-					num += hw_ep_max/2;
+					num += udc->hw_ep_max/2;
 				if (!udc->ci13xxx_ep[num].wedge) {
 					spin_unlock(udc->lock);
 					err = usb_ep_clear_halt(
@@ -2012,7 +2006,7 @@ __acquires(udc->lock)
 			if (le16_to_cpu(req.wLength) != 0 ||
 			    le16_to_cpu(req.wIndex)  != 0)
 				break;
-			err = hw_usb_set_address((u8)le16_to_cpu(req.wValue));
+			err = hw_usb_set_address(udc, (u8)le16_to_cpu(req.wValue));
 			if (err)
 				break;
 			err = isr_setup_status_phase(udc);
@@ -2027,7 +2021,7 @@ __acquires(udc->lock)
 				dir = num & USB_ENDPOINT_DIR_MASK;
 				num &= USB_ENDPOINT_NUMBER_MASK;
 				if (dir) /* TX */
-					num += hw_ep_max/2;
+					num += udc->hw_ep_max/2;
 
 				spin_unlock(udc->lock);
 				err = usb_ep_set_halt(&udc->ci13xxx_ep[num].ep);
@@ -2141,7 +2135,7 @@ static int ep_enable(struct usb_ep *ep,
 	 * is always enabled
 	 */
 	if (mEp->num)
-		retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type);
+		retval |= hw_ep_enable(mEp->udc, mEp->num, mEp->dir, mEp->type);
 
 	spin_unlock_irqrestore(mEp->lock, flags);
 	return retval;
@@ -2174,7 +2168,7 @@ static int ep_disable(struct usb_ep *ep)
 		dbg_event(_usb_addr(mEp), "DISABLE", 0);
 
 		retval |= _ep_nuke(mEp);
-		retval |= hw_ep_disable(mEp->num, mEp->dir);
+		retval |= hw_ep_disable(mEp->udc, mEp->num, mEp->dir);
 
 		if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
 			mEp->dir = (mEp->dir == TX) ? RX : TX;
@@ -2341,7 +2335,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
 
 	dbg_event(_usb_addr(mEp), "DEQUEUE", 0);
 
-	hw_ep_flush(mEp->num, mEp->dir);
+	hw_ep_flush(mEp->udc, mEp->num, mEp->dir);
 
 	/* pop request */
 	list_del_init(&mReq->queue);
@@ -2393,7 +2387,7 @@ static int ep_set_halt(struct usb_ep *ep, int value)
 	direction = mEp->dir;
 	do {
 		dbg_event(_usb_addr(mEp), "HALT", value);
-		retval |= hw_ep_set_halt(mEp->num, mEp->dir, value);
+		retval |= hw_ep_set_halt(mEp->udc, mEp->num, mEp->dir, value);
 
 		if (!value)
 			mEp->wedge = 0;
@@ -2452,7 +2446,7 @@ static void ep_fifo_flush(struct usb_ep *ep)
 	spin_lock_irqsave(mEp->lock, flags);
 
 	dbg_event(_usb_addr(mEp), "FFLUSH", 0);
-	hw_ep_flush(mEp->num, mEp->dir);
+	hw_ep_flush(mEp->udc, mEp->num, mEp->dir);
 
 	spin_unlock_irqrestore(mEp->lock, flags);
 }
@@ -2495,9 +2489,9 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active)
 		if (is_active) {
 			pm_runtime_get_sync(&_gadget->dev);
 			hw_device_reset(udc);
-			hw_device_state(udc->ep0out->qh.dma);
+			hw_device_state(udc, udc->ep0out->qh.dma);
 		} else {
-			hw_device_state(0);
+			hw_device_state(udc, 0);
 			if (udc->udc_driver->notify_event)
 				udc->udc_driver->notify_event(udc,
 				CI13XXX_CONTROLLER_STOPPED_EVENT);
@@ -2523,12 +2517,12 @@ static int ci13xxx_wakeup(struct usb_gadget *_gadget)
 		trace("remote wakeup feature is not enabled\n");
 		goto out;
 	}
-	if (!hw_oread(OP_PORTSC, PORTSC_SUSP)) {
+	if (!hw_oread(udc, OP_PORTSC, PORTSC_SUSP)) {
 		ret = -EINVAL;
 		trace("port is not suspended\n");
 		goto out;
 	}
-	hw_owrite(OP_PORTSC, PORTSC_FPR, PORTSC_FPR);
+	hw_owrite(udc, OP_PORTSC, PORTSC_FPR, PORTSC_FPR);
 out:
 	spin_unlock_irqrestore(udc->lock, flags);
 	return ret;
@@ -2605,19 +2599,20 @@ static int ci13xxx_start(struct usb_gadget_driver *driver,
 
 	spin_lock_irqsave(udc->lock, flags);
 
-	info("hw_ep_max = %d", hw_ep_max);
+	info("hw_ep_max = %d", udc->hw_ep_max);
 
 	udc->gadget.dev.driver = NULL;
 
 	retval = 0;
-	for (i = 0; i < hw_ep_max/2; i++) {
+	for (i = 0; i < udc->hw_ep_max/2; i++) {
 		for (j = RX; j <= TX; j++) {
-			int k = i + j * hw_ep_max/2;
+			int k = i + j * udc->hw_ep_max/2;
 			struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[k];
 
 			scnprintf(mEp->name, sizeof(mEp->name), "ep%i%s", i,
 					(j == TX)  ? "in" : "out");
 
+			mEp->udc          = udc;
 			mEp->lock         = udc->lock;
 			mEp->device       = &udc->gadget.dev;
 			mEp->td_pool      = udc->td_pool;
@@ -2693,7 +2688,7 @@ static int ci13xxx_start(struct usb_gadget_driver *driver,
 		}
 	}
 
-	retval = hw_device_state(udc->ep0out->qh.dma);
+	retval = hw_device_state(udc, udc->ep0out->qh.dma);
 	if (retval)
 		pm_runtime_put_sync(&udc->gadget.dev);
 
@@ -2725,7 +2720,7 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver)
 
 	if (!(udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) ||
 			udc->vbus_active) {
-		hw_device_state(0);
+		hw_device_state(udc, 0);
 		if (udc->udc_driver->notify_event)
 			udc->udc_driver->notify_event(udc,
 			CI13XXX_CONTROLLER_STOPPED_EVENT);
@@ -2743,7 +2738,7 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver)
 	udc->gadget.dev.driver = NULL;
 
 	/* free resources */
-	for (i = 0; i < hw_ep_max; i++) {
+	for (i = 0; i < udc->hw_ep_max; i++) {
 		struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i];
 
 		if (mEp->num)
@@ -2795,13 +2790,13 @@ static irqreturn_t udc_irq(void)
 	spin_lock(udc->lock);
 
 	if (udc->udc_driver->flags & CI13XXX_REGS_SHARED) {
-		if (hw_oread(OP_USBMODE, USBMODE_CM) !=
+		if (hw_oread(udc, OP_USBMODE, USBMODE_CM) !=
 				USBMODE_CM_DEVICE) {
 			spin_unlock(udc->lock);
 			return IRQ_NONE;
 		}
 	}
-	intr = hw_test_and_clear_intr_active();
+	intr = hw_test_and_clear_intr_active(udc);
 	if (intr) {
 		isr_statistics.hndl.buf[isr_statistics.hndl.idx++] = intr;
 		isr_statistics.hndl.idx &= ISR_MASK;
@@ -2814,7 +2809,7 @@ static irqreturn_t udc_irq(void)
 		}
 		if (USBi_PCI & intr) {
 			isr_statistics.pci++;
-			udc->gadget.speed = hw_port_is_high_speed() ?
+			udc->gadget.speed = hw_port_is_high_speed(udc) ?
 				USB_SPEED_HIGH : USB_SPEED_FULL;
 			if (udc->suspended && udc->driver->resume) {
 				spin_unlock(udc->lock);
@@ -2908,7 +2903,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,
 	udc->gadget.dev.parent   = dev;
 	udc->gadget.dev.release  = udc_release;
 
-	retval = hw_device_init(regs, capoffset);
+	retval = hw_device_init(udc, regs, capoffset);
 	if (retval < 0)
 		goto free_udc;
 
diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h
index d3c9a63..d12e2ad 100644
--- a/drivers/usb/gadget/ci13xxx_udc.h
+++ b/drivers/usb/gadget/ci13xxx_udc.h
@@ -95,6 +95,7 @@ struct ci13xxx_ep {
 	int                                    wedge;
 
 	/* global resources */
+	struct ci13xxx                        *udc;
 	spinlock_t                            *lock;
 	struct device                         *device;
 	struct dma_pool                       *td_pool;
@@ -114,6 +115,14 @@ struct ci13xxx_udc_driver {
 	void	(*notify_event) (struct ci13xxx *udc, unsigned event);
 };
 
+struct hw_bank {
+	unsigned      lpm;    /* is LPM? */
+	void __iomem *abs;    /* bus map offset */
+	void __iomem *cap;    /* bus map offset + CAP offset */
+	void __iomem *op;     /* bus map offset + OP offset */
+	size_t        size;   /* bank size */
+};
+
 /* CI13XXX UDC descriptor & global resources */
 struct ci13xxx {
 	spinlock_t		  *lock;      /* ctrl register bank access */
@@ -127,11 +136,14 @@ struct ci13xxx {
 	struct ci13xxx_ep          ci13xxx_ep[ENDPT_MAX]; /* extended endpts */
 	u32                        ep0_dir;    /* ep0 direction */
 	struct ci13xxx_ep          *ep0out, *ep0in;
+	unsigned		   hw_ep_max;  /* number of hw endpoints */
+
 	u8                         remote_wakeup; /* Is remote wakeup feature
 							enabled by the host? */
 	u8                         suspended;  /* suspended by the host */
 	u8                         test_mode;  /* the selected test mode */
 
+	struct hw_bank             hw_bank;
 	struct usb_gadget_driver  *driver;     /* 3rd party gadget driver */
 	struct ci13xxx_udc_driver *udc_driver; /* device controller driver */
 	int                        vbus_active; /* is VBUS active */
-- 
1.7.9.1

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux