Lines Matching full:ohci
3 * Driver for OHCI 1394 controllers
42 #include "ohci.h"
44 #define ohci_info(ohci, f, args...) dev_info(ohci->card.device, f, ##args) argument
45 #define ohci_notice(ohci, f, args...) dev_notice(ohci->card.device, f, ##args) argument
46 #define ohci_err(ohci, f, args...) dev_err(ohci->card.device, f, ##args) argument
88 struct fw_ohci *ohci; member
118 struct fw_ohci *ohci; member
291 static bool has_reboot_by_cycle_timer_read_quirk(const struct fw_ohci *ohci) in has_reboot_by_cycle_timer_read_quirk() argument
293 return !!(ohci->quirks & QUIRK_REBOOT_BY_CYCLE_TIMER_READ); in has_reboot_by_cycle_timer_read_quirk()
323 #define has_reboot_by_cycle_timer_read_quirk(ohci) false argument
411 static void log_irqs(struct fw_ohci *ohci, u32 evt) in log_irqs() argument
421 ohci_notice(ohci, "IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt, in log_irqs()
460 static void log_selfids(struct fw_ohci *ohci, int generation, int self_id_count) in log_selfids() argument
467 ohci_notice(ohci, "%d selfIDs, generation %d, local node ID %04x\n", in log_selfids()
468 self_id_count, generation, ohci->node_id); in log_selfids()
470 for (s = ohci->self_id_buffer; self_id_count--; ++s) in log_selfids()
472 ohci_notice(ohci, in log_selfids()
479 ohci_notice(ohci, in log_selfids()
516 static void log_ar_at_event(struct fw_ohci *ohci, in log_ar_at_event() argument
529 ohci_notice(ohci, "A%c evt_bus_reset, generation %d\n", in log_ar_at_event()
549 ohci_notice(ohci, "A%c %s, %s\n", in log_ar_at_event()
553 ohci_notice(ohci, "A%c %s, PHY %08x %08x\n", in log_ar_at_event()
557 ohci_notice(ohci, in log_ar_at_event()
564 ohci_notice(ohci, in log_ar_at_event()
572 static inline void reg_write(const struct fw_ohci *ohci, int offset, u32 data) in reg_write() argument
574 writel(data, ohci->registers + offset); in reg_write()
577 static inline u32 reg_read(const struct fw_ohci *ohci, int offset) in reg_read() argument
579 return readl(ohci->registers + offset); in reg_read()
582 static inline void flush_writes(const struct fw_ohci *ohci) in flush_writes() argument
585 reg_read(ohci, OHCI1394_Version); in flush_writes()
590 * read_paged_phy_reg() require the caller to hold ohci->phy_reg_mutex.
594 static int read_phy_reg(struct fw_ohci *ohci, int addr) in read_phy_reg() argument
599 reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr)); in read_phy_reg()
601 val = reg_read(ohci, OHCI1394_PhyControl); in read_phy_reg()
615 ohci_err(ohci, "failed to read phy reg %d\n", addr); in read_phy_reg()
621 static int write_phy_reg(const struct fw_ohci *ohci, int addr, u32 val) in write_phy_reg() argument
625 reg_write(ohci, OHCI1394_PhyControl, in write_phy_reg()
628 val = reg_read(ohci, OHCI1394_PhyControl); in write_phy_reg()
638 ohci_err(ohci, "failed to write phy reg %d, val %u\n", addr, val); in write_phy_reg()
644 static int update_phy_reg(struct fw_ohci *ohci, int addr, in update_phy_reg() argument
647 int ret = read_phy_reg(ohci, addr); in update_phy_reg()
658 return write_phy_reg(ohci, addr, (ret & ~clear_bits) | set_bits); in update_phy_reg()
661 static int read_paged_phy_reg(struct fw_ohci *ohci, int page, int addr) in read_paged_phy_reg() argument
665 ret = update_phy_reg(ohci, 7, PHY_PAGE_SELECT, page << 5); in read_paged_phy_reg()
669 return read_phy_reg(ohci, addr); in read_paged_phy_reg()
674 struct fw_ohci *ohci = fw_ohci(card); in ohci_read_phy_reg() local
677 mutex_lock(&ohci->phy_reg_mutex); in ohci_read_phy_reg()
678 ret = read_phy_reg(ohci, addr); in ohci_read_phy_reg()
679 mutex_unlock(&ohci->phy_reg_mutex); in ohci_read_phy_reg()
687 struct fw_ohci *ohci = fw_ohci(card); in ohci_update_phy_reg() local
690 mutex_lock(&ohci->phy_reg_mutex); in ohci_update_phy_reg()
691 ret = update_phy_reg(ohci, addr, clear_bits, set_bits); in ohci_update_phy_reg()
692 mutex_unlock(&ohci->phy_reg_mutex); in ohci_update_phy_reg()
717 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_WAKE); in ar_context_link_page()
722 struct device *dev = ctx->ohci->card.device; in ar_context_release()
739 struct fw_ohci *ohci = ctx->ohci; in ar_context_abort() local
741 if (reg_read(ohci, CONTROL_CLEAR(ctx->regs)) & CONTEXT_RUN) { in ar_context_abort()
742 reg_write(ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN); in ar_context_abort()
743 flush_writes(ohci); in ar_context_abort()
745 ohci_err(ohci, "AR error: %s; DMA stopped\n", error_msg); in ar_context_abort()
827 dma_sync_single_for_cpu(ctx->ohci->card.device, in ar_sync_buffers_for_cpu()
833 dma_sync_single_for_cpu(ctx->ohci->card.device, in ar_sync_buffers_for_cpu()
840 (ohci->quirks & QUIRK_BE_HEADERS ? (__force __u32)(v) : le32_to_cpu(v))
847 struct fw_ohci *ohci = ctx->ohci; in handle_ar_packet() local
906 p.generation = ohci->request_generation; in handle_ar_packet()
908 log_ar_at_event(ohci, 'R', p.speed, p.header, evt); in handle_ar_packet()
919 * The OHCI bus reset handler synthesizes a PHY packet with in handle_ar_packet()
932 if (!(ohci->quirks & QUIRK_RESET_PACKET)) in handle_ar_packet()
933 ohci->request_generation = (p.header[2] >> 16) & 0xff; in handle_ar_packet()
934 } else if (ctx == &ohci->ar_request_ctx) { in handle_ar_packet()
935 fw_core_handle_request(&ohci->card, &p); in handle_ar_packet()
937 fw_core_handle_response(&ohci->card, &p); in handle_ar_packet()
963 dma_sync_single_for_device(ctx->ohci->card.device, in ar_recycle_buffers()
1017 static int ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, in ar_context_init() argument
1020 struct device *dev = ohci->card.device; in ar_context_init()
1027 ctx->ohci = ohci; in ar_context_init()
1048 ctx->descriptors = ohci->misc_buffer + descriptors_offset; in ar_context_init()
1049 ctx->descriptors_bus = ohci->misc_buffer_bus + descriptors_offset; in ar_context_init()
1079 reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ctx->descriptors_bus | 1); in ar_context_run()
1080 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN); in ar_context_run()
1131 spin_lock_irqsave(&ctx->ohci->lock, flags); in context_tasklet()
1133 spin_unlock_irqrestore(&ctx->ohci->lock, flags); in context_tasklet()
1141 * context. Must be called with ohci->lock held.
1156 desc = dmam_alloc_coherent(ctx->ohci->card.device, PAGE_SIZE, &bus_addr, GFP_ATOMIC); in context_add_buffer()
1177 static int context_init(struct context *ctx, struct fw_ohci *ohci, in context_init() argument
1180 ctx->ohci = ohci; in context_init()
1212 struct fw_card *card = &ctx->ohci->card; in context_release()
1221 /* Must be called with ohci->lock held */
1255 struct fw_ohci *ohci = ctx->ohci; in context_run() local
1257 reg_write(ohci, COMMAND_PTR(ctx->regs), in context_run()
1259 reg_write(ohci, CONTROL_CLEAR(ctx->regs), ~0); in context_run()
1260 reg_write(ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN | extra); in context_run()
1262 flush_writes(ohci); in context_run()
1290 if (unlikely(ctx->ohci->quirks & QUIRK_IR_WAKE) && in context_append()
1303 struct fw_ohci *ohci = ctx->ohci; in context_stop() local
1307 reg_write(ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN); in context_stop()
1311 reg = reg_read(ohci, CONTROL_SET(ctx->regs)); in context_stop()
1318 ohci_err(ohci, "DMA context still active (0x%08x)\n", reg); in context_stop()
1334 struct fw_ohci *ohci = ctx->ohci; in at_context_queue_packet() local
1413 payload_bus = dma_map_single(ohci->card.device, in at_context_queue_packet()
1417 if (dma_mapping_error(ohci->card.device, payload_bus)) { in at_context_queue_packet()
1443 if (ohci->generation != packet->generation) { in at_context_queue_packet()
1445 dma_unmap_single(ohci->card.device, payload_bus, in at_context_queue_packet()
1454 reg_write(ohci, CONTROL_SET(ctx->regs), CONTEXT_WAKE); in at_context_queue_packet()
1478 struct fw_ohci *ohci = context->ohci; in handle_at_packet() local
1492 dma_unmap_single(ohci->card.device, packet->payload_bus, in handle_at_packet()
1498 log_ar_at_event(ohci, 'T', packet->speed, packet->header, evt); in handle_at_packet()
1548 packet->callback(packet, &ohci->card, packet->ack); in handle_at_packet()
1559 static u32 get_cycle_time(struct fw_ohci *ohci);
1561 static void handle_local_rom(struct fw_ohci *ohci, in handle_local_rom() argument
1582 (void *) ohci->config_rom + i, length); in handle_local_rom()
1586 response.timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ohci)); in handle_local_rom()
1587 fw_core_handle_response(&ohci->card, &response); in handle_local_rom()
1590 static void handle_local_lock(struct fw_ohci *ohci, in handle_local_lock() argument
1617 reg_write(ohci, OHCI1394_CSRData, lock_data); in handle_local_lock()
1618 reg_write(ohci, OHCI1394_CSRCompareData, lock_arg); in handle_local_lock()
1619 reg_write(ohci, OHCI1394_CSRControl, sel); in handle_local_lock()
1622 if (reg_read(ohci, OHCI1394_CSRControl) & 0x80000000) { in handle_local_lock()
1623 lock_old = cpu_to_be32(reg_read(ohci, in handle_local_lock()
1631 ohci_err(ohci, "swap not done (CSR lock timeout)\n"); in handle_local_lock()
1636 response.timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ohci)); in handle_local_lock()
1637 fw_core_handle_response(&ohci->card, &response); in handle_local_lock()
1644 if (ctx == &ctx->ohci->at_request_ctx) { in handle_local_request()
1646 packet->callback(packet, &ctx->ohci->card, packet->ack); in handle_local_request()
1657 handle_local_rom(ctx->ohci, packet, csr); in handle_local_request()
1663 handle_local_lock(ctx->ohci, packet, csr); in handle_local_request()
1666 if (ctx == &ctx->ohci->at_request_ctx) in handle_local_request()
1667 fw_core_handle_request(&ctx->ohci->card, packet); in handle_local_request()
1669 fw_core_handle_response(&ctx->ohci->card, packet); in handle_local_request()
1673 if (ctx == &ctx->ohci->at_response_ctx) { in handle_local_request()
1675 packet->callback(packet, &ctx->ohci->card, packet->ack); in handle_local_request()
1684 spin_lock_irqsave(&ctx->ohci->lock, flags); in at_context_transmit()
1686 if (HEADER_GET_DESTINATION(packet->header[0]) == ctx->ohci->node_id && in at_context_transmit()
1687 ctx->ohci->generation == packet->generation) { in at_context_transmit()
1688 spin_unlock_irqrestore(&ctx->ohci->lock, flags); in at_context_transmit()
1691 packet->timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ctx->ohci)); in at_context_transmit()
1698 spin_unlock_irqrestore(&ctx->ohci->lock, flags); in at_context_transmit()
1702 packet->timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ctx->ohci)); in at_context_transmit()
1704 packet->callback(packet, &ctx->ohci->card, packet->ack); in at_context_transmit()
1708 static void detect_dead_context(struct fw_ohci *ohci, in detect_dead_context() argument
1713 ctl = reg_read(ohci, CONTROL_SET(regs)); in detect_dead_context()
1715 ohci_err(ohci, "DMA context %s has stopped, error code: %s\n", in detect_dead_context()
1719 static void handle_dead_contexts(struct fw_ohci *ohci) in handle_dead_contexts() argument
1724 detect_dead_context(ohci, "ATReq", OHCI1394_AsReqTrContextBase); in handle_dead_contexts()
1725 detect_dead_context(ohci, "ATRsp", OHCI1394_AsRspTrContextBase); in handle_dead_contexts()
1726 detect_dead_context(ohci, "ARReq", OHCI1394_AsReqRcvContextBase); in handle_dead_contexts()
1727 detect_dead_context(ohci, "ARRsp", OHCI1394_AsRspRcvContextBase); in handle_dead_contexts()
1729 if (!(ohci->it_context_support & (1 << i))) in handle_dead_contexts()
1732 detect_dead_context(ohci, name, OHCI1394_IsoXmitContextBase(i)); in handle_dead_contexts()
1735 if (!(ohci->ir_context_support & (1 << i))) in handle_dead_contexts()
1738 detect_dead_context(ohci, name, OHCI1394_IsoRcvContextBase(i)); in handle_dead_contexts()
1769 static u32 get_cycle_time(struct fw_ohci *ohci) in get_cycle_time() argument
1776 if (has_reboot_by_cycle_timer_read_quirk(ohci)) in get_cycle_time()
1779 c2 = reg_read(ohci, OHCI1394_IsochronousCycleTimer); in get_cycle_time()
1781 if (ohci->quirks & QUIRK_CYCLE_TIMER) { in get_cycle_time()
1784 c2 = reg_read(ohci, OHCI1394_IsochronousCycleTimer); in get_cycle_time()
1788 c2 = reg_read(ohci, OHCI1394_IsochronousCycleTimer); in get_cycle_time()
1808 static u32 update_bus_time(struct fw_ohci *ohci) in update_bus_time() argument
1810 u32 cycle_time_seconds = get_cycle_time(ohci) >> 25; in update_bus_time()
1812 if (unlikely(!ohci->bus_time_running)) { in update_bus_time()
1813 reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_cycle64Seconds); in update_bus_time()
1814 ohci->bus_time = (lower_32_bits(ktime_get_seconds()) & ~0x7f) | in update_bus_time()
1816 ohci->bus_time_running = true; in update_bus_time()
1819 if ((ohci->bus_time & 0x40) != (cycle_time_seconds & 0x40)) in update_bus_time()
1820 ohci->bus_time += 0x40; in update_bus_time()
1822 return ohci->bus_time | cycle_time_seconds; in update_bus_time()
1825 static int get_status_for_port(struct fw_ohci *ohci, int port_index) in get_status_for_port() argument
1829 mutex_lock(&ohci->phy_reg_mutex); in get_status_for_port()
1830 reg = write_phy_reg(ohci, 7, port_index); in get_status_for_port()
1832 reg = read_phy_reg(ohci, 8); in get_status_for_port()
1833 mutex_unlock(&ohci->phy_reg_mutex); in get_status_for_port()
1846 static int get_self_id_pos(struct fw_ohci *ohci, u32 self_id, in get_self_id_pos() argument
1853 entry = ohci->self_id_buffer[i]; in get_self_id_pos()
1862 static int initiated_reset(struct fw_ohci *ohci) in initiated_reset() argument
1867 mutex_lock(&ohci->phy_reg_mutex); in initiated_reset()
1868 reg = write_phy_reg(ohci, 7, 0xe0); /* Select page 7 */ in initiated_reset()
1870 reg = read_phy_reg(ohci, 8); in initiated_reset()
1872 reg = write_phy_reg(ohci, 8, reg); /* set PMODE bit */ in initiated_reset()
1874 reg = read_phy_reg(ohci, 12); /* read register 12 */ in initiated_reset()
1883 mutex_unlock(&ohci->phy_reg_mutex); in initiated_reset()
1892 static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count) in find_and_insert_self_id() argument
1898 reg = reg_read(ohci, OHCI1394_NodeID); in find_and_insert_self_id()
1900 ohci_notice(ohci, in find_and_insert_self_id()
1906 reg = ohci_read_phy_reg(&ohci->card, 4); in find_and_insert_self_id()
1911 reg = ohci_read_phy_reg(&ohci->card, 1); in find_and_insert_self_id()
1917 status = get_status_for_port(ohci, i); in find_and_insert_self_id()
1923 self_id |= initiated_reset(ohci); in find_and_insert_self_id()
1925 pos = get_self_id_pos(ohci, self_id, self_id_count); in find_and_insert_self_id()
1927 memmove(&(ohci->self_id_buffer[pos+1]), in find_and_insert_self_id()
1928 &(ohci->self_id_buffer[pos]), in find_and_insert_self_id()
1929 (self_id_count - pos) * sizeof(*ohci->self_id_buffer)); in find_and_insert_self_id()
1930 ohci->self_id_buffer[pos] = self_id; in find_and_insert_self_id()
1938 struct fw_ohci *ohci = in bus_reset_work() local
1946 reg = reg_read(ohci, OHCI1394_NodeID); in bus_reset_work()
1948 ohci_notice(ohci, in bus_reset_work()
1953 ohci_notice(ohci, "malconfigured bus\n"); in bus_reset_work()
1956 ohci->node_id = reg & (OHCI1394_NodeID_busNumber | in bus_reset_work()
1960 if (!(ohci->is_root && is_new_root)) in bus_reset_work()
1961 reg_write(ohci, OHCI1394_LinkControlSet, in bus_reset_work()
1963 ohci->is_root = is_new_root; in bus_reset_work()
1965 reg = reg_read(ohci, OHCI1394_SelfIDCount); in bus_reset_work()
1967 ohci_notice(ohci, "self ID receive error\n"); in bus_reset_work()
1979 ohci_notice(ohci, "bad selfIDSize (%08x)\n", reg); in bus_reset_work()
1983 generation = (cond_le32_to_cpu(ohci->self_id[0]) >> 16) & 0xff; in bus_reset_work()
1987 u32 id = cond_le32_to_cpu(ohci->self_id[i]); in bus_reset_work()
1988 u32 id2 = cond_le32_to_cpu(ohci->self_id[i + 1]); in bus_reset_work()
1999 ohci_notice(ohci, "ignoring spurious self IDs\n"); in bus_reset_work()
2004 ohci_notice(ohci, "bad self ID %d/%d (%08x != ~%08x)\n", in bus_reset_work()
2008 ohci->self_id_buffer[j] = id; in bus_reset_work()
2011 if (ohci->quirks & QUIRK_TI_SLLZ059) { in bus_reset_work()
2012 self_id_count = find_and_insert_self_id(ohci, self_id_count); in bus_reset_work()
2014 ohci_notice(ohci, in bus_reset_work()
2021 ohci_notice(ohci, "no self IDs\n"); in bus_reset_work()
2031 * will read out inconsistent data. The OHCI specification in bus_reset_work()
2040 new_generation = (reg_read(ohci, OHCI1394_SelfIDCount) >> 16) & 0xff; in bus_reset_work()
2042 ohci_notice(ohci, "new bus reset, discarding self ids\n"); in bus_reset_work()
2047 spin_lock_irq(&ohci->lock); in bus_reset_work()
2049 ohci->generation = -1; /* prevent AT packet queueing */ in bus_reset_work()
2050 context_stop(&ohci->at_request_ctx); in bus_reset_work()
2051 context_stop(&ohci->at_response_ctx); in bus_reset_work()
2053 spin_unlock_irq(&ohci->lock); in bus_reset_work()
2056 * Per OHCI 1.2 draft, clause 7.2.3.3, hardware may leave unsent in bus_reset_work()
2058 * Some OHCI 1.1 controllers (JMicron) apparently require this too. in bus_reset_work()
2060 at_context_flush(&ohci->at_request_ctx); in bus_reset_work()
2061 at_context_flush(&ohci->at_response_ctx); in bus_reset_work()
2063 spin_lock_irq(&ohci->lock); in bus_reset_work()
2065 ohci->generation = generation; in bus_reset_work()
2066 reg_write(ohci, OHCI1394_IntEventClear, OHCI1394_busReset); in bus_reset_work()
2068 reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_busReset); in bus_reset_work()
2070 if (ohci->quirks & QUIRK_RESET_PACKET) in bus_reset_work()
2071 ohci->request_generation = generation; in bus_reset_work()
2082 if (ohci->next_config_rom != NULL) { in bus_reset_work()
2083 if (ohci->next_config_rom != ohci->config_rom) { in bus_reset_work()
2084 free_rom = ohci->config_rom; in bus_reset_work()
2085 free_rom_bus = ohci->config_rom_bus; in bus_reset_work()
2087 ohci->config_rom = ohci->next_config_rom; in bus_reset_work()
2088 ohci->config_rom_bus = ohci->next_config_rom_bus; in bus_reset_work()
2089 ohci->next_config_rom = NULL; in bus_reset_work()
2097 reg_write(ohci, OHCI1394_BusOptions, in bus_reset_work()
2098 be32_to_cpu(ohci->config_rom[2])); in bus_reset_work()
2099 ohci->config_rom[0] = ohci->next_header; in bus_reset_work()
2100 reg_write(ohci, OHCI1394_ConfigROMhdr, in bus_reset_work()
2101 be32_to_cpu(ohci->next_header)); in bus_reset_work()
2105 reg_write(ohci, OHCI1394_PhyReqFilterHiSet, ~0); in bus_reset_work()
2106 reg_write(ohci, OHCI1394_PhyReqFilterLoSet, ~0); in bus_reset_work()
2109 spin_unlock_irq(&ohci->lock); in bus_reset_work()
2112 dmam_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, free_rom, free_rom_bus); in bus_reset_work()
2114 log_selfids(ohci, generation, self_id_count); in bus_reset_work()
2116 fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, in bus_reset_work()
2117 self_id_count, ohci->self_id_buffer, in bus_reset_work()
2118 ohci->csr_state_setclear_abdicate); in bus_reset_work()
2119 ohci->csr_state_setclear_abdicate = false; in bus_reset_work()
2124 struct fw_ohci *ohci = data; in irq_handler() local
2128 event = reg_read(ohci, OHCI1394_IntEventClear); in irq_handler()
2135 * (OHCI 1.1 clauses 7.2.3.2 and 13.2.8.1) in irq_handler()
2137 reg_write(ohci, OHCI1394_IntEventClear, in irq_handler()
2139 log_irqs(ohci, event); in irq_handler()
2141 reg_write(ohci, OHCI1394_IntMaskClear, OHCI1394_busReset); in irq_handler()
2144 queue_work(selfid_workqueue, &ohci->bus_reset_work); in irq_handler()
2147 tasklet_schedule(&ohci->ar_request_ctx.tasklet); in irq_handler()
2150 tasklet_schedule(&ohci->ar_response_ctx.tasklet); in irq_handler()
2153 tasklet_schedule(&ohci->at_request_ctx.tasklet); in irq_handler()
2156 tasklet_schedule(&ohci->at_response_ctx.tasklet); in irq_handler()
2159 iso_event = reg_read(ohci, OHCI1394_IsoRecvIntEventClear); in irq_handler()
2160 reg_write(ohci, OHCI1394_IsoRecvIntEventClear, iso_event); in irq_handler()
2165 &ohci->ir_context_list[i].context.tasklet); in irq_handler()
2171 iso_event = reg_read(ohci, OHCI1394_IsoXmitIntEventClear); in irq_handler()
2172 reg_write(ohci, OHCI1394_IsoXmitIntEventClear, iso_event); in irq_handler()
2177 &ohci->it_context_list[i].context.tasklet); in irq_handler()
2183 ohci_err(ohci, "register access failure\n"); in irq_handler()
2186 reg_read(ohci, OHCI1394_PostedWriteAddressHi); in irq_handler()
2187 reg_read(ohci, OHCI1394_PostedWriteAddressLo); in irq_handler()
2188 reg_write(ohci, OHCI1394_IntEventClear, in irq_handler()
2191 ohci_err(ohci, "PCI posted write error\n"); in irq_handler()
2196 ohci_notice(ohci, "isochronous cycle too long\n"); in irq_handler()
2197 reg_write(ohci, OHCI1394_LinkControlSet, in irq_handler()
2209 ohci_notice(ohci, "isochronous cycle inconsistent\n"); in irq_handler()
2213 handle_dead_contexts(ohci); in irq_handler()
2216 spin_lock(&ohci->lock); in irq_handler()
2217 update_bus_time(ohci); in irq_handler()
2218 spin_unlock(&ohci->lock); in irq_handler()
2220 flush_writes(ohci); in irq_handler()
2225 static int software_reset(struct fw_ohci *ohci) in software_reset() argument
2230 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset); in software_reset()
2232 val = reg_read(ohci, OHCI1394_HCControlSet); in software_reset()
2254 static int configure_1394a_enhancements(struct fw_ohci *ohci) in configure_1394a_enhancements() argument
2260 if (!(reg_read(ohci, OHCI1394_HCControlSet) & in configure_1394a_enhancements()
2266 ret = read_phy_reg(ohci, 2); in configure_1394a_enhancements()
2270 ret = read_paged_phy_reg(ohci, 1, 8); in configure_1394a_enhancements()
2277 if (ohci->quirks & QUIRK_NO_1394A) in configure_1394a_enhancements()
2288 ret = update_phy_reg(ohci, 5, clear, set); in configure_1394a_enhancements()
2296 reg_write(ohci, offset, OHCI1394_HCControl_aPhyEnhanceEnable); in configure_1394a_enhancements()
2299 reg_write(ohci, OHCI1394_HCControlClear, in configure_1394a_enhancements()
2305 static int probe_tsb41ba3d(struct fw_ohci *ohci) in probe_tsb41ba3d() argument
2311 reg = read_phy_reg(ohci, 2); in probe_tsb41ba3d()
2318 reg = read_paged_phy_reg(ohci, 1, i + 10); in probe_tsb41ba3d()
2330 struct fw_ohci *ohci = fw_ohci(card); in ohci_enable() local
2334 ret = software_reset(ohci); in ohci_enable()
2336 ohci_err(ohci, "failed to reset ohci card\n"); in ohci_enable()
2353 reg_write(ohci, OHCI1394_HCControlSet, in ohci_enable()
2356 flush_writes(ohci); in ohci_enable()
2360 lps = reg_read(ohci, OHCI1394_HCControlSet) & in ohci_enable()
2365 ohci_err(ohci, "failed to set Link Power Status\n"); in ohci_enable()
2369 if (ohci->quirks & QUIRK_TI_SLLZ059) { in ohci_enable()
2370 ret = probe_tsb41ba3d(ohci); in ohci_enable()
2374 ohci_notice(ohci, "local TSB41BA3D phy\n"); in ohci_enable()
2376 ohci->quirks &= ~QUIRK_TI_SLLZ059; in ohci_enable()
2379 reg_write(ohci, OHCI1394_HCControlClear, in ohci_enable()
2382 reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->self_id_bus); in ohci_enable()
2383 reg_write(ohci, OHCI1394_LinkControlSet, in ohci_enable()
2387 reg_write(ohci, OHCI1394_ATRetries, in ohci_enable()
2393 ohci->bus_time_running = false; in ohci_enable()
2396 if (ohci->ir_context_support & (1 << i)) in ohci_enable()
2397 reg_write(ohci, OHCI1394_IsoRcvContextControlClear(i), in ohci_enable()
2400 version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; in ohci_enable()
2402 reg_write(ohci, OHCI1394_InitialChannelsAvailableHi, in ohci_enable()
2408 reg_write(ohci, OHCI1394_FairnessControl, 0x3f); in ohci_enable()
2409 ohci->pri_req_max = reg_read(ohci, OHCI1394_FairnessControl) & 0x3f; in ohci_enable()
2410 reg_write(ohci, OHCI1394_FairnessControl, 0); in ohci_enable()
2411 card->priority_budget_implemented = ohci->pri_req_max != 0; in ohci_enable()
2413 reg_write(ohci, OHCI1394_PhyUpperBound, FW_MAX_PHYSICAL_RANGE >> 16); in ohci_enable()
2414 reg_write(ohci, OHCI1394_IntEventClear, ~0); in ohci_enable()
2415 reg_write(ohci, OHCI1394_IntMaskClear, ~0); in ohci_enable()
2417 ret = configure_1394a_enhancements(ohci); in ohci_enable()
2433 * OHCI requires that ConfigROMhdr and BusOptions have valid in ohci_enable()
2446 ohci->next_config_rom = dmam_alloc_coherent(ohci->card.device, CONFIG_ROM_SIZE, in ohci_enable()
2447 &ohci->next_config_rom_bus, GFP_KERNEL); in ohci_enable()
2448 if (ohci->next_config_rom == NULL) in ohci_enable()
2451 copy_config_rom(ohci->next_config_rom, config_rom, length); in ohci_enable()
2457 ohci->next_config_rom = ohci->config_rom; in ohci_enable()
2458 ohci->next_config_rom_bus = ohci->config_rom_bus; in ohci_enable()
2461 ohci->next_header = ohci->next_config_rom[0]; in ohci_enable()
2462 ohci->next_config_rom[0] = 0; in ohci_enable()
2463 reg_write(ohci, OHCI1394_ConfigROMhdr, 0); in ohci_enable()
2464 reg_write(ohci, OHCI1394_BusOptions, in ohci_enable()
2465 be32_to_cpu(ohci->next_config_rom[2])); in ohci_enable()
2466 reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); in ohci_enable()
2468 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); in ohci_enable()
2482 reg_write(ohci, OHCI1394_IntMaskSet, irqs); in ohci_enable()
2484 reg_write(ohci, OHCI1394_HCControlSet, in ohci_enable()
2488 reg_write(ohci, OHCI1394_LinkControlSet, in ohci_enable()
2492 ar_context_run(&ohci->ar_request_ctx); in ohci_enable()
2493 ar_context_run(&ohci->ar_response_ctx); in ohci_enable()
2495 flush_writes(ohci); in ohci_enable()
2498 fw_schedule_bus_reset(&ohci->card, false, true); in ohci_enable()
2506 struct fw_ohci *ohci; in ohci_set_config_rom() local
2510 ohci = fw_ohci(card); in ohci_set_config_rom()
2513 * When the OHCI controller is enabled, the config rom update in ohci_set_config_rom()
2515 * section 5.5.6 in the OHCI specification. in ohci_set_config_rom()
2517 * The OHCI controller caches the new config rom address in a in ohci_set_config_rom()
2535 * We use ohci->lock to avoid racing with the code that sets in ohci_set_config_rom()
2536 * ohci->next_config_rom to NULL (see bus_reset_work). in ohci_set_config_rom()
2539 next_config_rom = dmam_alloc_coherent(ohci->card.device, CONFIG_ROM_SIZE, in ohci_set_config_rom()
2544 spin_lock_irq(&ohci->lock); in ohci_set_config_rom()
2548 * push our new allocation into the ohci->next_config_rom in ohci_set_config_rom()
2557 if (ohci->next_config_rom == NULL) { in ohci_set_config_rom()
2558 ohci->next_config_rom = next_config_rom; in ohci_set_config_rom()
2559 ohci->next_config_rom_bus = next_config_rom_bus; in ohci_set_config_rom()
2563 copy_config_rom(ohci->next_config_rom, config_rom, length); in ohci_set_config_rom()
2565 ohci->next_header = config_rom[0]; in ohci_set_config_rom()
2566 ohci->next_config_rom[0] = 0; in ohci_set_config_rom()
2568 reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); in ohci_set_config_rom()
2570 spin_unlock_irq(&ohci->lock); in ohci_set_config_rom()
2574 dmam_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, next_config_rom, in ohci_set_config_rom()
2581 * mappings in the bus reset tasklet, since the OHCI in ohci_set_config_rom()
2586 fw_schedule_bus_reset(&ohci->card, true, true); in ohci_set_config_rom()
2593 struct fw_ohci *ohci = fw_ohci(card); in ohci_send_request() local
2595 at_context_transmit(&ohci->at_request_ctx, packet); in ohci_send_request()
2600 struct fw_ohci *ohci = fw_ohci(card); in ohci_send_response() local
2602 at_context_transmit(&ohci->at_response_ctx, packet); in ohci_send_response()
2607 struct fw_ohci *ohci = fw_ohci(card); in ohci_cancel_packet() local
2608 struct context *ctx = &ohci->at_request_ctx; in ohci_cancel_packet()
2618 dma_unmap_single(ohci->card.device, packet->payload_bus, in ohci_cancel_packet()
2621 log_ar_at_event(ohci, 'T', packet->speed, packet->header, 0x20); in ohci_cancel_packet()
2626 packet->timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ohci)); in ohci_cancel_packet()
2628 packet->callback(packet, &ohci->card, packet->ack); in ohci_cancel_packet()
2639 struct fw_ohci *ohci = fw_ohci(card); in ohci_enable_phys_dma() local
2651 spin_lock_irqsave(&ohci->lock, flags); in ohci_enable_phys_dma()
2653 if (ohci->generation != generation) { in ohci_enable_phys_dma()
2665 reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 1 << n); in ohci_enable_phys_dma()
2667 reg_write(ohci, OHCI1394_PhyReqFilterHiSet, 1 << (n - 32)); in ohci_enable_phys_dma()
2669 flush_writes(ohci); in ohci_enable_phys_dma()
2671 spin_unlock_irqrestore(&ohci->lock, flags); in ohci_enable_phys_dma()
2678 struct fw_ohci *ohci = fw_ohci(card); in ohci_read_csr() local
2685 if (ohci->is_root && in ohci_read_csr()
2686 (reg_read(ohci, OHCI1394_LinkControlSet) & in ohci_read_csr()
2691 if (ohci->csr_state_setclear_abdicate) in ohci_read_csr()
2697 return reg_read(ohci, OHCI1394_NodeID) << 16; in ohci_read_csr()
2700 return get_cycle_time(ohci); in ohci_read_csr()
2708 spin_lock_irqsave(&ohci->lock, flags); in ohci_read_csr()
2709 value = update_bus_time(ohci); in ohci_read_csr()
2710 spin_unlock_irqrestore(&ohci->lock, flags); in ohci_read_csr()
2714 value = reg_read(ohci, OHCI1394_ATRetries); in ohci_read_csr()
2718 return (reg_read(ohci, OHCI1394_FairnessControl) & 0x3f) | in ohci_read_csr()
2719 (ohci->pri_req_max << 8); in ohci_read_csr()
2729 struct fw_ohci *ohci = fw_ohci(card); in ohci_write_csr() local
2734 if ((value & CSR_STATE_BIT_CMSTR) && ohci->is_root) { in ohci_write_csr()
2735 reg_write(ohci, OHCI1394_LinkControlClear, in ohci_write_csr()
2737 flush_writes(ohci); in ohci_write_csr()
2740 ohci->csr_state_setclear_abdicate = false; in ohci_write_csr()
2744 if ((value & CSR_STATE_BIT_CMSTR) && ohci->is_root) { in ohci_write_csr()
2745 reg_write(ohci, OHCI1394_LinkControlSet, in ohci_write_csr()
2747 flush_writes(ohci); in ohci_write_csr()
2750 ohci->csr_state_setclear_abdicate = true; in ohci_write_csr()
2754 reg_write(ohci, OHCI1394_NodeID, value >> 16); in ohci_write_csr()
2755 flush_writes(ohci); in ohci_write_csr()
2759 reg_write(ohci, OHCI1394_IsochronousCycleTimer, value); in ohci_write_csr()
2760 reg_write(ohci, OHCI1394_IntEventSet, in ohci_write_csr()
2762 flush_writes(ohci); in ohci_write_csr()
2766 spin_lock_irqsave(&ohci->lock, flags); in ohci_write_csr()
2767 ohci->bus_time = (update_bus_time(ohci) & 0x40) | in ohci_write_csr()
2769 spin_unlock_irqrestore(&ohci->lock, flags); in ohci_write_csr()
2775 reg_write(ohci, OHCI1394_ATRetries, value); in ohci_write_csr()
2776 flush_writes(ohci); in ohci_write_csr()
2780 reg_write(ohci, OHCI1394_FairnessControl, value & 0x3f); in ohci_write_csr()
2781 flush_writes(ohci); in ohci_write_csr()
2844 dma_sync_single_range_for_cpu(context->ohci->card.device, in handle_ir_packet_per_buffer()
2883 dma_sync_single_range_for_cpu(context->ohci->card.device, in handle_ir_buffer_fill()
2900 dma_sync_single_range_for_cpu(ctx->context.ohci->card.device, in flush_ir_buffer_fill()
2938 dma_sync_single_range_for_cpu(context->ohci->card.device, in sync_it_packet_for_cpu()
2985 static void set_multichannel_mask(struct fw_ohci *ohci, u64 channels) in set_multichannel_mask() argument
2989 reg_write(ohci, OHCI1394_IRMultiChanMaskHiClear, ~hi); in set_multichannel_mask()
2990 reg_write(ohci, OHCI1394_IRMultiChanMaskLoClear, ~lo); in set_multichannel_mask()
2991 reg_write(ohci, OHCI1394_IRMultiChanMaskHiSet, hi); in set_multichannel_mask()
2992 reg_write(ohci, OHCI1394_IRMultiChanMaskLoSet, lo); in set_multichannel_mask()
2993 ohci->mc_channels = channels; in set_multichannel_mask()
2999 struct fw_ohci *ohci = fw_ohci(card); in ohci_allocate_iso_context() local
3006 spin_lock_irq(&ohci->lock); in ohci_allocate_iso_context()
3010 mask = &ohci->it_context_mask; in ohci_allocate_iso_context()
3016 ctx = &ohci->it_context_list[index]; in ohci_allocate_iso_context()
3021 channels = &ohci->ir_context_channels; in ohci_allocate_iso_context()
3022 mask = &ohci->ir_context_mask; in ohci_allocate_iso_context()
3029 ctx = &ohci->ir_context_list[index]; in ohci_allocate_iso_context()
3034 mask = &ohci->ir_context_mask; in ohci_allocate_iso_context()
3036 index = !ohci->mc_allocated ? ffs(*mask) - 1 : -1; in ohci_allocate_iso_context()
3038 ohci->mc_allocated = true; in ohci_allocate_iso_context()
3041 ctx = &ohci->ir_context_list[index]; in ohci_allocate_iso_context()
3050 spin_unlock_irq(&ohci->lock); in ohci_allocate_iso_context()
3062 ret = context_init(&ctx->context, ohci, regs, callback); in ohci_allocate_iso_context()
3067 set_multichannel_mask(ohci, 0); in ohci_allocate_iso_context()
3076 spin_lock_irq(&ohci->lock); in ohci_allocate_iso_context()
3084 ohci->mc_allocated = false; in ohci_allocate_iso_context()
3089 spin_unlock_irq(&ohci->lock); in ohci_allocate_iso_context()
3098 struct fw_ohci *ohci = ctx->context.ohci; in ohci_start_iso() local
3108 index = ctx - ohci->it_context_list; in ohci_start_iso()
3114 reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 1 << index); in ohci_start_iso()
3115 reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1 << index); in ohci_start_iso()
3123 index = ctx - ohci->ir_context_list; in ohci_start_iso()
3130 reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 1 << index); in ohci_start_iso()
3131 reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, 1 << index); in ohci_start_iso()
3132 reg_write(ohci, CONTEXT_MATCH(ctx->context.regs), match); in ohci_start_iso()
3146 struct fw_ohci *ohci = fw_ohci(base->card); in ohci_stop_iso() local
3152 index = ctx - ohci->it_context_list; in ohci_stop_iso()
3153 reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 1 << index); in ohci_stop_iso()
3158 index = ctx - ohci->ir_context_list; in ohci_stop_iso()
3159 reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 1 << index); in ohci_stop_iso()
3162 flush_writes(ohci); in ohci_stop_iso()
3171 struct fw_ohci *ohci = fw_ohci(base->card); in ohci_free_iso_context() local
3180 spin_lock_irqsave(&ohci->lock, flags); in ohci_free_iso_context()
3184 index = ctx - ohci->it_context_list; in ohci_free_iso_context()
3185 ohci->it_context_mask |= 1 << index; in ohci_free_iso_context()
3189 index = ctx - ohci->ir_context_list; in ohci_free_iso_context()
3190 ohci->ir_context_mask |= 1 << index; in ohci_free_iso_context()
3191 ohci->ir_context_channels |= 1ULL << base->channel; in ohci_free_iso_context()
3195 index = ctx - ohci->ir_context_list; in ohci_free_iso_context()
3196 ohci->ir_context_mask |= 1 << index; in ohci_free_iso_context()
3197 ohci->ir_context_channels |= ohci->mc_channels; in ohci_free_iso_context()
3198 ohci->mc_channels = 0; in ohci_free_iso_context()
3199 ohci->mc_allocated = false; in ohci_free_iso_context()
3203 spin_unlock_irqrestore(&ohci->lock, flags); in ohci_free_iso_context()
3208 struct fw_ohci *ohci = fw_ohci(base->card); in ohci_set_iso_channels() local
3215 spin_lock_irqsave(&ohci->lock, flags); in ohci_set_iso_channels()
3218 if (~ohci->ir_context_channels & ~ohci->mc_channels & *channels) { in ohci_set_iso_channels()
3219 *channels = ohci->ir_context_channels; in ohci_set_iso_channels()
3222 set_multichannel_mask(ohci, *channels); in ohci_set_iso_channels()
3226 spin_unlock_irqrestore(&ohci->lock, flags); in ohci_set_iso_channels()
3237 static void ohci_resume_iso_dma(struct fw_ohci *ohci) in ohci_resume_iso_dma() argument
3242 for (i = 0 ; i < ohci->n_ir ; i++) { in ohci_resume_iso_dma()
3243 ctx = &ohci->ir_context_list[i]; in ohci_resume_iso_dma()
3248 for (i = 0 ; i < ohci->n_it ; i++) { in ohci_resume_iso_dma()
3249 ctx = &ohci->it_context_list[i]; in ohci_resume_iso_dma()
3337 dma_sync_single_range_for_device(ctx->context.ohci->card.device, in queue_iso_transmit()
3365 struct device *device = ctx->context.ohci->card.device; in queue_iso_packet_per_buffer()
3373 * The OHCI controller puts the isochronous header and trailer in the in queue_iso_packet_per_buffer()
3483 dma_sync_single_range_for_device(ctx->context.ohci->card.device, in queue_iso_buffer_fill()
3506 spin_lock_irqsave(&ctx->context.ohci->lock, flags); in ohci_queue_iso()
3518 spin_unlock_irqrestore(&ctx->context.ohci->lock, flags); in ohci_queue_iso()
3528 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_WAKE); in ohci_flush_queue_iso()
3618 struct fw_ohci *ohci = pci_get_drvdata(pdev); in release_ohci() local
3622 ar_context_release(&ohci->ar_response_ctx); in release_ohci()
3623 ar_context_release(&ohci->ar_request_ctx); in release_ohci()
3625 dev_notice(dev, "removed fw-ohci device\n"); in release_ohci()
3631 struct fw_ohci *ohci; in pci_probe() local
3642 ohci = devres_alloc(release_ohci, sizeof(*ohci), GFP_KERNEL); in pci_probe()
3643 if (ohci == NULL) in pci_probe()
3645 fw_card_initialize(&ohci->card, &ohci_driver, &dev->dev); in pci_probe()
3646 pci_set_drvdata(dev, ohci); in pci_probe()
3648 devres_add(&dev->dev, ohci); in pci_probe()
3652 dev_err(&dev->dev, "failed to enable OHCI hardware\n"); in pci_probe()
3659 spin_lock_init(&ohci->lock); in pci_probe()
3660 mutex_init(&ohci->phy_reg_mutex); in pci_probe()
3662 INIT_WORK(&ohci->bus_reset_work, bus_reset_work); in pci_probe()
3666 ohci_err(ohci, "invalid MMIO resource\n"); in pci_probe()
3672 ohci_err(ohci, "request and map MMIO resource unavailable\n"); in pci_probe()
3675 ohci->registers = pcim_iomap_table(dev)[0]; in pci_probe()
3683 ohci->quirks = ohci_quirks[i].flags; in pci_probe()
3687 ohci->quirks = param_quirks; in pci_probe()
3690 ohci->quirks |= QUIRK_REBOOT_BY_CYCLE_TIMER_READ; in pci_probe()
3699 ohci->misc_buffer = dmam_alloc_coherent(&dev->dev, PAGE_SIZE, &ohci->misc_buffer_bus, in pci_probe()
3701 if (!ohci->misc_buffer) in pci_probe()
3704 err = ar_context_init(&ohci->ar_request_ctx, ohci, 0, in pci_probe()
3709 err = ar_context_init(&ohci->ar_response_ctx, ohci, PAGE_SIZE/4, in pci_probe()
3714 err = context_init(&ohci->at_request_ctx, ohci, in pci_probe()
3719 err = context_init(&ohci->at_response_ctx, ohci, in pci_probe()
3724 reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, ~0); in pci_probe()
3725 ohci->ir_context_channels = ~0ULL; in pci_probe()
3726 ohci->ir_context_support = reg_read(ohci, OHCI1394_IsoRecvIntMaskSet); in pci_probe()
3727 reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, ~0); in pci_probe()
3728 ohci->ir_context_mask = ohci->ir_context_support; in pci_probe()
3729 ohci->n_ir = hweight32(ohci->ir_context_mask); in pci_probe()
3730 size = sizeof(struct iso_context) * ohci->n_ir; in pci_probe()
3731 ohci->ir_context_list = devm_kzalloc(&dev->dev, size, GFP_KERNEL); in pci_probe()
3732 if (!ohci->ir_context_list) in pci_probe()
3735 reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0); in pci_probe()
3736 ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet); in pci_probe()
3738 if (!ohci->it_context_support) { in pci_probe()
3739 ohci_notice(ohci, "overriding IsoXmitIntMask\n"); in pci_probe()
3740 ohci->it_context_support = 0xf; in pci_probe()
3742 reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0); in pci_probe()
3743 ohci->it_context_mask = ohci->it_context_support; in pci_probe()
3744 ohci->n_it = hweight32(ohci->it_context_mask); in pci_probe()
3745 size = sizeof(struct iso_context) * ohci->n_it; in pci_probe()
3746 ohci->it_context_list = devm_kzalloc(&dev->dev, size, GFP_KERNEL); in pci_probe()
3747 if (!ohci->it_context_list) in pci_probe()
3750 ohci->self_id = ohci->misc_buffer + PAGE_SIZE/2; in pci_probe()
3751 ohci->self_id_bus = ohci->misc_buffer_bus + PAGE_SIZE/2; in pci_probe()
3753 bus_options = reg_read(ohci, OHCI1394_BusOptions); in pci_probe()
3756 guid = ((u64) reg_read(ohci, OHCI1394_GUIDHi) << 32) | in pci_probe()
3757 reg_read(ohci, OHCI1394_GUIDLo); in pci_probe()
3759 if (!(ohci->quirks & QUIRK_NO_MSI)) in pci_probe()
3762 pci_dev_msi_enabled(dev) ? 0 : IRQF_SHARED, ohci_driver_name, ohci); in pci_probe()
3764 ohci_err(ohci, "failed to allocate interrupt %d\n", dev->irq); in pci_probe()
3768 err = fw_card_add(&ohci->card, max_receive, link_speed, guid); in pci_probe()
3772 version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; in pci_probe()
3773 ohci_notice(ohci, in pci_probe()
3774 "added OHCI v%x.%x device as card %d, " in pci_probe()
3776 version >> 16, version & 0xff, ohci->card.index, in pci_probe()
3777 ohci->n_ir, ohci->n_it, ohci->quirks, in pci_probe()
3778 reg_read(ohci, OHCI1394_PhyUpperBound) ? in pci_probe()
3784 devm_free_irq(&dev->dev, dev->irq, ohci); in pci_probe()
3792 struct fw_ohci *ohci = pci_get_drvdata(dev); in pci_remove() local
3798 if (reg_read(ohci, OHCI1394_HCControlSet) & OHCI1394_HCControl_LPS) { in pci_remove()
3799 reg_write(ohci, OHCI1394_IntMaskClear, ~0); in pci_remove()
3800 flush_writes(ohci); in pci_remove()
3802 cancel_work_sync(&ohci->bus_reset_work); in pci_remove()
3803 fw_core_remove_card(&ohci->card); in pci_remove()
3810 software_reset(ohci); in pci_remove()
3812 devm_free_irq(&dev->dev, dev->irq, ohci); in pci_remove()
3815 dev_notice(&dev->dev, "removing fw-ohci device\n"); in pci_remove()
3821 struct fw_ohci *ohci = pci_get_drvdata(dev); in pci_suspend() local
3824 software_reset(ohci); in pci_suspend()
3827 ohci_err(ohci, "pci_save_state failed\n"); in pci_suspend()
3832 ohci_err(ohci, "pci_set_power_state failed with %d\n", err); in pci_suspend()
3840 struct fw_ohci *ohci = pci_get_drvdata(dev); in pci_resume() local
3848 ohci_err(ohci, "pci_enable_device failed\n"); in pci_resume()
3853 if (!reg_read(ohci, OHCI1394_GUIDLo) && in pci_resume()
3854 !reg_read(ohci, OHCI1394_GUIDHi)) { in pci_resume()
3855 reg_write(ohci, OHCI1394_GUIDLo, (u32)ohci->card.guid); in pci_resume()
3856 reg_write(ohci, OHCI1394_GUIDHi, (u32)(ohci->card.guid >> 32)); in pci_resume()
3859 err = ohci_enable(&ohci->card, NULL, 0); in pci_resume()
3863 ohci_resume_iso_dma(ohci); in pci_resume()
3906 MODULE_DESCRIPTION("Driver for PCI OHCI IEEE1394 controllers");