Beispiel #1
0
int    mvUsbBackVoltageUpdate(int dev, MV_U8 gppNo)
{
    int     vbusChange = 0;
    MV_U32  gppData, regVal, gppInv;

    if(gppNo < 32)
    {
        gppInv = mvGppPolarityGet(0, (1 << gppNo));
        gppData = mvGppValueGet(0, (1 << gppNo));
    }
    else
    {
        gppInv = mvGppPolarityGet(1, (1 << (gppNo-32)));
        gppData = mvGppValueGet(1, (1 << (gppNo-32)));
    }
    regVal = MV_REG_READ(MV_USB_PHY_POWER_CTRL_REG(dev));

    if( (gppInv == 0) &&
            (gppData != 0) )
    {
        /* VBUS appear */
        regVal |= (7 << 24);

        if(gppNo < 32)
            gppInv |= (1 << gppNo);
        else
            gppInv |= (1 << (gppNo-32));

        /*mvOsPrintf("VBUS appear: dev=%d, gpp=%d\n", dev, gppNo);*/
        vbusChange = 1;
    }
    else if( (gppInv != 0) &&
             (gppData != 0) )
    {
        /* VBUS disappear */
        regVal &= ~(7 << 24);

        if(gppNo < 32)
            gppInv &= ~(1 << gppNo);
        else
            gppInv &= ~(1 << (gppNo-32));

        /*mvOsPrintf("VBUS disappear: dev=%d, gpp=%d\n", dev, gppNo);*/
        vbusChange = 2;
    }
    else
    {
        /* No changes */
        return vbusChange;
    }
    MV_REG_WRITE(MV_USB_PHY_POWER_CTRL_REG(dev), regVal);

    if(gppNo < 32)
        mvGppPolaritySet(0, (1<<gppNo), gppInv);
    else
        mvGppPolaritySet(1, (1<<(gppNo-32)), gppInv);

    return vbusChange;
}
MV_BOOL bfGppInRegBitTest(MV_32 bit)
{
	if (bit < 0)
		return MV_FALSE;

	if (bit < 32)
		return mvGppValueGet(0, BIT(bit)) ? MV_TRUE : MV_FALSE;
	else
		return mvGppValueGet(1, BIT(bit - 32)) ? MV_TRUE : MV_FALSE;
}
Beispiel #3
0
static MV_VOID gflt200BoardInit(MV_BOARD_INFO *pBoardInfo)
{
	MV_U32 board_ver;

	mvGppTypeSet(0, GFLT200_GPP_BOARD_VER_MASK, GFLT200_GPP_BOARD_VER_MASK);

	switch ((board_ver = mvGppValueGet(0, GFLT200_GPP_BOARD_VER_MASK))) {
	case GFLT200_EVT1_BOARD_VER:
		pBoardInfo->numBoardMppConfigValue
			= MV_ARRAY_SIZE(gflt200Evt1InfoBoardMppConfigValue);
		pBoardInfo->pBoardMppConfigValue
			= gflt200Evt1InfoBoardMppConfigValue;
		pBoardInfo->numBoardGppInfo
			= MV_ARRAY_SIZE(gflt200Evt1InfoBoardGppInfo),
		pBoardInfo->pBoardGppInfo = gflt200Evt1InfoBoardGppInfo,
		pBoardInfo->gppOutEnValLow = GFLT200_EVT1_GPP_OUT_ENA_LOW;
		pBoardInfo->gppOutEnValMid = GFLT200_EVT1_GPP_OUT_ENA_MID;
		pBoardInfo->gppOutValLow = GFLT200_EVT1_GPP_OUT_VAL_LOW;
		pBoardInfo->gppOutValMid = GFLT200_EVT1_GPP_OUT_VAL_MID;
		pBoardInfo->gppPolarityValLow = GFLT200_EVT1_GPP_POL_LOW;
		pBoardInfo->gppPolarityValMid = GFLT200_EVT1_GPP_POL_MID;
		break;

	default:
		pr_err("GFLT200: unknown board version '%x'\n", board_ver);
		/* fallthrough */
	case GFLT200_EVT2_BOARD_VER:
		pBoardInfo->numBoardMppConfigValue
			= MV_ARRAY_SIZE(gflt200Evt2InfoBoardMppConfigValue);
		pBoardInfo->pBoardMppConfigValue
			= gflt200Evt2InfoBoardMppConfigValue;
		pBoardInfo->numBoardGppInfo
			= MV_ARRAY_SIZE(gflt200Evt2InfoBoardGppInfo),
		pBoardInfo->pBoardGppInfo = gflt200Evt2InfoBoardGppInfo,
		pBoardInfo->gppOutEnValLow = GFLT200_EVT2_GPP_OUT_ENA_LOW;
		pBoardInfo->gppOutEnValMid = GFLT200_EVT2_GPP_OUT_ENA_MID;
		pBoardInfo->gppOutValLow = GFLT200_EVT2_GPP_OUT_VAL_LOW;
		pBoardInfo->gppOutValMid = GFLT200_EVT2_GPP_OUT_VAL_MID;
		pBoardInfo->gppPolarityValLow = GFLT200_EVT2_GPP_POL_LOW;
		pBoardInfo->gppPolarityValMid = GFLT200_EVT2_GPP_POL_MID;
		break;
	}
}