aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2010-06-12 14:30:21 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-06-19 07:01:41 -0400
commitdb3c9cc105ee844f6cd7a1beb9926fb8e9a093ae (patch)
tree5fe981b7be4ffb97a506e23836d6c81a61dc8c91
parente847cc832bab50aad939a0c30414cd986637564d (diff)
firewire: replace get_features card driver hook
by feature variables in the fw_card struct. The hook appeared to be an unnecessary abstraction in the card driver interface. Cleaner would be to pass those feature flags as arguments to fw_card_initialize() or fw_card_add(), but the FairnessControl register is in the SCLK domain and may therefore not be accessible while Link Power Status is off, i.e. before the card->driver->enable call from fw_card_add(). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r--drivers/firewire/core-topology.c3
-rw-r--r--drivers/firewire/core-transaction.c3
-rw-r--r--drivers/firewire/core.h5
-rw-r--r--drivers/firewire/ohci.c14
-rw-r--r--include/linux/firewire.h3
5 files changed, 7 insertions, 21 deletions
diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c
index 00a556f3a585..3b9667c37b67 100644
--- a/drivers/firewire/core-topology.c
+++ b/drivers/firewire/core-topology.c
@@ -543,8 +543,7 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
543 543
544 spin_lock_irqsave(&card->lock, flags); 544 spin_lock_irqsave(&card->lock, flags);
545 545
546 card->broadcast_channel_allocated = (card->driver->get_features(card) & 546 card->broadcast_channel_allocated = card->broadcast_channel_auto_allocated;
547 FEATURE_CHANNEL_31_ALLOCATED) != 0;
548 card->node_id = node_id; 547 card->node_id = node_id;
549 /* 548 /*
550 * Update node_id before generation to prevent anybody from using 549 * Update node_id before generation to prevent anybody from using
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 5069cfc75b50..62bf30560a3e 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -1129,8 +1129,7 @@ static void handle_registers(struct fw_card *card, struct fw_request *request,
1129 break; 1129 break;
1130 1130
1131 case CSR_PRIORITY_BUDGET: 1131 case CSR_PRIORITY_BUDGET:
1132 if (!(card->driver->get_features(card) & 1132 if (!card->priority_budget_implemented)
1133 FEATURE_PRIORITY_BUDGET))
1134 rcode = RCODE_ADDRESS_ERROR; 1133 rcode = RCODE_ADDRESS_ERROR;
1135 else if (tcode == TCODE_READ_QUADLET_REQUEST) 1134 else if (tcode == TCODE_READ_QUADLET_REQUEST)
1136 *data = cpu_to_be32(card->driver-> 1135 *data = cpu_to_be32(card->driver->
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h
index 3f9e39b60bca..8dc76d8711a5 100644
--- a/drivers/firewire/core.h
+++ b/drivers/firewire/core.h
@@ -38,9 +38,6 @@ struct fw_packet;
38#define BROADCAST_CHANNEL_INITIAL (1 << 31 | 31) 38#define BROADCAST_CHANNEL_INITIAL (1 << 31 | 31)
39#define BROADCAST_CHANNEL_VALID (1 << 30) 39#define BROADCAST_CHANNEL_VALID (1 << 30)
40 40
41#define FEATURE_PRIORITY_BUDGET 0x01
42#define FEATURE_CHANNEL_31_ALLOCATED 0x02
43
44#define CSR_STATE_BIT_CMSTR (1 << 8) 41#define CSR_STATE_BIT_CMSTR (1 << 8)
45#define CSR_STATE_BIT_ABDICATE (1 << 10) 42#define CSR_STATE_BIT_ABDICATE (1 << 10)
46 43
@@ -84,8 +81,6 @@ struct fw_card_driver {
84 u32 (*read_csr_reg)(struct fw_card *card, int csr_offset); 81 u32 (*read_csr_reg)(struct fw_card *card, int csr_offset);
85 void (*write_csr_reg)(struct fw_card *card, int csr_offset, u32 value); 82 void (*write_csr_reg)(struct fw_card *card, int csr_offset, u32 value);
86 83
87 unsigned int (*get_features)(struct fw_card *card);
88
89 struct fw_iso_context * 84 struct fw_iso_context *
90 (*allocate_iso_context)(struct fw_card *card, 85 (*allocate_iso_context)(struct fw_card *card,
91 int type, int channel, size_t header_size); 86 int type, int channel, size_t header_size);
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 2abdb3268a10..09bba9315de9 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -172,7 +172,6 @@ struct fw_ohci {
172 int request_generation; /* for timestamping incoming requests */ 172 int request_generation; /* for timestamping incoming requests */
173 unsigned quirks; 173 unsigned quirks;
174 unsigned int pri_req_max; 174 unsigned int pri_req_max;
175 unsigned int features;
176 u32 bus_time; 175 u32 bus_time;
177 bool is_root; 176 bool is_root;
178 177
@@ -1753,15 +1752,14 @@ static int ohci_enable(struct fw_card *card,
1753 if (version >= OHCI_VERSION_1_1) { 1752 if (version >= OHCI_VERSION_1_1) {
1754 reg_write(ohci, OHCI1394_InitialChannelsAvailableHi, 1753 reg_write(ohci, OHCI1394_InitialChannelsAvailableHi,
1755 0xfffffffe); 1754 0xfffffffe);
1756 ohci->features |= FEATURE_CHANNEL_31_ALLOCATED; 1755 card->broadcast_channel_auto_allocated = true;
1757 } 1756 }
1758 1757
1759 /* Get implemented bits of the priority arbitration request counter. */ 1758 /* Get implemented bits of the priority arbitration request counter. */
1760 reg_write(ohci, OHCI1394_FairnessControl, 0x3f); 1759 reg_write(ohci, OHCI1394_FairnessControl, 0x3f);
1761 ohci->pri_req_max = reg_read(ohci, OHCI1394_FairnessControl) & 0x3f; 1760 ohci->pri_req_max = reg_read(ohci, OHCI1394_FairnessControl) & 0x3f;
1762 reg_write(ohci, OHCI1394_FairnessControl, 0); 1761 reg_write(ohci, OHCI1394_FairnessControl, 0);
1763 if (ohci->pri_req_max != 0) 1762 card->priority_budget_implemented = ohci->pri_req_max != 0;
1764 ohci->features |= FEATURE_PRIORITY_BUDGET;
1765 1763
1766 ar_context_run(&ohci->ar_request_ctx); 1764 ar_context_run(&ohci->ar_request_ctx);
1767 ar_context_run(&ohci->ar_response_ctx); 1765 ar_context_run(&ohci->ar_response_ctx);
@@ -2132,13 +2130,6 @@ static void ohci_write_csr_reg(struct fw_card *card, int csr_offset, u32 value)
2132 } 2130 }
2133} 2131}
2134 2132
2135static unsigned int ohci_get_features(struct fw_card *card)
2136{
2137 struct fw_ohci *ohci = fw_ohci(card);
2138
2139 return ohci->features;
2140}
2141
2142static void copy_iso_headers(struct iso_context *ctx, void *p) 2133static void copy_iso_headers(struct iso_context *ctx, void *p)
2143{ 2134{
2144 int i = ctx->header_length; 2135 int i = ctx->header_length;
@@ -2578,7 +2569,6 @@ static const struct fw_card_driver ohci_driver = {
2578 .enable_phys_dma = ohci_enable_phys_dma, 2569 .enable_phys_dma = ohci_enable_phys_dma,
2579 .read_csr_reg = ohci_read_csr_reg, 2570 .read_csr_reg = ohci_read_csr_reg,
2580 .write_csr_reg = ohci_write_csr_reg, 2571 .write_csr_reg = ohci_write_csr_reg,
2581 .get_features = ohci_get_features,
2582 2572
2583 .allocate_iso_context = ohci_allocate_iso_context, 2573 .allocate_iso_context = ohci_allocate_iso_context,
2584 .free_iso_context = ohci_free_iso_context, 2574 .free_iso_context = ohci_free_iso_context,
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 4d22643215ef..5acb5fc19180 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -122,6 +122,9 @@ struct fw_card {
122 bool bm_abdicate; /* value of csr_abdicate before last bus reset */ 122 bool bm_abdicate; /* value of csr_abdicate before last bus reset */
123 bool csr_abdicate; /* visible in CSR STATE_CLEAR/SET registers */ 123 bool csr_abdicate; /* visible in CSR STATE_CLEAR/SET registers */
124 124
125 bool priority_budget_implemented; /* controller feature */
126 bool broadcast_channel_auto_allocated; /* controller feature */
127
125 bool broadcast_channel_allocated; 128 bool broadcast_channel_allocated;
126 u32 broadcast_channel; 129 u32 broadcast_channel;
127 __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; 130 __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];