diff options
-rw-r--r-- | drivers/firewire/core-cdev.c | 9 | ||||
-rw-r--r-- | drivers/firewire/core.h | 5 | ||||
-rw-r--r-- | drivers/firewire/ohci.c | 3 | ||||
-rw-r--r-- | include/linux/firewire-cdev.h | 5 |
4 files changed, 18 insertions, 4 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 0425dd5dfcd3..31863cf8b6c4 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -1423,9 +1423,10 @@ static void outbound_phy_packet_callback(struct fw_packet *packet, | |||
1423 | /* stale generation; cancelled; on certain controllers: no ack */ | 1423 | /* stale generation; cancelled; on certain controllers: no ack */ |
1424 | default: e->phy_packet.rcode = status; break; | 1424 | default: e->phy_packet.rcode = status; break; |
1425 | } | 1425 | } |
1426 | e->phy_packet.data[0] = packet->timestamp; | ||
1426 | 1427 | ||
1427 | queue_event(e->client, &e->event, | 1428 | queue_event(e->client, &e->event, &e->phy_packet, |
1428 | &e->phy_packet, sizeof(e->phy_packet), NULL, 0); | 1429 | sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0); |
1429 | client_put(e->client); | 1430 | client_put(e->client); |
1430 | } | 1431 | } |
1431 | 1432 | ||
@@ -1439,7 +1440,7 @@ static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg) | |||
1439 | if (!client->device->is_local) | 1440 | if (!client->device->is_local) |
1440 | return -ENOSYS; | 1441 | return -ENOSYS; |
1441 | 1442 | ||
1442 | e = kzalloc(sizeof(*e), GFP_KERNEL); | 1443 | e = kzalloc(sizeof(*e) + 4, GFP_KERNEL); |
1443 | if (e == NULL) | 1444 | if (e == NULL) |
1444 | return -ENOMEM; | 1445 | return -ENOMEM; |
1445 | 1446 | ||
@@ -1453,6 +1454,8 @@ static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg) | |||
1453 | e->p.callback = outbound_phy_packet_callback; | 1454 | e->p.callback = outbound_phy_packet_callback; |
1454 | e->phy_packet.closure = a->closure; | 1455 | e->phy_packet.closure = a->closure; |
1455 | e->phy_packet.type = FW_CDEV_EVENT_PHY_PACKET_SENT; | 1456 | e->phy_packet.type = FW_CDEV_EVENT_PHY_PACKET_SENT; |
1457 | if (is_ping_packet(a->data)) | ||
1458 | e->phy_packet.length = 4; | ||
1456 | 1459 | ||
1457 | card->driver->send_request(card, &e->p); | 1460 | card->driver->send_request(card, &e->p); |
1458 | 1461 | ||
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h index 3102b6b63438..28621e44b111 100644 --- a/drivers/firewire/core.h +++ b/drivers/firewire/core.h | |||
@@ -234,4 +234,9 @@ void fw_fill_response(struct fw_packet *response, u32 *request_header, | |||
234 | void fw_send_phy_config(struct fw_card *card, | 234 | void fw_send_phy_config(struct fw_card *card, |
235 | int node_id, int generation, int gap_count); | 235 | int node_id, int generation, int gap_count); |
236 | 236 | ||
237 | static inline bool is_ping_packet(u32 *data) | ||
238 | { | ||
239 | return (data[0] & 0xc0ffffff) == 0 && ~data[0] == data[1]; | ||
240 | } | ||
241 | |||
237 | #endif /* _FIREWIRE_CORE_H */ | 242 | #endif /* _FIREWIRE_CORE_H */ |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 08afccc66333..5f6bb2c53808 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -1068,6 +1068,9 @@ static int at_context_queue_packet(struct context *ctx, | |||
1068 | header[1] = cpu_to_le32(packet->header[0]); | 1068 | header[1] = cpu_to_le32(packet->header[0]); |
1069 | header[2] = cpu_to_le32(packet->header[1]); | 1069 | header[2] = cpu_to_le32(packet->header[1]); |
1070 | d[0].req_count = cpu_to_le16(12); | 1070 | d[0].req_count = cpu_to_le16(12); |
1071 | |||
1072 | if (is_ping_packet(packet->header)) | ||
1073 | d[0].control |= cpu_to_le16(DESCRIPTOR_PING); | ||
1071 | break; | 1074 | break; |
1072 | 1075 | ||
1073 | case 4: | 1076 | case 4: |
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index b87409160794..da0fec7e8dc0 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
@@ -294,7 +294,10 @@ struct fw_cdev_event_iso_resource { | |||
294 | * @length: Data length in bytes | 294 | * @length: Data length in bytes |
295 | * @data: Incoming data | 295 | * @data: Incoming data |
296 | * | 296 | * |
297 | * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty. | 297 | * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty, |
298 | * except in case of a ping packet: Then, @length is 4, and @data[0] is the | ||
299 | * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE. | ||
300 | * | ||
298 | * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data | 301 | * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data |
299 | * consists of the two PHY packet quadlets, in host byte order. | 302 | * consists of the two PHY packet quadlets, in host byte order. |
300 | */ | 303 | */ |