aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/isp1760-hcd.c
diff options
context:
space:
mode:
authorArvid Brodin <arvid.brodin@enea.com>2011-08-21 02:29:25 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-22 18:32:12 -0400
commit0ba7905e030a409fd0bb92cb965e915c0cb01030 (patch)
tree48bec194981b1af87ef7688ea3323769be8575b0 /drivers/usb/host/isp1760-hcd.c
parente25e0eb209bf945db554512430ee128e6bb7b291 (diff)
usb/isp1760: Move isp1760_run within file (prepare for next patch)
Like the previous patch, this patch has been split from the next one for clarity. Signed-off-by: Arvid Brodin <arvid.brodin@enea.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/isp1760-hcd.c')
-rw-r--r--drivers/usb/host/isp1760-hcd.c136
1 files changed, 68 insertions, 68 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index a46ccf97a5c9..e399e235f656 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -514,74 +514,6 @@ static int isp1760_hc_setup(struct usb_hcd *hcd)
514 return priv_init(hcd); 514 return priv_init(hcd);
515} 515}
516 516
517static int isp1760_run(struct usb_hcd *hcd)
518{
519 int retval;
520 u32 temp;
521 u32 command;
522 u32 chipid;
523
524 hcd->uses_new_polling = 1;
525
526 hcd->state = HC_STATE_RUNNING;
527
528 /* Set PTD interrupt AND & OR maps */
529 reg_write32(hcd->regs, HC_ATL_IRQ_MASK_AND_REG, 0);
530 reg_write32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG, 0xffffffff);
531 reg_write32(hcd->regs, HC_INT_IRQ_MASK_AND_REG, 0);
532 reg_write32(hcd->regs, HC_INT_IRQ_MASK_OR_REG, 0xffffffff);
533 reg_write32(hcd->regs, HC_ISO_IRQ_MASK_AND_REG, 0);
534 reg_write32(hcd->regs, HC_ISO_IRQ_MASK_OR_REG, 0xffffffff);
535 /* step 23 passed */
536
537 temp = reg_read32(hcd->regs, HC_HW_MODE_CTRL);
538 reg_write32(hcd->regs, HC_HW_MODE_CTRL, temp | HW_GLOBAL_INTR_EN);
539
540 command = reg_read32(hcd->regs, HC_USBCMD);
541 command &= ~(CMD_LRESET|CMD_RESET);
542 command |= CMD_RUN;
543 reg_write32(hcd->regs, HC_USBCMD, command);
544
545 retval = handshake(hcd, HC_USBCMD, CMD_RUN, CMD_RUN, 250 * 1000);
546 if (retval)
547 return retval;
548
549 /*
550 * XXX
551 * Spec says to write FLAG_CF as last config action, priv code grabs
552 * the semaphore while doing so.
553 */
554 down_write(&ehci_cf_port_reset_rwsem);
555 reg_write32(hcd->regs, HC_CONFIGFLAG, FLAG_CF);
556
557 retval = handshake(hcd, HC_CONFIGFLAG, FLAG_CF, FLAG_CF, 250 * 1000);
558 up_write(&ehci_cf_port_reset_rwsem);
559 if (retval)
560 return retval;
561
562 chipid = reg_read32(hcd->regs, HC_CHIP_ID_REG);
563 dev_info(hcd->self.controller, "USB ISP %04x HW rev. %d started\n",
564 chipid & 0xffff, chipid >> 16);
565
566 /* PTD Register Init Part 2, Step 28 */
567
568 /* Setup registers controlling PTD checking */
569 reg_write32(hcd->regs, HC_ATL_PTD_LASTPTD_REG, 0x80000000);
570 reg_write32(hcd->regs, HC_INT_PTD_LASTPTD_REG, 0x80000000);
571 reg_write32(hcd->regs, HC_ISO_PTD_LASTPTD_REG, 0x00000001);
572 reg_write32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG, 0xffffffff);
573 reg_write32(hcd->regs, HC_INT_PTD_SKIPMAP_REG, 0xffffffff);
574 reg_write32(hcd->regs, HC_ISO_PTD_SKIPMAP_REG, 0xffffffff);
575 reg_write32(hcd->regs, HC_BUFFER_STATUS_REG,
576 ATL_BUF_FILL | INT_BUF_FILL);
577
578 /* GRR this is run-once init(), being done every time the HC starts.
579 * So long as they're part of class devices, we can't do it init()
580 * since the class device isn't created that early.
581 */
582 return 0;
583}
584
585static u32 base_to_chip(u32 base) 517static u32 base_to_chip(u32 base)
586{ 518{
587 return ((base - 0x400) >> 3); 519 return ((base - 0x400) >> 3);
@@ -1326,6 +1258,74 @@ leave:
1326 return irqret; 1258 return irqret;
1327} 1259}
1328 1260
1261static int isp1760_run(struct usb_hcd *hcd)
1262{
1263 int retval;
1264 u32 temp;
1265 u32 command;
1266 u32 chipid;
1267
1268 hcd->uses_new_polling = 1;
1269
1270 hcd->state = HC_STATE_RUNNING;
1271
1272 /* Set PTD interrupt AND & OR maps */
1273 reg_write32(hcd->regs, HC_ATL_IRQ_MASK_AND_REG, 0);
1274 reg_write32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG, 0xffffffff);
1275 reg_write32(hcd->regs, HC_INT_IRQ_MASK_AND_REG, 0);
1276 reg_write32(hcd->regs, HC_INT_IRQ_MASK_OR_REG, 0xffffffff);
1277 reg_write32(hcd->regs, HC_ISO_IRQ_MASK_AND_REG, 0);
1278 reg_write32(hcd->regs, HC_ISO_IRQ_MASK_OR_REG, 0xffffffff);
1279 /* step 23 passed */
1280
1281 temp = reg_read32(hcd->regs, HC_HW_MODE_CTRL);
1282 reg_write32(hcd->regs, HC_HW_MODE_CTRL, temp | HW_GLOBAL_INTR_EN);
1283
1284 command = reg_read32(hcd->regs, HC_USBCMD);
1285 command &= ~(CMD_LRESET|CMD_RESET);
1286 command |= CMD_RUN;
1287 reg_write32(hcd->regs, HC_USBCMD, command);
1288
1289 retval = handshake(hcd, HC_USBCMD, CMD_RUN, CMD_RUN, 250 * 1000);
1290 if (retval)
1291 return retval;
1292
1293 /*
1294 * XXX
1295 * Spec says to write FLAG_CF as last config action, priv code grabs
1296 * the semaphore while doing so.
1297 */
1298 down_write(&ehci_cf_port_reset_rwsem);
1299 reg_write32(hcd->regs, HC_CONFIGFLAG, FLAG_CF);
1300
1301 retval = handshake(hcd, HC_CONFIGFLAG, FLAG_CF, FLAG_CF, 250 * 1000);
1302 up_write(&ehci_cf_port_reset_rwsem);
1303 if (retval)
1304 return retval;
1305
1306 chipid = reg_read32(hcd->regs, HC_CHIP_ID_REG);
1307 dev_info(hcd->self.controller, "USB ISP %04x HW rev. %d started\n",
1308 chipid & 0xffff, chipid >> 16);
1309
1310 /* PTD Register Init Part 2, Step 28 */
1311
1312 /* Setup registers controlling PTD checking */
1313 reg_write32(hcd->regs, HC_ATL_PTD_LASTPTD_REG, 0x80000000);
1314 reg_write32(hcd->regs, HC_INT_PTD_LASTPTD_REG, 0x80000000);
1315 reg_write32(hcd->regs, HC_ISO_PTD_LASTPTD_REG, 0x00000001);
1316 reg_write32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG, 0xffffffff);
1317 reg_write32(hcd->regs, HC_INT_PTD_SKIPMAP_REG, 0xffffffff);
1318 reg_write32(hcd->regs, HC_ISO_PTD_SKIPMAP_REG, 0xffffffff);
1319 reg_write32(hcd->regs, HC_BUFFER_STATUS_REG,
1320 ATL_BUF_FILL | INT_BUF_FILL);
1321
1322 /* GRR this is run-once init(), being done every time the HC starts.
1323 * So long as they're part of class devices, we can't do it init()
1324 * since the class device isn't created that early.
1325 */
1326 return 0;
1327}
1328
1329static int qtd_fill(struct isp1760_qtd *qtd, void *databuffer, size_t len) 1329static int qtd_fill(struct isp1760_qtd *qtd, void *databuffer, size_t len)
1330{ 1330{
1331 qtd->data_buffer = databuffer; 1331 qtd->data_buffer = databuffer;