cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
6,232 Views
Registered: ‎09-16-2007

Four Temac design how to config Marvell PHY

Ok I have MARVELL 88E1145 I have been able to use one port(static XTemac TemacInstance) but when I add 3 more ports my MDIO function stopped working any ideas how to call XTemacIf_ConfigTable correctly.  Plus it seems I can’t write to the first phy not sure what’s going on.  (phy # 1,2,3,4) 

 

Cheers,

Bill T

 
/* int main(void)
 *
 * Initializes the memory file system from an image pre-loaded in SRAM, and
 * launches the Xilinx MicroKernel.
 */
int main(void)
{
    XTemacIf_Config *xtemacif_ptr;
    XTemac mac;
    XStatus status = XST_SUCCESS;
    Xuint32 phyaddr;
   
    // enabling cache for the microkernel
    XCache_EnableICache( 0x1 );
    XCache_EnableDCache( 0x1 );   
    for( phyaddr = 1;
         phyaddr <= 4;
         phyaddr++ )
    {
       xtemacif_ptr = &XTemacIf_ConfigTable[ phyaddr - 1 ];
      mac = *(xtemacif_ptr->instance_ptr); 
 
       // setup MDIO interface
   xil_printf("Mac pointer set to%d\r\n", mac);
       status = WriteAllRegMDIO( &mac, phyaddr );
       if( status == XST_FAILURE )
       {
           if( DEBUG_LEVEL >= CRITICAL )
           {
               xil_printf( "WriteAllRegMDIO failed, terminating application\r\n" );
           }
          
           return XST_FAILURE;
       }
      
       status = ReadAllRegMDIO( &mac, phyaddr );
       if( status == XST_FAILURE )
       {
           if( DEBUG_LEVEL >= CRITICAL )
           {
               xil_printf( "ReadAllRegMDIO failed, terminating application\r\n" );
           }
          
           return XST_FAILURE;
       }
    }
   
    // Launch XMK
    xilkernel_main();
   
    return 0;
}

Tried to upload more than one file but that failed so here is the mdio.h file

 
//MDIO.h file
#ifndef _MDIO_H
#define _MDIO_H
#include "common.h"
#include "xparameters.h"
#include "xutil.h"
#include "sleep.h"
#include "xcache_l.h"
#include "xtemac.h"
// Defines
#define C_ETHERNET_BASEADDR      XPAR_PLB_TEMAC_0_BASEADDR
#define IPISR          0x00000020UL  /* IP interrupt status register */
#define MGTDR          0x000033B0UL
#define MGTCR          0x000033B4UL
#define EMC            0x00003340UL
/* Function Definitions */
XStatus ReadAllRegMDIO( XTemac *mac, Xuint32 phyaddr );
XStatus WriteAllRegMDIO( XTemac *mac, Xuint32 phyaddr );

#endif
 
Cheers,
Bill Tomb
0 Kudos
Reply
0 Replies