Lines Matching refs:dma

82 #include <linux/dma-mapping.h>
314 struct i596_dma *dma;
369 return lp->dma_addr + ((unsigned long)v - (unsigned long)lp->dma);
399 static inline int wait_istat(struct net_device *dev, struct i596_dma *dma, int delcnt, char *str)
401 dma_sync_cpu(dev, &(dma->iscp), sizeof(struct i596_iscp));
402 while (--delcnt && dma->iscp.stat) {
404 dma_sync_cpu(dev, &(dma->iscp), sizeof(struct i596_iscp));
408 dev->name, str, SWAP16(dma->iscp.stat));
415 static inline int wait_cmd(struct net_device *dev, struct i596_dma *dma, int delcnt, char *str)
417 dma_sync_cpu(dev, &(dma->scb), sizeof(struct i596_scb));
418 while (--delcnt && dma->scb.command) {
420 dma_sync_cpu(dev, &(dma->scb), sizeof(struct i596_scb));
425 SWAP16(dma->scb.status),
426 SWAP16(dma->scb.command));
436 struct i596_dma *dma = lp->dma;
442 &dma->scp, dma->scp.sysbus, SWAP32(dma->scp.iscp));
444 &dma->iscp, SWAP32(dma->iscp.stat), SWAP32(dma->iscp.scb));
447 &dma->scb, SWAP16(dma->scb.status), SWAP16(dma->scb.command),
448 SWAP16(dma->scb.cmd), SWAP32(dma->scb.rfd));
451 SWAP32(dma->scb.crc_err), SWAP32(dma->scb.align_err),
452 SWAP32(dma->scb.resource_err), SWAP32(dma->scb.over_err),
453 SWAP32(dma->scb.rcvdt_err), SWAP32(dma->scb.short_err));
484 dma_sync_cpu(dev, dma, sizeof(struct i596_dma));
490 struct i596_dma *dma = lp->dma;
497 for (i = 0, rbd = dma->rbds; i < rx_ring_size; i++, rbd++) {
514 lp->rbd_head = dma->rbds;
515 rbd = dma->rbds + rx_ring_size - 1;
516 rbd->v_next = dma->rbds;
517 rbd->b_next = SWAP32(virt_to_dma(lp, dma->rbds));
521 for (i = 0, rfd = dma->rfds; i < rx_ring_size; i++, rfd++) {
528 lp->rfd_head = dma->rfds;
529 dma->scb.rfd = SWAP32(virt_to_dma(lp, dma->rfds));
530 rfd = dma->rfds;
532 rfd->v_prev = dma->rfds + rx_ring_size - 1;
533 rfd = dma->rfds + rx_ring_size - 1;
534 rfd->v_next = dma->rfds;
535 rfd->b_next = SWAP32(virt_to_dma(lp, dma->rfds));
538 dma_sync_dev(dev, dma, sizeof(struct i596_dma));
548 for (i = 0, rbd = lp->dma->rbds; i < rx_ring_size; i++, rbd++) {
562 struct i596_dma *dma = lp->dma;
568 dma->rfds[i].rbd = I596_NULL;
569 dma->rfds[i].cmd = SWAP16(CMD_FLEX);
571 dma->rfds[rx_ring_size-1].cmd = SWAP16(CMD_EOL|CMD_FLEX);
572 lp->rfd_head = dma->rfds;
573 dma->scb.rfd = SWAP32(virt_to_dma(lp, dma->rfds));
574 lp->rbd_head = dma->rbds;
575 dma->rfds[0].rbd = SWAP32(virt_to_dma(lp, dma->rbds));
577 dma_sync_dev(dev, dma, sizeof(struct i596_dma));
584 struct i596_dma *dma = lp->dma;
594 dma->scp.sysbus = SYSBUS;
595 dma->scp.iscp = SWAP32(virt_to_dma(lp, &(dma->iscp)));
596 dma->iscp.scb = SWAP32(virt_to_dma(lp, &(dma->scb)));
597 dma->iscp.stat = SWAP32(ISCP_BUSY);
601 dma->scb.cmd = I596_NULL;
605 dma_sync_dev(dev, &(dma->scp), sizeof(struct i596_scp));
606 dma_sync_dev(dev, &(dma->iscp), sizeof(struct i596_iscp));
607 dma_sync_dev(dev, &(dma->scb), sizeof(struct i596_scb));
609 mpu_port(dev, PORT_ALTSCP, virt_to_dma(lp, &dma->scp));
611 if (wait_istat(dev, dma, 1000, "initialization timed out"))
625 dma->scb.command = 0;
626 dma_sync_dev(dev, &(dma->scb), sizeof(struct i596_scb));
630 memcpy(dma->cf_cmd.i596_config, init_setup, 14);
631 dma->cf_cmd.cmd.command = SWAP16(CmdConfigure);
632 dma_sync_dev(dev, &(dma->cf_cmd), sizeof(struct cf_cmd));
633 i596_add_cmd(dev, &dma->cf_cmd.cmd);
636 memcpy(dma->sa_cmd.eth_addr, dev->dev_addr, ETH_ALEN);
637 dma->sa_cmd.cmd.command = SWAP16(CmdSASetup);
638 dma_sync_dev(dev, &(dma->sa_cmd), sizeof(struct sa_cmd));
639 i596_add_cmd(dev, &dma->sa_cmd.cmd);
642 dma->tdr_cmd.cmd.command = SWAP16(CmdTDR);
643 dma_sync_dev(dev, &(dma->tdr_cmd), sizeof(struct tdr_cmd));
644 i596_add_cmd(dev, &dma->tdr_cmd.cmd);
648 if (wait_cmd(dev, dma, 1000, "timed out waiting to issue RX_START")) {
653 dma->scb.command = SWAP16(RX_START);
654 dma->scb.rfd = SWAP32(virt_to_dma(lp, dma->rfds));
655 dma_sync_dev(dev, &(dma->scb), sizeof(struct i596_scb));
660 if (wait_cmd(dev, dma, 1000, "RX_START not processed"))
807 lp->dma->scb.rfd = rfd->b_next;
860 wait_cmd(dev, lp->dma, 100, "i596_cleanup_cmd timed out");
861 lp->dma->scb.cmd = I596_NULL;
862 dma_sync_dev(dev, &(lp->dma->scb), sizeof(struct i596_scb));
874 wait_cmd(dev, lp->dma, 100, "i596_reset timed out");
879 lp->dma->scb.command = SWAP16(CUC_ABORT | RX_ABORT);
880 dma_sync_dev(dev, &(lp->dma->scb), sizeof(struct i596_scb));
884 wait_cmd(dev, lp->dma, 1000, "i596_reset 2 timed out");
898 struct i596_dma *dma = lp->dma;
918 wait_cmd(dev, dma, 100, "i596_add_cmd timed out");
919 dma->scb.cmd = SWAP32(virt_to_dma(lp, &cmd->status));
920 dma->scb.command = SWAP16(CUC_START);
921 dma_sync_dev(dev, &(dma->scb), sizeof(struct i596_scb));
985 lp->dma->scb.command = SWAP16(CUC_START | RX_START);
986 dma_sync_dev(dev, &(lp->dma->scb), sizeof(struct i596_scb));
1015 tx_cmd = lp->dma->tx_cmds + lp->next_tx_cmd;
1016 tbd = lp->dma->tbds + lp->next_tx_cmd;
1095 memset(lp->dma, 0, sizeof(struct i596_dma));
1096 lp->dma->scb.command = 0;
1097 lp->dma->scb.cmd = I596_NULL;
1098 lp->dma->scb.rfd = I596_NULL;
1101 dma_sync_dev(dev, lp->dma, sizeof(struct i596_dma));
1111 "%s: dma at 0x%p (%d bytes), lp->scb at 0x%p\n",
1112 dev->name, lp->dma, (int)sizeof(struct i596_dma),
1113 &lp->dma->scb));
1131 struct i596_dma *dma;
1135 dma = lp->dma;
1139 wait_cmd(dev, dma, 100, "i596 interrupt, timeout");
1140 status = SWAP16(dma->scb.status);
1272 dma->scb.cmd = SWAP32(virt_to_dma(lp, &lp->cmd_head->status));
1273 dma_sync_dev(dev, &dma->scb, sizeof(struct i596_scb));
1296 wait_cmd(dev, dma, 100, "i596 interrupt, timeout");
1297 dma->scb.command = SWAP16(ack_cmd);
1298 dma_sync_dev(dev, &dma->scb, sizeof(struct i596_scb));
1306 wait_cmd(dev, dma, 100, "i596 interrupt, exit timeout");
1323 dev->name, SWAP16(lp->dma->scb.status)));
1327 wait_cmd(dev, lp->dma, 100, "close1 timed out");
1328 lp->dma->scb.command = SWAP16(CUC_ABORT | RX_ABORT);
1329 dma_sync_dev(dev, &lp->dma->scb, sizeof(struct i596_scb));
1333 wait_cmd(dev, lp->dma, 100, "close2 timed out");
1351 struct i596_dma *dma = lp->dma;
1362 !(dma->cf_cmd.i596_config[8] & 0x01)) {
1363 dma->cf_cmd.i596_config[8] |= 0x01;
1367 (dma->cf_cmd.i596_config[8] & 0x01)) {
1368 dma->cf_cmd.i596_config[8] &= ~0x01;
1372 (dma->cf_cmd.i596_config[11] & 0x20)) {
1373 dma->cf_cmd.i596_config[11] &= ~0x20;
1377 !(dma->cf_cmd.i596_config[11] & 0x20)) {
1378 dma->cf_cmd.i596_config[11] |= 0x20;
1382 if (dma->cf_cmd.cmd.command)
1387 dma->cf_cmd.cmd.command = SWAP16(CmdConfigure);
1388 dma_sync_dev(dev, &dma->cf_cmd, sizeof(struct cf_cmd));
1389 i596_add_cmd(dev, &dma->cf_cmd.cmd);
1405 cmd = &dma->mc_cmd;
1420 dma_sync_dev(dev, &dma->mc_cmd, sizeof(struct mc_cmd));