Ejemplo n.º 1
0
/*
*  Initialize the QuarterDeck. This should be done in BSP driver init routine.
*	Since BSP is not combined with QuarterDeck driver, we are doing here.
*/
GT_STATUS qdStart(void) /* devId is used for simulator only */
{
	GT_STATUS status;
	/*
	 *  Register all the required functions to QuarterDeck Driver.
	 */
	cfg.BSPFunctions.readMii   = ffReadMii;
	cfg.BSPFunctions.writeMii  = ffWriteMii;
#ifdef USE_SEMAPHORE
	cfg.BSPFunctions.semCreate = osSemCreate;
	cfg.BSPFunctions.semDelete = osSemDelete;
	cfg.BSPFunctions.semTake   = osSemWait;
	cfg.BSPFunctions.semGive   = osSemSignal;
#else /* USE_SEMAPHORE */
	cfg.BSPFunctions.semCreate = NULL;
	cfg.BSPFunctions.semDelete = NULL;
	cfg.BSPFunctions.semTake   = NULL;
	cfg.BSPFunctions.semGive   = NULL;
#endif /* USE_SEMAPHORE */

	cfg.initPorts = GT_TRUE;	
	cfg.cpuPortNum = GT_CPU_SWITCH_PORT;	
	qd_dev->cpuPortNum = GT_CPU_SWITCH_PORT;	
	if((status = qdLoadDriver(&cfg, qd_dev)) != GT_OK) {		
	  gtOsPrintf("qdLoadDriver is failed: status = 0x%x\n", status);
	  return status;
	}
	
	/*
	*  start the QuarterDeck
	*/
	if (qd_dev->deviceId == GT_88E6063) {
	  phyPatch(qd_dev);
	}

	/* to which VID should we set the CPU_PORT? (1 is temporary)*/
	if((status = gvlnSetPortVid(qd_dev, GT_CPU_SWITCH_PORT, 5)) != GT_OK) {
	  gtOsPrintf("gprtSetPortVid returned fail for CPU port.\n");
	  return status;
	}

#ifdef QD_TRAILER_MODE
	/* set ingress trailer mode*/
	gprtSetIngressMode(qd_dev, GT_CPU_SWITCH_PORT, GT_TRAILER_INGRESS);	
	/* set egress trailer*/
	gprtSetTrailerMode(qd_dev, GT_CPU_SWITCH_PORT, GT_TRUE);
#endif

#ifdef QD_HEADER_MODE
	if((status = gprtSetHeaderMode(qd_dev, GT_CPU_SWITCH_PORT, GT_TRUE)) != GT_OK)
	{
	  gtOsPrintf("gprtSetHeaderMode return Failed\n");
	  return status;
	}   
#endif

	return GT_OK;    
}
Ejemplo n.º 2
0
int mv_switch_load_drv(unsigned int port)
{
    int num, scan_mode = 0;
    GT_QD_DEV *qd;

    printk("  o Loading Switch QuarterDeck driver\n");

    memset((char*)&qd_cfg, 0, sizeof(GT_SYS_CONFIG) * BOARD_MAX_CASCADED_SWITCHES);

    scan_mode = mvBoardSmiScanModeGet(port);

    for (num = 0; num < mvBoardNumSwitchesOnPortGet(port); num++) {
        /* init config structure for qd package */
        qd_cfg[num].BSPFunctions.readMii    = gtwReadMiiWrap;
        qd_cfg[num].BSPFunctions.writeMii   = gtwWriteMiiWrap;
        qd_cfg[num].BSPFunctions.semCreate  = NULL;
        qd_cfg[num].BSPFunctions.semDelete  = NULL;
        qd_cfg[num].BSPFunctions.semTake    = NULL;
        qd_cfg[num].BSPFunctions.semGive    = NULL;
        qd_cfg[num].initPorts   = GT_TRUE;
        qd_cfg[num].cpuPortNum  = mvBoardSwitchCpuPortGet(port, num);

        if (scan_mode == 1) {
            qd_cfg[num].mode.baseAddr = 0;
            qd_cfg[num].mode.scanMode = SMI_MANUAL_MODE;
        } else if (scan_mode == 2) {
            qd_cfg[num].mode.baseAddr = mvBoardSwitchSmiAddrGet(port, num);
            qd_cfg[num].mode.scanMode = SMI_MULTI_ADDR_MODE;
        }

        /* load switch sw package */
        if (qdLoadDriver(&qd_cfg[num], &qd_dev[num]) != GT_OK) {
            printk("qdLoadDriver failed, qd_num = %d\n", num);
            return -1;
        }

        qd = &qd_dev[num];
        ETH_DBG( ETH_DBG_LOAD, ("Device ID     : 0x%x\n", qd->deviceId));
        ETH_DBG( ETH_DBG_LOAD, ("Base Reg Addr : 0x%x\n", qd->baseRegAddr));
        ETH_DBG( ETH_DBG_LOAD, ("No. of Ports  : %d\n",   qd->numOfPorts));
        ETH_DBG( ETH_DBG_LOAD, ("CPU Ports     : %ld\n",  qd->cpuPortNum));
    }

    return 0;
}
Ejemplo n.º 3
0
int mv_switch_load(unsigned int port)
{                              
	printk(KERN_ERR "  o Loading Switch QuarterDeck driver\n");

	if (qd_dev) {
		printk(KERN_ERR "    o %s: Already initialized\n", __func__);
		return 0;
	}

	memset((char *)&qd_cfg, 0, sizeof(GT_SYS_CONFIG));
	spin_lock_init(&switch_lock);

	/* init config structure for qd package */ 
	qd_cfg.BSPFunctions.readMii   = readMiiWrap;
	qd_cfg.BSPFunctions.writeMii  = writeMiiWrap;
	qd_cfg.BSPFunctions.semCreate = NULL;
	qd_cfg.BSPFunctions.semDelete = NULL;
	qd_cfg.BSPFunctions.semTake   = NULL;
	qd_cfg.BSPFunctions.semGive   = NULL;
	qd_cfg.initPorts = GT_TRUE;
	qd_cfg.cpuPortNum = mvBoardSwitchCpuPortGet(port);
    if (mvBoardSmiScanModeGet(port) == 1) {
        qd_cfg.mode.baseAddr = 0;
        qd_cfg.mode.scanMode = SMI_MANUAL_MODE;
    }
    else if (mvBoardSmiScanModeGet(port) == 2) {
        qd_cfg.mode.baseAddr = mvBoardPhyAddrGet(port); /* was 0xA; */
        qd_cfg.mode.scanMode = SMI_MULTI_ADDR_MODE;
    }
	
	/* load switch sw package */ 
	if (qdLoadDriver(&qd_cfg, &qddev) != GT_OK) {
		printk(KERN_ERR "qdLoadDriver failed (mv_switch_load)\n");
		return -1;
	}
	printk("qdLoadDriver OK in %s\n",__func__);
	qd_dev = &qddev;
	return 0;	
}
Ejemplo n.º 4
0
//#define MULTI_ADDR_MODE 1
GT_STATUS qdStart(int cpuPort)
{
	GT_STATUS status;


	/*
	 *   Register all the required functions to QuarterDeck Driver.
	 * */
	memset((char*)&cfg,0,sizeof(GT_SYS_CONFIG));
	memset((char*)&diagDev,0,sizeof(GT_QD_DEV));

	dev = &diagDev;

	cfg.BSPFunctions.readMii   = switchReadReg;
	cfg.BSPFunctions.writeMii  = switchWriteReg;
#ifdef GT_RMGMT_ACCESS
	cfg.BSPFunctions.hwAccess  = gtBspHwAccess; 
#endif
#ifdef USE_SEMAPHORE
	cfg.BSPFunctions.semCreate = osSemCreate;
	cfg.BSPFunctions.semDelete = osSemDelete;
	cfg.BSPFunctions.semTake   = osSemWait;
	cfg.BSPFunctions.semGive   = osSemSignal;
#else
	cfg.BSPFunctions.semCreate = NULL;
	cfg.BSPFunctions.semDelete = NULL;
	cfg.BSPFunctions.semTake   = NULL;
	cfg.BSPFunctions.semGive   = NULL;
#endif
	gtBspMiiInit(dev);

	cfg.initPorts = GT_TRUE;    /* Set switch ports to Forwarding mode. If GT_FALSE, use Default Setting. */
	cfg.cpuPortNum = cpuPort;
#ifdef MANUAL_MODE    /* not defined. this is only for sample */
	/* user may want to use this mode when there are two QD switchs on the same MII bus. */
	cfg.mode.scanMode = SMI_MANUAL_MODE;    /* Use QD located at manually defined base addr */
	cfg.mode.baseAddr = 0x10;    /* valid value in this case is either 0 or 0x10 */
#else
#ifdef MULTI_ADDR_MODE
	cfg.mode.scanMode = SMI_MULTI_ADDR_MODE;    /* find a QD in indirect access mode */
	cfg.mode.baseAddr = 1;        /* this is the phyAddr used by QD family device. 
									 Valid value are 1 ~ 31.*/
#else
	cfg.mode.scanMode = SMI_AUTO_SCAN_MODE;    /* Scan 0 or 0x10 base address to find the QD */
	cfg.mode.baseAddr = 0;
#endif
#endif


	if((status=qdLoadDriver(&cfg, dev)) != GT_OK)
	{
		ERROR(GLOBAL_OUT_GROUP, "qdLoadDriver return Failed\n");
		return status;
	}

	INFO(GLOBAL_OUT_GROUP,"Device ID     : 0x%x\n",dev->deviceId);
	INFO(GLOBAL_OUT_GROUP,"Base Reg Addr : 0x%x\n",dev->baseRegAddr);
	INFO(GLOBAL_OUT_GROUP,"No of Ports   : %d\n",(int)dev->numOfPorts);
	INFO(GLOBAL_OUT_GROUP,"CPU Ports     : %d\n",(int)dev->cpuPortNum);

	/*
	 *      *  start the QuarterDeck
	 *          */
	if((status=sysEnable(dev)) != GT_OK)
	{
		ERROR(GLOBAL_OUT_GROUP,"sysConfig return Failed\n");
		return status;
	}

	INFO(GLOBAL_OUT_GROUP,"QuarterDeck has been started.\n");


	return GT_OK;
}
Ejemplo n.º 5
0
GT_STATUS RubyStart(int phyAddr, GT_QD_DEV* d)
{
	GT_STATUS status = GT_FAIL;
	GT_SYS_CONFIG   cfg;

	memset((char*)&cfg,0,sizeof(GT_SYS_CONFIG));
	MSG_PRINT(("Size of GT_QD_DEV %i\n",sizeof(GT_QD_DEV)));

	if(d == NULL)
	{
		MSG_PRINT(("Device Structure is NULL.\n"));
		return GT_FAIL;
	}

	memset((char*)d,0,sizeof(GT_QD_DEV));

	cfg.BSPFunctions.readMii   = ffReadMii;
	cfg.BSPFunctions.writeMii  = ffWriteMii;
#ifdef USE_SEMAPHORE
	cfg.BSPFunctions.semCreate = osSemCreate;
	cfg.BSPFunctions.semDelete = osSemDelete;
	cfg.BSPFunctions.semTake   = osSemWait;
	cfg.BSPFunctions.semGive   = osSemSignal;
#else
	cfg.BSPFunctions.semCreate = NULL;
	cfg.BSPFunctions.semDelete = NULL;
	cfg.BSPFunctions.semTake   = NULL;
	cfg.BSPFunctions.semGive   = NULL;
#endif

	cfg.initPorts = GT_TRUE;	/* Set switch ports to Forwarding mode. If GT_FALSE, use Default Setting. */
	cfg.cpuPortNum = 10;

	cfg.mode.scanMode = SMI_MULTI_ADDR_MODE;
	cfg.mode.baseAddr = phyAddr;	/* valid value in this case is either 0 or 0x10 */

	if((status=qdLoadDriver(&cfg, d)) != GT_OK)
	{
		MSG_PRINT(("qdLoadDriver return Failed\n"));
		return status;
	}

	MSG_PRINT(("Device ID     : 0x%x\n",d->deviceId));
	MSG_PRINT(("PHY Addr      : 0x%x\n",d->phyAddr));
	MSG_PRINT(("Base Addr     : 0x%x\n",d->baseRegAddr));
	MSG_PRINT(("CPU Ports     : %d\n",d->cpuPortNum));
	MSG_PRINT(("N Ports       : %d\n",d->numOfPorts));
	MSG_PRINT(("Device Group  : 0x%x\n",d->devName));
	MSG_PRINT(("QDDev         : %#x\n",(unsigned long)&d));

	/*
	 *  start the QuarterDeck
	*/
	if((status=sysEnable(d)) != GT_OK)
	{
		MSG_PRINT(("sysConfig return Failed\n"));
		return status;
	}

	return GT_OK;
}
Ejemplo n.º 6
0
GT_QD_DEV* loadDev(GT_QD_DEV* dev, int mode, int phyAddr, int cpuPort, unsigned int cfgMode)
{
	GT_QD_DEV* d = dev;
	GT_STATUS status = GT_FAIL;
	GT_SYS_CONFIG   cfg;

	if((int)dev == -1)
		goto printUse;

	memset((char*)&cfg,0,sizeof(GT_SYS_CONFIG));

	if(d == NULL)
	{
		d = (GT_QD_DEV*)malloc(sizeof(GT_QD_DEV));

		if(d == NULL)
		{
			MSG_PRINT(("Failed to allocate Device Structure\n"));
			return NULL;
		}
	}

	memset((char*)d,0,sizeof(GT_QD_DEV));

	cfg.BSPFunctions.readMii   = ffReadMii;
	cfg.BSPFunctions.writeMii  = ffWriteMii;
#ifdef USE_SEMAPHORE
	cfg.BSPFunctions.semCreate = osSemCreate;
	cfg.BSPFunctions.semDelete = osSemDelete;
	cfg.BSPFunctions.semTake   = osSemWait;
	cfg.BSPFunctions.semGive   = osSemSignal;
#else
	cfg.BSPFunctions.semCreate = NULL;
	cfg.BSPFunctions.semDelete = NULL;
	cfg.BSPFunctions.semTake   = NULL;
	cfg.BSPFunctions.semGive   = NULL;
#endif

	cfg.initPorts = GT_TRUE;	/* Set switch ports to Forwarding mode. If GT_FALSE, use Default Setting. */
	cfg.cpuPortNum = cpuPort;
	cfg.skipInitSetup = (GT_U32)cfgMode;

	switch(mode)
	{
		case SMI_MANUAL_MODE:		/* Use QD located at manually defined base addr */
		case SMI_MULTI_ADDR_MODE:	/* Use QD in multi chip address mode */
			cfg.mode.scanMode = mode;
			cfg.mode.baseAddr = phyAddr;	/* valid value in this case is either 0 or 0x10 */
			break;
		case SMI_AUTO_SCAN_MODE:	/* Scan 0 or 0x10 base address to find the QD */
			cfg.mode.scanMode = mode;
			cfg.mode.baseAddr = 0;
			break;
		default:
			MSG_PRINT(("Unknown Mode %i\n",mode));
			goto printUse;
	}

	if((status=qdLoadDriver(&cfg, d)) != GT_OK)
	{
		MSG_PRINT(("qdLoadDriver return Failed\n"));
		goto loadErr;
	}

	MSG_PRINT(("Device ID     : 0x%x\n",d->deviceId));
	MSG_PRINT(("PHY Addr      : 0x%x\n",d->phyAddr));
	MSG_PRINT(("Base Addr     : 0x%x\n",d->baseRegAddr));
	MSG_PRINT(("CPU Ports     : %d\n",d->cpuPortNum));

	/*
	 *  start the QuarterDeck
	*/
	if((status=sysEnable(d)) != GT_OK)
	{
		MSG_PRINT(("sysConfig return Failed\n"));
		goto loadErr;
	}

	return d;

printUse:
	MSG_PRINT(("Usage: loadDev(Dev,mode,phyAddr,cpuPort)\n",SMI_AUTO_SCAN_MODE));
	MSG_PRINT(("\tSMI_AUTO_SCAN_MODE :  %i\n",SMI_AUTO_SCAN_MODE));
	MSG_PRINT(("\tSMI_MANUAL_MODE :     %i\n",SMI_MANUAL_MODE));
	MSG_PRINT(("\tSMI_MULTI_ADDR_MODE : %i\n",SMI_MULTI_ADDR_MODE));
	MSG_PRINT(("Example: loadDev(0,1,0x10,5)\n"));
	MSG_PRINT(("for Manual mode, phy base address 0x10, and cpu port 5\n"));

loadErr:

	if(dev)
		return NULL;

	if(d)
		free(d);

	return NULL;
}
Ejemplo n.º 7
0
GT_STATUS qdStart(int cpuPort, int useQdSim, int devId) /* devId is used for simulator only */
{
GT_STATUS status;

    /*
     *  Register all the required functions to QuarterDeck Driver.
    */
    memset((char*)&cfg,0,sizeof(GT_SYS_CONFIG));
    memset((char*)&diagDev,0,sizeof(GT_QD_DEV));

    if(useQdSim == 0) /* use EV-96122 */
    {
        cfg.BSPFunctions.readMii   = gtBspReadMii;
        cfg.BSPFunctions.writeMii  = gtBspWriteMii;
#ifdef GT_RMGMT_ACCESS
    cfg.BSPFunctions.hwAccess  = gtBspHwAccess;
#endif
#ifdef USE_SEMAPHORE
        cfg.BSPFunctions.semCreate = osSemCreate;
        cfg.BSPFunctions.semDelete = osSemDelete;
        cfg.BSPFunctions.semTake   = osSemWait;
        cfg.BSPFunctions.semGive   = osSemSignal;
#else
        cfg.BSPFunctions.semCreate = NULL;
        cfg.BSPFunctions.semDelete = NULL;
        cfg.BSPFunctions.semTake   = NULL;
        cfg.BSPFunctions.semGive   = NULL;
#endif
        gtBspMiiInit(dev);
    }
    else    /* use QuaterDeck Simulator (No QD Device Required.) */
    {
        cfg.BSPFunctions.readMii   = qdSimRead;
        cfg.BSPFunctions.writeMii  = qdSimWrite;
#ifdef USE_SEMAPHORE
        cfg.BSPFunctions.semCreate = osSemCreate;
        cfg.BSPFunctions.semDelete = osSemDelete;
        cfg.BSPFunctions.semTake   = osSemWait;
        cfg.BSPFunctions.semGive   = osSemSignal;
#else
        cfg.BSPFunctions.semCreate = NULL;
        cfg.BSPFunctions.semDelete = NULL;
        cfg.BSPFunctions.semTake   = NULL;
        cfg.BSPFunctions.semGive   = NULL;
#endif

        qdSimInit(devId,0);
    }

    cfg.initPorts = GT_TRUE;    /* Set switch ports to Forwarding mode. If GT_FALSE, use Default Setting. */
    cfg.cpuPortNum = cpuPort;
#ifdef MANUAL_MODE    /* not defined. this is only for sample */
    /* user may want to use this mode when there are two QD switchs on the same MII bus. */
    cfg.mode.scanMode = SMI_MANUAL_MODE;    /* Use QD located at manually defined base addr */
    cfg.mode.baseAddr = 0x10;    /* valid value in this case is either 0 or 0x10 */
#else
#ifdef MULTI_ADDR_MODE
    cfg.mode.scanMode = SMI_MULTI_ADDR_MODE;    /* find a QD in indirect access mode */
    cfg.mode.baseAddr = 1;        /* this is the phyAddr used by QD family device.
                                Valid value are 1 ~ 31.*/
#else
    cfg.mode.scanMode = SMI_AUTO_SCAN_MODE;    /* Scan 0 or 0x10 base address to find the QD */
    cfg.mode.baseAddr = 0;
#endif
#endif
    if((status=qdLoadDriver(&cfg, dev)) != GT_OK)
    {
        MSG_PRINT(("qdLoadDriver return Failed\n"));
        return status;
    }

    MSG_PRINT(("Device ID     : 0x%x\n",dev->deviceId));
    MSG_PRINT(("Base Reg Addr : 0x%x\n",dev->baseRegAddr));
    MSG_PRINT(("No of Ports   : %d\n",dev->numOfPorts));
    MSG_PRINT(("CPU Ports     : %d\n",dev->cpuPortNum));

    /*
     *  start the QuarterDeck
    */
    if((status=sysEnable(dev)) != GT_OK)
    {
        MSG_PRINT(("sysConfig return Failed\n"));
        return status;
    }

    MSG_PRINT(("QuarterDeck has been started.\n"));

    return GT_OK;
}
Ejemplo n.º 8
0
int mv_switch_load(unsigned int switch_ports_mask)
{
	int p;
	GT_STU_ENTRY	stuEntry;

	printk(KERN_ERR "  o Loading Switch QuarterDeck driver\n");

	if (qd_dev) {
		printk(KERN_ERR "    o %s: Already initialized\n", __func__);
		return 0;
	}

	memset((char *)&qd_cfg, 0, sizeof(GT_SYS_CONFIG));
	spin_lock_init(&switch_lock);

	/* init config structure for qd package */
	qd_cfg.BSPFunctions.readMii = mv_switch_mii_read;
	qd_cfg.BSPFunctions.writeMii = mv_switch_mii_write;
	qd_cfg.BSPFunctions.semCreate = NULL;
	qd_cfg.BSPFunctions.semDelete = NULL;
	qd_cfg.BSPFunctions.semTake = NULL;
	qd_cfg.BSPFunctions.semGive = NULL;
	qd_cfg.initPorts = GT_TRUE;
	qd_cfg.cpuPortNum = mvBoardSwitchCpuPortGet(MV_SWITCH_DEF_INDEX);
	if (mvBoardSmiScanModeGet(MV_SWITCH_DEF_INDEX) == 1) {
		qd_cfg.mode.baseAddr = 0;
		qd_cfg.mode.scanMode = SMI_MANUAL_MODE;
	} else if (mvBoardSmiScanModeGet(MV_SWITCH_DEF_INDEX) == 2) {
		qd_cfg.mode.scanMode = SMI_MULTI_ADDR_MODE;
		if (mvBoardSwitchConnectedPortGet(MV_ETH_PORT_0) != -1) {
			qd_cfg.mode.baseAddr = mvBoardPhyAddrGet(MV_ETH_PORT_0);
		} else if (mvBoardSwitchConnectedPortGet(MV_ETH_PORT_1) != -1) {
			qd_cfg.mode.baseAddr = mvBoardPhyAddrGet(MV_ETH_PORT_1);
		} else {
			printk(KERN_ERR "mv_switch_load failed: Wrong SCAN mode\n");
			return -1;
		}
	}

	/* load switch sw package */
	if (qdLoadDriver(&qd_cfg, &qddev) != GT_OK) {
		printk(KERN_ERR "qdLoadDriver failed\n");
		return -1;
	}
	qd_dev = &qddev;
	qd_cpu_port = qd_cfg.cpuPortNum;

	/* Create entry in STU table  */
	memset(&stuEntry, 0, sizeof(GT_STU_ENTRY));
	stuEntry.sid = 1; /* required: ((sid > 0) && (sid < 0x3F)) */
	gstuAddEntry(qd_dev, &stuEntry);

	printk(KERN_ERR "    o Device ID     : 0x%x\n", qd_dev->deviceId);
	printk(KERN_ERR "    o No. of Ports  : %d\n", qd_dev->numOfPorts);
	printk(KERN_ERR "    o CPU Port      : %ld\n", qd_dev->cpuPortNum);

	qsgmii_module = mvBoardIsQsgmiiModuleConnected();
	if (qsgmii_module)
		printk(KERN_ERR "    o QSGMII Module Detected\n");

	gephy_on_port = mvBoardGePhySwitchPortGet();
	if (gephy_on_port >= 0)
		printk(KERN_ERR "    o Internal GE PHY Connected to Switch Port %d Detected\n", gephy_on_port);

	rgmiia_on_port = mvBoardRgmiiASwitchPortGet();
	if (rgmiia_on_port >= 0)
		printk(KERN_ERR "    o RGMII-A Connected to Switch Port %d Detected\n", rgmiia_on_port);

	/* disable all disconnected ports */
	for (p = 0; p < qd_dev->numOfPorts; p++) {
		/* Do nothing for ports that are not part of the given switch_port_mask */
		if (!MV_BIT_CHECK(switch_ports_mask, p))
			continue;

		if (mvBoardSwitchPortMap(MV_SWITCH_DEF_INDEX, p) != -1) {
			/* Switch port mapped to connector on the board */

			if ((gpcsSetFCValue(qd_dev, p, GT_FALSE) != GT_OK) ||
			    (gpcsSetForcedFC(qd_dev, p, GT_FALSE) != GT_OK)) {
				printk(KERN_ERR "Force Flow Control - Failed\n");
				return -1;
			}
#if 0
			/* TODO - decide if we want to enable auto-negotiation of Flow Control for external ports */
			if (qsgmii_module) {
				/* TODO - configure ports via QSGMII registers */
			} else {
				GT_STATUS status;

				status = gprtSetPause(qd_dev, p, GT_PHY_PAUSE);
				if (status != GT_OK)
					printk(KERN_ERR "Failed set pause for switch port #%d: status = %d\n", p, status);
			}
#endif
			continue;
		}

		if ((mvBoardSwitchConnectedPortGet(MV_ETH_PORT_0) == p) ||
		    (mvBoardSwitchConnectedPortGet(MV_ETH_PORT_1) == p)) {
			/* Switch port connected to GMAC - force link UP - 1000 Full with FC */
			printk(KERN_ERR "    o Setting Switch Port #%d connected to GMAC port for 1000 Full with FC\n", p);
			if (gpcsSetForceSpeed(qd_dev, p, PORT_FORCE_SPEED_1000_MBPS) != GT_OK) {
				printk(KERN_ERR "Force speed 1000mbps - Failed\n");
				return -1;
			}

			if ((gpcsSetDpxValue(qd_dev, p, GT_TRUE) != GT_OK) ||
			    (gpcsSetForcedDpx(qd_dev, p, GT_TRUE) != GT_OK)) {
				printk(KERN_ERR "Force duplex FULL - Failed\n");
				return -1;
			}

			if ((gpcsSetFCValue(qd_dev, p, GT_TRUE) != GT_OK) ||
			    (gpcsSetForcedFC(qd_dev, p, GT_TRUE) != GT_OK)) {
				printk(KERN_ERR "Force Flow Control - Failed\n");
				return -1;
			}

			if ((gpcsSetLinkValue(qd_dev, p, GT_TRUE) != GT_OK) ||
			    (gpcsSetForcedLink(qd_dev, p, GT_TRUE) != GT_OK)) {
				printk(KERN_ERR "Force Link UP - Failed\n");
				return -1;
			}
			continue;
		}
		printk(KERN_ERR "    o Disable disconnected Switch Port #%d and force link down\n", p);

		if (gstpSetPortState(qd_dev, p, GT_PORT_DISABLE) != GT_OK) {
			printk(KERN_ERR "gstpSetPortState failed\n");
			return -1;
		}
		if ((gpcsSetLinkValue(qd_dev, p, GT_FALSE) != GT_OK) ||
		    (gpcsSetForcedLink(qd_dev, p, GT_TRUE) != GT_OK)) {
			printk(KERN_ERR "Force Link DOWN - Failed\n");
			return -1;
		}
	}
	return 0;
}