Commit e534fe16 authored by Stefan Richter's avatar Stefan Richter

firewire: implement broadcast_channel CSR for 1394a compliance

See IEEE 1394a clause 8.3.2.3.11.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 435f9726
...@@ -403,6 +403,7 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, ...@@ -403,6 +403,7 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
card->current_tlabel = 0; card->current_tlabel = 0;
card->tlabel_mask = 0; card->tlabel_mask = 0;
card->color = 0; card->color = 0;
card->broadcast_channel = BROADCAST_CHANNEL_INITIAL;
INIT_LIST_HEAD(&card->transaction_list); INIT_LIST_HEAD(&card->transaction_list);
spin_lock_init(&card->lock); spin_lock_init(&card->lock);
......
...@@ -817,12 +817,13 @@ handle_registers(struct fw_card *card, struct fw_request *request, ...@@ -817,12 +817,13 @@ handle_registers(struct fw_card *card, struct fw_request *request,
int reg = offset & ~CSR_REGISTER_BASE; int reg = offset & ~CSR_REGISTER_BASE;
unsigned long long bus_time; unsigned long long bus_time;
__be32 *data = payload; __be32 *data = payload;
int rcode = RCODE_COMPLETE;
switch (reg) { switch (reg) {
case CSR_CYCLE_TIME: case CSR_CYCLE_TIME:
case CSR_BUS_TIME: case CSR_BUS_TIME:
if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) { if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) {
fw_send_response(card, request, RCODE_TYPE_ERROR); rcode = RCODE_TYPE_ERROR;
break; break;
} }
...@@ -831,7 +832,17 @@ handle_registers(struct fw_card *card, struct fw_request *request, ...@@ -831,7 +832,17 @@ handle_registers(struct fw_card *card, struct fw_request *request,
*data = cpu_to_be32(bus_time); *data = cpu_to_be32(bus_time);
else else
*data = cpu_to_be32(bus_time >> 25); *data = cpu_to_be32(bus_time >> 25);
fw_send_response(card, request, RCODE_COMPLETE); break;
case CSR_BROADCAST_CHANNEL:
if (tcode == TCODE_READ_QUADLET_REQUEST)
*data = cpu_to_be32(card->broadcast_channel);
else if (tcode == TCODE_WRITE_QUADLET_REQUEST)
card->broadcast_channel =
(be32_to_cpu(*data) & BROADCAST_CHANNEL_VALID) |
BROADCAST_CHANNEL_INITIAL;
else
rcode = RCODE_TYPE_ERROR;
break; break;
case CSR_BUS_MANAGER_ID: case CSR_BUS_MANAGER_ID:
...@@ -850,10 +861,13 @@ handle_registers(struct fw_card *card, struct fw_request *request, ...@@ -850,10 +861,13 @@ handle_registers(struct fw_card *card, struct fw_request *request,
case CSR_BUSY_TIMEOUT: case CSR_BUSY_TIMEOUT:
/* FIXME: Implement this. */ /* FIXME: Implement this. */
default: default:
fw_send_response(card, request, RCODE_ADDRESS_ERROR); rcode = RCODE_ADDRESS_ERROR;
break; break;
} }
fw_send_response(card, request, rcode);
} }
static struct fw_address_handler registers = { static struct fw_address_handler registers = {
......
...@@ -80,6 +80,9 @@ ...@@ -80,6 +80,9 @@
#define CSR_SPEED_MAP 0x2000 #define CSR_SPEED_MAP 0x2000
#define CSR_SPEED_MAP_END 0x3000 #define CSR_SPEED_MAP_END 0x3000
#define BROADCAST_CHANNEL_INITIAL (1 << 31 | 31)
#define BROADCAST_CHANNEL_VALID (1 << 30)
#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
...@@ -236,6 +239,7 @@ struct fw_card { ...@@ -236,6 +239,7 @@ struct fw_card {
*/ */
int self_id_count; int self_id_count;
u32 topology_map[252 + 3]; u32 topology_map[252 + 3];
u32 broadcast_channel;
spinlock_t lock; /* Take this lock when handling the lists in spinlock_t lock; /* Take this lock when handling the lists in
* this struct. */ * this struct. */
......
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