aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-ohci.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-03-07 12:12:56 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-09 16:03:15 -0500
commitd60d7f1d5ce83d1be8d79256f711d6a645b7a2fa (patch)
treedd3f02960657d4270efb0990b5cdfe0eeef62ad5 /drivers/firewire/fw-ohci.c
parent473d28c730e2de888c24b226cfe4183868eacde2 (diff)
firewire: Implement CSR cycle time and bus time registers.
Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-ohci.c')
-rw-r--r--drivers/firewire/fw-ohci.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index a9e13468f60c..6f9895d201b8 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -139,6 +139,7 @@ struct fw_ohci {
139 int node_id; 139 int node_id;
140 int generation; 140 int generation;
141 int request_generation; 141 int request_generation;
142 u32 bus_seconds;
142 143
143 /* Spinlock for accessing fw_ohci data. Never call out of 144 /* Spinlock for accessing fw_ohci data. Never call out of
144 * this driver with this lock held. */ 145 * this driver with this lock held. */
@@ -959,7 +960,7 @@ static void bus_reset_tasklet(unsigned long data)
959static irqreturn_t irq_handler(int irq, void *data) 960static irqreturn_t irq_handler(int irq, void *data)
960{ 961{
961 struct fw_ohci *ohci = data; 962 struct fw_ohci *ohci = data;
962 u32 event, iso_event; 963 u32 event, iso_event, cycle_time;
963 int i; 964 int i;
964 965
965 event = reg_read(ohci, OHCI1394_IntEventClear); 966 event = reg_read(ohci, OHCI1394_IntEventClear);
@@ -1002,6 +1003,12 @@ static irqreturn_t irq_handler(int irq, void *data)
1002 iso_event &= ~(1 << i); 1003 iso_event &= ~(1 << i);
1003 } 1004 }
1004 1005
1006 if (event & OHCI1394_cycle64Seconds) {
1007 cycle_time = reg_read(ohci, OHCI1394_IsochronousCycleTimer);
1008 if ((cycle_time & 0x80000000) == 0)
1009 ohci->bus_seconds++;
1010 }
1011
1005 return IRQ_HANDLED; 1012 return IRQ_HANDLED;
1006} 1013}
1007 1014
@@ -1213,6 +1220,19 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation)
1213 return retval; 1220 return retval;
1214} 1221}
1215 1222
1223static u64
1224ohci_get_bus_time(struct fw_card *card)
1225{
1226 struct fw_ohci *ohci = fw_ohci(card);
1227 u32 cycle_time;
1228 u64 bus_time;
1229
1230 cycle_time = reg_read(ohci, OHCI1394_IsochronousCycleTimer);
1231 bus_time = ((u64) ohci->bus_seconds << 32) | cycle_time;
1232
1233 return bus_time;
1234}
1235
1216static int handle_ir_bufferfill_packet(struct context *context, 1236static int handle_ir_bufferfill_packet(struct context *context,
1217 struct descriptor *d, 1237 struct descriptor *d,
1218 struct descriptor *last) 1238 struct descriptor *last)
@@ -1686,6 +1706,7 @@ static const struct fw_card_driver ohci_driver = {
1686 .send_response = ohci_send_response, 1706 .send_response = ohci_send_response,
1687 .cancel_packet = ohci_cancel_packet, 1707 .cancel_packet = ohci_cancel_packet,
1688 .enable_phys_dma = ohci_enable_phys_dma, 1708 .enable_phys_dma = ohci_enable_phys_dma,
1709 .get_bus_time = ohci_get_bus_time,
1689 1710
1690 .allocate_iso_context = ohci_allocate_iso_context, 1711 .allocate_iso_context = ohci_allocate_iso_context,
1691 .free_iso_context = ohci_free_iso_context, 1712 .free_iso_context = ohci_free_iso_context,
@@ -1862,7 +1883,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1862 OHCI1394_RQPkt | OHCI1394_RSPkt | 1883 OHCI1394_RQPkt | OHCI1394_RSPkt |
1863 OHCI1394_reqTxComplete | OHCI1394_respTxComplete | 1884 OHCI1394_reqTxComplete | OHCI1394_respTxComplete |
1864 OHCI1394_isochRx | OHCI1394_isochTx | 1885 OHCI1394_isochRx | OHCI1394_isochTx |
1865 OHCI1394_masterIntEnable); 1886 OHCI1394_masterIntEnable |
1887 OHCI1394_cycle64Seconds);
1866 1888
1867 bus_options = reg_read(ohci, OHCI1394_BusOptions); 1889 bus_options = reg_read(ohci, OHCI1394_BusOptions);
1868 max_receive = (bus_options >> 12) & 0xf; 1890 max_receive = (bus_options >> 12) & 0xf;