diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 12:32:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 12:32:39 -0400 |
commit | 148b729b9f51a78c1a024369bdcdc592f01103d4 (patch) | |
tree | 0fa25d5dcff62b67545deebbebed11967753ce94 /drivers/firewire | |
parent | 9ec97169e7d6afe2f8206d694d1411fb3bb49853 (diff) | |
parent | e3cbd92002a30aecae8cb8b31a5e1916eb270a14 (diff) |
Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire updates from Stefan Richter:
- Small fixes and optimizations.
- A new sysfs attribute to tell local and remote nodes apart.
Useful to set special permissions/ ownership of local nodes'
/dev/fw*, to start daemons on them (for diagnostics, management,
AV targets, VersaPHY initiator or targets...), to pick up their
GUID to use it as GUID of an SBP2 target instance, and of course
for informational purposes.
* tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
firewire: core: document is_local sysfs attribute
firewire: core: add is_local sysfs device attribute
firewire: ohci: initialize multiChanMode bits after reset
firewire: core: fix multichannel IR with buffers larger than 2 GB
firewire: ohci: sanity-check MMIO resource
firewire: ohci: lazy bus time initialization
firewire: core: allocate the low memory region
firewire: core: make address handler length 64 bits
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/core-device.c | 9 | ||||
-rw-r--r-- | drivers/firewire/core-iso.c | 2 | ||||
-rw-r--r-- | drivers/firewire/core-transaction.c | 23 | ||||
-rw-r--r-- | drivers/firewire/ohci.c | 30 |
4 files changed, 55 insertions, 9 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 4d460ef87161..7a05fd24d68b 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c | |||
@@ -398,6 +398,14 @@ static ssize_t guid_show(struct device *dev, | |||
398 | return ret; | 398 | return ret; |
399 | } | 399 | } |
400 | 400 | ||
401 | static ssize_t is_local_show(struct device *dev, | ||
402 | struct device_attribute *attr, char *buf) | ||
403 | { | ||
404 | struct fw_device *device = fw_device(dev); | ||
405 | |||
406 | return sprintf(buf, "%u\n", device->is_local); | ||
407 | } | ||
408 | |||
401 | static int units_sprintf(char *buf, const u32 *directory) | 409 | static int units_sprintf(char *buf, const u32 *directory) |
402 | { | 410 | { |
403 | struct fw_csr_iterator ci; | 411 | struct fw_csr_iterator ci; |
@@ -447,6 +455,7 @@ static ssize_t units_show(struct device *dev, | |||
447 | static struct device_attribute fw_device_attributes[] = { | 455 | static struct device_attribute fw_device_attributes[] = { |
448 | __ATTR_RO(config_rom), | 456 | __ATTR_RO(config_rom), |
449 | __ATTR_RO(guid), | 457 | __ATTR_RO(guid), |
458 | __ATTR_RO(is_local), | ||
450 | __ATTR_RO(units), | 459 | __ATTR_RO(units), |
451 | __ATTR_NULL, | 460 | __ATTR_NULL, |
452 | }; | 461 | }; |
diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index 8382e27e9a27..38c0aa60b2cb 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c | |||
@@ -146,7 +146,7 @@ EXPORT_SYMBOL(fw_iso_buffer_destroy); | |||
146 | /* Convert DMA address to offset into virtually contiguous buffer. */ | 146 | /* Convert DMA address to offset into virtually contiguous buffer. */ |
147 | size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed) | 147 | size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed) |
148 | { | 148 | { |
149 | int i; | 149 | size_t i; |
150 | dma_addr_t address; | 150 | dma_addr_t address; |
151 | ssize_t offset; | 151 | ssize_t offset; |
152 | 152 | ||
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index 780708dc6e25..87d6f2d2f02d 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c | |||
@@ -525,9 +525,10 @@ const struct fw_address_region fw_high_memory_region = | |||
525 | { .start = 0x000100000000ULL, .end = 0xffffe0000000ULL, }; | 525 | { .start = 0x000100000000ULL, .end = 0xffffe0000000ULL, }; |
526 | EXPORT_SYMBOL(fw_high_memory_region); | 526 | EXPORT_SYMBOL(fw_high_memory_region); |
527 | 527 | ||
528 | #if 0 | 528 | static const struct fw_address_region low_memory_region = |
529 | const struct fw_address_region fw_low_memory_region = | ||
530 | { .start = 0x000000000000ULL, .end = 0x000100000000ULL, }; | 529 | { .start = 0x000000000000ULL, .end = 0x000100000000ULL, }; |
530 | |||
531 | #if 0 | ||
531 | const struct fw_address_region fw_private_region = | 532 | const struct fw_address_region fw_private_region = |
532 | { .start = 0xffffe0000000ULL, .end = 0xfffff0000000ULL, }; | 533 | { .start = 0xffffe0000000ULL, .end = 0xfffff0000000ULL, }; |
533 | const struct fw_address_region fw_csr_region = | 534 | const struct fw_address_region fw_csr_region = |
@@ -1198,6 +1199,23 @@ static struct fw_address_handler registers = { | |||
1198 | .address_callback = handle_registers, | 1199 | .address_callback = handle_registers, |
1199 | }; | 1200 | }; |
1200 | 1201 | ||
1202 | static void handle_low_memory(struct fw_card *card, struct fw_request *request, | ||
1203 | int tcode, int destination, int source, int generation, | ||
1204 | unsigned long long offset, void *payload, size_t length, | ||
1205 | void *callback_data) | ||
1206 | { | ||
1207 | /* | ||
1208 | * This catches requests not handled by the physical DMA unit, | ||
1209 | * i.e., wrong transaction types or unauthorized source nodes. | ||
1210 | */ | ||
1211 | fw_send_response(card, request, RCODE_TYPE_ERROR); | ||
1212 | } | ||
1213 | |||
1214 | static struct fw_address_handler low_memory = { | ||
1215 | .length = 0x000100000000ULL, | ||
1216 | .address_callback = handle_low_memory, | ||
1217 | }; | ||
1218 | |||
1201 | MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); | 1219 | MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); |
1202 | MODULE_DESCRIPTION("Core IEEE1394 transaction logic"); | 1220 | MODULE_DESCRIPTION("Core IEEE1394 transaction logic"); |
1203 | MODULE_LICENSE("GPL"); | 1221 | MODULE_LICENSE("GPL"); |
@@ -1259,6 +1277,7 @@ static int __init fw_core_init(void) | |||
1259 | 1277 | ||
1260 | fw_core_add_address_handler(&topology_map, &topology_map_region); | 1278 | fw_core_add_address_handler(&topology_map, &topology_map_region); |
1261 | fw_core_add_address_handler(®isters, ®isters_region); | 1279 | fw_core_add_address_handler(®isters, ®isters_region); |
1280 | fw_core_add_address_handler(&low_memory, &low_memory_region); | ||
1262 | fw_core_add_descriptor(&vendor_id_descriptor); | 1281 | fw_core_add_descriptor(&vendor_id_descriptor); |
1263 | fw_core_add_descriptor(&model_id_descriptor); | 1282 | fw_core_add_descriptor(&model_id_descriptor); |
1264 | 1283 | ||
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index c1af05e834b6..c788dbdaf3bc 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -191,6 +191,7 @@ struct fw_ohci { | |||
191 | unsigned quirks; | 191 | unsigned quirks; |
192 | unsigned int pri_req_max; | 192 | unsigned int pri_req_max; |
193 | u32 bus_time; | 193 | u32 bus_time; |
194 | bool bus_time_running; | ||
194 | bool is_root; | 195 | bool is_root; |
195 | bool csr_state_setclear_abdicate; | 196 | bool csr_state_setclear_abdicate; |
196 | int n_ir; | 197 | int n_ir; |
@@ -1726,6 +1727,13 @@ static u32 update_bus_time(struct fw_ohci *ohci) | |||
1726 | { | 1727 | { |
1727 | u32 cycle_time_seconds = get_cycle_time(ohci) >> 25; | 1728 | u32 cycle_time_seconds = get_cycle_time(ohci) >> 25; |
1728 | 1729 | ||
1730 | if (unlikely(!ohci->bus_time_running)) { | ||
1731 | reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_cycle64Seconds); | ||
1732 | ohci->bus_time = (lower_32_bits(get_seconds()) & ~0x7f) | | ||
1733 | (cycle_time_seconds & 0x40); | ||
1734 | ohci->bus_time_running = true; | ||
1735 | } | ||
1736 | |||
1729 | if ((ohci->bus_time & 0x40) != (cycle_time_seconds & 0x40)) | 1737 | if ((ohci->bus_time & 0x40) != (cycle_time_seconds & 0x40)) |
1730 | ohci->bus_time += 0x40; | 1738 | ohci->bus_time += 0x40; |
1731 | 1739 | ||
@@ -2213,7 +2221,7 @@ static int ohci_enable(struct fw_card *card, | |||
2213 | { | 2221 | { |
2214 | struct fw_ohci *ohci = fw_ohci(card); | 2222 | struct fw_ohci *ohci = fw_ohci(card); |
2215 | struct pci_dev *dev = to_pci_dev(card->device); | 2223 | struct pci_dev *dev = to_pci_dev(card->device); |
2216 | u32 lps, seconds, version, irqs; | 2224 | u32 lps, version, irqs; |
2217 | int i, ret; | 2225 | int i, ret; |
2218 | 2226 | ||
2219 | if (software_reset(ohci)) { | 2227 | if (software_reset(ohci)) { |
@@ -2269,9 +2277,12 @@ static int ohci_enable(struct fw_card *card, | |||
2269 | (OHCI1394_MAX_PHYS_RESP_RETRIES << 8) | | 2277 | (OHCI1394_MAX_PHYS_RESP_RETRIES << 8) | |
2270 | (200 << 16)); | 2278 | (200 << 16)); |
2271 | 2279 | ||
2272 | seconds = lower_32_bits(get_seconds()); | 2280 | ohci->bus_time_running = false; |
2273 | reg_write(ohci, OHCI1394_IsochronousCycleTimer, seconds << 25); | 2281 | |
2274 | ohci->bus_time = seconds & ~0x3f; | 2282 | for (i = 0; i < 32; i++) |
2283 | if (ohci->ir_context_support & (1 << i)) | ||
2284 | reg_write(ohci, OHCI1394_IsoRcvContextControlClear(i), | ||
2285 | IR_CONTEXT_MULTI_CHANNEL_MODE); | ||
2275 | 2286 | ||
2276 | version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; | 2287 | version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; |
2277 | if (version >= OHCI_VERSION_1_1) { | 2288 | if (version >= OHCI_VERSION_1_1) { |
@@ -2369,7 +2380,6 @@ static int ohci_enable(struct fw_card *card, | |||
2369 | OHCI1394_postedWriteErr | | 2380 | OHCI1394_postedWriteErr | |
2370 | OHCI1394_selfIDComplete | | 2381 | OHCI1394_selfIDComplete | |
2371 | OHCI1394_regAccessFail | | 2382 | OHCI1394_regAccessFail | |
2372 | OHCI1394_cycle64Seconds | | ||
2373 | OHCI1394_cycleInconsistent | | 2383 | OHCI1394_cycleInconsistent | |
2374 | OHCI1394_unrecoverableError | | 2384 | OHCI1394_unrecoverableError | |
2375 | OHCI1394_cycleTooLong | | 2385 | OHCI1394_cycleTooLong | |
@@ -2658,7 +2668,8 @@ static void ohci_write_csr(struct fw_card *card, int csr_offset, u32 value) | |||
2658 | 2668 | ||
2659 | case CSR_BUS_TIME: | 2669 | case CSR_BUS_TIME: |
2660 | spin_lock_irqsave(&ohci->lock, flags); | 2670 | spin_lock_irqsave(&ohci->lock, flags); |
2661 | ohci->bus_time = (ohci->bus_time & 0x7f) | (value & ~0x7f); | 2671 | ohci->bus_time = (update_bus_time(ohci) & 0x40) | |
2672 | (value & ~0x7f); | ||
2662 | spin_unlock_irqrestore(&ohci->lock, flags); | 2673 | spin_unlock_irqrestore(&ohci->lock, flags); |
2663 | break; | 2674 | break; |
2664 | 2675 | ||
@@ -3539,6 +3550,13 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
3539 | 3550 | ||
3540 | INIT_WORK(&ohci->bus_reset_work, bus_reset_work); | 3551 | INIT_WORK(&ohci->bus_reset_work, bus_reset_work); |
3541 | 3552 | ||
3553 | if (!(pci_resource_flags(dev, 0) & IORESOURCE_MEM) || | ||
3554 | pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE) { | ||
3555 | dev_err(&dev->dev, "invalid MMIO resource\n"); | ||
3556 | err = -ENXIO; | ||
3557 | goto fail_disable; | ||
3558 | } | ||
3559 | |||
3542 | err = pci_request_region(dev, 0, ohci_driver_name); | 3560 | err = pci_request_region(dev, 0, ohci_driver_name); |
3543 | if (err) { | 3561 | if (err) { |
3544 | dev_err(&dev->dev, "MMIO resource unavailable\n"); | 3562 | dev_err(&dev->dev, "MMIO resource unavailable\n"); |