|
@@ -69,13 +69,10 @@
|
69
|
69
|
#include "etherboot.h"
|
70
|
70
|
#include "nic.h"
|
71
|
71
|
#include "isa.h"
|
|
72
|
+#include "console.h"
|
72
|
73
|
#include "cs89x0.h"
|
73
|
74
|
|
74
|
|
-#ifndef EMBEDDED
|
75
|
75
|
static unsigned short eth_nic_base;
|
76
|
|
-#else
|
77
|
|
-static unsigned long eth_nic_base;
|
78
|
|
-#endif
|
79
|
76
|
static unsigned long eth_mem_start;
|
80
|
77
|
static unsigned short eth_irqno;
|
81
|
78
|
static unsigned short eth_cs_type; /* one of: CS8900, CS8920, CS8920M */
|
|
@@ -454,266 +451,258 @@ static void cs89x0_irq(struct nic *nic __unused, irq_action_t action __unused)
|
454
|
451
|
}
|
455
|
452
|
}
|
456
|
453
|
|
|
454
|
+static struct nic_operations cs89x0_operations = {
|
|
455
|
+ .connect = dummy_connect,
|
|
456
|
+ .poll = cs89x0_poll,
|
|
457
|
+ .transmit = cs89x0_transmit,
|
|
458
|
+ .irq = cs89x0_irq,
|
|
459
|
+ .disable = cs89x0_disable,
|
|
460
|
+};
|
|
461
|
+
|
457
|
462
|
/**************************************************************************
|
458
|
463
|
ETH_PROBE - Look for an adapter
|
459
|
464
|
***************************************************************************/
|
460
|
465
|
|
461
|
|
-static int cs89x0_probe(struct dev *dev, unsigned short *probe_addrs __unused)
|
462
|
|
-{
|
463
|
|
- struct nic *nic = (struct nic *)dev;
|
464
|
|
- static const unsigned int netcard_portlist[] = {
|
465
|
|
-#ifdef CS_SCAN
|
466
|
|
- CS_SCAN,
|
467
|
|
-#else /* use "conservative" default values for autoprobing */
|
468
|
|
-#ifndef EMBEDDED
|
469
|
|
- 0x300,0x320,0x340,0x200,0x220,0x240,
|
470
|
|
- 0x260,0x280,0x2a0,0x2c0,0x2e0,
|
471
|
|
- /* if that did not work, then be more aggressive */
|
472
|
|
- 0x301,0x321,0x341,0x201,0x221,0x241,
|
473
|
|
- 0x261,0x281,0x2a1,0x2c1,0x2e1,
|
474
|
|
-#else
|
475
|
|
- 0x01000300,
|
476
|
|
-#endif
|
477
|
|
-#endif
|
478
|
|
- 0};
|
479
|
|
-
|
480
|
|
- int i, result = -1;
|
481
|
|
- unsigned rev_type = 0, ioaddr, ioidx, isa_cnf, cs_revision;
|
482
|
|
- unsigned short eeprom_buff[CHKSUM_LEN];
|
483
|
|
-
|
|
466
|
+static int cs89x0_probe_addr ( uint16_t ioaddr ) {
|
|
467
|
+ /* if they give us an odd I/O address, then do ONE write to
|
|
468
|
+ the address port, to get it back to address zero, where we
|
|
469
|
+ expect to find the EISA signature word. */
|
|
470
|
+ if (ioaddr & 1) {
|
|
471
|
+ ioaddr &= ~1;
|
|
472
|
+ if ((inw(ioaddr + ADD_PORT) & ADD_MASK) != ADD_SIG)
|
|
473
|
+ return 0;
|
|
474
|
+ outw(PP_ChipID, ioaddr + ADD_PORT);
|
|
475
|
+ }
|
|
476
|
+
|
|
477
|
+ if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG)
|
|
478
|
+ return 0;
|
484
|
479
|
|
485
|
|
- for (ioidx = 0; (ioaddr=netcard_portlist[ioidx++]) != 0; ) {
|
486
|
|
- /* if they give us an odd I/O address, then do ONE write to
|
487
|
|
- the address port, to get it back to address zero, where we
|
488
|
|
- expect to find the EISA signature word. */
|
489
|
|
- if (ioaddr & 1) {
|
490
|
|
- ioaddr &= ~1;
|
491
|
|
- if ((inw(ioaddr + ADD_PORT) & ADD_MASK) != ADD_SIG)
|
492
|
|
- continue;
|
493
|
|
- outw(PP_ChipID, ioaddr + ADD_PORT);
|
494
|
|
- }
|
|
480
|
+ return 1;
|
|
481
|
+}
|
495
|
482
|
|
496
|
|
- if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG)
|
497
|
|
- continue;
|
498
|
|
- eth_nic_base = ioaddr;
|
|
483
|
+static int cs89x0_probe ( struct dev *dev, struct isa_device *isa ) {
|
|
484
|
+ struct nic *nic = nic_device ( dev );
|
499
|
485
|
|
500
|
|
- /* get the chip type */
|
501
|
|
- rev_type = readreg(PRODUCT_ID_ADD);
|
502
|
|
- eth_cs_type = rev_type &~ REVISON_BITS;
|
503
|
|
- cs_revision = ((rev_type & REVISON_BITS) >> 8) + 'A';
|
|
486
|
+ int i, result = -1;
|
|
487
|
+ unsigned rev_type = 0, isa_cnf, cs_revision;
|
|
488
|
+ unsigned short eeprom_buff[CHKSUM_LEN];
|
504
|
489
|
|
505
|
|
- printf("\ncs: cs89%c0%s rev %c, base %#hX",
|
506
|
|
- eth_cs_type==CS8900?'0':'2',
|
507
|
|
- eth_cs_type==CS8920M?"M":"",
|
508
|
|
- cs_revision,
|
509
|
|
- eth_nic_base);
|
|
490
|
+ nic->ioaddr = ( isa->ioaddr & ~1 );
|
|
491
|
+ nic->irqno = 0;
|
|
492
|
+
|
|
493
|
+ eth_nic_base = nic->ioaddr;
|
|
494
|
+
|
|
495
|
+ /* get the chip type */
|
|
496
|
+ rev_type = readreg(PRODUCT_ID_ADD);
|
|
497
|
+ eth_cs_type = rev_type &~ REVISON_BITS;
|
|
498
|
+ cs_revision = ((rev_type & REVISON_BITS) >> 8) + 'A';
|
|
499
|
+
|
|
500
|
+ printf("\ncs: cs89%c0%s rev %c, base %#hX",
|
|
501
|
+ eth_cs_type==CS8900?'0':'2',
|
|
502
|
+ eth_cs_type==CS8920M?"M":"",
|
|
503
|
+ cs_revision,
|
|
504
|
+ eth_nic_base);
|
510
|
505
|
#ifndef EMBEDDED
|
511
|
|
- /* First check to see if an EEPROM is attached*/
|
512
|
|
- if ((readreg(PP_SelfST) & EEPROM_PRESENT) == 0) {
|
513
|
|
- printf("\ncs: no EEPROM...\n");
|
514
|
|
- outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
515
|
|
- continue; }
|
516
|
|
- else if (get_eeprom_data(START_EEPROM_DATA,CHKSUM_LEN,
|
517
|
|
- eeprom_buff) < 0) {
|
518
|
|
- printf("\ncs: EEPROM read failed...\n");
|
519
|
|
- outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
520
|
|
- continue; }
|
521
|
|
- else if (get_eeprom_chksum(START_EEPROM_DATA,CHKSUM_LEN,
|
522
|
|
- eeprom_buff) < 0) {
|
523
|
|
- printf("\ncs: EEPROM checksum bad...\n");
|
524
|
|
- outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
525
|
|
- continue; }
|
526
|
|
-
|
527
|
|
- /* get transmission control word but keep the
|
528
|
|
- autonegotiation bits */
|
529
|
|
- eth_auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET/2];
|
530
|
|
- /* Store adapter configuration */
|
531
|
|
- eth_adapter_cnf = eeprom_buff[ADAPTER_CNF_OFFSET/2];
|
532
|
|
- /* Store ISA configuration */
|
533
|
|
- isa_cnf = eeprom_buff[ISA_CNF_OFFSET/2];
|
534
|
|
-
|
535
|
|
- /* store the initial memory base address */
|
536
|
|
- eth_mem_start = eeprom_buff[PACKET_PAGE_OFFSET/2] << 8;
|
537
|
|
-
|
538
|
|
- printf("%s%s%s, addr ",
|
539
|
|
- (eth_adapter_cnf & A_CNF_10B_T)?", RJ-45":"",
|
540
|
|
- (eth_adapter_cnf & A_CNF_AUI)?", AUI":"",
|
541
|
|
- (eth_adapter_cnf & A_CNF_10B_2)?", BNC":"");
|
542
|
|
-
|
543
|
|
- /* If this is a CS8900 then no pnp soft */
|
544
|
|
- if (eth_cs_type != CS8900 &&
|
545
|
|
- /* Check if the ISA IRQ has been set */
|
546
|
|
- (i = readreg(PP_CS8920_ISAINT) & 0xff,
|
547
|
|
- (i != 0 && i < CS8920_NO_INTS)))
|
548
|
|
- eth_irqno = i;
|
549
|
|
- else {
|
550
|
|
- i = isa_cnf & INT_NO_MASK;
|
551
|
|
- if (eth_cs_type == CS8900) {
|
552
|
|
- /* the table that follows is dependent
|
553
|
|
- upon how you wired up your cs8900
|
554
|
|
- in your system. The table is the
|
555
|
|
- same as the cs8900 engineering demo
|
556
|
|
- board. irq_map also depends on the
|
557
|
|
- contents of the table. Also see
|
558
|
|
- write_irq, which is the reverse
|
559
|
|
- mapping of the table below. */
|
560
|
|
- if (i < 4) i = "\012\013\014\005"[i];
|
561
|
|
- else printf("\ncs: BUG: isa_config is %d\n", i); }
|
562
|
|
- eth_irqno = i; }
|
563
|
|
-
|
564
|
|
- /* Retrieve and print the ethernet address. */
|
565
|
|
- for (i=0; i<ETH_ALEN; i++) {
|
566
|
|
- nic->node_addr[i] = ((unsigned char *)eeprom_buff)[i];
|
567
|
|
- }
|
568
|
|
- printf("%!\n", nic->node_addr);
|
|
506
|
+ /* First check to see if an EEPROM is attached*/
|
|
507
|
+ if ((readreg(PP_SelfST) & EEPROM_PRESENT) == 0) {
|
|
508
|
+ printf("\ncs: no EEPROM...\n");
|
|
509
|
+ outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
|
510
|
+ return 0;
|
|
511
|
+ } else if (get_eeprom_data(START_EEPROM_DATA,CHKSUM_LEN,
|
|
512
|
+ eeprom_buff) < 0) {
|
|
513
|
+ printf("\ncs: EEPROM read failed...\n");
|
|
514
|
+ outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
|
515
|
+ return 0;
|
|
516
|
+ } else if (get_eeprom_chksum(START_EEPROM_DATA,CHKSUM_LEN,
|
|
517
|
+ eeprom_buff) < 0) {
|
|
518
|
+ printf("\ncs: EEPROM checksum bad...\n");
|
|
519
|
+ outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
|
520
|
+ return 0;
|
|
521
|
+ }
|
|
522
|
+
|
|
523
|
+ /* get transmission control word but keep the
|
|
524
|
+ autonegotiation bits */
|
|
525
|
+ eth_auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET/2];
|
|
526
|
+ /* Store adapter configuration */
|
|
527
|
+ eth_adapter_cnf = eeprom_buff[ADAPTER_CNF_OFFSET/2];
|
|
528
|
+ /* Store ISA configuration */
|
|
529
|
+ isa_cnf = eeprom_buff[ISA_CNF_OFFSET/2];
|
|
530
|
+
|
|
531
|
+ /* store the initial memory base address */
|
|
532
|
+ eth_mem_start = eeprom_buff[PACKET_PAGE_OFFSET/2] << 8;
|
|
533
|
+
|
|
534
|
+ printf("%s%s%s, addr ",
|
|
535
|
+ (eth_adapter_cnf & A_CNF_10B_T)?", RJ-45":"",
|
|
536
|
+ (eth_adapter_cnf & A_CNF_AUI)?", AUI":"",
|
|
537
|
+ (eth_adapter_cnf & A_CNF_10B_2)?", BNC":"");
|
|
538
|
+
|
|
539
|
+ /* If this is a CS8900 then no pnp soft */
|
|
540
|
+ if (eth_cs_type != CS8900 &&
|
|
541
|
+ /* Check if the ISA IRQ has been set */
|
|
542
|
+ (i = readreg(PP_CS8920_ISAINT) & 0xff,
|
|
543
|
+ (i != 0 && i < CS8920_NO_INTS)))
|
|
544
|
+ eth_irqno = i;
|
|
545
|
+ else {
|
|
546
|
+ i = isa_cnf & INT_NO_MASK;
|
|
547
|
+ if (eth_cs_type == CS8900) {
|
|
548
|
+ /* the table that follows is dependent
|
|
549
|
+ upon how you wired up your cs8900
|
|
550
|
+ in your system. The table is the
|
|
551
|
+ same as the cs8900 engineering demo
|
|
552
|
+ board. irq_map also depends on the
|
|
553
|
+ contents of the table. Also see
|
|
554
|
+ write_irq, which is the reverse
|
|
555
|
+ mapping of the table below. */
|
|
556
|
+ if (i < 4) i = "\012\013\014\005"[i];
|
|
557
|
+ else printf("\ncs: BUG: isa_config is %d\n", i); }
|
|
558
|
+ eth_irqno = i; }
|
|
559
|
+
|
|
560
|
+ /* Retrieve and print the ethernet address. */
|
|
561
|
+ for (i=0; i<ETH_ALEN; i++) {
|
|
562
|
+ nic->node_addr[i] = ((unsigned char *)eeprom_buff)[i];
|
|
563
|
+ }
|
|
564
|
+ printf("%!\n", nic->node_addr);
|
569
|
565
|
#endif
|
570
|
566
|
#ifdef EMBEDDED
|
571
|
|
- /* Retrieve and print the ethernet address. */
|
572
|
|
- {
|
|
567
|
+ /* Retrieve and print the ethernet address. */
|
|
568
|
+ {
|
573
|
569
|
unsigned char MAC_HW_ADDR[6]={MAC_HW_ADDR_DRV};
|
574
|
570
|
memcpy(nic->node_addr, MAC_HW_ADDR, 6);
|
575
|
|
- }
|
576
|
|
- printf("\n%!\n", nic->node_addr);
|
577
|
|
-
|
578
|
|
- eth_adapter_cnf = A_CNF_10B_T | A_CNF_MEDIA_10B_T;
|
579
|
|
- eth_auto_neg_cnf = EE_AUTO_NEG_ENABLE | IMM_BIT;
|
|
571
|
+ }
|
|
572
|
+ printf("\n%!\n", nic->node_addr);
|
|
573
|
+
|
|
574
|
+ eth_adapter_cnf = A_CNF_10B_T | A_CNF_MEDIA_10B_T;
|
|
575
|
+ eth_auto_neg_cnf = EE_AUTO_NEG_ENABLE | IMM_BIT;
|
580
|
576
|
#endif
|
581
|
577
|
#ifndef EMBEDDED
|
582
|
|
- /* Set the LineCTL quintuplet based on adapter
|
583
|
|
- configuration read from EEPROM */
|
584
|
|
- if ((eth_adapter_cnf & A_CNF_EXTND_10B_2) &&
|
585
|
|
- (eth_adapter_cnf & A_CNF_LOW_RX_SQUELCH))
|
586
|
|
- eth_linectl = LOW_RX_SQUELCH;
|
587
|
|
- else
|
588
|
|
- eth_linectl = 0;
|
589
|
|
-
|
590
|
|
- /* check to make sure that they have the "right"
|
591
|
|
- hardware available */
|
592
|
|
- switch(eth_adapter_cnf & A_CNF_MEDIA_TYPE) {
|
593
|
|
- case A_CNF_MEDIA_10B_T: result = eth_adapter_cnf & A_CNF_10B_T;
|
594
|
|
- break;
|
595
|
|
- case A_CNF_MEDIA_AUI: result = eth_adapter_cnf & A_CNF_AUI;
|
596
|
|
- break;
|
597
|
|
- case A_CNF_MEDIA_10B_2: result = eth_adapter_cnf & A_CNF_10B_2;
|
598
|
|
- break;
|
599
|
|
- default: result = eth_adapter_cnf & (A_CNF_10B_T | A_CNF_AUI |
|
600
|
|
- A_CNF_10B_2);
|
601
|
|
- }
|
602
|
|
- if (!result) {
|
603
|
|
- printf("cs: EEPROM is configured for unavailable media\n");
|
604
|
|
- error:
|
605
|
|
- writereg(PP_LineCTL, readreg(PP_LineCTL) &
|
606
|
|
- ~(SERIAL_TX_ON | SERIAL_RX_ON));
|
607
|
|
- outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
608
|
|
- continue;
|
609
|
|
- }
|
|
578
|
+ /* Set the LineCTL quintuplet based on adapter
|
|
579
|
+ configuration read from EEPROM */
|
|
580
|
+ if ((eth_adapter_cnf & A_CNF_EXTND_10B_2) &&
|
|
581
|
+ (eth_adapter_cnf & A_CNF_LOW_RX_SQUELCH))
|
|
582
|
+ eth_linectl = LOW_RX_SQUELCH;
|
|
583
|
+ else
|
|
584
|
+ eth_linectl = 0;
|
|
585
|
+
|
|
586
|
+ /* check to make sure that they have the "right"
|
|
587
|
+ hardware available */
|
|
588
|
+ switch(eth_adapter_cnf & A_CNF_MEDIA_TYPE) {
|
|
589
|
+ case A_CNF_MEDIA_10B_T: result = eth_adapter_cnf & A_CNF_10B_T;
|
|
590
|
+ break;
|
|
591
|
+ case A_CNF_MEDIA_AUI: result = eth_adapter_cnf & A_CNF_AUI;
|
|
592
|
+ break;
|
|
593
|
+ case A_CNF_MEDIA_10B_2: result = eth_adapter_cnf & A_CNF_10B_2;
|
|
594
|
+ break;
|
|
595
|
+ default: result = eth_adapter_cnf & (A_CNF_10B_T | A_CNF_AUI |
|
|
596
|
+ A_CNF_10B_2);
|
|
597
|
+ }
|
|
598
|
+ if (!result) {
|
|
599
|
+ printf("cs: EEPROM is configured for unavailable media\n");
|
|
600
|
+ error:
|
|
601
|
+ writereg(PP_LineCTL, readreg(PP_LineCTL) &
|
|
602
|
+ ~(SERIAL_TX_ON | SERIAL_RX_ON));
|
|
603
|
+ outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
|
604
|
+ return 0;
|
|
605
|
+ }
|
610
|
606
|
#endif
|
611
|
|
- /* Initialize the card for probing of the attached media */
|
612
|
|
- cs89x0_reset(nic);
|
613
|
|
-
|
614
|
|
- /* set the hardware to the configured choice */
|
615
|
|
- switch(eth_adapter_cnf & A_CNF_MEDIA_TYPE) {
|
616
|
|
- case A_CNF_MEDIA_10B_T:
|
617
|
|
- result = detect_tp();
|
618
|
|
- if (!result) {
|
619
|
|
- clrline();
|
620
|
|
- printf("10Base-T (RJ-45%s",
|
621
|
|
- ") has no cable\n"); }
|
622
|
|
- /* check "ignore missing media" bit */
|
623
|
|
- if (eth_auto_neg_cnf & IMM_BIT)
|
624
|
|
- /* Yes! I don't care if I see a link pulse */
|
625
|
|
- result = A_CNF_MEDIA_10B_T;
|
626
|
|
- break;
|
627
|
|
- case A_CNF_MEDIA_AUI:
|
628
|
|
- result = detect_aui(nic);
|
629
|
|
- if (!result) {
|
630
|
|
- clrline();
|
631
|
|
- printf("10Base-5 (AUI%s",
|
632
|
|
- ") has no cable\n"); }
|
633
|
|
- /* check "ignore missing media" bit */
|
634
|
|
- if (eth_auto_neg_cnf & IMM_BIT)
|
635
|
|
- /* Yes! I don't care if I see a carrrier */
|
636
|
|
- result = A_CNF_MEDIA_AUI;
|
637
|
|
- break;
|
638
|
|
- case A_CNF_MEDIA_10B_2:
|
639
|
|
- result = detect_bnc(nic);
|
640
|
|
- if (!result) {
|
641
|
|
- clrline();
|
642
|
|
- printf("10Base-2 (BNC%s",
|
643
|
|
- ") has no cable\n"); }
|
644
|
|
- /* check "ignore missing media" bit */
|
645
|
|
- if (eth_auto_neg_cnf & IMM_BIT)
|
646
|
|
- /* Yes! I don't care if I can xmit a packet */
|
647
|
|
- result = A_CNF_MEDIA_10B_2;
|
648
|
|
- break;
|
649
|
|
- case A_CNF_MEDIA_AUTO:
|
650
|
|
- writereg(PP_LineCTL, eth_linectl | AUTO_AUI_10BASET);
|
651
|
|
- if (eth_adapter_cnf & A_CNF_10B_T)
|
652
|
|
- if ((result = detect_tp()) != 0)
|
653
|
|
- break;
|
654
|
|
- if (eth_adapter_cnf & A_CNF_AUI)
|
655
|
|
- if ((result = detect_aui(nic)) != 0)
|
656
|
|
- break;
|
657
|
|
- if (eth_adapter_cnf & A_CNF_10B_2)
|
658
|
|
- if ((result = detect_bnc(nic)) != 0)
|
659
|
|
- break;
|
660
|
|
- clrline(); printf("no media detected\n");
|
661
|
|
- goto error;
|
662
|
|
- }
|
663
|
|
- clrline();
|
664
|
|
- switch(result) {
|
665
|
|
- case 0: printf("no network cable attached to configured media\n");
|
666
|
|
- goto error;
|
667
|
|
- case A_CNF_MEDIA_10B_T: printf("using 10Base-T (RJ-45)\n");
|
668
|
|
- break;
|
669
|
|
- case A_CNF_MEDIA_AUI: printf("using 10Base-5 (AUI)\n");
|
670
|
|
- break;
|
671
|
|
- case A_CNF_MEDIA_10B_2: printf("using 10Base-2 (BNC)\n");
|
672
|
|
- break;
|
673
|
|
- }
|
674
|
|
-
|
675
|
|
- /* Turn on both receive and transmit operations */
|
676
|
|
- writereg(PP_LineCTL, readreg(PP_LineCTL) | SERIAL_RX_ON |
|
677
|
|
- SERIAL_TX_ON);
|
678
|
|
-
|
|
607
|
+ /* Initialize the card for probing of the attached media */
|
|
608
|
+ cs89x0_reset(nic);
|
|
609
|
+
|
|
610
|
+ /* set the hardware to the configured choice */
|
|
611
|
+ switch(eth_adapter_cnf & A_CNF_MEDIA_TYPE) {
|
|
612
|
+ case A_CNF_MEDIA_10B_T:
|
|
613
|
+ result = detect_tp();
|
|
614
|
+ if (!result) {
|
|
615
|
+ clrline();
|
|
616
|
+ printf("10Base-T (RJ-45%s",
|
|
617
|
+ ") has no cable\n"); }
|
|
618
|
+ /* check "ignore missing media" bit */
|
|
619
|
+ if (eth_auto_neg_cnf & IMM_BIT)
|
|
620
|
+ /* Yes! I don't care if I see a link pulse */
|
|
621
|
+ result = A_CNF_MEDIA_10B_T;
|
|
622
|
+ break;
|
|
623
|
+ case A_CNF_MEDIA_AUI:
|
|
624
|
+ result = detect_aui(nic);
|
|
625
|
+ if (!result) {
|
|
626
|
+ clrline();
|
|
627
|
+ printf("10Base-5 (AUI%s",
|
|
628
|
+ ") has no cable\n"); }
|
|
629
|
+ /* check "ignore missing media" bit */
|
|
630
|
+ if (eth_auto_neg_cnf & IMM_BIT)
|
|
631
|
+ /* Yes! I don't care if I see a carrrier */
|
|
632
|
+ result = A_CNF_MEDIA_AUI;
|
|
633
|
+ break;
|
|
634
|
+ case A_CNF_MEDIA_10B_2:
|
|
635
|
+ result = detect_bnc(nic);
|
|
636
|
+ if (!result) {
|
|
637
|
+ clrline();
|
|
638
|
+ printf("10Base-2 (BNC%s",
|
|
639
|
+ ") has no cable\n"); }
|
|
640
|
+ /* check "ignore missing media" bit */
|
|
641
|
+ if (eth_auto_neg_cnf & IMM_BIT)
|
|
642
|
+ /* Yes! I don't care if I can xmit a packet */
|
|
643
|
+ result = A_CNF_MEDIA_10B_2;
|
|
644
|
+ break;
|
|
645
|
+ case A_CNF_MEDIA_AUTO:
|
|
646
|
+ writereg(PP_LineCTL, eth_linectl | AUTO_AUI_10BASET);
|
|
647
|
+ if (eth_adapter_cnf & A_CNF_10B_T)
|
|
648
|
+ if ((result = detect_tp()) != 0)
|
|
649
|
+ break;
|
|
650
|
+ if (eth_adapter_cnf & A_CNF_AUI)
|
|
651
|
+ if ((result = detect_aui(nic)) != 0)
|
|
652
|
+ break;
|
|
653
|
+ if (eth_adapter_cnf & A_CNF_10B_2)
|
|
654
|
+ if ((result = detect_bnc(nic)) != 0)
|
|
655
|
+ break;
|
|
656
|
+ clrline(); printf("no media detected\n");
|
|
657
|
+ goto error;
|
|
658
|
+ }
|
|
659
|
+ clrline();
|
|
660
|
+ switch(result) {
|
|
661
|
+ case 0: printf("no network cable attached to configured media\n");
|
|
662
|
+ goto error;
|
|
663
|
+ case A_CNF_MEDIA_10B_T: printf("using 10Base-T (RJ-45)\n");
|
|
664
|
+ break;
|
|
665
|
+ case A_CNF_MEDIA_AUI: printf("using 10Base-5 (AUI)\n");
|
679
|
666
|
break;
|
|
667
|
+ case A_CNF_MEDIA_10B_2: printf("using 10Base-2 (BNC)\n");
|
|
668
|
+ break;
|
|
669
|
+ }
|
|
670
|
+
|
|
671
|
+ /* Turn on both receive and transmit operations */
|
|
672
|
+ writereg(PP_LineCTL, readreg(PP_LineCTL) | SERIAL_RX_ON |
|
|
673
|
+ SERIAL_TX_ON);
|
|
674
|
+
|
|
675
|
+ return 0;
|
680
|
676
|
#ifdef EMBEDDED
|
681
|
|
- error:
|
682
|
|
- writereg(PP_LineCTL, readreg(PP_LineCTL) &
|
683
|
|
- ~(SERIAL_TX_ON | SERIAL_RX_ON));
|
684
|
|
- outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
685
|
|
- continue;
|
|
677
|
+ error:
|
|
678
|
+ writereg(PP_LineCTL, readreg(PP_LineCTL) &
|
|
679
|
+ ~(SERIAL_TX_ON | SERIAL_RX_ON));
|
|
680
|
+ outw(PP_ChipID, eth_nic_base + ADD_PORT);
|
|
681
|
+ return 0;
|
686
|
682
|
#endif
|
687
|
|
- }
|
688
|
|
-
|
689
|
|
- if (ioaddr == 0)
|
690
|
|
- return (0);
|
691
|
|
-
|
692
|
|
- nic->irqno = 0;
|
693
|
|
- nic->ioaddr = ioaddr;
|
694
|
|
-static struct nic_operations cs89x0_operations;
|
695
|
|
-static struct nic_operations cs89x0_operations = {
|
696
|
|
- .connect = dummy_connect,
|
697
|
|
- .poll = cs89x0_poll,
|
698
|
|
- .transmit = cs89x0_transmit,
|
699
|
|
- .irq = cs89x0_irq,
|
700
|
|
- .disable = cs89x0_disable,
|
701
|
|
-};
|
702
|
|
- nic->nic_op = &cs89x0_operations;
|
703
|
683
|
|
704
|
|
- /* Based on PnP ISA map */
|
705
|
|
- dev->devid.vendor_id = htons(ISAPNP_VENDOR('C','S','C'));
|
706
|
|
- dev->devid.device_id = htons(0x0007);
|
|
684
|
+ nic->nic_op = &cs89x0_operations;
|
707
|
685
|
return 1;
|
708
|
686
|
}
|
709
|
|
-
|
710
|
|
-static struct isa_driver cs89x0_driver __isa_driver = {
|
711
|
|
- .type = NIC_DRIVER,
|
712
|
|
- .name = "CS89x0",
|
713
|
|
- .probe = cs89x0_probe,
|
714
|
|
- .ioaddrs = 0,
|
|
687
|
+
|
|
688
|
+static struct isa_probe_addr cs89x0_probe_addrs[] = {
|
|
689
|
+#ifndef EMBEDDED
|
|
690
|
+ /* use "conservative" default values for autoprobing */
|
|
691
|
+ { 0x300 }, { 0x320 }, { 0x340 }, { 0x200 }, { 0x220 }, { 0x240 },
|
|
692
|
+ { 0x260 }, { 0x280 }, { 0x2a0 }, { 0x2c0 }, { 0x2e0 },
|
|
693
|
+ /* if that did not work, then be more aggressive */
|
|
694
|
+ { 0x301 }, { 0x321 }, { 0x341 }, { 0x201 }, { 0x221 }, { 0x241 },
|
|
695
|
+ { 0x261 }, { 0x281 }, { 0x2a1 }, { 0x2c1 }, { 0x2e1 },
|
|
696
|
+#else
|
|
697
|
+ 0x01000300,
|
|
698
|
+#endif
|
715
|
699
|
};
|
716
|
|
-ISA_ROM("cs89x0","Crystal Semiconductor CS89x0");
|
|
700
|
+
|
|
701
|
+static struct isa_driver cs89x0_driver =
|
|
702
|
+ ISA_DRIVER ( "CS89x0", cs89x0_probe_addrs, cs89x0_probe_addr,
|
|
703
|
+ ISAPNP_VENDOR('C','S','C'), 0x0007 );
|
|
704
|
+
|
|
705
|
+ISA_ROM ( "cs89x0", "Crystal Semiconductor CS89x0" );
|
717
|
706
|
|
718
|
707
|
/*
|
719
|
708
|
* Local variables:
|