diff options
author | Divy Le Ray <divy@chelsio.com> | 2007-05-31 00:10:58 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-08 22:16:39 -0400 |
commit | 480fe1a31c662ef4ff0598a7cacefa21f98335f1 (patch) | |
tree | 66da8f259d7093d7f9290054f4fbda1f68ff9e0a /drivers/net/cxgb3/t3_hw.c | |
parent | 8a9fab22cf6a3abde7731f4425d4ff87509bc15a (diff) |
cxgb3 - TP SRAM update
The chip executes microcode present in internal RAM,
whose content is loaded from EEPROM on power cycle.
This patch allows an update of the microcode through PIO
without forcing a power cycle.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cxgb3/t3_hw.c')
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 9e3591d7706f..dd3149d94ba8 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -847,6 +847,64 @@ static int t3_write_flash(struct adapter *adapter, unsigned int addr, | |||
847 | return 0; | 847 | return 0; |
848 | } | 848 | } |
849 | 849 | ||
850 | /** | ||
851 | * t3_check_tpsram_version - read the tp sram version | ||
852 | * @adapter: the adapter | ||
853 | * | ||
854 | * Reads the protocol sram version from serial eeprom. | ||
855 | */ | ||
856 | int t3_check_tpsram_version(struct adapter *adapter) | ||
857 | { | ||
858 | int ret; | ||
859 | u32 vers; | ||
860 | unsigned int major, minor; | ||
861 | |||
862 | /* Get version loaded in SRAM */ | ||
863 | t3_write_reg(adapter, A_TP_EMBED_OP_FIELD0, 0); | ||
864 | ret = t3_wait_op_done(adapter, A_TP_EMBED_OP_FIELD0, | ||
865 | 1, 1, 5, 1); | ||
866 | if (ret) | ||
867 | return ret; | ||
868 | |||
869 | vers = t3_read_reg(adapter, A_TP_EMBED_OP_FIELD1); | ||
870 | |||
871 | major = G_TP_VERSION_MAJOR(vers); | ||
872 | minor = G_TP_VERSION_MINOR(vers); | ||
873 | |||
874 | if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR) | ||
875 | return 0; | ||
876 | |||
877 | return -EINVAL; | ||
878 | } | ||
879 | |||
880 | /** | ||
881 | * t3_check_tpsram - check if provided protocol SRAM | ||
882 | * is compatible with this driver | ||
883 | * @adapter: the adapter | ||
884 | * @tp_sram: the firmware image to write | ||
885 | * @size: image size | ||
886 | * | ||
887 | * Checks if an adapter's tp sram is compatible with the driver. | ||
888 | * Returns 0 if the versions are compatible, a negative error otherwise. | ||
889 | */ | ||
890 | int t3_check_tpsram(struct adapter *adapter, u8 *tp_sram, unsigned int size) | ||
891 | { | ||
892 | u32 csum; | ||
893 | unsigned int i; | ||
894 | const u32 *p = (const u32 *)tp_sram; | ||
895 | |||
896 | /* Verify checksum */ | ||
897 | for (csum = 0, i = 0; i < size / sizeof(csum); i++) | ||
898 | csum += ntohl(p[i]); | ||
899 | if (csum != 0xffffffff) { | ||
900 | CH_ERR(adapter, "corrupted protocol SRAM image, checksum %u\n", | ||
901 | csum); | ||
902 | return -EINVAL; | ||
903 | } | ||
904 | |||
905 | return 0; | ||
906 | } | ||
907 | |||
850 | enum fw_version_type { | 908 | enum fw_version_type { |
851 | FW_VERSION_N3, | 909 | FW_VERSION_N3, |
852 | FW_VERSION_T3 | 910 | FW_VERSION_T3 |
@@ -2686,6 +2744,34 @@ static void ulp_config(struct adapter *adap, const struct tp_params *p) | |||
2686 | t3_write_reg(adap, A_ULPRX_TDDP_TAGMASK, 0xffffffff); | 2744 | t3_write_reg(adap, A_ULPRX_TDDP_TAGMASK, 0xffffffff); |
2687 | } | 2745 | } |
2688 | 2746 | ||
2747 | /** | ||
2748 | * t3_set_proto_sram - set the contents of the protocol sram | ||
2749 | * @adapter: the adapter | ||
2750 | * @data: the protocol image | ||
2751 | * | ||
2752 | * Write the contents of the protocol SRAM. | ||
2753 | */ | ||
2754 | int t3_set_proto_sram(struct adapter *adap, u8 *data) | ||
2755 | { | ||
2756 | int i; | ||
2757 | u32 *buf = (u32 *)data; | ||
2758 | |||
2759 | for (i = 0; i < PROTO_SRAM_LINES; i++) { | ||
2760 | t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, cpu_to_be32(*buf++)); | ||
2761 | t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, cpu_to_be32(*buf++)); | ||
2762 | t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, cpu_to_be32(*buf++)); | ||
2763 | t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, cpu_to_be32(*buf++)); | ||
2764 | t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, cpu_to_be32(*buf++)); | ||
2765 | |||
2766 | t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31); | ||
2767 | if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1)) | ||
2768 | return -EIO; | ||
2769 | } | ||
2770 | t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, 0); | ||
2771 | |||
2772 | return 0; | ||
2773 | } | ||
2774 | |||
2689 | void t3_config_trace_filter(struct adapter *adapter, | 2775 | void t3_config_trace_filter(struct adapter *adapter, |
2690 | const struct trace_params *tp, int filter_index, | 2776 | const struct trace_params *tp, int filter_index, |
2691 | int invert, int enable) | 2777 | int invert, int enable) |