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>

+22 -3
+1
drivers/firewire/fw-card.c
··· 403 403 card->current_tlabel = 0; 404 404 card->tlabel_mask = 0; 405 405 card->color = 0; 406 + card->broadcast_channel = BROADCAST_CHANNEL_INITIAL; 406 407 407 408 INIT_LIST_HEAD(&card->transaction_list); 408 409 spin_lock_init(&card->lock);
+17 -3
drivers/firewire/fw-transaction.c
··· 817 817 int reg = offset & ~CSR_REGISTER_BASE; 818 818 unsigned long long bus_time; 819 819 __be32 *data = payload; 820 + int rcode = RCODE_COMPLETE; 820 821 821 822 switch (reg) { 822 823 case CSR_CYCLE_TIME: 823 824 case CSR_BUS_TIME: 824 825 if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) { 825 - fw_send_response(card, request, RCODE_TYPE_ERROR); 826 + rcode = RCODE_TYPE_ERROR; 826 827 break; 827 828 } 828 829 ··· 832 831 *data = cpu_to_be32(bus_time); 833 832 else 834 833 *data = cpu_to_be32(bus_time >> 25); 835 - fw_send_response(card, request, RCODE_COMPLETE); 834 + break; 835 + 836 + case CSR_BROADCAST_CHANNEL: 837 + if (tcode == TCODE_READ_QUADLET_REQUEST) 838 + *data = cpu_to_be32(card->broadcast_channel); 839 + else if (tcode == TCODE_WRITE_QUADLET_REQUEST) 840 + card->broadcast_channel = 841 + (be32_to_cpu(*data) & BROADCAST_CHANNEL_VALID) | 842 + BROADCAST_CHANNEL_INITIAL; 843 + else 844 + rcode = RCODE_TYPE_ERROR; 836 845 break; 837 846 838 847 case CSR_BUS_MANAGER_ID: ··· 861 850 862 851 case CSR_BUSY_TIMEOUT: 863 852 /* FIXME: Implement this. */ 853 + 864 854 default: 865 - fw_send_response(card, request, RCODE_ADDRESS_ERROR); 855 + rcode = RCODE_ADDRESS_ERROR; 866 856 break; 867 857 } 858 + 859 + fw_send_response(card, request, rcode); 868 860 } 869 861 870 862 static struct fw_address_handler registers = {
+4
drivers/firewire/fw-transaction.h
··· 80 80 #define CSR_SPEED_MAP 0x2000 81 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 86 #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) 84 87 #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) 85 88 ··· 239 236 */ 240 237 int self_id_count; 241 238 u32 topology_map[252 + 3]; 239 + u32 broadcast_channel; 242 240 243 241 spinlock_t lock; /* Take this lock when handling the lists in 244 242 * this struct. */