diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-03-07 12:12:56 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-09 16:03:15 -0500 |
commit | d60d7f1d5ce83d1be8d79256f711d6a645b7a2fa (patch) | |
tree | dd3f02960657d4270efb0990b5cdfe0eeef62ad5 /drivers/firewire/fw-transaction.c | |
parent | 473d28c730e2de888c24b226cfe4183868eacde2 (diff) |
firewire: Implement CSR cycle time and bus time registers.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-transaction.c')
-rw-r--r-- | drivers/firewire/fw-transaction.c | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c index 38b286ed744f..d36dd512a59d 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c | |||
@@ -752,10 +752,65 @@ handle_topology_map(struct fw_card *card, struct fw_request *request, | |||
752 | } | 752 | } |
753 | 753 | ||
754 | static struct fw_address_handler topology_map = { | 754 | static struct fw_address_handler topology_map = { |
755 | .length = 0x400, | 755 | .length = 0x200, |
756 | .address_callback = handle_topology_map, | 756 | .address_callback = handle_topology_map, |
757 | }; | 757 | }; |
758 | 758 | ||
759 | const struct fw_address_region registers_region = | ||
760 | { .start = 0xfffff0000000ull, .end = 0xfffff0000400ull, }; | ||
761 | |||
762 | static void | ||
763 | handle_registers(struct fw_card *card, struct fw_request *request, | ||
764 | int tcode, int destination, int source, | ||
765 | int generation, int speed, | ||
766 | unsigned long long offset, | ||
767 | void *payload, size_t length, void *callback_data) | ||
768 | { | ||
769 | int reg = offset - CSR_REGISTER_BASE; | ||
770 | unsigned long long bus_time; | ||
771 | __be32 *data = payload; | ||
772 | |||
773 | switch (reg) { | ||
774 | case CSR_CYCLE_TIME: | ||
775 | case CSR_BUS_TIME: | ||
776 | if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) { | ||
777 | fw_send_response(card, request, RCODE_TYPE_ERROR); | ||
778 | break; | ||
779 | } | ||
780 | |||
781 | bus_time = card->driver->get_bus_time(card); | ||
782 | if (reg == CSR_CYCLE_TIME) | ||
783 | *data = cpu_to_be32(bus_time); | ||
784 | else | ||
785 | *data = cpu_to_be32(bus_time >> 25); | ||
786 | fw_send_response(card, request, RCODE_COMPLETE); | ||
787 | break; | ||
788 | |||
789 | case CSR_BUS_MANAGER_ID: | ||
790 | case CSR_BANDWIDTH_AVAILABLE: | ||
791 | case CSR_CHANNELS_AVAILABLE_HI: | ||
792 | case CSR_CHANNELS_AVAILABLE_LO: | ||
793 | /* FIXME: these are handled by the OHCI hardware and | ||
794 | * the stack never sees these request. If we add | ||
795 | * support for a new type of controller that doesn't | ||
796 | * handle this in hardware we need to deal with these | ||
797 | * transactions. */ | ||
798 | BUG(); | ||
799 | break; | ||
800 | |||
801 | case CSR_BUSY_TIMEOUT: | ||
802 | /* FIXME: Implement this. */ | ||
803 | default: | ||
804 | fw_send_response(card, request, RCODE_ADDRESS_ERROR); | ||
805 | break; | ||
806 | } | ||
807 | } | ||
808 | |||
809 | static struct fw_address_handler registers = { | ||
810 | .length = 0x400, | ||
811 | .address_callback = handle_registers, | ||
812 | }; | ||
813 | |||
759 | MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); | 814 | MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); |
760 | MODULE_DESCRIPTION("Core IEEE1394 transaction logic"); | 815 | MODULE_DESCRIPTION("Core IEEE1394 transaction logic"); |
761 | MODULE_LICENSE("GPL"); | 816 | MODULE_LICENSE("GPL"); |
@@ -811,6 +866,10 @@ static int __init fw_core_init(void) | |||
811 | &topology_map_region); | 866 | &topology_map_region); |
812 | BUG_ON(retval < 0); | 867 | BUG_ON(retval < 0); |
813 | 868 | ||
869 | retval = fw_core_add_address_handler(®isters, | ||
870 | ®isters_region); | ||
871 | BUG_ON(retval < 0); | ||
872 | |||
814 | /* Add the vendor textual descriptor. */ | 873 | /* Add the vendor textual descriptor. */ |
815 | retval = fw_core_add_descriptor(&vendor_id_descriptor); | 874 | retval = fw_core_add_descriptor(&vendor_id_descriptor); |
816 | BUG_ON(retval < 0); | 875 | BUG_ON(retval < 0); |