Commit db3c9cc1 authored by Stefan Richter's avatar Stefan Richter

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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent e847cc83
...@@ -543,8 +543,7 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation, ...@@ -543,8 +543,7 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
spin_lock_irqsave(&card->lock, flags); spin_lock_irqsave(&card->lock, flags);
card->broadcast_channel_allocated = (card->driver->get_features(card) & card->broadcast_channel_allocated = card->broadcast_channel_auto_allocated;
FEATURE_CHANNEL_31_ALLOCATED) != 0;
card->node_id = node_id; card->node_id = node_id;
/* /*
* Update node_id before generation to prevent anybody from using * Update node_id before generation to prevent anybody from using
......
...@@ -1129,8 +1129,7 @@ static void handle_registers(struct fw_card *card, struct fw_request *request, ...@@ -1129,8 +1129,7 @@ static void handle_registers(struct fw_card *card, struct fw_request *request,
break; break;
case CSR_PRIORITY_BUDGET: case CSR_PRIORITY_BUDGET:
if (!(card->driver->get_features(card) & if (!card->priority_budget_implemented)
FEATURE_PRIORITY_BUDGET))
rcode = RCODE_ADDRESS_ERROR; rcode = RCODE_ADDRESS_ERROR;
else if (tcode == TCODE_READ_QUADLET_REQUEST) else if (tcode == TCODE_READ_QUADLET_REQUEST)
*data = cpu_to_be32(card->driver-> *data = cpu_to_be32(card->driver->
......
...@@ -38,9 +38,6 @@ struct fw_packet; ...@@ -38,9 +38,6 @@ struct fw_packet;
#define BROADCAST_CHANNEL_INITIAL (1 << 31 | 31) #define BROADCAST_CHANNEL_INITIAL (1 << 31 | 31)
#define BROADCAST_CHANNEL_VALID (1 << 30) #define BROADCAST_CHANNEL_VALID (1 << 30)
#define FEATURE_PRIORITY_BUDGET 0x01
#define FEATURE_CHANNEL_31_ALLOCATED 0x02
#define CSR_STATE_BIT_CMSTR (1 << 8) #define CSR_STATE_BIT_CMSTR (1 << 8)
#define CSR_STATE_BIT_ABDICATE (1 << 10) #define CSR_STATE_BIT_ABDICATE (1 << 10)
...@@ -84,8 +81,6 @@ struct fw_card_driver { ...@@ -84,8 +81,6 @@ struct fw_card_driver {
u32 (*read_csr_reg)(struct fw_card *card, int csr_offset); u32 (*read_csr_reg)(struct fw_card *card, int csr_offset);
void (*write_csr_reg)(struct fw_card *card, int csr_offset, u32 value); void (*write_csr_reg)(struct fw_card *card, int csr_offset, u32 value);
unsigned int (*get_features)(struct fw_card *card);
struct fw_iso_context * struct fw_iso_context *
(*allocate_iso_context)(struct fw_card *card, (*allocate_iso_context)(struct fw_card *card,
int type, int channel, size_t header_size); int type, int channel, size_t header_size);
......
...@@ -172,7 +172,6 @@ struct fw_ohci { ...@@ -172,7 +172,6 @@ struct fw_ohci {
int request_generation; /* for timestamping incoming requests */ int request_generation; /* for timestamping incoming requests */
unsigned quirks; unsigned quirks;
unsigned int pri_req_max; unsigned int pri_req_max;
unsigned int features;
u32 bus_time; u32 bus_time;
bool is_root; bool is_root;
...@@ -1753,15 +1752,14 @@ static int ohci_enable(struct fw_card *card, ...@@ -1753,15 +1752,14 @@ static int ohci_enable(struct fw_card *card,
if (version >= OHCI_VERSION_1_1) { if (version >= OHCI_VERSION_1_1) {
reg_write(ohci, OHCI1394_InitialChannelsAvailableHi, reg_write(ohci, OHCI1394_InitialChannelsAvailableHi,
0xfffffffe); 0xfffffffe);
ohci->features |= FEATURE_CHANNEL_31_ALLOCATED; card->broadcast_channel_auto_allocated = true;
} }
/* Get implemented bits of the priority arbitration request counter. */ /* Get implemented bits of the priority arbitration request counter. */
reg_write(ohci, OHCI1394_FairnessControl, 0x3f); reg_write(ohci, OHCI1394_FairnessControl, 0x3f);
ohci->pri_req_max = reg_read(ohci, OHCI1394_FairnessControl) & 0x3f; ohci->pri_req_max = reg_read(ohci, OHCI1394_FairnessControl) & 0x3f;
reg_write(ohci, OHCI1394_FairnessControl, 0); reg_write(ohci, OHCI1394_FairnessControl, 0);
if (ohci->pri_req_max != 0) card->priority_budget_implemented = ohci->pri_req_max != 0;
ohci->features |= FEATURE_PRIORITY_BUDGET;
ar_context_run(&ohci->ar_request_ctx); ar_context_run(&ohci->ar_request_ctx);
ar_context_run(&ohci->ar_response_ctx); 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,13 +2130,6 @@ static void ohci_write_csr_reg(struct fw_card *card, int csr_offset, u32 value)
} }
} }
static unsigned int ohci_get_features(struct fw_card *card)
{
struct fw_ohci *ohci = fw_ohci(card);
return ohci->features;
}
static void copy_iso_headers(struct iso_context *ctx, void *p) static void copy_iso_headers(struct iso_context *ctx, void *p)
{ {
int i = ctx->header_length; int i = ctx->header_length;
...@@ -2578,7 +2569,6 @@ static const struct fw_card_driver ohci_driver = { ...@@ -2578,7 +2569,6 @@ static const struct fw_card_driver ohci_driver = {
.enable_phys_dma = ohci_enable_phys_dma, .enable_phys_dma = ohci_enable_phys_dma,
.read_csr_reg = ohci_read_csr_reg, .read_csr_reg = ohci_read_csr_reg,
.write_csr_reg = ohci_write_csr_reg, .write_csr_reg = ohci_write_csr_reg,
.get_features = ohci_get_features,
.allocate_iso_context = ohci_allocate_iso_context, .allocate_iso_context = ohci_allocate_iso_context,
.free_iso_context = ohci_free_iso_context, .free_iso_context = ohci_free_iso_context,
......
...@@ -122,6 +122,9 @@ struct fw_card { ...@@ -122,6 +122,9 @@ struct fw_card {
bool bm_abdicate; /* value of csr_abdicate before last bus reset */ bool bm_abdicate; /* value of csr_abdicate before last bus reset */
bool csr_abdicate; /* visible in CSR STATE_CLEAR/SET registers */ bool csr_abdicate; /* visible in CSR STATE_CLEAR/SET registers */
bool priority_budget_implemented; /* controller feature */
bool broadcast_channel_auto_allocated; /* controller feature */
bool broadcast_channel_allocated; bool broadcast_channel_allocated;
u32 broadcast_channel; u32 broadcast_channel;
__be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
......
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