]> git.hungrycats.org Git - linux/commitdiff
ohci1394(r1160): Disable cross_bound() check, and add code to try to enable connected...
authorBen Collins <bcollins@debian.org>
Mon, 23 Feb 2004 14:41:21 +0000 (09:41 -0500)
committerBen Collins <bcollins@debian.org>
Mon, 23 Feb 2004 14:41:21 +0000 (09:41 -0500)
drivers/ieee1394/ohci1394.c
drivers/ieee1394/ohci1394.h

index 9cdca53685bd319c760eaea84933ff3e593c15e0..20798cee36ca8e333fcf66b10d20392a458a158d 100644 (file)
@@ -501,6 +501,7 @@ static void ohci_initialize(struct ti_ohci *ohci)
 {
        char irq_buf[16];
        quadlet_t buf;
+       int num_ports, i;
 
        spin_lock_init(&ohci->phy_reg_lock);
        spin_lock_init(&ohci->event_lock);
@@ -527,10 +528,6 @@ static void ohci_initialize(struct ti_ohci *ohci)
                  OHCI1394_LinkControl_CycleMaster);
        set_phy_reg_mask(ohci, 4, 0xc0);
 
-       /* Clear interrupt registers */
-       reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff);
-       reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff);
-
        /* Set up self-id dma buffer */
        reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->selfid_buf_bus);
 
@@ -610,6 +607,19 @@ static void ohci_initialize(struct ti_ohci *ohci)
              pci_resource_start(ohci->dev, 0),
              pci_resource_start(ohci->dev, 0) + OHCI1394_REGISTER_SIZE - 1,
              ohci->max_packet_size);
+
+       /* Check all of our ports to make sure that if anything is
+        * connected, we enable that port. */
+       num_ports = get_phy_reg(ohci, 2) & 0xf;
+       for (i = 0; i < num_ports; i++) {
+               unsigned int status;
+
+               set_phy_reg(ohci, 7, i);
+               status = get_phy_reg(ohci, 8);
+
+               if (status & 0x20)
+                       set_phy_reg(ohci, 8, status & ~1);
+       }
 }
 
 /* 
@@ -690,7 +700,12 @@ static void insert_packet(struct ti_ohci *ohci,
                         /* 
                          * Check that the packet data buffer
                          * does not cross a page boundary.
+                        *
+                        * XXX Fix this some day. eth1394 seems to trigger
+                        * it, but ignoring it doesn't seem to cause a
+                        * problem.
                          */
+#if 0
                         if (cross_bound((unsigned long)packet->data, 
                                         packet->data_size)>0) {
                                 /* FIXME: do something about it */
@@ -699,7 +714,7 @@ static void insert_packet(struct ti_ohci *ohci,
                                       "cross page boundary", __FUNCTION__,
                                       packet->data, packet->data_size);
                         }
-
+#endif
                         d->prg_cpu[idx]->end.address = cpu_to_le32(
                                 pci_map_single(ohci->dev, packet->data,
                                                packet->data_size,
@@ -3190,6 +3205,7 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
                ohci->selfid_swap = 1;
 #endif
 
+
 #ifndef PCI_DEVICE_ID_NVIDIA_NFORCE2_FW
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2_FW 0x006e
 #endif
index 3d400e1c361fb86fbf076e876ff01aa233eb92c3..ceecf7361bf99156ff716b5909e5220efad0951e 100644 (file)
@@ -238,14 +238,13 @@ struct ti_ohci {
 
 static inline int cross_bound(unsigned long addr, unsigned int size)
 {
-       int cross=0;
-       if (size>PAGE_SIZE) {
-               cross = size/PAGE_SIZE;
-               size -= cross*PAGE_SIZE;
-       }
-       if ((PAGE_SIZE-addr%PAGE_SIZE)<size)
-               cross++;
-       return cross;
+       if (size > PAGE_SIZE)
+               return 1;
+
+       if (addr >> PAGE_SHIFT != (addr + size - 1) >> PAGE_SHIFT)
+               return 1;
+
+       return 0;
 }
 
 /*