Commit e364cf4e authored by Kristian Høgsberg's avatar Kristian Høgsberg Committed by Stefan Richter

firewire: Store OHCI version and make sure we have at least 1.1 before doing dualbuffer.

Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 68be3fa1
...@@ -152,6 +152,7 @@ struct iso_context { ...@@ -152,6 +152,7 @@ struct iso_context {
struct fw_ohci { struct fw_ohci {
struct fw_card card; struct fw_card card;
u32 version;
__iomem char *registers; __iomem char *registers;
dma_addr_t self_id_bus; dma_addr_t self_id_bus;
__le32 *self_id_cpu; __le32 *self_id_cpu;
...@@ -210,6 +211,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card) ...@@ -210,6 +211,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
#define OHCI1394_PCI_HCI_Control 0x40 #define OHCI1394_PCI_HCI_Control 0x40
#define SELF_ID_BUF_SIZE 0x800 #define SELF_ID_BUF_SIZE 0x800
#define OHCI_TCODE_PHY_PACKET 0x0e #define OHCI_TCODE_PHY_PACKET 0x0e
#define OHCI_VERSION_1_1 0x010010
static char ohci_driver_name[] = KBUILD_MODNAME; static char ohci_driver_name[] = KBUILD_MODNAME;
...@@ -1357,6 +1359,10 @@ ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size) ...@@ -1357,6 +1359,10 @@ ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size)
callback = handle_ir_bufferfill_packet; callback = handle_ir_bufferfill_packet;
} }
if (callback == handle_ir_dualbuffer_packet &&
ohci->version < OHCI_VERSION_1_1)
return ERR_PTR(-EINVAL);
spin_lock_irqsave(&ohci->lock, flags); spin_lock_irqsave(&ohci->lock, flags);
index = ffs(*mask) - 1; index = ffs(*mask) - 1;
if (index >= 0) if (index >= 0)
...@@ -1687,14 +1693,19 @@ ohci_queue_iso(struct fw_iso_context *base, ...@@ -1687,14 +1693,19 @@ ohci_queue_iso(struct fw_iso_context *base,
struct fw_iso_buffer *buffer, struct fw_iso_buffer *buffer,
unsigned long payload) unsigned long payload)
{ {
struct iso_context *ctx = container_of(base, struct iso_context, base);
if (base->type == FW_ISO_CONTEXT_TRANSMIT) if (base->type == FW_ISO_CONTEXT_TRANSMIT)
return ohci_queue_iso_transmit(base, packet, buffer, payload); return ohci_queue_iso_transmit(base, packet, buffer, payload);
else if (base->header_size == 0) else if (base->header_size == 0)
return ohci_queue_iso_receive_bufferfill(base, packet, return ohci_queue_iso_receive_bufferfill(base, packet,
buffer, payload); buffer, payload);
else else if (ctx->context.ohci->version >= OHCI_VERSION_1_1)
return ohci_queue_iso_receive_dualbuffer(base, packet, return ohci_queue_iso_receive_dualbuffer(base, packet,
buffer, payload); buffer, payload);
else
/* FIXME: Implement fallback for OHCI 1.0 controllers. */
return -EINVAL;
} }
static const struct fw_card_driver ohci_driver = { static const struct fw_card_driver ohci_driver = {
...@@ -1767,7 +1778,7 @@ static int __devinit ...@@ -1767,7 +1778,7 @@ static int __devinit
pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
{ {
struct fw_ohci *ohci; struct fw_ohci *ohci;
u32 bus_options, max_receive, link_speed, version; u32 bus_options, max_receive, link_speed;
u64 guid; u64 guid;
int error_code; int error_code;
size_t size; size_t size;
...@@ -1894,9 +1905,9 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) ...@@ -1894,9 +1905,9 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
if (error_code < 0) if (error_code < 0)
return cleanup(ohci, CLEANUP_SELF_ID, error_code); return cleanup(ohci, CLEANUP_SELF_ID, error_code);
version = reg_read(ohci, OHCI1394_Version); ohci->version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff;
fw_notify("Added fw-ohci device %s, OHCI version %x.%x\n", fw_notify("Added fw-ohci device %s, OHCI version %x.%x\n",
dev->dev.bus_id, (version >> 16) & 0xff, version & 0xff); dev->dev.bus_id, ohci->version >> 16, ohci->version & 0xff);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment