[PATCH v1 08/27] usb: musb: pass fifo_mode from hw glue driver

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

 



From: Ming Lei <tom.leiming@xxxxxxxxx>

Each hw controller may have different fifo configuraion,
so passing fifo_mode from hw glue is very reasonable.

Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
---
 drivers/usb/musb/am35x.c     |    1 +
 drivers/usb/musb/blackfin.c  |    1 +
 drivers/usb/musb/da8xx.c     |    1 +
 drivers/usb/musb/davinci.c   |    1 +
 drivers/usb/musb/musb_core.c |   13 ++++---------
 drivers/usb/musb/musb_core.h |    2 ++
 drivers/usb/musb/omap2430.c  |    1 +
 drivers/usb/musb/tusb6010.c  |    1 +
 drivers/usb/musb/ux500.c     |    1 +
 9 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 6ab6ed2..20231f3 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -442,6 +442,7 @@ static void am35x_musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
 }
 
 static const struct musb_platform_ops am35x_ops = {
+	.fifo_mode	= 4,
 	.init		= am35x_musb_init,
 	.exit		= am35x_musb_exit,
 
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 73b6b2c..bc075bd 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -418,6 +418,7 @@ static int bfin_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops bfin_ops = {
+	.fifo_mode	= 2,
 	.init		= bfin_musb_init,
 	.exit		= bfin_musb_exit,
 
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 5e97aa8..8ea5a71 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -470,6 +470,7 @@ static int da8xx_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops da8xx_ops = {
+	.fifo_mode	= 2,
 	.init		= da8xx_musb_init,
 	.exit		= da8xx_musb_exit,
 
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 6987899..3c7f39a 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -505,6 +505,7 @@ static int davinci_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops davinci_ops = {
+	.fifo_mode	= 2,
 	.init		= davinci_musb_init,
 	.exit		= davinci_musb_exit,
 
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 45f98b5..ecdbc38 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1051,17 +1051,10 @@ 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_OMAP2PLUS) \
-	|| defined(CONFIG_USB_MUSB_AM35X)
-static ushort __devinitdata fifo_mode = 4;
-#elif defined(CONFIG_USB_MUSB_UX500)
-static ushort __devinitdata fifo_mode = 5;
-#else
-static ushort __devinitdata fifo_mode = 2;
-#endif
+static short __devinitdata fifo_mode = -1;
 
 /* "modprobe ... fifo_mode=1" etc */
-module_param(fifo_mode, ushort, 0);
+module_param(fifo_mode, short, 0);
 MODULE_PARM_DESC(fifo_mode, "initial endpoint configuration");
 
 /*
@@ -1982,6 +1975,8 @@ bad_config:
 	musb->board_set_power = plat->set_power;
 	musb->min_power = plat->min_power;
 	musb->ops = plat->platform_ops;
+	if (fifo_mode == -1)
+		fifo_mode = musb->ops->fifo_mode;
 
 	/* The musb_platform_init() call:
 	 *   - adjusts musb->mregs and musb->isr if needed,
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 60e3b72..76307fb 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -255,6 +255,7 @@ enum musb_g_ep0_state {
 
 /**
  * struct musb_platform_ops - Operations passed to musb_core by HW glue layer
+ * @fifo_mode: which fifo_mode is taken by me
  * @init:	turns on clocks, sets up platform-specific registers, etc
  * @exit:	undoes @init
  * @set_mode:	forcefully changes operating mode
@@ -266,6 +267,7 @@ enum musb_g_ep0_state {
  * @write_fifo: write data into musb fifo in PIO
  */
 struct musb_platform_ops {
+	short	fifo_mode;
 	int	(*init)(struct musb *musb);
 	int	(*exit)(struct musb *musb);
 
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 289129b..ccb63c3 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -370,6 +370,7 @@ static int omap2430_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops omap2430_ops = {
+	.fifo_mode	= 4,
 	.init		= omap2430_musb_init,
 	.exit		= omap2430_musb_exit,
 
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 7cad16c..f12124f 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1164,6 +1164,7 @@ static int tusb_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops tusb_ops = {
+	.fifo_mode	= 4,
 	.init		= tusb_musb_init,
 	.exit		= tusb_musb_exit,
 
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index d6384e4..810ed08 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -54,6 +54,7 @@ static int ux500_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops ux500_ops = {
+	.fifo_mode	= 5,
 	.init		= ux500_musb_init,
 	.exit		= ux500_musb_exit,
 };
-- 
1.7.3

--
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