@@ -500,19 +500,12 @@ unsigned configure_IEEE_phy_speed( XEmacPs * xemacpsp,
500
500
return 0 ;
501
501
}
502
502
503
- static void SetUpSLCRDivisors ( int mac_baseaddr ,
504
- int speed )
503
+ static void WriteSLCRDivisors ( int mac_baseaddr ,
504
+ u32 SlcrDiv0 ,
505
+ u32 SlcrDiv1 )
505
506
{
506
507
volatile u32 slcrBaseAddress ;
507
508
508
- #ifndef PEEP
509
- u32 SlcrDiv0 = 0 ;
510
- u32 SlcrDiv1 = 0 ;
511
- u32 SlcrTxClkCntrl ;
512
- #endif
513
-
514
- * ( volatile unsigned int * ) ( SLCR_UNLOCK_ADDR ) = SLCR_UNLOCK_KEY_VALUE ;
515
-
516
509
if ( ( unsigned long ) mac_baseaddr == EMAC0_BASE_ADDRESS )
517
510
{
518
511
slcrBaseAddress = SLCR_GEM0_CLK_CTRL_ADDR ;
@@ -522,7 +515,30 @@ static void SetUpSLCRDivisors( int mac_baseaddr,
522
515
slcrBaseAddress = SLCR_GEM1_CLK_CTRL_ADDR ;
523
516
}
524
517
518
+ u32 SlcrTxClkCntrl = * ( volatile unsigned int * ) ( slcrBaseAddress );
519
+ SlcrTxClkCntrl &= EMACPS_SLCR_DIV_MASK ;
520
+ SlcrTxClkCntrl |= ( SlcrDiv1 << 20 );
521
+ SlcrTxClkCntrl |= ( SlcrDiv0 << 8 );
522
+ * ( volatile unsigned int * ) ( slcrBaseAddress ) = SlcrTxClkCntrl ;
523
+ }
524
+
525
+ static void SetUpSLCRDivisors ( int mac_baseaddr ,
526
+ int speed )
527
+ {
528
+ * ( volatile unsigned int * ) ( SLCR_UNLOCK_ADDR ) = SLCR_UNLOCK_KEY_VALUE ;
529
+
525
530
#ifdef PEEP
531
+ volatile u32 slcrBaseAddress ;
532
+
533
+ if ( ( unsigned long ) mac_baseaddr == EMAC0_BASE_ADDRESS )
534
+ {
535
+ slcrBaseAddress = SLCR_GEM0_CLK_CTRL_ADDR ;
536
+ }
537
+ else
538
+ {
539
+ slcrBaseAddress = SLCR_GEM1_CLK_CTRL_ADDR ;
540
+ }
541
+
526
542
if ( speed == 1000 )
527
543
{
528
544
* ( volatile unsigned int * ) ( slcrBaseAddress ) =
@@ -544,15 +560,17 @@ static void SetUpSLCRDivisors( int mac_baseaddr,
544
560
if ( ( unsigned long ) mac_baseaddr == EMAC0_BASE_ADDRESS )
545
561
{
546
562
#ifdef XPAR_PS7_ETHERNET_0_ENET_SLCR_1000MBPS_DIV0
547
- SlcrDiv0 = XPAR_PS7_ETHERNET_0_ENET_SLCR_1000MBPS_DIV0 ;
548
- SlcrDiv1 = XPAR_PS7_ETHERNET_0_ENET_SLCR_1000MBPS_DIV1 ;
563
+ u32 SlcrDiv0 = XPAR_PS7_ETHERNET_0_ENET_SLCR_1000MBPS_DIV0 ;
564
+ u32 SlcrDiv1 = XPAR_PS7_ETHERNET_0_ENET_SLCR_1000MBPS_DIV1 ;
565
+ WriteSLCRDivisors ( mac_baseaddr , SlcrDiv0 , SlcrDiv1 );
549
566
#endif
550
567
}
551
568
else
552
569
{
553
570
#ifdef XPAR_PS7_ETHERNET_1_ENET_SLCR_1000MBPS_DIV0
554
- SlcrDiv0 = XPAR_PS7_ETHERNET_1_ENET_SLCR_1000MBPS_DIV0 ;
555
- SlcrDiv1 = XPAR_PS7_ETHERNET_1_ENET_SLCR_1000MBPS_DIV1 ;
571
+ u32 SlcrDiv0 = XPAR_PS7_ETHERNET_1_ENET_SLCR_1000MBPS_DIV0 ;
572
+ u32 SlcrDiv1 = XPAR_PS7_ETHERNET_1_ENET_SLCR_1000MBPS_DIV1 ;
573
+ WriteSLCRDivisors ( mac_baseaddr , SlcrDiv0 , SlcrDiv1 );
556
574
#endif
557
575
}
558
576
}
@@ -561,15 +579,17 @@ static void SetUpSLCRDivisors( int mac_baseaddr,
561
579
if ( ( unsigned long ) mac_baseaddr == EMAC0_BASE_ADDRESS )
562
580
{
563
581
#ifdef XPAR_PS7_ETHERNET_0_ENET_SLCR_100MBPS_DIV0
564
- SlcrDiv0 = XPAR_PS7_ETHERNET_0_ENET_SLCR_100MBPS_DIV0 ;
565
- SlcrDiv1 = XPAR_PS7_ETHERNET_0_ENET_SLCR_100MBPS_DIV1 ;
582
+ u32 SlcrDiv0 = XPAR_PS7_ETHERNET_0_ENET_SLCR_100MBPS_DIV0 ;
583
+ u32 SlcrDiv1 = XPAR_PS7_ETHERNET_0_ENET_SLCR_100MBPS_DIV1 ;
584
+ WriteSLCRDivisors ( mac_baseaddr , SlcrDiv0 , SlcrDiv1 );
566
585
#endif
567
586
}
568
587
else
569
588
{
570
589
#ifdef XPAR_PS7_ETHERNET_1_ENET_SLCR_100MBPS_DIV0
571
- SlcrDiv0 = XPAR_PS7_ETHERNET_1_ENET_SLCR_100MBPS_DIV0 ;
572
- SlcrDiv1 = XPAR_PS7_ETHERNET_1_ENET_SLCR_100MBPS_DIV1 ;
590
+ u32 SlcrDiv0 = XPAR_PS7_ETHERNET_1_ENET_SLCR_100MBPS_DIV0 ;
591
+ u32 SlcrDiv1 = XPAR_PS7_ETHERNET_1_ENET_SLCR_100MBPS_DIV1 ;
592
+ WriteSLCRDivisors ( mac_baseaddr , SlcrDiv0 , SlcrDiv1 );
573
593
#endif
574
594
}
575
595
}
@@ -578,37 +598,24 @@ static void SetUpSLCRDivisors( int mac_baseaddr,
578
598
if ( ( unsigned long ) mac_baseaddr == EMAC0_BASE_ADDRESS )
579
599
{
580
600
#ifdef XPAR_PS7_ETHERNET_0_ENET_SLCR_10MBPS_DIV0
581
- SlcrDiv0 = XPAR_PS7_ETHERNET_0_ENET_SLCR_10MBPS_DIV0 ;
582
- SlcrDiv1 = XPAR_PS7_ETHERNET_0_ENET_SLCR_10MBPS_DIV1 ;
601
+ u32 SlcrDiv0 = XPAR_PS7_ETHERNET_0_ENET_SLCR_10MBPS_DIV0 ;
602
+ u32 SlcrDiv1 = XPAR_PS7_ETHERNET_0_ENET_SLCR_10MBPS_DIV1 ;
603
+ WriteSLCRDivisors ( mac_baseaddr , SlcrDiv0 , SlcrDiv1 );
583
604
#endif
584
605
}
585
606
else
586
607
{
587
608
#ifdef XPAR_PS7_ETHERNET_1_ENET_SLCR_10MBPS_DIV0
588
- SlcrDiv0 = XPAR_PS7_ETHERNET_1_ENET_SLCR_10MBPS_DIV0 ;
589
- SlcrDiv1 = XPAR_PS7_ETHERNET_1_ENET_SLCR_10MBPS_DIV1 ;
609
+ u32 SlcrDiv0 = XPAR_PS7_ETHERNET_1_ENET_SLCR_10MBPS_DIV0 ;
610
+ u32 SlcrDiv1 = XPAR_PS7_ETHERNET_1_ENET_SLCR_10MBPS_DIV1 ;
611
+ WriteSLCRDivisors ( mac_baseaddr , SlcrDiv0 , SlcrDiv1 );
590
612
#endif
591
613
}
592
614
}
593
-
594
- /* SDT drivers should not write to the register */
595
- #ifndef SDT
596
- SlcrTxClkCntrl = * ( volatile unsigned int * ) ( slcrBaseAddress );
597
- SlcrTxClkCntrl &= EMACPS_SLCR_DIV_MASK ;
598
- SlcrTxClkCntrl |= ( SlcrDiv1 << 20 );
599
- SlcrTxClkCntrl |= ( SlcrDiv0 << 8 );
600
- * ( volatile unsigned int * ) ( slcrBaseAddress ) = SlcrTxClkCntrl ;
601
- #else
602
- ( void ) SlcrTxClkCntrl ;
603
- ( void ) SlcrDiv0 ;
604
- ( void ) SlcrDiv1 ;
605
- ( void ) slcrBaseAddress ;
606
- #endif
607
615
#endif /* ifdef PEEP */
608
616
* ( volatile unsigned int * ) ( SLCR_LOCK_ADDR ) = SLCR_LOCK_KEY_VALUE ;
609
617
}
610
618
611
-
612
619
unsigned link_speed ;
613
620
unsigned Phy_Setup ( XEmacPs * xemacpsp )
614
621
{
0 commit comments