diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2010-06-10 02:35:06 -0400 |
---|---|---|
committer | Clemens Ladisch <clemens@ladisch.de> | 2010-06-10 02:35:06 -0400 |
commit | a1a1132bd83d0aea51d4f19be4b4a58a064a0131 (patch) | |
tree | 93352d6aa9fd8eaa0521fbeb65853cd9f485666e /drivers/firewire/ohci.c | |
parent | 27a2329f8235d6ce637463f5d83e98d760ef006e (diff) |
firewire: add CSR PRIORITY_BUDGET support
If supported by the OHCI controller, implement the PRIORITY_BUDGET
register, which is required for nodes that can use asynchronous
priority arbitration.
To allow the core to determine what features the lowlevel device
supports, add a new card driver callback.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'drivers/firewire/ohci.c')
-rw-r--r-- | drivers/firewire/ohci.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 9c588fd01250..0e5413531785 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -170,6 +170,7 @@ struct fw_ohci { | |||
170 | int generation; | 170 | int generation; |
171 | int request_generation; /* for timestamping incoming requests */ | 171 | int request_generation; /* for timestamping incoming requests */ |
172 | unsigned quirks; | 172 | unsigned quirks; |
173 | unsigned int pri_req_max; | ||
173 | u32 bus_time; | 174 | u32 bus_time; |
174 | 175 | ||
175 | /* | 176 | /* |
@@ -1738,6 +1739,11 @@ static int ohci_enable(struct fw_card *card, | |||
1738 | reg_write(ohci, OHCI1394_IsochronousCycleTimer, seconds << 25); | 1739 | reg_write(ohci, OHCI1394_IsochronousCycleTimer, seconds << 25); |
1739 | ohci->bus_time = seconds & ~0x3f; | 1740 | ohci->bus_time = seconds & ~0x3f; |
1740 | 1741 | ||
1742 | /* Get implemented bits of the priority arbitration request counter. */ | ||
1743 | reg_write(ohci, OHCI1394_FairnessControl, 0x3f); | ||
1744 | ohci->pri_req_max = reg_read(ohci, OHCI1394_FairnessControl) & 0x3f; | ||
1745 | reg_write(ohci, OHCI1394_FairnessControl, 0); | ||
1746 | |||
1741 | ar_context_run(&ohci->ar_request_ctx); | 1747 | ar_context_run(&ohci->ar_request_ctx); |
1742 | ar_context_run(&ohci->ar_response_ctx); | 1748 | ar_context_run(&ohci->ar_response_ctx); |
1743 | 1749 | ||
@@ -2028,6 +2034,10 @@ static u32 ohci_read_csr_reg(struct fw_card *card, int csr_offset) | |||
2028 | value = reg_read(ohci, OHCI1394_ATRetries); | 2034 | value = reg_read(ohci, OHCI1394_ATRetries); |
2029 | return (value >> 4) & 0x0ffff00f; | 2035 | return (value >> 4) & 0x0ffff00f; |
2030 | 2036 | ||
2037 | case CSR_PRIORITY_BUDGET: | ||
2038 | return (reg_read(ohci, OHCI1394_FairnessControl) & 0x3f) | | ||
2039 | (ohci->pri_req_max << 8); | ||
2040 | |||
2031 | default: | 2041 | default: |
2032 | WARN_ON(1); | 2042 | WARN_ON(1); |
2033 | return 0; | 2043 | return 0; |
@@ -2065,12 +2075,28 @@ static void ohci_write_csr_reg(struct fw_card *card, int csr_offset, u32 value) | |||
2065 | flush_writes(ohci); | 2075 | flush_writes(ohci); |
2066 | break; | 2076 | break; |
2067 | 2077 | ||
2078 | case CSR_PRIORITY_BUDGET: | ||
2079 | reg_write(ohci, OHCI1394_FairnessControl, value & 0x3f); | ||
2080 | flush_writes(ohci); | ||
2081 | break; | ||
2082 | |||
2068 | default: | 2083 | default: |
2069 | WARN_ON(1); | 2084 | WARN_ON(1); |
2070 | break; | 2085 | break; |
2071 | } | 2086 | } |
2072 | } | 2087 | } |
2073 | 2088 | ||
2089 | static unsigned int ohci_get_features(struct fw_card *card) | ||
2090 | { | ||
2091 | struct fw_ohci *ohci = fw_ohci(card); | ||
2092 | unsigned int features = 0; | ||
2093 | |||
2094 | if (ohci->pri_req_max != 0) | ||
2095 | features |= FEATURE_PRIORITY_BUDGET; | ||
2096 | |||
2097 | return features; | ||
2098 | } | ||
2099 | |||
2074 | static void copy_iso_headers(struct iso_context *ctx, void *p) | 2100 | static void copy_iso_headers(struct iso_context *ctx, void *p) |
2075 | { | 2101 | { |
2076 | int i = ctx->header_length; | 2102 | int i = ctx->header_length; |
@@ -2510,6 +2536,7 @@ static const struct fw_card_driver ohci_driver = { | |||
2510 | .enable_phys_dma = ohci_enable_phys_dma, | 2536 | .enable_phys_dma = ohci_enable_phys_dma, |
2511 | .read_csr_reg = ohci_read_csr_reg, | 2537 | .read_csr_reg = ohci_read_csr_reg, |
2512 | .write_csr_reg = ohci_write_csr_reg, | 2538 | .write_csr_reg = ohci_write_csr_reg, |
2539 | .get_features = ohci_get_features, | ||
2513 | 2540 | ||
2514 | .allocate_iso_context = ohci_allocate_iso_context, | 2541 | .allocate_iso_context = ohci_allocate_iso_context, |
2515 | .free_iso_context = ohci_free_iso_context, | 2542 | .free_iso_context = ohci_free_iso_context, |