diff options
Diffstat (limited to 'drivers/usb/musb/musb_core.c')
-rw-r--r-- | drivers/usb/musb/musb_core.c | 137 |
1 files changed, 42 insertions, 95 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index bb56a0e8b23b..57cc9c6eaa9f 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -116,7 +116,6 @@ | |||
116 | 116 | ||
117 | #define MUSB_DRIVER_NAME "musb-hdrc" | 117 | #define MUSB_DRIVER_NAME "musb-hdrc" |
118 | const char musb_driver_name[] = MUSB_DRIVER_NAME; | 118 | const char musb_driver_name[] = MUSB_DRIVER_NAME; |
119 | static DEFINE_IDA(musb_ida); | ||
120 | 119 | ||
121 | MODULE_DESCRIPTION(DRIVER_INFO); | 120 | MODULE_DESCRIPTION(DRIVER_INFO); |
122 | MODULE_AUTHOR(DRIVER_AUTHOR); | 121 | MODULE_AUTHOR(DRIVER_AUTHOR); |
@@ -133,35 +132,6 @@ static inline struct musb *dev_to_musb(struct device *dev) | |||
133 | 132 | ||
134 | /*-------------------------------------------------------------------------*/ | 133 | /*-------------------------------------------------------------------------*/ |
135 | 134 | ||
136 | int musb_get_id(struct device *dev, gfp_t gfp_mask) | ||
137 | { | ||
138 | int ret; | ||
139 | int id; | ||
140 | |||
141 | ret = ida_pre_get(&musb_ida, gfp_mask); | ||
142 | if (!ret) { | ||
143 | dev_err(dev, "failed to reserve resource for id\n"); | ||
144 | return -ENOMEM; | ||
145 | } | ||
146 | |||
147 | ret = ida_get_new(&musb_ida, &id); | ||
148 | if (ret < 0) { | ||
149 | dev_err(dev, "failed to allocate a new id\n"); | ||
150 | return ret; | ||
151 | } | ||
152 | |||
153 | return id; | ||
154 | } | ||
155 | EXPORT_SYMBOL_GPL(musb_get_id); | ||
156 | |||
157 | void musb_put_id(struct device *dev, int id) | ||
158 | { | ||
159 | |||
160 | dev_dbg(dev, "removing id %d\n", id); | ||
161 | ida_remove(&musb_ida, id); | ||
162 | } | ||
163 | EXPORT_SYMBOL_GPL(musb_put_id); | ||
164 | |||
165 | #ifndef CONFIG_BLACKFIN | 135 | #ifndef CONFIG_BLACKFIN |
166 | static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | 136 | static int musb_ulpi_read(struct usb_phy *phy, u32 offset) |
167 | { | 137 | { |
@@ -467,12 +437,12 @@ void musb_hnp_stop(struct musb *musb) | |||
467 | */ | 437 | */ |
468 | 438 | ||
469 | static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | 439 | static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, |
470 | u8 devctl, u8 power) | 440 | u8 devctl) |
471 | { | 441 | { |
472 | struct usb_otg *otg = musb->xceiv->otg; | 442 | struct usb_otg *otg = musb->xceiv->otg; |
473 | irqreturn_t handled = IRQ_NONE; | 443 | irqreturn_t handled = IRQ_NONE; |
474 | 444 | ||
475 | dev_dbg(musb->controller, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl, | 445 | dev_dbg(musb->controller, "<== DevCtl=%02x, int_usb=0x%x\n", devctl, |
476 | int_usb); | 446 | int_usb); |
477 | 447 | ||
478 | /* in host mode, the peripheral may issue remote wakeup. | 448 | /* in host mode, the peripheral may issue remote wakeup. |
@@ -485,6 +455,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
485 | 455 | ||
486 | if (devctl & MUSB_DEVCTL_HM) { | 456 | if (devctl & MUSB_DEVCTL_HM) { |
487 | void __iomem *mbase = musb->mregs; | 457 | void __iomem *mbase = musb->mregs; |
458 | u8 power; | ||
488 | 459 | ||
489 | switch (musb->xceiv->state) { | 460 | switch (musb->xceiv->state) { |
490 | case OTG_STATE_A_SUSPEND: | 461 | case OTG_STATE_A_SUSPEND: |
@@ -492,6 +463,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
492 | * will stop RESUME signaling | 463 | * will stop RESUME signaling |
493 | */ | 464 | */ |
494 | 465 | ||
466 | power = musb_readb(musb->mregs, MUSB_POWER); | ||
495 | if (power & MUSB_POWER_SUSPENDM) { | 467 | if (power & MUSB_POWER_SUSPENDM) { |
496 | /* spurious */ | 468 | /* spurious */ |
497 | musb->int_usb &= ~MUSB_INTR_SUSPEND; | 469 | musb->int_usb &= ~MUSB_INTR_SUSPEND; |
@@ -655,8 +627,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
655 | } | 627 | } |
656 | 628 | ||
657 | if (int_usb & MUSB_INTR_SUSPEND) { | 629 | if (int_usb & MUSB_INTR_SUSPEND) { |
658 | dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x power %02x\n", | 630 | dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x\n", |
659 | otg_state_string(musb->xceiv->state), devctl, power); | 631 | otg_state_string(musb->xceiv->state), devctl); |
660 | handled = IRQ_HANDLED; | 632 | handled = IRQ_HANDLED; |
661 | 633 | ||
662 | switch (musb->xceiv->state) { | 634 | switch (musb->xceiv->state) { |
@@ -722,8 +694,10 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
722 | if (is_peripheral_active(musb)) { | 694 | if (is_peripheral_active(musb)) { |
723 | /* REVISIT HNP; just force disconnect */ | 695 | /* REVISIT HNP; just force disconnect */ |
724 | } | 696 | } |
725 | musb_writew(musb->mregs, MUSB_INTRTXE, musb->epmask); | 697 | musb->intrtxe = musb->epmask; |
726 | musb_writew(musb->mregs, MUSB_INTRRXE, musb->epmask & 0xfffe); | 698 | musb_writew(musb->mregs, MUSB_INTRTXE, musb->intrtxe); |
699 | musb->intrrxe = musb->epmask & 0xfffe; | ||
700 | musb_writew(musb->mregs, MUSB_INTRRXE, musb->intrrxe); | ||
727 | musb_writeb(musb->mregs, MUSB_INTRUSBE, 0xf7); | 701 | musb_writeb(musb->mregs, MUSB_INTRUSBE, 0xf7); |
728 | musb->port1_status &= ~(USB_PORT_STAT_LOW_SPEED | 702 | musb->port1_status &= ~(USB_PORT_STAT_LOW_SPEED |
729 | |USB_PORT_STAT_HIGH_SPEED | 703 | |USB_PORT_STAT_HIGH_SPEED |
@@ -944,8 +918,10 @@ void musb_start(struct musb *musb) | |||
944 | dev_dbg(musb->controller, "<== devctl %02x\n", devctl); | 918 | dev_dbg(musb->controller, "<== devctl %02x\n", devctl); |
945 | 919 | ||
946 | /* Set INT enable registers, enable interrupts */ | 920 | /* Set INT enable registers, enable interrupts */ |
947 | musb_writew(regs, MUSB_INTRTXE, musb->epmask); | 921 | musb->intrtxe = musb->epmask; |
948 | musb_writew(regs, MUSB_INTRRXE, musb->epmask & 0xfffe); | 922 | musb_writew(regs, MUSB_INTRTXE, musb->intrtxe); |
923 | musb->intrrxe = musb->epmask & 0xfffe; | ||
924 | musb_writew(regs, MUSB_INTRRXE, musb->intrrxe); | ||
949 | musb_writeb(regs, MUSB_INTRUSBE, 0xf7); | 925 | musb_writeb(regs, MUSB_INTRUSBE, 0xf7); |
950 | 926 | ||
951 | musb_writeb(regs, MUSB_TESTMODE, 0); | 927 | musb_writeb(regs, MUSB_TESTMODE, 0); |
@@ -983,7 +959,9 @@ static void musb_generic_disable(struct musb *musb) | |||
983 | 959 | ||
984 | /* disable interrupts */ | 960 | /* disable interrupts */ |
985 | musb_writeb(mbase, MUSB_INTRUSBE, 0); | 961 | musb_writeb(mbase, MUSB_INTRUSBE, 0); |
962 | musb->intrtxe = 0; | ||
986 | musb_writew(mbase, MUSB_INTRTXE, 0); | 963 | musb_writew(mbase, MUSB_INTRTXE, 0); |
964 | musb->intrrxe = 0; | ||
987 | musb_writew(mbase, MUSB_INTRRXE, 0); | 965 | musb_writew(mbase, MUSB_INTRRXE, 0); |
988 | 966 | ||
989 | /* off */ | 967 | /* off */ |
@@ -1062,12 +1040,12 @@ static void musb_shutdown(struct platform_device *pdev) | |||
1062 | || defined(CONFIG_USB_MUSB_AM35X_MODULE) \ | 1040 | || defined(CONFIG_USB_MUSB_AM35X_MODULE) \ |
1063 | || defined(CONFIG_USB_MUSB_DSPS) \ | 1041 | || defined(CONFIG_USB_MUSB_DSPS) \ |
1064 | || defined(CONFIG_USB_MUSB_DSPS_MODULE) | 1042 | || defined(CONFIG_USB_MUSB_DSPS_MODULE) |
1065 | static ushort __devinitdata fifo_mode = 4; | 1043 | static ushort fifo_mode = 4; |
1066 | #elif defined(CONFIG_USB_MUSB_UX500) \ | 1044 | #elif defined(CONFIG_USB_MUSB_UX500) \ |
1067 | || defined(CONFIG_USB_MUSB_UX500_MODULE) | 1045 | || defined(CONFIG_USB_MUSB_UX500_MODULE) |
1068 | static ushort __devinitdata fifo_mode = 5; | 1046 | static ushort fifo_mode = 5; |
1069 | #else | 1047 | #else |
1070 | static ushort __devinitdata fifo_mode = 2; | 1048 | static ushort fifo_mode = 2; |
1071 | #endif | 1049 | #endif |
1072 | 1050 | ||
1073 | /* "modprobe ... fifo_mode=1" etc */ | 1051 | /* "modprobe ... fifo_mode=1" etc */ |
@@ -1080,7 +1058,7 @@ MODULE_PARM_DESC(fifo_mode, "initial endpoint configuration"); | |||
1080 | */ | 1058 | */ |
1081 | 1059 | ||
1082 | /* mode 0 - fits in 2KB */ | 1060 | /* mode 0 - fits in 2KB */ |
1083 | static struct musb_fifo_cfg __devinitdata mode_0_cfg[] = { | 1061 | static struct musb_fifo_cfg mode_0_cfg[] = { |
1084 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, | 1062 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, |
1085 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, | 1063 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, |
1086 | { .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, }, | 1064 | { .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, }, |
@@ -1089,7 +1067,7 @@ static struct musb_fifo_cfg __devinitdata mode_0_cfg[] = { | |||
1089 | }; | 1067 | }; |
1090 | 1068 | ||
1091 | /* mode 1 - fits in 4KB */ | 1069 | /* mode 1 - fits in 4KB */ |
1092 | static struct musb_fifo_cfg __devinitdata mode_1_cfg[] = { | 1070 | static struct musb_fifo_cfg mode_1_cfg[] = { |
1093 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, }, | 1071 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, }, |
1094 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, }, | 1072 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, }, |
1095 | { .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, .mode = BUF_DOUBLE, }, | 1073 | { .hw_ep_num = 2, .style = FIFO_RXTX, .maxpacket = 512, .mode = BUF_DOUBLE, }, |
@@ -1098,7 +1076,7 @@ static struct musb_fifo_cfg __devinitdata mode_1_cfg[] = { | |||
1098 | }; | 1076 | }; |
1099 | 1077 | ||
1100 | /* mode 2 - fits in 4KB */ | 1078 | /* mode 2 - fits in 4KB */ |
1101 | static struct musb_fifo_cfg __devinitdata mode_2_cfg[] = { | 1079 | static struct musb_fifo_cfg mode_2_cfg[] = { |
1102 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, | 1080 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, |
1103 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, | 1081 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, |
1104 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, | 1082 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, |
@@ -1108,7 +1086,7 @@ static struct musb_fifo_cfg __devinitdata mode_2_cfg[] = { | |||
1108 | }; | 1086 | }; |
1109 | 1087 | ||
1110 | /* mode 3 - fits in 4KB */ | 1088 | /* mode 3 - fits in 4KB */ |
1111 | static struct musb_fifo_cfg __devinitdata mode_3_cfg[] = { | 1089 | static struct musb_fifo_cfg mode_3_cfg[] = { |
1112 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, }, | 1090 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, .mode = BUF_DOUBLE, }, |
1113 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, }, | 1091 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, .mode = BUF_DOUBLE, }, |
1114 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, | 1092 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, |
@@ -1118,7 +1096,7 @@ static struct musb_fifo_cfg __devinitdata mode_3_cfg[] = { | |||
1118 | }; | 1096 | }; |
1119 | 1097 | ||
1120 | /* mode 4 - fits in 16KB */ | 1098 | /* mode 4 - fits in 16KB */ |
1121 | static struct musb_fifo_cfg __devinitdata mode_4_cfg[] = { | 1099 | static struct musb_fifo_cfg mode_4_cfg[] = { |
1122 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, | 1100 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, |
1123 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, | 1101 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, |
1124 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, | 1102 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, |
@@ -1149,7 +1127,7 @@ static struct musb_fifo_cfg __devinitdata mode_4_cfg[] = { | |||
1149 | }; | 1127 | }; |
1150 | 1128 | ||
1151 | /* mode 5 - fits in 8KB */ | 1129 | /* mode 5 - fits in 8KB */ |
1152 | static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = { | 1130 | static struct musb_fifo_cfg mode_5_cfg[] = { |
1153 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, | 1131 | { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, }, |
1154 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, | 1132 | { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, |
1155 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, | 1133 | { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, |
@@ -1185,7 +1163,7 @@ static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = { | |||
1185 | * | 1163 | * |
1186 | * returns negative errno or offset for next fifo. | 1164 | * returns negative errno or offset for next fifo. |
1187 | */ | 1165 | */ |
1188 | static int __devinit | 1166 | static int |
1189 | fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, | 1167 | fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, |
1190 | const struct musb_fifo_cfg *cfg, u16 offset) | 1168 | const struct musb_fifo_cfg *cfg, u16 offset) |
1191 | { | 1169 | { |
@@ -1256,11 +1234,11 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, | |||
1256 | return offset + (maxpacket << ((c_size & MUSB_FIFOSZ_DPB) ? 1 : 0)); | 1234 | return offset + (maxpacket << ((c_size & MUSB_FIFOSZ_DPB) ? 1 : 0)); |
1257 | } | 1235 | } |
1258 | 1236 | ||
1259 | static struct musb_fifo_cfg __devinitdata ep0_cfg = { | 1237 | static struct musb_fifo_cfg ep0_cfg = { |
1260 | .style = FIFO_RXTX, .maxpacket = 64, | 1238 | .style = FIFO_RXTX, .maxpacket = 64, |
1261 | }; | 1239 | }; |
1262 | 1240 | ||
1263 | static int __devinit ep_config_from_table(struct musb *musb) | 1241 | static int ep_config_from_table(struct musb *musb) |
1264 | { | 1242 | { |
1265 | const struct musb_fifo_cfg *cfg; | 1243 | const struct musb_fifo_cfg *cfg; |
1266 | unsigned i, n; | 1244 | unsigned i, n; |
@@ -1351,7 +1329,7 @@ done: | |||
1351 | * ep_config_from_hw - when MUSB_C_DYNFIFO_DEF is false | 1329 | * ep_config_from_hw - when MUSB_C_DYNFIFO_DEF is false |
1352 | * @param musb the controller | 1330 | * @param musb the controller |
1353 | */ | 1331 | */ |
1354 | static int __devinit ep_config_from_hw(struct musb *musb) | 1332 | static int ep_config_from_hw(struct musb *musb) |
1355 | { | 1333 | { |
1356 | u8 epnum = 0; | 1334 | u8 epnum = 0; |
1357 | struct musb_hw_ep *hw_ep; | 1335 | struct musb_hw_ep *hw_ep; |
@@ -1398,7 +1376,7 @@ enum { MUSB_CONTROLLER_MHDRC, MUSB_CONTROLLER_HDRC, }; | |||
1398 | /* Initialize MUSB (M)HDRC part of the USB hardware subsystem; | 1376 | /* Initialize MUSB (M)HDRC part of the USB hardware subsystem; |
1399 | * configure endpoints, or take their config from silicon | 1377 | * configure endpoints, or take their config from silicon |
1400 | */ | 1378 | */ |
1401 | static int __devinit musb_core_init(u16 musb_type, struct musb *musb) | 1379 | static int musb_core_init(u16 musb_type, struct musb *musb) |
1402 | { | 1380 | { |
1403 | u8 reg; | 1381 | u8 reg; |
1404 | char *type; | 1382 | char *type; |
@@ -1523,33 +1501,6 @@ static int __devinit musb_core_init(u16 musb_type, struct musb *musb) | |||
1523 | 1501 | ||
1524 | /*-------------------------------------------------------------------------*/ | 1502 | /*-------------------------------------------------------------------------*/ |
1525 | 1503 | ||
1526 | #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) || \ | ||
1527 | defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500) | ||
1528 | |||
1529 | static irqreturn_t generic_interrupt(int irq, void *__hci) | ||
1530 | { | ||
1531 | unsigned long flags; | ||
1532 | irqreturn_t retval = IRQ_NONE; | ||
1533 | struct musb *musb = __hci; | ||
1534 | |||
1535 | spin_lock_irqsave(&musb->lock, flags); | ||
1536 | |||
1537 | musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); | ||
1538 | musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); | ||
1539 | musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); | ||
1540 | |||
1541 | if (musb->int_usb || musb->int_tx || musb->int_rx) | ||
1542 | retval = musb_interrupt(musb); | ||
1543 | |||
1544 | spin_unlock_irqrestore(&musb->lock, flags); | ||
1545 | |||
1546 | return retval; | ||
1547 | } | ||
1548 | |||
1549 | #else | ||
1550 | #define generic_interrupt NULL | ||
1551 | #endif | ||
1552 | |||
1553 | /* | 1504 | /* |
1554 | * handle all the irqs defined by the HDRC core. for now we expect: other | 1505 | * handle all the irqs defined by the HDRC core. for now we expect: other |
1555 | * irq sources (phy, dma, etc) will be handled first, musb->int_* values | 1506 | * irq sources (phy, dma, etc) will be handled first, musb->int_* values |
@@ -1560,12 +1511,11 @@ static irqreturn_t generic_interrupt(int irq, void *__hci) | |||
1560 | irqreturn_t musb_interrupt(struct musb *musb) | 1511 | irqreturn_t musb_interrupt(struct musb *musb) |
1561 | { | 1512 | { |
1562 | irqreturn_t retval = IRQ_NONE; | 1513 | irqreturn_t retval = IRQ_NONE; |
1563 | u8 devctl, power; | 1514 | u8 devctl; |
1564 | int ep_num; | 1515 | int ep_num; |
1565 | u32 reg; | 1516 | u32 reg; |
1566 | 1517 | ||
1567 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 1518 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
1568 | power = musb_readb(musb->mregs, MUSB_POWER); | ||
1569 | 1519 | ||
1570 | dev_dbg(musb->controller, "** IRQ %s usb%04x tx%04x rx%04x\n", | 1520 | dev_dbg(musb->controller, "** IRQ %s usb%04x tx%04x rx%04x\n", |
1571 | (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral", | 1521 | (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral", |
@@ -1576,7 +1526,7 @@ irqreturn_t musb_interrupt(struct musb *musb) | |||
1576 | */ | 1526 | */ |
1577 | if (musb->int_usb) | 1527 | if (musb->int_usb) |
1578 | retval |= musb_stage0_irq(musb, musb->int_usb, | 1528 | retval |= musb_stage0_irq(musb, musb->int_usb, |
1579 | devctl, power); | 1529 | devctl); |
1580 | 1530 | ||
1581 | /* "stage 1" is handling endpoint irqs */ | 1531 | /* "stage 1" is handling endpoint irqs */ |
1582 | 1532 | ||
@@ -1628,7 +1578,7 @@ irqreturn_t musb_interrupt(struct musb *musb) | |||
1628 | EXPORT_SYMBOL_GPL(musb_interrupt); | 1578 | EXPORT_SYMBOL_GPL(musb_interrupt); |
1629 | 1579 | ||
1630 | #ifndef CONFIG_MUSB_PIO_ONLY | 1580 | #ifndef CONFIG_MUSB_PIO_ONLY |
1631 | static bool __devinitdata use_dma = 1; | 1581 | static bool use_dma = 1; |
1632 | 1582 | ||
1633 | /* "modprobe ... use_dma=0" etc */ | 1583 | /* "modprobe ... use_dma=0" etc */ |
1634 | module_param(use_dma, bool, 0); | 1584 | module_param(use_dma, bool, 0); |
@@ -1809,8 +1759,7 @@ static void musb_irq_work(struct work_struct *data) | |||
1809 | * Init support | 1759 | * Init support |
1810 | */ | 1760 | */ |
1811 | 1761 | ||
1812 | static struct musb *__devinit | 1762 | static struct musb *allocate_instance(struct device *dev, |
1813 | allocate_instance(struct device *dev, | ||
1814 | struct musb_hdrc_config *config, void __iomem *mbase) | 1763 | struct musb_hdrc_config *config, void __iomem *mbase) |
1815 | { | 1764 | { |
1816 | struct musb *musb; | 1765 | struct musb *musb; |
@@ -1885,7 +1834,7 @@ static void musb_free(struct musb *musb) | |||
1885 | * @ctrl: virtual address of controller registers, | 1834 | * @ctrl: virtual address of controller registers, |
1886 | * not yet corrected for platform-specific offsets | 1835 | * not yet corrected for platform-specific offsets |
1887 | */ | 1836 | */ |
1888 | static int __devinit | 1837 | static int |
1889 | musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | 1838 | musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) |
1890 | { | 1839 | { |
1891 | int status; | 1840 | int status; |
@@ -1919,7 +1868,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1919 | musb->ops = plat->platform_ops; | 1868 | musb->ops = plat->platform_ops; |
1920 | 1869 | ||
1921 | /* The musb_platform_init() call: | 1870 | /* The musb_platform_init() call: |
1922 | * - adjusts musb->mregs and musb->isr if needed, | 1871 | * - adjusts musb->mregs |
1872 | * - sets the musb->isr | ||
1923 | * - may initialize an integrated tranceiver | 1873 | * - may initialize an integrated tranceiver |
1924 | * - initializes musb->xceiv, usually by otg_get_phy() | 1874 | * - initializes musb->xceiv, usually by otg_get_phy() |
1925 | * - stops powering VBUS | 1875 | * - stops powering VBUS |
@@ -1929,7 +1879,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1929 | * external/discrete ones in various flavors (twl4030 family, | 1879 | * external/discrete ones in various flavors (twl4030 family, |
1930 | * isp1504, non-OTG, etc) mostly hooking up through ULPI. | 1880 | * isp1504, non-OTG, etc) mostly hooking up through ULPI. |
1931 | */ | 1881 | */ |
1932 | musb->isr = generic_interrupt; | ||
1933 | status = musb_platform_init(musb); | 1882 | status = musb_platform_init(musb); |
1934 | if (status < 0) | 1883 | if (status < 0) |
1935 | goto fail1; | 1884 | goto fail1; |
@@ -2060,7 +2009,7 @@ fail0: | |||
2060 | /* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just | 2009 | /* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just |
2061 | * bridge to a platform device; this driver then suffices. | 2010 | * bridge to a platform device; this driver then suffices. |
2062 | */ | 2011 | */ |
2063 | static int __devinit musb_probe(struct platform_device *pdev) | 2012 | static int musb_probe(struct platform_device *pdev) |
2064 | { | 2013 | { |
2065 | struct device *dev = &pdev->dev; | 2014 | struct device *dev = &pdev->dev; |
2066 | int irq = platform_get_irq_byname(pdev, "mc"); | 2015 | int irq = platform_get_irq_byname(pdev, "mc"); |
@@ -2085,7 +2034,7 @@ static int __devinit musb_probe(struct platform_device *pdev) | |||
2085 | return status; | 2034 | return status; |
2086 | } | 2035 | } |
2087 | 2036 | ||
2088 | static int __devexit musb_remove(struct platform_device *pdev) | 2037 | static int musb_remove(struct platform_device *pdev) |
2089 | { | 2038 | { |
2090 | struct device *dev = &pdev->dev; | 2039 | struct device *dev = &pdev->dev; |
2091 | struct musb *musb = dev_to_musb(dev); | 2040 | struct musb *musb = dev_to_musb(dev); |
@@ -2120,8 +2069,6 @@ static void musb_save_context(struct musb *musb) | |||
2120 | musb->context.testmode = musb_readb(musb_base, MUSB_TESTMODE); | 2069 | musb->context.testmode = musb_readb(musb_base, MUSB_TESTMODE); |
2121 | musb->context.busctl = musb_read_ulpi_buscontrol(musb->mregs); | 2070 | musb->context.busctl = musb_read_ulpi_buscontrol(musb->mregs); |
2122 | musb->context.power = musb_readb(musb_base, MUSB_POWER); | 2071 | musb->context.power = musb_readb(musb_base, MUSB_POWER); |
2123 | musb->context.intrtxe = musb_readw(musb_base, MUSB_INTRTXE); | ||
2124 | musb->context.intrrxe = musb_readw(musb_base, MUSB_INTRRXE); | ||
2125 | musb->context.intrusbe = musb_readb(musb_base, MUSB_INTRUSBE); | 2072 | musb->context.intrusbe = musb_readb(musb_base, MUSB_INTRUSBE); |
2126 | musb->context.index = musb_readb(musb_base, MUSB_INDEX); | 2073 | musb->context.index = musb_readb(musb_base, MUSB_INDEX); |
2127 | musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); | 2074 | musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); |
@@ -2194,8 +2141,8 @@ static void musb_restore_context(struct musb *musb) | |||
2194 | musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode); | 2141 | musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode); |
2195 | musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl); | 2142 | musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl); |
2196 | musb_writeb(musb_base, MUSB_POWER, musb->context.power); | 2143 | musb_writeb(musb_base, MUSB_POWER, musb->context.power); |
2197 | musb_writew(musb_base, MUSB_INTRTXE, musb->context.intrtxe); | 2144 | musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); |
2198 | musb_writew(musb_base, MUSB_INTRRXE, musb->context.intrrxe); | 2145 | musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); |
2199 | musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); | 2146 | musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); |
2200 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); | 2147 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); |
2201 | 2148 | ||
@@ -2340,7 +2287,7 @@ static struct platform_driver musb_driver = { | |||
2340 | .pm = MUSB_DEV_PM_OPS, | 2287 | .pm = MUSB_DEV_PM_OPS, |
2341 | }, | 2288 | }, |
2342 | .probe = musb_probe, | 2289 | .probe = musb_probe, |
2343 | .remove = __devexit_p(musb_remove), | 2290 | .remove = musb_remove, |
2344 | .shutdown = musb_shutdown, | 2291 | .shutdown = musb_shutdown, |
2345 | }; | 2292 | }; |
2346 | 2293 | ||