Rev 5194 | Rev 5363 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5194 | Rev 5247 | ||
---|---|---|---|
Line 185... | Line 185... | ||
185 | rb 0x100 - ($ and 0xff) ; align 256 |
185 | rb 0x100 - ($ and 0xff) ; align 256 |
186 | lstats lstats |
186 | lstats lstats |
Line 187... | Line 187... | ||
187 | 187 | ||
Line 188... | Line -... | ||
188 | ends |
- | |
189 | - | ||
190 | macro delay { |
- | |
191 | push eax |
- | |
192 | in ax, dx |
- | |
193 | in ax, dx |
- | |
194 | in ax, dx |
- | |
195 | in ax, dx |
- | |
196 | in ax, dx |
- | |
197 | in ax, dx |
- | |
198 | in ax, dx |
- | |
199 | in ax, dx |
- | |
200 | in ax, dx |
- | |
201 | in ax, dx |
- | |
202 | pop eax |
- | |
203 | } |
188 | ends |
204 | 189 | ||
205 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
190 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
206 | ;; ;; |
191 | ;; ;; |
207 | ;; proc START ;; |
192 | ;; proc START ;; |
Line 894... | Line 879... | ||
894 | movzx ecx, [ebx + device.ee_bus_width] |
879 | movzx ecx, [ebx + device.ee_bus_width] |
895 | add ecx, 3 |
880 | add ecx, 3 |
Line 896... | Line 881... | ||
896 | 881 | ||
897 | mov al, EE_CS |
882 | mov al, EE_CS |
898 | out dx, al |
883 | out dx, al |
Line 899... | Line 884... | ||
899 | delay |
884 | call udelay |
900 | 885 | ||
Line 901... | Line 886... | ||
901 | ;----------------------- |
886 | ;----------------------- |
Line 906... | Line 891... | ||
906 | shl esi, 1 |
891 | shl esi, 1 |
907 | jnc @f |
892 | jnc @f |
908 | or al, EE_DI |
893 | or al, EE_DI |
909 | @@: |
894 | @@: |
910 | out dx, al |
895 | out dx, al |
911 | delay |
896 | call udelay |
Line 912... | Line 897... | ||
912 | 897 | ||
913 | and al, not EE_SK |
898 | and al, not EE_SK |
914 | out dx, al |
899 | out dx, al |
Line 915... | Line 900... | ||
915 | delay |
900 | call udelay |
Line 916... | Line 901... | ||
916 | 901 | ||
917 | loop .loop |
902 | loop .loop |
Line 924... | Line 909... | ||
924 | 909 | ||
925 | .loop2: |
910 | .loop2: |
926 | shl esi, 1 |
911 | shl esi, 1 |
927 | mov al, EE_CS + EE_SK |
912 | mov al, EE_CS + EE_SK |
928 | out dx, al |
913 | out dx, al |
Line 929... | Line 914... | ||
929 | delay |
914 | call udelay |
930 | 915 | ||
931 | in al, dx |
916 | in al, dx |
932 | test al, EE_DO |
917 | test al, EE_DO |
933 | jz @f |
918 | jz @f |
Line 934... | Line 919... | ||
934 | inc esi |
919 | inc esi |
935 | @@: |
920 | @@: |
936 | 921 | ||
Line 937... | Line 922... | ||
937 | mov al, EE_CS |
922 | mov al, EE_CS |
Line 938... | Line 923... | ||
938 | out dx, al |
923 | out dx, al |
939 | delay |
924 | call udelay |
Line 983... | Line 968... | ||
983 | shl esi, 1 |
968 | shl esi, 1 |
984 | jnc @f |
969 | jnc @f |
985 | or al, EE_DI |
970 | or al, EE_DI |
986 | @@: |
971 | @@: |
987 | out dx, al |
972 | out dx, al |
988 | delay |
973 | call udelay |
Line 989... | Line 974... | ||
989 | 974 | ||
990 | and al, not EE_SK |
975 | and al, not EE_SK |
991 | out dx, al |
976 | out dx, al |
Line 992... | Line 977... | ||
992 | delay |
977 | call udelay |
Line 993... | Line 978... | ||
993 | 978 | ||
994 | loop .loop |
979 | loop .loop |
Line 1003... | Line 988... | ||
1003 | shl di, 1 |
988 | shl di, 1 |
1004 | jnc @f |
989 | jnc @f |
1005 | or al, EE_DI |
990 | or al, EE_DI |
1006 | @@: |
991 | @@: |
1007 | out dx, al |
992 | out dx, al |
1008 | delay |
993 | call udelay |
Line 1009... | Line 994... | ||
1009 | 994 | ||
1010 | and al, not EE_SK |
995 | and al, not EE_SK |
1011 | out dx, al |
996 | out dx, al |
Line 1012... | Line 997... | ||
1012 | delay |
997 | call udelay |
Line 1013... | Line 998... | ||
1013 | 998 | ||
1014 | loop .loop2 |
999 | loop .loop2 |
Line 1030... | Line 1015... | ||
1030 | set_io [ebx + device.io_addr], 0 |
1015 | set_io [ebx + device.io_addr], 0 |
1031 | set_io [ebx + device.io_addr], reg_eeprom |
1016 | set_io [ebx + device.io_addr], reg_eeprom |
Line 1032... | Line 1017... | ||
1032 | 1017 | ||
1033 | mov al, EE_CS ; activate eeprom |
1018 | mov al, EE_CS ; activate eeprom |
1034 | out dx, al |
1019 | out dx, al |
Line 1035... | Line 1020... | ||
1035 | delay |
1020 | call udelay |
1036 | 1021 | ||
1037 | mov si, EE_READ shl 13 |
1022 | mov si, EE_READ shl 13 |
1038 | xor ecx, ecx |
1023 | xor ecx, ecx |
1039 | .loop: |
1024 | .loop: |
1040 | mov al, EE_CS + EE_SK |
1025 | mov al, EE_CS + EE_SK |
1041 | shl si, 1 |
1026 | shl si, 1 |
1042 | jnc @f |
1027 | jnc @f |
1043 | or al, EE_DI |
1028 | or al, EE_DI |
1044 | @@: |
1029 | @@: |
Line 1045... | Line 1030... | ||
1045 | out dx, al |
1030 | out dx, al |
1046 | delay |
1031 | call udelay |
1047 | 1032 | ||
Line 1048... | Line 1033... | ||
1048 | and al, not EE_SK |
1033 | and al, not EE_SK |
Line 1049... | Line 1034... | ||
1049 | out dx, al |
1034 | out dx, al |
1050 | delay |
1035 | call udelay |
Line 1074... | Line 1059... | ||
1074 | out dx, al ; de-activate eeprom |
1059 | out dx, al ; de-activate eeprom |
Line 1075... | Line 1060... | ||
1075 | 1060 | ||
Line -... | Line 1061... | ||
- | 1061 | ret |
|
- | 1062 | ||
- | 1063 | ||
- | 1064 | ; Wait a minimum of 2µs |
|
- | 1065 | udelay: |
|
- | 1066 | pusha |
|
- | 1067 | mov esi, 1 |
|
- | 1068 | invoke Sleep |
|
- | 1069 | popa |
|
- | 1070 | ||
Line 1076... | Line 1071... | ||
1076 | ret |
1071 | ret |
1077 | 1072 | ||
Line 1078... | Line 1073... | ||
1078 | 1073 | ||
Line 1097... | Line 1092... | ||
1097 | set_io [ebx + device.io_addr], 0 |
1092 | set_io [ebx + device.io_addr], 0 |
1098 | set_io [ebx + device.io_addr], reg_mdi_ctrl |
1093 | set_io [ebx + device.io_addr], reg_mdi_ctrl |
1099 | out dx, eax |
1094 | out dx, eax |
Line 1100... | Line 1095... | ||
1100 | 1095 | ||
1101 | .wait: |
1096 | .wait: |
1102 | delay |
1097 | call udelay |
1103 | in eax, dx |
1098 | in eax, dx |
1104 | test eax, 1 shl 28 ; ready bit |
1099 | test eax, 1 shl 28 ; ready bit |
Line 1105... | Line 1100... | ||
1105 | jz .wait |
1100 | jz .wait |
Line 1129... | Line 1124... | ||
1129 | set_io [ebx + device.io_addr], 0 |
1124 | set_io [ebx + device.io_addr], 0 |
1130 | set_io [ebx + device.io_addr], reg_mdi_ctrl |
1125 | set_io [ebx + device.io_addr], reg_mdi_ctrl |
1131 | out dx, eax |
1126 | out dx, eax |
Line 1132... | Line 1127... | ||
1132 | 1127 | ||
1133 | .wait: |
1128 | .wait: |
1134 | delay |
1129 | call udelay |
1135 | in eax, dx |
1130 | in eax, dx |
1136 | test eax, 1 shl 28 ; ready bit |
1131 | test eax, 1 shl 28 ; ready bit |
Line 1137... | Line 1132... | ||
1137 | jz .wait |
1132 | jz .wait |