aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/musb_core.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index ced6d9ea9af3..3f4c158a9f5e 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -995,24 +995,13 @@ static ushort __initdata fifo_mode = 2;
995module_param(fifo_mode, ushort, 0); 995module_param(fifo_mode, ushort, 0);
996MODULE_PARM_DESC(fifo_mode, "initial endpoint configuration"); 996MODULE_PARM_DESC(fifo_mode, "initial endpoint configuration");
997 997
998
999enum fifo_style { FIFO_RXTX, FIFO_TX, FIFO_RX } __attribute__ ((packed));
1000enum buf_mode { BUF_SINGLE, BUF_DOUBLE } __attribute__ ((packed));
1001
1002struct fifo_cfg {
1003 u8 hw_ep_num;
1004 enum fifo_style style;
1005 enum buf_mode mode;
1006 u16 maxpacket;
1007};
1008
1009/* 998/*
1010 * tables defining fifo_mode values. define more if you like. 999 * tables defining fifo_mode values. define more if you like.
1011 * for host side, make sure both halves of ep1 are set up. 1000 * for host side, make sure both halves of ep1 are set up.
1012 */ 1001 */
1013 1002
1014/* mode 0 - fits in 2KB */ 1003/* mode 0 - fits in 2KB */
1015static struct fifo_cfg __initdata mode_0_cfg[] = { 1004static struct musb_fifo_cfg __initdata mode_0_cfg[] = {
1016{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, 1005{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
1017{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, 1006{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
1018{ .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, }, 1007{ .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, },
@@ -1021,7 +1010,7 @@ static struct fifo_cfg __initdata mode_0_cfg[] = {
1021}; 1010};
1022 1011
1023/* mode 1 - fits in 4KB */ 1012/* mode 1 - fits in 4KB */
1024static struct fifo_cfg __initdata mode_1_cfg[] = { 1013static struct musb_fifo_cfg __initdata mode_1_cfg[] = {
1025{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1014{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, },
1026{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1015{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, },
1027{ .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1016{ .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, .mode = BUF_DOUBLE, },
@@ -1030,7 +1019,7 @@ static struct fifo_cfg __initdata mode_1_cfg[] = {
1030}; 1019};
1031 1020
1032/* mode 2 - fits in 4KB */ 1021/* mode 2 - fits in 4KB */
1033static struct fifo_cfg __initdata mode_2_cfg[] = { 1022static struct musb_fifo_cfg __initdata mode_2_cfg[] = {
1034{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, 1023{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
1035{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, 1024{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
1036{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, 1025{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
@@ -1040,7 +1029,7 @@ static struct fifo_cfg __initdata mode_2_cfg[] = {
1040}; 1029};
1041 1030
1042/* mode 3 - fits in 4KB */ 1031/* mode 3 - fits in 4KB */
1043static struct fifo_cfg __initdata mode_3_cfg[] = { 1032static struct musb_fifo_cfg __initdata mode_3_cfg[] = {
1044{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1033{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, },
1045{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, }, 1034{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, },
1046{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, 1035{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
@@ -1050,7 +1039,7 @@ static struct fifo_cfg __initdata mode_3_cfg[] = {
1050}; 1039};
1051 1040
1052/* mode 4 - fits in 16KB */ 1041/* mode 4 - fits in 16KB */
1053static struct fifo_cfg __initdata mode_4_cfg[] = { 1042static struct musb_fifo_cfg __initdata mode_4_cfg[] = {
1054{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, 1043{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
1055{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, 1044{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
1056{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, 1045{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
@@ -1081,7 +1070,7 @@ static struct fifo_cfg __initdata mode_4_cfg[] = {
1081}; 1070};
1082 1071
1083/* mode 5 - fits in 8KB */ 1072/* mode 5 - fits in 8KB */
1084static struct fifo_cfg __initdata mode_5_cfg[] = { 1073static struct musb_fifo_cfg __initdata mode_5_cfg[] = {
1085{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, 1074{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
1086{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, 1075{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
1087{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, 1076{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
@@ -1119,7 +1108,7 @@ static struct fifo_cfg __initdata mode_5_cfg[] = {
1119 */ 1108 */
1120static int __init 1109static int __init
1121fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, 1110fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep,
1122 const struct fifo_cfg *cfg, u16 offset) 1111 const struct musb_fifo_cfg *cfg, u16 offset)
1123{ 1112{
1124 void __iomem *mbase = musb->mregs; 1113 void __iomem *mbase = musb->mregs;
1125 int size = 0; 1114 int size = 0;
@@ -1190,17 +1179,23 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep,
1190 return offset + (maxpacket << ((c_size & MUSB_FIFOSZ_DPB) ? 1 : 0)); 1179 return offset + (maxpacket << ((c_size & MUSB_FIFOSZ_DPB) ? 1 : 0));
1191} 1180}
1192 1181
1193static struct fifo_cfg __initdata ep0_cfg = { 1182static struct musb_fifo_cfg __initdata ep0_cfg = {
1194 .style = FIFO_RXTX, .maxpacket = 64, 1183 .style = FIFO_RXTX, .maxpacket = 64,
1195}; 1184};
1196 1185
1197static int __init ep_config_from_table(struct musb *musb) 1186static int __init ep_config_from_table(struct musb *musb)
1198{ 1187{
1199 const struct fifo_cfg *cfg; 1188 const struct musb_fifo_cfg *cfg;
1200 unsigned i, n; 1189 unsigned i, n;
1201 int offset; 1190 int offset;
1202 struct musb_hw_ep *hw_ep = musb->endpoints; 1191 struct musb_hw_ep *hw_ep = musb->endpoints;
1203 1192
1193 if (musb->config->fifo_cfg) {
1194 cfg = musb->config->fifo_cfg;
1195 n = musb->config->fifo_cfg_size;
1196 goto done;
1197 }
1198
1204 switch (fifo_mode) { 1199 switch (fifo_mode) {
1205 default: 1200 default:
1206 fifo_mode = 0; 1201 fifo_mode = 0;
@@ -1235,6 +1230,7 @@ static int __init ep_config_from_table(struct musb *musb)
1235 musb_driver_name, fifo_mode); 1230 musb_driver_name, fifo_mode);
1236 1231
1237 1232
1233done:
1238 offset = fifo_setup(musb, hw_ep, &ep0_cfg, 0); 1234 offset = fifo_setup(musb, hw_ep, &ep0_cfg, 0);
1239 /* assert(offset > 0) */ 1235 /* assert(offset > 0) */
1240 1236