xref: /reactos/drivers/network/dd/dc21x4/media.c (revision 32d615fc)
1 /*
2  * PROJECT:     ReactOS DC21x4 Driver
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Media common code
5  * COPYRIGHT:   Copyright 2023 Dmitry Borisov <di.sean@protonmail.com>
6  */
7 
8 /* INCLUDES *******************************************************************/
9 
10 #include "dc21x4.h"
11 
12 #include <debug.h>
13 
14 /* FUNCTIONS ******************************************************************/
15 
16 VOID
17 MediaIndicateConnect(
18     _In_ PDC21X4_ADAPTER Adapter,
19     _In_ BOOLEAN LinkUp)
20 {
21     /* Nothing to do */
22     if (Adapter->LinkUp == LinkUp)
23         return;
24 
25     Adapter->LinkUp = LinkUp;
26 
27     INFO_VERB("Link %sconnected, media is %s\n",
28               LinkUp ? "" : "dis",
29               MediaNumber2Str(Adapter, Adapter->MediaNumber));
30 
31     NdisDprReleaseSpinLock(&Adapter->ModeLock);
32 
33     NdisMIndicateStatus(Adapter->AdapterHandle,
34                         LinkUp ? NDIS_STATUS_MEDIA_CONNECT : NDIS_STATUS_MEDIA_DISCONNECT,
35                         NULL,
36                         0);
37     NdisMIndicateStatusComplete(Adapter->AdapterHandle);
38 
39     NdisDprAcquireSpinLock(&Adapter->ModeLock);
40 }
41 
42 static
43 ULONG
44 MediaMiiNextMedia(
45     _In_ PDC21X4_ADAPTER Adapter)
46 {
47     Adapter->ModeFlags &= ~(DC_MODE_TEST_PACKET | DC_MODE_AUI_FAILED | DC_MODE_BNC_FAILED);
48     Adapter->LastReceiveActivity = (ULONG)Adapter->Statistics.ReceiveOk;
49 
50     /*
51      * In MII mode, we don't know exactly which port is active.
52      * Switch to the media with a higher priority.
53      */
54     if (Adapter->MediaBitmap & (1 << MEDIA_HMR))
55         return MEDIA_HMR;
56     else if (Adapter->MediaBitmap & (1 << MEDIA_AUI))
57         return MEDIA_AUI;
58     else
59         return MEDIA_BNC;
60 }
61 
62 static
63 VOID
64 MediaMiiSetSpeedAndDuplex(
65     _In_ PDC21X4_ADAPTER Adapter,
66     _In_ BOOLEAN FullDuplex,
67     _In_ BOOLEAN Speed100)
68 {
69     ULONG OpMode = Adapter->OpMode;
70 
71     if (FullDuplex)
72         OpMode |= DC_OPMODE_FULL_DUPLEX;
73     else
74         OpMode &= ~DC_OPMODE_FULL_DUPLEX;
75 
76     if (Speed100)
77         OpMode &= ~DC_OPMODE_PORT_XMIT_10;
78     else
79         OpMode |= DC_OPMODE_PORT_XMIT_10;
80 
81     /* Nothing to do */
82     if (OpMode == Adapter->OpMode)
83         return;
84 
85     INFO_VERB("Configuring MAC from %u %s-duplex to %u %s-duplex\n",
86               Adapter->LinkSpeedMbps,
87               (Adapter->OpMode & DC_OPMODE_FULL_DUPLEX) ? "full" : "half",
88               Speed100 ? 100 : 10,
89               FullDuplex ? "full" : "half");
90 
91     Adapter->LinkSpeedMbps = Speed100 ? 100 : 10;
92 
93     DcStopTxRxProcess(Adapter);
94 
95     Adapter->OpMode = OpMode;
96     DC_WRITE(Adapter, DcCsr6_OpMode, Adapter->OpMode);
97 }
98 
99 static
100 VOID
101 MediaMiiGetSpeedAndDuplex(
102     _In_ PDC21X4_ADAPTER Adapter,
103     _Out_ PBOOLEAN FullDuplex,
104     _Out_ PBOOLEAN Speed100)
105 {
106     ULONG MiiLinkPartnerAbility, AdvLpa;
107 
108     MiiRead(Adapter, Adapter->PhyAddress, MII_AUTONEG_LINK_PARTNER, &MiiLinkPartnerAbility);
109 
110     TRACE("MII LPA %04lx\n", MiiLinkPartnerAbility);
111 
112     AdvLpa = Adapter->MiiMedia.Advertising & MiiLinkPartnerAbility;
113     if (AdvLpa & MII_LP_100T_FD)
114     {
115         *FullDuplex = TRUE;
116         *Speed100 = TRUE;
117     }
118     else if (AdvLpa & MII_LP_100T4)
119     {
120         *FullDuplex = FALSE;
121         *Speed100 = TRUE;
122     }
123     else if (AdvLpa & MII_LP_100T_HD)
124     {
125         *FullDuplex = FALSE;
126         *Speed100 = TRUE;
127     }
128     else if (AdvLpa & MII_LP_10T_FD)
129     {
130         *FullDuplex = TRUE;
131         *Speed100 = FALSE;
132     }
133     else
134     {
135         *FullDuplex = FALSE;
136         *Speed100 = FALSE;
137     }
138 }
139 
140 BOOLEAN
141 MediaMiiCheckLink(
142     _In_ PDC21X4_ADAPTER Adapter)
143 {
144     ULONG MiiStatus;
145     BOOLEAN FullDuplex, Speed100;
146 
147     /* The link status is a latched-low bit, read it twice */
148     if (!MiiRead(Adapter, Adapter->PhyAddress, MII_STATUS, &MiiStatus))
149     {
150         goto NoLink;
151     }
152     if (!(MiiStatus & MII_SR_LINK_STATUS))
153     {
154         MiiRead(Adapter, Adapter->PhyAddress, MII_STATUS, &MiiStatus);
155     }
156     TRACE("MII Status %04lx\n", MiiStatus);
157 
158     /* Check the link status */
159     if (!(MiiStatus & MII_SR_LINK_STATUS))
160     {
161 NoLink:
162         /* No link detected, check the other port */
163         if (Adapter->MediaBitmap & ((1 << MEDIA_HMR) | (1 << MEDIA_AUI) | (1 << MEDIA_BNC)))
164         {
165             if ((Adapter->Features & DC_MII_AUTOSENSE) && !MEDIA_IS_FIXED(Adapter))
166             {
167                 Adapter->MediaNumber = MediaMiiNextMedia(Adapter);
168                 MediaSiaSelect(Adapter);
169             }
170         }
171 
172         return FALSE;
173     }
174 
175     /* If we are forcing speed and duplex */
176     if (MEDIA_IS_FIXED(Adapter))
177     {
178         FullDuplex = !!(Adapter->MiiControl & MII_CR_FULL_DUPLEX);
179         Speed100 = !!(Adapter->MiiControl & MII_CR_SPEED_SELECTION);
180     }
181     else
182     {
183         /* Check auto-negotiation is complete */
184         if (!(MiiStatus & MII_SR_AUTONEG_COMPLETE))
185             return FALSE;
186 
187         MediaMiiGetSpeedAndDuplex(Adapter, &FullDuplex, &Speed100);
188     }
189 
190     /* Set the link speed and duplex */
191     MediaMiiSetSpeedAndDuplex(Adapter, FullDuplex, Speed100);
192 
193     return TRUE;
194 }
195 
196 VOID
197 MediaMiiSelect(
198     _In_ PDC21X4_ADAPTER Adapter)
199 {
200     ULONG MiiControl, MiiAdvertise;
201 
202     MiiRead(Adapter, Adapter->PhyAddress, MII_CONTROL, &MiiControl);
203     MiiControl &= ~(MII_CR_POWER_DOWN | MII_CR_ISOLATE | MII_CR_RESET | MII_CR_SPEED_SELECTION |
204                     MII_CR_FULL_DUPLEX | MII_CR_AUTONEG | MII_CR_AUTONEG_RESTART);
205     MiiWrite(Adapter, Adapter->PhyAddress, MII_CONTROL, MiiControl);
206 
207     MiiControl |= Adapter->MiiControl;
208     MiiAdvertise = Adapter->MiiAdvertising;
209 
210     MiiWrite(Adapter, Adapter->PhyAddress, MII_AUTONEG_ADVERTISE, MiiAdvertise | MII_ADV_CSMA);
211     MiiWrite(Adapter, Adapter->PhyAddress, MII_CONTROL, MiiControl);
212 }
213 
214 VOID
215 MediaSelectMiiPort(
216     _In_ PDC21X4_ADAPTER Adapter,
217     _In_ BOOLEAN ResetPhy)
218 {
219     ULONG OpMode, i;
220 
221     if (Adapter->ChipType != DC21140)
222     {
223         DcWriteSia(Adapter, 0, 0, 0);
224     }
225 
226     OpMode = Adapter->OpMode;
227     OpMode &= ~DC_OPMODE_MEDIA_MASK;
228     OpMode |= DC_OPMODE_PORT_SELECT | DC_OPMODE_PORT_HEARTBEAT_DISABLE;
229     Adapter->OpMode = OpMode;
230 
231     DC_WRITE(Adapter, DcCsr6_OpMode, OpMode);
232 
233     NdisStallExecution(10);
234 
235     if (ResetPhy)
236     {
237         ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
238 
239         /* Execute the GPIO reset sequence */
240         if (Adapter->MiiMedia.ResetStreamLength)
241         {
242             /* Set the GPIO direction */
243             DcWriteGpio(Adapter, Adapter->MiiMedia.SetupStream[0]);
244 
245             for (i = 0; i < Adapter->MiiMedia.ResetStreamLength; ++i)
246             {
247                 NdisMSleep(100);
248                 DcWriteGpio(Adapter, Adapter->MiiMedia.ResetStream[i]);
249             }
250 
251             /* Give the PHY some time to reset */
252             NdisMSleep(5000);
253         }
254     }
255 
256     /* Set the GPIO direction */
257     DcWriteGpio(Adapter, Adapter->MiiMedia.SetupStream[0]);
258 
259     /* Execute the GPIO setup sequence */
260     for (i = 1; i < Adapter->MiiMedia.SetupStreamLength; ++i)
261     {
262         NdisStallExecution(10);
263         DcWriteGpio(Adapter, Adapter->MiiMedia.SetupStream[i]);
264     }
265 }
266 
267 VOID
268 MediaSiaSelect(
269     _In_ PDC21X4_ADAPTER Adapter)
270 {
271     ULONG OpMode;
272     PDC_MEDIA Media;
273 
274     INFO_VERB("Selected media %s\n",
275               MediaNumber2Str(Adapter, Adapter->MediaNumber));
276 
277     Media = &Adapter->Media[Adapter->MediaNumber];
278 
279     DcStopTxRxProcess(Adapter);
280 
281     if (Adapter->ChipType != DC21041)
282     {
283         /* Make sure the reset pulse is wide enough */
284         NdisStallExecution(100);
285         DcWriteGpio(Adapter, Media->GpioCtrl);
286         NdisStallExecution(100);
287         DcWriteGpio(Adapter, Media->GpioData);
288     }
289 
290     DcWriteSia(Adapter, Media->Csr13, Media->Csr14, Media->Csr15);
291 
292     NdisStallExecution(10);
293 
294     OpMode = Adapter->OpMode;
295     OpMode &= ~DC_OPMODE_MEDIA_MASK;
296     OpMode |= Media->OpMode;
297     Adapter->OpMode = OpMode;
298 
299     DC_WRITE(Adapter, DcCsr6_OpMode, OpMode);
300 }
301 
302 VOID
303 MediaGprSelect(
304     _In_ PDC21X4_ADAPTER Adapter)
305 {
306     ULONG OpMode;
307     PDC_MEDIA Media;
308 
309     INFO("Selected media %s\n", MediaNumber2Str(Adapter, Adapter->MediaNumber));
310 
311     Media = &Adapter->Media[Adapter->MediaNumber];
312 
313     DC_WRITE(Adapter, DcCsr12_Gpio, Media->GpioData);
314 
315     OpMode = Adapter->OpMode;
316     OpMode &= ~DC_OPMODE_MEDIA_MASK;
317     OpMode |= Media->OpMode;
318     Adapter->OpMode = OpMode;
319 
320     DC_WRITE(Adapter, DcCsr6_OpMode, OpMode);
321 }
322 
323 CODE_SEG("PAGE")
324 VOID
325 MediaInitDefaultMedia(
326     _In_ PDC21X4_ADAPTER Adapter,
327     _In_ ULONG MediaNumber)
328 {
329     ULONG Csr14, i;
330     BOOLEAN UseMii;
331 
332     PAGED_CODE();
333 
334     /* Media auto-detection */
335     if (MediaNumber == MEDIA_AUTO)
336     {
337         Adapter->Flags |= DC_AUTOSENSE;
338 
339         /* Initial value for all boards */
340         Adapter->DefaultMedia = MEDIA_10T;
341 
342         Adapter->MiiAdvertising = Adapter->MiiMedia.Advertising;
343         Adapter->MiiControl = MII_CR_AUTONEG | MII_CR_AUTONEG_RESTART;
344 
345         switch (Adapter->ChipType)
346         {
347             case DC21041:
348             {
349                 /* Errata: don't enable auto-negotiation */
350                 if (Adapter->RevisionId < 0x20)
351                     break;
352 
353                 /* Advertise 10T HD and 10T FD. The chip chooses the 10T FD mode automatically */
354                 Adapter->Media[MEDIA_10T].Csr14 |= DC_SIA_TXRX_AUTONEG | DC_SIA_TXRX_ADV_10T_HD;
355                 Adapter->Media[MEDIA_10T].OpMode |= DC_OPMODE_FULL_DUPLEX;
356                 break;
357             }
358 
359             case DC21140:
360             {
361                 /* Pick the default media */
362                 if (Adapter->Features & DC_HAS_MII)
363                 {
364                     Adapter->DefaultMedia = MEDIA_MII;
365                     break;
366                 }
367 
368                 /* The final entry in the media list should be checked first */
369                 _BitScanReverse(&Adapter->DefaultMedia, Adapter->MediaBitmap);
370 
371                 /*
372                  * Select the first half-duplex media.
373                  * If you want to be able to use 21140 boards without MII in full-duplex mode,
374                  * you have to manually select the media.
375                  */
376                 for (i = Adapter->DefaultMedia; i > 0; --i)
377                 {
378                     if ((Adapter->MediaBitmap & (1 << i)) && !MEDIA_IS_FD(i))
379                         break;
380                 }
381                 Adapter->DefaultMedia = i;
382                 break;
383             }
384 
385             case DC21143:
386             case DC21145:
387             {
388                 /* Pick the default media */
389                 if (Adapter->Features & DC_HAS_MII)
390                 {
391                     Adapter->DefaultMedia = MEDIA_MII;
392                 }
393                 else if (Adapter->MediaBitmap & (1 << MEDIA_10T))
394                 {
395                     /* Start at 10mbps to do internal auto-negotiation */
396                     Adapter->DefaultMedia = MEDIA_10T;
397                 }
398                 else
399                 {
400                     /* The final entry in the media list should be checked first */
401                     _BitScanReverse(&Adapter->DefaultMedia, Adapter->MediaBitmap);
402                 }
403 
404                 /* Enable the PCS function to do 100mbps parallel detection */
405                 if (Adapter->SymAdvertising & MII_ADV_100)
406                 {
407                     Adapter->Media[MEDIA_10T].OpMode |= DC_OPMODE_PORT_PCS;
408                     Adapter->Media[MEDIA_10T_FD].OpMode |= DC_OPMODE_PORT_PCS;
409                     Adapter->Media[MEDIA_AUI].OpMode |= DC_OPMODE_PORT_PCS;
410                     Adapter->Media[MEDIA_BNC].OpMode |= DC_OPMODE_PORT_PCS;
411                     Adapter->Media[MEDIA_HMR].OpMode |= DC_OPMODE_PORT_PCS;
412                 }
413 
414                 Csr14 = DC_SIA_TXRX_AUTONEG;
415 
416                 if (Adapter->SymAdvertising & MII_ADV_10T_HD)
417                     Csr14 |= DC_SIA_TXRX_ADV_10T_HD;
418 
419                 /* When NWay is turned on, the FDX bit advertises 10T FD */
420                 if (Adapter->SymAdvertising & MII_ADV_10T_FD)
421                     Adapter->Media[MEDIA_10T].OpMode |= DC_OPMODE_FULL_DUPLEX;
422 
423                 if (Adapter->SymAdvertising & MII_ADV_100T_HD)
424                     Csr14 |= DC_SIA_TXRX_ADV_100TX_HD;
425 
426                 if (Adapter->SymAdvertising & MII_ADV_100T_FD)
427                     Csr14 |= DC_SIA_TXRX_ADV_100TX_FD;
428 
429                 if (Adapter->SymAdvertising & MII_ADV_100T4)
430                     Csr14 |= DC_SIA_TXRX_ADV_100T4;
431 
432                 /* Advertise the PHY capability */
433                 Adapter->Media[MEDIA_10T].Csr14 |= Csr14;
434 
435                 /* This media may use GPIO data different from the 10T HD */
436                 Adapter->Media[MEDIA_10T_FD].Csr14 |= Csr14;
437                 break;
438             }
439 
440             default:
441                 break;
442         }
443     }
444     else /* Forced speed and duplex */
445     {
446         UseMii = FALSE;
447 
448         if (Adapter->Features & DC_HAS_MII)
449         {
450             if (!MEDIA_MII_OVERRIDE(MediaNumber))
451             {
452                 UseMii = TRUE;
453             }
454         }
455 
456         if (!UseMii)
457         {
458             Adapter->DefaultMedia = MediaNumber;
459 
460             if (MEDIA_IS_10T(MediaNumber))
461             {
462                 Adapter->InterruptMask &= ~DC_IRQ_LINK_CHANGED;
463                 Adapter->LinkStateChangeMask &= ~DC_IRQ_LINK_CHANGED;
464             }
465 
466             if (MEDIA_IS_100(MediaNumber))
467             {
468                 Adapter->InterruptMask &= ~(DC_IRQ_LINK_FAIL | DC_IRQ_LINK_PASS);
469                 Adapter->LinkStateChangeMask &= ~(DC_IRQ_LINK_FAIL | DC_IRQ_LINK_PASS);
470             }
471         }
472         else
473         {
474             ULONG MiiAdvertising, MiiControl;
475             Adapter->DefaultMedia = MEDIA_MII;
476 
477             switch (MediaNumber)
478             {
479                 case MEDIA_10T:
480                     MiiAdvertising = MII_ADV_10T_HD;
481                     MiiControl = 0;
482                     break;
483                 case MEDIA_10T_FD:
484                     MiiAdvertising = MII_ADV_10T_FD;
485                     MiiControl = MII_CR_FULL_DUPLEX;
486                     break;
487                 case MEDIA_100TX_HD:
488                     MiiAdvertising = MII_ADV_100T_HD;
489                     MiiControl = MII_CR_SPEED_SELECTION;
490                     break;
491                 case MEDIA_100TX_FD:
492                     MiiAdvertising = MII_ADV_100T_FD;
493                     MiiControl = MII_CR_FULL_DUPLEX | MII_CR_SPEED_SELECTION;
494                     break;
495                 case MEDIA_100T4:
496                     MiiAdvertising = MII_ADV_100T4;
497                     MiiControl = MII_CR_SPEED_SELECTION;
498                     break;
499                 default:
500                     MiiAdvertising = 0;
501                     MiiControl = 0;
502                     break;
503             }
504 
505             if (MiiControl & MII_CR_SPEED_SELECTION)
506                 Adapter->LinkSpeedMbps = 100;
507             else
508                 Adapter->LinkSpeedMbps = 10;
509 
510             Adapter->MiiAdvertising = MiiAdvertising;
511             Adapter->MiiControl = MiiControl;
512         }
513     }
514 
515     INFO("Default media is %s\n", MediaNumber2Str(Adapter, Adapter->DefaultMedia));
516 }
517 
518 static
519 CODE_SEG("PAGE")
520 VOID
521 MediaInitOpMode2114x(
522     _In_ PDC21X4_ADAPTER Adapter)
523 {
524     PAGED_CODE();
525 
526     Adapter->Media[MEDIA_10T     ].OpMode = 0;
527     Adapter->Media[MEDIA_BNC     ].OpMode = 0;
528     Adapter->Media[MEDIA_AUI     ].OpMode = 0;
529     Adapter->Media[MEDIA_100TX_HD].OpMode = DC_OPMODE_PORT_SELECT |
530                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE;
531     Adapter->Media[MEDIA_10T_FD  ].OpMode = DC_OPMODE_FULL_DUPLEX;
532     Adapter->Media[MEDIA_100TX_FD].OpMode = DC_OPMODE_PORT_SELECT | DC_OPMODE_FULL_DUPLEX |
533                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE;
534     Adapter->Media[MEDIA_100T4   ].OpMode = DC_OPMODE_PORT_SELECT |
535                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE;
536     Adapter->Media[MEDIA_100FX_HD].OpMode = DC_OPMODE_PORT_SELECT |
537                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE |
538                                             DC_OPMODE_PORT_PCS;
539     Adapter->Media[MEDIA_100FX_FD].OpMode = DC_OPMODE_PORT_SELECT | DC_OPMODE_FULL_DUPLEX |
540                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE |
541                                             DC_OPMODE_PORT_PCS;
542     Adapter->Media[MEDIA_HMR     ].OpMode = DC_OPMODE_PORT_HEARTBEAT_DISABLE;
543 }
544 
545 CODE_SEG("PAGE")
546 VOID
547 MediaInitMediaList(
548     _In_ PDC21X4_ADAPTER Adapter)
549 {
550     PAGED_CODE();
551 
552     /*
553      * Set the default internal values for the SIA/SYM operating modes.
554      * The SROM parsing code may later overwrite them.
555      */
556     switch (Adapter->ChipType)
557     {
558         case DC21040:
559         {
560             Adapter->Media[MEDIA_10T].Csr13 = 0x8F01;
561             Adapter->Media[MEDIA_10T].Csr14 = 0xFFFF;
562             Adapter->Media[MEDIA_10T].Csr15 = 0x0000;
563 
564             Adapter->Media[MEDIA_BNC].Csr13 = 0x8F09;
565             Adapter->Media[MEDIA_BNC].Csr14 = 0x0705;
566             Adapter->Media[MEDIA_BNC].Csr15 = 0x0006;
567 
568             Adapter->Media[MEDIA_10T_FD].Csr13 = 0x8F01;
569             Adapter->Media[MEDIA_10T_FD].Csr14 = 0xFFFD;
570             Adapter->Media[MEDIA_10T_FD].Csr15 = 0x0000;
571             Adapter->Media[MEDIA_10T_FD].OpMode = DC_OPMODE_FULL_DUPLEX;
572             break;
573         }
574 
575         case DC21041:
576         {
577             Adapter->Media[MEDIA_10T].Csr13 = 0xEF01;
578             Adapter->Media[MEDIA_10T].Csr14 = 0xFF3F;
579             Adapter->Media[MEDIA_10T].Csr15 = 0x0008;
580 
581             Adapter->Media[MEDIA_BNC].Csr13 = 0xEF09;
582             Adapter->Media[MEDIA_BNC].Csr14 = 0xF7FD;
583             Adapter->Media[MEDIA_BNC].Csr15 = 0x0006;
584 
585             Adapter->Media[MEDIA_AUI].Csr13 = 0xEF09;
586             Adapter->Media[MEDIA_AUI].Csr14 = 0xF7FD;
587             Adapter->Media[MEDIA_AUI].Csr15 = 0x000E;
588 
589             Adapter->Media[MEDIA_10T_HD].Csr13 = 0xEF01;
590             Adapter->Media[MEDIA_10T_HD].Csr14 = 0x7F3F;
591             Adapter->Media[MEDIA_10T_HD].Csr15 = 0x0008;
592 
593             Adapter->Media[MEDIA_10T_FD].Csr13 = 0xEF01;
594             Adapter->Media[MEDIA_10T_FD].Csr14 = 0x7F3D;
595             Adapter->Media[MEDIA_10T_FD].Csr15 = 0x0008;
596             Adapter->Media[MEDIA_10T_FD].OpMode = DC_OPMODE_FULL_DUPLEX;
597             break;
598         }
599 
600         case DC21140:
601         {
602             MediaInitOpMode2114x(Adapter);
603             break;
604         }
605 
606         case DC21143:
607         case DC21145:
608         {
609             Adapter->Media[MEDIA_10T].Csr13 = 0x0001;
610             Adapter->Media[MEDIA_10T].Csr14 = 0x7F3F;
611             Adapter->Media[MEDIA_10T].Csr15 = 0x0008;
612 
613             Adapter->Media[MEDIA_BNC].Csr13 = 0x0009;
614             Adapter->Media[MEDIA_BNC].Csr14 = 0x0705;
615             Adapter->Media[MEDIA_BNC].Csr15 = 0x0006;
616 
617             Adapter->Media[MEDIA_AUI].Csr13 = 0x0009;
618             Adapter->Media[MEDIA_AUI].Csr14 = 0x0705;
619             Adapter->Media[MEDIA_AUI].Csr15 = 0x000E;
620 
621             Adapter->Media[MEDIA_10T_FD].Csr13 = 0x0001;
622             Adapter->Media[MEDIA_10T_FD].Csr14 = 0x7F3D;
623             Adapter->Media[MEDIA_10T_FD].Csr15 = 0x0008;
624 
625             Adapter->Media[MEDIA_HMR].Csr13 = 0x0009;
626             Adapter->Media[MEDIA_HMR].Csr14 = 0x0505;
627             Adapter->Media[MEDIA_HMR].Csr15 = 0x0010;
628 
629             MediaInitOpMode2114x(Adapter);
630             break;
631         }
632 
633         default:
634             break;
635     }
636 }
637