aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/ohci1394.c
diff options
context:
space:
mode:
authorBen Collins <bcollins@debian.org>2005-07-09 20:01:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-10 15:23:23 -0400
commit1934b8b6561ee7804b0a671b48cf642fcd936b2c (patch)
tree25c975176441aceedd2faae515121374f6f75750 /drivers/ieee1394/ohci1394.c
parentf179bc77d09b9087bfc559d0368bba350342ac76 (diff)
[PATCH] Sync up ieee-1394
Lots of this patch is trivial code cleanups (static vars were being intialized to 0, etc). There's also some fixes for ISO transmits (max buffer handling). Aswell, we have a few fixes to disable IRM capabilites correctly. We've also disabled, by default some generally unused EXPORT symbols for the sake of cleanliness in the kernel. However, instead of removing them completely, we felt it necessary to have a config option that allowed them to be enabled for the many projects outside of the main kernel tree that use our API for driver development. The primary reason for this patch is to revert a MODE6->MODE10 RBC conversion patch from the SCSI maintainers. The new conversions handled directly in the scsi layer do not seem to work for SBP2. This patch reverts to our old working code so that users can enjoy using Firewire disks and dvd drives again. We are working with the SCSI maintainers to resolve this issue outside of the main kernel tree. We'll merge the patch once the SCSI layer's handling of the MODE10 conversion is working for us. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/ieee1394/ohci1394.c')
-rw-r--r--drivers/ieee1394/ohci1394.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index b3d3d22fde6..a485f47bb21 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -162,7 +162,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
162printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) 162printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args)
163 163
164static char version[] __devinitdata = 164static char version[] __devinitdata =
165 "$Rev: 1250 $ Ben Collins <bcollins@debian.org>"; 165 "$Rev: 1299 $ Ben Collins <bcollins@debian.org>";
166 166
167/* Module Parameters */ 167/* Module Parameters */
168static int phys_dma = 1; 168static int phys_dma = 1;
@@ -483,7 +483,9 @@ static void ohci_initialize(struct ti_ohci *ohci)
483 /* Put some defaults to these undefined bus options */ 483 /* Put some defaults to these undefined bus options */
484 buf = reg_read(ohci, OHCI1394_BusOptions); 484 buf = reg_read(ohci, OHCI1394_BusOptions);
485 buf |= 0x60000000; /* Enable CMC and ISC */ 485 buf |= 0x60000000; /* Enable CMC and ISC */
486 if (!hpsb_disable_irm) 486 if (hpsb_disable_irm)
487 buf &= ~0x80000000;
488 else
487 buf |= 0x80000000; /* Enable IRMC */ 489 buf |= 0x80000000; /* Enable IRMC */
488 buf &= ~0x00ff0000; /* XXX: Set cyc_clk_acc to zero for now */ 490 buf &= ~0x00ff0000; /* XXX: Set cyc_clk_acc to zero for now */
489 buf &= ~0x18000000; /* Disable PMC and BMC */ 491 buf &= ~0x18000000; /* Disable PMC and BMC */
@@ -503,8 +505,12 @@ static void ohci_initialize(struct ti_ohci *ohci)
503 reg_write(ohci, OHCI1394_LinkControlSet, 505 reg_write(ohci, OHCI1394_LinkControlSet,
504 OHCI1394_LinkControl_CycleTimerEnable | 506 OHCI1394_LinkControl_CycleTimerEnable |
505 OHCI1394_LinkControl_CycleMaster); 507 OHCI1394_LinkControl_CycleMaster);
506 set_phy_reg_mask(ohci, 4, PHY_04_LCTRL | 508 i = get_phy_reg(ohci, 4) | PHY_04_LCTRL;
507 (hpsb_disable_irm ? 0 : PHY_04_CONTENDER)); 509 if (hpsb_disable_irm)
510 i &= ~PHY_04_CONTENDER;
511 else
512 i |= PHY_04_CONTENDER;
513 set_phy_reg(ohci, 4, i);
508 514
509 /* Set up self-id dma buffer */ 515 /* Set up self-id dma buffer */
510 reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->selfid_buf_bus); 516 reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->selfid_buf_bus);
@@ -1566,6 +1572,10 @@ static void ohci_iso_recv_release_block(struct ohci_iso_recv *recv, int block)
1566 1572
1567 struct dma_cmd *next = &recv->block[next_i]; 1573 struct dma_cmd *next = &recv->block[next_i];
1568 struct dma_cmd *prev = &recv->block[prev_i]; 1574 struct dma_cmd *prev = &recv->block[prev_i];
1575
1576 /* ignore out-of-range requests */
1577 if ((block < 0) || (block > recv->nblocks))
1578 return;
1569 1579
1570 /* 'next' becomes the new end of the DMA chain, 1580 /* 'next' becomes the new end of the DMA chain,
1571 so disable branch and enable interrupt */ 1581 so disable branch and enable interrupt */
@@ -1593,19 +1603,8 @@ static void ohci_iso_recv_release_block(struct ohci_iso_recv *recv, int block)
1593static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv, 1603static void ohci_iso_recv_bufferfill_release(struct ohci_iso_recv *recv,
1594 struct hpsb_iso_packet_info *info) 1604 struct hpsb_iso_packet_info *info)
1595{ 1605{
1596 int len;
1597
1598 /* release the memory where the packet was */ 1606 /* release the memory where the packet was */
1599 len = info->len; 1607 recv->released_bytes += info->total_len;
1600
1601 /* add the wasted space for padding to 4 bytes */
1602 if (len % 4)
1603 len += 4 - (len % 4);
1604
1605 /* add 8 bytes for the OHCI DMA data format overhead */
1606 len += 8;
1607
1608 recv->released_bytes += len;
1609 1608
1610 /* have we released enough memory for one block? */ 1609 /* have we released enough memory for one block? */
1611 while (recv->released_bytes > recv->buf_stride) { 1610 while (recv->released_bytes > recv->buf_stride) {
@@ -1637,7 +1636,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
1637 /* note: packet layout is as shown in section 10.6.1.1 of the OHCI spec */ 1636 /* note: packet layout is as shown in section 10.6.1.1 of the OHCI spec */
1638 1637
1639 unsigned int offset; 1638 unsigned int offset;
1640 unsigned short len, cycle; 1639 unsigned short len, cycle, total_len;
1641 unsigned char channel, tag, sy; 1640 unsigned char channel, tag, sy;
1642 1641
1643 unsigned char *p = iso->data_buf.kvirt; 1642 unsigned char *p = iso->data_buf.kvirt;
@@ -1688,9 +1687,11 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
1688 /* advance to xferStatus/timeStamp */ 1687 /* advance to xferStatus/timeStamp */
1689 recv->dma_offset += len; 1688 recv->dma_offset += len;
1690 1689
1690 total_len = len + 8; /* 8 bytes header+trailer in OHCI packet */
1691 /* payload is padded to 4 bytes */ 1691 /* payload is padded to 4 bytes */
1692 if (len % 4) { 1692 if (len % 4) {
1693 recv->dma_offset += 4 - (len%4); 1693 recv->dma_offset += 4 - (len%4);
1694 total_len += 4 - (len%4);
1694 } 1695 }
1695 1696
1696 /* check for wrap-around */ 1697 /* check for wrap-around */
@@ -1724,7 +1725,7 @@ static void ohci_iso_recv_bufferfill_parse(struct hpsb_iso *iso, struct ohci_iso
1724 recv->dma_offset -= recv->buf_stride*recv->nblocks; 1725 recv->dma_offset -= recv->buf_stride*recv->nblocks;
1725 } 1726 }
1726 1727
1727 hpsb_iso_packet_received(iso, offset, len, cycle, channel, tag, sy); 1728 hpsb_iso_packet_received(iso, offset, len, total_len, cycle, channel, tag, sy);
1728 } 1729 }
1729 1730
1730 if (wake) 1731 if (wake)
@@ -1850,7 +1851,8 @@ static void ohci_iso_recv_packetperbuf_task(struct hpsb_iso *iso, struct ohci_is
1850 tag = hdr[5] >> 6; 1851 tag = hdr[5] >> 6;
1851 sy = hdr[4] & 0xF; 1852 sy = hdr[4] & 0xF;
1852 1853
1853 hpsb_iso_packet_received(iso, offset, packet_len, cycle, channel, tag, sy); 1854 hpsb_iso_packet_received(iso, offset, packet_len,
1855 recv->buf_stride, cycle, channel, tag, sy);
1854 } 1856 }
1855 1857
1856 /* reset the DMA descriptor */ 1858 /* reset the DMA descriptor */