aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2010-06-10 02:25:19 -0400
committerClemens Ladisch <clemens@ladisch.de>2010-06-10 02:25:19 -0400
commit506f1a31932747f56a5029d5b3c14b1b68f41ccc (patch)
tree04dfb94980fc95cfc2c458fc62e6b77996c8145b /drivers/firewire
parent60d32970c5a32e8c4f340a9e41993759ad658ef2 (diff)
firewire: add CSR NODE_IDS support
The NODE_IDS register, and especially its bus_id field, is quite useless because 1394.1 requires that the bus_id field always stays 0x3ff. However, the 1394 specification requires this register on all transaction capable nodes, and the Base 1394 Test Suite tests for it, so we better implement it. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-transaction.c11
-rw-r--r--drivers/firewire/core.h1
-rw-r--r--drivers/firewire/ohci.c20
3 files changed, 32 insertions, 0 deletions
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index a4d8109edec2..16ffa27d23b7 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -1023,6 +1023,17 @@ static void handle_registers(struct fw_card *card, struct fw_request *request,
1023 } 1023 }
1024 break; 1024 break;
1025 1025
1026 case CSR_NODE_IDS:
1027 if (tcode == TCODE_READ_QUADLET_REQUEST)
1028 *data = cpu_to_be32(card->driver->
1029 read_csr_reg(card, CSR_NODE_IDS));
1030 else if (tcode == TCODE_WRITE_QUADLET_REQUEST)
1031 card->driver->write_csr_reg(card, CSR_NODE_IDS,
1032 be32_to_cpu(*data));
1033 else
1034 rcode = RCODE_TYPE_ERROR;
1035 break;
1036
1026 case CSR_CYCLE_TIME: 1037 case CSR_CYCLE_TIME:
1027 if (TCODE_IS_READ_REQUEST(tcode) && length == 4) 1038 if (TCODE_IS_READ_REQUEST(tcode) && length == 4)
1028 *data = cpu_to_be32(card->driver-> 1039 *data = cpu_to_be32(card->driver->
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h
index c19e9873e433..efcdeb2e31e6 100644
--- a/drivers/firewire/core.h
+++ b/drivers/firewire/core.h
@@ -76,6 +76,7 @@ struct fw_card_driver {
76 int node_id, int generation); 76 int node_id, int generation);
77 77
78 u32 (*read_csr_reg)(struct fw_card *card, int csr_offset); 78 u32 (*read_csr_reg)(struct fw_card *card, int csr_offset);
79 void (*write_csr_reg)(struct fw_card *card, int csr_offset, u32 value);
79 80
80 struct fw_iso_context * 81 struct fw_iso_context *
81 (*allocate_iso_context)(struct fw_card *card, 82 (*allocate_iso_context)(struct fw_card *card,
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index a8093a9a3fc8..a55fbbce9e79 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -1974,6 +1974,9 @@ static u32 ohci_read_csr_reg(struct fw_card *card, int csr_offset)
1974 struct fw_ohci *ohci = fw_ohci(card); 1974 struct fw_ohci *ohci = fw_ohci(card);
1975 1975
1976 switch (csr_offset) { 1976 switch (csr_offset) {
1977 case CSR_NODE_IDS:
1978 return reg_read(ohci, OHCI1394_NodeID) << 16;
1979
1977 case CSR_CYCLE_TIME: 1980 case CSR_CYCLE_TIME:
1978 return get_cycle_time(ohci); 1981 return get_cycle_time(ohci);
1979 1982
@@ -1983,6 +1986,22 @@ static u32 ohci_read_csr_reg(struct fw_card *card, int csr_offset)
1983 } 1986 }
1984} 1987}
1985 1988
1989static void ohci_write_csr_reg(struct fw_card *card, int csr_offset, u32 value)
1990{
1991 struct fw_ohci *ohci = fw_ohci(card);
1992
1993 switch (csr_offset) {
1994 case CSR_NODE_IDS:
1995 reg_write(ohci, OHCI1394_NodeID, value >> 16);
1996 flush_writes(ohci);
1997 break;
1998
1999 default:
2000 WARN_ON(1);
2001 break;
2002 }
2003}
2004
1986static void copy_iso_headers(struct iso_context *ctx, void *p) 2005static void copy_iso_headers(struct iso_context *ctx, void *p)
1987{ 2006{
1988 int i = ctx->header_length; 2007 int i = ctx->header_length;
@@ -2421,6 +2440,7 @@ static const struct fw_card_driver ohci_driver = {
2421 .cancel_packet = ohci_cancel_packet, 2440 .cancel_packet = ohci_cancel_packet,
2422 .enable_phys_dma = ohci_enable_phys_dma, 2441 .enable_phys_dma = ohci_enable_phys_dma,
2423 .read_csr_reg = ohci_read_csr_reg, 2442 .read_csr_reg = ohci_read_csr_reg,
2443 .write_csr_reg = ohci_write_csr_reg,
2424 2444
2425 .allocate_iso_context = ohci_allocate_iso_context, 2445 .allocate_iso_context = ohci_allocate_iso_context,
2426 .free_iso_context = ohci_free_iso_context, 2446 .free_iso_context = ohci_free_iso_context,