diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-05-24 10:41:09 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-07-14 07:06:03 -0400 |
commit | e534fe16b987780744da351acece2a4699783096 (patch) | |
tree | fdeafe1851b2b40b3def1f4135a7fc847deb595a | |
parent | 435f972697fcd4c424db941f0ea8f2e38eda2b39 (diff) |
firewire: implement broadcast_channel CSR for 1394a compliance
See IEEE 1394a clause 8.3.2.3.11.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r-- | drivers/firewire/fw-card.c | 1 | ||||
-rw-r--r-- | drivers/firewire/fw-transaction.c | 20 | ||||
-rw-r--r-- | drivers/firewire/fw-transaction.h | 4 |
3 files changed, 22 insertions, 3 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c index 5b4c0d9f5173..96340ce690d4 100644 --- a/drivers/firewire/fw-card.c +++ b/drivers/firewire/fw-card.c | |||
@@ -403,6 +403,7 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, | |||
403 | card->current_tlabel = 0; | 403 | card->current_tlabel = 0; |
404 | card->tlabel_mask = 0; | 404 | card->tlabel_mask = 0; |
405 | card->color = 0; | 405 | card->color = 0; |
406 | card->broadcast_channel = BROADCAST_CHANNEL_INITIAL; | ||
406 | 407 | ||
407 | INIT_LIST_HEAD(&card->transaction_list); | 408 | INIT_LIST_HEAD(&card->transaction_list); |
408 | spin_lock_init(&card->lock); | 409 | spin_lock_init(&card->lock); |
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c index 03ae8a77c479..2f11ed1acf01 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c | |||
@@ -817,12 +817,13 @@ handle_registers(struct fw_card *card, struct fw_request *request, | |||
817 | int reg = offset & ~CSR_REGISTER_BASE; | 817 | int reg = offset & ~CSR_REGISTER_BASE; |
818 | unsigned long long bus_time; | 818 | unsigned long long bus_time; |
819 | __be32 *data = payload; | 819 | __be32 *data = payload; |
820 | int rcode = RCODE_COMPLETE; | ||
820 | 821 | ||
821 | switch (reg) { | 822 | switch (reg) { |
822 | case CSR_CYCLE_TIME: | 823 | case CSR_CYCLE_TIME: |
823 | case CSR_BUS_TIME: | 824 | case CSR_BUS_TIME: |
824 | if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) { | 825 | if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) { |
825 | fw_send_response(card, request, RCODE_TYPE_ERROR); | 826 | rcode = RCODE_TYPE_ERROR; |
826 | break; | 827 | break; |
827 | } | 828 | } |
828 | 829 | ||
@@ -831,7 +832,17 @@ handle_registers(struct fw_card *card, struct fw_request *request, | |||
831 | *data = cpu_to_be32(bus_time); | 832 | *data = cpu_to_be32(bus_time); |
832 | else | 833 | else |
833 | *data = cpu_to_be32(bus_time >> 25); | 834 | *data = cpu_to_be32(bus_time >> 25); |
834 | fw_send_response(card, request, RCODE_COMPLETE); | 835 | break; |
836 | |||
837 | case CSR_BROADCAST_CHANNEL: | ||
838 | if (tcode == TCODE_READ_QUADLET_REQUEST) | ||
839 | *data = cpu_to_be32(card->broadcast_channel); | ||
840 | else if (tcode == TCODE_WRITE_QUADLET_REQUEST) | ||
841 | card->broadcast_channel = | ||
842 | (be32_to_cpu(*data) & BROADCAST_CHANNEL_VALID) | | ||
843 | BROADCAST_CHANNEL_INITIAL; | ||
844 | else | ||
845 | rcode = RCODE_TYPE_ERROR; | ||
835 | break; | 846 | break; |
836 | 847 | ||
837 | case CSR_BUS_MANAGER_ID: | 848 | case CSR_BUS_MANAGER_ID: |
@@ -850,10 +861,13 @@ handle_registers(struct fw_card *card, struct fw_request *request, | |||
850 | 861 | ||
851 | case CSR_BUSY_TIMEOUT: | 862 | case CSR_BUSY_TIMEOUT: |
852 | /* FIXME: Implement this. */ | 863 | /* FIXME: Implement this. */ |
864 | |||
853 | default: | 865 | default: |
854 | fw_send_response(card, request, RCODE_ADDRESS_ERROR); | 866 | rcode = RCODE_ADDRESS_ERROR; |
855 | break; | 867 | break; |
856 | } | 868 | } |
869 | |||
870 | fw_send_response(card, request, rcode); | ||
857 | } | 871 | } |
858 | 872 | ||
859 | static struct fw_address_handler registers = { | 873 | static struct fw_address_handler registers = { |
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 04d3854f6560..f3a493d596cc 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -80,6 +80,9 @@ | |||
80 | #define CSR_SPEED_MAP 0x2000 | 80 | #define CSR_SPEED_MAP 0x2000 |
81 | #define CSR_SPEED_MAP_END 0x3000 | 81 | #define CSR_SPEED_MAP_END 0x3000 |
82 | 82 | ||
83 | #define BROADCAST_CHANNEL_INITIAL (1 << 31 | 31) | ||
84 | #define BROADCAST_CHANNEL_VALID (1 << 30) | ||
85 | |||
83 | #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) | 86 | #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) |
84 | #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) | 87 | #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) |
85 | 88 | ||
@@ -236,6 +239,7 @@ struct fw_card { | |||
236 | */ | 239 | */ |
237 | int self_id_count; | 240 | int self_id_count; |
238 | u32 topology_map[252 + 3]; | 241 | u32 topology_map[252 + 3]; |
242 | u32 broadcast_channel; | ||
239 | 243 | ||
240 | spinlock_t lock; /* Take this lock when handling the lists in | 244 | spinlock_t lock; /* Take this lock when handling the lists in |
241 | * this struct. */ | 245 | * this struct. */ |